diff --git a/.c3i/authorized_users.yml b/.c3i/authorized_users.yml index 3c20b5b172cd0..6e6068e0e1187 100644 --- a/.c3i/authorized_users.yml +++ b/.c3i/authorized_users.yml @@ -1,933 +1,1051 @@ authorized_users: - - "github-actions[bot]" - - "conan-center-bot" - - "c3i-dev" - - "uilianries" - - "SSE4" - - "Croydon" - - "Johnnyxy" - - "solvingj" - - "ericLemanissier" - - "tru" - - "sztomi" - - "theodelrieu" - - "grafikrobot" - - "piponazo" - - "minimonium" - - "lasote" - - "danimtb" - - "memsharded" - - "jgsogo" - - "czoido" - - "jcar87" - - "theirix" - - "madebr" - - "sourcedelica" - - "obiltschnig" - - "martinmoene" - - "tonka3000" - - "leonardoarcari" - - "bmanga" - - "flexferrum" - - "gocarlos" - - "flostellbrink" - - "rvarago" - - "cqjjjzr" - - "akemimadoka" - - "bverhagen" - - "IceflowRE" - - "mjvk" - - "Morwenn" - - "Talkless" - - "sgiessl" - - "KristianJerpetjon" - - "paulbendixen" - - "datalogics-robb" - - "PinkySan" - - "keysight-daryl" - - "gunmetal313" - - "rdeterre" - - "Hopobcn" - - "rikdev" - - "arcadien" - - "aostrowski" - - "reneme" - - "abbyssoul" - - "ledocc" - - "fpelliccioni" - - "PierreRamoin" - - "yipdw" - - "soporide" - - "detwiler" - - "hrantzsch" - - "figroc" - - "robert-shade" - - "KaoCC" - - "planetmarshall" - - "cirla" - - "vaerizk" - - "Dattax" - - "TimSimpson" - - "intelligide" - - "ericriff" - - "renatofilho" - - "puetzk" - - "calvingiles" - - "raffienficiaud" - - "chfanghr" - - "dvirtz" - - "greenjava" - - "apeterson-branch" - - "david-sinuela-pix4d" - - "BlueSolei" - - "AndWass" - - "SpaceIm" - - "prsolucoes" - - "yssource" - - "dheater" - - "GavinNL" - - "sourcedelica" - - "kf6kjg" - - "StefansM" - - "Psy-Kai" - - "LunarWatcher" - - "nicoguillier" - - "a4z" - - "p-podsiadly" - - "tarc" - - "n-bes" - - "Manu343726" - - "greenrobot" - - "KingKili" - - "Adnn" - - "arnesor" - - "gummif" - - "btashton" - - "osfd" - - "maddanio" - - "likle" - - "mbodmer" - - "feragon" - - "claremacrae" - - "nicolastagliani" - - "samuelpmish" - - "Garcia6l20" - - "RemySphere" - - "pleroux0" - - "qchateau" - - "datalogics-kam" - - "tt4g" - - "akshit-sharma" - - "jargonzombies" - - "xqp" - - "alnkpa" - - "prince-chrismc" - - "bk2221" - - "igl42" - - "casabre" - - "Nipheris" - - "faker00t" - - "vvilpas" - - "fredrikslattman" - - "worldemar" - - "rurabori" - - "chhitz" - - "zod" - - "Twon" - - "miketsukerman" - - "mgoldshteyn" - - "dab0bby" - - "atilag" - - "floriansimon1" - - "jjkoshy" - - "kasunch" - - "mapau" - - "igor-sadchenko" - - "fulara" - - "BNL-Corp" - - "pyrige" - - "ZaMaZaN4iK" - - "rudolfheszele" - - "philburr" - - "vishsangale" - - "Artalus" - - "vanwinkeljan" - - "renatoGarcia" - - "Nekto89" - - "gonestco" - - "xyz1001" - - "axalon900" - - "jfalcou" - - "pss146" - - "zhenlei" - - "datalogics-aarroyo" - - "serpent7776" - - "AndrewMeadows" - - "neobrain" - - "oxycoder" - - "dvd0101" - - "anagno" - - "odygrd" - - "datalogics-kam" - - "ChaosWars" - - "ash7777" - - "csch0" - - "daixian" - - "Murazaki" - - "garethsb-sony" - - "Austin299792" - - "FranckRJ" - - "danielaparker" - - "0x8000-0000" - - "ah7675" - - "jmarrec" - - "icraggs" - - "davidtazy" - - "kchmck" - - "PavelKisliak" - - "vvandrounik" - - "pavanbadugu" - - "isnullxbh" - - "Michanne" - - "markusgod" - - "syoliver" - - "daravi" - - "museghost" - - "pezcode" - - "hnOsmium0001" - - "kaihowl" - - "deimi" - - "tomlankhorst" - - "frek818" - - "ddalcino" - - "saukijan" - - "sandro97git" - - "hoxnox" - - "madduci" - - "goranbrkic" - - "mohamedghita" - - "rweickelt" - - "faithfracture" - - "wolfee001" - - "empyrical" - - "birgerbr" - - "akosik-anyvision" - - "jeremy-coulon" - - "TheStormN" - - "gmgunter" - - "ibmibmibm" - - "daniellecandid" - - "AGreat1" - - "ytimenkov" - - "memchk" - - "lederernc" - - "lkotsonis" - - "DrewImm" - - "martin-schulze-vireso" - - "wdobbe" - - "Flow-It" - - "burace17" - - "sam-mosleh" - - "db4" - - "jaspervandeven" - - "DavidZemon" - - "yelu" - - "bibermann" - - "baltendorf" - - "Mahe-Thomas" - - "Eremiell" - - "d70-t" - - "ufkesba" - - "frtru" - - "Janos95" - - "siebenschlaefer" - - "marzer" - - "timblechmann" - - "dBagrat" - - "lemire" - - "talyz" - - "rconde01" - - "SemyonDuB" - - "reuk" - - "ppetraki" - - "ZachClayburn" - - "SergiusTheBest" - - "kirandivekar" - - "jaredkeithwhite" - - "DavidAce" - - "zhangyoufu" - - "nqle" - - "rushikesh90" - - "marcvilletard" - - "klimkin" - - "jheaff1" - - "Bigpet" - - "derived-coder" - - "thclark" - - "sielicki" - - "helmesjo" - - "dskachan" - - "johanneskares" - - "GirtsR" - - "greeng3" - - "mattgodbolt" - - "mathbunnyru" - - "ngerke" - - "TheLavaBlock" - - "greeng3" - - "ItsBasi" - - "yamadapc" - - "afedechko" - - "pmqtt" - - "uyha" - - "GIGte" - - "ctapmex" - - "ohanar" - - "bernedom" - - "ericniebler" - - "mmha" - - "mjvankampen" - - "ivan-kulikov-dev" - - "ntagliani" - - "bnlcorp" - - "Alberto-Izquierdo" - - "an-tao" - - "p-ranav" - - "omaralvarez" - - "djcsdy" - - "pepsiman" - - "Fefer-Ivan" - - "iblancasa" - - "dongskyler" - - "MartinDelille" - - "samr" - - "cen1" - - "stefan-floeren" - - "oleurodecision" - - "tbeu" - - "joxoby" - - "halfelf" - - "matt-42" - - "sunnycase" - - "ldobinson" - - "xiaotianrandom" - - "mpusz" - - "Erlkoenig90" - - "mzdun" - - "annulen" - - "fmorgner" - - "gmikhaile" - - "wwhuie" - - "kyllingstad" - - "desertfury" - - "yarrr-ru" - - "fschoenm" - - "bel2125" - - "melak47" - - "b1ackviking" - - "remysalim" - - "hosseinmoein" - - "illume" - - "srnwk" - - "boussaffawalid" - - "atrelinski" - - "Arenoros" - - "narcdev" - - "steinerthomas" - - "w4bremer" - - "ddark008" - - "andioz" - - "OleksiiKyslynskyi" - - "verybigbadboy" - - "bobrofon" - - "newlawrence" - - "ThomasHauth" - - "nicraMarcin" - - "dankamongmen" - - "davehadley" - - "G3nna" - - "dertuxmalwieder" - - "arlyon" - - "remiburtin" - - "mplemay" - - "mys007" - - "jwellbelove" - - "gopaldappdev" - - "ngrodzitski" - - "spjuanjoc" - - "hongyx11" - - "morth" - - "selaci" - - "hdhauk" - - "libbylg" - - "cacay" - - "fatliverfreddy" - - "dnck" - - "balintfodor" - - "blackliner" - - "HeinrichJanzing" - - "Nick-Deubert-Bose" - - "ruanformigoni" - - "CAMOBAP" - - "jwillikers" - - "bowb" - - "dsakurai" - - "dooho-h" - - "dmn-star" - - "avantgardnerio" - - "ShuangLiu1992" - - "justinmcbride" - - "resttime" - - "ubnt-kannan" - - "taoyouh" - - "skannan89" - - "paulo-coutinho" - - "AndreyMlashkin" - - "AndyMender" - - "triangulumlabs" - - "Woazim" - - "shubhamck" - - "Lukas-Heiligenbrunner" - - "marius-meissner" - - "Mikayex" - - "n-stone" - - "IvanRibakov" - - "dfontenot" - - "JonasProgrammer" - - "plopp" - - "sebastian-bergt" - - "xguerin" - - "Dobiasd" - - "ChGen" - - "Jonathan-Eid" - - "ihsandemir" - - "Marks101" - - "whuji" - - "jiangdawhy" - - "MichelleHetzel" - - "Pro" - - "anton-dirac" - - "petiaccja" - - "Expander" - - "kdsx" - - "wolfram77" - - "dsakilesh" - - "mdavezac" - - "Jihadist" - - "anton-danielsson" - - "rawbby" - - "wuzhiguocarter" - - "GaryN4" - - "TheSalvator" - - "fcelda" - - "toge" - - "maksim-0" - - "blackencino" - - "lukaszlaszko" - - "pichi-router" - - "dernasherbrezon" - - "bsergean" - - "krzysztof-jusiak" - - "riebl" - - "ruilvo" - - "jhurliman" - - "ralfholly" - - "MaxSac" - - "Linux13524" - - "IanE9" - - "upsj" - - "Hippskill" - - "ksamelyuk" - - "doshisahil" - - "FlayaN" - - "uglyog" - - "alex-87" - - "mologie" - - "ChatPion" - - "heyzooi" - - "Firefly35" - - "maxmouchet" - - "dvj" - - "bitwizeshift" - - "ondrej-outrata" - - "rileylev" - - "ltjax" - - "sloriot" - - "wbitesi" - - "canmor" - - "whyman" - - "garethsb" - - "sixten-hilborn" - - "qoelet" - - "lawrence-koh" - - "adrianjrg" - - "ayeganov" - - "tetsuo-cpp" - - "AlvaroFS" - - "ivabrajer" - - "kebadopp" - - "qoo2p5" - - "aapocketz" - - "mbeutel" - - "redradist" - - "accwebs" - - "ZombieRaccoon" - - "hoyes" - - "rtosman" - - "ivalery111" - - "krsch" - - "jothepro" - - "Jean1995" - - "tomas-krupa" - - "ollien" - - "tupini07" - - "yuanliuus" - - "luismartingil" - - "mydatamodels" - - "pixsperdavid" - - "rockdreamer" - - "jpilet" - - "voidbar" - - "jayaramganapathy" - - "AJIOB" - - "th-lp" - - "penfeizhou" - - "tapia" - - "igormironchik" - - "rkozakban" - - "avsej" - - "jakecobb" - - "johnmcfarlane" - - "FernandoVelcic" - - "LHLaurini" - - "dotChris90" - - "mymichu" - - "i-vovk" - - "lakinwecker" - - "hpesoj" - - "shiena" - - "aurelienpre" - - "lieser" - - "zspasztori" - - "HRenata" - - "alejandro-colomar" - - "leha-bot" - - "werto87" - - "cguentherTUChemnitz" - - "mmatrosov" - - "cesenaLA" - - "chgans" - - "sabelka" - - "stefled" - - "PengZheng" - - "mez" - - "beckerhe" - - "serszab" - - "mtrzas" - - "zuut" - - "JohanZackrisson" - - "VladimirVR" - - "franramirez688" - - "nicholas-kelly" - - "yemreinci" - - "alvarogarcia7" - - "daniele77" - - "Renari" - - "AlexanderLanin" - - "Guyutongxue" - - "rockandsalt" - - "thmahe" - - "slietzau" - - "fennibay" - - "Konard" - - "uselessgoddess" - - "espositofulvio" - - "Elnee" - - "tisonkun" - - "AshleyRoll" - - "inparallel" - - "vcampmany" - - "3d4m-vladimir" - - "thesummer" - - "NolanC33" - - "Chnossos" - - "spaque-qustodio" - - "maxis11" - - "cqc-alec" - - "Zugzwanger" - - "maspri" - - "ghorbanzade" - - "pchamuczynski" - - "Sahnvour" - - "torfinnberset" - - "davidsanfal" - - "COM8" - - "seladb" - - "vvarma" - - "smsm2014" - - "jngrb" - - "dilawar" - - "cbachhuber" - - "mmatisko" - - "sparik" - - "samuel-emrys" - - "lordafzal" - - "jayvdb" - - "wwizz" - - "sh0" - - "jtorresfabra" - - "Snowapril" - - "ryanseipp" - - "exief" - - "Lemiort" - - "tcanabrava" - - "k0ekk0ek" - - "gerd2s" - - "Divix55" - - "hannahwhy" - - "zodinyac" - - "claudius-kienle" - - "choll" - - "erikzenker" - - "dannftk" - - "Jairard" - - "Nicky-D" - - "pgeler" - - "gmeeker" - - "gokhanettin" - - "emwap" - - "vbieleny" - - "FusionBolt" - - "krotitom-embedded" - - "SamsonBox" - - "SkillerRaptor" - - "KerstinKeller" - - "hemantkashniyal" - - "ThePirate42" - - "jhabermas" - - "TheClonerx" - - "FMeinicke" - - "isidore" - - "corporategoth" - - "nightlark" - - "jpauwels" - - "LighthouseJ" - - "vbeffara" - - "ChrisRuff" - - "eigenwhat" - - "samvik" - - "xissburg" - - "SuTanTank" - - "bemehiser" - - "szavadsky" - - "nfrechette" - - "patmantru" - - "kenfred" - - "coryan" - - "ciclark2" - - "serge1" - - "PatSche" - - "Mo-Tay" - - "kexianda" - - "dvetutnev" - - "mwcondino" - - "YaZasnyal" - - "walterbrebels" - - "tuxu" - - "dev-plvlml" - - "woidpointer" - - "dkruempe" - - "ehds" - - "sase-cs" - - "idealvin" - - "seemk" - - "chausner" - - "loic-lopez" - - "PolyPik" - - "fdgStilla" - - "jputcu" - - "ivmai" - - "Speak2Erase" - - "miklelappo" - - "ivanvurbanov" - - "cc0der" - - "kubasz" - - "killzoner" - - "MathiasDanzeisen" - - "mosure" - - "avitevet" - - "AntonHorbach" - - "darcamo" - - "DonOregano" - - "sebastianbergt" - - "yuriy-mochurad" - - "jtcarnes" - - "ValentiWorkLearning" - - "eyalroz" - - "Zvicii" - - "SteelBlueVision" - - "Fettpet" - - "sobotklp" - - "andiwand" - - "pdavydov108" - - "gjasny" - - "eirikb" - - "wpalfi" - - "vkes" - - "wouterz" - - "szigetics" - - "kovdan01" - - "willadsen" - - "michalwidera" - - "FlexW" - - "wizardsd" - - "eeyrw" - - "nioncode" - - "Kr4is" - - "tonyseek" - - "kevswims" - - "Tarek-Hasan" - - "SerkanTuerker" - - "Carsten87" - - "aacebedo" - - "maximiliank" - - "drmacdon" - - "somedevfox" - - "Zeeno-atl" - - "hardsetting" - - "friendlyanon" - - "MrLIk" - - "OrianeGourdyStilla" - - "chusitoo" - - "csegarragonz" - - "dean0x7d" - - "MauriceS-WTI" - - "Lorac" - - "sonicxml" - - "elazarl" - - "synacker" - - "jtbandes" - - "gouriano" - - "hiemstar" - - "Enhex" - - "luk1337" - - "ChristianPanov" - - "JurajX" - - "pedro-alves-ferreira" - - "BenjaminNavarro" - - "sophieeihpos" - - "jowr" - - "aruizs" - - "pbreaux" - - "fardragon" - - "njacquemin1993" - - "earonesty" - - "capnkenny" - - "kring" - - "sanblch" - - "winternet" - - "jlouazel" - - "JonathanGirardeau" - - "BishopJohnson" - - "Tzoockee" - - "PeteAudinate" - - "Cyriuz" - - "ArashPartow" - - "dpronin" - - "The-EDev" - - "artem-ogre" - - "krzysztofskorupski" - - "jt416" - - "Pollux42" - - "gracicot" - - "Siviuze" - - "ggulgulia" - - "ondrej-benus" - - "RubyNova" - - "HerrNamenlos123" - - "naresh97" - - "rnapier" - - "eerimoq" - - "bb010g" - - "paulocoutinhox" - - "WilliamBehrens" - - "greg7mdp" - - "ruurdadema" - - "steromano87" - - "marsven" - - "DS-Serafin" - - "DS-Alex-AG" - - "cbeattie-tl" - - "0x28" - - "nmgwddj" - - "brandonmkunkel" - - "MykolaPu" - - "petamas" - - "icarusdes" - - "the-nic" - - "zjg" - - "rfn123" - - "icedream2linxi" - - "MikeLankamp" - - "AnotherFoxGuy" - - "fdefelici" - - "basiliscos" - - "svenpilz" - - "sfackler" - - "AnticliMaxtic" - - "serghov" - - "erikogenvik" - - "dssimonspoerri" - - "bysnack" - - "hannesa2" - - "Aypahyo" - - "chausner-audeering" - - "gleb-kov" - - "Yen5666" - - "jkimblad" - - "impugachev" - - "sebhmg" - - "sujankota" - - "5chmidti" - - "l2dy" - - "DamDsj" - - "Anokhi1994" - - "mscofield0" - - "alex-700" - - "StellaSmith" - - "buresu" - - "yzsolt" - - "aborzunov" - - "jsantorek" - - "tmartiel" - - "rbrich" - - "HappySeaFox" - - "hlewin" - - "victor1234" - - "nextsilicon-itay-bookstein" - - "ekondis" - - "luizgabriel" - - "kshehata" - - "dietssa" - - "simoncent" - - "staskau" - - "Iswenzz" - - "DAP-IT-Aachen" - - "VladyslavUsenko" - - "vdsbenoit" - - "Macfly" - - "hesham-essam" - - "mkviatkovskii" - - "sgoth" - - "hellozee" - - "Ryan-rsm-McKenzie" - - "bog-dan-ro" - - "dennisjosesilva" - - "bartop" - - "cameron-devine" - - "wadimklincov" - - "vectorsli" - - "paulharris" - - "pbailey-hf" - - "Cogitri" - - "Sil3ntStorm" - - "jstzwj" - - "eseiler" - - "npuichigo" - - "dfleury2" - - "bigerl" - - "EKathe" - - "hmartinez82" - - "sfc-gh-mpilman" - - "apogza" - - "ameysutavani" - - "sify21" - - "eigenraven" - - "jay-tux" - - "baptisteesteban" - - "chenpengfei" - - "minlexx" - - "kou" - - "0xbk" - - "dsche" - - "tk-tnz" - - "strangeQuark1041" - - "tuduongquyet" - - "lbakman" - - "gogoprog" - - "mvhv" - - "FreePhoenix888" - - "tuccio" - - "martinvl" - - "robomics" - - "EricDeng1001" - - "agom" - - "tsondergaard" - - "xhuohai" - - "Mitron57" - - "EstebanDugueperoux2" - - "suhasHere" - - "Tradias" - - "NeXuS4Developer" - - "jellespijker" - - "bshoshany" - - "Chrismarsh" - - "ice0" - - "krjakbrjak" - - "romariorios" - - "Latios96" - - "0xFireWolf" - - "ashkulz" - - "kenneth-jia" - - "jnordin20" - - "jubalh" - - "joaotavora" - - "VestniK" - - "sheepgrass" - - "allen-zhou-dev" - - "daemyung" - - "szmyd" - - "lo1ol" - - "victorpaleologue" - - "FaerHack" - - "netheril96" - - "atimin" - - "ssophie01" - - "mietzen" - - "mourogurt" - - "hoisunng" - - "abouvier" - - "jadamwilson2" - - "nilsnolde" - - "olivia76" - - "CD3" - - "ovostrikov" - - "t-8ch" - - "ingydotnet" - - "SirCosty" - - "mvoelkle-cern" - - "markferry" - - "mttbernardini" - - "ofiriluz" - - "ksmets" - - "jonathan-conder-sm" - - "Bueddl" - - "dornbirndevelops" - - "boofhead" - - "marcusl" - - "Makamitsu" - - "ulrichji" - - "kammce" - - "tomconder" - - "horusxnetworks" - - "maksim-petukhov" - - "Nomalah" - - "kambala-decapitator" - - "rainman110" - - "jiangshipengv8" - - "BjoernAtBosch" - - "dubvulture" - - "ZbigniewRA" - - "JorgenPo" - - "AlexRamallo" - - "kissandras" +- github-actions[bot] +- conan-center-bot +- c3i-dev +- uilianries +- SSE4 +- Croydon +- Johnnyxy +- solvingj +- ericLemanissier +- tru +- sztomi +- theodelrieu +- grafikrobot +- piponazo +- minimonium +- lasote +- danimtb +- memsharded +- jgsogo +- czoido +- jcar87 +- theirix +- madebr +- sourcedelica +- obiltschnig +- martinmoene +- tonka3000 +- leonardoarcari +- bmanga +- flexferrum +- gocarlos +- flostellbrink +- rvarago +- cqjjjzr +- akemimadoka +- bverhagen +- IceflowRE +- mjvk +- Morwenn +- Talkless +- sgiessl +- KristianJerpetjon +- paulbendixen +- datalogics-robb +- PinkySan +- keysight-daryl +- gunmetal313 +- rdeterre +- Hopobcn +- rikdev +- arcadien +- aostrowski +- reneme +- abbyssoul +- ledocc +- fpelliccioni +- PierreRamoin +- yipdw +- soporide +- detwiler +- hrantzsch +- figroc +- robert-shade +- KaoCC +- planetmarshall +- cirla +- vaerizk +- Dattax +- TimSimpson +- intelligide +- ericriff +- renatofilho +- puetzk +- calvingiles +- raffienficiaud +- chfanghr +- dvirtz +- greenjava +- apeterson-branch +- david-sinuela-pix4d +- BlueSolei +- AndWass +- SpaceIm +- prsolucoes +- yssource +- dheater +- GavinNL +- sourcedelica +- kf6kjg +- StefansM +- Psy-Kai +- LunarWatcher +- nicoguillier +- a4z +- p-podsiadly +- tarc +- n-bes +- Manu343726 +- greenrobot +- KingKili +- Adnn +- arnesor +- gummif +- btashton +- osfd +- maddanio +- likle +- mbodmer +- feragon +- claremacrae +- nicolastagliani +- samuelpmish +- Garcia6l20 +- RemySphere +- pleroux0 +- qchateau +- datalogics-kam +- tt4g +- akshit-sharma +- jargonzombies +- xqp +- alnkpa +- prince-chrismc +- bk2221 +- igl42 +- casabre +- Nipheris +- faker00t +- vvilpas +- fredrikslattman +- worldemar +- rurabori +- chhitz +- zod +- Twon +- miketsukerman +- mgoldshteyn +- dab0bby +- atilag +- floriansimon1 +- jjkoshy +- kasunch +- mapau +- igor-sadchenko +- fulara +- BNL-Corp +- pyrige +- ZaMaZaN4iK +- rudolfheszele +- philburr +- vishsangale +- Artalus +- vanwinkeljan +- renatoGarcia +- Nekto89 +- gonestco +- xyz1001 +- axalon900 +- jfalcou +- pss146 +- zhenlei +- datalogics-aarroyo +- serpent7776 +- AndrewMeadows +- neobrain +- oxycoder +- dvd0101 +- anagno +- odygrd +- datalogics-kam +- ChaosWars +- ash7777 +- csch0 +- daixian +- Murazaki +- garethsb-sony +- Austin299792 +- FranckRJ +- danielaparker +- 0x8000-0000 +- ah7675 +- jmarrec +- icraggs +- davidtazy +- kchmck +- PavelKisliak +- vvandrounik +- pavanbadugu +- isnullxbh +- Michanne +- markusgod +- syoliver +- daravi +- museghost +- pezcode +- hnOsmium0001 +- kaihowl +- deimi +- tomlankhorst +- frek818 +- ddalcino +- saukijan +- sandro97git +- hoxnox +- madduci +- goranbrkic +- mohamedghita +- rweickelt +- faithfracture +- wolfee001 +- empyrical +- birgerbr +- akosik-anyvision +- jeremy-coulon +- TheStormN +- gmgunter +- ibmibmibm +- daniellecandid +- AGreat1 +- ytimenkov +- memchk +- lederernc +- lkotsonis +- DrewImm +- martin-schulze-vireso +- wdobbe +- Flow-It +- burace17 +- sam-mosleh +- db4 +- jaspervandeven +- DavidZemon +- yelu +- bibermann +- baltendorf +- Mahe-Thomas +- Eremiell +- d70-t +- ufkesba +- frtru +- Janos95 +- siebenschlaefer +- marzer +- timblechmann +- dBagrat +- lemire +- talyz +- rconde01 +- SemyonDuB +- reuk +- ppetraki +- ZachClayburn +- SergiusTheBest +- kirandivekar +- jaredkeithwhite +- DavidAce +- zhangyoufu +- nqle +- rushikesh90 +- marcvilletard +- klimkin +- jheaff1 +- Bigpet +- derived-coder +- thclark +- sielicki +- helmesjo +- dskachan +- johanneskares +- GirtsR +- greeng3 +- mattgodbolt +- mathbunnyru +- ngerke +- TheLavaBlock +- greeng3 +- ItsBasi +- yamadapc +- afedechko +- pmqtt +- uyha +- GIGte +- ctapmex +- ohanar +- bernedom +- ericniebler +- mmha +- mjvankampen +- ivan-kulikov-dev +- ntagliani +- bnlcorp +- Alberto-Izquierdo +- an-tao +- p-ranav +- omaralvarez +- djcsdy +- pepsiman +- Fefer-Ivan +- iblancasa +- dongskyler +- MartinDelille +- samr +- cen1 +- stefan-floeren +- oleurodecision +- tbeu +- joxoby +- halfelf +- matt-42 +- sunnycase +- ldobinson +- xiaotianrandom +- mpusz +- Erlkoenig90 +- mzdun +- annulen +- fmorgner +- gmikhaile +- wwhuie +- kyllingstad +- desertfury +- yarrr-ru +- fschoenm +- bel2125 +- melak47 +- b1ackviking +- remysalim +- hosseinmoein +- illume +- srnwk +- boussaffawalid +- atrelinski +- Arenoros +- narcdev +- steinerthomas +- w4bremer +- ddark008 +- andioz +- OleksiiKyslynskyi +- verybigbadboy +- bobrofon +- newlawrence +- ThomasHauth +- nicraMarcin +- dankamongmen +- davehadley +- G3nna +- dertuxmalwieder +- arlyon +- remiburtin +- mplemay +- mys007 +- jwellbelove +- gopaldappdev +- ngrodzitski +- spjuanjoc +- hongyx11 +- morth +- selaci +- hdhauk +- libbylg +- cacay +- fatliverfreddy +- dnck +- balintfodor +- blackliner +- HeinrichJanzing +- Nick-Deubert-Bose +- ruanformigoni +- CAMOBAP +- jwillikers +- bowb +- dsakurai +- dooho-h +- dmn-star +- avantgardnerio +- ShuangLiu1992 +- justinmcbride +- resttime +- ubnt-kannan +- taoyouh +- skannan89 +- paulo-coutinho +- AndreyMlashkin +- AndyMender +- triangulumlabs +- Woazim +- shubhamck +- Lukas-Heiligenbrunner +- marius-meissner +- Mikayex +- n-stone +- IvanRibakov +- dfontenot +- JonasProgrammer +- plopp +- sebastian-bergt +- xguerin +- Dobiasd +- ChGen +- Jonathan-Eid +- ihsandemir +- Marks101 +- whuji +- jiangdawhy +- MichelleHetzel +- Pro +- anton-dirac +- petiaccja +- Expander +- kdsx +- wolfram77 +- dsakilesh +- mdavezac +- Jihadist +- anton-danielsson +- rawbby +- wuzhiguocarter +- GaryN4 +- TheSalvator +- fcelda +- toge +- maksim-0 +- blackencino +- lukaszlaszko +- pichi-router +- dernasherbrezon +- bsergean +- krzysztof-jusiak +- riebl +- ruilvo +- jhurliman +- ralfholly +- MaxSac +- Linux13524 +- IanE9 +- upsj +- Hippskill +- ksamelyuk +- doshisahil +- FlayaN +- uglyog +- alex-87 +- mologie +- ChatPion +- heyzooi +- Firefly35 +- maxmouchet +- dvj +- bitwizeshift +- ondrej-outrata +- rileylev +- ltjax +- sloriot +- wbitesi +- canmor +- whyman +- garethsb +- sixten-hilborn +- qoelet +- lawrence-koh +- adrianjrg +- ayeganov +- tetsuo-cpp +- AlvaroFS +- ivabrajer +- kebadopp +- qoo2p5 +- aapocketz +- mbeutel +- redradist +- accwebs +- ZombieRaccoon +- hoyes +- rtosman +- ivalery111 +- krsch +- jothepro +- Jean1995 +- tomas-krupa +- ollien +- tupini07 +- yuanliuus +- luismartingil +- mydatamodels +- pixsperdavid +- rockdreamer +- jpilet +- voidbar +- jayaramganapathy +- AJIOB +- th-lp +- penfeizhou +- tapia +- igormironchik +- rkozakban +- avsej +- jakecobb +- johnmcfarlane +- FernandoVelcic +- LHLaurini +- dotChris90 +- mymichu +- i-vovk +- lakinwecker +- hpesoj +- shiena +- aurelienpre +- lieser +- zspasztori +- HRenata +- alejandro-colomar +- leha-bot +- werto87 +- cguentherTUChemnitz +- mmatrosov +- cesenaLA +- chgans +- sabelka +- stefled +- PengZheng +- mez +- beckerhe +- serszab +- mtrzas +- zuut +- JohanZackrisson +- VladimirVR +- franramirez688 +- nicholas-kelly +- yemreinci +- alvarogarcia7 +- daniele77 +- Renari +- AlexanderLanin +- Guyutongxue +- rockandsalt +- thmahe +- slietzau +- fennibay +- Konard +- uselessgoddess +- espositofulvio +- Elnee +- tisonkun +- AshleyRoll +- inparallel +- vcampmany +- 3d4m-vladimir +- thesummer +- NolanC33 +- Chnossos +- spaque-qustodio +- maxis11 +- cqc-alec +- Zugzwanger +- maspri +- ghorbanzade +- pchamuczynski +- Sahnvour +- torfinnberset +- davidsanfal +- COM8 +- seladb +- vvarma +- smsm2014 +- jngrb +- dilawar +- cbachhuber +- mmatisko +- sparik +- samuel-emrys +- lordafzal +- jayvdb +- wwizz +- sh0 +- jtorresfabra +- Snowapril +- ryanseipp +- exief +- Lemiort +- tcanabrava +- k0ekk0ek +- gerd2s +- Divix55 +- hannahwhy +- zodinyac +- claudius-kienle +- choll +- erikzenker +- dannftk +- Jairard +- Nicky-D +- pgeler +- gmeeker +- gokhanettin +- emwap +- vbieleny +- FusionBolt +- krotitom-embedded +- SamsonBox +- SkillerRaptor +- KerstinKeller +- hemantkashniyal +- ThePirate42 +- jhabermas +- TheClonerx +- FMeinicke +- isidore +- corporategoth +- nightlark +- jpauwels +- LighthouseJ +- vbeffara +- ChrisRuff +- eigenwhat +- samvik +- xissburg +- SuTanTank +- bemehiser +- szavadsky +- nfrechette +- patmantru +- kenfred +- coryan +- ciclark2 +- serge1 +- PatSche +- Mo-Tay +- kexianda +- dvetutnev +- mwcondino +- YaZasnyal +- walterbrebels +- tuxu +- dev-plvlml +- woidpointer +- dkruempe +- ehds +- sase-cs +- idealvin +- seemk +- chausner +- loic-lopez +- PolyPik +- fdgStilla +- jputcu +- ivmai +- Speak2Erase +- miklelappo +- ivanvurbanov +- cc0der +- kubasz +- killzoner +- MathiasDanzeisen +- mosure +- avitevet +- AntonHorbach +- darcamo +- DonOregano +- sebastianbergt +- yuriy-mochurad +- jtcarnes +- ValentiWorkLearning +- eyalroz +- Zvicii +- SteelBlueVision +- Fettpet +- sobotklp +- andiwand +- pdavydov108 +- gjasny +- eirikb +- wpalfi +- vkes +- wouterz +- szigetics +- kovdan01 +- willadsen +- michalwidera +- FlexW +- wizardsd +- eeyrw +- nioncode +- Kr4is +- tonyseek +- kevswims +- Tarek-Hasan +- SerkanTuerker +- Carsten87 +- aacebedo +- maximiliank +- drmacdon +- somedevfox +- Zeeno-atl +- hardsetting +- friendlyanon +- MrLIk +- OrianeGourdyStilla +- chusitoo +- csegarragonz +- dean0x7d +- MauriceS-WTI +- Lorac +- sonicxml +- elazarl +- synacker +- jtbandes +- gouriano +- hiemstar +- Enhex +- luk1337 +- ChristianPanov +- JurajX +- pedro-alves-ferreira +- BenjaminNavarro +- sophieeihpos +- jowr +- aruizs +- pbreaux +- fardragon +- njacquemin1993 +- earonesty +- capnkenny +- kring +- sanblch +- winternet +- jlouazel +- JonathanGirardeau +- BishopJohnson +- Tzoockee +- PeteAudinate +- Cyriuz +- ArashPartow +- dpronin +- The-EDev +- artem-ogre +- krzysztofskorupski +- jt416 +- Pollux42 +- gracicot +- Siviuze +- ggulgulia +- ondrej-benus +- RubyNova +- HerrNamenlos123 +- naresh97 +- rnapier +- eerimoq +- bb010g +- paulocoutinhox +- WilliamBehrens +- greg7mdp +- ruurdadema +- steromano87 +- marsven +- DS-Serafin +- DS-Alex-AG +- cbeattie-tl +- '0x28' +- nmgwddj +- brandonmkunkel +- MykolaPu +- petamas +- icarusdes +- the-nic +- zjg +- rfn123 +- icedream2linxi +- MikeLankamp +- AnotherFoxGuy +- fdefelici +- basiliscos +- svenpilz +- sfackler +- AnticliMaxtic +- serghov +- erikogenvik +- dssimonspoerri +- bysnack +- hannesa2 +- Aypahyo +- chausner-audeering +- gleb-kov +- Yen5666 +- jkimblad +- impugachev +- sebhmg +- sujankota +- 5chmidti +- l2dy +- DamDsj +- Anokhi1994 +- mscofield0 +- alex-700 +- StellaSmith +- buresu +- yzsolt +- aborzunov +- jsantorek +- tmartiel +- rbrich +- HappySeaFox +- hlewin +- victor1234 +- nextsilicon-itay-bookstein +- ekondis +- luizgabriel +- kshehata +- dietssa +- simoncent +- staskau +- Iswenzz +- DAP-IT-Aachen +- VladyslavUsenko +- vdsbenoit +- Macfly +- hesham-essam +- mkviatkovskii +- sgoth +- hellozee +- Ryan-rsm-McKenzie +- bog-dan-ro +- dennisjosesilva +- bartop +- cameron-devine +- wadimklincov +- vectorsli +- paulharris +- pbailey-hf +- Cogitri +- Sil3ntStorm +- jstzwj +- eseiler +- npuichigo +- dfleury2 +- bigerl +- EKathe +- hmartinez82 +- sfc-gh-mpilman +- apogza +- ameysutavani +- sify21 +- eigenraven +- jay-tux +- baptisteesteban +- chenpengfei +- minlexx +- kou +- 0xbk +- dsche +- tk-tnz +- strangeQuark1041 +- tuduongquyet +- lbakman +- gogoprog +- mvhv +- FreePhoenix888 +- tuccio +- martinvl +- robomics +- EricDeng1001 +- agom +- tsondergaard +- xhuohai +- Mitron57 +- EstebanDugueperoux2 +- suhasHere +- Tradias +- NeXuS4Developer +- jellespijker +- bshoshany +- Chrismarsh +- ice0 +- krjakbrjak +- romariorios +- Latios96 +- 0xFireWolf +- ashkulz +- kenneth-jia +- jnordin20 +- jubalh +- joaotavora +- VestniK +- sheepgrass +- allen-zhou-dev +- daemyung +- szmyd +- lo1ol +- victorpaleologue +- FaerHack +- netheril96 +- atimin +- ssophie01 +- mietzen +- mourogurt +- hoisunng +- abouvier +- jadamwilson2 +- nilsnolde +- olivia76 +- CD3 +- ovostrikov +- t-8ch +- ingydotnet +- SirCosty +- mvoelkle-cern +- markferry +- mttbernardini +- ofiriluz +- ksmets +- jonathan-conder-sm +- Bueddl +- dornbirndevelops +- boofhead +- marcusl +- Makamitsu +- ulrichji +- kammce +- tomconder +- horusxnetworks +- Nomalah +- kambala-decapitator +- rainman110 +- jiangshipengv8 +- BjoernAtBosch +- dubvulture +- ZbigniewRA +- JorgenPo +- AlexRamallo +- kissandras +- scandyna +- jave27 +- mark0n +- kayoub5 +- topheg +- curoky +- datalogics-saharay +- sproberts92 +- madhat1 +- vince-cheung +- mariopil +- PikachuHyA +- System-Arch +- sorny92 +- cubanpit +- winterz +- Kidsunbo +- antony-jr +- tankeco +- ElliotMugner +- jfaust +- morningstar1 +- lrineau +- jwidauer +- partiallyderived +- Ahajha +- mjimenofluendo +- jiaoew1991 +- ramin-raeisi +- schoetbi +- psyinf +- Novakov +- maksim-petukhov +- roedhaetten +- nassipkali +- petrovito +- razielxyz +- da1910 +- RazielXYZ +- EmilienBINET +- Doome161 +- Sneder89 +- connorsmacd +- jshanab +- ghost +- zamazan4ik +- elliotcmorris +- Ignition +- je894591 +- AlexandrePTJ +- peterSW +- shiyj +- KGrzeg +- goodtune +- theartful +- Yuhanun +- feltech +- geirhei +- Clueliss +- andrewwasielewski +- chatpion +- kletoz +- agilemapper +- ZXfkSIE +- RubenRBS +- Alex-PLACET +- antekone +- ambroff +- tiolan +- MateuszMiekicki +- EricAtORS +- calebkiage +- bennyhuo +- ashuels +- jjcasmar +- kaipenglu +- ashley-b +- psmitsu +- Viatorus +- mkoviazin +- shtanko-sv +- larshg +- Wuqiqi123 +- OzanCansel +- marlamb +- alexsmedin +- n-morales +- calebgray +- technic +- guillaume-michel +- okaerin +- marknefedov +- jmaillard01 +- hpe-ykoehler +- dbarkar +- weinhold +- activtrak-dsalemizadeh +- axxel +- nicosmd +- impegoraro +- lukaumi +- mkmkme +- hobbeshunter +- rturrado +- wadehunk +- yekmen +- rechbergera +- hedtke +- Loki-Astari +- robbeykaaso +- LevWi +- Tsche +- Seadex-GmbH +- art-ignatev +- MrSparc +- ahmed192a +- maxpagani +- tim-goto +- tannerbitz diff --git a/.c3i/conan_v2_ready_references.yml b/.c3i/conan_v2_ready_references.yml new file mode 100644 index 0000000000000..b3a4fe9ed3e52 --- /dev/null +++ b/.c3i/conan_v2_ready_references.yml @@ -0,0 +1,26 @@ +required_for_references: + - asio + - b2 + - bzip2 + - boost + - catch2 + - cmake + - eigen + - flex + - fmt + - gtest + - jsoncpp + - libbacktrace + - libelf + - libiconv + - ninja + - nlohmann_json +# - openssl ? 3.0.0 version still not working + - ogg + - pcre2 + - rapidjson + - sqlite3 + - yaml-cpp + - xz_utils + - zlib + - zstd diff --git a/.c3i/config_v1.yml b/.c3i/config_v1.yml index 0495513380bba..52508b8fdc61e 100644 --- a/.c3i/config_v1.yml +++ b/.c3i/config_v1.yml @@ -3,7 +3,7 @@ id: 'conan-io/conan-center-index' conan: - version: 1.51.3 + version: 1.59.0 artifactory: url: "https://c3i.jfrog.io/c3i" @@ -16,16 +16,6 @@ artifactory: github: reviewers: "reviewers.yml" authorized_users: "authorized_users.yml" - check_runs: - - "Lint changed files (YAML files)" - - "Lint changed conanfile.py (v2 migration)" - -# Requirements to merge a given pull-request: -# * status_checks refers to notifications coming from external tools (Jenkins, CLA,...) -# * check_runs refers to notifications from GH actions -status_checks: - - "license/cla" - - "continuous-integration/jenkins/pr-merge" slack: credential_success_url: SLACK_SUCCESS_WEBHOOK_URL @@ -33,13 +23,37 @@ slack: # Things related to Jenkins jobs tasks: - conan_v2_run_export: true - write_comments: true - detailed_status_checks: true - update_labels: true + access_request: + request_issue_url: https://github.com/conan-io/conan-center-index/issues/4 + max_inactivity_days: 0 automatic_merge: reviews_required_total: 2 # Reviews that a PR needs so it can be merged reviews_required_team: 1 # Reviews from the Conan team that a PR needs so it can be merged + branches: # PRs from automations that have these as base-branches will be merged automatically + - "conan-io:action-doc-toc" + # Requirements to merge a given pull-request: + # * check_runs refers to notifications from GH actions + # * status_checks refers to notifications coming from external tools (Jenkins, CLA,...) + check_runs: + - name: "Lint changed files (YAML files)" + - name: "Lint changed conanfile.py (v2 migration)" + status_checks: + - name: "license/cla" + - name: "continuous-integration/jenkins/pr-merge" + - name: "c3i/conan-v2/pr-merge" + required_for_references: "conan_v2_ready_references.yml" + cci: + conan_v2_run_export: false + write_comments: true + detailed_status_checks: true + update_labels: true + wait_for_multibranch: # CCI jobs should wait for other multibranch job for that same PR + job_name: "prod-v2/cci" # e.g. "cci-v2/cci" -> this means waiting for cci-v2/cci/PR- + timeout_seconds: 600 # Maximum time to wait for the multibranch job + merge_messages: true # Merge messages from the multibranch job waited for + scheduled_export_check: + report_issue_url: https://github.com/conan-io/conan-center-index/issues/2232 + report_issue_append: false # Profile configurations to build packages configurations: @@ -159,7 +173,7 @@ node_labels: Windows: x86_64: "Visual Studio": - default: "windows20220803" + default: "windows20221212" Macos: x86_64: "apple-clang": diff --git a/.c3i/config_v2.yml b/.c3i/config_v2.yml index b63fb15a0d2e9..0062897c30594 100644 --- a/.c3i/config_v2.yml +++ b/.c3i/config_v2.yml @@ -1,13 +1,13 @@ --- -# Configuration for `https://github.com/conan-io/conan-center-index-staging` repository (using Conan v2) -id: 'conan-io/conan-center-index-staging-v2' +# Configuration for `https://github.com/conan-io/conan-center-index` repository (using Conan v2) +id: 'conan-io/conan-center-index' conan: - version: 2.0.0-pre + version: 2.0.0 artifactory: url: "https://c3i.jfrog.io/c3i" - main_repo: "conan-center-v2" + main_repo: "conan-center" pull-request_repo_prefix: "c3i_PR-v2" pull-request_permission: "c3i-pr" logs_repo: "misc-v2" @@ -17,29 +17,36 @@ github: reviewers: "reviewers.yml" authorized_users: "authorized_users.yml" -# Requirements to merge a given pull-request: -# * status_checks refers to notifications coming from external tools (Jenkins, CLA,...) -# * check_runs refers to notifications from GH actions -#status_checks: -# - "license/cla" -# - "continuous-integration/jenkins/pr-merge" - #slack: # credential_success_url: SLACK_SUCCESS_WEBHOOK_URL # ceredential_errors_url: SLACK_FAILURE_WEBHOOK_URL # Things related to Jenkins jobs: tasks: - write_comments: false - detailed_status_checks: false - update_labels: false automatic_merge: reviews_required_total: 1000 # AutomaticMerge shouldn't run with this file, but just in case reviews_required_team: 1000 # AutomaticMerge shouldn't run with this file, but just in case + access_request: + request_issue_url: https://github.com/conan-io/conan-center-index/issues/4 + max_inactivity_days: 0 + cci: + conan_v2_run_export: false + detailed_status_checks: false + write_comments: false + update_labels: false + user_feedback: + title: "Conan v2 pipeline (informative, not required for merge)" + description: "> **Note**: Conan v2 builds are informative and they are not required for the PR to be merged." + text_on_failure: "The v2 pipeline failed. Please, review the errors and note this will be required for pull requests to be merged in the near future." + collapse_on_success: false + collapse_on_failure: true + scheduled_export_check: + report_issue_url: https://github.com/conan-io/conan-center-index/issues/15557 + report_issue_append: false configurations: - id: linux-gcc - epochs: [20220628] + epochs: [0, 20211221, 20220120, 20220628] hrname: "Linux, GCC" build_profile: os: "Linux" @@ -52,20 +59,34 @@ configurations: compiler.version: ["11"] build_type: ["Release"] - id: configs/macos-clang - epochs: [20220628] + epochs: [0, 20211221, 20220120, 20220628] hrname: "macOS, Clang" build_profile: os: "Macos" content: - os: [ "Macos" ] arch: [ "x86_64" ] + compiler: + - "apple-clang": + compiler.version: [ "13" ] + compiler.libcxx: [ "libc++" ] + build_type: [ "Release"] + - id: configs/macos-m1-clang + epochs: [0, 20211221, 20220120, 20220628] + hrname: "macOS M1, Clang" + build_profile: + os: "Macos" + arch: "x86_64" + content: + - os: [ "Macos" ] + arch: [ "armv8" ] compiler: - "apple-clang": compiler.version: ["13" ] compiler.libcxx: [ "libc++" ] build_type: [ "Release"] - id: configs/windows-msvc - epochs: [20220628] + epochs: [0, 20211221, 20220120, 20220628] hrname: "Windows, MSVC" build_profile: os: "Windows" @@ -80,6 +101,14 @@ configurations: compiler.runtime: [ "static", "dynamic" ] compiler.runtime_type: [ "Release" ] +cppstd: + apple-clang: + "13": ["gnu17"] + gcc: + "11": ["gnu17"] + msvc: + "192": ["14"] + jenkins: url: "http://mb-jenkins-my-bloody-jenkins:8080" @@ -87,7 +116,7 @@ node_labels: Windows: x86_64: "msvc": - default: "windows20220803" + default: "windows20221212" Macos: x86_64: "apple-clang": diff --git a/.c3i/reviewers.yml b/.c3i/reviewers.yml index bc47c10472b07..f5c3403c713cf 100644 --- a/.c3i/reviewers.yml +++ b/.c3i/reviewers.yml @@ -10,8 +10,8 @@ reviewers: type: "team" request_reviews: false - user: "jgsogo" - type: "team" - request_reviews: true + type: "community" + request_reviews: false - user: "czoido" type: "team" request_reviews: false @@ -19,8 +19,8 @@ reviewers: type: "team" request_reviews: false - user: "SSE4" - type: "team" - request_reviews: true + type: "community" + request_reviews: false - user: "uilianries" type: "team" request_reviews: true @@ -30,6 +30,9 @@ reviewers: - user: "SpaceIm" type: "community" request_reviews: false + - user: "theirix" + type: "community" + request_reviews: false - user: "ericLemanissier" type: "community" request_reviews: false @@ -42,15 +45,6 @@ reviewers: - user: "intelligide" type: "community" request_reviews: false - - user: "theirix" - type: "community" - request_reviews: false - - user: "gocarlos" - type: "community" - request_reviews: false - - user: "mathbunnyru" - type: "community" - request_reviews: false - user: "ericriff" type: "community" request_reviews: false @@ -63,9 +57,6 @@ reviewers: - user: "MartinDelille" type: "community" request_reviews: false - - user: "dmn-star" - type: "community" - request_reviews: false - user: "jcar87" type: "team" request_reviews: true @@ -75,3 +66,18 @@ reviewers: - user: "paulocoutinhox" type: "community" request_reviews: false + - user: "jwillikers" + type: "community" + request_reviews: false + - user: "RubenRBS" + type: "team" + request_reviews: true + - user: "System-Arch" + type: "community" + request_reviews: false + - user: "samuel-emrys" + type: "community" + request_reviews: false + - user: "StellaSmith" + type: "community" + request_reviews: false diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 902845de67eaf..0000000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1,23 +0,0 @@ -# Conan Center Index - Recipe Watchers -# -# If you are interested to watch/subscribe any recipe from Conan Center Index and receive -# a notification when a new PR is created, add the recipe repo and your @, -# for instance: -# -# recipes/zlib @myusername -# -# NOTE: Github uses case-sensitive filesystem, so your name must be the same from your account. -# -# Github will add you as a reviewer and will notify you by e-mail. -# This feature is named 'CodeOwners', however, it's a Github's feature name. -# On Conan Center Index, there are no owners/maintainers, all recipes are owned by the -# community. This feature only helps people that are more interested in watching and following -# specific recipes, instead of receiving a new notification for each new pull request. -# -# Full reference: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners -# - -.github @ericLemanissier -recipes/aaf @MartinDelille -recipes/gtk @ericLemanissier -recipes/qt @ericLemanissier diff --git a/.github/ISSUE_TEMPLATE/center_conan_io.md b/.github/ISSUE_TEMPLATE/center_conan_io.md deleted file mode 100644 index f95bb699d0607..0000000000000 --- a/.github/ISSUE_TEMPLATE/center_conan_io.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: 'ConanCenter: Web UI Bugs Or Requests' -about: 'Bugs or feature requests for the Web UI of ConanCenter at https://conan.io/center' -title: '[conan.io/center] SHORT DESCRIPTION' -labels: conan.io/center ---- - - diff --git a/.github/ISSUE_TEMPLATE/center_conan_io.yml b/.github/ISSUE_TEMPLATE/center_conan_io.yml new file mode 100644 index 0000000000000..0662c491c9958 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/center_conan_io.yml @@ -0,0 +1,18 @@ +name: 'ConanCenter: Web UI Bugs Or Requests' +description: Bugs or feature requests for the Web UI of ConanCenter at https://conan.io/center +title: '[conan.io/center] SHORT DESCRIPTION' +labels: 'conan.io/center' +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to submit a report. + **Please don't forget to update the issue title.** + - type: textarea + id: contents + attributes: + label: What is your problem/feature request? + description: Please be as specific as possible! + placeholder: Hi! I would like for ConanCenter to ... + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/package_bug.yml b/.github/ISSUE_TEMPLATE/package_bug.yml index 8d4162d3beef4..2c6e3356c879b 100644 --- a/.github/ISSUE_TEMPLATE/package_bug.yml +++ b/.github/ISSUE_TEMPLATE/package_bug.yml @@ -1,48 +1,87 @@ name: 'Package: Bug Report' -description: 'Report a bug, something does not work as it supposed to' +description: 'Report a bug, something does not work as it is supposed to' title: '[package] /: SHORT DESCRIPTION' labels: bug body: -- type: markdown - attributes: - value: | - Please don't forget to update the issue title. - Include all applicable information to help us reproduce your problem. + - type: markdown + attributes: + value: | + Thanks for taking the time to submit a report. + **Please don't forget to update the issue title.** + Include all applicable information to help us reproduce + - type: textarea + id: description + attributes: + label: Description + description: | + What is not working? What were you expecting? Are there any workarounds? + Remember that a missing profile or a short log will make extremely difficult + to investigate your case or provide any help, please be as specific as possible. + placeholder: Include all applicable information with details to help us reproduce your problem + validations: + required: true + - type: textarea + id: env + attributes: + label: Package and Environment Details + description: (Include every applicable attribute) + value: | + * Package Name/Version: **zlib/1.2.8** + * Operating System+version: **Linux Ubuntu 18.04** + * Compiler+version: **GCC 8** + * Docker image: **conanio/gcc8** + * Conan version: **conan 1.18.0** + * Python version: **Python 3.7.4** + placeholder: | + cat /etc/lsb-release | grep + gcc --version + docker info + cmake --version + conan -v + python3 --version + validations: + required: true + - type: textarea + id: profile + attributes: + label: Conan profile + description: Output of `conan profile show default` or `conan profile show ` if a custom profile is in use + value: | + [settings] + os=Macos + os_build=Macos + arch=armv8 + arch_build=armv8 + compiler=apple-clang + compiler.version=14 + compiler.libcxx=libc++ + build_type=Release + [options] + [conf] + [build_requires] + [env] + validations: + required: true + - type: textarea + id: steps + attributes: + label: Steps to reproduce + description: Which commands did you run? + placeholder: conan install -r conancenter foobar/0.1.0@ -pr:b=default -pr:h=default + validations: + required: true + - type: textarea + id: logs + attributes: + label: Logs + description: Include/Attach the entire command output here. + value: | +
Click to expand log -- type: textarea - attributes: - label: Package and Environment Details - description: include every applicable attribute) - value: | - * Package Name/Version: **zlib/1.2.8** - * Operating System+version: **Linux Ubuntu 18.04** - * Compiler+version: **GCC 8** - * Docker image: **conanio/gcc8** - * Conan version: **conan 1.18.0** - * Python version: **Python 3.7.4** - validations: - required: true + ``` + Put your log output here + ``` - -- type: textarea - attributes: - label: Conan profile - description: output of `conan profile show default` or `conan profile show ` if custom profile is in use - -- type: textarea - attributes: - label: Steps to reproduce - description: Include if Applicable - -- type: textarea - attributes: - label: Logs - description: Include/Attach if Applicable - value: | -
Click to expand log - - ``` - Put your log output here - ``` - -
+
+ validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/package_request.md b/.github/ISSUE_TEMPLATE/package_request.md deleted file mode 100644 index 2d23c97fae995..0000000000000 --- a/.github/ISSUE_TEMPLATE/package_request.md +++ /dev/null @@ -1,14 +0,0 @@ ---- -name: 'Package: Completely New Recipe' -about: 'If would like to see a completely new recipe' -title: '[request] /' -labels: 'library request' ---- - -### Package Details - * Package Name/Version: **cmake/3.15.3** - * Website: **https://cmake.org/** - * Source code: **https://github.com/Kitware/CMake** - - -### Description Of The Library / Tool diff --git a/.github/ISSUE_TEMPLATE/package_request.yml b/.github/ISSUE_TEMPLATE/package_request.yml new file mode 100644 index 0000000000000..3c08e51204866 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/package_request.yml @@ -0,0 +1,42 @@ +name: 'Package: Completely New Recipe' +description: If you would like to see a completely new recipe +title: '[request] /' +labels: 'library request' +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to submit your request. + **Please don't forget to update the issue title.** + - type: input + id: package + attributes: + label: Package Name/Version + placeholder: cmake/3.25.1 + validations: + required: true + - type: input + id: website + attributes: + label: Webpage + placeholder: https://cmake.org + validations: + required: true + - type: input + id: sources + attributes: + label: Source code + placeholder: https://github.com/Kitware/CMake + validations: + required: true + - type: textarea + id: description + attributes: + label: Description of the library/tool + description: | + Give us some context about this library/tool. + What is it about? + placeholder: | + CMake is an open-source, cross-platform family of tools designed to build, test and package software. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/package_upstream_update.md b/.github/ISSUE_TEMPLATE/package_upstream_update.md deleted file mode 100644 index 15db000618746..0000000000000 --- a/.github/ISSUE_TEMPLATE/package_upstream_update.md +++ /dev/null @@ -1,13 +0,0 @@ ---- -name: 'Package: New Version' -about: 'If an existing package recipe needs an update for a new upstream version' -title: '[request] /' -labels: 'upstream update' ---- - -### Package Details - * Package Name/Version: **cmake/3.15.3** - * Changelog: **https://cmake.org/cmake/help/latest/release/3.15.html** - - -The above mentioned version is newly released by the upstream project and not yet available as a recipe. Please add this version. diff --git a/.github/ISSUE_TEMPLATE/package_upstream_update.yml b/.github/ISSUE_TEMPLATE/package_upstream_update.yml new file mode 100644 index 0000000000000..efbe2c5a38c32 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/package_upstream_update.yml @@ -0,0 +1,33 @@ +name: 'Package: New Version' +description: If an existing package recipe needs an update for a new upstream version +title: '[request] /' +labels: 'upstream update' +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to submit your request. + **Please don't forget to update the issue title.** + - type: input + id: package + attributes: + label: Package Name/Version + placeholder: cmake/3.25.1 + validations: + required: true + - type: input + id: changelog + attributes: + label: Changelog + placeholder: https://cmake.org/cmake/help/latest/release/3.25.html + validations: + required: true + - type: textarea + id: description + attributes: + label: Context about the new update + value: | + The above-mentioned version is newly released by the upstream project and not yet available as a recipe. + Please add this version. + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/question.md b/.github/ISSUE_TEMPLATE/question.md deleted file mode 100644 index 226701a9fa97c..0000000000000 --- a/.github/ISSUE_TEMPLATE/question.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: 'Question' -about: 'If something needs clarification' -title: '[question] SHORT DESCRIPTION' -labels: question ---- - - diff --git a/.github/ISSUE_TEMPLATE/question.yml b/.github/ISSUE_TEMPLATE/question.yml new file mode 100644 index 0000000000000..afe36c847827d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/question.yml @@ -0,0 +1,18 @@ +name: Question +description: If something needs clarification +title: '[question] SHORT DESCRIPTION' +labels: 'question' +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to fill your question. + **Please don't forget to update the issue title.** + - type: textarea + id: question + attributes: + label: What is your question? + description: Please be as specific as possible! + placeholder: Hi! I have a question regarding ... + validations: + required: true diff --git a/.github/ISSUE_TEMPLATE/service.md b/.github/ISSUE_TEMPLATE/service.md deleted file mode 100644 index d0b1cf7de1921..0000000000000 --- a/.github/ISSUE_TEMPLATE/service.md +++ /dev/null @@ -1,8 +0,0 @@ ---- -name: 'Service: Infrastructure Bugs Or Requests' -about: 'Bug or feature requests for Conan Center Index itself' -title: '[service] SHORT DESCRIPTION' -labels: service ---- - - diff --git a/.github/ISSUE_TEMPLATE/service.yml b/.github/ISSUE_TEMPLATE/service.yml new file mode 100644 index 0000000000000..4afdce69c57d6 --- /dev/null +++ b/.github/ISSUE_TEMPLATE/service.yml @@ -0,0 +1,18 @@ +name: 'Service: Infrastructure Bugs Or Requests' +description: Bug or feature requests for Conan Center Index itself +title: '[service] SHORT DESCRIPTION' +labels: 'service' +body: + - type: markdown + attributes: + value: | + Thanks for taking the time to submit a report. + **Please don't forget to update the issue title.** + - type: textarea + id: contents + attributes: + label: What is your problem/feature request? + description: Please be as specific as possible! + placeholder: Hi! I would like for Conan Center Index to ... + validations: + required: true diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index d5cc68f215c7b..3f6e08d2479e9 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -1,10 +1,10 @@ Specify library name and version: **lib/1.0** -This is also a good place to share with all of us **why you are submitting this PR** (specially if it is a new addition to ConanCenter): is it a dependency of other libraries you want to package? Are you the author of the library? Thanks! + + --- -- [ ] I've read the [guidelines](https://github.com/conan-io/conan-center-index/blob/master/docs/how_to_add_packages.md) for contributing. -- [ ] I've followed the [PEP8](https://www.python.org/dev/peps/pep-0008/) style guides for Python code in the recipes. -- [ ] I've used the [latest](https://github.com/conan-io/conan/releases/latest) Conan client version. +- [ ] I've read the [contributing guidelines](https://github.com/conan-io/conan-center-index/blob/master/CONTRIBUTING.md). +- [ ] I've used a [recent](https://github.com/conan-io/conan/releases/latest) Conan client version close to the [currently deployed](https://github.com/conan-io/conan-center-index/blob/master/.c3i/config_v1.yml#L6). - [ ] I've tried at least one configuration locally with the [conan-center hook](https://github.com/conan-io/hooks.git) activated. diff --git a/.github/actions/alert-community/action.yml b/.github/actions/alert-community/action.yml new file mode 100644 index 0000000000000..ca390cd38b4e7 --- /dev/null +++ b/.github/actions/alert-community/action.yml @@ -0,0 +1,31 @@ +name: "Alert Community" +description: "Comment on pull request if certain files changes" +author: "prince-chrismc" +inputs: + files: + description: "Check for changes using only this list of files (Defaults to the entire repo)" + required: true + default: "" + reviewers: + description: "List of users to mention (make sure to include the @)" + required: true + default: "" + +runs: + using: "composite" + steps: + # Assume the repo checked out the code since this is running + - uses: ./.github/actions/pr_changed_files + id: changed_files + with: + files: ${{ inputs.files }} + - if: always() && steps.changed_files.outputs.any_changed == 'true' + uses: actions/github-script@v6 + with: + script: | + github.rest.issues.createComment({ + issue_number: context.issue.number, + owner: context.repo.owner, + repo: context.repo.repo, + body: `:robot: **Beep Boop**! This pull request is making changes to '${{ inputs.files }}'.\n\n:wave: ${{ inputs.reviewers }} you might be interested. :wink:` + }) diff --git a/.github/actions/pr_changed_files/action.yml b/.github/actions/pr_changed_files/action.yml new file mode 100644 index 0000000000000..70f97c9499430 --- /dev/null +++ b/.github/actions/pr_changed_files/action.yml @@ -0,0 +1,51 @@ +name: 'Changed files in PR' +description: 'Get all changed files in a Pull Request' +author: 'ericLemanissier' +inputs: + files: + description: "Check for changes using only this list of files (Defaults to the entire repo)" + required: false + default: "" + +outputs: + all_changed_files: + description: List of all copied, modified, and added files. + value: ${{ steps.changed-files.outputs.all_changed_files }} + any_changed: + description: Return true only when any files provided using the files input have changed. + value: ${{ steps.changed-files.outputs.any_changed }} +runs: + using: "composite" + steps: + - uses: actions/setup-python@v4 + with: + python-version: ${{ env.PYVER }} + - name: Get changed files + id: changed-files + shell: python + env: + GITHUB_TOKEN: ${{ github.token }} + run: | + import json + import subprocess + import fnmatch + import os + from pathlib import Path + + patterns = [Path(p).parts for p in '''${{ inputs.files }}'''.splitlines()] + + res = subprocess.run(["gh", "api", "/repos/${{ github.repository }}/pulls/${{ github.event.pull_request.number }}/files", "--paginate"], capture_output=True, check=True) + files = [] + for f in json.loads(res.stdout): + if f["status"] == "removed": + continue + filename = Path(f["filename"]).parts + for pattern in patterns: + if len(pattern) != len(filename): + continue + if all(fnmatch.fnmatch(filename[i], pattern[i]) for i in range(len(pattern))): + files.append(f["filename"]) + break + with open(os.getenv("GITHUB_OUTPUT"), "a") as output_file: + output_file.write(f"any_changed={'true' if files else 'false'}\n") + output_file.write(f"all_changed_files={' '.join(files)}\n") diff --git a/.github/workflows/alert-community.yml b/.github/workflows/alert-community.yml new file mode 100644 index 0000000000000..5eeed68fcfd6c --- /dev/null +++ b/.github/workflows/alert-community.yml @@ -0,0 +1,417 @@ +name: "[service] Alert Community" + +on: + pull_request_target: + types: [opened] + +env: + PYVER: "3.10" + +jobs: + comment: + if: github.repository == 'conan-io/conan-center-index' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + ref: master + + - uses: ./.github/actions/alert-community + with: + files: "docs/*/*" + reviewers: "@prince-chrismc @MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: ".github/*/*" + reviewers: "@ericLemanissier @prince-chrismc @Croydon" + + - uses: ./.github/actions/alert-community + with: + files: "linter/*/*" + reviewers: "@ericLemanissier @prince-chrismc @Croydon" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/aaf/*/*" + reviewers: "@MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/abseil/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/avahi/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/b2/*/*" + reviewers: "@grafikrobot" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/bandit/*/*" + reviewers: "@MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/benchmark/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/boost/*/*" + reviewers: "@grafikrobot @Hopobcn @jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/boost-ext-ut/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/bzip2/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/cereal/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/cmake/*/*" + reviewers: "@Croydon" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/cppcheck/*/*" + reviewers: "@MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/create-dmg/*/*" + reviewers: "@MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/dbus/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/double-conversion/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/eigen/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/elfio/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/ffmpeg/*/*" + reviewers: "@MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/fmt/*/*" + reviewers: "@Hopobcn @jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/folly/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/foxi/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/fp16/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/g3log/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/gflags/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/glew/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/glfw/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/glog/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/gtest/*/*" + reviewers: "@Hopobcn @jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/gtk/*/*" + reviewers: "@ericLemanissier" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/imgui/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/implot/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/jemalloc/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libalsa/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libarchive/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libbacktrace/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libcap/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libcurl/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libdwarf/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libelf/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libevent/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libffi/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libiberty/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libiconv/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libltc/*/*" + reviewers: "@MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libpng/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libsodium/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libspatialite/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libunwind/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libuuid/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/libxml2/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/llvm-core/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/lyra/*/*" + reviewers: "@grafikrobot" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/lz4/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/ms-gsl/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/nlohmann_json/*/*" + reviewers: "@Hopobcn @jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/onnx/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/openapi-generator/*/*" + reviewers: "@MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/opengl/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/opengl-registry/*/*" + reviewers: "@MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/openssl/*/*" + reviewers: "@Hopobcn @Croydon" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/protobuf/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/psimd/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/qt/*/*" + reviewers: "@ericLemanissier @jwillikers @MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/quazip/*/*" + reviewers: "@MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/rtmidi/*/*" + reviewers: "@MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/sentry-*/*/*" + reviewers: "@MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/shapelib/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/snappy/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/uncrustify/*/*" + reviewers: "@MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/wayland/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/wayland-protocols/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/xkbcommon/*/*" + reviewers: "@jwillikers" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/xorg/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/yaml-cpp/*/*" + reviewers: "@jwillikers @MartinDelille" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/xz_utils/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/zlib/*/*" + reviewers: "@Hopobcn" + + - uses: ./.github/actions/alert-community + with: + files: "recipes/zstd/*/*" + reviewers: "@Hopobcn" diff --git a/.github/workflows/linter-conan-v2.yml b/.github/workflows/linter-conan-v2.yml index d1f78543433e7..9b437a26e46d8 100644 --- a/.github/workflows/linter-conan-v2.yml +++ b/.github/workflows/linter-conan-v2.yml @@ -6,7 +6,6 @@ on: env: PYTHONPATH: ${{github.workspace}} PYVER: "3.8" - SCORE_THRESHOLD: "9.5" REQUIREMENTS: "pylint==2.14" jobs: @@ -15,24 +14,26 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - fetch-depth: 2 - name: Get changed files - uses: tj-actions/changed-files@v20 + uses: ./.github/actions/pr_changed_files id: changed_files with: files: | linter/** + .github/workflows/linter-conan-v2.yml + - name: Get Conan v1 version id: parse_conan_v1_version if: steps.changed_files.outputs.any_changed == 'true' uses: mikefarah/yq@master with: cmd: yq '.conan.version' '.c3i/config_v1.yml' - - uses: actions/setup-python@v3 + + - uses: actions/setup-python@v4 if: steps.changed_files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} + - name: Install requirements if: steps.changed_files.outputs.any_changed == 'true' run: | @@ -42,52 +43,28 @@ jobs: id: linter_recipes if: steps.changed_files.outputs.any_changed == 'true' run: | - pylint --rcfile=linter/pylintrc_recipe recipes/*/*/conanfile.py --output-format=json --output=recipes.json --score=y --fail-under=${{ env.SCORE_THRESHOLD }} + echo '## Linter summary (recipes)' >> $GITHUB_STEP_SUMMARY + pylint --rcfile=linter/pylintrc_recipe `ls recipes/*/*/conanfile.py | shuf -n 500` --output-format=json --output=recipes.json --score=y --exit-zero + jq '[map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}] | sort_by(.length) | reverse' recipes.json > recipes2.json + jq -r '.[] | " * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY - name: Execute linter over all test_package/recipes in the repository id: linter_test_package if: steps.changed_files.outputs.any_changed == 'true' - run: | - pylint --rcfile=linter/pylintrc_testpackage recipes/*/*/test_*/conanfile.py --ignore-paths="recipes/[^/]*/[^/]*/test_v1[^/]*/conanfile.py" --output-format=json --output=test_package.json --score=y --fail-under=${{ env.SCORE_THRESHOLD }} - - - name: Archive production artifacts - if: steps.changed_files.outputs.any_changed == 'true' && always() - uses: actions/upload-artifact@v3 - with: - name: linter-output - path: | - recipes.json - test_package.json - - - name: Create report (recipes) - if: steps.changed_files.outputs.any_changed == 'true' && steps.linter_recipes.outcome != 'skipped' && always() - run: | - echo '## Linter summary (recipes)' >> $GITHUB_STEP_SUMMARY - jq 'map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}' recipes.json > recipes2.json - jq -r '" * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY - - - name: Create report (test_package) - if: steps.changed_files.outputs.any_changed == 'true' && steps.linter_test_package.outcome != 'skipped' && always() run: | echo '## Linter summary (test_package)' >> $GITHUB_STEP_SUMMARY - jq 'map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}' test_package.json > test_package2.json - jq -r '" * \(.message): \(.length)"' test_package2.json >> $GITHUB_STEP_SUMMARY - - - name: Create report - if: steps.changed_files.outputs.any_changed == 'true' && always() - run: | - echo '> Note.- Check uploaded artifacts for a full report.' >> $GITHUB_STEP_SUMMARY + pylint --rcfile=linter/pylintrc_testpackage `ls recipes/*/*/test_package/conanfile.py | shuf -n 500` --output-format=json --output=recipes.json --exit-zero + jq '[map( select(.type=="error")) | group_by (.message)[] | {message: .[0].message, length: length}] | sort_by(.length) | reverse' recipes.json > recipes2.json + jq -r '.[] | " * \(.message): \(.length)"' recipes2.json >> $GITHUB_STEP_SUMMARY conanfile_recipe: name: Lint changed conanfile.py (v2 migration) runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - fetch-depth: 2 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v20 + uses: ./.github/actions/pr_changed_files with: files: | recipes/*/*/conanfile.py @@ -97,7 +74,7 @@ jobs: uses: mikefarah/yq@master with: cmd: yq '.conan.version' '.c3i/config_v1.yml' - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 if: steps.changed-files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} @@ -118,11 +95,9 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - fetch-depth: 2 - name: Get changed files id: changed-files - uses: tj-actions/changed-files@v20 + uses: ./.github/actions/pr_changed_files with: files: | recipes/*/*/test_*/conanfile.py @@ -132,7 +107,7 @@ jobs: uses: mikefarah/yq@master with: cmd: yq '.conan.version' '.c3i/config_v1.yml' - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 if: steps.changed-files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} diff --git a/.github/workflows/linter-yaml.yml b/.github/workflows/linter-yaml.yml index 511e654ab8bb0..d7d4050e8071d 100644 --- a/.github/workflows/linter-yaml.yml +++ b/.github/workflows/linter-yaml.yml @@ -6,8 +6,8 @@ on: env: PYTHONPATH: ${{github.workspace}} PYVER: "3.8" - CONFIG_FILES_PATH: "recipes/**/config.yml" - CONANDATA_FILES_PATH: "recipes/**/**/conandata.yml" + CONFIG_FILES_PATH: "recipes/*/config.yml" + CONANDATA_FILES_PATH: "recipes/*/*/conandata.yml" jobs: test_linter: @@ -16,33 +16,49 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - name: Get changed files - uses: tj-actions/changed-files@v20 + uses: ./.github/actions/pr_changed_files id: changed_files with: files: | linter/** - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 if: steps.changed_files.outputs.any_changed == 'true' with: python-version: ${{ env.PYVER }} - + - name: Install dependencies if: steps.changed_files.outputs.any_changed == 'true' - run: pip install yamllint + run: pip install yamllint strictyaml argparse - name: Run linter (config.yml) if: steps.changed_files.outputs.any_changed == 'true' && always() - run: yamllint --config-file linter/yamllint_rules.yml -f parsable ${{ env.CONFIG_FILES_PATH }} + run: | + echo "::add-matcher::linter/yamllint_matcher.json" + yamllint --config-file linter/yamllint_rules.yml -f standard ${{ env.CONFIG_FILES_PATH }} + echo "::remove-matcher owner=yamllint_matcher::" + + - name: Run schema check (config.yml) + if: steps.changed_files.outputs.any_changed == 'true' && always() + run: | + for file in ${{ env.CONFIG_FILES_PATH }}; do + python3 linter/config_yaml_linter.py ${file} + done - name: Run linter (conandata.yml) if: steps.changed_files.outputs.any_changed == 'true' && always() - run: yamllint --config-file linter/yamllint_rules.yml -f parsable ${{ env.CONANDATA_FILES_PATH }} + run: | + echo "::add-matcher::linter/yamllint_matcher.json" + yamllint --config-file linter/yamllint_rules.yml -f standard ${{ env.CONANDATA_FILES_PATH }} + echo "::remove-matcher owner=yamllint_matcher::" + - name: Run schema check (conandata.yml) + if: steps.changed_files.outputs.any_changed == 'true' && always() + run: | + for file in ${{ env.CONANDATA_FILES_PATH }}; do + python3 linter/conandata_yaml_linter.py ${file} + done lint_pr_files: # Lint files modified in the pull_request @@ -50,44 +66,53 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - with: - fetch-depth: 2 - - - uses: actions/setup-python@v3 + - uses: actions/setup-python@v4 with: python-version: ${{ env.PYVER }} - + - name: Install dependencies - run: pip install yamllint + run: pip install yamllint strictyaml argparse ## Work on config.yml files - name: Get changed files (config) id: changed_files_config if: always() - uses: tj-actions/changed-files@v20 + uses: ./.github/actions/pr_changed_files with: files: | ${{ env.CONFIG_FILES_PATH }} - + - name: Run linter (config.yml) if: steps.changed_files_config.outputs.any_changed == 'true' && always() run: | + echo "::add-matcher::linter/yamllint_matcher.json" for file in ${{ steps.changed_files_config.outputs.all_changed_files }}; do - yamllint --config-file linter/yamllint_rules.yml ${file} + yamllint --config-file linter/yamllint_rules.yml -f standard ${file} + done + echo "::remove-matcher owner=yamllint_matcher::" + + for file in ${{ steps.changed_files_conandata.outputs.all_changed_files }}; do + python3 linter/config_yaml_linter.py ${file} done ## Work on conandata.yml files - name: Get changed files (conandata) id: changed_files_conandata if: always() - uses: tj-actions/changed-files@v20 + uses: ./.github/actions/pr_changed_files with: files: | ${{ env.CONANDATA_FILES_PATH }} - + - name: Run linter (conandata.yml) if: steps.changed_files_conandata.outputs.any_changed == 'true' && always() run: | + echo "::add-matcher::linter/yamllint_matcher.json" + for file in ${{ steps.changed_files_conandata.outputs.all_changed_files }}; do + yamllint --config-file linter/yamllint_rules.yml -f standard ${file} + done + echo "::remove-matcher owner=yamllint_matcher::" + for file in ${{ steps.changed_files_conandata.outputs.all_changed_files }}; do - yamllint --config-file linter/yamllint_rules.yml ${file} + python3 linter/conandata_yaml_linter.py ${file} done diff --git a/.github/workflows/markdown-links.yml b/.github/workflows/markdown-links.yml new file mode 100644 index 0000000000000..50c393f373fb1 --- /dev/null +++ b/.github/workflows/markdown-links.yml @@ -0,0 +1,18 @@ +name: "[linter] Markdown links" + +on: + pull_request: + paths: + - '**.md' + +jobs: + markdown-link-check-pr: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: gaurav-nelson/github-action-markdown-link-check@v1 + with: + config-file: .github/workflows/mlc_config.json + use-quiet-mode: 'yes' + use-verbose-mode: 'yes' + check-modified-files-only: 'yes' diff --git a/.github/workflows/mlc_config.json b/.github/workflows/mlc_config.json new file mode 100644 index 0000000000000..d16005bb86641 --- /dev/null +++ b/.github/workflows/mlc_config.json @@ -0,0 +1,13 @@ +{ + "retryOn429": true, + "retryCount": 5, + "fallbackRetryDelay": "30s", + "httpHeaders": [ + { + "urls": ["https://github.com/", "https://guides.github.com/", "https://help.github.com/", "https://docs.github.com/"], + "headers": { + "Accept-Encoding": "zstd, br, gzip, deflate" + } + } + ] +} diff --git a/.github/workflows/on-push-do-doco.yml b/.github/workflows/on-push-do-doco.yml index fe33f4984dfb3..f5206b720d4a9 100644 --- a/.github/workflows/on-push-do-doco.yml +++ b/.github/workflows/on-push-do-doco.yml @@ -22,7 +22,7 @@ jobs: --toc-level 5 shell: bash - name: Create Pull Request - uses: peter-evans/create-pull-request@v3 + uses: peter-evans/create-pull-request@v4 with: branch: bot/action-doc-toc commit-message: "[docs] Regenerate tables of contents" diff --git a/.gitignore b/.gitignore index d4f0278522f81..e9c7fe3589289 100644 --- a/.gitignore +++ b/.gitignore @@ -1,13 +1,18 @@ # Conan specific -test_package/build/ +**/test_package/build/ +**/test_package/test_output/ conan.lock conanbuildinfo.txt conaninfo.txt graph_info.json build/ +# CMake +CMakeUserPresets.json + # IDEs .idea +.vs .vscode .project .pydevproject @@ -19,7 +24,7 @@ build/ # Byte-compiled / optimized / DLL files / Cache __pycache__/ -test_package/__pycache__/ +**/test_package/__pycache__/ *.pyc *.py[cod] *$py.class @@ -125,3 +130,10 @@ venv.bak/ # scons build files *.dblite + +# vim temp files +.*.sw? +.sw? +Session.vim +*~ +.undodir diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 22027379ce53b..e3e7f52de2da8 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -11,27 +11,29 @@ The following summarizes the process for contributing to the CCI (Conan Center I ## Community -Conan Center Index is an Open Source MIT licensed project. -Conan Center Index is developed by the Conan maintainers and a great community of contributors. +ConanCenterIndex is an Open Source MIT licensed project; it is developed by the Conan maintainers and a great community of contributors. ## Dev-flow & Pull Requests CCI follows the ["GitFlow"](https://datasift.github.io/gitflow/IntroducingGitFlow.html) branching model. Issues are triaged and categorized mainly by type (package request, bug...) and priority (high, medium...) using GitHub - labels. +labels. To contribute follow the next steps: 1. Comment in the corresponding issue that you want to contribute the package/fix proposed. If there is no open issue, we strongly suggest - to open one to gather feedback. -2. Check the [how_to_add_packages.md](docs/how_to_add_packages.md) if are - contributing for a new package. -3. Fork the [CCI repository](https://github.com/conan-io/conan-center-index) and create a `package/xxx` branch from the `master` branch and develop + opening one to gather feedback. +2. Make sure to [request access](docs/adding_packages/README.md#request-access) and be aware there is a [CLA](docs/CONTRIBUTOR_LICENSE_AGREEMENT.md). +3. Get setup by following the [Developing Recipes](docs/developing_recipes_locally.md) guide and learn the basic commands. +4. Check the [How To Add Packages](docs/adding_packages/README.md) page for the break down of ConanCenterIndex specific conventions and practices. +5. In your fork create a `package/xxx` branch from the `master` branch and develop your fix/packages as discussed in previous step. -4. Try to keep your branch updated with the `master` branch to avoid conflicts. -5. Add the text (besides other comments): "fixes #IssueNumber" in the body of the PR, referring to the issue of step 1. +6. [Submit a pull request](docs/adding_packages/README.md#submitting-a-package) once you are ready. This can be when you + got everything working or even if you need help. Add the text to the issue body (besides other comments): "fixes #IssueNumber" + in the body of the PR, referring to the issue of step 1. -The ``conan-io`` organization maintainers will review and help with the packaging. +The Conan Community works hard to review all the pull requests and provided assistance where need. +The [Review Process](docs/review_process.md) is partially automated with the help of @conan-center-index-bot :rocket: ## Issues @@ -50,10 +52,5 @@ For any suggestion, feature request or question open an issue indicating the fol - Try to explain the motivation, what are you trying to do, what is the pain it tries to solve. - What do you expect from CCI. -We use the following tags to control the status of the issues: - -- **infrastructure**: Waiting on tools or services belonging to the infra. -- **library request**: Request a new package to be created. -- **question**: Further information is requested . -- **upstream update**: Bump a new package version. -- **conan.io/center**: Issues and features related to Web UI . +We use the following tags to control the status of the issues and pull requests, you can learn more in [Labels](docs/labels.md) document +which details the important one and their roles. diff --git a/README.md b/README.md index d9dc76350c51e..516167a9ba258 100644 --- a/README.md +++ b/README.md @@ -41,7 +41,7 @@ All the documentation is available in this same repository in the [`docs/` subfo This is a list of shortcuts to some interesting topics: -* :rocket: If you want to learn how to **contribute new recipes**, please read [docs/how_to_add_packages.md](docs/how_to_add_packages.md). +* :rocket: If you want to learn how to **contribute new recipes**, please read [docs/adding_packages/](docs/adding_packages/README.md). * :speech_balloon: **FAQ**: most common questions are listed in [docs/faqs.md](docs/faqs.md). * :warning: The conan-center **hook errors** reported by CCI Bot can be found in the [docs/error_knowledge_base.md](docs/error_knowledge_base.md). * :hammer_and_wrench: The internal changes related to infrastructure can be checked in [docs/changelog.md](docs/changelog.md). diff --git a/docs/CONTRIBUTOR_LICENSE_AGREEMENT.md b/docs/CONTRIBUTOR_LICENSE_AGREEMENT.md new file mode 100644 index 0000000000000..39acf20a7aebd --- /dev/null +++ b/docs/CONTRIBUTOR_LICENSE_AGREEMENT.md @@ -0,0 +1,23 @@ +Conan-Center-Index project Contributor License Agreement +-------------------------------------------------------- + +The following terms are used throughout this agreement: + +- You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it. +- Contribution - any type of work that is submitted to the repository, including any modifications or additions to existing work. +- Project - Conan-Center-Index project (https://github.com/conan-io/conan-center-index) +- Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with the copyright owner, contributors or maintainers. + +1. Grant of Copyright License. + + Subject to the terms and conditions of this agreement, You grant to JFrog LTD, a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare derivative works of, publicly display, publicly perform, sublicense, and distribute your contributions and such derivative works. + +2. Grant of Patent License. + + Subject to the terms and conditions of this agreement, You grant to JFrog LTD, a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer your contributions, where such license applies only to those patent claims licensable by you that are necessarily infringed by your contribution or by combination of your contribution with the project to which this contribution was submitted. + + If any entity institutes patent litigation - including cross-claim or counterclaim in a lawsuit - against You alleging that your contribution or any project it was submitted to constitutes or is responsible for direct or contributory patent infringement, then any patent licenses granted to that entity under this agreement shall terminate as of the date such litigation is filed. + +3. Source of Contribution. + + Your contribution is either your original creation, based upon previous work that, to the best of your knowledge, is covered under an appropriate open source license and you have the right under that license to submit that work with modifications, whether created in whole or in part by you, or you have clearly identified the source of the contribution and any license or other restriction (like related patents, trademarks, and license agreements) of which you are personally aware. diff --git a/docs/README.md b/docs/README.md index bd72287edf75b..0c06266cf5f35 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,5 +1,9 @@ +This repository, ConanCenterIndex, contains recipes for the remote [JFrog ConanCenter](https://conan.io/center/). +This remote is added by default to a clean installation of the Conan client. Recipes are contributed by opening pull requests as explained in the sections below. +When pull requests are merged, the CI will upload the generated packages to the [ConanCenter](https://conan.io/center/) remote. + # Documentation * [Code of conduct](code_of_conduct.md) @@ -7,14 +11,13 @@ * User documentation + [Contributing to Conan Center Index](../CONTRIBUTING.md) - + [Adding Packages to ConanCenter](how_to_add_packages.md) - + [Policy about patching](policy_patching.md) + + [Developing Recipes Locally](developing_recipes_locally.md) + + [Adding Packages to ConanCenter](adding_packages/README.md) :point_left: Best place to learn how to contribute + + [Errors from the conan-center hook (KB-Hxxx)](error_knowledge_base.md) + [Review Process](review_process.md) - + [Packaging policy](packaging_policy.md) + + [Labels](labels.md) + [Supported platforms and configurations](supported_platforms_and_configurations.md) - + [Errors from the conan-center hook (KB-Hxxx)](error_knowledge_base.md) - + [FAQs](faqs.md) + + [Consuming Recipes](consuming_recipes.md) :information_source: Learn how to limit the impact of recipe changes + [Community Resources](community_resources.md) - + [Review Guidelines](reviewing.md) - + [Labels](labels.md) + [Preparing recipes for Conan 2.0](v2_migration.md) + + [FAQs](faqs.md) diff --git a/docs/adding_packages/README.md b/docs/adding_packages/README.md new file mode 100644 index 0000000000000..92c0dbc7994a0 --- /dev/null +++ b/docs/adding_packages/README.md @@ -0,0 +1,133 @@ +# Adding Packages to ConanCenter + +ConanCenterIndex aims to provide the best quality packages of any open source project. +Any C/C++ project can be made available by contributing a "recipe". + +Getting started is easy. Try building an existing package with our [developing recipes](../developing_recipes_locally.md) +tutorial. To deepen you understanding, start with the [How to provide a good recipe](#how-to-provide-a-good-recipe) section. +You can follow the three steps (:one: :two: :three:) described below! :tada: + + +## Contents + + * [:one: Request access](#one-request-access) + * [Inactivity and user removal](#inactivity-and-user-removal) + * [:two: Creating a package](#two-creating-a-package) + * [How to provide a good recipe](#how-to-provide-a-good-recipe) + * [:three: Submitting a Package](#three-submitting-a-package) + * [The Build Service](#the-build-service) + +## :one: Request access + +The first step to add packages to ConanCenter is requesting access. To enroll in ConanCenterIndex repository, please write a comment +requesting access in this GitHub [issue #4](https://github.com/conan-io/conan-center-index/issues/4). Feel free to introduce yourself and +your motivation to join ConanCenter community. + +This process helps ConanCenter against spam and malicious code. The process is not fully automated on purpose and the requests are +generally approved on a weekly basis. Feel free to continue to step :two: while waiting for approval. + +> **Note** The requests are reviewed manually, checking the GitHub profile activity of the requester to avoid any misuse of the service. +> All interactions are subject to the expectations of the [code of conduct](../code_of_conduct.md). Any misuse or inappropriate behavior +> are subject to the same principals. + +When submitting a pull request for the first time, you will be prompted to sign the [CLA](../CONTRIBUTOR_LICENSE_AGREEMENT.md) for your +code contributions. You can view your signed CLA's by going to and signing in. + +## Inactivity and user removal + +For security reasons related to the CI, when a user no longer contributes for a long period, it will be considered inactive and removed from the authorized user's list. +For now, it's configured for **4 months**, and it's computed based on the latest commit, not comments or opened issues. +After that time, the CI bot will ask to remove the user name from the authorized users' list through the access request PR, which occurs a few times every week. + +When you are interested in contributing again, simply ask again to be included in the [issue #4](https://github.com/conan-io/conan-center-index/issues/4). +The process will be precisely like for newcomers. + +## :two: Creating a package + +Once you've successfully built an existing recipe following [developing recipes](../developing_recipes_locally.md) tutorial. +You are set to being adding a new package. + +Make sure you have: + +* Forked and then cloned the [conan-center-index](https://github.com/conan-io/conan-center-index) git repository. +* Make sure you are using a recent [Conan client](https://conan.io/downloads) version, as recipes improve by introducing features of the newer Conan releases. + +The easiest way to start is copying a template from our [`package_templates/`](../package_templates) folder to the [`recipes/`](../../recipes/) folder. +Rename the new folder following the [project name](conanfile_attributes.md#name) guidelines. Read templates [documentation](../package_templates/README.md) +to find more information. + +Quickly, there's a few items to look at: + +* Add _only_ the latest version in the [`config.yml`](folders_and_files.md#configyml) and [`conandata.yml`](folders_and_files.md#conandatayml) +* Make sure to update the [`ConanFile` attributes](conanfile_attributes.md) like `license`, `description`, etc... + +In ConanCenter, our belief is recipes should always match upstream, in other words, what the original author(s) intended. + +* Options should [follow these recommendations](conanfile_attributes.md#options) as well as match the default value used by the upstream project. +* [Package information](build_and_package.md), libraries, components should match as well. This includes exposing supported build system names. + +Where dependencies are involved, there's no shortcuts, inspect the upstream's build scripts for how they are usually consumed. Pick the Conan +generator that matches. The most common example is CMake's `find_package` that can be satisfied by Conan's +[`CMakeDeps`](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmakedeps.html) generator. There are a few +things to be cautious about, many projects like to "vendor" other projects within them. This can be files checked into the repository or +downloaded during the build process. These should be removed, see the [Dependencies section](dependencies.md#handling-internal-dependencies) +for more information. + +### How to provide a good recipe + +Take a look at existing [recipes](https://github.com/conan-io/conan-center-index/tree/master/recipes) available in ConanCenterIndex which can be +used as good examples, you can use them as the base for your recipe. The GitHub search is very good for matching code snippets, you can see if, +how or when a function is used in other recipes. + +> **Note**: Conan features change over time and our best practices evolve so some minor details may be out of date due to the vast number of recipes. + +More often than not, ConanCenter recipes are built in more configuration than the upstream project. This means some edge cases need minor tweaks. +We **strongly encourage** everyone to contribute back to the upstream project. This reduces the burden of re-applying patches and overall makes the +the code more accessible. + +Read the docs! The [FAQs](../faqs.md) are a great place to find short answers. +The documents in this folder are written to explain each folder, file, method, and attribute. + +1. [Folders and Files](folders_and_files.md) +2. [Sources and Patches](sources_and_patches.md) + 1. [`conandata.yml` format](conandata_yml_format.md) +3. [`ConanFile` Attributes](conanfile_attributes.md) +4. [Dependencies](dependencies.md) +5. [Build and Package](build_and_package.md) + 1. [Revisit Patches](sources_and_patches.md#policy-about-patching) +6. [Test Package](test_packages.md) + +The one place you are certain to find a lot of information is , this has the documentation for everything in Conan. +There are helpful tutorials for cross-build, detailed explication for profiles and settings and much much more! + +## :three: Submitting a Package + +To contribute a package, you can submit a [Pull Request](https://github.com/conan-io/conan-center-index/pulls) to this GitHub +repository . + +The specific steps to submitting changes are: + +* Build and test the new recipe in several combinations. Check [developing recipes](../developing_recipes_locally.md) for tips. +* [Commit and push to your fork repository](https://docs.github.com/en/get-started/using-git/pushing-commits-to-a-remote-repository) then + [submit a pull request](https://github.com/conan-io/conan-center-index/compare). +* Our automated [build service](#the-build-service) will build 100+ different configurations, and provide messages that indicate if there + were any issues found during the pull request on GitHub. + +When the pull request is [reviewed and merged](../review_process.md), those packages are published to [JFrog's ConanCenter](https://conan.io/center/) +and are made available for everyone. + +## The Build Service + +The **build service** associated to this repository will generate binary packages automatically for the most common platforms and compilers. +See [the Supported Platforms and Configurations page](../supported_platforms_and_configurations.md) for a list of generated configurations. +For a C++ library, the system is currently generating more than 100 binary packages. + +> **Note**: This not a testing service, it is a binary building service for **released** packages. Unit tests shouldn't be built nor run in recipes by default, see the [FAQs](../faqs.md#why-conancenter-does-not-build-and-execute-tests-in-recipes) for more. Before submitting a pull request, please ensure that it works locally for some configurations. + +* The CI bot will start a new build only [after the author is approved](#one-request-access). Your PR may be reviewed in the mean time, but is not guaranteed. +* The CI system will also report errors and build logs by creating a comment in the pull-request, the message will include links to the logs for inspecting. +* The Actions are used to lint and ensure the latest conventions are being used. You'll see comments from bots letting you know. + +Packages generated and uploaded by this build service do not include any _user_ or _channel_ (we generally recommend using `@user/channel` for private package +repositories as an easy way to distinguish them from public ones). Once the packages are uploaded, you will be able to install them using the reference as +`name/version` so example `conan install fmt/9.1.0@` for 1.x client or `conan install --requires=fmt/9.1.0` for 2.x clients. diff --git a/docs/adding_packages/build_and_package.md b/docs/adding_packages/build_and_package.md new file mode 100644 index 0000000000000..b247b29d9faa8 --- /dev/null +++ b/docs/adding_packages/build_and_package.md @@ -0,0 +1,112 @@ +# Build and Package + +This document gathers all the relevant information regarding the general lines to follow while writing either the `build()` or the `package()` methods. +Both methods often use build helpers to build binaries and install them into the `package_folder`. + + +## Contents + + * [Build Method](#build-method) + * [Package Method](#package-method) + * [Build System Examples](#build-system-examples) + * [Header Only](#header-only) + * [CMake](#cmake) + * [Autotools](#autotools) + * [No Upstream Build Scripts](#no-upstream-build-scripts) + * [System Packages](#system-packages) + +## Build Method + +* `build()` method should focus on build only, not installation. During the build, nothing should be written in `package` folder. Installation step should only occur in `package()` method. + +* The build itself should only rely on local files. Nothing should be downloaded from the internet during this step. If external files are required, they should come from `requirements` or `build_requirements` in addition to source files downloaded in `source()` or coming from the recipe itself through `export()` or `export_sources()`. + +* Except for CMake, a working build toolchain (compiler, linker, archiver, etc.), and a "native generator" (`make` on *nix platforms, `mingw32-make` for MinGW, `MSBuild`/`NMake` for Visual Studio), the recipe should not assume that any other build tool is installed on the user-build machine (like Meson, autotools, or pkg-config). On Windows, the recipe should not assume that a shell is available (like MSYS2). Therefore, if the build method requires additional tools, they should be added to `build_requirements()`. + Tools explicitly marked as available by users through conf like `tools.gnu:make_program`, `tools.gnu:pkg_config`, `tools.microsoft.bash:path`, `tools.microsoft.bash:subsystem` should be taken into account to conditionally inject a build requirement (these conf should have precedence over build requirement equivalent hardcoded in the recipe). + +* It is forbidden to run other conan client commands during build. In other words, if upstream build files call conan under the hood (through `cmake-conan` for example or any other logic), this logic must be removed. + +* Settings from profile should be honored (`build_type`, `compiler.libcxx`, `compiler.cppstd`, `compiler.runtime` etc). + +* Compiler paths from host profile should be honored and properly propagated to underlying build system during the build: + + | compiler type | conf / env var | + |---------------|----------------| + | C compiler | `c` key of `tools.build:compiler_executables`, otherwise `CC` environment variable | + | C++ compiler | `cpp` key of `tools.build:compiler_executables`, otherwise `CXX` environment variable | + | ASM compiler | `asm` key of `tools.build:compiler_executables`, otherwise `CCAS` environment variable | + | CUDA compiler | `cuda` key of `tools.build:compiler_executables` | + | Fortran compiler | `fortran` key of `tools.build:compiler_executables`, otherwise `FC` environment variable | + | Objective-C compiler | `objc` key of `tools.build:compiler_executables` | + | Objective-C++ compiler | `objcpp` key of `tools.build:compiler_executables` | + | Resource files compiler | `rc` key of `tools.build:compiler_executables`, otherwise `RC` environment variable | + | Archiver | `AR` environment variable | + | Linker | `LD` environment variable | + + They should be curated on the fly if underlying build system expects a specific format (no spaces in path, forward slash instead of back slash, etc). + +* These compiler and linker conf from host profile should be honored and propagated to underlying build system during the build: + * `tools.build:cflags` + * `tools.build:cxxflags` + * `tools.build:defines` + * `tools.build:sharedlinklags` + * `tools.build:exelinkflags` + * `tools.apple:enable_bitcode` (only if host OS is `iOS`/`watchOS`/`tvOS`) + +* Multithread build (if supported by underlying build system): + * if some steps are sensitive to race conditions, monothread should be enforced. + * otherwise multithreaded build should be enabled with a number of cores controlled by `tools.build:jobs` conf from host profile if it is set, otherwise to all cores of build machine. + +## Package Method + +* CMake config files must be removed. They will be generated for consumers by `CMakeDeps` generator (or legacy `cmake_find_package`/`cmake_find_package_multi` generators). + +* pkg-config files must be removed. They will be generated for consumers by `PkgConfigDeps` generator (or legacy `pkg_config` generator). + +* On *nix systems, executables and shared libraries should have empty `RPATH`/`RUNPATH`/`LC_RPATH`. Though, a relative path pointing inside package itself is allowed. + +* On Apple OS family: + * shared libs: name field of `LC_ID_DYLIB` load command must be `@rpath/`. + * shared libs & executables: name field of each `LC_LOAD_DYLIB` load command should be `@rpath/` (except those refering to system libs or frameworks). + +* Installed files must not contain absolute paths specific to build machine. Relative paths to other packages is also forbidden since relative paths of dependencies during build may not be the same for consumers. Hardcoded relative paths pointing to a location in the package itself are allowed. + +* Static and shared flavors of the same library must not be packaged together. + +## Build System Examples + +The [Conan's documentation](https://docs.conan.io) is always a good place for technical details. +General patterns about how they can be used for OSS in ConanCenterIndex can be found in the +[package templates](../package_templates/README.md) sections. These are excellent to copy and start from. + +### Header Only + +If you are looking for header-only projects, you can take a look on [header-only template](../package_templates/header_only). +Also, Conan Docs have a section about [how to package header-only libraries](https://docs.conan.io/en/latest/howtos/header_only.html). + +### CMake + +For C/C++ projects which use CMake for building, you can take a look on [cmake package template](../package_templates/cmake_package). + +Another common use case for CMake based projects, both header only and compiled, is _modeling components_ to match the `find_package` and export the correct targets from Conan's generators. A basic examples of this is [cpu_features](https://github.com/conan-io/conan-center-index/blob/master/recipes/cpu_features/all/conanfile.py), a moderate/intermediate example is [cpprestsdk](https://github.com/conan-io/conan-center-index/blob/master/recipes/cpprestsdk/all/conanfile.py), and a very complex example is [OpenCV](https://github.com/conan-io/conan-center-index/blob/master/recipes/opencv/4.x/conanfile.py). + +### Autotools + +There is an [autotools package template](../package_templates/autotools_package/) amiable to start from. + +However, if you need to use autotools for building, you can take a look on [libalsa](https://github.com/conan-io/conan-center-index/blob/master/recipes/libalsa/all/conanfile.py), [kmod](https://github.com/conan-io/conan-center-index/blob/master/recipes/kmod/all/conanfile.py), [libcap](https://github.com/conan-io/conan-center-index/blob/master/recipes/libcap/all/conanfile.py). + +Many projects offer [**pkg-config**'s](https://www.freedesktop.org/wiki/Software/pkg-config/) `*.pc` files which need to be modeled using components. A prime example of this is [Wayland](https://github.com/conan-io/conan-center-index/blob/master/recipes/wayland/all/conanfile.py). + +### No Upstream Build Scripts + +For cases where a project only offers source files, but not a build script, you can add CMake support, but first, contact the upstream and open a PR offering building support. If it's rejected because the author doesn't want any kind of build script, or the project is abandoned, CCI can accept your build script. Take a look at [Bzip2](https://github.com/conan-io/conan-center-index/blob/master/recipes/bzip2/all/CMakeLists.txt) and [DirectShowBaseClasses](https://github.com/conan-io/conan-center-index/blob/master/recipes/directshowbaseclasses/all/CMakeLists.txt) as examples. + +### System Packages + +> **Note**: For exceptional cases where only system packages can be used and a regular Conan package may result in an incompatible and fragile package, a separated system package may be created. See the [FAQs](../faqs.md#can-i-install-packages-from-the-system-package-manager) for more. + +The [SystemPackageTool](https://docs.conan.io/en/latest/reference/conanfile/methods.html#systempackagetool) can easily manage a system package manager (e.g. apt, +pacman, brew, choco) and install packages which are missing on Conan Center but available for most distributions. It is key to correctly fill in the `cpp_info` for the consumers of a system package to have access to whatever was installed. + +As example there is [xorg](https://github.com/conan-io/conan-center-index/blob/master/recipes/xorg/all/conanfile.py). Also, it will require an exception rule for [conan-center hook](https://github.com/conan-io/hooks#conan-center), a [pull request](https://github.com/conan-io/hooks/pulls) should be open to allow it over the KB-H032. diff --git a/docs/adding_packages/conandata_yml_format.md b/docs/adding_packages/conandata_yml_format.md new file mode 100644 index 0000000000000..84338094c3568 --- /dev/null +++ b/docs/adding_packages/conandata_yml_format.md @@ -0,0 +1,243 @@ +# conandata.yml + +[conandata.yml](https://docs.conan.io/en/latest/reference/config_files/conandata.yml.html) is a [YAML](https://yaml.org/) +file to provide declarative data for the recipe (which is imperative). This is a built-in Conan feature (available since +1.22.0) without a fixed structure, but ConanCenter has a specific format to ensure quality of recipes. + +In the context of ConanCenterIndex, this file is _mandatory_ and consists of two main sections that will be explained in the +next sections with more detail: + +* `sources`: Library sources origin with their verification checksums. +* `patches`: A list of patches to apply and supporting information. See the [Patching Policy](sources_and_patches.md#policy-about-patching) for the criteria. + + +## Contents + + * [sources](#sources) + * [Mirrors](#mirrors) + * [Multiple Assets](#multiple-assets) + * [Different source archives per configuration](#different-source-archives-per-configuration) + * [Sources fields](#sources-fields) + * [url](#url) + * [sha256](#sha256) + * [patches](#patches) + * [Patches fields](#patches-fields) + * [patch_file](#patch_file) + * [patch_description](#patch_description) + * [patch_type](#patch_type) + * [official](#official) + * [vulnerability](#vulnerability) + * [portability](#portability) + * [conan](#conan) + * [bugfix](#bugfix) + * [patch_source](#patch_source) + * [base_path](#base_path) + +## sources + +`sources` is a top level dictionary, containing entries of sources and checksums for each of the supported versions. + +This is the entry that contains all the items that are downloaded from the internet and used in a recipe. This section contains one entry per version and each version should declare its own sources. + +> **Note**: For deciding which source to pick, see [Picking Sources](sources_and_patches.md#picking-the-sources) guide. + +This is a basic example of a regular library, it should satisfy most of the use cases: + +```yml +sources: + "1.2.11": + url: "..." + sha256: "..." + "1.2.12": + url: "..." + sha256: "..." +``` + +Every entry for a version consists in a dictionary with the `url` and the hashing algorithm of the artifact. `sha256` is required, but others like `sha1` or `md5` can be used as well. + +### Mirrors + +Sometimes it is useful to declare mirrors, use a list in the `url` field. Conan will try to download the artifacts from any of those mirrors. + +```yml +sources: + "1.2.11": + url: + - "https://zlib.net/zlib-1.2.11.tar.gz", + - "https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz", + sha256: "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1" +``` + +Keep in mind all the mirrors have to provide the exactly same source (e.g. no repackaging), thus using the same hash sum. + +### Multiple Assets + +It's rare but some projects ship archives missing files that are required to build or specifically to ConanCenter requirements. +You can name each asset and download them in the `conanfile.py`'s `source()` referring to the names. + +```yml +sources: + "10.12.2": + "sources": + url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.12.2/ApprovalTests.v.10.12.2.hpp + sha256: 4c43d0ea98669e3d6fbb5810cc47b19adaf88cabb1421b488aa306b08c434131 + "license": + url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.12.2/LICENSE" + sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 +``` + +You can list as many assets you need and reference them by their index. But make sure you keep them in order if there is any specific +logic about handling. + +```yml +sources: + "10.12.2": + - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.10.12.2/ApprovalTests.v.10.12.2.hpp + sha256: 4c43d0ea98669e3d6fbb5810cc47b19adaf88cabb1421b488aa306b08c434131 + - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.10.12.2/LICENSE" + sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 +``` + +#### Different source archives per configuration + +This is the most advanced and sophisticated use-case, but not so common. Some projects may provide different sources for different platforms, it could be expressed as: + +```yml +sources: + "0066": + "Macos": # Operating system + "x86": # Architecture + - url: "https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0066/C/MacIntel_OSX_AppleC_32bit/packages/cspice.tar.Z" + sha256: "9a4b5f674ea76821c43aa9140829da4091de646ef3ce40fd5be1d09d7c37b6b3" + "x86_64": + - url: "https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0066/C/MacIntel_OSX_AppleC_64bit/packages/cspice.tar.Z" + sha256: "f5d48c4b0d558c5d71e8bf6fcdf135b0943210c1ff91f8191dfc447419a6b12e" +``` + +This approach requires a special code within [build](https://docs.conan.io/en/latest/reference/conanfile/methods.html#build) method to handle. + +### Sources fields + +#### url + +`url` contains a string specifying [URI](https://tools.ietf.org/html/rfc3986) where to download released sources. +Usually, `url` has a [https](https://tools.ietf.org/html/rfc2660) scheme, but other schemes, such as [ftp](https://tools.ietf.org/html/rfc959) are accepted as well. + +#### sha256 + +[sha256](https://tools.ietf.org/html/rfc6234) is a preferred method to specify hash sum for the released sources. It allows to check the integrity of sources downloaded. +You may use an [online service](https://hash.online-convert.com/sha256-generator) to compute `sha256` sum for the given `url`. +Also, you may use [sha256sum](https://linux.die.net/man/1/sha256sum) command ([windows](http://www.labtestproject.com/files/win/sha256sum/sha256sum.exe)). + +## patches + +Sometimes sources provided by project require patching for various reasons. The `conandata.yml` file is the right place to indicate this information as well. + +> **Note**: Under our mission to ensure quality, patches undergo extra scrutiny. **Make sure to review** our +> [Patching Policy](sources_and_patches.md#policy-about-patching) to understand the requirements before adding any. + +This section follows the same pattern as the `sources` above - one entry per version with a list of patches to apply. + +```yaml +patches: + "1.2.0": + - patch_file: "patches/1.2.0-002-link-core-with-find-library.patch" + patch_description: "Link CoreFoundation and CoreServices with find_library" + patch_type: "portability" + patch_source: "https://a-url-to-a-pull-request-mail-list-topic-issue-or-question" +``` + +### Patches fields + +Theres are necessary for Conan to work as well as provide key information to reviewers and consumers which need to understand +the reasoning behind patches. + +#### patch_file + +_Required_ + +Patch file that are committed to the ConanCenterIndex, go into the `patches` sub-directory (next to the `conanfile.py`). Such patch files usually have either `.diff` or `.patch` extension. The recommended way to generate such patches is [git format-patch](https://git-scm.com/docs/git-format-patch). The path to the patch is relative to the directory containing `conandata.yml` and `conanfile.py`. + +#### patch_description + +_Required_ + +`patch_description` is an arbitrary text describing the following aspects of the patch: + +* What does patch do (example - `add missing unistd.h header`) +* Why is it necessary (example - `port to Android`) +* How exactly does patch achieve that (example - `update configure.ac`) + +An example of a full patch description could be: `port to Android: update configure.ac adding missing unistd.h header`. + +#### patch_type + +_Required_ + +The `patch_type` field specifies the type of the patch. In ConanCenterIndex we currently accept only several kind of patches: + +##### official + +`patch_type: official` indicates the patch is distributed with source code itself. usually, this happens if release managers +failed to include a critical fix to the release, but it's too much burden for them to make a new release just because of that single fix. +[example](https://www.boost.org/users/history/version_1_72_0.html) (notice the `coroutine` patch). The [`patch_source`](#patch_source) +field shall point to the official distribution of the patch. + +##### vulnerability + +`patch_type: vulnerability`: Indicates a patch that addresses the security issue. The patch description should include the index of CVE +or CWE the patch addresses. Usually, original library projects do new releases fixing vulnerabilities for this kind of issues, but in some +cases they are either abandoned or inactive. The [`patch_source`](#patch_source) must be a commit to the official fix of the vulnerability. + +##### portability + +`patch_type: portability`: Indicates a patch that improves the portability of the library, e.g. adding supports of new architectures (ARM, Sparc, etc.), operating systems (FreeBSD, Android, etc.), compilers (Intel, MinGW, etc.), and other types of configurations which are not originally supported by the project. +In such cases, the patch could be adopted from another package repository (e.g. MSYS packages, Debian packages, Homebrew, FreeBSD ports, etc.). +Patches of this kind are preferred to be submitted upstream to the original project repository first, but it's not always possible. +Some projects simply do not accept patches for platforms they don't have a build/test infrastructure, or maybe they are just either abandoned or inactive. + +##### conan + +`patch_type: conan`: Indicates a patch that is Conan-specific, patches of such kind are usually not welcomed upstream at all, because they provide zero value outside of Conan. +Examples of such a patches may include modifications of build system files to allow dependencies provided by Conan instead of dependencies provided by projects themselves (e.g. as submodule or just 3rd-party sub-directory) or by the system package manager (rpm/deb). +Such patches may contain variables and targets generated only by Conan, but not generated normally by the build system (e.g. `CONAN_INCLUDE_DIRS`). + +##### bugfix + +> **Warning**: These will undergo extra scrutiny during review as they may modify the source code. + +`patch_type: bugfix`: Indicates a patch that backports an existing bug fix from the newer release or master branch (or equivalent, such as main/develop/trunk/etc). The [`patch_source`](#patch_source) may be a pull request, or bug within the project's issue tracker. +Backports are accepted only for bugs that break normal execution flow, never for feature requests. +Usually, the following kind of problems are good candidates for backports: + +* Program doesn't start at all. +* Crash (segmentation fault or access violation). +* Hang up or deadlock. +* Memory leak or resource leak in general. +* Garbage output. +* Abnormal termination without a crash (e.g. just exit code 1 at very beginning of the execution). +* Data corruption. +* Use of outdated or deprecated API or library. + +As sources with backports don't act exactly the same as the version officially released, it may be a source of confusion for the consumers who are relying on the buggy behavior (even if it's completely wrong). Therefore, it's required to introduce a new `cci.` version for such backports, so consumers may choose to use either official version, or modified version with backport(s) included. + +#### patch_source + +_Recommended_ + +`patch_source` is the URL from where patch was taken from. https scheme is preferred, but other URLs (e.g. git/svn/hg) are also accepted if there is no alternative. Types of patch sources are: + +* Link to the public commit in project hosting like GitHub/GitLab/BitBucket/Savanha/SourceForge/etc. +* Link to the Pull Request or equivalent (e.g. gerrit review). +* Link to the bug tracker (such as JIRA, BugZilla, etc.). +* Link to the mail list discussion. +* Link to the patch itself in another repository (e.g. MSYS, Debian, etc.). + +For the `patch_type: portability` there might be no patch source matching the definition above. Although we encourage contributors to submit all such portability fixes upstream first, it's not always possible (e.g. for projects no longer maintained). In that case, a link to the Conan issue is a valid patch source (if there is no issue, you may [create](https://github.com/conan-io/conan-center-index/issues/new/choose) one). +For the `patch_type: conan`, it doesn't make sense to submit patch upstream, so there will be no patch source. + +#### base_path + +_Optional_ + +Specifies a sub-directory in project's sources to apply patch. This directory is relative to the [source_folder](https://docs.conan.io/en/latest/reference/conanfile/attributes.html?highlight=source_folder#source-folder). Usually, it would be a `source_subfolder`, but could be a lower-level sub-directory (e.g. if it's a patch for a submodule). diff --git a/docs/adding_packages/conanfile_attributes.md b/docs/adding_packages/conanfile_attributes.md new file mode 100644 index 0000000000000..be94297dfa798 --- /dev/null +++ b/docs/adding_packages/conanfile_attributes.md @@ -0,0 +1,193 @@ +# `ConanFile` Attributes + +The `ConanFile` class has a lot of different properties that can help consumers search for projects, help the client build packages for different configurations +or are known by ConanCenter's build service and have special meaning. + + +## Contents + + * [Attributes](#attributes) + * [Name](#name) + * [Version](#version) + * [ConanCenter specific releases format](#conancenter-specific-releases-format) + * [License Attribute](#license-attribute) + * [Order of methods and attributes](#order-of-methods-and-attributes) + * [Settings](#settings) + * [Options](#options) + * [Recommended Names](#recommended-names) + * [Predefined Options and Known Defaults](#predefined-options-and-known-defaults) + * [Options to Avoid](#options-to-avoid) + +## Attributes + +These are a [key feature](https://docs.conan.io/en/latest/reference/conanfile/attributes.html) which allow the Conan client to understand, +identify, and expose recipes and which project they expose. + +In ConanCenter, there are a few conventions that need to be respected to ensure recipes can be discovered there `conan search` command +of through the web UI. Many of which are enforces with the [hooks](../error_knowledge_base.md). + +### Name + +Same as the _recipe folder_ and always lowercase. + +Please see the FAQs for: + +* [name collisions](../faqs.md#what-is-the-policy-on-recipe-name-collisions) +* [space and symbols](../faqs.md#should-reference-names-use---or-_) + +### Version + +ConanCenter is geared towards quickly added new release, the build service always pass the version it is currently building to the recipe. +The `version` attribute MUST NOT be added to any recipe - with exception to "system packages". + +#### ConanCenter specific releases format + +The notation shown below is used for publishing packages which do not match the original library's official releases. This format which includes the "datestamp" corresponding to the date of a commit: `cci.`. + +In order to create reproducible builds, we also "commit-lock" to the latest commit on that day. Otherwise, users would get inconsistent results over time when rebuilding the package. An example of this is the [RapidJSON](https://github.com/Tencent/rapidjson) library, where its package reference is `rapidjson/cci.20200410` and its sources are locked the latest commit on that date in [config.yml](https://github.com/conan-io/conan-center-index/blob/master/recipes/rapidjson/config.yml#L4). The prefix `cci.` is mandatory to distinguish as a virtual version provided by CCI. If you are interested to know about the origin, please, read [here](https://github.com/conan-io/conan-center-index/pull/1464). + +### License Attribute + +The mandatory license attribute of each recipe **should** be a [SPDX license](https://spdx.org/licenses/) [short Identifiers](https://spdx.dev/ids/) when applicable. + +Where the SPDX guidelines do not apply, packages should do the following: + +* When no license is provided or it's under the ["public domain"](https://fairuse.stanford.edu/overview/public-domain/welcome/) - these are not a license by itself. Thus, we have [equivalent licenses](https://en.wikipedia.org/wiki/Public-domain-equivalent_license) that should be used instead. If a project falls under these criteria it should be identified as the [Unlicense](https://spdx.org/licenses/Unlicense) license. +* When a custom (e.g. project specific) license is given, the value should be set to `LicenseRef-` as a prefix, followed by the name of the file which contains the custom license. See [this example](https://github.com/conan-io/conan-center-index/blob/e604534bbe0ef56bdb1f8513b83404eff02aebc8/recipes/fft/all/conanfile.py#L8). For more details, [read this conversation](https://github.com/conan-io/conan-center-index/pull/4928/files#r596216206). + + +## Order of methods and attributes + +Prefer the following order of documented methods in python code (`conanfile.py`, `test_package/conanfile.py`): + +For `conan create` the order is listed [here](https://docs.conan.io/en/latest/reference/commands/creator/create.html#methods-execution-order) +test packages recipes should append the following methods: + +* deploy +* test + +the order above resembles the execution order of methods on CI. therefore, for instance, `build` is always executed before `package` method, so `build` should appear before the +`package` in `conanfile.py`. + +## Settings + +As a general rule, recipes should set the `settings` attribute to: `os`, `arch`, `compiler` and `build_type`, and let Conan compute the package ID based on the settings. Some exceptions apply, as detailed below. For cases not covered here, please reach out to the Conan Center maintainers team for assistance. The following list is not exhaustive: + +* **Recipes for _header only_ libraries** or where the contents of the package are the same irrespective of settings, might omit the `settings` attribute altogether, unless there is any logic conditional on a setting value. If the recipe has options or dependencies, but the contents of the package are invariant irrespective of their values, the following logic must be added to ensure a single, unique package ID: + + ```python + def package_id(self): + self.info.clear() + ``` + +* **Recipes that primarily provide _compiled_ applications** (e.g. `b2`, `cmake`, `make`, ...), which typically applies to packages that are consumed as _tool requires_) must list all + the settings as well, as they are required during package creation. However, it is advised that the `compiler` setting is removed one in the `package_id()` method as follows: + + ```python + def package_id(self): + del self.info.settings.compiler + ``` + + This reflects those cases where tools are consumed exclusively as executables, irrespective of how they were built. Additionally, this reduces the number of configurations generated by CI. + + > **Note** We do not recommend removing the `build_type` setting on these packages, in order to preserve the ability of consumers to run debug executables should they wish to do so. + +## Options + +Recipes can list any number of options with any meaning, and defaults are up to the recipe itself. The CI cannot enforce anything +in this direction. However, there are a couple of options that have a special meaning for the CI. + +### Recommended Names + +Adding options is often needed to toggle specific library features on/off. Regardless of the default, there is a strong preference for using positive naming for options. In order to avoid the fragmentation, we recommend using the following naming conventions for such options: + +* enable_ / disable_ +* with_ / without_ +* use_ + +The actual recipe code then may look like: + +```py + options = {"enable_locales": [True, False]} # Changes which files are compiled in to the library + default_options = {"enable_locales": True} +``` + +```py + options = {"with_zlib": [True, False]} # Will add a `self.requires` with more deps to link against + default_options = {"with_zlib": True} +``` + +```py + options = {"use_tzdb": [True, False]} # Might install more headers to expose more features + default_options = {"use_tzdb": True} +``` + +Having the same naming conventions for the options helps consumers. It allows users to specify options with wildcards: `-o *:with_threads=True`. Therefore, the `with_threads` options will be enabled for all packages in the graph that support it. + +### Predefined Options and Known Defaults + +ConanCenter supports many combinations, these are outline in the [supported configurations](../supported_platforms_and_configurations.md) document for each platform. +By default recipes should use `shared=False` with `fPIC=True`. If support, `header_only=False` is the default. + +Usage of each option should follow the rules: + +* `shared` (with values `True` or `False`). The CI inspects the recipe looking for this option. The **default should be `shared=False`** and will + generate all the configurations with values `shared=True` and `shared=False`. + + > **Note**: The CI applies `shared=True` only to the package being built, while every other requirement will `shared=False`. To consume everything as a shared library you will set `--build=always` and/or `-o *:shared=True`) + > It's important to keep this in mind when trying to consume shared packages from ConanCenter + > as their requirements were linked inside the shared library. See [FAQs](../faqs.md#how-to-consume-a-graph-of-shared-libraries) for more information. + +* `fPIC` (with values `True` or `False`). The **default should be `fPIC=True`** and will generate all the configurations with values `fPIC=True` and `fPIC=False`. + This option does not make sense on all the support configurations so it should be removed. + + ```python + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + ``` + +* `header_only` (with values `True` or `False`). The **default should be `header_only=False`**. If the CI detects this option, it will generate all the + configurations for the value `header_only=False` and add one more configuration with `header_only=True`. **Only one package** + will be generated for `header_only=True`, so it is crucial that the package is actually a _header only_ library, with header files only (no libraries or executables inside). + + Recipes with such option should include the following in their `package_id` method + + ```python + def package_id(self): + if self.options.header_only: + self.info.clear() + ``` + + ensuring that, when the option is active, the recipe ignores all the settings and only one package ID is generated. + +### Options to Avoid + +* `build_testing` should not be added, nor any other related unit test option. Options affect the package ID, therefore, testing should not be part of that. + Instead, use Conan config [skip_test](https://docs.conan.io/en/latest/reference/config_files/global_conf.html#tools-configurations) feature: + + ```python + def generate(self): + tc = CMakeToolChain(self) + tc.variables['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=true, check_type=bool) + ``` + + The `skip_test` configuration is supported by [CMake](https://docs.conan.io/en/latest/reference/build_helpers/cmake.html#test) and [Meson](https://docs.conan.io/en/latest/reference/build_helpers/meson.html#test). + + ### Removing from `package_id` + + By default, options are included in the calculation for the `package_id` ([docs](https://docs.conan.io/en/latest/reference/conanfile/methods.html#package-id)). + Options which do not impact the generated packages should be deleted, for instance adding a `#define` for a package. + + ```python +def package_id(self): + del self.info.options.enable_feature + +def package_info(self): + if self.options.enable_feature: + self.cpp_info.defines.append("FOBAR_FEATURE=1") +``` diff --git a/docs/adding_packages/dependencies.md b/docs/adding_packages/dependencies.md new file mode 100644 index 0000000000000..ec2c265059824 --- /dev/null +++ b/docs/adding_packages/dependencies.md @@ -0,0 +1,193 @@ +# Dependencies + +This section outlines all the practices and guidelines for the `requirements()` and `build_requirements()` methods. This includes everything +from handling "vendored" dependencies to what versions should be used. + + +## Contents + + * [List Dependencies](#list-dependencies) + * [Optional Requirements](#optional-requirements) + * [Build Requirements](#build-requirements) + * [Accessing Dependencies](#accessing-dependencies) + * [Handling Requirement's Options](#handling-requirements-options) + * [Verifying Dependency's Version](#verifying-dependencys-version) + * [Passing Requirement's info to `build()`](#passing-requirements-info-to-build) + * [Overriding the provided properties from the consumer](#overriding-the-provided-properties-from-the-consumer) + * [Adherence to Build Service](#adherence-to-build-service) + * [Version Ranges](#version-ranges) + * [Handling "internal" dependencies](#handling-internal-dependencies) + +## List Dependencies + +Since all ConanCenterIndex recipes are to build and/or package projects they are exclusively done in [`conanfile.py`](https://docs.conan.io/en/latest/reference/conanfile.html). This offers a few +ways to add requirements. The most common way is [requirements](https://docs.conan.io/en/latest/reference/conanfile/methods.html#requirements): + +```py + def requirements(self): + self.requires("fmt/9.1.0") +``` + +> **Note**: With Conan 2.0, you'll also need to pay attention to new properties like the `transitive_header` attributed which is +> needed when a project include a dependencies header files in its public headers. + +When a project supports a range of version of a dependency, it's generally advised to pick the **most recent available in ConanCenter**. +This helps ensure there are fewer conflicts with other, up to-date, recipes that share the same requirement. + +### Optional Requirements + +Many projects support enabling certain features by adding dependencies. In ConanCenterIndex this is done by adding an option, see +[naming recommendation](conanfile_attributes.md#recommended-names), which should be set to match the upstream project's by default. + +```py +class ExampleConan(ConanFile): + options = { + "with_zlib": [True, False], # Possible values + } + default_options = { + "with_zlib": True, # Should match upstream's CMakeLists.txt `option(...)` + } + + def requirements(self): + if self.options.with_zlib: + self.requires("zlib/1.2.13") +``` + +If a dependency was added (or removed) with a release, then the `if` condition could check [`self.version`](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#version). Another common case is +`self.settings.os` dependant requirements which need to be added for certain plaforms. + +### Build Requirements + +In ConanCenter we only assume +[CMake is available](../faqs.md#why-recipes-that-use-build-tools-like-cmake-that-have-packages-in-conan-center-do-not-use-it-as-a-build-require-by-default). +If a project requires any other specific tool, those can be added as well. We like to do this with [build_requirements](https://docs.conan.io/en/latest/reference/conanfile/methods.html#build-requirements): + +```py + def build_requirements(self): + self.tool_requires("ninja/1.1.0") +``` + +## Accessing Dependencies + +It's fairly common to need to pass information from a dependency to the project. This is the job of the [`generate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#generate) method. This +is generally covered by the built-in generators like [`CMakeDeps`](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmakedeps.html) +However the [`self.dependencies`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html?highlight=generate) are available. + +Alternatively, a project may depend on a specific versions or configuration of a dependency. This use case is again covered by the +[`self.dependencies`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html?highlight=validate) within the +[`validate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#validate) method. Additionally it's possible to suggest the option's values while the graph is built through [`configure()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#configure-config-options) +this is not guaranteed and not a common practice. + +### Handling Requirement's Options + +Forcing options of dependencies inside a ConanCenter should be avoided, except if it is mandatory for the library to build. +Our general belief is the users input should be the most important; it's unexpected for command line arguments to be over ruled +by specifc recipes. + +You need to use the [`validate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#validate) method in order to ensure they check after the Conan graph is completely built. + +Certain projects are dependent on the configuration (also known as options) of a dependency. This can be enforced in a recipe by +accessing the [`options`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html?highlight=options) field of +the dependency. + +```py + def configure(self): + self.options["foobar"].enable_feature = True # This will still allow users to override this option + + def validate(self): + if not self.dependencies["foobar"].options.enable_feature: + raise ConanInvalidConfiguration(f"{self.ref} requires foobar/*:enable_feature=True.") +``` + +### Verifying Dependency's Version + +Some project requirements need to respect a version constraint, this can be done as follows: + +```py +def validate(self): + if Version(self.dependencies["foobar"].ref.version) < "1.2": + raise ConanInvalidConfiguration(f"{self.ref} requires [foobar>=1.2] to build and work.") +``` + +### Passing Requirement's info to `build()` + +The [`self.dependencies`](https://docs.conan.io/en/latest/reference/conanfile/dependencies.html) are limited to [`generate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#generate) and [`validate()`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#validate). This means configuring a projects build scripts +is a touch more complicated when working with unsupported build scripts. + +In general, with [CMake](https://cmake.org/) project, this can be very simple with the [`CMakeToolchain`](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmaketoolchain.html), such as: + +```py + def generate(self): + tc = CMakeToolchain(self) + # deps_cpp_info, deps_env_info and deps_user_info are no longer used + if self.dependencies["dependency"].options.foobar: + tc.variables["DEPENDENCY_LIBPATH"] = self.dependencies["dependency"].cpp_info.libdirs +``` + +This pattern can be recreated for less common build system by, generating a script to call configure or capture the +required values in a YAML files for example. + +> **Note**: This needs to be saved to disk because the [`conan install`](https://docs.conan.io/en/latest/reference/commands/consumer/install.html) and [`conan build`](https://docs.conan.io/en/latest/reference/commands/development/build.html) commands can be separated when +> developing packages so for this reason the `class` may not persists the information. This is a very common workflow, +> even used in ConanCenter in other areas such as testing. + +```py +from conan import ConanFile +from conan.tools.files import save, load + + +class ExampleConan(ConanFile): + _optional_build_args = [] + + @property + def _optional_build_args_filename(self): + return os.path.join(self.recipe_folder, self.folders.generators, "build_args.yml") + + def generate(self): + # This is required as `self.dependencies` is not available in `build()` or `test()` + if self.dependencies["foobar"].options.with_compression: + self._optional_build_args.append("--enable-foobar-compression") + + save(self, self._optional_build_args_filename, file) + + def build(self): + opts_args = load(self, self._optional_build_args_filename) + # Some magic setup + self.run(f"./configure.sh {opts_args}") +``` + +### Overriding the provided properties from the consumer + +> **Note**: This was adding in [Conan 1.55](https://github.com/conan-io/conan/pull/12609) to the generators... we need to +> write docs for when that's available + +## Adherence to Build Service + +It's very rare we layout "rules", most often it's guidelines, however in order to ensure graph and the package generated are usable +for consumer, we do impose some limits on Conan features to provide a smoother first taste to using Conan. + +> **Note**: These are very specific to the ConanCenter being the default remote and may not be relevant to your specifc use case. + +* [Version ranges](https://docs.conan.io/en/latest/versioning/version_ranges.html) are not allowed. +* Specify explicit [RREV](https://docs.conan.io/en/latest/versioning/revisions.html) (recipe revision) of dependencies is not allowed. +* Only ConanCenter recipes are allowed in `requires`/`requirements()` and `build_requires`/`build_requirements()`. +* [`python_requires`](https://docs.conan.io/en/latest/reference/conanfile/other.html#python-requires) are not allowed. + +### Version Ranges + +Version ranges are a useful Conan feature, [documentation here](https://docs.conan.io/en/latest/versioning/version_ranges.html). However, +in the context of ConanCenter they pose a few key challenges when being used generally to consume packages, most notably: + +* Non-Deterministic `package-id`: With version ranges the newest compatible package may yield a different `package_id` than the one built + and published by ConanCenter resulting in frustrating error "no binaries found". For more context + see [this excellent explanation](https://github.com/conan-io/conan-center-index/pull/8831#issuecomment-1024526780). + +* Build Reproducibility: If consumers try to download and build the recipe at a later time, it may resolve to a different package version + that may generate a different binary (that may or may not be compatible). In order to prevent these types of issues, we have decided to + only allow exact requirements versions. This is a complicated issue, + [check this thread](https://github.com/conan-io/conan-center-index/pull/9140#discussion_r795461547) for more information. + +## Handling "internal" dependencies + +Vendoring in library source code should be removed (best effort) to avoid potential ODR violations. If upstream takes care to rename +symbols, it may be acceptable. diff --git a/docs/adding_packages/folders_and_files.md b/docs/adding_packages/folders_and_files.md new file mode 100644 index 0000000000000..2149e21f0e4c7 --- /dev/null +++ b/docs/adding_packages/folders_and_files.md @@ -0,0 +1,192 @@ +# Folder and Files Structure + +ConanCenterIndex has a specific structure for its recipes, this allows the [build service](../README.md#the-build-service) +to work most efficiently. + + +## Contents + + * [Recipe File Structure](#recipe-file-structure) + * [`config.yml`](#configyml) + * [The _recipe folder_](#the-_recipe-folder_) + * [`conandata.yml`](#conandatayml) + * [`conanfile.py`](#conanfilepy) + * [`test_package`](#test_package) + +## Recipe File Structure + +Every entry in the `recipes` folder contains all the files required by Conan to create the binaries for all the versions of one library. Those +files don't depend on any other file in the repository (we are not using `python_requires`) and every pull-request can modify only one of those +folders at a time. + +This is the canonical structure of one of these folders, where the same `conanfile.py` recipe is suitable to build all the versions of the library: + +> **Note**: For updating the structure during the [v2 migration](../v2_migration.md) see the [test package](test_packages.md#cmake-targets) document. + +```txt +. ++-- recipes +| +-- library_name/ +| +-- config.yml +| +-- all/ +| +-- conanfile.py +| +-- conandata.yml +| +-- patches/ +| +-- add-missing-string-header-2.1.0.patch +| +-- test_package/ +| +-- conanfile.py +| +-- CMakeLists.txt +| +-- test_pacakge.cpp +``` + +If it becomes too complex to maintain the logic for all the versions in a single `conanfile.py`, it is possible to split the folder `all/` into +more folders, dedicated to different versions, each one with its own `conanfile.py` recipe. In any case, those folders should replicate the +same structure. + +### `config.yml` + +This file lists the versions that should be built along with the corresponding [recipe folder](#the-recipe-folder) that will be used to package the project. + +> **Note**: It's strongly preferred to only have one recipe which should be in the `all/` folder. + +```yml +versions: + # It's encouraged to add new versions on the top + "2.1.0": + folder: all + "2.0.0": + folder: all +``` + +This simple file has the following format: + +* `versions` is a top level dictionary, containing a list of known versions. +* `folder` is a string entry providing the name of the folder, relative to the current directory where the `conanfile.py` that +can package that given folder. + +If it's not possible to maintain one recipe for all version, older version maybe moved to a separate folder. + +```yml +versions: + "2.1.0": + folder: all + "2.0.0": + folder: all + "1.1.1": + folder: 1.x.x # Older version with different build system and options that are not compatible with newer version +``` + +### The _recipe folder_ + +This contains every needed to build packages. + +#### `conandata.yml` + +This file lists **all the sources** that are needed to build the package. The most common examples are +source code, build scripts, license files. + +The file is organized into two sections, `"sources"` and `"patches"`, each one of them contains the files that are required +for each version of the library. Resources which need to be downloaded are listed under `"source"` should include a checksum +to validate that they do not change. This helps to ensure the build is reproducible at a later point in time. Often +modifications are required for a variety of reasons, which ones are associated to which version are listed under the `"patches"`. + +```yml +sources: + "9.0.0": + url: "https://github.com/fmtlib/fmt/archive/9.0.0.tar.gz" + sha256: "9a1e0e9e843a356d65c7604e2c8bf9402b50fe294c355de0095ebd42fb9bd2c5" +``` + +For more information about picking source tarballs, adding or removing versions, or what the rules are for patches, continue reading our +[Sources and Patches](sources_and_patches.md) guide. + +> **Note**: Under our mission to ensure quality, patches undergo extra scrutiny. **Make sure to review** our +> [modifying sources policy](sources_and_patches.md#policy-about-patching) before making changes. + +A detailed breakdown of all the fields can be found in [conandata_yml_format.md](conandata_yml_format.md). We **strongly** recommend adding the +[patch fields](conandata_yml_format.md#patches-fields) to help track where patches come from and what issue they solve. + +Inside the `conanfile.py` recipe, this data is available in a `self.conan_data` attribute that can be used as follows: + +```py +def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) +``` + +See the [Export Patches](sources_and_patches.md#exporting-patches) and [Applying Patches](sources_and_patches.md#applying-patches) +for more use cases and examples. + +#### `conanfile.py` + +This file is the recipe, it contains the logic to build the libraries from source for all the configurations. +It's the single most important part of writing a package. Every `conanfile.py` should be accompanied by at least one +[folder to test the generated packages](#test_package). + +Each recipe should derive the `ConanFile` class and implement key attributes and methods. + +* Basic attributes and conversions can be found in [`ConanFile` attributes](conanfile_attributes.md) +* Some of the key methods are outlined in this document and will link to more details + +```python +from conan import ConanFile + +class FmtConan(ConanFile): + name = "fmt" + homepage = "https://github.com/fmtlib/fmt" + # ... +``` + +When a package needs other packages those can be include with the `requirements()` method. + +```python + def requirements(self): + self.require("fmt/9.0.0") +``` + +For more information see the [Dependencies](dependencies.md) documentation. + +For compiled libraries, the `build()` method is used along side the [build helpers](https://docs.conan.io/en/latest/reference/build_helpers.html). +This allows you to use the official build script from a project, see [build and package](build_and_package.md) instructions. + +```python + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() +``` + +Most of the projects with build scripts support installing the important files. Avoid installing documentation or examples. + +```python + def package(self): + cmake = CMake(self) + cmake.configure() + cmake.install() +``` + +For some projects, you will need to manually copy files. +Here's an example for a header only library: + +```python + def package(self): + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) +``` + +#### `test_package` + +All the packages in this repository need to be tested before they join ConanCenter. A `test_package` folder with its +corresponding `conanfile.py` and a minimal project to test the package is strictly required. You can read about it in the +[Conan documentation](https://docs.conan.io/en/latest/creating_packages/getting_started.html) and learn about ConanCenterIndex +specific conventions in [test package](test_packages.md) section. + +The goal for the test package is to make sure the + +* header files are available +* libraries are available to link against +* components are correctly exposed + +> **Note** It's required to verify that the old generators are not broken. You can do so by using the pattern, see +> [KB-H073](../error_knowledge_base.md#kb-h078) for details. + +Remember that the `test_` recipes should **test the package configuration that has just been generated** for the +_host_ context, otherwise it will fail in cross-building scenarios. diff --git a/docs/adding_packages/sources_and_patches.md b/docs/adding_packages/sources_and_patches.md new file mode 100644 index 0000000000000..5032bc50a5949 --- /dev/null +++ b/docs/adding_packages/sources_and_patches.md @@ -0,0 +1,199 @@ +# Sources and Patches + +This documents contains everything related to the `source()`. This includes picking sources, where they should come from and goes into when and how to modify sources. +These are a very important aspects and it helps us to establish the quality of the packages offered by ConanCenter. + + +## Contents + + * [Picking the Sources](#picking-the-sources) + * [Source immutability](#source-immutability) + * [Sources not accessible](#sources-not-accessible) + * [Supported Versions](#supported-versions) + * [Removing old versions](#removing-old-versions) + * [Adding old versions](#adding-old-versions) + * [Policy about patching](#policy-about-patching) + * [Format and Conventions](#format-and-conventions) + * [Exporting Patches](#exporting-patches) + * [Applying Patches](#applying-patches) + * [Rules](#rules) + * [Exceptions](#exceptions) + +## Picking the Sources + +This is one of the most important steps when contributing and the quality of the sources directly dictates the quality of the packages produced. +The **origin of sources** should come from an official origin like the library source code repository or the official +release/download webpage. If an official source archive is available, it should be preferred over an auto-generated archive. + +Recipes should always be **built from library sources**. It aims to provide packages that respect the complete setting model of Conan. +Where ever possible, downloading source files and compiling is mandated. Downloading pre-compiled binaries should be avoided. + +### Source immutability + +Downloaded source code must have a deterministic results where the exact same archive is download each time. See +[Conandata's `"sha"` fields](conandata_yml_format.md#sha256) for how this is achieved in ConanCenterIndex. + +The sources stored under `self.source_folder` should not be modified. This will enable local workflows to "keep sources" and avoid extra downloads. +Any patch should be applied to the copy of this source code when a build is executed (basically in `build()` method). See [Applying Patches](#applying-patches) +below for more information. + +### Sources not accessible + +Library sources that are not publicly available will not be allowed in this repository even if the license allows their redistribution. See +our [closed source FAQ answer for more](../faqs.md#how-to-package-libraries-that-depend-on-proprietary-closed-source-libraries). +If library sources cannot be downloaded from their official origin or cannot be consumed directly due to their +format, the recommendation is to contact the publisher and ask them to provide the sources in a way/format that can be consumed +programmatically. + +As a final option, in case you need to use those binaries as a "build require" for some library, we will consider adding it +as a system recipe (`/system`) and making those binaries available in the CI machines (if the license allows it). + +## Supported Versions + +In this repository we are building a subset of all the versions for a given library. This set of version changes over time as new versions +are released and old ones stop being used. + +We always welcome latest releases as soon as they are available, and from time to time we remove old versions mainly due to technical reasons: +the more versions we have, the more resources that are needed in the CI and the more time it takes to build each pull-request (also, the +more chances of failing because of unexpected errors). + +### Removing old versions + +The Conan Team may ask you to remove more if they are taking a lot of resources. When removing old versions, please follow these considerations: + +* keep one version for every major release +* for the latest major release, at least three versions should be available (latest three minor versions) + +Logic associated with removed revisions implies that entries in the `config.yml` and `conandata.yml` files should also be removed. If anyone needs to +recover them in the future, Git contains the full history and changes can be recovered from it. + +Please, note that even if those versions are removed from this repository, **the packages will always be accessible in ConanCenter remote** +associated to the recipe revision used to build them. + +### Adding old versions + +We love to hear why in the opening description of the pull requests you need this exact version. +We usually don't add old versions unless there is a specific request for it. Adding versions that are not used by author of the pull request reduces overall resources and time from [the build services](README.md#the-build-service). + +Take into account that the version might be removed in future pull requests according to the [guidelines above](#removing-old-versions). + +## Policy about patching + +The main guideline in ConanCenter is to provide already compiled binaries for a set of architectures in the least surprising way as possible, so Conan +can be plugged into existing projects trying to minimize the modifications needed. Packages from Conan Center should fulfill the expectations of anyone +reading the changelog of the library, the documentation, or any statement by the library maintainers. + +### Format and Conventions + +Patch files are preferred over programmatic `replace_in_file` statements. This makes it easier to review and prevent +unwanted side effects when new versions are added. They will be listed in [`conandata.yml`](conandata_yml_format.md) +file and exported together with the recipe. Patches must always include [patch fields](conandata_yml_format.md#patches-fields) +which are enforced by the [linters](../../linter/conandata_yaml_linter.py). + +Patches must be located in the recipe folder in a `patches/` sub-directory. + +There are a few recommendations about naming patches: + +* be descriptive but terse +* number them so they can be re-used +* note the specific version + +By clearly indicating what the patch does, when it's applied, and how it relates to existing patches, you can +help make the [review process](../review_process.md) easier for readers and help speed up your pull requests. + +### Exporting Patches + +It's ideal to minimize the number of files in a package to exactly what's required. When recipes support multiple +versions with differing patches, it's strongly encouraged to only export the patches used for that given recipe. + +Make sure the `export_sources` attribute is replaced by +[`conan.tools.files.export_conandata_patches`](https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html?highlight=export_conandata_patches) +helper. + +```py +def export_sources(self): + export_conandata_patches(self) +``` + +### Applying Patches + +Patches can be applied in a separate method, the pattern name is `_patch_sources`. When applying patch files, +using [`conan.tools.files.apply_conandata_patches`](https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html?highlight=apply_conandata_patches) +is the best option. + +```py +def build(self): + apply_conandata_patches(self) +``` + +For more complicated cases, +[`conan.tools.files.rm`](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-rm) +or [`conan.tools.files.replace_in_file`](https://docs.conan.io/en/latest/reference/conanfile/tools/files/basic.html#conan-tools-files-replace-in-file) +are good choices. + +```py +def _patch_sources(self): + # remove bundled libfmt + rmdir(self, os.path.join(self.source_folder, "lib", "fmt")) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "${CMAKE_SOURCE_DIR}", "${CMAKE_CURRENT_SOURCE_DIR}") +``` + +### Rules + +These are the rules that apply to regular versions of Conan packages: + +**Build system patches.** In order to add libraries into ConanCenter sometimes +it is NEEDED to apply patches so they can consume existing packages +for requirements and binaries can be generated. These patches are totally +needed for the purpose of ConanCenter and Conan keeps adding features trying +to minimize these changes. + +**Source patches.** ConanCenter DOES NOT accept patches **backporting bugfixes or +features** from upcoming releases, they break the principle of minimum surprise, +they change the behavior of the library and it will no longer match the +documentation or the changelog originally delivered by the authors. + +However, ConanCenter DOES accept **working software patches**, these patches +are needed to generate the binaries for architectures not considered by +library maintainers, or to use some compilers or configurations. These patches +make it possible to generate binaries that cannot be generated otherwise, or +they can turn a crashing binary into a working software one (bugs, errors, or +faults are considered working software as long as they produce deterministic +results). + +Patches to sources to add support to newer versions of dependencies are +considered feature patches and they are not allowed either. They can +introduce new behaviors or bugs not considered when delivering the +library by maintainers. If a requirement is known not to work, the recipe +should raise a `ConanInvalidConfiguration` from the `validate()` method. + +**Vulnerability patches.** Patches published to CVE databases or declared as +vulnerabilities by the authors in non-mainstream libraries WILL be applied +to packages generated in Conan Center. + +**Official release patches.** If the library documents that a patch should be +applied to sources when building a tag/release from sources, ConanCenter WILL +apply that patch too. This is needed to match the documented behavior or the +binaries of that library offered by other means. +[Example here](https://www.boost.org/users/history/version_1_73_0.html). + +### Exceptions + +Exceptionally, we might find libraries that aren't actively developed and consumers +might benefit from having some bugfixes applied to previous versions while +waiting for the next release, or because the library is no longer maintained. These +are the rules for this exceptional scenario: + +* **new release**, based on some official release and clearly identifiable will + be created to apply these patches to: <>. +* **only patches backporting bugfixes** will be accepted after they have + been submitted to the upstream and there is a consensus that it's a bug and the patch is the solution. + +ConanCenter will build this patched release and serve its binaries like it does with +any other Conan reference. + +Notice that these <> releases are unique to ConanCenter +and they can get new patches or discard existing ones according to upstream +considerations. It means that these releases will modify their behavior without previous +notice, the documentation or changelog for these specific releases won't exist. Use +them carefully in your projects. diff --git a/docs/adding_packages/test_packages.md b/docs/adding_packages/test_packages.md new file mode 100644 index 0000000000000..c37f824816aba --- /dev/null +++ b/docs/adding_packages/test_packages.md @@ -0,0 +1,111 @@ +# Test Packages + +This is the main way that ConanCenter is able to validate the contents of a package are valid. +It is required to provide a [`test_package/`](https://docs.conan.io/en/latest/reference/commands/creator/create.html?highlight=test_package) +sub-directory with every recipe. These are expected to work regardless of the options or settings used as this is what consumer will encounter when doing a `conan create` +themselves. It's possible to have ConanCenter run `conan test` on more then one `test folder` by using the `test_` prefix. + + +## Contents + + * [Files and Structure](#files-and-structure) + * [CMake targets](#cmake-targets) + * [Testing more generators with `test_`](#testing-more-generators-with-test_something) + * [Testing CMake variables from FindModules](#testing-cmake-variables-from-findmodules) + * [How it works](#how-it-works) + * [Minimalist Source Code](#minimalist-source-code) + +### Files and Structure + +See the [recipe files and structures](README.md#recipe-files-structure) for a visual. + +All ConanCenterIndex recipe should have a two [test_folders](https://docs.conan.io/en/latest/reference/commands/creator/create.html?highlight=test_folder) +One for the current CMake generator in `test_package/` and on for the deprecated generators in `test_v1_package/`. + +Please refer to the [Package Templates](../package_templates/) for the current practices about which files and what their content should be. + +### CMake targets + +When using CMake to test a package, the information should be consumed using the +[`CMakeDeps` generator](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmakedeps.html?highlight=cmakedeps). + +This typically will look like a `CMakeLists.txt` which contain lines similar to + +```cmake +find_package(fmt REQUIRED CONFIG) +# ... +target_link_libraries(test_ranges PRIVATE fmt::fmt) +``` + +Refer to the [package template](https://github.com/conan-io/conan-center-index/blob/master/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt) for more examples. + +> **Notes** It's still important to test targets provided by `cmake_find_package[_multi]` generators. +> It should help in the migration (and compatibility) with Conan v2. See [v1 test package template](https://github.com/conan-io/conan-center-index/blob/master/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt) for details. +> You can see read [this conversation](https://github.com/conan-io/conan-center-index/issues/12888#issuecomment-1290817799) for more context. + +In ConanCenter we try to accurately represent the names of the targets and the information provided by CMake's modules and config files that some libraries +provide. If CMake or the library itself don't enforce any target name, the default ones provided by Conan should be recommended. The minimal project +in the `test_package` folder should serve as an example of the best way to consume the package, and targets are preferred over raw variables. + +This rule applies for the _global_ target and for components ones. The following snippet should serve as example: + +We encourage contributors to check that not only the _global_ target works properly, but also the ones for the components. It can be +done creating and linking different libraries and/or executables. + +### Testing more generators with `test_` + +The CI will explore all the folders and run the tests for the ones matching `test_*/conanfile.py` pattern. You can find the output of all +of them together in the testing logs. + +Sometimes it is useful to test the package using different build systems (CMake, Autotools,...). Instead of adding complex logic to one +`test_package/conanfile.py` file, it is better to add another `test_/conanfile.py` file with a minimal example for that build system. That +way the examples will be short and easy to understand and maintain. In some other situations it could be useful to test different Conan generators +(`cmake_find_package`, `CMakeDeps`,...) using different folders and `conanfile.py` files. + +When using more than one `test_` folder, create a different project for each of them to keep the content of the `conanfile.py` and the +project files as simple as possible, without the need of extra logic to handle different scenarios. + +``` +. ++-- recipes +| +-- library_name/ +| +-- config.yml +| +-- all/ +| +-- ... +| +-- test_package/ +| +-- ... +| +-- test_cmakedeps/ +| +-- conanfile.py +| +-- CMakeLists.txt +| +-- test_package.cpp +``` + +### Testing CMake variables from FindModules + +Recipes which provide [Find Modules](https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html#find-modules) are strongly encouraged to +module the file name, targets and or variables. + +**We will provide better docs in the near future**, for now here are a few references: + +- Convo: https://github.com/conan-io/conan-center-index/pull/13511 +- early example: https://github.com/conan-io/conan-center-index/tree/master/recipes/libxml2/all/test_cmake_module_package +- Best reference: https://github.com/conan-io/conan-center-index/blob/master/recipes/expat/all/test_package_module/CMakeLists.txt#L9 + +### How it works + +The [build service](README.md#the-build-service) will explore all the folders and run the tests for the ones matching `test_*/conanfile.py` pattern. +You can find the output of all of them together in the testing logs. Only the end of the logs are posted even if an earlier "test folder" may have failed. + +> **Note**: If, for any reason, it is useful to write a test that should only be checked using Conan v1, you can do so by using the pattern +> `test_v1_*/conanfile.py` for the folder. Please, have a look to [linter notes](../v2_linter.md) to know how to prevent the linter from +> checking these files. + +Remember that the `test_` recipes should **test the package configuration that has just been generated** for the _host_ context, otherwise +it will fail in cross-building scenarios; before running executables, recipes should check +[`conan.tools.build.can_run`](https://docs.conan.io/en/latest/reference/conanfile/tools/build.html?highlight=can_run#conan-tools-build-can-run) + +### Minimalist Source Code + +The contents of `test_package.c` or `test_package.cpp` should be as minimal as possible, including a few headers at most with simple +instantiation of objects to ensure linkage and dependencies are correct. Any build system can be used to test the package, but +CMake or Meson are usually preferred. diff --git a/docs/changelog.md b/docs/changelog.md index 335787481aa1e..6b0d31b6d712e 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,5 +1,132 @@ # Changelog +### 21-February-2023 - 17:22 CET + +- [fix] Fix bug with cppstd entry in configuration files. +- [fix] Fix configuration read of list from an external yaml file. + +### 21-February-2023 - 12:44 CET + +- [feature] ScheduledExportCheck: Collect warnings from hooks and publish them to a separate table. +- [feature] AutomaticMerge: Add conditional status checks with allowlist. +- [feature] AutomaticMerge: Add branches config to merge branches automatically. +- [feature] Conan: Add methods to get the latest recipe revision. +- [feature] Bump library requirements to support the latest Conan versions. +- [fix] PromotePackages: Fix an issue when promoting multiple references. +- [fix] UpdateSearchIndex: Fix conan inspect call command. + +### 14-February-2023 - 15:32 CET + +- [fix] Fix ScheduledExportCheck job not updating hook validation issues. +- [fix] Fix missing GitHub labels for PRs with "bump version" and "bump dependencies" +- [feature] PromotePackages: Add a parameter to promote multiple references. +- [feature] Increase `conan test` time limit to 1 hour. +- [feature] Add request header for GitHub API version. + +### 03-February-2023 - 10:24 CET + +- [fix] Fix macOS deployment target / minos value. +- [feature] Validate: Add return code for license check. +- [feature] Add references list and force parameters to TapaholesRepo job. +- [feature] Add new ListPackages job. +- [feature] Update Conan versions library requirements to 1.58.0 and 2.0.0-beta9. + +### 20-January-2023 - 16:09 CET + +- [feature] Make feedback messages of PRs configurable. +- [feature] Add status icon to the title of PRs comments. +- [fix] Fix Conan v2 error when getting revisions. + +### 16-January-2023 - 16:43 CET + +- [fix] ValidateInfrastructure: Fix Conan version check. +- [feature] TapaholesRepo: Build references when there are 0 packages for a recipe revision. + +### 12-January-2023 - 19:33 CET + +- [fix] Fix Conan v2 download/upload recipe commands. + +### 12-January-2023 - 11:21 CET + +- [feature] Add support for Conan v2 beta 7. +- [feature] Check complete Conan version on ValidateInfrastructure. +- [fix] Increase `conan test` timeout value. +- [fix] Fix stage name when calculating build configurations. + +### 10-January-2023 - 15:20 CET + +- [feature] Add entry in config to disable merging labels from the multibranch job. +- [feature] Add timeout to `conan test` command. +- [feature] Add API wrapper support for status page. +- [refactor] Separate build configuration calculation from pull-request interaction (labels/comments). +- [feature] Take main repository from configuration for Tapaholes jobs. + +### 15-December-2022 - 11:12 CET + +- [feature] Set github feeback title via config file (`feedback_title`). +- [fix] Fix log summary html table for shared option with Conan v2. +- [fix] ValidateInfra: Remove same OS version check for Macos nodes. + +### 09-December-2022 - 11:38 CET + +- [feature] Add environment variable to build with different Xcode/apple-clang compilers on Macos agents. +- [feature] Add `MACOSX_DEPLOYMENT_TARGET` and `SDKROOT` env variables to build stages on Macos. +- [feature] Add `LongPathsEnabled` registry key check on Windows to Validate Infrastructure job. +- [fix] Fix git user on commits when updating docs for supported platforms and configurations. +- [fix] Fix getting commit hash when writing GitHub error messages. +- [fix] Fix Conan v2 inspect command. +- [fix] Fix condition when waiting for another job to finish. + +### 14-November-2022 - 11:54 CET + +- [feature] Disable inactivity count for Access Request job. +- [feature] Add `github-actions[bot]` to permanent users list. +- [feature] No need to run ValidateInfrastructure job for Access Request and Reviewers update pull-requests. +- [fix] JobRelauncher retry property fix. + +### 07-November-2022 - 11:17 CET + +- [feature] Improve Access Request's pull-request description mentioning users. +- [fix] Access Request should not remove reviewers and maintainers. +- [fix] Access Request should count requests done on the same day as the pull request. +- [fix] Avoid posting pipeline title in GitHub messages if feedback is empty. + +### 27-October-2022 - 15:18 CEST + +- [feature] Add under maintenance check to AccessRequest and ScheduledExportCheck jobs. +- [feature] AccessRequest: Remove inactive users. +- [feature] Accept Major.Minor as bump version. +- [feature] Add message title to gihtub comments. +- [fix] Update maintainers list and fix output. +- [fix] Remove dummy files from tests. +- [fix] Make sure contributors are not removed in Access request PR. + +### 17-October-2022 - 10:33 CEST + +- [feature] Improve management of GitHub labels on pull requests. +- [feature] New EpochsSummary job to show epoch status for each reference. +- [feature] Save bot comments as labels as job artifacts for easier user feedback. +- [feature] Ability to wait for a job and merge bot messages from another pipeline: Allows to provide feedback to users in PRs from the Conan v2 pipeline in the future. +- [feature] Add timeout to AutomaticMerge job. +- [feature] Add note about Windows SDK on supported platforms documentation. +- [fix] Fix getting package IDs from Artifactory in the Conan v2 pipeline. +- [fix] Bump dependencies pull requests should only consider modified comments. +- [fix] ValidateInfrastructure job parameter for macos executors. + +### 20-September-2022 - 14:27 CEST + +- [feature] Handle scenarios where some files are removed. +- [feature] Simplify logic to detect references to be built in a pull request. +- [feature] Workaround in Conan v2 commands to list package IDs in a pull request. +- [feature] Bump minimum required Conan client version. +- [fix] When merging a pull request, check recipe revisions only against the pull-request repository. +- [fix] Do not consider GitHub check runs for pull requests opened by a bot. +- [fix] Consider files renamed in pull requests as "added" and "removed". +- [fix] Cover use-case when a pull request adds just one conanfile.py. +- [fix] Simplify assignment of GitHub labels. +- [fix] Use backquotes in GitHub comments. +- [fix] Fix promotion of packages with Conan v2. + ### 1-September-2022 - 10:21 CEST - [feature] Avoid `test_v?_package` folders that don't match the Conan version. diff --git a/docs/community_resources.md b/docs/community_resources.md index 6a09713749810..06aa0558a52f3 100644 --- a/docs/community_resources.md +++ b/docs/community_resources.md @@ -13,6 +13,8 @@ This is a curated list of various bots and helpful tools that aim to making appr The community is very active on the [Cpplang's Slack channel](https://cpplang.slack.com/archives/C41CWV9HA), it's a great place to get help. +If you are looking to stay up to date with the last Conan news, follow us on Twitter [@conan_io](https://twitter.com/conan_io) + ## Bots - [Updatable Recipes](https://github.com/qchateau/conan-center-bot): Automatically scans available recipes and checked for new upstream releases and tests one configuration @@ -22,6 +24,7 @@ recipe files and posts a message. - The results can be found here: https://ericlemanissier.github.io/conan-center-conflicting-prs/ - [Pending Review](https://github.com/prince-chrismc/conan-center-index-pending-review) - The results can be found here: https://prince-chrismc.github.io/conan-center-index-pending-review/ +- [Pull Request In Progress Status](https://ericlemanissier.github.io/conan-center-pr-status/in_progress_jobs) - [System Package Checks](https://github.com/bincrafters/system-packages-checks): Builds automatically all `system` versions of recipes merged on CCI and being pull requested on a selection of Linux distributions and FreeBSD - The results can be found here: https://bincrafters.github.io/system-packages-checks/ diff --git a/docs/conandata_yml_format.md b/docs/conandata_yml_format.md deleted file mode 100644 index a1222e4125c92..0000000000000 --- a/docs/conandata_yml_format.md +++ /dev/null @@ -1,255 +0,0 @@ -# conandata.yml - -[conandata.yml](https://docs.conan.io/en/latest/reference/config_files/conandata.yml.html) is a [YAML](https://yaml.org/) file to provide declarative data for the recipe (which is imperative). - -`conandata.yml` is a built-in Conan feature (available since 1.22.0) without a fixed structure, but conan-center-index uses it for its own purposes. - -In the context of conan-center-index, this file is mandatory and consists of two main sections that we will explain in the next sections with more detail: - - * `sources`: Library sources origin with their verification checksums. - * `patches`: Details about the different patches the library needs for several reasons. - - -## Contents - - * [sources](#sources) - * [Mirrors](#mirrors) - * [Sources fields](#sources-fields) - * [url](#url) - * [sha256](#sha256) - * [sha1](#sha1) - * [md5](#md5) - * [Other cases](#other-cases) - * [Source code & license](#source-code--license) - * [Several source code archives](#several-source-code-archives) - * [Different source code archives per configuration](#different-source-code-archives-per-configuration) - * [patches](#patches) - * [Patches fields](#patches-fields) - * [patch_file](#patch_file) - * [patch_description](#patch_description) - * [patch_type](#patch_type) - * [official](#official) - * [vulnerability](#vulnerability) - * [backport](#backport) - * [portability](#portability) - * [conan](#conan) - * [patch_source](#patch_source) - * [base_path](#base_path) - * [sha256](#sha256-1) - -## sources - -`sources` is a top level dictionary, containing entries of sources and checksums for each of the supported versions. - -This is the entry that contains all the items that are downloaded from the internet and used in a recipe. This section contains one entry per version and each version should declare its own sources. - -This is a basic example of a regular library, it should satisfy most of the use cases: - -```yml -sources: - "1.2.11": - url: "..." - sha256: "..." - "1.2.12": - url: "..." - sha256: "..." -``` - -Every entry for a version consists in a dictionary with the `url` and the hashing algorithm of the artifact. `sha256` is required, but others like `sha1` or `md5` can be used as well. - -### Mirrors -Sometimes it is useful to declare mirrors, use a list in the `url` field. Conan will try to download the artifacts from any of those mirrors. - -```yml -sources: - "1.2.11": - url: [ - "https://zlib.net/zlib-1.2.11.tar.gz", - "https://downloads.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.gz", - ] - sha256: "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1" -``` - -Keep in mind all the mirrors have to provide the exactly same source (e.g. no repackaging), thus using the same hash sum. - -### Sources fields - -#### url - -`url` contains a string specifying [URI](https://tools.ietf.org/html/rfc3986) where to download released sources. -Usually, `url` has a [https](https://tools.ietf.org/html/rfc2660) scheme, but other schemes, such as [ftp](https://tools.ietf.org/html/rfc959) are accepted as well. - -#### sha256 - -[sha256](https://tools.ietf.org/html/rfc6234) is a preferred method to specify hash sum for the released sources. It allows to check the integrity of sources downloaded. -You may use an [online service](https://hash.online-convert.com/sha256-generator) to compute `sha256` sum for the given `url`. -Also, you may use [sha256sum](https://linux.die.net/man/1/sha256sum) command ([windows](http://www.labtestproject.com/files/win/sha256sum/sha256sum.exe)). - -#### sha1 - -[sha1](https://tools.ietf.org/html/rfc3174) is an alternate method to specify hash sum. It's usage is discouraged and `sha256` is preferred. - -#### md5 - -[md5](https://tools.ietf.org/html/rfc1321) is an alternate method to specify hash sum. It's usage is discouraged and `sha256` is preferred. - -### Other cases - -There are other ways to specify sources to cover other cases. - -#### Source code & license - -Certain projects provide license on their own, and released artifacts do not include it. In this case, a license URL can be provided separately: - -``` -sources: - 8.0.0: - - url: https://github.com/approvals/ApprovalTests.cpp/releases/download/v.8.0.0/ApprovalTests.v.8.0.0.hpp - sha256: e16a97081f8582be951d95a9d53dc611f1f5a84e117a477029890d0b34ae99d6 - - url: "https://raw.githubusercontent.com/approvals/ApprovalTests.cpp/v.8.0.0/LICENSE" - sha256: c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4 -``` - -#### Several source code archives - -Some projects may include multiple tarballs as a part of release, [OpenCV](https://opencv.org/) is an example which includes auxiliary [contrib](https://github.com/opencv/opencv_contrib) archive: - -``` -sources: - "4.5.0": - - sha256: dde4bf8d6639a5d3fe34d5515eab4a15669ded609a1d622350c7ff20dace1907 - url: https://github.com/opencv/opencv/archive/4.5.0.tar.gz - - sha256: a65f1f0b98b2c720abbf122c502044d11f427a43212d85d8d2402d7a6339edda - url: https://github.com/opencv/opencv_contrib/archive/4.5.0.tar.gz -``` - -#### Different source code archives per configuration - -This is the most advanced and sophisticated use-case, but no so common. Some projects may provide different sources for different platforms for awkward reasons, it could be expressed as: - -``` -sources: - "0066": - "Macos": - "apple-clang": - "x86": - - url: "https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0066/C/MacIntel_OSX_AppleC_32bit/packages/cspice.tar.Z" - sha256: "9a4b5f674ea76821c43aa9140829da4091de646ef3ce40fd5be1d09d7c37b6b3" - "x86_64": - - url: "https://naif.jpl.nasa.gov/pub/naif/misc/toolkit_N0066/C/MacIntel_OSX_AppleC_64bit/packages/cspice.tar.Z" - sha256: "f5d48c4b0d558c5d71e8bf6fcdf135b0943210c1ff91f8191dfc447419a6b12e" -``` - -This approach requires a special code within [build](https://docs.conan.io/en/latest/reference/conanfile/methods.html#build) method to handle. - -## patches - -Sometimes sources provided by project require patching for various reasons. The `conandata.yml` file is the right place to indicate this information as well. - -This section follows the same pattern as the `sources` above: one entry per version with a list of patches to apply. - -```yaml -patches: - "1.2.0": - - patch_file: "patches/1.2.0-002-link-core-with-find-library.patch" - patch_description: "Link CoreFoundation and CoreServices with find_library" - patch_type: "portability" - base_path: "source_subfolder" - patch_source: "https://a-url-to-a-pull-request-mail-list-topic-issue-or-question" - sha256: "qafe4rq54533qa43esdaq53ewqa5" -``` - -### Patches fields - -#### patch_file - -_Required_ - -Patch file might be committed to the conan-center-index, near to the conanfile (usually, into the `patches` sub-directory). Such patch files usually have either `.diff` or `.patch` extension. -The recommended way to generate such patches is [git format-patch](https://git-scm.com/docs/git-format-patch). The path to the patch is relative to the directory containing `conandata.yml` and `conanfile.py`. - -#### patch_description - -_Required_ - -`patch_description` is an arbitrary text describing the following aspects of the patch: - -- What does patch do (example - `add missing unistd.h header`) -- Why is it necessary (example - `port to Android`) -- How exactly does patch achieve that (example - `update configure.ac`) - -An example of a full patch description could be: `port to Android: update configure.ac adding missing unistd.h header`. - -#### patch_type - -_Required_ - -The `patch_type` field specifies the type of the patch. In conan-center-index we currently accept only several kind of patches: - -##### official - -`patch_type: official` indicates the patch is distributed with source code itself. usually, this happens if release managers failed to include a critical fix to the release, but it's too much burden for them to make a new release just because of that single fix. -[example](https://www.boost.org/users/history/version_1_72_0.html) (notice the `coroutine` patch) - -##### vulnerability - -`patch_type: vulnerability`: Indicates a patch that addresses the security issue. The patch description -should include the index of CVE or CWE the patch addresses. -Usually, original library projects do new releases fixing vulnerabilities for this kind of issues, but in some cases they are either abandoned or inactive. - -##### backport - -`patch_type: backport`: Indicates a patch that backports an existing bug fix from the newer release or master branch (or equivalent, such as main/develop/trunk/etc). The patch source may be a pull request, or bug within the project's issue tracker. -Backports are accepted only for bugs that break normal execution flow, never for feature requests. -Usually, the following kind of problems are good candidates for backports: - -- Program doesn't start at all. -- Crash (segmentation fault or access violation). -- Hang up or deadlock. -- Memory leak or resource leak in general. -- Garbage output. -- Abnormal termination without a crash (e.g. just exit code 1 at very beginning of the execution). -- Data corruption. -- Use of outdated or deprecated API or library. - -As sources with backports don't act exactly the same as the version officially released, it may be a source of confusion for the consumers who are relying on the buggy behavior (even if it's completely wrong). Therefore, it's required to introduce a new `cci.` version for such backports, so consumers may choose to use either official version, or modified version with backport(s) included. - -##### portability - -`patch_type: portability`: Indicates a patch that improves the portability of the library, e.g. adding supports of new architectures (ARM, Sparc, etc.), operating systems (FreeBSD, Android, etc.), compilers (Intel, MinGW, etc.), and other types of configurations which are not originally supported by the project. -In such cases, the patch could be adopted from another package repository (e.g. MSYS packages, Debian packages, Homebrew, FreeBSD ports, etc.). -Patches of this kind are preferred to be submitted upstream to the original project repository first, but it's not always possible. -Some projects simply do not accept patches for platforms they don't have a build/test infrastructure, or maybe they are just either abandoned or inactive. - -##### conan - -`patch_type: conan`: Indicates a patch that is Conan-specific, patches of such kind are usually not welcomed upstream at all, because they provide zero value outside of Conan. -Examples of such a patches may include modifications of build system files to allow dependencies provided by Conan instead of dependencies provided by projects themselves (e.g. as submodule or just 3rd-party sub-directory) or by the system package manager (rpm/deb). -Such patches may contain variables and targets generated only by Conan, but not generated normally by the build system (e.g. `CONAN_INCLUDE_DIRS`). - -#### patch_source - -_Optional_ - -`patch_source` is the URL from where patch was taken from. https scheme is preferred, but other URLs (e.g. git/svn/hg) are also accepted if there is no alternative. Types of patch sources are: - -- Link to the public commit in project hosting like GitHub/GitLab/BitBucket/Savanha/SourceForge/etc. -- Link to the Pull Request or equivalent (e.g. gerrit review). -- Link to the bug tracker (such as JIRA, BugZilla, etc.). -- Link to the mail list discussion. -- Link to the patch itself in another repository (e.g. MSYS, Debian, etc.). - -For the `patch_type: portability` there might be no patch source matching the definition above. Although we encourage contributors to submit all such portability fixes upstream first, it's not always possible (e.g. for projects no longer maintained). In that case, a link to the Conan issue is a valid patch source (if there is no issue, you may [create](https://github.com/conan-io/conan-center-index/issues/new/choose) one). -For the `patch_type: conan`, it doesn't make sense to submit patch upstream, so there will be no patch source. - -#### base_path - -_Optional_ - -Specifies a sub-directory in project's sources to apply patch. This directory is relative to the [source_folder](https://docs.conan.io/en/latest/reference/conanfile/attributes.html?highlight=source_folder#source-folder). Usually, it would be a `source_subfolder`, but could be a lower-level sub-directory (e.g. if it's a patch for a submodule). - -#### sha256 - -_Optional_ - -This is the hash for the patch itself, in the same way this field is used in the `sources` section. diff --git a/docs/consuming_recipes.md b/docs/consuming_recipes.md index c58bbc2e2991c..ee80883fc7130 100644 --- a/docs/consuming_recipes.md +++ b/docs/consuming_recipes.md @@ -1,128 +1,68 @@ # Consuming recipes -Recipes in this repository are evolving continuously, contributors are creating pull-requests -fixing issues and adding new features every day. It is expected that from time to time these -new recipe revisions stop to work in your project. +ConanCenter has always maintained recipes consumers need to have an up to date client for the best experience. +The reason is there are constantly improvements and fixes being made, sometimes those require new Conan features +to be possible. There are usually waves of new features, patches and fixes that allow for even better quality recipes. ## Contents * [Breaking changes](#breaking-changes) - * [Isolate your project from upstream changes](#isolate-your-project-from-upstream-changes) - * [Use your own Artifactory instance](#use-your-own-artifactory-instance) - * [Use recipe revisions and lockfiles](#use-recipe-revisions-and-lockfiles) + * [Isolate your project from upstream changes](#isolate-your-project-from-upstream-changes) ## Breaking changes -There can be several root causes if a recipe (a new revision) stopped to work in your project: +There can be several causes if a recipe (a new revision) might stopped to work in your project: - * **Fixes in recipes** that modify the libraries they are creating: exported symbols, +- **Fixes in recipes** that modify the libraries they are creating: exported symbols, compiler flags, generated files for your build system, CMake target names,... Every contributor tries to do their best and reviewers do an amazing work checking that the changes are really improving recipes. - - * **New Conan features (breaking syntax)**: sometimes Conan introduces a new feature that - requires new attributes or statements in recipes. If your Conan client is not new enough, +- **New Conan features (breaking syntax)** sometimes requires new attributes or statements in recipes. + If your Conan client is not new enough, Conan will fail to parse the recipe and will raise a cryptic Python syntax error. - This use case is covered by the [`required_conan_version`](https://docs.conan.io/en/latest/reference/conanfile/other.html?highlight=required_conan_version#requiring-a-conan-version-for-the-recipe) feature. It will - substitute the syntax error by one nicer error provided by Conan client. - - * **New Conan features**: Conan keeps evolving and adding new features in its road to Conan v2, - and ConanCenter is committed in this roadmap as well, and tries to push the user base to these +- **New Conan Version**: Conan keeps evolving and adding new features, especially on its road to Conan 2.0, + and ConanCenter is committed in this [roadmap](v2_roadmap.md) as well, and tries to prepare the user base to these new features in order to ease the migration to new versions. New recipe revisions can take into account changes that are introduced in new Conan client version, sometimes these changes modify some experimental behavior without modifying recipe syntax. - When these changes are in the critical path to Conan v2 we can introduce the - `required_conan_version` statement to be sure that people using these new experimental - features are using the required Conan version and testing the actual behavior of those - features (feedback about them is very important to Conan). - -## Isolate your project from upstream changes - -There are two main ways you can isolate your project from changes in recipes: - - * **Cache recipes in your own Artifactory**: your project should use only this remote and - new recipe revisions are only pushed to your Artifactory after they have been validated - in your project. - * **Pin the version of every reference you consume in your project** using recipe revisions - and lockfiles. - -### Use your own Artifactory instance - -Using your own Artifactory instance is not as complicated as it sounds. You can [deploy it -on-premise](https://conan.io/downloads.html) or use a [cloud provided solution](https://jfrog.com/start-free/?isConan=true) for free. - -Once you have configured your Artifactory instance, you should ensure that your project is -using only that remote (`conan remote list`). Conan makes it easy to use different configurations -per project (check `CONAN_USER_HOME` env variable) or to store the configuration in some external -file or repository so you can shared and install it using one command (`conan config install ...`). +This use case is covered by the [`required_conan_version`](https://docs.conan.io/en/latest/reference/conanfile/other.html?highlight=required_conan_version#requiring-a-conan-version-for-the-recipe) feature. It will +substitute the syntax error by one nicer error provided by Conan client. -### Use recipe revisions and lockfiles +To be sure that people using these new experimental features are using the required Conan version and testing the actual behavior +of those features (feedback about them is very important to Conan). -If you don't want to deploy and maintain your own Artifactory instance, you can isolate from -changes in upstream recipes in ConanCenter using [recipe revisions](https://docs.conan.io/en/latest/versioning/revisions.html) -and [lockfiles](https://docs.conan.io/en/latest/versioning/lockfiles.html) (please, read linked Conan documentation for more detailed -explanation). - -Recipe revisions and lockfiles can be used to define exactly the binary you want to use in -your project. **Nothing is removed from ConanCenter**, even if the recipe is modified and new -binaries are generated for the same configurations, existing binaries are still there, you -just need to instruct Conan to use them even if new ones are available. - -**Recipe revisions** are the way to tell Conan to use a specific snapshot of the recipe. It -is a hash added to the reference and can be used in Conan at the same place as regular -revisions: - - * In the command line: - - ```sh - conan install openssl/3.0.1@#1955937e88f13a02aa4fdae98c3f9fb8 - ``` - - * In a `conanfile.txt` file: - - ```txt - [requires] - openssl/3.0.1@#1955937e88f13a02aa4fdae98c3f9fb8 - ``` - -If you use explicit recipe revisions in your project you can be sure that Conan will always use -the same recipe revision of those references. You might get new binaries if the same -configuration (same packageID) is built again for the same recipe revision, but that is not -going to be a _compatibility problem_. +## Isolate your project from upstream changes -This might not be enough for some projects, where you want -to be sure nothing is modified, not just the revisions you are listing explicitly but also any -other transitive dependency, this is what lockfiles are for. +This has always been a concern from ConanCenter consumers. -**Lockfiles** are files where all the information about requirements is written: recipe -revisions, package IDs and package revisions. You can create a lockfile with all the -dependencies for your project once you are happy with them, and use that same lockfile -with every Conan command. Conan will always build the same graph (the locked one) and -will always retrieve the same recipes and binaries. +Conan is very flexible; you can add your own remote or modify your client’s configuration for more granularity. We see the majority of Conan users hosting their own remote, and only consuming packages from there. For production this is the recommended way to add some infrastructure to ensure stability. This is generally a good practice when relying on package managers - not just Conan. -Then, it would be up to you to generate a new lockfile if you want to introduce new revisions -for existing references. +Here are a few choices: -The two basic commands you need to know ([full docs here](https://docs.conan.io/en/latest/versioning/lockfiles.html)): +- [Running your own Conan Server](https://docs.conan.io/en/latest/uploading_packages/running_your_server.html) - great for local ad-hoc setups +- [Cache recipes in your own ArtifactoryCE](https://docs.conan.io/en/latest/uploading_packages/using_artifactory.html) - recommended for production environments - * Create lockfile from `conanfile.txt` file: +Using your own ArtifactoryCE instance is easy. You can [deploy it on-premise](https://conan.io/downloads.html) or use a +[cloud provided solution](https://jfrog.com/community/start-free) for **free**. Your project should +[use only this remote](https://docs.conan.io/en/latest/reference/commands/misc/remote.html?highlight=add%20new) and new recipe +revisions are only pushed to your Artifactory after they have been validated in your project. - ```sh - conan lock create conanfile.txt --lockfile-out=locks/project.lock - ``` +The minimum solution, if still choosing to rely on ConanCenter directly, involves small changes to your client configuration by pinning the revision of every reference you consume in your project using using: - * Consume a lockfile: +- [recipe revision (RREV)](https://docs.conan.io/en/latest/versioning/revisions.html) can be added to each requirement. + Instead of `fmt/9.1.0` you can add a pound (or hashtag) to the end followed by the revision `fmt/9.1.0#c93359fba9fd21359d8db6f875d8a233`. + This feature needs to be enabled in Conan 1.x, see the [Activation Instructions](https://docs.conan.io/en/latest/versioning/revisions.html#how-to-activate-the-revisions) for details. +- [Lockfiles](https://docs.conan.io/en/latest/versioning/lockfiles.html) can be created with the `conan lock create` and read with by + adding `--lockfile=conan.lock` to `conan install` or `conan create` commands. See the [lockfile introduction](https://docs.conan.io/en/latest/versioning/lockfiles/introduction.html#) for more information. - ```sh - conan install conanfile.txt --lockfile=locks/project.lock - ``` +> **Warning** Please, be aware there are some known bugs related to lockfiles that are not being fixed in Conan v1.x - we are really excited for the 2.0 improvements to be widely used. -If your project is managing several configurations, you would probably like to have a look to [base lockfiles](https://docs.conan.io/en/latest/versioning/lockfiles/configurations.html#base-lockfiles) and [lockfile bundles](https://docs.conan.io/en/latest/versioning/lockfiles/bundle.html) in the documentation. +Both of these give you better control and will allow you to choose when to upgrade your Conan client. --- diff --git a/docs/developing_recipes_locally.md b/docs/developing_recipes_locally.md new file mode 100644 index 0000000000000..afd59e641ddaa --- /dev/null +++ b/docs/developing_recipes_locally.md @@ -0,0 +1,272 @@ +# Developing Recipes Locally + +Before you can contribute any code changes, you'll need to make sure you are familiar with the Conan client and have an environment that is conducive to developing recipes. + +This file is intended to provide all the commands you need to run in order to be an expert ConanCenter contributor. + + +## Contents + + * [Clone your fork](#clone-your-fork) + * [Setup your environment](#setup-your-environment) + * [Installing the ConanCenter Hooks](#installing-the-conancenter-hooks) + * [Updating conan hooks on your machine](#updating-conan-hooks-on-your-machine) + * [Basic Commands](#basic-commands) + * [Try it yourself](#try-it-yourself) + * [Debugging Failed Builds](#debugging-failed-builds) + * [Running the Python Linters](#running-the-python-linters) + * [Running the YAML Linters](#running-the-yaml-linters) + * [Yamllint](#yamllint) + * [Yamlschema](#yamlschema) + * [Testing the different `test__package`](#testing-the-different-test__package) + * [Testing more environments](#testing-more-environments) + * [Using Conan 2.0](#using-conan-20) + * [Installing Conan 2.0 beta](#installing-conan-20-beta) + * [Trying it out](#trying-it-out) + +## Clone your fork + +1. Follow the GitHub UI to [fork this repository](https://github.com/conan-io/conan-center-index/fork) +2. [Clone your fork](https://docs.github.com/en/repositories/creating-and-managing-repositories/cloning-a-repository) + +## Setup your environment + +1. Install a C++ development toolchain - ConanCenter's [build images](#testing-more-environments) are available +2. [Install the Conan client](https://docs.conan.io/en/latest/installation.html) - make sure to keep it up to date! +3. Install CMake - this is the only tool which is assumed to be present + [see FAQ](faqs.md#why-recipes-that-use-build-tools-like-cmake-that-have-packages-in-conan-center-do-not-use-it-as-a-build-require-by-default) for details. + +> **Note**: It's recommended to use a dedicated Python virtualenv when installing with `pip`. + +### Installing the ConanCenter Hooks + +The system will use the [conan-center hooks](https://github.com/conan-io/hooks) to perform some quality checks. You can install the hooks by running: + +```sh +conan config install https://github.com/conan-io/hooks.git -sf hooks -tf hooks +conan config set hooks.conan-center +``` + +> **Note**: Hooks are generally for package correctness and the pylinters are for the recipe syntax + +The hooks will show error messages but the `conan create` won’t fail unless you export the environment variable `CONAN_HOOK_ERROR_LEVEL=40`. +All hooks checks will print a similar message: + +```txt +[HOOK - conan-center.py] post_source(): [LIBCXX MANAGEMENT (KB-H011)] OK +[HOOK - conan-center.py] post_package(): ERROR: [PACKAGE LICENSE] No package licenses found +``` + +#### Updating conan hooks on your machine + +The hooks are updated from time to time, so it's worth keeping your own copy of the hooks updated regularly. To do this, simply run: + +```sh +conan config install +``` + +## Basic Commands + +We recommend working from the `recipes/project` folder itself. You can learn about the [recipe file structure](adding_packages/README.md#recipe-files-structure) to understand the folder and files located there. + +> **Note**: You can only change one recipe per pull request, and working from the [_recipe folder_](adding_packages/README.md#the-recipe-folder-conanfilepy) will help prevent making a few mistakes. The default for this folder is `all`, follow the link above to learn more. + +The [entire workflow of a recipe](https://docs.conan.io/en/latest/developing_packages/package_dev_flow.html) can be execute with the [`conan create`](https://docs.conan.io/en/latest/reference/commands/creator/create.html). This should look like: + +* `conan create all/conanfile.py 0.0.0@ -pr:b=default -pr:h=default` + +ConanCenter also has a few [support settings and options](supported_platforms_and_configurations.md) which highly recommend to test. For example +`conan create all/conanfile.py 0.0.0@ -o project:shared=True -s build_type=Debug` is a easy way to test more configurations ensuring the package is correct. + +### Try it yourself + +For instance you can create packages for `fmt` in various supported configurations by running: + +```sh +cd recipes/fmt +conan create all/conanfile.py fmt/9.0.0@ -pr:b=default -pr:h=default +conan create all/conanfile.py fmt/9.0.0@ -o fmt:header_only=True -pr:b=default -pr:h=default +conan create all/conanfile.py fmt/9.0.0@ -s build_type=Debug -o fmt:shared=True -pr:b=default -pr:h=default +``` + +## Debugging Failed Builds + +Some common errors related to Conan can be found on [troubleshooting](https://docs.conan.io/en/latest/faq/troubleshooting.html) section. +For ConanCenter Hook errors, go to the [Error Knowledge Base](error_knowledge_base.md) page to know more about those. + +To test with the same environment, the [build images](supported_platforms_and_configurations.md#build-images) are available. +Instructions for using these images can be found in [Testing more environments](#testing-more-environments) section. + +In ConanCenterIndex, the most common failure point is upstream build scripts tailored to their specific use cases. +It's not uncommon to [patch build scripts](adding_packages/sources_and_patches.md#rules) but make sure to read the +[patch policy](adding_packages/sources_and_patches.md#policy-about-patching). You are encouraged to submit pull requests upstream. + +## Running the Python Linters + +Linters are always executed by GitHub Actions to validate parts of your recipe, for instance, if it uses migrated Conan tools imports. + +It is possible to run the linter locally the same way it is being run [using Github actions](../.github/workflows/linter-conan-v2.yml) by: + +* (Recommended) Use a dedicated Python virtualenv. +* Ensure you have required tools installed: `conan` and `pylint` (better to uses fixed versions) + + ```sh + pip install conan~=1.0 pylint==2.14 + ``` + +* Set environment variable `PYTHONPATH` to the root of the repository + + ```sh + export PYTHONPATH=your/path/conan-center-index + ``` + +* Now you just need to execute the `pylint` commands: + + ```sh + # Lint a recipe: + pylint --rcfile=linter/pylintrc_recipe recipes/fmt/all/conanfile.py + + # Lint the test_package + pylint --rcfile=linter/pylintrc_testpackage recipes/fmt/all/test_package/conanfile.py + ``` + +## Running the YAML Linters + +There's two levels of YAML validation, first is syntax and the second is schema. +The style rules are located in [`linter/yamllint_rules.yml`](../linter/yamllint_rules.yml) and are used to ensure consistence. +The [`config.yml`](adding_packages/README.md#configyml) is required for the build infrastructure and the +[`conandata.yml` patch fields](adding_packages/conandata_yml_format.md#patches-fields) have required elements that are enforced with +schema validation. There's are to encourage the best possible quality of recipes and make reviewing faster. + +### Yamllint + +* (Recommended) Use a dedicated Python virtualenv. +* Ensure you have required tools installed: `yamllint` (better to uses fixed versions) + + ```sh + pip install yamllint==1.28 + ``` + +* Now you just need to execute the `yamllint` commands: + + ```sh + # Lint a recipe: + yamllint --config-file linter/yamllint_rules.yml -f standard recipes/config.yml + yamllint --config-file linter/yamllint_rules.yml -f standard recipes/fmt/all/conandata.yml + ``` + +### Yamlschema + +* (Recommended) Use a dedicated Python virtualenv. +* Ensure you have required tools installed: `strictyaml` and `argparse` (better to uses fixed versions) + + ```sh + pip install strictyaml==1.16 argparse==1.4 + ``` + +* Now you just need to execute the validation scripts: + + ```sh + # Lint a config.yml: + python3 linter/config_yaml_linter.py recipes/fmt/config.yml + + # Lint a conandata.yml + python3 linter/conandata_yaml_linter.py recipes/fmt/all/conandata.yml + ``` + +## Testing the different `test_*_package` + +This can be selected when calling `conan create` or separately with `conan test` + +```sh +# By adding the `-tf` argument +conan create recipes/fmt/all/conanfile.py 9.0.0@ -tf test_v1_package/ -pr:b=default -pr:h=default +``` + +```sh +# Passing test package's conanfile directly (make sure to export first) +conan test recipes/fmt/all/test_v1_package/conanfile.py fmt/9.0.0@ -pr:h=default -pr:b=default +``` + +## Testing more environments + +This can be difficult for some platforms given virtualization support. + +For Windows and MacOS users, you can test the Linux build environments with the Docker build images. + +Assuming you've already tested it locally and it's been successfully exported to your cache, you can: + +1. Creating a new profile. + * You can also download them from CCI build summary +2. Build missing packages + +Example. + +```sh +docker run -v/Users/barbarian/.conan:/home/conan/.conan conanio/gcc8 bash -c "conan profile new --detect gcc8" +docker run -v/Users/barbarian/.conan:/home/conan/.conan conanio/gcc8 bash -c "conan install -pr gcc8 fmt/9.0.0@ --build missing" +``` + +> **Note**: If you are running on Mac M1, the follow Docker argument is required: `--platform=linux/amd64` + +If you are working with packages that have system dependencies that are managed by Conan + +```sh +docker run -e CONAN_SYSREQUIRES_MODE=enabled conanio/gcc11-ubuntu16.04 conan install fmt/9.0.0@ -if build --build missing -c tools.system.package_manager:mode=install -c tools.system.package_manager:sudo=yes +``` + +## Using Conan 2.0 + +Everything you need to know about the methods, commands line, outputs can be found in the +[Conan 2.0 Migrations](https://docs.conan.io/en/latest/conan_v2.html) docs. + +This should be non-intrusive. Conan 2.0 by default has a different `CONAN_USER_HOME` location, which means that it has separate caches, profiles, and settings. +This will leave your Conan 1.0 setup completely intact when using Conan 2.0. + +> **Note**: There are substantial changes to the CLI so very few of the commands will remain the same. +> The new [Unified Command Pattern](https://docs.conan.io/en/latest/migrating_to_2.0/commands.html#unified-patterns-in-command-arguments), +> as an example, changes how settings and options are passed. + +### Installing Conan 2.0 beta + +Simply install Conan 2.0 with `pip install conan --upgrade --pre`. + +You can confirm the installation with: + +```sh +$ conan --version +Conan version 2.0.0-beta3 +$ conan config home +Current Conan home: /Users/barbarian/.conan2 +``` + +> **Note**: You will most likely see +> +> ```sh +> Initialized file: '/Users/barbarian/.conan2/settings.yml' +> Initialized file: '/Users/barbarian/.conan2/extensions/plugins/compatibility/compatibility.py' +> Initialized file: '/Users/barbarian/.conan2/extensions/plugins/compatibility/app_compat.py' +> Initialized file: '/Users/barbarian/.conan2/extensions/plugins/compatibility/cppstd_compat.py' +> Initialized file: '/Users/barbarian/.conan2/extensions/plugins/profile.py' +> ``` +> +> When running the client for the first time. + +You will need to setup profiles. This is one of the changes in 2.0. The default profile is now opt-in and no longer generated automatically. + +```sh +conan profile detect +``` + +> **Warning**: This is a best guess, you need to make sure it's correct. + +### Trying it out + +Try building an existing recipe. We'll repeat the 1.x example with `fmt` to build the same configurations: + +```sh +cd recipes/fmt +conan create all/conanfile.py --version 9.0.0 +conan create all/conanfile.py --version 9.0.0 -o fmt/9.0.0:header_only=True +conan create all/conanfile.py --version 9.0.0 -s build_type=Debug -o fmt/9.0.0:shared=True +``` diff --git a/docs/error_knowledge_base.md b/docs/error_knowledge_base.md index bbea3128fdd97..9e81657888bb6 100644 --- a/docs/error_knowledge_base.md +++ b/docs/error_knowledge_base.md @@ -1,5 +1,7 @@ # Errors from the conan-center hook (KB-Hxxx) +These are located at [conan-io/hooks](https://github.com/conan-io/hooks/blob/master/hooks/conan-center.py). + #### **#KB-H001: "DEPRECATED GLOBAL CPPSTD"** `Conan > 1.15` deprecated the usage of the global ``cppstd`` setting in favor of ``compiler.cppstd`` to [manage C++ standard](https://docs.conan.io/en/latest/howtos/manage_cpp_standard.html). As a subsetting of the compiler, it shouldn't be declared in the `conanfile.py`. @@ -63,7 +65,7 @@ Here we use [configure()](https://docs.conan.io/en/latest/reference/conanfile/me #### **#KB-H008: "VERSION RANGES"** -It is not allowed to use [version ranges](https://docs.conan.io/en/latest/versioning/version_ranges.html) for the recipes in Conan center, where the dependency graph should be deterministic. +See [Dependencies Version Ranges](adding_packages/dependencies.md#version-ranges) for details. #### **#KB-H009: "RECIPE FOLDER SIZE"** @@ -110,7 +112,12 @@ The binary packages should contain a folder named `licenses` containing the cont #### **#KB-H013: "DEFAULT PACKAGE LAYOUT"** -The binary packages shouldn't contain any other files or folder except the following: `["lib", "bin", "include", "res", "licenses"]`. If you are packaging an application put all the contents inside the `bin` folder. +The binary packages generally do not need any other files or folder except the following: `["lib", "bin", "include", "res", "licenses"]`. +This closely matches the default [`cpp_info`](https://docs.conan.io/en/latest/reference/conanfile/methods.html#package-info) from the client. +The upstream package layout should be followed as much as possible, if a folder is not in the list (like `"share"`) then an exception +can very easily be added by adding it to [this list of exceptions](https://github.com/conan-io/hooks/blob/d587cfebbf2b31c16e477b79c0c2fd4501f60fc8/hooks/conan-center.py#L1089-L1090). + +> **Note**: We are in the process of evaluating this rule, looking at calculating the size impact for problematic packages #### **#KB-H014: "MATCHING CONFIGURATION"** @@ -182,7 +189,7 @@ There is a complete explanation in the [FAQ](faqs.md#should-recipes-export-a-rec #### **#KB-H024: "TEST PACKAGE FOLDER"** -The [test_package](https://docs.conan.io/en/latest/creating_packages/getting_started.html#the-test-package-folder) folder is required for every recipe in Conan Center Index. +The [test_package](https://docs.conan.io/en/latest/creating_packages/getting_started.html) folder is required for every recipe in Conan Center Index. ``` . conanfile.py @@ -226,7 +233,7 @@ class SomeRecipe(ConanFile): #### **#KB-H027: "CONAN CENTER INDEX URL"** The attribute [url](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#url) should point to the address where the recipe is located. -The current Conan Center Index address is https://github.com/conan-io/conan-center-index +The current Conan Center Index address is #### **#KB-H028: "CMAKE MINIMUM VERSION"** @@ -242,7 +249,7 @@ project(conanwrapper) #### **#KB-H029: "TEST PACKAGE - RUN ENVIRONMENT"** -The [RunEnvironment()](https://docs.conan.io/en/latest/reference/build_helpers/run_environment.html#runenvironment) build helper is no longer needed in the *test_package/conanfile.py*. It has been integrated by [run_environment](https://docs.conan.io/en/latest/devtools/running_packages.html#running-from-packages) parameter. +The [RunEnvironment()](https://docs.conan.io/en/latest/reference/build_helpers/run_environment.html#runenvironment) build helper is no longer needed in the `test_package/conanfile.py`. It has been integrated by [run_environment](https://docs.conan.io/en/latest/devtools/running_packages.html#running-from-packages) parameter. ```python # test_package/conanfile.py @@ -256,7 +263,7 @@ class TestConan(ConanFile): #### **#KB-H030: "CONANDATA.YML FORMAT"** The structure of the [conandata.yml](https://docs.conan.io/en/latest/reference/config_files/conandata.yml.html) file should follow the schema -defined in [Adding Packages - `Conandata.yml` Format](conandata_yml_format.md). +defined in [Adding Packages - `Conandata.yml` Format](adding_packages/conandata_yml_format.md). #### **#KB-H031: "CONANDATA.YML REDUCE"** @@ -320,7 +327,9 @@ The attribue [default_options](https://docs.conan.io/en/latest/reference/conanfi #### **#KB-H052: "CONFIG.YML HAS NEW VERSION"** -It's important to have new library version defined in both [config.yml](how_to_add_packages.md#the-version-folders) and [conandata.yml](https://docs.conan.io/en/latest/reference/config_files/conandata.yml.html), otherwise newly added version will not be checked and built by CI and will not be available for download. +It's important to have new library version defined in both [config.yml](adding_packages/folders_and_files.md#configyml) and +[conandata.yml](adding_packages/folders_and_files.md#conandatayml), otherwise newly added version will not be checked and built +by CI and will not be available for download. #### **#KB-H053: "PRIVATE IMPORTS"** @@ -338,9 +347,7 @@ The duality creates a heterogeneous way of solving dependencies, making it diffi #### **#KB-H056: "LICENSE PUBLIC DOMAIN"** -[Public Domain](https://en.wikipedia.org/wiki/Public-domain-equivalent_license) is not a license by itself, but consists of all the creative work to which -no exclusive intellectual property rights apply. If a project is under Public Domain and there is no license listed, the -[Unlicense](https://spdx.org/licenses/Unlicense) should be used as described in the [FAQ](faqs.md#what-license-should-i-use-for-public-domain). +See [License Attribute](adding_packages/conanfile_attributes.md#license-attribute) for details. #### **#KB-H057: "TOOLS RENAME"** @@ -391,7 +398,7 @@ class SomeRecipe(ConanFile): ``` -See also: [Submitting a Package](how_to_add_packages.md#submitting-a-package). +See also: [Submitting a Package](adding_packages/README.md#submitting-a-package). #### **#KB-H066: "SHORT_PATHS USAGE"** @@ -447,7 +454,7 @@ class SomeRecipe(ConanFile): There is the case when the package is header-only, but the options affects the generated artifact, (e.g. kanguru, pagmo2 ...), so you need to use `self.info.settings.clear()` instead. -- For "tool" recipes ([example](https://github.com/conan-io/conan-center-index/blob/e604534bbe0ef56bdb1f8513b83404eff02aebc8/recipes/cmake/3.x.x/conanfile.py#L104-L105)) which only provide binaries, see [our packing policy](packaging_policy.md#settings) for more, should do as follows: +- @prince-chrismc This needs to a better example; For "tool" recipes ([example](https://github.com/conan-io/conan-center-index/blob/e604534bbe0ef56bdb1f8513b83404eff02aebc8/recipes/cmake/3.x.x/conanfile.py#L104-L105)) which only provide binaries, see [our packaging policy](adding_packages/build_and_package.md) for more, should do as follows: ```python def package_id(self): @@ -463,6 +470,28 @@ def package_info(self): self.cpp_info.includedirs = [] ``` +#### **#KB-H072: "PYLINT EXECUTION"** + +Pylint is executed by default over all `conanfile.py` files in ConanCenterIndex and it should not be skipped. It's an important tool which helps us keep a standard level of acceptance. Otherwise, it would be incredibly hard to review all recipes and keep them to the same level of standards. + +#### **#KB-H073: "TEST V1 PACKAGE FOLDER"** + +The legacy content in test_package should not be removed. Instead, rename that folder to `test_v1_package` and create a new `test_package` folder following the [file structure](adding_packages/README.md#recipe-files-structure) related to Conan v2 and v1 compatibility. Also, you can obtain good examples of Conan v2 test packages from the [template packages](package_templates/README.md) folder. + +#### **#KB-H075: "REQUIREMENT OVERRIDE PARAMETER"** + +The [self.requires()](https://docs.conan.io/en/latest/reference/conanfile/methods.html#requirements) allows to override a dependency version, forcing to use that version imposed by the recipe only. As a side-effect, dependencies can use different versions of the same project at the same package, which may cause unpredicted errors, like ABI incompatibility. For that reason, the `override` parameter is forbidden and should not be used. Instead, all dependencies should align their package versions, even when it's necessary to open more pull requests to update dependency versions. + +#### **#KB-H076: "EITHER STATIC OR SHARED OF EACH LIB"** + +It checks whether static & shared artifacts of the same lib are packaged together. Also, if there are tuples of (.a/.dylib) or (.a/.so) files with the same name. +So it works on Unix systems only, not Windows. Putting both same library name as shared and static in the very same package is considered an error, as it should be separated +and managed by the package option `shared`. + +#### **#KB-H077: "APPLE RELOCATABLE SHARED LIBS"** + +It checks whether installed shared libs are relocatable on Linux & macOS. All shared libs on macOS properly have `@rpath/` in install tree (@rpath token is supported since macOS 10.5 Leopard). + ## Deprecated errors The following errors from the hooks are deprecated and no longer reported: diff --git a/docs/faqs.md b/docs/faqs.md index dc593ab6cc44d..ee0c09a480f3f 100644 --- a/docs/faqs.md +++ b/docs/faqs.md @@ -11,18 +11,22 @@ This section gathers the most common questions from the community related to pac * [Why are CMake find/config files and pkg-config files not packaged?](#why-are-cmake-findconfig-files-and-pkg-config-files-not-packaged) * [Should recipes export a recipe's license?](#should-recipes-export-a-recipes-license) * [Why recipes that use build tools (like CMake) that have packages in Conan Center do not use it as a build require by default?](#why-recipes-that-use-build-tools-like-cmake-that-have-packages-in-conan-center-do-not-use-it-as-a-build-require-by-default) + * [How are rare build systems without generators packaged?](#how-are-rare-build-systems-without-generators-packaged) * [Are python requires allowed in the `conan-center-index`?](#are-python-requires-allowed-in-the-conan-center-index) * [What version should packages use for libraries without official releases?](#what-version-should-packages-use-for-libraries-without-official-releases) * [Is the Jenkins orchestration library publicly available?](#is-the-jenkins-orchestration-library-publicly-available) * [Why not x86 binaries?](#why-not-x86-binaries) - * [But if there are no packages available, what will the x86 validation look like?](#but-if-there-are-no-packages-available-what-will-the-x86-validation-look-like) + * [But if there are no packages available, what will the x86 validation look like?](#but-if-there-are-no-packages-available-what-will-the-x86-validation-look-like) + * [Do static libraries tend to be compiled as PIC by default?](#do-static-libraries-tend-to-be-compiled-as-pic-by-default) * [Why PDB files are not allowed?](#why-pdb-files-are-not-allowed) - * [Why is there no option for PDB, as there is for fPIC?](#why-is-there-no-option-for-pdb-as-there-is-for-fpic) + * [Why is there no option for PDB, as there is for fPIC?](#why-is-there-no-option-for-pdb-as-there-is-for-fpic) + * [Doesn't this make debug builds useless?](#doesnt-this-make-debug-builds-useless) * [Can I remove an option from a recipe?](#can-i-remove-an-option-from-a-recipe) * [Can I split a project into an installer and library package?](#can-i-split-a-project-into-an-installer-and-library-package) * [What license should I use for Public Domain?](#what-license-should-i-use-for-public-domain) * [What license should I use for a custom project specific license?](#what-license-should-i-use-for-a-custom-project-specific-license) - * [Why is a `tools.check_min_cppstd` call not enough?](#why-is-a-toolscheck_min_cppstd-call-not-enough) + * [How do I flag a problem to a recipe consumer?](#how-do-i-flag-a-problem-to-a-recipe-consumer) + * [Why is a `build.check_min_cppstd` call not enough?](#why-is-a-buildcheck_min_cppstd-call-not-enough) * [What is the policy for adding older versions of a package?](#what-is-the-policy-for-adding-older-versions-of-a-package) * [What is the policy for removing older versions of a package?](#what-is-the-policy-for-removing-older-versions-of-a-package) * [Can I install packages from the system package manager?](#can-i-install-packages-from-the-system-package-manager) @@ -33,7 +37,12 @@ This section gathers the most common questions from the community related to pac * [How to protect my project from breaking changes in recipes?](#how-to-protect-my-project-from-breaking-changes-in-recipes) * [Why are version ranges not allowed?](#why-are-version-ranges-not-allowed) * [How to consume a graph of shared libraries?](#how-to-consume-a-graph-of-shared-libraries) - * [How to watch only specific recipes?](#how-to-watch-only-specific-recipes) + * [How to watch only specific recipes?](#how-to-watch-only-specific-recipes) + * [Is it possible to disable Pylint?](#is-it-possible-to-disable-pylint) + * [How long can I be inactive before being removed from the authorized users list?](#how-long-can-i-be-inactive-before-being-removed-from-the-authorized-users-list) + * [Can we add package which are parts of bigger projects like Boost?](#can-we-add-package-which-are-parts-of-bigger-projects-like-boost) + * [Can I add my project which I will submit to Boost?](#can-i-add-my-project-which-i-will-submit-to-boost) + * [Can I add options that do not affect `package_id` or the package contents](#can-i-add-options-that-do-not-affect-package_id-or-the-package-contents) ## What is the policy on recipe name collisions? @@ -47,9 +56,9 @@ For example, `GSL` is the name of `Guidelines Support Library` from Microsoft an ## What is the policy on creating packages from pre-compiled binaries? -The policy is that in the general case [recipes should build packages from sources](packaging_policy.md), because of reproducibility and security concerns. The implication is that the sources must be publicly available, and in a format that can be consumed programmatically. +The policy is that in the general case [recipes should build packages from sources](adding_packages/sources_and_patches.md#picking-the-sources), because of reproducibility and security concerns. The implication is that the sources must be publicly available, and in a format that can be consumed programmatically. -Check the link for further details. +See [Picking Sources](adding_packages/sources_and_patches.md#picking-the-sources) for more information. ## Should reference names use `-` or `_`? @@ -68,7 +77,7 @@ Conan has an abstraction over the packages build system and description by using In the past, we have found that the logic of some of the CMake's find/config or pkg-config files can lead to broken scenarios due to issues with: - Transitive dependencies: The find logic of CMake can lead to link libraries with system libraries instead of the ones specified in the conanfile. -- Different build type configurations: Usually those files are not prepared to handle multiconfiguration development while switching between release/debug build types for example. +- Different build type configurations: Usually those files are not prepared to handle multi-configuration development while switching between release/debug build types for example. - Absolute paths: Usually, those files include absolute paths that would make the package broken when shared and consumed. - Hardcoded versions of dependencies as well as build options that make overriding dependencies from the consumer not possible. @@ -92,11 +101,22 @@ No, recipes do not need to export a recipe license. Recipes and all files contri We generally consider tools like CMake as a standard tool to have installed in your system. Having the `cmake` package as a build require in **all** the recipes that use it will be an overkill, as every build requirement is installed like a requirement and takes time to download. However, `cmake` could still be useful to use in your profile: ``` -[build_requires] +[tool_requires] cmake/3.17.2 ``` -Other packages using more unusual build tools, like `OpenSSL` using `strawberryperl`, will have the build require in the recipe as it is likely that the user that want to build it from sources will not have it installed in their system +Other packages using more unusual build tools should refer to the [Dependencies - Adding Build Requirements](adding_packages/dependencies.md#build-requirements) section for more information. + +## How are rare build systems without generators packaged? + +The C++ ecosystem has a lot of rare, unique and obscure build systems. Some of these are available in ConanCenter but they do not have built-in generators from the main Conan client. +The recipe is expected to encode the specifics of the build system, mapping the `settings`, `options` for the binary configuration, and also mapping `self.dependencies` so the build system can locate the dependencies libraries as required. +For these cases, contributors are asked to help reviewers as much as possible as it's likely we will not have expertise. + +> TODO: Add a link to docs.conan.io which explains how to write a custom generator in the 2.0 sense + +For quality assurance the build service is expected to be green and the [hooks](https://github.com/conan-io/hooks) will ensure the package contents match what is expected given the options. These recipes are more likely to have +inconsistency with other recipes but make for excellent contributions. ## Are python requires allowed in the `conan-center-index`? @@ -104,7 +124,8 @@ Unless they are a general and extended utility in recipes (in which case, we sho ## What version should packages use for libraries without official releases? -The notation shown below is used for publishing packages where the original library does not make official releases. Thus, we use a format which includes the datestamp corresponding to the date of a commit: `cci.`. In order to create reproducible builds, we also "commit-lock" to the latest commit on that day. Otherwise, users would get inconsistent results over time when rebuilding the package. An example of this is the [RapidJSON](https://github.com/Tencent/rapidjson) library, where its package reference is `rapidjson/cci.20200410` and its sources are locked the latest commit on that date in [config.yml](https://github.com/conan-io/conan-center-index/blob/master/recipes/rapidjson/config.yml#L4). The prefix `cci.` is mandatory to distinguish as a virtual version provided by CCI. If you are interested to know about the origin, please, read [here](https://github.com/conan-io/conan-center-index/pull/1464). +This happens for a number of reasons, some projects have a "live on main" others are less maintained but still merge pull requests. +Read about the [ConanCenter specific version format](adding_packages/conanfile_attributes.md#conancenter-specific-releases-format) for more information. ## Is the Jenkins orchestration library publicly available? @@ -125,6 +146,10 @@ As stated earlier, any increase in the number of configurations will result in a We often receive new fixes and improvements to the recipes already available for x86_64, including help for other architectures like x86 and ARM. In addition, we also receive new cases of bugs, for recipes that do not work on a certain platform, but that are necessary for use, which is important to understand where we should put more effort. So we believe that the best way to maintain and add support for other architectures is through the community. +## Do static libraries tend to be compiled as PIC by default? + +Yes! You can learn more about default options in [Packaging Policy](adding_packages/conanfile_attributes.md#predefined-options-and-known-defaults). + ## Why PDB files are not allowed? The project initially decided not to support the PDB files primarily due to the size of the final package, which could add an exaggerated size and not even used by users. In addition, PDB files need the source code to perform the debugging and even follow the path in which it was created and not the one used by the user, which makes it difficult to use when compared to the regular development flow with the IDE. @@ -135,6 +160,11 @@ However, there are ways to get around this, one of them is through the [/Z7](htt Adding one more common option, it seems the most simple and obvious solution, but it contains a side effect already seen with fPIC. It is necessary to manage the entire recipe, it has become a Boilerplate. So, adding PDB would be one more point to be reviewed for each recipe. In addition, in the future new options could arise, such as sanity or benchmark, further inflating the recipes. For this reason, a new option will not be added. However, the inclusion of the PDB files is discussed in issue [#1982](https://github.com/conan-io/conan-center-index/issues/1982) and there are some ideas for making this possible through a new feature. If you want to comment on the subject, please visit issue. +### Doesn't this make debug builds useless? + +No. The PDBs are only needed to debug dependency code. By providing the libraries you are able to link and build your application and debug your own code. +This is by far the more common scenario which we want to enable. + ## Can I remove an option from a recipe? It's preferable to leave all options (ie. not removing them) because it may break other packages which require those deleted options. @@ -158,7 +188,7 @@ def package_id(self): ``` This is the safest way, users will be warned of deprecation and their projects will not risk breaking. -As aditional examples, take a look on follow recipes: [dcmtk](https://github.com/conan-io/conan-center-index/blob/5e6089005f0bb66cd16db7b0e5f37f5081c7820c/recipes/dcmtk/all/conanfile.py#L24), [gtsam](https://github.com/conan-io/conan-center-index/blob/f7f18ab050e5d97fac70932b0ba4c115a930958c/recipes/gtsam/all/conanfile.py#L40) +As additional examples, take a look on follow recipes: [dcmtk](https://github.com/conan-io/conan-center-index/blob/5e6089005f0bb66cd16db7b0e5f37f5081c7820c/recipes/dcmtk/all/conanfile.py#L24), [gtsam](https://github.com/conan-io/conan-center-index/blob/f7f18ab050e5d97fac70932b0ba4c115a930958c/recipes/gtsam/all/conanfile.py#L40) and [libcurl](https://github.com/conan-io/conan-center-index/blob/f834ee1c82564199fdd9ca2f95231693c1a7136a/recipes/libcurl/all/conanfile.py#L24). However, if logic is too complex (this is subjective and depends on the Conan review team) then just remove the option. @@ -170,17 +200,16 @@ No. Some projects provide more than a simple library, but also applications. For ## What license should I use for Public Domain? -[The Public Domain](https://fairuse.stanford.edu/overview/public-domain/welcome/) is not a license by itself. Thus, we have [equivalent licenses](https://en.wikipedia.org/wiki/Public-domain-equivalent_license) to be used instead. By default, if a project uses Public Domain and there is no official license listed, you should use [Unlicense](https://spdx.org/licenses/Unlicense). +See [License Attribute](adding_packages/conanfile_attributes.md#license-attribute) for details. ## What license should I use for a custom project specific license? -When a non standard open-source license is used, we have decided to use `LicenseRef-` as a prefix, followed by the name of the file which contains a custom license. -See [the reviewing guidlines](reviewing.md#license-attribute) for more details. +See [License Attribute](adding_packages/conanfile_attributes.md#license-attribute) for details. ## How do I flag a problem to a recipe consumer? Regardless of why, if the recipe detects a problem where binaries might not be generated correctly, an exception must be raised. This to prevent the publishing -incorrect packages which do not work as intented. Use `ConanInvalidConfiguration` which is specially support in ConanCenter. +incorrect packages which do not work as intended. Use `ConanInvalidConfiguration` which is specially support in ConanCenter. ```py raise ConanInvalidConfiguration(f"The project {self.ref} requires liba.enable_feature=True.") @@ -214,16 +243,11 @@ As a result, all calls to `build.check_min_cppstd` must be guarded by a check fo ## What is the policy for adding older versions of a package? -We defer adding older versions without a direct requirement. We love to hear why in the opening description of the PR. -Adding versions that are not used by consumer only requires more resources and time from the CI servers. +See [Adding older versions](adding_packages/sources_and_patches.md#adding-old-versions) for details. ## What is the policy for removing older versions of a package? -Older versions can be removed from packages given the considerations below. When removing those version, remove everything -that is specific to them: logic from the recipe and references in `config.yml` and `conandata.yml`. In any case, packages -are never removed from ConanCenter remote. - -When removing older versions, please take into account [these considerations](reviewing.md#supported-versions). +See [Removing older versions](adding_packages/sources_and_patches.md#removing-old-versions) for details. ## Can I install packages from the system package manager? @@ -234,21 +258,21 @@ The hook [KB-H032](error_knowledge_base.md#KB-H032) does not allow `system_requi system packages at same recipe. There are exceptions where some projects are closer to system drivers or hardware and packaging as a regular library could result -in an incompatible Conan package. To deal with those cases, you are allowed to provide an exclusive Conan package which only installs system packages, see the [How-to](how_to_add_packages.md#system-packages) for more. +in an incompatible Conan package. To deal with those cases, you are allowed to provide an exclusive Conan package which only installs system packages, see the [How-to](adding_packages/build_and_package.md#system-packages) for more. ## Why ConanCenter does **not** build and execute tests in recipes -There are different motivations +There are different motivations: + - time and resources: adding the build time required by the test suite plus execution time can increase our building times significantly across the 100+ configurations. - ConanCenter is a service that builds binaries for the community for existing library versions, this is not an integration system to test the libraries. ## Why not add an option to build unit tests - Adding a testing option will change the package ID, but will not provide different packaged binaries -- Use the configuration [skip_test](packaging_policy.md#options) to define the testing behavior. - +- Use the configuration [skip_test](adding_packages/conanfile_attributes.md#options-to-avoid) to define the testing behavior. ## What is the policy for supported python versions? @@ -283,16 +307,16 @@ There are no guarantees that recipes will work correctly in future Python versio There are several popular software libraries provided by Intel: -* [Intel Math Kernel Library (MKL)](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onemkl.html) -* [Intel Integrated Performance Primitives (IPP)](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/ipp.html) -* [Intel Deep Neural Networking Library (DNN)](https://software.intel.com/content/www/us/en/develop/tools/oneapi/components/onednn.html) +* [Intel Math Kernel Library (MKL)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html) +* [Intel Integrated Performance Primitives (IPP)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/ipp.html) +* [Intel Deep Neural Networking Library (DNN)](https://www.intel.com/content/www/us/en/developer/tools/oneapi/onednn.html) these Intel libraries are widely used by various well-known open-source projects (e.g. [OpenCV](https://opencv.org/) or [TensorFlow](https://www.tensorflow.org/)). Unfortunately, these Intel libraries cannot be accepted into ConanCenter due to several important reasons: * they are closed-source and commercial products, ConanCenter cannot redistribute their binaries due to the license restrictions -* registration on the Intel portal is required in order to dowload the libraries, there are no permanent public direct download links +* registration on the Intel portal is required in order to download the libraries, there are no permanent public direct download links * they use graphical installers which are hard to automate within conan recipe instead, the libraries that depend on *MKL*, *IPP* or *DNN* should use the following references: @@ -333,7 +357,7 @@ intel-mkl/2021@mycompany/stable ## How to protect my project from breaking changes in recipes? -This repository and the CI building recipes is continuosly pushing to new Conan versions, +This repository and the CI building recipes is continuously pushing to new Conan versions, sometimes adopting new features as soon as they are released ([Conan client changelog](https://docs.conan.io/en/latest/changelog.html)). @@ -341,33 +365,12 @@ You should expect that latest revision of recipes can introduce breaking changes features that will be broken unless you also upgrade Conan client (and sometimes you will need to modify your project if the recipe changes the binaries, flags,... it provides). -To isolate from this changes there are different strategies you can follow: - -The minimum solution involves small changes to your Conan client configuration by - -* **Pin the version of every reference you consume in your project** using either: - * [recipe revision (RREV)](https://docs.conan.io/en/latest/versioning/revisions.html): `foo/1.0@#RREV` instead of `foo/1.0` in your conanfile. - * [lockfiles](https://docs.conan.io/en/latest/versioning/lockfiles/introduction.html) (please, be aware there are some [knowns bugs](https://github.com/conan-io/conan/issues?q=is%3Aissue+lockfile) related to lockfiles that are not being fixed in Conan v1.x). - -For larger projects and teams it is recommended to add some infrastructure to ensure stability by - - * **Cache recipes in your own Artifactory**: your project should use only this remote and - new recipe revisions are only pushed to your Artifactory after they have been validated - in your project. - -Keep reading in the [consuming recipes section](consuming_recipes.md). +To isolate from these changes there are different strategies you can follow. +Keep reading in the [consuming recipes section](consuming_recipes.md#isolate-your-project-from-upstream-changes). ## Why are version ranges not allowed? -Version ranges are a useful Conan feature, find the documentation [here](https://docs.conan.io/en/latest/versioning/version_ranges.html). However, in the context of ConanCenter they pose a few key challenges, most notably: - -- Non-Determinstic `package-id` - -With version ranges the newest compatible package may yield a different package-id than the one built and published by ConanCenter resulting in frustrating error "no binaries found". For more context see [this excellent explanation](https://github.com/conan-io/conan-center-index/pull/8831#issuecomment-1024526780). - -- Build Reproducibility - -If consumers try to download and build the recipe at a later time, it may resolve to a different package version that may generate a different binary (that may or may not be compatible). In order to prevent these types of issues, we have decided to only allow exact requirements versions. This is a complicated issue, check [this thread](https://github.com/conan-io/conan-center-index/pull/9140#discussion_r795461547) for more. +See [Dependencies Version Ranges](adding_packages/dependencies.md#version-ranges) for details. ## How to consume a graph of shared libraries? @@ -403,5 +406,59 @@ Conan will build from sources all the packages and use the shared libraries when The [Code Owners](https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners) feature requires write permission for any listed user in the file `.github/CODEOWNERS`, which makes it impossible to be accepted by Conan. However, that file is still important as it can be re-used in -a future Github Action to parse and communicate users. Meanwhile, there is the project https://app.github-file-watcher.com/, which is able to notify users, but only after -merging to the master branch. Feel free to contribute to a new Github Action that implements a file watcher feature. +a future Github Action to parse and communicate users. Meanwhile, there is the project https://app.github-file-watcher.com/, +which is able to notify users, but only after merging to the master branch. Feel free to contribute to a new Github Action that +implements a file watcher feature. + +## Is it possible to disable Pylint? + +No. The [pylint](v2_linter.md) has an important role of keeping any recipe prepared for [Conan v2 migration](v2_migration.md). In case you are having +difficult to understand [linter errors](linters.md), please comment on your pull request about the problem to receive help from the community. + +## How long can I be inactive before being removed from the authorized users list? + +Please, read [Inactivity and user removal section](adding_packages/README.md#inactivity-and-user-removal). + +## Can we add package which are parts of bigger projects like Boost? + +Sadly no. There have been many efforts in the past and we feel it's not sustainable given the number of combinations of libraries and version. +See #14660 for recent discussions. There is one main "boost" recipe with many versions maintained. Adding boost libraries with no dependencies +just opens the door to graph resolution problems and once available allows for dependent libraries to be added. + +In order to avoid this the sole permutation which is permissible is when the project does not package any headers under the `boost/` folder, does not use the boost namespace +and does not install libraries with the boost prefix. + +### Can I add my project which I will submit to Boost? + +Yes, but make sure it does not have Boost in the name. Use the [`author-name` convention](https://github.com/conan-io/conan-center-index/blob/master/docs/faqs.md#what-is-the-policy-on-recipe-name-collisions) so there are no conflicts. In addition to follow the rules outlined above. + +## Can I add options that do not affect `package_id` or the package contents + +Generally no, these sorts of options can most likely be set from a profile or downstream recipes. However if the project supports this option from its build script +and would otherwise dynamically embed this into the CMake config files or generated pkg-config files then it should be allowed. + +Doing so requires [deleting the option from the `package_id`](adding_packages/conanfile_attributes.md#removing-from-package_id). + +## Can I use full_package_mode for a requirement in my recipe? + +For some irregular projects, they may need to be aligned when being used as a requirement, using the very same version, options, and settings and maybe not mixing shared with static linkage. +Those projects usually break between patch versions and are very sensitive, so we can not use different versions through Conan graph dependencies, +otherwise, it may result in unexpected behavior or even runtime errors. + +A very known project is GLib, which requires the very same configuration to prevent multiple instances when using static linkage. +As a solution, we could consume GLib on full package id mode, like: + +```python +def package_id(self): + self.info.requires["glib"].full_package_mode() +``` + +Perfect solution on the consumer side, but there is a side-effect: CCI will not re-generate all involved packages for any change in the dependencies graph with which glib is associated, which means, users will start to see **MISSING_PACKAGES** error during their pull requests. +As a trade-off, it would be necessary to update all recipes involved, by opening new PRs, +then it should generate new packages, but it takes many days and still is a process that is not supported by CCI internally. + +To have more context about it, please, visit issues #11684 and #11022 + +In summary, we do not recommend `full_package_mode` or any other custom package id mode for requirements on CCI, it will break other PRs soon or later. +Instead, prefer using `shared=True` by default, when needed. +Also, when having a similar situation, do not hesitate in opening an issue explaining your case, and ask for support from the community. diff --git a/docs/how_to_add_packages.md b/docs/how_to_add_packages.md deleted file mode 100644 index a3d58c0bb19af..0000000000000 --- a/docs/how_to_add_packages.md +++ /dev/null @@ -1,291 +0,0 @@ -# Adding Packages to ConanCenter - -The [conan-center-index](https://github.com/conan-io/conan-center-index) (this repository) contains recipes for the remote [JFrog ConanCenter](https://conan.io/center/). -This remote is added by default to a clean installation of the Conan client. Recipes are contributed by opening pull requests as explained in the sections below. -When pull requests are merged, the CI will upload the generated packages to the [conancenter](https://conan.io/center/) remote. - - -## Contents - - * [Request access](#request-access) - * [Submitting a Package](#submitting-a-package) - * [The Build Service](#the-build-service) - * [Recipe files structure](#recipe-files-structure) - * [`config.yml`](#configyml) - * [`conandata.yml`](#conandatayml) - * [The _recipe folder_: `conanfile.py`](#the-_recipe-folder_-conanfilepy) - * [The test package folders: `test_package` and `test_`](#the-test-package-folders-test_package-and-test_something) - * [How to provide a good recipe](#how-to-provide-a-good-recipe) - * [Header Only](#header-only) - * [CMake](#cmake) - * [Components](#components) - * [Autotools](#autotools) - * [Components](#components-1) - * [No Upstream Build Scripts](#no-upstream-build-scripts) - * [System Packages](#system-packages) - * [Verifying Dependency Version](#verifying-dependency-version) - * [Verifying Dependency Options](#verifying-dependency-options) - * [Test the recipe locally](#test-the-recipe-locally) - * [Updating conan hooks on your machine](#updating-conan-hooks-on-your-machine) - * [Debugging failed builds](#debugging-failed-builds) - -## Request access - -:one: The first step to add packages to ConanCenter is requesting access. To enroll in ConanCenter repository, please write a comment -requesting access in this GitHub [issue](https://github.com/conan-io/conan-center-index/issues/4). Feel free to introduce yourself and -your motivation to join ConanCenter. - -This process helps conan-center-index against spam and malicious code. The process is not not automated on purpose and the requests are generally approved on a weekly basis. - -> :warning: The requests are reviewed manually, checking the GitHub profile activity of the requester to avoid a misuse of the service. In case of detecting a misuse or inappropriate behavior, the requester will be dropped from the authorized users list and at last instance even banned from the repository. - -## Submitting a Package - -:two: To contribute a package, you can submit a [Pull Request](https://github.com/conan-io/conan-center-index/pulls) to this GitHub repository https://github.com/conan-io/conan-center-index. - -The specific steps to add new packages are: -* Fork the [conan-center-index](https://github.com/conan-io/conan-center-index) git repository, and then clone it locally. -* Create a new folder with the Conan package recipe (`conanfile.py`) in the correct folder. -* Make sure you are using the latest [Conan client](https://conan.io/downloads) version, as recipes might evolve introducing features of the newer Conan releases. -* Commit and Push to GitHub then submit a pull request. -* Our automated build service will build 100+ different configurations, and provide messages that indicate if there were any issues found during the pull request on GitHub. - -:three: When the pull request is [reviewed and merged](review_process.md), those packages are published to [JFrog ConanCenter](https://conan.io/center/) and available for everyone. - -### The Build Service - -The **build service** associated to this repo will generate binary packages automatically for the most common platforms and compilers. See [the Supported Platforms and Configurations page](supported_platforms_and_configurations.md) for a list of generated configurations. For a C++ library, the system is currently generating more than 100 binary packages. - -> ⚠️ **Note**: This not a testing service, it is a binary building service for package **released**. Unit tests shouldn't be built nor run in recipes by default, see the [FAQs](faqs.md#why-conancenter-does-not-build-and-execute-tests-in-recipes) for more. Before submitting a pull request, please ensure that it works locally for some configurations. - -- The CI bot will start a new build only after the author is approved. Your PR may be reviewed in the mean time, but is not guaranteed. -- The CI system will also report with messages in the PR any error in the process, even linking to the logs to see more details and debug. - -The pipeline will report errors and build logs by creating a comment in the pull-request after every commit. The message will include links to the logs for inspecting. - -Packages generated and uploaded by this build service don't include any _user_ or _channel_ (existing references with any `@user/channel` should be considered as deprecated in favor of packages without it). Once the packages are uploaded, you will be able to install them using the reference as `name/version` (requires Conan >= 1.21): `conan install cmake/3.18.2@`. - -## Recipe files structure - -Every entry in the `recipes` folder contains all the files required by Conan to create the binaries for all the versions of one library. Those -files don't depend on any other file in the repository (we are not using `python_requires`) and every pull-request can modify only one of those -folders at a time. - -This is the canonical structure of one of these folders, where the same `conanfile.py` recipe is suitable to build all the versions of the library: - -``` -. -+-- recipes -| +-- library_name/ -| +-- config.yml -| +-- all/ -| +-- conanfile.py -| +-- conandata.yml -| +-- test_package/ -| +-- conanfile.py -| +-- CMakeLists.txt -| +-- main.cpp -``` - -If it becomes too complex to maintain the logic for all the versions in a single `conanfile.py`, it is possible to split the folder `all` into -two or more folders, dedicated to different versions, each one with its own `conanfile.py` recipe. In any case, those folders should replicate the -same structure. - -### `config.yml` - -This file lists the versions and the folders where they are located (if there are more than a single `all` folder): - -```yml -versions: - "1.1.0": - folder: 1.x.x - "1.1.1": - folder: 1.x.x - "2.0.0": - folder: all - "2.1.0": - folder: all -``` - - -### `conandata.yml` - -This file lists **all the sources that are needed to build the package**: source code, license files,... any file that will be used by the recipe -should be listed here. The file is organized into two sections, `sources` and `patches`, each one of them contains the files that are required -for each version of the library. All the files that are downloaded from the internet should include a checksum, so we can validate that -they are not changed. - -A detailed breakdown of all the fields can be found in [conandata_yml_format.md](conandata_yml_format.md). We strongly encourage adding the [patch fields](conandata_yml_format.md#patches-fields) to help track where patches come from and what issue they solve. - -Inside the `conanfile.py` recipe, this data is available in a `self.conan_data` attribute that can be used as follows: - -```py -def source(self): - files.get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - -def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - files.copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) - -def build(self): - files.apply_conandata_patches(self) - [...] -``` - -More details can be found in the [reviewing preference](reviewing.md) documentation - -### The _recipe folder_: `conanfile.py` - -The main files in this repository are the `conanfile.py` ones that contain the logic to build the libraries from sources for all the configurations, -as we said before there can be one single recipe suitable for all the versions inside the `all` folder, or there can be several recipes targetting -different versions in different folders. For mainteinance reasons, we prefer to have only one recipe, but sometimes the extra effort doesn't worth -it and it makes sense to split and duplicate it, there is no common rule for it. - -Together with the recipe, there can be other files that are needed to build the library: patches, other files related to build systems (many recipes -include a `CMakeLists.txt` to run some Conan logic before using the one from the library),... all these files will usually be listed in the -`exports_sources` attribute and used during the build process. - -Also, **every `conanfile.py` should be accompanied by one or several folder to test the generated packages** as we will see below. - -### The test package folders: `test_package` and `test_` - -All the packages in this repository need to be tested before they join ConanCenter. A `test_package` folder with its corresponding `conanfile.py` and -a minimal project to test the package is strictly required. You can read about it in the -[Conan documentation](https://docs.conan.io/en/latest/creating_packages/getting_started.html#the-test-package-folder). - -Sometimes it is useful to test the package using different build systems (CMake, Autotools,...). Instead of adding complex logic to one -`test_package/conanfile.py` file, it is better to add another `test_/conanfile.py` file with a minimal example for that build system. That -way the examples will be short and easy to understand and maintain. In some other situations it could be useful to test different Conan generators -(`cmake_find_package`, `CMakeDeps`,...) using different folders and `conanfile.py` files ([see example](https://github.com/conan-io/conan-center-index/tree/master/recipes/fmt/all)). - -When using more than one `test_` folder, create a different project for each of them to keep the content of the `conanfile.py` and the -project files as simple as possible, without the need of extra logic to handle different scenarios. - -``` -. -+-- recipes -| +-- library_name/ -| +-- config.yml -| +-- all/ -| +-- conanfile.py -| +-- conandata.yml -| +-- test_package/ -| +-- conanfile.py -| +-- CMakeLists.txt -| +-- main.cpp -| +-- test_cmakedeps/ -| +-- conanfile.py -| +-- CMakeLists.txt -| +-- conanfile.py -``` - -The CI will explore all the folders and run the tests for the ones matching `test_*/conanfile.py` pattern. You can find the output of all -of them together in the testing logs. - -> **Note.-** If, for any reason, it is useful to write a test that should only be checked using Conan v1, you can do so by using the pattern -> `test_v1_*/conanfile.py` for the folder. Please, have a look to [linter notes](v2_linter.md) to know how to prevent the linter from -> checking these files. - -> Remember that the `test_` recipes should **test the package configuration that has just been generated** for the _host_ context, otherwise -> it will fail in crossbuilding scenarios. - - -## How to provide a good recipe - -The [recipes](https://github.com/conan-io/conan-center-index/tree/master/recipes) available in CCI can be used as good examples, you can use them as the base for your recipe. However it is important to note Conan features change over time and our best practices evolve so some minor details may be out of date due to the vast number of recipes. - -### Header Only - -If you are looking for header-only projects, you can take a look on [rapidjson](https://github.com/conan-io/conan-center-index/blob/master/recipes/rapidjson/all/conanfile.py), [rapidxml](https://github.com/conan-io/conan-center-index/blob/master/recipes/rapidxml/all/conanfile.py), and [nuklear](https://github.com/conan-io/conan-center-index/blob/master/recipes/nuklear/all/conanfile.py). Also, Conan Docs has a section about [how to package header-only libraries](https://docs.conan.io/en/latest/howtos/header_only.html). - -### CMake - -For C/C++ projects which use CMake for building, you can take a look on [szip](https://github.com/conan-io/conan-center-index/blob/master/recipes/szip/all/conanfile.py) and [recastnavigation](https://github.com/conan-io/conan-center-index/blob/master/recipes/recastnavigation/all/conanfile.py). - -#### Components - -Another common use case for CMake based projects, both header only and compiled, is _modeling components_ to match the `find_package` and export the correct targets from Conan's generators. A basic examples of this is [cpu_features](https://github.com/conan-io/conan-center-index/blob/master/recipes/cpu_features/all/conanfile.py), a moderate/intermediate example is [cpprestsdk](https://github.com/conan-io/conan-center-index/blob/master/recipes/cpprestsdk/all/conanfile.py), and a very complex example is [OpenCV](https://github.com/conan-io/conan-center-index/blob/master/recipes/opencv/4.x/conanfile.py). - -### Autotools - -However, if you need to use autotools for building, you can take a look on [mpc](https://github.com/conan-io/conan-center-index/blob/master/recipes/mpc/all/conanfile.py), [libatomic_ops](https://github.com/conan-io/conan-center-index/blob/master/recipes/libatomic_ops/all/conanfile.py), [libev](https://github.com/conan-io/conan-center-index/blob/master/recipes/libev/all/conanfile.py). - -#### Components - -Many projects offer **pkg-config**'s `*.pc` files which need to be modeled using components. A prime example of this is [Wayland](https://github.com/conan-io/conan-center-index/blob/master/recipes/wayland/all/conanfile.py). - -### No Upstream Build Scripts - -For cases where a project only offers source files, but not a build script, you can add CMake support, but first, contact the upstream and open a PR offering building support. If it's rejected because the author doesn't want any kind of build script, or the project is abandoned, CCI can accept your build script. Take a look at [Bzip2](https://github.com/conan-io/conan-center-index/blob/master/recipes/bzip2/all/CMakeLists.txt) and [DirectShowBaseClasses](https://github.com/conan-io/conan-center-index/blob/master/recipes/directshowbaseclasses/all/CMakeLists.txt) as examples. - -### System Packages - -> :information_source: For exceptional cases where only system packages can be used and a regular Conan package may result in an incompatible and fragile package, a separated system package may be created. See the [FAQs](faqs.md#can-i-install-packages-from-the-system-package-manager) for more. - -The [SystemPackageTool](https://docs.conan.io/en/latest/reference/conanfile/methods.html#systempackagetool) can easily manage a system package manager (e.g. apt, -pacman, brew, choco) and install packages which are missing on Conan Center but available for most distributions. It is key to correctly fill in the `cpp_info` for the consumers of a system package to have access to whatever was installed. - -As example there are [glu](https://github.com/conan-io/conan-center-index/blob/master/recipes/glu/all/conanfile.py) and [OpenGL](https://github.com/conan-io/conan-center-index/blob/master/recipes/opengl/all/conanfile.py). Also, it will require an exception rule for [conan-center hook](https://github.com/conan-io/hooks#conan-center), a [pull request](https://github.com/conan-io/hooks/pulls) should be open to allow it over the KB-H032. - -### Verifying Dependency Version - -Some project requirements need to respect a version constraint. This can be enforced in a recipe by accessing the [`deps_cpp_info`](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#deps-cpp-info) attribute. -An exaple of this can be found in the [spdlog recipe](https://github.com/conan-io/conan-center-index/blob/9618f31c4d9b4da5d06f905befe9691cf105a1fc/recipes/spdlog/all/conanfile.py#L92-L94). - -```py -if tools.Version(self.deps_cpp_info["liba"].version) < "7": - raise ConanInvalidConfiguration(f"The project {self.name}/{self.version} requires liba > 7.x") -``` - -In Conan version 1.x this needs to be done in the `build` method, in future release is should be done in the `validate` method. - -### Verifying Dependency Options - -Certain projects are dependant on the configuration (a.k.a options) of a dependency. This can be enforced in a recipe by accessing the [`options`](https://docs.conan.io/en/latest/reference/conanfile/attributes.html#options) attribute. -An example of this can be found in the [kealib recipe](https://github.com/conan-io/conan-center-index/blob/9618f31c4d9b4da5d06f905befe9691cf105a1fc/recipes/kealib/all/conanfile.py#L44-L46). - -```py - def validate(self): - if not self.options["liba"].enable_feature: - raise ConanInvalidConfiguration(f"The project {self.name}/{self.version} requires liba.enable_feature=True.") -``` - -## Test the recipe locally - -The system will use the [conan-center hook](https://github.com/conan-io/hooks) to perform some quality checks. You can install the hook running: - -```sh -conan config install https://github.com/conan-io/hooks.git -sf hooks -tf hooks -conan config set hooks.conan-center -``` - -The hook will show error messages but the `conan create` won’t fail unless you export the environment variable `CONAN_HOOK_ERROR_LEVEL=40`. -All hook checks will print a similar message: - -``` -[HOOK - conan-center.py] post_source(): [LIBCXX MANAGEMENT (KB-H011)] OK -[HOOK - conan-center.py] post_package(): ERROR: [PACKAGE LICENSE] No package licenses found -``` - -Call `conan create . lib/1.0@` in the folder of the recipe using the profile you want to test. For instance: - -```sh -cd conan-center-index/recipes/boost/all -conan create conanfile.py boost/1.77.0@ -``` - -### Updating conan hooks on your machine - -The hooks are updated from time to time, so it's worth keeping your own copy of the hooks updated regularly. To do this: - -```sh -conan config install -``` - -## Debugging failed builds - -Go to the [Error Knowledge Base](error_knowledge_base.md) page to know more about Conan Center hook errors. - -Some common errors related to Conan can be found on [troubleshooting](https://docs.conan.io/en/latest/faq/troubleshooting.html) section. - -To test with the same enviroment, the [build images](supported_platforms_and_configurations.md#build-images) are available. diff --git a/docs/labels.md b/docs/labels.md index 129664ab09538..270b6b157a75a 100644 --- a/docs/labels.md +++ b/docs/labels.md @@ -12,7 +12,11 @@ special meaning: * [Infrastructure](#infrastructure) * [Stale](#stale) * [Unexpected Error](#unexpected-error) - * [User-approval pending](#user-approval-pending) + * [User-approval pending](#user-approval-pending) + * [Library Request](#library-request) + * [Question](#question) + * [Upstream Update](#upstream-update) + * [conan.io/center](#conaniocenter) ## Bump dependencies @@ -28,8 +32,8 @@ If the pull request modifies anything else, the label won't be assigned, we need Label [`Bump version`](https://github.com/conan-io/conan-center-index/pulls?q=is%3Aopen+is%3Apr+label%3A%22Bump+version%22) is assigned by the bot to pull-requests that are just adding a new version of the library. The new version should satisfy -some extra conditions: sources should provide from the same URL domain as previous versions and the version itself should -be valid semver. +some extra conditions: sources should provide from the same URL domain as previous versions. +For now, only [SEMVER](https://semver.org/#semantic-versioning-200) and `` are acceptable version formats. > These pull-requests will be merged right away without requiring any approval (CI and CLA checks must have passed). @@ -50,12 +54,32 @@ any further activity. ## Unexpected Error Label [`Unexpected Error`](https://github.com/conan-io/conan-center-index/pulls?q=is%3Aopen+is%3Apr+label%3A%22Unexpected+Error%22) -is assigned by the CI when the process finishes abnormally. It tries to signal all the pull requests that failed, but -didn't provide any meaningful message to the user. Usually it is some _random_ internal error and it won't happen next -time the CI runs, don't hesitate to trigger a new build in this situation. +is assigned by the CI when the process finishes abnormally. +Usually it is some _random_ internal error and it won't happen next time the CI runs. +The CI will re-start your build automatically, the Github check `continuous-integration/jenkins/pr-merge` +will be changed to the status `Pending — This commit is being built` to signalize as running. + +> **Note**: Manually restarting a new build, by closing/opening the PR, will be added to the end of the CI build queue. ## User-approval pending Label [`User-approval pending`](https://github.com/conan-io/conan-center-index/pulls?q=is%3Aopen+is%3Apr+label%3A%22User-approval+pending%22) signals the pull request that have been submitted by an user who is not yet approved in ConanCenter. Once the user is approved these pull requests will be triggered again automatically. + +## Library Request + +Request a new package to be created. + +## Question + +Further information is requested. Usually these are for issue where help is needed to solve a specific issue. These are a great way +to look for advice or recommendation about making changes to recipes. + +## Upstream Update + +Request a bump of a new package version. + +## conan.io/center + +Issues and features related to Web UI. diff --git a/docs/linters.md b/docs/linters.md new file mode 100644 index 0000000000000..b93f645337264 --- /dev/null +++ b/docs/linters.md @@ -0,0 +1,160 @@ +# ConanCenterIndex Linters + +Some linter configuration files are available in the folder [linter](../linter), which are executed by Github Actions +and are displayed during [code review](https://github.com/features/code-review) as annotations, to improve recipe quality. +They consume python scripts which are executed to fit CCI rules. Those scripts use [astroid](https://github.com/PyCQA/astroid) +and [pylint](https://pylint.pycqa.org/en/latest/) classes to parse Conan recipe files and manage their warnings and errors. + +Pylint by itself is not able to find ConanCenterIndex rules, so astroid is used to iterate over a conanfile's content and +validate CCI requirements. Pylint uses an [rcfile](https://pylint.pycqa.org/en/latest/user_guide/configuration/index.html) +to configure plugins, warnings and errors which should be enabled or disabled. + + +## Contents + + * [Understanding the different linters](#understanding-the-different-linters) + * [Running the linters locally](#running-the-linters-locally) + * [Pylint configuration files](#pylint-configuration-files) + * [Linter Warning and Errors](#linter-warning-and-errors) + * [E9006 - conan-import-conanfile: ConanFile should be imported from conan](#e9006---conan-import-conanfile-conanfile-should-be-imported-from-conan) + * [E9005 - conan-missing-name: Every conan recipe must contain the attribute name](#e9005---conan-missing-name-every-conan-recipe-must-contain-the-attribute-name) + * [E9004 - conan-package-name: Conan package names must be lower-case](#e9004---conan-package-name-conan-package-names-must-be-lower-case) + * [E9007 - conan-test-no-name: Do not add name attribute in test package recipes](#e9007---conan-test-no-name-do-not-add-name-attribute-in-test-package-recipes) + * [E9008 - conan-import-errors: Deprecated imports should be replaced by new imports](#e9008---conan-import-errors-deprecated-imports-should-be-replaced-by-new-imports) + * [E9009 - conan-import-error-conanexception: conans.errors is deprecated and conan.errors should be used instead](#e9009---conan-import-error-conanexception-conanserrors-is-deprecated-and-conanerrors-should-be-used-instead) + * [E9010 - conan-import-error-conaninvalidconfiguration: conans.errors is deprecated and conan.errors should be used instead](#e9010---conan-import-error-conaninvalidconfiguration-conanserrors-is-deprecated-and-conanerrors-should-be-used-instead) + * [E9011 - conan-import-tools: Importing conan.tools or conan.tools.xxx.zzz.yyy should be considered as private](#e9011---conan-import-tools-importing-conantools-or-conantoolsxxxzzzyyy-should-be-considered-as-private) + +## Understanding the different linters + +There's a three classes of linters currently in place for ConanCenterIndex + +- ConanCenter Hook - these are responsible for validating the structure of the recipes and packages. +- Pylint Linter - these are used to ensure the code quality and conventions of a recipes (i.e `conanfile.py`) +- Yaml Checks - stylistic guidance and schema validation check for support files and best practices + +## Running the linters locally + +Check the [Developing Recipes](developing_recipes_locally.md) for more information on each of the three linters. + +## Pylint configuration files + +- [Pylint Recipe](../linter/pylintrc_recipe): This `rcfile` lists plugins and rules to be executed over all recipes (not test package) and validate them. +- [Pylint Test Package Recipe](../linter/pylintrc_testpackage): This `rcfile` lists plugins and rules to be executed over all recipes in test package folders only: + +## Linter Warning and Errors + +Here is the list of current warning and errors provided by pylint, when using CCI configuration. + +### E9006 - conan-import-conanfile: ConanFile should be imported from conan + +```python +from conans import ConanFile +``` + +Should be replaced by: + +```python +from conan import Conanfile +``` + +### E9005 - conan-missing-name: Every conan recipe must contain the attribute name + +The attribute `name` is always expected. On the other hand, `version` should not be listed. + +```python +def BazConanfile(ConanFile): + name = "baz" +``` + +### E9004 - conan-package-name: Conan package names must be lower-case + +The package name is always lower-case, even when the upstream uses another format + +```python +def FoobarConanfile(ConanFile): + name = "foobar" +``` + +### E9007 - conan-test-no-name: Do not add name attribute in test package recipes + +The test package is not a recipe, thus, it should not have a name + +```python +def TestPackageConanFile(ConanFile): + name = "test_package" # Wrong! +``` + +### E9008 - conan-import-errors: Deprecated imports should be replaced by new imports + +Read [v2_linter](v2_linter.md) for a list of mappings of v1 to v2. +Regular imports from `conans.tools` are now updated: + +```python +from conans import tools +... + +tools.rmdir(os.path.join(self.package_folder, "shared")) +``` + +Should be replaced by specialized tools, prepared for Conan 2.0 + +```python +from conan.tools.files import rmdir +... + +rmdir(self, os.path.join(self.package_folder, "shared")) +``` + +### E9009 - conan-import-error-conanexception: conans.errors is deprecated and conan.errors should be used instead + +```python +from conans.errors import ConanException +``` + +Should be replaced by: + +```python +from conan.errors import ConanException +``` + +Only the namespace `conans` has been replaced by `conan`. + +### E9010 - conan-import-error-conaninvalidconfiguration: conans.errors is deprecated and conan.errors should be used instead + +```python +from conans.errors import ConanInvalidConfiguration +``` + +Should be replaced by: + +```python +from conan.errors import ConanInvalidConfiguration +``` + +Only the namespace `conans` has been replaced by `conan`. + +### E9011 - conan-import-tools: Importing conan.tools or conan.tools.xxx.zzz.yyy should be considered as private + +Documented on [conanfile.tools](https://docs.conan.io/en/latest/reference/conanfile/tools.html): +It's not allowed to use `tools.xxx` directly: + +```python +from conan import tools +... + +tools.scm.Version(self.version) +``` + +Neither sub modules: + +```python +from conan.tools.apple.apple import is_apple_os +``` + +Only modules under `conan.tools` and `conan.tools.xxx` are allowed: + +```python +from conan.tools.files import rmdir +from conan.tools import scm +```` diff --git a/docs/package_templates/README.md b/docs/package_templates/README.md new file mode 100644 index 0000000000000..76d696e57b0a0 --- /dev/null +++ b/docs/package_templates/README.md @@ -0,0 +1,27 @@ +## Package Templates + +A brief description about each template available: + +#### Autotools package + +It's listed under [autotools_package](autotools_package) folder. It fits projects which use `autotools` or `make` to be built. + +#### CMake package + +It's listed under [cmake_package](cmake_package) folder. It fits projects which use `CMake` to be built. + +#### Header only + +It's listed under [header_only](header_only) folder. It fits projects which only copy header and have the same package ID always. + +#### MSBuild package + +It's listed under [msbuild_package](msbuild_package) folder. It fits projects which use `msbuild` to be built. + +#### Prebuilt tool package + +It's listed under [prebuilt_tool_package](prebuilt_tool_package) folder. It fits projects which only copy generated binaries (executables and libraries). + +#### Meson package + +It's listed under [meson_package](meson_package) folder. It fits projects which use `Meson` to be built. diff --git a/docs/package_templates/autotools_package/all/conandata.yml b/docs/package_templates/autotools_package/all/conandata.yml index 61b769f81b6fa..629a5640adc16 100644 --- a/docs/package_templates/autotools_package/all/conandata.yml +++ b/docs/package_templates/autotools_package/all/conandata.yml @@ -1,16 +1,14 @@ sources: # Newer versions at the top "1.2.0": - url: [ - "https://mirror1.net/package-1.2.0.tar.gz", - "https://mirror2.net/package-1.2.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.2.0.tar.gz" + - "https://mirror2.net/package-1.2.0.tar.gz" sha256: "________________________________________________________________" "1.1.0": - url: [ - "https://mirror1.net/package-1.1.0.tar.gz", - "https://mirror2.net/package-1.1.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.1.0.tar.gz" + - "https://mirror2.net/package-1.1.0.tar.gz" sha256: "________________________________________________________________" patches: # Newer versions at the top @@ -19,11 +17,7 @@ patches: patch_description: "correct the order of cmake min and project" patch_type: "backport" patch_source: "https://github.com/owner/package/pulls/42" - sha256: "________________________________________________________________" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-linux.patch" patch_description: "add missing header to support linux" patch_type: "portability" patch_source: "https://github.com/owner/package/issues/0" - sha256: "________________________________________________________________" - base_path: "source_subfolder" diff --git a/docs/package_templates/autotools_package/all/conanfile.py b/docs/package_templates/autotools_package/all/conanfile.py index 27a85160acde1..7f3844b8e46b6 100644 --- a/docs/package_templates/autotools_package/all/conanfile.py +++ b/docs/package_templates/autotools_package/all/conanfile.py @@ -1,23 +1,34 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.env import VirtualBuildEnv -from conan.tools.build import check_min_cppstd -from conan.tools.files import copy, get, rm, rmdir, apply_conandata_patches +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.54.0" + +# +# INFO: Please, remove all comments before pushing your PR! +# class PackageConan(ConanFile): name = "package" description = "short description" - license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # In case not listed there, use "LicenseRef-" + license = "" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/project/package" - topics = ("topic1", "topic2", "topic3") # no "conan" and project name in topics + # no "conan" and project name in topics. Use topics from the upstream listed on GH + topics = ("topic1", "topic2", "topic3") + # package_type should usually be "library" (if there is shared option) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,11 +41,14 @@ class PackageConan(ConanFile): "with_foobar": True, } + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + # no exports_sources attribute, but export_sources(self) method instead # this allows finer grain exportation of patches per version def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -42,75 +56,106 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC # once removed by config_options, need try..except for a second del - except Exception: - pass - try: - del self.settings.compiler.libcxx # for plain C projects only - except Exception: - pass - try: - del self.settings.compiler.cppstd # for plain C projects only - except Exception: - pass + self.options.rm_safe("fPIC") + # for plain C projects only + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): - basic_layout(self, src_folder="src") # src_folder must use the same source folder name the project + # src_folder must use the same source folder name the project + basic_layout(self, src_folder="src") def requirements(self): - self.requires("dependency/0.8.1") # prefer self.requires method instead of requires attribute + # prefer self.requires method instead of requires attribute + self.requires("dependency/0.8.1") if self.options.with_foobar: self.requires("foobar/0.1.0") def validate(self): # validate the minimum cpp standard supported. Only for C++ projects - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - if self.info.settings.os not in ["Linux", "FreeBSD", "MacOS"]: - raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.info.settings.os}.") + if self.settings.os not in ["Linux", "FreeBSD", "MacOS"]: + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.settings.os}.") # if another tool than the compiler or autotools is required to build the project (pkgconf, bison, flex etc) def build_requirements(self): + # only if we have to call autoreconf self.tool_requires("libtool/x.y.z") - self.tool_requires("pkgconf/x.y.z") + # only if upstream configure.ac relies on PKG_CHECK_MODULES macro + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/x.y.z") + # required to suppport windows as a build machine + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + # for msvc support to get compile & ar-lib scripts (may be avoided if shipped in source code of the library) + # not needed if libtool already in build requirements + if is_msvc(self): + self.tool_requires("automake/x.y.z") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): - # autotools usually uses 'yes' and 'no' to enable/disable options - yes_no = lambda v: "yes" if v else "no" + # inject tool_requires env vars in build scope (not needed if there is no tool_requires) + env = VirtualBuildEnv(self) + env.generate() + # inject requires env vars in build scope + # it's required in case of native build when there is AutotoolsDeps & at least one dependency which might be shared, because configure tries to run a test executable + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") # --fpic is automatically managed when 'fPIC'option is declared # --enable/disable-shared is automatically managed when 'shared' option is declared tc = AutotoolsToolchain(self) - tc.configure_args.append("--with-foobar=%s" % yes_no(self.options.with_foobar)) - tc.configure_args.append("--enable-tools=no") - tc.configure_args.append("--enable-manpages=no") + # autotools usually uses 'yes' and 'no' to enable/disable options + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--with-foobar={yes_no(self.options.with_foobar)}", + "--enable-tools=no", + "--enable-manpages=no", + ]) tc.generate() - # generate dependencies for pkg-config + # generate pkg-config files of dependencies (useless if upstream configure.ac doesn't rely on PKG_CHECK_MODULES macro) tc = PkgConfigDeps(self) tc.generate() # generate dependencies for autotools tc = AutotoolsDeps(self) tc.generate() - # inject tools_require env vars in build context - ms = VirtualBuildEnv(self) - ms.generate(scope="build") + + # If Visual Studio is supported + if is_msvc(self): + env = Environment() + # get compile & ar-lib from automake (or eventually lib source code if available) + # it's not always required to wrap CC, CXX & AR with these scripts, it depends on how much love was put in + # upstream build files + automake_conf = self.dependencies.build["automake"].conf_info + compile_wrapper = unix_path(self, automake_conf.get("user.automake:compile-wrapper", check_type=str)) + ar_wrapper = unix_path(self, automake_conf.get("user.automake:lib-wrapper", check_type=str)) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + env.vars(self).save_script("conanbuild_msvc") def build(self): # apply patches listed in conandata.yml apply_conandata_patches(self) autotools = Autotools(self) - # run autoreconf to generate configure file + # (optional) run autoreconf to regenerate configure file (libtool should be in tool_requires) autotools.autoreconf() # ./configure + toolchain file autotools.configure() autotools.make() def package(self): - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) autotools = Autotools(self) autotools.install() @@ -119,6 +164,9 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "share")) + # In shared lib/executable files, autotools set install_name (macOS) to lib dir absolute path instead of @rpath, it's not relocatable, so fix it + fix_apple_shared_install_name(self) + def package_info(self): self.cpp_info.libs = ["package_lib"] @@ -127,6 +175,4 @@ def package_info(self): # If they are needed on Linux, m, pthread and dl are usually needed on FreeBSD too if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") - self.cpp_info.system_libs.append("pthread") - self.cpp_info.system_libs.append("dl") + self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) diff --git a/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt b/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt index dcb2919e20597..d5f12b4376cdb 100644 --- a/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt +++ b/docs/package_templates/autotools_package/all/test_package/CMakeLists.txt @@ -1,7 +1,6 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -# project(test_package CXX) # if the project uses c++ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) # if the project is pure C +# project(test_package LANGUAGES CXX) # if the project uses c++ find_package(package REQUIRED CONFIG) diff --git a/docs/package_templates/autotools_package/all/test_package/conanfile.py b/docs/package_templates/autotools_package/all/test_package/conanfile.py index 1111583fea732..48499fa0989d9 100644 --- a/docs/package_templates/autotools_package/all/test_package/conanfile.py +++ b/docs/package_templates/autotools_package/all/test_package/conanfile.py @@ -10,12 +10,12 @@ class TestPackageConan(ConanFile): generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) - def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt b/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt index 6298d7b9a123c..e4a742eca89e3 100644 --- a/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt +++ b/docs/package_templates/autotools_package/all/test_v1_package/CMakeLists.txt @@ -1,16 +1,11 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -# project(test_package CXX) # if the project uses c++ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) # if the project is pure C +# project(test_package LANGUAGES CXX) # if the project uses c++ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) find_package(package REQUIRED CONFIG) -# Re-use the same source file from test_package folder -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -# don't link to ${CONAN_LIBS} or CONAN_PKG::package -target_link_libraries(${PROJECT_NAME} PRIVATE package::package) -# in case the target project requires a C++ standard -# set_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/docs/package_templates/cmake_package/all/conandata.yml b/docs/package_templates/cmake_package/all/conandata.yml index 61b769f81b6fa..629a5640adc16 100644 --- a/docs/package_templates/cmake_package/all/conandata.yml +++ b/docs/package_templates/cmake_package/all/conandata.yml @@ -1,16 +1,14 @@ sources: # Newer versions at the top "1.2.0": - url: [ - "https://mirror1.net/package-1.2.0.tar.gz", - "https://mirror2.net/package-1.2.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.2.0.tar.gz" + - "https://mirror2.net/package-1.2.0.tar.gz" sha256: "________________________________________________________________" "1.1.0": - url: [ - "https://mirror1.net/package-1.1.0.tar.gz", - "https://mirror2.net/package-1.1.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.1.0.tar.gz" + - "https://mirror2.net/package-1.1.0.tar.gz" sha256: "________________________________________________________________" patches: # Newer versions at the top @@ -19,11 +17,7 @@ patches: patch_description: "correct the order of cmake min and project" patch_type: "backport" patch_source: "https://github.com/owner/package/pulls/42" - sha256: "________________________________________________________________" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-linux.patch" patch_description: "add missing header to support linux" patch_type: "portability" patch_source: "https://github.com/owner/package/issues/0" - sha256: "________________________________________________________________" - base_path: "source_subfolder" diff --git a/docs/package_templates/cmake_package/all/conanfile.py b/docs/package_templates/cmake_package/all/conanfile.py index ffec34ee46a8d..ee4c716b4e9d7 100644 --- a/docs/package_templates/cmake_package/all/conanfile.py +++ b/docs/package_templates/cmake_package/all/conanfile.py @@ -1,7 +1,7 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc_static_runtime, is_msvc -from conan.tools.files import apply_conandata_patches, get, copy, rm, rmdir, replace_in_file +from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file from conan.tools.build import check_min_cppstd from conan.tools.scm import Version from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout @@ -9,16 +9,23 @@ import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" + +# +# INFO: Please, remove all comments before pushing your PR! +# class PackageConan(ConanFile): name = "package" description = "short description" - license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # In case not listed there, use "LicenseRef-" + license = "" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/project/package" - topics = ("topic1", "topic2", "topic3") # no "conan" and project name in topics + # no "conan" and project name in topics. Use topics from the upstream listed on GH + topics = ("topic1", "topic2", "topic3") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,7 +37,7 @@ class PackageConan(ConanFile): } @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 17 # in case the project requires C++14/17/20/... the minimum compiler version should be listed @@ -38,7 +45,6 @@ def _minimum_cpp_standard(self): def _compilers_minimum_version(self): return { "gcc": "7", - "Visual Studio": "15.7", "clang": "7", "apple-clang": "10", } @@ -46,8 +52,7 @@ def _compilers_minimum_version(self): # no exports_sources attribute, but export_sources(self) method instead # this allows finer grain exportation of patches per version def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -55,34 +60,32 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC # once removed by config_options, need try..except for a second del - except Exception: - pass - try: - del self.settings.compiler.libcxx # for plain C projects only - except Exception: - pass - try: - del self.settings.compiler.cppstd # for plain C projects only - except Exception: - pass + self.options.rm_safe("fPIC") + # for plain C projects only + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): - cmake_layout(self, src_folder="src") # src_folder must use the same source folder name the project + # src_folder must use the same source folder name the project + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("dependency/0.8.1") # prefer self.requires method instead of requires attribute + # prefer self.requires method instead of requires attribute + self.requires("dependency/0.8.1") def validate(self): # validate the minimum cpp standard supported. For C++ projects only - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, self._minimum_cpp_standard) - minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) - if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) # in case it does not work in another configuration, it should validated here too - if is_msvc(self) and self.info.options.shared: + if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared on Visual Studio and msvc.") # if another tool than the compiler or CMake is required to build the project (pkgconf, bison, flex etc) @@ -90,20 +93,21 @@ def build_requirements(self): self.tool_requires("tool/x.y.z") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): # BUILD_SHARED_LIBS and POSITION_INDEPENDENT_CODE are automatically parsed when self.options.shared or self.options.fPIC exist tc = CMakeToolchain(self) # Boolean values are preferred instead of "ON"/"OFF" - tc.cache_variables["PACKAGE_CUSTOM_DEFINITION"] = True + tc.variables["PACKAGE_CUSTOM_DEFINITION"] = True if is_msvc(self): # don't use self.settings.compiler.runtime - tc.cache_variables.definitions["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) # deps_cpp_info, deps_env_info and deps_user_info are no longer used if self.dependencies["dependency"].options.foobar: - tc.cache_variables["DEPENDENCY_LIBPATH"] = self.dependencies["dependency"].cpp_info.libdirs + tc.variables["DEPENDENCY_LIBPATH"] = self.dependencies["dependency"].cpp_info.libdirs + # cache_variables should be used sparingly, example setting cmake policies + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() # In case there are dependencies listed on requirements, CMakeDeps should be used tc = CMakeDeps(self) @@ -116,16 +120,12 @@ def _patch_sources(self): apply_conandata_patches(self) # remove bundled xxhash rm(self, "whateer.*", os.path.join(self.source_folder, "lib")) - replace_in_file( - self, - os.path.join(self.source_folder, "CMakeLists.txt"), - "...", - "", - ) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "...", "") def build(self): - self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed + self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed cmake = CMake(self) + cmake.configure() cmake.build() def package(self): @@ -137,8 +137,8 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "share")) - rm(self, "*.pdb", self, os.path.join(self.package_folder, "lib")) - rm(self, "*.la", self, os.path.join(self.package_folder, "lib")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) def package_info(self): diff --git a/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt b/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt index 00e3c3ca60a6d..bf37e23371cba 100644 --- a/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt +++ b/docs/package_templates/cmake_package/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.8) project(test_package C) # if the project is pure C -project(test_package CXX) # if the project uses c++ +# project(test_package CXX) # if the project uses c++ find_package(package REQUIRED CONFIG) diff --git a/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt b/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt index e36cdfd024c40..925ecbe19e448 100644 --- a/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt +++ b/docs/package_templates/cmake_package/all/test_v1_package/CMakeLists.txt @@ -1,17 +1,8 @@ -cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -project(test_package CXX) # if the project uses c++ +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(package REQUIRED CONFIG) - -# Re-use the same source file from test_package folder -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -# don't link to ${CONAN_LIBS} or CONAN_PKG::package -target_link_libraries(${PROJECT_NAME} PRIVATE package::package) -# in case the target project requires a C++ standard -set_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) - +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/docs/package_templates/header_only/all/conandata.yml b/docs/package_templates/header_only/all/conandata.yml index 61b769f81b6fa..629a5640adc16 100644 --- a/docs/package_templates/header_only/all/conandata.yml +++ b/docs/package_templates/header_only/all/conandata.yml @@ -1,16 +1,14 @@ sources: # Newer versions at the top "1.2.0": - url: [ - "https://mirror1.net/package-1.2.0.tar.gz", - "https://mirror2.net/package-1.2.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.2.0.tar.gz" + - "https://mirror2.net/package-1.2.0.tar.gz" sha256: "________________________________________________________________" "1.1.0": - url: [ - "https://mirror1.net/package-1.1.0.tar.gz", - "https://mirror2.net/package-1.1.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.1.0.tar.gz" + - "https://mirror2.net/package-1.1.0.tar.gz" sha256: "________________________________________________________________" patches: # Newer versions at the top @@ -19,11 +17,7 @@ patches: patch_description: "correct the order of cmake min and project" patch_type: "backport" patch_source: "https://github.com/owner/package/pulls/42" - sha256: "________________________________________________________________" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-linux.patch" patch_description: "add missing header to support linux" patch_type: "portability" patch_source: "https://github.com/owner/package/issues/0" - sha256: "________________________________________________________________" - base_path: "source_subfolder" diff --git a/docs/package_templates/header_only/all/conanfile.py b/docs/package_templates/header_only/all/conanfile.py index 4d9370bad1f91..b268d9251b28e 100644 --- a/docs/package_templates/header_only/all/conanfile.py +++ b/docs/package_templates/header_only/all/conanfile.py @@ -1,30 +1,36 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, get, copy from conan.tools.build import check_min_cppstd -from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" class PackageConan(ConanFile): name = "package" description = "short description" - license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # In case it's not listed there, use "LicenseRef-" + license = "" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/project/package" - topics = ("topic1", "topic2", "topic3", "header-only") # no "conan" and project name in topics, keep 'header-only' - settings = "os", "arch", "compiler", "build_type" # even for header only - no_copy_source = True # do not copy sources to build folder for header only projects, unless, need to apply patches + # Do not put "conan" nor the project name in topics. Use topics from the upstream listed on GH + # Keep 'header-only' as topic + topics = ("topic1", "topic2", "topic3", "header-only") + # Keep these or explain why it's not required for this particular case + settings = "os", "arch", "compiler", "build_type" + # Do not copy sources to build folder for header only projects, unless you need to apply patches + no_copy_source = True @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 14 - # in case the project requires C++14/17/20/... the minimum compiler version should be listed + # In case the project requires C++14/17/20/... the minimum compiler version should be listed @property def _compilers_minimum_version(self): return { @@ -35,77 +41,78 @@ def _compilers_minimum_version(self): "apple-clang": "5.1", } - # no exports_sources attribute, but export_sources(self) method instead - # this allows finer grain exportation of patches per version + # Use the export_sources(self) method instead of the exports_sources attribute. + # This allows finer grain exportation of patches per version def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def layout(self): - # src_folder must use the same source folder name the project + # src_folder must use the same source folder name than the project basic_layout(self, src_folder="src") def requirements(self): - # prefer self.requires method instead of requires attribute - self.requires("dependency/0.8.1") + # Prefer self.requires method instead of requires attribute + # Direct dependencies of header only libs are always transitive since they are included in public headers + self.requires("dependency/0.8.1", transitive_headers=True) # same package ID for any package def package_id(self): self.info.clear() def validate(self): - # compiler subsettings are not available when building with self.info.clear() - if self.info.settings.get_safe("compiler.cppstd"): - # validate the minimum cpp standard supported when installing the package. For C++ projects only - check_min_cppstd(self, self._minimum_cpp_standard) - minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) - if minimum_version and Version(self.info.settings.get_safe("compiler.version")) < minimum_version: - raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") - # in case it does not work in another configuration, it should validated here too - if self.info.settings.os == "Windows": + if self.settings.compiler.get_safe("cppstd"): + # Validate the minimum cpp standard supported when installing the package. For C++ projects only + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + # In case this library does not work in some another configuration, it should be validated here too + if self.settings.os == "Windows": raise ConanInvalidConfiguration(f"{self.ref} can not be used on Windows.") - # if another tool than the compiler or CMake is required to build the project (pkgconf, bison, flex etc) - def build_requirements(self): - self.tool_requires("tool/x.y.z") - def source(self): - # download source package and extract to source folder - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + # Download source package and extract to source folder + get(self, **self.conan_data["sources"][self.version], strip_root=True) - # not mandatory when there is no patch, but will suppress warning message about missing build() method + # Not mandatory when there is no patch, but will suppress warning message about missing build() method def build(self): # The attribute no_copy_source should not be used when applying patches in build apply_conandata_patches(self) - # copy all files to the package folder + # Copy all files to the package folder def package(self): copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) def package_info(self): - # folders not used for header-only + # Folders not used for header-only self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] - # if package has an official FindPACKAGE.cmake listed in https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html#find-modules + # Set these to the appropriate values if the package has an official FindPACKAGE.cmake + # listed in https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html#find-modules # examples: bzip2, freetype, gdal, icu, libcurl, libjpeg, libpng, libtiff, openssl, sqlite3, zlib... self.cpp_info.set_property("cmake_module_file_name", "PACKAGE") self.cpp_info.set_property("cmake_module_target_name", "PACKAGE::PACKAGE") - # if package provides a CMake config file (package-config.cmake or packageConfig.cmake, with package::package target, usually installed in /lib/cmake//) + # Set these to the appropriate values if package provides a CMake config file + # (package-config.cmake or packageConfig.cmake, with package::package target, usually installed in /lib/cmake//) self.cpp_info.set_property("cmake_file_name", "package") self.cpp_info.set_property("cmake_target_name", "package::package") - # if package provides a pkgconfig file (package.pc, usually installed in /lib/pkgconfig/) + # Set this to the appropriate value if the package provides a pkgconfig file + # (package.pc, usually installed in /lib/pkgconfig/) self.cpp_info.set_property("pkg_config_name", "package") - # If they are needed on Linux, m, pthread and dl are usually needed on FreeBSD too + # Add m, pthread and dl if needed in Linux/FreeBSD if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") - self.cpp_info.system_libs.append("pthread") - self.cpp_info.system_libs.append("dl") + self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "PACKAGE" diff --git a/docs/package_templates/header_only/all/test_package/CMakeLists.txt b/docs/package_templates/header_only/all/test_package/CMakeLists.txt index d36b7fedf54ae..bf8eccb9b5b0a 100644 --- a/docs/package_templates/header_only/all/test_package/CMakeLists.txt +++ b/docs/package_templates/header_only/all/test_package/CMakeLists.txt @@ -1,7 +1,6 @@ cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -project(test_package CXX) # if the project uses c++ +project(test_package LANGUAGES C) # if the project is pure C +# project(test_package LANGUAGES CXX) # if the project uses c++ find_package(package REQUIRED CONFIG) diff --git a/docs/package_templates/header_only/all/test_package/conanfile.py b/docs/package_templates/header_only/all/test_package/conanfile.py index 1111583fea732..48499fa0989d9 100644 --- a/docs/package_templates/header_only/all/test_package/conanfile.py +++ b/docs/package_templates/header_only/all/test_package/conanfile.py @@ -10,12 +10,12 @@ class TestPackageConan(ConanFile): generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) - def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt b/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt index 40b3d97d7ddb2..0aeb3e1d92584 100644 --- a/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt +++ b/docs/package_templates/header_only/all/test_v1_package/CMakeLists.txt @@ -1,16 +1,9 @@ cmake_minimum_required(VERSION 3.8) - -project(test_package C) # if the project is pure C -project(test_package CXX) # if the project uses c++ +project(test_package LANGUAGES C) # if the project is pure C +project(test_package LANGUAGES CXX) # if the project uses c++ include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(package REQUIRED CONFIG) - -# Re-use the same source file from test_package folder -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -# don't link to ${CONAN_LIBS} or CONAN_PKG::package -target_link_libraries(${PROJECT_NAME} PRIVATE package::package) -# in case the target project requires a C++ standard -set_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/docs/package_templates/meson_package/all/conandata.yml b/docs/package_templates/meson_package/all/conandata.yml new file mode 100644 index 0000000000000..f73df4b4f1645 --- /dev/null +++ b/docs/package_templates/meson_package/all/conandata.yml @@ -0,0 +1,22 @@ +sources: + # Newer versions at the top + "1.2.0": + url: + - "https://mirror1.net/package-1.2.0.tar.gz", + - "https://mirror2.net/package-1.2.0.tar.gz", + sha256: "________________________________________________________________" + "1.1.0": + - "https://mirror1.net/package-1.1.0.tar.gz", + - "https://mirror2.net/package-1.1.0.tar.gz", + sha256: "________________________________________________________________" +patches: + # Newer versions at the top + "1.1.0": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "correct the order of cmake min and project" + patch_type: "backport" + patch_source: "https://github.com/owner/package/pulls/42" + - patch_file: "patches/0002-fix-linux.patch" + patch_description: "add missing header to support linux" + patch_type: "portability" + patch_source: "https://github.com/owner/package/issues/0" diff --git a/docs/package_templates/meson_package/all/conanfile.py b/docs/package_templates/meson_package/all/conanfile.py new file mode 100644 index 0000000000000..98f986361e929 --- /dev/null +++ b/docs/package_templates/meson_package/all/conanfile.py @@ -0,0 +1,153 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import check_min_cppstd +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.53.0" + +# +# INFO: Please, remove all comments before pushing your PR! +# + + +class PackageConan(ConanFile): + name = "package" + description = "short description" + # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # In case not listed there, use "LicenseRef-" + license = "" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/project/package" + # no "conan" and project name in topics. Use topics from the upstream listed on GH + topics = ("topic1", "topic2", "topic3") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + # in case the project requires C++14/17/20/... the minimum compiler version should be listed + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } + + # no exports_sources attribute, but export_sources(self) method instead + # this allows finer grain exportation of patches per version + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + # for plain C projects only + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + # src_folder must use the same source folder name the project + basic_layout(self, src_folder="src") + + def requirements(self): + # prefer self.requires method instead of requires attribute + self.requires("dependency/0.8.1") + + def validate(self): + # validate the minimum cpp standard supported. For C++ projects only + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + # in case it does not work in another configuration, it should validated here too + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared on Visual Studio and msvc.") + + # if another tool than the compiler or Meson is required to build the project (pkgconf, bison, flex etc) + def build_requirements(self): + # CCI policy assumes that Meson may not be installed on consumers machine + self.tool_requires("meson/0.63.3") + # pkgconf is largely used by Meson, it should be added in build requirement when there are dependencies + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + # default_library and b_staticpic are automatically parsed when self.options.shared and self.options.fpic exist + # buildtype is automatically parsed for self.settings + tc = MesonToolchain(self) + # In case need to pass definitions directly to the compiler + tc.preprocessor_definitions["MYDEFINE"] = "MYDEF_VALUE" + # Meson project options may vary their types + tc.project_options["tests"] = False + tc.generate() + # In case there are dependencies listed on requirements, PkgConfigDeps should be used + tc = PkgConfigDeps(self) + tc.generate() + # In case there are dependencies listed on build_requirements, VirtualBuildEnv should be used + tc = VirtualBuildEnv(self) + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # remove bundled xxhash + rm(self, "whateer.*", os.path.join(self.source_folder, "lib")) + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "...", "") + + def build(self): + self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + meson = Meson(self) + meson.install() + + # some files extensions and folders are not allowed. Please, read the FAQs to get informed. + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + # In shared lib/executable files, meson set install_name (macOS) to lib dir absolute path instead of @rpath, it's not relocatable, so fix it + fix_apple_shared_install_name(self) + + def package_info(self): + # avoid collect_libs(), prefer explicit library name instead + self.cpp_info.libs = ["package_lib"] + # if package provides a pkgconfig file (package.pc, usually installed in /lib/pkgconfig/) + self.cpp_info.set_property("pkg_config_name", "package") + # If they are needed on Linux, m, pthread and dl are usually needed on FreeBSD too + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) diff --git a/docs/package_templates/meson_package/all/test_package/conanfile.py b/docs/package_templates/meson_package/all/test_package/conanfile.py new file mode 100644 index 0000000000000..287ce44d8a78e --- /dev/null +++ b/docs/package_templates/meson_package/all/test_package/conanfile.py @@ -0,0 +1,33 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "PkgConfigDeps", "MesonToolchain", "VirtualRunEnv", "VirtualBuildEnv" + test_type = "explicit" + + def layout(self): + basic_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.tool_requires("meson/0.63.3") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + + def build(self): + meson = Meson(self) + meson.configure() + meson.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/docs/package_templates/meson_package/all/test_package/meson.build b/docs/package_templates/meson_package/all/test_package/meson.build new file mode 100644 index 0000000000000..481f6cfd116c1 --- /dev/null +++ b/docs/package_templates/meson_package/all/test_package/meson.build @@ -0,0 +1,5 @@ +project('test_package', 'cpp') +package_dep = dependency('package') +executable('test_package', + sources : ['test_package.cpp'], + dependencies : [package_dep]) diff --git a/docs/package_templates/meson_package/all/test_package/test_package.cpp b/docs/package_templates/meson_package/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..315875d954777 --- /dev/null +++ b/docs/package_templates/meson_package/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#include +#include +#include "package/foobar.hpp" + + +int main(void) { + /* + * Create a minimal usage for the target project here. + * Avoid big examples, bigger than 100 lines. + * Avoid networking connections. + * Avoid background apps or servers. + * The propose is testing the generated artifacts only. + */ + + foobar.print_version(); + + return EXIT_SUCCESS; +} diff --git a/docs/package_templates/meson_package/all/test_v1_package/conanfile.py b/docs/package_templates/meson_package/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c5b074313827d --- /dev/null +++ b/docs/package_templates/meson_package/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +from conans import ConanFile, Meson +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "pkg_config" + + def build_requirements(self): + self.build_requires("meson/0.63.3") + self.build_requires("pkgconf/1.9.3") + + def build(self): + meson = Meson(self) + meson.configure(build_folder="bin", source_folder="../test_package") + meson.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/docs/package_templates/meson_package/config.yml b/docs/package_templates/meson_package/config.yml new file mode 100644 index 0000000000000..a885cbf942a74 --- /dev/null +++ b/docs/package_templates/meson_package/config.yml @@ -0,0 +1,6 @@ +versions: + # Newer versions at the top + "1.2.0": + folder: all + "1.1.0": + folder: all diff --git a/docs/package_templates/msbuild_package/all/conandata.yml b/docs/package_templates/msbuild_package/all/conandata.yml index 61b769f81b6fa..629a5640adc16 100644 --- a/docs/package_templates/msbuild_package/all/conandata.yml +++ b/docs/package_templates/msbuild_package/all/conandata.yml @@ -1,16 +1,14 @@ sources: # Newer versions at the top "1.2.0": - url: [ - "https://mirror1.net/package-1.2.0.tar.gz", - "https://mirror2.net/package-1.2.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.2.0.tar.gz" + - "https://mirror2.net/package-1.2.0.tar.gz" sha256: "________________________________________________________________" "1.1.0": - url: [ - "https://mirror1.net/package-1.1.0.tar.gz", - "https://mirror2.net/package-1.1.0.tar.gz", - ] + url: + - "https://mirror1.net/package-1.1.0.tar.gz" + - "https://mirror2.net/package-1.1.0.tar.gz" sha256: "________________________________________________________________" patches: # Newer versions at the top @@ -19,11 +17,7 @@ patches: patch_description: "correct the order of cmake min and project" patch_type: "backport" patch_source: "https://github.com/owner/package/pulls/42" - sha256: "________________________________________________________________" - base_path: "source_subfolder" - patch_file: "patches/0002-fix-linux.patch" patch_description: "add missing header to support linux" patch_type: "portability" patch_source: "https://github.com/owner/package/issues/0" - sha256: "________________________________________________________________" - base_path: "source_subfolder" diff --git a/docs/package_templates/msbuild_package/all/conanfile.py b/docs/package_templates/msbuild_package/all/conanfile.py index 42c754733c1a9..332dbfb867b37 100644 --- a/docs/package_templates/msbuild_package/all/conanfile.py +++ b/docs/package_templates/msbuild_package/all/conanfile.py @@ -1,21 +1,24 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc, MSBuildDeps, MSBuildToolchain, MSBuild, VCVars -from conan.tools.layout import vs_layout -from conan.tools.files import apply_conandata_patches, get, copy, rm, replace_in_file +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildDeps, MSBuildToolchain import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class PackageConan(ConanFile): name = "package" description = "short description" - license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + # In case not listed there, use "LicenseRef-" + license = "" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/project/package" - topics = ("topic1", "topic2", "topic3") # no "conan" and project name in topics + # no "conan" and project name in topics. Use topics from the upstream listed on GH + topics = ("topic1", "topic2", "topic3") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,8 +32,7 @@ class PackageConan(ConanFile): # no exports_sources attribute, but export_sources(self) method instead # this allows finer grain exportation of patches per version def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,24 +40,17 @@ def config_options(self): def configure(self): if self.options.shared: - try: - del self.options.fPIC # once removed by config_options, need try..except for a second del - except Exception: - pass - try: - del self.settings.compiler.libcxx # for plain C projects only - except Exception: - pass - try: - del self.settings.compiler.cppstd # for plain C projects only - except Exception: - pass + self.options.rm_safe("fPIC") + # for plain C projects only + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): - vs_layout(self, src_folder="src") # src_folder must use the same source folder name the project + basic_layout(self, src_folder="src") def requirements(self): - self.requires("dependency/0.8.1") # prefer self.requires method instead of requires attribute + # prefer self.requires method instead of requires attribute + self.requires("dependency/0.8.1") def validate(self): # in case it does not work in another configuration, it should validated here too @@ -67,43 +62,71 @@ def build_requirements(self): self.tool_requires("tool/x.y.z") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + @property + def _msbuild_configuration(self): + # Customize to Release when RelWithDebInfo or MinSizeRel, if upstream build files + # don't have RelWithDebInfo and MinSizeRel. + # Moreover: + # - you may have to change these values if upstream build file uses custom configuration names. + # - configuration of MSBuildToolchain/MSBuildDeps & build_type of MSBuild may have to be different. + # Its unusual, but it happens when there is a preSolution/postSolution mapping with different names. + # * build_type attribute of MSBuild should match preSolution + # * configuration attribute of MSBuildToolchain/MSBuildDeps should match postSolution + return "Debug" if self.settings.build_type == "Debug" else "Release" def generate(self): tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration tc.generate() - tc = MSBuildDeps(self) - tc.generate() - tc = VCVars(self) - tc.generate() + + # If there are requirements + deps = MSBuildDeps(self) + deps.configuration = self._msbuild_configuration + deps.generate() def _patch_sources(self): apply_conandata_patches(self) # remove bundled xxhash rm(self, "whateer.*", os.path.join(self.source_folder, "lib")) - replace_in_file( - self, - os.path.join(self.source_folder, "CMakeLists.txt"), - "...", - "", - ) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "...", "") + + # Allows to inject platform toolset, and props file generated by MSBuildToolchain & MSBuildDeps + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + vcxproj_files = ["path/to/vcxproj_file1", "path/to/vcxproj_file2", "..."] + platform_toolset = MSBuildToolchain(self).toolset + import_conan_generators = "" + for props_file in ["conantoolchain.props", "conandeps.props"]: + props_path = os.path.join(self.generators_folder, props_file) + if os.path.exists(props_path): + import_conan_generators += f"" + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + # change this v142 value depending on actual value in vcxproj file + "v142", + f"{platform_toolset}", + ) + if props_path: + replace_in_file( + self, vcxproj_file, + "", + f"{import_conan_generators}", + ) def build(self): - self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed + self._patch_sources() # It can be apply_conandata_patches(self) only in case no more patches are needed msbuild = MSBuild(self) - # customize to Release when RelWithDebInfo - msbuild.build_type = "Debug" if self.settings.build_type == "Debug" else "Release" - # use Win32 instead of the default value when building x86 - msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build_type = self._msbuild_configuration # customize according the solution file and compiler version msbuild.build(sln="project_2017.sln") def package(self): - copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) - copy(self, pattern="*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder, keep_path=False) - copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.libs = ["package_lib"] diff --git a/docs/package_templates/msbuild_package/all/test_v1_package/CMakeLists.txt b/docs/package_templates/msbuild_package/all/test_v1_package/CMakeLists.txt index 6b0a261eddbcc..983c9e84f7828 100644 --- a/docs/package_templates/msbuild_package/all/test_v1_package/CMakeLists.txt +++ b/docs/package_templates/msbuild_package/all/test_v1_package/CMakeLists.txt @@ -8,9 +8,5 @@ conan_basic_setup(TARGETS) find_package(package REQUIRED CONFIG) -# Re-use the same source file from test_package folder -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -# don't link to ${CONAN_LIBS} or CONAN_PKG::package -target_link_libraries(${PROJECT_NAME} PRIVATE package::package) -# in case the target project requires a C++ standard -set_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/docs/package_templates/prebuilt_tool_package/all/conanfile.py b/docs/package_templates/prebuilt_tool_package/all/conanfile.py index b4b3859fcb0c8..f632b6094174c 100644 --- a/docs/package_templates/prebuilt_tool_package/all/conanfile.py +++ b/docs/package_templates/prebuilt_tool_package/all/conanfile.py @@ -11,11 +11,12 @@ class PackageConan(ConanFile): name = "package" description = "short description" - license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ + license = "" # Use short name only, conform to SPDX License List: https://spdx.org/licenses/ url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/project/package" - topics = ("topic1", "topic2", "topic3", "pre-built") # no "conan" and project name in topics. Use "pre-built" for tooling packages - settings = "os", "arch", "compiler", "build_type" # even for pre-built executables + # no "conan" and project name in topics. Use "pre-built" for tooling packages + topics = ("topic1", "topic2", "topic3", "pre-built") + settings = "os", "arch", "compiler", "build_type" # even for pre-built executables # not needed but supress warning message from conan commands def layout(self): @@ -28,7 +29,7 @@ def package_id(self): # in case some configuration is not supported def validate(self): - if self.info.settings.os == "Macos" and Version(self.info.settings.os.version) < 11: + if self.settings.os == "Macos" and Version(self.settings.os.version) < 11: raise ConanInvalidConfiguration(f"{self.ref} requires OSX >=11.") # do not cache as source, instead, use build folder @@ -37,8 +38,11 @@ def source(self): # download the source here, than copy to package folder def build(self): - get(self, **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)], - destination=self.source_folder, strip_root=True) + get( + self, + **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)], + strip_root=True, + ) # copy all needed files to the package folder def package(self): @@ -54,10 +58,6 @@ def package_info(self): self.cpp_info.resdirs = [] self.cpp_info.includedirs = [] - bin_folder = os.path.join(self.package_folder, "bin") - # In case need to find packaged tools when building a package - self.buildenv_info.append("PATH", bin_folder) - # In case need to find packaged tools at runtime - self.runenv_info.append("PATH", bin_folder) # TODO: Legacy, to be removed on Conan 2.0 + bin_folder = os.path.join(self.package_folder, "bin") self.env_info.PATH.append(bin_folder) diff --git a/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py b/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py index b84c922d41cb0..b3a58664b7d6b 100644 --- a/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py +++ b/docs/package_templates/prebuilt_tool_package/all/test_package/conanfile.py @@ -5,14 +5,11 @@ # It will become the standard on Conan 2.x class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "VirtualRunEnv" + generators = "VirtualBuildEnv" test_type = "explicit" def build_requirements(self): - self.tools_requires(self.tested_reference_str) + self.tool_requires(self.tested_reference_str) def test(self): - if can_run(self): - # self.run checks the command exit code - # the tool must be available on PATH - self.run("tool --version", env="conanrun") + self.run("tool --version") diff --git a/docs/packaging_policy.md b/docs/packaging_policy.md deleted file mode 100644 index 4eb95d041e21c..0000000000000 --- a/docs/packaging_policy.md +++ /dev/null @@ -1,143 +0,0 @@ -# Packaging Policy - -This document gathers all the relevant information regarding the general lines to follow while creating new recipes that will eventually be part of this repository. - - -## Contents - - * [Sources](#sources) - * [Dependencies](#dependencies) - * [Build](#build) - * [Package](#package) - * [Settings](#settings) - * [Options](#options) - -## Sources - -**Origin of sources:** - -* Library sources should come from an official origin like the library source code repository or the official -release/download webpage. - -* If an official source archive is available, it should be preferred over an auto-generated archive. - -**Source immutability:** Downloaded source code stored under `source` folder should not be modified. Any patch should be applied to the copy of this source code when a build is executed (basically in `build()` method). - -**Building from sources:** Recipes should always build packages from library sources. - -**Sources not accessible:** - -* Library sources that are not publicly available will not be allowed in this repository even if the license allows their redistribution. - -* If library sources cannot be downloaded from their official origin or cannot be consumed directly due to their - format, the recommendation is to contact the publisher and ask them to provide the sources in a way/format that can be consumed - programmatically. - -* In case of needing those binaries to use them as a "build require" for some library, we will consider following the approach of adding it - as a system recipe (`/system`) and making those binaries available in the CI machines (if the license allows it). - -## Dependencies - -* Version range is not allowed. - -* Specify explicit RREV (recipe revision) of dependencies is not allowed. - -* Vendoring in library source code should be removed (best effort) to avoid potential ODR violations. If upstream takes care to rename symbols, it may be acceptable. - -* Only other conan-center recipes are allowed in `requires`/`requirements()` and `build_requires`/`build_requirements()` of a conan-center recipe. - -* If a requirement is conditional, this condition must not depend on build context. Build requirements don't have this constraint. - -* Forcing options of dependencies inside a conan-center recipe should be avoided, except if it is mandatory for the library. - -## Build - -* `build()` method should focus on build only, not installation. During the build, nothing should be written in `package` folder. Installation step should only occur in `package()` method. - -* The build itself should only rely on local files. Nothing should be downloaded from internet during this step. If external files are required, they should come from `requirements` or `build_requirements`, in addition to source files downloaded in `source()` or coming from recipe itself. - -* Except CMake and a working build toolchain (compiler, linker, archiver etc), the recipe should not assume that any other build tool is installed on user build machine (like Meson, autotools or pkg-config). On Windows, recipe should not assume that a shell is available (like MSYS2). Therefore, if the buid requires additional build tools, they should be added to `build_requirements()`. - -* It is forbidden to run other conan client commands during build. In other words, if upstream build files call conan under the hood (through `cmake-conan` for example or any other logic), this logic must be neutralized. - -* Settings from profile should be honored (`build_type`, `compiler.libcxx`, `compiler.cppstd`, `compiler.runtime` etc). - -* These env vars from profile should be honored and properly propagated to underlying build system during the build: `CC`, `CXX`, `CFLAGS`, `CXXFLAGS`, `LDFLAGS`. - -## Package - -* CMake config files must be removed (they will be generated for consumers by `cmake_find_package`, `cmake_find_package_multi` or `CMakeDeps` generators). - -* pkg-config files must be removed (they will be generated for consumers by `pkg_config` or `PkgConfigDeps` generators). - -* On *nix systems, executables and shared libraries should have empty `RPATH`/`RUNPATH`/`LC_RPATH`. - -* On macOS, install name in `LC_ID_DYLIB` section of shared libs must be `@rpath/`. - -* Installed files must not contain absolute paths specific to build machine. Relative paths to other packages is also forbidden since relative paths of dependencies during build may not be the same for consumers. Hardcoded relative paths pointing to a location in the package itself are allowed. - -## Settings - -All recipes should list the four settings `os`, `arch`, `compiler` and `build_type` so Conan will compute a different package ID -for each combination. There are some particular cases for this general rule: - -* **Recipes for _header only_ libraries** might omit the `settings` attibute, but in any case they should add - - ```python - def package_id(self): - self.info.header_only() - ``` - -* **Recipes that provide applications** (`b2`, `cmake`, `make`,...) that are generally used as a _build requires_, must list all - the settings as well, but they should remove the `compiler` one in the corresponding method unless the recipe provides also - libraries that are consumed by other packages: - - ```python - def package_id(self): - del self.info.settings.compiler - ``` - - Removing the `compiler` setting reduces the number of configurations generated by the CI, reducing the time and workload and, at the - same time, demonstrates the power of Conan behind the package ID logic. - - > Note.- Intentionally, the `build_type` setting should not be removed from the package ID in this case. Preserving this - > setting will ensure that the package ID for Debug and Release configurations will be different and both binaries can be - > available in the Conan cache at the same time. This enable consumers to switch from one configuration to the other in the case - > they want to run or to debug those executables. - -## Options - -Recipes can list any number of options with any meaning, and defaults are up to the recipe itself. The CI cannot enforce anything -in this direction. However, there are a couple of options that have a special meaning for the CI: - -* `shared` (with values `True` or `False`). The CI inspects the recipe looking for this option. If it is found, it will - generate all the configurations with values `shared=True` and `shared=False`. - - > Note.- The CI applies `shared=True` only to the package being built, while every other requirement will use their defaults - > (typically `shared=False`). It's important to keep this in mind when trying to consume shared packages from ConanCenter - > as their requirements were linked inside the shared library. See [FAQs](faqs.md#how-to-consume-a-graph-of-shared-libraries) for more information. - -* `header_only` (with values `True` or `False`). If the CI detects this option, it will generate all the configurations for the - value `header_only=False` and add one more configuration with `header_only=True`. **Only one - package** will be generated for `header_only=True`, so it is crucial that the package is actually a _header only_ library, with header files only (no libraries or executables inside). - - Recipes with such option should include the following in their `package_id` method - - ```python - def package_id(self): - if self.options.header_only: - self.info.header_only() - ``` - - ensuring that, when the option is active, the recipe ignores all the settings and only one package ID is generated. - -* `build_testing` should not be added, nor any other related unit test option. Options affect the package ID, therefore, testing should not be part of that. - Instead, use Conan config [skip_test](https://docs.conan.io/en/latest/reference/config_files/global_conf.html#tools-configurations) feature: - - ```python - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions['BUILD_TESTING'] = not self.conf.get("tools.build:skip_test", default=true, check_type=bool) - ``` - - The `skip_test` configuration is supported by [CMake](https://docs.conan.io/en/latest/reference/build_helpers/cmake.html#test) and [Meson](https://docs.conan.io/en/latest/reference/build_helpers/meson.html#test). diff --git a/docs/policy_patching.md b/docs/policy_patching.md deleted file mode 100644 index 0d876f9a11656..0000000000000 --- a/docs/policy_patching.md +++ /dev/null @@ -1,81 +0,0 @@ -# Policy about patching - -The main guideline in ConanCenter is to provide already compiled binaries -for a set of architectures in the least surprising way as possible, so Conan -can be plugged into existing projects trying to minimize the modifications -needed. Packages from Conan Center should fulfill the expectations of anyone -reading the changelog of the library, the documentation, or any statement by -the library maintainers. - - - -## Contents - - * [Rules](#rules) - * [Exceptions](#exceptions) - * [Patches: format and conventions](#patches-format-and-conventions) - -## Rules - -These are the rules that apply to regular version of Conan packages: - -**Build system patches.-** In order to add libraries into ConanCenter sometimes -it is NEEDED to apply patches so they can consume existing packages -for requirements and binaries can be generated. These patches are totally -needed for the purpose of ConanCenter and Conan keeps adding features trying -to minimize these changes. - -**Source patches.-** ConanCenter DOES NOT accept patches **backporting bugfixes or -features** from upcoming releases, they break the principle of minimum surprise, -they change the behavior of the library and it will no longer match the -documentation or the changelog originally delivered by the authors. - -However, ConanCenter DOES accept **working software patches**, these patches -are needed to generate the binaries for architectures not considered by -library maintainers, or to use some compilers or configurations. These patches -make it possible to generate binaries that cannot be generated otherwise, or -they can turn a crashing binary into a working software one (bugs, errors, or -faults are considered working software as long as they produce deterministic -results). - -Patches to sources to add support to newer versions of dependencies are -considered feature patches and they are not allowed either. They can -introduce new behaviors or bugs not considered when delivering the -library by maintainers. If a requirement is known not to work, the recipe -should raise a `ConanInvalidConfiguration` from the `validate()` method. - -**Vulnerability patches.-** Patches published to CVE databases or declared as -vulnerabilities by the authors in non-mainstream libraries WILL be applied -to packages generated in Conan Center. - -**Official release patches.-** If the library documents that a patch should be -applied to sources when building a tag/release from sources, ConanCenter WILL -apply that patch too. This is needed to match the documented behavior or the -binaries of that library offered by other means. [Example here](https://www.boost.org/users/history/version_1_73_0.html). - - -## Exceptions - -Exceptionally, we might find libraries that aren't actively developed and consumers -might benefit from having some bugfixes applied to previous versions while -waiting for the next release, or because the library is no longer maintained. These -are the rules for this exceptional scenario: - * **new release**, based on some official release and clearly identifiable will - be create to apply these patches to: PLACEHOLDER_FOR_RELEASE_FORMAT. - * **only patches backporting bugfixes** will be accepted after they have - been submitted to the upstream and there is a consensus that it's a bug and the patch is the solution. - -ConanCenter will build this patched release and serve its binaries like it does with -any other Conan reference. - -Notice that these PLACEHOLDER_FOR_RELEASE_FORMAT releases are unique to ConanCenter -and they can get new patches or discard existing ones according to upstream -considerations. It means that these releases will modify its behavior without previous -notice, the documentation or changelog for these specific releases won't exist. Use -them carefully in your projects. - -## Patches: format and conventions - -Patches are preferred over `replace_in_file` statement. Patches should always include -a link to the origin where it's taken from (it doesn't apply to build system patches). -They will be listed in `conandata.yml` file and exported together with the recipe. diff --git a/docs/review_process.md b/docs/review_process.md index d746d332e894d..55eadf1bd0738 100644 --- a/docs/review_process.md +++ b/docs/review_process.md @@ -13,8 +13,6 @@ conan-center-index tries to make the process as smooth and simple as possible fo * [Avoiding conflicts](#avoiding-conflicts) * [Draft](#draft) * [Getting your pull request reviewed](#getting-your-pull-request-reviewed) - * [Official reviewers](#official-reviewers) - * [Community reviewers](#community-reviewers) * [Rule of 2 reviews](#rule-of-2-reviews) * [Reviews from others](#reviews-from-others) * [Addressing review comments](#addressing-review-comments) @@ -51,13 +49,8 @@ If you struggle to fix build errors yourself, you may want to ask for help from ### Unexpected error Sometimes, build fails with `Unexpected error` message. This indicates an infrastructure problem, and usually it's unrelated to the changes within PR itself. -Keep in mind conan-center-index is still *under development*, and there can be some instabilities. Especially, as we're using lots of external services, -which might be inaccessible (GitHub API, docker hub, etc.) and may result in intermittent failures. -So, what to do once `Unexpected error` was encountered? You may consider re-running the build by closing your pull request, waiting 15 seconds, and then re-opening it again. -Sometimes it's necessary to restart the build several times. -If an `Unexpected error` persists, tag [@jgsogo](https://github.com/jgsogo) and [@danimtb](https://github.com/danimtb) asking for the help with CI. -Alternatively, just [open a new issue](https://github.com/conan-io/conan-center-index/issues/new/choose). +To learn more, checkout the [label definition](labels.md#unexpected-error). ## Avoiding conflicts @@ -72,43 +65,17 @@ Once you're done with your changes, remember to convert from "Draft" to "Normal" ## Getting your pull request reviewed -Each PR must be reviewed by several reviewers before it will be merged. It cannot be just reviews from random people, we have two categories of reviewers: +Each PR must be reviewed by several reviewers before it will be merged. It cannot be just reviews from anyone, we have two categories of reviewers: -### Official reviewers +- Official reviewers: these are active team members who are responsible for developing Conan, ConanCenter, and ConanCenterIndex. +- Community reviewers: this list includes former Conan team members and ConanCenterIndex contributors who are very active and proven to be trusted - they frequently submit pull requests and provide their own useful reviews -The list includes only official Conan developers: - -- [@memsharded](https://github.com/memsharded) -- [@lasote](https://github.com/lasote) -- [@danimtb](https://github.com/danimtb) -- [@jgsogo](https://github.com/jgsogo) -- [@czoido](https://github.com/czoido) -- [@sse4](https://github.com/sse4) -- [@uilianries](https://github.com/uilianries) - -### Community reviewers - -The list includes conan-center-index contributors who are very active and proven to be trusted - they frequently submit pull requests and provide their own useful reviews: - -- [@madebr](https://github.com/madebr) -- [@SpaceIm](https://github.com/SpaceIm) -- [@ericLemanissier](https://github.com/ericLemanissier) -- [@prince-chrismc](https://github.com/prince-chrismc) -- [@Croydon](https://github.com/Croydon) -- [@intelligide](https://github.com/intelligide) -- [@theirix](https://github.com/theirix) -- [@gocarlos](https://github.com/gocarlos) -- [@mathbunnyru](https://github.com/mathbunnyru) -- [@ericriff](https://github.com/ericriff) -- [@toge](https://github.com/toge) -- [@AndreyMlashkin](https://github.com/AndreyMlashkin) -- [@MartinDelille](https://github.com/MartinDelille) -- [@dmn-star](https://github.com/dmn-star) - -The list, located [here](../.c3i/reviewers.yml), +The list or reviewers, located [here](../.c3i/reviewers.yml), is not constant and will change periodically based on contribution. That also means **you can be included in this list** as well - submit PRs and provide reviews, and in time you may be added as a trusted contributor. +> **Note**: GitHubs user interface does not support such custom rules so you should not rely solely on the message it provides. + ### Rule of 2 reviews At least 2 approving reviews are required, and at least one of them has to be from the official reviewers. @@ -134,7 +101,7 @@ The bot runs Automatic Merges every 20 minutes. Currently, it can only merge a s PR is selected for the merge only if: - Author is already [approved](https://github.com/conan-io/conan-center-index/issues/4). -- Author has signed CLA. +- Author has signed the [CLA](CONTRIBUTOR_LICENSE_AGREEMENT.md). - PR is not a Draft. - PR has a green status (successful build). - PR doesn't have merge conflicts with `master` branch. diff --git a/docs/reviewing.md b/docs/reviewing.md deleted file mode 100644 index f42f88d67438b..0000000000000 --- a/docs/reviewing.md +++ /dev/null @@ -1,234 +0,0 @@ -# Reviewing policies - -The following policies are preferred during the review, but not mandatory: - - -## Contents - - * [Trailing white-spaces](#trailing-white-spaces) - * [Quotes](#quotes) - * [Subfolder Properties](#subfolder-properties) - * [Order of methods and attributes](#order-of-methods-and-attributes) - * [License Attribute](#license-attribute) - * [Exporting Patches](#exporting-patches) - * [Applying Patches](#applying-patches) - * [CMake](#cmake) - * [Caching Helper](#caching-helper) - * [Build Folder](#build-folder) - * [CMake Configure Method](#cmake-configure-method) - * [Test Package](#test-package) - * [Minimalistic Source Code](#minimalistic-source-code) - * [CMake targets](#cmake-targets) - * [Recommended feature options names](#recommended-feature-options-names) - * [Supported Versions](#supported-versions) - * [Removing old versions](#removing-old-versions) - * [Adding old versions](#adding-old-versions) - -## Trailing white-spaces - -Avoid trailing white-space characters, if possible - -## Quotes - -If possible, try to avoid mixing single quotes (`'`) and double quotes (`"`) in python code (`conanfile.py`, `test_package/conanfile.py`). Consistency is preferred. - -## Subfolder Properties - -When extracting sources or performing out-of-source builds, it is preferable to use a _subfolder_ attribute, `_source_subfolder` and `_build_subfolder` respectively. - -For example doing this with property attributes for these variables: - -```py -@property -def _source_subfolder(self): - return "source_subfolder" - -@property -def _build_subfolder(self): - return "build_subfolder" -``` - -## Order of methods and attributes - -Prefer the following order of documented methods in python code (`conanfile.py`, `test_package/conanfile.py`): - -- init -- set_name -- set_version -- export -- export_sources -- config_options -- configure -- layout -- requirements -- package_id -- validate -- build_id -- build_requirements -- system_requirements -- source -- generate -- imports -- build -- package -- package_info -- deploy -- test - -the order above resembles the execution order of methods on CI. therefore, for instance, `build` is always executed before `package` method, so `build` should appear before the -`package` in `conanfile.py`. - -## License Attribute - -The mandatory license attribute of each recipe **should** be a [SPDX license](https://spdx.org/licenses/) [short Identifiers](https://spdx.dev/ids/) when applicable. - -Where the SPDX guidelines do not apply, packages should do the following: - -- When no license is provided or when it's given to the "public domain", the value should be set to [Unlicense](https://spdx.org/licenses/Unlicense) as per [KB-H056](error_knowledge_base.md#kb-h056-license-public-domain) and [FAQ](faqs.md#what-license-should-i-use-for-public-domain). -- When a custom (e.g. project specific) license is given, the value should be set to `LicenseRef-` as a prefix, followed by the name of the file which contains a custom license. See [this example](https://github.com/conan-io/conan-center-index/blob/e604534bbe0ef56bdb1f8513b83404eff02aebc8/recipes/fft/all/conanfile.py#L8). For more details, [read this conversation](https://github.com/conan-io/conan-center-index/pull/4928/files#r596216206) - -## Exporting Patches - -It's ideal to minimize the number of files in a package the exactly whats required. When recipes support multiple versions with differing patches it's strongly encourged to only export the patches that are being used for that given recipe. - -Make sure the `export_sources` attribute is replaced by the following: - -```py -def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) -``` - -## Applying Patches - -Patches can be applied in a different protected method, the pattern name is `_patch_sources`. When applying patch files, `tools.patch` is the best option. -For simple cases, `tools.replace_in_file` is allowed. - -```py -def _patch_sources(self): - files.apply_conandata_patches(self) - # remove bundled xxhash - tools.remove_files_by_mask(os.path.join(self._source_subfolder, "lib"), "whateer.*") - tools.replace_in_file(os.path.join(self._cmakelists_subfolder, "CMakeLists.txt"), "...", "") -``` - -## CMake - -When working with CMake based upstream projects it is prefered to follow these principals. They are not applicable to all projects so they can not be enforced. - -### Caching Helper - -Due to build times and the lenght to configure CMake multiple times, there is a strong motivation to cache the `CMake` build helper from Conan between the `build()` and `package()` methods. - -This can be done by adding a `_cmake` attribute to the `ConanFile` class, but consider it as outdated. The current option is using `@functools.lru_cache(1)` decorator. -As example, take a look on [miniz](https://github.com/conan-io/conan-center-index/blob/16780f87ad3db3be81323ddafc668145e4348513/recipes/miniz/all/conanfile.py#L57) recipe. - -### Build Folder - -Ideally use out-of-source builds by calling `cmake.configure(build_folder=self._build_subfolder)` when ever possible. - -### CMake Configure Method - -Use a seperate method to handle the common patterns with using CMake based projects. This method is `_configure_cmake` and looks like the follow in the most basic cases: - -```py -@functools.lru_cache(1) -def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_STATIC"] = not self.options.shared - cmake.configure(build_folder=self._build_subfolder) - return cmake -``` - -## Test Package - -### Minimalistic Source Code - -The contents of `test_package.c` or `test_package.cpp` should be as minimal as possible, including a few headers at most with simple -instantiation of objects to ensure linkage and dependencies are correct. Any build system can be used to test the package, but -CMake or Meson are usually preferred. - -### CMake targets - -When using CMake to test a package, the information should be consumed using the **targets provided by `cmake_find_package_multi` generator**. We -enforce this generator to align with the upcoming -[Conan's new `CMakeDeps` generator](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmakedeps.html?highlight=cmakedeps) -and it should help in the migration (and compatibility) with Conan v2. - -In ConanCenter we try to mimic the names of the targets and the information provided by CMake's modules and config files that some libraries -provide. If CMake or the library itself don't enforce any target name, the ones provided by Conan should be recommended. The minimal project -in the `test_package` folder should serve as an example of the best way to consume the package, and targets are preferred over raw variables. - -This rule applies for the _global_ target and for components ones. The following snippet should serve as example: - -**CMakeLists.txt** -```cmake -cmake_minimum_required(VERSION 3.1.2) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(package REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} package::package) -``` - -We encourage contributors to check that not only the _global_ target works properly, but also the ones for the components. It can be -done creating and linking different libraries and/or executables. - -## Recommended feature options names - -It's often needed to add options to toggle specific library features on/off. Regardless of the default, there is a strong preference for using positive naming for options. In order to avoid the fragmentation, we recommend to use the following naming conventions for such options: - -- enable_ / disable_ -- with_ / without_ -- use_ - -the actual recipe code then may look like: - -```py - options = {"use_tzdb": [True, False]} - default_options = {"use_tzdb": True} -``` - -```py - options = {"enable_locales": [True, False]} - default_options = {"enable_locales": True} -``` - -```py - options = {"with_zlib": [True, False]} - default_options = {"with_zlib": True} -``` - -having the same naming conventions for the options may help consumers, e.g. they will be able to specify options with wildcards: `-o *:with_threads=True`, therefore, `with_threads` options will be enabled for all packages in the graph that support it. - -## Supported Versions - -In this repository we are building a subset of all the versions for a given library. This set of version changes over time as new versions -are released and old ones stop to be used. - -We always welcome latest releases as soon as they are available, and from time to time we remove old versions mainly due to technical reasons: -the more versions we have, the more resources that are needed in the CI and the more time it takes to build each pull-request (also, the -more chances of failing because of unexpected errors). - -### Removing old versions - -When removing old versions, please follow these considerations: - - keep one version for every major release - - for the latest major release, at least three versions should be available (latest three minor versions) - -Logic associated to removed revisions, and entries in `config.yml` and `conandata.yml` files should be removed as well. If anyone needs to -recover them in the future, Git contains the full history and changes can be recovered from it. - -Please, note that even if those versions are removed from this repository, **the packages will always be accessible in ConanCenter remote** -associated to the recipe revision used to build them. - -### Adding old versions - -We usually don't add old versions unless there is a specific request for it. If you need some old version, please -share in the pull-request what is the motivation. Take into account that the version might be removed in future -pull-requests according to the statements above. diff --git a/docs/supported_platforms_and_configurations.md b/docs/supported_platforms_and_configurations.md index 6ca6d82cfbdc5..d4b13a6915051 100644 --- a/docs/supported_platforms_and_configurations.md +++ b/docs/supported_platforms_and_configurations.md @@ -39,10 +39,12 @@ For more information see [conan-io/conan-docker-tools](https://github.com/conan- - Python: 3.7.9 - CMake: 3.21.6 - WinSDK: 10.0.20348 + > WinSDK version is rolled periodically as [discussed previously](https://github.com/conan-io/conan-center-index/issues/4450). + > Please open an issue in case it needs to be updated. - Compilers: Visual Studio: - 2017 (19.16.27048) - - 2019 (19.29.30146) + - 2019 (19.29.30147) - Release (MT/MD) and Debug (MTd, MDd) - Architectures: x86_64 @@ -75,6 +77,8 @@ For more information see [conan-io/conan-docker-tools](https://github.com/conan- - Python: 3.7.12 - CMake: 3.20.1 - Compilers: Apple-clang versions 11.0.3, 12.0.5, 13.0.0 +- Macos SDK versions (for each apple-clang version respectively): 10.15, 11.3 +- Macos deployment target (`minos`): 10.15, 11.0, 11.3 - C++ Standard Library (`libcxx`): `libc++` - Architectures: x86_64, armv8 - Build types: Release, Debug diff --git a/docs/v2_linter.md b/docs/v2_linter.md index 54aa81f9edcc4..a2358f657f524 100644 --- a/docs/v2_linter.md +++ b/docs/v2_linter.md @@ -1,7 +1,11 @@ # Linter to help migration to Conan v2 - +## Contents + + * [Running the linter locally](#running-the-linter-locally) + * [Import ConanFile from `conan`](#import-conanfile-from-conan) + * [Import tools from `conan`](#import-tools-from-conan) On our [path to Conan v2](v2_roadmap.md) we are leveraging on custom Pylint rules. This linter will run for every pull-request that is submitted to the repository and will @@ -17,6 +21,10 @@ if perfectly valid in Conan v1, the recipe might fail here because it is not v2- Here you can find some examples of the extra rules we are adding: +## Running the linter locally + +Check the [Developing Recipes](developing_recipes_locally.md#running-the-python-linters) for details. + ## Import ConanFile from `conan` The module `conans` is deprecated in Conan v2. Now all the imports should be done from @@ -60,45 +68,4 @@ Here is a list of different imports and their new equivalent (note that the inte | conans.errors.ConanInvalidConfiguration | [conan.errors.ConanInvalidConfiguration](https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#migrating-the-recipes) | 1.47.0 | | conans.errors.ConanException | [conan.errors.ConanException](https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#migrating-the-recipes) | 1.47.0 | -## Disable linter for a specific conanfile - -If for some reason a conanfile of a recipe or a test_package is not yet prepared to pass -all the checks of the linter, it can be skipped from `pylint` adding the following comment to the file: - -**`conanfile.py`** - -```python -# pylint: skip-file -from conans import ConanFile, CMake, tools -... -``` - --- - -## Running the linter locally - -It is possible to run the linter locally the same way it is being run [using Github actions](../.github/workflows/linter-conan-v2.yml): - - * (Recommended) Use a dedicated Python virtualenv. - * Ensure you have required tools installed: `conan` and `pylint` (better to uses fixed versions) - - ``` - pip install conan~=1.0 pylint==2.14 - ``` - - * Set environment variable `PYTHONPATH` to the root of the repository - - ``` - export PYTHONPATH=your/path/conan-center-index - ``` - - * Now you just need to execute the `pylint` commands: - - ``` - # Lint a recipe: - pylint --rcfile=linter/pylintrc_recipe recipes/boost/all/conanfile.py - - # Lint the test_package - pylint --rcfile=linter/pylintrc_testpackage recipes/boost/all/test_package/conanfile.py - ``` - diff --git a/docs/v2_migration.md b/docs/v2_migration.md index c38d114a5ccc5..3a8ebff66e879 100644 --- a/docs/v2_migration.md +++ b/docs/v2_migration.md @@ -1,8 +1,17 @@ # Preparing recipes for Conan 2.0 +Refer to [road to Conan v2](v2_roadmap.md) to know the steps that +will be taken in ConanCenter and this repository to start running +Conan v2 in pull requests. + ## Contents + * [Using Layout](#using-layout) + * [With New Generators](#with-new-generators) + * [With Multiple Build Helpers](#with-multiple-build-helpers) + * [CMakeToolchain](#cmaketoolchain) + * [New conf_info properties](#new-conf_info-properties) * [New cpp_info set_property model](#new-cpp_info-set_property-model) * [CMakeDeps](#cmakedeps) * [Update required_conan_version to ">=1.43.0"](#update-required_conan_version-to-1430) @@ -12,11 +21,7 @@ * [Translating .build_modules to cmake_build_modules](#translating-build_modules-to-cmake_build_modules) * [PkgConfigDeps](#pkgconfigdeps) -> ⚠️ Refer to [road to Conan v2](v2_roadmap.md) to know the steps that -> will be taken in ConanCenter and this repository to start running -> Conan v2 in pull requests. - -> ⚠️ Read about the [linter in pull requests](v2_linter.md). +> **Note**: Read about the [linter in pull requests](v2_linter.md) to learn how this is being enforced. It's time to start thinking seriously about Conan v2 and prepare recipes for the incoming changes. Conan v2 comes with many @@ -26,6 +31,89 @@ changes and improvements, you can read about them in the This document is a practical guide, offering extended information particular to Conan Center Index recipes to get them ready to upgrade to Conan 2.0. +## Using Layout + +All recipes should use a layout. Without one, more manual configuration of folders (e.g. source, build, etc) +and package structure will be required. + +### With New Generators + +When doing this there is no need to manually define `self._subfolder_[...]` in a recipe. +Simply use `self.source_folder` and `self.build_folder` instead of "subfolder properties" that used to be the norm. + +### With Multiple Build Helpers + +When different build tools are use, at least one layout needs to be set. + +```python + def layout(self): + if self._use_cmake(): + cmake_layout(self) + else: # using autotools + basic_layout(self) +``` + +The `src_folder` must be the same when using different layouts and should +not depend on settings or options. + +## CMakeToolchain + +The old `CMake.definition` should be replaced by `CMakeToolchain.variables` and moved to the `generate` method. +However, certain options need to be passed as `cache_variables`. You'll need to check project's `CMakeLists.txt` +as there are a few cases to look out for: + +- When an `option` is configured before `project()` is called. + + ```cmake + cmake_minimum_required(3.1) + option(BUILD_EXAMPLES "Build examples using foorbar") + project(foobar) + ``` + +- When an variable is declared with `CACHE`. + + ```cmake + cmake_minimum_required(3.1) + project(foobar) + set(USE_JPEG ON CACHE BOOL "include jpeg support?") + ``` + +For more information refere to the [CMakeToolchain docs](https://docs.conan.io/en/latest/reference/conanfile/tools/cmake/cmaketoolchain.html) +or check out the converstaion in conan-io/conan#11937 for the brave. + +## New conf_info properties + +As described in the documentation `self.user_info` has been depreated and you are now required to use +`self.conf_info` to define individual properties to expose to downstream recipes. +The [2.0 migrations docs](https://docs.conan.io/en/latest/migrating_to_2.0/recipes.html#removed-self-user-info) +should cover the technical details, however for ConanCenterIndex we need to make sure there are no collisions +`conf_info` must be named `user.:`. + +For usage options of `conf_info`, the [documenation](https://docs.conan.io/en/latest/reference/config_files/global_conf.html?highlight=conf_info#configuration-in-your-recipes) + +In ConanCenterIndex this will typically looks like: + +- defining a value + ```py + def package_info(self): + tool_path = os.path.join(self.package_folder, "bin", "tool") + self.conf_info.define("user.pkg:tool", tool_path) + ``` +- using a value + ```py + #generators = "VirtualBuildEnv", "VirtualRunEnv" + + def build_requirements(self): + self.tool_requires("tool/0.1") + + def build(self): + tool_path = self.conf_info.get("user.pkg:tool") + self.run(f"{tool_path} --build") + ``` +> **Note**: This should only be used when absolutely required. In the vast majority of cases, the new +> ["Environments"](https://docs.conan.io/en/latest/reference/conanfile/tools/env/environment.html?highlight=Virtual) +> will include the `self.cpp_info.bindirs` which will provide access to the tools in the correct scopes. + ## New cpp_info set_property model New Conan generators like diff --git a/linter/check_import_conanfile.py b/linter/check_import_conanfile.py index 56442307ea781..bd5a90391b096 100644 --- a/linter/check_import_conanfile.py +++ b/linter/check_import_conanfile.py @@ -13,7 +13,7 @@ class ImportConanFile(BaseChecker): name = "conan-import-conanfile" msgs = { - "W9006": ( + "E9006": ( "Import ConanFile from new module: `from conan import ConanFile`. Old import is deprecated in Conan v2.", "conan-import-conanfile", "Import ConanFile from new module: `from conan import ConanFile`. Old import is deprecated in Conan v2.", diff --git a/linter/check_layout_src_folder.py b/linter/check_layout_src_folder.py new file mode 100644 index 0000000000000..b7d418884ca45 --- /dev/null +++ b/linter/check_layout_src_folder.py @@ -0,0 +1,44 @@ +from pylint.checkers import BaseChecker +from pylint.interfaces import IAstroidChecker +from astroid import nodes + +WHY_SRC_FOLDER = "Setting the `src_folder` for layouts will help keep an organized and clean workspace when developing recipes locally. " \ + "The extra folder will help ensure there are no collisions between the upstream sources and recipe's exports - which " \ + "also extends to what happens in the cache when creating packages" + + +class LayoutSrcFolder(BaseChecker): + """ + Ensure `src_folder=src` when using built-in layouts + """ + + __implements__ = IAstroidChecker + + name = "conan-layout-src-folder" + msgs = { + "E9012": ( + "layout is missing `src_folder` argument which should be to `src`", + "conan-missing-layout-src-folder", + WHY_SRC_FOLDER, + ), + "E9013": ( + "layout should set `src_folder` to `src`", + "conan-layout-src-folder-is-src", + WHY_SRC_FOLDER, + ), + } + + def visit_call(self, node: nodes.Call) -> None: + if not isinstance(node.func, nodes.Name): + return + + if node.func.name in ["cmake_layout", "bazel_layout", "basic_layout"]: + for kw in node.keywords: + if kw.arg == "src_folder": + if not kw.value or kw.value.as_string().strip("\"'") != "src": + self.add_message( + "conan-layout-src-folder-is-src", node=node, line=node.lineno + ) + break + else: + self.add_message("conan-missing-layout-src-folder", node=node, line=node.lineno) diff --git a/linter/conandata_yaml_linter.py b/linter/conandata_yaml_linter.py new file mode 100644 index 0000000000000..9e7133803906e --- /dev/null +++ b/linter/conandata_yaml_linter.py @@ -0,0 +1,125 @@ +import argparse +from strictyaml import ( + load, + Map, + Str, + YAMLValidationError, + MapPattern, + Optional, + Seq, + Enum, + Any, +) +from yaml_linting import file_path + + +CONANDATA_YAML_URL = "https://github.com/conan-io/conan-center-index/blob/master/docs/adding_packages/conandata_yml_format.md" + + +def main(): + parser = argparse.ArgumentParser( + description="Validate Conan's 'conandata.yaml' file to ConanCenterIndex's requirements." + ) + parser.add_argument( + "path", + nargs="?", + type=file_path, + help="file to validate.", + ) + args = parser.parse_args() + + patch_fields = Map( + { + "patch_file": Str(), + "patch_description": Str(), + "patch_type": Enum( + ["official", "conan", "portability", "bugfix", "vulnerability"] + ), + Optional("patch_source"): Str(), + # No longer required for v2 recipes with layouts + Optional("base_path"): Str(), + } + ) + schema = Map( + { + "sources": MapPattern(Str(), Any(), minimum_keys=1), + Optional("patches"): MapPattern(Str(), Seq(Any()), minimum_keys=1), + } + ) + + with open(args.path, encoding="utf-8") as f: + content = f.read() + + try: + parsed = load(content, schema) + except YAMLValidationError as error: + pretty_print_yaml_validate_error(args, error) # Error when "source" is missing or when "patches" has no versions + return + except BaseException as error: + pretty_print_yaml_validate_error(args, error) # YAML could not be parsed + return + + if "patches" in parsed: + for version in parsed["patches"]: + patches = parsed["patches"][version] + if version not in parsed["sources"]: + print( + f"::warning file={args.path},line={patches.start_line},endline={patches.end_line}," + f"title=conandata.yml inconsistency" + f"::Patch(es) are listed for version `{version}`, but there is source for this version." + f" You should either remove `{version}` from the `patches` section, or add it to the" + f" `sources` section" + ) + for i, patch in enumerate(patches): + # Individual report errors for each patch object + try: + parsed["patches"][version][i].revalidate(patch_fields) + except YAMLValidationError as error: + pretty_print_yaml_validate_warning(args, error) # Warning when patch fields are not followed + continue + + # Make sure `patch_source` exists where it's encouraged + type = parsed["patches"][version][i]["patch_type"] + if ( + type in ["official", "bugfix", "vulnerability"] + and not "patch_source" in patch + ): + print( + f"::warning file={args.path},line={type.start_line},endline={type.end_line}," + f"title=conandata.yml schema warning" + f"::'patch_type' should have 'patch_source' as per {CONANDATA_YAML_URL}#patch_type" + " it is expected to have a source (e.g. a URL) to where it originates from to help with" + " reviewing and consumers to evaluate patches" + ) + + # v2 migrations suggestion + if "base_path" in parsed["patches"][version][i]: + base_path = parsed["patches"][version][i]["base_path"] + print( + f"::notice file={args.path},line={base_path.start_line},endline={base_path.end_line}," + f"title=conandata.yml v2 migration suggestion" + "::'base_path' should not be required once a recipe has been upgraded to take advantage of" + " layouts (see https://docs.conan.io/en/latest/reference/conanfile/tools/layout.html) and" + " the new helper (see https://docs.conan.io/en/latest/reference/conanfile/tools/files/patches.html#conan-tools-files-apply-conandata-patches)" + ) + + +def pretty_print_yaml_validate_error(args, error): + snippet = error.context_mark.get_snippet().replace("\n", "%0A") + print( + f"::error file={args.path},line={error.context_mark.line},endline={error.problem_mark.line+1}," + f"title=conandata.yml schema error" + f"::Schema outlined in {CONANDATA_YAML_URL}#patches-fields is not followed.%0A%0A{error.problem} in %0A{snippet}%0A" + ) + +def pretty_print_yaml_validate_warning(args, error): + snippet = error.context_mark.get_snippet().replace("\n", "%0A") + print( + f"::warning file={args.path},line={error.context_mark.line},endline={error.problem_mark.line+1}," + f"title=conandata.yml schema warning" + f"::Schema outlined in {CONANDATA_YAML_URL}#patches-fields is not followed.%0A%0A{error.problem} in %0A{snippet}%0A" + ) + + +if __name__ == "__main__": + main() diff --git a/linter/conanv2_transition.py b/linter/conanv2_transition.py index 8c79054c05c25..32f3a3b0924b0 100644 --- a/linter/conanv2_transition.py +++ b/linter/conanv2_transition.py @@ -9,6 +9,7 @@ from linter.check_import_conanfile import ImportConanFile from linter.check_import_errors import ImportErrorsConanException, ImportErrorsConanInvalidConfiguration, ImportErrors from linter.check_import_tools import ImportTools +from linter.check_layout_src_folder import LayoutSrcFolder def register(linter: PyLinter) -> None: @@ -18,3 +19,4 @@ def register(linter: PyLinter) -> None: linter.register_checker(ImportErrorsConanException(linter)) linter.register_checker(ImportErrorsConanInvalidConfiguration(linter)) linter.register_checker(ImportTools(linter)) + linter.register_checker(LayoutSrcFolder(linter)) diff --git a/linter/config_yaml_linter.py b/linter/config_yaml_linter.py new file mode 100644 index 0000000000000..29807e6ce3b99 --- /dev/null +++ b/linter/config_yaml_linter.py @@ -0,0 +1,37 @@ +import argparse +from strictyaml import load, Map, Str, YAMLValidationError, MapPattern +from yaml_linting import file_path + + +def main(): + parser = argparse.ArgumentParser( + description="Validate ConanCenterIndex's 'config.yaml' file." + ) + parser.add_argument( + "path", + nargs="?", + type=file_path, + help="file to validate.", + ) + args = parser.parse_args() + + schema = Map( + {"versions": MapPattern(Str(), Map({"folder": Str()}), minimum_keys=1)} + ) + + with open(args.path) as f: + content = f.read() + + try: + load(content, schema) + except YAMLValidationError as error: + e = error.__str__().replace("\n", "%0A") + print( + f"::error file={args.path},line={error.context_mark.line},endline={error.problem_mark.line}," + f"title=config.yml schema error" + f"::{e}\n" + ) + + +if __name__ == "__main__": + main() diff --git a/linter/yaml_linting.py b/linter/yaml_linting.py new file mode 100644 index 0000000000000..8b61d99ba39f9 --- /dev/null +++ b/linter/yaml_linting.py @@ -0,0 +1,9 @@ +import argparse + + +def file_path(a_string): + from os.path import isfile + + if not isfile(a_string): + raise argparse.ArgumentTypeError(f"{a_string} does not point to a file") + return a_string diff --git a/linter/yamllint_matcher.json b/linter/yamllint_matcher.json new file mode 100644 index 0000000000000..42a3ef93b5956 --- /dev/null +++ b/linter/yamllint_matcher.json @@ -0,0 +1,22 @@ +{ + "problemMatcher": [ + { + "owner": "yamllint_matcher", + "pattern": [ + { + "regexp": "^(.*\\.ya?ml)$", + "file": 1 + }, + { + "regexp": "^\\s{2}(\\d+):(\\d+)\\s+(error|warning)\\s+(.*?)\\s+\\((.*)\\)$", + "line": 1, + "column": 2, + "severity": 3, + "message": 4, + "code": 5, + "loop": true + } + ] + } + ] +} diff --git a/recipes/7zip/19.00/conanfile.py b/recipes/7zip/19.00/conanfile.py index 5bca7f358e5d4..d18ee2242a6e7 100644 --- a/recipes/7zip/19.00/conanfile.py +++ b/recipes/7zip/19.00/conanfile.py @@ -1,8 +1,10 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import download, chdir, replace_in_file +from conans import tools, AutoToolsBuildEnvironment import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class SevenZipConan(ConanFile): @@ -18,7 +20,7 @@ class SevenZipConan(ConanFile): def _settings_build(self): return getattr(self, "settings_build", self.settings) - def configure(self): + def validate(self): if self.settings.os != "Windows": raise ConanInvalidConfiguration("Only Windows supported") if self.settings.arch not in ("x86", "x86_64"): @@ -28,21 +30,20 @@ def build_requirements(self): self.build_requires("lzma_sdk/9.20") if self.settings.compiler != "Visual Studio" and self._settings_build.os == "Windows" and "make" not in os.environ.get("CONAN_MAKE_PROGRAM", ""): - self.build_requires("make/4.2.1") + self.build_requires("make/4.3") def package_id(self): del self.info.settings.compiler def _uncompress_7z(self, filename): - self.run("7zr x {}".format(filename)) + self.run(f"7zr x {filename}") def source(self): from six.moves.urllib.parse import urlparse url = self.conan_data["sources"][self.version]["url"] filename = os.path.basename(urlparse(url).path) sha256 = self.conan_data["sources"][self.version]["sha256"] - tools.download(url, filename) - tools.check_sha256(filename, sha256) + download(self, url, filename, sha256) self._uncompress_7z(filename) os.unlink(filename) @@ -55,8 +56,8 @@ def _msvc_platform(self): def _build_msvc(self): with tools.vcvars(self.settings): - with tools.chdir(os.path.join("CPP", "7zip")): - self.run("nmake /f makefile PLATFORM=%s" % self._msvc_platform) + with chdir(self, os.path.join("CPP", "7zip")): + self.run(f"nmake /f makefile PLATFORM={self._msvc_platform}") def _build_autotools(self): # TODO: Enable non-Windows methods in configure @@ -65,15 +66,15 @@ def _build_autotools(self): if self.settings.os == "Windows" and self.settings.compiler == "gcc": extra_env["IS_MINGW"] = "1" with tools.environment_append(extra_env): - with tools.chdir(os.path.join("CPP", "7zip", "Bundles", "LzmaCon")): + with chdir(self, os.path.join("CPP", "7zip", "Bundles", "LzmaCon")): autotools.make(args=["-f", "makefile.gcc"], target="all") def _patch_sources(self): if self.settings.compiler == "Visual Studio": fn = os.path.join("CPP", "Build.mak") os.chmod(fn, 0o644) - tools.replace_in_file(fn, "-MT", "-{}".format(str(self.settings.compiler.runtime))) - tools.replace_in_file(fn, "-MD", "-{}".format(str(self.settings.compiler.runtime))) + replace_in_file(self, fn, "-MT", f"-{self.settings.compiler.runtime}") + replace_in_file(self, fn, "-MD", f"-{self.settings.compiler.runtime}") def build(self): self._patch_sources() @@ -93,5 +94,8 @@ def package(self): def package_info(self): bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.path.append(bin_path) + + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/aaf/all/CMakeLists.txt b/recipes/aaf/all/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/aaf/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/aaf/all/conandata.yml b/recipes/aaf/all/conandata.yml index 6deeda4a0cea7..47f1b39d22fea 100644 --- a/recipes/aaf/all/conandata.yml +++ b/recipes/aaf/all/conandata.yml @@ -5,22 +5,23 @@ sources: patches: "1.2.0": - patch_file: "patches/1.2.0-001-simpler-cmakelists.patch" - base_path: "source_subfolder" patch_type: "conan" patch_description: "Simplify CMakeLists.txt" - patch_file: "patches/1.2.0-002-link-core-with-find-library.patch" - base_path: "source_subfolder" patch_type: "portability" patch_description: "Link CoreFoundation and CoreServices with find_library" - patch_file: "patches/1.2.0-003-remove-register-keyword.patch" - base_path: "source_subfolder" patch_type: "portability" patch_description: "Remove deprecated use of register keyword for c++11 builds" - patch_file: "patches/1.2.0-004-remove-expat.patch" - base_path: "source_subfolder" patch_type: "conan" patch_description: "Remove expat dependency directory" - patch_file: "patches/1.2.0-005-remove-libjpeg.patch" - base_path: "source_subfolder" patch_type: "conan" patch_description: "Remove libjpeg dependency directory" + - patch_file: "patches/1.2.0-006-link-libuuid.patch" + patch_type: "conan" + patch_description: "Link libuuid" + - patch_file: "patches/1.2.0-007-support-all-generators.patch" + patch_type: "portability" + patch_description: "Support all CMake generators" diff --git a/recipes/aaf/all/conanfile.py b/recipes/aaf/all/conanfile.py index ab1bf99fe216b..3cb365138e8e8 100644 --- a/recipes/aaf/all/conanfile.py +++ b/recipes/aaf/all/conanfile.py @@ -1,20 +1,24 @@ -from conan.tools.files import apply_conandata_patches -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -import glob + +required_conan_version = ">=1.52.0" class AafConan(ConanFile): name = "aaf" url = "https://github.com/conan-io/conan-center-index" homepage = "https://sourceforge.net/projects/aaf/" - description = "A cross-platform SDK for AAF. AAF is a metadata management system and file format for use in professional multimedia creation and authoring." - topics = ("aaf", "multimedia", "crossplatform") + description = ( + "A cross-platform SDK for AAF. AAF is a metadata management system and " + "file format for use in professional multimedia creation and authoring." + ) + topics = ("multimedia", "crossplatform") license = "AAFSDKPSL-2.0" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake", "cmake_find_package" - settings = "os", "compiler", "build_type", "arch" + + settings = "os", "arch", "compiler", "build_type" options = { "structured_storage": [True, False], } @@ -22,69 +26,67 @@ class AafConan(ConanFile): "structured_storage": False, } - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("expat/2.4.1") - self.requires("libjpeg/9d") + self.requires("expat/2.5.0") + self.requires("libjpeg/9e") if self.settings.os in ("FreeBSD", "Linux"): self.requires("libuuid/1.0.3") - def validate(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - raise ConanInvalidConfiguration("ARM v8 not supported") - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def build(self): - apply_conandata_patches(self) - - cmake = CMake(self) - - if tools.is_apple_os(self.settings.os): - cmake.definitions["PLATFORM"] = "apple-clang" + def generate(self): + tc = CMakeToolchain(self) + if is_apple_os(self): + tc.cache_variables["PLATFORM"] = "apple-clang" elif self.settings.compiler == "Visual Studio": - cmake.definitions["PLATFORM"] = "vc" + tc.cache_variables["PLATFORM"] = "vc" + else: + tc.cache_variables["PLATFORM"] = str(self.settings.os) + # ARCH is used only for setting the output directory, except if host is macOS + # where ARCH is used to select proper pre-compiled proprietary Structured Storage library. + if self.settings.os == "Macos" and self.settings.arch == "armv8": + tc.cache_variables["ARCH"] = "arm64" else: - cmake.definitions["PLATFORM"] = self.settings.os + tc.cache_variables["ARCH"] = "x86_64" + tc.cache_variables["AAF_NO_STRUCTURED_STORAGE"] = not self.options.structured_storage + jpeg_res_dirs = ";".join([p.replace("\\", "/") for p in self.dependencies["libjpeg"].cpp_info.aggregated_components().resdirs]) + tc.variables["JPEG_RES_DIRS"] = jpeg_res_dirs + tc.generate() + deps = CMakeDeps(self) + deps.generate() - cmake.definitions["ARCH"] = "x86_64" # ARCH is used only for setting the output directory. So itsvalue does not matter here. - cmake.definitions["AAF_NO_STRUCTURED_STORAGE"] = not self.options.structured_storage - cmake.configure(build_folder=self._build_subfolder) + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("out/shared/include/*.h", dst="include", src=self._source_subfolder, keep_path=False) - self.copy("out/target/*/*/RefImpl/*.dll", dst="bin", src=self._source_subfolder, keep_path=False) - self.copy("out/target/*/*/RefImpl/*.lib", dst="lib", src=self._source_subfolder, keep_path=False) - self.copy("out/target/*/*/RefImpl/*.so", dst="lib", src=self._source_subfolder, keep_path=False) - self.copy("out/target/*/*/RefImpl/*.dylib", dst="lib", src=self._source_subfolder, keep_path=False) - self.copy("out/target/*/*/RefImpl/*.a", dst="lib", src=self._source_subfolder, keep_path=False) - self.copy("LEGAL/AAFSDKPSL.TXT", dst="licenses", src=self._source_subfolder, keep_path=False) - - if tools.is_apple_os(self.settings.os): - with tools.chdir(os.path.join(self.package_folder, "lib")): - for dylib in glob.glob("*.dylib"): - command = "install_name_tool -id {0} {1}".format(os.path.basename(dylib), dylib) - self.output.info(command) - self.run(command) + copy(self, "AAFSDKPSL.TXT", src=os.path.join(self.source_folder, "LEGAL"), dst=os.path.join(self.package_folder, "licenses")) + out_include_folder = os.path.join(self.source_folder, "out", "shared", "include") + out_target_folder = os.path.join(self.source_folder, "out", "target") + copy(self, "*.h", src=out_include_folder, dst=os.path.join(self.package_folder, "include")) + copy(self, "*/RefImpl/*.dll", src=out_target_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*/RefImpl/*.lib", src=out_target_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*/RefImpl/*.so*", src=out_target_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*/RefImpl/*.dylib", src=out_target_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*/RefImpl/*.a", src=out_target_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + fix_apple_shared_install_name(self) def package_info(self): if self.settings.os == "Windows": - if self.settings.build_type == "Release": - self.cpp_info.libs = ["AAF", "AAFIID", "AAFCOAPI"] - else: - self.cpp_info.libs = ["AAFD", "AAFIIDD", "AAFCOAPI"] + suffix = "D" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [f"AAF{suffix}", f"AAFIID{suffix}", "AAFCOAPI"] else: self.cpp_info.libs = ["aaflib", "aafiid", "com-api"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["dl"] - if self.settings.os == 'Macos': - self.cpp_info.frameworks = ['CoreServices', 'CoreFoundation'] + elif is_apple_os(self): + self.cpp_info.frameworks = ["CoreServices", "CoreFoundation"] diff --git a/recipes/aaf/all/patches/1.2.0-004-remove-expat.patch b/recipes/aaf/all/patches/1.2.0-004-remove-expat.patch index 0ced3c8afbed8..e715111f6d78e 100644 --- a/recipes/aaf/all/patches/1.2.0-004-remove-expat.patch +++ b/recipes/aaf/all/patches/1.2.0-004-remove-expat.patch @@ -28,7 +28,7 @@ index e0c5be195..1210f4d99 100644 + #${AAFSDK_ROOT}/ref-impl/expat ) -+find_package(EXPAT REQUIRED) ++find_package(EXPAT REQUIRED MODULE) + +target_link_libraries(OM PUBLIC EXPAT::EXPAT) + diff --git a/recipes/aaf/all/patches/1.2.0-006-link-libuuid.patch b/recipes/aaf/all/patches/1.2.0-006-link-libuuid.patch new file mode 100644 index 0000000000000..4fd45bf2d6ef2 --- /dev/null +++ b/recipes/aaf/all/patches/1.2.0-006-link-libuuid.patch @@ -0,0 +1,25 @@ +--- a/ref-impl/aaflib/CMakeLists.txt ++++ b/ref-impl/aaflib/CMakeLists.txt +@@ -75,7 +75,7 @@ target_compile_definitions(AAFLIB PRIVATE + ) + + if(UNIX AND NOT APPLE) +- target_link_libraries(AAFLIB dl uuid) ++ target_link_libraries(AAFLIB dl) + endif() + + # TODO: find a way to get the actual 'comapi' target output binary name +--- a/ref-impl/src/OM/CMakeLists.txt ++++ b/ref-impl/src/OM/CMakeLists.txt +@@ -165,6 +165,11 @@ find_package(EXPAT REQUIRED MODULE) + + target_link_libraries(OM PUBLIC EXPAT::EXPAT) + ++find_package(libuuid CONFIG) ++if(libuuid_FOUND) ++ target_link_libraries(OM PRIVATE libuuid::libuuid) ++endif() ++ + target_compile_definitions(OM PUBLIC + XML_STATIC + $<$:OM_DEBUG> diff --git a/recipes/aaf/all/patches/1.2.0-007-support-all-generators.patch b/recipes/aaf/all/patches/1.2.0-007-support-all-generators.patch new file mode 100644 index 0000000000000..15eb2c9ffb7a5 --- /dev/null +++ b/recipes/aaf/all/patches/1.2.0-007-support-all-generators.patch @@ -0,0 +1,31 @@ +--- a/build/pdefs.cmake ++++ b/build/pdefs.cmake +@@ -45,26 +45,11 @@ if(NOT ARCH) + message(FATAL_ERROR "'ARCH' must be set.") + endif() + +-if(APPLE) +- if(${CMAKE_GENERATOR} STREQUAL "Xcode") +- set(CONFIGURATION "${CMAKE_CFG_INTDIR}") +- elseif(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") +- set(CONFIGURATION "${CMAKE_BUILD_TYPE}") +- else() +- message(FATAL_ERROR "CMake generator '${CMAKE_GENERATOR}' is not supported by this platform.") +- endif() +-elseif(WIN32) +- string(REGEX REPLACE "Visual Studio ([0-9]+) .*" "\\1" MSVS_VERSION_NUMBER "${CMAKE_GENERATOR}") +- if(NOT ${CMAKE_GENERATOR} STREQUAL "${MSVS_VERSION_NUMBER}") ++if(APPLE OR WIN32 OR UNIX) ++ if(GENERATOR_IS_MULTI_CONFIG) + set(CONFIGURATION "${CMAKE_CFG_INTDIR}") + else() +- message(FATAL_ERROR "CMake generator '${CMAKE_GENERATOR}' is not supported by this platform.") +- endif() +-elseif(UNIX) +- if(${CMAKE_GENERATOR} STREQUAL "Unix Makefiles") + set(CONFIGURATION "${CMAKE_BUILD_TYPE}") +- else() +- message(FATAL_ERROR "CMake generator '${CMAKE_GENERATOR}' is not supported by this platform.") + endif() + else() + message(FATAL_ERROR "This platform is not supported.") diff --git a/recipes/aaf/all/test_package/CMakeLists.txt b/recipes/aaf/all/test_package/CMakeLists.txt index 2e676c42d531c..6b1e5d9915990 100644 --- a/recipes/aaf/all/test_package/CMakeLists.txt +++ b/recipes/aaf/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(aaf REQUIRED CONFIG) -add_executable(example example.cpp) -target_link_libraries(example CONAN_PKG::aaf) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE aaf::aaf) diff --git a/recipes/aaf/all/test_package/conanfile.py b/recipes/aaf/all/test_package/conanfile.py index 3f6584e95145b..98ab55852ad56 100644 --- a/recipes/aaf/all/test_package/conanfile.py +++ b/recipes/aaf/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aaf/all/test_package/example.cpp b/recipes/aaf/all/test_package/test_package.cpp similarity index 100% rename from recipes/aaf/all/test_package/example.cpp rename to recipes/aaf/all/test_package/test_package.cpp diff --git a/recipes/aaf/all/test_v1_package/CMakeLists.txt b/recipes/aaf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/aaf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sol2/3.x.x/test_package/conanfile.py b/recipes/aaf/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/sol2/3.x.x/test_package/conanfile.py rename to recipes/aaf/all/test_v1_package/conanfile.py diff --git a/recipes/aaplus/all/conanfile.py b/recipes/aaplus/all/conanfile.py index b7e5972fe003d..82bc050c7cb95 100644 --- a/recipes/aaplus/all/conanfile.py +++ b/recipes/aaplus/all/conanfile.py @@ -2,11 +2,11 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, load, save +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, load, save from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class Aaplusconan(ConanFile): @@ -30,17 +30,9 @@ class Aaplusconan(ConanFile): "fPIC": True, } - def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - - def configure(self): - if self.options.shared: - del self.options.fPIC + @property + def _min_cppstd(self): + return "17" @property def _compilers_minimum_version(self): @@ -49,17 +41,32 @@ def _compilers_minimum_version(self): "clang": "9", "apple-clang": "11", "Visual Studio": "16", + "msvc": "192", } + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, "17") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) compiler_version = Version(self.info.settings.compiler.version) if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - "{} requires C++17, which your compiler does not support.".format(self.name) + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", ) if self.info.settings.compiler == "clang" and (compiler_version >= "10" and compiler_version < "12"): @@ -67,9 +74,6 @@ def validate(self): "AA+ cannot handle clang 10 and 11 due to filesystem being under experimental namespace" ) - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder) diff --git a/recipes/aaplus/all/test_package/CMakeLists.txt b/recipes/aaplus/all/test_package/CMakeLists.txt index ba245858dc132..709ce7a5f945a 100644 --- a/recipes/aaplus/all/test_package/CMakeLists.txt +++ b/recipes/aaplus/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) find_package(aaplus REQUIRED CONFIG) diff --git a/recipes/aaplus/all/test_package/conanfile.py b/recipes/aaplus/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/aaplus/all/test_package/conanfile.py +++ b/recipes/aaplus/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/aaplus/all/test_v1_package/CMakeLists.txt b/recipes/aaplus/all/test_v1_package/CMakeLists.txt index 8fa3fc54aa2d0..0d20897301b68 100644 --- a/recipes/aaplus/all/test_v1_package/CMakeLists.txt +++ b/recipes/aaplus/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(aaplus REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE aaplus::aaplus) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aaplus/all/test_v1_package/conanfile.py b/recipes/aaplus/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/aaplus/all/test_v1_package/conanfile.py +++ b/recipes/aaplus/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/abseil/all/conandata.yml b/recipes/abseil/all/conandata.yml index e507e3661535d..f2176c94635e9 100644 --- a/recipes/abseil/all/conandata.yml +++ b/recipes/abseil/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "20230125.1": + url: "https://github.com/abseil/abseil-cpp/archive/20230125.1.tar.gz" + sha256: "81311c17599b3712069ded20cca09a62ab0bf2a89dfa16993786c8782b7ed145" + "20230125.0": + url: "https://github.com/abseil/abseil-cpp/archive/20230125.0.tar.gz" + sha256: "3ea49a7d97421b88a8c48a0de16c16048e17725c7ec0f1d3ea2683a2a75adc21" + "20220623.1": + url: "https://github.com/abseil/abseil-cpp/archive/20220623.1.tar.gz" + sha256: "91ac87d30cc6d79f9ab974c51874a704de9c2647c40f6932597329a282217ba8" "20220623.0": url: "https://github.com/abseil/abseil-cpp/archive/20220623.0.tar.gz" sha256: "4208129b49006089ba1d6710845a45e31c59b0ab6bff9e5788a87f55c5abd602" @@ -15,12 +24,22 @@ sources: url: "https://github.com/abseil/abseil-cpp/archive/20200225.3.tar.gz" sha256: "66d4d009050f39c104b03f79bdca9d930c4964016f74bf24867a43fbdbd00d23" patches: + "20230125.1": + - patch_file: "patches/0003-absl-string-libm.patch" + "20230125.0": + - patch_file: "patches/0003-absl-string-libm.patch" + "20220623.1": + - patch_file: "patches/0003-absl-string-libm.patch" + - patch_file: "patches/0005-has-unique-object-representations.patch" + patch_description: "Workaround bug in GCC 7.2" + patch_source: "https://github.com/abseil/abseil-cpp/pull/1250" + patch_type: "portability" "20220623.0": - patch_file: "patches/0003-absl-string-libm.patch" - patch_file: "patches/0005-has-unique-object-representations.patch" patch_description: "Workaround bug in GCC 7.2" patch_source: "https://github.com/abseil/abseil-cpp/pull/1250" - patch_type: "backport" + patch_type: "portability" "20211102.0": - patch_file: "patches/0003-absl-string-libm.patch" "20210324.2": diff --git a/recipes/abseil/all/conanfile.py b/recipes/abseil/all/conanfile.py index 28ebfb4eb5aa3..0b2ca54f99449 100644 --- a/recipes/abseil/all/conanfile.py +++ b/recipes/abseil/all/conanfile.py @@ -3,15 +3,15 @@ from conan.tools.apple import is_apple_os from conan.tools.build import check_min_cppstd, cross_building from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, load, replace_in_file, rmdir, save +from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get, load, replace_in_file, rmdir, save from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import json import os import re import textwrap -required_conan_version = ">=1.51.3" - +required_conan_version = ">=1.53.0" class AbseilConan(ConanFile): name = "abseil" @@ -30,13 +30,27 @@ class AbseilConan(ConanFile): "shared": False, "fPIC": True, } - short_paths = True + @property + def _min_cppstd(self): + return "11" if Version(self.version) < "20230125.0" else "14" + + @property + def _compilers_minimum_version(self): + return { + "14": { + "gcc": "6", + "clang": "5", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + }, + }.get(self._min_cppstd, {}) + def export_sources(self): copy(self, "abi_trick/*", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,21 +58,26 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) - if self.info.options.shared and is_msvc(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + if self.options.shared and is_msvc(self): # upstream tries its best to export symbols, but it's broken for the moment - raise ConanInvalidConfiguration("abseil shared not availabe for Visual Studio (yet)") + raise ConanInvalidConfiguration(f"{self.ref} shared not availabe for Visual Studio (yet)") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/abseil/all/test_package/CMakeLists.txt b/recipes/abseil/all/test_package/CMakeLists.txt index 04ceb34a1e4bd..ee593a507a47a 100644 --- a/recipes/abseil/all/test_package/CMakeLists.txt +++ b/recipes/abseil/all/test_package/CMakeLists.txt @@ -6,7 +6,12 @@ find_package(absl REQUIRED CONFIG) # Test components add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE absl::strings absl::flat_hash_map absl::flat_hash_set absl::int128 absl::time) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +# Abseil now requires at least C++14 since 20230125.0 +if(absl_VERSION VERSION_LESS "20230125.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +endif() if(cxx_std_14 IN_LIST CMAKE_CXX_COMPILE_FEATURES) add_executable(${PROJECT_NAME}_14 test_package.cpp) @@ -34,5 +39,14 @@ endif() # Test also (unofficial) global target add_executable(${PROJECT_NAME}_global test_package.cpp) -target_link_libraries(${PROJECT_NAME}_global PRIVATE abseil::abseil) -target_compile_features(${PROJECT_NAME}_global PRIVATE cxx_std_11) +if(TARGET abseil::abseil) + target_link_libraries(${PROJECT_NAME}_global PRIVATE abseil::abseil) +else() + target_link_libraries(${PROJECT_NAME}_global PRIVATE absl::absl) +endif() +# Abseil now requires at least C++14 since 20230125.0 +if(absl_VERSION VERSION_LESS "20230125.0") + target_compile_features(${PROJECT_NAME}_global PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME}_global PRIVATE cxx_std_14) +endif() diff --git a/recipes/abseil/all/test_v1_package/CMakeLists.txt b/recipes/abseil/all/test_v1_package/CMakeLists.txt index fe7c8fa13bf23..0d20897301b68 100644 --- a/recipes/abseil/all/test_v1_package/CMakeLists.txt +++ b/recipes/abseil/all/test_v1_package/CMakeLists.txt @@ -1,41 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(absl REQUIRED CONFIG) - -# Test components -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE absl::strings absl::flat_hash_map absl::flat_hash_set absl::int128 absl::time) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) - -if(cxx_std_14 IN_LIST CMAKE_CXX_COMPILE_FEATURES) - add_executable(${PROJECT_NAME}_14 ../test_package/test_package.cpp) - target_link_libraries(${PROJECT_NAME}_14 PRIVATE absl::strings absl::flat_hash_map absl::flat_hash_set absl::int128 absl::time) - target_compile_features(${PROJECT_NAME}_14 PRIVATE cxx_std_14) -endif() -if(cxx_std_17 IN_LIST CMAKE_CXX_COMPILE_FEATURES) - add_executable(${PROJECT_NAME}_17 ../test_package/test_package.cpp) - target_link_libraries(${PROJECT_NAME}_17 PRIVATE absl::strings absl::flat_hash_map absl::flat_hash_set absl::int128 absl::time) - target_compile_features(${PROJECT_NAME}_17 PRIVATE cxx_std_17) -endif() -# old abseil used std::result_of (which was removed in C++20) https://github.com/abseil/abseil-cpp/issues/649 -if(CXX20_SUPPORTED) - if(cxx_std_20 IN_LIST CMAKE_CXX_COMPILE_FEATURES) - add_executable(${PROJECT_NAME}_20 ../test_package/test_package.cpp) - target_link_libraries(${PROJECT_NAME}_20 PRIVATE absl::strings absl::flat_hash_map absl::flat_hash_set absl::int128 absl::time) - target_compile_features(${PROJECT_NAME}_20 PRIVATE cxx_std_20) - endif() - if(cxx_std_23 IN_LIST CMAKE_CXX_COMPILE_FEATURES) - add_executable(${PROJECT_NAME}_23 ../test_package/test_package.cpp) - target_link_libraries(${PROJECT_NAME}_23 PRIVATE absl::strings absl::flat_hash_map absl::flat_hash_set absl::int128 absl::time) - target_compile_features(${PROJECT_NAME}_23 PRIVATE cxx_std_23) - endif() -endif() - -# Test also global target -add_executable(${PROJECT_NAME}_global ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME}_global PRIVATE CONAN_PKG::abseil) -target_compile_features(${PROJECT_NAME}_global PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/abseil/all/test_v1_package/conanfile.py b/recipes/abseil/all/test_v1_package/conanfile.py index 9f94318d8f0ec..5c87f554bbab2 100644 --- a/recipes/abseil/all/test_v1_package/conanfile.py +++ b/recipes/abseil/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/abseil/config.yml b/recipes/abseil/config.yml index da310ea8a8810..9f03a38ed2611 100644 --- a/recipes/abseil/config.yml +++ b/recipes/abseil/config.yml @@ -1,4 +1,10 @@ versions: + "20230125.1": + folder: all + "20230125.0": + folder: all + "20220623.1": + folder: all "20220623.0": folder: all "20211102.0": diff --git a/recipes/acl/all/conandata.yml b/recipes/acl/all/conandata.yml index d7d40a7f305a3..3a30a3346bfd5 100644 --- a/recipes/acl/all/conandata.yml +++ b/recipes/acl/all/conandata.yml @@ -1,4 +1,4 @@ sources: "2.3.1": url: "http://download.savannah.nongnu.org/releases/acl/acl-2.3.1.tar.xz" - sha256: "C0234042E17F11306C23C038B08E5E070EDB7BE44BEF6697FB8734DCFF1C66B1" + sha256: "c0234042e17f11306c23c038b08e5e070edb7be44bef6697fb8734dcff1c66b1" diff --git a/recipes/acl/all/conanfile.py b/recipes/acl/all/conanfile.py index c02a3661c6741..f273d2731c12d 100644 --- a/recipes/acl/all/conanfile.py +++ b/recipes/acl/all/conanfile.py @@ -1,78 +1,74 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.env import VirtualRunEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout import os -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" + class AclConan(ConanFile): name = "acl" description = "Commands for Manipulating POSIX Access Control Lists" - topics = ("conan", "acl", "POSIX") + topics = ("posix",) license = "GPL-2.0-or-later" homepage = "https://savannah.nongnu.org/projects/acl/" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = { "shared": [True, False], - "fPIC": [True, False] + "fPIC": [True, False], } default_options = { "shared": False, - "fPIC": True + "fPIC": True, } - requires = ["libattr/2.5.1"] - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") - @property - def _doc_folder(self): - return os.path.join( - self._source_subfolder, - "doc" - ) + def requirements(self): + self.requires("libattr/2.5.1") def validate(self): if self.settings.os != "Linux": raise ConanInvalidConfiguration("libacl is just supported for Linux") - def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - if self.options.shared: - del self.options.fPIC - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - conf_args = [] - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) - else: - conf_args.extend(["--disable-shared", "--enable-static"]) - self._autotools.configure(configure_dir=self._source_subfolder, args=conf_args) - return self._autotools + def generate(self): + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def build(self): - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - autotools = self._configure_autotools() + copy(self, "COPYING", src=os.path.join(self.source_folder, "doc"), dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) autotools.install() - self.copy("COPYING", dst="licenses", src=self._doc_folder) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "share")) - + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) + def package_info(self): - self.cpp_info.names["pkg_config"] = "libacl" + self.cpp_info.set_property("pkg_config_name", "libacl") self.cpp_info.libs = ["acl"] diff --git a/recipes/acl/all/test_package/CMakeLists.txt b/recipes/acl/all/test_package/CMakeLists.txt index 5304f940f246f..3c77dd4bcf50a 100644 --- a/recipes/acl/all/test_package/CMakeLists.txt +++ b/recipes/acl/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(example C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(acl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE acl::acl) diff --git a/recipes/acl/all/test_package/conanfile.py b/recipes/acl/all/test_package/conanfile.py index 0bddc9f2bdfc8..98ab55852ad56 100644 --- a/recipes/acl/all/test_package/conanfile.py +++ b/recipes/acl/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/acl/all/test_v1_package/CMakeLists.txt b/recipes/acl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/acl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/acl/all/test_v1_package/conanfile.py b/recipes/acl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/acl/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/ade/all/conandata.yml b/recipes/ade/all/conandata.yml index 33408bd203512..954c10dfe2c1d 100644 --- a/recipes/ade/all/conandata.yml +++ b/recipes/ade/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.2a": + url: "https://github.com/opencv/ade/archive/refs/tags/v0.1.2a.tar.gz" + sha256: "c022a688b0554017e46e1cbdeb0105e625ca090fc3755c15df8c4451a304e084" "0.1.1f": url: "https://github.com/opencv/ade/archive/refs/tags/v0.1.1f.tar.gz" sha256: "c316680efbb5dd3ac4e10bb8cea345cf26a6a25ebc22418f8f0b8ca931a550e9" diff --git a/recipes/ade/all/conanfile.py b/recipes/ade/all/conanfile.py index 7a3013131f30c..56f8248013585 100644 --- a/recipes/ade/all/conanfile.py +++ b/recipes/ade/all/conanfile.py @@ -28,16 +28,15 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) - def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/ade/all/test_package/conanfile.py b/recipes/ade/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/ade/all/test_package/conanfile.py +++ b/recipes/ade/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/ade/all/test_v1_package/CMakeLists.txt b/recipes/ade/all/test_v1_package/CMakeLists.txt index 9e81f90ccede3..0d20897301b68 100644 --- a/recipes/ade/all/test_v1_package/CMakeLists.txt +++ b/recipes/ade/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(ade REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE ade) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/ade/config.yml b/recipes/ade/config.yml index 02ba1ae2763b8..cbf2f373fb630 100644 --- a/recipes/ade/config.yml +++ b/recipes/ade/config.yml @@ -1,3 +1,5 @@ versions: + "0.1.2a": + folder: "all" "0.1.1f": folder: "all" diff --git a/recipes/aeron/all/CMakeLists.txt b/recipes/aeron/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/aeron/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/aeron/all/conandata.yml b/recipes/aeron/all/conandata.yml index 6c6ca05f4d274..a888d0c721120 100644 --- a/recipes/aeron/all/conandata.yml +++ b/recipes/aeron/all/conandata.yml @@ -11,6 +11,3 @@ sources: "1.32.0": url: https://github.com/real-logic/aeron/archive/refs/tags/1.32.0.tar.gz sha256: "998ca14c895cd154345c85298b7c2e2ef76aef45b10c742030fd3a32065b9b1c" - "1.31.2": - url: https://github.com/real-logic/aeron/archive/refs/tags/1.31.2.tar.gz - sha256: "3edcf01415298aa053cd9e9637405cb8f7b940545bb52a563592dab2b35389ea" diff --git a/recipes/aeron/all/conanfile.py b/recipes/aeron/all/conanfile.py index a437a1c1fb57a..aef0519cfd69a 100644 --- a/recipes/aeron/all/conanfile.py +++ b/recipes/aeron/all/conanfile.py @@ -1,45 +1,50 @@ -import os -import shutil +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import collect_libs, copy, get, replace_in_file, rename, rm +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import glob -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration - +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class AeronConan(ConanFile): name = "aeron" description = "Efficient reliable UDP unicast, UDP multicast, and IPC message transport" - topics = ("conan", "aeron", "udp", "messaging", "low-latency") + topics = ("udp", "messaging", "low-latency") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/real-logic/aeron/wiki" license = "Apache-2.0" - exports_sources = "CMakeLists.txt", + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "build_aeron_driver": [True, False], - "build_aeron_archive_api": [True, False] + "build_aeron_archive_api": [True, False], } default_options = { "shared": False, "fPIC": True, "build_aeron_driver": True, - "build_aeron_archive_api": True + "build_aeron_archive_api": True, } - generators = "cmake" - - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "11" @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "5", + } def config_options(self): if self.settings.os == 'Windows': @@ -47,95 +52,94 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def build_requirements(self): - self.build_requires("zulu-openjdk/11.0.8") + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version) - - minimal_version = { - "Visual Studio": "16", - "gcc": "5" - } - - if compiler in minimal_version and compiler_version < minimal_version[compiler]: + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - "{} requires {} compiler {} or newer [is: {}]".format(self.name, compiler, minimal_version[compiler], compiler_version) + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) + if self.settings.os == "Macos" and self.settings.arch == "armv8": raise ConanInvalidConfiguration("This platform (os=Macos arch=armv8) is not yet supported by this recipe") - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["AERON_INSTALL_TARGETS"] = True - self._cmake.definitions["BUILD_AERON_DRIVER"] = self.options.build_aeron_driver - self._cmake.definitions["AERON_TESTS"] = False - self._cmake.definitions["AERON_BUILD_SAMPLES"] = False - self._cmake.definitions["BUILD_AERON_ARCHIVE_API"] = self.options.build_aeron_archive_api - self._cmake.definitions["AERON_ENABLE_NONSTANDARD_OPTIMIZATIONS"] = True + def build_requirements(self): + self.tool_requires("zulu-openjdk/11.0.15") - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_AERON_DRIVER"] = self.options.build_aeron_driver + tc.cache_variables["BUILD_AERON_ARCHIVE_API"] = self.options.build_aeron_archive_api + tc.cache_variables["AERON_TESTS"] = False + tc.cache_variables["AERON_SYSTEM_TESTS"] = False + tc.cache_variables["AERON_SLOW_SYSTEM_TESTS"] = False + tc.cache_variables["AERON_BUILD_SAMPLES"] = False + tc.cache_variables["AERON_BUILD_DOCUMENTATION"] = False + tc.cache_variables["AERON_INSTALL_TARGETS"] = True + tc.cache_variables["AERON_ENABLE_NONSTANDARD_OPTIMIZATIONS"] = True + tc.generate() def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "/MTd", "") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "/MT", "") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "/MTd", "") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "/MT", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - with tools.chdir(self.package_folder): - for dll in glob.glob(os.path.join("lib", "*.dll")): - shutil.move(dll, "bin") + archive_resources_dir = os.path.join(self.source_folder, "aeron-archive", "src", "main", "resources") + copy(self, "*", src=archive_resources_dir, dst=os.path.join(self.package_folder, "res")) - archive_resources_dir = os.path.join(self._source_subfolder, "aeron-archive", "src", "main", "resources") - self.copy("*", dst="res", src=archive_resources_dir) + archive_include_dir = os.path.join(self.source_folder, "aeron-archive", "src", "main", "cpp", "client") + copy(self, "*.h", src=archive_include_dir, dst=os.path.join(self.package_folder, "include", "aeron-archive")) - archive_include_dir = os.path.join(self._source_subfolder, "aeron-archive", "src", "main", "cpp", "client") - self.copy("*.h", dst=os.path.join("include", "aeron-archive"), src=archive_include_dir) + lib_folder = os.path.join(self.package_folder, "lib") + bin_folder = os.path.join(self.package_folder, "bin") + for dll in glob.glob(os.path.join(lib_folder, "*.dll")): + rename(self, dll, os.path.join(bin_folder, os.path.basename(dll))) - libs_folder = os.path.join(self.package_folder, "lib") if self.options.shared: - tools.remove_files_by_mask(libs_folder, "*.a") - tools.remove_files_by_mask(libs_folder, "*static.lib") - tools.remove_files_by_mask(libs_folder, "aeron_client.lib") + for lib in glob.glob(os.path.join(lib_folder, "*.a")): + if not lib.endswith(".dll.a"): + os.remove(lib) + rm(self, "*static.lib", lib_folder) + rm(self, "aeron_client.lib", lib_folder) else: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.dll") - tools.remove_files_by_mask(libs_folder, "*.so") - tools.remove_files_by_mask(libs_folder, "*.dylib") - tools.remove_files_by_mask(libs_folder, "*shared.lib") - tools.remove_files_by_mask(libs_folder, "aeron.lib") + rm(self, "*.dll", bin_folder) + rm(self, "*.so*", lib_folder) + rm(self, "*.dylib", lib_folder) + rm(self, "*.dll.a", lib_folder) + rm(self, "*shared.lib", lib_folder) + rm(self, "aeron.lib", lib_folder) def package_info(self): - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - self.cpp_info.libs = tools.collect_libs(self) - if self.settings.compiler == "Visual Studio": + self.cpp_info.libs = collect_libs(self) + if is_msvc(self): self.cpp_info.defines.append("_ENABLE_EXTENDED_ALIGNED_STORAGE") - - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["m", "pthread"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["dl", "m", "pthread"]) elif self.settings.os == "Windows": - self.cpp_info.system_libs = ["wsock32", "ws2_32", "Iphlpapi"] + self.cpp_info.system_libs = ["winmm", "wsock32", "ws2_32", "iphlpapi"] self.cpp_info.defines.append("HAVE_WSAPOLL") + + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/aeron/all/test_package/CMakeLists.txt b/recipes/aeron/all/test_package/CMakeLists.txt index 8bc5f760e7cf7..a3773bc5e7424 100644 --- a/recipes/aeron/all/test_package/CMakeLists.txt +++ b/recipes/aeron/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.6.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(aeron CONFIG REQUIRED) +find_package(aeron REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} aeron::aeron) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE aeron::aeron) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/aeron/all/test_package/conanfile.py b/recipes/aeron/all/test_package/conanfile.py index 3ee36e2493a5f..98ab55852ad56 100644 --- a/recipes/aeron/all/test_package/conanfile.py +++ b/recipes/aeron/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools, RunEnvironment class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aeron/all/test_v1_package/CMakeLists.txt b/recipes/aeron/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/aeron/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aeron/all/test_v1_package/conanfile.py b/recipes/aeron/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/aeron/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aeron/config.yml b/recipes/aeron/config.yml index 33785dfd3b513..0c20e51036f8b 100644 --- a/recipes/aeron/config.yml +++ b/recipes/aeron/config.yml @@ -7,5 +7,3 @@ versions: folder: all "1.32.0": folder: all - "1.31.2": - folder: all diff --git a/recipes/alac/all/CMakeLists.txt b/recipes/alac/all/CMakeLists.txt index 824a71b493f3a..fe2d89ad21170 100644 --- a/recipes/alac/all/CMakeLists.txt +++ b/recipes/alac/all/CMakeLists.txt @@ -3,11 +3,11 @@ project(alac LANGUAGES C CXX) include(GNUInstallDirs) -file(GLOB ALAC_LIB_SRCS src/codec/*.c src/codec/*.cpp) -file(GLOB ALAC_LIB_PUBLIC_HDRS src/codec/ALAC*.h) +file(GLOB ALAC_LIB_SRCS ${ALAC_SRC_DIR}/codec/*.c ${ALAC_SRC_DIR}/codec/*.cpp) +file(GLOB ALAC_LIB_PUBLIC_HDRS ${ALAC_SRC_DIR}/codec/ALAC*.h) add_library(alac ${ALAC_LIB_SRCS}) -target_include_directories(alac PUBLIC src/codec) +target_include_directories(alac PUBLIC ${ALAC_SRC_DIR}/codec) set_property(TARGET alac PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS TRUE) target_compile_definitions(alac PRIVATE @@ -21,7 +21,7 @@ install(TARGETS alac ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) if(ALAC_BUILD_UTILITY) - file(GLOB ALAC_CONVERTER_SRCS src/convert-utility/*.cpp) + file(GLOB ALAC_CONVERTER_SRCS ${ALAC_SRC_DIR}/convert-utility/*.cpp) add_executable(alacconvert ${ALAC_CONVERTER_SRCS}) target_link_libraries(alacconvert PRIVATE alac) diff --git a/recipes/alac/all/conanfile.py b/recipes/alac/all/conanfile.py index 1c265220e3e81..03e8814c8b1fd 100644 --- a/recipes/alac/all/conanfile.py +++ b/recipes/alac/all/conanfile.py @@ -1,9 +1,10 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get +from conan.tools.scm import Version import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.52.0" class AlacConan(ConanFile): @@ -35,7 +36,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass def layout(self): cmake_layout(self, src_folder="src") @@ -46,6 +50,7 @@ def source(self): def generate(self): tc = CMakeToolchain(self) + tc.variables["ALAC_SRC_DIR"] = self.source_folder.replace("\\", "/") tc.variables["ALAC_BUILD_UTILITY"] = self.options.utility tc.generate() @@ -62,7 +67,5 @@ def package(self): def package_info(self): self.cpp_info.libs = ["alac"] - if self.options.utility: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + if Version(conan_version).major < 2 and self.options.utility: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/alac/all/test_package/CMakeLists.txt b/recipes/alac/all/test_package/CMakeLists.txt index 20135a2b359e3..237396b4c3323 100644 --- a/recipes/alac/all/test_package/CMakeLists.txt +++ b/recipes/alac/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) find_package(alac REQUIRED CONFIG) diff --git a/recipes/alac/all/test_package/conanfile.py b/recipes/alac/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/alac/all/test_package/conanfile.py +++ b/recipes/alac/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/alac/all/test_v1_package/CMakeLists.txt b/recipes/alac/all/test_v1_package/CMakeLists.txt index 00f950dcb21f6..6e042a1c74181 100644 --- a/recipes/alac/all/test_v1_package/CMakeLists.txt +++ b/recipes/alac/all/test_v1_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) diff --git a/recipes/alac/all/test_v1_package/conanfile.py b/recipes/alac/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/alac/all/test_v1_package/conanfile.py +++ b/recipes/alac/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/alembic/all/CMakeLists.txt b/recipes/alembic/all/CMakeLists.txt deleted file mode 100644 index 6963462d91a16..0000000000000 --- a/recipes/alembic/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -find_package(OpenEXR REQUIRED) - -add_subdirectory("source_subfolder") diff --git a/recipes/alembic/all/conandata.yml b/recipes/alembic/all/conandata.yml index 76ff4d49ed9fe..bf7fb209af8bc 100644 --- a/recipes/alembic/all/conandata.yml +++ b/recipes/alembic/all/conandata.yml @@ -7,8 +7,6 @@ sources: sha256: "3f1c466ee1600578689b32b1f2587066d3259704ec7ed1fcf80c324d01274f48" patches: "1.8.3": - - patch_file: "patches/cmake-compiler-directories-1.8.2.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.8.2-0001-fix-cmake.patch" "1.8.2": - - patch_file: "patches/cmake-compiler-directories-1.8.2.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.8.2-0001-fix-cmake.patch" diff --git a/recipes/alembic/all/conanfile.py b/recipes/alembic/all/conanfile.py index e03670713f2da..73264829b63a3 100644 --- a/recipes/alembic/all/conanfile.py +++ b/recipes/alembic/all/conanfile.py @@ -1,14 +1,17 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class AlembicConan(ConanFile): name = "alembic" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/alembic/alembic" + homepage = "http://www.alembic.io" description = "Open framework for storing and sharing scene data." topics = ("3d", "scene", "geometry", "graphics") @@ -24,21 +27,8 @@ class AlembicConan(ConanFile): "with_hdf5": False, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -46,60 +36,61 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("openexr/2.5.7") + self.requires("imath/3.1.6") if self.options.with_hdf5: - self.requires("hdf5/1.12.0") + self.requires("hdf5/1.14.0") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USE_ARNOLD"] = False - self._cmake.definitions["USE_MAYA"] = False - self._cmake.definitions["USE_PRMAN"] = False - self._cmake.definitions["USE_PYALEMBIC"] = False - self._cmake.definitions["USE_BINARIES"] = False - self._cmake.definitions["USE_EXAMPLES"] = False - self._cmake.definitions["USE_HDF5"] = self.options.with_hdf5 - self._cmake.definitions["USE_TESTS"] = False - self._cmake.definitions["ALEMBIC_BUILD_LIBS"] = True - self._cmake.definitions["ALEMBIC_ILMBASE_LINK_STATIC"] = True # for -DOPENEXR_DLL, handled by OpenEXR package - self._cmake.definitions["ALEMBIC_SHARED_LIBS"] = self.options.shared - self._cmake.definitions["ALEMBIC_USING_IMATH_3"] = False - self._cmake.definitions["ALEMBIC_ILMBASE_FOUND"] = 1 - self._cmake.definitions["ALEMBIC_ILMBASE_LIBS"] = "OpenEXR::OpenEXR" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_ARNOLD"] = False + tc.variables["USE_MAYA"] = False + tc.variables["USE_PRMAN"] = False + tc.variables["USE_PYALEMBIC"] = False + tc.variables["USE_BINARIES"] = False + tc.variables["USE_EXAMPLES"] = False + tc.variables["USE_HDF5"] = self.options.with_hdf5 + tc.variables["USE_TESTS"] = False + tc.variables["ALEMBIC_BUILD_LIBS"] = True + tc.variables["ALEMBIC_ILMBASE_LINK_STATIC"] = True # for -DOPENEXR_DLL, handled by OpenEXR package + tc.variables["ALEMBIC_SHARED_LIBS"] = self.options.shared + tc.variables["ALEMBIC_USING_IMATH_3"] = False + tc.variables["ALEMBIC_ILMBASE_FOUND"] = 1 + tc.variables["ALEMBIC_ILMBASE_LIBS"] = "OpenEXR::OpenEXR" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses", keep_path=False) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Alembic") self.cpp_info.set_property("cmake_target_name", "Alembic::Alembic") self.cpp_info.libs = ["Alembic"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "Alembic" diff --git a/recipes/alembic/all/patches/1.8.2-0001-fix-cmake.patch b/recipes/alembic/all/patches/1.8.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..8b83f19775d82 --- /dev/null +++ b/recipes/alembic/all/patches/1.8.2-0001-fix-cmake.patch @@ -0,0 +1,57 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -99,9 +99,6 @@ SET(DARWIN FALSE) + IF ("${CMAKE_SYSTEM_NAME}" MATCHES "Darwin") + SET(DARWIN TRUE) + # suppress rpath warning +- IF (POLICY CMP0042) +- CMAKE_POLICY(SET CMP0042 OLD) +- ENDIF() + ENDIF() + + IF (APPLE) +@@ -127,7 +124,6 @@ ENDIF() + + # Set some debug vs opt flags + if ("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND NOT MSVC) +- add_definitions(-Wall -Werror -Wextra -Wno-unused-parameter -Wno-deprecated) + if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0) OR + CMAKE_CXX_COMPILER_ID MATCHES "CLANG") + add_definitions( -Wno-error=implicit-fallthrough) +@@ -215,7 +211,6 @@ INCLUDE("./cmake/AlembicIlmBase.cmake") + + # HDF5 + IF (USE_HDF5) +- FIND_PACKAGE(ZLIB REQUIRED) + SET(ALEMBIC_WITH_HDF5 "1") + INCLUDE("./cmake/AlembicHDF5.cmake") + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DH5_USE_18_API") +--- a/lib/Alembic/CMakeLists.txt ++++ b/lib/Alembic/CMakeLists.txt +@@ -69,21 +69,20 @@ ENDIF() + + + TARGET_LINK_LIBRARIES(Alembic +- LINK_PUBLIC ++ PUBLIC + ${ALEMBIC_ILMBASE_LIBS} + ${CMAKE_THREAD_LIBS_INIT} + ${EXTERNAL_MATH_LIBS} +- LINK_PRIVATE ++ PRIVATE + ${HDF5_LIBRARIES} +- ${ZLIB_LIBRARY} + ) + + SET( ALEMBIC_LIB_INSTALL_DIR lib CACHE PATH "Where to install the Alembic libs") + INSTALL(TARGETS Alembic + EXPORT AlembicTargets +- LIBRARY DESTINATION ${ALEMBIC_LIB_INSTALL_DIR} +- ARCHIVE DESTINATION ${ALEMBIC_LIB_INSTALL_DIR} +- RUNTIME DESTINATION ${ALEMBIC_LIB_INSTALL_DIR}) ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + + #-****************************************************************************** + # PACKAGE EXPORTS diff --git a/recipes/alembic/all/patches/cmake-compiler-directories-1.8.2.patch b/recipes/alembic/all/patches/cmake-compiler-directories-1.8.2.patch deleted file mode 100644 index 855dbf19d51cc..0000000000000 --- a/recipes/alembic/all/patches/cmake-compiler-directories-1.8.2.patch +++ /dev/null @@ -1,67 +0,0 @@ -diff '--color=auto' -Naur ./CMakeLists.txt ./CMakeLists.txt ---- ./CMakeLists.txt 2021-08-23 14:34:04.141208518 +0300 -+++ ./CMakeLists.txt 2021-08-23 14:42:28.163384280 +0300 -@@ -115,8 +115,8 @@ - - # if not set fall back to VFX reference platform 2018 to 2020 - IF ("${CMAKE_CXX_STANDARD}" STREQUAL "") -- MESSAGE("Defaulting CMAKE_CXX_STANDARD to 14") -- SET(CMAKE_CXX_STANDARD 14) -+ MESSAGE("Defaulting CMAKE_CXX_STANDARD to 11") -+ SET(CMAKE_CXX_STANDARD 11) - SET(CMAKE_CXX_STANDARD_REQUIRED ON) - ENDIF() - -@@ -127,7 +127,7 @@ - - # Set some debug vs opt flags - if ("${CMAKE_BUILD_TYPE}" MATCHES "Debug" AND NOT MSVC) -- add_definitions(-Wall -Werror -Wextra -Wno-unused-parameter -Wno-deprecated) -+ add_definitions(-Wall -Wextra -Wno-unused-parameter -Wno-deprecated) - if((CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 7.0) OR - CMAKE_CXX_COMPILER_ID MATCHES "CLANG") - add_definitions( -Wno-error=implicit-fallthrough) -@@ -210,9 +210,6 @@ - FIND_PACKAGE(Doxygen) - ENDIF() - --# IlmBase --INCLUDE("./cmake/AlembicIlmBase.cmake") -- - # HDF5 - IF (USE_HDF5) - FIND_PACKAGE(ZLIB REQUIRED) -@@ -228,7 +225,7 @@ - # Alembic - IF (ALEMBIC_BUILD_LIBS) - ADD_SUBDIRECTORY(lib) -- INCLUDE_DIRECTORIES("${CMAKE_SOURCE_DIR}/lib" "${PROJECT_BINARY_DIR}/lib") -+ INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/lib" "${PROJECT_BINARY_DIR}/lib") - ADD_LIBRARY( Alembic::Alembic ALIAS Alembic ) - ELSE() - FIND_PACKAGE(Alembic REQUIRED CONFIG HINTS ${ALEMBIC_ROOT}) -diff '--color=auto' -Naur ./lib/Alembic/CMakeLists.txt ./lib/Alembic/CMakeLists.txt ---- ./lib/Alembic/CMakeLists.txt 2021-08-23 14:34:04.155208355 +0300 -+++ ./lib/Alembic/CMakeLists.txt 2021-08-23 14:43:52.417413762 +0300 -@@ -52,7 +52,7 @@ - - TARGET_INCLUDE_DIRECTORIES(Alembic - PUBLIC -- $ -+ $ - $ - $/include> - ${ALEMBIC_ILMBASE_INCLUDE_DIRECTORY} -@@ -81,9 +81,9 @@ - SET( ALEMBIC_LIB_INSTALL_DIR lib CACHE PATH "Where to install the Alembic libs") - INSTALL(TARGETS Alembic - EXPORT AlembicTargets -- LIBRARY DESTINATION ${ALEMBIC_LIB_INSTALL_DIR} -- ARCHIVE DESTINATION ${ALEMBIC_LIB_INSTALL_DIR} -- RUNTIME DESTINATION ${ALEMBIC_LIB_INSTALL_DIR}) -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - - #-****************************************************************************** - # PACKAGE EXPORTS diff --git a/recipes/alembic/all/test_package/CMakeLists.txt b/recipes/alembic/all/test_package/CMakeLists.txt index 6bec164e6563c..e152ce5e9421a 100644 --- a/recipes/alembic/all/test_package/CMakeLists.txt +++ b/recipes/alembic/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(Alembic REQUIRED) +find_package(Alembic REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Alembic::Alembic) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE Alembic::Alembic) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/alembic/all/test_package/conanfile.py b/recipes/alembic/all/test_package/conanfile.py index 3da371b660e0a..98ab55852ad56 100644 --- a/recipes/alembic/all/test_package/conanfile.py +++ b/recipes/alembic/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/alembic/all/test_v1_package/CMakeLists.txt b/recipes/alembic/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/alembic/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/alembic/all/test_v1_package/conanfile.py b/recipes/alembic/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/alembic/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/alpaca/all/conandata.yml b/recipes/alpaca/all/conandata.yml new file mode 100644 index 0000000000000..4be0a369c7f9a --- /dev/null +++ b/recipes/alpaca/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.2.1": + url: "https://github.com/p-ranav/alpaca/archive/refs/tags/v0.2.1.tar.gz" + sha256: "05d49a2dc9c6a9e07c0cbc4e26caec273a8666270c82d7c3f0ede4f3a9258f4e" diff --git a/recipes/alpaca/all/conanfile.py b/recipes/alpaca/all/conanfile.py new file mode 100644 index 0000000000000..a7227d4427d29 --- /dev/null +++ b/recipes/alpaca/all/conanfile.py @@ -0,0 +1,69 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.52.0" + + +class AlpacaConan(ConanFile): + name = "alpaca" + description = "Serialization library written in C++17 - Pack C++ structs into a compact byte-array without any macros or boilerplate code" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/p-ranav/alpaca" + topics = ("reflection", "checksum", "serialization", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("pkg_config_name", "alpaca") diff --git a/recipes/alpaca/all/test_package/CMakeLists.txt b/recipes/alpaca/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..790a5eaae638a --- /dev/null +++ b/recipes/alpaca/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(alpaca REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE alpaca::alpaca) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/alpaca/all/test_package/conanfile.py b/recipes/alpaca/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/alpaca/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/alpaca/all/test_package/test_package.cpp b/recipes/alpaca/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..0134e1d6e0d2d --- /dev/null +++ b/recipes/alpaca/all/test_package/test_package.cpp @@ -0,0 +1,35 @@ +#include + +struct Config { + std::string device; + std::pair resolution; + std::array K_matrix; + std::vector distortion_coeffients; + std::map> parameters; +}; + +int main() { + // Construct the object + Config c{"/dev/video0", {640, 480}, + {223.28249888247538, 0.0, 152.30570853111396, + 0.0, 223.8756535707556, 124.5606000035353, + 0.0, 0.0, 1.0}, + {-0.44158343539568284, 0.23861463831967872, 0.0016338407443826572, + 0.0034950038632981604, -0.05239245892096022}, + {{"start_server", bool{true}}, + {"max_depth", uint16_t{5}}, + {"model_path", std::string{"foo/bar.pt"}}}}; + + // Serialize + std::vector bytes; + auto bytes_written = alpaca::serialize(c, bytes); + + // Deserialize + std::error_code ec; + auto object = alpaca::deserialize(bytes, ec); + if (ec) { + return 1; + } + return 0; +} + diff --git a/recipes/alpaca/all/test_v1_package/CMakeLists.txt b/recipes/alpaca/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0aeb3e1d92584 --- /dev/null +++ b/recipes/alpaca/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) # if the project is pure C +project(test_package LANGUAGES CXX) # if the project uses c++ + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/alpaca/all/test_v1_package/conanfile.py b/recipes/alpaca/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/alpaca/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/alpaca/config.yml b/recipes/alpaca/config.yml new file mode 100644 index 0000000000000..f975c1e3261f7 --- /dev/null +++ b/recipes/alpaca/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.1": + folder: all diff --git a/recipes/amgcl/all/conandata.yml b/recipes/amgcl/all/conandata.yml index 97da314dcfe0d..cbd774ff5f231 100644 --- a/recipes/amgcl/all/conandata.yml +++ b/recipes/amgcl/all/conandata.yml @@ -7,4 +7,4 @@ sources: sha256: "db0de6b75e6c205f44542c3ac8d9935c8357a58072963228d0bb11a54181aea8" "1.4.0": url: "https://github.com/ddemidov/amgcl/archive/refs/tags/1.4.0.tar.gz" - sha256: 018b824396494c8958faa6337cebcaba48a2584d828f279eef0bbf9e05f900a7 + sha256: "018b824396494c8958faa6337cebcaba48a2584d828f279eef0bbf9e05f900a7" diff --git a/recipes/amgcl/all/conanfile.py b/recipes/amgcl/all/conanfile.py index 684b4b4d4041e..d2ddd6171e66f 100644 --- a/recipes/amgcl/all/conanfile.py +++ b/recipes/amgcl/all/conanfile.py @@ -1,34 +1,52 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.51.1" -class UncrustifyConan(ConanFile): + +class AmgclConan(ConanFile): name = "amgcl" + description = ( + "AMGCL is a header-only C++ library for solving large sparse linear " + "systems with algebraic multigrid (AMG) method." + ) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ddemidov/amgcl" topics = ("mathematics", "opencl", "openmp", "cuda", "amg") license = "MIT" - description = "AMGCL is a header-only C++ library for solving large sparse linear systems with algebraic multigrid (AMG) method." - settings = "compiler" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - requires = [("boost/1.76.0")] - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("boost/1.81.0") + + def package_id(self): + self.info.clear() def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE.md", src=self._source_subfolder, dst="licenses") - self.copy("*", - dst=os.path.join("include", "amgcl"), - src=(os.path.join(self._source_subfolder, "amgcl"))) + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "amgcl"), + dst=os.path.join(self.package_folder, "include", "amgcl")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "amgcl") + self.cpp_info.set_property("cmake_target_name", "amgcl::amgcl") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/amgcl/all/test_package/CMakeLists.txt b/recipes/amgcl/all/test_package/CMakeLists.txt index 70e150a06e203..9a31b491cc133 100644 --- a/recipes/amgcl/all/test_package/CMakeLists.txt +++ b/recipes/amgcl/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(amgcl REQUIRED CONFIG) -add_executable(solver solver.cpp) -target_link_libraries(solver ${CONAN_LIBS}) -set_property(TARGET solver PROPERTY CXX_STANDARD 11) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE amgcl::amgcl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/amgcl/all/test_package/conanfile.py b/recipes/amgcl/all/test_package/conanfile.py index cfb088ed67795..0a6bc68712d90 100644 --- a/recipes/amgcl/all/test_package/conanfile.py +++ b/recipes/amgcl/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" -class AmgclTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "solver") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/amgcl/all/test_package/solver.cpp b/recipes/amgcl/all/test_package/test_package.cpp similarity index 100% rename from recipes/amgcl/all/test_package/solver.cpp rename to recipes/amgcl/all/test_package/test_package.cpp diff --git a/recipes/amgcl/all/test_v1_package/CMakeLists.txt b/recipes/amgcl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/amgcl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/amgcl/all/test_v1_package/conanfile.py b/recipes/amgcl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/amgcl/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/amqp-cpp/all/CMakeLists.txt b/recipes/amqp-cpp/all/CMakeLists.txt deleted file mode 100644 index dddebcc68cdb4..0000000000000 --- a/recipes/amqp-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/amqp-cpp/all/conandata.yml b/recipes/amqp-cpp/all/conandata.yml index b1762b6aca57f..063e7eada3339 100644 --- a/recipes/amqp-cpp/all/conandata.yml +++ b/recipes/amqp-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.3.18": + url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.3.18.tar.gz" + sha256: "cc2c1fc5da00a1778c2804306e06bdedc782a5f74762b9d9b442d3a498dd0c4f" "4.3.16": url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.3.16.tar.gz" sha256: "66c96e0db1efec9e7ddcf7240ff59a073d68c09752bd3e94b8bc4c506441fbf7" @@ -21,24 +24,19 @@ sources: url: "https://github.com/CopernicaMarketingSoftware/AMQP-CPP/archive/v4.1.5.tar.gz" sha256: "9840c7fb17bb0c0b601d269e528b7f9cac5ec008dcf8d66bef22434423b468aa" patches: + "4.3.18": + - patch_file: "patches/0001-cmake-openssl-install-directories.patch" "4.3.16": - patch_file: "patches/0001-cmake-openssl-install-directories.patch" - base_path: "source_subfolder" "4.3.11": - patch_file: "patches/0001-cmake-openssl-install-directories.patch" - base_path: "source_subfolder" "4.3.10": - patch_file: "patches/0001-cmake-openssl-install-directories.patch" - base_path: "source_subfolder" "4.2.1": - patch_file: "patches/0001-cmake-openssl-install-directories.patch" - base_path: "source_subfolder" "4.1.7": - patch_file: "patches/0001-cmake-openssl-install-directories.patch" - base_path: "source_subfolder" "4.1.6": - patch_file: "patches/0001-cmake-openssl-install-directories.patch" - base_path: "source_subfolder" "4.1.5": - patch_file: "patches/0001-cmake-openssl-install-directories.patch" - base_path: "source_subfolder" diff --git a/recipes/amqp-cpp/all/conanfile.py b/recipes/amqp-cpp/all/conanfile.py index 6b5d9c2631df0..efcd52d23c58e 100644 --- a/recipes/amqp-cpp/all/conanfile.py +++ b/recipes/amqp-cpp/all/conanfile.py @@ -1,8 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class AmqpcppConan(ConanFile): @@ -25,21 +27,8 @@ class AmqpcppConan(ConanFile): "linux_tcp_module": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -48,41 +37,40 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.get_safe("linux_tcp_module"): - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["AMQP-CPP_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["AMQP-CPP_BUILD_EXAMPLES"] = False - self._cmake.definitions["AMQP-CPP_LINUX_TCP"] = self.options.get_safe("linux_tcp_module") or False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["AMQP-CPP_BUILD_SHARED"] = self.options.shared + tc.variables["AMQP-CPP_BUILD_EXAMPLES"] = False + tc.variables["AMQP-CPP_LINUX_TCP"] = self.options.get_safe("linux_tcp_module", False) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() - cmake.install() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", src=self._source_subfolder, dst="licenses", keep_path=False) - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -90,21 +78,20 @@ def package(self): {"amqpcpp": "amqpcpp::amqpcpp"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "amqpcpp") @@ -112,7 +99,9 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "amqpcpp") self.cpp_info.libs = ["amqpcpp"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["dl", "pthread"] + self.cpp_info.system_libs = ["dl", "m", "pthread"] + elif self.settings.os == "Windows": + self.cpp_info.system_libs = ["ws2_32"] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["pkg_config"] = "amqpcpp" diff --git a/recipes/amqp-cpp/all/patches/0001-cmake-openssl-install-directories.patch b/recipes/amqp-cpp/all/patches/0001-cmake-openssl-install-directories.patch index 31d848a28a771..f47d6bd4b19df 100644 --- a/recipes/amqp-cpp/all/patches/0001-cmake-openssl-install-directories.patch +++ b/recipes/amqp-cpp/all/patches/0001-cmake-openssl-install-directories.patch @@ -1,12 +1,13 @@ --- CMakeLists.txt +++ CMakeLists.txt -@@ -88,7 +88,9 @@ +@@ -88,7 +88,10 @@ #add_library(${PROJECT_NAME} STATIC ${SRCS}) add_library(${PROJECT_NAME} STATIC ${src_MAIN} ${src_LINUX_TCP}) endif() - +if(AMQP-CPP_LINUX_TCP) -+target_link_libraries(${PROJECT_NAME} CONAN_PKG::openssl) ++find_package(OpenSSL REQUIRED) ++target_link_libraries(${PROJECT_NAME} OpenSSL::SSL OpenSSL::Crypto) +endif() # install rules # ------------------------------------------------------------------------------------------------------ diff --git a/recipes/amqp-cpp/all/test_package/CMakeLists.txt b/recipes/amqp-cpp/all/test_package/CMakeLists.txt index 0fcd0b264d027..bbc10e2424b6b 100644 --- a/recipes/amqp-cpp/all/test_package/CMakeLists.txt +++ b/recipes/amqp-cpp/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(amqpcpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} amqpcpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE amqpcpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/amqp-cpp/all/test_package/conanfile.py b/recipes/amqp-cpp/all/test_package/conanfile.py index a500b98343c74..0a6bc68712d90 100644 --- a/recipes/amqp-cpp/all/test_package/conanfile.py +++ b/recipes/amqp-cpp/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/amqp-cpp/all/test_v1_package/CMakeLists.txt b/recipes/amqp-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/amqp-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/amqp-cpp/all/test_v1_package/conanfile.py b/recipes/amqp-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/amqp-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/amqp-cpp/config.yml b/recipes/amqp-cpp/config.yml index 25894cbf035c2..81db570a6cd83 100644 --- a/recipes/amqp-cpp/config.yml +++ b/recipes/amqp-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "4.3.18": + folder: all "4.3.16": folder: all "4.3.11": diff --git a/recipes/android-ndk/all/conandata.yml b/recipes/android-ndk/all/conandata.yml index 8bc387caae19b..3276410e65493 100644 --- a/recipes/android-ndk/all/conandata.yml +++ b/recipes/android-ndk/all/conandata.yml @@ -1,4 +1,30 @@ sources: + "r25c": + "Windows": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r25c-windows.zip" + sha256: "f70093964f6cbbe19268f9876a20f92d3a593db3ad2037baadd25fd8d71e84e2" + "Linux": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r25c-linux.zip" + sha256: "769ee342ea75f80619d985c2da990c48b3d8eaf45f48783a2d48870d04b46108" + "Macos": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r25c-darwin.zip" + sha256: "b01bae969a5d0bfa0da18469f650a1628dc388672f30e0ba231da5c74245bc92" + "r25b": + "Windows": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r25b-windows.zip" + sha256: "c9a72beda4663ab714c9fb3dc06bb9b9f124f2b5199957c86cd6f57eb59fd49a" + "Linux": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r25b-linux.zip" + sha256: "403ac3e3020dd0db63a848dcaba6ceb2603bf64de90949d5c4361f848e44b005" + "Macos": + "x86_64": + url: "https://dl.google.com/android/repository/android-ndk-r25b-darwin.zip" + sha256: "7e12f1f809878d4f5d5a901809277aa31546d36c10730fade2036d7d95b3607a" "r25": "Windows": "x86_64": diff --git a/recipes/android-ndk/all/conanfile.py b/recipes/android-ndk/all/conanfile.py index 5e792a8a7deac..7d9d0cacc05ec 100644 --- a/recipes/android-ndk/all/conanfile.py +++ b/recipes/android-ndk/all/conanfile.py @@ -1,12 +1,13 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration from conan.tools.files import get, download, unzip, load, copy from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os import re import shutil -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.52.0" class AndroidNDKConan(ConanFile): @@ -22,13 +23,15 @@ class AndroidNDKConan(ConanFile): short_paths = True exports_sources = "cmake-wrapper.cmd", "cmake-wrapper" - @property - def _is_universal2(self): - return self.version in ["r23b", "r23c", "r24", "r25"] and self.settings.os == "Macos" and self.settings.arch in ["x86_64", "armv8"] + def _is_universal2(self, info=False): + settings = self.info.settings if info else self.settings + major, minor = self._ndk_major_minor + return ((major == 23 and minor >= "b") or major >= 24) and \ + settings.os == "Macos" and settings.arch in ["x86_64", "armv8"] @property def _arch(self): - return "x86_64" if self._is_universal2 else self.settings.arch + return "x86_64" if self._is_universal2() else self.settings.arch @property def _settings_os_supported(self): @@ -38,8 +41,11 @@ def _settings_os_supported(self): def _settings_arch_supported(self): return self.conan_data["sources"][self.version].get(str(self.settings.os), {}).get(str(self._arch)) is not None + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): - if self._is_universal2: + if self._is_universal2(info=True): self.info.settings.arch = "universal:armv8/x86_64" del self.info.settings.compiler del self.info.settings.build_type @@ -50,14 +56,12 @@ def validate(self): if not self._settings_arch_supported: raise ConanInvalidConfiguration(f"os,arch={self.settings.os},{self.settings.arch} is not supported by {self.name} (no binaries are available)") - def layout(self): - basic_layout(self, src_folder="src") - def source(self): pass def build(self): - if self.version in ['r23', 'r23b', 'r23c', 'r24', 'r25']: + major, _ = self._ndk_major_minor + if major >= 23: data = self.conan_data["sources"][self.version][str(self.settings.os)][str(self._arch)] self._unzip_fix_symlinks(url=data["url"], target_folder=self.source_folder, sha256=data["sha256"]) else: @@ -65,11 +69,11 @@ def build(self): destination=self.source_folder, strip_root=True) def package(self): - copy(self, "*", src=self.source_folder, dst=self.package_folder, keep_path=True) + copy(self, "*", src=self.source_folder, dst=os.path.join(self.package_folder, "bin")) copy(self, "*NOTICE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) copy(self, "*NOTICE.toolchain", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - copy(self, "cmake-wrapper.cmd", src=os.path.join(self.source_folder, os.pardir), dst=self.package_folder) - copy(self, "cmake-wrapper", src=os.path.join(self.source_folder, os.pardir), dst=self.package_folder) + copy(self, "cmake-wrapper.cmd", src=os.path.join(self.source_folder, os.pardir), dst=os.path.join(self.package_folder, "bin")) + copy(self, "cmake-wrapper", src=os.path.join(self.source_folder, os.pardir), dst=os.path.join(self.package_folder, "bin")) self._fix_broken_links() self._fix_permissions() @@ -133,7 +137,7 @@ def _ndk_version_minor(self): def _fix_permissions(self): if os.name != "posix": return - for root, _, files in os.walk(self.package_folder): + for root, _, files in os.walk(os.path.join(self.package_folder, "bin")): for filename in files: filename = os.path.join(root, filename) with open(filename, "rb") as f: @@ -169,7 +173,7 @@ def _fix_broken_links(self): f"toolchains/llvm/prebuilt/{platform}-x86_64/x86_64-linux-android/bin/as": "../../bin/x86_64-linux-android-as", f"toolchains/llvm/prebuilt/{platform}-x86_64/i686-linux-android/bin/as": "../../bin/i686-linux-android-as"} for path, target in links.items(): - path = os.path.join(self.package_folder, path) + path = os.path.join(self.package_folder, "bin", path) os.unlink(path) os.symlink(target, path) @@ -177,9 +181,13 @@ def _fix_broken_links(self): def _host(self): return f"{self._platform}-{self._arch}" + @property + def _ndk_root_rel_path(self): + return os.path.join("bin", "toolchains", "llvm", "prebuilt", self._host) + @property def _ndk_root(self): - return os.path.join(self.package_folder, "toolchains", "llvm", "prebuilt", self._host) + return os.path.join(self.package_folder, self._ndk_root_rel_path) def _wrap_executable(self, tool): suffix = ".exe" if self.settings_build.os == "Windows" else "" @@ -220,7 +228,6 @@ def _define_tool_var(self, name, value, bare = False): if not os.path.isfile(path): self.output.error(f"'Environment variable {name} could not be created: '{path}'") return "UNKNOWN" - self.output.info(f"Creating {name} environment variable: {path}") return path def _define_tool_var_naked(self, name, value): @@ -229,7 +236,6 @@ def _define_tool_var_naked(self, name, value): if not os.path.isfile(path): self.output.error(f"'Environment variable {name} could not be created: '{path}'") return "UNKNOWN" - self.output.info(f"Creating {name} environment variable: {path}") return path @staticmethod @@ -239,17 +245,14 @@ def _chmod_plus_x(filename): def package_info(self): self.cpp_info.includedirs = [] - - # test shall pass, so this runs also in the build as build requirement context - # ndk-build: https://developer.android.com/ndk/guides/ndk-build - self.cpp_info.bindirs.append(".") + self.cpp_info.libdirs = [] # You should use the ANDROID_NDK_ROOT environment variable to indicate where the NDK is located. # That's what most NDK-related scripts use (inside the NDK, and outside of it). # https://groups.google.com/g/android-ndk/c/qZjhOaynHXc - self.buildenv_info.define_path("ANDROID_NDK_ROOT", self.package_folder) + self.buildenv_info.define_path("ANDROID_NDK_ROOT", os.path.join(self.package_folder, "bin")) - self.buildenv_info.define_path("ANDROID_NDK_HOME", self.package_folder) + self.buildenv_info.define_path("ANDROID_NDK_HOME", os.path.join(self.package_folder, "bin")) # this is not enough, I can kill that ..... if not hasattr(self, "settings_target"): @@ -262,34 +265,32 @@ def package_info(self): # And if we are not building for Android, why bother at all if not self.settings_target.os == "Android": - self.output.warn(f"You've added {self.name}/{self.version} as a build requirement, while os={self.settings_target.os} != Android") + self.output.warning(f"You've added {self.ref} as a build requirement, while os={self.settings_target.os} != Android") return + self.cpp_info.bindirs.append(os.path.join(self._ndk_root_rel_path, "bin")) + self.buildenv_info.define_path("NDK_ROOT", self._ndk_root) self.buildenv_info.define("CHOST", self._llvm_triplet) ndk_sysroot = os.path.join(self._ndk_root, "sysroot") + self.conf_info.define("tools.build:sysroot", ndk_sysroot) self.buildenv_info.define_path("SYSROOT", ndk_sysroot) - self.cpp_info.sysroot = ndk_sysroot - self.buildenv_info.define("ANDROID_NATIVE_API_LEVEL", str(self.settings_target.os.api_level)) - # TODO: It's not clear how this all mechanism of cmake-wrapper should be emulated in conan v2, - # and actually if it matters at all. - # Is it not the purpose of the toolchain defined later to pass all these informations? - self._chmod_plus_x(os.path.join(self.package_folder, "cmake-wrapper")) - cmake_wrapper = "cmake-wrapper.cmd" if self.settings.os == "Windows" else "cmake-wrapper" - cmake_wrapper = os.path.join(self.package_folder, cmake_wrapper) - self.output.info(f"Creating CONAN_CMAKE_PROGRAM environment variable: {cmake_wrapper}") - self.env_info.CONAN_CMAKE_PROGRAM = cmake_wrapper + # CMakeToolchain automatically adds the standard Android toolchain file that ships with the NDK + # when `tools.android:ndk_path` is provided, so it MUST NOT be manually injected here to `tools.cmake.cmaketoolchain:user_toolchain` conf_info + self.conf_info.define("tools.android:ndk_path", os.path.join(self.package_folder, "bin")) - toolchain = os.path.join(self.package_folder, "build", "cmake", "android.toolchain.cmake") - self.conf_info.prepend("tools.cmake.cmaketoolchain:user_toolchain", toolchain) - - self.buildenv_info.define_path("CC", self._define_tool_var("CC", "clang")) - self.buildenv_info.define_path("CXX", self._define_tool_var("CXX", "clang++")) + compiler_executables = { + "c": self._define_tool_var("CC", "clang"), + "cpp": self._define_tool_var("CXX", "clang++"), + } + self.conf_info.update("tools.build:compiler_executables", compiler_executables) + self.buildenv_info.define_path("CC", compiler_executables["c"]) + self.buildenv_info.define_path("CXX", compiler_executables["cpp"]) # Versions greater than 23 had the naming convention # changed to no longer include the triplet. @@ -319,48 +320,51 @@ def package_info(self): libcxx_str = str(self.settings_target.compiler.libcxx) self.buildenv_info.define("ANDROID_STL", libcxx_str if libcxx_str.startswith("c++_") else "c++_shared") - self.conf_info.define("tools.android:ndk_path", self.package_folder) - # TODO: conan v1 stuff to remove later - self.env_info.PATH.append(self.package_folder) - self.env_info.ANDROID_NDK_ROOT = self.package_folder - self.env_info.ANDROID_NDK_HOME = self.package_folder - cmake_system_processor = self._cmake_system_processor - if cmake_system_processor: - self.env_info.CONAN_CMAKE_SYSTEM_PROCESSOR = cmake_system_processor - else: - self.output.warn("Could not find a valid CMAKE_SYSTEM_PROCESSOR variable, supported by CMake") - self.env_info.NDK_ROOT = self._ndk_root - self.env_info.CHOST = self._llvm_triplet - self.env_info.CONAN_CMAKE_FIND_ROOT_PATH = ndk_sysroot - self.env_info.SYSROOT = ndk_sysroot - self.env_info.ANDROID_NATIVE_API_LEVEL = str(self.settings_target.os.api_level) - self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = toolchain - self.env_info.CC = self._define_tool_var("CC", "clang") - self.env_info.CXX = self._define_tool_var("CXX", "clang++") - self.env_info.AR = self._define_tool_var("AR", "ar", bare) - self.env_info.AS = self._define_tool_var("AS", "as", bare) - self.env_info.RANLIB = self._define_tool_var("RANLIB", "ranlib", bare) - self.env_info.STRIP = self._define_tool_var("STRIP", "strip", bare) - self.env_info.ADDR2LINE = self._define_tool_var("ADDR2LINE", "addr2line", bare) - self.env_info.NM = self._define_tool_var("NM", "nm", bare) - self.env_info.OBJCOPY = self._define_tool_var("OBJCOPY", "objcopy", bare) - self.env_info.OBJDUMP = self._define_tool_var("OBJDUMP", "objdump", bare) - self.env_info.READELF = self._define_tool_var("READELF", "readelf", bare) - if self._ndk_version_major < 23: - self.env_info.ELFEDIT = self._define_tool_var("ELFEDIT", "elfedit") - if self._ndk_version_major >= 22: - self.env_info.LD = self._define_tool_var_naked("LD", "ld") - else: - self.env_info.LD = self._define_tool_var("LD", "ld") - self.env_info.ANDROID_PLATFORM = f"android-{self.settings_target.os.api_level}" - self.env_info.ANDROID_TOOLCHAIN = "clang" - self.env_info.ANDROID_ABI = self._android_abi - self.env_info.ANDROID_STL = libcxx_str if libcxx_str.startswith("c++_") else "c++_shared" - self.env_info.CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH" - self.env_info.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "BOTH" - self.env_info.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "BOTH" - self.env_info.CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = "BOTH" + if Version(conan_version).major < 2: + self.env_info.PATH.extend([os.path.join(self.package_folder, "bin"), os.path.join(self._ndk_root, "bin")]) + self.env_info.ANDROID_NDK_ROOT = os.path.join(self.package_folder, "bin") + self.env_info.ANDROID_NDK_HOME = os.path.join(self.package_folder, "bin") + cmake_system_processor = self._cmake_system_processor + if cmake_system_processor: + self.env_info.CONAN_CMAKE_SYSTEM_PROCESSOR = cmake_system_processor + else: + self.output.warning("Could not find a valid CMAKE_SYSTEM_PROCESSOR variable, supported by CMake") + self.env_info.NDK_ROOT = self._ndk_root + self.env_info.CHOST = self._llvm_triplet + self.env_info.CONAN_CMAKE_FIND_ROOT_PATH = ndk_sysroot + self.env_info.SYSROOT = ndk_sysroot + self.env_info.ANDROID_NATIVE_API_LEVEL = str(self.settings_target.os.api_level) + self._chmod_plus_x(os.path.join(self.package_folder, "bin", "cmake-wrapper")) + cmake_wrapper = "cmake-wrapper.cmd" if self.settings.os == "Windows" else "cmake-wrapper" + cmake_wrapper = os.path.join(self.package_folder, "bin", cmake_wrapper) + self.env_info.CONAN_CMAKE_PROGRAM = cmake_wrapper + self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = os.path.join(self.package_folder, "bin", "build", "cmake", "android.toolchain.cmake") + self.env_info.CC = compiler_executables["c"] + self.env_info.CXX = compiler_executables["cpp"] + self.env_info.AR = self._define_tool_var("AR", "ar", bare) + self.env_info.AS = self._define_tool_var("AS", "as", bare) + self.env_info.RANLIB = self._define_tool_var("RANLIB", "ranlib", bare) + self.env_info.STRIP = self._define_tool_var("STRIP", "strip", bare) + self.env_info.ADDR2LINE = self._define_tool_var("ADDR2LINE", "addr2line", bare) + self.env_info.NM = self._define_tool_var("NM", "nm", bare) + self.env_info.OBJCOPY = self._define_tool_var("OBJCOPY", "objcopy", bare) + self.env_info.OBJDUMP = self._define_tool_var("OBJDUMP", "objdump", bare) + self.env_info.READELF = self._define_tool_var("READELF", "readelf", bare) + if self._ndk_version_major < 23: + self.env_info.ELFEDIT = self._define_tool_var("ELFEDIT", "elfedit") + if self._ndk_version_major >= 22: + self.env_info.LD = self._define_tool_var_naked("LD", "ld") + else: + self.env_info.LD = self._define_tool_var("LD", "ld") + self.env_info.ANDROID_PLATFORM = f"android-{self.settings_target.os.api_level}" + self.env_info.ANDROID_TOOLCHAIN = "clang" + self.env_info.ANDROID_ABI = self._android_abi + self.env_info.ANDROID_STL = libcxx_str if libcxx_str.startswith("c++_") else "c++_shared" + self.env_info.CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = "BOTH" + self.env_info.CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = "BOTH" + self.env_info.CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = "BOTH" + self.env_info.CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = "BOTH" def _unzip_fix_symlinks(self, url, target_folder, sha256): # Python's built-in module 'zipfile' won't handle symlinks (https://bugs.python.org/issue37921) diff --git a/recipes/android-ndk/all/test_v1_package/CMakeLists.txt b/recipes/android-ndk/all/test_v1_package/CMakeLists.txt index f7c5ddc942cf1..0d20897301b68 100644 --- a/recipes/android-ndk/all/test_v1_package/CMakeLists.txt +++ b/recipes/android-ndk/all/test_v1_package/CMakeLists.txt @@ -1,7 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/android-ndk/config.yml b/recipes/android-ndk/config.yml index b2fc5196cfcfc..bf4ed9150d9a2 100644 --- a/recipes/android-ndk/config.yml +++ b/recipes/android-ndk/config.yml @@ -1,4 +1,8 @@ versions: + "r25c": + folder: all + "r25b": + folder: all "r25": folder: all "r24": diff --git a/recipes/angelscript/all/CMakeLists.txt b/recipes/angelscript/all/CMakeLists.txt deleted file mode 100644 index d93e1400caafb..0000000000000 --- a/recipes/angelscript/all/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(NOT "${CMAKE_CXX_STANDARD}") - set(CMAKE_CXX_STANDARD 11) -endif() -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -add_subdirectory(source_subfolder/angelscript/projects/cmake) diff --git a/recipes/angelscript/all/conandata.yml b/recipes/angelscript/all/conandata.yml index cfde1084109f4..1dec7ac1d3e71 100644 --- a/recipes/angelscript/all/conandata.yml +++ b/recipes/angelscript/all/conandata.yml @@ -1,7 +1,28 @@ sources: + "2.36.0": + url: "https://www.angelcode.com/angelscript/sdk/files/angelscript_2.36.0.zip" + sha256: "33f95f7597bc0d88b097d35e7b1320d15419ffc5779851d9d2a6cccec57811b3" + "2.35.1": + url: "https://www.angelcode.com/angelscript/sdk/files/angelscript_2.35.1.zip" + sha256: "5c1096b6d6cf50c7e77ae93c736d35b69b07b1e5047161c7816bca25b413a18b" "2.35.0": - url: "http://www.angelcode.com/angelscript/sdk/files/angelscript_2.35.0.zip" + url: "https://www.angelcode.com/angelscript/sdk/files/angelscript_2.35.0.zip" sha256: "010dd45e23e734d46f5891d70e268607a12cb9ab12503dda42f842d9db7e8857" +patches: + "2.36.0": + - patch_file: "patches/2.36.0-0001-missing-include-stdint.patch" + patch_description: "Add missing stdint.h include" + patch_type: "portability" + sha256: "16d08c43a871a2ab4695e63829e9c07f9fab4237515185c1921e55c0b76483d3" "2.35.1": - url: "http://www.angelcode.com/angelscript/sdk/files/angelscript_2.35.1.zip" - sha256: "5c1096b6d6cf50c7e77ae93c736d35b69b07b1e5047161c7816bca25b413a18b" + - patch_file: "patches/2.35.1-0001-fix-compatibility-apple-clang.patch" + patch_description: "Fix apple-clang compatibility of ASM arm" + patch_type: "portability" + patch_source: "https://github.com/codecat/angelscript-mirror/commit/7ec10a763d9c078b57c413b552a2d05c2638878f" + sha256: "6cd39d941cc9e674f5ec2f94d2dc0d2eec04dfb348bbc8956eb2c6e6f5b2b895" + "2.35.0": + - patch_file: "patches/2.35.0-0001-fix-compatibility-apple-clang.patch" + patch_description: "Fix apple-clang compatibility of ASM arm" + patch_type: "portability" + patch_source: "https://github.com/codecat/angelscript-mirror/commit/7ec10a763d9c078b57c413b552a2d05c2638878f" + sha256: "03446786a60dbf53e0e69385ae918dbc4004bcf1a64c14960d11b856f3b0c64a" diff --git a/recipes/angelscript/all/conanfile.py b/recipes/angelscript/all/conanfile.py index 8c4d9752423d6..174e1d9732354 100644 --- a/recipes/angelscript/all/conanfile.py +++ b/recipes/angelscript/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.build import valid_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, get, export_conandata_patches, load, rmdir, save +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class AngelScriptConan(ConanFile): @@ -28,21 +32,9 @@ class AngelScriptConan(ConanFile): } short_paths = True - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -50,46 +42,55 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): # Website blocks default user agent string. - tools.get( + get( + self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, + destination=self.source_folder, headers={"User-Agent": "ConanCenter"}, strip_root=True, ) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["AS_NO_EXCEPTIONS"] = self.options.no_exceptions - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["AS_NO_EXCEPTIONS"] = self.options.no_exceptions + if not valid_min_cppstd(self, 11): + tc.variables["CMAKE_CXX_STANDARD"] = 11 + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "angelscript", "projects", "cmake")) cmake.build() def _extract_license(self): - header = tools.load(os.path.join(self._source_subfolder, "angelscript", "include", "angelscript.h")) - tools.save("LICENSE", header[header.find("/*", 1) + 3 : header.find("*/", 1)]) + header = load(self, os.path.join(self.source_folder, "angelscript", "include", "angelscript.h")) + return header[header.find("/*", 1) + 3 : header.find("*/", 1)] def package(self): - self._extract_license() - self.copy("LICENSE", dst="licenses") - cmake = self._configure_cmake() + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Angelscript") self.cpp_info.set_property("cmake_target_name", "Angelscript::angelscript") - postfix = "d" if self._is_msvc and self.settings.build_type == "Debug" else "" + postfix = "d" if is_msvc(self) and self.settings.build_type == "Debug" else "" # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["_angelscript"].libs = ["angelscript" + postfix] + self.cpp_info.components["_angelscript"].libs = [f"angelscript{postfix}"] if self.settings.os in ("Linux", "FreeBSD", "SunOS"): self.cpp_info.components["_angelscript"].system_libs.append("pthread") diff --git a/recipes/angelscript/all/patches/2.35.0-0001-fix-compatibility-apple-clang.patch b/recipes/angelscript/all/patches/2.35.0-0001-fix-compatibility-apple-clang.patch new file mode 100644 index 0000000000000..acf1d8b621bbf --- /dev/null +++ b/recipes/angelscript/all/patches/2.35.0-0001-fix-compatibility-apple-clang.patch @@ -0,0 +1,30 @@ +--- a/angelscript/projects/cmake/CMakeLists.txt ++++ b/angelscript/projects/cmake/CMakeLists.txt +@@ -110,7 +110,9 @@ if(${CMAKE_SYSTEM_PROCESSOR} MATCHES "^arm") + enable_language(ASM) + if(CMAKE_ASM_COMPILER_WORKS) + set(ANGELSCRIPT_SOURCE ${ANGELSCRIPT_SOURCE} ../../source/as_callfunc_arm.cpp ../../source/as_callfunc_arm_gcc.S) ++ if (NOT APPLE) + set_property(SOURCE ../../source/as_callfunc_arm_gcc.S APPEND PROPERTY COMPILE_FLAGS " -Wa,-mimplicit-it=always") ++ endif() + else() + message(FATAL ERROR "ARM target requires a working assembler") + endif() +--- a/angelscript/source/as_callfunc_arm64_gcc.S ++++ b/angelscript/source/as_callfunc_arm64_gcc.S +@@ -46,6 +46,7 @@ + .global CallARM64Float + .global CallARM64 + ++#if !defined(__MACH__) + .type GetHFAReturnDouble, %function + .type GetHFAReturnFloat, %function + .type CallARM64Ret128, %function +@@ -53,6 +54,7 @@ + .type CallARM64Double, %function + .type CallARM64Float, %function + .type CallARM64, %function ++#endif + + .align 2 + GetHFAReturnDouble: diff --git a/recipes/angelscript/all/patches/2.35.1-0001-fix-compatibility-apple-clang.patch b/recipes/angelscript/all/patches/2.35.1-0001-fix-compatibility-apple-clang.patch new file mode 100644 index 0000000000000..49ca65e890f7a --- /dev/null +++ b/recipes/angelscript/all/patches/2.35.1-0001-fix-compatibility-apple-clang.patch @@ -0,0 +1,18 @@ +--- a/angelscript/source/as_callfunc_arm64_gcc.S ++++ b/angelscript/source/as_callfunc_arm64_gcc.S +@@ -50,6 +50,7 @@ + .global CallARM64Float + .global CallARM64 + ++#if !defined(__MACH__) + .type GetHFAReturnDouble, %function + .type GetHFAReturnFloat, %function + .type CallARM64Ret128, %function +@@ -57,6 +58,7 @@ + .type CallARM64Double, %function + .type CallARM64Float, %function + .type CallARM64, %function ++#endif + + .align 2 + GetHFAReturnDouble: diff --git a/recipes/angelscript/all/patches/2.36.0-0001-missing-include-stdint.patch b/recipes/angelscript/all/patches/2.36.0-0001-missing-include-stdint.patch new file mode 100644 index 0000000000000..f2e883bacf543 --- /dev/null +++ b/recipes/angelscript/all/patches/2.36.0-0001-missing-include-stdint.patch @@ -0,0 +1,10 @@ +--- a/angelscript/source/as_context.cpp ++++ b/angelscript/source/as_context.cpp +@@ -36,6 +36,7 @@ + // + + #include // fmodf() pow() ++#include + + #include "as_config.h" + #include "as_context.h" diff --git a/recipes/angelscript/all/test_package/CMakeLists.txt b/recipes/angelscript/all/test_package/CMakeLists.txt index dfeca78c0bd3e..ee85cb2f6cc3c 100644 --- a/recipes/angelscript/all/test_package/CMakeLists.txt +++ b/recipes/angelscript/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(Angelscript REQUIRED CONFIG) diff --git a/recipes/angelscript/all/test_package/conanfile.py b/recipes/angelscript/all/test_package/conanfile.py index a3b9c17e2ea29..0a6bc68712d90 100644 --- a/recipes/angelscript/all/test_package/conanfile.py +++ b/recipes/angelscript/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -class AngelScriptTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/angelscript/all/test_v1_package/CMakeLists.txt b/recipes/angelscript/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/angelscript/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/angelscript/all/test_v1_package/conanfile.py b/recipes/angelscript/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a3b9c17e2ea29 --- /dev/null +++ b/recipes/angelscript/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import CMake, ConanFile, tools +import os + + +class AngelScriptTestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/angelscript/config.yml b/recipes/angelscript/config.yml index 75f0f388bd4d1..22190418b16a2 100644 --- a/recipes/angelscript/config.yml +++ b/recipes/angelscript/config.yml @@ -1,5 +1,7 @@ versions: - "2.35.0": + "2.36.0": folder: all "2.35.1": folder: all + "2.35.0": + folder: all diff --git a/recipes/antlr4-cppruntime/all/CMakeLists.txt b/recipes/antlr4-cppruntime/all/CMakeLists.txt deleted file mode 100644 index 327601d6d347e..0000000000000 --- a/recipes/antlr4-cppruntime/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder/runtime/Cpp) diff --git a/recipes/antlr4-cppruntime/all/conandata.yml b/recipes/antlr4-cppruntime/all/conandata.yml index 7cbac2212a675..2605966cb79dc 100644 --- a/recipes/antlr4-cppruntime/all/conandata.yml +++ b/recipes/antlr4-cppruntime/all/conandata.yml @@ -2,13 +2,38 @@ sources: "4.9.3": url: "https://github.com/antlr/antlr4/archive/refs/tags/4.9.3.tar.gz" sha256: "efe4057d75ab48145d4683100fec7f77d7f87fa258707330cadd1f8e6f7eecae" - "4.10": - url: "https://github.com/antlr/antlr4/archive/refs/tags/4.10.tar.gz" - sha256: "39b2604fc75fa77323bd7046f2fb750c818cf11fcce2cd6cca06b6697f60ffbb" "4.10.1": url: "https://github.com/antlr/antlr4/archive/refs/tags/4.10.1.tar.gz" sha256: "a320568b738e42735946bebc5d9d333170e14a251c5734e8b852ad1502efa8a2" + "4.11.1": + url: "https://github.com/antlr/antlr4/archive/refs/tags/4.11.1.tar.gz" + sha256: "81f87f03bb83b48da62e4fc8bfdaf447efb9fb3b7f19eb5cbc37f64e171218cf" patches: "4.9.3": - patch_file: "patches/0001-update-cmakelist.patch" - base_path: "source_subfolder" + - patch_file: "patches/0004-update-DropLibuuid-4.9.3-1.patch" + patch_description: "Revise the CMakeLists.txt to remove the dependency on libuuid (#1) which is not used since 4.9." + patch_type: "backport" + patch_source: "https://github.com/antlr/antlr4/pull/3787" + - patch_file: "patches/0004-update-DropLibuuid-4.9.3-2.patch" + patch_description: "Revise the CMakeLists.txt to remove the dependency on libuuid (#2) which is not used since 4.9." + patch_type: "backport" + patch_source: "https://github.com/antlr/antlr4/pull/3787" + "4.10.1": + - patch_file: "patches/0004-update-DropLibuuid-4.10.x-1.patch" + patch_description: "Revise the CMakeLists.txt to remove the dependency on libuuid (#1) which is not used since 4.9." + patch_type: "backport" + patch_source: "https://github.com/antlr/antlr4/pull/3787" + - patch_file: "patches/0004-update-DropLibuuid-4.10.x-2.patch" + patch_description: "Revise the CMakeLists.txt to remove the dependency on libuuid (#2) which is not used since 4.9." + patch_type: "backport" + patch_source: "https://github.com/antlr/antlr4/pull/3787" + "4.11.1": + - patch_file: "patches/0002-update-FlatHashSet.patch" + patch_description: "Fix the compiler errors reported by GCC 7 due to the new type FlatHashSet introduced in 4.11." + patch_type: "portability" + patch_source: "https://github.com/antlr/antlr4/pull/3885" + - patch_file: "patches/0003-update-FlatHashMap.patch" + patch_description: "Fix the compiler errors reported by GCC 7 due to the new type FlatHashMap introduced in 4.11." + patch_type: "portability" + patch_source: "https://github.com/antlr/antlr4/pull/3885" diff --git a/recipes/antlr4-cppruntime/all/conanfile.py b/recipes/antlr4-cppruntime/all/conanfile.py index 5f1d957aa04fd..89d2f483bf480 100644 --- a/recipes/antlr4-cppruntime/all/conanfile.py +++ b/recipes/antlr4-cppruntime/all/conanfile.py @@ -1,11 +1,15 @@ -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, check_min_vs +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, copy, rm, rmdir, save +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os import textwrap -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" class Antlr4CppRuntimeConan(ConanFile): @@ -15,6 +19,7 @@ class Antlr4CppRuntimeConan(ConanFile): topics = ("antlr", "parser", "runtime") url = "https://github.com/conan-io/conan-center-index" license = "BSD-3-Clause" + settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], "fPIC": [True, False], @@ -23,30 +28,25 @@ class Antlr4CppRuntimeConan(ConanFile): "shared": False, "fPIC": True, } - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "pkg_config" short_paths = True - compiler_required_cpp17 = { - "Visual Studio": "16", - "gcc": "7", - "clang": "5", - "apple-clang": "9.1" - } - - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + # Antlr 4.9.3 requires C++11 while newer versions require C++17 + return "17" if Version(self.version) >= "4.10" else "11" @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + return { + "17": { + "gcc": "7", + "clang": "5", + "apple-clang": "9.1", + }, + }.get(self._min_cppstd, {}) def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -54,93 +54,74 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): + # As of 4.11, antlr4-cppruntime no longer requires libuuid. + # Reference: [C++] Remove libuuid dependency (https://github.com/antlr/antlr4/pull/3787) + # Note that the above PR points that libuuid can be removed from 4.9.3, 4.10 and 4.10.1 as well. + # We have patched the CMakeLists.txt to drop the dependency on libuuid from aforementioned antlr versions. self.requires("utfcpp/3.2.1") - if self.settings.os in ("FreeBSD", "Linux"): - self.requires("libuuid/1.0.3") def validate(self): - if str(self.settings.arch).startswith("arm"): - raise ConanInvalidConfiguration("arm architectures are not supported") - # Need to deal with missing libuuid on Arm. - # So far ANTLR delivers macOS binary package. - - compiler = self.settings.compiler - compiler_version = tools.Version(self.settings.compiler.version) - antlr_version = tools.Version(self.version) - - if compiler == "Visual Studio" and compiler_version < "16": - raise ConanInvalidConfiguration("library claims C2668 'Ambiguous call to overloaded function'") - # Compilation of this library on version 15 claims C2668 Error. - # This could be Bogus error or malformed Antl4 libary. - # Version 16 compiles this code correctly. - - if antlr_version >= "4.10": - # Antlr4 for 4.9.3 does not require C++17 - C++11 is enough. - # for newest version we need C++17 compatible compiler here - - if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") - - minimum_version = self.compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if compiler_version < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) - - if is_msvc(self) and antlr_version == "4.10": - raise ConanInvalidConfiguration("{} Antlr4 4.10 version is broken on msvc - Use 4.10.1 or above.".format(self.name)) - - def build_requirements(self): - if self.settings.os in ("FreeBSD", "Linux"): - self.build_requires("pkgconf/1.7.4") + # Compilation of this library on version 15 claims C2668 Error. + # This could be Bogus error or malformed Antlr4 library. + # Guard: The minimum MSVC version is 16 or 1920 (which already supports C++17) + check_min_vs(self, "192") - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["ANTLR4_INSTALL"] = True - cmake.definitions["WITH_LIBCXX"] = self.settings.compiler.get_safe("libcxx") == "libc++" - cmake.definitions["ANTLR_BUILD_CPP_TESTS"] = False + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ANTLR4_INSTALL"] = True + tc.variables["WITH_LIBCXX"] = self.settings.compiler.get_safe("libcxx") == "libc++" + tc.variables["ANTLR_BUILD_CPP_TESTS"] = False if is_msvc(self): - cmake.definitions["WITH_STATIC_CRT"] = is_msvc_static_runtime(self) - cmake.definitions["WITH_DEMO"] = False - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.cache_variables["WITH_STATIC_CRT"] = is_msvc_static_runtime(self) + tc.variables["WITH_DEMO"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder="runtime/Cpp") cmake.build() def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=os.path.join(self.source_folder), dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*antlr4-runtime-static.*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*antlr4-runtime.a") + rm(self, "*antlr4-runtime-static.*", os.path.join(self.package_folder, "lib")) + rm(self, "*antlr4-runtime.a", os.path.join(self.package_folder, "lib")) else: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.dll") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "antlr4-runtime.lib") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*antlr4-runtime.so*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*antlr4-runtime.dll*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*antlr4-runtime.*dylib") - tools.rmdir(os.path.join(self.package_folder, "share")) + rm(self, "*.dll", os.path.join(self.package_folder, "bin")) + rm(self, "antlr4-runtime.lib", os.path.join(self.package_folder, "lib")) + rm(self, "*antlr4-runtime.so*", os.path.join(self.package_folder, "lib")) + rm(self, "*antlr4-runtime.dll*", os.path.join(self.package_folder, "lib")) + rm(self, "*antlr4-runtime.*dylib", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) # FIXME: this also removes lib/cmake/antlr4-generator # This cmake config script is needed to provide the cmake function `antlr4_generate` - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + fix_apple_shared_install_name(self) # TODO: to remove in conan v2 once cmake_find_package* generatores removed self._create_cmake_module_alias_targets( @@ -148,8 +129,7 @@ def package(self): {"antlr4_shared" if self.options.shared else "antlr4_static": "antlr4-cppruntime::antlr4-cppruntime"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent(f"""\ @@ -158,7 +138,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): @@ -175,7 +155,9 @@ def package_info(self): if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.defines.append("ANTLR4CPP_STATIC") if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs = ["pthread"] + self.cpp_info.system_libs = ["m", "pthread"] + elif is_apple_os(self): + self.cpp_info.frameworks = ["CoreFoundation"] # TODO: to remove in conan v2 once cmake_find_package* generatores removed self.cpp_info.filenames["cmake_find_package"] = "antlr4-runtime" diff --git a/recipes/antlr4-cppruntime/all/patches/0002-update-FlatHashSet.patch b/recipes/antlr4-cppruntime/all/patches/0002-update-FlatHashSet.patch new file mode 100644 index 0000000000000..336271b756971 --- /dev/null +++ b/recipes/antlr4-cppruntime/all/patches/0002-update-FlatHashSet.patch @@ -0,0 +1,15 @@ +--- runtime/Cpp/runtime/src/FlatHashSet.h ++++ runtime/Cpp/runtime/src/FlatHashSet.h +@@ -48,9 +48,9 @@ + using FlatHashSet = absl::flat_hash_set; + #else + template ::hasher, +- typename Equal = typename std::unordered_set::key_equal, +- typename Allocator = typename std::unordered_set::allocator_type> ++ typename Hash = std::hash, ++ typename Equal = std::equal_to, ++ typename Allocator = std::allocator> + using FlatHashSet = std::unordered_set; + #endif + diff --git a/recipes/antlr4-cppruntime/all/patches/0003-update-FlatHashMap.patch b/recipes/antlr4-cppruntime/all/patches/0003-update-FlatHashMap.patch new file mode 100644 index 0000000000000..e841ee8933643 --- /dev/null +++ b/recipes/antlr4-cppruntime/all/patches/0003-update-FlatHashMap.patch @@ -0,0 +1,15 @@ +--- runtime/Cpp/runtime/src/FlatHashMap.h ++++ runtime/Cpp/runtime/src/FlatHashMap.h +@@ -48,9 +48,9 @@ + using FlatHashMap = absl::flat_hash_map; + #else + template ::hasher, +- typename Equal = typename std::unordered_map::key_equal, +- typename Allocator = typename std::unordered_map::allocator_type> ++ typename Hash = std::hash, ++ typename Equal = std::equal_to, ++ typename Allocator = std::allocator>> + using FlatHashMap = std::unordered_map; + #endif + diff --git a/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.10.x-1.patch b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.10.x-1.patch new file mode 100644 index 0000000000000..52e813be947a8 --- /dev/null +++ b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.10.x-1.patch @@ -0,0 +1,13 @@ +--- runtime/Cpp/CMakeLists.txt ++++ runtime/Cpp/CMakeLists.txt +@@ -41,10 +41,6 @@ + CMAKE_POLICY(SET CMP0054 OLD) + endif() + +-if(CMAKE_SYSTEM_NAME MATCHES "Linux") +- find_package(PkgConfig REQUIRED) +- pkg_check_modules(UUID REQUIRED uuid) +-endif() + if(APPLE) + find_library(COREFOUNDATION_LIBRARY CoreFoundation) + endif() diff --git a/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.10.x-2.patch b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.10.x-2.patch new file mode 100644 index 0000000000000..f1fffa5599c8b --- /dev/null +++ b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.10.x-2.patch @@ -0,0 +1,14 @@ +--- runtime/Cpp/runtime/CMakeLists.txt ++++ runtime/Cpp/runtime/CMakeLists.txt +@@ -69,10 +69,7 @@ + gtest_discover_tests(antlr4_tests) + endif() + +-if(CMAKE_SYSTEM_NAME MATCHES "Linux") +- target_link_libraries(antlr4_shared ${UUID_LIBRARIES}) +- target_link_libraries(antlr4_static ${UUID_LIBRARIES}) +-elseif(APPLE) ++if(APPLE) + target_link_libraries(antlr4_shared ${COREFOUNDATION_LIBRARY}) + target_link_libraries(antlr4_static ${COREFOUNDATION_LIBRARY}) + endif() diff --git a/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.9.3-1.patch b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.9.3-1.patch new file mode 100644 index 0000000000000..6412c93b3d0b5 --- /dev/null +++ b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.9.3-1.patch @@ -0,0 +1,13 @@ +--- runtime/Cpp/CMakeLists.txt ++++ runtime/Cpp/CMakeLists.txt +@@ -39,10 +39,6 @@ + CMAKE_POLICY(SET CMP0054 OLD) + endif() + +-if(CMAKE_SYSTEM_NAME MATCHES "Linux") +- find_package(PkgConfig REQUIRED) +- pkg_check_modules(UUID REQUIRED uuid) +-endif() + if(APPLE) + find_library(COREFOUNDATION_LIBRARY CoreFoundation) + endif() diff --git a/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.9.3-2.patch b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.9.3-2.patch new file mode 100644 index 0000000000000..a9b062d8bea5a --- /dev/null +++ b/recipes/antlr4-cppruntime/all/patches/0004-update-DropLibuuid-4.9.3-2.patch @@ -0,0 +1,14 @@ +--- runtime/Cpp/runtime/CMakeLists.txt ++++ runtime/Cpp/runtime/CMakeLists.txt +@@ -75,10 +75,7 @@ + endif() + endif() + +-if(CMAKE_SYSTEM_NAME MATCHES "Linux") +- target_link_libraries(antlr4_shared ${UUID_LIBRARIES}) +- target_link_libraries(antlr4_static ${UUID_LIBRARIES}) +-elseif(APPLE) ++if(APPLE) + target_link_libraries(antlr4_shared ${COREFOUNDATION_LIBRARY}) + target_link_libraries(antlr4_static ${COREFOUNDATION_LIBRARY}) + endif() diff --git a/recipes/antlr4-cppruntime/all/test_package/CMakeLists.txt b/recipes/antlr4-cppruntime/all/test_package/CMakeLists.txt index 90f183c23127a..e1a9346912d37 100644 --- a/recipes/antlr4-cppruntime/all/test_package/CMakeLists.txt +++ b/recipes/antlr4-cppruntime/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(antlr4-runtime REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) @@ -12,4 +9,4 @@ if(TARGET antlr4_shared) else() target_link_libraries(${PROJECT_NAME} PRIVATE antlr4_static) endif() -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/antlr4-cppruntime/all/test_package/conanfile.py b/recipes/antlr4-cppruntime/all/test_package/conanfile.py index 90eb89e3f2f46..a9fb96656f203 100644 --- a/recipes/antlr4-cppruntime/all/test_package/conanfile.py +++ b/recipes/antlr4-cppruntime/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/antlr4-cppruntime/all/test_v1_package/CMakeLists.txt b/recipes/antlr4-cppruntime/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/antlr4-cppruntime/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/antlr4-cppruntime/all/test_v1_package/conanfile.py b/recipes/antlr4-cppruntime/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..90eb89e3f2f46 --- /dev/null +++ b/recipes/antlr4-cppruntime/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/antlr4-cppruntime/config.yml b/recipes/antlr4-cppruntime/config.yml index 9b65d8dc1061b..fd8294e924d85 100644 --- a/recipes/antlr4-cppruntime/config.yml +++ b/recipes/antlr4-cppruntime/config.yml @@ -1,7 +1,7 @@ versions: "4.9.3": folder: all - "4.10": - folder: all "4.10.1": folder: all + "4.11.1": + folder: all diff --git a/recipes/anyrpc/all/conandata.yml b/recipes/anyrpc/all/conandata.yml new file mode 100644 index 0000000000000..11c9a8b3eb434 --- /dev/null +++ b/recipes/anyrpc/all/conandata.yml @@ -0,0 +1,17 @@ +sources: + "1.0.2": + url: "https://github.com/sgieseking/anyrpc/archive/refs/tags/v1.0.2.tar.gz" + sha256: "236c9fa0ba417af945d950866c9671a1efa06506af8c86efa2e89ab67607969f" +patches: + "1.0.2": + - patch_file: "patches/0001-fix-asan-1.0.2.patch" + patch_description: "Handle ASAN flag properly in CMakeLists.txt" + patch_type: "portability" + patch_source: "https://github.com/sgieseking/anyrpc/pull/42" + - patch_file: "patches/0002-fix-shared-library-1.0.2.patch" + patch_description: "Fixed 'undefined reference' error when compile for windows platform" + patch_type: "portability" + patch_source: "https://github.com/sgieseking/anyrpc/pull/43" + - patch_file: "patches/0003-use-conan-libs-1.0.2.patch" + patch_description: "Link to conan libs" + patch_type: "conan" diff --git a/recipes/anyrpc/all/conanfile.py b/recipes/anyrpc/all/conanfile.py new file mode 100644 index 0000000000000..e5887586c576e --- /dev/null +++ b/recipes/anyrpc/all/conanfile.py @@ -0,0 +1,110 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +import os + +required_conan_version = ">=1.53.0" + + +class AnyRPCConan(ConanFile): + name = "anyrpc" + description = "A multiprotocol remote procedure call system for C++" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/sgieseking/anyrpc" + topics = ("rpc",) + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_log4cplus": [True, False], + "with_threading": [True, False], + "with_regex": [True, False], + "with_wchar": [True, False], + "with_protocol_json": [True, False], + "with_protocol_xml": [True, False], + "with_protocol_messagepack": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_log4cplus": False, + "with_threading": True, + "with_wchar": True, + "with_regex": True, + "with_protocol_json": True, + "with_protocol_xml": True, + "with_protocol_messagepack": True, + } + + @property + def _min_cppstd(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_log4cplus: + self.requires("log4cplus/2.0.7") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + if self.options.with_log4cplus and self.options.with_wchar: + raise ConanInvalidConfiguration(f"{self.ref} can not be built with both log4cplus and wchar, see https://github.com/sgieseking/anyrpc/issues/25") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ANYRPC_LIB_BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_TEST"] = False + tc.variables["BUILD_WITH_ADDRESS_SANITIZE"] = False + tc.variables["BUILD_WITH_LOG4CPLUS"] = self.options.with_log4cplus + tc.variables["BUILD_WITH_THREADING"] = self.options.with_threading + tc.variables["BUILD_WITH_REGEX"] = self.options.with_regex + tc.variables["BUILD_WITH_WCHAR"] = self.options.with_wchar + tc.variables["BUILD_PROTOCOL_JSON"] = self.options.with_protocol_json + tc.variables["BUILD_PROTOCOL_XML"] = self.options.with_protocol_xml + tc.variables["BUILD_PROTOCOL_MESSAGEPACK"] = self.options.with_protocol_messagepack + # Relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="license", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["anyrpc"] + if not self.options.shared and self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/anyrpc/all/patches/0001-fix-asan-1.0.2.patch b/recipes/anyrpc/all/patches/0001-fix-asan-1.0.2.patch new file mode 100644 index 0000000000000..23a8dc94863a2 --- /dev/null +++ b/recipes/anyrpc/all/patches/0001-fix-asan-1.0.2.patch @@ -0,0 +1,28 @@ +From 74b4fbb92b654a9483ef3ff64b708fda46bd7b2b Mon Sep 17 00:00:00 2001 +From: Falko Axmann +Date: Sun, 12 Jan 2020 12:43:00 +0100 +Subject: [PATCH] Handle ASAN flag properly in CMakeLists.txt + +Because of a typo ("else" instead of "elseif"), the +BUILD_WITH_ADDRESS_SANITIZE option was ignored and on +Linux, anyrpc would always be built with ASAN enabled. +--- + CMakeLists.txt | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cfeb604..87991bb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,7 +63,7 @@ if (MSVC) + set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc" ) + elseif (MINGW) + SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -U__STRICT_ANSI__" ) +-else (BUILD_WITH_ADDRESS_SANITIZE) ++elseif (BUILD_WITH_ADDRESS_SANITIZE) + SET( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer" ) + SET( ASAN_LIBRARY asan ) + endif () +-- +2.36.1.windows.1 + diff --git a/recipes/anyrpc/all/patches/0002-fix-shared-library-1.0.2.patch b/recipes/anyrpc/all/patches/0002-fix-shared-library-1.0.2.patch new file mode 100644 index 0000000000000..bb861d675230e --- /dev/null +++ b/recipes/anyrpc/all/patches/0002-fix-shared-library-1.0.2.patch @@ -0,0 +1,54 @@ +From c8ece5d572bf68a7d0f63405089a7a8d7d6206ee Mon Sep 17 00:00:00 2001 +From: "email@email.com" +Date: Fri, 31 Jul 2020 15:37:29 +0300 +Subject: [PATCH] fixed 'undefined reference' error when compile for windows + platform + +--- + include/anyrpc/json/jsonserver.h | 2 +- + include/anyrpc/messagepack/messagepackserver.h | 2 +- + include/anyrpc/xml/xmlserver.h | 2 +- + 3 files changed, 3 insertions(+), 3 deletions(-) + +diff --git a/include/anyrpc/json/jsonserver.h b/include/anyrpc/json/jsonserver.h +index d883b16..000bbd4 100644 +--- a/include/anyrpc/json/jsonserver.h ++++ b/include/anyrpc/json/jsonserver.h +@@ -24,7 +24,7 @@ + namespace anyrpc + { + +-bool JsonRpcHandler(MethodManager* manager, char* request, std::size_t length, Stream &response); ++ANYRPC_API bool JsonRpcHandler(MethodManager* manager, char* request, std::size_t length, Stream &response); + + //////////////////////////////////////////////////////////////////////////////// + +diff --git a/include/anyrpc/messagepack/messagepackserver.h b/include/anyrpc/messagepack/messagepackserver.h +index cc708f8..708bd72 100644 +--- a/include/anyrpc/messagepack/messagepackserver.h ++++ b/include/anyrpc/messagepack/messagepackserver.h +@@ -24,7 +24,7 @@ + namespace anyrpc + { + +-bool MessagePackRpcHandler(MethodManager* manager, char* request, std::size_t length, Stream &response); ++ANYRPC_API bool MessagePackRpcHandler(MethodManager* manager, char* request, std::size_t length, Stream &response); + + //////////////////////////////////////////////////////////////////////////////// + +diff --git a/include/anyrpc/xml/xmlserver.h b/include/anyrpc/xml/xmlserver.h +index 5350ca5..fe0ed23 100644 +--- a/include/anyrpc/xml/xmlserver.h ++++ b/include/anyrpc/xml/xmlserver.h +@@ -24,7 +24,7 @@ + namespace anyrpc + { + +-bool XmlRpcHandler(MethodManager* manager, char* request, std::size_t length, Stream &response); ++ANYRPC_API bool XmlRpcHandler(MethodManager* manager, char* request, std::size_t length, Stream &response); + + //////////////////////////////////////////////////////////////////////////////// + +-- +2.36.1.windows.1 + diff --git a/recipes/anyrpc/all/patches/0003-use-conan-libs-1.0.2.patch b/recipes/anyrpc/all/patches/0003-use-conan-libs-1.0.2.patch new file mode 100644 index 0000000000000..b1c4f4b1d7f2e --- /dev/null +++ b/recipes/anyrpc/all/patches/0003-use-conan-libs-1.0.2.patch @@ -0,0 +1,44 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 2.8) + + Project(AnyRPC CXX) + +-# Some of the cmake find_package files are part of this distribution +-set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") +- + # Read out version from "version" file + file(STRINGS "version" ANYRPC_VERSION_FILE) + +@@ -91,7 +88,7 @@ CONFIGURE_FILE( "${PROJECT_SOURCE_DIR}/version.h.in" + "${PROJECT_SOURCE_DIR}/include/anyrpc/version.h" ) + + if (BUILD_WITH_LOG4CPLUS) +- find_package( Log4cplus ) +- if (NOT LOG4CPLUS_FOUND) ++ find_package( log4cplus ) ++ if (NOT log4cplus_FOUND) + # the find_package call for Log4cplus doesn't generate an error even if marked as required + message( FATAL_ERROR "LOG4CPLUS library required if BUILD_WITH_LOG4CPLUS on" ) + +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -44,15 +44,15 @@ set(ANYRPC_HEADERS ${ANYRPC_HEADERS} ${ANYRPC_INTERNAL_HEADERS} + + # Add the necessary external library references + if (BUILD_WITH_LOG4CPLUS) +- include_directories(${LOG4CPLUS_INCLUDE_DIRS}) ++ set( LOG4CPLUS_TARGET "log4cplus::log4cplus" ) + add_definitions( -DBUILD_WITH_LOG4CPLUS ) + else () +- set( LOG4CPLUS_LIBRARIES "" ) ++ set( LOG4CPLUS_TARGET "" ) + endif () + + # Create the libraries with these header and source files + add_library( anyrpc ${ANYRPC_LIB_TYPE} ${ANYRPC_SOURCES} ${ANYRPC_HEADERS} ) +-target_link_libraries( anyrpc ${ASAN_LIBRARY} ${LOG4CPLUS_LIBRARIES}) ++target_link_libraries( anyrpc ${ASAN_LIBRARY} ${LOG4CPLUS_TARGET}) + + # Need the winsock library for Windows + if (WIN32) diff --git a/recipes/anyrpc/all/test_package/CMakeLists.txt b/recipes/anyrpc/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f9c6894d75a0f --- /dev/null +++ b/recipes/anyrpc/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_anyrpc CXX) + +find_package(anyrpc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_anyrpc.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE anyrpc::anyrpc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/anyrpc/all/test_package/conanfile.py b/recipes/anyrpc/all/test_package/conanfile.py new file mode 100644 index 0000000000000..7f2b358ed020e --- /dev/null +++ b/recipes/anyrpc/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestAnyRpcConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_anyrpc") + self.run(bin_path, env="conanrun") diff --git a/recipes/anyrpc/all/test_package/test_anyrpc.cpp b/recipes/anyrpc/all/test_package/test_anyrpc.cpp new file mode 100644 index 0000000000000..3a1af31f88b40 --- /dev/null +++ b/recipes/anyrpc/all/test_package/test_anyrpc.cpp @@ -0,0 +1,17 @@ +#include +#include + +#include "anyrpc/anyrpc.h" + +void testFunc(anyrpc::Value& params, anyrpc::Value& result) +{ +} + +int main(void) +{ + anyrpc::JsonHttpServer server; + anyrpc::MethodManager* methodManager = server.GetMethodManager(); + methodManager->AddFunction(&testFunc, "testFunc", "Test function"); + + return EXIT_SUCCESS; +} diff --git a/recipes/anyrpc/all/test_v1_package/CMakeLists.txt b/recipes/anyrpc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8272097b5b3da --- /dev/null +++ b/recipes/anyrpc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/anyrpc/all/test_v1_package/conanfile.py b/recipes/anyrpc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e946eccc88b51 --- /dev/null +++ b/recipes/anyrpc/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestAnyRpcV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_anyrpc") + self.run(bin_path, run_environment=True) diff --git a/recipes/anyrpc/config.yml b/recipes/anyrpc/config.yml new file mode 100644 index 0000000000000..8457ca9a4a8cd --- /dev/null +++ b/recipes/anyrpc/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.2": + folder: all diff --git a/recipes/apr-util/all/conandata.yml b/recipes/apr-util/all/conandata.yml index 5d5dde4a587d8..54e26418aee59 100644 --- a/recipes/apr-util/all/conandata.yml +++ b/recipes/apr-util/all/conandata.yml @@ -1,7 +1,9 @@ sources: "1.6.1": - url: "https://downloads.apache.org/apr/apr-util-1.6.1.tar.gz" sha256: "b65e40713da57d004123b6319828be7f1273fbc6490e145874ee1177e112c459" + url: + - "https://archive.apache.org/dist/apr/apr-util-1.6.1.tar.gz" + - "https://downloads.apache.org/apr/apr-util-1.6.1.tar.gz" patches: "1.6.1": - base_path: "source_subfolder" diff --git a/recipes/apr/all/CMakeLists.txt b/recipes/apr/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/apr/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/apr/all/conandata.yml b/recipes/apr/all/conandata.yml index 761248b72bbad..99413b626b3c6 100644 --- a/recipes/apr/all/conandata.yml +++ b/recipes/apr/all/conandata.yml @@ -1,18 +1,13 @@ sources: "1.7.0": - url: "https://downloads.apache.org/apr/apr-1.7.0.tar.gz" - sha256: "48e9dbf45ae3fdc7b491259ffb6ccf7d63049ffacbc1c0977cced095e4c2d5a2" + url: "https://archive.apache.org/dist/apr/apr-1.7.0.tar.bz2" + sha256: "e2e148f0b2e99b8e5c6caa09f6d4fb4dd3e83f744aa72a952f94f5a14436f7ea" patches: "1.7.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-cmake-build-only-shared-static.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-apr-config-prefix-env.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-cmake-gen_test_char-use-target.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-autotools-mingw.patch" - - base_path: "source_subfolder" - patch_file: "patches/0005-clang12-apple.patch" - - base_path: "source_subfolder" - patch_file: "patches/0006-sys_siglist-fix.patch" + - patch_file: "patches/0001-cmake-build-only-shared-static.patch" + - patch_file: "patches/0002-apr-config-prefix-env.patch" + - patch_file: "patches/0003-cmake-gen_test_char-use-target.patch" + - patch_file: "patches/0004-autotools-mingw.patch" + - patch_file: "patches/0005-clang12-apple.patch" + - patch_file: "patches/0006-sys_siglist-fix.patch" + - patch_file: "patches/0007-cmake-minimum-required.patch" diff --git a/recipes/apr/all/conanfile.py b/recipes/apr/all/conanfile.py index f11328e35d47d..1708ae7135970 100644 --- a/recipes/apr/all/conanfile.py +++ b/recipes/apr/all/conanfile.py @@ -1,14 +1,26 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, CMake, tools -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanException, ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os import re -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.54.0" class AprConan(ConanFile): name = "apr" - description = "The Apache Portable Runtime (APR) provides a predictable and consistent interface to underlying platform-specific implementations" + description = ( + "The Apache Portable Runtime (APR) provides a predictable and consistent " + "interface to underlying platform-specific implementations" + ) license = "Apache-2.0" topics = ("apache", "platform", "library") homepage = "https://apr.apache.org/" @@ -26,28 +38,18 @@ class AprConan(ConanFile): "force_apr_uuid": True, } - generators = "cmake" - _autotools = None - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property def _should_call_autoreconf(self): return self.settings.compiler == "apple-clang" and \ - tools.Version(self.settings.compiler.version) >= "12" and \ + Version(self.settings.compiler.version) >= "12" and \ self.version == "1.7.0" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -55,101 +57,99 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + if is_msvc(self): + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self): - raise ConanInvalidConfiguration("apr cannot be cross compiled due to runtime checks") + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration("apr recipe doesn't support cross-build yet due to runtime checks") def build_requirements(self): - if self._should_call_autoreconf: - self.build_requires("libtool/2.4.6") + if not is_msvc(self): + if self._should_call_autoreconf: + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["INSTALL_PDB"] = False - self._cmake.definitions["APR_BUILD_TESTAPR"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--with-installbuilddir=${prefix}/bin/build-1", - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - if tools.cross_building(self): - # - conf_args.append("apr_cv_mutex_robust_shared=yes") - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = CMakeToolchain(self) + tc.variables["INSTALL_PDB"] = False + tc.variables["APR_BUILD_TESTAPR"] = False + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--with-installbuilddir=${prefix}/res/build-1") + if cross_building(self): + tc.configure_args.append("apr_cv_mutex_robust_shared=yes") + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if self.options.force_apr_uuid: - tools.replace_in_file(os.path.join(self._source_subfolder, "include", "apr.h.in"), + replace_in_file(self, os.path.join(self.source_folder, "include", "apr.h.in"), "@osuuid@", "0") def build(self): self._patch_sources() - if self.settings.compiler == "Visual Studio": - cmake = self._configure_cmake() + if is_msvc(self): + cmake = CMake(self) + cmake.configure() cmake.build(target="libapr-1" if self.options.shared else "apr-1") else: + autotools = Autotools(self) if self._should_call_autoreconf: - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - autotools = self._configure_autotools() + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - if self.settings.compiler == "Visual Studio": - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + cmake = CMake(self) cmake.install() else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "build-1")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) - os.unlink(os.path.join(self.package_folder, "lib", "libapr-1.la")) - tools.rmdir(os.path.join(self.package_folder, "build-1")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - - apr_rules_mk = os.path.join(self.package_folder, "bin", "build-1", "apr_rules.mk") + apr_rules_mk = os.path.join(self.package_folder, "res", "build-1", "apr_rules.mk") apr_rules_cnt = open(apr_rules_mk).read() for key in ("apr_builddir", "apr_builders", "top_builddir"): - apr_rules_cnt, nb = re.subn("^{}=[^\n]*\n".format(key), "{}=$(_APR_BUILDDIR)\n".format(key), apr_rules_cnt, flags=re.MULTILINE) + apr_rules_cnt, nb = re.subn(f"^{key}=[^\n]*\n", f"{key}=$(_APR_BUILDDIR)\n", apr_rules_cnt, flags=re.MULTILINE) if nb == 0: - raise ConanException("Could not find/replace {} in {}".format(key, apr_rules_mk)) + raise ConanException(f"Could not find/replace {key} in {apr_rules_mk}") open(apr_rules_mk, "w").write(apr_rules_cnt) def package_info(self): self.cpp_info.set_property("pkg_config_name", "apr-1") - self.cpp_info.libs = ["libapr-1" if self.settings.compiler == "Visual Studio" and self.options.shared else "apr-1"] + prefix = "lib" if is_msvc(self) and self.options.shared else "" + self.cpp_info.libs = [f"{prefix}apr-1"] + self.cpp_info.resdirs = ["res"] if not self.options.shared: self.cpp_info.defines = ["APR_DECLARE_STATIC"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["dl", "pthread"] + self.cpp_info.system_libs = ["crypt", "dl", "pthread", "rt"] if self.settings.os == "Windows": - self.cpp_info.system_libs = ["rpcrt4"] - - apr_root = tools.unix_path(self.package_folder) - self.output.info("Settings APR_ROOT environment var: {}".format(apr_root)) - self.env_info.APR_ROOT = apr_root + self.cpp_info.system_libs = ["mswsock", "rpcrt4", "ws2_32"] - apr_mk_dir = tools.unix_path(os.path.join(self.package_folder, "bin", "build-1")) - self.env_info._APR_BUILDDIR = apr_mk_dir + # TODO: to remove in conan v2 + self.env_info.APR_ROOT = self.package_folder + self.env_info._APR_BUILDDIR = os.path.join(self.package_folder, "res", "build-1") diff --git a/recipes/apr/all/patches/0003-cmake-gen_test_char-use-target.patch b/recipes/apr/all/patches/0003-cmake-gen_test_char-use-target.patch index b6c4855dd153c..171d7365eb26e 100644 --- a/recipes/apr/all/patches/0003-cmake-gen_test_char-use-target.patch +++ b/recipes/apr/all/patches/0003-cmake-gen_test_char-use-target.patch @@ -1,11 +1,16 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -53,7 +53,7 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -49,11 +49,11 @@ CONFIGURE_FILE(include/apr.hwc + ${PROJECT_BINARY_DIR}/apr.h) + + ADD_EXECUTABLE(gen_test_char tools/gen_test_char.c) +-GET_TARGET_PROPERTY(GEN_TEST_CHAR_EXE gen_test_char LOCATION) ++# GET_TARGET_PROPERTY(GEN_TEST_CHAR_EXE gen_test_char LOCATION) ADD_CUSTOM_COMMAND( COMMENT "Generating character tables, apr_escape_test_char.h, for current locale" DEPENDS gen_test_char - COMMAND ${GEN_TEST_CHAR_EXE} > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h -+ COMMAND gen_test_char > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h ++ COMMAND $ > ${PROJECT_BINARY_DIR}/apr_escape_test_char.h OUTPUT ${PROJECT_BINARY_DIR}/apr_escape_test_char.h ) ADD_CUSTOM_TARGET( diff --git a/recipes/apr/all/patches/0007-cmake-minimum-required.patch b/recipes/apr/all/patches/0007-cmake-minimum-required.patch new file mode 100644 index 0000000000000..161b16e8f7269 --- /dev/null +++ b/recipes/apr/all/patches/0007-cmake-minimum-required.patch @@ -0,0 +1,13 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -15,9 +15,9 @@ + # + # Read README.cmake before using this. + ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1) + PROJECT(APR C) + +-CMAKE_MINIMUM_REQUIRED(VERSION 2.8) + + OPTION(APR_INSTALL_PRIVATE_H "Install selected private .h files (for httpd)" OFF) + OPTION(APR_HAVE_IPV6 "IPv6 support" ON) diff --git a/recipes/apr/all/test_package/CMakeLists.txt b/recipes/apr/all/test_package/CMakeLists.txt index f8b971e2db377..c82ee1f7cca4b 100644 --- a/recipes/apr/all/test_package/CMakeLists.txt +++ b/recipes/apr/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(apr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE apr::apr) diff --git a/recipes/apr/all/test_package/conanfile.py b/recipes/apr/all/test_package/conanfile.py index 5c09494bc67c0..98ab55852ad56 100644 --- a/recipes/apr/all/test_package/conanfile.py +++ b/recipes/apr/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/apr/all/test_v1_package/CMakeLists.txt b/recipes/apr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/apr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/apr/all/test_v1_package/conanfile.py b/recipes/apr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/apr/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aravis/all/conandata.yml b/recipes/aravis/all/conandata.yml index 3dad42682b77d..f4c6ccd2ff9e6 100644 --- a/recipes/aravis/all/conandata.yml +++ b/recipes/aravis/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "0.8.20": - patch_file: "patches/0.8.19-gst-shared-lib.patch" - base_path: "source_subfolder" diff --git a/recipes/aravis/all/conanfile.py b/recipes/aravis/all/conanfile.py index 9c2e5d3df66d8..aaa8cad5fb1b4 100644 --- a/recipes/aravis/all/conanfile.py +++ b/recipes/aravis/all/conanfile.py @@ -1,8 +1,19 @@ -from conans import ConanFile, Meson, RunEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rename, rm, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, msvc_runtime_flag +from conan.tools.scm import Version import os import glob +required_conan_version = ">=1.53.0" + class AravisConan(ConanFile): name = "aravis" @@ -11,7 +22,7 @@ class AravisConan(ConanFile): homepage = "https://github.com/AravisProject/aravis" description = "A vision library for genicam based cameras." topics = ("usb", "camera") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -19,7 +30,7 @@ class AravisConan(ConanFile): "packet_socket": [True, False], "gst_plugin": [True, False], "tools": [True, False], - "introspection": [True, False] + "introspection": [True, False], } default_options = { "shared": False, @@ -28,27 +39,11 @@ class AravisConan(ConanFile): "packet_socket": True, "gst_plugin": False, "tools": True, - "introspection": False + "introspection": False, } - generators = "pkg_config" - - _meson = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property - def _aravis_api_version(self): - return ".".join(self.version.split(".")[0:2]) - - @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -58,112 +53,114 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - self.options["glib"].shared = True - - def validate(self): - if self._is_msvc and self.settings.get_safe("compiler.runtime", "").startswith("MT"): - raise ConanInvalidConfiguration("Static MT/MTd runtime is not supported on Windows due to GLib issues") - if not self.options["glib"].shared and self.options.shared: - raise ConanInvalidConfiguration("Shared Aravis cannot link to static GLib") - if self.settings.os == "Macos": - raise ConanInvalidConfiguration("macOS builds are disabled until conan-io/conan#7324 gets merged to fix macOS SIP issue #8443") + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + if self.options.shared: + self.options["glib"].shared = True - def build_requirements(self): - self.build_requires("meson/0.60.2") - self.build_requires("pkgconf/1.7.4") - if self.options.introspection: - self.build_requires("gobject-introspection/1.70.0") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("glib/2.70.1") - self.requires("libxml2/2.9.12") - self.requires("zlib/1.2.11") + self.requires("glib/2.75.2") + self.requires("libxml2/2.10.3") + self.requires("zlib/1.2.13") if self.options.usb: - self.requires("libusb/1.0.24") + self.requires("libusb/1.0.26") if self.options.gst_plugin: self.requires("gstreamer/1.19.2") self.requires("gst-plugins-base/1.19.2") - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + def validate(self): + if is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("Static runtime is not supported on Windows due to GLib issues") + if self.options.shared and not self.dependencies["glib"].options.shared: + raise ConanInvalidConfiguration("Shared Aravis cannot link to static GLib") + if self.settings.os == "Macos" and self.dependencies["glib"].options.shared: + raise ConanInvalidConfiguration( + "macOS builds are disabled when glib is shared until " + "conan-io/conan#7324 gets merged to fix macOS SIP issue #8443" + ) + + def build_requirements(self): + self.tool_requires("meson/1.0.0") + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires("glib/2.75.2") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self.options.introspection: + self.tool_requires("gobject-introspection/1.72.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - def _configure_meson(self): - if self._meson: - return self._meson - defs = dict() - defs["wrap_mode"] = "nofallback" - defs["usb"] = "enabled" if self.options.usb else "disabled" - defs["gst-plugin"] = "enabled" if self.options.gst_plugin else "disabled" - defs["packet-socket"] = "enabled" if self.options.get_safe("packet_socket") else "disabled" - defs["introspection"] = "enabled" if self.options.introspection else "disabled" - defs["viewer"] = "disabled" - defs["tests"] = "false" - defs["documentation"] = "disabled" + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = MesonToolchain(self) + tc.project_options["usb"] = "enabled" if self.options.usb else "disabled" + tc.project_options["gst-plugin"] = "enabled" if self.options.gst_plugin else "disabled" + tc.project_options["packet-socket"] = "enabled" if self.options.get_safe("packet_socket") else "disabled" + tc.project_options["introspection"] = "enabled" if self.options.introspection else "disabled" + tc.project_options["viewer"] = "disabled" + tc.project_options["tests"] = False + tc.project_options["documentation"] = "disabled" if self.settings.get_safe("compiler.runtime"): - defs["b_vscrt"] = str(self.settings.compiler.runtime).lower() - self._meson = Meson(self) - self._meson.configure(defs=defs, source_folder=self._source_subfolder, build_folder=self._build_subfolder) - return self._meson + tc.project_options["b_vscrt"] = msvc_runtime_flag(self).lower() + tc.generate() + + deps = PkgConfigDeps(self) + deps.generate() def build(self): - self._patch_sources() - with tools.environment_append(RunEnvironment(self).vars): - meson = self._configure_meson() - meson.build() + apply_conandata_patches(self) + meson = Meson(self) + meson.configure() + meson.build() def _fix_library_names(self, path): # https://github.com/mesonbuild/meson/issues/1412 - if not self.options.shared and self._is_msvc: - with tools.chdir(path): + if not self.options.shared and is_msvc(self): + with chdir(self, path): for filename_old in glob.glob("*.a"): filename_new = filename_old[3:-2] + ".lib" - self.output.info("rename %s into %s" % (filename_old, filename_new)) - tools.rename(filename_old, filename_new) + self.output.info(f"rename {filename_old} into {filename_new}") + rename(self, filename_old, filename_new) def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses", keep_path=False) - with tools.environment_append(RunEnvironment(self).vars): - meson = self._configure_meson() - meson.install() - + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() self._fix_library_names(os.path.join(self.package_folder, "lib")) if self.options.gst_plugin: self._fix_library_names(os.path.join(self.package_folder, "lib", "gstreamer-1.0")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(self.package_folder, "*.pdb") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.pdb", self.package_folder, recursive=True) if not self.options.tools: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "arv-*") - - def package_id(self): - self.info.requires["glib"].full_package_mode() - if self.options.gst_plugin: - self.info.requires["gstreamer"].full_package_mode() - self.info.requires["gst-plugins-base"].full_package_mode() + rm(self, "arv-*", os.path.join(self.package_folder, "bin")) + fix_apple_shared_install_name(self) def package_info(self): - aravis_name = "aravis-{}".format(self._aravis_api_version) - self.cpp_info.names["pkg_config"] = aravis_name + version = Version(self.version) + aravis_name = f"aravis-{version.major}.{version.minor}" + self.cpp_info.set_property("pkg_config_name", aravis_name) self.cpp_info.includedirs = [os.path.join("include", aravis_name)] self.cpp_info.libs = [aravis_name] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["dl", "pthread", "m", "resolv"]) elif self.settings.os == "Windows": self.cpp_info.system_libs.extend(["ws2_32", "iphlpapi"]) - if self.options.tools: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) if self.options.gst_plugin and self.options.shared: gst_plugin_path = os.path.join(self.package_folder, "lib", "gstreamer-1.0") - self.output.info("Appending GST_PLUGIN_PATH env var: {}".format(gst_plugin_path)) + self.runenv_info.prepend_path("GST_PLUGIN_PATH", gst_plugin_path) + if self.options.tools: + self.buildenv_info.prepend_path("GST_PLUGIN_PATH", gst_plugin_path) self.env_info.GST_PLUGIN_PATH.append(gst_plugin_path) + if self.options.tools: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/aravis/all/test_package/CMakeLists.txt b/recipes/aravis/all/test_package/CMakeLists.txt index f6a87ca17276f..8a5d8c220194f 100644 --- a/recipes/aravis/all/test_package/CMakeLists.txt +++ b/recipes/aravis/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aravis REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} aravis::aravis) +target_link_libraries(${PROJECT_NAME} PRIVATE aravis::aravis) diff --git a/recipes/aravis/all/test_package/conanfile.py b/recipes/aravis/all/test_package/conanfile.py index 3f3cb5b947e78..98ab55852ad56 100644 --- a/recipes/aravis/all/test_package/conanfile.py +++ b/recipes/aravis/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class AravisTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aravis/all/test_v1_package/CMakeLists.txt b/recipes/aravis/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/aravis/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aravis/all/test_v1_package/conanfile.py b/recipes/aravis/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/aravis/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/archicad-apidevkit/all/conandata.yml b/recipes/archicad-apidevkit/all/conandata.yml new file mode 100644 index 0000000000000..d3788a4383b77 --- /dev/null +++ b/recipes/archicad-apidevkit/all/conandata.yml @@ -0,0 +1,28 @@ +sources: + "26": + Macos: + "x86_64": + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/220529.v2022Release.3000.FULL.FIN.MAC64.DevKitAPI.tar.gz" + sha256: "326643eb79619166b6cb8f2858be3b24c1c3e3dd6749d20d2960baa0690f8e9c" + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/licenses.zip" + sha256: "ad798e4760d784a84d2708be77b3c8d7562a88ac8cddbc3177f21a6d6e91772a" + Windows: + "x86_64": + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/220529.v2022Release.3000.FULL.FIN.WIN64.DevKitAPI.zip" + sha256: "588c411b8bb8263bd417c271bb5a8d01136a802cb60116732ab5c1e2fbbf0558" + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/licenses.zip" + sha256: "ad798e4760d784a84d2708be77b3c8d7562a88ac8cddbc3177f21a6d6e91772a" + + "25": + Macos: + "x86_64": + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/210709.v2021Release.3006.FULL.FIN.MAC64.DevKitAPI.tar.gz" + sha256: "d692a59bdec7847ef4632e2c6741be064822a91eda2735dcff768985eaf4ec1e" + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/licenses.zip" + sha256: "ad798e4760d784a84d2708be77b3c8d7562a88ac8cddbc3177f21a6d6e91772a" + Windows: + "x86_64": + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/210519.v2021Release.3002.FULL.FIN.WIN64.DevKitAPI.zip" + sha256: "e7da392408f6150c58f3cba5d4f05118f1eaed4519fdb76895e13aed9ceede97" + - url: "https://stgsswsconan001.blob.core.windows.net/apidevkit/licenses.zip" + sha256: "ad798e4760d784a84d2708be77b3c8d7562a88ac8cddbc3177f21a6d6e91772a" diff --git a/recipes/archicad-apidevkit/all/conanfile.py b/recipes/archicad-apidevkit/all/conanfile.py new file mode 100644 index 0000000000000..55e0ec99e9a6b --- /dev/null +++ b/recipes/archicad-apidevkit/all/conanfile.py @@ -0,0 +1,65 @@ +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.52.0" + + +class ArchicadApidevkitConan(ConanFile): + name = "archicad-apidevkit" + description = "The General API Development Kit enables software developers to extend the functionality of Archicad" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://archicadapi.graphisoft.com/" + license = "LicenseRef-LICENSE" + settings = "os", "compiler", "arch", "build_type" + no_copy_source = True + topics = "api", "archicad", "development" + short_paths = True + + def validate(self): + if self.settings.build_type == "Debug": + raise ConanInvalidConfiguration("Debug configuration is not supported") + if is_msvc(self): + # Approximate requirement for toolset >= v142 + check_min_vs(self, "192") + if not self.info.settings.os in ("Macos", "Windows"): + raise ConanInvalidConfiguration( + f"{self.ref} is not supported by the OS {self.info.settings.os}") + if not str(self.settings.arch) in ("x86_64"): + raise ConanInvalidConfiguration( + f"{self.ref} is not supported yet.") + if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < "16": + raise ConanInvalidConfiguration( + "This recipe does not support this compiler version") + + def build(self): + devkit, licenses = self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)] + get(self, **devkit, destination=os.path.join(self.package_folder, "bin"), strip_root=True) + get(self, **licenses, destination=os.path.join(self.package_folder, "licenses"), strip_root=True) + + def package(self): + copy(self, "bin", src=self.build_folder, dst=self.package_folder) + copy(self, "licenses", src=self.build_folder, dst=self.package_folder) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.includedirs = [] + + # These are dependencies of third party vendored libraries + self.cpp_info.system_libs = [ + "WinMM", "MSImg32", "WS2_32", "USP10", "DNSApi"] + if self.settings.os == "Macos": + self.cpp_info.frameworks = ["CoreText", "CoreFoundation", "CoreServices", + "ApplicationServices", "Carbon", "CoreGraphics", "AppKit", "Foundation"] + else: + self.cpp_info.system_libs.extend(["gdiplus", "iphlpapi"]) + + devkit_dir = os.path.join(self.package_folder, "bin") + self.output.info(f"Setting AC_API_DEVKIT_DIR environment variable: {devkit_dir}") + self.env_info.AC_API_DEVKIT_DIR = devkit_dir + self.buildenv_info.define("AC_API_DEVKIT_DIR", devkit_dir) diff --git a/recipes/archicad-apidevkit/all/test_package/CMakeLists.txt b/recipes/archicad-apidevkit/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7e25d3d3b7690 --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_package/CMakeLists.txt @@ -0,0 +1,44 @@ +cmake_minimum_required(VERSION 3.15) + +project(test_package CXX) + +function(SetCompilerOptions target ac_version) + if(ac_version GREATER "26") + target_compile_features("${target}" PUBLIC cxx_std_17) + else() + target_compile_features("${target}" PUBLIC cxx_std_14) + endif() +endfunction() + +set(AC_API_DEVKIT_DIR "$ENV{AC_API_DEVKIT_DIR}" CACHE PATH "API DevKit directory.") + +find_package(archicad-apidevkit REQUIRED CONFIG) + +add_executable(test_package test_gsroot.cpp) +SetCompilerOptions(test_package "${archicad-apidevkit_VERSION}") + +if(WIN32) + target_compile_definitions(test_package PRIVATE UNICODE _UNICODE) +else() + target_compile_definitions(test_package PRIVATE macintosh=1) +endif() + +target_include_directories(test_package SYSTEM PRIVATE "${AC_API_DEVKIT_DIR}/Modules/GSRoot") + +if(WIN32) + target_link_libraries( + test_package PRIVATE + "${AC_API_DEVKIT_DIR}/Modules/GSRoot/Win/GSRootImp.lib" + ) +else() + find_library( + GSROOT_FRAMEWORK GSRoot + PATHS "${AC_API_DEVKIT_DIR}/Frameworks" + ) + + if(NOT GSROOT_FRAMEWORK) + message(FATAL_ERROR "GSRoot not found: ${GSROOT_FRAMEWORK}") + endif() + + target_link_libraries(test_package PRIVATE "${GSROOT_FRAMEWORK}") +endif() diff --git a/recipes/archicad-apidevkit/all/test_package/conanfile.py b/recipes/archicad-apidevkit/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f6d3c68ca3efb --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualBuildEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/archicad-apidevkit/all/test_package/test_gsroot.cpp b/recipes/archicad-apidevkit/all/test_package/test_gsroot.cpp new file mode 100644 index 0000000000000..8712d2cd553d3 --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_package/test_gsroot.cpp @@ -0,0 +1,10 @@ +#include +#include + +int main () +{ + Gfx::Color someColor; + someColor.SetRed (176); + + return someColor.GetRed () == 176 ? EXIT_SUCCESS : EXIT_FAILURE; +} diff --git a/recipes/archicad-apidevkit/all/test_v1_package/CMakeLists.txt b/recipes/archicad-apidevkit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..50f1488b009a2 --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS KEEP_RPATHS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/archicad-apidevkit/all/test_v1_package/conanfile.py b/recipes/archicad-apidevkit/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..af4b5cc85f42f --- /dev/null +++ b/recipes/archicad-apidevkit/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conans import CMake +from conan.errors import ConanInvalidConfiguration +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/archicad-apidevkit/config.yml b/recipes/archicad-apidevkit/config.yml new file mode 100644 index 0000000000000..ca23918e2d0f4 --- /dev/null +++ b/recipes/archicad-apidevkit/config.yml @@ -0,0 +1,5 @@ +versions: + "25": + folder: all + "26": + folder: all diff --git a/recipes/arcus/all/CMakeLists.txt b/recipes/arcus/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/arcus/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/arcus/all/conandata.yml b/recipes/arcus/all/conandata.yml index 9e659afa43d49..688b758b7cf3c 100644 --- a/recipes/arcus/all/conandata.yml +++ b/recipes/arcus/all/conandata.yml @@ -2,3 +2,9 @@ sources: "4.9.1": url: "https://github.com/Ultimaker/libArcus/archive/refs/tags/4.9.1.tar.gz" sha256: "18d939fd2428c72fdce35a286c196438327cfc3c8476e463e5ca46570168c9ce" +patches: + "4.9.1": + - patch_file: "patches/0001-fix-cmake.patch" + - patch_file: "patches/0002-protobuf-compat-ge-3.18.patch" + patch_description: "Compatibility with protobuf >= 3.18" + patch_type: "portability" diff --git a/recipes/arcus/all/conanfile.py b/recipes/arcus/all/conanfile.py index b11f3d26915f9..d2e0d9c10f99c 100644 --- a/recipes/arcus/all/conanfile.py +++ b/recipes/arcus/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class ArcusConan(ConanFile): @@ -11,7 +15,7 @@ class ArcusConan(ConanFile): "creating a socket in a thread and using this socket to send " \ "and receive messages based on the Protocol Buffers library." license = "LGPL-3.0-or-later" - topics = ("arcus", "protobuf", "socket", "cura") + topics = ("protobuf", "socket", "cura") homepage = "https://github.com/Ultimaker/libArcus" url = "https://github.com/conan-io/conan-center-index" @@ -26,17 +30,8 @@ class ArcusConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,97 +39,76 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("protobuf/3.17.1") + self.requires("protobuf/3.21.9") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - # Do not force PIC - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set(CMAKE_POSITION_INDEPENDENT_CODE ON)", - "") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set_target_properties(Arcus PROPERTIES COMPILE_FLAGS -fPIC)", - "") - # TODO: this patch could be removed when CMake variables fixed in protobuf recipe - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "target_link_libraries(Arcus PUBLIC ${PROTOBUF_LIBRARIES})", - "target_link_libraries(Arcus PUBLIC protobuf::libprotobuf)") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_PYTHON"] = False - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_STATIC"] = not self.options.shared - if self._is_msvc: - if self.settings.compiler == "Visual Studio": - is_static_runtime = str(self.settings.compiler.runtime).startswith("MT") - else: - is_static_runtime = self.settings.compiler.runtime == "static" - self._cmake.definitions["MSVC_STATIC_RUNTIME"] = is_static_runtime - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_PYTHON"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_STATIC"] = not self.options.shared + if is_msvc(self): + tc.variables["MSVC_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"Arcus": "Arcus::Arcus"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) - - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake") + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join(self._module_subfolder, - "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "Arcus") self.cpp_info.set_property("cmake_target_name", "Arcus") self.cpp_info.libs = ["Arcus"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.extend(["m", "pthread"]) elif self.settings.os == "Windows": self.cpp_info.system_libs.append("ws2_32") # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "Arcus" self.cpp_info.names["cmake_find_package_multi"] = "Arcus" - self.cpp_info.builddirs.append(self._module_subfolder) self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/arcus/all/patches/0001-fix-cmake.patch b/recipes/arcus/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..581de6fa9b257 --- /dev/null +++ b/recipes/arcus/all/patches/0001-fix-cmake.patch @@ -0,0 +1,62 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ ++cmake_minimum_required(VERSION 3.8) + project(arcus) +-cmake_minimum_required(VERSION 3.6) + + include(GNUInstallDirs) + include(CMakePackageConfigHelpers) +@@ -19,7 +19,6 @@ endif() + set(protobuf_MODULE_COMPATIBLE ON CACHE INTERNAL "" FORCE) + find_package(Protobuf 3.0.0 REQUIRED) + +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) #Required if a patch to libArcus needs to be made via templates. + + if(BUILD_PYTHON) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) +@@ -37,11 +36,7 @@ if(BUILD_PYTHON) + include_directories(python/ src/ ${SIP_INCLUDE_DIRS} ${Python3_INCLUDE_DIRS}) + endif() + +-set(CMAKE_CXX_STANDARD 11) + +-if(APPLE AND CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++") +-endif() + + set(arcus_SRCS + src/Socket.cpp +@@ -63,17 +58,16 @@ set(arcus_HDRS + set(ARCUS_VERSION 1.1.0) + set(ARCUS_SOVERSION 3) + +-set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_FULL_LIBDIR}") + + if(BUILD_STATIC) + add_library(Arcus STATIC ${arcus_SRCS}) + if(NOT WIN32 OR CMAKE_COMPILER_IS_GNUCXX) + target_link_libraries(Arcus PRIVATE pthread) +- set_target_properties(Arcus PROPERTIES COMPILE_FLAGS -fPIC) + endif() + else() + add_library(Arcus SHARED ${arcus_SRCS}) + endif() ++target_compile_features(Arcus PUBLIC cxx_std_11) + + if(MSVC_STATIC_RUNTIME) + foreach(flag_var +@@ -97,11 +91,11 @@ target_include_directories(Arcus PUBLIC + $ + ${PROTOBUF_INCLUDE_DIR} + ) +-target_link_libraries(Arcus PUBLIC ${PROTOBUF_LIBRARIES}) ++target_link_libraries(Arcus PUBLIC protobuf::libprotobuf) + + if(WIN32) + add_definitions(-D_WIN32_WINNT=0x0600) # Declare we require Vista or higher, this allows us to use IPv6 functions. +- target_link_libraries(Arcus PUBLIC Ws2_32) ++ target_link_libraries(Arcus PUBLIC ws2_32) + endif() + + if(${CMAKE_BUILD_TYPE}) diff --git a/recipes/arcus/all/patches/0002-protobuf-compat-ge-3.18.patch b/recipes/arcus/all/patches/0002-protobuf-compat-ge-3.18.patch new file mode 100644 index 0000000000000..64e2ba1e5b1a6 --- /dev/null +++ b/recipes/arcus/all/patches/0002-protobuf-compat-ge-3.18.patch @@ -0,0 +1,22 @@ +--- a/src/Socket_p.h ++++ b/src/Socket_p.h +@@ -41,6 +41,7 @@ + #include + #include + #include ++#include + + #include "Socket.h" + #include "Types.h" +@@ -548,7 +549,11 @@ namespace Arcus + + google::protobuf::io::ArrayInputStream array(wire_message->data, wire_message->size); + google::protobuf::io::CodedInputStream stream(&array); ++#if GOOGLE_PROTOBUF_VERSION >= 3006000 ++ stream.SetTotalBytesLimit(message_size_maximum); ++#else + stream.SetTotalBytesLimit(message_size_maximum, message_size_warning); ++#endif + if(!message->ParseFromCodedStream(&stream)) + { + error(ErrorCode::ParseFailedError, "Failed to parse message:" + std::string(wire_message->data)); diff --git a/recipes/arcus/all/test_package/CMakeLists.txt b/recipes/arcus/all/test_package/CMakeLists.txt index ef27cd84029d8..376d65791e678 100644 --- a/recipes/arcus/all/test_package/CMakeLists.txt +++ b/recipes/arcus/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Arcus REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Arcus) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE Arcus) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/arcus/all/test_package/conanfile.py b/recipes/arcus/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/arcus/all/test_package/conanfile.py +++ b/recipes/arcus/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/arcus/all/test_v1_package/CMakeLists.txt b/recipes/arcus/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/arcus/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/arcus/all/test_v1_package/conanfile.py b/recipes/arcus/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/arcus/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/argon2/all/conandata.yml b/recipes/argon2/all/conandata.yml index 589a36b80b11a..9241ad3ee86cd 100644 --- a/recipes/argon2/all/conandata.yml +++ b/recipes/argon2/all/conandata.yml @@ -4,5 +4,4 @@ sources: sha256: "daf972a89577f8772602bf2eb38b6a3dd3d922bf5724d45e7f9589b5e830442c" patches: "20190702": - - base_path: "source_subfolder" - patch_file: "patches/0001-makefile-no-march.patch" + - patch_file: "patches/0001-makefile-no-march.patch" diff --git a/recipes/argon2/all/conanfile.py b/recipes/argon2/all/conanfile.py index 95aff495247cc..9881bc93bce37 100644 --- a/recipes/argon2/all/conanfile.py +++ b/recipes/argon2/all/conanfile.py @@ -1,7 +1,16 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, MSBuild, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, chdir, copy, export_conandata_patches, get, mkdir, + rename, replace_in_file, rm, rmdir +) +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path, MSBuild, MSBuildToolchain import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class Argon2Conan(ConanFile): @@ -10,112 +19,148 @@ class Argon2Conan(ConanFile): homepage = "https://github.com/P-H-C/phc-winner-argon2" url = "https://github.com/conan-io/conan-center-index" description = "Argon2 password hashing library" - topics = ("argon2", "crypto", "password hashing") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - exports_sources = "patches/**" + topics = ("crypto", "password hashing") - @property - def _source_subfolder(self): - return "source_subfolder" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + @property + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if self._settings_build.os == "Windows" and self.settings.compiler != "Visual Studio" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows" and not is_msvc(self): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _kernel_name(self): - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): return "Darwin" - if self.settings.os == "Windows": - return "MINGW" return { "Windows": "MINGW", }.get(str(self.settings.os), str(self.settings.os)) - @property - def _make_args(self): - return ( - "PREFIX={}".format(tools.unix_path(self.package_folder)), - "LIBRARY_REL=lib", - "KERNEL_NAME={}".format(self._kernel_name), - "RUN_EXT={}".format(".exe" if self.settings.os == "Windows" else ""), - ) + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.make_args.extend([ + "LIBRARY_REL=lib", + f"KERNEL_NAME={self._kernel_name}", + "RUN_EXT={}".format(".exe" if self.settings.os == "Windows" else ""), + ]) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - vcxproj = os.path.join(self._source_subfolder, "vs2015", "Argon2OptDll", "Argon2OptDll.vcxproj") - argon2_header = os.path.join(self._source_subfolder, "include", "argon2.h") - if not self.options.shared: - tools.replace_in_file(argon2_header, "__declspec(dllexport)", "") - tools.replace_in_file(vcxproj, "DynamicLibrary", "StaticLibrary") - tools.replace_in_file(vcxproj, "", "$(SolutionDir)include;%(AdditionalIncludeDirectories)") - tools.replace_in_file(vcxproj, "8.1", "") - if self.settings.compiler == "Visual Studio": + apply_conandata_patches(self) + if is_msvc(self): + vcxproj = os.path.join(self.source_folder, "vs2015", "Argon2OptDll", "Argon2OptDll.vcxproj") + argon2_header = os.path.join(self.source_folder, "include", "argon2.h") + if not self.options.shared: + replace_in_file(self, argon2_header, "__declspec(dllexport)", "") + replace_in_file(self, vcxproj, "DynamicLibrary", "StaticLibrary") + replace_in_file( + self, vcxproj, + "", + "$(SolutionDir)include;%(AdditionalIncludeDirectories)", + ) + replace_in_file(self, vcxproj, "8.1", "") + + #========================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file(self, vcxproj, "true", "") + platform_toolset = MSBuildToolchain(self).toolset + replace_in_file( + self, vcxproj, + "$(DefaultPlatformToolset)", + f"{platform_toolset}", + ) + replace_in_file( + self, vcxproj, + "", + f"", + ) + #========================== + msbuild = MSBuild(self) - msbuild.build(os.path.join(self._source_subfolder, "Argon2.sln"), targets=("Argon2OptDll",))#, platforms={"x86": "Win32"}) + msbuild.build_type = self._msbuild_configuration + msbuild.build(os.path.join(self.source_folder, "Argon2.sln"), targets=["Argon2OptDll"]) if self.options.shared: - tools.replace_in_file(argon2_header, "__declspec(dllexport)", "__declspec(dllimport)") + replace_in_file(self, argon2_header, "__declspec(dllexport)", "__declspec(dllimport)") else: - with tools.chdir(self._source_subfolder): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with tools.environment_append(autotools.vars): - autotools.make(args=self._make_args, target="libs") + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.make(target="libs") def package(self): - self.copy("*LICENSE", src=self._source_subfolder, dst="licenses", keep_path=False) - if self.settings.compiler == "Visual Studio": - self.copy("*.h", src=os.path.join(self._source_subfolder, "include"), dst="include") - self.copy("*.dll", src=os.path.join(self._source_subfolder, "vs2015", "build"), dst="bin") - self.copy("*.lib", src=os.path.join(self._source_subfolder, "vs2015", "build"), dst="lib") - os.rename(os.path.join(self.package_folder, "lib", "Argon2OptDll.lib"), - os.path.join(self.package_folder, "lib", "argon2.lib")) + copy(self, "*LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + bin_folder = os.path.join(self.package_folder, "bin") + lib_folder = os.path.join(self.package_folder, "lib") + if is_msvc(self): + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + output_folder = os.path.join(self.source_folder, "vs2015", "build") + copy(self, "*.dll", src=output_folder, dst=bin_folder, keep_path=False) + copy(self, "*.lib", src=output_folder, dst=lib_folder, keep_path=False) + rename(self, os.path.join(lib_folder, "Argon2OptDll.lib"), os.path.join(lib_folder, "argon2.lib")) else: - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with tools.chdir(self._source_subfolder): - with tools.environment_append(autotools.vars): - autotools.install(args=self._make_args) - # drop unneeded dirs - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "bin")) - if self.settings.os == "Windows" and self.options.shared: - os.unlink(os.path.join(self.package_folder, "lib", "libargon2.a")) - self.copy("libargon2.dll.a", src=self._source_subfolder, dst="lib") - tools.mkdir(os.path.join(self.package_folder, "bin")) - os.rename(os.path.join(self.package_folder, "lib", "libargon2.dll"), - os.path.join(self.package_folder, "bin", "libargon2.dll")) - # drop unneeded libs + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}", "PREFIX=/"]) + rmdir(self, os.path.join(lib_folder, "pkgconfig")) + rmdir(self, bin_folder) if self.options.shared: - if self.settings.os != "Windows": - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.a*") + rm(self, "*.a", lib_folder) + if self.settings.os == "Windows": + mkdir(self, bin_folder) + rename(self, os.path.join(lib_folder, "libargon2.dll"), os.path.join(bin_folder, "libargon2.dll")) + copy(self, "libargon2.dll.a", src=self.source_folder, dst=lib_folder) else: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.dll") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.so") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.so.*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.dylib") + rm(self, "*.dll", lib_folder) + rm(self, "*.so*", lib_folder) + rm(self, "*.dylib", lib_folder) def package_info(self): - self.cpp_info.names["pkg_config"] = "libargon2" + self.cpp_info.set_property("pkg_config_name", "libargon2") self.cpp_info.libs = ["argon2"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/argon2/all/test_package/CMakeLists.txt b/recipes/argon2/all/test_package/CMakeLists.txt index b570e22ca35d5..665425a420e57 100644 --- a/recipes/argon2/all/test_package/CMakeLists.txt +++ b/recipes/argon2/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1.2) -project(test_package CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(argon2 REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE argon2::argon2) diff --git a/recipes/argon2/all/test_package/conanfile.py b/recipes/argon2/all/test_package/conanfile.py index d4128b0450777..98ab55852ad56 100644 --- a/recipes/argon2/all/test_package/conanfile.py +++ b/recipes/argon2/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/argon2/all/test_package/test_package.c b/recipes/argon2/all/test_package/test_package.c new file mode 100644 index 0000000000000..e53c74b315943 --- /dev/null +++ b/recipes/argon2/all/test_package/test_package.c @@ -0,0 +1,23 @@ +#include "argon2.h" +#include + +int main() { + const char *salt = "SALTSTR"; + const char *pwd = "password"; + + char encoded[97]; + + // high-level API + argon2id_hash_encoded(2, 1<<16, 2, pwd, sizeof(pwd), salt, sizeof(salt), 32, encoded, sizeof(encoded)); + + printf("Encoded password: %s", encoded); + int res = argon2id_verify(encoded, pwd, sizeof(pwd)); + + if (res == 0){ + printf("Verify password OK\n"); + } else { + printf("Something went wrong while verify password\n"); + } + + return 0; +} diff --git a/recipes/argon2/all/test_package/test_package.cpp b/recipes/argon2/all/test_package/test_package.cpp deleted file mode 100644 index aaf97a7985fd5..0000000000000 --- a/recipes/argon2/all/test_package/test_package.cpp +++ /dev/null @@ -1,23 +0,0 @@ -#include "argon2.h" -#include - -int main() { - const char *salt = "SALTSTR"; - const char *pwd = "password"; - - char encoded[97] = {}; - - // high-level API - argon2id_hash_encoded(2, 1<<16, 2, pwd, sizeof(pwd), salt, sizeof(salt), 32, encoded, sizeof(encoded)); - - printf("Encoded password: %s", encoded); - int res = argon2id_verify(encoded, pwd, sizeof(pwd)); - - if (res == 0){ - printf("Verify password OK\n"); - } else { - printf("Something went wrong while verify password\n"); - } - - return 0; -} diff --git a/recipes/argon2/all/test_v1_package/CMakeLists.txt b/recipes/argon2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/argon2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/argon2/all/test_v1_package/conanfile.py b/recipes/argon2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/argon2/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/argparse/all/conandata.yml b/recipes/argparse/all/conandata.yml index 741831c2fa64b..18f4555649896 100644 --- a/recipes/argparse/all/conandata.yml +++ b/recipes/argparse/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.9": + url: "https://github.com/p-ranav/argparse/archive/v2.9.tar.gz" + sha256: "cd563293580b9dc592254df35b49cf8a19b4870ff5f611c7584cf967d9e6031e" "2.6": url: "https://github.com/p-ranav/argparse/archive/v2.6.tar.gz" sha256: "da261c3b3010c10a163f4535bbe2b160319d2a6b1e0fd2eb5a7b9f6a85c29021" diff --git a/recipes/argparse/config.yml b/recipes/argparse/config.yml index c4a01f65b8f9b..5a743e89da3ef 100644 --- a/recipes/argparse/config.yml +++ b/recipes/argparse/config.yml @@ -1,4 +1,6 @@ versions: + "2.9": + folder: all "2.6": folder: all "2.5": diff --git a/recipes/argtable2/all/conandata.yml b/recipes/argtable2/all/conandata.yml index 9f0629c6216d9..d126dc0b958f8 100644 --- a/recipes/argtable2/all/conandata.yml +++ b/recipes/argtable2/all/conandata.yml @@ -5,8 +5,5 @@ sources: patches: "2.13": - patch_file: "patches/2.13-0001-enable-mingw-dll.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.13-0002-msvc-nmake-accept-conan-flags.patch" - base_path: "source_subfolder" + - patch_file: "patches/2.13-0002-msvc-nmake-honor-profile.patch" - patch_file: "patches/2.13-0003-armv8-build.patch" - base_path: "source_subfolder" diff --git a/recipes/argtable2/all/conanfile.py b/recipes/argtable2/all/conanfile.py index 4ad0658c61784..4e3ccd375b1a6 100644 --- a/recipes/argtable2/all/conanfile.py +++ b/recipes/argtable2/all/conanfile.py @@ -1,14 +1,19 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rename, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, NMakeToolchain import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.55.0" class Argtable2Conan(ConanFile): name = "argtable2" description = "Argtable is an ANSI C library for parsing GNU style command line options with a minimum of fuss." - topics = ("conan", "argtable2", "argument", "parsing", "getopt") + topics = ("argument", "parsing", "getopt") license = "LGPL-2.0+" homepage = "http://argtable.sourceforge.net/" url = "https://github.com/conan-io/conan-center-index" @@ -22,105 +27,82 @@ class Argtable2Conan(ConanFile): "fPIC": True, } - generators = "cmake", "pkg_config", "cmake_find_package" - exports_sources = "patches/**" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if self.settings.compiler != "Visual Studio": - self.build_requires("gnu-config/cci.20201022") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not is_msvc(self): + self.tool_requires("gnu-config/cci.20210814") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @property - def _user_info_build(self): - # If using the experimental feature with different context for host and - # build, the 'user_info' attributes of the 'build_requires' packages - # will be located into the 'user_info_build' object. In other cases they - # will be located into the 'deps_user_info' object. - return getattr(self, "user_info_build", None) or self.deps_user_info - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] + get(self, **self.conan_data["sources"][self.version], strip_root=True) - # it contains outdated 'config.sub' and - # 'config.guess' files. It not allows to build libelf for armv8 arch. - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools - - def _run_nmake(self, target): - autotools = AutoToolsBuildEnvironment(self) - autotools.libs = [] - vars = " ".join("CONAN_{}=\"{}\"".format(k, v) for k, v in autotools.vars.items()) - with tools.vcvars(self.settings): - with tools.chdir(os.path.join(self._source_subfolder, "src")): - self.run("nmake -f Makefile.nmake {} {}".format(target, vars), run_environment=True) + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self.settings.compiler == "Visual Studio": - self._run_nmake("argtable2.dll" if self.options.shared else "argtable2.lib") + apply_conandata_patches(self) + if is_msvc(self): + with chdir(self, os.path.join(self.source_folder, "src")): + target = "argtable2.dll" if self.options.shared else "argtable2.lib" + self.run(f"nmake -f Makefile.nmake {target}") else: - autotools = self._configure_autotools() + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - if self.settings.compiler == "Visual Studio": - self.copy("*.lib", src=os.path.join(self._source_subfolder, "src"), dst="lib") - self.copy("*.dll", src=os.path.join(self._source_subfolder, "src"), dst="bin") - self.copy("argtable2.h", src=os.path.join(self._source_subfolder, "src"), dst="include") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + output_folder = os.path.join(self.source_folder, "src") + copy(self, "*.lib", src=output_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "argtable2.h", src=output_folder, dst=os.path.join(self.package_folder, "include"), keep_path=False) if self.options.shared: - os.rename(os.path.join(self.package_folder, "lib", "impargtable2.lib"), - os.path.join(self.package_folder, "lib", "argtable2.lib")) + rename(self, os.path.join(self.package_folder, "lib", "impargtable2.lib"), + os.path.join(self.package_folder, "lib", "argtable2.lib")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "argtable2") self.cpp_info.libs = ["argtable2"] - self.cpp_info.names["pkg_config"] = "argtable2" diff --git a/recipes/argtable2/all/patches/2.13-0002-msvc-nmake-accept-conan-flags.patch b/recipes/argtable2/all/patches/2.13-0002-msvc-nmake-accept-conan-flags.patch deleted file mode 100644 index 33c5a7752c185..0000000000000 --- a/recipes/argtable2/all/patches/2.13-0002-msvc-nmake-accept-conan-flags.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- src/Makefile.nmake -+++ src/Makefile.nmake -@@ -13,12 +13,12 @@ - # HAVE_STRING_H. - # Rather than hand craft a config.h file we just define them here in CFLAGS - # for convenience. --CFLAGS = /W4 /D "WIN32" /D "_MBCS" /D "STDC_HEADERS" /D "HAVE_STDLIB_H" /D "HAVE_STRING_H" /nologo -+CFLAGS = $(CONAN_CFLAGS) $(CONAN_CPPFLAGS) /W4 /D "WIN32" /D "_MBCS" /D "STDC_HEADERS" /D "HAVE_STDLIB_H" /D "HAVE_STRING_H" /nologo - - !IF "$(DEBUG)" == "1" --CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /MLd /RTC1 /ZI -+CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /RTC1 /ZI - !ELSE --CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 /ML /GS /Zi -+CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 /GS /Zi - !ENDIF - - all: argtable2.lib argtable2.dll -@@ -32,7 +32,7 @@ - LIB /OUT:$@ $** - - argtable2.dll: $(OBJS) -- link /DLL /OUT:$@ $** /IMPLIB:impargtable2.lib /def:argtable2.def -+ link /DLL /OUT:$@ $** /IMPLIB:impargtable2.lib /def:argtable2.def $(CONAN_LDFLAGS) - - clean: - del *.exe *.lib *.obj *.idb *.pdb *.dll *.exp diff --git a/recipes/argtable2/all/patches/2.13-0002-msvc-nmake-honor-profile.patch b/recipes/argtable2/all/patches/2.13-0002-msvc-nmake-honor-profile.patch new file mode 100644 index 0000000000000..5fc8451015ecb --- /dev/null +++ b/recipes/argtable2/all/patches/2.13-0002-msvc-nmake-honor-profile.patch @@ -0,0 +1,14 @@ +--- a/src/Makefile.nmake ++++ b/src/Makefile.nmake +@@ -16,9 +16,9 @@ + CFLAGS = /W4 /D "WIN32" /D "_MBCS" /D "STDC_HEADERS" /D "HAVE_STDLIB_H" /D "HAVE_STRING_H" /nologo + + !IF "$(DEBUG)" == "1" +-CFLAGS = $(CFLAGS) /D "_DEBUG" /Od /MLd /RTC1 /ZI ++CFLAGS = $(CFLAGS) /D "_DEBUG" + !ELSE +-CFLAGS = $(CFLAGS) /D "NDEBUG" /O2 /ML /GS /Zi ++CFLAGS = $(CFLAGS) /D "NDEBUG" + !ENDIF + + all: argtable2.lib argtable2.dll diff --git a/recipes/argtable2/all/test_package/CMakeLists.txt b/recipes/argtable2/all/test_package/CMakeLists.txt index 3a403dc404b41..9ae95a47d2481 100644 --- a/recipes/argtable2/all/test_package/CMakeLists.txt +++ b/recipes/argtable2/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() +find_package(argtable2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE argtable2::argtable2) diff --git a/recipes/argtable2/all/test_package/conanfile.py b/recipes/argtable2/all/test_package/conanfile.py index 11cbe23a4ac97..cde4572fbe457 100644 --- a/recipes/argtable2/all/test_package/conanfile.py +++ b/recipes/argtable2/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run("{} -n".format(bin_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(f"{bin_path} -n", env="conanrun") diff --git a/recipes/argtable2/all/test_v1_package/CMakeLists.txt b/recipes/argtable2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/argtable2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/argtable2/all/test_v1_package/conanfile.py b/recipes/argtable2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5c79f133054fa --- /dev/null +++ b/recipes/argtable2/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(f"{bin_path} -n", run_environment=True) diff --git a/recipes/argtable3/all/CMakeLists.txt b/recipes/argtable3/all/CMakeLists.txt deleted file mode 100644 index d3f1ab5676542..0000000000000 --- a/recipes/argtable3/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(CMAKE_HOST_SYSTEM_NAME STREQUAL "Linux") - link_libraries(m) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/argtable3/all/conandata.yml b/recipes/argtable3/all/conandata.yml index 103508c1e8a96..3dfcb090995fa 100644 --- a/recipes/argtable3/all/conandata.yml +++ b/recipes/argtable3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.2": + url: "https://github.com/argtable/argtable3/archive/refs/tags/v3.2.2.f25c624.tar.gz" + sha256: "a5c66d819fa0be0435f37ed2fb3f23e371091722ff74219de97b65f6b9914e51" "3.2.1": url: "https://github.com/argtable/argtable3/releases/download/v3.2.1.52f24e5/argtable-v3.2.1.52f24e5.tar.gz" sha256: "bf02394a21378fdca95937fc4e3aeff8af63a2bfed7e3f87b1c1eda8bf9227dc" @@ -11,7 +14,9 @@ sources: patches: "3.2.0": - patch_file: "patches/3.2.0-0001-cmake-fixes.patch" - base_path: "source_subfolder" + patch_description: "disable example build, make shared/static build separated" + patch_type: "conan" "3.1.5": - patch_file: "patches/3.1.5-0001-cmake-fixes.patch" - base_path: "source_subfolder" + patch_description: "disable example build, make shared/static build separated" + patch_type: "conan" diff --git a/recipes/argtable3/all/conanfile.py b/recipes/argtable3/all/conanfile.py index 64ccba9e5506f..2b2ed84a2b4f5 100644 --- a/recipes/argtable3/all/conanfile.py +++ b/recipes/argtable3/all/conanfile.py @@ -1,17 +1,19 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, save +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os import textwrap -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.53.0" class Argtable3Conan(ConanFile): name = "argtable3" description = "A single-file, ANSI C, command-line parsing library that parses GNU-style command-line options." - topics = ("conan", "argtable3", "command", "line", "argument", "parse", "parsing", "getopt") license = "BSD-3-clause" - homepage = "https://www.argtable.org/" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.argtable.org/" + topics = ("conan", "argtable3", "command", "line", "argument", "parse", "parsing", "getopt") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,14 +24,8 @@ class Argtable3Conan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt", "patches/*" - generators = "cmake" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,59 +33,53 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ARGTABLE3_ENABLE_TESTS"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ARGTABLE3_ENABLE_TESTS"] = False + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # The initial space is important (the cmake script does OFFSET 0) - tools.save(os.path.join(self._source_subfolder, "version.tag"), " {}.0\n".format(self.version)) - cmake = self._configure_cmake() + save(self, os.path.join(self.build_folder, "version.tag"), f" {self.version}.0\n") + cmake = CMake(self) + cmake.configure() cmake.build() - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake") - @property def _module_file_rel_path(self): - return os.path.join(self._module_subfolder, - "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) - # These targets were for versions <= 3.2.0 (newer create argtable3::argtable3) + # These targets were for versions < 3.2.1 (newer create argtable3::argtable3) target_name = "argtable3" if self.options.shared else "argtable3_static" self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), @@ -100,18 +90,21 @@ def package_info(self): suffix = "" if not self.options.shared: suffix += "_static" - if tools.Version(self.version) >= "3.2.1" and self.settings.build_type == "Debug": + if Version(self.version) >= "3.2.1" and self.settings.build_type == "Debug": suffix += "d" - self.cpp_info.libs = ["argtable3{}".format(suffix)] - if not self.options.shared: - if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs.append("m") + self.cpp_info.libs = [f"argtable3{suffix}"] + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.system_libs.append("m") + + self.cpp_info.set_property("cmake_file_name", "Argtable3") + self.cpp_info.set_property("cmake_target_name", "argtable3::argtable3") + # These targets were for versions < 3.2.1 (newer create argtable3::argtable3) + self.cpp_info.set_property("cmake_target_aliases", ["argtable3" if self.options.shared else "argtable3_static"]) + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "Argtable3" self.cpp_info.filenames["cmake_find_package_multi"] = "Argtable3" self.cpp_info.names["cmake_find_package"] = "argtable3" self.cpp_info.names["cmake_find_package_multi"] = "argtable3" - - self.cpp_info.builddirs.append(self._module_subfolder) self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/argtable3/all/test_package/CMakeLists.txt b/recipes/argtable3/all/test_package/CMakeLists.txt index fab7dc3090af1..79004b3e726d4 100644 --- a/recipes/argtable3/all/test_package/CMakeLists.txt +++ b/recipes/argtable3/all/test_package/CMakeLists.txt @@ -1,14 +1,13 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(Argtable3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -if(TARGET argtable3) - target_link_libraries(${PROJECT_NAME} argtable3) +if(Argtable3_VERSION VERSION_GREATER_EQUAL "3.2.1") + target_link_libraries(${PROJECT_NAME} PRIVATE argtable3::argtable3) +elseif(TARGET argtable3) + target_link_libraries(${PROJECT_NAME} PRIVATE argtable3) else() - target_link_libraries(${PROJECT_NAME} argtable3_static) + target_link_libraries(${PROJECT_NAME} PRIVATE argtable3_static) endif() diff --git a/recipes/argtable3/all/test_package/conanfile.py b/recipes/argtable3/all/test_package/conanfile.py index fcd48798a6df1..0ab6dbb34f3d6 100644 --- a/recipes/argtable3/all/test_package/conanfile.py +++ b/recipes/argtable3/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run("{} --help".format(bin_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(f"{bin_path} --help", run_environment=True) diff --git a/recipes/argtable3/all/test_v1_package/CMakeLists.txt b/recipes/argtable3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/argtable3/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/argtable3/all/test_v1_package/conanfile.py b/recipes/argtable3/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b36b4025b8a6a --- /dev/null +++ b/recipes/argtable3/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(f"{bin_path} --help", run_environment=True) diff --git a/recipes/argtable3/config.yml b/recipes/argtable3/config.yml index 2f3c419dfc7ff..70453d7b259cf 100644 --- a/recipes/argtable3/config.yml +++ b/recipes/argtable3/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.2": + folder: "all" "3.2.1": folder: "all" "3.2.0": diff --git a/recipes/armadillo/all/CMakeLists.txt b/recipes/armadillo/all/CMakeLists.txt deleted file mode 100644 index ec859e0f118e0..0000000000000 --- a/recipes/armadillo/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS on) - -add_subdirectory("source_subfolder") diff --git a/recipes/armadillo/all/conandata.yml b/recipes/armadillo/all/conandata.yml index db673d3844290..91baae076a36f 100644 --- a/recipes/armadillo/all/conandata.yml +++ b/recipes/armadillo/all/conandata.yml @@ -3,13 +3,22 @@ sources: url: "http://sourceforge.net/projects/arma/files/armadillo-10.7.0.tar.xz" sha256: "9bf60db6fd237721908747a0e56797b97b7ceae3603f2cca0b012a3b88265d3f" "10.7.3": - url: "http://sourceforge.net/projects/arma/files/armadillo-10.7.3.tar.xz" + url: "https://sourceforge.net/projects/arma/files/armadillo-10.7.3.tar.xz" sha256: "aac930d5fbc23dca9453ff3647d03f7d90d9584a4556719ad7bc7adab7db6ff5" + "11.4.3": + url: "https://sourceforge.net/projects/arma/files/armadillo-11.4.3.tar.xz" + sha256: "87603263664988af41da2ca4f36205e36ea47a9281fa6cfd463115f3797a1da2" patches: "10.7.0": - patch_file: "patches/0001-Guard-dependency-discovery-10.7.x.patch" - base_path: "source_subfolder" + patch_description: "Add find_package statements to inject conan dependencies" + patch_type: "conan" "10.7.3": - patch_file: "patches/0001-Guard-dependency-discovery-10.7.x.patch" - base_path: "source_subfolder" + patch_description: "Add find_package statements to inject conan dependencies" + patch_type: "conan" + "11.4.3": + - patch_file: "patches/0002-Guard-dependency-discovery-11.4.x.patch" + patch_description: "Add find_package statements to inject conan dependencies" + patch_type: "conan" diff --git a/recipes/armadillo/all/conanfile.py b/recipes/armadillo/all/conanfile.py index af32d66f1621f..698da802b3b8f 100644 --- a/recipes/armadillo/all/conanfile.py +++ b/recipes/armadillo/all/conanfile.py @@ -1,7 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import copy, get, rmdir, apply_conandata_patches, export_conandata_patches +from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration import os +required_conan_version = ">=1.53.0" + class ArmadilloConan(ConanFile): name = "armadillo" @@ -68,20 +73,12 @@ class ArmadilloConan(ConanFile): "use_lapack", ], } - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = ( - "cmake", - "cmake_find_package", - ) - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") def config_options(self): if self.settings.os == "Windows": @@ -99,11 +96,11 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, 11) if self.settings.os != "Macos" and ( self.options.use_blas == "framework_accelerate" @@ -183,9 +180,9 @@ def requirements(self): self.options.use_blas == "intel_mkl" and self.options.use_lapack == "intel_mkl" ): - # Consumers can override this requirement with their own by using - # self.requires("intel-mkl/version@user/channel, override=True) in their consumer - # conanfile.py + # Consumers can override this requirement with their own + # by using self.requires("intel-mkl/version@user/channel, override=True) + # in their consumer conanfile.py if ( self.options.use_blas == "intel_mkl" or self.options.use_lapack == "intel_mkl" @@ -195,89 +192,70 @@ def requirements(self): ) self.requires("intel-mkl/2021.4") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ARMA_USE_LAPACK"] = self.options.use_lapack - self._cmake.definitions["ARMA_USE_BLAS"] = self.options.use_blas - self._cmake.definitions["ARMA_USE_ATLAS"] = ( - self.options.use_lapack == "system_atlas" - ) - self._cmake.definitions["ARMA_USE_HDF5"] = self.options.use_hdf5 - self._cmake.definitions["ARMA_USE_ARPACK"] = self.options.use_arpack - self._cmake.definitions["ARMA_USE_EXTERN_RNG"] = self.options.get_safe("use_exern_rng", default=False) - self._cmake.definitions["ARMA_USE_SUPERLU"] = self.options.use_superlu - self._cmake.definitions["ARMA_USE_WRAPPER"] = self.options.use_wrapper - self._cmake.definitions["ARMA_USE_ACCELERATE"] = ( + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ARMA_USE_LAPACK"] = self.options.use_lapack + tc.variables["ARMA_USE_BLAS"] = self.options.use_blas + tc.variables["ARMA_USE_ATLAS"] = self.options.use_lapack == "system_atlas" + tc.variables["ARMA_USE_HDF5"] = self.options.use_hdf5 + tc.variables["ARMA_USE_HDF5_CMAKE"] = self.options.use_hdf5 + tc.variables["ARMA_USE_ARPACK"] = self.options.use_arpack + tc.variables["ARMA_USE_EXTERN_RNG"] = self.options.get_safe("use_exern_rng", default=False) + tc.variables["ARMA_USE_SUPERLU"] = self.options.use_superlu + tc.variables["ARMA_USE_WRAPPER"] = self.options.use_wrapper + tc.variables["ARMA_USE_ACCELERATE"] = ( self.options.use_blas == "framework_accelerate" or self.options.use_lapack == "framework_accelerate" ) and self.settings.os == "Macos" - self._cmake.definitions["DETECT_HDF5"] = self.options.use_hdf5 - self._cmake.definitions["USE_OPENBLAS"] = self.options.use_blas == "openblas" - self._cmake.definitions["USE_MKL"] = ( - self.options.use_blas == "intel_mkl" - and self.options.use_lapack == "intel_mkl" - ) - self._cmake.definitions["USE_SYSTEM_LAPACK"] = ( - self.options.use_lapack == "system_lapack" - ) - self._cmake.definitions["USE_SYSTEM_BLAS"] = ( - self.options.use_blas == "system_blas" - ) - self._cmake.definitions["USE_SYSTEM_ATLAS"] = ( - self.options.use_lapack == "system_atlas" - ) - self._cmake.definitions["USE_SYSTEM_HDF5"] = False - self._cmake.definitions["USE_SYSTEM_ARPACK"] = self.options.use_arpack - self._cmake.definitions["USE_SYSTEM_SUPERLU"] = self.options.use_superlu - self._cmake.definitions["USE_SYSTEM_OPENBLAS"] = False - self._cmake.definitions["USE_SYSTEM_FLEXIBLAS"] = ( - self.options.use_blas == "system_flexiblas" - ) - self._cmake.definitions["ALLOW_FLEXIBLAS_LINUX"] = ( - self.options.use_blas == "system_flexiblas" and self.settings.os == "Linux" - ) - self._cmake.definitions["ALLOW_OPENBLAS_MACOS"] = ( - self.options.use_blas == "openblas" - ) and self.settings.os == "Macos" - self._cmake.definitions["ALLOW_BLAS_LAPACK_MACOS"] = ( - self.options.use_blas != "framework_accelerate" - ) - self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["DETECT_HDF5"] = self.options.use_hdf5 + tc.variables["USE_OPENBLAS"] = (self.options.use_blas == "openblas") + tc.variables["USE_MKL"] = self.options.use_blas == "intel_mkl" and self.options.use_lapack == "intel_mkl" + tc.variables["USE_SYSTEM_LAPACK"] = self.options.use_lapack == "system_lapack" + tc.variables["USE_SYSTEM_BLAS"] = (self.options.use_blas == "system_blas") + tc.variables["USE_SYSTEM_ATLAS"] = self.options.use_lapack == "system_atlas" + tc.variables["USE_SYSTEM_HDF5"] = False + tc.variables["USE_SYSTEM_ARPACK"] = self.options.use_arpack + tc.variables["USE_SYSTEM_SUPERLU"] = self.options.use_superlu + tc.variables["USE_SYSTEM_OPENBLAS"] = False + tc.variables["USE_SYSTEM_FLEXIBLAS"] = self.options.use_blas == "system_flexiblas" + tc.variables["ALLOW_FLEXIBLAS_LINUX"] = self.options.use_blas == "system_flexiblas" and self.settings.os == "Linux" + tc.variables["ALLOW_OPENBLAS_MACOS"] = self.options.use_blas == "openblas" and self.settings.os == "Macos" + tc.variables["OPENBLAS_PROVIDES_LAPACK"] = self.options.use_lapack == "openblas" + tc.variables["ALLOW_BLAS_LAPACK_MACOS"] = self.options.use_blas != "framework_accelerate" + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["BUILD_SMOKE_TEST"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def source(self): - tools.get( + get(self, **self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder, - filename="{name}-{version}.tar.xz".format( - name=self.name, version=self.version - ), + filename="f{self.name}-{self.version}.tar.xz" ) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy("NOTICE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + + copy(self, "LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "NOTICE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libs = ["armadillo"] - self.cpp_info.names["pkg_config"] = "armadillo" + self.cpp_info.set_property("pkg_config_name", "armadillo") if self.options.get_safe("use_extern_rng"): self.cpp_info.defines.append("ARMA_USE_EXTERN_RNG") diff --git a/recipes/armadillo/all/patches/0002-Guard-dependency-discovery-11.4.x.patch b/recipes/armadillo/all/patches/0002-Guard-dependency-discovery-11.4.x.patch new file mode 100644 index 0000000000000..33fb53382e9ee --- /dev/null +++ b/recipes/armadillo/all/patches/0002-Guard-dependency-discovery-11.4.x.patch @@ -0,0 +1,155 @@ +From aa49b619333a25d892d119836ca97dd1d833475d Mon Sep 17 00:00:00 2001 +From: Samuel Dowling +Date: Thu, 5 Jan 2023 00:02:06 +1030 +Subject: [PATCH 1/1] Guard dependency discovery + +* Add guards to prevent usage of custom cmake find package scripts. +* Remove ability to inject hdf5 include directory into compiled binary +--- + CMakeLists.txt | 78 ++++++++++++++++++++----- + include/armadillo_bits/config.hpp.cmake | 2 +- + 2 files changed, 64 insertions(+), 16 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index da1ff3a..7bdd808 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -275,7 +275,11 @@ if(APPLE) + set(ARMA_USE_ACCELERATE true) + + if(ALLOW_OPENBLAS_MACOS) +- include(ARMA_FindOpenBLAS) ++ if(USE_OPENBLAS) ++ find_package(OpenBLAS) ++ else() ++ set(OpenBLAS_FOUND NO) ++ endif() + message(STATUS "OpenBLAS_FOUND = ${OpenBLAS_FOUND}") + message(STATUS "") + message(STATUS "*** If use of OpenBLAS is causing problems,") +@@ -290,8 +294,16 @@ if(APPLE) + endif() + + if(ALLOW_BLAS_LAPACK_MACOS) +- include(ARMA_FindBLAS) +- include(ARMA_FindLAPACK) ++ if(USE_SYSTEM_BLAS) ++ include(ARMA_FindBLAS) ++ else() ++ set(BLAS_FOUND NO) ++ endif() ++ if(USE_SYSTEM_LAPACK) ++ include(ARMA_FindLAPACK) ++ else() ++ set(LAPACK_FOUND NO) ++ endif() + message(STATUS " BLAS_FOUND = ${BLAS_FOUND}" ) + message(STATUS "LAPACK_FOUND = ${LAPACK_FOUND}") + message(STATUS "") +@@ -331,17 +343,45 @@ if(APPLE) + else() + + if(ALLOW_FLEXIBLAS_LINUX AND (${CMAKE_SYSTEM_NAME} MATCHES "Linux")) +- include(ARMA_FindFlexiBLAS) ++ if(USE_SYSTEM_FLEXIBLAS) ++ include(ARMA_FindFlexiBLAS) ++ else() ++ set(FlexiBLAS_FOUND NO) ++ endif() + else() + set(FlexiBLAS_FOUND false) + endif() +- +- include(ARMA_FindMKL) +- include(ARMA_FindOpenBLAS) +- include(ARMA_FindATLAS) # TODO: remove support for ATLAS in next major version +- include(ARMA_FindBLAS) +- include(ARMA_FindLAPACK) +- ++ ++ if(USE_MKL) ++ find_package(MKL) ++ else() ++ set(MKL_FOUND NO) ++ endif() ++ ++ if(USE_OPENBLAS) ++ find_package(OpenBLAS) ++ else() ++ set(OpenBLAS_FOUND NO) ++ endif() ++ ++ if(USE_SYSTEM_ATLAS) ++ include(ARMA_FindATLAS) ++ else() ++ set(ATLAS_FOUND NO) ++ endif() ++ ++ if(USE_SYSTEM_BLAS) ++ include(ARMA_FindBLAS) ++ else() ++ set(BLAS_FOUND NO) ++ endif() ++ ++ if(USE_SYSTEM_LAPACK) ++ include(ARMA_FindLAPACK) ++ else() ++ set(LAPACK_FOUND NO) ++ endif() ++ + message(STATUS "FlexiBLAS_FOUND = ${FlexiBLAS_FOUND}" ) + message(STATUS " MKL_FOUND = ${MKL_FOUND}" ) + message(STATUS " OpenBLAS_FOUND = ${OpenBLAS_FOUND}" ) +@@ -493,8 +533,6 @@ if(DETECT_HDF5) + # HDF5_INCLUDE_DIRS is the correct include directory. So, in either case we + # can use the first element in the list. Issue a status message, too, just + # for good measure. +- list(GET HDF5_INCLUDE_DIRS 0 ARMA_HDF5_INCLUDE_DIR) +- message(STATUS "ARMA_HDF5_INCLUDE_DIR = ${ARMA_HDF5_INCLUDE_DIR}") + message(STATUS "") + message(STATUS "*** If use of HDF5 is causing problems,") + message(STATUS "*** rerun cmake with HDF5 detection disabled:") +@@ -503,7 +541,12 @@ if(DETECT_HDF5) + endif() + endif() + +-include(ARMA_FindARPACK) ++if(USE_SYSTEM_ARPACK) ++ include(ARMA_FindARPACK) ++else() ++ set(ARPACK_FOUND NO) ++endif() ++ + message(STATUS "ARPACK_FOUND = ${ARPACK_FOUND}") + + if(ARPACK_FOUND) +@@ -511,7 +554,12 @@ if(ARPACK_FOUND) + set(ARMA_LIBS ${ARMA_LIBS} ${ARPACK_LIBRARY}) + endif() + +-include(ARMA_FindSuperLU5) ++if(USE_SYSTEM_SUPERLU) ++ include(ARMA_FindSuperLU5) ++else() ++ set(SuperLU_FOUND NO) ++endif() ++ + message(STATUS "SuperLU_FOUND = ${SuperLU_FOUND}") + + if(SuperLU_FOUND) +diff --git a/include/armadillo_bits/config.hpp.cmake b/include/armadillo_bits/config.hpp.cmake +index 07c85b8..584e01e 100644 +--- a/include/armadillo_bits/config.hpp.cmake ++++ b/include/armadillo_bits/config.hpp.cmake +@@ -164,7 +164,7 @@ + #undef ARMA_USE_HDF5 + #define ARMA_USE_HDF5 + +- #define ARMA_HDF5_INCLUDE_DIR ${ARMA_HDF5_INCLUDE_DIR}/ ++ // #define ARMA_HDF5_INCLUDE_DIR ${ARMA_HDF5_INCLUDE_DIR}/ + #endif + + #if !defined(ARMA_MAT_PREALLOC) +-- +2.39.0 + diff --git a/recipes/armadillo/all/test_package/CMakeLists.txt b/recipes/armadillo/all/test_package/CMakeLists.txt index 708a6618b6043..2ede063cb4884 100644 --- a/recipes/armadillo/all/test_package/CMakeLists.txt +++ b/recipes/armadillo/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.6) +cmake_minimum_required(VERSION 3.15) project(PackageTest CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(armadillo CONFIG REQUIRED) -find_package(armadillo REQUIRED) - -add_executable(example example.cpp) +add_executable(example src/example.cpp) target_link_libraries(example armadillo::armadillo) set_property(TARGET example PROPERTY CXX_STANDARD 11) diff --git a/recipes/armadillo/all/test_package/conanfile.py b/recipes/armadillo/all/test_package/conanfile.py index 5eba7cbe1bb9c..4a901f505fcdd 100644 --- a/recipes/armadillo/all/test_package/conanfile.py +++ b/recipes/armadillo/all/test_package/conanfile.py @@ -1,18 +1,30 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import cross_building -class ArmadilloTestConan(ConanFile): +class FooTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + # VirtualBuildEnv and VirtualRunEnv can be avoided if "tools.env.virtualenv:auto_use" is defined + # (it will be defined in Conan 2.0) + generators = "CMakeDeps", "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv" + apply_env = False + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) cmake.configure() cmake.build() + def layout(self): + cmake_layout(self) + def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if not cross_building(self): + cmd = os.path.join(self.cpp.build.bindirs[0], "example") + self.run(cmd, env="conanrun") diff --git a/recipes/armadillo/all/test_package/example.cpp b/recipes/armadillo/all/test_package/example.cpp deleted file mode 100644 index e931fd518cedd..0000000000000 --- a/recipes/armadillo/all/test_package/example.cpp +++ /dev/null @@ -1,207 +0,0 @@ -#include -#include - -using namespace std; -using namespace arma; - -// Armadillo documentation is available at: -// http://arma.sourceforge.net/docs.html - -// NOTE: the C++11 "auto" keyword is not recommended for use with Armadillo objects and functions - -int -main(int argc, char** argv) - { - cout << "Armadillo version: " << arma_version::as_string() << endl; - - // construct a matrix according to given size and form of element initialisation - mat A(2,3,fill::zeros); - - // .n_rows and .n_cols are read only - cout << "A.n_rows: " << A.n_rows << endl; - cout << "A.n_cols: " << A.n_cols << endl; - - A(1,2) = 456.0; // access an element (indexing starts at 0) - A.print("A:"); - - A = 5.0; // scalars are treated as a 1x1 matrix - A.print("A:"); - - A.set_size(4,5); // change the size (data is not preserved) - - A.fill(5.0); // set all elements to a specific value - A.print("A:"); - - A = { { 0.165300, 0.454037, 0.995795, 0.124098, 0.047084 }, - { 0.688782, 0.036549, 0.552848, 0.937664, 0.866401 }, - { 0.348740, 0.479388, 0.506228, 0.145673, 0.491547 }, - { 0.148678, 0.682258, 0.571154, 0.874724, 0.444632 }, - { 0.245726, 0.595218, 0.409327, 0.367827, 0.385736 } }; - - A.print("A:"); - -#ifdef ARMA_USE_LAPACK - // determinant - cout << "det(A): " << det(A) << endl; - - // inverse - cout << "inv(A): " << endl << inv(A) << endl; -#else - cout << "LAPACK not available. Skipping calls to functions det() and inv()" << endl; -#endif - - // save matrix as a text file - A.save("A.txt", raw_ascii); - - // load from file - mat B; - B.load("A.txt"); - - // submatrices - cout << "B( span(0,2), span(3,4) ):" << endl << B( span(0,2), span(3,4) ) << endl; - - cout << "B( 0,3, size(3,2) ):" << endl << B( 0,3, size(3,2) ) << endl; - - cout << "B.row(0): " << endl << B.row(0) << endl; - - cout << "B.col(1): " << endl << B.col(1) << endl; - - // transpose - cout << "B.t(): " << endl << B.t() << endl; - - // maximum from each column (traverse along rows) - cout << "max(B): " << endl << max(B) << endl; - - // maximum from each row (traverse along columns) - cout << "max(B,1): " << endl << max(B,1) << endl; - - // maximum value in B - cout << "max(max(B)) = " << max(max(B)) << endl; - - // sum of each column (traverse along rows) - cout << "sum(B): " << endl << sum(B) << endl; - - // sum of each row (traverse along columns) - cout << "sum(B,1) =" << endl << sum(B,1) << endl; - - // sum of all elements - cout << "accu(B): " << accu(B) << endl; - - // trace = sum along diagonal - cout << "trace(B): " << trace(B) << endl; - - // generate the identity matrix - mat C = eye(4,4); - - // random matrix with values uniformly distributed in the [0,1] interval - mat D = randu(4,4); - D.print("D:"); - - // row vectors are treated like a matrix with one row - rowvec r = { 0.59119, 0.77321, 0.60275, 0.35887, 0.51683 }; - r.print("r:"); - - // column vectors are treated like a matrix with one column - vec q = { 0.14333, 0.59478, 0.14481, 0.58558, 0.60809 }; - q.print("q:"); - - // convert matrix to vector; data in matrices is stored column-by-column - vec v = vectorise(A); - v.print("v:"); - - // dot or inner product - cout << "as_scalar(r*q): " << as_scalar(r*q) << endl; - - // outer product - cout << "q*r: " << endl << q*r << endl; - - // multiply-and-accumulate operation (no temporary matrices are created) - cout << "accu(A % B) = " << accu(A % B) << endl; - - // example of a compound operation - B += 2.0 * A.t(); - B.print("B:"); - - // imat specifies an integer matrix - imat AA = { { 1, 2, 3 }, - { 4, 5, 6 }, - { 7, 8, 9 } }; - - imat BB = { { 3, 2, 1 }, - { 6, 5, 4 }, - { 9, 8, 7 } }; - - // comparison of matrices (element-wise); output of a relational operator is a umat - umat ZZ = (AA >= BB); - ZZ.print("ZZ:"); - - // cubes ("3D matrices") - cube Q( B.n_rows, B.n_cols, 2 ); - - Q.slice(0) = B; - Q.slice(1) = 2.0 * B; - - Q.print("Q:"); - - // 2D field of matrices; 3D fields are also supported - field F(4,3); - - for(uword col=0; col < F.n_cols; ++col) - for(uword row=0; row < F.n_rows; ++row) - { - F(row,col) = randu(2,3); // each element in field is a matrix - } - - F.print("F:"); - - // Test that the result of the use_extern_rng option in the conan recipe -#ifdef ARMA_USE_EXTERN_RNG - cout << "ARMA_USE_EXTERN_RNG set." << endl; -#else - cout << "ARMA_USE_EXTERN_RNG not set." << endl; -#endif - - arma::vec v2{1,2,3,4}; - arma::arma_rng::set_seed(1237); - v2.randn(); - v2.print("v2 (randn):"); - -#ifdef ARMA_USE_HDF5 - std::cout << "ARMA_USE_HDF5 set" << std::endl; - arma::Mat a; - a.randu(20, 20); - - // Save first. - a.save("file.h5", hdf5_binary); - - // Load as different matrix. - arma::Mat b; - b.load("file.h5", hdf5_binary); - - // Check that they are the same. - bool result = true; - for (uword i = 0; i < a.n_elem; ++i) - { - result *= a[i] == b[i]; - } - std::cout << "Matrix written to and read from file.h5 are equivalent: " << result << "\n"; - - // Now autoload. - arma::Mat c; - c.load("file.h5"); - - // Check that they are the same. - result = true; - for (uword i = 0; i < a.n_elem; ++i) - { - result *= a[i] == c[i]; - } - std::cout << "Matrix written to and autoloaded from file.h5 are equivalent: " << result << "\n"; - - std::remove("file.h5"); -#else - std::cout << "ARMA_USE_HDF5 not set" << std::endl; -#endif - - return 0; - } diff --git a/recipes/armadillo/all/test_package/src/example.cpp b/recipes/armadillo/all/test_package/src/example.cpp new file mode 100644 index 0000000000000..2244a238d35fb --- /dev/null +++ b/recipes/armadillo/all/test_package/src/example.cpp @@ -0,0 +1,207 @@ +#include +#include + +using namespace std; +using namespace arma; + +// Armadillo documentation is available at: +// http://arma.sourceforge.net/docs.html + +// NOTE: the C++11 "auto" keyword is not recommended for use with Armadillo objects and functions + +int +main(int argc, char** argv) +{ + cout << "Armadillo version: " << arma_version::as_string() << endl; + + // construct a matrix according to given size and form of element initialisation + mat A(2,3,fill::zeros); + + // .n_rows and .n_cols are read only + cout << "A.n_rows: " << A.n_rows << endl; + cout << "A.n_cols: " << A.n_cols << endl; + + A(1,2) = 456.0; // access an element (indexing starts at 0) + A.print("A:"); + + A = 5.0; // scalars are treated as a 1x1 matrix + A.print("A:"); + + A.set_size(4,5); // change the size (data is not preserved) + + A.fill(5.0); // set all elements to a specific value + A.print("A:"); + + A = { { 0.165300, 0.454037, 0.995795, 0.124098, 0.047084 }, + { 0.688782, 0.036549, 0.552848, 0.937664, 0.866401 }, + { 0.348740, 0.479388, 0.506228, 0.145673, 0.491547 }, + { 0.148678, 0.682258, 0.571154, 0.874724, 0.444632 }, + { 0.245726, 0.595218, 0.409327, 0.367827, 0.385736 } }; + + A.print("A:"); + +#ifdef ARMA_USE_LAPACK + // determinant + cout << "det(A): " << det(A) << endl; + + // inverse + cout << "inv(A): " << endl << inv(A) << endl; +#else + cout << "LAPACK not available. Skipping calls to functions det() and inv()" << endl; +#endif + + // save matrix as a text file + A.save("A.txt", raw_ascii); + + // load from file + mat B; + B.load("A.txt"); + + // submatrices + cout << "B( span(0,2), span(3,4) ):" << endl << B( span(0,2), span(3,4) ) << endl; + + cout << "B( 0,3, size(3,2) ):" << endl << B( 0,3, size(3,2) ) << endl; + + cout << "B.row(0): " << endl << B.row(0) << endl; + + cout << "B.col(1): " << endl << B.col(1) << endl; + + // transpose + cout << "B.t(): " << endl << B.t() << endl; + + // maximum from each column (traverse along rows) + cout << "max(B): " << endl << max(B) << endl; + + // maximum from each row (traverse along columns) + cout << "max(B,1): " << endl << max(B,1) << endl; + + // maximum value in B + cout << "max(max(B)) = " << max(max(B)) << endl; + + // sum of each column (traverse along rows) + cout << "sum(B): " << endl << sum(B) << endl; + + // sum of each row (traverse along columns) + cout << "sum(B,1) =" << endl << sum(B,1) << endl; + + // sum of all elements + cout << "accu(B): " << accu(B) << endl; + + // trace = sum along diagonal + cout << "trace(B): " << trace(B) << endl; + + // generate the identity matrix + mat C = eye(4,4); + + // random matrix with values uniformly distributed in the [0,1] interval + mat D = randu(4,4); + D.print("D:"); + + // row vectors are treated like a matrix with one row + rowvec r = { 0.59119, 0.77321, 0.60275, 0.35887, 0.51683 }; + r.print("r:"); + + // column vectors are treated like a matrix with one column + vec q = { 0.14333, 0.59478, 0.14481, 0.58558, 0.60809 }; + q.print("q:"); + + // convert matrix to vector; data in matrices is stored column-by-column + vec v = vectorise(A); + v.print("v:"); + + // dot or inner product + cout << "as_scalar(r*q): " << as_scalar(r*q) << endl; + + // outer product + cout << "q*r: " << endl << q*r << endl; + + // multiply-and-accumulate operation (no temporary matrices are created) + cout << "accu(A % B) = " << accu(A % B) << endl; + + // example of a compound operation + B += 2.0 * A.t(); + B.print("B:"); + + // imat specifies an integer matrix + imat AA = { { 1, 2, 3 }, + { 4, 5, 6 }, + { 7, 8, 9 } }; + + imat BB = { { 3, 2, 1 }, + { 6, 5, 4 }, + { 9, 8, 7 } }; + + // comparison of matrices (element-wise); output of a relational operator is a umat + umat ZZ = (AA >= BB); + ZZ.print("ZZ:"); + + // cubes ("3D matrices") + cube Q( B.n_rows, B.n_cols, 2 ); + + Q.slice(0) = B; + Q.slice(1) = 2.0 * B; + + Q.print("Q:"); + + // 2D field of matrices; 3D fields are also supported + field F(4,3); + + for(uword col=0; col < F.n_cols; ++col) + for(uword row=0; row < F.n_rows; ++row) + { + F(row,col) = randu(2,3); // each element in field is a matrix + } + + F.print("F:"); + + // Test that the result of the use_extern_rng option in the conan recipe +#ifdef ARMA_USE_EXTERN_RNG + cout << "ARMA_USE_EXTERN_RNG set." << endl; +#else + cout << "ARMA_USE_EXTERN_RNG not set." << endl; +#endif + + arma::vec v2{1,2,3,4}; + arma::arma_rng::set_seed(1237); + v2.randn(); + v2.print("v2 (randn):"); + +#ifdef ARMA_USE_HDF5 + std::cout << "ARMA_USE_HDF5 set" << std::endl; + arma::Mat a; + a.randu(20, 20); + + // Save first. + a.save("file.h5", hdf5_binary); + + // Load as different matrix. + arma::Mat b; + b.load("file.h5", hdf5_binary); + + // Check that they are the same. + bool result = true; + for (uword i = 0; i < a.n_elem; ++i) + { + result *= a[i] == b[i]; + } + std::cout << "Matrix written to and read from file.h5 are equivalent: " << result << "\n"; + + // Now autoload. + arma::Mat c; + c.load("file.h5"); + + // Check that they are the same. + result = true; + for (uword i = 0; i < a.n_elem; ++i) + { + result *= a[i] == c[i]; + } + std::cout << "Matrix written to and autoloaded from file.h5 are equivalent: " << result << "\n"; + + std::remove("file.h5"); +#else + std::cout << "ARMA_USE_HDF5 not set" << std::endl; +#endif + + return 0; +} diff --git a/recipes/armadillo/all/test_v1_package/CMakeLists.txt b/recipes/armadillo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..3ac69a9731274 --- /dev/null +++ b/recipes/armadillo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.6) +project(PackageTest CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(armadillo REQUIRED) + +add_executable(example ../test_package/src/example.cpp) +target_link_libraries(example armadillo::armadillo) +set_property(TARGET example PROPERTY CXX_STANDARD 11) diff --git a/recipes/armadillo/all/test_v1_package/conanfile.py b/recipes/armadillo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5eba7cbe1bb9c --- /dev/null +++ b/recipes/armadillo/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class ArmadilloTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "example") + self.run(bin_path, run_environment=True) diff --git a/recipes/armadillo/config.yml b/recipes/armadillo/config.yml index 9cadebcc7f6bf..8af743e5561bd 100644 --- a/recipes/armadillo/config.yml +++ b/recipes/armadillo/config.yml @@ -3,3 +3,5 @@ versions: folder: all "10.7.3": folder: all + "11.4.3": + folder: all diff --git a/recipes/arrow/all/CMakeLists.txt b/recipes/arrow/all/CMakeLists.txt deleted file mode 100644 index 5fce337b405db..0000000000000 --- a/recipes/arrow/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder/cpp) diff --git a/recipes/arrow/all/conandata.yml b/recipes/arrow/all/conandata.yml index 57dc370908163..692a759b11a1b 100644 --- a/recipes/arrow/all/conandata.yml +++ b/recipes/arrow/all/conandata.yml @@ -1,74 +1,64 @@ sources: + "10.0.1": + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-10.0.1/apache-arrow-10.0.1.tar.gz?action=download" + sha256: "c814e0670112a22c1a6ec03ab420a52ae236a9a42e9e438c3cbd37f37e658fb3" + "10.0.0": + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-10.0.0/apache-arrow-10.0.0.tar.gz?action=download" + sha256: "5b46fa4c54f53e5df0019fe0f9d421e93fc906b625ebe8e89eed010d561f1f12" "8.0.1": - url: "https://github.com/apache/arrow/archive/apache-arrow-8.0.1.tar.gz" - sha256: "e4c86329be769f2c8778aacc8d6220a9a13c90d59d4988f9349d51299dacbd11" + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-8.0.1/apache-arrow-8.0.1.tar.gz?action=download" + sha256: "82d46929f7574715551da21700f100b39f99c3c4d6790f26cac86d869d64e94e" "8.0.0": - url: "https://github.com/apache/arrow/archive/apache-arrow-8.0.0.tar.gz" - sha256: "19ece12de48e51ce4287d2dee00dc358fbc5ff02f41629d16076f77b8579e272" + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-8.0.0/apache-arrow-8.0.0.tar.gz?action=download" + sha256: "ad9a05705117c989c116bae9ac70492fe015050e1b80fb0e38fde4b5d863aaa3" "7.0.0": - url: "https://github.com/apache/arrow/archive/apache-arrow-7.0.0.tar.gz" - sha256: "57e13c62f27b710e1de54fd30faed612aefa22aa41fa2c0c3bacd204dd18a8f3" + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-7.0.0/apache-arrow-7.0.0.tar.gz?action=download" + sha256: "e8f49b149a15ecef4e40fcfab1b87c113c6b1ee186005c169e5cdf95d31a99de" "2.0.0": - url: "https://github.com/apache/arrow/archive/apache-arrow-2.0.0.tar.gz" - sha256: "ea299df9cf440cfc43393ce12ee6d9a4c9d0dfa9fde33c3bc9b70ec25520a844" + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-2.0.0/apache-arrow-2.0.0.tar.gz?action=download" + sha256: "be0342cc847bb340d86aeaef43596a0b6c1dbf1ede9c789a503d939e01c71fbe" "1.0.0": - url: "https://github.com/apache/arrow/archive/apache-arrow-1.0.0.tar.gz" - sha256: "08fbd4c633c08939850d619ca0224c75d7a0526467c721c0838b8aa7efccb270" + url: "https://www.apache.org/dyn/closer.lua/arrow/arrow-1.0.0/apache-arrow-1.0.0.tar.gz?action=download" + sha256: "86ddb9feb48203a5aaf9cc4f2827525e20a2ca4d7239e492af17e74532ccf243" patches: "8.0.1": - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0001-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0002-jemalloc.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0003-mallctl-takes-size_t.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0004-use-find-package.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0005-install-utils.patch" + - patch_file: "patches/8.0.0-0005-install-utils.patch" + patch_description: "enable utilis installation" + patch_type: "conan" + - patch_file: "patches/8.0.0-0006-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "8.0.0": - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0001-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0002-jemalloc.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0003-mallctl-takes-size_t.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0004-use-find-package.patch" - - base_path: "source_subfolder" - patch_file: "patches/8.0.0-0005-install-utils.patch" + - patch_file: "patches/8.0.0-0005-install-utils.patch" + patch_description: "enable utilis installation" + patch_type: "conan" + - patch_file: "patches/8.0.0-0006-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "7.0.0": - - base_path: "source_subfolder" - patch_file: "patches/7.0.0-0001-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/7.0.0-0002-jemalloc.patch" - - base_path: "source_subfolder" - patch_file: "patches/7.0.0-0003-mallctl-takes-size_t.patch" - - base_path: "source_subfolder" - patch_file: "patches/7.0.0-0005-use-find-package.patch" - - base_path: "source_subfolder" - patch_file: "patches/7.0.0-0006-install-utils.patch" + - patch_file: "patches/7.0.0-0006-install-utils.patch" + patch_description: "enable utilis installation" + patch_type: "conan" + - patch_file: "patches/7.0.0-0007-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "2.0.0": - - base_path: "source_subfolder" - patch_file: "patches/2.0.0-0001-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.0.0-0002-jemalloc.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.0.0-0003-fix-shared-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0004-mallctl-takes-size_t.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.0.0-0005-gandiva-engine.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.0.0-0006-gandiva-llvm-re2.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.0.0-0007-fix-protoc-cmake.patch" + - patch_file: "patches/2.0.0-0003-fix-shared-msvc.patch" + patch_description: "make shared enabled in msvc" + patch_type: "official" + - patch_file: "patches/2.0.0-0005-gandiva-engine.patch" + patch_description: "fix grandiva compilation error" + patch_type: "official" + - patch_file: "patches/2.0.0-0008-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "1.0.0": - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0001-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0002-jemalloc.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0003-fix-shared-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.0.0-0004-mallctl-takes-size_t.patch" + - patch_file: "patches/1.0.0-0003-fix-shared-msvc.patch" + patch_description: "make shared enabled in msvc" + patch_type: "official" + - patch_file: "patches/1.0.0-0005-fix-make12-namespace.patch" + patch_description: "fix ambiguous `make12` function between std and date" + patch_type: "official" + - patch_file: "patches/1.0.0-0006-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" diff --git a/recipes/arrow/all/conanfile.py b/recipes/arrow/all/conanfile.py index 5a8b65c292e20..1def26f4a6ab8 100644 --- a/recipes/arrow/all/conanfile.py +++ b/recipes/arrow/all/conanfile.py @@ -1,10 +1,15 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc_static_runtime, is_msvc, check_min_vs +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + import os import glob -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.53.0" class ArrowConan(ConanFile): name = "arrow" @@ -41,8 +46,8 @@ class ArrowConan(ConanFile): "with_gflags": ["auto", True, False], "with_glog": ["auto", True, False], "with_grpc": ["auto", True, False], - "with_hiveserver2": [True, False], "with_jemalloc": ["auto", True, False], + "with_mimalloc": ["auto", True, False], "with_json": [True, False], "with_llvm": ["auto", True, False], "with_openssl": ["auto", True, False], @@ -87,9 +92,9 @@ class ArrowConan(ConanFile): "with_gcs": False, "with_gflags": "auto", "with_jemalloc": "auto", + "with_mimalloc": False, "with_glog": "auto", "with_grpc": "auto", - "with_hiveserver2": False, "with_json": False, "with_llvm": "auto", "with_openssl": "auto", @@ -104,40 +109,61 @@ class ArrowConan(ConanFile): "with_zlib": False, "with_zstd": False, } - generators = "cmake", "cmake_find_package_multi" short_paths = True - _cmake = None + @property + def _minimum_cpp_standard(self): + # arrow >= 10.0.0 requires C++17. + # https://github.com/apache/arrow/pull/13991 + return 11 if Version(self.version) < "10.0.0" else 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "apple-clang": "10", + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) < "2.0.0": + if Version(self.version) < "2.0.0": del self.options.simd_level del self.options.runtime_simd_level - elif tools.Version(self.version) < "6.0.0": + elif Version(self.version) < "6.0.0": self.options.simd_level = "sse4_2" - if tools.Version(self.version) < "6.0.0": + if Version(self.version) < "6.0.0": del self.options.with_gcs - if tools.Version(self.version) < "7.0.0": + if Version(self.version) < "7.0.0": del self.options.skyhook del self.options.with_flight_sql del self.options.with_opentelemetry - if tools.Version(self.version) < "8.0.0": + if Version(self.version) < "8.0.0": del self.options.substrait + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + def validate(self): - if self.settings.compiler == "clang" and self.settings.compiler.version <= tools.Version("3.9"): - raise ConanInvalidConfiguration("This recipe does not support this compiler version") + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + + if self._minimum_cpp_standard == 11: + if self.info.settings.compiler == "clang" and self.info.settings.compiler.version <= Version("3.9"): + raise ConanInvalidConfiguration("This recipe does not support this compiler version") + else: + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) if self.options.shared: del self.options.fPIC @@ -166,11 +192,9 @@ def validate(self): if self.options.with_openssl == False and self._with_openssl(True): raise ConanInvalidConfiguration("with_openssl options is required (or choose auto)") if self.options.with_llvm == False and self._with_llvm(True): - raise ConanInvalidConfiguration("with_openssl options is required (or choose auto)") + raise ConanInvalidConfiguration("with_llvm options is required (or choose auto)") if self.options.with_cuda: raise ConanInvalidConfiguration("CCI has no cuda recipe (yet)") - if self.options.with_hiveserver2: - raise ConanInvalidConfiguration("CCI has no hiveserver2 recipe (yet)") if self.options.with_orc: raise ConanInvalidConfiguration("CCI has no orc recipe (yet)") if self.options.with_s3 and not self.options["aws-sdk-cpp"].config: @@ -180,12 +204,15 @@ def validate(self): if self.options["jemalloc"].enable_cxx: raise ConanInvalidConfiguration("jemmalloc.enable_cxx of a static jemalloc must be disabled") - if tools.Version(self.version) < "6.0.0" and self.options.get_safe("simd_level") == "default": - raise ConanInvalidConfiguration("In {}/{}, simd_level options is not supported `default` value.".format(self.name, self.version)) + if Version(self.version) < "6.0.0" and self.options.get_safe("simd_level") == "default": + raise ConanInvalidConfiguration(f"In {self.ref}, simd_level options is not supported `default` value.") + + def layout(self): + cmake_layout(self, src_folder="src") def _compute(self, required=False): if required or self.options.compute == "auto": - return bool(self._dataset_modules()) or bool(self.options.get_safe("substrait", False)) + return bool(self._parquet() or self._dataset_modules()) or bool(self.options.get_safe("substrait", False)) else: return bool(self.options.compute) @@ -209,7 +236,11 @@ def _with_jemalloc(self, required=False): def _with_re2(self, required=False): if required or self.options.with_re2 == "auto": - return bool(self.options.gandiva) + if self.options.gandiva or self.options.parquet: + return True + if Version(self) >= "7.0.0" and (self._compute() or self._dataset_modules()): + return True + return False else: return bool(self.options.with_re2) @@ -247,12 +278,12 @@ def _with_boost(self, required=False): if required or self.options.with_boost == "auto": if self.options.gandiva: return True - version = tools.Version(self.version) + version = Version(self.version) if version.major == "1": - if self._parquet() and self.settings.compiler == "gcc" and self.settings.compiler.version < tools.Version("4.9"): + if self._parquet() and self.settings.compiler == "gcc" and self.settings.compiler.version < Version("4.9"): return True elif version.major >= "2": - if self.settings.compiler == "Visual Studio": + if is_msvc(self): return True return False else: @@ -260,11 +291,11 @@ def _with_boost(self, required=False): def _with_thrift(self, required=False): # No self.options.with_thift exists - return bool(required or self.options.with_hiveserver2 or self._parquet()) + return bool(required or self._parquet()) def _with_utf8proc(self, required=False): if required or self.options.with_utf8proc == "auto": - return False + return bool(self._compute() or self.options.gandiva) else: return bool(self.options.with_utf8proc) @@ -280,15 +311,24 @@ def _with_openssl(self, required=False): else: return bool(self.options.with_openssl) + def _with_rapidjson(self): + if self.options.with_json: + return True + if Version(self.version) >= "7.0.0" and self.options.encryption: + return True + return False + def requirements(self): if self._with_thrift(): - self.requires("thrift/0.16.0") + self.requires("thrift/0.17.0") if self._with_protobuf(): - self.requires("protobuf/3.21.1") + self.requires("protobuf/3.21.4") if self._with_jemalloc(): - self.requires("jemalloc/5.2.1") + self.requires("jemalloc/5.3.0") + if self.options.with_mimalloc: + self.requires("mimalloc/1.7.6") if self._with_boost(): - self.requires("boost/1.79.0") + self.requires("boost/1.80.0") if self._with_gflags(): self.requires("gflags/2.2.2") if self._with_glog(): @@ -296,19 +336,19 @@ def requirements(self): if self.options.get_safe("with_gcs"): self.requires("google-cloud-cpp/1.40.1") if self._with_grpc(): - self.requires("grpc/1.47.0") - if self.options.with_json: + self.requires("grpc/1.50.0") + if self._with_rapidjson(): self.requires("rapidjson/1.1.0") if self._with_llvm(): self.requires("llvm-core/13.0.0") if self._with_openssl(): # aws-sdk-cpp requires openssl/1.1.1. it uses deprecated functions in openssl/3.0.0 if self.options.with_s3: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") else: - self.requires("openssl/3.0.5") + self.requires("openssl/1.1.1s") if self.options.get_safe("with_opentelemetry"): - self.requires("opentelemetry-cpp/1.4.1") + self.requires("opentelemetry-cpp/1.7.0") if self.options.with_s3: self.requires("aws-sdk-cpp/1.9.234") if self.options.with_brotli: @@ -316,147 +356,152 @@ def requirements(self): if self.options.with_bz2: self.requires("bzip2/1.0.8") if self.options.with_lz4: - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.with_snappy: self.requires("snappy/1.1.9") - if tools.Version(self.version) >= "6.0.0" and \ + if Version(self.version) >= "6.0.0" and \ self.options.get_safe("simd_level") != None or \ self.options.get_safe("runtime_simd_level") != None: - self.requires("xsimd/8.1.0") + self.requires("xsimd/9.0.1") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_zstd: self.requires("zstd/1.5.2") if self._with_re2(): - self.requires("re2/20220201") + self.requires("re2/20220601") if self._with_utf8proc(): - self.requires("utf8proc/2.7.0") + self.requires("utf8proc/2.8.0") if self.options.with_backtrace: self.requires("libbacktrace/cci.20210118") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - if tools.cross_building(self.settings): + get(self, **self.conan_data["sources"][self.version], + filename=f"apache-arrow-{self.version}.tar.gz", destination=self.source_folder, strip_root=True) + + def generate(self): + # BUILD_SHARED_LIBS and POSITION_INDEPENDENT_CODE are automatically parsed when self.options.shared or self.options.fPIC exist + tc = CMakeToolchain(self) + if cross_building(self): cmake_system_processor = { "armv8": "aarch64", "armv8.3": "aarch64", }.get(str(self.settings.arch), str(self.settings.arch)) - self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = cmake_system_processor - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["ARROW_USE_STATIC_CRT"] = "MT" in str(self.settings.compiler.runtime) - self._cmake.definitions["ARROW_DEPENDENCY_SOURCE"] = "SYSTEM" - self._cmake.definitions["ARROW_GANDIVA"] = self.options.gandiva - self._cmake.definitions["ARROW_PARQUET"] = self._parquet() - self._cmake.definitions["ARROW_SUBSTRAIT"] = self.options.get_safe("substrait", False) - self._cmake.definitions["ARROW_PLASMA"] = self.options.plasma - self._cmake.definitions["ARROW_DATASET"] = self._dataset_modules() - self._cmake.definitions["ARROW_FILESYSTEM"] = self.options.filesystem_layer - self._cmake.definitions["PARQUET_REQUIRE_ENCRYPTION"] = self.options.encryption - self._cmake.definitions["ARROW_HDFS"] = self.options.hdfs_bridgs - self._cmake.definitions["ARROW_VERBOSE_THIRDPARTY_BUILD"] = True - self._cmake.definitions["ARROW_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["ARROW_BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["ARROW_NO_DEPRECATED_API"] = not self.options.deprecated - self._cmake.definitions["ARROW_FLIGHT"] = self._with_flight_rpc() - self._cmake.definitions["ARROW_FLIGHT_SQL"] = self.options.get_safe("with_flight_sql", False) - self._cmake.definitions["ARROW_HIVESERVER2"] = self.options.with_hiveserver2 - self._cmake.definitions["ARROW_COMPUTE"] = self._compute() - self._cmake.definitions["ARROW_CSV"] = self.options.with_csv - self._cmake.definitions["ARROW_CUDA"] = self.options.with_cuda - self._cmake.definitions["ARROW_JEMALLOC"] = self._with_jemalloc() - self._cmake.definitions["ARROW_JSON"] = self.options.with_json - self._cmake.definitions["ARROW_GCS"] = self.options.get_safe("with_gcs", False) - - self._cmake.definitions["BOOST_SOURCE"] = "SYSTEM" - self._cmake.definitions["Protobuf_SOURCE"] = "SYSTEM" + tc.variables["CMAKE_SYSTEM_PROCESSOR"] = cmake_system_processor + if cmake_system_processor == "aarch64": + tc.variables["ARROW_CPU_FLAG"] = "armv8" + if is_msvc(self): + tc.variables["ARROW_USE_STATIC_CRT"] = is_msvc_static_runtime(self) + tc.variables["ARROW_DEPENDENCY_SOURCE"] = "SYSTEM" + tc.variables["ARROW_PACKAGE_KIND"] = "conan" # See https://github.com/conan-io/conan-center-index/pull/14903/files#r1057938314 for details + tc.variables["ARROW_GANDIVA"] = bool(self.options.gandiva) + tc.variables["ARROW_PARQUET"] = self._parquet() + tc.variables["ARROW_SUBSTRAIT"] = bool(self.options.get_safe("substrait", False)) + tc.variables["ARROW_PLASMA"] = bool(self.options.plasma) + tc.variables["ARROW_DATASET"] = self._dataset_modules() + tc.variables["ARROW_FILESYSTEM"] = bool(self.options.filesystem_layer) + tc.variables["PARQUET_REQUIRE_ENCRYPTION"] = bool(self.options.encryption) + tc.variables["ARROW_HDFS"] = bool(self.options.hdfs_bridgs) + tc.variables["ARROW_VERBOSE_THIRDPARTY_BUILD"] = True + tc.variables["ARROW_BUILD_SHARED"] = bool(self.options.shared) + tc.variables["ARROW_BUILD_STATIC"] = not bool(self.options.shared) + tc.variables["ARROW_NO_DEPRECATED_API"] = not bool(self.options.deprecated) + tc.variables["ARROW_FLIGHT"] = self._with_flight_rpc() + tc.variables["ARROW_FLIGHT_SQL"] = bool(self.options.get_safe("with_flight_sql", False)) + tc.variables["ARROW_COMPUTE"] = self._compute() + tc.variables["ARROW_CSV"] = bool(self.options.with_csv) + tc.variables["ARROW_CUDA"] = bool(self.options.with_cuda) + tc.variables["ARROW_JEMALLOC"] = self._with_jemalloc() + tc.variables["jemalloc_SOURCE"] = "SYSTEM" + tc.variables["ARROW_MIMALLOC"] = bool(self.options.with_mimalloc) + tc.variables["ARROW_JSON"] = bool(self.options.with_json) + tc.variables["google_cloud_cpp_SOURCE"] = "SYSTEM" + tc.variables["ARROW_GCS"] = bool(self.options.get_safe("with_gcs", False)) + tc.variables["BOOST_SOURCE"] = "SYSTEM" + tc.variables["Protobuf_SOURCE"] = "SYSTEM" if self._with_protobuf(): - self._cmake.definitions["ARROW_PROTOBUF_USE_SHARED"] = self.options["protobuf"].shared - self._cmake.definitions["gRPC_SOURCE"] = "SYSTEM" + tc.variables["ARROW_PROTOBUF_USE_SHARED"] = bool(self.options["protobuf"].shared) + tc.variables["gRPC_SOURCE"] = "SYSTEM" if self._with_grpc(): - self._cmake.definitions["ARROW_GRPC_USE_SHARED"] = self.options["grpc"].shared - self._cmake.definitions["ARROW_HDFS"] = self.options.hdfs_bridgs - self._cmake.definitions["ARROW_USE_GLOG"] = self._with_glog() - self._cmake.definitions["GLOG_SOURCE"] = "SYSTEM" - self._cmake.definitions["ARROW_WITH_BACKTRACE"] = self.options.with_backtrace - self._cmake.definitions["ARROW_WITH_BROTLI"] = self.options.with_brotli - self._cmake.definitions["Brotli_SOURCE"] = "SYSTEM" + tc.variables["ARROW_GRPC_USE_SHARED"] = bool(self.options["grpc"].shared) + + tc.variables["ARROW_USE_GLOG"] = self._with_glog() + tc.variables["GLOG_SOURCE"] = "SYSTEM" + tc.variables["ARROW_WITH_BACKTRACE"] = bool(self.options.with_backtrace) + tc.variables["ARROW_WITH_BROTLI"] = bool(self.options.with_brotli) + tc.variables["brotli_SOURCE"] = "SYSTEM" if self.options.with_brotli: - self._cmake.definitions["ARROW_BROTLI_USE_SHARED"] = self.options["brotli"].shared - self._cmake.definitions["gflags_SOURCE"] = "SYSTEM" + tc.variables["ARROW_BROTLI_USE_SHARED"] = bool(self.options["brotli"].shared) + tc.variables["gflags_SOURCE"] = "SYSTEM" if self._with_gflags(): - self._cmake.definitions["ARROW_BROTLI_USE_SHARED"] = self.options["gflags"].shared - self._cmake.definitions["ARROW_WITH_BZ2"] = self.options.with_bz2 - self._cmake.definitions["BZip2_SOURCE"] = "SYSTEM" + tc.variables["ARROW_GFLAGS_USE_SHARED"] = bool(self.options["gflags"].shared) + tc.variables["ARROW_WITH_BZ2"] = bool(self.options.with_bz2) + tc.variables["BZip2_SOURCE"] = "SYSTEM" if self.options.with_bz2: - self._cmake.definitions["ARROW_BZ2_USE_SHARED"] = self.options["bzip2"].shared - self._cmake.definitions["ARROW_WITH_LZ4"] = self.options.with_lz4 - self._cmake.definitions["Lz4_SOURCE"] = "SYSTEM" + tc.variables["ARROW_BZ2_USE_SHARED"] = bool(self.options["bzip2"].shared) + tc.variables["ARROW_WITH_LZ4"] = bool(self.options.with_lz4) + tc.variables["lz4_SOURCE"] = "SYSTEM" if self.options.with_lz4: - self._cmake.definitions["ARROW_LZ4_USE_SHARED"] = self.options["lz4"].shared - self._cmake.definitions["ARROW_WITH_SNAPPY"] = self.options.with_snappy - self._cmake.definitions["Snappy_SOURCE"] = "SYSTEM" + tc.variables["ARROW_LZ4_USE_SHARED"] = bool(self.options["lz4"].shared) + tc.variables["ARROW_WITH_SNAPPY"] = bool(self.options.with_snappy) + tc.variables["RapidJSON_SOURCE"] = "SYSTEM" + tc.variables["Snappy_SOURCE"] = "SYSTEM" if self.options.with_snappy: - self._cmake.definitions["ARROW_SNAPPY_USE_SHARED"] = self.options["snappy"].shared - self._cmake.definitions["ARROW_WITH_ZLIB"] = self.options.with_zlib - self._cmake.definitions["RE2_SOURCE"] = "SYSTEM" - self._cmake.definitions["ZLIB_SOURCE"] = "SYSTEM" - - self._cmake.definitions["ARROW_WITH_ZSTD"] = self.options.with_zstd - if tools.Version(self.version) >= "2.0": - self._cmake.definitions["zstd_SOURCE"] = "SYSTEM" - self._cmake.definitions["ARROW_SIMD_LEVEL"] = str(self.options.simd_level).upper() - self._cmake.definitions["ARROW_RUNTIME_SIMD_LEVEL"] = str(self.options.runtime_simd_level).upper() + tc.variables["ARROW_SNAPPY_USE_SHARED"] = bool(self.options["snappy"].shared) + tc.variables["ARROW_WITH_ZLIB"] = bool(self.options.with_zlib) + tc.variables["re2_SOURCE"] = "SYSTEM" + tc.variables["ZLIB_SOURCE"] = "SYSTEM" + tc.variables["xsimd_SOURCE"] = "SYSTEM" + tc.variables["ARROW_WITH_ZSTD"] = bool(self.options.with_zstd) + if Version(self.version) >= "2.0": + tc.variables["zstd_SOURCE"] = "SYSTEM" + tc.variables["ARROW_SIMD_LEVEL"] = str(self.options.simd_level).upper() + tc.variables["ARROW_RUNTIME_SIMD_LEVEL"] = str(self.options.runtime_simd_level).upper() else: - self._cmake.definitions["ZSTD_SOURCE"] = "SYSTEM" + tc.variables["ZSTD_SOURCE"] = "SYSTEM" if self.options.with_zstd: - self._cmake.definitions["ARROW_ZSTD_USE_SHARED"] = self.options["zstd"].shared - self._cmake.definitions["ORC_SOURCE"] = "SYSTEM" - self._cmake.definitions["ARROW_WITH_THRIFT"] = self._with_thrift() - self._cmake.definitions["Thrift_SOURCE"] = "SYSTEM" + tc.variables["ARROW_ZSTD_USE_SHARED"] = bool(self.options["zstd"].shared) + tc.variables["ORC_SOURCE"] = "SYSTEM" + tc.variables["ARROW_WITH_THRIFT"] = self._with_thrift() + tc.variables["Thrift_SOURCE"] = "SYSTEM" if self._with_thrift(): - self._cmake.definitions["THRIFT_VERSION"] = self.deps_cpp_info["thrift"].version # a recent thrift does not require boost - self._cmake.definitions["ARROW_THRIFT_USE_SHARED"] = self.options["thrift"].shared - self._cmake.definitions["ARROW_USE_OPENSSL"] = self._with_openssl() + tc.variables["THRIFT_VERSION"] = bool(self.deps_cpp_info["thrift"].version) # a recent thrift does not require boost + tc.variables["ARROW_THRIFT_USE_SHARED"] = bool(self.options["thrift"].shared) + tc.variables["ARROW_USE_OPENSSL"] = self._with_openssl() if self._with_openssl(): - self._cmake.definitions["OPENSSL_ROOT_DIR"] = self.deps_cpp_info["openssl"].rootpath.replace("\\", "/") - self._cmake.definitions["ARROW_OPENSSL_USE_SHARED"] = self.options["openssl"].shared + tc.variables["OPENSSL_ROOT_DIR"] = self.deps_cpp_info["openssl"].rootpath.replace("\\", "/") + tc.variables["ARROW_OPENSSL_USE_SHARED"] = bool(self.options["openssl"].shared) if self._with_boost(): - self._cmake.definitions["ARROW_BOOST_USE_SHARED"] = self.options["boost"].shared - self._cmake.definitions["ARROW_S3"] = self.options.with_s3 - self._cmake.definitions["AWSSDK_SOURCE"] = "SYSTEM" - - self._cmake.definitions["ARROW_BUILD_UTILITIES"] = self.options.cli - self._cmake.definitions["ARROW_BUILD_INTEGRATION"] = False - self._cmake.definitions["ARROW_INSTALL_NAME_RPATH"] = False - self._cmake.definitions["ARROW_BUILD_EXAMPLES"] = False - self._cmake.definitions["ARROW_BUILD_TESTS"] = False - self._cmake.definitions["ARROW_ENABLE_TIMING_TESTS"] = False - self._cmake.definitions["ARROW_BUILD_BENCHMARKS"] = False - self._cmake.definitions["LLVM_SOURCE"] = "SYSTEM" - self._cmake.definitions["ARROW_WITH_UTF8PROC"] = self._with_utf8proc() - self._cmake.definitions["utf8proc_SOURCE"] = "SYSTEM" + tc.variables["ARROW_USE_BOOST"] = True + tc.variables["ARROW_BOOST_USE_SHARED"] = bool(self.options["boost"].shared) + tc.variables["ARROW_S3"] = bool(self.options.with_s3) + tc.variables["AWSSDK_SOURCE"] = "SYSTEM" + tc.variables["ARROW_BUILD_UTILITIES"] = bool(self.options.cli) + tc.variables["ARROW_BUILD_INTEGRATION"] = False + tc.variables["ARROW_INSTALL_NAME_RPATH"] = True + tc.variables["ARROW_BUILD_EXAMPLES"] = False + tc.variables["ARROW_BUILD_TESTS"] = False + tc.variables["ARROW_ENABLE_TIMING_TESTS"] = False + tc.variables["ARROW_BUILD_BENCHMARKS"] = False + tc.variables["LLVM_SOURCE"] = "SYSTEM" + tc.variables["ARROW_WITH_UTF8PROC"] = self._with_utf8proc() + tc.variables["ARROW_BOOST_REQUIRED"] = self._with_boost() + tc.variables["utf8proc_SOURCE"] = "SYSTEM" if self._with_utf8proc(): - self._cmake.definitions["ARROW_UTF8PROC_USE_SHARED"] = self.options["utf8proc"].shared - self._cmake.definitions["BUILD_WARNING_LEVEL"] = "PRODUCTION" - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["ARROW_USE_STATIC_CRT"] = "MT" in str(self.settings.compiler.runtime) - + tc.variables["ARROW_UTF8PROC_USE_SHARED"] = bool(self.options["utf8proc"].shared) + tc.variables["BUILD_WARNING_LEVEL"] = "PRODUCTION" + if is_msvc(self): + tc.variables["ARROW_USE_STATIC_CRT"] = "MT" in str(self.settings.compiler.runtime) if self._with_llvm(): - self._cmake.definitions["LLVM_DIR"] = self.deps_cpp_info["llvm-core"].rootpath.replace("\\", "/") - self._cmake.configure() - return self._cmake + tc.variables["LLVM_DIR"] = self.deps_cpp_info["llvm-core"].rootpath.replace("\\", "/") + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) >= "7.0.0": - for filename in glob.glob(os.path.join(self._source_subfolder, "cpp", "cmake_modules", "Find*.cmake")): + apply_conandata_patches(self) + if "7.0.0" <= Version(self.version) < "10.0.0": + for filename in glob.glob(os.path.join(self.source_folder, "cpp", "cmake_modules", "Find*.cmake")): if os.path.basename(filename) not in [ "FindArrow.cmake", "FindArrowCUDA.cmake", @@ -476,27 +521,27 @@ def _patch_sources(self): def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake =CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "cpp")) cmake.build() def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - self.copy("NOTICE.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="NOTICE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake =CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def _lib_name(self, name): - if self.settings.compiler == "Visual Studio" and not self.options.shared: + if is_msvc(self) and not self.options.shared: return "{}_static".format(name) else: return "{}".format(name) def package_id(self): - self.info.options.with_jemalloc = self._with_jemalloc() self.info.options.with_gflags = self._with_gflags() self.info.options.with_protobuf = self._with_protobuf() self.info.options.with_re2 = self._with_re2() @@ -524,6 +569,8 @@ def package_info(self): self.cpp_info.components["libparquet"].names["cmake_find_package_multi"] = "parquet" self.cpp_info.components["libparquet"].names["pkg_config"] = "parquet" self.cpp_info.components["libparquet"].requires = ["libarrow"] + if not self.options.shared: + self.cpp_info.components["libparquet"].defines = ["PARQUET_STATIC"] if self.options.get_safe("substrait", False): self.cpp_info.components["libarrow_substrait"].libs = [self._lib_name("arrow_substrait")] @@ -545,6 +592,8 @@ def package_info(self): self.cpp_info.components["libgandiva"].names["cmake_find_package_multi"] = "gandiva" self.cpp_info.components["libgandiva"].names["pkg_config"] = "gandiva" self.cpp_info.components["libgandiva"].requires = ["libarrow"] + if not self.options.shared: + self.cpp_info.components["libgandiva"].defines = ["GANDIVA_STATIC"] if self._with_flight_rpc(): self.cpp_info.components["libarrow_flight"].libs = [self._lib_name("arrow_flight")] @@ -565,16 +614,16 @@ def package_info(self): if (self.options.cli and (self.options.with_cuda or self._with_flight_rpc() or self._parquet())) or self.options.plasma: binpath = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var: {}".format(binpath)) + self.output.info(f"Appending PATH env var: {binpath}") self.env_info.PATH.append(binpath) if self._with_boost(): if self.options.gandiva: # FIXME: only filesystem component is used self.cpp_info.components["libgandiva"].requires.append("boost::boost") - if self._parquet() and self.settings.compiler == "gcc" and self.settings.compiler.version < tools.Version("4.9"): + if self._parquet() and self.settings.compiler == "gcc" and self.settings.compiler.version < Version("4.9"): self.cpp_info.components["libparquet"].requires.append("boost::boost") - if tools.Version(self.version) >= "2.0": + if Version(self.version) >= "2.0": # FIXME: only headers components is used self.cpp_info.components["libarrow"].requires.append("boost::boost") if self._with_openssl(): @@ -585,8 +634,14 @@ def package_info(self): self.cpp_info.components["libarrow"].requires.append("glog::glog") if self._with_jemalloc(): self.cpp_info.components["libarrow"].requires.append("jemalloc::jemalloc") + if self.options.with_mimalloc: + self.cpp_info.components["libarrow"].requires.append("mimalloc::mimalloc") if self._with_re2(): - self.cpp_info.components["libgandiva"].requires.append("re2::re2") + if self.options.gandiva: + self.cpp_info.components["libgandiva"].requires.append("re2::re2") + if self._parquet(): + self.cpp_info.components["libparquet"].requires.append("re2::re2") + self.cpp_info.components["libarrow"].requires.append("re2::re2") if self._with_llvm(): self.cpp_info.components["libgandiva"].requires.append("llvm-core::llvm-core") if self._with_protobuf(): @@ -599,9 +654,7 @@ def package_info(self): self.cpp_info.components["libarrow"].requires.append("libbacktrace::libbacktrace") if self.options.with_cuda: self.cpp_info.components["libarrow"].requires.append("cuda::cuda") - if self.options.with_hiveserver2: - self.cpp_info.components["libarrow"].requires.append("hiveserver2::hiveserver2") - if self.options.with_json: + if self._with_rapidjson(): self.cpp_info.components["libarrow"].requires.append("rapidjson::rapidjson") if self.options.with_s3: self.cpp_info.components["libarrow"].requires.append("aws-sdk-cpp::s3") @@ -625,6 +678,9 @@ def package_info(self): self.cpp_info.components["libarrow"].requires.append("zlib::zlib") if self.options.with_zstd: self.cpp_info.components["libarrow"].requires.append("zstd::zstd") + if self._with_boost(): + self.cpp_info.components["libarrow"].requires.append("boost::boost") + if self._with_grpc(): + self.cpp_info.components["libarrow"].requires.append("grpc::grpc") if self._with_flight_rpc(): - self.cpp_info.components["libarrow_flight"].requires.append("grpc::grpc") self.cpp_info.components["libarrow_flight"].requires.append("protobuf::protobuf") diff --git a/recipes/arrow/all/patches/1.0.0-0001-cmake.patch b/recipes/arrow/all/patches/1.0.0-0001-cmake.patch deleted file mode 100644 index c227f1860e305..0000000000000 --- a/recipes/arrow/all/patches/1.0.0-0001-cmake.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- cpp/cmake_modules/DefineOptions.cmake -+++ cpp/cmake_modules/DefineOptions.cmake -@@ -76,7 +76,7 @@ macro(define_option_string name description default) - endmacro() - - # Top level cmake dir --if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") -+if(1) - #---------------------------------------------------------------------- - set_option_category("Compile and link") - ---- cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -854,7 +854,7 @@ if(ARROW_WITH_SNAPPY) - # location. - # https://bugzilla.redhat.com/show_bug.cgi?id=1679727 - # https://src.fedoraproject.org/rpms/snappy/pull-request/1 -- find_package(Snappy QUIET HINTS "${CMAKE_ROOT}/Modules/") -+ find_package(Snappy REQUIRED) - if(NOT Snappy_FOUND) - find_package(SnappyAlt) - endif() -@@ -866,7 +866,7 @@ - elseif(Snappy_SOURCE STREQUAL "SYSTEM") - # SnappyConfig.cmake is not installed on Ubuntu/Debian - # TODO: Make a bug report upstream -- find_package(Snappy HINTS "${CMAKE_ROOT}/Modules/") -+ find_package(Snappy REQUIRED) - if(NOT Snappy_FOUND) - find_package(SnappyAlt REQUIRED) - endif() -@@ -1139,8 +1139,8 @@ - build_gflags() - elseif(gflags_SOURCE STREQUAL "SYSTEM") -- # gflagsConfig.cmake is not installed on Ubuntu/Debian -- # TODO: Make a bug report upstream -- find_package(gflags ${ARROW_GFLAGS_REQUIRED_VERSION}) -+ find_package(gflags REQUIRED) -+ add_library(gflags-shared INTERFACE) -+ target_link_libraries(gflags-shared INTERFACE gflags::gflags) - if(NOT gflags_FOUND) - find_package(gflagsAlt ${ARROW_GFLAGS_REQUIRED_VERSION} REQUIRED) - endif() -@@ -1329,6 +1329,6 @@ macro(build_protobuf) - endmacro() -- - if(ARROW_WITH_PROTOBUF) -+ find_package(Protobuf REQUIRED) - if(ARROW_WITH_GRPC) - # gRPC 1.21.0 or later require Protobuf 3.7.0 or later. - set(ARROW_PROTOBUF_REQUIRED_VERSION "3.7.0") -@@ -1365,9 +1365,9 @@ if(ARROW_WITH_PROTOBUF) - set(ARROW_PROTOBUF_LIBPROTOC arrow::protobuf::libprotoc) - else() - if(NOT TARGET protobuf::libprotoc) -+ set(Protobuf_PROTOC_LIBRARY protoc) - if(PROTOBUF_PROTOC_LIBRARY AND NOT Protobuf_PROTOC_LIBRARY) -- # Old CMake versions have a different casing. -- set(Protobuf_PROTOC_LIBRARY ${PROTOBUF_PROTOC_LIBRARY}) -+ set(Protobuf_PROTOC_LIBRARY protoc) - endif() - if(NOT Protobuf_PROTOC_LIBRARY) - message(FATAL_ERROR "libprotoc was set to ${Protobuf_PROTOC_LIBRARY}") -@@ -1802,7 +1802,7 @@ if(ARROW_WITH_RAPIDJSON) - elseif(RapidJSON_SOURCE STREQUAL "SYSTEM") - # Fedora packages place the package information at the wrong location. - # https://bugzilla.redhat.com/show_bug.cgi?id=1680400 -- find_package(RapidJSON ${ARROW_RAPIDJSON_REQUIRED_VERSION} HINTS "${CMAKE_ROOT}") -+ find_package(RapidJSON REQUIRED) - if(RapidJSON_FOUND) - set(RAPIDJSON_INCLUDE_DIR ${RAPIDJSON_INCLUDE_DIRS}) - else() -@@ -2088,7 +2088,7 @@ if(ARROW_WITH_BZ2) - PROPERTIES IMPORTED_LOCATION "${BZIP2_LIBRARIES}" - INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIR}") - endif() -- include_directories(SYSTEM "${BZIP2_INCLUDE_DIR}") -+ include_directories(SYSTEM "${BZip2_INCLUDE_DIR}") - endif() - - macro(build_utf8proc) ---- cpp/cmake_modules/SetupCxxFlags.cmake -+++ cpp/cmake_modules/SetupCxxFlags.cmake -@@ -188,7 +188,7 @@ - message(STATUS "Arrow build warning level: ${BUILD_WARNING_LEVEL}") - - macro(arrow_add_werror_if_debug) -- if("${CMAKE_BUILD_TYPE}" STREQUAL "DEBUG") -+ if(0) - # Treat all compiler warnings as errors - if(MSVC) - set(CXX_COMMON_FLAGS "${CXX_COMMON_FLAGS} /WX") diff --git a/recipes/arrow/all/patches/1.0.0-0002-jemalloc.patch b/recipes/arrow/all/patches/1.0.0-0002-jemalloc.patch deleted file mode 100644 index 7e8bd1ed08039..0000000000000 --- a/recipes/arrow/all/patches/1.0.0-0002-jemalloc.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -1407,6 +1407,6 @@ endif() - # jemalloc - Unix-only high-performance allocator -- - if(ARROW_JEMALLOC) -+if(0) - message(STATUS "Building (vendored) jemalloc from source") - # We only use a vendored jemalloc as we want to control its version. - # Also our build of jemalloc is specially prefixed so that it will not -@@ -1465,6 +1465,8 @@ if(ARROW_JEMALLOC) - add_dependencies(jemalloc::jemalloc jemalloc_ep) - - list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) -+else() -+ find_package(jemalloc REQUIRED) -+endif() - endif() -- - # ---------------------------------------------------------------------- - # mimalloc - Cross-platform high-performance allocator, from Microsoft ---- cpp/src/arrow/CMakeLists.txt -+++ cpp/src/arrow/CMakeLists.txt -@@ -292,7 +292,7 @@ - - set(_allocator_dependencies "") # Empty list - if(ARROW_JEMALLOC) -- list(APPEND _allocator_dependencies jemalloc_ep) -+ list(APPEND _allocator_dependencies jemalloc::jemalloc) - endif() - if(ARROW_MIMALLOC) - list(APPEND _allocator_dependencies mimalloc_ep) ---- cpp/src/arrow/memory_pool.cc -+++ cpp/src/arrow/memory_pool.cc -@@ -31,7 +31,7 @@ - // Needed to support jemalloc 3 and 4 - #define JEMALLOC_MANGLE - // Explicitly link to our version of jemalloc --#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" -+#include "jemalloc/jemalloc.h" - #endif - - #ifdef ARROW_MIMALLOC diff --git a/recipes/arrow/all/patches/1.0.0-0004-mallctl-takes-size_t.patch b/recipes/arrow/all/patches/1.0.0-0004-mallctl-takes-size_t.patch deleted file mode 100644 index e9ce3546d355f..0000000000000 --- a/recipes/arrow/all/patches/1.0.0-0004-mallctl-takes-size_t.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- cpp/src/arrow/memory_pool.cc -+++ cpp/src/arrow/CMakeLists.txt -@@ -427,7 +427,7 @@ - - Status jemalloc_set_decay_ms(int ms) { - #ifdef ARROW_JEMALLOC -- ssize_t decay_time_ms = static_cast(ms); -+ size_t decay_time_ms = static_cast(ms); - - int err = mallctl("arenas.dirty_decay_ms", nullptr, nullptr, &decay_time_ms, - sizeof(decay_time_ms)); diff --git a/recipes/arrow/all/patches/1.0.0-0005-fix-make12-namespace.patch b/recipes/arrow/all/patches/1.0.0-0005-fix-make12-namespace.patch new file mode 100644 index 0000000000000..5f0f6f4c52d5c --- /dev/null +++ b/recipes/arrow/all/patches/1.0.0-0005-fix-make12-namespace.patch @@ -0,0 +1,22 @@ +diff --git a/cpp/src/arrow/vendored/datetime/date.h b/cpp/src/arrow/vendored/datetime/date.h +index 02a4909..2b168d2 100644 +--- a/cpp/src/arrow/vendored/datetime/date.h ++++ b/cpp/src/arrow/vendored/datetime/date.h +@@ -5152,7 +5152,7 @@ to_stream(std::basic_ostream& os, const CharT* fmt, + if (modified == CharT{}) + #endif + { +- auto h = *fmt == CharT{'I'} ? make12(hms.hours()) : hms.hours(); ++ auto h = *fmt == CharT{'I'} ? arrow_vendored::date::make12(hms.hours()) : hms.hours(); + if (h < hours{10}) + os << CharT{'0'}; + os << h.count(); +@@ -5366,7 +5366,7 @@ to_stream(std::basic_ostream& os, const CharT* fmt, + save_ostream _(os); + os.fill('0'); + os.width(2); +- os << make12(tod.hours()).count() << CharT{':'}; ++ os << arrow_vendored::date::make12(tod.hours()).count() << CharT{':'}; + os.width(2); + os << tod.minutes().count() << CharT{':'}; + os.width(2); diff --git a/recipes/arrow/all/patches/1.0.0-0006-fix-cmake.patch b/recipes/arrow/all/patches/1.0.0-0006-fix-cmake.patch new file mode 100644 index 0000000000000..eb6816262214b --- /dev/null +++ b/recipes/arrow/all/patches/1.0.0-0006-fix-cmake.patch @@ -0,0 +1,333 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index 300f043..0127a7a 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -654,7 +654,7 @@ endif() + + if(ARROW_WITH_BROTLI) + # Order is important for static linking +- set(ARROW_BROTLI_LIBS Brotli::brotlienc Brotli::brotlidec Brotli::brotlicommon) ++ set(ARROW_BROTLI_LIBS brotli::brotlienc brotli::brotlidec brotli::brotlicommon) + list(APPEND ARROW_LINK_LIBS ${ARROW_BROTLI_LIBS}) + list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS}) + endif() +@@ -664,7 +664,7 @@ if(ARROW_WITH_BZ2) + endif() + + if(ARROW_WITH_LZ4) +- list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) ++ list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4_static) + endif() + + if(ARROW_WITH_SNAPPY) +@@ -800,8 +800,11 @@ endif() + + if(ARROW_MIMALLOC) + add_definitions(-DARROW_MIMALLOC) +- list(APPEND ARROW_LINK_LIBS mimalloc::mimalloc) +- list(APPEND ARROW_STATIC_LINK_LIBS mimalloc::mimalloc) ++ if (TARGET mimalloc-static) ++ list(APPEND ARROW_LINK_LIBS mimalloc-static) ++ else() ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc) ++ endif() + endif() + + # ---------------------------------------------------------------------- +diff --git a/cpp/cmake_modules/BuildUtils.cmake b/cpp/cmake_modules/BuildUtils.cmake +index eb10ebe..9c81017 100644 +--- a/cpp/cmake_modules/BuildUtils.cmake ++++ b/cpp/cmake_modules/BuildUtils.cmake +@@ -165,10 +165,10 @@ function(create_merged_static_lib output_target) + set(ar_script_path ${CMAKE_BINARY_DIR}/${ARG_NAME}.ar) + + file(WRITE ${ar_script_path}.in "CREATE ${output_lib_path}\n") +- file(APPEND ${ar_script_path}.in "ADDLIB $\n") ++ file(APPEND ${ar_script_path}.in "ADDLIB $\n") + + foreach(lib ${ARG_TO_MERGE}) +- file(APPEND ${ar_script_path}.in "ADDLIB $\n") ++ file(APPEND ${ar_script_path}.in "ADDLIB $\n") + endforeach() + + file(APPEND ${ar_script_path}.in "SAVE\nEND\n") +diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake +index 807e2b9..016c8db 100644 +--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake ++++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake +@@ -154,16 +154,7 @@ macro(build_dependency DEPENDENCY_NAME) + endmacro() + + macro(resolve_dependency DEPENDENCY_NAME) +- if(${DEPENDENCY_NAME}_SOURCE STREQUAL "AUTO") +- find_package(${DEPENDENCY_NAME} MODULE) +- if(NOT ${${DEPENDENCY_NAME}_FOUND}) +- build_dependency(${DEPENDENCY_NAME}) +- endif() +- elseif(${DEPENDENCY_NAME}_SOURCE STREQUAL "BUNDLED") +- build_dependency(${DEPENDENCY_NAME}) +- elseif(${DEPENDENCY_NAME}_SOURCE STREQUAL "SYSTEM") +- find_package(${DEPENDENCY_NAME} REQUIRED) +- endif() ++ find_package(${DEPENDENCY_NAME} REQUIRED) + endmacro() + + macro(resolve_dependency_with_version DEPENDENCY_NAME REQUIRED_VERSION) +@@ -765,6 +756,7 @@ endif() + # - Tests need Boost at runtime. + # - S3FS and Flight benchmarks need Boost at runtime. + if(ARROW_BUILD_INTEGRATION ++ OR ARROW_BOOST_REQUIRED + OR ARROW_BUILD_TESTS + OR ARROW_GANDIVA + OR (ARROW_FLIGHT AND ARROW_BUILD_BENCHMARKS) +@@ -785,7 +777,7 @@ if(ARROW_BOOST_REQUIRED) + elseif(BOOST_SOURCE STREQUAL "BUNDLED") + build_boost() + elseif(BOOST_SOURCE STREQUAL "SYSTEM") +- find_package(BoostAlt ${ARROW_BOOST_REQUIRED_VERSION} REQUIRED) ++ find_package(Boost ${ARROW_BOOST_REQUIRED_VERSION} REQUIRED) + endif() + + if(TARGET Boost::system) +@@ -936,11 +928,11 @@ macro(build_brotli) + endmacro() + + if(ARROW_WITH_BROTLI) +- resolve_dependency(Brotli) ++ resolve_dependency(brotli) + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon ++ get_target_property(BROTLI_INCLUDE_DIR brotli::brotlicommon + INTERFACE_INCLUDE_DIRECTORIES) +- include_directories(SYSTEM ${BROTLI_INCLUDE_DIR}) ++ include_directories(SYSTEM ${brotli_INCLUDE_DIR}) + endif() + + if(PARQUET_REQUIRE_ENCRYPTION AND NOT ARROW_PARQUET) +@@ -1146,9 +1138,10 @@ if(ARROW_NEED_GFLAGS) + endif() + endif() + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) ++ include_directories(SYSTEM ${gflags_INCLUDE_DIR}) ++ set(GFLAGS_LIBRARIES ${gflags_LIBRARIES}) + +- if(NOT TARGET ${GFLAGS_LIBRARIES}) ++ if(0) + if(TARGET gflags-shared) + set(GFLAGS_LIBRARIES gflags-shared) + elseif(TARGET gflags_shared) +@@ -1237,12 +1230,13 @@ endmacro() + if(ARROW_WITH_THRIFT) + # We already may have looked for Thrift earlier, when considering whether + # to build Boost, so don't look again if already found. +- if(NOT Thrift_FOUND AND NOT THRIFT_FOUND) ++ if(0) + # Thrift c++ code generated by 0.13 requires 0.11 or greater + resolve_dependency_with_version(Thrift 0.11.0) + endif() ++ find_package(Thrift CONFIG REQUIRED) + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}) ++ include_directories(SYSTEM ${Thrift_INCLUDE_DIR}) + endif() + + # ---------------------------------------------------------------------- +@@ -1407,6 +1401,7 @@ endif() + # jemalloc - Unix-only high-performance allocator + + if(ARROW_JEMALLOC) ++if(0) + message(STATUS "Building (vendored) jemalloc from source") + # We only use a vendored jemalloc as we want to control its version. + # Also our build of jemalloc is specially prefixed so that it will not +@@ -1465,12 +1460,18 @@ if(ARROW_JEMALLOC) + add_dependencies(jemalloc::jemalloc jemalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) ++else() ++ find_package(jemalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${jemalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${jemalloc_LIBRARIES_TARGETS} ) ++endif() + endif() + + # ---------------------------------------------------------------------- + # mimalloc - Cross-platform high-performance allocator, from Microsoft + + if(ARROW_MIMALLOC) ++if(0) + message(STATUS "Building (vendored) mimalloc from source") + # We only use a vendored mimalloc as we want to control its build options. + +@@ -1518,6 +1519,11 @@ if(ARROW_MIMALLOC) + add_dependencies(toolchain mimalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) ++else() ++ find_package(mimalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${mimalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${mimalloc_LIBRARIES_TARGETS} ) ++endif() + endif() + + # ---------------------------------------------------------------------- +@@ -1918,11 +1924,16 @@ macro(build_lz4) + endmacro() + + if(ARROW_WITH_LZ4) +- resolve_dependency(Lz4) ++ resolve_dependency(lz4) + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) +- include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) ++ if(TARGET LZ4::lz4_static) ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_static INTERFACE_INCLUDE_DIRECTORIES) ++ else() ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_shared INTERFACE_INCLUDE_DIRECTORIES) ++ endif() ++ include_directories(SYSTEM ${lz4_INCLUDE_DIR}) ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${lz4_LIBRARIES_TARGETS} ) + endif() + + macro(build_zstd) +@@ -2037,10 +2048,10 @@ macro(build_re2) + endmacro() + + if(ARROW_GANDIVA) +- resolve_dependency(RE2) ++ resolve_dependency(re2) + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(RE2_INCLUDE_DIR RE2::re2 INTERFACE_INCLUDE_DIRECTORIES) ++ get_target_property(RE2_INCLUDE_DIR re2::re2 INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${RE2_INCLUDE_DIR}) + endif() + +@@ -2480,17 +2491,24 @@ if(ARROW_WITH_GRPC) + endif() + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(GRPC_INCLUDE_DIR gRPC::grpc INTERFACE_INCLUDE_DIRECTORIES) ++ # get_target_property(GRPC_INCLUDE_DIR gRPC::grpc INTERFACE_INCLUDE_DIRECTORIES) ++ if(grpc_INCLUDE_DIRS_RELEASE) ++ set(GRPC_INCLUDE_DIR ${grpc_INCLUDE_DIRS_RELEASE}) ++ elseif(grpc_INCLUDE_DIRS_DEBUG) ++ set(GRPC_INCLUDE_DIR ${grpc_INCLUDE_DIRS_DEBUG}) ++ endif() + include_directories(SYSTEM ${GRPC_INCLUDE_DIR}) ++ include_directories(SYSTEM ${absl_INCLUDE_DIR}) ++ include_directories(SYSTEM ${protobuf_INCLUDE_DIR}) + + if(GRPC_VENDORED) + set(GRPCPP_PP_INCLUDE TRUE) + else() + # grpc++ headers may reside in ${GRPC_INCLUDE_DIR}/grpc++ or ${GRPC_INCLUDE_DIR}/grpcpp + # depending on the gRPC version. +- if(EXISTS "${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h") ++ if(EXISTS ${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h) + set(GRPCPP_PP_INCLUDE TRUE) +- elseif(EXISTS "${GRPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h") ++ elseif(EXISTS ${GRPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h) + set(GRPCPP_PP_INCLUDE FALSE) + else() + message(FATAL_ERROR "Cannot find grpc++ headers in ${GRPC_INCLUDE_DIR}") +diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt +index 5797a78..da6bd4d 100644 +--- a/cpp/src/arrow/CMakeLists.txt ++++ b/cpp/src/arrow/CMakeLists.txt +@@ -292,10 +292,15 @@ set(ARROW_TESTING_SRCS + + set(_allocator_dependencies "") # Empty list + if(ARROW_JEMALLOC) +- list(APPEND _allocator_dependencies jemalloc_ep) ++ list(APPEND _allocator_dependencies jemalloc::jemalloc) + endif() ++ + if(ARROW_MIMALLOC) +- list(APPEND _allocator_dependencies mimalloc_ep) ++ if (TARGET mimalloc-static) ++ list(APPEND _allocator_dependencies mimalloc-static) ++ else() ++ list(APPEND _allocator_dependencies mimalloc) ++ endif() + endif() + + if(_allocator_dependencies) +diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc +index 784bf7b..8f005a5 100644 +--- a/cpp/src/arrow/memory_pool.cc ++++ b/cpp/src/arrow/memory_pool.cc +@@ -31,7 +31,7 @@ + // Needed to support jemalloc 3 and 4 + #define JEMALLOC_MANGLE + // Explicitly link to our version of jemalloc +-#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" ++#include "jemalloc/jemalloc.h" + #endif + + #ifdef ARROW_MIMALLOC +diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt +index 85e8db6..cd70c63 100644 +--- a/cpp/src/gandiva/CMakeLists.txt ++++ b/cpp/src/gandiva/CMakeLists.txt +@@ -25,7 +25,7 @@ add_custom_target(gandiva-benchmarks) + + add_dependencies(gandiva-all gandiva gandiva-tests gandiva-benchmarks) + +-find_package(LLVMAlt REQUIRED) ++find_package(LLVM REQUIRED) + + if(LLVM_VERSION_MAJOR LESS "10") + set(GANDIVA_CXX_STANDARD ${CMAKE_CXX_STANDARD}) +@@ -88,9 +88,16 @@ set(SRC_FILES + random_generator_holder.cc + ${GANDIVA_PRECOMPILED_CC_PATH}) + +-set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared LLVM::LLVM_INTERFACE RE2::re2) + +-set(GANDIVA_STATIC_LINK_LIBS arrow_static LLVM::LLVM_INTERFACE RE2::re2) ++ function(get_all_targets var) ++ set(targets) ++ get_all_targets_recursive(targets ${CMAKE_CURRENT_SOURCE_DIR}) ++ set(${var} ${targets} PARENT_SCOPE) ++endfunction() ++ ++set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared llvm-core::llvm-core re2::re2) ++ ++set(GANDIVA_STATIC_LINK_LIBS arrow_static llvm-core::llvm-core re2::re2) + + if(ARROW_GANDIVA_STATIC_LIBSTDCPP + AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)) +@@ -131,7 +138,7 @@ add_arrow_lib(gandiva + arrow_dependencies + precompiled + EXTRA_INCLUDES +- $ ++ $ + SHARED_LINK_FLAGS + ${GANDIVA_SHARED_LINK_FLAGS} + SHARED_LINK_LIBS +@@ -203,7 +210,7 @@ endfunction() + + set(GANDIVA_INTERNALS_TEST_ARGUMENTS) + if(WIN32) +- list(APPEND GANDIVA_INTERNALS_TEST_ARGUMENTS EXTRA_LINK_LIBS LLVM::LLVM_INTERFACE) ++ list(APPEND GANDIVA_INTERNALS_TEST_ARGUMENTS EXTRA_LINK_LIBS llvm-core::llvm-core) + endif() + add_gandiva_test(internals-test + SOURCES +@@ -225,9 +232,9 @@ add_gandiva_test(internals-test + decimal_type_util_test.cc + random_generator_holder_test.cc + EXTRA_DEPENDENCIES +- LLVM::LLVM_INTERFACE ++ llvm-core::llvm-core + EXTRA_INCLUDES +- $ ++ $ + ${GANDIVA_INTERNALS_TEST_ARGUMENTS}) + + if(ARROW_GANDIVA_JAVA) diff --git a/recipes/arrow/all/patches/2.0.0-0001-cmake.patch b/recipes/arrow/all/patches/2.0.0-0001-cmake.patch deleted file mode 100644 index e275b8cfe872b..0000000000000 --- a/recipes/arrow/all/patches/2.0.0-0001-cmake.patch +++ /dev/null @@ -1,19 +0,0 @@ ---- cpp/cmake_modules/DefineOptions.cmake -+++ cpp/cmake_modules/DefineOptions.cmake -@@ -76,7 +76,7 @@ macro(define_option_string name description default) - endmacro() - - # Top level cmake dir --if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") -+if(1) - #---------------------------------------------------------------------- - set_option_category("Compile and link") - ---- cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -1856,3 +1856,3 @@ -- find_package(RapidJSON ${ARROW_RAPIDJSON_REQUIRED_VERSION} HINTS "${CMAKE_ROOT}") -+ find_package(RapidJSON ${ARROW_RAPIDJSON_REQUIRED_VERSION} HINTS "${CMAKE_ROOT}" REQUIRED) - if(RapidJSON_FOUND) -- set(RAPIDJSON_INCLUDE_DIR ${RAPIDJSON_INCLUDE_DIRS}) -+ set(RAPIDJSON_INCLUDE_DIR ${RapidJSON_INCLUDE_DIRS}) diff --git a/recipes/arrow/all/patches/2.0.0-0002-jemalloc.patch b/recipes/arrow/all/patches/2.0.0-0002-jemalloc.patch deleted file mode 100644 index 6fd3afbe4a1db..0000000000000 --- a/recipes/arrow/all/patches/2.0.0-0002-jemalloc.patch +++ /dev/null @@ -1,43 +0,0 @@ ---- cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -1461,6 +1461,6 @@ - # jemalloc - Unix-only high-performance allocator -- - if(ARROW_JEMALLOC) -+if(0) - message(STATUS "Building (vendored) jemalloc from source") - # We only use a vendored jemalloc as we want to control its version. - # Also our build of jemalloc is specially prefixed so that it will not -@@ -1519,6 +1519,8 @@ - add_dependencies(jemalloc::jemalloc jemalloc_ep) - - list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) -+else() -+ find_package(jemalloc REQUIRED) -+endif() - endif() -- - # ---------------------------------------------------------------------- - # mimalloc - Cross-platform high-performance allocator, from Microsoft ---- cpp/src/arrow/CMakeLists.txt -+++ cpp/src/arrow/CMakeLists.txt -@@ -307,7 +307,7 @@ - - set(_allocator_dependencies "") # Empty list - if(ARROW_JEMALLOC) -- list(APPEND _allocator_dependencies jemalloc_ep) -+ list(APPEND _allocator_dependencies jemalloc::jemalloc) - endif() - if(ARROW_MIMALLOC) - list(APPEND _allocator_dependencies mimalloc_ep) ---- cpp/src/arrow/memory_pool.cc -+++ cpp/src/arrow/memory_pool.cc -@@ -31,7 +31,7 @@ - // Needed to support jemalloc 3 and 4 - #define JEMALLOC_MANGLE - // Explicitly link to our version of jemalloc --#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" -+#include "jemalloc/jemalloc.h" - #endif - - #ifdef ARROW_MIMALLOC diff --git a/recipes/arrow/all/patches/2.0.0-0006-gandiva-llvm-re2.patch b/recipes/arrow/all/patches/2.0.0-0006-gandiva-llvm-re2.patch deleted file mode 100644 index 84a3edc7fde19..0000000000000 --- a/recipes/arrow/all/patches/2.0.0-0006-gandiva-llvm-re2.patch +++ /dev/null @@ -1,78 +0,0 @@ ---- cpp/CMakeLists.txt -+++ cpp/CMakeLists.txt -@@ -109,7 +109,7 @@ set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support") - set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") - set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}") - --set(ARROW_LLVM_VERSIONS "10" "9" "8" "7") -+set(ARROW_LLVM_VERSIONS "12" "11" "10" "9" "8" "7") - list(GET ARROW_LLVM_VERSIONS 0 ARROW_LLVM_VERSION_PRIMARY) - string(REGEX - REPLACE "^([0-9]+)(\\..+)?" "\\1" ARROW_LLVM_VERSION_PRIMARY_MAJOR - ---- cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -2092,10 +2092,11 @@ macro(build_re2) - endmacro() - - if(ARROW_GANDIVA) -- resolve_dependency(RE2) -+ find_package(re2 REQUIRED) -+ resolve_dependency(re2) - - # TODO: Don't use global includes but rather target_include_directories -- get_target_property(RE2_INCLUDE_DIR RE2::re2 INTERFACE_INCLUDE_DIRECTORIES) -+ get_target_property(RE2_INCLUDE_DIR re2::re2 INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${RE2_INCLUDE_DIR}) - endif() - ---- cpp/src/gandiva/CMakeLists.txt -+++ cpp/src/gandiva/CMakeLists.txt -@@ -25,8 +25,14 @@ add_custom_target(gandiva-benchmarks) - - add_dependencies(gandiva-all gandiva gandiva-tests gandiva-benchmarks) - -+# Now LLVMAlt is only for finding clang/llvm-link - find_package(LLVMAlt REQUIRED) - -+find_package(llvm-core REQUIRED) -+ -+string(REPLACE "." ";" VERSION_LIST ${llvm-core_VERSION}) -+list(GET VERSION_LIST 0 LLVM_VERSION_MAJOR) -+ - if(LLVM_VERSION_MAJOR LESS "10") - set(GANDIVA_CXX_STANDARD ${CMAKE_CXX_STANDARD}) - else() -@@ -88,9 +94,9 @@ set(SRC_FILES - random_generator_holder.cc - ${GANDIVA_PRECOMPILED_CC_PATH}) - --set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared LLVM::LLVM_INTERFACE RE2::re2) -+set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared llvm-core::llvm-core re2::re2) - --set(GANDIVA_STATIC_LINK_LIBS arrow_static LLVM::LLVM_INTERFACE RE2::re2) -+set(GANDIVA_STATIC_LINK_LIBS arrow_static llvm-core::llvm-core re2::re2) - - if(ARROW_GANDIVA_STATIC_LIBSTDCPP - AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX)) -@@ -131,7 +137,7 @@ add_arrow_lib(gandiva - arrow_dependencies - precompiled - EXTRA_INCLUDES -- $ -+ $ - SHARED_LINK_FLAGS - ${GANDIVA_SHARED_LINK_FLAGS} - SHARED_LINK_LIBS -@@ -225,9 +231,9 @@ add_gandiva_test(internals-test - decimal_type_util_test.cc - random_generator_holder_test.cc - EXTRA_DEPENDENCIES -- LLVM::LLVM_INTERFACE -+ llvm-core::llvm-core - EXTRA_INCLUDES -- $ -+ $ - ${GANDIVA_INTERNALS_TEST_ARGUMENTS}) - - if(ARROW_GANDIVA_JAVA) diff --git a/recipes/arrow/all/patches/2.0.0-0007-fix-protoc-cmake.patch b/recipes/arrow/all/patches/2.0.0-0007-fix-protoc-cmake.patch deleted file mode 100644 index 2e1c27893d15d..0000000000000 --- a/recipes/arrow/all/patches/2.0.0-0007-fix-protoc-cmake.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -1452,7 +1452,7 @@ if(ARROW_WITH_PROTOBUF) - message(STATUS "Found protoc: ${PROTOBUF_PROTOC_EXECUTABLE}") - # Protobuf_PROTOC_LIBRARY is set by all versions of FindProtobuf.cmake - message(STATUS "Found libprotoc: ${Protobuf_PROTOC_LIBRARY}") -- get_target_property(PROTOBUF_LIBRARY ${ARROW_PROTOBUF_LIBPROTOBUF} IMPORTED_LOCATION) -+ # get_target_property(PROTOBUF_LIBRARY ${ARROW_PROTOBUF_LIBPROTOBUF} IMPORTED_LOCATION) - message(STATUS "Found libprotobuf: ${PROTOBUF_LIBRARY}") - message(STATUS "Found protobuf headers: ${PROTOBUF_INCLUDE_DIR}") - endif() diff --git a/recipes/arrow/all/patches/2.0.0-0008-fix-cmake.patch b/recipes/arrow/all/patches/2.0.0-0008-fix-cmake.patch new file mode 100644 index 0000000000000..7153d641e0c61 --- /dev/null +++ b/recipes/arrow/all/patches/2.0.0-0008-fix-cmake.patch @@ -0,0 +1,273 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index 515e6af..7488161 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -109,7 +109,7 @@ set(BUILD_SUPPORT_DIR "${CMAKE_SOURCE_DIR}/build-support") + set(ARROW_CMAKE_INSTALL_DIR "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}") + set(ARROW_DOC_DIR "share/doc/${PROJECT_NAME}") + +-set(ARROW_LLVM_VERSIONS "10" "9" "8" "7") ++set(ARROW_LLVM_VERSIONS "13" "12" "11" "10" "9" "8" "7") + list(GET ARROW_LLVM_VERSIONS 0 ARROW_LLVM_VERSION_PRIMARY) + string(REGEX + REPLACE "^([0-9]+)(\\..+)?" "\\1" ARROW_LLVM_VERSION_PRIMARY_MAJOR +@@ -667,7 +667,7 @@ endif() + + if(ARROW_WITH_BROTLI) + # Order is important for static linking +- set(ARROW_BROTLI_LIBS Brotli::brotlienc Brotli::brotlidec Brotli::brotlicommon) ++ set(ARROW_BROTLI_LIBS brotli::brotlienc brotli::brotlidec brotli::brotlicommon) + list(APPEND ARROW_LINK_LIBS ${ARROW_BROTLI_LIBS}) + list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS}) + if(Brotli_SOURCE STREQUAL "SYSTEM") +@@ -683,9 +683,9 @@ if(ARROW_WITH_BZ2) + endif() + + if(ARROW_WITH_LZ4) +- list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) ++ list(APPEND ARROW_STATIC_LINK_LIBS lz4::lz4) + if(Lz4_SOURCE STREQUAL "SYSTEM") +- list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) ++ list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS lz4::lz4) + endif() + endif() + +@@ -842,8 +842,14 @@ endif() + + if(ARROW_MIMALLOC) + add_definitions(-DARROW_MIMALLOC) +- list(APPEND ARROW_LINK_LIBS mimalloc::mimalloc) +- list(APPEND ARROW_STATIC_LINK_LIBS mimalloc::mimalloc) ++ if (TARGET mimalloc-static) ++ list(APPEND ARROW_LINK_LIBS mimalloc-static) ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc-static) ++ else() ++ list(APPEND ARROW_LINK_LIBS mimalloc) ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc) ++ endif() ++ + endif() + + # ---------------------------------------------------------------------- +diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake +index cc37a3c..8fe6db9 100644 +--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake ++++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake +@@ -171,6 +171,7 @@ macro(provide_find_module DEPENDENCY_NAME) + endmacro() + + macro(resolve_dependency DEPENDENCY_NAME) ++if(0) + set(options) + set(one_value_args REQUIRED_VERSION) + cmake_parse_arguments(ARG +@@ -207,6 +208,14 @@ macro(resolve_dependency DEPENDENCY_NAME) + provide_find_module(${DEPENDENCY_NAME}) + list(APPEND ARROW_SYSTEM_DEPENDENCIES ${DEPENDENCY_NAME}) + endif() ++else() ++ if(ARG_REQUIRED_VERSION) ++ find_package(${DEPENDENCY_NAME} ${ARG_REQUIRED_VERSION} REQUIRED) ++ else() ++ find_package(${DEPENDENCY_NAME} REQUIRED) ++ endif() ++ list(APPEND ARROW_SYSTEM_DEPENDENCIES ${DEPENDENCY_NAME}) ++endif() + endmacro() + + # ---------------------------------------------------------------------- +@@ -826,6 +835,7 @@ endif() + # - Tests need Boost at runtime. + # - S3FS and Flight benchmarks need Boost at runtime. + if(ARROW_BUILD_INTEGRATION ++ OR ARROW_BOOST_REQUIRED + OR ARROW_BUILD_TESTS + OR ARROW_GANDIVA + OR (ARROW_FLIGHT AND ARROW_BUILD_BENCHMARKS) +@@ -846,7 +856,7 @@ if(ARROW_BOOST_REQUIRED) + elseif(BOOST_SOURCE STREQUAL "BUNDLED") + build_boost() + elseif(BOOST_SOURCE STREQUAL "SYSTEM") +- find_package(BoostAlt ${ARROW_BOOST_REQUIRED_VERSION} REQUIRED) ++ find_package(Boost ${ARROW_BOOST_REQUIRED_VERSION} REQUIRED) + endif() + + if(TARGET Boost::system) +@@ -973,11 +983,11 @@ macro(build_brotli) + endmacro() + + if(ARROW_WITH_BROTLI) +- resolve_dependency(Brotli) ++ resolve_dependency(brotli) + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon ++ get_target_property(BROTLI_INCLUDE_DIR brotli::brotlicommon + INTERFACE_INCLUDE_DIRECTORIES) +- include_directories(SYSTEM ${BROTLI_INCLUDE_DIR}) ++ include_directories(SYSTEM ${brotli_INCLUDE_DIR}) + endif() + + if(PARQUET_REQUIRE_ENCRYPTION AND NOT ARROW_PARQUET) +@@ -1200,9 +1210,10 @@ if(ARROW_NEED_GFLAGS) + endif() + endif() + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) ++ include_directories(SYSTEM ${gflags_INCLUDE_DIR}) ++ set(GFLAGS_LIBRARIES ${gflags_LIBRARIES}) + +- if(NOT TARGET ${GFLAGS_LIBRARIES}) ++ if(0) + if(TARGET gflags-shared) + set(GFLAGS_LIBRARIES gflags-shared) + elseif(TARGET gflags_shared) +@@ -1291,12 +1302,13 @@ endmacro() + if(ARROW_WITH_THRIFT) + # We already may have looked for Thrift earlier, when considering whether + # to build Boost, so don't look again if already found. +- if(NOT Thrift_FOUND AND NOT THRIFT_FOUND) ++ if(0) + # Thrift c++ code generated by 0.13 requires 0.11 or greater + resolve_dependency(Thrift REQUIRED_VERSION 0.11.0) + endif() ++ find_package(Thrift CONFIG REQUIRED) + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}) ++ include_directories(SYSTEM ${Thrift_INCLUDE_DIR}) + endif() + + # ---------------------------------------------------------------------- +@@ -1461,6 +1473,7 @@ endif() + # jemalloc - Unix-only high-performance allocator + + if(ARROW_JEMALLOC) ++if(0) + message(STATUS "Building (vendored) jemalloc from source") + # We only use a vendored jemalloc as we want to control its version. + # Also our build of jemalloc is specially prefixed so that it will not +@@ -1519,12 +1532,18 @@ if(ARROW_JEMALLOC) + add_dependencies(jemalloc::jemalloc jemalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) ++else() ++ find_package(jemalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${jemalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${jemalloc_LIBRARIES_TARGETS} ) ++endif() + endif() + + # ---------------------------------------------------------------------- + # mimalloc - Cross-platform high-performance allocator, from Microsoft + + if(ARROW_MIMALLOC) ++if(0) + message(STATUS "Building (vendored) mimalloc from source") + # We only use a vendored mimalloc as we want to control its build options. + +@@ -1572,6 +1591,11 @@ if(ARROW_MIMALLOC) + add_dependencies(toolchain mimalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) ++else() ++ find_package(mimalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${mimalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${mimalloc_LIBRARIES_TARGETS} ) ++endif() + endif() + + # ---------------------------------------------------------------------- +@@ -1971,11 +1995,16 @@ macro(build_lz4) + endmacro() + + if(ARROW_WITH_LZ4) +- resolve_dependency(Lz4) ++ resolve_dependency(lz4) + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) +- include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) ++ if(TARGET LZ4::lz4_static) ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_static INTERFACE_INCLUDE_DIRECTORIES) ++ else() ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_shared INTERFACE_INCLUDE_DIRECTORIES) ++ endif() ++ include_directories(SYSTEM ${lz4_INCLUDE_DIR}) ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${lz4_LIBRARIES_TARGETS} ) + endif() + + macro(build_zstd) +@@ -2090,10 +2119,10 @@ macro(build_re2) + endmacro() + + if(ARROW_GANDIVA) +- resolve_dependency(RE2) ++ resolve_dependency(re2) + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(RE2_INCLUDE_DIR RE2::re2 INTERFACE_INCLUDE_DIRECTORIES) ++ get_target_property(RE2_INCLUDE_DIR re2::re2 INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${RE2_INCLUDE_DIR}) + endif() + +@@ -2541,17 +2570,24 @@ if(ARROW_WITH_GRPC) + endif() + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(GRPC_INCLUDE_DIR gRPC::grpc INTERFACE_INCLUDE_DIRECTORIES) ++ if(grpc_INCLUDE_DIRS_RELEASE) ++ set(GRPC_INCLUDE_DIR ${grpc_INCLUDE_DIRS_RELEASE}) ++ elseif(grpc_INCLUDE_DIRS_DEBUG) ++ set(GRPC_INCLUDE_DIR ${grpc_INCLUDE_DIRS_DEBUG}) ++ endif() ++ + include_directories(SYSTEM ${GRPC_INCLUDE_DIR}) ++ include_directories(SYSTEM ${absl_INCLUDE_DIR}) ++ include_directories(SYSTEM ${protobuf_INCLUDE_DIR}) + + if(GRPC_VENDORED) + set(GRPCPP_PP_INCLUDE TRUE) + else() + # grpc++ headers may reside in ${GRPC_INCLUDE_DIR}/grpc++ or ${GRPC_INCLUDE_DIR}/grpcpp + # depending on the gRPC version. +- if(EXISTS "${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h") ++ if(EXISTS ${gRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h) + set(GRPCPP_PP_INCLUDE TRUE) +- elseif(EXISTS "${GRPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h") ++ elseif(EXISTS ${gRPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h) + set(GRPCPP_PP_INCLUDE FALSE) + else() + message(FATAL_ERROR "Cannot find grpc++ headers in ${GRPC_INCLUDE_DIR}") +diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt +index 2751254..842fc9e 100644 +--- a/cpp/src/arrow/CMakeLists.txt ++++ b/cpp/src/arrow/CMakeLists.txt +@@ -307,10 +307,14 @@ set(ARROW_TESTING_SRCS + + set(_allocator_dependencies "") # Empty list + if(ARROW_JEMALLOC) +- list(APPEND _allocator_dependencies jemalloc_ep) ++ list(APPEND _allocator_dependencies jemalloc::jemalloc) + endif() + if(ARROW_MIMALLOC) +- list(APPEND _allocator_dependencies mimalloc_ep) ++ if (TARGET mimalloc-static) ++ list(APPEND _allocator_dependencies mimalloc-static) ++ else() ++ list(APPEND _allocator_dependencies mimalloc) ++ endif() + endif() + + if(_allocator_dependencies) +diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc +index 784bf7b..8f005a5 100644 +--- a/cpp/src/arrow/memory_pool.cc ++++ b/cpp/src/arrow/memory_pool.cc +@@ -31,7 +31,7 @@ + // Needed to support jemalloc 3 and 4 + #define JEMALLOC_MANGLE + // Explicitly link to our version of jemalloc +-#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" ++#include "jemalloc/jemalloc.h" + #endif + + #ifdef ARROW_MIMALLOC diff --git a/recipes/arrow/all/patches/7.0.0-0001-cmake.patch b/recipes/arrow/all/patches/7.0.0-0001-cmake.patch deleted file mode 100644 index 3a476ed4aeddb..0000000000000 --- a/recipes/arrow/all/patches/7.0.0-0001-cmake.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake -index 0a43ec1..c468d48 100644 ---- a/cpp/cmake_modules/DefineOptions.cmake -+++ b/cpp/cmake_modules/DefineOptions.cmake -@@ -82,7 +82,7 @@ macro(define_option_string name description default) - endmacro() - - # Top level cmake dir --if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") -+if(1) - #---------------------------------------------------------------------- - set_option_category("Compile and link") - diff --git a/recipes/arrow/all/patches/7.0.0-0002-jemalloc.patch b/recipes/arrow/all/patches/7.0.0-0002-jemalloc.patch deleted file mode 100644 index 323f5178065e6..0000000000000 --- a/recipes/arrow/all/patches/7.0.0-0002-jemalloc.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt -index b984bc1..84975e2 100644 ---- a/cpp/src/arrow/CMakeLists.txt -+++ b/cpp/src/arrow/CMakeLists.txt -@@ -323,7 +323,7 @@ set(ARROW_TESTING_SRCS - - set(_allocator_dependencies "") # Empty list - if(ARROW_JEMALLOC) -- list(APPEND _allocator_dependencies jemalloc_ep) -+ list(APPEND _allocator_dependencies jemalloc::jemalloc) - endif() - if(ARROW_MIMALLOC) - list(APPEND _allocator_dependencies mimalloc_ep) -diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc -index cf8bf64..cf8966b 100644 ---- a/cpp/src/arrow/memory_pool.cc -+++ b/cpp/src/arrow/memory_pool.cc -@@ -48,7 +48,7 @@ - // Needed to support jemalloc 3 and 4 - #define JEMALLOC_MANGLE - // Explicitly link to our version of jemalloc --#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" -+#include "jemalloc/jemalloc.h" - #endif - - #ifdef ARROW_MIMALLOC diff --git a/recipes/arrow/all/patches/7.0.0-0003-mallctl-takes-size_t.patch b/recipes/arrow/all/patches/7.0.0-0003-mallctl-takes-size_t.patch deleted file mode 100644 index a7077fc324531..0000000000000 --- a/recipes/arrow/all/patches/7.0.0-0003-mallctl-takes-size_t.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc -index cf8bf64..2dcfb01 100644 ---- a/cpp/src/arrow/memory_pool.cc -+++ b/cpp/src/arrow/memory_pool.cc -@@ -563,7 +563,7 @@ MemoryPool* default_memory_pool() { - - Status jemalloc_set_decay_ms(int ms) { - #ifdef ARROW_JEMALLOC -- ssize_t decay_time_ms = static_cast(ms); -+ size_t decay_time_ms = static_cast(ms); - - int err = mallctl("arenas.dirty_decay_ms", nullptr, nullptr, &decay_time_ms, - sizeof(decay_time_ms)); diff --git a/recipes/arrow/all/patches/7.0.0-0005-use-find-package.patch b/recipes/arrow/all/patches/7.0.0-0005-use-find-package.patch deleted file mode 100644 index 64cfa3e6d8f47..0000000000000 --- a/recipes/arrow/all/patches/7.0.0-0005-use-find-package.patch +++ /dev/null @@ -1,418 +0,0 @@ -diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt -index 2d7baf1..c2e86e0 100644 ---- a/cpp/CMakeLists.txt -+++ b/cpp/CMakeLists.txt -@@ -715,7 +715,7 @@ if(ARROW_WITH_BZ2) - endif() - - if(ARROW_WITH_LZ4) -- list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) -+ list(APPEND ARROW_STATIC_LINK_LIBS lz4::lz4) - if(Lz4_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) - endif() -@@ -901,8 +901,8 @@ endif() - if(ARROW_JEMALLOC) - add_definitions(-DARROW_JEMALLOC) - add_definitions(-DARROW_JEMALLOC_INCLUDE_DIR=${JEMALLOC_INCLUDE_DIR}) -- list(APPEND ARROW_LINK_LIBS jemalloc::jemalloc) -- list(APPEND ARROW_STATIC_LINK_LIBS jemalloc::jemalloc) -+ list(APPEND ARROW_LINK_LIBS jemalloc) -+ list(APPEND ARROW_STATIC_LINK_LIBS jemalloc) - endif() - - if(ARROW_MIMALLOC) -diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake -index bc38952..84fc279 100644 ---- a/cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -953,14 +953,7 @@ else() - endif() - - if(ARROW_BOOST_REQUIRED) -- resolve_dependency(Boost -- HAVE_ALT -- TRUE -- REQUIRED_VERSION -- ${ARROW_BOOST_REQUIRED_VERSION} -- IS_RUNTIME_DEPENDENCY -- # libarrow.so doesn't depend on libboost*. -- FALSE) -+ find_package(Boost CONFIG REQUIRED) - - if(TARGET Boost::system) - set(BOOST_SYSTEM_LIBRARY Boost::system) -@@ -1038,6 +1031,7 @@ macro(build_snappy) - endmacro() - - if(ARROW_WITH_SNAPPY) -+ if(0) - resolve_dependency(Snappy PC_PACKAGE_NAMES snappy) - if(${Snappy_SOURCE} STREQUAL "SYSTEM" AND NOT snappy_PC_FOUND) - get_target_property(SNAPPY_LIB Snappy::snappy IMPORTED_LOCATION) -@@ -1046,6 +1040,8 @@ if(ARROW_WITH_SNAPPY) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(SNAPPY_INCLUDE_DIRS Snappy::snappy INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${SNAPPY_INCLUDE_DIRS}) -+ endif() -+ find_package(Snappy REQUIRED) - endif() - - # ---------------------------------------------------------------------- -@@ -1108,7 +1104,7 @@ macro(build_brotli) - endmacro() - - if(ARROW_WITH_BROTLI) -- resolve_dependency(Brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) -+ find_package(Brotli REQUIRED) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon - INTERFACE_INCLUDE_DIRECTORIES) -@@ -1156,6 +1152,15 @@ if(PARQUET_REQUIRE_ENCRYPTION - set(OpenSSL_USE_STATIC_LIBS ON) - set(OPENSSL_USE_STATIC_LIBS ON) - find_package(OpenSSL ${ARROW_OPENSSL_REQUIRED_VERSION} REQUIRED) -+ find_package(OpenSSL REQUIRED CONFIG) -+ message("OPENSSL_FOUND: ${OPENSSL_FOUND}") -+ message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}") -+ message("OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}") -+ message("OPENSSL_CRYPTO_LIBRARIES: ${OPENSSL_CRYPTO_LIBRARIES}") -+ message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}") -+ message("OPENSSL_SSL_LIBRARIES: ${OPENSSL_SSL_LIBRARIES}") -+ message("OPENSSL_LIBRARIES: ${OPENSSL_LIBRARIES}") -+ message("OPENSSL_VERSION: ${OPENSSL_VERSION}") - endif() - set(ARROW_USE_OPENSSL ON) - endif() -@@ -1228,10 +1233,13 @@ macro(build_glog) - endmacro() - - if(ARROW_USE_GLOG) -+ if(0) - resolve_dependency(GLOG PC_PACKAGE_NAMES libglog) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(GLOG_INCLUDE_DIR glog::glog INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${GLOG_INCLUDE_DIR}) -+ endif() -+ find_package(glog REQUIRED) - endif() - - # ---------------------------------------------------------------------- -@@ -1300,17 +1308,11 @@ macro(build_gflags) - endmacro() - - if(ARROW_NEED_GFLAGS) -- set(ARROW_GFLAGS_REQUIRED_VERSION "2.1.0") -- resolve_dependency(gflags -- HAVE_ALT -- TRUE -- REQUIRED_VERSION -- ${ARROW_GFLAGS_REQUIRED_VERSION} -- IS_RUNTIME_DEPENDENCY -- FALSE) -+ find_package(gflags REQUIRED) - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) - -+if(0) - if(NOT TARGET ${GFLAGS_LIBRARIES}) - if(TARGET gflags-shared) - set(GFLAGS_LIBRARIES gflags-shared) -@@ -1318,6 +1320,10 @@ if(ARROW_NEED_GFLAGS) - set(GFLAGS_LIBRARIES gflags_shared) - endif() - endif() -+else() -+ set(GFLAGS_LIBRARIES gflags::gflags) -+endif() -+ - endif() - - # ---------------------------------------------------------------------- -@@ -1400,6 +1406,7 @@ macro(build_thrift) - endmacro() - - if(ARROW_WITH_THRIFT) -+if (0) - # We already may have looked for Thrift earlier, when considering whether - # to build Boost, so don't look again if already found. - if(NOT Thrift_FOUND) -@@ -1412,6 +1419,9 @@ if(ARROW_WITH_THRIFT) - endif() - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}) -+else() -+ find_package(Thrift REQUIRED CONFIG) -+endif() - - string(REPLACE "." ";" VERSION_LIST ${THRIFT_VERSION}) - list(GET VERSION_LIST 0 THRIFT_VERSION_MAJOR) -@@ -1606,7 +1616,7 @@ if(ARROW_JEMALLOC) - # conflict with the default allocator as well as other jemalloc - # installations. - # find_package(jemalloc) -- -+ if (0) - set(ARROW_JEMALLOC_USE_SHARED OFF) - set(JEMALLOC_PREFIX - "${CMAKE_CURRENT_BINARY_DIR}/jemalloc_ep-prefix/src/jemalloc_ep/dist/") -@@ -1664,6 +1674,9 @@ if(ARROW_JEMALLOC) - "${CMAKE_CURRENT_BINARY_DIR}/jemalloc_ep-prefix/src") - add_dependencies(jemalloc::jemalloc jemalloc_ep) - -+ endif() -+ find_package(jemalloc REQUIRED) -+ - list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) - endif() - -@@ -1671,6 +1684,8 @@ endif() - # mimalloc - Cross-platform high-performance allocator, from Microsoft - - if(ARROW_MIMALLOC) -+ if (0) -+ - message(STATUS "Building (vendored) mimalloc from source") - # We only use a vendored mimalloc as we want to control its build options. - -@@ -1715,6 +1730,13 @@ if(ARROW_MIMALLOC) - add_dependencies(mimalloc::mimalloc mimalloc_ep) - add_dependencies(toolchain mimalloc_ep) - -+ else() -+ -+ find_package(mimalloc CONFIG REQUIRED) -+ add_dependencies(toolchain mimalloc::mimalloc) -+ -+ endif() -+ - list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) - endif() - -@@ -1999,6 +2021,7 @@ macro(build_rapidjson) - endmacro() - - if(ARROW_WITH_RAPIDJSON) -+if(0) - set(ARROW_RAPIDJSON_REQUIRED_VERSION "1.1.0") - resolve_dependency(RapidJSON - HAVE_ALT -@@ -2011,6 +2034,10 @@ if(ARROW_WITH_RAPIDJSON) - if(RapidJSON_INCLUDE_DIR) - set(RAPIDJSON_INCLUDE_DIR "${RapidJSON_INCLUDE_DIR}") - endif() -+else() -+ find_package(RapidJSON REQUIRED) -+ set(RAPIDJSON_INCLUDE_DIR "${RapidJSON_INCLUDE_DIR}") -+endif() - - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR}) -@@ -2036,10 +2063,21 @@ macro(build_xsimd) - set(XSIMD_VENDORED TRUE) - endmacro() - --if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE" -- )) -+if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE")) -+ -+ if (0) -+ - set(xsimd_SOURCE "BUNDLED") - resolve_dependency(xsimd) -+ -+ else() -+ -+ find_package(xsimd) -+ set(XSIMD_INCLUDE_DIR "${xsimd_INCLUDE_DIR}") -+ add_dependencies(toolchain xsimd) -+ -+ endif() -+ - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${XSIMD_INCLUDE_DIR}) - endif() -@@ -2082,11 +2120,14 @@ macro(build_zlib) - endmacro() - - if(ARROW_WITH_ZLIB) -+ if(0) - resolve_dependency(ZLIB PC_PACKAGE_NAMES zlib) - - # TODO: Don't use global includes but rather target_include_directories - get_target_property(ZLIB_INCLUDE_DIR ZLIB::ZLIB INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${ZLIB_INCLUDE_DIR}) -+ endif() -+ find_package(ZLIB REQUIRED) - endif() - - macro(build_lz4) -@@ -2140,11 +2181,14 @@ macro(build_lz4) - endmacro() - - if(ARROW_WITH_LZ4) -+ if(0) - resolve_dependency(Lz4 PC_PACKAGE_NAMES liblz4) - - # TODO: Don't use global includes but rather target_include_directories - get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) -+ endif() -+ find_package(lz4 REQUIRED) - endif() - - macro(build_zstd) -@@ -2205,6 +2249,7 @@ macro(build_zstd) - endmacro() - - if(ARROW_WITH_ZSTD) -+ if(0) - # ARROW-13384: ZSTD_minCLevel was added in v1.4.0, required by ARROW-13091 - resolve_dependency(zstd - PC_PACKAGE_NAMES -@@ -2232,6 +2277,8 @@ if(ARROW_WITH_ZSTD) - get_target_property(ZSTD_INCLUDE_DIR ${ARROW_ZSTD_LIBZSTD} - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${ZSTD_INCLUDE_DIR}) -+ endif() -+ find_package(zstd REQUIRED) - endif() - - # ---------------------------------------------------------------------- -@@ -2271,6 +2318,7 @@ macro(build_re2) - endmacro() - - if(ARROW_WITH_RE2) -+ if(0) - # Don't specify "PC_PACKAGE_NAMES re2" here because re2.pc may - # include -std=c++11. It's not compatible with C source and C++ - # source not uses C++ 11. -@@ -2284,6 +2332,8 @@ if(ARROW_WITH_RE2) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(RE2_INCLUDE_DIR re2::re2 INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${RE2_INCLUDE_DIR}) -+ endif() -+ find_package(re2 REQUIRED) - endif() - - macro(build_bzip2) -@@ -2335,10 +2385,7 @@ macro(build_bzip2) - endmacro() - - if(ARROW_WITH_BZ2) -- resolve_dependency(BZip2) -- if(${BZip2_SOURCE} STREQUAL "SYSTEM") -- string(APPEND ARROW_PC_LIBS_PRIVATE " ${BZIP2_LIBRARIES}") -- endif() -+ find_package(BZip2 REQUIRED) - - if(NOT TARGET BZip2::BZip2) - add_library(BZip2::BZip2 UNKNOWN IMPORTED) -@@ -2390,11 +2437,7 @@ macro(build_utf8proc) - endmacro() - - if(ARROW_WITH_UTF8PROC) -- resolve_dependency(utf8proc -- REQUIRED_VERSION -- "2.2.0" -- PC_PACKAGE_NAMES -- libutf8proc) -+ find_package(utf8proc REQUIRED CONFIG) - - add_definitions(-DARROW_WITH_UTF8PROC) - -@@ -3554,33 +3597,12 @@ if(ARROW_WITH_GRPC) - message(STATUS "Forcing gRPC_SOURCE to Protobuf_SOURCE (${Protobuf_SOURCE})") - set(gRPC_SOURCE "${Protobuf_SOURCE}") - endif() -- resolve_dependency(gRPC -- HAVE_ALT -- TRUE -- REQUIRED_VERSION -- ${ARROW_GRPC_REQUIRED_VERSION} -- PC_PACKAGE_NAMES -- grpc++) -+ find_package(gRPC CONFIG REQUIRED) - - # TODO: Don't use global includes but rather target_include_directories - get_target_property(GRPC_INCLUDE_DIR gRPC::grpc++ INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${GRPC_INCLUDE_DIR}) - -- if(GRPC_VENDORED) -- set(GRPCPP_PP_INCLUDE TRUE) -- # Examples need to link to static Arrow if we're using static gRPC -- set(ARROW_GRPC_USE_SHARED OFF) -- else() -- # grpc++ headers may reside in ${GRPC_INCLUDE_DIR}/grpc++ or ${GRPC_INCLUDE_DIR}/grpcpp -- # depending on the gRPC version. -- if(EXISTS "${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h") -- set(GRPCPP_PP_INCLUDE TRUE) -- elseif(EXISTS "${GRPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h") -- set(GRPCPP_PP_INCLUDE FALSE) -- else() -- message(FATAL_ERROR "Cannot find grpc++ headers in ${GRPC_INCLUDE_DIR}") -- endif() -- endif() - endif() - - # ---------------------------------------------------------------------- -@@ -3770,7 +3792,12 @@ macro(build_google_cloud_cpp_storage) - endmacro() - - if(ARROW_WITH_GOOGLE_CLOUD_CPP) -+if(0) - resolve_dependency(google_cloud_cpp_storage) -+else() -+ find_package(google-cloud-cpp REQUIRED) -+endif() -+ - get_target_property(google_cloud_cpp_storage_INCLUDE_DIR google-cloud-cpp::storage - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${google_cloud_cpp_storage_INCLUDE_DIR}) -@@ -4097,11 +4124,15 @@ macro(build_opentelemetry) - endmacro() - - if(ARROW_WITH_OPENTELEMETRY) -+if(0) - set(opentelemetry-cpp_SOURCE "AUTO") - resolve_dependency(opentelemetry-cpp) - get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::api - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${OPENTELEMETRY_INCLUDE_DIR}) -+else() -+ find_package(opentelemetry-cpp REQUIRED) -+endif() - message(STATUS "Found OpenTelemetry headers: ${OPENTELEMETRY_INCLUDE_DIR}") - endif() - -diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt -index 84975e2..7779c08 100644 ---- a/cpp/src/arrow/CMakeLists.txt -+++ b/cpp/src/arrow/CMakeLists.txt -@@ -575,6 +575,10 @@ foreach(LIB_TARGET ${ARROW_LIBRARIES}) - target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_EXPORTING) - endforeach() - -+if(ARROW_BUILD_SHARED AND WIN32) -+ target_compile_definitions(arrow_shared PRIVATE ARROW_EXPORTING) -+endif() -+ - if(ARROW_WITH_BACKTRACE) - find_package(Backtrace) - -@@ -585,6 +589,7 @@ if(ARROW_WITH_BACKTRACE) - endforeach() - endif() - -+if(0) - if(ARROW_BUILD_BUNDLED_DEPENDENCIES) - arrow_car(_FIRST_LIB ${ARROW_BUNDLED_STATIC_LIBS}) - arrow_cdr(_OTHER_LIBS ${ARROW_BUNDLED_STATIC_LIBS}) -@@ -596,6 +601,7 @@ if(ARROW_BUILD_BUNDLED_DEPENDENCIES) - TO_MERGE - ${_OTHER_LIBS}) - endif() -+endif() - - if(ARROW_TESTING) - # that depend on gtest diff --git a/recipes/arrow/all/patches/7.0.0-0007-fix-cmake.patch b/recipes/arrow/all/patches/7.0.0-0007-fix-cmake.patch new file mode 100644 index 0000000000000..8b4d5d5518dcc --- /dev/null +++ b/recipes/arrow/all/patches/7.0.0-0007-fix-cmake.patch @@ -0,0 +1,347 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index 2d7baf1..dff5b1a 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -699,7 +699,7 @@ endif() + + if(ARROW_WITH_BROTLI) + # Order is important for static linking +- set(ARROW_BROTLI_LIBS Brotli::brotlienc Brotli::brotlidec Brotli::brotlicommon) ++ set(ARROW_BROTLI_LIBS brotli::brotlienc brotli::brotlidec brotli::brotlicommon) + list(APPEND ARROW_LINK_LIBS ${ARROW_BROTLI_LIBS}) + list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS}) + if(Brotli_SOURCE STREQUAL "SYSTEM") +@@ -715,10 +715,17 @@ if(ARROW_WITH_BZ2) + endif() + + if(ARROW_WITH_LZ4) +- list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) +- if(Lz4_SOURCE STREQUAL "SYSTEM") +- list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) +- endif() ++ if (TARGET LZ4::lz4_static) ++ list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4_static) ++ if(Lz4_SOURCE STREQUAL "SYSTEM") ++ list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4_static) ++ endif() ++ else() ++ list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4_shared) ++ if(Lz4_SOURCE STREQUAL "SYSTEM") ++ list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4_shared) ++ endif() ++endif() + endif() + + if(ARROW_WITH_SNAPPY) +@@ -907,8 +914,13 @@ endif() + + if(ARROW_MIMALLOC) + add_definitions(-DARROW_MIMALLOC) +- list(APPEND ARROW_LINK_LIBS mimalloc::mimalloc) +- list(APPEND ARROW_STATIC_LINK_LIBS mimalloc::mimalloc) ++ if (TARGET mimalloc-static) ++ list(APPEND ARROW_LINK_LIBS mimalloc-static) ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc-static) ++ else() ++ list(APPEND ARROW_LINK_LIBS mimalloc) ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc) ++ endif() + endif() + + # ---------------------------------------------------------------------- +diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake +index bc38952..62bf314 100644 +--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake ++++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake +@@ -954,7 +954,7 @@ endif() + + if(ARROW_BOOST_REQUIRED) + resolve_dependency(Boost +- HAVE_ALT ++ USE_CONFIG + TRUE + REQUIRED_VERSION + ${ARROW_BOOST_REQUIRED_VERSION} +@@ -965,7 +965,7 @@ if(ARROW_BOOST_REQUIRED) + if(TARGET Boost::system) + set(BOOST_SYSTEM_LIBRARY Boost::system) + set(BOOST_FILESYSTEM_LIBRARY Boost::filesystem) +- elseif(BoostAlt_FOUND) ++ elseif(Boost_FOUND) + set(BOOST_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY}) + set(BOOST_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY}) + else() +@@ -1108,9 +1108,9 @@ macro(build_brotli) + endmacro() + + if(ARROW_WITH_BROTLI) +- resolve_dependency(Brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) ++ resolve_dependency(brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon ++ get_target_property(BROTLI_INCLUDE_DIR brotli::brotlicommon + INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${BROTLI_INCLUDE_DIR}) + endif() +@@ -1302,22 +1302,17 @@ endmacro() + if(ARROW_NEED_GFLAGS) + set(ARROW_GFLAGS_REQUIRED_VERSION "2.1.0") + resolve_dependency(gflags +- HAVE_ALT ++ USE_CONFIG + TRUE + REQUIRED_VERSION + ${ARROW_GFLAGS_REQUIRED_VERSION} + IS_RUNTIME_DEPENDENCY + FALSE) + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) ++ include_directories(SYSTEM ${gflags_INCLUDE_DIR}) + +- if(NOT TARGET ${GFLAGS_LIBRARIES}) +- if(TARGET gflags-shared) +- set(GFLAGS_LIBRARIES gflags-shared) +- elseif(TARGET gflags_shared) +- set(GFLAGS_LIBRARIES gflags_shared) +- endif() +- endif() ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${gflags_LIBRARIES_TARGETS}) ++ set(GFLAGS_LIBRARIES gflags::gflags) + endif() + + # ---------------------------------------------------------------------- +@@ -1411,9 +1406,9 @@ if(ARROW_WITH_THRIFT) + thrift) + endif() + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}) ++ include_directories(SYSTEM ${Thrift_INCLUDE_DIR}) + +- string(REPLACE "." ";" VERSION_LIST ${THRIFT_VERSION}) ++ string(REPLACE "." ";" VERSION_LIST ${Thrift_VERSION}) + list(GET VERSION_LIST 0 THRIFT_VERSION_MAJOR) + list(GET VERSION_LIST 1 THRIFT_VERSION_MINOR) + list(GET VERSION_LIST 2 THRIFT_VERSION_PATCH) +@@ -1528,6 +1523,7 @@ if(ARROW_WITH_PROTOBUF) + set(ARROW_PROTOBUF_REQUIRED_VERSION "2.6.1") + endif() + resolve_dependency(Protobuf ++ USE_CONFIG + REQUIRED_VERSION + ${ARROW_PROTOBUF_REQUIRED_VERSION} + PC_PACKAGE_NAMES +@@ -1538,7 +1534,7 @@ if(ARROW_WITH_PROTOBUF) + endif() + + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${PROTOBUF_INCLUDE_DIR}) ++ include_directories(SYSTEM ${protobuf_INCLUDE_DIR}) + + if(TARGET arrow::protobuf::libprotobuf) + set(ARROW_PROTOBUF_LIBPROTOBUF arrow::protobuf::libprotobuf) +@@ -1547,9 +1543,9 @@ if(ARROW_WITH_PROTOBUF) + if(NOT TARGET protobuf::libprotobuf) + add_library(protobuf::libprotobuf UNKNOWN IMPORTED) + set_target_properties(protobuf::libprotobuf +- PROPERTIES IMPORTED_LOCATION "${PROTOBUF_LIBRARY}" ++ PROPERTIES IMPORTED_LOCATION "${Protobuf_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES +- "${PROTOBUF_INCLUDE_DIR}") ++ "${Protobuf_INCLUDE_DIR}") + endif() + set(ARROW_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) + endif() +@@ -1569,7 +1565,7 @@ if(ARROW_WITH_PROTOBUF) + set_target_properties(protobuf::libprotoc + PROPERTIES IMPORTED_LOCATION "${Protobuf_PROTOC_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES +- "${PROTOBUF_INCLUDE_DIR}") ++ "${Protobuf_INCLUDE_DIR}") + endif() + set(ARROW_PROTOBUF_LIBPROTOC protobuf::libprotoc) + endif() +@@ -1600,6 +1596,7 @@ endif() + # jemalloc - Unix-only high-performance allocator + + if(ARROW_JEMALLOC) ++if(0) + message(STATUS "Building (vendored) jemalloc from source") + # We only use a vendored jemalloc as we want to control its version. + # Also our build of jemalloc is specially prefixed so that it will not +@@ -1665,12 +1662,18 @@ if(ARROW_JEMALLOC) + add_dependencies(jemalloc::jemalloc jemalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) ++else() ++ find_package(jemalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${jemalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${jemalloc_LIBRARIES_TARGETS}) ++endif() + endif() + + # ---------------------------------------------------------------------- + # mimalloc - Cross-platform high-performance allocator, from Microsoft + + if(ARROW_MIMALLOC) ++if(0) + message(STATUS "Building (vendored) mimalloc from source") + # We only use a vendored mimalloc as we want to control its build options. + +@@ -1716,6 +1719,11 @@ if(ARROW_MIMALLOC) + add_dependencies(toolchain mimalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) ++else() ++ find_package(mimalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${mimalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${mimalloc_LIBRARIES_TARGETS} ) ++endif() + endif() + + # ---------------------------------------------------------------------- +@@ -2001,7 +2009,7 @@ endmacro() + if(ARROW_WITH_RAPIDJSON) + set(ARROW_RAPIDJSON_REQUIRED_VERSION "1.1.0") + resolve_dependency(RapidJSON +- HAVE_ALT ++ USE_CONFIG + TRUE + REQUIRED_VERSION + ${ARROW_RAPIDJSON_REQUIRED_VERSION} +@@ -2038,10 +2046,9 @@ endmacro() + + if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE" + )) +- set(xsimd_SOURCE "BUNDLED") + resolve_dependency(xsimd) + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${XSIMD_INCLUDE_DIR}) ++ include_directories(SYSTEM ${xsimd_INCLUDE_DIR}) + endif() + + macro(build_zlib) +@@ -2140,10 +2147,14 @@ macro(build_lz4) + endmacro() + + if(ARROW_WITH_LZ4) +- resolve_dependency(Lz4 PC_PACKAGE_NAMES liblz4) ++ resolve_dependency(lz4) + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) ++ if (TARGET LZ4::lz4_static) ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_static INTERFACE_INCLUDE_DIRECTORIES) ++ else() ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_shared INTERFACE_INCLUDE_DIRECTORIES) ++ endif() + include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) + endif() + +@@ -2274,7 +2285,7 @@ if(ARROW_WITH_RE2) + # Don't specify "PC_PACKAGE_NAMES re2" here because re2.pc may + # include -std=c++11. It's not compatible with C source and C++ + # source not uses C++ 11. +- resolve_dependency(re2 HAVE_ALT TRUE) ++ resolve_dependency(re2 USE_CONFIG TRUE) + if(${re2_SOURCE} STREQUAL "SYSTEM") + get_target_property(RE2_LIB re2::re2 IMPORTED_LOCATION) + string(APPEND ARROW_PC_LIBS_PRIVATE " ${RE2_LIB}") +@@ -2337,7 +2348,7 @@ endmacro() + if(ARROW_WITH_BZ2) + resolve_dependency(BZip2) + if(${BZip2_SOURCE} STREQUAL "SYSTEM") +- string(APPEND ARROW_PC_LIBS_PRIVATE " ${BZIP2_LIBRARIES}") ++ string(APPEND ARROW_PC_LIBS_PRIVATE " ${BZip2_LIBRARIES}") + endif() + + if(NOT TARGET BZip2::BZip2) +@@ -2346,7 +2357,7 @@ if(ARROW_WITH_BZ2) + PROPERTIES IMPORTED_LOCATION "${BZIP2_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIR}") + endif() +- include_directories(SYSTEM "${BZIP2_INCLUDE_DIR}") ++ include_directories(SYSTEM "${BZip2_INCLUDE_DIR}") + endif() + + macro(build_utf8proc) +@@ -3555,7 +3566,7 @@ if(ARROW_WITH_GRPC) + set(gRPC_SOURCE "${Protobuf_SOURCE}") + endif() + resolve_dependency(gRPC +- HAVE_ALT ++ USE_CONFIG + TRUE + REQUIRED_VERSION + ${ARROW_GRPC_REQUIRED_VERSION} +@@ -3573,9 +3584,9 @@ if(ARROW_WITH_GRPC) + else() + # grpc++ headers may reside in ${GRPC_INCLUDE_DIR}/grpc++ or ${GRPC_INCLUDE_DIR}/grpcpp + # depending on the gRPC version. +- if(EXISTS "${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h") ++ if(EXISTS ${gRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h) + set(GRPCPP_PP_INCLUDE TRUE) +- elseif(EXISTS "${GRPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h") ++ elseif(EXISTS ${gPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h) + set(GRPCPP_PP_INCLUDE FALSE) + else() + message(FATAL_ERROR "Cannot find grpc++ headers in ${GRPC_INCLUDE_DIR}") +@@ -4097,9 +4108,9 @@ macro(build_opentelemetry) + endmacro() + + if(ARROW_WITH_OPENTELEMETRY) +- set(opentelemetry-cpp_SOURCE "AUTO") ++ set(opentelemetry-cpp_SOURCE "SYSTEM") + resolve_dependency(opentelemetry-cpp) +- get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::api ++ get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::opentelemetry_common + INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${OPENTELEMETRY_INCLUDE_DIR}) + message(STATUS "Found OpenTelemetry headers: ${OPENTELEMETRY_INCLUDE_DIR}") +diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt +index b984bc1..2c78cd9 100644 +--- a/cpp/src/arrow/CMakeLists.txt ++++ b/cpp/src/arrow/CMakeLists.txt +@@ -323,10 +323,14 @@ set(ARROW_TESTING_SRCS + + set(_allocator_dependencies "") # Empty list + if(ARROW_JEMALLOC) +- list(APPEND _allocator_dependencies jemalloc_ep) ++ list(APPEND _allocator_dependencies jemalloc::jemalloc) + endif() + if(ARROW_MIMALLOC) +- list(APPEND _allocator_dependencies mimalloc_ep) ++ if (TARGET mimalloc-static) ++ list(APPEND _allocator_dependencies mimalloc-static) ++ else() ++ list(APPEND _allocator_dependencies mimalloc) ++ endif() + endif() + + if(_allocator_dependencies) +diff --git a/cpp/src/arrow/flight/CMakeLists.txt b/cpp/src/arrow/flight/CMakeLists.txt +index 2cf8c99..90ebb9a 100644 +--- a/cpp/src/arrow/flight/CMakeLists.txt ++++ b/cpp/src/arrow/flight/CMakeLists.txt +@@ -17,6 +17,9 @@ + + add_custom_target(arrow_flight) + ++# TODO: This is a temporary workaround. absl should be LINKED as TARGET. ++include_directories(SYSTEM ${absl_INCLUDE_DIR}) ++ + arrow_install_all_headers("arrow/flight") + + set(ARROW_FLIGHT_LINK_LIBS gRPC::grpc++ ${ARROW_PROTOBUF_LIBPROTOBUF}) +diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc +index 2dcfb01..0394c01 100644 +--- a/cpp/src/arrow/memory_pool.cc ++++ b/cpp/src/arrow/memory_pool.cc +@@ -48,7 +48,7 @@ + // Needed to support jemalloc 3 and 4 + #define JEMALLOC_MANGLE + // Explicitly link to our version of jemalloc +-#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" ++#include "jemalloc/jemalloc.h" + #endif + + #ifdef ARROW_MIMALLOC diff --git a/recipes/arrow/all/patches/8.0.0-0001-cmake.patch b/recipes/arrow/all/patches/8.0.0-0001-cmake.patch deleted file mode 100644 index 893ddf0b07512..0000000000000 --- a/recipes/arrow/all/patches/8.0.0-0001-cmake.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cpp/cmake_modules/DefineOptions.cmake b/cpp/cmake_modules/DefineOptions.cmake -index ab7d2ed..6f1e411 100644 ---- a/cpp/cmake_modules/DefineOptions.cmake -+++ b/cpp/cmake_modules/DefineOptions.cmake -@@ -82,7 +82,7 @@ macro(define_option_string name description default) - endmacro() - - # Top level cmake dir --if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") -+if(1) - #---------------------------------------------------------------------- - set_option_category("Compile and link") - diff --git a/recipes/arrow/all/patches/8.0.0-0002-jemalloc.patch b/recipes/arrow/all/patches/8.0.0-0002-jemalloc.patch deleted file mode 100644 index ebc52531e130d..0000000000000 --- a/recipes/arrow/all/patches/8.0.0-0002-jemalloc.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt -index 690c51a..c518b7d 100644 ---- a/cpp/src/arrow/CMakeLists.txt -+++ b/cpp/src/arrow/CMakeLists.txt -@@ -326,7 +326,7 @@ set(ARROW_TESTING_SRCS - - set(_allocator_dependencies "") # Empty list - if(ARROW_JEMALLOC) -- list(APPEND _allocator_dependencies jemalloc_ep) -+ list(APPEND _allocator_dependencies jemalloc::jemalloc) - endif() - if(ARROW_MIMALLOC) - list(APPEND _allocator_dependencies mimalloc_ep) -diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc -index 2fab6f3..1f8f896 100644 ---- a/cpp/src/arrow/memory_pool.cc -+++ b/cpp/src/arrow/memory_pool.cc -@@ -52,7 +52,7 @@ - // Needed to support jemalloc 3 and 4 - #define JEMALLOC_MANGLE - // Explicitly link to our version of jemalloc --#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" -+#include "jemalloc/jemalloc.h" - #endif - - #ifdef ARROW_MIMALLOC diff --git a/recipes/arrow/all/patches/8.0.0-0003-mallctl-takes-size_t.patch b/recipes/arrow/all/patches/8.0.0-0003-mallctl-takes-size_t.patch deleted file mode 100644 index 87a804c6cd774..0000000000000 --- a/recipes/arrow/all/patches/8.0.0-0003-mallctl-takes-size_t.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc -index 1f8f896..37a89da 100644 ---- a/cpp/src/arrow/memory_pool.cc -+++ b/cpp/src/arrow/memory_pool.cc -@@ -767,7 +767,7 @@ MemoryPool* default_memory_pool() { - - Status jemalloc_set_decay_ms(int ms) { - #ifdef ARROW_JEMALLOC -- ssize_t decay_time_ms = static_cast(ms); -+ size_t decay_time_ms = static_cast(ms); - - int err = mallctl("arenas.dirty_decay_ms", nullptr, nullptr, &decay_time_ms, - sizeof(decay_time_ms)); diff --git a/recipes/arrow/all/patches/8.0.0-0004-use-find-package.patch b/recipes/arrow/all/patches/8.0.0-0004-use-find-package.patch deleted file mode 100644 index b270f53d3516e..0000000000000 --- a/recipes/arrow/all/patches/8.0.0-0004-use-find-package.patch +++ /dev/null @@ -1,379 +0,0 @@ -diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt -index aba18c8..bb463d0 100644 ---- a/cpp/CMakeLists.txt -+++ b/cpp/CMakeLists.txt -@@ -721,7 +721,7 @@ if(ARROW_WITH_BZ2) - endif() - - if(ARROW_WITH_LZ4) -- list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4) -+ list(APPEND ARROW_STATIC_LINK_LIBS lz4::lz4) - if(Lz4_SOURCE STREQUAL "SYSTEM") - list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) - endif() -@@ -907,8 +907,8 @@ endif() - if(ARROW_JEMALLOC) - add_definitions(-DARROW_JEMALLOC) - add_definitions(-DARROW_JEMALLOC_INCLUDE_DIR=${JEMALLOC_INCLUDE_DIR}) -- list(APPEND ARROW_LINK_LIBS jemalloc::jemalloc) -- list(APPEND ARROW_STATIC_LINK_LIBS jemalloc::jemalloc) -+ list(APPEND ARROW_LINK_LIBS jemalloc) -+ list(APPEND ARROW_STATIC_LINK_LIBS jemalloc) - endif() - - if(ARROW_MIMALLOC) -diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake -index f070323..2e2a03b 100644 ---- a/cpp/cmake_modules/ThirdpartyToolchain.cmake -+++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake -@@ -974,6 +974,7 @@ else() - endif() - - if(ARROW_BOOST_REQUIRED) -+if(0) - resolve_dependency(Boost - HAVE_ALT - TRUE -@@ -982,6 +983,9 @@ if(ARROW_BOOST_REQUIRED) - IS_RUNTIME_DEPENDENCY - # libarrow.so doesn't depend on libboost*. - FALSE) -+else() -+ find_package(Boost REQUIRED CONFIG) -+endif() - - if(TARGET Boost::system) - set(BOOST_SYSTEM_LIBRARY Boost::system) -@@ -1059,6 +1063,7 @@ macro(build_snappy) - endmacro() - - if(ARROW_WITH_SNAPPY) -+if(0) - resolve_dependency(Snappy PC_PACKAGE_NAMES snappy) - if(${Snappy_SOURCE} STREQUAL "SYSTEM" AND NOT snappy_PC_FOUND) - get_target_property(SNAPPY_LIB Snappy::snappy IMPORTED_LOCATION) -@@ -1067,6 +1072,9 @@ if(ARROW_WITH_SNAPPY) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(SNAPPY_INCLUDE_DIRS Snappy::snappy INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${SNAPPY_INCLUDE_DIRS}) -+else() -+ find_package(Snappy REQUIRED) -+endif() - endif() - - # ---------------------------------------------------------------------- -@@ -1129,7 +1137,7 @@ macro(build_brotli) - endmacro() - - if(ARROW_WITH_BROTLI) -- resolve_dependency(Brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) -+ find_package(Brotli REQUIRED) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon - INTERFACE_INCLUDE_DIRECTORIES) -@@ -1169,8 +1177,16 @@ if(PARQUET_REQUIRE_ENCRYPTION - set(BUILD_SHARED_LIBS_KEEP ${BUILD_SHARED_LIBS}) - set(BUILD_SHARED_LIBS ON) - -- find_package(OpenSSL ${ARROW_OPENSSL_REQUIRED_VERSION} REQUIRED) -- set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_KEEP}) -+ find_package(OpenSSL REQUIRED CONFIG) -+ message("OPENSSL_FOUND: ${OPENSSL_FOUND}") -+ message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}") -+ message("OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}") -+ message("OPENSSL_CRYPTO_LIBRARIES: ${OPENSSL_CRYPTO_LIBRARIES}") -+ message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}") -+ message("OPENSSL_SSL_LIBRARIES: ${OPENSSL_SSL_LIBRARIES}") -+ message("OPENSSL_LIBRARIES: ${OPENSSL_LIBRARIES}") -+ message("OPENSSL_VERSION: ${OPENSSL_VERSION}") -+ set(BUILD_SHARED_LIBS ${BUILD_SHARED_LIBS_KEEP}) - unset(BUILD_SHARED_LIBS_KEEP) - else() - # Find static OpenSSL headers and libs -@@ -1249,10 +1265,14 @@ macro(build_glog) - endmacro() - - if(ARROW_USE_GLOG) -+if(0) - resolve_dependency(GLOG PC_PACKAGE_NAMES libglog) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(GLOG_INCLUDE_DIR glog::glog INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${GLOG_INCLUDE_DIR}) -+else() -+ find_package(glog REQUIRED) -+endif() - endif() - - # ---------------------------------------------------------------------- -@@ -1321,6 +1341,7 @@ macro(build_gflags) - endmacro() - - if(ARROW_NEED_GFLAGS) -+if(0) - set(ARROW_GFLAGS_REQUIRED_VERSION "2.1.0") - resolve_dependency(gflags - HAVE_ALT -@@ -1339,6 +1360,10 @@ if(ARROW_NEED_GFLAGS) - set(GFLAGS_LIBRARIES gflags_shared) - endif() - endif() -+else() -+ find_package(gflags REQUIRED) -+ set(GFLAGS_LIBRARIES gflags::gflags) -+endif() - endif() - - # ---------------------------------------------------------------------- -@@ -1718,6 +1756,7 @@ if(ARROW_JEMALLOC) - # installations. - # find_package(jemalloc) - -+if(0) - set(ARROW_JEMALLOC_USE_SHARED OFF) - set(JEMALLOC_PREFIX - "${CMAKE_CURRENT_BINARY_DIR}/jemalloc_ep-prefix/src/jemalloc_ep/dist/") -@@ -1778,6 +1817,9 @@ if(ARROW_JEMALLOC) - INTERFACE_INCLUDE_DIRECTORIES - "${CMAKE_CURRENT_BINARY_DIR}/jemalloc_ep-prefix/src") - add_dependencies(jemalloc::jemalloc jemalloc_ep) -+else() -+ find_package(jemalloc REQUIRED) -+endif() - - list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) - endif() -@@ -1786,6 +1828,7 @@ endif() - # mimalloc - Cross-platform high-performance allocator, from Microsoft - - if(ARROW_MIMALLOC) -+if(0) - message(STATUS "Building (vendored) mimalloc from source") - # We only use a vendored mimalloc as we want to control its build options. - -@@ -1834,6 +1877,10 @@ if(ARROW_MIMALLOC) - endif() - add_dependencies(mimalloc::mimalloc mimalloc_ep) - add_dependencies(toolchain mimalloc_ep) -+else() -+ find_package(mimalloc REQUIRED CONFIG) -+ add_dependencies(toolchain mimalloc::mimalloc) -+endif() - - list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) - endif() -@@ -2119,6 +2166,7 @@ macro(build_rapidjson) - endmacro() - - if(ARROW_WITH_RAPIDJSON) -+if(0) - set(ARROW_RAPIDJSON_REQUIRED_VERSION "1.1.0") - resolve_dependency(RapidJSON - HAVE_ALT -@@ -2131,6 +2179,10 @@ if(ARROW_WITH_RAPIDJSON) - if(RapidJSON_INCLUDE_DIR) - set(RAPIDJSON_INCLUDE_DIR "${RapidJSON_INCLUDE_DIR}") - endif() -+else() -+ find_package(RapidJSON REQUIRED) -+ set(RAPIDJSON_INCLUDE_DIR "${RapidJSON_INCLUDE_DIR}") -+endif() - - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${RAPIDJSON_INCLUDE_DIR}) -@@ -2158,8 +2210,14 @@ endmacro() - - if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE" - )) -+if(0) - set(xsimd_SOURCE "BUNDLED") - resolve_dependency(xsimd) -+else() -+ find_package(xsimd) -+ set(XSIMD_INCLUDE_DIR "${xsimd_INCLUDE_DIR}") -+ add_dependencies(toolchain xsimd) -+endif() - # TODO: Don't use global includes but rather target_include_directories - include_directories(SYSTEM ${XSIMD_INCLUDE_DIR}) - endif() -@@ -2202,11 +2260,15 @@ macro(build_zlib) - endmacro() - - if(ARROW_WITH_ZLIB) -+if(0) - resolve_dependency(ZLIB PC_PACKAGE_NAMES zlib) - - # TODO: Don't use global includes but rather target_include_directories - get_target_property(ZLIB_INCLUDE_DIR ZLIB::ZLIB INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${ZLIB_INCLUDE_DIR}) -+else() -+ find_package(ZLIB REQUIRED) -+endif() - endif() - - macro(build_lz4) -@@ -2260,11 +2322,15 @@ macro(build_lz4) - endmacro() - - if(ARROW_WITH_LZ4) -+if(0) - resolve_dependency(Lz4 PC_PACKAGE_NAMES liblz4) - - # TODO: Don't use global includes but rather target_include_directories - get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) -+else() -+ find_package(lz4 REQUIRED) -+endif() - endif() - - macro(build_zstd) -@@ -2325,6 +2391,7 @@ macro(build_zstd) - endmacro() - - if(ARROW_WITH_ZSTD) -+if(0) - # ARROW-13384: ZSTD_minCLevel was added in v1.4.0, required by ARROW-13091 - resolve_dependency(zstd - PC_PACKAGE_NAMES -@@ -2352,6 +2419,9 @@ if(ARROW_WITH_ZSTD) - get_target_property(ZSTD_INCLUDE_DIR ${ARROW_ZSTD_LIBZSTD} - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${ZSTD_INCLUDE_DIR}) -+else() -+ find_package(zstd REQUIRED) -+endif() - endif() - - # ---------------------------------------------------------------------- -@@ -2391,6 +2461,7 @@ macro(build_re2) - endmacro() - - if(ARROW_WITH_RE2) -+if(0) - # Don't specify "PC_PACKAGE_NAMES re2" here because re2.pc may - # include -std=c++11. It's not compatible with C source and C++ - # source not uses C++ 11. -@@ -2411,6 +2482,9 @@ if(ARROW_WITH_RE2) - # TODO: Don't use global includes but rather target_include_directories - get_target_property(RE2_INCLUDE_DIR re2::re2 INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${RE2_INCLUDE_DIR}) -+else() -+ find_package(re2 REQUIRED) -+endif() - endif() - - macro(build_bzip2) -@@ -2462,6 +2536,7 @@ macro(build_bzip2) - endmacro() - - if(ARROW_WITH_BZ2) -+if(0) - resolve_dependency(BZip2) - if(${BZip2_SOURCE} STREQUAL "SYSTEM") - string(APPEND ARROW_PC_LIBS_PRIVATE " ${BZIP2_LIBRARIES}") -@@ -2474,6 +2549,9 @@ if(ARROW_WITH_BZ2) - INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIR}") - endif() - include_directories(SYSTEM "${BZIP2_INCLUDE_DIR}") -+else() -+ find_package(BZip2 REQUIRED) -+endif() - endif() - - macro(build_utf8proc) -@@ -2517,6 +2595,7 @@ macro(build_utf8proc) - endmacro() - - if(ARROW_WITH_UTF8PROC) -+if(0) - resolve_dependency(utf8proc - REQUIRED_VERSION - "2.2.0" -@@ -2538,6 +2617,10 @@ if(ARROW_WITH_UTF8PROC) - get_target_property(UTF8PROC_INCLUDE_DIR utf8proc::utf8proc - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${UTF8PROC_INCLUDE_DIR}) -+else() -+ find_package(utf8proc REQUIRED CONFIG) -+ add_definitions(-DARROW_WITH_UTF8PROC) -+endif() - endif() - - macro(build_cares) -@@ -3702,6 +3785,7 @@ macro(build_grpc) - endmacro() - - if(ARROW_WITH_GRPC) -+if(0) - set(ARROW_GRPC_REQUIRED_VERSION "1.17.0") - if(NOT Protobuf_SOURCE STREQUAL gRPC_SOURCE) - # ARROW-15495: Protobuf/gRPC must come from the same source -@@ -3735,6 +3819,9 @@ if(ARROW_WITH_GRPC) - message(FATAL_ERROR "Cannot find grpc++ headers in ${GRPC_INCLUDE_DIR}") - endif() - endif() -+else() -+ find_package(gRPC REQUIRED CONFIG) -+endif() - endif() - - # ---------------------------------------------------------------------- -@@ -3937,10 +4024,14 @@ macro(build_google_cloud_cpp_storage) - endmacro() - - if(ARROW_WITH_GOOGLE_CLOUD_CPP) -+if(0) - resolve_dependency(google_cloud_cpp_storage) - get_target_property(google_cloud_cpp_storage_INCLUDE_DIR google-cloud-cpp::storage - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${google_cloud_cpp_storage_INCLUDE_DIR}) -+else() -+ find_package(google-cloud-cpp REQUIRED) -+endif() - get_target_property(absl_base_INCLUDE_DIR absl::base INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${absl_base_INCLUDE_DIR}) - message(STATUS "Found google-cloud-cpp::storage headers: ${google_cloud_cpp_storage_INCLUDE_DIR}" -@@ -4261,6 +4352,7 @@ macro(build_opentelemetry) - endmacro() - - if(ARROW_WITH_OPENTELEMETRY) -+if(0) - # cURL is required whether we build from source or use an existing installation - # (OTel's cmake files do not call find_curl for you) - find_curl() -@@ -4269,7 +4361,10 @@ if(ARROW_WITH_OPENTELEMETRY) - get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::api - INTERFACE_INCLUDE_DIRECTORIES) - include_directories(SYSTEM ${OPENTELEMETRY_INCLUDE_DIR}) -- message(STATUS "Found OpenTelemetry headers: ${OPENTELEMETRY_INCLUDE_DIR}") -+else() -+ find_package(opentelemetry-cpp REQUIRED) -+endif() -+ message(STATUS "Found OpenTelemetry headers: ${OPENTELEMETRY_INCLUDE_DIR}") - endif() - - # ---------------------------------------------------------------------- -diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt -index c518b7d..40b4853 100644 ---- a/cpp/src/arrow/CMakeLists.txt -+++ b/cpp/src/arrow/CMakeLists.txt -@@ -584,6 +584,10 @@ foreach(LIB_TARGET ${ARROW_LIBRARIES}) - target_compile_definitions(${LIB_TARGET} PRIVATE ARROW_EXPORTING) - endforeach() - -+if(ARROW_BUILD_SHARED AND WIN32) -+ target_compile_definitions(arrow_shared PRIVATE ARROW_EXPORTING) -+endif() -+ - if(ARROW_WITH_BACKTRACE) - find_package(Backtrace) - -@@ -594,7 +598,7 @@ if(ARROW_WITH_BACKTRACE) - endforeach() - endif() - --if(ARROW_BUILD_BUNDLED_DEPENDENCIES) -+if(0) - arrow_car(_FIRST_LIB ${ARROW_BUNDLED_STATIC_LIBS}) - arrow_cdr(_OTHER_LIBS ${ARROW_BUNDLED_STATIC_LIBS}) - create_merged_static_lib(arrow_bundled_dependencies diff --git a/recipes/arrow/all/patches/8.0.0-0006-fix-cmake.patch b/recipes/arrow/all/patches/8.0.0-0006-fix-cmake.patch new file mode 100644 index 0000000000000..eb60d6e795ad5 --- /dev/null +++ b/recipes/arrow/all/patches/8.0.0-0006-fix-cmake.patch @@ -0,0 +1,425 @@ +diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt +index bb463d0..ce2d1df 100644 +--- a/cpp/CMakeLists.txt ++++ b/cpp/CMakeLists.txt +@@ -705,7 +705,7 @@ endif() + + if(ARROW_WITH_BROTLI) + # Order is important for static linking +- set(ARROW_BROTLI_LIBS Brotli::brotlienc Brotli::brotlidec Brotli::brotlicommon) ++ set(ARROW_BROTLI_LIBS brotli::brotlienc brotli::brotlidec brotli::brotlicommon) + list(APPEND ARROW_LINK_LIBS ${ARROW_BROTLI_LIBS}) + list(APPEND ARROW_STATIC_LINK_LIBS ${ARROW_BROTLI_LIBS}) + if(Brotli_SOURCE STREQUAL "SYSTEM") +@@ -721,11 +721,18 @@ if(ARROW_WITH_BZ2) + endif() + + if(ARROW_WITH_LZ4) +- list(APPEND ARROW_STATIC_LINK_LIBS lz4::lz4) +- if(Lz4_SOURCE STREQUAL "SYSTEM") +- list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4) ++ if (TARGET LZ4::lz4_static) ++ list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4_static) ++ if(Lz4_SOURCE STREQUAL "SYSTEM") ++ list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4_static) ++ endif() ++ else() ++ list(APPEND ARROW_STATIC_LINK_LIBS LZ4::lz4_shared) ++ if(Lz4_SOURCE STREQUAL "SYSTEM") ++ list(APPEND ARROW_STATIC_INSTALL_INTERFACE_LIBS LZ4::lz4_shared) + endif() + endif() ++endif() + + if(ARROW_WITH_SNAPPY) + list(APPEND ARROW_STATIC_LINK_LIBS Snappy::snappy) +@@ -913,8 +920,13 @@ endif() + + if(ARROW_MIMALLOC) + add_definitions(-DARROW_MIMALLOC) +- list(APPEND ARROW_LINK_LIBS mimalloc::mimalloc) +- list(APPEND ARROW_STATIC_LINK_LIBS mimalloc::mimalloc) ++ if (TARGET mimalloc-static) ++ list(APPEND ARROW_LINK_LIBS mimalloc-static) ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc-static) ++ else() ++ list(APPEND ARROW_LINK_LIBS mimalloc) ++ list(APPEND ARROW_STATIC_LINK_LIBS mimalloc) ++ endif() + endif() + + # ---------------------------------------------------------------------- +diff --git a/cpp/cmake_modules/ThirdpartyToolchain.cmake b/cpp/cmake_modules/ThirdpartyToolchain.cmake +index f070323..16faf73 100644 +--- a/cpp/cmake_modules/ThirdpartyToolchain.cmake ++++ b/cpp/cmake_modules/ThirdpartyToolchain.cmake +@@ -959,6 +959,7 @@ endif() + # - Tests need Boost at runtime. + # - S3FS and Flight benchmarks need Boost at runtime. + if(ARROW_BUILD_INTEGRATION ++ OR ARROW_BOOST_REQUIRED + OR ARROW_BUILD_TESTS + OR (ARROW_FLIGHT AND ARROW_BUILD_BENCHMARKS) + OR (ARROW_S3 AND ARROW_BUILD_BENCHMARKS)) +@@ -975,7 +976,7 @@ endif() + + if(ARROW_BOOST_REQUIRED) + resolve_dependency(Boost +- HAVE_ALT ++ USE_CONFIG + TRUE + REQUIRED_VERSION + ${ARROW_BOOST_REQUIRED_VERSION} +@@ -986,7 +987,7 @@ if(ARROW_BOOST_REQUIRED) + if(TARGET Boost::system) + set(BOOST_SYSTEM_LIBRARY Boost::system) + set(BOOST_FILESYSTEM_LIBRARY Boost::filesystem) +- elseif(BoostAlt_FOUND) ++ elseif(Boost_FOUND) + set(BOOST_SYSTEM_LIBRARY ${Boost_SYSTEM_LIBRARY}) + set(BOOST_FILESYSTEM_LIBRARY ${Boost_FILESYSTEM_LIBRARY}) + else() +@@ -1129,9 +1130,9 @@ macro(build_brotli) + endmacro() + + if(ARROW_WITH_BROTLI) +- resolve_dependency(Brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) ++ resolve_dependency(brotli PC_PACKAGE_NAMES libbrotlidec libbrotlienc) + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(BROTLI_INCLUDE_DIR Brotli::brotlicommon ++ get_target_property(BROTLI_INCLUDE_DIR brotli::brotlicommon + INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${BROTLI_INCLUDE_DIR}) + endif() +@@ -1323,22 +1324,16 @@ endmacro() + if(ARROW_NEED_GFLAGS) + set(ARROW_GFLAGS_REQUIRED_VERSION "2.1.0") + resolve_dependency(gflags +- HAVE_ALT ++ USE_CONFIG + TRUE + REQUIRED_VERSION + ${ARROW_GFLAGS_REQUIRED_VERSION} + IS_RUNTIME_DEPENDENCY + FALSE) + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${GFLAGS_INCLUDE_DIR}) +- +- if(NOT TARGET ${GFLAGS_LIBRARIES}) +- if(TARGET gflags-shared) +- set(GFLAGS_LIBRARIES gflags-shared) +- elseif(TARGET gflags_shared) +- set(GFLAGS_LIBRARIES gflags_shared) +- endif() +- endif() ++ include_directories(SYSTEM ${gflags_INCLUDE_DIR}) ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${gflags_LIBRARIES_TARGETS}) ++ set(GFLAGS_LIBRARIES gflags::gflags) + endif() + + # ---------------------------------------------------------------------- +@@ -1432,9 +1427,9 @@ if(ARROW_WITH_THRIFT) + thrift) + endif() + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${THRIFT_INCLUDE_DIR}) ++ include_directories(SYSTEM ${Thrift_INCLUDE_DIR}) + +- string(REPLACE "." ";" VERSION_LIST ${THRIFT_VERSION}) ++ string(REPLACE "." ";" VERSION_LIST ${Thrift_VERSION}) + list(GET VERSION_LIST 0 THRIFT_VERSION_MAJOR) + list(GET VERSION_LIST 1 THRIFT_VERSION_MINOR) + list(GET VERSION_LIST 2 THRIFT_VERSION_PATCH) +@@ -1557,6 +1552,7 @@ if(ARROW_WITH_PROTOBUF) + set(ARROW_PROTOBUF_REQUIRED_VERSION "2.6.1") + endif() + resolve_dependency(Protobuf ++ USE_CONFIG + REQUIRED_VERSION + ${ARROW_PROTOBUF_REQUIRED_VERSION} + PC_PACKAGE_NAMES +@@ -1567,7 +1563,7 @@ if(ARROW_WITH_PROTOBUF) + endif() + + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${PROTOBUF_INCLUDE_DIR}) ++ include_directories(SYSTEM ${protobuf_INCLUDE_DIR}) + + if(TARGET arrow::protobuf::libprotobuf) + set(ARROW_PROTOBUF_LIBPROTOBUF arrow::protobuf::libprotobuf) +@@ -1576,9 +1572,9 @@ if(ARROW_WITH_PROTOBUF) + if(NOT TARGET protobuf::libprotobuf) + add_library(protobuf::libprotobuf UNKNOWN IMPORTED) + set_target_properties(protobuf::libprotobuf +- PROPERTIES IMPORTED_LOCATION "${PROTOBUF_LIBRARY}" ++ PROPERTIES IMPORTED_LOCATION "${Protobuf_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES +- "${PROTOBUF_INCLUDE_DIR}") ++ "${Protobuf_INCLUDE_DIR}") + endif() + set(ARROW_PROTOBUF_LIBPROTOBUF protobuf::libprotobuf) + endif() +@@ -1598,7 +1594,7 @@ if(ARROW_WITH_PROTOBUF) + set_target_properties(protobuf::libprotoc + PROPERTIES IMPORTED_LOCATION "${Protobuf_PROTOC_LIBRARY}" + INTERFACE_INCLUDE_DIRECTORIES +- "${PROTOBUF_INCLUDE_DIR}") ++ "${Protobuf_INCLUDE_DIR}") + endif() + set(ARROW_PROTOBUF_LIBPROTOC protobuf::libprotoc) + endif() +@@ -1690,11 +1686,12 @@ macro(build_substrait) + + add_custom_target(substrait_gen ALL DEPENDS ${SUBSTRAIT_PROTO_GEN_ALL}) + +- set(SUBSTRAIT_INCLUDES ${SUBSTRAIT_CPP_DIR} ${PROTOBUF_INCLUDE_DIR}) ++ set(SUBSTRAIT_INCLUDES ${SUBSTRAIT_CPP_DIR} ${protobuf_INCLUDE_DIR}) + + add_library(substrait STATIC ${SUBSTRAIT_SOURCES}) + set_target_properties(substrait PROPERTIES POSITION_INDEPENDENT_CODE ON) + target_include_directories(substrait PUBLIC ${SUBSTRAIT_INCLUDES}) ++ target_include_directories(substrait PUBLIC ${PROTOBUF_INCLUDE_DIR}) + target_link_libraries(substrait INTERFACE ${ARROW_PROTOBUF_LIBPROTOBUF}) + add_dependencies(substrait substrait_gen) + +@@ -1711,6 +1708,7 @@ endif() + # jemalloc - Unix-only high-performance allocator + + if(ARROW_JEMALLOC) ++if(0) + message(STATUS "Building (vendored) jemalloc from source") + # We only use a vendored jemalloc as we want to control its version. + # Also our build of jemalloc is specially prefixed so that it will not +@@ -1780,12 +1778,18 @@ if(ARROW_JEMALLOC) + add_dependencies(jemalloc::jemalloc jemalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS jemalloc::jemalloc) ++else() ++ find_package(jemalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${jemalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${jemalloc_LIBRARIES_TARGETS}) ++endif() + endif() + + # ---------------------------------------------------------------------- + # mimalloc - Cross-platform high-performance allocator, from Microsoft + + if(ARROW_MIMALLOC) ++if(0) + message(STATUS "Building (vendored) mimalloc from source") + # We only use a vendored mimalloc as we want to control its build options. + +@@ -1836,6 +1840,11 @@ if(ARROW_MIMALLOC) + add_dependencies(toolchain mimalloc_ep) + + list(APPEND ARROW_BUNDLED_STATIC_LIBS mimalloc::mimalloc) ++else() ++ find_package(mimalloc REQUIRED CONFIG) ++ include_directories(SYSTEM "${mimalloc_INCLUDE_DIR}") ++ list(APPEND ARROW_BUNDLED_STATIC_LIBS ${mimalloc_LIBRARIES_TARGETS} ) ++endif() + endif() + + # ---------------------------------------------------------------------- +@@ -2121,7 +2130,7 @@ endmacro() + if(ARROW_WITH_RAPIDJSON) + set(ARROW_RAPIDJSON_REQUIRED_VERSION "1.1.0") + resolve_dependency(RapidJSON +- HAVE_ALT ++ USE_CONFIG + TRUE + REQUIRED_VERSION + ${ARROW_RAPIDJSON_REQUIRED_VERSION} +@@ -2158,10 +2167,10 @@ endmacro() + + if((NOT ARROW_SIMD_LEVEL STREQUAL "NONE") OR (NOT ARROW_RUNTIME_SIMD_LEVEL STREQUAL "NONE" + )) +- set(xsimd_SOURCE "BUNDLED") ++ set(xsimd_SOURCE "SYSTEM") + resolve_dependency(xsimd) + # TODO: Don't use global includes but rather target_include_directories +- include_directories(SYSTEM ${XSIMD_INCLUDE_DIR}) ++ include_directories(SYSTEM ${xsimd_INCLUDE_DIR}) + endif() + + macro(build_zlib) +@@ -2260,10 +2269,14 @@ macro(build_lz4) + endmacro() + + if(ARROW_WITH_LZ4) +- resolve_dependency(Lz4 PC_PACKAGE_NAMES liblz4) ++ resolve_dependency(Lz4) + + # TODO: Don't use global includes but rather target_include_directories +- get_target_property(LZ4_INCLUDE_DIR LZ4::lz4 INTERFACE_INCLUDE_DIRECTORIES) ++ if (TARGET LZ4::lz4_static) ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_static INTERFACE_INCLUDE_DIRECTORIES) ++ else() ++ get_target_property(LZ4_INCLUDE_DIR LZ4::lz4_shared INTERFACE_INCLUDE_DIRECTORIES) ++ endif() + include_directories(SYSTEM ${LZ4_INCLUDE_DIR}) + endif() + +@@ -2394,7 +2407,7 @@ if(ARROW_WITH_RE2) + # Don't specify "PC_PACKAGE_NAMES re2" here because re2.pc may + # include -std=c++11. It's not compatible with C source and C++ + # source not uses C++ 11. +- resolve_dependency(re2 HAVE_ALT TRUE) ++ resolve_dependency(re2 USE_CONFIG TRUE) + if(${re2_SOURCE} STREQUAL "SYSTEM") + get_target_property(RE2_LIB re2::re2 IMPORTED_LOCATION_${UPPERCASE_BUILD_TYPE}) + if(NOT RE2_LIB) +@@ -2464,7 +2477,7 @@ endmacro() + if(ARROW_WITH_BZ2) + resolve_dependency(BZip2) + if(${BZip2_SOURCE} STREQUAL "SYSTEM") +- string(APPEND ARROW_PC_LIBS_PRIVATE " ${BZIP2_LIBRARIES}") ++ string(APPEND ARROW_PC_LIBS_PRIVATE " ${BZip2_LIBRARIES}") + endif() + + if(NOT TARGET BZip2::BZip2) +@@ -2473,7 +2486,7 @@ if(ARROW_WITH_BZ2) + PROPERTIES IMPORTED_LOCATION "${BZIP2_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${BZIP2_INCLUDE_DIR}") + endif() +- include_directories(SYSTEM "${BZIP2_INCLUDE_DIR}") ++ include_directories(SYSTEM "${BZip2_INCLUDE_DIR}") + endif() + + macro(build_utf8proc) +@@ -3709,7 +3722,7 @@ if(ARROW_WITH_GRPC) + set(gRPC_SOURCE "${Protobuf_SOURCE}") + endif() + resolve_dependency(gRPC +- HAVE_ALT ++ USE_CONFIG + TRUE + REQUIRED_VERSION + ${ARROW_GRPC_REQUIRED_VERSION} +@@ -3727,9 +3740,9 @@ if(ARROW_WITH_GRPC) + else() + # grpc++ headers may reside in ${GRPC_INCLUDE_DIR}/grpc++ or ${GRPC_INCLUDE_DIR}/grpcpp + # depending on the gRPC version. +- if(EXISTS "${GRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h") ++ if(EXISTS ${gRPC_INCLUDE_DIR}/grpcpp/impl/codegen/config_protobuf.h) + set(GRPCPP_PP_INCLUDE TRUE) +- elseif(EXISTS "${GRPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h") ++ elseif(EXISTS ${gRPC_INCLUDE_DIR}/grpc++/impl/codegen/config_protobuf.h) + set(GRPCPP_PP_INCLUDE FALSE) + else() + message(FATAL_ERROR "Cannot find grpc++ headers in ${GRPC_INCLUDE_DIR}") +@@ -3937,7 +3950,7 @@ macro(build_google_cloud_cpp_storage) + endmacro() + + if(ARROW_WITH_GOOGLE_CLOUD_CPP) +- resolve_dependency(google_cloud_cpp_storage) ++ resolve_dependency(google_cloud_cpp) + get_target_property(google_cloud_cpp_storage_INCLUDE_DIR google-cloud-cpp::storage + INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${google_cloud_cpp_storage_INCLUDE_DIR}) +@@ -4264,9 +4277,9 @@ if(ARROW_WITH_OPENTELEMETRY) + # cURL is required whether we build from source or use an existing installation + # (OTel's cmake files do not call find_curl for you) + find_curl() +- set(opentelemetry-cpp_SOURCE "AUTO") ++ set(opentelemetry-cpp_SOURCE "SYSTEM") + resolve_dependency(opentelemetry-cpp) +- get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::api ++ get_target_property(OPENTELEMETRY_INCLUDE_DIR opentelemetry-cpp::opentelemetry_common + INTERFACE_INCLUDE_DIRECTORIES) + include_directories(SYSTEM ${OPENTELEMETRY_INCLUDE_DIR}) + message(STATUS "Found OpenTelemetry headers: ${OPENTELEMETRY_INCLUDE_DIR}") +diff --git a/cpp/src/arrow/CMakeLists.txt b/cpp/src/arrow/CMakeLists.txt +index 690c51a..752f3b9 100644 +--- a/cpp/src/arrow/CMakeLists.txt ++++ b/cpp/src/arrow/CMakeLists.txt +@@ -326,10 +326,14 @@ set(ARROW_TESTING_SRCS + + set(_allocator_dependencies "") # Empty list + if(ARROW_JEMALLOC) +- list(APPEND _allocator_dependencies jemalloc_ep) ++ list(APPEND _allocator_dependencies jemalloc::jemalloc) + endif() + if(ARROW_MIMALLOC) +- list(APPEND _allocator_dependencies mimalloc_ep) ++ if (TARGET mimalloc-static) ++ list(APPEND _allocator_dependencies mimalloc-static) ++ else() ++ list(APPEND _allocator_dependencies mimalloc) ++ endif() + endif() + + if(_allocator_dependencies) +diff --git a/cpp/src/arrow/flight/CMakeLists.txt b/cpp/src/arrow/flight/CMakeLists.txt +index f9d1356..c9bcf79 100644 +--- a/cpp/src/arrow/flight/CMakeLists.txt ++++ b/cpp/src/arrow/flight/CMakeLists.txt +@@ -17,6 +17,9 @@ + + add_custom_target(arrow_flight) + ++# TODO: This is a temporary workaround. absl should be LINKED as TARGET. ++include_directories(SYSTEM ${absl_INCLUDE_DIR}) ++ + arrow_install_all_headers("arrow/flight") + + set(ARROW_FLIGHT_LINK_LIBS gRPC::grpc++ ${ARROW_PROTOBUF_LIBPROTOBUF}) +diff --git a/cpp/src/arrow/memory_pool.cc b/cpp/src/arrow/memory_pool.cc +index ed1c2d8..37a89da 100644 +--- a/cpp/src/arrow/memory_pool.cc ++++ b/cpp/src/arrow/memory_pool.cc +@@ -52,7 +52,7 @@ + // Needed to support jemalloc 3 and 4 + #define JEMALLOC_MANGLE + // Explicitly link to our version of jemalloc +-#include "jemalloc_ep/dist/include/jemalloc/jemalloc.h" ++#include "jemalloc/jemalloc.h" + #endif + + #ifdef ARROW_MIMALLOC +diff --git a/cpp/src/gandiva/CMakeLists.txt b/cpp/src/gandiva/CMakeLists.txt +index 71faf9a..3aabea1 100644 +--- a/cpp/src/gandiva/CMakeLists.txt ++++ b/cpp/src/gandiva/CMakeLists.txt +@@ -25,7 +25,7 @@ add_custom_target(gandiva-benchmarks) + + add_dependencies(gandiva-all gandiva gandiva-tests gandiva-benchmarks) + +-find_package(LLVMAlt REQUIRED) ++find_package(LLVM REQUIRED) + + if(LLVM_VERSION_MAJOR LESS "10") + set(GANDIVA_CXX_STANDARD ${CMAKE_CXX_STANDARD}) +@@ -40,7 +40,7 @@ endif() + + add_definitions(-DGANDIVA_LLVM_VERSION=${LLVM_VERSION_MAJOR}) + +-find_package(OpenSSLAlt REQUIRED) ++find_package(OpenSSL REQUIRED) + + # Set the path where the bitcode file generated, see precompiled/CMakeLists.txt + set(GANDIVA_PRECOMPILED_BC_PATH "${CMAKE_CURRENT_BINARY_DIR}/irhelpers.bc") +@@ -98,10 +98,11 @@ set(SRC_FILES + random_generator_holder.cc + ${GANDIVA_PRECOMPILED_CC_PATH}) + +-set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared LLVM::LLVM_INTERFACE +- ${GANDIVA_OPENSSL_LIBS}) ++set(GANDIVA_SHARED_PRIVATE_LINK_LIBS arrow_shared llvm-core::llvm-core NTERFACE ++ ${GANDIVA_OPENSSL_LIBS}) ++ ++set(GANDIVA_STATIC_LINK_LIBS arrow_static llvm-core::llvm-core ${GANDIVA_OPENSSL_LIBS}) + +-set(GANDIVA_STATIC_LINK_LIBS arrow_static LLVM::LLVM_INTERFACE ${GANDIVA_OPENSSL_LIBS}) + + if(ARROW_GANDIVA_STATIC_LIBSTDCPP AND (CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX + )) +@@ -139,7 +140,7 @@ add_arrow_lib(gandiva + arrow_dependencies + precompiled + EXTRA_INCLUDES +- $ ++ $ + ${GANDIVA_OPENSSL_INCLUDE_DIR} + ${UTF8PROC_INCLUDE_DIR} + SHARED_LINK_FLAGS diff --git a/recipes/arrow/all/test_package/CMakeLists.txt b/recipes/arrow/all/test_package/CMakeLists.txt index f5dd033e0e7e3..9b721bbe6a17c 100644 --- a/recipes/arrow/all/test_package/CMakeLists.txt +++ b/recipes/arrow/all/test_package/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -find_package(Arrow REQUIRED) +find_package(Arrow REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} arrow::arrow) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_JEMALLOC) +target_link_libraries(${PROJECT_NAME} PRIVATE arrow::arrow) +if (${Arrow_VERSION} VERSION_LESS "10.0.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/arrow/all/test_package/conanfile.py b/recipes/arrow/all/test_package/conanfile.py index 3da371b660e0a..1111583fea732 100644 --- a/recipes/arrow/all/test_package/conanfile.py +++ b/recipes/arrow/all/test_package/conanfile.py @@ -1,10 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/arrow/all/test_v1_package/CMakeLists.txt b/recipes/arrow/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2a9b48732268c --- /dev/null +++ b/recipes/arrow/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/arrow/all/test_v1_package/conanfile.py b/recipes/arrow/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/arrow/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/arrow/config.yml b/recipes/arrow/config.yml index 51ab07154eb69..4bae18e25c979 100644 --- a/recipes/arrow/config.yml +++ b/recipes/arrow/config.yml @@ -1,4 +1,8 @@ versions: + "10.0.1": + folder: all + "10.0.0": + folder: all "8.0.1": folder: all "8.0.0": diff --git a/recipes/arsenalgear/all/CMakeLists.txt b/recipes/arsenalgear/all/CMakeLists.txt index 595b8c7314510..3656fbcc9d3a0 100644 --- a/recipes/arsenalgear/all/CMakeLists.txt +++ b/recipes/arsenalgear/all/CMakeLists.txt @@ -1,35 +1,34 @@ cmake_minimum_required(VERSION 3.8) project(arsenalgear LANGUAGES CXX) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - include(GNUInstallDirs) -set(arsenalgear_src - source_subfolder/src/operators.cpp - source_subfolder/src/stream.cpp - source_subfolder/src/system.cpp - source_subfolder/src/utils.cpp -) - -set(arsenalgear_inc - source_subfolder/include/constants.hpp - source_subfolder/include/math.hpp - source_subfolder/include/operators.hpp - source_subfolder/include/stream.hpp - source_subfolder/include/system.hpp - source_subfolder/include/utils.hpp -) - add_library(arsenalgear ${arsenalgear_src}) -target_include_directories(arsenalgear PRIVATE "source_subfolder/include") +target_sources(arsenalgear PRIVATE + $<$: + ${ARSENALGEAR_SRC_DIR}/src/operators.cpp + > + ${ARSENALGEAR_SRC_DIR}/src/stream.cpp + ${ARSENALGEAR_SRC_DIR}/src/system.cpp + ${ARSENALGEAR_SRC_DIR}/src/utils.cpp +) +target_include_directories(arsenalgear PRIVATE "${ARSENALGEAR_SRC_DIR}/include") set_target_properties(arsenalgear PROPERTIES PUBLIC_HEADER "${arsenalgear_inc}" WINDOWS_EXPORT_ALL_SYMBOLS ON ) target_compile_features(arsenalgear PUBLIC cxx_std_17) +if(${ARSENALGEAR_VERSION} VERSION_LESS 2.0.0) + find_package(Boost REQUIRED CONFIG) + target_link_libraries(arsenalgear PUBLIC Boost::headers) + + find_package(exprtk CONFIG) + if(${exprtk_FOUND}) + target_link_libraries(arsenalgear PUBLIC exprtk::exprtk) + endif() +endif() + find_library(LIBM m) target_link_libraries(arsenalgear PRIVATE $<$:${LIBM}>) @@ -38,5 +37,9 @@ install( RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/arsenalgear +) + +install( + DIRECTORY ${ARSENALGEAR_SRC_DIR}/include/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/arsenalgear ) diff --git a/recipes/arsenalgear/all/conandata.yml b/recipes/arsenalgear/all/conandata.yml index 99ab6ba4966e7..b30bf921ec7e0 100644 --- a/recipes/arsenalgear/all/conandata.yml +++ b/recipes/arsenalgear/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.1": + url: "https://github.com/JustWhit3/arsenalgear-cpp/archive/refs/tags/v2.0.1.tar.gz" + sha256: "d0fa1639abb3c41aa60e596b9d70966281a1206c5527b34a4526f6577c3bac6f" "1.2.2": url: "https://github.com/JustWhit3/arsenalgear-cpp/archive/refs/tags/v1.2.2.tar.gz" sha256: "556155d0be0942bcdd5df02fcda258579915e76b5a70e7220de6ef38c8ca7779" diff --git a/recipes/arsenalgear/all/conanfile.py b/recipes/arsenalgear/all/conanfile.py index 2edad27f8a72e..98dcd780da86b 100644 --- a/recipes/arsenalgear/all/conanfile.py +++ b/recipes/arsenalgear/all/conanfile.py @@ -1,9 +1,14 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.microsoft import is_msvc -import functools +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -required_conan_version = ">=1.45.0" +import os + +required_conan_version = ">=1.53.0" class ArsenalgearConan(ConanFile): name = "arsenalgear" @@ -21,14 +26,23 @@ class ArsenalgearConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12.0", + } def export_sources(self): - self.copy("CMakeLists.txt") + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -36,54 +50,48 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def requirements(self): - self.requires("boost/1.79.0") - if self.settings.os in ["Linux", "Macos"]: - self.requires("exprtk/0.0.1") + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _compiler_required_cpp17(self): - return { - "Visual Studio": "16", - "gcc": "8", - "clang": "7", - "apple-clang": "12.0", - } + def requirements(self): + if Version(self.version) < "2.0.0": + self.requires("boost/1.81.0") + if self.settings.os in ["Linux", "Macos"]: + self.requires("exprtk/0.0.1") def validate(self): - # In 1.2.2, arsenalgear doesn't support Visual Studio. + # arsenalgear doesn't support Visual Studio(yet). if is_msvc(self): - raise ConanInvalidConfiguration("{} doesn't support Visual Studio(yet)".format(self.name)) - - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio(yet)") - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{0} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ARSENALGEAR_VERSION"] = str(self.version) + tc.variables["ARSENALGEAR_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/arsenalgear/all/test_package/CMakeLists.txt b/recipes/arsenalgear/all/test_package/CMakeLists.txt index abd25c367aac4..3ff34ca782123 100644 --- a/recipes/arsenalgear/all/test_package/CMakeLists.txt +++ b/recipes/arsenalgear/all/test_package/CMakeLists.txt @@ -1,12 +1,9 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(arsenalgear REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} arsenalgear::arsenalgear) +target_link_libraries(${PROJECT_NAME} PRIVATE arsenalgear::arsenalgear) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/arsenalgear/all/test_package/conanfile.py b/recipes/arsenalgear/all/test_package/conanfile.py index 38f4483872d47..a9fbb7f543162 100644 --- a/recipes/arsenalgear/all/test_package/conanfile.py +++ b/recipes/arsenalgear/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt b/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..bc541ea90b512 --- /dev/null +++ b/recipes/arsenalgear/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/arsenalgear/all/test_v1_package/conanfile.py b/recipes/arsenalgear/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/arsenalgear/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/arsenalgear/config.yml b/recipes/arsenalgear/config.yml index af40d9653a378..6d0bf30afb485 100644 --- a/recipes/arsenalgear/config.yml +++ b/recipes/arsenalgear/config.yml @@ -1,3 +1,5 @@ versions: + "2.0.1": + folder: all "1.2.2": folder: all diff --git a/recipes/aruco/3.x.x/CMakeLists.txt b/recipes/aruco/3.x.x/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/aruco/3.x.x/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/aruco/3.x.x/conanfile.py b/recipes/aruco/3.x.x/conanfile.py index 22aa76a34e69a..fb95bc3ec62e7 100644 --- a/recipes/aruco/3.x.x/conanfile.py +++ b/recipes/aruco/3.x.x/conanfile.py @@ -1,18 +1,20 @@ -from conans import ConanFile, tools, CMake -import functools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import collect_libs, copy, get, rmdir import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class ArucoConan(ConanFile): name = "aruco" description = "Augmented reality library based on OpenCV " - topics = ("aruco", "augmented reality") + topics = ("augmented-reality", "robotics", "markers") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.uco.es/investiga/grupos/ava/node/26" license = "GPL-3.0-only" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [False, True], @@ -23,59 +25,51 @@ class ArucoConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("opencv/4.5.5") self.requires("eigen/3.4.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["ARUCO_DEVINSTALL"] = True - cmake.definitions["BUILD_TESTS"] = False - cmake.definitions["BUILD_GLSAMPLES"] = False - cmake.definitions["BUILD_UTILS"] = False - cmake.definitions["BUILD_DEBPACKAGE"] = False - cmake.definitions["BUILD_SVM"] = False - cmake.definitions["INSTALL_DOC"] = False - cmake.definitions["USE_OWN_EIGEN3"] = False - cmake.configure(build_folder=self._build_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ARUCO_DEVINSTALL"] = True + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_GLSAMPLES"] = False + tc.variables["BUILD_UTILS"] = False + tc.variables["BUILD_DEBPACKAGE"] = False + tc.variables["BUILD_SVM"] = False + tc.variables["INSTALL_DOC"] = False + tc.variables["USE_OWN_EIGEN3"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "aruco") self.cpp_info.includedirs.append(os.path.join("include", "aruco")) - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) diff --git a/recipes/aruco/3.x.x/test_package/CMakeLists.txt b/recipes/aruco/3.x.x/test_package/CMakeLists.txt index d8da2bf5ad2d6..30e5df3e94e16 100644 --- a/recipes/aruco/3.x.x/test_package/CMakeLists.txt +++ b/recipes/aruco/3.x.x/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(aruco REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} aruco::aruco) +target_link_libraries(${PROJECT_NAME} PRIVATE aruco::aruco) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/aruco/3.x.x/test_package/conanfile.py b/recipes/aruco/3.x.x/test_package/conanfile.py index 38f4483872d47..98ab55852ad56 100644 --- a/recipes/aruco/3.x.x/test_package/conanfile.py +++ b/recipes/aruco/3.x.x/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aruco/3.x.x/test_v1_package/CMakeLists.txt b/recipes/aruco/3.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/aruco/3.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aruco/3.x.x/test_v1_package/conanfile.py b/recipes/aruco/3.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/aruco/3.x.x/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/asio-grpc/all/conandata.yml b/recipes/asio-grpc/all/conandata.yml index f34ff55643aa6..67c8b715cb2d3 100644 --- a/recipes/asio-grpc/all/conandata.yml +++ b/recipes/asio-grpc/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "2.4.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.4.0.tar.gz" + sha256: "d71de4f8de91dc0ad44d6a161fc628496b80622a6f9030dcd4c53b516629b8b7" + "2.3.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.3.0.tar.gz" + sha256: "eb48e72c98d45d9251fe1cbdca3a72a4d67435a7020357cd33ff717cc5851c01" + "2.2.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.2.0.tar.gz" + sha256: "a820e48681bc66834f7e6dbc326e245416f4ef009769f45826b3d09079afad4c" + "2.1.0": + url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.1.0.tar.gz" + sha256: "51da699eb442db3ec3af1caae5a29d78733ebbd9d1b781f75abe6ce2802fc7c1" "2.0.0": url: "https://github.com/Tradias/asio-grpc/archive/refs/tags/v2.0.0.tar.gz" sha256: "e36ab4f286dccfd6589b8001d6560e994c753539738680588264c1c0e0a6ce4f" diff --git a/recipes/asio-grpc/all/conanfile.py b/recipes/asio-grpc/all/conanfile.py index 75de28466abad..3bb6966103744 100644 --- a/recipes/asio-grpc/all/conanfile.py +++ b/recipes/asio-grpc/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class AsioGrpcConan(ConanFile): @@ -16,11 +20,11 @@ class AsioGrpcConan(ConanFile): no_copy_source = True options = { "backend": ["boost", "asio", "unifex"], - "use_boost_container": ["auto", True, False], + "local_allocator": ["auto", "memory_resource", "boost_container", "recycling_allocator"], } default_options = { "backend": "boost", - "use_boost_container": "auto", + "local_allocator": "auto", } @property @@ -38,49 +42,63 @@ def _compilers_minimum_version(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._min_cppstd) + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: + if Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration(f"{self.name} requires C++{self._min_cppstd}, which your compiler does not support.") else: self.output.warn(f"{self.name} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") def configure(self): - if self.options.use_boost_container == "auto": + self._local_allocator_option = self.options.local_allocator + if self._local_allocator_option == "auto": libcxx = self.settings.compiler.get_safe("libcxx") - compiler_version = tools.Version(self.settings.compiler.version) - self.options.use_boost_container = libcxx and str(libcxx) == "libc++" or \ + compiler_version = Version(self.settings.compiler.version) + prefer_boost_container = libcxx and str(libcxx) == "libc++" or \ (self.settings.compiler == "gcc" and compiler_version < "9") or \ (self.settings.compiler == "clang" and compiler_version < "12" and libcxx and str(libcxx) == "libstdc++") + self._local_allocator_option = "boost_container" if prefer_boost_container else "memory_resource" + if self._local_allocator_option == "recycling_allocator" and self.options.backend == "unifex": + raise ConanInvalidConfiguration(f"{self.name} 'recycling_allocator' cannot be used in combination with the 'unifex' backend.") def requirements(self): - self.requires("grpc/1.47.1") - if self.options.use_boost_container or self.options.backend == "boost": - self.requires("boost/1.79.0") + self.requires("grpc/1.50.1") + if self._local_allocator_option == "boost_container" or self.options.backend == "boost": + self.requires("boost/1.81.0") if self.options.backend == "asio": - self.requires("asio/1.23.0") + self.requires("asio/1.24.0") if self.options.backend == "unifex": self.requires("libunifex/cci.20220430") def package_id(self): - self.info.header_only() - self.info.options.use_boost_container = self.options.use_boost_container + self.info.clear() + self.info.options.local_allocator = self._local_allocator_option + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def package(self): - self.copy(pattern="LICENSE", dst="licenses") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ASIO_GRPC_USE_BOOST_CONTAINER"] = self._local_allocator_option == "boost_container" + tc.variables["ASIO_GRPC_USE_RECYCLING_ALLOCATOR"] = self._local_allocator_option == "recycling_allocator" + tc.generate() + + def build(self): cmake = CMake(self) - cmake.definitions["ASIO_GRPC_USE_BOOST_CONTAINER"] = self.options.use_boost_container cmake.configure() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib", "cmake", "asio-grpc"), "asio-grpc*") + rm(self, "asio-grpc*", os.path.join(self.package_folder, "lib", "cmake", "asio-grpc")) def package_info(self): - self.cpp_info.builddirs = [os.path.join("lib", "cmake", "asio-grpc")] - build_modules = [os.path.join(self.cpp_info.builddirs[0], "AsioGrpcProtobufGenerator.cmake")] + build_modules = [os.path.join("lib", "cmake", "asio-grpc", "AsioGrpcProtobufGenerator.cmake")] self.cpp_info.requires = ["grpc::grpc++_unsecure"] if self.options.backend == "boost": @@ -93,7 +111,7 @@ def package_info(self): self.cpp_info.defines = ["AGRPC_UNIFEX"] self.cpp_info.requires.append("libunifex::unifex") - if self.options.use_boost_container: + if self._local_allocator_option == "boost_container": self.cpp_info.requires.append("boost::container") self.cpp_info.set_property("cmake_file_name", "asio-grpc") diff --git a/recipes/asio-grpc/all/test_package/CMakeLists.txt b/recipes/asio-grpc/all/test_package/CMakeLists.txt index 24d2c280e32b6..3566d527f1ca9 100644 --- a/recipes/asio-grpc/all/test_package/CMakeLists.txt +++ b/recipes/asio-grpc/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.14) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(asio-grpc REQUIRED CONFIG) diff --git a/recipes/asio-grpc/all/test_package/conanfile.py b/recipes/asio-grpc/all/test_package/conanfile.py index 38f4483872d47..d120a992c06a6 100644 --- a/recipes/asio-grpc/all/test_package/conanfile.py +++ b/recipes/asio-grpc/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/asio-grpc/all/test_v1_package/CMakeLists.txt b/recipes/asio-grpc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..e68b2def0d618 --- /dev/null +++ b/recipes/asio-grpc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.14) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(asio-grpc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE asio-grpc::asio-grpc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + +# See https://github.com/chriskohlhoff/asio/issues/955 +target_compile_definitions(${PROJECT_NAME} + PRIVATE BOOST_ASIO_DISABLE_STD_ALIGNED_ALLOC) + +if(${asio-grpc_VERSION} VERSION_GREATER_EQUAL 2) + target_compile_definitions(${PROJECT_NAME} PRIVATE ASIO_GRPC_V2) +endif() + +if(CMAKE_CROSSCOMPILING) + # Assuming protoc plugins needed by `asio_grpc_protobuf_generate` are not + # available when cross compiling + target_compile_definitions(${PROJECT_NAME} PRIVATE CROSSCOMPILING) +else() + asio_grpc_protobuf_generate( + GENERATE_GRPC + TARGET + ${PROJECT_NAME} + OUT_DIR + "${CMAKE_CURRENT_BINARY_DIR}/generated" + PROTOS + "${CMAKE_CURRENT_LIST_DIR}/../test_package/test.proto") +endif() diff --git a/recipes/asio-grpc/all/test_v1_package/conanfile.py b/recipes/asio-grpc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2da76eac8dd35 --- /dev/null +++ b/recipes/asio-grpc/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/asio-grpc/config.yml b/recipes/asio-grpc/config.yml index a6ac7221e4d6f..25e51279385fd 100644 --- a/recipes/asio-grpc/config.yml +++ b/recipes/asio-grpc/config.yml @@ -1,4 +1,12 @@ versions: + "2.4.0": + folder: all + "2.3.0": + folder: all + "2.2.0": + folder: all + "2.1.0": + folder: all "2.0.0": folder: all "1.7.0": diff --git a/recipes/asmjit/all/conandata.yml b/recipes/asmjit/all/conandata.yml index df2784f746c7a..a7cfd40faef87 100644 --- a/recipes/asmjit/all/conandata.yml +++ b/recipes/asmjit/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20221111": + url: "https://github.com/asmjit/asmjit/archive/0c03ed2f7497441ac0de232bda2e6b8cc041b2dc.zip" + sha256: "85d8f3edabd708658b63d8a9bc2e7ccb72edd1d14b668fa681b5f7fa529601a4" "cci.20220210": url: "https://github.com/asmjit/asmjit/archive/23ddf56b00f47d8aa0c82ad225e4b3a92661da7e.zip" sha256: "8832003526dbb9329b308246ffe34ebda9dcbe9b5116d7c3fbbe7ab15e5fd7b3" diff --git a/recipes/asmjit/all/conanfile.py b/recipes/asmjit/all/conanfile.py index e87d8cd6a0055..ad8cb46dcf24d 100644 --- a/recipes/asmjit/all/conanfile.py +++ b/recipes/asmjit/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class AsmjitConan(ConanFile): @@ -16,6 +16,7 @@ class AsmjitConan(ConanFile): homepage = "https://asmjit.com" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,18 +33,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -77,4 +77,4 @@ def package_info(self): if not self.options.shared: self.cpp_info.defines = ["ASMJIT_STATIC"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs = ["pthread", "rt"] + self.cpp_info.system_libs = ["pthread", "rt", "m"] diff --git a/recipes/asmjit/all/test_package/conanfile.py b/recipes/asmjit/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/asmjit/all/test_package/conanfile.py +++ b/recipes/asmjit/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/asmjit/all/test_v1_package/CMakeLists.txt b/recipes/asmjit/all/test_v1_package/CMakeLists.txt index dce0881645ff4..9d54a092e0a67 100644 --- a/recipes/asmjit/all/test_v1_package/CMakeLists.txt +++ b/recipes/asmjit/all/test_v1_package/CMakeLists.txt @@ -4,8 +4,5 @@ project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(asmjit REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE asmjit::asmjit) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/asmjit/all/test_v1_package/conanfile.py b/recipes/asmjit/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/asmjit/all/test_v1_package/conanfile.py +++ b/recipes/asmjit/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/asmjit/config.yml b/recipes/asmjit/config.yml index cdb03cca7661a..aaa7d13798678 100644 --- a/recipes/asmjit/config.yml +++ b/recipes/asmjit/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20221111": + folder: all "cci.20220210": folder: all "cci.20210306": diff --git a/recipes/assimp/5.x/conanfile.py b/recipes/assimp/5.x/conanfile.py index b306ed9818cf2..6f021e008adb4 100644 --- a/recipes/assimp/5.x/conanfile.py +++ b/recipes/assimp/5.x/conanfile.py @@ -1,13 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.build import stdcpp_library from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.microsoft import is_msvc from conan.tools.scm import Version -from conans import tools as tools_legacy import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.54.0" class AssimpConan(ConanFile): @@ -20,7 +20,8 @@ class AssimpConan(ConanFile): ) topics = ("assimp", "3d", "game development", "3mf", "collada") license = "BSD-3-Clause" - settings = "os", "compiler", "build_type", "arch" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -104,8 +105,7 @@ class AssimpConan(ConanFile): default_options.update(dict.fromkeys(_format_option_map, True)) def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -117,7 +117,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") @property def _depends_on_kuba_zip(self): @@ -163,26 +166,26 @@ def _depends_on_openddlparser(self): def requirements(self): # TODO: unvendor others libs: # - Open3DGC - self.requires("minizip/1.2.12") - self.requires("utfcpp/3.2.1") + self.requires("minizip/1.2.13") + self.requires("utfcpp/3.2.3") if Version(self.version) < "5.1.0": self.requires("irrxml/1.2") else: - self.requires("pugixml/1.12.1") + self.requires("pugixml/1.13") if self._depends_on_kuba_zip: - self.requires("kuba-zip/0.2.4") + self.requires("kuba-zip/0.2.6") if self._depends_on_poly2tri: self.requires("poly2tri/cci.20130502") if self._depends_on_rapidjson: - self.requires("rapidjson/cci.20211112") + self.requires("rapidjson/cci.20220822") if self._depends_on_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self._depends_on_draco: - self.requires("draco/1.5.3") + self.requires("draco/1.5.5") if self._depends_on_clipper: self.requires("clipper/4.10.0") # Only 4.x supported if self._depends_on_stb: - self.requires("stb/cci.20210910") + self.requires("stb/cci.20220909") if self._depends_on_openddlparser: self.requires("openddl-parser/0.5.0") @@ -190,12 +193,8 @@ def validate(self): if self._depends_on_clipper and Version(self.dependencies["clipper"].ref.version).major != "4": raise ConanInvalidConfiguration("Only 'clipper/4.x' is supported") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -279,31 +278,6 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["rt", "m", "pthread"] if not self.options.shared: - stdcpp_library = tools_legacy.stdcpp_library(self) - if stdcpp_library: - self.cpp_info.system_libs.append(stdcpp_library) - - # FIXME: shouldn't be necessary. - # It's a workaround to support conan v1 generators - self.cpp_info.requires.append("minizip::minizip") - self.cpp_info.requires.append("utfcpp::utfcpp") - if Version(self.version) < "5.1.0": - self.cpp_info.requires.append("irrxml::irrxml") - else: - self.cpp_info.requires.append("pugixml::pugixml") - if self._depends_on_kuba_zip: - self.cpp_info.requires.append("kuba-zip::kuba-zip") - if self._depends_on_poly2tri: - self.cpp_info.requires.append("poly2tri::poly2tri") - if self._depends_on_rapidjson: - self.cpp_info.requires.append("rapidjson::rapidjson") - if self._depends_on_zlib: - self.cpp_info.requires.append("zlib::zlib") - if self._depends_on_draco: - self.cpp_info.requires.append("draco::draco") - if self._depends_on_clipper: - self.cpp_info.requires.append("clipper::clipper") - if self._depends_on_stb: - self.cpp_info.requires.append("stb::stb") - if self._depends_on_openddlparser: - self.cpp_info.requires.append("openddl-parser::openddl-parser") + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/assimp/5.x/patches/0001-unvendor-deps-5.0.x.patch b/recipes/assimp/5.x/patches/0001-unvendor-deps-5.0.x.patch index 6df76c40d3bc9..1445d96a11b7c 100644 --- a/recipes/assimp/5.x/patches/0001-unvendor-deps-5.0.x.patch +++ b/recipes/assimp/5.x/patches/0001-unvendor-deps-5.0.x.patch @@ -110,7 +110,7 @@ - INCLUDE_DIRECTORIES( "../contrib/rapidjson/include" ) - INCLUDE_DIRECTORIES( "../contrib" ) + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ find_package(rapidjson REQUIRED CONFIG) ++ find_package(RapidJSON REQUIRED CONFIG) + endif() ENDIF(HUNTER_ENABLED) @@ -158,7 +158,7 @@ + target_link_libraries(assimp zip::zip) + endif() + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ target_link_libraries(assimp rapidjson::rapidjson) ++ target_link_libraries(assimp rapidjson) + endif() ENDIF(HUNTER_ENABLED) diff --git a/recipes/assimp/5.x/patches/0003-unvendor-deps-5.1.x.patch b/recipes/assimp/5.x/patches/0003-unvendor-deps-5.1.x.patch index e5355147d8c36..fdd67862ddb24 100644 --- a/recipes/assimp/5.x/patches/0003-unvendor-deps-5.1.x.patch +++ b/recipes/assimp/5.x/patches/0003-unvendor-deps-5.1.x.patch @@ -198,7 +198,7 @@ ELSE() - INCLUDE_DIRECTORIES("../contrib/rapidjson/include") + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ find_package(rapidjson REQUIRED CONFIG) ++ find_package(RapidJSON REQUIRED CONFIG) + endif() ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1) option( ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR "Suppress rapidjson warning on MSVC (NOTE: breaks android build)" ON ) @@ -288,7 +288,7 @@ + target_link_libraries(assimp openddlparser::openddlparser) + endif() + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ target_link_libraries(assimp rapidjson::rapidjson) ++ target_link_libraries(assimp rapidjson) + endif() + if(ASSIMP_BUILD_M3D_IMPORTER OR ASSIMP_BUILD_M3D_EXPORTER OR ASSIMP_BUILD_PBRT_EXPORTER) + target_link_libraries(assimp stb::stb) diff --git a/recipes/assimp/5.x/patches/0004-unvendor-deps-5.1.6.patch b/recipes/assimp/5.x/patches/0004-unvendor-deps-5.1.6.patch index 5e1a3a2bcfaf2..67d2f67fd3661 100644 --- a/recipes/assimp/5.x/patches/0004-unvendor-deps-5.1.6.patch +++ b/recipes/assimp/5.x/patches/0004-unvendor-deps-5.1.6.patch @@ -185,7 +185,7 @@ ELSE() - INCLUDE_DIRECTORIES("../contrib/rapidjson/include") + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ find_package(rapidjson REQUIRED CONFIG) ++ find_package(RapidJSON REQUIRED CONFIG) + endif() ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1) option( ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR "Suppress rapidjson warning on MSVC (NOTE: breaks android build)" ON ) @@ -275,7 +275,7 @@ + target_link_libraries(assimp openddlparser::openddlparser) + endif() + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ target_link_libraries(assimp rapidjson::rapidjson) ++ target_link_libraries(assimp rapidjson) + endif() + if(ASSIMP_BUILD_M3D_IMPORTER OR ASSIMP_BUILD_M3D_EXPORTER OR ASSIMP_BUILD_PBRT_EXPORTER) + target_link_libraries(assimp stb::stb) diff --git a/recipes/assimp/5.x/patches/0006-unvendor-deps-5.2.x.patch b/recipes/assimp/5.x/patches/0006-unvendor-deps-5.2.x.patch index 3fc4c7ba34b08..2a1e7bc39e620 100644 --- a/recipes/assimp/5.x/patches/0006-unvendor-deps-5.2.x.patch +++ b/recipes/assimp/5.x/patches/0006-unvendor-deps-5.2.x.patch @@ -185,7 +185,7 @@ ELSE() - INCLUDE_DIRECTORIES("../contrib/rapidjson/include") + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ find_package(rapidjson REQUIRED CONFIG) ++ find_package(RapidJSON REQUIRED CONFIG) + endif() ADD_DEFINITIONS( -DRAPIDJSON_HAS_STDSTRING=1) option( ASSIMP_RAPIDJSON_NO_MEMBER_ITERATOR "Suppress rapidjson warning on MSVC (NOTE: breaks android build)" ON ) @@ -275,7 +275,7 @@ + target_link_libraries(assimp openddlparser::openddlparser) + endif() + if(ASSIMP_BUILD_GLTF_IMPORTER OR ASSIMP_BUILD_GLTF_EXPORTER) -+ target_link_libraries(assimp rapidjson::rapidjson) ++ target_link_libraries(assimp rapidjson) + endif() + if(ASSIMP_BUILD_M3D_IMPORTER OR ASSIMP_BUILD_M3D_EXPORTER OR ASSIMP_BUILD_PBRT_EXPORTER) + target_link_libraries(assimp stb::stb) diff --git a/recipes/assimp/5.x/test_package/conanfile.py b/recipes/assimp/5.x/test_package/conanfile.py index 6122fda64dd3e..93ba652962cbf 100644 --- a/recipes/assimp/5.x/test_package/conanfile.py +++ b/recipes/assimp/5.x/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,20 +7,21 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): obj_path = os.path.join(self.source_folder, "box.obj") bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") diff --git a/recipes/assimp/5.x/test_v1_package/CMakeLists.txt b/recipes/assimp/5.x/test_v1_package/CMakeLists.txt index e4be46f4be748..0d20897301b68 100644 --- a/recipes/assimp/5.x/test_v1_package/CMakeLists.txt +++ b/recipes/assimp/5.x/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES C CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(assimp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE assimp::assimp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) - -add_executable(${PROJECT_NAME}_c ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME}_c PRIVATE assimp::assimp) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/assimp/5.x/test_v1_package/conanfile.py b/recipes/assimp/5.x/test_v1_package/conanfile.py index 920277897fd09..32dae739b46ce 100644 --- a/recipes/assimp/5.x/test_v1_package/conanfile.py +++ b/recipes/assimp/5.x/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os @@ -17,7 +16,7 @@ def test(self): obj_path = os.path.join(self.source_folder, os.pardir, "test_package", "box.obj") bin_path = os.path.join("bin", "test_package") - self.run("{0} {1}".format(bin_path, obj_path), run_environment=True) + self.run(f"{bin_path} {obj_path}", run_environment=True) bin_c_path = os.path.join("bin", "test_package_c") - self.run("{0} {1}".format(bin_c_path, obj_path), run_environment=True) + self.run(f"{bin_c_path} {obj_path}", run_environment=True) diff --git a/recipes/astc-codec/all/CMakeLists.txt b/recipes/astc-codec/all/CMakeLists.txt deleted file mode 100644 index d32836cbae4aa..0000000000000 --- a/recipes/astc-codec/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/astc-codec/all/conandata.yml b/recipes/astc-codec/all/conandata.yml index 5ae510b14b461..455c19647e7bd 100644 --- a/recipes/astc-codec/all/conandata.yml +++ b/recipes/astc-codec/all/conandata.yml @@ -2,3 +2,8 @@ sources: "cci.20190617": url: "https://github.com/google/astc-codec/archive/9757befb64db6662aad45de09ca87cd6f599ac02.tar.gz" sha256: "19034fed68401a612655b026e713c351df8caa768f55ce29a0f628378e988eac" +patches: + "cci.20190617": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "CMake: add install target, export symbols" + patch_type: "conan" diff --git a/recipes/astc-codec/all/conanfile.py b/recipes/astc-codec/all/conanfile.py index de86c00f0acc4..a02aae0b4d930 100644 --- a/recipes/astc-codec/all/conanfile.py +++ b/recipes/astc-codec/all/conanfile.py @@ -1,6 +1,10 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -import glob -from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.54.0" class AstcCodecConan(ConanFile): @@ -9,65 +13,58 @@ class AstcCodecConan(ConanFile): homepage = "https://github.com/google/astc-codec" url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" - topics = ("conan", "astc", "codec") - settings = "os", "compiler", "arch", "build_type" + topics = ("astc", "codec") + settings = "os", "arch", "compiler", "build_type" options = { + "shared": [True, False], "fPIC": [True, False], } default_options = { + "shared": False, "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, "11") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("astc-codec-*")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["OPTION_ASTC_TESTS"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OPTION_ASTC_TESTS"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy("*.lib", src=os.path.join(self._build_subfolder, "lib"), dst="lib", keep_path=False) - self.copy("*.dll", src=os.path.join(self._build_subfolder, "bin"), dst="bin", keep_path=False) - self.copy("*.exe", src=os.path.join(self._build_subfolder, "bin"), dst="bin", keep_path=False) - self.copy("*.so*", src=os.path.join(self._build_subfolder, "lib"), dst="lib", keep_path=False, symlinks=True) - self.copy("*.dylib", src=os.path.join(self._build_subfolder, "lib"), dst="lib", keep_path=False) - self.copy("*.a", src=os.path.join(self._build_subfolder, "lib"), dst="lib", keep_path=False) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["astc-codec"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/astc-codec/all/patches/0001-fix-cmake.patch b/recipes/astc-codec/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..bde6c9106dbe4 --- /dev/null +++ b/recipes/astc-codec/all/patches/0001-fix-cmake.patch @@ -0,0 +1,76 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,7 +11,7 @@ + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations under + # the License. +-cmake_minimum_required(VERSION 3.1.0) ++cmake_minimum_required(VERSION 3.8) + project(astc-codec) + + option(OPTION_ASTC_TESTS "Build all the unit tests." ON) +@@ -20,7 +20,6 @@ option(OPTION_ASTC_TESTS "Build all the unit tests." ON) + # yet bringing in. + option(OPTION_BUILD_FUZZER "Build the fuzzer tests." OFF) + +-set (CMAKE_CXX_STANDARD 11) + if(OPTION_ASTC_TESTS) + enable_testing() + +@@ -44,3 +43,13 @@ endif() + + add_subdirectory(src/base) + add_subdirectory(src/decoder) ++ ++include(GNUInstallDirs) ++install(DIRECTORY include/astc-codec DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ++install( ++ TARGETS astc-codec ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++) ++install(TARGETS astc_inspector_cli DESTINATION ${CMAKE_INSTALL_BINDIR}) +--- a/src/decoder/CMakeLists.txt ++++ b/src/decoder/CMakeLists.txt +@@ -11,10 +11,11 @@ + # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the + # License for the specific language governing permissions and limitations under + # the License. +-add_library(footprint footprint.cc) ++add_library(footprint OBJECT footprint.cc) ++target_compile_features(footprint PUBLIC cxx_std_11) + target_link_libraries(footprint base) + +-add_library(astc_utils ++add_library(astc_utils OBJECT + astc_file.cc + endpoint_codec.cc + integer_sequence_codec.cc +@@ -24,17 +25,24 @@ add_library(astc_utils + physical_astc_block.cc + quantization.cc + weight_infill.cc) ++target_compile_features(astc_utils PUBLIC cxx_std_11) + target_link_libraries(astc_utils PRIVATE base footprint) + target_include_directories(astc_utils PRIVATE ../..) ++if(BUILD_SHARED_LIBS) ++ set_target_properties(footprint PROPERTIES POSITION_INDEPENDENT_CODE ON) ++ set_target_properties(astc_utils PROPERTIES POSITION_INDEPENDENT_CODE ON) ++endif() + + add_library(astc-codec codec.cc) +-target_link_libraries(astc-codec PRIVATE astc_utils) ++target_compile_features(astc-codec PRIVATE cxx_std_11) ++set_target_properties(astc-codec PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) ++target_link_libraries(astc-codec PRIVATE astc_utils footprint) + target_include_directories(astc-codec PUBLIC ../../include) + target_include_directories(astc-codec PRIVATE ../..) + + add_executable(astc_inspector_cli tools/astc_inspector_cli.cc) + target_include_directories(astc_inspector_cli PRIVATE ../..) +-target_link_libraries(astc_inspector_cli PRIVATE astc_utils) ++target_link_libraries(astc_inspector_cli PRIVATE astc_utils footprint) + + # + # Testing diff --git a/recipes/astc-codec/all/test_package/CMakeLists.txt b/recipes/astc-codec/all/test_package/CMakeLists.txt index 1baaed448aea7..fecfc194504f2 100644 --- a/recipes/astc-codec/all/test_package/CMakeLists.txt +++ b/recipes/astc-codec/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(astc-codec REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE astc-codec::astc-codec) +target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/astc-codec/all/test_package/conanfile.py b/recipes/astc-codec/all/test_package/conanfile.py index 0616bc5a57142..9f50bbe4c73b2 100644 --- a/recipes/astc-codec/all/test_package/conanfile.py +++ b/recipes/astc-codec/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") bees = os.path.join(self.source_folder, "atlas_small_4x4.astc") - self.run("{} {} 256 256".format(bin_path, bees), run_environment=True) + self.run(f"{bin_path} {bees} 256 256", env="conanrun") diff --git a/recipes/astc-codec/all/test_v1_package/CMakeLists.txt b/recipes/astc-codec/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/astc-codec/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/astc-codec/all/test_v1_package/conanfile.py b/recipes/astc-codec/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3605ef5403092 --- /dev/null +++ b/recipes/astc-codec/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + bees = os.path.join(self.source_folder, os.pardir, "test_package", "atlas_small_4x4.astc") + self.run(f"{bin_path} {bees} 256 256", run_environment=True) diff --git a/recipes/asyncplusplus/all/conanfile.py b/recipes/asyncplusplus/all/conanfile.py index 3a587ac42b02e..1846058ae1e44 100644 --- a/recipes/asyncplusplus/all/conanfile.py +++ b/recipes/asyncplusplus/all/conanfile.py @@ -5,7 +5,7 @@ import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class AsyncplusplusConan(ConanFile): @@ -16,6 +16,7 @@ class AsyncplusplusConan(ConanFile): homepage = "https://github.com/Amanieu/asyncplusplus" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,18 +33,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -69,17 +69,17 @@ def package(self): def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) + """) save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "Async++") diff --git a/recipes/asyncplusplus/all/test_package/conanfile.py b/recipes/asyncplusplus/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/asyncplusplus/all/test_package/conanfile.py +++ b/recipes/asyncplusplus/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/asyncplusplus/all/test_v1_package/CMakeLists.txt b/recipes/asyncplusplus/all/test_v1_package/CMakeLists.txt index 3fba019a21faa..0d20897301b68 100644 --- a/recipes/asyncplusplus/all/test_v1_package/CMakeLists.txt +++ b/recipes/asyncplusplus/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Async++ REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Async++) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/asyncplusplus/all/test_v1_package/conanfile.py b/recipes/asyncplusplus/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/asyncplusplus/all/test_v1_package/conanfile.py +++ b/recipes/asyncplusplus/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/at-spi2-core/config.yml b/recipes/at-spi2-core/config.yml index e2400052c7bae..21111516a8585 100644 --- a/recipes/at-spi2-core/config.yml +++ b/recipes/at-spi2-core/config.yml @@ -15,3 +15,7 @@ versions: folder: new "2.45.90": folder: new + "2.46.0": + folder: new + "2.47.1": + folder: new diff --git a/recipes/at-spi2-core/new/conandata.yml b/recipes/at-spi2-core/new/conandata.yml index f27c58a670f7b..0404ff9bea312 100644 --- a/recipes/at-spi2-core/new/conandata.yml +++ b/recipes/at-spi2-core/new/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.47.1": + url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.47/at-spi2-core-2.47.1.tar.xz" + sha256: "c6ba7c160434edebf09d2936933569c936f6ec972301766f2bdac5a4d418153c" + "2.46.0": + url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.46/at-spi2-core-2.46.0.tar.xz" + sha256: "aa0c86c79f7a8d67bae49a5b7a5ab08430c608cffe6e33bf47a72f41ab03c3d0" "2.45.90": url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.45/at-spi2-core-2.45.90.tar.xz" sha256: "e9050ad3c24937548396b2377f2fcdb9321ce2daffad35e7554e8f6ad850ab0d" @@ -6,9 +12,11 @@ sources: sha256: "ba95f346e93108fbb3462c62437081d582154db279b4052dedc52a706828b192" url: "https://ftp.gnome.org/pub/gnome/sources/at-spi2-core/2.45/at-spi2-core-2.45.1.tar.xz" patches: + "2.47.1": + - patch_file: "patches/93.patch" + "2.46.0": + - patch_file: "patches/93.patch" "2.45.90": - - base_path: "source_subfolder" - patch_file: "patches/93.patch" + - patch_file: "patches/93.patch" "2.45.1": - - base_path: "source_subfolder" - patch_file: "patches/93.patch" + - patch_file: "patches/93.patch" diff --git a/recipes/at-spi2-core/new/conanfile.py b/recipes/at-spi2-core/new/conanfile.py index 389943e02b001..d40f68c8b3da5 100644 --- a/recipes/at-spi2-core/new/conanfile.py +++ b/recipes/at-spi2-core/new/conanfile.py @@ -1,8 +1,15 @@ -from conans import ConanFile, Meson, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.scm import Version import os +required_conan_version = ">=1.53.0" class AtSpi2CoreConan(ConanFile): name = "at-spi2-core" description = "It provides a Service Provider Interface for the Assistive Technologies available on the GNOME platform and a library against which applications can be linked" @@ -10,7 +17,6 @@ class AtSpi2CoreConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.gnome.org/GNOME/at-spi2-core/" license = "LGPL-2.1-or-later" - generators = "pkg_config" provides = "at-spi2-atk", "atk" @@ -26,37 +32,27 @@ class AtSpi2CoreConan(ConanFile): "with_x11": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - _meson = None - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") if self.options.shared: self.options["glib"].shared = True def build_requirements(self): - self.build_requires("meson/0.62.2") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("meson/1.0.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") def requirements(self): - self.requires("glib/2.73.0") + self.requires("glib/2.75.2") if self.options.with_x11: self.requires("xorg/system") - self.requires("dbus/1.12.20") + self.requires("dbus/1.15.2") def validate(self): if self.options.shared and not self.options["glib"].shared: @@ -66,63 +62,67 @@ def validate(self): if self.settings.os != "Linux": raise ConanInvalidConfiguration("only linux is supported by this recipe") + def layout(self): + basic_layout(self, src_folder="src") + self.cpp.package.resdirs = ["res"] + def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - def _configure_meson(self): - if self._meson: - return self._meson - self._meson = Meson(self) - defs = {} - defs["introspection"] = "no" - defs["docs"] = "false" - defs["x11"] = "yes" if self.options.with_x11 else "no" - args=[] - args.append("--datadir=%s" % os.path.join(self.package_folder, "res")) - args.append("--localedir=%s" % os.path.join(self.package_folder, "res")) - args.append("--wrap-mode=nofallback") - self._meson.configure(defs=defs, build_folder=self._build_subfolder, source_folder=self._source_subfolder, pkg_config_paths=".", args=args) - return self._meson + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + tc = MesonToolchain(self) + if Version(self.version) >= "2.47.1": + tc.project_options["introspection"] = "disabled" + tc.project_options["x11"] = "enabled" if self.options.with_x11 else "disabled" + else: + tc.project_options["introspection"] = "no" + tc.project_options["x11"] = "yes" if self.options.with_x11 else "no" + tc.project_options["docs"] = "false" + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.replace_in_file(os.path.join(self._source_subfolder, "bus", "meson.build"), + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "bus", "meson.build"), "if x11_dep.found()", - "if x11_option == 'yes'") - tools.replace_in_file(os.path.join(self._source_subfolder, 'meson.build'), + "if get_option('x11').enabled()" if Version(self.version) >= "2.47.1" + else "if x11_option == 'yes'") + replace_in_file(self, os.path.join(self.source_folder, 'meson.build'), "subdir('tests')", "#subdir('tests')") - tools.replace_in_file(os.path.join(self._source_subfolder, 'meson.build'), + replace_in_file(self, os.path.join(self.source_folder, 'meson.build'), "libxml_dep = dependency('libxml-2.0', version: libxml_req_version)", "#libxml_dep = dependency('libxml-2.0', version: libxml_req_version)") - meson = self._configure_meson() + meson = Meson(self) + meson.configure() meson.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + meson = Meson(self) meson.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "etc")) def package_info(self): self.cpp_info.components["atspi"].libs = ['atspi'] self.cpp_info.components["atspi"].includedirs = ["include/at-spi-2.0"] self.cpp_info.components["atspi"].requires = ["dbus::dbus", "glib::glib"] - self.cpp_info.components["atspi"].names["pkg_config"] = "atspi-2" - + self.cpp_info.components["atspi"].set_property("pkg_config_name", "atspi-2") + self.cpp_info.components["atk"].libs = ["atk-1.0"] self.cpp_info.components["atk"].includedirs = ['include/atk-1.0'] self.cpp_info.components["atk"].requires = ["glib::glib"] - self.cpp_info.components["atk"].names['pkg_config'] = 'atk' + self.cpp_info.components["atk"].set_property("pkg_config_name", 'atk') self.cpp_info.components["atk-bridge"].libs = ['atk-bridge-2.0'] self.cpp_info.components["atk-bridge"].includedirs = [os.path.join('include', 'at-spi2-atk', '2.0')] self.cpp_info.components["atk-bridge"].requires = ["dbus::dbus", "atk", "glib::glib", "atspi"] - self.cpp_info.components["atk-bridge"].names['pkg_config'] = 'atk-bridge-2.0' + self.cpp_info.components["atk-bridge"].set_property("pkg_config_name", 'atk-bridge-2.0') def package_id(self): self.info.requires["glib"].full_package_mode() diff --git a/recipes/atk/all/conandata.yml b/recipes/atk/all/conandata.yml index be9240fbf54e1..40a2c07c87971 100644 --- a/recipes/atk/all/conandata.yml +++ b/recipes/atk/all/conandata.yml @@ -5,8 +5,6 @@ sources: "2.36.0": url: "https://download.gnome.org/sources/atk/2.36/atk-2.36.0.tar.xz" sha256: "fb76247e369402be23f1f5c65d38a9639c1164d934e40f6a9cf3c9e96b652788" - patches: "2.38.0": - patch_file: "patches/define_dllmain_only_when_shared.patch" - base_path: "source_subfolder" diff --git a/recipes/atk/all/conanfile.py b/recipes/atk/all/conanfile.py index c160c33f34f91..851368f9af235 100644 --- a/recipes/atk/all/conanfile.py +++ b/recipes/atk/all/conanfile.py @@ -1,102 +1,127 @@ -from conans import ConanFile, Meson, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc_static_runtime import os -import glob -required_conan_version = ">=1.29" +required_conan_version = ">=1.53.0" + class AtkConan(ConanFile): name = "atk" description = "set of accessibility interfaces that are implemented by other toolkits and applications" - topics = ("conan", "atk", "accessibility") + topics = ("accessibility",) url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.atk.org" license = "LGPL-2.1-or-later" - generators = "pkg_config" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - } + } default_options = { "shared": False, "fPIC": True, - } - - _source_subfolder = "source_subfolder" - _build_subfolder = "build_subfolder" + } - exports_sources = "patches/**" + def export_sources(self): + export_conandata_patches(self) def config_options(self): - if self.settings.os == 'Windows': + if self.settings.os == "Windows": del self.options.fPIC - def build_requirements(self): - self.build_requires('meson/0.60.2') - self.build_requires('pkgconf/1.7.4') - - def requirements(self): - self.requires('glib/2.73.0') - def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if self.options.shared: self.options["glib"].shared = True + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("glib/2.75.2") + def validate(self): - if self.options.shared and not self.options["glib"].shared: + if self.options.shared and not self.dependencies["glib"].options.shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." ) - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + if str(self.settings.compiler) == "Visual Studio" and not self.options.shared and \ + is_msvc_static_runtime(self) and self.dependencies["glib"].options.shared: + raise ConanInvalidConfiguration("this specific configuration is prevented due to internal c3i limitations") - def _configure_meson(self): - meson = Meson(self) - defs = {} - defs['introspection'] = 'false' - defs['docs'] = 'false' - args=[] - args.append('--wrap-mode=nofallback') - args.append('--localedir=%s' % os.path.join(self.package_folder, 'bin', 'share', 'locale')) - meson.configure(defs=defs, build_folder=self._build_subfolder, source_folder=self._source_subfolder, pkg_config_paths='.', args=args) - return meson + def build_requirements(self): + self.tool_requires("meson/1.0.0") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires("glib/2.75.2") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = MesonToolchain(self) + tc.project_options["introspection"] = False + tc.project_options["docs"] = False + tc.project_options["localedir"] = os.path.join(self.package_folder, "bin", "share", "locale") + tc.generate() + deps = PkgConfigDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('tests')", "#subdir('tests')") def build(self): self._patch_sources() - tools.replace_in_file(os.path.join(self._source_subfolder, 'meson.build'), - "subdir('tests')", - "#subdir('tests')") - meson = self._configure_meson() + meson = Meson(self) + meson.configure() meson.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + meson = Meson(self) meson.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - if self.settings.compiler == "Visual Studio": - for pdb in glob.glob(os.path.join(self.package_folder, "bin", "*.pdb")): - os.unlink(pdb) - if not self.options.shared: - os.rename(os.path.join(self.package_folder, 'lib', 'libatk-1.0.a'), os.path.join(self.package_folder, 'lib', 'atk-1.0.lib')) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - self.cpp_info.includedirs = ['include/atk-1.0'] - - def package_id(self): - self.info.requires["glib"].full_package_mode() + self.cpp_info.set_property("pkg_config_name", "atk") + self.cpp_info.libs = ["atk-1.0"] + self.cpp_info.includedirs = [os.path.join("include", "atk-1.0")] + +def fix_msvc_libname(conanfile, remove_lib_prefix=True): + """remove lib prefix & change extension to .lib in case of cl like compiler""" + if not conanfile.settings.get_safe("compiler.runtime"): + return + from conan.tools.files import rename + import glob + libdirs = getattr(conanfile.cpp.package, "libdirs") + for libdir in libdirs: + for ext in [".dll.a", ".dll.lib", ".a"]: + full_folder = os.path.join(conanfile.package_folder, libdir) + for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")): + libname = os.path.basename(filepath)[0:-len(ext)] + if remove_lib_prefix and libname[0:3] == "lib": + libname = libname[3:] + rename(conanfile, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib")) diff --git a/recipes/atk/all/test_package/CMakeLists.txt b/recipes/atk/all/test_package/CMakeLists.txt index 34af13462f44f..331b8cd557e44 100644 --- a/recipes/atk/all/test_package/CMakeLists.txt +++ b/recipes/atk/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(atk REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE atk::atk) diff --git a/recipes/atk/all/test_package/conanfile.py b/recipes/atk/all/test_package/conanfile.py index bd7165a553cf4..98ab55852ad56 100644 --- a/recipes/atk/all/test_package/conanfile.py +++ b/recipes/atk/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/atk/all/test_v1_package/CMakeLists.txt b/recipes/atk/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/atk/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/atk/all/test_v1_package/conanfile.py b/recipes/atk/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/atk/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/autoconf-archive/all/conandata.yml b/recipes/autoconf-archive/all/conandata.yml index 528425d762278..5443eebf3e116 100644 --- a/recipes/autoconf-archive/all/conandata.yml +++ b/recipes/autoconf-archive/all/conandata.yml @@ -2,3 +2,6 @@ sources: "2021.02.19": url: "https://ftpmirror.gnu.org/autoconf-archive/autoconf-archive-2021.02.19.tar.xz" sha256: "e8a6eb9d28ddcba8ffef3fa211653239e9bf239aba6a01a6b7cfc7ceaec69cbd" + "2022.09.03": + url: "https://ftpmirror.gnu.org/autoconf-archive/autoconf-archive-2022.09.03.tar.xz" + sha256: "e07454f00d8cae7907bed42d0747798927809947684d94c37207a4d63a32f423" diff --git a/recipes/autoconf-archive/all/conanfile.py b/recipes/autoconf-archive/all/conanfile.py index b4dbfc5911f9b..f3f012f86b927 100644 --- a/recipes/autoconf-archive/all/conanfile.py +++ b/recipes/autoconf-archive/all/conanfile.py @@ -1,11 +1,15 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment +from conan import ConanFile +from conan.tools.files import get, copy, mkdir, rename, rmdir, export_conandata_patches +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.56.0" class AutoconfArchiveConan(ConanFile): name = "autoconf-archive" + package_type = "build-scripts" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.gnu.org/software/autoconf-archive/" license = "GPL-2.0-or-later" @@ -13,47 +17,61 @@ class AutoconfArchiveConan(ConanFile): topics = ("conan", "GNU", "autoconf", "autoconf-archive", "macro") settings = "os" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") - self._autotools.configure() - return self._autotools + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - with tools.chdir(os.path.join(self._source_subfolder)): - self._autotools = self._configure_autotools() - self._autotools.make() + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - with tools.chdir(os.path.join(self._source_subfolder)): - self._autotools = self._configure_autotools() - self._autotools.install() + autotools = Autotools(self) + autotools.install() + + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - tools.mkdir(os.path.join(self.package_folder, "res")) - tools.rename(os.path.join(self.package_folder, "share", "aclocal"), + mkdir(self, os.path.join(self.package_folder, "res")) + rename(self, os.path.join(self.package_folder, "share", "aclocal"), os.path.join(self.package_folder, "res", "aclocal")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - aclocal_path = tools.unix_path(os.path.join(self.package_folder, "res", "aclocal")) + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = ["res/aclocal"] + + # Use ACLOCAL_PATH to access the .m4 files provided with autoconf-archive + aclocal_path = os.path.join(self.package_folder, "res", "aclocal") + self.buildenv_info.append_path("ACLOCAL_PATH", aclocal_path) + + # Remove for Conan 2.0 + aclocal_path = "/" + aclocal_path.replace("\\", "/").replace(":", "") # Can't use unix_path with Conan 2.0 + self.output.info(f'Appending ACLOCAL_PATH env: {aclocal_path}') + self.env_info.ACLOCAL_PATH.append(aclocal_path) self.output.info("Appending AUTOMAKE_CONAN_INCLUDES environment var: {}".format(aclocal_path)) self.env_info.AUTOMAKE_CONAN_INCLUDES.append(aclocal_path) diff --git a/recipes/autoconf-archive/all/test_package/conanfile.py b/recipes/autoconf-archive/all/test_package/conanfile.py index 76133cc91c338..737285d3778bc 100644 --- a/recipes/autoconf-archive/all/test_package/conanfile.py +++ b/recipes/autoconf-archive/all/test_package/conanfile.py @@ -1,49 +1,54 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -import contextlib +from conan import ConanFile +from conan.tools.build import cross_building, can_run +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.layout import basic_layout import os import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.56.0" class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" exports_sources = "configure.ac", "Makefile.am", "test_package.c" test_type = "explicit" + generators = "VirtualBuildEnv" # Need VirtualBuildEnv for Conan 1.x env_info support + win_bash = True # This assignment must be *here* to avoid "Cannot wrap command with different envs." in Conan 1.x @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def layout(self): + basic_layout(self) + def build_requirements(self): - self.build_requires(self.tested_reference_str) - self.build_requires("automake/1.16.3") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "cl -nologo", - "CXX": "cl -nologo", - } - with tools.environment_append(env): - yield - else: - yield + self.tool_requires(self.tested_reference_str) + self.tool_requires("autoconf/2.71") # Needed for autoreconf + self.tool_requires("automake/1.16.5") # Needed for aclocal called by autoreconf--does Coanan 2.0 need a transitive_run trait? + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def generate(self): + tc = AutotoolsToolchain(self) + env = tc.environment() + if is_msvc(self): + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + tc.generate(env) def build(self): - for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), self.build_folder) - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True, win_bash=self._settings_build.os == "Windows") - with self._build_context(): - autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") - autotools.libs = [] - autotools.configure() + if not cross_building(self): + for src in self.exports_sources: + shutil.copy(os.path.join(self.source_folder, src), self.build_folder) + self.run("autoreconf -fiv") + autotools = Autotools(self) + autotools.configure(build_script_folder=self.build_folder) autotools.make() def test(self): - if not tools.cross_building(self): - self.run(os.path.join(".", "test_package")) + if can_run(self): + self.run(unix_path(self, os.path.join(".", "test_package"))) diff --git a/recipes/autoconf-archive/all/test_v1_package/Makefile.am b/recipes/autoconf-archive/all/test_v1_package/Makefile.am new file mode 100644 index 0000000000000..b5165c3af4560 --- /dev/null +++ b/recipes/autoconf-archive/all/test_v1_package/Makefile.am @@ -0,0 +1,2 @@ +bin_PROGRAMS = test_package +test_package_sources = test_package.c diff --git a/recipes/autoconf-archive/all/test_v1_package/conanfile.py b/recipes/autoconf-archive/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..99631c75c0149 --- /dev/null +++ b/recipes/autoconf-archive/all/test_v1_package/conanfile.py @@ -0,0 +1,52 @@ +from conans import AutoToolsBuildEnvironment, ConanFile, tools +import contextlib +import os +import shutil + +required_conan_version = ">=1.56.0" + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + exports_sources = "configure.ac", "Makefile.am", "test_package.c" + test_type = "explicit" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + self.build_requires("automake/1.16.5") + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + @contextlib.contextmanager + def _build_context(self): + if self.settings.compiler == "Visual Studio": + with tools.vcvars(self): + env = { + "CC": "cl -nologo", + "CXX": "cl -nologo", + } + with tools.environment_append(env): + yield + else: + yield + + def build(self): + for src in self.exports_sources: + shutil.copy(os.path.join(self.source_folder, src), self.build_folder) + + # Work around the fact that "used_special_vars" in conans/client/tools/win.py doesn't handle ACLOCAL_PATH + aclocal_path = "$ACLOCAL_PATH:" + self.deps_env_info.vars["ACLOCAL_PATH"][0].lower() + self.run("ACLOCAL_PATH={} autoreconf -fiv".format(aclocal_path), win_bash=self._settings_build.os == "Windows") + with self._build_context(): + autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") + autotools.libs = [] + autotools.configure() + autotools.make() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join(".", "test_package")) diff --git a/recipes/autoconf-archive/all/test_v1_package/configure.ac b/recipes/autoconf-archive/all/test_v1_package/configure.ac new file mode 100644 index 0000000000000..e74fbe8a4a2dd --- /dev/null +++ b/recipes/autoconf-archive/all/test_v1_package/configure.ac @@ -0,0 +1,15 @@ +AC_INIT([test_package], [1.0]) +AC_CONFIG_SRCDIR([test_package.c]) +AC_CONFIG_AUX_DIR([autostuff]) +AM_INIT_AUTOMAKE([foreign]) +AC_PROG_CC +m4_pattern_forbid([^AX_], + [Unexpanded AX_ macro found. Please install GNU autoconf-archive.]) +AX_CXX_BOOL() +AX_CXX_HAVE_VECTOR_AT() +AX_CXX_HAVE_BIND() +AX_PRINTF_SIZE_T() +AX_CHECK_AWK_INDEX() +AX_BERKELEY_DB() +AC_CONFIG_FILES([Makefile]) +AC_OUTPUT diff --git a/recipes/autoconf-archive/all/test_v1_package/test_package.c b/recipes/autoconf-archive/all/test_v1_package/test_package.c new file mode 100644 index 0000000000000..88b53a74dc6fb --- /dev/null +++ b/recipes/autoconf-archive/all/test_v1_package/test_package.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("Hello world from test_package.c\n"); + return 0; +} diff --git a/recipes/autoconf-archive/config.yml b/recipes/autoconf-archive/config.yml index be18dee9e6714..d6031b4a79015 100644 --- a/recipes/autoconf-archive/config.yml +++ b/recipes/autoconf-archive/config.yml @@ -1,3 +1,5 @@ versions: "2021.02.19": folder: all + "2022.09.03": + folder: all diff --git a/recipes/autoconf/all/conandata.yml b/recipes/autoconf/all/conandata.yml index 0dfca4d3f4fe2..aefee4cae6132 100644 --- a/recipes/autoconf/all/conandata.yml +++ b/recipes/autoconf/all/conandata.yml @@ -2,29 +2,14 @@ sources: "2.71": sha256: "431075ad0bf529ef13cb41e9042c542381103e80015686222b8a9d4abef42a1c" url: "https://ftp.gnu.org/gnu/autoconf/autoconf-2.71.tar.gz" - "2.69": - sha256: "954bd69b391edc12d6a4a51a2dd1476543da5c6bbf05a95b59dc0dd6fd4c2969" - url: "https://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz" patches: "2.71": - - patch_file: "patches/2.71-0001-autom4te-relocatable.patch" - base_path: "source_subfolder" + - patch_file: "patches/2.71-0001-relocatable-autoconf.patch" + patch_description: "Replace instances where absolute paths are embedded the generated files" + patch_type: "conan" - patch_file: "patches/2.71-0002-no-perl-path-in-shebang.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.71-0003-uppercase-autom4te_perllibdir.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.71-0004-no-embedded-m4-paths.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.71-0005-disable-man-regeneration.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch" - base_path: "source_subfolder" - "2.69": - - patch_file: "patches/2.69-0001-autom4te-relocatable.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.69-0002-no-perl-path-in-shebang.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.69-0003-uppercase-autom4te_perllibdir.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.69-0004-no-embedded-m4-paths.patch" - base_path: "source_subfolder" + patch_description: "Avoid build machine's perl path to be embedded the generated files" + patch_type: "conan" + - patch_file: "patches/2.71-0003-disable-man-regeneration.patch" + patch_description: "Disable man regeneration" + patch_type: "conan" diff --git a/recipes/autoconf/all/conanfile.py b/recipes/autoconf/all/conanfile.py index 279b87e4862d2..09afbd7d337d1 100644 --- a/recipes/autoconf/all/conanfile.py +++ b/recipes/autoconf/all/conanfile.py @@ -1,122 +1,139 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -import contextlib +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rmdir, apply_conandata_patches, replace_in_file, export_conandata_patches +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import unix_path, is_msvc import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class AutoconfConan(ConanFile): name = "autoconf" + package_type = "application" + description = ( + "Autoconf is an extensible package of M4 macros that produce shell " + "scripts to automatically configure software source code packages" + ) + license = ("GPL-2.0-or-later", "GPL-3.0-or-later") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.gnu.org/software/autoconf/" - description = "Autoconf is an extensible package of M4 macros that produce shell scripts to automatically configure software source code packages" topics = ("autoconf", "configure", "build") - license = ("GPL-2.0-or-later", "GPL-3.0-or-later") settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/*" - - _autotools = None - - @property - def _source_subfolder(self): - return os.path.join(self.source_folder, "source_subfolder") - @property def _settings_build(self): + # TODO: Remove for Conan v2 return getattr(self, "settings_build", self.settings) - def requirements(self): - self.requires("m4/1.4.19") + def export_sources(self): + export_conandata_patches(self) - def build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires("m4/1.4.19") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() + + def requirements(self): + self.requires("m4/1.4.19") # Needed at runtime by downstream clients as well + + def build_requirements(self): + self.tool_requires("m4/1.4.19") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @property - def _datarootdir(self): - return os.path.join(self.package_folder, "bin", "share") + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + "--datarootdir=${prefix}/res", + ]) - @property - def _autoconf_datarootdir(self): - return os.path.join(self._datarootdir, "autoconf") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - datarootdir = self._datarootdir - prefix = self.package_folder if self.settings.os == "Windows": - datarootdir = tools.unix_path(datarootdir) - prefix = tools.unix_path(prefix) - conf_args = [ - "--datarootdir={}".format(datarootdir), - "--prefix={}".format(prefix), - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools - - def _patch_files(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - @contextlib.contextmanager - def _build_context(self): - with tools.environment_append(tools.RunEnvironment(self).vars): - yield + if is_msvc(self): + build = "{}-{}-{}".format( + "x86_64" if self._settings_build.arch == "x86_64" else "i686", + "pc" if self._settings_build.arch == "x86" else "win64", + "mingw32") + host = "{}-{}-{}".format( + "x86_64" if self.settings.arch == "x86_64" else "i686", + "pc" if self.settings.arch == "x86" else "win64", + "mingw32") + tc.configure_args.append(f"--build={build}") + tc.configure_args.append(f"--host={host}") + + env = tc.environment() + env.define_path("INSTALL", unix_path(self, os.path.join(self.source_folder, "build-aux", "install-sh"))) + tc.generate(env) + + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "Makefile.in"), + "M4 = /usr/bin/env m4", "#M4 = /usr/bin/env m4") + if self._settings_build.os == "Windows": + # Handle vagaries of Windows line endings + replace_in_file(self, os.path.join(self.source_folder, "bin", "autom4te.in"), + "$result =~ s/^\\n//mg;", "$result =~ s/^\\R//mg;") def build(self): - self._patch_files() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + self._patch_sources() + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING*", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "bin", "share", "info")) - tools.rmdir(os.path.join(self.package_folder, "bin", "share", "man")) + autotools = Autotools(self) + autotools.install() + + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "res", "info")) + rmdir(self, os.path.join(self.package_folder, "res", "man")) def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] + self.cpp_info.resdirs = ["res"] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var with : {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + # TODO: These variables can be removed since the scripts now locate the resources + # relative to themselves. + dataroot_path = os.path.join(self.package_folder, "res", "autoconf") + self.output.info(f"Defining AC_MACRODIR environment variable: {dataroot_path}") + self.buildenv_info.define_path("AC_MACRODIR", dataroot_path) - ac_macrodir = self._autoconf_datarootdir - self.output.info("Setting AC_MACRODIR to {}".format(ac_macrodir)) - self.env_info.AC_MACRODIR = ac_macrodir + self.output.info(f"Defining autom4te_perllibdir environment variable: {dataroot_path}") + self.buildenv_info.define_path("autom4te_perllibdir", dataroot_path) - autoconf = tools.unix_path(os.path.join(self.package_folder, "bin", "autoconf")) - self.output.info("Setting AUTOCONF to {}".format(autoconf)) - self.env_info.AUTOCONF = autoconf + bin_path = os.path.join(self.package_folder, "bin") - autoreconf = tools.unix_path(os.path.join(self.package_folder, "bin", "autoreconf")) - self.output.info("Setting AUTORECONF to {}".format(autoreconf)) - self.env_info.AUTORECONF = autoreconf + autoconf_bin = os.path.join(bin_path, "autoconf") + self.output.info(f"Defining AUTOCONF environment variable: {autoconf_bin}") + self.buildenv_info.define_path("AUTOCONF", autoconf_bin) - autoheader = tools.unix_path(os.path.join(self.package_folder, "bin", "autoheader")) - self.output.info("Setting AUTOHEADER to {}".format(autoheader)) - self.env_info.AUTOHEADER = autoheader + autoreconf_bin = os.path.join(bin_path, "autoreconf") + self.output.info(f"Defining AUTORECONF environment variable: {autoreconf_bin}") + self.buildenv_info.define_path("AUTORECONF", autoreconf_bin) - autom4te = tools.unix_path(os.path.join(self.package_folder, "bin", "autom4te")) - self.output.info("Setting AUTOM4TE to {}".format(autom4te)) - self.env_info.AUTOM4TE = autom4te + autoheader_bin = os.path.join(bin_path, "autoheader") + self.output.info(f"Defining AUTOHEADER environment variable: {autoheader_bin}") + self.buildenv_info.define_path("AUTOHEADER", autoheader_bin) - autom4te_perllibdir = self._autoconf_datarootdir - self.output.info("Setting AUTOM4TE_PERLLIBDIR to {}".format(autom4te_perllibdir)) - self.env_info.AUTOM4TE_PERLLIBDIR = autom4te_perllibdir + autom4te_bin = os.path.join(bin_path, "autom4te") + self.output.info(f"Defining AUTOM4TE environment variable: {autom4te_bin}") + self.buildenv_info.define_path("AUTOM4TE", autom4te_bin) + + # TODO: to remove in conan v2 + self.env_info.PATH.append(bin_path) + self.env_info.AUTOCONF = "autoconf" + self.env_info.AUTORECONF = "autoreconf" + self.env_info.AUTOHEADER = "autoheader" + self.env_info.AUTOM4TE = "autom4te" diff --git a/recipes/autoconf/all/patches/2.69-0001-autom4te-relocatable.patch b/recipes/autoconf/all/patches/2.69-0001-autom4te-relocatable.patch deleted file mode 100644 index 7c7e3724d37e6..0000000000000 --- a/recipes/autoconf/all/patches/2.69-0001-autom4te-relocatable.patch +++ /dev/null @@ -1,54 +0,0 @@ ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -268,6 +268,13 @@ - if /^\s*(\#.*)?$/; - - my @words = shellwords ($_); -+ # not using: s#AUTOCONF_M4DIR#$pkgdatadir#r to support perl <5.14 -+ my @words_clone = @words; -+ @words = (); -+ foreach ( @words_clone ) { -+ push(@words, do { (my $tmp = $_) =~ s#AUTOCONF_M4DIR#$pkgdatadir#; $tmp }); -+ } -+ - my $type = shift @words; - if ($type eq 'begin-language:') - { ---- lib/autom4te.in -+++ lib/autom4te.in -@@ -106,7 +106,7 @@ - # This intermediate language is used by aclocal to build aclocal.m4. - - begin-language: "Autoconf-without-aclocal-m4" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: --cache=autom4te.cache - args: autoconf/autoconf.m4f - args: acsite.m4? -@@ -133,7 +133,7 @@ - ## -------- ## - - begin-language: "Autotest" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: autotest/autotest.m4f - args: package.m4? - args: local.at? -@@ -147,7 +147,7 @@ - ## ---- ## - - begin-language: "M4sh" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: m4sugar/m4sh.m4f - args: --mode 777 - args: --language M4sugar -@@ -159,7 +159,7 @@ - ## ------- ## - - begin-language: "M4sugar" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: m4sugar/m4sugar.m4f - args: --warnings syntax - end-language: "M4sugar" diff --git a/recipes/autoconf/all/patches/2.69-0002-no-perl-path-in-shebang.patch b/recipes/autoconf/all/patches/2.69-0002-no-perl-path-in-shebang.patch deleted file mode 100644 index 1ff7ad736c944..0000000000000 --- a/recipes/autoconf/all/patches/2.69-0002-no-perl-path-in-shebang.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- bin/autoheader.in -+++ bin/autoheader.in -@@ -1,4 +1,4 @@ --#! @PERL@ -+#! /usr/bin/env perl - # -*- Perl -*- - # @configure_input@ - ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - ---- bin/autoreconf.in -+++ bin/autoreconf.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - ---- bin/autoscan.in -+++ bin/autoscan.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - ---- bin/ifnames.in -+++ bin/ifnames.in -@@ -1,4 +1,4 @@ --#! @PERL@ -w --# -*- perl -*- -+#! /usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - diff --git a/recipes/autoconf/all/patches/2.69-0003-uppercase-autom4te_perllibdir.patch b/recipes/autoconf/all/patches/2.69-0003-uppercase-autom4te_perllibdir.patch deleted file mode 100644 index 89895c153b4b9..0000000000000 --- a/recipes/autoconf/all/patches/2.69-0003-uppercase-autom4te_perllibdir.patch +++ /dev/null @@ -1,156 +0,0 @@ ---- bin/autoheader.in -+++ bin/autoheader.in -@@ -28,7 +28,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, "$pkgdatadir"; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -24,7 +24,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoreconf.in -+++ bin/autoreconf.in -@@ -26,7 +26,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoscan.in -+++ bin/autoscan.in -@@ -25,7 +25,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -26,7 +26,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/ifnames.in -+++ bin/ifnames.in -@@ -31,7 +31,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/Makefile.in -+++ bin/Makefile.in -@@ -213,7 +213,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/autoconf/Makefile.in -+++ lib/autoconf/Makefile.in -@@ -229,7 +229,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/autoscan/Makefile.in -+++ lib/autoscan/Makefile.in -@@ -215,7 +215,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/autotest/Makefile.in -+++ lib/autotest/Makefile.in -@@ -222,7 +222,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/freeze.mk -+++ lib/freeze.mk -@@ -31,7 +31,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- lib/m4sugar/Makefile.in -+++ lib/m4sugar/Makefile.in -@@ -227,7 +227,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- tests/Makefile.in 2020-01-29 19:10:51.544709041 +0100 -+++ tests/Makefile.in 2020-01-29 19:10:37.143656386 +0100 -@@ -200,7 +200,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_builddir)/bin/autom4te \ - -B '$(top_builddir)'/lib -B '$(top_srcdir)'/lib # keep ` ' - ---- tests/wrapper.as 2020-01-29 19:10:54.928721413 +0100 -+++ tests/wrapper.as 2020-01-29 19:10:37.143656386 +0100 -@@ -23,8 +23,8 @@ - AUTOHEADER=autoheader - AUTOM4TE=autom4te - AUTOM4TE_CFG='@abs_top_builddir@/lib/autom4te.cfg' --autom4te_perllibdir='@abs_top_srcdir@/lib' --export AUTOCONF AUTOHEADER AUTOM4TE AUTOM4TE_CFG autom4te_perllibdir -+AUTOM4TE_PERLLIBDIR='@abs_top_srcdir@/lib' -+export AUTOCONF AUTOHEADER AUTOM4TE AUTOM4TE_CFG AUTOM4TE_PERLLIBDIR - - case '@wrap_program@' in - ifnames) diff --git a/recipes/autoconf/all/patches/2.69-0004-no-embedded-m4-paths.patch b/recipes/autoconf/all/patches/2.69-0004-no-embedded-m4-paths.patch deleted file mode 100644 index 7b9c4d0bb1d32..0000000000000 --- a/recipes/autoconf/all/patches/2.69-0004-no-embedded-m4-paths.patch +++ /dev/null @@ -1,154 +0,0 @@ ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -87,7 +87,7 @@ - my $freeze = 0; - - # $M4. --my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; - # Some non-GNU m4's don't reject the --help option, so give them /dev/null. - fatal "need GNU m4 1.4 or later: $m4" - if system "$m4 --help &1 | grep reload-state >/dev/null"; ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -53,7 +53,7 @@ - my @include = ('@pkgdatadir@'); - my $force = 0; - # m4. --my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; - - - # $HELP ---- bin/Makefile.in -+++ bin/Makefile.in -@@ -133,7 +133,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- doc/Makefile.in -+++ doc/Makefile.in -@@ -125,7 +125,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/autoconf/Makefile.in -+++ lib/autoconf/Makefile.in -@@ -135,7 +135,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/Autom4te/Makefile.in -+++ lib/Autom4te/Makefile.in -@@ -114,7 +114,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/autoscan/Makefile.in -+++ lib/autoscan/Makefile.in -@@ -131,7 +131,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/autotest/Makefile.in -+++ lib/autotest/Makefile.in -@@ -134,7 +134,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/emacs/Makefile.in -+++ lib/emacs/Makefile.in -@@ -104,7 +104,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/m4sugar/Makefile.in -+++ lib/m4sugar/Makefile.in -@@ -134,7 +134,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- lib/Makefile.in -+++ lib/Makefile.in -@@ -153,7 +153,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- Makefile.in -+++ Makefile.in -@@ -169,7 +169,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- man/Makefile.in -+++ man/Makefile.in -@@ -115,7 +115,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ ---- tests/Makefile.in -+++ tests/Makefile.in -@@ -107,7 +107,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ diff --git a/recipes/autoconf/all/patches/2.71-0001-autom4te-relocatable.patch b/recipes/autoconf/all/patches/2.71-0001-autom4te-relocatable.patch deleted file mode 100644 index 2fc1a3d51a5f7..0000000000000 --- a/recipes/autoconf/all/patches/2.71-0001-autom4te-relocatable.patch +++ /dev/null @@ -1,53 +0,0 @@ ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -271,6 +271,13 @@ - if /^\s*(\#.*)?$/; - - my @words = shellwords ($_); -+ # not using: s#AUTOCONF_M4DIR#$pkgdatadir#r to support perl <5.14 -+ my @words_clone = @words; -+ @words = (); -+ foreach ( @words_clone ) { -+ push(@words, do { (my $tmp = $_) =~ s#AUTOCONF_M4DIR#$pkgdatadir#; $tmp }); -+ } -+ - my $type = shift @words; - if ($type eq 'begin-language:') - { ---- lib/autom4te.in -+++ lib/autom4te.in -@@ -115,7 +115,7 @@ - # This intermediate language is used by aclocal to build aclocal.m4. - - begin-language: "Autoconf-without-aclocal-m4" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: --cache=autom4te.cache - args: autoconf/autoconf.m4f - args: acsite.m4? -@@ -142,7 +142,7 @@ - ## -------- ## - - begin-language: "Autotest" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: autotest/autotest.m4f - args: package.m4? - args: local.at? -@@ -156,7 +156,7 @@ - ## ---- ## - - begin-language: "M4sh" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: m4sugar/m4sh.m4f - args: --mode 777 - args: --language M4sugar -@@ -168,6 +168,6 @@ - ## ------- ## - - begin-language: "M4sugar" --args: --prepend-include '@pkgdatadir@' -+args: --prepend-include 'AUTOCONF_M4DIR' - args: m4sugar/m4sugar.m4f - end-language: "M4sugar" diff --git a/recipes/autoconf/all/patches/2.71-0001-relocatable-autoconf.patch b/recipes/autoconf/all/patches/2.71-0001-relocatable-autoconf.patch new file mode 100644 index 0000000000000..ab33a00f77cb7 --- /dev/null +++ b/recipes/autoconf/all/patches/2.71-0001-relocatable-autoconf.patch @@ -0,0 +1,275 @@ +diff --git a/Makefile.in b/Makefile.in +index 22a17b3..ac18c85 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -427,7 +427,7 @@ INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ + LIBOBJS = @LIBOBJS@ + LIBS = @LIBS@ + LTLIBOBJS = @LTLIBOBJS@ +-M4 = @M4@ ++M4 = /usr/bin/env m4 + M4_DEBUGFILE = @M4_DEBUGFILE@ + M4_GNU = @M4_GNU@ + MAKEINFO = @MAKEINFO@ +diff --git a/bin/autoconf.as b/bin/autoconf.as +index 1407739..50ad1de 100644 +--- a/bin/autoconf.as ++++ b/bin/autoconf.as +@@ -89,8 +89,17 @@ exit_missing_arg=' + # restore font-lock: ' + + # Variables. +-: ${AUTOM4TE='@bindir@/@autom4te-name@'} +-: ${trailer_m4='@pkgdatadir@/autoconf/trailer.m4'} ++# Locate autom4ate and support files relative to current script inside package ++SCRIPT_DIR=$(dirname "$as_myself") ++RES_DIR="$SCRIPT_DIR/../res/autoconf" ++if [[ ! -d "$RES_DIR" ]] ++then ++ echo "Autoconf conan package error, unable to locate resource directory at $RES_DIR\n" ++ exit 1 ++fi ++ ++: ${AUTOM4TE="$SCRIPT_DIR/autom4te"} ++: ${trailer_m4="$RES_DIR/autoconf/trailer.m4"} + autom4te_options= + outfile= + verbose=false +diff --git a/bin/autoheader.in b/bin/autoheader.in +index 1cbf509..9bdd1cf 100644 +--- a/bin/autoheader.in ++++ b/bin/autoheader.in +@@ -29,10 +29,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, "$pkgdatadir"; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +@@ -54,7 +57,8 @@ use Autom4te::XFile; + our ($config_h, %symbol, %verbatim); + + # Lib files. +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $autom4te = $ENV{'AUTOM4TE'} || "$scriptpath/@autom4te-name@"; + my $config_h_in; + my @prepend_include; + my @include; +diff --git a/bin/autom4te.in b/bin/autom4te.in +index 7ebe419..42f09b4 100644 +--- a/bin/autom4te.in ++++ b/bin/autom4te.in +@@ -25,10 +25,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +@@ -48,7 +51,8 @@ use Autom4te::General; + use Autom4te::XFile; + + # Data directory. +-my $pkgdatadir = $ENV{'AC_MACRODIR'} || '@pkgdatadir@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $pkgdatadir = $ENV{'AC_MACRODIR'} || "$scriptpath/../res/autoconf"; + + # $LANGUAGE{LANGUAGE} -- Automatic options for LANGUAGE. + my %language; +@@ -91,7 +95,7 @@ my @include; + my $freeze = 0; + + # $M4. +-my $m4 = $ENV{"M4"} || '@M4@'; ++my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; + # Some non-GNU m4's don't reject the --help option, so give them /dev/null. + fatal "need GNU m4 1.4 or later: $m4" + if system "$m4 --help &1 | grep reload-state >/dev/null"; +@@ -271,6 +275,12 @@ sub load_configuration ($) + if /^\s*(\#.*)?$/; + + my @words = shellwords ($_); ++ # not using: s#AUTOCONF_M4DIR#$pkgdatadir#r to support perl <5.14 ++ my @words_clone = @words; ++ @words = (); ++ foreach ( @words_clone ) { ++ push(@words, do { (my $tmp = $_) =~ s#AUTOCONF_M4DIR#$pkgdatadir#; $tmp }); ++ } + my $type = shift @words; + if ($type eq 'begin-language:') + { +diff --git a/bin/autoreconf.in b/bin/autoreconf.in +index ec391a6..2992b16 100644 +--- a/bin/autoreconf.in ++++ b/bin/autoreconf.in +@@ -28,11 +28,14 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + my $buildauxdir; + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + $buildauxdir = $ENV{'autom4te_buildauxdir'} || $pkgdatadir . '/build-aux'; +@@ -117,9 +120,10 @@ Written by David J. MacKenzie and Akim Demaille. + "; + + # Lib files. +-my $autoconf = $ENV{'AUTOCONF'} || '@bindir@/@autoconf-name@'; +-my $autoheader = $ENV{'AUTOHEADER'} || '@bindir@/@autoheader-name@'; +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $autoconf = $ENV{'AUTOCONF'} || "$scriptpath/@autoconf-name@"; ++my $autoheader = $ENV{'AUTOHEADER'} || "$scriptpath/@autoheader-name@"; ++my $autom4te = $ENV{'AUTOM4TE'} || "$scriptpath/@autom4te-name@"; + my $automake = $ENV{'AUTOMAKE'} || 'automake'; + my $aclocal = $ENV{'ACLOCAL'} || 'aclocal'; + my $libtoolize = $ENV{'LIBTOOLIZE'} || 'libtoolize'; +diff --git a/bin/autoscan.in b/bin/autoscan.in +index b89fd1a..6113d62 100644 +--- a/bin/autoscan.in ++++ b/bin/autoscan.in +@@ -27,10 +27,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +@@ -95,7 +98,8 @@ my %needed_macros = + my $log; + + # Autoconf and lib files. +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $autom4te = $ENV{'AUTOM4TE'} || "$scriptpath/@autom4te-name@"; + my $autoconf = "$autom4te --language=autoconf"; + my @prepend_include; + my @include = ('@pkgdatadir@'); +diff --git a/bin/autoupdate.in b/bin/autoupdate.in +index c86203a..844dd20 100644 +--- a/bin/autoupdate.in ++++ b/bin/autoupdate.in +@@ -28,10 +28,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +@@ -51,14 +54,15 @@ use Autom4te::General; + use Autom4te::XFile; + + # Lib files. +-my $autom4te = $ENV{'AUTOM4TE'} || '@bindir@/@autom4te-name@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++my $autom4te = $ENV{'AUTOM4TE'} || "$scriptpath/@autom4te-name@"; + my $autoconf = "$autom4te --language=autoconf"; + # We need to find m4sugar. + my @prepend_include; + my @include = ('@pkgdatadir@'); + my $force = 0; + # m4. +-my $m4 = $ENV{"M4"} || '@M4@'; ++my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; + + + # $HELP +diff --git a/bin/ifnames.in b/bin/ifnames.in +index b04947f..75d014e 100644 +--- a/bin/ifnames.in ++++ b/bin/ifnames.in +@@ -32,10 +32,13 @@ eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ my $pkgdatadir = $ENV{'autom4te_perllibdir'} || "$scriptpath/../res/autoconf"; + unshift @INC, $pkgdatadir; + + # Override SHELL. On DJGPP SHELL may not be set to a shell +diff --git a/lib/autom4te.in b/lib/autom4te.in +index 9e86c9f..bf3ae42 100644 +--- a/lib/autom4te.in ++++ b/lib/autom4te.in +@@ -115,7 +115,7 @@ end-language: "Autoreconf-preselections" + # This intermediate language is used by aclocal to build aclocal.m4. + + begin-language: "Autoconf-without-aclocal-m4" +-args: --prepend-include '@pkgdatadir@' ++args: --prepend-include 'AUTOCONF_M4DIR' + args: --cache=autom4te.cache + args: autoconf/autoconf.m4f + args: acsite.m4? +@@ -142,7 +142,7 @@ end-language: "Autoconf" + ## -------- ## + + begin-language: "Autotest" +-args: --prepend-include '@pkgdatadir@' ++args: --prepend-include 'AUTOCONF_M4DIR' + args: autotest/autotest.m4f + args: package.m4? + args: local.at? +@@ -156,7 +156,7 @@ end-language: "Autotest" + ## ---- ## + + begin-language: "M4sh" +-args: --prepend-include '@pkgdatadir@' ++args: --prepend-include 'AUTOCONF_M4DIR' + args: m4sugar/m4sh.m4f + args: --mode 777 + args: --language M4sugar +@@ -168,6 +168,6 @@ end-language: "M4sh" + ## ------- ## + + begin-language: "M4sugar" +-args: --prepend-include '@pkgdatadir@' ++args: --prepend-include 'AUTOCONF_M4DIR' + args: m4sugar/m4sugar.m4f + end-language: "M4sugar" diff --git a/recipes/autoconf/all/patches/2.71-0005-disable-man-regeneration.patch b/recipes/autoconf/all/patches/2.71-0003-disable-man-regeneration.patch similarity index 100% rename from recipes/autoconf/all/patches/2.71-0005-disable-man-regeneration.patch rename to recipes/autoconf/all/patches/2.71-0003-disable-man-regeneration.patch diff --git a/recipes/autoconf/all/patches/2.71-0003-uppercase-autom4te_perllibdir.patch b/recipes/autoconf/all/patches/2.71-0003-uppercase-autom4te_perllibdir.patch deleted file mode 100644 index f877e630d58f5..0000000000000 --- a/recipes/autoconf/all/patches/2.71-0003-uppercase-autom4te_perllibdir.patch +++ /dev/null @@ -1,77 +0,0 @@ ---- bin/autoheader.in -+++ bin/autoheader.in -@@ -32,7 +32,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, "$pkgdatadir"; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -28,7 +28,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoreconf.in -+++ bin/autoreconf.in -@@ -32,7 +32,7 @@ - my $buildauxdir; - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - $buildauxdir = $ENV{'autom4te_buildauxdir'} || $pkgdatadir . '/build-aux'; ---- bin/autoscan.in -+++ bin/autoscan.in -@@ -30,7 +30,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -31,7 +31,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- bin/ifnames.in -+++ bin/ifnames.in -@@ -35,7 +35,7 @@ - - BEGIN - { -- my $pkgdatadir = $ENV{'autom4te_perllibdir'} || '@pkgdatadir@'; -+ my $pkgdatadir = $ENV{'AUTOM4TE_PERLLIBDIR'} || '@pkgdatadir@'; - unshift @INC, $pkgdatadir; - - # Override SHELL. On DJGPP SHELL may not be set to a shell ---- Makefile.in -+++ Makefile.in -@@ -576,7 +567,7 @@ - # others) to `false'. Autoconf provides autom4te, so that doesn't - # apply to us. - MY_AUTOM4TE = \ -- autom4te_perllibdir='$(top_srcdir)'/lib \ -+ AUTOM4TE_PERLLIBDIR='$(top_srcdir)'/lib \ - AUTOM4TE_CFG='$(AUTOM4TE_CFG)' $(top_build_prefix)bin/autom4te \ - -B '$(top_build_prefix)'lib -B '$(top_srcdir)'/lib # keep ` ' - diff --git a/recipes/autoconf/all/patches/2.71-0004-no-embedded-m4-paths.patch b/recipes/autoconf/all/patches/2.71-0004-no-embedded-m4-paths.patch deleted file mode 100644 index d47835a0e0137..0000000000000 --- a/recipes/autoconf/all/patches/2.71-0004-no-embedded-m4-paths.patch +++ /dev/null @@ -1,33 +0,0 @@ ---- bin/autom4te.in -+++ bin/autom4te.in -@@ -91,7 +91,7 @@ - my $freeze = 0; - - # $M4. --my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; - # Some non-GNU m4's don't reject the --help option, so give them /dev/null. - fatal "need GNU m4 1.4 or later: $m4" - if system "$m4 --help &1 | grep reload-state >/dev/null"; ---- bin/autoupdate.in -+++ bin/autoupdate.in -@@ -58,7 +58,7 @@ - my @include = ('@pkgdatadir@'); - my $force = 0; - # m4. --my $m4 = $ENV{"M4"} || '@M4@'; -+my $m4 = $ENV{"M4"} || '/usr/bin/env m4'; - - - # $HELP ---- Makefile.in -+++ Makefile.in -@@ -427,7 +427,7 @@ - LIBOBJS = @LIBOBJS@ - LIBS = @LIBS@ - LTLIBOBJS = @LTLIBOBJS@ --M4 = @M4@ -+M4 = /usr/bin/env m4 - M4_DEBUGFILE = @M4_DEBUGFILE@ - M4_GNU = @M4_GNU@ - MAKEINFO = @MAKEINFO@ diff --git a/recipes/autoconf/all/patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch b/recipes/autoconf/all/patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch deleted file mode 100644 index a346636c61139..0000000000000 --- a/recipes/autoconf/all/patches/2.71-0006-autoconf-no-embedded-trailer_m4-path.patch +++ /dev/null @@ -1,17 +0,0 @@ -The trailer_m4 environment variable contains build-environment dependent information. -So this variable needs to be overridden by the conanfile. -But Windows has case insensitive environment variables. -Python silently converts lowercase environment variables to uppercase. -Work around this problem by getting the system information from an uppercase environment variable. - ---- bin/autoconf.as -+++ bin/autoconf.as -@@ -90,7 +90,7 @@ - - # Variables. - : ${AUTOM4TE='@bindir@/@autom4te-name@'} --: ${trailer_m4='@pkgdatadir@/autoconf/trailer.m4'} -+: ${trailer_m4="$AC_MACRODIR/autoconf/trailer.m4"} - autom4te_options= - outfile= - verbose=false diff --git a/recipes/autoconf/all/test_package/conanfile.py b/recipes/autoconf/all/test_package/conanfile.py index bde84bf328288..bb22349ed9696 100644 --- a/recipes/autoconf/all/test_package/conanfile.py +++ b/recipes/autoconf/all/test_package/conanfile.py @@ -1,47 +1,51 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import copy +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc -import contextlib import os -import shutil - -required_conan_version = ">=1.45.0" class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - exports_sources = "configure.ac", "config.h.in", "Makefile.in", "test_package_c.c", "test_package_cpp.cpp", + settings = "os", "arch", "compiler", "build_type" test_type = "explicit" + win_bash = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - def build_requirements(self): - self.build_requires(self.tested_reference_str) - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + def layout(self): + basic_layout(self) - @contextlib.contextmanager - def _build_context(self): + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() if is_msvc(self): - with tools.vcvars(self): - with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo",}): - yield - else: - yield + env = Environment() + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + env.vars(self).save_script("conanbuild_msvc") def build(self): - for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), self.build_folder) - self.run("{} --verbose".format(os.environ["AUTOCONF"]), - win_bash=tools.os_info.is_windows, run_environment=True) - self.run("{} --help".format(os.path.join(self.build_folder, "configure").replace("\\", "/")), - win_bash=tools.os_info.is_windows, run_environment=True) - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with self._build_context(): - autotools.configure() - autotools.make() + for src in ("configure.ac", "config.h.in", "Makefile.in", "test_package_c.c", "test_package_cpp.cpp"): + copy(self, src, self.source_folder, self.build_folder) + self.run("autoconf --verbose") + autotools = Autotools(self) + autotools.configure(build_script_folder=self.build_folder) + autotools.make() def test(self): - if not tools.cross_building(self): - self.run(os.path.join(".", "test_package"), run_environment=True) + self.win_bash = None + if can_run(self): + bin_path = os.path.join(self.build_folder, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/autoconf/all/test_v1_package/conanfile.py b/recipes/autoconf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..422d5f44c10cf --- /dev/null +++ b/recipes/autoconf/all/test_v1_package/conanfile.py @@ -0,0 +1,43 @@ +from conans import AutoToolsBuildEnvironment, ConanFile, tools +from conan.tools.files import copy +from conan.tools.microsoft import is_msvc +import contextlib +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + @contextlib.contextmanager + def _build_context(self): + if is_msvc(self): + with tools.vcvars(self): + with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo",}): + yield + else: + yield + + def build(self): + for src in ("configure.ac", "config.h.in", "Makefile.in", "test_package_c.c", "test_package_cpp.cpp"): + copy(self, src, os.path.join(self.source_folder, os.pardir, "test_package"), self.build_folder) + self.run("autoconf --verbose", win_bash=tools.os_info.is_windows) + self.run("{} --help".format(os.path.join(self.build_folder, "configure").replace("\\", "/")), + win_bash=tools.os_info.is_windows) + autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + with self._build_context(): + autotools.configure() + autotools.make() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join(".", "test_package"), run_environment=True) diff --git a/recipes/autoconf/config.yml b/recipes/autoconf/config.yml index 7eafcfb17c54f..f45dc3e529288 100644 --- a/recipes/autoconf/config.yml +++ b/recipes/autoconf/config.yml @@ -1,5 +1,3 @@ versions: "2.71": folder: all - "2.69": - folder: all diff --git a/recipes/automake/all/conandata.yml b/recipes/automake/all/conandata.yml index 24df7aa715c72..19afbb0666855 100644 --- a/recipes/automake/all/conandata.yml +++ b/recipes/automake/all/conandata.yml @@ -11,52 +11,44 @@ sources: "1.16.2": url: "https://ftp.gnu.org/gnu/automake/automake-1.16.2.tar.gz" sha256: "b2f361094b410b4acbf4efba7337bdb786335ca09eb2518635a09fb7319ca5c1" - "1.16.1": - url: "https://ftp.gnu.org/gnu/automake/automake-1.16.1.tar.gz" - sha256: "608a97523f97db32f1f5d5615c98ca69326ced2054c9f82e65bade7fc4c9dea8" patches: "1.16.5": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.4.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.4.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.3.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.5.patch" + patch_description: "help2man no discard stderr" + patch_type: "portability" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.5.patch" + patch_description: "no perl path in shebang" + patch_type: "portability" + - patch_file: "patches/0003-relocatable-automake-1.16.5.patch" + patch_description: "relocatable automake" + patch_type: "portability" "1.16.4": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.4.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.4.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.3.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.4.patch" + patch_description: "help2man no discard stderr" + patch_type: "portability" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.4.patch" + patch_description: "no perl path in shebang" + patch_type: "portability" + - patch_file: "patches/0003-relocatable-automake-1.16.4.patch" + patch_description: "relocatable automake" + patch_type: "portability" "1.16.3": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.3.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.3.patch" + patch_description: "help2man no discard stderr" + patch_type: "portability" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.3.patch" + patch_description: "no perl path in shebang" + patch_type: "portability" + - patch_file: "patches/0003-relocatable-automake-1.16.3.patch" + patch_description: "relocatable automake" + patch_type: "portability" "1.16.2": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.2.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.2.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.2.patch" - "1.16.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-help2man-no-discard-stderr-0.16.1.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-no-perl-path-in-shebang-0.16.1.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-introduce-automake_perllibdir-0.16.1.patch" + - patch_file: "patches/0001-help2man-no-discard-stderr-1.16.2.patch" + patch_description: "help2man no discard stderr" + patch_type: "portability" + - patch_file: "patches/0002-no-perl-path-in-shebang-1.16.2.patch" + patch_description: "no perl path in shebang" + patch_type: "portability" + - patch_file: "patches/0003-relocatable-automake-1.16.2.patch" + patch_description: "relocatable automake" + patch_type: "portability" diff --git a/recipes/automake/all/conanfile.py b/recipes/automake/all/conanfile.py index 472f84cf07d88..c5504ce85bf9a 100644 --- a/recipes/automake/all/conanfile.py +++ b/recipes/automake/all/conanfile.py @@ -1,101 +1,103 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class AutomakeConan(ConanFile): name = "automake" + package_type = "application" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.gnu.org/software/automake/" description = "Automake is a tool for automatically generating Makefile.in files compliant with the GNU Coding Standards." - topics = ("conan", "automake", "configure", "build") + topics = ("autotools", "configure", "build") license = ("GPL-2.0-or-later", "GPL-3.0-or-later") settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/*" - - _autotools = None - - @property - def _source_subfolder(self): - return os.path.join(self.source_folder, "source_subfolder") - - @property - def _version_major_minor(self): - [major, minor, _] = self.version.split(".", 2) - return '{}.{}'.format(major, minor) - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("autoconf/2.71") # automake requires perl-Thread-Queue package - def build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires("autoconf/2.71") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - def package_id(self): del self.info.settings.arch del self.info.settings.compiler del self.info.settings.build_type + def build_requirements(self): + if hasattr(self, "settings_build"): + self.tool_requires("autoconf/2.71") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @property - def _datarootdir(self): - return os.path.join(self.package_folder, "res") + def generate(self): + env = VirtualBuildEnv(self) + env.generate() - @property - def _automake_libdir(self): - return os.path.join(self._datarootdir, "automake-{}".format(self._version_major_minor)) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - conf_args = [ - "--datarootdir={}".format(tools.unix_path(self._datarootdir)), - "--prefix={}".format(tools.unix_path(self.package_folder)), - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools - - def _patch_files(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + "--datarootdir=${prefix}/res", + ]) + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) if self.settings.os == "Windows": # tracing using m4 on Windows returns Windows paths => use cygpath to convert to unix paths - tools.replace_in_file(os.path.join(self._source_subfolder, "bin", "aclocal.in"), - " $map_traced_defs{$arg1} = $file;", - " $file = `cygpath -u $file`;\n" - " $file =~ s/^\\s+|\\s+$//g;\n" - " $map_traced_defs{$arg1} = $file;") + ac_local_in = os.path.join(self.source_folder, "bin", "aclocal.in") + replace_in_file(self, ac_local_in, + " $map_traced_defs{$arg1} = $file;", + " $file = `cygpath -u $file`;\n" + " $file =~ s/^\\s+|\\s+$//g;\n" + " $map_traced_defs{$arg1} = $file;") + # handle relative paths during aclocal.m4 creation + replace_in_file(self, ac_local_in, "$map{$m} eq $map_traced_defs{$m}", + "abs_path($map{$m}) eq abs_path($map_traced_defs{$m})") def build(self): - self._patch_files() - autotools = self._configure_autotools() + self._patch_sources() + autotools = Autotools(self) + autotools.configure() autotools.make() + @property + def _datarootdir(self): + return os.path.join(self.package_folder, "res") + def package(self): - self.copy("COPYING*", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self._datarootdir, "info")) - tools.rmdir(os.path.join(self._datarootdir, "man")) - tools.rmdir(os.path.join(self._datarootdir, "doc")) + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder,"licenses")) + + rmdir(self, os.path.join(self._datarootdir, "info")) + rmdir(self, os.path.join(self._datarootdir, "man")) + rmdir(self, os.path.join(self._datarootdir, "doc")) + # TODO: consider whether the following is still necessary on Windows if self.settings.os == "Windows": binpath = os.path.join(self.package_folder, "bin") for filename in os.listdir(binpath): @@ -104,37 +106,23 @@ def package(self): continue os.rename(fullpath, fullpath + ".exe") + @property + def _automake_libdir(self): + ver = Version(self.version) + return os.path.join(self._datarootdir, f"automake-{ver.major}.{ver.minor}") + def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] - - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable:: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - - bin_ext = ".exe" if self.settings.os == "Windows" else "" - - aclocal = tools.unix_path(os.path.join(self.package_folder, "bin", "aclocal" + bin_ext)) - self.output.info("Appending ACLOCAL environment variable with: {}".format(aclocal)) - self.env_info.ACLOCAL.append(aclocal) - - automake_datadir = tools.unix_path(self._datarootdir) - self.output.info("Setting AUTOMAKE_DATADIR to {}".format(automake_datadir)) - self.env_info.AUTOMAKE_DATADIR = automake_datadir - - automake_libdir = tools.unix_path(self._automake_libdir) - self.output.info("Setting AUTOMAKE_LIBDIR to {}".format(automake_libdir)) - self.env_info.AUTOMAKE_LIBDIR = automake_libdir - - automake_perllibdir = tools.unix_path(self._automake_libdir) - self.output.info("Setting AUTOMAKE_PERLLIBDIR to {}".format(automake_perllibdir)) - self.env_info.AUTOMAKE_PERLLIBDIR = automake_perllibdir - - automake = tools.unix_path(os.path.join(self.package_folder, "bin", "automake" + bin_ext)) - self.output.info("Setting AUTOMAKE to {}".format(automake)) - self.env_info.AUTOMAKE = automake - - self.output.info("Append M4 include directories to AUTOMAKE_CONAN_INCLUDES environment variable") - - self.user_info.compile = os.path.join(self._automake_libdir, "compile") - self.user_info.ar_lib = os.path.join(self._automake_libdir, "ar-lib") + self.cpp_info.resdirs = ["res"] + + # For consumers with new integrations (Conan 1 and 2 compatible): + compile_wrapper = os.path.join(self._automake_libdir, "compile") + lib_wrapper = os.path.join(self._automake_libdir, "ar-lib") + self.conf_info.define("user.automake:compile-wrapper", compile_wrapper) + self.conf_info.define("user.automake:lib-wrapper", lib_wrapper) + + # For legacy Conan 1.x consumers only: + self.user_info.compile = compile_wrapper + self.user_info.ar_lib = lib_wrapper + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.1.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.1.patch deleted file mode 100644 index 56c09e6ef5610..0000000000000 --- a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.1.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -706,7 +706,7 @@ - update_mans = \ - $(AM_V_GEN): \ - && $(MKDIR_P) doc \ -- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ -+ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ - - amhello_sources = \ - doc/amhello/configure.ac \ diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.2.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.2.patch deleted file mode 100644 index 9c66ba2afeeb7..0000000000000 --- a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.2.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -699,7 +699,7 @@ - update_mans = \ - $(AM_V_GEN): \ - && $(MKDIR_P) doc \ -- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ -+ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ - - amhello_sources = \ - doc/amhello/configure.ac \ diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.3.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.3.patch deleted file mode 100644 index b608f94a12008..0000000000000 --- a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.3.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -711,4 +711,4 @@ - update_mans = \ - $(AM_V_GEN): \ - && $(MKDIR_P) doc \ -- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ -+ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ - diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.4.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.4.patch deleted file mode 100644 index 0ae00eb737eac..0000000000000 --- a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-0.16.4.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -703,4 +703,4 @@ - update_mans = \ - $(AM_V_GEN): \ - && $(MKDIR_P) doc \ -- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ -+ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ - diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.2.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.2.patch new file mode 100644 index 0000000000000..8caedb331444e --- /dev/null +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.2.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index 670f97a..feb1085 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -699,7 +699,7 @@ man1_MANS = \ + update_mans = \ + $(AM_V_GEN): \ + && $(MKDIR_P) doc \ +- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ ++ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ + + amhello_sources = \ + doc/amhello/configure.ac \ diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.3.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.3.patch new file mode 100644 index 0000000000000..e6fc1e37c7a20 --- /dev/null +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.3.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index 3190a66..c599705 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -711,7 +711,7 @@ man1_MANS = \ + update_mans = \ + $(AM_V_GEN): \ + && $(MKDIR_P) doc \ +- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ ++ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ + + checklinkx = $(top_srcdir)/contrib/checklinkx + # that 4-second sleep seems to be what gnu.org likes. diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.4.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.4.patch new file mode 100644 index 0000000000000..aec1e1e992850 --- /dev/null +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.4.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index bbe2d04..3a0f57e 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -703,7 +703,7 @@ man1_MANS = \ + update_mans = \ + $(AM_V_GEN): \ + && $(MKDIR_P) doc \ +- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ ++ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ + + checklinkx = $(top_srcdir)/contrib/checklinkx + # that 4-second sleep seems to be what gnu.org likes. diff --git a/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.5.patch b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.5.patch new file mode 100644 index 0000000000000..c593ef11dafd1 --- /dev/null +++ b/recipes/automake/all/patches/0001-help2man-no-discard-stderr-1.16.5.patch @@ -0,0 +1,13 @@ +diff --git a/Makefile.in b/Makefile.in +index 18850e7..ae75282 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -703,7 +703,7 @@ man1_MANS = \ + update_mans = \ + $(AM_V_GEN): \ + && $(MKDIR_P) doc \ +- && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --output=$@ ++ && ./pre-inst-env $(PERL) $(srcdir)/doc/help2man --no-discard-stderr --output=$@ + + checklinkx = $(top_srcdir)/contrib/checklinkx + # that 4-second sleep seems to be what gnu.org likes. diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.1.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.1.patch deleted file mode 100644 index 3b71368f12261..0000000000000 --- a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.1.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -1,8 +1,8 @@ --#!@PERL@ -w --# -*- perl -*- -+#!/usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - --eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' -+eval 'case $# in 0) exec /usr/bin/env perl -S "$0";; *) exec /usr/bin/env perl -S "$0" "$@";; esac' - if 0; - - # aclocal - create aclocal.m4 by scanning configure.ac ---- bin/automake.in -+++ bin/automake.in -@@ -1,8 +1,8 @@ --#!@PERL@ -w --# -*- perl -*- -+#!/usr/bin/env perl -+# -*- perl -*- -w - # @configure_input@ - --eval 'case $# in 0) exec @PERL@ -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' -+eval 'case $# in 0) exec /usr/bin/env perl -S "$0";; *) exec @PERL@ -S "$0" "$@";; esac' - if 0; - - # automake - create Makefile.in from Makefile.am ---- Makefile.in -+++ Makefile.in -@@ -532,7 +532,7 @@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ --PERL = @PERL@ -+PERL = /usr/bin/env perl - RELEASE_YEAR = @RELEASE_YEAR@ - SET_MAKE = @SET_MAKE@ - SHELL = @SHELL@ ---- t/ax/test-defs.in -+++ t/ax/test-defs.in -@@ -97,7 +97,7 @@ - # User can override various tools used. Prefer overriding specific for - # that automake testsuite, if they are available. - AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} --PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} -+PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} - MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} - YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} - LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.2.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.2.patch deleted file mode 100644 index 5e91a18bb5be9..0000000000000 --- a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.2.patch +++ /dev/null @@ -1,34 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -1,1 +1,1 @@ --#!@PERL@ -w -+#!/usr/bin/env perl -+# -*- perl -*- -w ---- bin/automake.in -+++ bin/automake.in -@@ -1,1 +1,1 @@ --#!@PERL@ -w -+#!/usr/bin/env perl -+# -*- perl -*- -w ---- Makefile.in -+++ Makefile.in -@@ -524,7 +524,7 @@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ --PERL = @PERL@ -+PERL = /usr/bin/env perl - RELEASE_YEAR = @RELEASE_YEAR@ - SET_MAKE = @SET_MAKE@ - SHELL = @SHELL@ ---- t/ax/test-defs.in -+++ t/ax/test-defs.in -@@ -97,7 +97,7 @@ - # User can override various tools used. Prefer overriding specific for - # that automake testsuite, if they are available. - AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} --PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} -+PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} - MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} - YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} - LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.3.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.3.patch deleted file mode 100644 index d13c305ceee18..0000000000000 --- a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.3.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -1,1 +1,1 @@ --#!@PERL@ -+#!/usr/bin/env perl ---- bin/automake.in -+++ bin/automake.in -@@ -1,1 +1,1 @@ --#!@PERL@ -+#!/usr/bin/env perl ---- Makefile.in -+++ Makefile.in -@@ -535,7 +535,7 @@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ --PERL = @PERL@ -+PERL = /usr/bin/env perl - RELEASE_YEAR = @RELEASE_YEAR@ - SET_MAKE = @SET_MAKE@ - SHELL = @SHELL@ ---- t/ax/test-defs.in -+++ t/ax/test-defs.in -@@ -97,7 +97,7 @@ - # User can override various tools used. Prefer overriding specific for - # that automake testsuite, if they are available. - AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} --PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} -+PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} - MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} - YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} - LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.4.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.4.patch deleted file mode 100644 index 986bcfba26760..0000000000000 --- a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-0.16.4.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -1,1 +1,1 @@ --#!@PERL@ -+#!/usr/bin/env perl ---- bin/automake.in -+++ bin/automake.in -@@ -1,1 +1,1 @@ --#!@PERL@ -+#!/usr/bin/env perl ---- Makefile.in -+++ Makefile.in -@@ -527,7 +527,7 @@ - PACKAGE_URL = @PACKAGE_URL@ - PACKAGE_VERSION = @PACKAGE_VERSION@ - PATH_SEPARATOR = @PATH_SEPARATOR@ --PERL = @PERL@ -+PERL = /usr/bin/env perl - RELEASE_YEAR = @RELEASE_YEAR@ - SET_MAKE = @SET_MAKE@ - SHELL = @SHELL@ ---- t/ax/test-defs.in -+++ t/ax/test-defs.in -@@ -97,7 +97,7 @@ - # User can override various tools used. Prefer overriding specific for - # that automake testsuite, if they are available. - AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} --PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} -+PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} - MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} - YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} - LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.2.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.2.patch new file mode 100644 index 0000000000000..62935414ace95 --- /dev/null +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.2.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile.in b/Makefile.in +index feb1085..5d2f5cc 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -524,7 +524,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index 9a20325..0a4eac4 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -1,4 +1,4 @@ +-#!@PERL@ -w ++#!/usr/bin/env perl + # aclocal - create aclocal.m4 by scanning configure.ac -*- perl -*- + # @configure_input@ + # Copyright (C) 1996-2020 Free Software Foundation, Inc. +diff --git a/bin/automake.in b/bin/automake.in +index 212cb38..cb077a7 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -1,4 +1,4 @@ +-#!@PERL@ -w ++#!/usr/bin/env perl + # automake - create Makefile.in from Makefile.am -*- perl -*- + # @configure_input@ + # Copyright (C) 1994-2020 Free Software Foundation, Inc. +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index dff88b7..20b012f 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL + # User can override various tools used. Prefer overriding specific for + # that automake testsuite, if they are available. + AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} +-PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} ++PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} + MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} + YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} + LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.3.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.3.patch new file mode 100644 index 0000000000000..1a24e6d5d93a7 --- /dev/null +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.3.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile.in b/Makefile.in +index c599705..8c18ed2 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -535,7 +535,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index ca2f963..8782f24 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # aclocal - create aclocal.m4 by scanning configure.ac -*- perl -*- + # @configure_input@ + # Copyright (C) 1996-2020 Free Software Foundation, Inc. +diff --git a/bin/automake.in b/bin/automake.in +index 31c7238..e41b1f5 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # automake - create Makefile.in from Makefile.am -*- perl -*- + # @configure_input@ + # Copyright (C) 1994-2020 Free Software Foundation, Inc. +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index dff88b7..20b012f 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL + # User can override various tools used. Prefer overriding specific for + # that automake testsuite, if they are available. + AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} +-PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} ++PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} + MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} + YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} + LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.4.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.4.patch new file mode 100644 index 0000000000000..e4e77c4731fc5 --- /dev/null +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.4.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile.in b/Makefile.in +index 3a0f57e..4bdcf55 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -527,7 +527,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index f112447..a63ce4d 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # aclocal - create aclocal.m4 by scanning configure.ac -*- perl -*- + # @configure_input@ + # Copyright (C) 1996-2021 Free Software Foundation, Inc. +diff --git a/bin/automake.in b/bin/automake.in +index f04f5d5..4502558 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # automake - create Makefile.in from Makefile.am -*- perl -*- + # @configure_input@ + # Copyright (C) 1994-2021 Free Software Foundation, Inc. +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index c404b0e..381d965 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL + # User can override various tools used. Prefer overriding specific for + # that automake testsuite, if they are available. + AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} +-PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} ++PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} + MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} + YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} + LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.5.patch b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.5.patch new file mode 100644 index 0000000000000..aa3b831101596 --- /dev/null +++ b/recipes/automake/all/patches/0002-no-perl-path-in-shebang-1.16.5.patch @@ -0,0 +1,46 @@ +diff --git a/Makefile.in b/Makefile.in +index ae75282..55844e7 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -527,7 +527,7 @@ PACKAGE_TARNAME = @PACKAGE_TARNAME@ + PACKAGE_URL = @PACKAGE_URL@ + PACKAGE_VERSION = @PACKAGE_VERSION@ + PATH_SEPARATOR = @PATH_SEPARATOR@ +-PERL = @PERL@ ++PERL = /usr/bin/env perl + RELEASE_YEAR = @RELEASE_YEAR@ + SET_MAKE = @SET_MAKE@ + SHELL = @SHELL@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index f112447..a63ce4d 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # aclocal - create aclocal.m4 by scanning configure.ac -*- perl -*- + # @configure_input@ + # Copyright (C) 1996-2021 Free Software Foundation, Inc. +diff --git a/bin/automake.in b/bin/automake.in +index 30babd6..d499bfd 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -1,4 +1,4 @@ +-#!@PERL@ ++#!/usr/bin/env perl + # automake - create Makefile.in from Makefile.am -*- perl -*- + # @configure_input@ + # Copyright (C) 1994-2021 Free Software Foundation, Inc. +diff --git a/t/ax/test-defs.in b/t/ax/test-defs.in +index c404b0e..381d965 100644 +--- a/t/ax/test-defs.in ++++ b/t/ax/test-defs.in +@@ -97,7 +97,7 @@ SHELL=${AM_TESTSUITE_SHELL-'@SHELL@'}; export SHELL + # User can override various tools used. Prefer overriding specific for + # that automake testsuite, if they are available. + AWK=${AM_TESTSUITE_AWK-${AWK-'@AWK@'}} +-PERL=${AM_TESTSUITE_PERL-${PERL-'@PERL@'}} ++PERL=${AM_TESTSUITE_PERL-${PERL-'/usr/bin/env perl'}} + MAKE=${AM_TESTSUITE_MAKE-${MAKE-'make'}} + YACC=${AM_TESTSUITE_YACC-${YACC-'@YACC@'}} + LEX=${AM_TESTSUITE_LEX-${LEX-'@LEX@'}} diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.2.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.2.patch new file mode 100644 index 0000000000000..c7d66e2f6959b --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.2.patch @@ -0,0 +1,106 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index 0a4eac4..487b93d 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -18,10 +18,13 @@ + + # Written by Tom Tromey , and + # Alexandre Duret-Lutz . ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -61,9 +64,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -445,6 +455,7 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -767,7 +778,7 @@ sub trace_used_macros () + # to silence m4_require warnings". + my $early_m4_code .= "m4_define([m4_require_silent_probe], [-])"; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + $traces = "echo '$early_m4_code' | $traces - "; + +diff --git a/bin/automake.in b/bin/automake.in +index cb077a7..676593c 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -23,10 +23,13 @@ + package Automake; + + use strict; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5243,7 +5246,7 @@ sub scan_autoconf_traces + sinclude => 1, + ); + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index f79b8cd..ed78dd2 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ use strict; + + use 5.006; + require Exporter; ++use Cwd 'abs_path'; ++use File::Basename; + + our @ISA = qw (Exporter); + our @EXPORT = qw ($APIVERSION $PACKAGE $PACKAGE_BUGREPORT $VERSION +@@ -32,7 +34,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.3.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.3.patch new file mode 100644 index 0000000000000..2c34ed4d6edbe --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.3.patch @@ -0,0 +1,106 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index 8782f24..263ebc2 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -22,10 +22,13 @@ + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -64,9 +67,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -448,6 +458,7 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -768,7 +779,7 @@ sub trace_used_macros () + # aclocal.m4 is not yet available. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + + # Support AC_CONFIG_MACRO_DIRS also with older autoconf. +diff --git a/bin/automake.in b/bin/automake.in +index e41b1f5..233a6a3 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -25,10 +25,13 @@ package Automake; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5254,7 +5257,7 @@ sub scan_autoconf_traces + # and will see its warnings then. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index d44e0ab..fba2b81 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ package Automake::Config; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + use Exporter; + +@@ -34,7 +36,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.4.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.4.patch new file mode 100644 index 0000000000000..011c7ddfdc8db --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.4.patch @@ -0,0 +1,106 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index a63ce4d..e82d65b 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -22,10 +22,13 @@ + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -64,9 +67,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -448,6 +458,7 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -768,7 +779,7 @@ sub trace_used_macros () + # aclocal.m4 is not yet available. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + + # Support AC_CONFIG_MACRO_DIRS also with older autoconf. +diff --git a/bin/automake.in b/bin/automake.in +index 4502558..6506946 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -25,10 +25,13 @@ package Automake; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5280,7 +5283,7 @@ sub scan_autoconf_traces + # and will see its warnings then. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index d529f1b..ca98604 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ package Automake::Config; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + use Exporter; + +@@ -34,7 +36,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-relocatable-automake-1.16.5.patch b/recipes/automake/all/patches/0003-relocatable-automake-1.16.5.patch new file mode 100644 index 0000000000000..56b752f9a116a --- /dev/null +++ b/recipes/automake/all/patches/0003-relocatable-automake-1.16.5.patch @@ -0,0 +1,107 @@ +diff --git a/bin/aclocal.in b/bin/aclocal.in +index a63ce4d..6224832 100644 +--- a/bin/aclocal.in ++++ b/bin/aclocal.in +@@ -22,10 +22,13 @@ + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + } + +@@ -64,9 +67,16 @@ $perl_threads = 0; + # @system_includes can be augmented with the 'dirlist' file or the + # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' + # option. ++my $scriptpath = abs_path(dirname(__FILE__)); + my @user_includes = (); +-my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); +-my @system_includes = ('@datadir@/aclocal'); ++my @automake_includes = ("$scriptpath/../res/aclocal-" . $APIVERSION); ++my @system_includes = ("$scriptpath/../res/aclocal"); ++my @conan_includes; ++foreach my $conandir (uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || ""))) ++{ ++ push (@conan_includes, $conandir) if $conandir ne '' && -d $conandir; ++ ++} + + # Whether we should copy M4 file in $user_includes[0]. + my $install = 0; +@@ -448,6 +458,8 @@ sub scan_m4_files () + } + scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); + scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); ++ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); ++ + + # Construct a new function that does the searching. We use a + # function (instead of just evaluating $search in the loop) so that +@@ -768,7 +780,7 @@ sub trace_used_macros () + # aclocal.m4 is not yet available. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOM4TE} || '@am_AUTOM4TE@'); ++ my $traces = ($ENV{AUTOM4TE} || '/usr/bin/env autom4te'); + $traces .= " --language Autoconf-without-aclocal-m4 "; + + # Support AC_CONFIG_MACRO_DIRS also with older autoconf. +diff --git a/bin/automake.in b/bin/automake.in +index d499bfd..d4081c9 100644 +--- a/bin/automake.in ++++ b/bin/automake.in +@@ -25,10 +25,13 @@ package Automake; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + BEGIN + { +- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') ++ my $scriptpath = abs_path(dirname(__FILE__)); ++ unshift (@INC, "$scriptpath/../res/@PACKAGE@-@APIVERSION@") + unless $ENV{AUTOMAKE_UNINSTALLED}; + + # Override SHELL. This is required on DJGPP so that system() uses +@@ -5280,7 +5283,7 @@ sub scan_autoconf_traces + # and will see its warnings then. + local $ENV{WARNINGS} = 'none'; + +- my $traces = ($ENV{AUTOCONF} || '@am_AUTOCONF@') . " "; ++ my $traces = ($ENV{AUTOCONF} || '/usr/bin/env autoconf') . " "; + + # Use a separator unlikely to be used, not ':', the default, which + # has a precise meaning for AC_CONFIG_FILES and so on. +diff --git a/lib/Automake/Config.in b/lib/Automake/Config.in +index d529f1b..ca98604 100644 +--- a/lib/Automake/Config.in ++++ b/lib/Automake/Config.in +@@ -20,6 +20,8 @@ package Automake::Config; + use 5.006; + use strict; + use warnings FATAL => 'all'; ++use Cwd 'abs_path'; ++use File::Basename; + + use Exporter; + +@@ -34,7 +36,8 @@ our $PACKAGE = '@PACKAGE@'; + our $PACKAGE_BUGREPORT = '@PACKAGE_BUGREPORT@'; + our $VERSION = '@VERSION@'; + our $RELEASE_YEAR = '@RELEASE_YEAR@'; +-our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; ++my $scriptpath = abs_path(dirname(__FILE__)); ++our $libdir = $ENV{"AUTOMAKE_LIBDIR"} || "$scriptpath/../../@PACKAGE@-@APIVERSION@"; + + our $perl_threads = 0; + # We need at least this version for CLONE support. diff --git a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch b/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch deleted file mode 100644 index 458aa275fdbca..0000000000000 --- a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.1.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -68,8 +68,8 @@ - # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' - # option. - my @user_includes = (); --my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); --my @system_includes = ('@datadir@/aclocal'); -+my @automake_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal-' . $APIVERSION); -+my @system_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal'); -+my @conan_includes = uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || "")); -- - # Whether we should copy M4 file in $user_includes[0]. - my $install = 0; -@@ -451,6 +451,6 @@ - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); -+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); -- - # Construct a new function that does the searching. We use a - # function (instead of just evaluating $search in the loop) so that diff --git a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch b/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch deleted file mode 100644 index 3b2e717768c51..0000000000000 --- a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.2.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -62,8 +62,8 @@ - # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' - # option. - my @user_includes = (); --my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); --my @system_includes = ('@datadir@/aclocal'); -+my @automake_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal-' . $APIVERSION); -+my @system_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal'); -+my @conan_includes = uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || "")); -- - # Whether we should copy M4 file in $user_includes[0]. - my $install = 0; -@@ -445,6 +445,6 @@ - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); -+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); -- - # Construct a new function that does the searching. We use a - # function (instead of just evaluating $search in the loop) so that diff --git a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch b/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch deleted file mode 100644 index a762cf7600f69..0000000000000 --- a/recipes/automake/all/patches/0003-remove-embedded-datadirs-introduce-automake-conan-includes-0.16.3.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -65,8 +65,8 @@ - # ACLOCAL_PATH environment variable, and reset with the '--system-acdir' - # option. - my @user_includes = (); --my @automake_includes = ('@datadir@/aclocal-' . $APIVERSION); --my @system_includes = ('@datadir@/aclocal'); -+my @automake_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal-' . $APIVERSION); -+my @system_includes = ($ENV{"AUTOMAKE_DATADIR"} . '/aclocal'); -+my @conan_includes = uniq(split(/[:;]/, $ENV{'AUTOMAKE_CONAN_INCLUDES'} || "")); -- - # Whether we should copy M4 file in $user_includes[0]. - my $install = 0; -@@ -448,6 +448,6 @@ - } - scan_m4_dirs (FT_AUTOMAKE, SCAN_M4_DIRS_ERROR, @automake_includes); - scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @system_includes); -+ scan_m4_dirs (FT_SYSTEM, SCAN_M4_DIRS_ERROR, @conan_includes); -- - # Construct a new function that does the searching. We use a - # function (instead of just evaluating $search in the loop) so that diff --git a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.1.patch b/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.1.patch deleted file mode 100644 index d74ebf2dc56a6..0000000000000 --- a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.1.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -27,7 +27,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - } - ---- bin/automake.in -+++ bin/automake.in -@@ -31,7 +31,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - - # Override SHELL. This is required on DJGPP so that system() uses -$ diff --git a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.2.patch b/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.2.patch deleted file mode 100644 index 07ad7435b932e..0000000000000 --- a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.2.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -21,7 +21,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - } - ---- bin/automake.in -+++ bin/automake.in -@@ -26,7 +26,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - - # Override SHELL. This is required on DJGPP so that system() uses -$ diff --git a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.3.patch b/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.3.patch deleted file mode 100644 index 8c2546f8629f4..0000000000000 --- a/recipes/automake/all/patches/0004-introduce-automake_perllibdir-0.16.3.patch +++ /dev/null @@ -1,25 +0,0 @@ ---- bin/aclocal.in -+++ bin/aclocal.in -@@ -25,7 +25,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - } - ---- bin/automake.in -+++ bin/automake.in -@@ -28,7 +28,8 @@ - - BEGIN - { -- unshift (@INC, '@datadir@/@PACKAGE@-@APIVERSION@') -+ my $pkgdatadir = $ENV{"AUTOMAKE_PERLLIBDIR"} || '@datadir@/@PACKAGE@-@APIVERSION@'; -+ unshift (@INC, $pkgdatadir) - unless $ENV{AUTOMAKE_UNINSTALLED}; - - # Override SHELL. This is required on DJGPP so that system() uses -$ diff --git a/recipes/automake/all/test_package/conanfile.py b/recipes/automake/all/test_package/conanfile.py index 8362800620a5a..a8b0427416846 100644 --- a/recipes/automake/all/test_package/conanfile.py +++ b/recipes/automake/all/test_package/conanfile.py @@ -1,89 +1,95 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conan.tools.microsoft import is_msvc -from contextlib import contextmanager import os -import shutil -required_conan_version = ">=1.45.0" +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import chdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import unix_path + + +required_conan_version = ">=1.53.0" class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - exports_sources = "configure.ac", "Makefile.am", "test_package_1.c", "test_package.cpp" - # DON'T COPY extra.m4 TO BUILD FOLDER!!! test_type = "explicit" + win_bash = True + + _default_cc = { + "gcc": "gcc", + "clang": "clang", + "Visual Studio": "cl -nologo", + "msvc": "cl -nologo", + "apple-clang": "clang", + } + + def _system_compiler(self, cxx=False): + system_cc = self._default_cc.get(str(self.settings.compiler)) + if system_cc and cxx: + if self.settings.compiler == "gcc": + system_cc = "g++" + elif "clang" in self.settings.compiler: + system_cc = "clang++" + return system_cc @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - def requirements(self): - self.requires(self.tested_reference_str) - def build_requirements(self): self.build_requires(self.tested_reference_str) - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + if self._settings_build.os == "Windows" and not self.conf.get( + "tools.microsoft.bash:path", check_type=str + ): self.build_requires("msys2/cci.latest") - @contextmanager - def _build_context(self): - if is_msvc(self): - with tools.vcvars(self): - with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo",}): - yield - else: - yield + def layout(self): + basic_layout(self, src_folder="src") - _default_cc = { - "gcc": "gcc", - "clang": "clang", - "Visual Studio": "cl -nologo", - "apple-clang": "clang", - } + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() - @property - def _system_cc(self): - system_cc = os.environ.get("CC", None) - if not system_cc: - system_cc = self._default_cc.get(str(self.settings.compiler)) - return system_cc - - @property - def _user_info(self): - return getattr(self, "user_info_build", self.deps_user_info) - - def _build_scripts(self): - """Test compile script of automake""" - compile_script = self._user_info["automake"].compile - ar_script = self._user_info["automake"].ar_lib - assert os.path.isfile(ar_script) - assert os.path.isfile(compile_script) - - if self._system_cc: - with tools.vcvars(self) if is_msvc(self) else tools.no_op(): - self.run("{} {} test_package_1.c -o script_test".format(tools.unix_path(compile_script), self._system_cc), win_bash=tools.os_info.is_windows) - - def _build_autotools(self): - """Test autoreconf + configure + make""" - with tools.environment_append({"AUTOMAKE_CONAN_INCLUDES": [tools.unix_path(self.source_folder)]}): - self.run("{} -fiv".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows) - self.run("{} --help".format(os.path.join(self.build_folder, "configure").replace("\\", "/")), win_bash=tools.os_info.is_windows) - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with self._build_context(): - autotools.configure() - autotools.make() + env = VirtualBuildEnv(self) + env.generate() - def build(self): - for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), self.build_folder) + env = Environment() - self._build_scripts() - self._build_autotools() + compile_script = unix_path(self, + self.dependencies.build["automake"].conf_info.get("user.automake:compile-wrapper")) - def test(self): - if self._system_cc: - if not tools.cross_building(self): - self.run(os.path.join(".", "script_test"), run_environment=True) + # define CC and CXX such that if the user hasn't already defined it + # via `tools.build:compiler_executables` or buildenv variables, + # we tell autotools to guess the name matching the current setting + # (otherwise it falls back to finding gcc first) + cc = self._system_compiler() + cxx = self._system_compiler(cxx=True) + if cc and cxx: + # Using shell parameter expansion + env.define("CC", f"${{CC-{cc}}}") + env.define("CXX", f"${{CXX-{cxx}}}") + + env.define("COMPILE", compile_script) + env.define("ACLOCAL_PATH", unix_path(self, os.path.join(self.source_folder))) + env.vars(self, scope="build").save_script("automake_build_test") - if not tools.cross_building(self): - self.run(os.path.join(".", "test_package"), run_environment=True) + def build(self): + # Test compilation through compile wrapper script + compiler = self._system_compiler() + source_file = unix_path(self, os.path.join(self.source_folder, "test_package_1.c")) + with chdir(self, self.build_folder): + self.run(f"$COMPILE {compiler} {source_file} -o script_test", env="conanbuild") + + # Build test project + autotools = Autotools(self) + autotools.autoreconf(args=['--debug']) + autotools.configure() + autotools.make() + + def test(self): + if can_run(self): + with chdir(self, self.build_folder): + self.run("./script_test") + self.run("./test_package") diff --git a/recipes/automake/all/test_package/src/Makefile.am b/recipes/automake/all/test_package/src/Makefile.am new file mode 100644 index 0000000000000..655db7f1876cb --- /dev/null +++ b/recipes/automake/all/test_package/src/Makefile.am @@ -0,0 +1,4 @@ +# @configure_input@ + +bin_PROGRAMS = test_package +test_package_SOURCES = test_package.cpp diff --git a/recipes/automake/all/test_package/src/configure.ac b/recipes/automake/all/test_package/src/configure.ac new file mode 100644 index 0000000000000..8a7ae1dc34e7f --- /dev/null +++ b/recipes/automake/all/test_package/src/configure.ac @@ -0,0 +1,28 @@ +AC_PREREQ([2.69]) +AC_INIT([test_package], [1.0]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + +# Safety checks in case user overwritten --srcdir +AC_CONFIG_SRCDIR([test_package.cpp]) + +AC_CANONICAL_HOST + +# Test includes of extra including directories using conan +AUTOMAKE_TEST_PACKAGE_PREREQ([1.0]) +AUTOMAKE_TEST_PACKAGE_HELLO([argument1], [argument2], [...], [last argument]) + +AC_CONFIG_HEADER([config.h]) + +# Check for CC and CXX compiler +AC_PROG_CC +AC_PROG_CXX +## We can add more checks in this section +# +## Tells automake to create a Makefile +## See https://www.gnu.org/software/automake/manual/html_node/Requirements.html +AC_CONFIG_FILES([Makefile]) +# +## Generate the output +AC_OUTPUT +# diff --git a/recipes/automake/all/test_package/src/extra.m4 b/recipes/automake/all/test_package/src/extra.m4 new file mode 100644 index 0000000000000..69c85f5ac945d --- /dev/null +++ b/recipes/automake/all/test_package/src/extra.m4 @@ -0,0 +1,14 @@ +dnl This file contains a macro to test adding extra include dirs using conan + +AC_DEFUN([AUTOMAKE_TEST_PACKAGE_PREREQ],[ + m4_define([CONAN_MACRO_VERSION], [1.3]) + m4_if(m4_version_compare(CONAN_MACRO_VERSION, [$1]), + -1, + [m4_fatal([extra.m4 version $1 or higher is required, but ]CONAN_MACRO_VERSION[ found])] + ) +])dnl AUTOMAKE_TEST_PACKAGE_PREREQ + +AC_DEFUN([AUTOMAKE_TEST_PACKAGE_HELLO],[ + echo "Hello world from the extra.m4 script!" + echo "My args were: $*" +])dnl diff --git a/recipes/automake/all/test_package/src/test_package.cpp b/recipes/automake/all/test_package/src/test_package.cpp new file mode 100644 index 0000000000000..cd8c2f27c3587 --- /dev/null +++ b/recipes/automake/all/test_package/src/test_package.cpp @@ -0,0 +1,9 @@ +#include "config.h" + +#include +#include + +int main(int argc, char** argv) { + std::cout << "test_package.cpp: " << "hello world from " PACKAGE_NAME "!\n"; + return EXIT_SUCCESS; +} diff --git a/recipes/automake/all/test_package/src/test_package_1.c b/recipes/automake/all/test_package/src/test_package_1.c new file mode 100644 index 0000000000000..9aaff6c18e30d --- /dev/null +++ b/recipes/automake/all/test_package/src/test_package_1.c @@ -0,0 +1,7 @@ +#include +#include + +int main() { + puts("test_package.c says 'Hello World'!\n"); + return EXIT_SUCCESS; +} diff --git a/recipes/automake/all/test_v1_package/Makefile.am b/recipes/automake/all/test_v1_package/Makefile.am new file mode 100644 index 0000000000000..655db7f1876cb --- /dev/null +++ b/recipes/automake/all/test_v1_package/Makefile.am @@ -0,0 +1,4 @@ +# @configure_input@ + +bin_PROGRAMS = test_package +test_package_SOURCES = test_package.cpp diff --git a/recipes/automake/all/test_v1_package/conanfile.py b/recipes/automake/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8362800620a5a --- /dev/null +++ b/recipes/automake/all/test_v1_package/conanfile.py @@ -0,0 +1,89 @@ +from conans import AutoToolsBuildEnvironment, ConanFile, tools +from conan.tools.microsoft import is_msvc +from contextlib import contextmanager +import os +import shutil + +required_conan_version = ">=1.45.0" + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + exports_sources = "configure.ac", "Makefile.am", "test_package_1.c", "test_package.cpp" + # DON'T COPY extra.m4 TO BUILD FOLDER!!! + test_type = "explicit" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + @contextmanager + def _build_context(self): + if is_msvc(self): + with tools.vcvars(self): + with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo",}): + yield + else: + yield + + _default_cc = { + "gcc": "gcc", + "clang": "clang", + "Visual Studio": "cl -nologo", + "apple-clang": "clang", + } + + @property + def _system_cc(self): + system_cc = os.environ.get("CC", None) + if not system_cc: + system_cc = self._default_cc.get(str(self.settings.compiler)) + return system_cc + + @property + def _user_info(self): + return getattr(self, "user_info_build", self.deps_user_info) + + def _build_scripts(self): + """Test compile script of automake""" + compile_script = self._user_info["automake"].compile + ar_script = self._user_info["automake"].ar_lib + assert os.path.isfile(ar_script) + assert os.path.isfile(compile_script) + + if self._system_cc: + with tools.vcvars(self) if is_msvc(self) else tools.no_op(): + self.run("{} {} test_package_1.c -o script_test".format(tools.unix_path(compile_script), self._system_cc), win_bash=tools.os_info.is_windows) + + def _build_autotools(self): + """Test autoreconf + configure + make""" + with tools.environment_append({"AUTOMAKE_CONAN_INCLUDES": [tools.unix_path(self.source_folder)]}): + self.run("{} -fiv".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows) + self.run("{} --help".format(os.path.join(self.build_folder, "configure").replace("\\", "/")), win_bash=tools.os_info.is_windows) + autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + with self._build_context(): + autotools.configure() + autotools.make() + + def build(self): + for src in self.exports_sources: + shutil.copy(os.path.join(self.source_folder, src), self.build_folder) + + self._build_scripts() + self._build_autotools() + + def test(self): + if self._system_cc: + if not tools.cross_building(self): + self.run(os.path.join(".", "script_test"), run_environment=True) + + if not tools.cross_building(self): + self.run(os.path.join(".", "test_package"), run_environment=True) diff --git a/recipes/automake/all/test_v1_package/configure.ac b/recipes/automake/all/test_v1_package/configure.ac new file mode 100644 index 0000000000000..8a7ae1dc34e7f --- /dev/null +++ b/recipes/automake/all/test_v1_package/configure.ac @@ -0,0 +1,28 @@ +AC_PREREQ([2.69]) +AC_INIT([test_package], [1.0]) +AC_CONFIG_AUX_DIR([build-aux]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + +# Safety checks in case user overwritten --srcdir +AC_CONFIG_SRCDIR([test_package.cpp]) + +AC_CANONICAL_HOST + +# Test includes of extra including directories using conan +AUTOMAKE_TEST_PACKAGE_PREREQ([1.0]) +AUTOMAKE_TEST_PACKAGE_HELLO([argument1], [argument2], [...], [last argument]) + +AC_CONFIG_HEADER([config.h]) + +# Check for CC and CXX compiler +AC_PROG_CC +AC_PROG_CXX +## We can add more checks in this section +# +## Tells automake to create a Makefile +## See https://www.gnu.org/software/automake/manual/html_node/Requirements.html +AC_CONFIG_FILES([Makefile]) +# +## Generate the output +AC_OUTPUT +# diff --git a/recipes/automake/all/test_v1_package/extra.m4 b/recipes/automake/all/test_v1_package/extra.m4 new file mode 100644 index 0000000000000..69c85f5ac945d --- /dev/null +++ b/recipes/automake/all/test_v1_package/extra.m4 @@ -0,0 +1,14 @@ +dnl This file contains a macro to test adding extra include dirs using conan + +AC_DEFUN([AUTOMAKE_TEST_PACKAGE_PREREQ],[ + m4_define([CONAN_MACRO_VERSION], [1.3]) + m4_if(m4_version_compare(CONAN_MACRO_VERSION, [$1]), + -1, + [m4_fatal([extra.m4 version $1 or higher is required, but ]CONAN_MACRO_VERSION[ found])] + ) +])dnl AUTOMAKE_TEST_PACKAGE_PREREQ + +AC_DEFUN([AUTOMAKE_TEST_PACKAGE_HELLO],[ + echo "Hello world from the extra.m4 script!" + echo "My args were: $*" +])dnl diff --git a/recipes/automake/all/test_v1_package/test_package.cpp b/recipes/automake/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..cd8c2f27c3587 --- /dev/null +++ b/recipes/automake/all/test_v1_package/test_package.cpp @@ -0,0 +1,9 @@ +#include "config.h" + +#include +#include + +int main(int argc, char** argv) { + std::cout << "test_package.cpp: " << "hello world from " PACKAGE_NAME "!\n"; + return EXIT_SUCCESS; +} diff --git a/recipes/automake/all/test_v1_package/test_package_1.c b/recipes/automake/all/test_v1_package/test_package_1.c new file mode 100644 index 0000000000000..9aaff6c18e30d --- /dev/null +++ b/recipes/automake/all/test_v1_package/test_package_1.c @@ -0,0 +1,7 @@ +#include +#include + +int main() { + puts("test_package.c says 'Hello World'!\n"); + return EXIT_SUCCESS; +} diff --git a/recipes/automake/config.yml b/recipes/automake/config.yml index fd370ec1de9eb..020d6b55dbfab 100644 --- a/recipes/automake/config.yml +++ b/recipes/automake/config.yml @@ -7,5 +7,3 @@ versions: folder: all "1.16.2": folder: all - "1.16.1": - folder: all diff --git a/recipes/avahi/all/conanfile.py b/recipes/avahi/all/conanfile.py index 793efa5b83afd..14386077db5e2 100644 --- a/recipes/avahi/all/conanfile.py +++ b/recipes/avahi/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import copy, get, rmdir, rm +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.53.0" class AvahiConan(ConanFile): @@ -10,12 +15,11 @@ class AvahiConan(ConanFile): # --enable-compat-libdns_sd means that this recipe provides the mdnsresponder compile interface provides = "mdnsresponder" description = "Avahi - Service Discovery for Linux using mDNS/DNS-SD -- compatible with Bonjour" - topics = ("avahi", "Bonjour", "DNS-SD", "mDNS") + topics = ("bonjour", "dns", "dns-sd", "mdns") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lathiat/avahi" license = "LGPL-2.1-only" settings = "os", "arch", "compiler", "build_type" - generators = "pkg_config" options = { "shared": [True, False], @@ -26,75 +30,72 @@ class AvahiConan(ConanFile): "fPIC": True } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("glib/2.68.3") - self.requires("expat/2.4.1") + self.requires("glib/2.75.2") + self.requires("expat/2.5.0") self.requires("libdaemon/0.14") - self.requires("dbus/1.12.20") + self.requires("dbus/1.15.2") self.requires("gdbm/1.19") self.requires("libevent/2.1.12") + def build_requirements(self): + self.tool_requires("glib/2.75.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + def validate(self): - if self.settings.os != "Linux" or tools.cross_building(self): - raise ConanInvalidConfiguration("Only Linux is supported for this package.") + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux.") def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @property - def _configure_args(self): - yes_no = lambda v: "yes" if v else "no" - return [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--disable-gtk3", - "--disable-mono", - "--disable-python", - "--disable-qt5", - "--disable-monodoc", - "--enable-compat-libdns_sd", - "--with-systemdsystemunitdir={}/lib/systemd/system".format(self.package_folder), - ] - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.configure(configure_dir=self._source_subfolder, args=self._configure_args) - return self._autotools + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--enable-compat-libdns_sd") + tc.configure_args.append("--disable-gtk3") + tc.configure_args.append("--disable-mono") + tc.configure_args.append("--disable-monodoc") + tc.configure_args.append("--disable-python") + tc.configure_args.append("--disable-qt5") + tc.configure_args.append("--with-systemdsystemunitdir=/lib/systemd/system") + tc.generate() + AutotoolsDeps(self).generate() + PkgConfigDeps(self).generate() + # Override Avahi's problematic check for the pkg-config executable. + env = Environment() + env.define("have_pkg_config", "yes") + env.vars(self).save_script("conanbuild_pkg_config") def build(self): - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "etc")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "run")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "Avahi" - self.cpp_info.names["cmake_find_package_multi"] = "Avahi" - for lib in ("client", "common", "core", "glib", "gobject", "libevent", "compat-libdns_sd"): - avahi_lib = "avahi-{}".format(lib) + avahi_lib = f"avahi-{lib}" self.cpp_info.components[lib].names["cmake_find_package"] = lib self.cpp_info.components[lib].names["cmake_find_package_multi"] = lib self.cpp_info.components[lib].names["pkg_config"] = avahi_lib @@ -111,7 +112,7 @@ def package_info(self): self.cpp_info.components["compat-libdns_sd"].requires = ["client"] for app in ("autoipd", "browse", "daemon", "dnsconfd", "publish", "resolve", "set-host-name"): - avahi_app = "avahi-{}".format(app) + avahi_app = f"avahi-{app}" self.cpp_info.components[app].names["cmake_find_package"] = app self.cpp_info.components[app].names["cmake_find_package_multi"] = app self.cpp_info.components[app].names["pkg_config"] = avahi_app @@ -125,5 +126,5 @@ def package_info(self): self.cpp_info.components["set-host-name"].requires = ["client"] bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/avahi/all/test_package/CMakeLists.txt b/recipes/avahi/all/test_package/CMakeLists.txt index 7f438a48c4ea1..fce015c3405a9 100644 --- a/recipes/avahi/all/test_package/CMakeLists.txt +++ b/recipes/avahi/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(Avahi CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} Avahi::compat-libdns_sd) +target_link_libraries(${PROJECT_NAME} PRIVATE avahi::compat-libdns_sd) diff --git a/recipes/avahi/all/test_package/conanfile.py b/recipes/avahi/all/test_package/conanfile.py index 1bf1c7e26255d..0cec595dd1ddc 100644 --- a/recipes/avahi/all/test_package/conanfile.py +++ b/recipes/avahi/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/avahi/all/test_v1_package/CMakeLists.txt b/recipes/avahi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/avahi/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/avahi/all/test_v1_package/conanfile.py b/recipes/avahi/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b6a26067f365d --- /dev/null +++ b/recipes/avahi/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/avcpp/all/CMakeLists.txt b/recipes/avcpp/all/CMakeLists.txt deleted file mode 100644 index fcd2addceeac7..0000000000000 --- a/recipes/avcpp/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -set(AVCPP_NOT_SUBPROJECT ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/avcpp/all/conandata.yml b/recipes/avcpp/all/conandata.yml index af831432579cc..1ba5e69f511c2 100644 --- a/recipes/avcpp/all/conandata.yml +++ b/recipes/avcpp/all/conandata.yml @@ -1,9 +1,17 @@ sources: + "2.1.0": + url: "https://github.com/h4tr3d/avcpp/archive/refs/tags/v2.1.0.tar.gz" + sha256: "8398217dccb9f5b4cbb41e5bf4f73f47b461ed3ba8c3aefdda9f9dd714649855" "cci.20220301": url: "https://github.com/h4tr3d/avcpp/archive/fd4bc4662eb39853de8fcac4a663bebd0eea30b8.tar.gz" sha256: "e48eae2ec154bc69aed16159c8b18c9ffb4925ba672b022e94a3c9b96782a4bf" patches: + "2.1.0": + - patch_file: "patches/2.1.0-fix-ffmpeg.patch" + patch_description: "fix ffmpeg package name and remove ffmpeg from install targets" + patch_type: "conan" "cci.20220301": - - base_path: "source_subfolder" - patch_file: "patches/fix-ffmpeg-package.patch" + - patch_file: "patches/cci.20220301-fix-ffmpeg.patch" + patch_description: "fix ffmpeg package name and remove ffmpeg from install targets" + patch_type: "conan" diff --git a/recipes/avcpp/all/conanfile.py b/recipes/avcpp/all/conanfile.py index ca7902bd79a4f..e1479bc47146c 100644 --- a/recipes/avcpp/all/conanfile.py +++ b/recipes/avcpp/all/conanfile.py @@ -1,46 +1,48 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" + class AvcppConan(ConanFile): name = "avcpp" description = "C++ wrapper for FFmpeg" - topics = ("ffmpeg", "cpp") license = "LGPL-2.1", "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/h4tr3d/avcpp/" + topics = ("ffmpeg", "cpp") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False], + "fPIC": [True, False], "shared": [True, False], } default_options = { - "fPIC": True, + "fPIC": True, "shared": False, } - generators = "cmake", "cmake_find_package_multi" + @property + def _min_cppstd(self): + return "17" @property - def _compiler_required_cpp17(self): + def _compilers_minimum_version(self): return { - "Visual Studio": "16", "gcc": "8", "clang": "7", "apple-clang": "12.0", + "Visual Studio": "15", + "msvc": "191", } - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -48,59 +50,68 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def validate(self): - if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") - - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{0} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("ffmpeg/5.0") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["AV_ENABLE_SHARED"] = self.options.shared - cmake.definitions["AV_ENABLE_STATIC"] = not self.options.shared - cmake.definitions["AV_BUILD_EXAMPLES"] = False - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["AV_ENABLE_SHARED"] = self.options.shared + tc.variables["AV_ENABLE_STATIC"] = not self.options.shared + tc.variables["AV_BUILD_EXAMPLES"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): target_name = "avcpp" if self.options.shared else "avcpp-static" self.cpp_info.set_property("cmake_file_name", "avcpp") - self.cpp_info.set_property("cmake_target_name", "avcpp::{}".format(target_name)) - - self.cpp_info.filenames["cmake_find_package"] = "avcpp" - self.cpp_info.filenames["cmake_find_package_multi"] = "avcpp" - self.cpp_info.names["cmake_find_package"] = "avcpp" - self.cpp_info.names["cmake_find_package_multi"] = "avcpp" + self.cpp_info.set_property("cmake_target_name", f"avcpp::{target_name}") self.cpp_info.components["AvCpp"].names["cmake_find_package"] = target_name self.cpp_info.components["AvCpp"].names["cmake_find_package_multi"] = target_name - self.cpp_info.components["AvCpp"].set_property("cmake_target_name", "avcpp::{}".format(target_name)) + self.cpp_info.components["AvCpp"].set_property("cmake_target_name", f"avcpp::{target_name}") self.cpp_info.components["AvCpp"].libs = ["avcpp", ] self.cpp_info.components["AvCpp"].requires = ["ffmpeg::ffmpeg", ] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["AvCpp"].system_libs = ["mvec"] + if self.settings.os == "Windows": + self.cpp_info.components["AvCpp"].system_libs = ["mfplat"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "avcpp" + self.cpp_info.filenames["cmake_find_package_multi"] = "avcpp" + self.cpp_info.names["cmake_find_package"] = "avcpp" + self.cpp_info.names["cmake_find_package_multi"] = "avcpp" diff --git a/recipes/avcpp/all/patches/2.1.0-fix-ffmpeg.patch b/recipes/avcpp/all/patches/2.1.0-fix-ffmpeg.patch new file mode 100644 index 0000000000000..38c60a601238c --- /dev/null +++ b/recipes/avcpp/all/patches/2.1.0-fix-ffmpeg.patch @@ -0,0 +1,46 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 95b1a02..0f31197 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,8 +6,6 @@ endif() + + project(AvCpp LANGUAGES CXX VERSION 2.1.0) + +-set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake ${CMAKE_MODULE_PATH}) +- + set(FFMPEG_PKG_CONFIG_SUFFIX "" CACHE STRING "This suffix uses for FFmpeg component names searches by pkg-config") + set(AV_ENABLE_STATIC On CACHE BOOL "Enable static library build (On)") + set(AV_ENABLE_SHARED On CACHE BOOL "Enable shared library build (On)") +@@ -28,8 +26,8 @@ set (AVCPP_WARNING_OPTIONS + set(THREADS_PREFER_PTHREAD_FLAG ON) + find_package(Threads) + +-find_package(FFmpeg +- COMPONENTS AVCODEC AVFORMAT AVUTIL AVDEVICE AVFILTER SWSCALE SWRESAMPLE REQUIRED) ++find_package(ffmpeg ++ COMPONENTS avcodec avformat avutil avdevice avfilter swscale swresample REQUIRED) + + add_subdirectory(src) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 4c58281..bee779f 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -24,7 +24,7 @@ foreach(TARGET ${AV_TARGETS}) + add_library(${TARGET} ${TYPE} ${AV_SOURCES} ${AV_HEADERS}) + + target_compile_options(${TARGET} PRIVATE ${AVCPP_WARNING_OPTIONS}) +- target_link_libraries(${TARGET} PRIVATE Threads::Threads PUBLIC FFmpeg::FFmpeg) ++ target_link_libraries(${TARGET} PRIVATE Threads::Threads PUBLIC ffmpeg::ffmpeg) + target_include_directories(${TARGET} + PUBLIC + $ +@@ -53,7 +53,7 @@ if (AVCPP_NOT_SUBPROJECT) + # APPEND + # FILE ${CMAKE_CURRENT_BINARY_DIR}/avcpp-targets.cmake) + +- install(TARGETS ${AV_TARGETS} FFmpeg ++ install(TARGETS ${AV_TARGETS} + EXPORT avcpp-targets + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/recipes/avcpp/all/patches/fix-ffmpeg-package.patch b/recipes/avcpp/all/patches/cci.20220301-fix-ffmpeg.patch similarity index 100% rename from recipes/avcpp/all/patches/fix-ffmpeg-package.patch rename to recipes/avcpp/all/patches/cci.20220301-fix-ffmpeg.patch diff --git a/recipes/avcpp/all/test_package/CMakeLists.txt b/recipes/avcpp/all/test_package/CMakeLists.txt index a52ed1452c0cb..7b07f0b83ed62 100644 --- a/recipes/avcpp/all/test_package/CMakeLists.txt +++ b/recipes/avcpp/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(avcpp CONFIG REQUIRED) +find_package(avcpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) if (TARGET avcpp::avcpp) - target_link_libraries(${PROJECT_NAME} avcpp::avcpp) + target_link_libraries(${PROJECT_NAME} PRIVATE avcpp::avcpp) else() - target_link_libraries(${PROJECT_NAME} avcpp::avcpp-static) + target_link_libraries(${PROJECT_NAME} PRIVATE avcpp::avcpp-static) endif() target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) diff --git a/recipes/avcpp/all/test_package/conanfile.py b/recipes/avcpp/all/test_package/conanfile.py index 6b551939fbde3..a9fb96656f203 100644 --- a/recipes/avcpp/all/test_package/conanfile.py +++ b/recipes/avcpp/all/test_package/conanfile.py @@ -1,9 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools -class TestConan(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/avcpp/all/test_v1_package/CMakeLists.txt b/recipes/avcpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/avcpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/avcpp/all/test_v1_package/conanfile.py b/recipes/avcpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6b551939fbde3 --- /dev/null +++ b/recipes/avcpp/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class TestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/avcpp/config.yml b/recipes/avcpp/config.yml index 372dcda16cf25..deb0eb011c7ea 100644 --- a/recipes/avcpp/config.yml +++ b/recipes/avcpp/config.yml @@ -1,3 +1,5 @@ versions: + "2.1.0": + folder: all "cci.20220301": folder: all diff --git a/recipes/aws-c-auth/all/CMakeLists.txt b/recipes/aws-c-auth/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-auth/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-auth/all/conandata.yml b/recipes/aws-c-auth/all/conandata.yml index 4cdcb1f5bef3d..3f6bee7b4b086 100644 --- a/recipes/aws-c-auth/all/conandata.yml +++ b/recipes/aws-c-auth/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.6.17": + url: "https://github.com/awslabs/aws-c-auth/archive/v0.6.17.tar.gz" + sha256: "b43678ad3a779c9c7fccf8f931c162eaaf4d5d64d2955ac1fcfd32e538545c0f" "0.6.11": url: "https://github.com/awslabs/aws-c-auth/archive/v0.6.11.tar.gz" sha256: "d8a0d373cf8b0ff148a014ae2ba24c51f2e7a598b5b0cf3a6e64482c1cd37f90" diff --git a/recipes/aws-c-auth/all/conanfile.py b/recipes/aws-c-auth/all/conanfile.py index 3f61c0db81b14..98d3c8c463737 100644 --- a/recipes/aws-c-auth/all/conanfile.py +++ b/recipes/aws-c-auth/all/conanfile.py @@ -1,18 +1,19 @@ -from conans import ConanFile, CMake, tools -import os +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -required_conan_version = ">=1.43.0" +import os +required_conan_version = ">=1.47.0" class AwsCAuth(ConanFile): name = "aws-c-auth" description = "C99 library implementation of AWS client-side authentication: standard credentials providers and signing." - topics = ("aws", "amazon", "cloud", "authentication", "credentials", "providers", "signing") + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-auth" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" + topics = ("aws", "amazon", "cloud", "authentication", "credentials", "providers", "signing") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,60 +24,66 @@ class AwsCAuth(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") + self.requires("aws-c-common/0.8.2") self.requires("aws-c-cal/0.5.13") - self.requires("aws-c-io/0.10.20") - self.requires("aws-c-http/0.6.13") - if tools.Version(self.version) >= "0.6.5": - self.requires("aws-c-sdkutils/0.1.2") + if Version(self.version) < "0.6.17": + self.requires("aws-c-io/0.10.20") + self.requires("aws-c-http/0.6.13") + else: + self.requires("aws-c-io/0.13.4") + self.requires("aws-c-http/0.6.22") + if Version(self.version) >= "0.6.5": + self.requires("aws-c-sdkutils/0.1.3") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-auth")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-auth")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-auth") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-auth") - self.cpp_info.filenames["cmake_find_package"] = "aws-c-auth" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-auth" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" self.cpp_info.components["aws-c-auth-lib"].names["cmake_find_package"] = "aws-c-auth" self.cpp_info.components["aws-c-auth-lib"].names["cmake_find_package_multi"] = "aws-c-auth" self.cpp_info.components["aws-c-auth-lib"].set_property("cmake_target_name", "AWS::aws-c-auth") @@ -86,7 +93,13 @@ def package_info(self): "aws-c-common::aws-c-common-lib", "aws-c-cal::aws-c-cal-lib", "aws-c-io::aws-c-io-lib", - "aws-c-http::aws-c-http-lib" + "aws-c-http::aws-c-http-lib", ] - if tools.Version(self.version) >= "0.6.5": + if Version(self.version) >= "0.6.5": self.cpp_info.components["aws-c-auth-lib"].requires.append("aws-c-sdkutils::aws-c-sdkutils-lib") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "aws-c-auth" + self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-auth" + self.cpp_info.names["cmake_find_package"] = "AWS" + self.cpp_info.names["cmake_find_package_multi"] = "AWS" diff --git a/recipes/aws-c-auth/all/test_package/CMakeLists.txt b/recipes/aws-c-auth/all/test_package/CMakeLists.txt index 61133ac41d950..d0c587e8dd59d 100644 --- a/recipes/aws-c-auth/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-auth/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-auth REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-auth) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-auth) diff --git a/recipes/aws-c-auth/all/test_package/conanfile.py b/recipes/aws-c-auth/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-c-auth/all/test_package/conanfile.py +++ b/recipes/aws-c-auth/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-auth/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-auth/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..606180fec87bd --- /dev/null +++ b/recipes/aws-c-auth/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-auth REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-auth) diff --git a/recipes/aws-c-auth/all/test_v1_package/conanfile.py b/recipes/aws-c-auth/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/aws-c-auth/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-c-auth/config.yml b/recipes/aws-c-auth/config.yml index 17cbddbaa736f..503ab418198f1 100644 --- a/recipes/aws-c-auth/config.yml +++ b/recipes/aws-c-auth/config.yml @@ -1,4 +1,6 @@ versions: + "0.6.17": + folder: all "0.6.11": folder: all "0.6.8": diff --git a/recipes/aws-c-cal/all/CMakeLists.txt b/recipes/aws-c-cal/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-cal/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-cal/all/conandata.yml b/recipes/aws-c-cal/all/conandata.yml index 32f0c310bc263..e1b848e4dfa2d 100644 --- a/recipes/aws-c-cal/all/conandata.yml +++ b/recipes/aws-c-cal/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.5.20": + url: "https://github.com/awslabs/aws-c-cal/archive/v0.5.20.tar.gz" + sha256: "acc352359bd06f8597415c366cf4ec4f00d0b0da92d637039a73323dd55b6cd0" + "0.5.19": + url: "https://github.com/awslabs/aws-c-cal/archive/refs/tags/v0.5.19.tar.gz" + sha256: "23452ab7960c480f1ec0a96ac55bde32d7d27c4a664baeadc248923b19c12086" "0.5.17": url: "https://github.com/awslabs/aws-c-cal/archive/v0.5.17.tar.gz" sha256: "40297da04443d4ee2988d1c5fb0dc4a156d0e4cfaf80e6a1df1867452566d540" @@ -12,9 +18,35 @@ sources: url: "https://github.com/awslabs/aws-c-cal/archive/v0.5.11.tar.gz" sha256: "ef46e121b2231a0b19afce8af4b32d77501df4d470e926990918456636cd83c0" patches: + "0.5.20": + - patch_file: "patches/0002-apple-corefoundation-0.5.13.patch" + patch_description: "Link to CoreFoundation on Apple" + patch_type: "backport" + patch_source: "https://github.com/awslabs/aws-c-cal/pull/126" + "0.5.19": + - patch_file: "patches/0002-apple-corefoundation-0.5.13.patch" + patch_description: "Link to CoreFoundation on Apple" + patch_type: "backport" + patch_source: "https://github.com/awslabs/aws-c-cal/pull/126" + "0.5.17": + - patch_file: "patches/0002-apple-corefoundation-0.5.13.patch" + patch_description: "Link to CoreFoundation on Apple" + patch_type: "backport" + patch_source: "https://github.com/awslabs/aws-c-cal/pull/126" + "0.5.13": + - patch_file: "patches/0002-apple-corefoundation-0.5.13.patch" + patch_description: "Link to CoreFoundation on Apple" + patch_type: "backport" + patch_source: "https://github.com/awslabs/aws-c-cal/pull/126" "0.5.12": - - patch_file: "patches/0001-use-openssl-cmake-imported-target.cmake" - base_path: "source_subfolder" + - patch_file: "patches/0001-use-openssl-cmake-imported-target.patch" + - patch_file: "patches/0002-apple-corefoundation-0.5.11.patch" + patch_description: "Link to CoreFoundation on Apple" + patch_type: "backport" + patch_source: "https://github.com/awslabs/aws-c-cal/pull/126" "0.5.11": - - patch_file: "patches/0001-use-openssl-cmake-imported-target.cmake" - base_path: "source_subfolder" + - patch_file: "patches/0001-use-openssl-cmake-imported-target.patch" + - patch_file: "patches/0002-apple-corefoundation-0.5.11.patch" + patch_description: "Link to CoreFoundation on Apple" + patch_type: "backport" + patch_source: "https://github.com/awslabs/aws-c-cal/pull/126" diff --git a/recipes/aws-c-cal/all/conanfile.py b/recipes/aws-c-cal/all/conanfile.py index 363b562fb03ab..3ed5c70f492e6 100644 --- a/recipes/aws-c-cal/all/conanfile.py +++ b/recipes/aws-c-cal/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.3" class AwsCCal(ConanFile): @@ -21,22 +25,13 @@ class AwsCCal(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _needs_openssl(self): - return self.settings.os != "Windows" and not tools.is_apple_os(self.settings.os) + return self.settings.os != "Windows" and not is_apple_os(self) def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -45,41 +40,49 @@ def config_options(self): def configure(self): if self.options.shared: del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - if tools.Version(self.version) <= "0.5.11": + if Version(self.version) <= "0.5.11": self.requires("aws-c-common/0.6.11") else: - self.requires("aws-c-common/0.7.4") + self.requires("aws-c-common/0.8.2") if self._needs_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["USE_OPENSSL"] = self._needs_openssl - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["USE_OPENSSL"] = self._needs_openssl + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-cal")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-cal")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-cal") @@ -97,22 +100,22 @@ def package_info(self): self.cpp_info.components["aws-c-cal-lib"].requires = ["aws-c-common::aws-c-common-lib"] if self.settings.os == "Windows": self.cpp_info.components["aws-c-cal-lib"].system_libs.append("ncrypt") - elif tools.is_apple_os(self.settings.os): - self.cpp_info.components["aws-c-cal-lib"].frameworks.append("Security") + elif is_apple_os(self): + self.cpp_info.components["aws-c-cal-lib"].frameworks.extend(["CoreFoundation", "Security"]) elif self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.components["aws-c-cal-lib"].system_libs.append("dl") self.user_info.with_openssl = self._needs_openssl if self._needs_openssl: self.cpp_info.components["aws-c-cal-lib"].requires.append("openssl::crypto") - if not self.options["openssl"].shared: + if not self.dependencies["openssl"].options.shared: # aws-c-cal does not statically link to openssl and searches dynamically for openssl symbols . # Mark these as undefined so the linker will include them. # This avoids dynamical look-up for a system crypto library. crypto_symbols = [ "HMAC_Update", "HMAC_Final", "HMAC_Init_ex", ] - if tools.Version(self.deps_cpp_info["openssl"].version) >= "1.1": + if Version(self.dependencies["openssl"].ref.version) >= "1.1": crypto_symbols.extend([ "HMAC_CTX_new", "HMAC_CTX_free", "HMAC_CTX_reset", ]) diff --git a/recipes/aws-c-cal/all/patches/0001-use-openssl-cmake-imported-target.cmake b/recipes/aws-c-cal/all/patches/0001-use-openssl-cmake-imported-target.patch similarity index 100% rename from recipes/aws-c-cal/all/patches/0001-use-openssl-cmake-imported-target.cmake rename to recipes/aws-c-cal/all/patches/0001-use-openssl-cmake-imported-target.patch diff --git a/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.11.patch b/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.11.patch new file mode 100644 index 0000000000000..3de09bddfa119 --- /dev/null +++ b/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.11.patch @@ -0,0 +1,26 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -76,7 +76,12 @@ elseif (APPLE) + message(FATAL_ERROR "Security Framework not found") + endif () + +- list(APPEND PLATFORM_LIBS "-framework Security") ++ find_library(COREFOUNDATION_LIB CoreFoundation) ++ if(NOT COREFOUNDATION_LIB) ++ message(FATAL_ERROR "CoreFoundation Framework not found") ++ endif() ++ ++ list(APPEND PLATFORM_LIBS "-framework Security -framework CoreFoundation") + endif() + else () + if (NOT BYO_CRYPTO) +--- a/source/darwin/securityframework_ecc.c ++++ b/source/darwin/securityframework_ecc.c +@@ -7,6 +7,7 @@ + #include + #include + ++#include + #include + #include + diff --git a/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.13.patch b/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.13.patch new file mode 100644 index 0000000000000..422624b80de7e --- /dev/null +++ b/recipes/aws-c-cal/all/patches/0002-apple-corefoundation-0.5.13.patch @@ -0,0 +1,26 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -78,7 +78,12 @@ elseif (APPLE) + message(FATAL_ERROR "Security Framework not found") + endif () + +- list(APPEND PLATFORM_LIBS "-framework Security") ++ find_library(COREFOUNDATION_LIB CoreFoundation) ++ if(NOT COREFOUNDATION_LIB) ++ message(FATAL_ERROR "CoreFoundation Framework not found") ++ endif() ++ ++ list(APPEND PLATFORM_LIBS "-framework Security -framework CoreFoundation") + endif() + else () + if (NOT BYO_CRYPTO) +--- a/source/darwin/securityframework_ecc.c ++++ b/source/darwin/securityframework_ecc.c +@@ -7,6 +7,7 @@ + #include + #include + ++#include + #include + #include + diff --git a/recipes/aws-c-cal/all/test_package/CMakeLists.txt b/recipes/aws-c-cal/all/test_package/CMakeLists.txt index 975ded3bef12d..7ed07f4d9b8e6 100644 --- a/recipes/aws-c-cal/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-cal/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-cal REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-cal) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-cal) diff --git a/recipes/aws-c-cal/all/test_package/conanfile.py b/recipes/aws-c-cal/all/test_package/conanfile.py index 2862c460d7754..1b3c18ef08ac1 100644 --- a/recipes/aws-c-cal/all/test_package/conanfile.py +++ b/recipes/aws-c-cal/all/test_package/conanfile.py @@ -1,10 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os import io + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,10 +22,10 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): stream = io.StringIO() - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True, output=stream) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun", output=stream) self.output.info(stream.getvalue()) if self.deps_user_info["aws-c-cal"].with_openssl == "True": assert "found static libcrypto" in stream.getvalue() diff --git a/recipes/aws-c-cal/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-cal/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8a88842ed46e6 --- /dev/null +++ b/recipes/aws-c-cal/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-cal REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-cal) diff --git a/recipes/aws-c-cal/all/test_v1_package/conanfile.py b/recipes/aws-c-cal/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ff0f4e1acbd6f --- /dev/null +++ b/recipes/aws-c-cal/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conans import ConanFile, CMake, tools +import os +import io + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + stream = io.StringIO() + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True, output=stream) + self.output.info(stream.getvalue()) + if self.deps_user_info["aws-c-cal"].with_openssl == "True": + assert "found static libcrypto" in stream.getvalue() diff --git a/recipes/aws-c-cal/config.yml b/recipes/aws-c-cal/config.yml index e742c8041e410..f969df4acc583 100644 --- a/recipes/aws-c-cal/config.yml +++ b/recipes/aws-c-cal/config.yml @@ -1,4 +1,8 @@ versions: + "0.5.20": + folder: all + "0.5.19": + folder: all "0.5.17": folder: all "0.5.13": diff --git a/recipes/aws-c-common/all/conandata.yml b/recipes/aws-c-common/all/conandata.yml index 26e66ad5a8e95..773702bbe2c98 100644 --- a/recipes/aws-c-common/all/conandata.yml +++ b/recipes/aws-c-common/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.8.2": + url: "https://github.com/awslabs/aws-c-common/archive/v0.8.2.tar.gz" + sha256: "36edc6e486c43bbb34059dde227e872c0d41ab54f0b3609d38f188cfbbc6d1f8" "0.7.5": url: "https://github.com/awslabs/aws-c-common/archive/v0.7.5.tar.gz" sha256: "e34fd3d3d32e3597f572205aaabbe995e162f4015e14c7328987b596bd25812c" diff --git a/recipes/aws-c-common/all/conanfile.py b/recipes/aws-c-common/all/conanfile.py index 53aa924766140..22976c3d4e8f5 100644 --- a/recipes/aws-c-common/all/conanfile.py +++ b/recipes/aws-c-common/all/conanfile.py @@ -2,12 +2,12 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class AwsCCommon(ConanFile): @@ -19,8 +19,9 @@ class AwsCCommon(ConanFile): topics = ("aws", "amazon", "cloud", ) url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-common" - license = "Apache-2.0", + license = "Apache-2.0" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,8 +35,7 @@ class AwsCCommon(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,26 +45,19 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass - - def validate(self): - if self.info.options.shared and is_msvc(self) and is_msvc_static_runtime(self): - raise ConanInvalidConfiguration("Static runtime + shared is not working for more recent releases") + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("Static runtime + shared is not working for more recent releases") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/aws-c-common/all/test_package/conanfile.py b/recipes/aws-c-common/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/aws-c-common/all/test_package/conanfile.py +++ b/recipes/aws-c-common/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/aws-c-common/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-common/all/test_v1_package/CMakeLists.txt index 089f7544e3394..0d20897301b68 100644 --- a/recipes/aws-c-common/all/test_v1_package/CMakeLists.txt +++ b/recipes/aws-c-common/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(aws-c-common REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-common) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/aws-c-common/config.yml b/recipes/aws-c-common/config.yml index 6664f0d33a038..5a8e794412c2f 100644 --- a/recipes/aws-c-common/config.yml +++ b/recipes/aws-c-common/config.yml @@ -1,4 +1,6 @@ versions: + "0.8.2": + folder: all "0.7.5": folder: all "0.7.4": diff --git a/recipes/aws-c-compression/all/CMakeLists.txt b/recipes/aws-c-compression/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-compression/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-compression/all/conandata.yml b/recipes/aws-c-compression/all/conandata.yml index e91acbde59dd4..1baf0be5b106a 100644 --- a/recipes/aws-c-compression/all/conandata.yml +++ b/recipes/aws-c-compression/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.2.15": + url: "https://github.com/awslabs/aws-c-compression/archive/v0.2.15.tar.gz" + sha256: "11d58a229e2961b2b36493155a981dea2c8a0bc0d113b0073deb8c3189cfa04e" "0.2.14": url: "https://github.com/awslabs/aws-c-compression/archive/v0.2.14.tar.gz" sha256: "8737863ced57d92f5a0bdde554bf0fe70eaa76aae118fec09a6c361dfc55d0d5" diff --git a/recipes/aws-c-compression/all/conanfile.py b/recipes/aws-c-compression/all/conanfile.py index ad431bea82df0..635a3e71fc9b4 100644 --- a/recipes/aws-c-compression/all/conanfile.py +++ b/recipes/aws-c-compression/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.47.0" class AwsCCompression(ConanFile): @@ -22,48 +24,52 @@ class AwsCCompression(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") + self.requires("aws-c-common/0.8.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-compression")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-compression")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-compression") diff --git a/recipes/aws-c-compression/all/test_package/CMakeLists.txt b/recipes/aws-c-compression/all/test_package/CMakeLists.txt index 915167add7ecd..8efb2e9b0efa5 100644 --- a/recipes/aws-c-compression/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-compression/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-compression REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-compression) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-compression) diff --git a/recipes/aws-c-compression/all/test_package/conanfile.py b/recipes/aws-c-compression/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/aws-c-compression/all/test_package/conanfile.py +++ b/recipes/aws-c-compression/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-compression/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-compression/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..e3ad5964d2a88 --- /dev/null +++ b/recipes/aws-c-compression/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-compression REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-compression) diff --git a/recipes/aws-c-compression/all/test_v1_package/conanfile.py b/recipes/aws-c-compression/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/aws-c-compression/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-c-compression/config.yml b/recipes/aws-c-compression/config.yml index 05d0149941499..5a381bb0e6674 100644 --- a/recipes/aws-c-compression/config.yml +++ b/recipes/aws-c-compression/config.yml @@ -1,4 +1,6 @@ versions: + "0.2.15": + folder: all "0.2.14": folder: all "0.2.13": diff --git a/recipes/aws-c-event-stream/all/CMakeLists.txt b/recipes/aws-c-event-stream/all/CMakeLists.txt deleted file mode 100644 index 969e73de12b57..0000000000000 --- a/recipes/aws-c-event-stream/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-event-stream/all/conandata.yml b/recipes/aws-c-event-stream/all/conandata.yml index 494754a3729b1..61428e916296b 100644 --- a/recipes/aws-c-event-stream/all/conandata.yml +++ b/recipes/aws-c-event-stream/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.2.15": + url: "https://github.com/awslabs/aws-c-event-stream/archive/v0.2.15.tar.gz" + sha256: "4ff2ada07ede3c6afa4b8e6e20de541e717038307f29b38c27efa7c4d875ee26" "0.2.12": url: "https://github.com/awslabs/aws-c-event-stream/archive/v0.2.12.tar.gz" sha256: "cc4ebfe715d8df5b9e3f4a3ce9b67d5f480017a7ebbbfa1d5e64ea53ec672580" @@ -13,7 +16,5 @@ sources: sha256: "f1b423a487b5d6dca118bfc0d0c6cc596dc476b282258a3228e73a8f730422d4" patches: "0.1.5": - - base_path: "source_subfolder" - patch_file: "patches/0001-disable-tests-bin.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-use-PROJECT_SOURCE_DIR.patch" + - patch_file: "patches/0001-disable-tests-bin.patch" + - patch_file: "patches/0002-use-PROJECT_SOURCE_DIR.patch" diff --git a/recipes/aws-c-event-stream/all/conanfile.py b/recipes/aws-c-event-stream/all/conanfile.py index 08ef8038f7003..25bb2fd989f0a 100644 --- a/recipes/aws-c-event-stream/all/conanfile.py +++ b/recipes/aws-c-event-stream/all/conanfile.py @@ -1,18 +1,18 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.52.0" class AwsCEventStream(ConanFile): name = "aws-c-event-stream" description = "C99 implementation of the vnd.amazon.eventstream content-type" - topics = ("aws", "eventstream", "content", ) + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-event-stream" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt", "aws_eventstream_target.cmake", "patches/*" - generators = "cmake", "cmake_find_package" + topics = ("aws", "eventstream", "content", ) settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,11 +23,8 @@ class AwsCEventStream(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,52 +32,69 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-checksums/0.1.12") - self.requires("aws-c-common/0.6.19") - if tools.Version(self.version) >= "0.2": - self.requires("aws-c-io/0.11.2") + self.requires("aws-checksums/0.1.13") + self.requires("aws-c-common/0.8.2") + if Version(self.version) >= "0.2": + if Version(self.version) < "0.2.11": + self.requires("aws-c-io/0.10.20") + else: + self.requires("aws-c-io/0.13.4") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_BINARIES"] = False + tc.variables["BUILD_TESTING"] = False + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_BINARIES"] = False - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-event-stream")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-event-stream")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-event-stream") self.cpp_info.set_property("cmake_target_name", "AWS::aws-c-event-stream") - self.cpp_info.filenames["cmake_find_package"] = "aws-c-event-stream" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-event-stream" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" self.cpp_info.components["aws-c-event-stream-lib"].names["cmake_find_package"] = "aws-c-event-stream" self.cpp_info.components["aws-c-event-stream-lib"].names["cmake_find_package_multi"] = "aws-c-event-stream" self.cpp_info.components["aws-c-event-stream-lib"].libs = ["aws-c-event-stream"] self.cpp_info.components["aws-c-event-stream-lib"].requires = ["aws-c-common::aws-c-common-lib", "aws-checksums::aws-checksums"] - if tools.Version(self.version) >= "0.2": + if Version(self.version) >= "0.2": self.cpp_info.components["aws-c-event-stream-lib"].requires.append("aws-c-io::aws-c-io-lib") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "aws-c-event-stream" + self.cpp_info.filenames["cmake_find_package_multi"] = "aws-c-event-stream" + self.cpp_info.names["cmake_find_package"] = "AWS" + self.cpp_info.names["cmake_find_package_multi"] = "AWS" diff --git a/recipes/aws-c-event-stream/all/test_package/CMakeLists.txt b/recipes/aws-c-event-stream/all/test_package/CMakeLists.txt index 360ccf8545330..05cae5027e20e 100644 --- a/recipes/aws-c-event-stream/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-event-stream/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-event-stream REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-event-stream) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-event-stream) diff --git a/recipes/aws-c-event-stream/all/test_package/conanfile.py b/recipes/aws-c-event-stream/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-c-event-stream/all/test_package/conanfile.py +++ b/recipes/aws-c-event-stream/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-event-stream/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-event-stream/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..674dc4a319004 --- /dev/null +++ b/recipes/aws-c-event-stream/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-event-stream REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-event-stream) diff --git a/recipes/aws-c-event-stream/all/test_v1_package/conanfile.py b/recipes/aws-c-event-stream/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/aws-c-event-stream/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-c-event-stream/config.yml b/recipes/aws-c-event-stream/config.yml index a93345494d8de..96ac653286f12 100644 --- a/recipes/aws-c-event-stream/config.yml +++ b/recipes/aws-c-event-stream/config.yml @@ -1,9 +1,11 @@ versions: + "0.2.15": + folder: all "0.2.12": folder: all "0.2.11": folder: all - 0.2.7: + "0.2.7": folder: all - 0.1.5: + "0.1.5": folder: all diff --git a/recipes/aws-c-http/all/CMakeLists.txt b/recipes/aws-c-http/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-http/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-http/all/conandata.yml b/recipes/aws-c-http/all/conandata.yml index 87f7955d95d07..09a36b1a86c13 100644 --- a/recipes/aws-c-http/all/conandata.yml +++ b/recipes/aws-c-http/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.6.22": + url: "https://github.com/awslabs/aws-c-http/archive/v0.6.22.tar.gz" + sha256: "a178fd04bd1618469cd21afc5b84cbe436d1f9d9e036fefbd3a8f00356da4d4c" "0.6.13": url: "https://github.com/awslabs/aws-c-http/archive/v0.6.13.tar.gz" sha256: "8c69f8fc58b7073039e598383da3e1fd9b23f392cb992dbe769a7b80f342dbaf" diff --git a/recipes/aws-c-http/all/conanfile.py b/recipes/aws-c-http/all/conanfile.py index 6e56f19ff07d9..5f4b5242c4dbe 100644 --- a/recipes/aws-c-http/all/conanfile.py +++ b/recipes/aws-c-http/all/conanfile.py @@ -1,17 +1,18 @@ +from conan import ConanFile +from conan.tools.scm import Version +from conan.tools.files import get, copy, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.47.0" class AwsCHttp(ConanFile): name = "aws-c-http" description = "C99 implementation of the HTTP/1.1 and HTTP/2 specifications" - topics = ("aws", "amazon", "cloud", "http", "http2", ) + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-http" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" + topics = ("aws", "amazon", "cloud", "http", "http2", ) settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,48 +23,58 @@ class AwsCHttp(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") - self.requires("aws-c-compression/0.2.14") - self.requires("aws-c-io/0.10.20") + self.requires("aws-c-common/0.8.2") + self.requires("aws-c-compression/0.2.15") + if Version(self.version) < "0.6.22": + self.requires("aws-c-io/0.10.20") + else: + self.requires("aws-c-io/0.13.4") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-http")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-http")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-http") diff --git a/recipes/aws-c-http/all/test_package/CMakeLists.txt b/recipes/aws-c-http/all/test_package/CMakeLists.txt index 7b2b79320df60..94387e3cbcded 100644 --- a/recipes/aws-c-http/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-http/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-http REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-http) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-http) diff --git a/recipes/aws-c-http/all/test_package/conanfile.py b/recipes/aws-c-http/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-c-http/all/test_package/conanfile.py +++ b/recipes/aws-c-http/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-http/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-http/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b3195e120b0b2 --- /dev/null +++ b/recipes/aws-c-http/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-http REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-http) diff --git a/recipes/aws-c-http/all/test_v1_package/conanfile.py b/recipes/aws-c-http/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/aws-c-http/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-c-http/config.yml b/recipes/aws-c-http/config.yml index ac476c864a916..ab4b9f0488086 100644 --- a/recipes/aws-c-http/config.yml +++ b/recipes/aws-c-http/config.yml @@ -1,4 +1,6 @@ versions: + "0.6.22": + folder: all "0.6.13": folder: all "0.6.10": diff --git a/recipes/aws-c-io/all/CMakeLists.txt b/recipes/aws-c-io/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-io/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-io/all/conandata.yml b/recipes/aws-c-io/all/conandata.yml index 9893bcceca8e0..4a9102a6ede26 100644 --- a/recipes/aws-c-io/all/conandata.yml +++ b/recipes/aws-c-io/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.13.4": + url: "https://github.com/awslabs/aws-c-io/archive/v0.13.4.tar.gz" + sha256: "133bd0aa46caa2041962cd4f6d076209686ce2934af82f86d1a258df4cbdce8b" "0.11.2": url: "https://github.com/awslabs/aws-c-io/archive/v0.11.2.tar.gz" sha256: "b60270d23b6e2f4a5d80e64ca6538ba114cd6044b53752964c940f87e59bf0d9" diff --git a/recipes/aws-c-io/all/conanfile.py b/recipes/aws-c-io/all/conanfile.py index a460634d03107..84b513c37e69f 100644 --- a/recipes/aws-c-io/all/conanfile.py +++ b/recipes/aws-c-io/all/conanfile.py @@ -1,17 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.52.0" class AwsCIO(ConanFile): name = "aws-c-io" description = "IO and TLS for application protocols" - topics = ("aws", "amazon", "cloud", "io", "tls",) + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-io" - license = "Apache-2.0", - + topics = ("aws", "amazon", "cloud", "io", "tls",) settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,58 +23,63 @@ class AwsCIO(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): # the versions of aws-c-common and aws-c-io are tied since aws-c-common/0.6.12 and aws-c-io/0.10.10 # Please refer https://github.com/conan-io/conan-center-index/issues/7763 - if tools.Version(self.version) <= "0.10.9": + if Version(self.version) <= "0.10.9": self.requires("aws-c-common/0.6.11") self.requires("aws-c-cal/0.5.11") else: - self.requires("aws-c-common/0.6.19") + self.requires("aws-c-common/0.8.2") self.requires("aws-c-cal/0.5.13") if self.settings.os in ["Linux", "FreeBSD", "Android"]: - self.requires("s2n/1.3.9") + self.requires("s2n/1.3.15") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-io")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-io")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-io") diff --git a/recipes/aws-c-io/all/test_package/CMakeLists.txt b/recipes/aws-c-io/all/test_package/CMakeLists.txt index 819bf242a1b07..de3176cc25055 100644 --- a/recipes/aws-c-io/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-io/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-io REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/aws-c-io/all/test_package/conanfile.py b/recipes/aws-c-io/all/test_package/conanfile.py index 38f4483872d47..a9fbb7f543162 100644 --- a/recipes/aws-c-io/all/test_package/conanfile.py +++ b/recipes/aws-c-io/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-io/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-io/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..e45dc2bc298c6 --- /dev/null +++ b/recipes/aws-c-io/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-io REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} AWS::aws-c-io) diff --git a/recipes/aws-c-io/all/test_v1_package/conanfile.py b/recipes/aws-c-io/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/aws-c-io/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-c-io/config.yml b/recipes/aws-c-io/config.yml index 5fac743e25830..6dca88e3f0554 100644 --- a/recipes/aws-c-io/config.yml +++ b/recipes/aws-c-io/config.yml @@ -1,4 +1,6 @@ versions: + "0.13.4": + folder: all "0.11.2": folder: all "0.10.20": diff --git a/recipes/aws-c-mqtt/all/CMakeLists.txt b/recipes/aws-c-mqtt/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-mqtt/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-mqtt/all/conandata.yml b/recipes/aws-c-mqtt/all/conandata.yml index 22b006adcd3d9..6240cf10ee0f5 100644 --- a/recipes/aws-c-mqtt/all/conandata.yml +++ b/recipes/aws-c-mqtt/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.7.12": + url: "https://github.com/awslabs/aws-c-mqtt/archive/v0.7.12.tar.gz" + sha256: "cf80f1b4f37aa8a6b8698315fae32cbf2bd944b67784f07b5762f392f18e64df" "0.7.10": url: "https://github.com/awslabs/aws-c-mqtt/archive/v0.7.10.tar.gz" sha256: "95667477e17bc99d49a1d6674d7fb98f9a0379b6966cb2ed4863152e959d9e8f" diff --git a/recipes/aws-c-mqtt/all/conanfile.py b/recipes/aws-c-mqtt/all/conanfile.py index 1e0ca9593f67c..4edb02ac94d9f 100644 --- a/recipes/aws-c-mqtt/all/conanfile.py +++ b/recipes/aws-c-mqtt/all/conanfile.py @@ -1,18 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.47.0" class AwsCMQTT(ConanFile): name = "aws-c-mqtt" description = "C99 implementation of the MQTT 3.1.1 specification." - topics = ("aws", "amazon", "cloud", "mqtt") + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-mqtt" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" + topics = ("aws", "amazon", "cloud", "mqtt") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,49 +25,59 @@ class AwsCMQTT(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass def requirements(self): - self.requires("aws-c-common/0.6.19") + self.requires("aws-c-common/0.8.2") self.requires("aws-c-cal/0.5.13") - self.requires("aws-c-io/0.10.20") - self.requires("aws-c-http/0.6.13") + if Version(self.version) < "0.7.12": + self.requires("aws-c-io/0.10.20") + self.requires("aws-c-http/0.6.13") + else: + self.requires("aws-c-io/0.13.4") + self.requires("aws-c-http/0.6.22") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-mqtt")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-mqtt")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-mqtt") diff --git a/recipes/aws-c-mqtt/all/test_package/CMakeLists.txt b/recipes/aws-c-mqtt/all/test_package/CMakeLists.txt index 721080a47fbac..04c8de77ba626 100644 --- a/recipes/aws-c-mqtt/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-mqtt/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-mqtt REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-mqtt) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-mqtt) diff --git a/recipes/aws-c-mqtt/all/test_package/conanfile.py b/recipes/aws-c-mqtt/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-c-mqtt/all/test_package/conanfile.py +++ b/recipes/aws-c-mqtt/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-mqtt/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-mqtt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..610e2350e6503 --- /dev/null +++ b/recipes/aws-c-mqtt/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-mqtt REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-mqtt) diff --git a/recipes/aws-c-mqtt/all/test_v1_package/conanfile.py b/recipes/aws-c-mqtt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/aws-c-mqtt/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-c-mqtt/config.yml b/recipes/aws-c-mqtt/config.yml index 92ca5ab76486c..edbab7e67d700 100644 --- a/recipes/aws-c-mqtt/config.yml +++ b/recipes/aws-c-mqtt/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.12": + folder: all "0.7.10": folder: all "0.7.9": diff --git a/recipes/aws-c-s3/all/CMakeLists.txt b/recipes/aws-c-s3/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-s3/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-s3/all/conandata.yml b/recipes/aws-c-s3/all/conandata.yml index 4daad0a6b73cc..af6e82a742aa6 100644 --- a/recipes/aws-c-s3/all/conandata.yml +++ b/recipes/aws-c-s3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.49": + url: "https://github.com/awslabs/aws-c-s3/archive/v0.1.49.tar.gz" + sha256: "71acbba41a02477a6c352172da561bc2138bf239b936490c773d7aaa83afc9ab" "0.1.37": url: "https://github.com/awslabs/aws-c-s3/archive/v0.1.37.tar.gz" sha256: "2c35100c1739300e438d47f49aaa2c374001416a79fe3c6f27d79371fb2ac90b" diff --git a/recipes/aws-c-s3/all/conanfile.py b/recipes/aws-c-s3/all/conanfile.py index 59a016d054869..131627214ba79 100644 --- a/recipes/aws-c-s3/all/conanfile.py +++ b/recipes/aws-c-s3/all/conanfile.py @@ -1,18 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.47.0" class AwsCS3(ConanFile): name = "aws-c-s3" description = "C99 implementation of the S3 client" - topics = ("aws", "amazon", "cloud", "s3") + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-s3" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" + topics = ("aws", "amazon", "cloud", "s3") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,51 +23,62 @@ class AwsCS3(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") - self.requires("aws-c-io/0.10.20") - self.requires("aws-c-http/0.6.13") - self.requires("aws-c-auth/0.6.11") - if tools.Version(self.version) >= "0.1.36": - self.requires("aws-checksums/0.1.12") + self.requires("aws-c-common/0.8.2") + if Version(self.version) < "0.1.49": + self.requires("aws-c-io/0.10.20") + self.requires("aws-c-http/0.6.13") + self.requires("aws-c-auth/0.6.11") + else: + self.requires("aws-c-io/0.13.4") + self.requires("aws-c-http/0.6.22") + self.requires("aws-c-auth/0.6.17") + if Version(self.version) >= "0.1.36": + self.requires("aws-checksums/0.1.13") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-s3")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-s3")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-s3") @@ -88,5 +99,5 @@ def package_info(self): "aws-c-http::aws-c-http-lib", "aws-c-auth::aws-c-auth-lib" ] - if tools.Version(self.version) >= "0.1.36": + if Version(self.version) >= "0.1.36": self.cpp_info.components["aws-c-s3-lib"].requires.append("aws-checksums::aws-checksums-lib") diff --git a/recipes/aws-c-s3/all/test_package/CMakeLists.txt b/recipes/aws-c-s3/all/test_package/CMakeLists.txt index 4af87d8f6333f..8e0fdd1abc04c 100644 --- a/recipes/aws-c-s3/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-s3/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-s3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-c-s3) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-s3) diff --git a/recipes/aws-c-s3/all/test_package/conanfile.py b/recipes/aws-c-s3/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-c-s3/all/test_package/conanfile.py +++ b/recipes/aws-c-s3/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-s3/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-s3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0778b2e2c7246 --- /dev/null +++ b/recipes/aws-c-s3/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-s3 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-c-s3) diff --git a/recipes/aws-c-s3/all/test_v1_package/conanfile.py b/recipes/aws-c-s3/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/aws-c-s3/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-c-s3/config.yml b/recipes/aws-c-s3/config.yml index 86679f6500b25..182095498622b 100644 --- a/recipes/aws-c-s3/config.yml +++ b/recipes/aws-c-s3/config.yml @@ -1,4 +1,6 @@ versions: + "0.1.49": + folder: all "0.1.37": folder: all "0.1.29": diff --git a/recipes/aws-c-sdkutils/all/CMakeLists.txt b/recipes/aws-c-sdkutils/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-c-sdkutils/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-c-sdkutils/all/conandata.yml b/recipes/aws-c-sdkutils/all/conandata.yml index a2d7aa973057e..7ec4906cf9a7f 100644 --- a/recipes/aws-c-sdkutils/all/conandata.yml +++ b/recipes/aws-c-sdkutils/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.3": + url: "https://github.com/awslabs/aws-c-sdkutils/archive/v0.1.3.tar.gz" + sha256: "13d99c0877424a8fad40f312762968012dd54ec60a4438fb601ee65ff8b2484b" "0.1.2": url: "https://github.com/awslabs/aws-c-sdkutils/archive/refs/tags/v0.1.2.tar.gz" sha256: "d654670c145212ed3ce0699a988b9f83ebf3e7c44ed74d4d0772dc95ad46b38e" diff --git a/recipes/aws-c-sdkutils/all/conanfile.py b/recipes/aws-c-sdkutils/all/conanfile.py index 37509472eb1f5..43b3b4f755411 100644 --- a/recipes/aws-c-sdkutils/all/conanfile.py +++ b/recipes/aws-c-sdkutils/all/conanfile.py @@ -1,18 +1,17 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.52.0" class AwsCSDKUtils(ConanFile): name = "aws-c-sdkutils" - description = "aws c language sdk utility library." - topics = ("aws", "amazon", "cloud", "utility") + description = "C99 library implementing AWS SDK specific utilities. Includes utilities for ARN parsing, reading AWS profiles, etc..." + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-c-sdkutils" - license = "Apache-2.0", - exports_sources = "CMakeLists.txt", - generators = "cmake", "cmake_find_package_multi" + topics = ("aws", "amazon", "cloud", "utility", "ARN") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,45 +22,52 @@ class AwsCSDKUtils(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") + self.requires("aws-c-common/0.8.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-c-sdkutils")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-c-sdkutils")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-c-sdkutils") @@ -77,4 +83,3 @@ def package_info(self): self.cpp_info.components["aws-c-sdkutils-lib"].libs = ["aws-c-sdkutils"] self.cpp_info.components["aws-c-sdkutils-lib"].requires = ["aws-c-common::aws-c-common-lib"] - diff --git a/recipes/aws-c-sdkutils/all/test_package/CMakeLists.txt b/recipes/aws-c-sdkutils/all/test_package/CMakeLists.txt index 61121c6334930..4b5efc665c153 100644 --- a/recipes/aws-c-sdkutils/all/test_package/CMakeLists.txt +++ b/recipes/aws-c-sdkutils/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-c-sdkutils REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/aws-c-sdkutils/all/test_package/conanfile.py b/recipes/aws-c-sdkutils/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-c-sdkutils/all/test_package/conanfile.py +++ b/recipes/aws-c-sdkutils/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-c-sdkutils/all/test_v1_package/CMakeLists.txt b/recipes/aws-c-sdkutils/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..6e620de3b4bc3 --- /dev/null +++ b/recipes/aws-c-sdkutils/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-c-sdkutils REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} AWS::aws-c-sdkutils) diff --git a/recipes/aws-c-sdkutils/all/test_v1_package/conanfile.py b/recipes/aws-c-sdkutils/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/aws-c-sdkutils/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-c-sdkutils/config.yml b/recipes/aws-c-sdkutils/config.yml index eb8addc0ca6d3..b2ced6f0d7ab7 100644 --- a/recipes/aws-c-sdkutils/config.yml +++ b/recipes/aws-c-sdkutils/config.yml @@ -1,4 +1,6 @@ versions: + "0.1.3": + folder: all "0.1.2": folder: all "0.1.1": diff --git a/recipes/aws-checksums/all/CMakeLists.txt b/recipes/aws-checksums/all/CMakeLists.txt deleted file mode 100644 index fe3c5e109c923..0000000000000 --- a/recipes/aws-checksums/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-checksums/all/conandata.yml b/recipes/aws-checksums/all/conandata.yml index 88de28be65063..ddf66e3fcf5ae 100644 --- a/recipes/aws-checksums/all/conandata.yml +++ b/recipes/aws-checksums/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.13": + url: "https://github.com/awslabs/aws-checksums/archive/v0.1.13.tar.gz" + sha256: "0f897686f1963253c5069a0e495b85c31635ba146cd3ac38cc2ea31eaf54694d" "0.1.12": url: "https://github.com/awslabs/aws-checksums/archive/v0.1.12.tar.gz" sha256: "394723034b81cc7cd528401775bc7aca2b12c7471c92350c80a0e2fb9d2909fe" @@ -10,9 +13,6 @@ sources: sha256: "6e6bed6f75cf54006b6bafb01b3b96df19605572131a2260fddaf0e87949ced0" patches: "0.1.5": - - base_path: "source_subfolder" - patch_file: "patches/0001-use-PROJECT_SOURCE_DIR.cmake" - - base_path: "source_subfolder" - patch_file: "patches/0002-disable-overriding-fPIC.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-disable-building-tests.patch" + - patch_file: "patches/0001-use-PROJECT_SOURCE_DIR.patch" + - patch_file: "patches/0002-disable-overriding-fPIC.patch" + - patch_file: "patches/0003-disable-building-tests.patch" diff --git a/recipes/aws-checksums/all/conanfile.py b/recipes/aws-checksums/all/conanfile.py index 0cc74755103d4..d3412c3a07b16 100644 --- a/recipes/aws-checksums/all/conanfile.py +++ b/recipes/aws-checksums/all/conanfile.py @@ -1,8 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.52.0" class AwsChecksums(ConanFile): name = "aws-checksums" @@ -10,11 +11,10 @@ class AwsChecksums(ConanFile): "Cross-Platform HW accelerated CRC32c and CRC32 with fallback to efficient " "SW implementations. C interface with language bindings for each of our SDKs." ) - topics = ("aws", "checksum", ) + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-checksums" - license = "Apache-2.0", - + topics = ("aws", "checksum", ) settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,17 +25,8 @@ class AwsChecksums(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,37 +34,47 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-common/0.6.19") + self.requires("aws-c-common/0.8.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-checksums")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-checksums")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-checksums") diff --git a/recipes/aws-checksums/all/patches/0001-use-PROJECT_SOURCE_DIR.cmake b/recipes/aws-checksums/all/patches/0001-use-PROJECT_SOURCE_DIR.patch similarity index 100% rename from recipes/aws-checksums/all/patches/0001-use-PROJECT_SOURCE_DIR.cmake rename to recipes/aws-checksums/all/patches/0001-use-PROJECT_SOURCE_DIR.patch diff --git a/recipes/aws-checksums/all/test_package/CMakeLists.txt b/recipes/aws-checksums/all/test_package/CMakeLists.txt index 5032e04785efc..9922744f24e3f 100644 --- a/recipes/aws-checksums/all/test_package/CMakeLists.txt +++ b/recipes/aws-checksums/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(aws-checksums REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} AWS::aws-checksums) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-checksums) diff --git a/recipes/aws-checksums/all/test_package/conanfile.py b/recipes/aws-checksums/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/aws-checksums/all/test_package/conanfile.py +++ b/recipes/aws-checksums/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-checksums/all/test_v1_package/CMakeLists.txt b/recipes/aws-checksums/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..915af9f83a60f --- /dev/null +++ b/recipes/aws-checksums/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-checksums REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-checksums) diff --git a/recipes/aws-checksums/all/test_v1_package/conanfile.py b/recipes/aws-checksums/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/aws-checksums/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-checksums/config.yml b/recipes/aws-checksums/config.yml index 9f54b2f6052e0..55fedf4c307f5 100644 --- a/recipes/aws-checksums/config.yml +++ b/recipes/aws-checksums/config.yml @@ -1,4 +1,6 @@ versions: + "0.1.13": + folder: all "0.1.12": folder: all "0.1.11": diff --git a/recipes/aws-crt-cpp/all/CMakeLists.txt b/recipes/aws-crt-cpp/all/CMakeLists.txt deleted file mode 100644 index 38522bd23de5d..0000000000000 --- a/recipes/aws-crt-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/aws-crt-cpp/all/conandata.yml b/recipes/aws-crt-cpp/all/conandata.yml index 723445d104dfe..5615e65f10a0b 100644 --- a/recipes/aws-crt-cpp/all/conandata.yml +++ b/recipes/aws-crt-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.18.8": + url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.18.8.tar.gz" + sha256: "70ea622cf8c1a7028b24078e909ee5898990444436584178f58d61b50b5b197d" "0.17.23": url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.17.23.tar.gz" sha256: "28061c3efa493519cfae46e4ea96389f03a81eeec7613d7da861dd8c5f4f6598" @@ -9,9 +12,15 @@ sources: url: "https://github.com/awslabs/aws-crt-cpp/archive/v0.14.3.tar.gz" sha256: "3ea16c43e691bab0c373ba1ad072f6535390c516ebda658dfaf4d074d920e0fb" patches: + "0.18.8": + - patch_file: "patches/0.17.23-fix-cast-error.patch" + patch_description: "fix const cast error" + patch_type: "portability" "0.17.23": - - base_path: "source_subfolder" - patch_file: "patches/0.17.23-fix-cast-error.patch" + - patch_file: "patches/0.17.23-fix-cast-error.patch" + patch_description: "fix const cast error" + patch_type: "portability" "0.17.12": - - base_path: "source_subfolder" - patch_file: "patches/0.17.12-fix-cast-error.patch" + - patch_file: "patches/0.17.12-fix-cast-error.patch" + patch_description: "fix const cast error" + patch_type: "portability" diff --git a/recipes/aws-crt-cpp/all/conanfile.py b/recipes/aws-crt-cpp/all/conanfile.py index fb49c50bc21cd..c70a676efc102 100644 --- a/recipes/aws-crt-cpp/all/conanfile.py +++ b/recipes/aws-crt-cpp/all/conanfile.py @@ -1,16 +1,20 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class AwsCrtCpp(ConanFile): name = "aws-crt-cpp" description = "C++ wrapper around the aws-c-* libraries. Provides Cross-Platform Transport Protocols and SSL/TLS implementations for C++." - topics = ("aws", "amazon", "cloud", "wrapper") + license = "Apache-2.0", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/awslabs/aws-crt-cpp" - license = "Apache-2.0", - generators = "cmake", "cmake_find_package" + topics = ("aws", "amazon", "cloud", "wrapper") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,16 +25,12 @@ class AwsCrtCpp(ConanFile): "fPIC": True, } - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,55 +38,64 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("aws-c-event-stream/0.2.7") - self.requires("aws-c-common/0.6.19") - self.requires("aws-c-io/0.10.20") - self.requires("aws-c-http/0.6.13") - self.requires("aws-c-auth/0.6.11") - self.requires("aws-c-mqtt/0.7.10") - self.requires("aws-c-s3/0.1.37") - self.requires("aws-checksums/0.1.12") + self.requires("aws-c-common/0.8.2") + self.requires("aws-checksums/0.1.13") + if Version(self.version) < "0.17.29": + self.requires("aws-c-io/0.10.20") + self.requires("aws-c-http/0.6.13") + self.requires("aws-c-auth/0.6.11") + self.requires("aws-c-s3/0.1.37") + self.requires("aws-c-mqtt/0.7.10") + self.requires("aws-c-event-stream/0.2.7") + else: + self.requires("aws-c-io/0.13.4") + self.requires("aws-c-http/0.6.22") + self.requires("aws-c-auth/0.6.17") + self.requires("aws-c-s3/0.1.49") + self.requires("aws-c-mqtt/0.7.12") + self.requires("aws-c-event-stream/0.2.15") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["BUILD_DEPS"] = False - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_DEPS"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "aws-crt-cpp")) + rmdir(self, os.path.join(self.package_folder, "lib", "aws-crt-cpp")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "aws-crt-cpp") self.cpp_info.set_property("cmake_target_name", "AWS::aws-crt-cpp") - self.cpp_info.filenames["cmake_find_package"] = "aws-crt-cpp" - self.cpp_info.filenames["cmake_find_package_multi"] = "aws-crt-cpp" - self.cpp_info.names["cmake_find_package"] = "AWS" - self.cpp_info.names["cmake_find_package_multi"] = "AWS" self.cpp_info.components["aws-crt-cpp-lib"].names["cmake_find_package"] = "aws-crt-cpp" self.cpp_info.components["aws-crt-cpp-lib"].names["cmake_find_package_multi"] = "aws-crt-cpp" self.cpp_info.components["aws-crt-cpp-lib"].libs = ["aws-crt-cpp"] @@ -100,3 +109,9 @@ def package_info(self): "aws-c-s3::aws-c-s3-lib", "aws-checksums::aws-checksums-lib" ] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "aws-crt-cpp" + self.cpp_info.filenames["cmake_find_package_multi"] = "aws-crt-cpp" + self.cpp_info.names["cmake_find_package"] = "AWS" + self.cpp_info.names["cmake_find_package_multi"] = "AWS" diff --git a/recipes/aws-crt-cpp/all/test_package/CMakeLists.txt b/recipes/aws-crt-cpp/all/test_package/CMakeLists.txt index 74debee402ca9..50b34b056a787 100644 --- a/recipes/aws-crt-cpp/all/test_package/CMakeLists.txt +++ b/recipes/aws-crt-cpp/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(aws-crt-cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} AWS::aws-crt-cpp) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/aws-crt-cpp/all/test_package/conanfile.py b/recipes/aws-crt-cpp/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/aws-crt-cpp/all/test_package/conanfile.py +++ b/recipes/aws-crt-cpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt b/recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..31592420f8acc --- /dev/null +++ b/recipes/aws-crt-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(aws-crt-cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE AWS::aws-crt-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/aws-crt-cpp/all/test_v1_package/conanfile.py b/recipes/aws-crt-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/aws-crt-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/aws-crt-cpp/config.yml b/recipes/aws-crt-cpp/config.yml index cd074764fbd37..a2a8f6922a602 100644 --- a/recipes/aws-crt-cpp/config.yml +++ b/recipes/aws-crt-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "0.18.8": + folder: all "0.17.23": folder: all "0.17.12": diff --git a/recipes/b2/config.yml b/recipes/b2/config.yml index 2f1e9f4a5aa34..0c5e840b204a2 100644 --- a/recipes/b2/config.yml +++ b/recipes/b2/config.yml @@ -39,3 +39,7 @@ versions: folder: portable "4.9.2": folder: portable + "4.9.3": + folder: portable + "4.9.4": + folder: portable diff --git a/recipes/b2/portable/conandata.yml b/recipes/b2/portable/conandata.yml index 47fa26513a374..a0a9743d8c2eb 100644 --- a/recipes/b2/portable/conandata.yml +++ b/recipes/b2/portable/conandata.yml @@ -47,3 +47,9 @@ sources: "4.9.2": url: "https://github.com/bfgroup/b2/archive/4.9.2.tar.gz" sha256: "7e1a135b308999d2a65fce3eba8f4ffb41ca82ae133f8494cc42cbca63c890de" + "4.9.3": + url: "https://github.com/bfgroup/b2/archive/4.9.3.tar.gz" + sha256: "4524b8ecf138a9087aa24b8889c44ea7ae9f2d373acc9535d72fb048c213e1b9" + "4.9.4": + url: "https://github.com/bfgroup/b2/releases/download/4.9.4/b2-4.9.4.tar.bz2" + sha256: "1996d8098955ad3fdecab242d784afaef0fba80dd5d2ef0b3a41592e26772312" diff --git a/recipes/b2/portable/conanfile.py b/recipes/b2/portable/conanfile.py index 392152fe81384..2aa8a0ce8829e 100644 --- a/recipes/b2/portable/conanfile.py +++ b/recipes/b2/portable/conanfile.py @@ -1,19 +1,25 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.files import chdir, copy, get +from conan.tools.layout import basic_layout + +from contextlib import contextmanager import os +from io import StringIO -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class B2Conan(ConanFile): name = "b2" homepage = "https://www.bfgroup.xyz/b2/" description = "B2 makes it easy to build C++ projects, everywhere." - topics = ("b2", "installer", "builder", "build", "build-system") + topics = ("installer", "builder", "build", "build-system") license = "BSL-1.0" - settings = "os", "arch" url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch" ''' * use_cxx_env: False, True @@ -41,62 +47,125 @@ class B2Conan(ConanFile): 'acc', 'borland', 'clang', 'como', 'gcc-nocygwin', 'gcc', 'intel-darwin', 'intel-linux', 'intel-win32', 'kcc', 'kylix', 'mingw', 'mipspro', 'pathscale', 'pgi', 'qcc', 'sun', 'sunpro', - 'tru64cxx', 'vacpp', 'vc12', 'vc14', 'vc141', 'vc142', 'vc143'] + 'tru64cxx', 'vacpp', 'vc12', 'vc14', 'vc141', 'vc142', 'vc143', + ] } default_options = { 'use_cxx_env': False, 'toolset': 'auto' } + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + del self.info.options.use_cxx_env + del self.info.options.toolset + def validate(self): + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration(f"{self.ref} recipe doesn't support cross-build yet") + if (self.options.toolset == 'cxx' or self.options.toolset == 'cross-cxx') and not self.options.use_cxx_env: raise ConanInvalidConfiguration( "Option toolset 'cxx' and 'cross-cxx' requires 'use_cxx_env=True'") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination="source") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + @property + def _b2_dir(self): + return self.source_folder + + @property + def _b2_engine_dir(self): + return os.path.join(self._b2_dir, "src", "engine") + + @property + def _b2_output_dir(self): + return os.path.join(self.build_folder, "output") + + @property + def _pkg_bin_dir(self): + return os.path.join(self.package_folder, "bin") + + @contextmanager + def _bootstrap_env(self): + saved_env = dict(os.environ) + # Vcvars will change the directory after it runs in the situation when + # the user has previously run the VS command console inits. In that + # context it remembers the dir and resets it at each vcvars invocation. + os.environ.update({"VSCMD_START_DIR": os.getcwd()}) + if not self.options.use_cxx_env: + # To avoid using the CXX env vars we clear them out for the build. + os.environ.update({ + "CXX": "", + "CXXFLAGS": ""}) + try: + yield + finally: + os.environ.clear() + os.environ.update(saved_env) def build(self): + # The order of the with:with: below is important. The first one changes + # the current dir. While the second does env changes that guarantees + # that dir doesn't change if/when vsvars runs to set the msvc compile + # env. + self.output.info("Build engine..") + command = "" + b2_toolset = self.options.toolset use_windows_commands = os.name == 'nt' - command = "build" if use_windows_commands else "./build.sh" - if self.options.toolset != 'auto': - command += " "+str(self.options.toolset) - build_dir = os.path.join(self.source_folder, "source") - engine_dir = os.path.join(build_dir, "src", "engine") - os.chdir(engine_dir) - with tools.environment_append({"VSCMD_START_DIR": os.curdir}): - if self.options.use_cxx_env: - # Allow use of CXX env vars. + if b2_toolset == 'auto': + if use_windows_commands: + # For windows auto detection it can evaluate to a msvc version + # that it's not aware of. Most likely because it's a future one + # that didn't exist when the build was written. This turns that + # into a generic msvc toolset build assuming it could work, + # since it's a better version. + with chdir(self, self._b2_engine_dir): + with self._bootstrap_env(): + buf = StringIO() + self.run('guess_toolset && set', buf) + guess_vars = map( + lambda x: x.strip(), buf.getvalue().split("\n")) + if "B2_TOOLSET=vcunk" in guess_vars: + b2_toolset = 'msvc' + for kv in guess_vars: + if kv.startswith("B2_TOOLSET_ROOT="): + b2_vcvars = os.path.join( + kv.split('=')[1].strip(), 'Auxiliary', 'Build', 'vcvars32.bat') + command += '"'+b2_vcvars+'" && ' + command += "build" if use_windows_commands else "./build.sh" + if b2_toolset != 'auto': + command += " "+str(b2_toolset) + with chdir(self, self._b2_engine_dir): + with self._bootstrap_env(): self.run(command) - else: - # To avoid using the CXX env vars we clear them out for the build. - with tools.environment_append({"CXX": "", "CXXFLAGS": ""}): - self.run(command) - os.chdir(build_dir) + + self.output.info("Install..") command = os.path.join( - engine_dir, "b2.exe" if use_windows_commands else "b2") - # auto, cxx, and cross-cxx aren't toolsets in b2; they're only used to affect - # the way build.sh builds b2. Don't pass them to b2 itself. - if self.options.toolset not in ['auto', 'cxx', 'cross-cxx']: - command += " toolset=" + str(self.options.toolset) + self._b2_engine_dir, "b2.exe" if use_windows_commands else "b2") + if b2_toolset not in ["auto", "cxx", "cross-cxx"]: + command += " toolset=" + str(b2_toolset) full_command = \ - "{0} --ignore-site-config --prefix=../output --abbreviate-paths install b2-install-layout=portable".format( - command) - self.run(full_command) + (f"{command} --ignore-site-config " + + f"--prefix={self._b2_output_dir} " + + "--abbreviate-paths " + + "install " + + "b2-install-layout=portable") + with chdir(self, self._b2_dir): + self.run(full_command) def package(self): - self.copy("LICENSE.txt", dst="licenses", src="source") - self.copy(pattern="*b2", dst="bin", src="output") - self.copy(pattern="*b2.exe", dst="bin", src="output") - self.copy(pattern="*.jam", dst="bin", src="output") + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*b2", dst=self._pkg_bin_dir, src=self._b2_output_dir) + copy(self, "*b2.exe", dst=self._pkg_bin_dir, src=self._b2_output_dir) + copy(self, "*.jam", dst=self._pkg_bin_dir, src=self._b2_output_dir) def package_info(self): self.cpp_info.includedirs = [] - self.cpp_info.bindirs = ["bin"] - self.env_info.path = [os.path.join( - self.package_folder, "bin")] + self.cpp_info.libdirs = [] - def package_id(self): - del self.info.options.use_cxx_env - del self.info.options.toolset + # TODO: to remove in conan v2 + self.env_info.PATH.append(self._pkg_bin_dir) diff --git a/recipes/b2/portable/test_package/conanfile.py b/recipes/b2/portable/test_package/conanfile.py index 24d8a018c8f84..270c3bedc31a3 100644 --- a/recipes/b2/portable/test_package/conanfile.py +++ b/recipes/b2/portable/test_package/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools -import os +from conan import ConanFile -class TestPackgeConan(ConanFile): - settings = "os", "arch" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - self.run("b2 -v", run_environment=True) + self.run("b2 -v") diff --git a/recipes/b2/portable/test_v1_package/conanfile.py b/recipes/b2/portable/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..53ed1a9a77b8b --- /dev/null +++ b/recipes/b2/portable/test_v1_package/conanfile.py @@ -0,0 +1,8 @@ +from conan import ConanFile + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + self.run("b2 -v", run_environment=True) diff --git a/recipes/backward-cpp/all/CMakeLists.txt b/recipes/backward-cpp/all/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c35..0000000000000 --- a/recipes/backward-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/backward-cpp/all/conandata.yml b/recipes/backward-cpp/all/conandata.yml index c43a93e1b28a1..56d588551a507 100644 --- a/recipes/backward-cpp/all/conandata.yml +++ b/recipes/backward-cpp/all/conandata.yml @@ -11,23 +11,15 @@ sources: patches: "1.6": - patch_file: "patches/backward-cpp-1.5.patch" - base_path: "source_subfolder" "1.5": - patch_file: "patches/backward-cpp-1.5.patch" - base_path: "source_subfolder" - # https://github.com/bombela/backward-cpp/commit/74dd7d6733d1ab6b79994f4acbc1ad86ba950d23.patch - patch_file: "patches/backward-cpp-1.5-74dd7d6733d1ab6b79994f4acbc1ad86ba950d23.patch" - base_path: "source_subfolder" + patch_source: "https://github.com/bombela/backward-cpp/commit/74dd7d6733d1ab6b79994f4acbc1ad86ba950d23.patch" - patch_file: "patches/backward-cpp-1.5-add-iterator-include.patch" - base_path: "source_subfolder" - patch_file: "patches/backward-cpp-1.5-mingw.patch" - base_path: "source_subfolder" "1.4": - patch_file: "patches/backward-cpp-1.4.patch" - base_path: "source_subfolder" - # https://github.com/bombela/backward-cpp/commit/7539d53b54f08f056dc9366c8d5c24c5d749cfce.patch - patch_file: "patches/backward-cpp-1.4-7539d53b54f08f056dc9366c8d5c24c5d749cfce.patch" - base_path: "source_subfolder" - # https://github.com/bombela/backward-cpp/commit/b7ffd640ec48ada93045f8c46fc65f823490819b.patch + patch_source: "https://github.com/bombela/backward-cpp/commit/7539d53b54f08f056dc9366c8d5c24c5d749cfce.patch" - patch_file: "patches/backward-cpp-1.4-b7ffd640ec48ada93045f8c46fc65f823490819b.patch" - base_path: "source_subfolder" + patch_source: "https://github.com/bombela/backward-cpp/commit/b7ffd640ec48ada93045f8c46fc65f823490819b.patch" diff --git a/recipes/backward-cpp/all/conanfile.py b/recipes/backward-cpp/all/conanfile.py index a3191f7258846..5ca9c317f3d8d 100644 --- a/recipes/backward-cpp/all/conanfile.py +++ b/recipes/backward-cpp/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class BackwardCppConan(ConanFile): @@ -27,21 +31,10 @@ class BackwardCppConan(ConanFile): "stack_details": "dwarf", } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _supported_os(self): supported_os = ["Linux", "Macos", "Android"] - if tools.Version(self.version) >= "1.5": + if Version(self.version) >= "1.5": supported_os.append("Windows") return supported_os @@ -52,9 +45,7 @@ def _has_stack_details(self, type): return False if self.settings.os == "Windows" else self.options.stack_details == type def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -66,7 +57,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.settings.os in ["Linux", "Android"]: @@ -78,52 +75,48 @@ def requirements(self): self.requires("binutils/2.38") def validate(self): - if self.settings.os not in self._supported_os: - raise ConanInvalidConfiguration("upstream backward-cpp v{0} is not" - " supported in {1}.".format(self.version, self.settings.os)) - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - if self.settings.os == "Macos": - if self.settings.arch == "armv8": + if self.info.settings.os not in self._supported_os: + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.info.settings.os}.") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if self.info.settings.os == "Macos": + if self.info.settings.arch == "armv8": raise ConanInvalidConfiguration("Macos M1 not supported yet") if not self._has_stack_details("backtrace_symbol"): raise ConanInvalidConfiguration("only stack_details=backtrace_symbol" " is supported on Macos") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["STACK_WALKING_UNWIND"] = self._has_stack_walking("unwind") - self._cmake.definitions["STACK_WALKING_BACKTRACE"] = self._has_stack_walking("backtrace") - self._cmake.definitions["STACK_DETAILS_AUTO_DETECT"] = False - self._cmake.definitions["STACK_DETAILS_BACKTRACE_SYMBOL"] = self._has_stack_details("backtrace_symbol") - self._cmake.definitions["STACK_DETAILS_DW"] = self._has_stack_details("dw") - self._cmake.definitions["STACK_DETAILS_BFD"] = self._has_stack_details("bfd") - self._cmake.definitions["STACK_DETAILS_DWARF"] = self._has_stack_details("dwarf") - self._cmake.definitions["BACKWARD_SHARED"] = self.options.shared - self._cmake.definitions["BACKWARD_TESTS"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["STACK_WALKING_UNWIND"] = self._has_stack_walking("unwind") + tc.variables["STACK_WALKING_BACKTRACE"] = self._has_stack_walking("backtrace") + tc.variables["STACK_DETAILS_AUTO_DETECT"] = False + tc.variables["STACK_DETAILS_BACKTRACE_SYMBOL"] = self._has_stack_details("backtrace_symbol") + tc.variables["STACK_DETAILS_DW"] = self._has_stack_details("dw") + tc.variables["STACK_DETAILS_BFD"] = self._has_stack_details("bfd") + tc.variables["STACK_DETAILS_DWARF"] = self._has_stack_details("dwarf") + tc.variables["BACKWARD_SHARED"] = self.options.shared + tc.variables["BACKWARD_TESTS"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "backward")) + rmdir(self, os.path.join(self.package_folder, "lib", "backward")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Backward") @@ -138,7 +131,7 @@ def package_info(self): self.cpp_info.defines.append("BACKWARD_HAS_DWARF={}".format(int(self._has_stack_details("dwarf")))) self.cpp_info.defines.append("BACKWARD_HAS_PDB_SYMBOL={}".format(int(self.settings.os == "Windows"))) - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["backward"] if self.settings.os == "Linux": self.cpp_info.system_libs.extend(["dl"]) if self.settings.os == "Windows": diff --git a/recipes/backward-cpp/all/patches/backward-cpp-1.4.patch b/recipes/backward-cpp/all/patches/backward-cpp-1.4.patch index ff4422c3741d7..f0e6e425a176f 100644 --- a/recipes/backward-cpp/all/patches/backward-cpp-1.4.patch +++ b/recipes/backward-cpp/all/patches/backward-cpp-1.4.patch @@ -41,16 +41,27 @@ ############################################################################### -@@ -74,6 +74,8 @@ endif() +@@ -74,6 +74,19 @@ endif() add_library(backward ${libtype} backward.cpp) target_compile_definitions(backward PUBLIC ${BACKWARD_DEFINITIONS}) target_include_directories(backward PUBLIC ${BACKWARD_INCLUDE_DIRS}) +target_compile_features(backward PUBLIC cxx_std_11) -+conan_target_link_libraries(backward) ++if(STACK_DETAILS_DW) ++ find_package(elfutils REQUIRED CONFIG) ++ target_link_libraries(backward PUBLIC elfutils::libdw) ++endif() ++if(STACK_DETAILS_BFD) ++ find_package(binutils REQUIRED CONFIG) ++ target_link_libraries(backward PUBLIC binutils::binutils) ++endif() ++if(STACK_DETAILS_DWARF) ++ find_package(libdwarf REQUIRED CONFIG) ++ target_link_libraries(backward PUBLIC libdwarf::libdwarf) ++endif() ############################################################################### # TESTS -@@ -117,11 +119,18 @@ if(BACKWARD_TESTS) +@@ -117,11 +130,18 @@ if(BACKWARD_TESTS) endforeach() endif() diff --git a/recipes/backward-cpp/all/patches/backward-cpp-1.5.patch b/recipes/backward-cpp/all/patches/backward-cpp-1.5.patch index 059254f52d44a..2fa198687d928 100644 --- a/recipes/backward-cpp/all/patches/backward-cpp-1.5.patch +++ b/recipes/backward-cpp/all/patches/backward-cpp-1.5.patch @@ -41,16 +41,27 @@ ############################################################################### -@@ -86,6 +86,8 @@ endif() +@@ -86,6 +86,19 @@ endif() add_library(backward ${libtype} backward.cpp) target_compile_definitions(backward PUBLIC ${BACKWARD_DEFINITIONS}) target_include_directories(backward PUBLIC ${BACKWARD_INCLUDE_DIRS}) +target_compile_features(backward PUBLIC cxx_std_11) -+conan_target_link_libraries(backward) ++if(STACK_DETAILS_DW) ++ find_package(elfutils REQUIRED CONFIG) ++ target_link_libraries(backward PUBLIC elfutils::libdw) ++endif() ++if(STACK_DETAILS_BFD) ++ find_package(binutils REQUIRED CONFIG) ++ target_link_libraries(backward PUBLIC binutils::binutils) ++endif() ++if(STACK_DETAILS_DWARF) ++ find_package(libdwarf REQUIRED CONFIG) ++ target_link_libraries(backward PUBLIC libdwarf::libdwarf) ++endif() ############################################################################### # TESTS -@@ -137,3 +139,9 @@ install( +@@ -137,3 +150,9 @@ install( FILES "BackwardConfig.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/backward ) diff --git a/recipes/backward-cpp/all/test_package/CMakeLists.txt b/recipes/backward-cpp/all/test_package/CMakeLists.txt index d95363e673997..9950bd34800a4 100644 --- a/recipes/backward-cpp/all/test_package/CMakeLists.txt +++ b/recipes/backward-cpp/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(Backward REQUIRED CONFIG) diff --git a/recipes/backward-cpp/all/test_package/conanfile.py b/recipes/backward-cpp/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/backward-cpp/all/test_package/conanfile.py +++ b/recipes/backward-cpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/backward-cpp/all/test_v1_package/CMakeLists.txt b/recipes/backward-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/backward-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/backward-cpp/all/test_v1_package/conanfile.py b/recipes/backward-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/backward-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/bacnet-stack/all/CMakeLists.txt b/recipes/bacnet-stack/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/bacnet-stack/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/bacnet-stack/all/conandata.yml b/recipes/bacnet-stack/all/conandata.yml index 834cc1c526e20..d44111989de5e 100644 --- a/recipes/bacnet-stack/all/conandata.yml +++ b/recipes/bacnet-stack/all/conandata.yml @@ -1,13 +1,10 @@ sources: - "20200306": - sha256: bf61bc7ffe556b30464ac0734e18d975fe6a8676d9c2fcb7c215981a46381847 - url: https://github.com/bacnet-stack/bacnet-stack/archive/4a916468c63de478b84ef4d0c67d541cd84da27e.zip - "20200515": - sha256: dda1b8c180c3eeb85eb950de5a5907fa22543d7c6b930f11f3fe735eb6ea662b - url: https://github.com/bacnet-stack/bacnet-stack/archive/3553ae56c2b0240949ddf54dbea4213b0c69433c.zip - "20200601": - sha256: 0575a7b1f9d05778ed6211a6a095d344b8684aebf3b51889423b51a4f3575889 - url: https://github.com/bacnet-stack/bacnet-stack/archive/ff9697bab4d520588dae350de9b8a700c8af18a0.zip "1.0.0": - sha256: 6a57448fa8099bcb51713a6799f9f08f4f14f70dc9c69c6927129b0a21868b92 - url: https://github.com/bacnet-stack/bacnet-stack/archive/bacnet-stack-1.0.0.zip + url: "https://github.com/bacnet-stack/bacnet-stack/archive/refs/tags/bacnet-stack-1.0.0.tar.gz" + sha256: "8dad24decb3870bc8147a1ea5eecd5c6f8c1205ec48d5ae4d454085427122658" +patches: + "1.0.0": + - patch_file: "patches/0001-fix-dll-install.patch" + patch_description: "Fix installation of dll" + patch_type: "portability" + patch_source: "https://github.com/bacnet-stack/bacnet-stack/pull/351" diff --git a/recipes/bacnet-stack/all/conanfile.py b/recipes/bacnet-stack/all/conanfile.py index 1d0069018b56d..69ae62a1c72de 100644 --- a/recipes/bacnet-stack/all/conanfile.py +++ b/recipes/bacnet-stack/all/conanfile.py @@ -1,6 +1,9 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.53.0" class BacnetStackConan(ConanFile): @@ -12,8 +15,7 @@ class BacnetStackConan(ConanFile): BACnet Protocol Stack library provides a BACnet application layer, network layer and media access (MAC) layer communications services.""" topics = ("bacnet") - exports_sources = ['CMakeLists.txt'] - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,63 +24,51 @@ class BacnetStackConan(ConanFile): "shared": False, "fPIC": True } - generators = "cmake", "cmake_find_package" - - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("Windows shared builds are not supported right now, see issue https://github.com/bacnet-stack/bacnet-stack/issues/49") + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - if self.version.startswith("2020"): - extracted_dir = self.name + "-" + os.path.basename(self.conan_data["sources"][self.version]["url"]).split(".")[0] - else: - extracted_dir = self.name + "-" + self.name + "-" + self.version - - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BACNET_STACK_BUILD_APPS"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BACNET_STACK_BUILD_APPS"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("gpl-2.txt", dst='licenses', src=os.path.join(self._source_subfolder, "license")) - cmake = self._configure_cmake() + copy(self, pattern="gpl-2.txt", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "license")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, - "lib", "bacnet-stack", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "bacnet-stack", "cmake")) def package_info(self): self.cpp_info.libs = ["bacnet-stack"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] elif self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] if not self.options.shared: self.cpp_info.defines = ["BACNET_STACK_STATIC_DEFINE"] + self.cpp_info.set_property("cmake_file_name", "bacnet-stack") + self.cpp_info.set_property("cmake_target_name", "bacnet-stack::bacnet-stack") diff --git a/recipes/bacnet-stack/all/patches/0001-fix-dll-install.patch b/recipes/bacnet-stack/all/patches/0001-fix-dll-install.patch new file mode 100644 index 0000000000000..b15286bcdd1e5 --- /dev/null +++ b/recipes/bacnet-stack/all/patches/0001-fix-dll-install.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -659,6 +659,7 @@ set(BACNET_STACK_CONFIG_INSTALL_DIR ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME + install( + TARGETS ${PROJECT_NAME} + EXPORT ${PROJECT_NAME}Targets ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT lib) + diff --git a/recipes/bacnet-stack/all/test_package/CMakeLists.txt b/recipes/bacnet-stack/all/test_package/CMakeLists.txt index 33ae887aa6aea..ad98c1486c8f3 100644 --- a/recipes/bacnet-stack/all/test_package/CMakeLists.txt +++ b/recipes/bacnet-stack/all/test_package/CMakeLists.txt @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(bacnet-stack REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE bacnet-stack::bacnet-stack) diff --git a/recipes/bacnet-stack/all/test_package/conanfile.py b/recipes/bacnet-stack/all/test_package/conanfile.py index 933dbf96533ae..a60b6fe8a1512 100644 --- a/recipes/bacnet-stack/all/test_package/conanfile.py +++ b/recipes/bacnet-stack/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class TestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - bin_path = self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + diff --git a/recipes/bacnet-stack/all/test_package/test_package.c b/recipes/bacnet-stack/all/test_package/test_package.c new file mode 100644 index 0000000000000..317c15cde5c25 --- /dev/null +++ b/recipes/bacnet-stack/all/test_package/test_package.c @@ -0,0 +1,24 @@ +#include "bacnet/basic/object/device.h" +#include "bacnet/basic/service/h_apdu.h" +#include "bacnet/basic/binding/address.h" +#include "bacnet/bacdef.h" +#include "bacnet/basic/services.h" + +static void Init_Service_Handlers(void) +{ + Device_Init(NULL); + apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is); + apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service); + apdu_set_confirmed_handler( + SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property); + apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_add); +} + +int main(int argc, char *argv[]) +{ + address_init(); + Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE); + Init_Service_Handlers(); + + return 0; +} diff --git a/recipes/bacnet-stack/all/test_package/test_package.cpp b/recipes/bacnet-stack/all/test_package/test_package.cpp deleted file mode 100644 index 28a71f016d118..0000000000000 --- a/recipes/bacnet-stack/all/test_package/test_package.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include "bacnet/basic/object/device.h" -#include "bacnet/basic/service/h_apdu.h" -#include "bacnet/basic/binding/address.h" -#include "bacnet/bacdef.h" -#include "bacnet/basic/services.h" - -static void Init_Service_Handlers(void) -{ - Device_Init(nullptr); - apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_WHO_IS, handler_who_is); - apdu_set_unrecognized_service_handler_handler(handler_unrecognized_service); - apdu_set_confirmed_handler( - SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property); - apdu_set_unconfirmed_handler(SERVICE_UNCONFIRMED_I_AM, handler_i_am_add); -} - -int main(int argc, char *argv[]) -{ - address_init(); - Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE); - Init_Service_Handlers(); - - return 0; -} diff --git a/recipes/bacnet-stack/all/test_v1_package/CMakeLists.txt b/recipes/bacnet-stack/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/bacnet-stack/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/bacnet-stack/all/test_v1_package/conanfile.py b/recipes/bacnet-stack/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6005bae433a02 --- /dev/null +++ b/recipes/bacnet-stack/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class TestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + bin_path = self.run(bin_path, run_environment=True) diff --git a/recipes/bacnet-stack/config.yml b/recipes/bacnet-stack/config.yml index 056dc291cd850..c7f13630776fb 100644 --- a/recipes/bacnet-stack/config.yml +++ b/recipes/bacnet-stack/config.yml @@ -1,10 +1,3 @@ ---- versions: - "20200306": - folder: "all" - "20200515": - folder: "all" - "20200601": - folder: "all" "1.0.0": folder: "all" diff --git a/recipes/baical-p7/all/CMakeLists.txt b/recipes/baical-p7/all/CMakeLists.txt deleted file mode 100644 index c921d02a0d877..0000000000000 --- a/recipes/baical-p7/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/baical-p7/all/conandata.yml b/recipes/baical-p7/all/conandata.yml index f73e5ee20ebb0..7bc581c047835 100644 --- a/recipes/baical-p7/all/conandata.yml +++ b/recipes/baical-p7/all/conandata.yml @@ -2,3 +2,8 @@ sources: "5.6": url: "http://baical.net/files/libP7Client_v5.6.zip" sha256: "7503bdf739b9c2aea297b49fa0aa0162b7090830aee1cbd4cf7be5d3c75600de" +patches: + "5.6": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "Fix CMakeLists" + patch_type: "conan" diff --git a/recipes/baical-p7/all/conanfile.py b/recipes/baical-p7/all/conanfile.py index 94fb1036053e3..d193b92014a9d 100644 --- a/recipes/baical-p7/all/conanfile.py +++ b/recipes/baical-p7/all/conanfile.py @@ -1,8 +1,11 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.29.1" +required_conan_version = ">=1.53.0" + class BaicalP7Conan(ConanFile): name = "baical-p7" @@ -11,17 +14,19 @@ class BaicalP7Conan(ConanFile): homepage = "http://baical.net/p7.html" topics = ("p7", "baical", "logging", "telemetry") description = "Baical P7 client" - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -29,46 +34,39 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): if self.settings.os not in ["Linux", "Windows"]: raise ConanInvalidConfiguration("P7 only supports Windows and Linux at this time") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination= self._source_subfolder) + get(self, **self.conan_data["sources"][self.version]) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["P7_TESTS_BUILD"] = False - self._cmake.definitions["P7_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["P7_EXAMPLES_BUILD"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["P7_TESTS_BUILD"] = False + tc.cache_variables["P7_BUILD_SHARED"] = self.options.shared + tc.variables["P7_EXAMPLES_BUILD"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "Headers")) - cmake = self._configure_cmake() + copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "include"), "*.cmake") def package_info(self): - self.cpp_info.names["cmake_find_package"] = "p7" - self.cpp_info.names["cmake_find_package_multi"] = "p7" - - if self.options.shared: - self.cpp_info.components["p7"].name = "p7-shared" - self.cpp_info.components["p7"].libs = ["p7-shared"] - else: - self.cpp_info.components["p7"].name = "p7" - self.cpp_info.components["p7"].libs = ["p7"] - - if self.settings.os == "Linux": - self.cpp_info.components["p7"].system_libs .extend(["rt", "pthread"]) - if self.settings.os == "Windows": - self.cpp_info.components["p7"].system_libs .append("Ws2_32") + self.cpp_info.libs = ["p7-shared" if self.options.shared else "p7"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "rt", "pthread"]) + elif self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/baical-p7/all/patches/0001-fix-cmake.patch b/recipes/baical-p7/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..dbedad975e252 --- /dev/null +++ b/recipes/baical-p7/all/patches/0001-fix-cmake.patch @@ -0,0 +1,86 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,6 @@ + cmake_minimum_required(VERSION 3.0 FATAL_ERROR) + +-#project(p7lib) ++project(p7lib) + + #>>Build options ********************************************************************** + option(P7_TESTS_BUILD "Build test" OFF) +@@ -25,7 +25,6 @@ if(NOT DEFINED ROOT_P7_PATH) + set(ROOT_P7_PATH ${PROJECT_SOURCE_DIR} CACHE INTERNAL "") + set(PATH_P7 ${CMAKE_CURRENT_SOURCE_DIR} CACHE INTERNAL "") + set(PATH_P7_API "${PROJECT_SOURCE_DIR}/Headers" CACHE INTERNAL "") +-else(expression) + endif(NOT DEFINED ROOT_P7_PATH) + + if(MSVC) +--- a/Sources/CMakeLists.txt ++++ b/Sources/CMakeLists.txt +@@ -7,7 +7,7 @@ include_directories(${PATH_SHARED_PLATFORM}) + include_directories(${PATH_P7_API}) + + if(WIN32) +- set(P7_PLATFORM_LIBS Ws2_32) ++ set(P7_PLATFORM_LIBS ws2_32) + elseif(UNIX) + set(P7_PLATFORM_LIBS rt pthread) + else() +@@ -16,29 +16,38 @@ endif() + + aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} P7_SOURCES) + ++if(NOT P7_BUILD_SHARED) + add_library(${PROJECT_NAME} STATIC ${P7_SOURCES}) + target_link_libraries(${PROJECT_NAME} PUBLIC ${P7_PLATFORM_LIBS}) ++endif() + + if(P7_BUILD_SHARED) + add_library(${PROJECT_NAME}-shared SHARED ${P7_SOURCES}) + target_link_libraries(${PROJECT_NAME}-shared ${P7_PLATFORM_LIBS}) + endif() + ++if(NOT P7_BUILD_SHARED) + set_property(TARGET ${PROJECT_NAME} PROPERTY POSITION_INDEPENDENT_CODE ON) ++endif() + + if(P7_BUILD_SHARED) + set_property(TARGET ${PROJECT_NAME}-shared PROPERTY POSITION_INDEPENDENT_CODE ON) + endif() + + ++if(NOT P7_BUILD_SHARED) + target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../Headers/") ++endif() + if(P7_BUILD_SHARED) + target_include_directories(${PROJECT_NAME}-shared PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../Headers/") + endif() + ++if(NOT P7_BUILD_SHARED) + target_include_directories(${PROJECT_NAME} INTERFACE "${CMAKE_CURRENT_SOURCE_DIR}/../Headers/") + target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../Shared/") ++endif() + ++if(NOT P7_BUILD_SHARED) + if(WIN32) + target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/../Shared/Platforms/Windows_x86/") + elseif(UNIX) +@@ -51,14 +60,15 @@ install(TARGETS ${PROJECT_NAME} + RUNTIME DESTINATION bin + ) + +-if(P7_BUILD_SHARED) ++else() + install(TARGETS ${PROJECT_NAME}-shared + ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) + endif() ++install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/../Headers/ DESTINATION include FILES_MATCHING PATTERN "*.h") + +-if(COMMAND set_ide_folder) ++if(0) + set_ide_folder(${PROJECT_NAME}) + if(P7_BUILD_SHARED) + set_ide_folder(${PROJECT_NAME}-shared) diff --git a/recipes/baical-p7/all/test_package/CMakeLists.txt b/recipes/baical-p7/all/test_package/CMakeLists.txt index bb7cd3a281865..8eba5be9b5dc9 100644 --- a/recipes/baical-p7/all/test_package/CMakeLists.txt +++ b/recipes/baical-p7/all/test_package/CMakeLists.txt @@ -1,15 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -find_package(p7 REQUIRED CONFIG) +find_package(baical-p7 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - -if(P7_SHARED) - target_link_libraries(${PROJECT_NAME} p7::p7-shared) -else() - target_link_libraries(${PROJECT_NAME} p7::p7) -endif() +target_link_libraries(${PROJECT_NAME} PRIVATE baical-p7::baical-p7) diff --git a/recipes/baical-p7/all/test_package/conanfile.py b/recipes/baical-p7/all/test_package/conanfile.py index c7a27ceb10b4e..98ab55852ad56 100644 --- a/recipes/baical-p7/all/test_package/conanfile.py +++ b/recipes/baical-p7/all/test_package/conanfile.py @@ -1,18 +1,26 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) - cmake.definitions["P7_SHARED"] = self.options["baical-p7"].shared cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/baical-p7/all/test_v1_package/CMakeLists.txt b/recipes/baical-p7/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/baical-p7/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/baical-p7/all/test_v1_package/conanfile.py b/recipes/baical-p7/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/baical-p7/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/bandit/all/conandata.yml b/recipes/bandit/all/conandata.yml new file mode 100644 index 0000000000000..f6a1c1fc0eaad --- /dev/null +++ b/recipes/bandit/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "cci.20210618": + url: "https://github.com/banditcpp/bandit/archive/77f50861c09d794af9ae5f65111b330d9b721054.tar.gz" + sha256: "4fe2eeb623e16a09b56f7a4e3d8fde864a5a4a67226cb514945fa7e9a1ae216a" +patches: + "cci.20210618": + - patch_file: "patches/0001-change-snowhouse-path.patch" + patch_description: "Fix snowhouse.h include path" + patch_type: "conan" diff --git a/recipes/bandit/all/conanfile.py b/recipes/bandit/all/conanfile.py new file mode 100644 index 0000000000000..31fd2c6978fa4 --- /dev/null +++ b/recipes/bandit/all/conanfile.py @@ -0,0 +1,46 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.51.3" + + +class BanditConan(ConanFile): + name = "bandit" + description = "Human-friendly unit testing for C++11" + topics = ("testing", "header-only") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/banditcpp/bandit" + license = "MIT" + + def export_sources(self): + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + + def requirements(self): + self.requires("snowhouse/5.0.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def layout(self): + basic_layout(self) + + def build(self): + apply_conandata_patches(self) + + def package(self): + copy(self, "LICENSE.txt", src=os.path.join(self.source_folder, "docs"), dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "include", "bandit"), src=os.path.join(self.source_folder, "bandit")) + + def package_id(self): + self.info.clear() + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + diff --git a/recipes/bandit/all/patches/0001-change-snowhouse-path.patch b/recipes/bandit/all/patches/0001-change-snowhouse-path.patch new file mode 100644 index 0000000000000..1df54a4f04d5b --- /dev/null +++ b/recipes/bandit/all/patches/0001-change-snowhouse-path.patch @@ -0,0 +1,13 @@ +diff --git a/bandit/adapters/snowhouse.h b/bandit/adapters/snowhouse.h +index f3d9fde..ee3844c 100644 +--- a/bandit/adapters/snowhouse.h ++++ b/bandit/adapters/snowhouse.h +@@ -3,7 +3,7 @@ + + #include + #include +-#include ++#include + + namespace bandit { + namespace adapter { diff --git a/recipes/bandit/all/test_package/CMakeLists.txt b/recipes/bandit/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..58ffec4a070b7 --- /dev/null +++ b/recipes/bandit/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +find_package(bandit REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} bandit::bandit) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/bandit/all/test_package/conanfile.py b/recipes/bandit/all/test_package/conanfile.py new file mode 100644 index 0000000000000..40f70f535b209 --- /dev/null +++ b/recipes/bandit/all/test_package/conanfile.py @@ -0,0 +1,30 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/bandit/all/test_package/test_package.cpp b/recipes/bandit/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..764be0a694402 --- /dev/null +++ b/recipes/bandit/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ +#include +#include + +using namespace snowhouse; +using namespace bandit; + +go_bandit([]() { + describe("context", []() { + bool b; + + before_each([&]() { + b = true; + }); + + it("is true", [&]() { + AssertThat(b, IsTrue()); + }); + }); +}); + +int main(int argc, char** argv) { + return bandit::run(argc, argv); +} + diff --git a/recipes/bandit/all/test_v1_package/CMakeLists.txt b/recipes/bandit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..08111eba078e8 --- /dev/null +++ b/recipes/bandit/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(bandit REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE bandit::bandit) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/bandit/all/test_v1_package/conanfile.py b/recipes/bandit/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/bandit/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/bandit/config.yml b/recipes/bandit/config.yml new file mode 100644 index 0000000000000..5cbf4c1d7cb53 --- /dev/null +++ b/recipes/bandit/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20210618": + folder: "all" diff --git a/recipes/base64/all/CMakeLists.txt b/recipes/base64/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f..0000000000000 --- a/recipes/base64/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/base64/all/conandata.yml b/recipes/base64/all/conandata.yml index 4a9e80d3b3b00..6ebaff03fb45d 100644 --- a/recipes/base64/all/conandata.yml +++ b/recipes/base64/all/conandata.yml @@ -1,10 +1,19 @@ sources: + "0.5.0": + url: "https://github.com/aklomp/base64/archive/v0.5.0.tar.gz" + sha256: "b21be58a90d31302ba86056db7ef77a481393b9359c505be5337d7d54e8a0559" "0.4.0": - sha256: 1fce54059c504b2604c22c20cd930444a71b3340fc81334c037da63976d92002 - url: https://github.com/aklomp/base64/archive/v0.4.0.tar.gz + url: "https://github.com/aklomp/base64/archive/v0.4.0.tar.gz" + sha256: "1fce54059c504b2604c22c20cd930444a71b3340fc81334c037da63976d92002" patches: + "0.5.0": + - patch_file: "patches/0.5.0-0001-make.patch" + patch_description: "add library taget" + patch_type: "conan" "0.4.0": - - base_path: "source_subfolder" - patch_file: "patches/make.patch" - - base_path: "source_subfolder" - patch_file: "patches/cmake.patch" + - patch_file: "patches/0.4.0-0001-make.patch" + patch_description: "add library taget" + patch_type: "conan" + - patch_file: "patches/0.4.0-0002-cmake.patch" + patch_description: "provide CMakeLists.txt for MSVC" + patch_type: "conan" diff --git a/recipes/base64/all/conanfile.py b/recipes/base64/all/conanfile.py index 6db47a061d928..d56ae8c5bcf10 100644 --- a/recipes/base64/all/conanfile.py +++ b/recipes/base64/all/conanfile.py @@ -1,85 +1,125 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import Environment +from conan.tools.files import copy, get, apply_conandata_patches, chdir, export_conandata_patches, rmdir +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + import os -from conans import ConanFile, AutoToolsBuildEnvironment, CMake, tools +required_conan_version = ">=1.52.0" class Base64Conan(ConanFile): name = "base64" + description = "Fast Base64 stream encoder/decoder" license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/aklomp/base64" - description = "Fast Base64 stream encoder/decoder" - topics = ("base64", "codec") - exports_sources = "patches/**", "CMakeLists.txt" - generators = "cmake" + topics = ("base64", "codec", "encoder", "decoder") settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False] + "shared": [True, False], + "fPIC": [True, False], } default_options = { - "fPIC": True + "shared": False, + "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == 'Windows': del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + def layout(self): + if self._use_cmake: + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure(build_folder=self._build_subfolder) - return cmake + def validate(self): + if Version(self.version) < "0.5.0" and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support build shared.") - def _build_cmake(self): - cmake = self._configure_cmake() - cmake.build(target="base64") + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + @property + def _use_cmake(self): + return is_msvc(self) or Version(self.version) >= "0.5.0" - def _build_autotools(self): - autotools = AutoToolsBuildEnvironment(self) - if self.settings.arch == "x86" or self.settings.arch == "x86_64": - extra_env = { - "AVX2_CFLAGS": "-mavx2", - "SSSE3_CFLAGS": "-mssse3", - "SSE41_CFLAGS": "-msse4.1", - "SSE42_CFLAGS": "-msse4.2", - "AVX_CFLAGS": "-mavx" - } + def generate(self): + if self._use_cmake: + tc = CMakeToolchain(self) + tc.generate() else: - # ARM-specific instructions can be enabled here - extra_env = {} - with tools.environment_append(extra_env): - with tools.chdir(self._source_subfolder): - autotools.make(target="lib/libbase64.a") + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - self._patch_sources() - if self.settings.compiler == "Visual Studio": - self._build_cmake() + apply_conandata_patches(self) + if self._use_cmake: + cmake = CMake(self) + cmake.configure() + if Version(self.version) >= "0.5.0": + cmake.build() + else: + cmake.build(target="base64") else: - self._build_autotools() + env = Environment() + if self.settings.arch == "x86" or self.settings.arch == "x86_64": + env.append("AVX2_CFLAGS", "-mavx2") + env.append("SSSE3_CFLAGS", "-mssse3") + env.append("SSE41_CFLAGS", "-msse4.1") + env.append("SSE42_CFLAGS", "-msse4.2") + env.append("AVX_CFLAGS", "-mavx") + else: + # ARM-specific instructions can be enabled here + pass + with env.vars(self).apply(), \ + chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make(target="lib/libbase64.a") def package(self): - self.copy(pattern="*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy(pattern="*.a", dst="lib", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + if self._use_cmake: + cmake = CMake(self) + cmake.install() + if Version(self.version) >= "0.5.0": + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + else: + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib")) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + else: + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + copy(self, pattern="*.a", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) def package_info(self): self.cpp_info.libs = ["base64"] + + if Version(self.version) >= "0.5.0" and not self.options.shared: + self.cpp_info.defines.append("BASE64_STATIC_DEFINE") diff --git a/recipes/base64/all/patches/make.patch b/recipes/base64/all/patches/0.4.0-0001-make.patch similarity index 100% rename from recipes/base64/all/patches/make.patch rename to recipes/base64/all/patches/0.4.0-0001-make.patch diff --git a/recipes/base64/all/patches/cmake.patch b/recipes/base64/all/patches/0.4.0-0002-cmake.patch similarity index 100% rename from recipes/base64/all/patches/cmake.patch rename to recipes/base64/all/patches/0.4.0-0002-cmake.patch diff --git a/recipes/base64/all/patches/0.5.0-0001-make.patch b/recipes/base64/all/patches/0.5.0-0001-make.patch new file mode 100644 index 0000000000000..f20d7ff2ec119 --- /dev/null +++ b/recipes/base64/all/patches/0.5.0-0001-make.patch @@ -0,0 +1,14 @@ +diff --git a/Makefile b/Makefile +index 2bb01e2..200ca73 100644 +--- a/Makefile ++++ b/Makefile +@@ -63,6 +63,9 @@ lib/libbase64.o: $(OBJS) + $(LD) -r -o $@ $^ + $(OBJCOPY) --keep-global-symbols=lib/exports.txt $@ + ++lib/libbase64.a: $(OBJS) ++ $(AR) rc $@ $^ ++ + lib/config.h: + @echo "#define HAVE_AVX2 $(HAVE_AVX2)" > $@ + @echo "#define HAVE_NEON32 $(HAVE_NEON32)" >> $@ diff --git a/recipes/base64/all/test_package/CMakeLists.txt b/recipes/base64/all/test_package/CMakeLists.txt index 48b855b8a30aa..195fdf269b250 100644 --- a/recipes/base64/all/test_package/CMakeLists.txt +++ b/recipes/base64/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package C) -add_executable(example example.c) -target_link_libraries(example ${CONAN_LIBS}) +find_package(base64 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE base64::base64) diff --git a/recipes/base64/all/test_package/conanfile.py b/recipes/base64/all/test_package/conanfile.py index 9a662bfeb73fe..a9fb96656f203 100644 --- a/recipes/base64/all/test_package/conanfile.py +++ b/recipes/base64/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools -class CppcodecTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/base64/all/test_package/example.c b/recipes/base64/all/test_package/test_package.c similarity index 100% rename from recipes/base64/all/test_package/example.c rename to recipes/base64/all/test_package/test_package.c diff --git a/recipes/base64/all/test_v1_package/CMakeLists.txt b/recipes/base64/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..6c32de99d28f7 --- /dev/null +++ b/recipes/base64/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(base64 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE base64::base64) diff --git a/recipes/base64/all/test_v1_package/conanfile.py b/recipes/base64/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/base64/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/base64/config.yml b/recipes/base64/config.yml index 80f918766690c..d13fcfd021b7b 100644 --- a/recipes/base64/config.yml +++ b/recipes/base64/config.yml @@ -1,4 +1,5 @@ ---- versions: + "0.5.0": + folder: all "0.4.0": folder: all diff --git a/recipes/bdwgc/all/CMakeLists.txt b/recipes/bdwgc/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f..0000000000000 --- a/recipes/bdwgc/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/bdwgc/all/conandata.yml b/recipes/bdwgc/all/conandata.yml index 1d60bdd779fbf..97d6a0b86b6e9 100644 --- a/recipes/bdwgc/all/conandata.yml +++ b/recipes/bdwgc/all/conandata.yml @@ -5,10 +5,13 @@ sources: "8.0.6": url: "https://github.com/ivmai/bdwgc/releases/download/v8.0.6/gc-8.0.6.tar.gz" sha256: "3b4914abc9fa76593596773e4da671d7ed4d5390e3d46fbf2e5f155e121bea11" + "8.2.2": + url: "https://github.com/ivmai/bdwgc/releases/download/v8.2.2/gc-8.2.2.tar.gz" + sha256: "f30107bcb062e0920a790ffffa56d9512348546859364c23a14be264b38836a0" patches: "8.0.4": - - patch_file: "patches/update-cmake.patch" - base_path: "source_subfolder" + - patch_file: "patches/update-cmake-8_0_4.patch" "8.0.6": - patch_file: "patches/update-cmake-8_0_6.patch" - base_path: "source_subfolder" + "8.2.2": + - patch_file: "patches/update-cmake-8_2_2.patch" diff --git a/recipes/bdwgc/all/conanfile.py b/recipes/bdwgc/all/conanfile.py index 9cf6cf0dd7e0b..925a47c27595c 100644 --- a/recipes/bdwgc/all/conanfile.py +++ b/recipes/bdwgc/all/conanfile.py @@ -1,20 +1,21 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, get, save, rmdir, copy, load +from conan.errors import ConanException import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" class BdwGcConan(ConanFile): name = "bdwgc" homepage = "https://www.hboehm.info/gc/" description = "The Boehm-Demers-Weiser conservative C/C++ Garbage Collector (libgc, bdwgc, boehm-gc)" - topics = ("conan", "gc", "garbage", "collector") + topics = ("gc", "garbage", "collector") url = "https://github.com/conan-io/conan-center-index" license = "MIT" settings = "os", "compiler", "build_type", "arch" - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake" _autotools_options_defaults = ( ("cplusplus", False,), @@ -25,7 +26,6 @@ class BdwGcConan(ConanFile): ("handle_fork", True,), ("thread_local_alloc", True,), ("threads_discovery", True,), - ("parallel_mark", True,), ("gcj_support", True,), ("java_finalization", True,), ("sigrt_signals", False,), @@ -39,7 +39,6 @@ class BdwGcConan(ConanFile): ("munmap", True,), ("dynamic_loading", True,), ("register_main_static_data", True,), - ("gc_assertions", False,), ("checksums", False,), ("single_obj_compilation", False,), ) @@ -48,6 +47,7 @@ class BdwGcConan(ConanFile): "shared": [True, False], "fPIC": [True, False], } + default_options = { "shared": False, "fPIC": True, @@ -56,11 +56,9 @@ class BdwGcConan(ConanFile): options[option] = [True, False] default_options[option] = default - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -68,47 +66,60 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - if tools.Version(self.version) <= "8.0.6": + try: + del self.options.fPIC + except Exception: + pass + if Version(self.version) < "8.2.0": del self.options.throw_bad_alloc_library if not self.options.cplusplus: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.settings.os == "Windows": - self.requires("libatomic_ops/7.6.10") + self.requires("libatomic_ops/7.6.14") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) for option, _ in self._autotools_options_defaults: - self._cmake.definitions["enable_{}".format(option)] = self.options.get_safe(option) - self._cmake.definitions["disable_gc_debug"] = not self.options.gc_debug - self._cmake.definitions["disable_handle_fork"] = not self.options.handle_fork - self._cmake.definitions["install_headers"] = True - self._cmake.definitions["build_tests"] = False - self._cmake.verbose = True - self._cmake.parallel = False - self._cmake.configure() - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + if option == "cord": + tc.variables["build_cord"] = self.options.get_safe(option) + elif option == "cplusplus": + tc.cache_variables["enable_cplusplus"] = str(self.options.get_safe(option)) + else: + tc.variables["enable_{}".format(option)] = self.options.get_safe(option) + tc.variables["disable_gc_debug"] = not self.options.gc_debug + tc.variables["disable_handle_fork"] = not self.options.handle_fork + tc.variables["install_headers"] = True + tc.variables["enable_docs"] = False + tc.variables["build_tests"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def _extract_copyright(self): - readme_md = open(os.path.join(self._source_subfolder, "README.md")).read() + readme_md = load(self, os.path.join(self.source_folder, "README.md")) copyright_header = "## Copyright & Warranty\n" index = readme_md.find(copyright_header) if index == -1: @@ -116,28 +127,43 @@ def _extract_copyright(self): return readme_md[index+len(copyright_header):] def package(self): - tools.save(os.path.join(self.package_folder, "licenses", "COPYRIGHT"), self._extract_copyright()) - cmake = self._configure_cmake() + save(self, os.path.join(self.package_folder, "licenses", "COPYRIGHT"), self._extract_copyright()) + cmake = CMake(self) cmake.install() - - @property - def _libs(self): - libs = [] - if self.options.get_safe("throw_bad_alloc_library"): - libs.append("gctba") - if self.options.cplusplus: - libs.append("gccpp") - if self.options.cord: - libs.append("cord") - libs.append("gc") - return libs + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.names["pkg_config"] = "bdw-gc" - self.cpp_info.libs = self._libs - self.cpp_info.defines = ["GC_DLL" if self.options.shared else "GC_NOT_DLL"] - if not self.options.shared: - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["pthread", "dl"] + self.cpp_info.set_property("cmake_file_name", "BDWgc") + self.cpp_info.set_property("cmake_target_name", "BDWgc::BDWgc") + + # TODO: Remove on Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "BDWgc" + self.cpp_info.names["cmake_find_package_multi"] = "BDWgc" + + self.cpp_info.components["gc"].set_property("cmake_target_name", "BDWgc::gc") + self.cpp_info.components["gc"].set_property("pkg_config_name", "bdw-gc") + self.cpp_info.components["gc"].libs = ["gc"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["gc"].system_libs = ["pthread", "dl"] + self.cpp_info.components["gc"].defines = ["GC_DLL" if self.options.shared else "GC_NOT_DLL"] if self.options.gc_debug: - self.cpp_info.defines.append("GC_DEBUG") + self.cpp_info.components["gc"].defines.append("GC_DEBUG") + if self.settings.os == "Windows": + self.cpp_info.components["gc"].requires = ["libatomic_ops::atomic_ops"] + + if self.options.cplusplus and self.options.get_safe("throw_bad_alloc_library"): + self.cpp_info.components["gctba"].set_property("cmake_target_name", "BDWgc::gctba") + self.cpp_info.components["gctba"].libs = ["gctba"] + self.cpp_info.components["gctba"].requires = ["gc"] + + if self.options.cplusplus: + self.cpp_info.components["gccpp"].set_property("cmake_target_name", "BDWgc::gccpp") + self.cpp_info.components["gccpp"].libs = ["gccpp"] + self.cpp_info.components["gccpp"].requires = ["gc"] + + if self.options.cord: + self.cpp_info.components["cord"].set_property("cmake_target_name", "BDWgc::cord") + self.cpp_info.components["cord"].libs = ["cord"] + self.cpp_info.components["cord"].requires = ["gc"] diff --git a/recipes/bdwgc/all/patches/update-cmake-8_0_4.patch b/recipes/bdwgc/all/patches/update-cmake-8_0_4.patch new file mode 100644 index 0000000000000..1af6e770494fc --- /dev/null +++ b/recipes/bdwgc/all/patches/update-cmake-8_0_4.patch @@ -0,0 +1,841 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -21,241 +21,603 @@ + # this will generate gc.sln + # + +-SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required +- +-PROJECT(gc) +- +-INCLUDE(CTest) +- +-CMAKE_MINIMUM_REQUIRED(VERSION 2.6) +- +-ADD_DEFINITIONS("-D_CRT_SECURE_NO_DEPRECATE +- -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION") +- +-IF(APPLE) +- IF("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "") +- SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;x86_64" CACHE STRING "Build architectures for Mac OS X" FORCE) +- ENDIF() +-ENDIF(APPLE) +- +-#LIBATOMIC #TODO +-#ADD_LIBRARY(atomic_ops STATIC ) +-#SET_TARGET_PROPERTIES(atomic_ops PROPERTIES COMPILE_FLAGS -DNO_DEBUGGING) +- +- +-#LIBGC +- +-INCLUDE_DIRECTORIES(include) +-INCLUDE_DIRECTORIES(libatomic_ops/src) +- +-SET(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c ++cmake_minimum_required(VERSION 3.1) ++ ++option(enable_cplusplus "C++ support" OFF) ++if (enable_cplusplus) ++ project(gc) ++else() ++ project(gc C) ++endif() ++ ++include(CheckCCompilerFlag) ++include(CheckCSourceCompiles) ++include(CheckFunctionExists) ++include(CheckIncludeFile) ++include(CheckSymbolExists) ++include(CTest) ++ ++# Customize the build by passing "-D=ON|OFF" in the command line. ++option(BUILD_SHARED_LIBS "Build shared libraries" ON) ++option(build_cord "Build cord library" ON) ++option(build_tests "Build tests" OFF) ++option(enable_threads "Support threads" ON) ++option(enable_parallel_mark "Parallelize marking and free list construction" ON) ++option(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON) ++option(enable_threads_discovery "Enable threads discovery in GC" ON) ++option(enable_gcj_support "Support for gcj" ON) ++option(enable_sigrt_signals "Use SIGRTMIN-based signals for thread suspend/resume" OFF) ++option(enable_gc_debug "Support for pointer back-tracing" OFF) ++option(disable_gc_debug "Disable debugging like GC_dump and its callees" OFF) ++option(enable_java_finalization "Support for java finalization" ON) ++option(enable_atomic_uncollectable "Support for atomic uncollectible allocation" ON) ++option(enable_redirect_malloc "Redirect malloc and friends to GC routines" OFF) ++option(enable_disclaim "Support alternative finalization interface" ON) ++option(enable_large_config "Optimize for large heap or root set" OFF) ++option(enable_gc_assertions "Enable collector-internal assertion checking" OFF) ++option(enable_mmap "Use mmap instead of sbrk to expand the heap" OFF) ++option(enable_munmap "Return page to the OS if empty for N collections" ON) ++option(enable_dynamic_loading "Enable tracing of dynamic library data roots" ON) ++option(enable_register_main_static_data "Perform the initial guess of data root sets" ON) ++option(enable_checksums "Report erroneously cleared dirty bits" OFF) ++option(enable_werror "Pass -Werror to the C compiler (treat warnings as errors)" OFF) ++option(enable_single_obj_compilation "Compile all libgc source files into single .o" OFF) ++option(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON) ++option(disable_handle_fork "Prohibit installation of pthread_atfork() handlers" OFF) ++option(install_headers "Install header files" ON) ++ ++add_definitions("-DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION") ++ ++if (APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "")) ++ set(CMAKE_OSX_ARCHITECTURES "x86_64;i386" ++ CACHE STRING "Build architectures for Mac OS X" FORCE) ++endif() ++ ++# Set struct packing alignment to word (instead of 1-byte). ++if (BORLAND) ++ add_compile_options(/a4) ++elseif (WATCOM) ++ add_compile_options(/zp4) ++endif() ++ ++# Output all warnings. ++if (BORLAND) ++ # All warnings except for particular ones. ++ add_compile_options(/w /w-pro /w-aus /w-par /w-ccc /w-inl /w-rch) ++elseif (MSVC) ++ # All warnings but ignoring "unreferenced formal parameter" and ++ # "conditional expression is constant" ones. ++ add_compile_options(/W4 /wd4100 /wd4127) ++ # Disable crt security warnings, since unfortunately they warn about all ++ # sorts of safe uses of strncpy. ++ add_definitions("-D_CRT_SECURE_NO_DEPRECATE") ++elseif (WATCOM) ++ add_compile_options(/wx) ++else() ++ # TODO add -[W]pedantic -Wno-long-long ++ add_compile_options(-Wall -Wextra) ++endif() ++ ++include_directories(include) ++ ++set(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c + mark_rts.c headers.c mark.c obj_map.c blacklst.c finalize.c + new_hblk.c dbg_mlc.c malloc.c dyn_load.c typd_mlc.c ptr_chck.c + mallocx.c) +-SET(LIBS) +-OPTION(enable_threads "TODO" NO) +-IF(enable_threads) +- FIND_PACKAGE(Threads REQUIRED) +- MESSAGE("Thread Model: ${CMAKE_THREAD_LIBS_INIT}" ) +- INCLUDE_DIRECTORIES(${Threads_INCLUDE_DIR}) +- SET(LIBS ${LIBS} ${Threads_LIBRARIES}) +-ENDIF(enable_threads) +- +-OPTION(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON) +- +-OPTION(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON) +- +-OPTION(enable_parallel_mark "Parallelize marking and free list construction" ON) +- +-#IF(Threads_FOUND) +-# ADD_DEFINITIONS("") +-#ELSE +-# MESSAGE("Parallel mark requires enable_threads ON" ) +-#ENDIF(Threads_FOUND) +- +-#OPTION(enable_cplusplus "install C++ support" ON) +-SET(SRC ${SRC} gc_cpp.cc) +- +-SET(_HOST ${CMAKE_HOST_SYSTEM_PROCESSOR}--${CMAKE_SYSTEM}) #FIXME missing the vendor field. +-STRING(TOLOWER ${_HOST} HOST) +-MESSAGE("HOST = ${HOST}") +- +-# Thread Detection. Relying on cmake for lib and includes. +-#TODO check cmake detection +-IF(CMAKE_USE_PTHREADS_INIT) +- SET(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c) +- # Common defines for most POSIX platforms. +- IF( HOST MATCHES .*-.*-aix.*|.*-.*-android.*|.*-.*-cygwin.*|.*-.*-darwin.*|.*-.*-.*freebsd.*|.*-.*-haiku.*|.*-.*-gnu.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-.*linux.*|.*-.*-nacl.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*) +- ADD_DEFINITIONS("-DGC_THREADS -D_REENTRANT") +- IF(enable_parallel_mark) +- ADD_DEFINITIONS("-DPARALLEL_MARK") +- ENDIF(enable_parallel_mark) +- IF(enable_thread_local_alloc) +- ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") +- SET(SRC ${SRC} thread_local_alloc.c) +- ENDIF(enable_thread_local_alloc) +- MESSAGE("Explicit GC_INIT() calls may be required.") +- ENDIF() +- IF ( HOST MATCHES .*-.*-hpux11.*) +- MESSAGE("Only HP/UX 11 POSIX threads are supported.") +- ADD_DEFINITIONS("-D_POSIX_C_SOURCE=199506L") #TODO test -DVAR=value. Alternative is COMPILE_DEFINITIONS property +- ENDIF() +- IF ( HOST MATCHES .*-.*-hpux10.*) +- MESSAGE("HP/UX 10 POSIX threads are not supported.") +- ENDIF() +- IF ( HOST MATCHES .*-.*-netbsd.*) +- MESSAGE("Only on NetBSD 2.0 or later.") +- ADD_DEFINITIONS("-D_PTHREADS") +- ENDIF() +- IF( HOST MATCHES .*-.*-android.*) +- # Android NDK does not provide pthread_atfork. +- ELSEIF( HOST MATCHES .*-.*-aix.*|.*-.*-cygwin.*|.*-.*-freebsd.*|.*-.*-haiku.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-kfreebsd.*-gnu|.*-.*-.*linux.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*) +- IF(enable_handle_fork) +- ADD_DEFINITIONS("-DHANDLE_FORK") +- ENDIF(enable_handle_fork) +- ENDIF() +- IF ( HOST MATCHES .*-.*-cygwin.*) +- SET(SRC ${SRC} win32_threads.c) +- ENDIF() +- IF ( HOST MATCHES .*-.*-darwin.*) +- IF(enable_handle_fork) +- # The incremental mode conflicts with fork handling. +- IF(enable_parallel_mark) +- ADD_DEFINITIONS("-DHANDLE_FORK") +- ENDIF(enable_parallel_mark) +- ENDIF(enable_handle_fork) +- SET(SRC ${SRC} darwin_stop_world.c) +- #TODO +- #darwin_threads=true +- ENDIF() +-ENDIF(CMAKE_USE_PTHREADS_INIT) +- +-IF(CMAKE_USE_WIN32_THREADS_INIT) +- ADD_DEFINITIONS("-DGC_THREADS") +- IF(enable_parallel_mark) +- ADD_DEFINITIONS("-DPARALLEL_MARK") +- IF(enable_thread_local_alloc) +- ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") +- SET(SRC ${SRC} thread_local_alloc.c) +- ENDIF(enable_thread_local_alloc) +- ENDIF() +- ADD_DEFINITIONS("-DEMPTY_GETENV_RESULTS") #TODO test +- SET(SRC ${SRC} win32_threads.c) +-ENDIF(CMAKE_USE_WIN32_THREADS_INIT) +- +-OPTION(enable_gcj_support "Support for gcj" ON) +-IF(enable_gcj_support) +- ADD_DEFINITIONS("-DGC_GCJ_SUPPORT") +- IF(enable_threads) +- ADD_DEFINITIONS("-DGC_ENABLE_SUSPEND_THREAD") +- ENDIF(enable_threads) +- SET(SRC ${SRC} gcj_mlc.c) +-ENDIF(enable_gcj_support) +- +-OPTION(enable_disclaim "Support alternative finalization interface" ON) +-IF(enable_disclaim) +- ADD_DEFINITIONS("-DENABLE_DISCLAIM") +- SET(SRC ${SRC} fnlz_mlc.c) +-ENDIF(enable_disclaim) +- +-OPTION(enable_java_finalization "Support for java finalization" ON) +-IF(enable_java_finalization) +- ADD_DEFINITIONS("-DJAVA_FINALIZATION") +-ENDIF(enable_java_finalization) +- +-OPTION(enable_atomic_uncollectable "Support for atomic uncollectible allocation" ON) +-IF(enable_atomic_uncollectable) +- ADD_DEFINITIONS("-DGC_ATOMIC_UNCOLLECTABLE") +-ENDIF(enable_atomic_uncollectable) +- +-OPTION(enable_gc_debug "Support for pointer back-tracing" NO) +-IF(enable_gc_debug) +- ADD_DEFINITIONS("-DDBG_HDRS_ALL -DKEEP_BACK_PTRS") +- IF (HOST MATCHES ia64-.*-linux.*|i586-.*-linux.*|i686-.*-linux.*|x86-.*-linux.*|x86_64-.*-linux.*) +- ADD_DEFINITIONS("-DMAKE_BACK_GRAPH") +- ADD_DEFINITIONS("-DSAVE_CALL_COUNT=8") +- SET(SRC ${SRC} backgraph.c) +- ENDIF() +- IF (HOST MATCHES i.86-.*-dgux.*) +- ADD_DEFINITIONS("-DMAKE_BACK_GRAPH") +- SET(SRC ${SRC} backgraph.c) +- ENDIF() +-ENDIF(enable_gc_debug) +- +-OPTION(enable_redirect_malloc "Redirect malloc and friends to GC routines" NO) +-IF(enable_redirect_malloc) +- IF(enable_gc_debug) +- ADD_DEFINITIONS("-DREDIRECT_MALLOC=GC_debug_malloc_replacement") +- ADD_DEFINITIONS("-DREDIRECT_REALLOC=GC_debug_realloc_replacement") +- ADD_DEFINITIONS("-DREDIRECT_FREE=GC_debug_free") +- ELSE(enable_gc_debug) +- ADD_DEFINITIONS("-DREDIRECT_MALLOC=GC_malloc") +- ENDIF(enable_gc_debug) +- ADD_DEFINITIONS("-DGC_USE_DLOPEN_WRAP") +-ENDIF(enable_redirect_malloc) +- +-OPTION(enable_mmap "Use mmap instead of sbrk to expand the heap" NO) +- +-OPTION(enable_munmap "Return page to the OS if empty for N collections" ON) +-IF(enable_munmap) +- ADD_DEFINITIONS("-DUSE_MMAP -DUSE_MUNMAP") +-ELSEIF(enable_mmap) +- ADD_DEFINITIONS("-DUSE_MMAP") +-ENDIF() +- +-OPTION(enable_dynamic_loading "Enable tracing of dynamic library data roots" ON) +-IF(NOT enable_dynamic_loading) +- ADD_DEFINITIONS("-DIGNORE_DYNAMIC_LOADING") +-ENDIF() +- +-OPTION(enable_register_main_static_data "Perform the initial guess of data root sets" ON) +-IF(NOT enable_register_main_static_data) +- ADD_DEFINITIONS("-DGC_DONT_REGISTER_MAIN_STATIC_DATA") +-ENDIF() +- +-OPTION(enable_large_config "Optimize for large heap or root set" NO) +-IF(enable_large_config) +- ADD_DEFINITIONS("-DLARGE_CONFIG") +-ENDIF(enable_large_config) +- +-OPTION(enable_gc_assertions "Enable collector-internal assertion checking" NO) +-IF(enable_gc_assertions) +- ADD_DEFINITIONS("-DGC_ASSERTIONS") +-ENDIF(enable_gc_assertions) +- +-OPTION(enable_threads_discovery "Enable threads discovery in GC" ON) +-IF(NOT enable_threads_discovery) +- ADD_DEFINITIONS("-DGC_NO_THREADS_DISCOVERY") +-ENDIF() +- +-OPTION(enable_checksums "Report erroneously cleared dirty bits" NO) +-IF(enable_checksums) +- IF(enable_munmap OR enable_threads) +- MESSAGE("CHECKSUMS not compatible with USE_MUNMAP or threads") +- ENDIF() +- ADD_DEFINITIONS("-DCHECKSUMS") +- SET(SRC ${SRC} checksums.c) +-ENDIF(enable_checksums) +- +-ADD_LIBRARY( gc-lib STATIC ${SRC}) +-SET_TARGET_PROPERTIES(gc-lib PROPERTIES +- COMPILE_DEFINITIONS GC_NOT_DLL) +-#TODO TARGET_LINK_LIBRARIES(... ... ${LIBS}) +- +-ADD_LIBRARY( gcmt-lib STATIC ${SRC}) +-SET_TARGET_PROPERTIES(gcmt-lib PROPERTIES +- COMPILE_DEFINITIONS GC_NOT_DLL) +- +-ADD_LIBRARY( gcmt-dll SHARED ${SRC}) +- +-IF(WIN32) +- ADD_EXECUTABLE(cord cord/cordbscs.c cord/cordxtra.c +- cord/tests/de.c cord/tests/de_win.c) +- SET_TARGET_PROPERTIES(cord PROPERTIES WIN32_EXECUTABLE TRUE) +- SET_TARGET_PROPERTIES(cord PROPERTIES +- COMPILE_DEFINITIONS GC_NOT_DLL) +- TARGET_LINK_LIBRARIES(cord gc-lib) +- TARGET_LINK_LIBRARIES(cord gdi32) +-ENDIF(WIN32) +- +-ADD_SUBDIRECTORY(tests) ++set(THREADDLLIBS) ++ ++set(_HOST ${CMAKE_SYSTEM_PROCESSOR}-unknown-${CMAKE_SYSTEM}) ++string(TOLOWER ${_HOST} HOST) ++message(STATUS "TARGET = ${HOST}") ++ ++if (enable_threads) ++ if(NOT APPLE) ++ find_package(Threads REQUIRED) ++ message(STATUS "Thread library: ${CMAKE_THREAD_LIBS_INIT}") ++ include_directories(${Threads_INCLUDE_DIR}) ++ set(THREADDLLIBS ${CMAKE_THREAD_LIBS_INIT}) ++ endif() ++ if (MSVC) ++ find_package(Atomic_ops CONFIG) ++ if (Atomic_ops_FOUND) ++ get_target_property(AO_INCLUDE_DIRS Atomic_ops::atomic_ops ++ INTERFACE_INCLUDE_DIRECTORIES) ++ include_directories(${AO_INCLUDE_DIRS}) ++ endif() ++ endif() ++ if (NOT (APPLE OR CYGWIN OR MSYS OR WIN32 OR HOST MATCHES mips-.*-irix6.*)) ++ set(THREADDLLIBS ${THREADDLLIBS} -ldl) ++ # The predefined CMAKE_DL_LIBS may be broken. ++ endif() ++endif(enable_threads) ++ ++# Thread support detection. ++if (CMAKE_USE_PTHREADS_INIT) ++ set(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c) ++ if (HOST MATCHES .*-.*-hpux10.*) ++ message(FATAL_ERROR "HP/UX 10 POSIX threads are not supported.") ++ endif() ++ # Assume the compiler supports C11 (GCC) atomic intrinsics. ++ add_definitions("-DGC_BUILTIN_ATOMIC") ++ # Common defines for POSIX platforms. ++ add_definitions("-DGC_THREADS -D_REENTRANT") ++ if (enable_parallel_mark) ++ add_definitions("-DPARALLEL_MARK") ++ endif() ++ if (enable_thread_local_alloc) ++ add_definitions("-DTHREAD_LOCAL_ALLOC") ++ set(SRC ${SRC} thread_local_alloc.c) ++ endif() ++ message("Explicit GC_INIT() calls may be required.") ++ if (HOST MATCHES .*-.*-hpux11.*) ++ message("Only HP/UX 11 POSIX threads are supported.") ++ add_definitions("-D_POSIX_C_SOURCE=199506L") ++ elseif (HOST MATCHES .*-.*-netbsd.*) ++ message("Only on NetBSD 2.0 or later.") ++ add_definitions("-D_PTHREADS") ++ endif() ++ if (ANDROID OR MSYS) # ANDROID variable is defined by CMake v3.7.0+. ++ # Android NDK does not provide pthread_atfork. ++ elseif (APPLE) ++ if (enable_handle_fork AND NOT disable_handle_fork) ++ # The incremental mode conflicts with fork handling. ++ if (enable_parallel_mark) ++ add_definitions("-DHANDLE_FORK") ++ endif(enable_parallel_mark) ++ endif() ++ set(SRC ${SRC} darwin_stop_world.c) ++ elseif (enable_handle_fork AND NOT disable_handle_fork) ++ add_definitions("-DHANDLE_FORK") ++ endif() ++ if (enable_sigrt_signals) ++ add_definitions("-DGC_USESIGRT_SIGNALS") ++ endif() ++ if (CYGWIN OR MSYS) ++ set(SRC ${SRC} win32_threads.c) ++ endif() ++elseif (CMAKE_USE_WIN32_THREADS_INIT) ++ add_definitions("-DGC_THREADS") ++ if (enable_parallel_mark) ++ add_definitions("-DPARALLEL_MARK") ++ endif() ++ if (enable_thread_local_alloc AND (enable_parallel_mark OR NOT BUILD_SHARED_LIBS)) ++ # Imply THREAD_LOCAL_ALLOC unless GC_DLL. ++ add_definitions("-DTHREAD_LOCAL_ALLOC") ++ set(SRC ${SRC} thread_local_alloc.c) ++ endif() ++ add_definitions("-DEMPTY_GETENV_RESULTS") ++ set(SRC ${SRC} win32_threads.c) ++elseif (CMAKE_HP_PTHREADS_INIT OR CMAKE_USE_SPROC_INIT) ++ message(FATAL_ERROR "Unsupported thread package") ++endif() ++ ++if (disable_handle_fork) ++ add_definitions("-DNO_HANDLE_FORK") ++endif() ++ ++if (enable_gcj_support) ++ add_definitions("-DGC_GCJ_SUPPORT") ++ if (enable_threads AND NOT (enable_thread_local_alloc AND HOST MATCHES .*-.*-kfreebsd.*-gnu)) ++ # FIXME: For a reason, gctest hangs up on kFreeBSD if both of ++ # THREAD_LOCAL_ALLOC and GC_ENABLE_SUSPEND_THREAD are defined. ++ add_definitions("-DGC_ENABLE_SUSPEND_THREAD") ++ endif() ++ set(SRC ${SRC} gcj_mlc.c) ++endif(enable_gcj_support) ++ ++if (enable_disclaim) ++ add_definitions("-DENABLE_DISCLAIM") ++ set(SRC ${SRC} fnlz_mlc.c) ++endif() ++ ++if (enable_java_finalization) ++ add_definitions("-DJAVA_FINALIZATION") ++endif() ++ ++if (enable_atomic_uncollectable) ++ add_definitions("-DGC_ATOMIC_UNCOLLECTABLE") ++endif() ++ ++if (enable_gc_debug) ++ add_definitions("-DDBG_HDRS_ALL -DKEEP_BACK_PTRS") ++ if (HOST MATCHES i.86-.*-dgux.*|ia64-.*-linux.*|i586-.*-linux.*|i686-.*-linux.*|x86-.*-linux.*|x86_64-.*-linux.*) ++ add_definitions("-DMAKE_BACK_GRAPH") ++ if (HOST MATCHES .*-.*-.*linux.*) ++ add_definitions("-DSAVE_CALL_COUNT=8") ++ endif() ++ set(SRC ${SRC} backgraph.c) ++ endif() ++endif(enable_gc_debug) ++ ++if (disable_gc_debug) ++ add_definitions("-DNO_DEBUGGING") ++elseif (WINCE) ++ # Read environment variables from ".gc.env" file. ++ add_definitions("-DGC_READ_ENV_FILE") ++endif() ++ ++if (enable_redirect_malloc) ++ if (enable_gc_debug) ++ add_definitions("-DREDIRECT_MALLOC=GC_debug_malloc_replacement") ++ add_definitions("-DREDIRECT_REALLOC=GC_debug_realloc_replacement") ++ add_definitions("-DREDIRECT_FREE=GC_debug_free") ++ else() ++ add_definitions("-DREDIRECT_MALLOC=GC_malloc") ++ endif() ++ add_definitions("-DGC_USE_DLOPEN_WRAP") ++endif(enable_redirect_malloc) ++ ++if (enable_munmap) ++ add_definitions("-DUSE_MMAP -DUSE_MUNMAP") ++elseif (enable_mmap) ++ add_definitions("-DUSE_MMAP") ++endif() ++ ++if (NOT enable_dynamic_loading) ++ add_definitions("-DIGNORE_DYNAMIC_LOADING") ++endif() ++ ++if (NOT enable_register_main_static_data) ++ add_definitions("-DGC_DONT_REGISTER_MAIN_STATIC_DATA") ++endif() ++ ++if (enable_large_config) ++ add_definitions("-DLARGE_CONFIG") ++endif() ++ ++if (enable_gc_assertions) ++ add_definitions("-DGC_ASSERTIONS") ++endif() ++ ++if (NOT enable_threads_discovery) ++ add_definitions("-DGC_NO_THREADS_DISCOVERY") ++endif() ++ ++if (enable_checksums) ++ if (enable_munmap OR enable_threads) ++ message(FATAL_ERROR "CHECKSUMS not compatible with USE_MUNMAP or threads") ++ endif() ++ add_definitions("-DCHECKSUMS") ++ set(SRC ${SRC} checksums.c) ++endif(enable_checksums) ++ ++if (enable_werror) ++ if (BORLAND) ++ add_compile_options(/w!) ++ elseif (MSVC) ++ add_compile_options(/WX) ++ # Workaround "typedef ignored on left of ..." warning reported in ++ # imagehlp.h of e.g. Windows Kit 8.1. ++ add_compile_options(/wd4091) ++ elseif (WATCOM) ++ add_compile_options(/we) ++ else() ++ add_compile_options(-Werror) ++ if (APPLE) ++ # _dyld_bind_fully_image_containing_address is deprecated in OS X 10.5+ ++ add_compile_options(-Wno-deprecated-declarations) ++ endif() ++ endif() ++endif(enable_werror) ++ ++if (enable_single_obj_compilation OR BUILD_SHARED_LIBS) ++ set(SRC extra/gc.c) # override SRC ++ if (CMAKE_USE_PTHREADS_INIT) ++ add_definitions("-DGC_PTHREAD_START_STANDALONE") ++ set(SRC ${SRC} pthread_start.c) ++ endif(CMAKE_USE_PTHREADS_INIT) ++elseif (BORLAND) ++ # Suppress "GC_push_contents_hdr() is declared but never used" warning. ++ add_compile_options(/w-use) ++endif() ++ ++# Add implementation of backtrace() and backtrace_symbols(). ++if (MSVC) ++ set(SRC ${SRC} extra/msvc_dbg.c) ++endif() ++ ++# Instruct check_c_source_compiles and similar CMake checks not to ignore ++# compiler warnings (like "implicit declaration of function"). ++if (NOT BORLAND AND NOT MSVC AND NOT WATCOM) ++ check_c_compiler_flag(-Werror HAVE_FLAG_WERROR) ++ if (HAVE_FLAG_WERROR) ++ SET(CMAKE_REQUIRED_FLAGS "-Werror") ++ endif(HAVE_FLAG_WERROR) ++endif() ++ ++if (BUILD_SHARED_LIBS) ++ add_definitions("-DGC_DLL") ++ # Pass -fvisibility=hidden option if supported. ++ check_c_compiler_flag(-fvisibility=hidden HAVE_FLAG_F_VISIBILITY_HIDDEN) ++ if (HAVE_FLAG_F_VISIBILITY_HIDDEN) ++ add_definitions("-DGC_VISIBILITY_HIDDEN_SET") ++ add_compile_options(-fvisibility=hidden) ++ else() ++ add_definitions("-DGC_NO_VISIBILITY") ++ endif() ++ check_c_compiler_flag(-Wl,--no-undefined HAVE_FLAG_WL_NO_UNDEFINED) ++else() ++ add_definitions("-DGC_NOT_DLL") ++ if (WIN32) ++ # Do not require the clients to link with "user32" system library. ++ add_definitions("-DDONT_USE_USER32_DLL") ++ endif(WIN32) ++endif() ++ ++# Disable strict aliasing optimizations. ++# It could re-enabled back by a flag passed in CFLAGS_EXTRA. ++check_c_compiler_flag(-fno-strict-aliasing HAVE_FLAG_F_NO_STRICT_ALIASING) ++if (HAVE_FLAG_F_NO_STRICT_ALIASING) ++ add_compile_options(-fno-strict-aliasing) ++endif() ++ ++# Extra user-defined flags to pass both to C and C++ compilers. ++if (DEFINED CFLAGS_EXTRA) ++ add_compile_options(${CFLAGS_EXTRA}) ++endif() ++ ++# Check whether execinfo.h header file is present. ++check_include_file(execinfo.h HAVE_EXECINFO_H) ++if (NOT HAVE_EXECINFO_H) ++ add_definitions("-DGC_MISSING_EXECINFO_H") ++endif() ++ ++# Check for getcontext (uClibc can be configured without it, for example). ++check_function_exists(getcontext HAVE_GETCONTEXT) ++if (NOT HAVE_GETCONTEXT) ++ add_definitions("-DNO_GETCONTEXT") ++endif() ++ ++# Check whether dl_iterate_phdr exists (as a strong symbol). ++check_function_exists(dl_iterate_phdr HAVE_DL_ITERATE_PHDR) ++if (HAVE_DL_ITERATE_PHDR) ++ add_definitions("-DHAVE_DL_ITERATE_PHDR") ++endif() ++ ++check_symbol_exists(sigsetjmp setjmp.h HAVE_SIGSETJMP) ++if (NOT HAVE_SIGSETJMP) ++ add_definitions("-DGC_NO_SIGSETJMP") ++endif() ++ ++# pthread_setname_np, if available, may have 1, 2 or 3 arguments. ++if (CMAKE_USE_PTHREADS_INIT) ++ check_c_source_compiles(" ++#include \n ++int main(void) { (void)pthread_setname_np(\"thread-name\"); return 0; }" ++ HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) ++ if (HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) ++ # Define to use 'pthread_setname_np(const char*)' function. ++ add_definitions("-DHAVE_PTHREAD_SETNAME_NP_WITHOUT_TID") ++ else() ++ check_c_source_compiles(" ++#include \n ++int main(void) {\n ++ (void)pthread_setname_np(pthread_self(), \"thread-name-%u\", 0); return 0; }" ++ HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG) ++ if (HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG) ++ # Define to use 'pthread_setname_np(pthread_t, const char*, void *)'. ++ add_definitions("-DHAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG") ++ else() ++ check_c_source_compiles(" ++#if defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) || defined(__CYGWIN__)\n ++#define _GNU_SOURCE 1\n ++#endif\n ++#include \n ++int main(void) {\n ++ (void)pthread_setname_np(pthread_self(), \"thread-name\"); return 0; }" ++ HAVE_PTHREAD_SETNAME_NP_WITH_TID) ++ if (HAVE_PTHREAD_SETNAME_NP_WITH_TID) ++ # Define to use 'pthread_setname_np(pthread_t, const char*)' function. ++ add_definitions("-DHAVE_PTHREAD_SETNAME_NP_WITH_TID") ++ endif() ++ endif(HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG) ++ endif (HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) ++endif() ++ ++# Check for dladdr (used for debugging). ++check_c_source_compiles(" ++#define _GNU_SOURCE 1\n ++#include \n ++int main(void) { Dl_info info; (void)dladdr(\"\", &info); return 0; }" ++ HAVE_DLADDR) ++if (HAVE_DLADDR) ++ # Define to use 'dladdr' function. ++ add_definitions("-DHAVE_DLADDR") ++endif() ++ ++add_library(gc ${SRC}) ++if (enable_threads) ++ target_link_libraries(gc PRIVATE ${THREADDLLIBS}) ++endif() ++ ++if (enable_cplusplus) ++ add_library(gccpp gc_cpp.cc) ++ target_link_libraries(gccpp PRIVATE gc) ++endif() ++ ++if (build_cord) ++ set(CORD_SRC cord/cordbscs.c cord/cordprnt.c cord/cordxtra.c) ++ add_library(cord ${CORD_SRC}) ++ target_link_libraries(cord PRIVATE gc) ++ install(TARGETS cord EXPORT cordExports ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ RUNTIME DESTINATION bin ++ INCLUDES DESTINATION include) ++endif() ++ ++if (BUILD_SHARED_LIBS AND HAVE_FLAG_WL_NO_UNDEFINED) ++ # Declare that the libraries do not refer to external symbols. ++ # TODO: use add_link_options() when cmake_minimum_required > 3.13 ++ target_link_libraries(gc PRIVATE -Wl,--no-undefined) ++ if (enable_cplusplus) ++ target_link_libraries(gccpp PRIVATE -Wl,--no-undefined) ++ endif(enable_cplusplus) ++ if (build_cord) ++ target_link_libraries(cord PRIVATE -Wl,--no-undefined) ++ endif(build_cord) ++endif() ++ ++install(TARGETS gc EXPORT gcExports ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ RUNTIME DESTINATION bin ++ INCLUDES DESTINATION include) ++ ++if (enable_cplusplus) ++ install(TARGETS gccpp EXPORT gccppExports ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib ++ RUNTIME DESTINATION bin ++ INCLUDES DESTINATION include) ++endif() ++ ++if (install_headers) ++ install(FILES include/gc.h ++ include/gc_backptr.h ++ include/gc_config_macros.h ++ include/gc_gcj.h ++ include/gc_inline.h ++ include/gc_mark.h ++ include/gc_pthread_redirects.h ++ include/gc_tiny_fl.h ++ include/gc_typed.h ++ include/gc_version.h ++ include/javaxfc.h ++ include/leak_detector.h ++ DESTINATION include/gc) ++ install(FILES include/extra/gc.h DESTINATION include) ++ if (enable_cplusplus) ++ install(FILES include/gc_allocator.h ++ include/gc_cpp.h ++ DESTINATION include/gc) ++ install(FILES include/extra/gc_cpp.h DESTINATION include) ++ endif() ++ if (enable_disclaim) ++ install(FILES include/gc_disclaim.h DESTINATION include/gc) ++ endif() ++ if (build_cord) ++ install(FILES include/cord.h ++ include/cord_pos.h ++ include/ec.h ++ DESTINATION include/gc) ++ endif() ++endif(install_headers) ++ ++if (build_tests) ++ if (build_cord) ++ add_executable(cordtest cord/tests/cordtest.c) ++ target_link_libraries(cordtest PRIVATE cord gc) ++ add_test(NAME cordtest COMMAND cordtest) ++ ++ if (WIN32 AND NOT CYGWIN) ++ add_executable(de cord/tests/de.c cord/tests/de_win.c ++ cord/tests/de_win.rc) ++ set_target_properties(de PROPERTIES WIN32_EXECUTABLE TRUE) ++ target_link_libraries(de PRIVATE cord gc gdi32) ++ endif() ++ endif(build_cord) ++ ++ # Compile some tests as C++ to test extern "C" in header files. ++ if (enable_cplusplus) ++ set_source_files_properties(tests/leak_test.c tests/test.c ++ PROPERTIES LANGUAGE CXX) ++ # To avoid "treating 'c' input as 'c++' when in C++ mode" Clang warning. ++ if (NOT (BORLAND OR MSVC OR WATCOM)) ++ add_compile_options(-x c++) ++ endif() ++ endif(enable_cplusplus) ++ ++ add_executable(gctest WIN32 tests/test.c) ++ target_link_libraries(gctest PRIVATE gc ${THREADDLLIBS}) ++ add_test(NAME gctest COMMAND gctest) ++ if (WATCOM) ++ # Suppress "conditional expression in if statement is always true/false" ++ # and "unreachable code" warnings in GC_MALLOC_[ATOMIC_]WORDS. ++ target_compile_options(gctest PRIVATE ++ /wcd=13 /wcd=201 /wcd=367 /wcd=368 /wcd=726) ++ endif() ++ ++ add_executable(hugetest tests/huge_test.c) ++ target_link_libraries(hugetest PRIVATE gc) ++ add_test(NAME hugetest COMMAND hugetest) ++ ++ add_executable(leaktest tests/leak_test.c) ++ target_link_libraries(leaktest PRIVATE gc) ++ add_test(NAME leaktest COMMAND leaktest) ++ ++ add_executable(middletest tests/middle.c) ++ target_link_libraries(middletest PRIVATE gc) ++ add_test(NAME middletest COMMAND middletest) ++ ++ add_executable(realloc_test tests/realloc_test.c) ++ target_link_libraries(realloc_test PRIVATE gc) ++ add_test(NAME realloc_test COMMAND realloc_test) ++ ++ add_executable(smashtest tests/smash_test.c) ++ target_link_libraries(smashtest PRIVATE gc) ++ add_test(NAME smashtest COMMAND smashtest) ++ ++ if (NOT (BUILD_SHARED_LIBS AND WIN32)) ++ add_library(staticrootslib_test tests/staticrootslib.c) ++ target_link_libraries(staticrootslib_test PRIVATE gc) ++ add_library(staticrootslib2_test tests/staticrootslib.c) ++ target_compile_options(staticrootslib2_test PRIVATE "-DSTATICROOTSLIB2") ++ target_link_libraries(staticrootslib2_test PRIVATE gc) ++ add_executable(staticrootstest tests/staticrootstest.c) ++ target_compile_options(staticrootstest PRIVATE "-DSTATICROOTSLIB2") ++ target_link_libraries(staticrootstest PRIVATE ++ gc staticrootslib_test staticrootslib2_test) ++ add_test(NAME staticrootstest COMMAND staticrootstest) ++ endif() ++ ++ if (enable_gc_debug) ++ add_executable(tracetest tests/trace_test.c) ++ target_link_libraries(tracetest PRIVATE gc) ++ add_test(NAME tracetest COMMAND tracetest) ++ endif() ++ ++ if (enable_threads) ++ add_executable(test_atomic_ops tests/test_atomic_ops.c) ++ target_link_libraries(test_atomic_ops PRIVATE gc) ++ add_test(NAME test_atomic_ops COMMAND test_atomic_ops) ++ ++ add_executable(threadleaktest tests/thread_leak_test.c) ++ target_link_libraries(threadleaktest PRIVATE gc ${THREADDLLIBS}) ++ add_test(NAME threadleaktest COMMAND threadleaktest) ++ ++ if (NOT WIN32) ++ add_executable(threadkey_test tests/threadkey_test.c) ++ target_link_libraries(threadkey_test PRIVATE gc ${THREADDLLIBS}) ++ add_test(NAME threadkey_test COMMAND threadkey_test) ++ endif() ++ ++ add_executable(subthreadcreate_test tests/subthread_create.c) ++ target_link_libraries(subthreadcreate_test PRIVATE gc ${THREADDLLIBS}) ++ add_test(NAME subthreadcreate_test COMMAND subthreadcreate_test) ++ ++ add_executable(initsecondarythread_test tests/initsecondarythread.c) ++ target_link_libraries(initsecondarythread_test PRIVATE gc ${THREADDLLIBS}) ++ add_test(NAME initsecondarythread_test COMMAND initsecondarythread_test) ++ endif(enable_threads) ++ ++ if (enable_cplusplus) ++ add_executable(test_cpp WIN32 tests/test_cpp.cc) ++ target_link_libraries(test_cpp PRIVATE gc gccpp) ++ add_test(NAME test_cpp COMMAND test_cpp) ++ endif() ++ ++ if (enable_disclaim) ++ add_executable(disclaim_bench tests/disclaim_bench.c) ++ target_link_libraries(disclaim_bench PRIVATE gc) ++ add_test(NAME disclaim_bench COMMAND disclaim_bench) ++ ++ add_executable(disclaim_test tests/disclaim_test.c) ++ target_link_libraries(disclaim_test PRIVATE gc ${THREADDLLIBS}) ++ add_test(NAME disclaim_test COMMAND disclaim_test) ++ ++ add_executable(disclaim_weakmap_test tests/disclaim_weakmap_test.c) ++ target_link_libraries(disclaim_weakmap_test PRIVATE gc ${THREADDLLIBS}) ++ add_test(NAME disclaim_weakmap_test COMMAND disclaim_weakmap_test) ++ endif() ++endif(build_tests) diff --git a/recipes/bdwgc/all/patches/update-cmake-8_0_6.patch b/recipes/bdwgc/all/patches/update-cmake-8_0_6.patch index 97f0276e5915d..10451ed429544 100644 --- a/recipes/bdwgc/all/patches/update-cmake-8_0_6.patch +++ b/recipes/bdwgc/all/patches/update-cmake-8_0_6.patch @@ -1,6 +1,6 @@ --- CMakeLists.txt +++ CMakeLists.txt -@@ -21,232 +21,592 @@ +@@ -21,232 +21,599 @@ # this will generate gc.sln # @@ -321,7 +321,14 @@ + include_directories(${Threads_INCLUDE_DIR}) + set(THREADDLLIBS ${CMAKE_THREAD_LIBS_INIT}) + endif() -+ include_directories(libatomic_ops/src) ++ if (MSVC) ++ find_package(Atomic_ops CONFIG) ++ if (Atomic_ops_FOUND) ++ get_target_property(AO_INCLUDE_DIRS Atomic_ops::atomic_ops ++ INTERFACE_INCLUDE_DIRECTORIES) ++ include_directories(${AO_INCLUDE_DIRS}) ++ endif() ++ endif() + if (NOT (APPLE OR CYGWIN OR MSYS OR WIN32 OR HOST MATCHES mips-.*-irix6.*)) + set(THREADDLLIBS ${THREADDLLIBS} -ldl) + # The predefined CMAKE_DL_LIBS may be broken. diff --git a/recipes/bdwgc/all/patches/update-cmake-8_2_2.patch b/recipes/bdwgc/all/patches/update-cmake-8_2_2.patch new file mode 100644 index 0000000000000..3d721c976bf45 --- /dev/null +++ b/recipes/bdwgc/all/patches/update-cmake-8_2_2.patch @@ -0,0 +1,15 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -161,6 +161,12 @@ if (enable_threads) + message(STATUS "Thread library: ${CMAKE_THREAD_LIBS_INIT}") + if (without_libatomic_ops OR BORLAND OR MSVC OR WATCOM) + include_directories(libatomic_ops/src) ++ find_package(Atomic_ops CONFIG) ++ if (Atomic_ops_FOUND) ++ get_target_property(AO_INCLUDE_DIRS Atomic_ops::atomic_ops ++ INTERFACE_INCLUDE_DIRECTORIES) ++ include_directories(${AO_INCLUDE_DIRS}) ++ endif() + # Note: alternatively, use CFLAGS_EXTRA to pass -I<...>/libatomic_ops/src. + else() + # Assume the compiler supports GCC atomic intrinsics. diff --git a/recipes/bdwgc/all/patches/update-cmake.patch b/recipes/bdwgc/all/patches/update-cmake.patch deleted file mode 100644 index 35f75a11f629a..0000000000000 --- a/recipes/bdwgc/all/patches/update-cmake.patch +++ /dev/null @@ -1,834 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -21,241 +21,596 @@ - # this will generate gc.sln - # - --SET(CMAKE_LEGACY_CYGWIN_WIN32 0) # Remove when CMake >= 2.8.4 is required -- --PROJECT(gc) -- --INCLUDE(CTest) -- --CMAKE_MINIMUM_REQUIRED(VERSION 2.6) -- --ADD_DEFINITIONS("-D_CRT_SECURE_NO_DEPRECATE -- -DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION") -- --IF(APPLE) -- IF("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "") -- SET(CMAKE_OSX_ARCHITECTURES "ppc;i386;x86_64" CACHE STRING "Build architectures for Mac OS X" FORCE) -- ENDIF() --ENDIF(APPLE) -- --#LIBATOMIC #TODO --#ADD_LIBRARY(atomic_ops STATIC ) --#SET_TARGET_PROPERTIES(atomic_ops PROPERTIES COMPILE_FLAGS -DNO_DEBUGGING) -- -- --#LIBGC -- --INCLUDE_DIRECTORIES(include) --INCLUDE_DIRECTORIES(libatomic_ops/src) -- --SET(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c -+cmake_minimum_required(VERSION 3.1) -+ -+option(enable_cplusplus "C++ support" OFF) -+if (enable_cplusplus) -+ project(gc) -+else() -+ project(gc C) -+endif() -+ -+include(CheckCCompilerFlag) -+include(CheckCSourceCompiles) -+include(CheckFunctionExists) -+include(CheckIncludeFile) -+include(CheckSymbolExists) -+include(CTest) -+ -+# Customize the build by passing "-D=ON|OFF" in the command line. -+option(BUILD_SHARED_LIBS "Build shared libraries" ON) -+option(build_cord "Build cord library" ON) -+option(build_tests "Build tests" OFF) -+option(enable_threads "Support threads" ON) -+option(enable_parallel_mark "Parallelize marking and free list construction" ON) -+option(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON) -+option(enable_threads_discovery "Enable threads discovery in GC" ON) -+option(enable_gcj_support "Support for gcj" ON) -+option(enable_sigrt_signals "Use SIGRTMIN-based signals for thread suspend/resume" OFF) -+option(enable_gc_debug "Support for pointer back-tracing" OFF) -+option(disable_gc_debug "Disable debugging like GC_dump and its callees" OFF) -+option(enable_java_finalization "Support for java finalization" ON) -+option(enable_atomic_uncollectable "Support for atomic uncollectible allocation" ON) -+option(enable_redirect_malloc "Redirect malloc and friends to GC routines" OFF) -+option(enable_disclaim "Support alternative finalization interface" ON) -+option(enable_large_config "Optimize for large heap or root set" OFF) -+option(enable_gc_assertions "Enable collector-internal assertion checking" OFF) -+option(enable_mmap "Use mmap instead of sbrk to expand the heap" OFF) -+option(enable_munmap "Return page to the OS if empty for N collections" ON) -+option(enable_dynamic_loading "Enable tracing of dynamic library data roots" ON) -+option(enable_register_main_static_data "Perform the initial guess of data root sets" ON) -+option(enable_checksums "Report erroneously cleared dirty bits" OFF) -+option(enable_werror "Pass -Werror to the C compiler (treat warnings as errors)" OFF) -+option(enable_single_obj_compilation "Compile all libgc source files into single .o" OFF) -+option(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON) -+option(disable_handle_fork "Prohibit installation of pthread_atfork() handlers" OFF) -+option(install_headers "Install header files" ON) -+ -+add_definitions("-DALL_INTERIOR_POINTERS -DNO_EXECUTE_PERMISSION") -+ -+if (APPLE AND ("${CMAKE_OSX_ARCHITECTURES}" STREQUAL "")) -+ set(CMAKE_OSX_ARCHITECTURES "x86_64;i386" -+ CACHE STRING "Build architectures for Mac OS X" FORCE) -+endif() -+ -+# Set struct packing alignment to word (instead of 1-byte). -+if (BORLAND) -+ add_compile_options(/a4) -+elseif (WATCOM) -+ add_compile_options(/zp4) -+endif() -+ -+# Output all warnings. -+if (BORLAND) -+ # All warnings except for particular ones. -+ add_compile_options(/w /w-pro /w-aus /w-par /w-ccc /w-inl /w-rch) -+elseif (MSVC) -+ # All warnings but ignoring "unreferenced formal parameter" and -+ # "conditional expression is constant" ones. -+ add_compile_options(/W4 /wd4100 /wd4127) -+ # Disable crt security warnings, since unfortunately they warn about all -+ # sorts of safe uses of strncpy. -+ add_definitions("-D_CRT_SECURE_NO_DEPRECATE") -+elseif (WATCOM) -+ add_compile_options(/wx) -+else() -+ # TODO add -[W]pedantic -Wno-long-long -+ add_compile_options(-Wall -Wextra) -+endif() -+ -+include_directories(include) -+ -+set(SRC alloc.c reclaim.c allchblk.c misc.c mach_dep.c os_dep.c - mark_rts.c headers.c mark.c obj_map.c blacklst.c finalize.c - new_hblk.c dbg_mlc.c malloc.c dyn_load.c typd_mlc.c ptr_chck.c - mallocx.c) --SET(LIBS) --OPTION(enable_threads "TODO" NO) --IF(enable_threads) -- FIND_PACKAGE(Threads REQUIRED) -- MESSAGE("Thread Model: ${CMAKE_THREAD_LIBS_INIT}" ) -- INCLUDE_DIRECTORIES(${Threads_INCLUDE_DIR}) -- SET(LIBS ${LIBS} ${Threads_LIBRARIES}) --ENDIF(enable_threads) -- --OPTION(enable_handle_fork "Attempt to ensure a usable collector after fork()" ON) -- --OPTION(enable_thread_local_alloc "Turn on thread-local allocation optimization" ON) -- --OPTION(enable_parallel_mark "Parallelize marking and free list construction" ON) -- --#IF(Threads_FOUND) --# ADD_DEFINITIONS("") --#ELSE --# MESSAGE("Parallel mark requires enable_threads ON" ) --#ENDIF(Threads_FOUND) -- --#OPTION(enable_cplusplus "install C++ support" ON) --SET(SRC ${SRC} gc_cpp.cc) -- --SET(_HOST ${CMAKE_HOST_SYSTEM_PROCESSOR}--${CMAKE_SYSTEM}) #FIXME missing the vendor field. --STRING(TOLOWER ${_HOST} HOST) --MESSAGE("HOST = ${HOST}") -- --# Thread Detection. Relying on cmake for lib and includes. --#TODO check cmake detection --IF(CMAKE_USE_PTHREADS_INIT) -- SET(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c) -- # Common defines for most POSIX platforms. -- IF( HOST MATCHES .*-.*-aix.*|.*-.*-android.*|.*-.*-cygwin.*|.*-.*-darwin.*|.*-.*-.*freebsd.*|.*-.*-haiku.*|.*-.*-gnu.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-.*linux.*|.*-.*-nacl.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*) -- ADD_DEFINITIONS("-DGC_THREADS -D_REENTRANT") -- IF(enable_parallel_mark) -- ADD_DEFINITIONS("-DPARALLEL_MARK") -- ENDIF(enable_parallel_mark) -- IF(enable_thread_local_alloc) -- ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") -- SET(SRC ${SRC} thread_local_alloc.c) -- ENDIF(enable_thread_local_alloc) -- MESSAGE("Explicit GC_INIT() calls may be required.") -- ENDIF() -- IF ( HOST MATCHES .*-.*-hpux11.*) -- MESSAGE("Only HP/UX 11 POSIX threads are supported.") -- ADD_DEFINITIONS("-D_POSIX_C_SOURCE=199506L") #TODO test -DVAR=value. Alternative is COMPILE_DEFINITIONS property -- ENDIF() -- IF ( HOST MATCHES .*-.*-hpux10.*) -- MESSAGE("HP/UX 10 POSIX threads are not supported.") -- ENDIF() -- IF ( HOST MATCHES .*-.*-netbsd.*) -- MESSAGE("Only on NetBSD 2.0 or later.") -- ADD_DEFINITIONS("-D_PTHREADS") -- ENDIF() -- IF( HOST MATCHES .*-.*-android.*) -- # Android NDK does not provide pthread_atfork. -- ELSEIF( HOST MATCHES .*-.*-aix.*|.*-.*-cygwin.*|.*-.*-freebsd.*|.*-.*-haiku.*|.*-.*-hpux11.*|.*-.*-irix.*|.*-.*-kfreebsd.*-gnu|.*-.*-.*linux.*|.*-.*-netbsd.*|.*-.*-openbsd.*|.*-.*-osf.*|.*-.*-solaris.*) -- IF(enable_handle_fork) -- ADD_DEFINITIONS("-DHANDLE_FORK") -- ENDIF(enable_handle_fork) -- ENDIF() -- IF ( HOST MATCHES .*-.*-cygwin.*) -- SET(SRC ${SRC} win32_threads.c) -- ENDIF() -- IF ( HOST MATCHES .*-.*-darwin.*) -- IF(enable_handle_fork) -- # The incremental mode conflicts with fork handling. -- IF(enable_parallel_mark) -- ADD_DEFINITIONS("-DHANDLE_FORK") -- ENDIF(enable_parallel_mark) -- ENDIF(enable_handle_fork) -- SET(SRC ${SRC} darwin_stop_world.c) -- #TODO -- #darwin_threads=true -- ENDIF() --ENDIF(CMAKE_USE_PTHREADS_INIT) -- --IF(CMAKE_USE_WIN32_THREADS_INIT) -- ADD_DEFINITIONS("-DGC_THREADS") -- IF(enable_parallel_mark) -- ADD_DEFINITIONS("-DPARALLEL_MARK") -- IF(enable_thread_local_alloc) -- ADD_DEFINITIONS("-DTHREAD_LOCAL_ALLOC") -- SET(SRC ${SRC} thread_local_alloc.c) -- ENDIF(enable_thread_local_alloc) -- ENDIF() -- ADD_DEFINITIONS("-DEMPTY_GETENV_RESULTS") #TODO test -- SET(SRC ${SRC} win32_threads.c) --ENDIF(CMAKE_USE_WIN32_THREADS_INIT) -- --OPTION(enable_gcj_support "Support for gcj" ON) --IF(enable_gcj_support) -- ADD_DEFINITIONS("-DGC_GCJ_SUPPORT") -- IF(enable_threads) -- ADD_DEFINITIONS("-DGC_ENABLE_SUSPEND_THREAD") -- ENDIF(enable_threads) -- SET(SRC ${SRC} gcj_mlc.c) --ENDIF(enable_gcj_support) -- --OPTION(enable_disclaim "Support alternative finalization interface" ON) --IF(enable_disclaim) -- ADD_DEFINITIONS("-DENABLE_DISCLAIM") -- SET(SRC ${SRC} fnlz_mlc.c) --ENDIF(enable_disclaim) -- --OPTION(enable_java_finalization "Support for java finalization" ON) --IF(enable_java_finalization) -- ADD_DEFINITIONS("-DJAVA_FINALIZATION") --ENDIF(enable_java_finalization) -- --OPTION(enable_atomic_uncollectable "Support for atomic uncollectible allocation" ON) --IF(enable_atomic_uncollectable) -- ADD_DEFINITIONS("-DGC_ATOMIC_UNCOLLECTABLE") --ENDIF(enable_atomic_uncollectable) -- --OPTION(enable_gc_debug "Support for pointer back-tracing" NO) --IF(enable_gc_debug) -- ADD_DEFINITIONS("-DDBG_HDRS_ALL -DKEEP_BACK_PTRS") -- IF (HOST MATCHES ia64-.*-linux.*|i586-.*-linux.*|i686-.*-linux.*|x86-.*-linux.*|x86_64-.*-linux.*) -- ADD_DEFINITIONS("-DMAKE_BACK_GRAPH") -- ADD_DEFINITIONS("-DSAVE_CALL_COUNT=8") -- SET(SRC ${SRC} backgraph.c) -- ENDIF() -- IF (HOST MATCHES i.86-.*-dgux.*) -- ADD_DEFINITIONS("-DMAKE_BACK_GRAPH") -- SET(SRC ${SRC} backgraph.c) -- ENDIF() --ENDIF(enable_gc_debug) -- --OPTION(enable_redirect_malloc "Redirect malloc and friends to GC routines" NO) --IF(enable_redirect_malloc) -- IF(enable_gc_debug) -- ADD_DEFINITIONS("-DREDIRECT_MALLOC=GC_debug_malloc_replacement") -- ADD_DEFINITIONS("-DREDIRECT_REALLOC=GC_debug_realloc_replacement") -- ADD_DEFINITIONS("-DREDIRECT_FREE=GC_debug_free") -- ELSE(enable_gc_debug) -- ADD_DEFINITIONS("-DREDIRECT_MALLOC=GC_malloc") -- ENDIF(enable_gc_debug) -- ADD_DEFINITIONS("-DGC_USE_DLOPEN_WRAP") --ENDIF(enable_redirect_malloc) -- --OPTION(enable_mmap "Use mmap instead of sbrk to expand the heap" NO) -- --OPTION(enable_munmap "Return page to the OS if empty for N collections" ON) --IF(enable_munmap) -- ADD_DEFINITIONS("-DUSE_MMAP -DUSE_MUNMAP") --ELSEIF(enable_mmap) -- ADD_DEFINITIONS("-DUSE_MMAP") --ENDIF() -- --OPTION(enable_dynamic_loading "Enable tracing of dynamic library data roots" ON) --IF(NOT enable_dynamic_loading) -- ADD_DEFINITIONS("-DIGNORE_DYNAMIC_LOADING") --ENDIF() -- --OPTION(enable_register_main_static_data "Perform the initial guess of data root sets" ON) --IF(NOT enable_register_main_static_data) -- ADD_DEFINITIONS("-DGC_DONT_REGISTER_MAIN_STATIC_DATA") --ENDIF() -- --OPTION(enable_large_config "Optimize for large heap or root set" NO) --IF(enable_large_config) -- ADD_DEFINITIONS("-DLARGE_CONFIG") --ENDIF(enable_large_config) -- --OPTION(enable_gc_assertions "Enable collector-internal assertion checking" NO) --IF(enable_gc_assertions) -- ADD_DEFINITIONS("-DGC_ASSERTIONS") --ENDIF(enable_gc_assertions) -- --OPTION(enable_threads_discovery "Enable threads discovery in GC" ON) --IF(NOT enable_threads_discovery) -- ADD_DEFINITIONS("-DGC_NO_THREADS_DISCOVERY") --ENDIF() -- --OPTION(enable_checksums "Report erroneously cleared dirty bits" NO) --IF(enable_checksums) -- IF(enable_munmap OR enable_threads) -- MESSAGE("CHECKSUMS not compatible with USE_MUNMAP or threads") -- ENDIF() -- ADD_DEFINITIONS("-DCHECKSUMS") -- SET(SRC ${SRC} checksums.c) --ENDIF(enable_checksums) -- --ADD_LIBRARY( gc-lib STATIC ${SRC}) --SET_TARGET_PROPERTIES(gc-lib PROPERTIES -- COMPILE_DEFINITIONS GC_NOT_DLL) --#TODO TARGET_LINK_LIBRARIES(... ... ${LIBS}) -- --ADD_LIBRARY( gcmt-lib STATIC ${SRC}) --SET_TARGET_PROPERTIES(gcmt-lib PROPERTIES -- COMPILE_DEFINITIONS GC_NOT_DLL) -- --ADD_LIBRARY( gcmt-dll SHARED ${SRC}) -- --IF(WIN32) -- ADD_EXECUTABLE(cord cord/cordbscs.c cord/cordxtra.c -- cord/tests/de.c cord/tests/de_win.c) -- SET_TARGET_PROPERTIES(cord PROPERTIES WIN32_EXECUTABLE TRUE) -- SET_TARGET_PROPERTIES(cord PROPERTIES -- COMPILE_DEFINITIONS GC_NOT_DLL) -- TARGET_LINK_LIBRARIES(cord gc-lib) -- TARGET_LINK_LIBRARIES(cord gdi32) --ENDIF(WIN32) -- --ADD_SUBDIRECTORY(tests) -+set(THREADDLLIBS) -+ -+set(_HOST ${CMAKE_SYSTEM_PROCESSOR}-unknown-${CMAKE_SYSTEM}) -+string(TOLOWER ${_HOST} HOST) -+message(STATUS "TARGET = ${HOST}") -+ -+if (enable_threads) -+ if(NOT APPLE) -+ find_package(Threads REQUIRED) -+ message(STATUS "Thread library: ${CMAKE_THREAD_LIBS_INIT}") -+ include_directories(${Threads_INCLUDE_DIR}) -+ set(THREADDLLIBS ${CMAKE_THREAD_LIBS_INIT}) -+ endif() -+ include_directories(libatomic_ops/src) -+ if (NOT (APPLE OR CYGWIN OR MSYS OR WIN32 OR HOST MATCHES mips-.*-irix6.*)) -+ set(THREADDLLIBS ${THREADDLLIBS} -ldl) -+ # The predefined CMAKE_DL_LIBS may be broken. -+ endif() -+endif(enable_threads) -+ -+# Thread support detection. -+if (CMAKE_USE_PTHREADS_INIT) -+ set(SRC ${SRC} pthread_start.c pthread_support.c pthread_stop_world.c) -+ if (HOST MATCHES .*-.*-hpux10.*) -+ message(FATAL_ERROR "HP/UX 10 POSIX threads are not supported.") -+ endif() -+ # Assume the compiler supports C11 (GCC) atomic intrinsics. -+ add_definitions("-DGC_BUILTIN_ATOMIC") -+ # Common defines for POSIX platforms. -+ add_definitions("-DGC_THREADS -D_REENTRANT") -+ if (enable_parallel_mark) -+ add_definitions("-DPARALLEL_MARK") -+ endif() -+ if (enable_thread_local_alloc) -+ add_definitions("-DTHREAD_LOCAL_ALLOC") -+ set(SRC ${SRC} thread_local_alloc.c) -+ endif() -+ message("Explicit GC_INIT() calls may be required.") -+ if (HOST MATCHES .*-.*-hpux11.*) -+ message("Only HP/UX 11 POSIX threads are supported.") -+ add_definitions("-D_POSIX_C_SOURCE=199506L") -+ elseif (HOST MATCHES .*-.*-netbsd.*) -+ message("Only on NetBSD 2.0 or later.") -+ add_definitions("-D_PTHREADS") -+ endif() -+ if (ANDROID OR MSYS) # ANDROID variable is defined by CMake v3.7.0+. -+ # Android NDK does not provide pthread_atfork. -+ elseif (APPLE) -+ if (enable_handle_fork AND NOT disable_handle_fork) -+ # The incremental mode conflicts with fork handling. -+ if (enable_parallel_mark) -+ add_definitions("-DHANDLE_FORK") -+ endif(enable_parallel_mark) -+ endif() -+ set(SRC ${SRC} darwin_stop_world.c) -+ elseif (enable_handle_fork AND NOT disable_handle_fork) -+ add_definitions("-DHANDLE_FORK") -+ endif() -+ if (enable_sigrt_signals) -+ add_definitions("-DGC_USESIGRT_SIGNALS") -+ endif() -+ if (CYGWIN OR MSYS) -+ set(SRC ${SRC} win32_threads.c) -+ endif() -+elseif (CMAKE_USE_WIN32_THREADS_INIT) -+ add_definitions("-DGC_THREADS") -+ if (enable_parallel_mark) -+ add_definitions("-DPARALLEL_MARK") -+ endif() -+ if (enable_thread_local_alloc AND (enable_parallel_mark OR NOT BUILD_SHARED_LIBS)) -+ # Imply THREAD_LOCAL_ALLOC unless GC_DLL. -+ add_definitions("-DTHREAD_LOCAL_ALLOC") -+ set(SRC ${SRC} thread_local_alloc.c) -+ endif() -+ add_definitions("-DEMPTY_GETENV_RESULTS") -+ set(SRC ${SRC} win32_threads.c) -+elseif (CMAKE_HP_PTHREADS_INIT OR CMAKE_USE_SPROC_INIT) -+ message(FATAL_ERROR "Unsupported thread package") -+endif() -+ -+if (disable_handle_fork) -+ add_definitions("-DNO_HANDLE_FORK") -+endif() -+ -+if (enable_gcj_support) -+ add_definitions("-DGC_GCJ_SUPPORT") -+ if (enable_threads AND NOT (enable_thread_local_alloc AND HOST MATCHES .*-.*-kfreebsd.*-gnu)) -+ # FIXME: For a reason, gctest hangs up on kFreeBSD if both of -+ # THREAD_LOCAL_ALLOC and GC_ENABLE_SUSPEND_THREAD are defined. -+ add_definitions("-DGC_ENABLE_SUSPEND_THREAD") -+ endif() -+ set(SRC ${SRC} gcj_mlc.c) -+endif(enable_gcj_support) -+ -+if (enable_disclaim) -+ add_definitions("-DENABLE_DISCLAIM") -+ set(SRC ${SRC} fnlz_mlc.c) -+endif() -+ -+if (enable_java_finalization) -+ add_definitions("-DJAVA_FINALIZATION") -+endif() -+ -+if (enable_atomic_uncollectable) -+ add_definitions("-DGC_ATOMIC_UNCOLLECTABLE") -+endif() -+ -+if (enable_gc_debug) -+ add_definitions("-DDBG_HDRS_ALL -DKEEP_BACK_PTRS") -+ if (HOST MATCHES i.86-.*-dgux.*|ia64-.*-linux.*|i586-.*-linux.*|i686-.*-linux.*|x86-.*-linux.*|x86_64-.*-linux.*) -+ add_definitions("-DMAKE_BACK_GRAPH") -+ if (HOST MATCHES .*-.*-.*linux.*) -+ add_definitions("-DSAVE_CALL_COUNT=8") -+ endif() -+ set(SRC ${SRC} backgraph.c) -+ endif() -+endif(enable_gc_debug) -+ -+if (disable_gc_debug) -+ add_definitions("-DNO_DEBUGGING") -+elseif (WINCE) -+ # Read environment variables from ".gc.env" file. -+ add_definitions("-DGC_READ_ENV_FILE") -+endif() -+ -+if (enable_redirect_malloc) -+ if (enable_gc_debug) -+ add_definitions("-DREDIRECT_MALLOC=GC_debug_malloc_replacement") -+ add_definitions("-DREDIRECT_REALLOC=GC_debug_realloc_replacement") -+ add_definitions("-DREDIRECT_FREE=GC_debug_free") -+ else() -+ add_definitions("-DREDIRECT_MALLOC=GC_malloc") -+ endif() -+ add_definitions("-DGC_USE_DLOPEN_WRAP") -+endif(enable_redirect_malloc) -+ -+if (enable_munmap) -+ add_definitions("-DUSE_MMAP -DUSE_MUNMAP") -+elseif (enable_mmap) -+ add_definitions("-DUSE_MMAP") -+endif() -+ -+if (NOT enable_dynamic_loading) -+ add_definitions("-DIGNORE_DYNAMIC_LOADING") -+endif() -+ -+if (NOT enable_register_main_static_data) -+ add_definitions("-DGC_DONT_REGISTER_MAIN_STATIC_DATA") -+endif() -+ -+if (enable_large_config) -+ add_definitions("-DLARGE_CONFIG") -+endif() -+ -+if (enable_gc_assertions) -+ add_definitions("-DGC_ASSERTIONS") -+endif() -+ -+if (NOT enable_threads_discovery) -+ add_definitions("-DGC_NO_THREADS_DISCOVERY") -+endif() -+ -+if (enable_checksums) -+ if (enable_munmap OR enable_threads) -+ message(FATAL_ERROR "CHECKSUMS not compatible with USE_MUNMAP or threads") -+ endif() -+ add_definitions("-DCHECKSUMS") -+ set(SRC ${SRC} checksums.c) -+endif(enable_checksums) -+ -+if (enable_werror) -+ if (BORLAND) -+ add_compile_options(/w!) -+ elseif (MSVC) -+ add_compile_options(/WX) -+ # Workaround "typedef ignored on left of ..." warning reported in -+ # imagehlp.h of e.g. Windows Kit 8.1. -+ add_compile_options(/wd4091) -+ elseif (WATCOM) -+ add_compile_options(/we) -+ else() -+ add_compile_options(-Werror) -+ if (APPLE) -+ # _dyld_bind_fully_image_containing_address is deprecated in OS X 10.5+ -+ add_compile_options(-Wno-deprecated-declarations) -+ endif() -+ endif() -+endif(enable_werror) -+ -+if (enable_single_obj_compilation OR BUILD_SHARED_LIBS) -+ set(SRC extra/gc.c) # override SRC -+ if (CMAKE_USE_PTHREADS_INIT) -+ add_definitions("-DGC_PTHREAD_START_STANDALONE") -+ set(SRC ${SRC} pthread_start.c) -+ endif(CMAKE_USE_PTHREADS_INIT) -+elseif (BORLAND) -+ # Suppress "GC_push_contents_hdr() is declared but never used" warning. -+ add_compile_options(/w-use) -+endif() -+ -+# Add implementation of backtrace() and backtrace_symbols(). -+if (MSVC) -+ set(SRC ${SRC} extra/msvc_dbg.c) -+endif() -+ -+# Instruct check_c_source_compiles and similar CMake checks not to ignore -+# compiler warnings (like "implicit declaration of function"). -+if (NOT BORLAND AND NOT MSVC AND NOT WATCOM) -+ check_c_compiler_flag(-Werror HAVE_FLAG_WERROR) -+ if (HAVE_FLAG_WERROR) -+ SET(CMAKE_REQUIRED_FLAGS "-Werror") -+ endif(HAVE_FLAG_WERROR) -+endif() -+ -+if (BUILD_SHARED_LIBS) -+ add_definitions("-DGC_DLL") -+ # Pass -fvisibility=hidden option if supported. -+ check_c_compiler_flag(-fvisibility=hidden HAVE_FLAG_F_VISIBILITY_HIDDEN) -+ if (HAVE_FLAG_F_VISIBILITY_HIDDEN) -+ add_definitions("-DGC_VISIBILITY_HIDDEN_SET") -+ add_compile_options(-fvisibility=hidden) -+ else() -+ add_definitions("-DGC_NO_VISIBILITY") -+ endif() -+ check_c_compiler_flag(-Wl,--no-undefined HAVE_FLAG_WL_NO_UNDEFINED) -+else() -+ add_definitions("-DGC_NOT_DLL") -+ if (WIN32) -+ # Do not require the clients to link with "user32" system library. -+ add_definitions("-DDONT_USE_USER32_DLL") -+ endif(WIN32) -+endif() -+ -+# Disable strict aliasing optimizations. -+# It could re-enabled back by a flag passed in CFLAGS_EXTRA. -+check_c_compiler_flag(-fno-strict-aliasing HAVE_FLAG_F_NO_STRICT_ALIASING) -+if (HAVE_FLAG_F_NO_STRICT_ALIASING) -+ add_compile_options(-fno-strict-aliasing) -+endif() -+ -+# Extra user-defined flags to pass both to C and C++ compilers. -+if (DEFINED CFLAGS_EXTRA) -+ add_compile_options(${CFLAGS_EXTRA}) -+endif() -+ -+# Check whether execinfo.h header file is present. -+check_include_file(execinfo.h HAVE_EXECINFO_H) -+if (NOT HAVE_EXECINFO_H) -+ add_definitions("-DGC_MISSING_EXECINFO_H") -+endif() -+ -+# Check for getcontext (uClibc can be configured without it, for example). -+check_function_exists(getcontext HAVE_GETCONTEXT) -+if (NOT HAVE_GETCONTEXT) -+ add_definitions("-DNO_GETCONTEXT") -+endif() -+ -+# Check whether dl_iterate_phdr exists (as a strong symbol). -+check_function_exists(dl_iterate_phdr HAVE_DL_ITERATE_PHDR) -+if (HAVE_DL_ITERATE_PHDR) -+ add_definitions("-DHAVE_DL_ITERATE_PHDR") -+endif() -+ -+check_symbol_exists(sigsetjmp setjmp.h HAVE_SIGSETJMP) -+if (NOT HAVE_SIGSETJMP) -+ add_definitions("-DGC_NO_SIGSETJMP") -+endif() -+ -+# pthread_setname_np, if available, may have 1, 2 or 3 arguments. -+if (CMAKE_USE_PTHREADS_INIT) -+ check_c_source_compiles(" -+#include \n -+int main(void) { (void)pthread_setname_np(\"thread-name\"); return 0; }" -+ HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) -+ if (HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) -+ # Define to use 'pthread_setname_np(const char*)' function. -+ add_definitions("-DHAVE_PTHREAD_SETNAME_NP_WITHOUT_TID") -+ else() -+ check_c_source_compiles(" -+#include \n -+int main(void) {\n -+ (void)pthread_setname_np(pthread_self(), \"thread-name-%u\", 0); return 0; }" -+ HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG) -+ if (HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG) -+ # Define to use 'pthread_setname_np(pthread_t, const char*, void *)'. -+ add_definitions("-DHAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG") -+ else() -+ check_c_source_compiles(" -+#if defined(__linux__) || defined(__GLIBC__) || defined(__GNU__) || defined(__CYGWIN__)\n -+#define _GNU_SOURCE 1\n -+#endif\n -+#include \n -+int main(void) {\n -+ (void)pthread_setname_np(pthread_self(), \"thread-name\"); return 0; }" -+ HAVE_PTHREAD_SETNAME_NP_WITH_TID) -+ if (HAVE_PTHREAD_SETNAME_NP_WITH_TID) -+ # Define to use 'pthread_setname_np(pthread_t, const char*)' function. -+ add_definitions("-DHAVE_PTHREAD_SETNAME_NP_WITH_TID") -+ endif() -+ endif(HAVE_PTHREAD_SETNAME_NP_WITH_TID_AND_ARG) -+ endif (HAVE_PTHREAD_SETNAME_NP_WITHOUT_TID) -+endif() -+ -+# Check for dladdr (used for debugging). -+check_c_source_compiles(" -+#define _GNU_SOURCE 1\n -+#include \n -+int main(void) { Dl_info info; (void)dladdr(\"\", &info); return 0; }" -+ HAVE_DLADDR) -+if (HAVE_DLADDR) -+ # Define to use 'dladdr' function. -+ add_definitions("-DHAVE_DLADDR") -+endif() -+ -+add_library(gc ${SRC}) -+if (enable_threads) -+ target_link_libraries(gc PRIVATE ${THREADDLLIBS}) -+endif() -+ -+if (enable_cplusplus) -+ add_library(gccpp gc_cpp.cc) -+ target_link_libraries(gccpp PRIVATE gc) -+endif() -+ -+if (build_cord) -+ set(CORD_SRC cord/cordbscs.c cord/cordprnt.c cord/cordxtra.c) -+ add_library(cord ${CORD_SRC}) -+ target_link_libraries(cord PRIVATE gc) -+ install(TARGETS cord EXPORT cordExports -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib -+ RUNTIME DESTINATION bin -+ INCLUDES DESTINATION include) -+endif() -+ -+if (BUILD_SHARED_LIBS AND HAVE_FLAG_WL_NO_UNDEFINED) -+ # Declare that the libraries do not refer to external symbols. -+ # TODO: use add_link_options() when cmake_minimum_required > 3.13 -+ target_link_libraries(gc PRIVATE -Wl,--no-undefined) -+ if (enable_cplusplus) -+ target_link_libraries(gccpp PRIVATE -Wl,--no-undefined) -+ endif(enable_cplusplus) -+ if (build_cord) -+ target_link_libraries(cord PRIVATE -Wl,--no-undefined) -+ endif(build_cord) -+endif() -+ -+install(TARGETS gc EXPORT gcExports -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib -+ RUNTIME DESTINATION bin -+ INCLUDES DESTINATION include) -+ -+if (enable_cplusplus) -+ install(TARGETS gccpp EXPORT gccppExports -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib -+ RUNTIME DESTINATION bin -+ INCLUDES DESTINATION include) -+endif() -+ -+if (install_headers) -+ install(FILES include/gc.h -+ include/gc_backptr.h -+ include/gc_config_macros.h -+ include/gc_gcj.h -+ include/gc_inline.h -+ include/gc_mark.h -+ include/gc_pthread_redirects.h -+ include/gc_tiny_fl.h -+ include/gc_typed.h -+ include/gc_version.h -+ include/javaxfc.h -+ include/leak_detector.h -+ DESTINATION include/gc) -+ install(FILES include/extra/gc.h DESTINATION include) -+ if (enable_cplusplus) -+ install(FILES include/gc_allocator.h -+ include/gc_cpp.h -+ DESTINATION include/gc) -+ install(FILES include/extra/gc_cpp.h DESTINATION include) -+ endif() -+ if (enable_disclaim) -+ install(FILES include/gc_disclaim.h DESTINATION include/gc) -+ endif() -+ if (build_cord) -+ install(FILES include/cord.h -+ include/cord_pos.h -+ include/ec.h -+ DESTINATION include/gc) -+ endif() -+endif(install_headers) -+ -+if (build_tests) -+ if (build_cord) -+ add_executable(cordtest cord/tests/cordtest.c) -+ target_link_libraries(cordtest PRIVATE cord gc) -+ add_test(NAME cordtest COMMAND cordtest) -+ -+ if (WIN32 AND NOT CYGWIN) -+ add_executable(de cord/tests/de.c cord/tests/de_win.c -+ cord/tests/de_win.rc) -+ set_target_properties(de PROPERTIES WIN32_EXECUTABLE TRUE) -+ target_link_libraries(de PRIVATE cord gc gdi32) -+ endif() -+ endif(build_cord) -+ -+ # Compile some tests as C++ to test extern "C" in header files. -+ if (enable_cplusplus) -+ set_source_files_properties(tests/leak_test.c tests/test.c -+ PROPERTIES LANGUAGE CXX) -+ # To avoid "treating 'c' input as 'c++' when in C++ mode" Clang warning. -+ if (NOT (BORLAND OR MSVC OR WATCOM)) -+ add_compile_options(-x c++) -+ endif() -+ endif(enable_cplusplus) -+ -+ add_executable(gctest WIN32 tests/test.c) -+ target_link_libraries(gctest PRIVATE gc ${THREADDLLIBS}) -+ add_test(NAME gctest COMMAND gctest) -+ if (WATCOM) -+ # Suppress "conditional expression in if statement is always true/false" -+ # and "unreachable code" warnings in GC_MALLOC_[ATOMIC_]WORDS. -+ target_compile_options(gctest PRIVATE -+ /wcd=13 /wcd=201 /wcd=367 /wcd=368 /wcd=726) -+ endif() -+ -+ add_executable(hugetest tests/huge_test.c) -+ target_link_libraries(hugetest PRIVATE gc) -+ add_test(NAME hugetest COMMAND hugetest) -+ -+ add_executable(leaktest tests/leak_test.c) -+ target_link_libraries(leaktest PRIVATE gc) -+ add_test(NAME leaktest COMMAND leaktest) -+ -+ add_executable(middletest tests/middle.c) -+ target_link_libraries(middletest PRIVATE gc) -+ add_test(NAME middletest COMMAND middletest) -+ -+ add_executable(realloc_test tests/realloc_test.c) -+ target_link_libraries(realloc_test PRIVATE gc) -+ add_test(NAME realloc_test COMMAND realloc_test) -+ -+ add_executable(smashtest tests/smash_test.c) -+ target_link_libraries(smashtest PRIVATE gc) -+ add_test(NAME smashtest COMMAND smashtest) -+ -+ if (NOT (BUILD_SHARED_LIBS AND WIN32)) -+ add_library(staticrootslib_test tests/staticrootslib.c) -+ target_link_libraries(staticrootslib_test PRIVATE gc) -+ add_library(staticrootslib2_test tests/staticrootslib.c) -+ target_compile_options(staticrootslib2_test PRIVATE "-DSTATICROOTSLIB2") -+ target_link_libraries(staticrootslib2_test PRIVATE gc) -+ add_executable(staticrootstest tests/staticrootstest.c) -+ target_compile_options(staticrootstest PRIVATE "-DSTATICROOTSLIB2") -+ target_link_libraries(staticrootstest PRIVATE -+ gc staticrootslib_test staticrootslib2_test) -+ add_test(NAME staticrootstest COMMAND staticrootstest) -+ endif() -+ -+ if (enable_gc_debug) -+ add_executable(tracetest tests/trace_test.c) -+ target_link_libraries(tracetest PRIVATE gc) -+ add_test(NAME tracetest COMMAND tracetest) -+ endif() -+ -+ if (enable_threads) -+ add_executable(test_atomic_ops tests/test_atomic_ops.c) -+ target_link_libraries(test_atomic_ops PRIVATE gc) -+ add_test(NAME test_atomic_ops COMMAND test_atomic_ops) -+ -+ add_executable(threadleaktest tests/thread_leak_test.c) -+ target_link_libraries(threadleaktest PRIVATE gc ${THREADDLLIBS}) -+ add_test(NAME threadleaktest COMMAND threadleaktest) -+ -+ if (NOT WIN32) -+ add_executable(threadkey_test tests/threadkey_test.c) -+ target_link_libraries(threadkey_test PRIVATE gc ${THREADDLLIBS}) -+ add_test(NAME threadkey_test COMMAND threadkey_test) -+ endif() -+ -+ add_executable(subthreadcreate_test tests/subthread_create.c) -+ target_link_libraries(subthreadcreate_test PRIVATE gc ${THREADDLLIBS}) -+ add_test(NAME subthreadcreate_test COMMAND subthreadcreate_test) -+ -+ add_executable(initsecondarythread_test tests/initsecondarythread.c) -+ target_link_libraries(initsecondarythread_test PRIVATE gc ${THREADDLLIBS}) -+ add_test(NAME initsecondarythread_test COMMAND initsecondarythread_test) -+ endif(enable_threads) -+ -+ if (enable_cplusplus) -+ add_executable(test_cpp WIN32 tests/test_cpp.cc) -+ target_link_libraries(test_cpp PRIVATE gc gccpp) -+ add_test(NAME test_cpp COMMAND test_cpp) -+ endif() -+ -+ if (enable_disclaim) -+ add_executable(disclaim_bench tests/disclaim_bench.c) -+ target_link_libraries(disclaim_bench PRIVATE gc) -+ add_test(NAME disclaim_bench COMMAND disclaim_bench) -+ -+ add_executable(disclaim_test tests/disclaim_test.c) -+ target_link_libraries(disclaim_test PRIVATE gc ${THREADDLLIBS}) -+ add_test(NAME disclaim_test COMMAND disclaim_test) -+ -+ add_executable(disclaim_weakmap_test tests/disclaim_weakmap_test.c) -+ target_link_libraries(disclaim_weakmap_test PRIVATE gc ${THREADDLLIBS}) -+ add_test(NAME disclaim_weakmap_test COMMAND disclaim_weakmap_test) -+ endif() -+endif(build_tests) diff --git a/recipes/bdwgc/all/test_package/CMakeLists.txt b/recipes/bdwgc/all/test_package/CMakeLists.txt index 7b9b613cbb24a..6b8623ba2be96 100644 --- a/recipes/bdwgc/all/test_package/CMakeLists.txt +++ b/recipes/bdwgc/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(BDWgc CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE BDWgc::gc) diff --git a/recipes/bdwgc/all/test_package/conanfile.py b/recipes/bdwgc/all/test_package/conanfile.py index b5ecfa88d3a13..fde7967ed16f1 100644 --- a/recipes/bdwgc/all/test_package/conanfile.py +++ b/recipes/bdwgc/all/test_package/conanfile.py @@ -1,10 +1,19 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake_find_package_multi", "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,5 +21,5 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin","test_package"), run_environment=True) + if can_run(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/bdwgc/all/test_v1_package/CMakeLists.txt b/recipes/bdwgc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8ab3169f9e927 --- /dev/null +++ b/recipes/bdwgc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(BDWgc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE BDWgc::gc) diff --git a/recipes/bdwgc/all/test_v1_package/conanfile.py b/recipes/bdwgc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..dfe389167a895 --- /dev/null +++ b/recipes/bdwgc/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake +from conan.tools.build import cross_building + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake_find_package_multi", "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + self.run(os.path.join("bin","test_package"), run_environment=True) diff --git a/recipes/bdwgc/config.yml b/recipes/bdwgc/config.yml index 1f22cca255b0c..a32355f74df3f 100644 --- a/recipes/bdwgc/config.yml +++ b/recipes/bdwgc/config.yml @@ -3,3 +3,5 @@ versions: folder: all "8.0.6": folder: all + "8.2.2": + folder: all diff --git a/recipes/bear/all/conandata.yml b/recipes/bear/all/conandata.yml new file mode 100644 index 0000000000000..4328506e20e22 --- /dev/null +++ b/recipes/bear/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "3.0.21": + url: "https://github.com/rizsotto/Bear/archive/refs/tags/3.0.21.tar.gz" + sha256: "0c949a6a907bc61a1284661f8d9dab1788a62770c265f6142602669b6e5c389d" +patches: + "3.0.21": + - patch_file: "patches/7de12540948cd5e0ee5f966b5cc383bc0c0e5fe9.diff" diff --git a/recipes/bear/all/conanfile.py b/recipes/bear/all/conanfile.py new file mode 100644 index 0000000000000..edeff717d1616 --- /dev/null +++ b/recipes/bear/all/conanfile.py @@ -0,0 +1,111 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.53.0" + + +class BearConan(ConanFile): + name = "bear" + description = "Bear is a tool that generates a compilation database for clang tooling" + license = "GPL-3.0-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/rizsotto/Bear" + topics = ("clang", "compilation", "database", "llvm") + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "9", + "clang": "12", + "apple-clang": "12", + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("grpc/1.50.1") + self.requires("fmt/9.1.0") + self.requires("spdlog/1.11.0") + self.requires("nlohmann_json/3.11.2") + + def build_requirements(self): + self.tool_requires("grpc/1.50.1") + + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + if self.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} can not be built on windows.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_UNIT_TESTS"] = False + tc.variables["ENABLE_FUNC_TESTS"] = False + tc.generate() + # In case there are dependencies listed on requirements, CMakeDeps should be used + tc = CMakeDeps(self) + tc.generate() + + pc = PkgConfigDeps(self) + pc.generate() + + tc = VirtualBuildEnv(self) + tc.generate(scope="build") + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + # some files extensions and folders are not allowed. Please, read the FAQs to get informed. + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + def package_info(self): + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] + + # TODO: Legacy, to be removed on Conan 2.0 + bin_folder = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bin_folder) diff --git a/recipes/bear/all/patches/7de12540948cd5e0ee5f966b5cc383bc0c0e5fe9.diff b/recipes/bear/all/patches/7de12540948cd5e0ee5f966b5cc383bc0c0e5fe9.diff new file mode 100644 index 0000000000000..445f363e4f1c3 --- /dev/null +++ b/recipes/bear/all/patches/7de12540948cd5e0ee5f966b5cc383bc0c0e5fe9.diff @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9de55a32..1f29f972 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -106,12 +106,6 @@ endif () + + # Install the project artifacts from the staged directory + include(GNUInstallDirs) +-install(DIRECTORY +- ${STAGED_INSTALL_PREFIX}/ +- DESTINATION +- . +- USE_SOURCE_PERMISSIONS +-) + install(FILES + COPYING README.md INSTALL.md CONTRIBUTING.md CODE_OF_CONDUCT.md + DESTINATION diff --git a/recipes/bear/all/test_package/conanfile.py b/recipes/bear/all/test_package/conanfile.py new file mode 100644 index 0000000000000..bc7a59b9b90d0 --- /dev/null +++ b/recipes/bear/all/test_package/conanfile.py @@ -0,0 +1,13 @@ +from conan import ConanFile + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def test(self): + self.run("bear --version") diff --git a/recipes/bear/all/test_v1_package/conanfile.py b/recipes/bear/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..bd3d11c7c6e42 --- /dev/null +++ b/recipes/bear/all/test_v1_package/conanfile.py @@ -0,0 +1,11 @@ +from conan import ConanFile +from conan.tools.build import can_run + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if can_run(self): + self.run("bear --version", run_environment=True) diff --git a/recipes/bear/config.yml b/recipes/bear/config.yml new file mode 100644 index 0000000000000..b08adc3d32b8b --- /dev/null +++ b/recipes/bear/config.yml @@ -0,0 +1,3 @@ +versions: + "3.0.21": + folder: all diff --git a/recipes/beauty/all/conanfile.py b/recipes/beauty/all/conanfile.py index fe51140196608..db4a11b8cb724 100644 --- a/recipes/beauty/all/conanfile.py +++ b/recipes/beauty/all/conanfile.py @@ -1,13 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class BeautyConan(ConanFile): @@ -18,6 +18,7 @@ class BeautyConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,7 +29,9 @@ class BeautyConan(ConanFile): "fPIC": True, } - generators = "CMakeDeps" + @property + def _min_cppstd(self): + return "20" @property def _compilers_minimum_version(self): @@ -40,8 +43,7 @@ def _compilers_minimum_version(self): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -49,20 +51,24 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("boost/1.79.0"), - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") def validate(self): - if self.settings.compiler.cppstd: - check_min_cppstd(self, "20") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - f"Compiler {self.name} must be at least {minimum_version}") + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) if self.settings.compiler == "clang" and self.settings.compiler.libcxx != "libc++": raise ConanInvalidConfiguration("Only libc++ is supported for clang") @@ -73,16 +79,14 @@ def validate(self): if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration("shared is not supported on Visual Studio") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): apply_conandata_patches(self) diff --git a/recipes/beauty/all/test_package/conanfile.py b/recipes/beauty/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/beauty/all/test_package/conanfile.py +++ b/recipes/beauty/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/beauty/all/test_v1_package/CMakeLists.txt b/recipes/beauty/all/test_v1_package/CMakeLists.txt index 45a312a95a7c8..0d20897301b68 100644 --- a/recipes/beauty/all/test_v1_package/CMakeLists.txt +++ b/recipes/beauty/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.12) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(beauty REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE beauty::beauty) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/beauty/all/test_v1_package/conanfile.py b/recipes/beauty/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/beauty/all/test_v1_package/conanfile.py +++ b/recipes/beauty/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/behaviortree.cpp/all/CMakeLists.txt b/recipes/behaviortree.cpp/all/CMakeLists.txt deleted file mode 100644 index e6c184155aee0..0000000000000 --- a/recipes/behaviortree.cpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(src) diff --git a/recipes/behaviortree.cpp/all/conandata.yml b/recipes/behaviortree.cpp/all/conandata.yml index 50aa5725b7caa..8e188b3097d43 100644 --- a/recipes/behaviortree.cpp/all/conandata.yml +++ b/recipes/behaviortree.cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.0.1": + url: "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/refs/tags/4.0.1.tar.gz" + sha256: "71544f72abea8e8c246b016b7e8d87d96f731c8aa96698058d8e69d40e56f9b9" "3.7.0": url: "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/refs/tags/3.7.0.tar.gz" sha256: "ab0d8ac1a0df4dd43cf45da8a784bab7fdedf711bd0e227f7ed071f79b0c7b5c" @@ -6,23 +9,20 @@ sources: url: "https://github.com/BehaviorTree/BehaviorTree.CPP/archive/refs/tags/3.5.6.tar.gz" sha256: "543c428602b5acb7c5666aee34feb532e18ce7200870a79b23ff9aed17ee84c4" patches: + "4.0.1": + - patch_file: "patches/4.0.1-0001-remove-fpic.patch" + - patch_file: "patches/4.0.1-0002-find-zmq.patch" + - patch_file: "patches/4.0.1-0003-no-werror.patch" + - patch_file: "patches/3.5.6-0005-stdc-format.patch" + - patch_file: "patches/3.5.6-0005-stdc-format.patch" "3.7.0": - patch_file: "patches/3.7.0-0001-remove-fpic.patch" - base_path: "src" - patch_file: "patches/3.7.0-0002-find-zmq.patch" - base_path: "src" - patch_file: "patches/3.7.0-0003-no-werror.patch" - base_path: "src" - patch_file: "patches/3.5.6-0005-stdc-format.patch" - base_path: "src" "3.5.6": - patch_file: "patches/3.5.6-0001-remove-fpic.patch" - base_path: "src" - patch_file: "patches/3.5.6-0002-find-zmq.patch" - base_path: "src" - patch_file: "patches/3.5.6-0003-no-werror.patch" - base_path: "src" - patch_file: "patches/3.5.6-0004-win-sigaction.patch" - base_path: "src" - patch_file: "patches/3.5.6-0005-stdc-format.patch" - base_path: "src" diff --git a/recipes/behaviortree.cpp/all/conanfile.py b/recipes/behaviortree.cpp/all/conanfile.py index 11764fb58fd18..54f5ae5ad8322 100644 --- a/recipes/behaviortree.cpp/all/conanfile.py +++ b/recipes/behaviortree.cpp/all/conanfile.py @@ -1,17 +1,21 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import os -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -conan_minimum_required = ">=1.43.0" +import os +required_conan_version = ">=1.53.0" class BehaviorTreeCPPConan(ConanFile): name = "behaviortree.cpp" description = "This C++ library provides a framework to create BehaviorTrees" license = "MIT" - homepage = "https://github.com/BehaviorTree/BehaviorTree.CPP" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/BehaviorTree/BehaviorTree.CPP" topics = ("ai", "robotics", "games", "coordination") settings = "os", "arch", "compiler", "build_type" options = { @@ -26,33 +30,28 @@ class BehaviorTreeCPPConan(ConanFile): "with_tools": False, "with_coroutines": False, } - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "src" - - @property - def _build_subfolder(self): - return "bld" @property def _minimum_cppstd_required(self): - return 14 + return 14 if Version(self.version) < "4.0" else 17 @property def _minimum_compilers_version(self): - return { - "Visual Studio": "15", - "gcc": "5", - "clang": "5", - "apple-clang": "12", - } + if Version(self.version) < "4.0": + return { + "gcc": "5", + "clang": "5", + "apple-clang": "12", + } + else: + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -60,66 +59,91 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_coroutines: - self.requires("boost/1.79.0") + self.requires("boost/1.80.0") self.requires("ncurses/6.3") self.requires("zeromq/4.3.4") - self.requires("cppzmq/4.8.1") + self.requires("cppzmq/4.9.0") def validate(self): - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("BehaviorTree.CPP can not be built as shared on Windows.") - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._minimum_cppstd_required) - minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("BehaviorTree.CPP requires C++{}. Your compiler is unknown. Assuming it supports C++14." - .format(self._minimum_cppstd_required)) - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("BehaviorTree.CPP requires C++{}, which your compiler does not support." - .format(self._minimum_cppstd_required)) + if self.info.settings.os == "Windows" and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared on Windows.") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._minimum_cppstd_required) + check_min_vs(self, 191 if Version(self.version) < "4.0" else 192) + if not is_msvc(self): + minimum_version = self._minimum_compilers_version.get(str(self.info.settings.compiler), False) + if not minimum_version: + self.output.warn(f"{self.ref} requires C++{self._minimum_cppstd_required}. Your compiler is unknown. Assuming it supports C++{self._minimum_cppstd_required}.") + elif Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration("BehaviorTree.CPP requires C++{}, which your compiler does not support." + .format(self._minimum_cppstd_required)) + + if self.settings.compiler == "clang" and str(self.settings .compiler.libcxx) == "libstdc++": + raise ConanInvalidConfiguration(f"{self.ref} needs recent libstdc++ with charconv. please switch to gcc, or to libc++") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_EXAMPLES"] = False - cmake.definitions["BUILD_UNIT_TESTS"] = False - cmake.definitions["BUILD_TOOLS"] = self.options.with_tools - cmake.definitions["ENABLE_COROUTINES"] = self.options.with_coroutines - cmake.configure(build_folder=self._build_subfolder) - return cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) < "4.0": + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_UNIT_TESTS"] = False + tc.variables["BUILD_TOOLS"] = self.options.with_tools + tc.variables["ENABLE_COROUTINES"] = self.options.with_coroutines + else: + tc.variables["BTCPP_SHARED_LIBS"] = self.options.shared + tc.variables["BTCPP_EXAMPLES"] = False + tc.variables["BTCPP_UNIT_TESTS"] = False + tc.variables["BTCPP_BUILD_TOOLS"] = self.options.with_tools + tc.variables["BTCPP_ENABLE_COROUTINES"] = self.options.with_coroutines + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "BehaviorTreeV3")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + + rmdir(self, os.path.join(self.package_folder, "lib", "BehaviorTreeV3")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.set_property("cmake_file_name", "BehaviorTreeV3") - self.cpp_info.set_property("cmake_target_name", "BT::behaviortree_cpp_v3") + if Version(self.version) < "4.0": + self.cpp_info.set_property("cmake_file_name", "BehaviorTreeV3") + else: + self.cpp_info.set_property("cmake_file_name", "BehaviorTree") + + libname = "behaviortree_cpp_v3" if Version(self.version) < "4.0" else "behaviortree_cpp" + self.cpp_info.set_property("cmake_target_name", f"BT::{libname}") + postfix = "d" if self.settings.os == "Windows" and self.settings.build_type == "Debug" else "" # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["behaviortree_cpp_v3"].libs = ["behaviortree_cpp_v3" + postfix] - self.cpp_info.components["behaviortree_cpp_v3"].requires = ["zeromq::zeromq", "cppzmq::cppzmq", "ncurses::ncurses"] + self.cpp_info.components[libname].libs = [f"{libname}{postfix}"] + self.cpp_info.components[libname].requires = ["zeromq::zeromq", "cppzmq::cppzmq", "ncurses::ncurses"] if self.options.with_coroutines: - self.cpp_info.components["behaviortree_cpp_v3"].requires.append("boost::coroutine") + self.cpp_info.components[libname].requires.append("boost::coroutine") if self.settings.os in ("Linux", "FreeBSD"): - self.cpp_info.components["behaviortree_cpp_v3"].system_libs.append("pthread") + self.cpp_info.components[libname].system_libs.append("pthread") + if Version(self.version) >= "4.0" and \ + self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == "8": + self.cpp_info.components[libname].system_libs.append("stdc++fs") if self.options.with_tools: bin_path = os.path.join(self.package_folder, "bin") @@ -127,10 +151,15 @@ def package_info(self): self.env_info.PATH.append(bin_path) # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.filenames["cmake_find_package"] = "BehaviorTreeV3" - self.cpp_info.filenames["cmake_find_package_multi"] = "BehaviorTreeV3" + if Version(self.version) < "4.0": + self.cpp_info.filenames["cmake_find_package"] = "BehaviorTreeV3" + self.cpp_info.filenames["cmake_find_package_multi"] = "BehaviorTreeV3" + else: + self.cpp_info.filenames["cmake_find_package"] = "BehaviorTree" + self.cpp_info.filenames["cmake_find_package_multi"] = "BehaviorTree" + self.cpp_info.names["cmake_find_package"] = "BT" self.cpp_info.names["cmake_find_package_multi"] = "BT" - self.cpp_info.components["behaviortree_cpp_v3"].names["cmake_find_package"] = "behaviortree_cpp_v3" - self.cpp_info.components["behaviortree_cpp_v3"].names["cmake_find_package_multi"] = "behaviortree_cpp_v3" - self.cpp_info.components["behaviortree_cpp_v3"].set_property("cmake_target_name", "BT::behaviortree_cpp_v3") + self.cpp_info.components[libname].names["cmake_find_package"] = libname + self.cpp_info.components[libname].names["cmake_find_package_multi"] = libname + self.cpp_info.components[libname].set_property("cmake_target_name", f"BT::{libname}") diff --git a/recipes/behaviortree.cpp/all/patches/4.0.1-0001-remove-fpic.patch b/recipes/behaviortree.cpp/all/patches/4.0.1-0001-remove-fpic.patch new file mode 100644 index 0000000000000..23931bd446392 --- /dev/null +++ b/recipes/behaviortree.cpp/all/patches/4.0.1-0001-remove-fpic.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d03b8a7..a2f23cf 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -15,8 +15,6 @@ else() + add_definitions(-Wpedantic) + endif() + +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) +- + #---- project configuration ---- + option(BTCPP_SHARED_LIBS "Build shared libraries" ON) + option(BTCPP_ENABLE_COROUTINES "Enable boost coroutines" ON) diff --git a/recipes/behaviortree.cpp/all/patches/4.0.1-0002-find-zmq.patch b/recipes/behaviortree.cpp/all/patches/4.0.1-0002-find-zmq.patch new file mode 100644 index 0000000000000..6753b06f564d0 --- /dev/null +++ b/recipes/behaviortree.cpp/all/patches/4.0.1-0002-find-zmq.patch @@ -0,0 +1,57 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a2f23cf..d427d37 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -67,14 +67,14 @@ endif() + + #---- Find other packages ---- + find_package(Threads) +-find_package(ZMQ) ++find_package(ZeroMQ) + + list(APPEND BEHAVIOR_TREE_PUBLIC_LIBRARIES + ${CMAKE_THREAD_LIBS_INIT} + ${CMAKE_DL_LIBS} + ) + +-if( ZMQ_FOUND ) ++if( ZeroMQ_FOUND ) + message(STATUS "ZeroMQ found.") + add_definitions( -DZMQ_FOUND ) + list(APPEND BT_SOURCE src/loggers/bt_zmq_publisher.cpp) +@@ -221,7 +221,7 @@ target_link_libraries(${BEHAVIOR_TREE_LIBRARY} + ${BEHAVIOR_TREE_PUBLIC_LIBRARIES} + PRIVATE + ${Boost_LIBRARIES} +- ${ZMQ_LIBRARIES} ++ ${ZeroMQ_LIBRARIES} + $ + ) + +@@ -243,8 +243,8 @@ target_include_directories(${BEHAVIOR_TREE_LIBRARY} PRIVATE + $ + ) + +-if( ZMQ_FOUND ) +- target_compile_definitions(${BEHAVIOR_TREE_LIBRARY} PUBLIC ZMQ_FOUND) ++if( ZeroMQ_FOUND ) ++ target_compile_definitions(${BEHAVIOR_TREE_LIBRARY} PUBLIC ZeroMQ_FOUND) + endif() + + if(MSVC) +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt +index 163e703..b98f525 100644 +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt +@@ -7,9 +7,9 @@ target_link_libraries(bt3_log_cat ${BEHAVIOR_TREE_LIBRARY} ) + install(TARGETS bt3_log_cat + DESTINATION ${BEHAVIOR_TREE_BIN_DESTINATION} ) + +-if( ZMQ_FOUND ) ++if( ZeroMQ_FOUND ) + add_executable(bt3_recorder bt_recorder.cpp ) +- target_link_libraries(bt3_recorder ${BEHAVIOR_TREE_LIBRARY} ${ZMQ_LIBRARIES}) ++ target_link_libraries(bt3_recorder ${BEHAVIOR_TREE_LIBRARY} ${ZeroMQ_LIBRARIES}) + install(TARGETS bt3_recorder + DESTINATION ${BEHAVIOR_TREE_BIN_DESTINATION} ) + endif() diff --git a/recipes/behaviortree.cpp/all/patches/4.0.1-0003-no-werror.patch b/recipes/behaviortree.cpp/all/patches/4.0.1-0003-no-werror.patch new file mode 100644 index 0000000000000..b69541449eb87 --- /dev/null +++ b/recipes/behaviortree.cpp/all/patches/4.0.1-0003-no-werror.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d427d37..0c10f52 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -250,7 +250,7 @@ endif() + if(MSVC) + else() + target_compile_options(${BEHAVIOR_TREE_LIBRARY} PRIVATE +- -Wall -Wextra -Werror=return-type) ++ -Wall -Wextra) + endif() + + ############################################################# diff --git a/recipes/behaviortree.cpp/all/test_package/CMakeLists.txt b/recipes/behaviortree.cpp/all/test_package/CMakeLists.txt index 960a3aeda6ad3..d710fc297db68 100644 --- a/recipes/behaviortree.cpp/all/test_package/CMakeLists.txt +++ b/recipes/behaviortree.cpp/all/test_package/CMakeLists.txt @@ -1,11 +1,16 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(BehaviorTreeV3 CONFIG REQUIRED) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} BT::behaviortree_cpp_v3) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) + +find_package(BehaviorTreeV3 CONFIG) +if(TARGET BT::behaviortree_cpp_v3) + target_link_libraries(${PROJECT_NAME} PRIVATE BT::behaviortree_cpp_v3) + target_compile_definitions(${PROJECT_NAME} PRIVATE -DBEHAVIORTREE_CPP_VERSION=3) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + find_package(BehaviorTree REQUIRED CONFIG) + target_link_libraries(${PROJECT_NAME} PRIVATE BT::behaviortree_cpp) + target_compile_definitions(${PROJECT_NAME} PRIVATE -DBEHAVIORTREE_CPP_VERSION=4) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/behaviortree.cpp/all/test_package/conanfile.py b/recipes/behaviortree.cpp/all/test_package/conanfile.py index a11bb5a026e55..a9fb96656f203 100644 --- a/recipes/behaviortree.cpp/all/test_package/conanfile.py +++ b/recipes/behaviortree.cpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import CMake, ConanFile, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/behaviortree.cpp/all/test_package/test_package.cpp b/recipes/behaviortree.cpp/all/test_package/test_package.cpp index 318d8809396f7..d5a7ae6ffc770 100644 --- a/recipes/behaviortree.cpp/all/test_package/test_package.cpp +++ b/recipes/behaviortree.cpp/all/test_package/test_package.cpp @@ -1,4 +1,8 @@ +#if BEHAVIORTREE_CPP_VERSION < 4 #include "behaviortree_cpp_v3/bt_factory.h" +#else +#include "behaviortree_cpp/bt_factory.h" +#endif using namespace BT; @@ -25,8 +29,13 @@ namespace BT{ class CalculateGoal: public SyncActionNode{ public: +#if BEHAVIORTREE_CPP_VERSION < 4 CalculateGoal(const std::string& name, const NodeConfiguration& config): SyncActionNode(name,config) {} +#else + CalculateGoal(const std::string& name, const NodeConfig& config): + SyncActionNode(name,config) {} +#endif NodeStatus tick() override{ Position2D mygoal = {1.1, 2.3}; @@ -41,8 +50,13 @@ class CalculateGoal: public SyncActionNode{ class PrintTarget: public SyncActionNode { public: +#if BEHAVIORTREE_CPP_VERSION < 4 PrintTarget(const std::string& name, const NodeConfiguration& config): SyncActionNode(name,config) {} +#else + PrintTarget(const std::string& name, const NodeConfig& config): + SyncActionNode(name,config) {} +#endif NodeStatus tick() override { auto res = getInput("target"); @@ -83,6 +97,10 @@ int main() { factory.registerNodeType("PrintTarget"); auto tree = factory.createTreeFromText(xml_text); +#if BEHAVIORTREE_CPP_VERSION < 4 tree.tickRoot(); +#else + tree.tickWhileRunning(); +#endif return 0; } diff --git a/recipes/behaviortree.cpp/all/test_v1_package/CMakeLists.txt b/recipes/behaviortree.cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/behaviortree.cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/behaviortree.cpp/all/test_v1_package/conanfile.py b/recipes/behaviortree.cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/behaviortree.cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/behaviortree.cpp/config.yml b/recipes/behaviortree.cpp/config.yml index 5d6faf2e5f4c6..e1234d5535a8c 100644 --- a/recipes/behaviortree.cpp/config.yml +++ b/recipes/behaviortree.cpp/config.yml @@ -1,4 +1,6 @@ versions: + "4.0.1": + folder: all "3.7.0": folder: all "3.5.6": diff --git a/recipes/benchmark/all/CMakeLists.txt b/recipes/benchmark/all/CMakeLists.txt deleted file mode 100644 index 08bd91ff0594a..0000000000000 --- a/recipes/benchmark/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") - include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -else() - include(conanbuildinfo.cmake) -endif() -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/benchmark/all/conandata.yml b/recipes/benchmark/all/conandata.yml index bcab7bca71fa9..926ace1d06183 100644 --- a/recipes/benchmark/all/conandata.yml +++ b/recipes/benchmark/all/conandata.yml @@ -1,13 +1,19 @@ sources: - "1.5.6": - url: "https://github.com/google/benchmark/archive/v1.5.6.tar.gz" - sha256: "789f85b4810d13ff803834ea75999e41b326405d83d6a538baf01499eda96102" - "1.6.0": - url: "https://github.com/google/benchmark/archive/v1.6.0.tar.gz" - sha256: "1f71c72ce08d2c1310011ea6436b31e39ccab8c2db94186d26657d41747c85d6" - "1.6.1": - url: "https://github.com/google/benchmark/archive/v1.6.1.tar.gz" - sha256: "6132883bc8c9b0df5375b16ab520fac1a85dc9e4cf5be59480448ece74b278d4" + "1.7.1": + url: "https://github.com/google/benchmark/archive/refs/tags/v1.7.1.tar.gz" + sha256: "6430e4092653380d9dc4ccb45a1e2dc9259d581f4866dc0759713126056bc1d7" + "1.7.0": + url: "https://github.com/google/benchmark/archive/refs/tags/v1.7.0.tar.gz" + sha256: "3aff99169fa8bdee356eaa1f691e835a6e57b1efeadb8a0f9f228531158246ac" "1.6.2": url: "https://github.com/google/benchmark/archive/v1.6.2.tar.gz" sha256: "a9f77e6188c1cd4ebedfa7538bf5176d6acc72ead6f456919e5f464ef2f06158" + "1.6.1": + url: "https://github.com/google/benchmark/archive/v1.6.1.tar.gz" + sha256: "6132883bc8c9b0df5375b16ab520fac1a85dc9e4cf5be59480448ece74b278d4" + "1.6.0": + url: "https://github.com/google/benchmark/archive/v1.6.0.tar.gz" + sha256: "1f71c72ce08d2c1310011ea6436b31e39ccab8c2db94186d26657d41747c85d6" + "1.5.6": + url: "https://github.com/google/benchmark/archive/v1.5.6.tar.gz" + sha256: "789f85b4810d13ff803834ea75999e41b326405d83d6a538baf01499eda96102" diff --git a/recipes/benchmark/all/conanfile.py b/recipes/benchmark/all/conanfile.py index fbabb91905a8c..41caf19f1ced1 100644 --- a/recipes/benchmark/all/conanfile.py +++ b/recipes/benchmark/all/conanfile.py @@ -1,22 +1,24 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc, check_min_vs +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class BenchmarkConan(ConanFile): name = "benchmark" description = "A microbenchmark support library." - topics = ("benchmark", "google", "microbenchmark") + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index/" homepage = "https://github.com/google/benchmark" - license = "Apache-2.0" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + topics = ("google", "microbenchmark") - settings = "arch", "build_type", "compiler", "os" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -30,71 +32,90 @@ class BenchmarkConan(ConanFile): "enable_exceptions": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version.value) <= 12: - raise ConanInvalidConfiguration("{} {} does not support Visual Studio <= 12".format(self.name, self.version)) def configure(self): if self.options.shared: - del self.options.fPIC - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("Windows shared builds are not supported right now, see issue #639") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - - self._cmake.definitions["BENCHMARK_ENABLE_TESTING"] = "OFF" - self._cmake.definitions["BENCHMARK_ENABLE_GTEST_TESTS"] = "OFF" - self._cmake.definitions["BENCHMARK_ENABLE_LTO"] = "ON" if self.options.enable_lto else "OFF" - self._cmake.definitions["BENCHMARK_ENABLE_EXCEPTIONS"] = "ON" if self.options.enable_exceptions else "OFF" + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + check_min_vs(self, "190") + if Version(self.version) < "1.7.0" and is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support msvc shared builds") + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "1.7.1" and not self._cmake_new_enough("3.16.3"): + self.tool_requires("cmake/3.25.2") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BENCHMARK_ENABLE_TESTING"] = "OFF" + tc.variables["BENCHMARK_ENABLE_GTEST_TESTS"] = "OFF" + tc.variables["BENCHMARK_ENABLE_LTO"] = self.options.enable_lto + tc.variables["BENCHMARK_ENABLE_EXCEPTIONS"] = self.options.enable_exceptions + if Version(self.version) >= "1.6.1": + tc.variables["BENCHMARK_ENABLE_WERROR"] = False + tc.variables["BENCHMARK_FORCE_WERROR"] = False if self.settings.os != "Windows": if cross_building(self): - self._cmake.definitions["HAVE_STD_REGEX"] = False - self._cmake.definitions["HAVE_POSIX_REGEX"] = False - self._cmake.definitions["HAVE_STEADY_CLOCK"] = False - self._cmake.definitions["BENCHMARK_USE_LIBCXX"] = "ON" if self.settings.compiler.get_safe("libcxx") == "libc++" else "OFF" + tc.variables["HAVE_STD_REGEX"] = False + tc.variables["HAVE_POSIX_REGEX"] = False + tc.variables["HAVE_STEADY_CLOCK"] = False + tc.variables["BENCHMARK_USE_LIBCXX"] = self.settings.compiler.get_safe("libcxx") == "libc++" else: - self._cmake.definitions["BENCHMARK_USE_LIBCXX"] = "OFF" - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["BENCHMARK_USE_LIBCXX"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, 'lib', 'pkgconfig')) - tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake')) - tools.rmdir(os.path.join(self.package_folder, 'share')) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.libs = ["benchmark", "benchmark_main"] + self.cpp_info.set_property("cmake_file_name", "benchmark") + self.cpp_info.set_property("pkg_config_name", "benchmark") + + self.cpp_info.components["_benchmark"].set_property("cmake_target_name", "benchmark::benchmark") + self.cpp_info.components["_benchmark"].libs = ["benchmark"] + if Version(self.version) >= "1.7.0" and not self.options.shared: + self.cpp_info.components["_benchmark"].defines.append("BENCHMARK_STATIC_DEFINE") if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs.extend(["pthread", "rt"]) + self.cpp_info.components["_benchmark"].system_libs.extend(["pthread", "rt", "m"]) elif self.settings.os == "Windows": - self.cpp_info.system_libs.append("shlwapi") + self.cpp_info.components["_benchmark"].system_libs.append("shlwapi") elif self.settings.os == "SunOS": - self.cpp_info.system_libs.append("kstat") + self.cpp_info.components["_benchmark"].system_libs.append("kstat") + + self.cpp_info.components["benchmark_main"].set_property("cmake_target_name", "benchmark::benchmark_main") + self.cpp_info.components["benchmark_main"].libs = ["benchmark_main"] + self.cpp_info.components["benchmark_main"].requires = ["_benchmark"] + + # workaround to have all components in CMakeDeps of downstream recipes + self.cpp_info.set_property("cmake_target_name", "benchmark::benchmark_main") diff --git a/recipes/benchmark/all/test_package/CMakeLists.txt b/recipes/benchmark/all/test_package/CMakeLists.txt index 196188113685c..58358ea09a5db 100644 --- a/recipes/benchmark/all/test_package/CMakeLists.txt +++ b/recipes/benchmark/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(benchmark REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE benchmark::benchmark benchmark::benchmark_main) diff --git a/recipes/benchmark/all/test_package/conanfile.py b/recipes/benchmark/all/test_package/conanfile.py index d882f9a0f3178..0a6bc68712d90 100644 --- a/recipes/benchmark/all/test_package/conanfile.py +++ b/recipes/benchmark/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/benchmark/all/test_v1_package/CMakeLists.txt b/recipes/benchmark/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/benchmark/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/benchmark/all/test_v1_package/conanfile.py b/recipes/benchmark/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2490acfa82ff8 --- /dev/null +++ b/recipes/benchmark/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/benchmark/config.yml b/recipes/benchmark/config.yml index 75621c0323825..c3f78fe6dce87 100644 --- a/recipes/benchmark/config.yml +++ b/recipes/benchmark/config.yml @@ -1,9 +1,13 @@ versions: - "1.5.6": + "1.7.1": folder: all - "1.6.0": + "1.7.0": + folder: all + "1.6.2": folder: all "1.6.1": folder: all - "1.6.2": + "1.6.0": + folder: all + "1.5.6": folder: all diff --git a/recipes/bigint/all/conanfile.py b/recipes/bigint/all/conanfile.py index c4c070e4b830d..5c6ea127ba6bd 100644 --- a/recipes/bigint/all/conanfile.py +++ b/recipes/bigint/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class BigintConan(ConanFile): @@ -16,6 +16,7 @@ class BigintConan(ConanFile): homepage = "https://mattmccutchen.net/bigint" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,8 +29,7 @@ class BigintConan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,18 +37,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.options.shared and is_msvc(self) and is_msvc_static_runtime(self): - raise ConanInvalidConfiguration("shared with static runtime not supported") + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("shared with static runtime not supported") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/bigint/all/test_package/conanfile.py b/recipes/bigint/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/bigint/all/test_package/conanfile.py +++ b/recipes/bigint/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/bigint/all/test_v1_package/CMakeLists.txt b/recipes/bigint/all/test_v1_package/CMakeLists.txt index d1ec33823d2ba..0d20897301b68 100644 --- a/recipes/bigint/all/test_v1_package/CMakeLists.txt +++ b/recipes/bigint/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(bigint REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE bigint::bigint) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/bigint/all/test_v1_package/conanfile.py b/recipes/bigint/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/bigint/all/test_v1_package/conanfile.py +++ b/recipes/bigint/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/bimg/all/conandata.yml b/recipes/bimg/all/conandata.yml new file mode 100644 index 0000000000000..b65f46ed5223b --- /dev/null +++ b/recipes/bimg/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20230114": + url: "https://github.com/bkaradzic/bimg/archive/7afa2419254fd466c013a51bdeb0bee3022619c4.tar.gz" + sha256: "664D2DB41B60E1BEA473898427CD71D43CD33397A24596F1A2CF269D324A305D" diff --git a/recipes/bimg/all/conanfile.py b/recipes/bimg/all/conanfile.py new file mode 100644 index 0000000000000..83eb227558d62 --- /dev/null +++ b/recipes/bimg/all/conanfile.py @@ -0,0 +1,246 @@ +from conan import ConanFile +from conan.tools.files import copy, get, rename +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, check_min_vs, is_msvc_static_runtime +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import MSBuild, VCVars +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.env import VirtualBuildEnv +from pathlib import Path +import os + +required_conan_version = ">=1.50.0" + + +class bimgConan(ConanFile): + name = "bimg" + license = "BSD-2-Clause" + homepage = "https://github.com/bkaradzic/bimg" + url = "https://github.com/conan-io/conan-center-index" + description = "Image library providing loading, saving, conversions and other utilities." + topics = ("image", "graphics") + settings = "os", "compiler", "arch", "build_type" + options = {"tools": [True, False]} + default_options = {"tools": False} + + @property + def _bx_folder(self): + return "bx" + + @property + def _bimg_folder(self): + return "bimg" + + @property + def _bimg_path(self): + return os.path.join(self.source_folder, self._bimg_folder) + + @property + def _genie_extra(self): + genie_extra = "" + if is_msvc(self) and not is_msvc_static_runtime(self): + genie_extra += " --with-dynamic-runtime" + if self.options.tools: + genie_extra += " --with-tools" + return genie_extra + + @property + def _lib_target_prefix(self): + if self.settings.os == "Windows": + return "libs\\" + else: + return "" + + @property + def _tool_target_prefix(self): + if self.settings.os == "Windows": + return "tools\\" + else: + return "" + + @property + def _projs(self): + projs = [f"{self._lib_target_prefix}bimg", f"{self._lib_target_prefix}bimg_decode", f"{self._lib_target_prefix}bimg_encode"] + if self.options.tools: + projs.extend([f"{self._lib_target_prefix}texturec"]) + return projs + + @property + def _compiler_required(self): + return { + "gcc": "8", + "clang": "3.3", + "apple-clang": "5", + } + + @property + def _bx_version(self): #mapping of bimg version to required/used bx version + return {"cci.20230114": "cci.20221116"} + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires(f"bx/{self._bx_version[self.version]}") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + check_min_vs(self, 191) + if not is_msvc(self): + try: + minimum_required_compiler_version = self._compiler_required[str(self.settings.compiler)] + if Version(self.settings.compiler.version) < minimum_required_compiler_version: + raise ConanInvalidConfiguration("This package requires C++14 support. The current compiler does not support it.") + except KeyError: + self.output.warn("This recipe has no checking for the current compiler. Please consider adding it.") + + def build_requirements(self): + self.tool_requires("genie/1170") + if not is_msvc(self) and self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True, + destination=os.path.join(self.source_folder, self._bimg_folder)) + # bimg's genie project, and the projects generated by it, expect bx source to be present on the same relative root as bimg's in order to build + # usins a pre-built bx instead would require significant changes to the genie project but may be worth looking into in the future + get(self, **self.dependencies["bx"].conan_data["sources"][self._bx_version[self.version]], strip_root=True, + destination=os.path.join(self.source_folder, self._bx_folder)) + + def generate(self): + vbe = VirtualBuildEnv(self) + vbe.generate() + if is_msvc(self): + tc = VCVars(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + tc.generate() + + def build(self): + if is_msvc(self): + # Conan to Genie translation maps + vs_ver_to_genie = {"17": "2022", "16": "2019", "15": "2017", + "193": "2022", "192": "2019", "191": "2017"} + + # Use genie directly, then msbuild on specific projects based on requirements + genie_VS = f"vs{vs_ver_to_genie[str(self.settings.compiler.version)]}" + genie_gen = f"{self._genie_extra} {genie_VS}" + self.run(f"genie {genie_gen}", cwd=self._bimg_path) + + msbuild = MSBuild(self) + # customize to Release when RelWithDebInfo + msbuild.build_type = "Debug" if self.settings.build_type == "Debug" else "Release" + # use Win32 instead of the default value when building x86 + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(self._bimg_path, ".build", "projects", genie_VS, "bimg.sln"), targets=self._projs) + else: + # Not sure if XCode can be spefically handled by conan for building through, so assume everything not VS is make + # gcc-multilib and g++-multilib required for 32bit cross-compilation, should see if we can check and install through conan + + # Conan to Genie translation maps + compiler_str = str(self.settings.compiler) + compiler_and_os_to_genie = {"Windows": f"--gcc=mingw-{compiler_str}", "Linux": f"--gcc=linux-{compiler_str}", + "FreeBSD": "--gcc=freebsd", "Macos": "--gcc=osx", + "Android": "--gcc=android", "iOS": "--gcc=ios"} + gmake_os_to_proj = {"Windows": "mingw", "Linux": "linux", "FreeBSD": "freebsd", "Macos": "osx", "Android": "android", "iOS": "ios"} + gmake_arch_to_genie_suffix = {"x86": "-x86", "x86_64": "-x64", "armv8": "-arm64", "armv7": "-arm"} + os_to_use_arch_config_suffix = {"Windows": False, "Linux": False, "FreeBSD": False, "Macos": True, "Android": True, "iOS": True} + + build_type_to_make_config = {"Debug": "config=debug", "Release": "config=release"} + arch_to_make_config_suffix = {"x86": "32", "x86_64": "64"} + os_to_use_make_config_suffix = {"Windows": True, "Linux": True, "FreeBSD": True, "Macos": False, "Android": False, "iOS": False} + + # Generate projects through genie + genieGen = f"{self._genie_extra} {compiler_and_os_to_genie[str(self.settings.os)]}" + if os_to_use_arch_config_suffix[str(self.settings.os)]: + genieGen += f"{gmake_arch_to_genie_suffix[str(self.settings.arch)]}" + genieGen += " gmake" + self.run(f"genie {genieGen}", cwd=self._bimg_path) + + # Build project folder and path from given settings + projFolder = f"gmake-{gmake_os_to_proj[str(self.settings.os)]}" + if self.settings.os == "Windows" or compiler_str not in ["gcc", "apple-clang"]: + projFolder += f"-{compiler_str}" #mingw-gcc or mingw-clang for windows; -clang for linux (where gcc on linux has no extra) + if os_to_use_arch_config_suffix[str(self.settings.os)]: + projFolder += gmake_arch_to_genie_suffix[str(self.settings.arch)] + proj_path = os.path.sep.join([self._bimg_path, ".build", "projects", projFolder]) + + # Build make args from settings + conf = build_type_to_make_config[str(self.settings.build_type)] + if os_to_use_make_config_suffix[str(self.settings.os)]: + conf += arch_to_make_config_suffix[str(self.settings.arch)] + if self.settings.os == "Windows": + mingw = "MINGW=$MINGW_PREFIX" + proj_path = proj_path.replace("\\", "/") # Fix path for msys... + else: + mingw = "" + autotools = Autotools(self) + # Build with make + for proj in self._projs: + autotools.make(target=proj, args=["-R", f"-C {proj_path}", mingw, conf]) + + def package(self): + # Set platform suffixes and prefixes + if self.settings.os == "Windows": + lib_pat = "*bimg*.lib" + package_lib_prefix = "" + elif self.settings.os in ["Linux", "FreeBSD"]: + lib_pat = "*bimg*.a" + package_lib_prefix = "lib" + elif self.settings.os == "Macos": + lib_pat = "*bimg*.a" + package_lib_prefix = "lib" + + # Get build bin folder + for bimg_out_dir in os.listdir(os.path.join(self._bimg_path, ".build")): + if not bimg_out_dir=="projects": + build_bin = os.path.join(self._bimg_path, ".build", bimg_out_dir, "bin") + break + + # Copy license + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self._bimg_path) + # Copy includes + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._bimg_path, "include")) + # Copy libs + copy(self, pattern=lib_pat, dst=os.path.join(self.package_folder, "lib"), src=build_bin, keep_path=False) + # Copy tools + if self.options.tools: + copy(self, pattern="texturec*", dst=os.path.join(self.package_folder, "bin"), src=build_bin, keep_path=False) + + # Rename for consistency across platforms and configs + for bimg_file in Path(os.path.join(self.package_folder, "lib")).glob("*bimg*"): + fExtra = "" + if bimg_file.name.find("encode") >= 0: + fExtra = "_encode" + elif bimg_file.name.find("decode") >= 0: + fExtra = "_decode" + rename(self, os.path.join(self.package_folder, "lib", bimg_file.name), + os.path.join(self.package_folder, "lib", f"{package_lib_prefix}bimg{fExtra}{bimg_file.suffix}")) + if self.options.tools: + for bimg_file in Path(os.path.join(self.package_folder, "bin")).glob("*texturec*"): + rename(self, os.path.join(self.package_folder, "bin", bimg_file.name), + os.path.join(self.package_folder, "bin", f"texturec{bimg_file.suffix}")) + + def package_info(self): + self.cpp_info.includedirs = ["include"] + self.cpp_info.libs = ["bimg_encode", "bimg_decode", "bimg"] + + self.cpp_info.set_property("cmake_file_name", "bimg") + self.cpp_info.set_property("cmake_target_name", "bimg::bimg") + self.cpp_info.set_property("pkg_config_name", "bimg") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "bimg" + self.cpp_info.filenames["cmake_find_package_multi"] = "bimg" + self.cpp_info.names["cmake_find_package"] = "bimg" + self.cpp_info.names["cmake_find_package_multi"] = "bimg" diff --git a/recipes/bimg/all/test_package/CMakeLists.txt b/recipes/bimg/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ffa49fe136f63 --- /dev/null +++ b/recipes/bimg/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(bimg REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF) +target_link_libraries(${PROJECT_NAME} bimg::bimg) diff --git a/recipes/bimg/all/test_package/conanfile.py b/recipes/bimg/all/test_package/conanfile.py new file mode 100644 index 0000000000000..4100c3ff4959c --- /dev/null +++ b/recipes/bimg/all/test_package/conanfile.py @@ -0,0 +1,29 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.layout import cmake_layout +from conan.tools.cmake import CMake +import os + +required_conan_version = ">=1.50.0" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + if can_run(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/bimg/all/test_package/test_package.cpp b/recipes/bimg/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..8869b9884eaf4 --- /dev/null +++ b/recipes/bimg/all/test_package/test_package.cpp @@ -0,0 +1,26 @@ +#include +#include +#include +#include + +//An embedded 2x2 PNG image in RGB8 format with a red pixel, a green pixel, a blue pixel and a white pixel +const unsigned char img[129] ={0x89, 0x50, 0x4e, 0x47, 0x0d, 0x0a, 0x1a, 0x0a, +0x00, 0x00, 0x00, 0x0d, 0x49, 0x48, 0x44, 0x52, 0x00, 0x00, 0x00, 0x02, +0x00, 0x00, 0x00, 0x02, 0x08, 0x02, 0x00, 0x00, 0x00, 0xfd, 0xd4, 0x9a, +0x73, 0x00, 0x00, 0x00, 0x01, 0x73, 0x52, 0x47, 0x42, 0x00, 0xae, 0xce, +0x1c, 0xe9, 0x00, 0x00, 0x00, 0x04, 0x67, 0x41, 0x4d, 0x41, 0x00, 0x00, +0xb1, 0x8f, 0x0b, 0xfc, 0x61, 0x05, 0x00, 0x00, 0x00, 0x09, 0x70, 0x48, +0x59, 0x73, 0x00, 0x00, 0x0e, 0xc3, 0x00, 0x00, 0x0e, 0xc3, 0x01, 0xc7, +0x6f, 0xa8, 0x64, 0x00, 0x00, 0x00, 0x16, 0x49, 0x44, 0x41, 0x54, 0x18, +0x57, 0x63, 0x78, 0x2b, 0xa3, 0xa2, 0xb4, 0xd1, 0x87, 0xc1, 0xde, 0xe3, +0xcc, 0xff, 0xff, 0xff, 0x01, 0x24, 0xec, 0x06, 0x9d, 0x64, 0xf4, 0x18, +0xdc, 0x00, 0x00, 0x00, 0x00, 0x49, 0x45, 0x4e, 0x44, 0xae, 0x42, 0x60, 0x82}; + +int main() { + bx::DefaultAllocator defAlloc; + bimg::ImageContainer* imageContainer = nullptr; + imageContainer = bimg::imageParse(&defAlloc, (const void*) img, 129 * sizeof(char)); + BX_ASSERT(imageContainer->m_format == bimg::TextureFormat::RGB8, "Image incorrectly decoded.") + bimg::imageFree(imageContainer); + return 0; +} diff --git a/recipes/bimg/all/test_v1_package/CMakeLists.txt b/recipes/bimg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..667976629550a --- /dev/null +++ b/recipes/bimg/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/bimg/all/test_v1_package/conanfile.py b/recipes/bimg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..056e75eddb91c --- /dev/null +++ b/recipes/bimg/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class BimgTestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/bimg/config.yml b/recipes/bimg/config.yml new file mode 100644 index 0000000000000..7f66042e6618c --- /dev/null +++ b/recipes/bimg/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20230114": + folder: all diff --git a/recipes/binutils/all/conandata.yml b/recipes/binutils/all/conandata.yml index 32dec03e26519..a4c3a01e317b2 100644 --- a/recipes/binutils/all/conandata.yml +++ b/recipes/binutils/all/conandata.yml @@ -8,4 +8,5 @@ sources: patches: "2.38": - patch_file: "patches/2.38-0001-no-texinfo.patch" - base_path: "source_subfolder" + patch_type: conan + patch_description: "disable texinfo" diff --git a/recipes/binutils/all/conanfile.py b/recipes/binutils/all/conanfile.py index 6b5e07979ad3b..142067bea696e 100644 --- a/recipes/binutils/all/conanfile.py +++ b/recipes/binutils/all/conanfile.py @@ -1,14 +1,17 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import functools import os import re import typing import unittest +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.54.0" # This recipe includes a selftest to test conversion of os/arch to triplets (and vice verse) # Run it using `python -m unittest conanfile.py` @@ -17,35 +20,33 @@ class BinutilsConan(ConanFile): name = "binutils" description = "The GNU Binutils are a collection of binary tools." + package_type = "application" license = "GPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index/" homepage = "https://www.gnu.org/software/binutils" - topics = ("binutils", "ld", "linker", "as", "assembler", "objcopy", "objdump") + topics = ("gnu", "ld", "linker", "as", "assembler", "objcopy", "objdump") settings = "os", "arch", "compiler", "build_type" - _PLACEHOLDER_TEXT = "__PLACEHOLDER__" - options = { "multilib": [True, False], "with_libquadmath": [True, False], - "target_arch": "ANY", - "target_os": "ANY", - "target_triplet": "ANY", - "prefix": "ANY", + "target_arch": [None, "ANY"], + "target_os": [None, "ANY"], + "target_triplet": [None, "ANY"], + "prefix": [None, "ANY"], } default_options = { "multilib": True, "with_libquadmath": True, - "target_arch": _PLACEHOLDER_TEXT, # Initialized in configure, checked in validate - "target_os": _PLACEHOLDER_TEXT, # Initialized in configure, checked in validate - "target_triplet": _PLACEHOLDER_TEXT, # Initialized in configure, checked in validate - "prefix": _PLACEHOLDER_TEXT, # Initialized in configure (NOT config_options, because it depends on target_{arch,os}) + "target_arch": None, # Initialized in configure, checked in validate + "target_os": None, # Initialized in configure, checked in validate + "target_triplet": None, # Initialized in configure, checked in validate + "prefix": None, # Initialized in configure (NOT config_options, because it depends on target_{arch,os}) } - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") @property def _settings_build(self): @@ -56,34 +57,35 @@ def _settings_target(self): return getattr(self, "settings_target", None) or self.settings def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) - - def config_options(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + export_conandata_patches(self) def configure(self): - if self.options.target_triplet == self._PLACEHOLDER_TEXT: - if self.options.target_arch == self._PLACEHOLDER_TEXT: + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + if not self.options.target_triplet: + if not self.options.target_arch: # If target triplet and target arch are not set, initialize it from the target settings self.options.target_arch = str(self._settings_target.arch) - if self.options.target_os == self._PLACEHOLDER_TEXT: + if not self.options.target_os: # If target triplet and target os are not set, initialize it from the target settings self.options.target_os = str(self._settings_target.os) # Initialize the target_triplet from the target arch and target os - self.options.target_triplet = _GNUTriplet.from_archos(_ArchOs(arch=str(self.options.target_arch), os=str(self.options.target_os), extra=dict(self._settings_target.values_list))).triplet + self.options.target_triplet = _GNUTriplet.from_archos(_ArchOs( + arch=str(self.options.target_arch), + os=str(self.options.target_os), + extra=dict(self._settings_target.values_list))).triplet else: gnu_triplet_obj = _GNUTriplet.from_text(str(self.options.target_triplet)) archos = _ArchOs.from_triplet(gnu_triplet_obj) - if self.options.target_arch == self._PLACEHOLDER_TEXT: + if not self.options.target_arch: # If target arch is not set, deduce it from the target triplet self.options.target_arch = archos.arch - if self.options.target_os == self._PLACEHOLDER_TEXT: + if not self.options.target_os: # If target arch is not set, deduce it from the target triplet self.options.target_os = archos.os - if self.options.prefix == self._PLACEHOLDER_TEXT: + if not self.options.prefix: self.options.prefix = f"{self.options.target_triplet}-" self.output.info(f"binutils:target_arch={self.options.target_arch}") @@ -91,7 +93,7 @@ def configure(self): self.output.info(f"binutils:target_triplet={self.options.target_triplet}") def validate(self): - if self.settings.compiler in ("msvc", "Visual Studio"): + if is_msvc(self): raise ConanInvalidConfiguration("This recipe does not support building binutils by this compiler") if self.options.target_os == "Macos": @@ -99,9 +101,9 @@ def validate(self): # Check whether the actual target_arch and target_os option are valid (they should be in settings.yml) # FIXME: does there exist a stable Conan API to accomplish this? - if self.options.target_arch not in self.settings.arch.values_range: + if str(self.options.target_arch) not in self.settings.arch.values_range: raise ConanInvalidConfiguration(f"target_arch={self.options.target_arch} is invalid (possibilities={self.settings.arch.values_range})") - if self.options.target_os not in self.settings.os.values_range: + if str(self.options.target_os) not in self.settings.os.values_range: raise ConanInvalidConfiguration(f"target_os={self.options.target_os} is invalid (possibilities={self.settings.os.values_range})") target_archos = _ArchOs(str(self.options.target_arch), str(self.options.target_os)) @@ -126,64 +128,79 @@ def _raise_unsupported_configuration(self, key, value): raise ConanInvalidConfiguration(f"This configuration is unsupported by this conan recip. Please consider adding support. ({key}={value})") def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type="str"): + self.tool_requires("msys2/cci.latest") + + if self.version >= "2.39": + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _exec_prefix(self): - return os.path.join(self.package_folder, "bin", "exec_prefix") - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") - yes_no = lambda tf : "yes" if tf else "no" - conf_args = [ - f"--target={self.options.target_triplet}", - f"--enable-multilib={yes_no(self.options.multilib)}", - "--with-system-zlib", - "--disable-nls", - f"--program-prefix={self.options.prefix}", - f"exec_prefix={tools.unix_path(self._exec_prefix)}", - ] - autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return autotools + return os.path.join("bin", "exec_prefix") + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + def yes_no(opt): return "yes" if opt else "no" + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-nls") + tc.configure_args.append(f"--target={self.options.target_triplet}") + tc.configure_args.append(f"--enable-multilib={yes_no(self.options.multilib)}") + tc.configure_args.append(f"--with-zlib={unix_path(self, self.dependencies['zlib'].package_folder)}") + tc.configure_args.append(f"--program-prefix={self.options.prefix}") + tc.configure_args.append("--exec_prefix=/bin/exec_prefix") + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - autotools = self._configure_autotools() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("COPYING*", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib"), recursive=True) + copy( + self, + pattern="COPYING*", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + keep_path=False, + ) def package_info(self): - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) - target_bindir = os.path.join(self._exec_prefix, str(self.options.target_triplet), "bin") - self.output.info("Appending PATH environment variable: {}".format(target_bindir)) - self.env_info.PATH.append(target_bindir) + self.cpp_info.bindirs = ["bin", target_bindir] + + absolute_target_bindir = os.path.join(self.package_folder, target_bindir) + # v1 exports + bindir = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bindir) + self.env_info.PATH.append(absolute_target_bindir) self.output.info(f"GNU triplet={self.options.target_triplet}") self.user_info.gnu_triplet = self.options.target_triplet - - self.output.info(f"executable prefix={self.options.prefix}") self.user_info.prefix = self.options.prefix + self.output.info(f"executable prefix={self.options.prefix}") + + # v2 exports + self.buildenv_info.append_path("PATH", bindir) + self.buildenv_info.append_path("PATH", absolute_target_bindir) + self.conf_info.define("user.binutils:gnu_triplet", self.options.target_triplet) + self.conf_info.define("user.binutils:prefix", self.options.prefix) # Add recipe path to enable running the self test in the test package. # Don't use this property in production code. It's unsupported. @@ -191,7 +208,7 @@ def package_info(self): class _ArchOs: - def __init__(self, arch: str, os: str, extra: typing.Optional[typing.Dict[str, str]]=None): + def __init__(self, arch: str, os: str, extra: typing.Optional[typing.Dict[str, str]] = None): self.arch = arch self.os = os self.extra = extra if extra is not None else {} @@ -241,16 +258,16 @@ def calculate_os(cls, triplet: "_GNUTriplet") -> str: @classmethod def from_triplet(cls, triplet: "_GNUTriplet") -> "_ArchOs": archs = cls.calculate_archs(triplet) - os = cls.calculate_os(triplet) + _os = cls.calculate_os(triplet) extra = {} - if os == "Android" and triplet.abi: + if _os == "Android" and triplet.abi: m = re.match(".*([0-9]+)", triplet.abi) if m: extra["os.api_level"] = m.group(1) # Assume first architecture - return cls(arch=archs[0], os=os, extra=extra) + return cls(arch=archs[0], os=_os, extra=extra) def __eq__(self, other) -> bool: if type(self) != type(other): @@ -300,7 +317,7 @@ def from_text(cls, text: str) -> "_GNUTriplet": gnu_machine = parts[0] parts = parts[1:] - if any(v in parts[-1] for v in cls.KNOWN_GNU_ABIS): + if any(v in parts[-1] for v in cls.KNOWN_GNU_ABIS): gnu_abi = parts[-1] parts = parts[:-1] else: @@ -325,7 +342,6 @@ def from_text(cls, text: str) -> "_GNUTriplet": return cls(gnu_machine, gnu_vendor, gnu_os, gnu_abi) - ARCH_TO_GNU_MACHINE_LUT = { "x86": "i686", "x86_64": "x86_64", diff --git a/recipes/binutils/all/test_package/conanfile.py b/recipes/binutils/all/test_package/conanfile.py index 6b7ddeed01c09..9f4ceaa413255 100644 --- a/recipes/binutils/all/test_package/conanfile.py +++ b/recipes/binutils/all/test_package/conanfile.py @@ -1,113 +1,32 @@ -from conans import ConanFile, tools -from io import StringIO -import os +from conan import ConanFile class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @property - def _target_arch(self): - return str(self.options["binutils"].target_arch) - - @property - def _target_os(self): - return str(self.options["binutils"].target_os) - - @property - def _test_linker_args(self): - args = [] - if self._target_os == "Windows": - args.extend(["--subsystem", "console", f"{self.build_folder}/lib/libkernel32.a"]) - return args - - @property - def _test_package_assembly_source(self): - part_arch = self._target_arch - if "armv7" in part_arch: - part_arch = "armv7" - elif part_arch in ("riscv32", "riscv64"): - part_arch = "riscv" - return os.path.join(self.source_folder, f"{self._target_os}-{part_arch}.s") - - def _append_gnu_triplet(self, exe): - return f"{self.deps_user_info['binutils'].prefix}{exe}" - - def build(self): - if not tools.cross_building(self): - - if not os.path.isfile(self._test_package_assembly_source): - self.output.warn(f"Missing {self._test_package_assembly_source}.\ntest_package does not support this target os/arch. Please consider adding it. (It's a great learning experience)") - else: - tools.mkdir(os.path.join(self.build_folder, "bin")) - tools.mkdir(os.path.join(self.build_folder, "lib")) - - gas = self._append_gnu_triplet("as") - ld = self._append_gnu_triplet("ld") - extension = "" - if self._target_os == "Windows": - extension = ".exe" - - # Create minimum import library for kernel32.dll - dlltool = f"{self.deps_user_info['binutils'].gnu_triplet}-dlltool" - - dlltool_args = [dlltool, "--input-def", f"{self.source_folder}/Windows-kernel32.def", "--output-lib", f"{self.build_folder}/lib/libkernel32.a"] - self.run(" ".join(dlltool_args)) - - - assembler_args = [gas, self._test_package_assembly_source, "-o", f"{self.build_folder}/object.o"] - linker_args = [ld, f"{self.build_folder}/object.o", "-o", f"{self.build_folder}/bin/test_package{extension}"] + self._test_linker_args - - self.run(" ".join(assembler_args)) - self.run(" ".join(linker_args)) - - def _can_run_target(self): - if self._settings_build.os != self._target_os: - return False - if self._settings_build.arch == "x86_64": - return self._target_arch in ("x86", "x86_64") - return self._settings_build.arch == self._target_arch - def _has_as(self): - if self._target_os in ("Macos"): - return False - return True + return self._settings_build.os not in ("Macos",) + @property def _has_ld(self): - if self._target_os in ("Macos"): - return False - return True + return self._settings_build.os not in ("Macos",) def test(self): - # Run selftest (conversion between conan os/arch <=> gnu triplet) - with tools.chdir(os.path.dirname(self.deps_user_info["binutils"].recipe_path)): - self.run(f"python -m unittest {os.path.basename(self.deps_user_info['binutils'].recipe_path)} --verbose") - - if not tools.cross_building(self): - if self._can_run_target() and os.path.isfile(self._test_package_assembly_source): - output = StringIO() - self.run(os.path.join("bin", "test_package"), output=output) - text = output.getvalue() - print(text) - assert "Hello, world!" in text - - bins = ["ar", "nm", "objcopy", "objdump", "ranlib", "readelf", "strip"] - if self._has_as(): - bins.append("as") - if self._has_ld(): - bins.append("ld") - - for bin in bins: - bin_path = os.path.realpath(tools.which(bin)) - self.output.info(f"Found {bin} at {bin_path}") - assert bin_path.startswith(self.deps_cpp_info["binutils"].rootpath) - - output = StringIO() - self.run("{} --version".format(bin_path), run_environment=True, output=output) - text = output.getvalue() - print(text) - assert str(self.requires["binutils"].ref.version) in text + binaries = ["ar", "nm", "objcopy", "objdump", "ranlib", "readelf", "strip"] + if self._has_as: + binaries.append("as") + if self._has_ld: + binaries.append("ld") + + for binary in binaries: + self.run(f"{binary} --version", env="conanbuild") diff --git a/recipes/binutils/all/test_package/Linux-armv7.s b/recipes/binutils/all/test_v1_package/Linux-armv7.s similarity index 100% rename from recipes/binutils/all/test_package/Linux-armv7.s rename to recipes/binutils/all/test_v1_package/Linux-armv7.s diff --git a/recipes/binutils/all/test_package/Linux-armv8.s b/recipes/binutils/all/test_v1_package/Linux-armv8.s similarity index 100% rename from recipes/binutils/all/test_package/Linux-armv8.s rename to recipes/binutils/all/test_v1_package/Linux-armv8.s diff --git a/recipes/binutils/all/test_package/Linux-riscv.s b/recipes/binutils/all/test_v1_package/Linux-riscv.s similarity index 100% rename from recipes/binutils/all/test_package/Linux-riscv.s rename to recipes/binutils/all/test_v1_package/Linux-riscv.s diff --git a/recipes/binutils/all/test_package/Linux-x86.s b/recipes/binutils/all/test_v1_package/Linux-x86.s similarity index 100% rename from recipes/binutils/all/test_package/Linux-x86.s rename to recipes/binutils/all/test_v1_package/Linux-x86.s diff --git a/recipes/binutils/all/test_package/Linux-x86_64.s b/recipes/binutils/all/test_v1_package/Linux-x86_64.s similarity index 100% rename from recipes/binutils/all/test_package/Linux-x86_64.s rename to recipes/binutils/all/test_v1_package/Linux-x86_64.s diff --git a/recipes/binutils/all/test_package/Windows-kernel32.def b/recipes/binutils/all/test_v1_package/Windows-kernel32.def similarity index 100% rename from recipes/binutils/all/test_package/Windows-kernel32.def rename to recipes/binutils/all/test_v1_package/Windows-kernel32.def diff --git a/recipes/binutils/all/test_package/Windows-x86.s b/recipes/binutils/all/test_v1_package/Windows-x86.s similarity index 100% rename from recipes/binutils/all/test_package/Windows-x86.s rename to recipes/binutils/all/test_v1_package/Windows-x86.s diff --git a/recipes/binutils/all/test_package/Windows-x86_64.s b/recipes/binutils/all/test_v1_package/Windows-x86_64.s similarity index 100% rename from recipes/binutils/all/test_package/Windows-x86_64.s rename to recipes/binutils/all/test_v1_package/Windows-x86_64.s diff --git a/recipes/binutils/all/test_v1_package/conanfile.py b/recipes/binutils/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6b7ddeed01c09 --- /dev/null +++ b/recipes/binutils/all/test_v1_package/conanfile.py @@ -0,0 +1,113 @@ +from conans import ConanFile, tools +from io import StringIO +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + @property + def _target_arch(self): + return str(self.options["binutils"].target_arch) + + @property + def _target_os(self): + return str(self.options["binutils"].target_os) + + @property + def _test_linker_args(self): + args = [] + if self._target_os == "Windows": + args.extend(["--subsystem", "console", f"{self.build_folder}/lib/libkernel32.a"]) + return args + + @property + def _test_package_assembly_source(self): + part_arch = self._target_arch + if "armv7" in part_arch: + part_arch = "armv7" + elif part_arch in ("riscv32", "riscv64"): + part_arch = "riscv" + return os.path.join(self.source_folder, f"{self._target_os}-{part_arch}.s") + + def _append_gnu_triplet(self, exe): + return f"{self.deps_user_info['binutils'].prefix}{exe}" + + def build(self): + if not tools.cross_building(self): + + if not os.path.isfile(self._test_package_assembly_source): + self.output.warn(f"Missing {self._test_package_assembly_source}.\ntest_package does not support this target os/arch. Please consider adding it. (It's a great learning experience)") + else: + tools.mkdir(os.path.join(self.build_folder, "bin")) + tools.mkdir(os.path.join(self.build_folder, "lib")) + + gas = self._append_gnu_triplet("as") + ld = self._append_gnu_triplet("ld") + extension = "" + if self._target_os == "Windows": + extension = ".exe" + + # Create minimum import library for kernel32.dll + dlltool = f"{self.deps_user_info['binutils'].gnu_triplet}-dlltool" + + dlltool_args = [dlltool, "--input-def", f"{self.source_folder}/Windows-kernel32.def", "--output-lib", f"{self.build_folder}/lib/libkernel32.a"] + self.run(" ".join(dlltool_args)) + + + assembler_args = [gas, self._test_package_assembly_source, "-o", f"{self.build_folder}/object.o"] + linker_args = [ld, f"{self.build_folder}/object.o", "-o", f"{self.build_folder}/bin/test_package{extension}"] + self._test_linker_args + + self.run(" ".join(assembler_args)) + self.run(" ".join(linker_args)) + + def _can_run_target(self): + if self._settings_build.os != self._target_os: + return False + if self._settings_build.arch == "x86_64": + return self._target_arch in ("x86", "x86_64") + return self._settings_build.arch == self._target_arch + + def _has_as(self): + if self._target_os in ("Macos"): + return False + return True + + def _has_ld(self): + if self._target_os in ("Macos"): + return False + return True + + def test(self): + # Run selftest (conversion between conan os/arch <=> gnu triplet) + with tools.chdir(os.path.dirname(self.deps_user_info["binutils"].recipe_path)): + self.run(f"python -m unittest {os.path.basename(self.deps_user_info['binutils'].recipe_path)} --verbose") + + if not tools.cross_building(self): + if self._can_run_target() and os.path.isfile(self._test_package_assembly_source): + output = StringIO() + self.run(os.path.join("bin", "test_package"), output=output) + text = output.getvalue() + print(text) + assert "Hello, world!" in text + + bins = ["ar", "nm", "objcopy", "objdump", "ranlib", "readelf", "strip"] + if self._has_as(): + bins.append("as") + if self._has_ld(): + bins.append("ld") + + for bin in bins: + bin_path = os.path.realpath(tools.which(bin)) + self.output.info(f"Found {bin} at {bin_path}") + assert bin_path.startswith(self.deps_cpp_info["binutils"].rootpath) + + output = StringIO() + self.run("{} --version".format(bin_path), run_environment=True, output=output) + text = output.getvalue() + print(text) + assert str(self.requires["binutils"].ref.version) in text diff --git a/recipes/bison/all/conandata.yml b/recipes/bison/all/conandata.yml index cab26f5d149a0..5b0419bb8cd0b 100644 --- a/recipes/bison/all/conandata.yml +++ b/recipes/bison/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.8.2": + url: "https://ftp.gnu.org/gnu/bison/bison-3.8.2.tar.gz" + sha256: "06c9e13bdf7eb24d4ceb6b59205a4f67c2c7e7213119644430fe82fbd14a0abb" "3.7.6": url: "https://ftp.gnu.org/gnu/bison/bison-3.7.6.tar.gz" sha256: "69dc0bb46ea8fc307d4ca1e0b61c8c355eb207d0b0c69f4f8462328e74d7b9ea" @@ -9,30 +12,52 @@ sources: url: "https://ftp.gnu.org/gnu/bison/bison-3.5.3.tar.gz" sha256: "34e201d963156618a0ea5bc87220f660a1e08403dd3c7c7903d4f38db3f40039" patches: + "3.8.2": + - patch_file: "patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" + patch_description: "use O_TEXT instead of O_BINARY for pipe" + patch_type: "portability" + - patch_file: "patches/0002-3.7.6-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" + patch_description: "windows: open source file in binary mode" + patch_type: "portability" + - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" + patch_description: "msvc: limit search range of _setmaxstdio" + patch_type: "portability" "3.7.6": - patch_file: "patches/0001-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" - base_path: "source_subfolder" + patch_description: "use O_TEXT instead of O_BINARY for pipe" + patch_type: "portability" - patch_file: "patches/0002-3.7.6-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" - base_path: "source_subfolder" + patch_description: "windows: open source file in binary mode" + patch_type: "portability" - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" - base_path: "source_subfolder" + patch_description: "msvc: limit search range of _setmaxstdio" + patch_type: "portability" "3.7.1": - patch_file: "patches/0001-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" - base_path: "source_subfolder" + patch_description: "use O_TEXT instead of O_BINARY for pipe" + patch_type: "portability" - patch_file: "patches/0002-3.7.1-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" - base_path: "source_subfolder" + patch_description: "windows: open source file in binary mode" + patch_type: "portability" - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" - base_path: "source_subfolder" + patch_description: "msvc: limit search range of _setmaxstdio" + patch_type: "portability" - patch_file: "patches/0006-dont-link-bison-against-libreadline.patch" - base_path: "source_subfolder" + patch_description: "Don't link bison against libreadline" + patch_type: "portability" "3.5.3": - patch_file: "patches/0001-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch" - base_path: "source_subfolder" + patch_description: "use O_TEXT instead of O_BINARY for pipe" + patch_type: "portability" - patch_file: "patches/0002-3.5.3-open-source-file-in-binary-mode-MS-ftell-bug-ks-68337.patch" - base_path: "source_subfolder" + patch_description: "windows: open source file in binary mode" + patch_type: "portability" - patch_file: "patches/0003-3.5.3-msvc-changes.patch" - base_path: "source_subfolder" + patch_description: "windows: fix build" + patch_type: "portability" - patch_file: "patches/0004-3.5.3-relocatable.patch" - base_path: "source_subfolder" + patch_description: "Relocatable" + patch_type: "portability" - patch_file: "patches/0005-gnulib-limit-search-range-of-_setmaxstdio.patch" - base_path: "source_subfolder" + patch_description: "msvc: limit search range of _setmaxstdio" + patch_type: "portability" diff --git a/recipes/bison/all/conanfile.py b/recipes/bison/all/conanfile.py index e52d761c606cd..9a5645894b97c 100644 --- a/recipes/bison/all/conanfile.py +++ b/recipes/bison/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -import contextlib +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class BisonConan(ConanFile): @@ -20,148 +25,147 @@ class BisonConan(ConanFile): "fPIC": True, } - exports_sources = "patches/*" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + @property + def _user_info_build(self): + return getattr(self, "user_info_build", self.deps_user_info) + + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("m4/1.4.19") + def validate(self): + if is_msvc(self) and self.version == "3.8.2": + raise ConanInvalidConfiguration( + f"{self.ref} is not yet ready for Visual Studio, use previous version " + "or open a pull request on https://github.com/conan-io/conan-center-index/pulls" + ) + def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - if self.settings.compiler == "Visual Studio": - self.build_requires("automake/1.16.4") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("automake/1.16.5") if self.settings.os != "Windows": - self.build_requires("flex/2.6.4") + self.tool_requires("flex/2.6.4") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "CFLAGS": "-{}".format(self.settings.compiler.runtime), - "LD": "link", - "NM": "dumpbin -symbols", - "STRIP": ":", - "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)), - "RANLIB": ":", - } - with tools.environment_append(env): - yield - else: - yield + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @property - def _datarootdir(self): - return os.path.join(self.package_folder, "res") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - args = [ + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ "--enable-relocatable", "--disable-nls", - "--datarootdir={}".format(os.path.join(self._datarootdir).replace("\\", "/")), - ] - host, build = None, None - if self.settings.os == "Windows": - self._autotools.defines.append("_WINDOWS") + "--datarootdir=${prefix}/res", + ]) if self.settings.compiler == "apple-clang": - args.append("gl_cv_compiler_check_decl_option=") - if self.settings.compiler == "Visual Studio": + tc.configure_args.append("gl_cv_compiler_check_decl_option=") + if is_msvc(self): # Avoid a `Assertion Failed Dialog Box` during configure with build_type=Debug # Visual Studio does not support the %n format flag: # https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions # Because the %n format is inherently insecure, it is disabled by default. If %n is encountered in a format string, # the invalid parameter handler is invoked, as described in Parameter Validation. To enable %n support, see _set_printf_count_output. - args.extend(["gl_cv_func_printf_directive_n=no", "gl_cv_func_snprintf_directive_n=no", "gl_cv_func_snprintf_directive_n=no"]) - self._autotools.flags.append("-FS") - host, build = False, False - self._autotools.configure(args=args, configure_dir=self._source_subfolder, host=host, build=build) - return self._autotools + tc.configure_args.extend([ + "gl_cv_func_printf_directive_n=no", + "gl_cv_func_snprintf_directive_n=no", + "gl_cv_func_snprintf_directive_n=no", + ]) + tc.extra_cflags.append("-FS") + env = tc.environment() + if is_msvc(self): + compile_wrapper = unix_path(self, self._user_info_build["automake"].compile) + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} lib") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + tc.generate(env) def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) + + makefile = os.path.join(self.source_folder, "Makefile.in") + yacc = os.path.join(self.source_folder, "src", "yacc.in") if self.settings.os == "Windows": # replace embedded unix paths by windows paths - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define BINDIR \"$(bindir)\"';", "echo '#define BINDIR \"$(shell cygpath -m \"$(bindir)\")\"';") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define PKGDATADIR \"$(pkgdatadir)\"';", "echo '#define PKGDATADIR \"$(shell cygpath -m \"$(pkgdatadir)\")\"';") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define DATADIR \"$(datadir)\"';", "echo '#define DATADIR \"$(shell cygpath -m \"$(datadir)\")\"';") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "echo '#define DATAROOTDIR \"$(datarootdir)\"';", "echo '#define DATAROOTDIR \"$(shell cygpath -m \"$(datarootdir)\")\"';") - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, makefile, "dist_man_MANS = $(top_srcdir)/doc/bison.1", "dist_man_MANS =") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "yacc.in"), - "@prefix@", - "${}_ROOT".format(self.name.upper())) - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "yacc.in"), - "@bindir@", - "${}_ROOT/bin".format(self.name.upper())) + replace_in_file(self, yacc, "@prefix@", "$CONAN_BISON_ROOT") + replace_in_file(self, yacc, "@bindir@", "$CONAN_BISON_ROOT/bin") def build(self): self._patch_sources() - with self._build_context(): - env_build = self._configure_autotools() - env_build.make() + autotools = Autotools(self) + autotools.configure() + autotools.install() def package(self): - with self._build_context(): - env_build = self._configure_autotools() - env_build.install() - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - - if self.settings.compiler == "Visual Studio": - os.rename(os.path.join(self.package_folder, "lib", "liby.a"), - os.path.join(self.package_folder, "lib", "y.lib")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + if is_msvc(self): + rename(self, os.path.join(self.package_folder, "lib", "liby.a"), + os.path.join(self.package_folder, "lib", "y.lib")) def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libs = ["y"] + self.cpp_info.resdirs = ["res"] - self.output.info("Setting BISON_ROOT environment variable: {}".format(self.package_folder)) - self.env_info.BISON_ROOT = self.package_folder.replace("\\", "/") + bison_root = self.package_folder.replace("\\", "/") + self.buildenv_info.define_path("CONAN_BISON_ROOT", bison_root) - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) - pkgdir = os.path.join(self._datarootdir, "bison") - self.output.info("Setting the BISON_PKGDATADIR environment variable: {}".format(pkgdir)) - self.env_info.BISON_PKGDATADIR = pkgdir + pkgdir = os.path.join(self.package_folder, "res", "bison") + self.buildenv_info.define_path("BISON_PKGDATADIR", pkgdir) # yacc is a shell script, so requires a shell (such as bash) - self.user_info.YACC = os.path.join(self.package_folder, "bin", "yacc").replace("\\", "/") + yacc = os.path.join(self.package_folder, "bin", "yacc").replace("\\", "/") + self.conf_info.define("user.bison:yacc", yacc) + + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.CONAN_BISON_ROOT = self.package_folder.replace("\\", "/") + self.env_info.BISON_PKGDATADIR = pkgdir + self.user_info.YACC = yacc diff --git a/recipes/bison/all/patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch b/recipes/bison/all/patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch new file mode 100644 index 0000000000000..b40517e5083c9 --- /dev/null +++ b/recipes/bison/all/patches/0001-3.8-create_pipe-uses-O_TEXT-not-O_BINARY-mode.patch @@ -0,0 +1,29 @@ +From dffa2a21edeba243ef76b75e0c2081ec15fe95bd Mon Sep 17 00:00:00 2001 +From: SSE4 +Date: Wed, 3 Apr 2019 19:48:12 +0700 +Subject: [PATCH 3/4] 0003 + +--- + lib/spawn-pipe.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/lib/spawn-pipe.c b/lib/spawn-pipe.c +index 3af5167..09e9cad 100644 +--- a/lib/spawn-pipe.c ++++ b/lib/spawn-pipe.c +@@ -213,10 +213,10 @@ create_pipe (const char *progname, + xalloc_die (); + + if (pipe_stdout) +- if (pipe2_safer (ifd, O_BINARY | O_CLOEXEC) < 0) ++ if (pipe2_safer (ifd, O_TEXT | O_CLOEXEC) < 0) + error (EXIT_FAILURE, errno, _("cannot create pipe")); + if (pipe_stdin) +- if (pipe2_safer (ofd, O_BINARY | O_CLOEXEC) < 0) ++ if (pipe2_safer (ofd, O_TEXT | O_CLOEXEC) < 0) + error (EXIT_FAILURE, errno, _("cannot create pipe")); + /* Data flow diagram: + * +-- +2.7.4.windows.1 + diff --git a/recipes/bison/all/patches/0003-3.5.3-msvc-changes.patch b/recipes/bison/all/patches/0003-3.5.3-msvc-changes.patch index 3e04d6ae94ee5..56aeeebbeb7df 100644 --- a/recipes/bison/all/patches/0003-3.5.3-msvc-changes.patch +++ b/recipes/bison/all/patches/0003-3.5.3-msvc-changes.patch @@ -7,11 +7,11 @@ but aren't to avoid a dependency on a already-built flex and bison. #include #include #include /* fileno */ -+#if !defined(_WINDOWS) ++#ifndef _WIN32 #include +#endif #include /* fstat */ -+#if !defined(_WINDOWS) ++#ifndef _WIN32 #include +#endif diff --git a/recipes/bison/all/test_package/CMakeLists.txt b/recipes/bison/all/test_package/CMakeLists.txt index b2e4203587321..569311ba35a62 100644 --- a/recipes/bison/all/test_package/CMakeLists.txt +++ b/recipes/bison/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.0) -project(test_package) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() - -find_package(BISON) +find_package(BISON REQUIRED) set(BISON_VARS BISON_FOUND @@ -19,13 +16,5 @@ foreach(BISON_VAR ${BISON_VARS}) endif() endforeach() -bison_target(Bison_McParser - mc_parser.yy "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp" -) - -add_library(McParser STATIC - "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp" -) -add_executable(${PROJECT_NAME} test_package.cpp) -set_propertY(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +bison_target(McParser mc_parser.yy "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp") +add_library(${PROJECT_NAME} STATIC ${BISON_McParser_OUTPUTS}) diff --git a/recipes/bison/all/test_package/conanfile.py b/recipes/bison/all/test_package/conanfile.py index 82220fffff866..dd177dd578622 100644 --- a/recipes/bison/all/test_package/conanfile.py +++ b/recipes/bison/all/test_package/conanfile.py @@ -1,38 +1,38 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.microsoft import unix_path import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" + win_bash = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def layout(self): + cmake_layout(self) + def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires(self.tested_reference_str) + if self._settings_build.os == "Windows": + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() @property def _mc_parser_source(self): return os.path.join(self.source_folder, "mc_parser.yy") - def build(self): - if not tools.cross_building(self, skip_x64_x86=True): - # verify bison may run - self.run("bison --version", run_environment=True) - # verify yacc may run - self.run("yacc --version", run_environment=True, win_bash=tools.os_info.is_windows) - # verify bison may preprocess something - self.run("bison -d {}".format(self._mc_parser_source), run_environment=True) - - # verify CMake integration - cmake = CMake(self) - cmake.configure() - cmake.build() - def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + self.run("bison --version") + self.run("yacc --version") + self.run(f"bison -d {unix_path(self, self._mc_parser_source)}") diff --git a/recipes/bison/all/test_package/test_package.cpp b/recipes/bison/all/test_package/test_package.cpp deleted file mode 100644 index b00966a007909..0000000000000 --- a/recipes/bison/all/test_package/test_package.cpp +++ /dev/null @@ -1,13 +0,0 @@ -#include - -extern "C" -{ - int yyerror(const char *); -} - -int main() -{ - char error[] = "conan-center-index"; - std::cout << yyerror(error) << std::endl; - return 0; -} diff --git a/recipes/bison/all/test_v1_package/CMakeLists.txt b/recipes/bison/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/bison/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/bison/all/test_v1_package/conanfile.py b/recipes/bison/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..99ccbfcae8665 --- /dev/null +++ b/recipes/bison/all/test_v1_package/conanfile.py @@ -0,0 +1,31 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + test_type = "explicit" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + @property + def _mc_parser_source(self): + return os.path.join(self.source_folder, os.pardir, "test_package", "mc_parser.yy") + + def test(self): + self.run("bison --version") + self.run("yacc --version", win_bash=tools.os_info.is_windows) + self.run(f"bison -d {self._mc_parser_source}") diff --git a/recipes/bison/config.yml b/recipes/bison/config.yml index c06b3140cfec4..7e22e455ae51e 100644 --- a/recipes/bison/config.yml +++ b/recipes/bison/config.yml @@ -1,4 +1,6 @@ versions: + "3.8.2": + folder: all "3.7.6": folder: all "3.7.1": diff --git a/recipes/bitflags/all/conandata.yml b/recipes/bitflags/all/conandata.yml new file mode 100644 index 0000000000000..2abe2034e3c41 --- /dev/null +++ b/recipes/bitflags/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.5.0": + url: "https://github.com/m-peko/bitflags/archive/refs/tags/v1.5.0.tar.gz" + sha256: 1ea19e03e05e8e78faf0126a1a100e591467828bc816224e9cda330b104e69b5 diff --git a/recipes/bitflags/all/conanfile.py b/recipes/bitflags/all/conanfile.py new file mode 100644 index 0000000000000..c9f1d462a3694 --- /dev/null +++ b/recipes/bitflags/all/conanfile.py @@ -0,0 +1,59 @@ +import os + +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.50.0" + + +class BitFlags(ConanFile): + name = "bitflags" + description = "Single-header header-only C++11 / C++14 / C++17 library for easily managing set of auto-generated type-safe flags" + topics = ("bits", "bitflags", "header-only") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/m-peko/bitflags" + license = "MIT" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _minimum_compilers_version(self): + return {"apple-clang": "5", "clang": "5", "gcc": "7", "Visual Studio": "14"} + + @property + def _minimum_cpp_standard(self): + return 11 + + def layout(self): + basic_layout(self) + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + try: + if Version(self.settings.compiler.version) < self._minimum_compilers_version[str(self.settings.compiler)]: + raise ConanInvalidConfiguration(f"{self.ref} requires a compiler that supports C++{self._minimum_cpp_standard}.") + except KeyError: + self.output.warn("Unknown compiler encountered. Assuming it supports C++11.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True, + destination=self.source_folder) + + def package(self): + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "bitflags") + self.cpp_info.set_property("cmake_target_name", "bitflags::bitflags") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/bitflags/all/test_package/CMakeLists.txt b/recipes/bitflags/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..51b69634fef26 --- /dev/null +++ b/recipes/bitflags/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +find_package(bitflags REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE bitflags::bitflags) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/bitflags/all/test_package/conanfile.py b/recipes/bitflags/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e506c322ce801 --- /dev/null +++ b/recipes/bitflags/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + +required_conan_version = ">=1.50.0" + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/bitflags/all/test_package/test_package.cpp b/recipes/bitflags/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..91a9730c23c5a --- /dev/null +++ b/recipes/bitflags/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include "bitflags/bitflags.hpp" +#include +#include + +BEGIN_BITFLAGS(Flags) +FLAG(none) +FLAG(flag_a) +FLAG(flag_b) +FLAG(flag_c) +END_BITFLAGS(Flags) + +DEFINE_FLAG(Flags, none) +DEFINE_FLAG(Flags, flag_a) +DEFINE_FLAG(Flags, flag_b) +DEFINE_FLAG(Flags, flag_c) + +int main() { + std::cout << +Flags::none.bits << " - " << Flags::none.name << '\n'; + std::cout << +Flags::flag_a.bits << " - " << Flags::flag_a.name << '\n'; + std::cout << +Flags::flag_b.bits << " - " << Flags::flag_b.name << '\n'; + std::cout << +Flags::flag_c.bits << " - " << Flags::flag_c.name << '\n'; + + const auto flags = Flags::flag_a | Flags::flag_b; + + assert(flags & Flags::flag_a); + assert(!(flags & Flags::flag_c)); +} diff --git a/recipes/bitflags/all/test_v1_package/CMakeLists.txt b/recipes/bitflags/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..789568c184c15 --- /dev/null +++ b/recipes/bitflags/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(bitflags REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE bitflags::bitflags) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/bitflags/all/test_v1_package/conanfile.py b/recipes/bitflags/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/bitflags/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/bitflags/config.yml b/recipes/bitflags/config.yml new file mode 100644 index 0000000000000..16b5c7979d806 --- /dev/null +++ b/recipes/bitflags/config.yml @@ -0,0 +1,3 @@ +versions: + "1.5.0": + folder: "all" diff --git a/recipes/bitserializer/all/conandata.yml b/recipes/bitserializer/all/conandata.yml index 10234ee527ae7..9b5b2264c84bb 100644 --- a/recipes/bitserializer/all/conandata.yml +++ b/recipes/bitserializer/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.50": + url: "https://bitbucket.com/Pavel_Kisliak/BitSerializer/get/0.50.tar.gz" + sha256: "dc000b6516db60337d5dd56fb1b60e29ce700bd2e6f4e609ca548b84d1f1dcee" "0.44": url: "https://bitbucket.com/Pavel_Kisliak/BitSerializer/get/0.44.tar.gz" sha256: "39ee0b038c9f38a012f96913c9738a68514d2e923431fbd83ddf3f454e02bc6c" diff --git a/recipes/bitserializer/all/conanfile.py b/recipes/bitserializer/all/conanfile.py index aae97523850f3..de0b409d6488a 100644 --- a/recipes/bitserializer/all/conanfile.py +++ b/recipes/bitserializer/all/conanfile.py @@ -1,14 +1,19 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, rmdir, replace_in_file +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class BitserializerConan(ConanFile): name = "bitserializer" - description = "C++ 17 library for serialization to multiple output formats (JSON, XML, YAML)" - topics = ("serialization", "json", "xml") + description = "C++ 17 library for serialization to multiple output formats (JSON, XML, YAML, CSV)" + topics = ("serialization", "json", "xml", "yaml", "csv") url = "https://github.com/conan-io/conan-center-index" homepage = "https://bitbucket.org/Pavel_Kisliak/bitserializer" license = "MIT" @@ -18,98 +23,166 @@ class BitserializerConan(ConanFile): "with_cpprestsdk": [True, False], "with_rapidjson": [True, False], "with_pugixml": [True, False], + "with_rapidyaml": [True, False], + "with_csv": [True, False], } default_options = { "with_cpprestsdk": False, "with_rapidjson": False, "with_pugixml": False, + "with_rapidyaml": False, + "with_csv": False, } no_copy_source = True @property - def _supported_compilers(self): - if tools.Version(self.version) >= "0.44": - return { - "gcc": "8", - "clang": "8", - "Visual Studio": "15", - "apple-clang": "12", - } + def _min_cppstd(self): + return "17" + @property + def _compilers_minimum_version(self): return { "gcc": "8", - "clang": "7", + "clang": "7" if Version(self.version) < "0.44" else "8", "Visual Studio": "15", + "msvc": "191", "apple-clang": "12", } @property - def _source_subfolder(self): - return "source_subfolder" + def _is_header_only(self): + # All components of library are header-only except csv-archive + return not self.options.with_csv + + def _patch_sources(self): + # Remove 'ryml' subdirectory from #include + replace_in_file(self, os.path.join(self.source_folder, "include/bitserializer/rapidyaml_archive.h"), "#include :BitSerializer::cpprestjson-archive> $<$:BitSerializer::rapidjson-archive> - $<$:BitSerializer::pugixml-archive>) + $<$:BitSerializer::pugixml-archive> + $<$:BitSerializer::rapidyaml-archive> + $<$:BitSerializer::csv-archive> +) target_compile_definitions(${PROJECT_NAME} PRIVATE $<$:"WITH_CPPRESTSDK"> $<$:"WITH_RAPIDJSON"> - $<$:"WITH_PUGIXML">) + $<$:"WITH_PUGIXML"> + $<$:"WITH_RAPIDYAML"> + $<$:"WITH_CSV"> +) diff --git a/recipes/bitserializer/all/test_package/conanfile.py b/recipes/bitserializer/all/test_package/conanfile.py index 2aef261cc5712..b681a2801a2f5 100644 --- a/recipes/bitserializer/all/test_package/conanfile.py +++ b/recipes/bitserializer/all/test_package/conanfile.py @@ -1,20 +1,36 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + bitserializerOptions = self.dependencies[self.tested_reference_str].options + tc.variables["WITH_CPPRESTSDK"] = bitserializerOptions.with_cpprestsdk + tc.variables["WITH_RAPIDJSON"] = bitserializerOptions.with_rapidjson + tc.variables["WITH_PUGIXML"] = bitserializerOptions.with_pugixml + tc.variables["WITH_RAPIDYAML"] = bitserializerOptions.with_rapidyaml + tc.variables["WITH_CSV"] = bitserializerOptions.with_csv + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["WITH_CPPRESTSDK"] = self.options["bitserializer"].with_cpprestsdk - cmake.definitions["WITH_RAPIDJSON"] = self.options["bitserializer"].with_rapidjson - cmake.definitions["WITH_PUGIXML"] = self.options["bitserializer"].with_pugixml cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/bitserializer/all/test_package/test_package.cpp b/recipes/bitserializer/all/test_package/test_package.cpp index 643c308b932d2..aba11c808ba19 100644 --- a/recipes/bitserializer/all/test_package/test_package.cpp +++ b/recipes/bitserializer/all/test_package/test_package.cpp @@ -12,6 +12,12 @@ #ifdef WITH_PUGIXML #include #endif +#ifdef WITH_RAPIDYAML +#include +#endif +#ifdef WITH_CSV +#include +#endif #include #include @@ -41,7 +47,7 @@ void TestArchive(const std::string& message) BitSerializer::SerializationOptions serializationOptions; serializationOptions.streamOptions.writeBom = false; - CTest testObj(message); + CTest testObj[1] = { message }; std::stringstream outputStream; BitSerializer::SaveObject(testObj, outputStream, serializationOptions); std::cout << outputStream.str() << std::endl; @@ -66,4 +72,10 @@ int main() { #ifdef WITH_PUGIXML TestArchive("Implementation based on pugixml"); #endif +#ifdef WITH_RAPIDYAML + TestArchive("Implementation based on RapidYaml"); +#endif +#ifdef WITH_CSV + TestArchive("CSV archive (built-in implementation)"); +#endif } diff --git a/recipes/bitserializer/all/test_v1_package/CMakeLists.txt b/recipes/bitserializer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/bitserializer/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/bitserializer/all/test_v1_package/conanfile.py b/recipes/bitserializer/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..36f5974e9b2f1 --- /dev/null +++ b/recipes/bitserializer/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["WITH_CPPRESTSDK"] = self.options["bitserializer"].with_cpprestsdk + cmake.definitions["WITH_RAPIDJSON"] = self.options["bitserializer"].with_rapidjson + cmake.definitions["WITH_PUGIXML"] = self.options["bitserializer"].with_pugixml + cmake.definitions["WITH_RAPIDYAML"] = self.options["bitserializer"].with_rapidyaml + cmake.definitions["WITH_CSV"] = self.options["bitserializer"].with_csv + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/bitserializer/config.yml b/recipes/bitserializer/config.yml index 3b57b2ed72ef1..31b1805864308 100644 --- a/recipes/bitserializer/config.yml +++ b/recipes/bitserializer/config.yml @@ -1,4 +1,6 @@ versions: + "0.50": + folder: "all" "0.44": folder: "all" "0.10": diff --git a/recipes/bitsery/all/conandata.yml b/recipes/bitsery/all/conandata.yml index 81be1b1c7d44e..6d53e1633d5bf 100644 --- a/recipes/bitsery/all/conandata.yml +++ b/recipes/bitsery/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.2.3": + url: "https://github.com/fraillt/bitsery/archive/v5.2.3.tar.gz" + sha256: "896d82ab4ccea9899ff2098aa69ad6d25e524ee1d4c747ce3232d0afe3cd05a5" "5.2.2": url: "https://github.com/fraillt/bitsery/archive/v5.2.2.tar.gz" sha256: "5e932c463f16db15228b2546632a5851a502c68e605a1e313b0f1a35c061e4ae" diff --git a/recipes/bitsery/config.yml b/recipes/bitsery/config.yml index 50e396f35efb2..07e67c2710fe5 100644 --- a/recipes/bitsery/config.yml +++ b/recipes/bitsery/config.yml @@ -1,4 +1,6 @@ versions: + "5.2.3": + folder: all "5.2.2": folder: all "5.2.1": diff --git a/recipes/blend2d/all/CMakeLists.txt b/recipes/blend2d/all/CMakeLists.txt deleted file mode 100644 index 0839374b3b5f4..0000000000000 --- a/recipes/blend2d/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper LANGUAGES CXX) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -set(CMAKE_CXX_STANDARD 11) - -add_subdirectory(src) diff --git a/recipes/blend2d/all/conanfile.py b/recipes/blend2d/all/conanfile.py index 215edc5b728db..e786098393dd3 100644 --- a/recipes/blend2d/all/conanfile.py +++ b/recipes/blend2d/all/conanfile.py @@ -1,15 +1,12 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd, valid_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import check_min_vs import os -from conan import ConanFile -from conan import tools -from conan.tools.build import check_min_cppstd -from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout -from conan.tools.scm import Version -from conan.tools.files import apply_conandata_patches -from conan.tools.microsoft import is_msvc -from conan.errors import ConanInvalidConfiguration +required_conan_version = ">=1.52.0" -required_conan_version = ">=1.50.0" class Blend2dConan(ConanFile): name = "blend2d" @@ -29,9 +26,7 @@ class Blend2dConan(ConanFile): } def export_sources(self): - tools.files.copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - tools.files.copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,37 +34,41 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass def layout(self): - cmake_layout(self, src_folder='src') + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("asmjit/cci.20220210") + self.requires("asmjit/cci.20221111") def validate(self): - if self.info.settings.compiler.cppstd: + if self.info.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) # In Visual Studio < 16, there are compilation error. patch is already provided. # https://github.com/blend2d/blend2d/commit/63db360c7eb2c1c3ca9cd92a867dbb23dc95ca7d - if is_msvc(self) and Version(self.settings.compiler.version) < "16": - raise ConanInvalidConfiguration("This recipe does not support this compiler version") + check_min_vs(self, 192) def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): - toolchain = CMakeToolchain(self) - toolchain.variables["BUILD_TESTING"] = False - toolchain.variables["BLEND2D_TEST"] = False - toolchain.variables["BLEND2D_EMBED"] = False - toolchain.variables["BLEND2D_STATIC"] = not self.options.shared - toolchain.variables["BLEND2D_NO_STDCXX"] = False + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["BLEND2D_TEST"] = False + tc.variables["BLEND2D_EMBED"] = False + tc.variables["BLEND2D_STATIC"] = not self.options.shared + tc.variables["BLEND2D_NO_STDCXX"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if not valid_min_cppstd(self, 11): + tc.variables["CMAKE_CXX_STANDARD"] = 11 if not self.options.shared: - toolchain.variables["CMAKE_C_FLAGS"] = "-DBL_STATIC" - toolchain.variables["CMAKE_CXX_FLAGS"] = "-DBL_STATIC" - toolchain.generate() + tc.preprocessor_definitions["BL_STATIC"] = "1" + tc.generate() deps = CMakeDeps(self) deps.generate() @@ -77,20 +76,20 @@ def generate(self): def build(self): apply_conandata_patches(self) cmake = CMake(self) - cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.configure() cmake.build() def package(self): - tools.files.copy(self, "LICENSE.md", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE.md", self.source_folder, os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() - tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "blend2d") + self.cpp_info.set_property("cmake_target_name", "blend2d::blend2d") self.cpp_info.libs = ["blend2d"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["pthread", "rt",]) if not self.options.shared: self.cpp_info.defines.append("BL_STATIC") - - self.cpp_info.requires.append("asmjit::asmjit") diff --git a/recipes/blend2d/all/test_package/CMakeLists.txt b/recipes/blend2d/all/test_package/CMakeLists.txt index 345822c0de7cb..7ac05ac9286e7 100644 --- a/recipes/blend2d/all/test_package/CMakeLists.txt +++ b/recipes/blend2d/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) find_package(blend2d CONFIG REQUIRED) diff --git a/recipes/blend2d/all/test_package/conanfile.py b/recipes/blend2d/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/blend2d/all/test_package/conanfile.py +++ b/recipes/blend2d/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/blend2d/all/test_v1_package/CMakeLists.txt b/recipes/blend2d/all/test_v1_package/CMakeLists.txt index e215fae6aabbd..0d20897301b68 100644 --- a/recipes/blend2d/all/test_v1_package/CMakeLists.txt +++ b/recipes/blend2d/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(blend2d CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE blend2d::blend2d) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/blend2d/all/test_v1_package/conanfile.py b/recipes/blend2d/all/test_v1_package/conanfile.py index 1dab42df853ca..38f4483872d47 100644 --- a/recipes/blend2d/all/test_v1_package/conanfile.py +++ b/recipes/blend2d/all/test_v1_package/conanfile.py @@ -1,7 +1,5 @@ -# pylint: skip-file -import os - from conans import ConanFile, CMake, tools +import os class TestPackageConan(ConanFile): diff --git a/recipes/boost-ext-ut/all/conanfile.py b/recipes/boost-ext-ut/all/conanfile.py index df8a7ffd45545..bce6579a06de7 100644 --- a/recipes/boost-ext-ut/all/conanfile.py +++ b/recipes/boost-ext-ut/all/conanfile.py @@ -3,12 +3,12 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.microsoft import check_min_vs, is_msvc from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class UTConan(ConanFile): @@ -37,8 +37,7 @@ def _minimum_compilers_version(self): } def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, patch["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if Version(self.version) <= "1.1.8": @@ -47,13 +46,13 @@ def config_options(self): self.options.disable_module = True def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._minimum_cpp_standard) if Version(self.version) <= "1.1.8" and is_msvc(self): - raise ConanInvalidConfiguration(f"{self.name} version 1.1.8 may not be built with MSVC. " + raise ConanInvalidConfiguration(f"{self.ref} may not be built with MSVC. " "Please use at least version 1.1.9 with MSVC.") if is_msvc(self): @@ -64,12 +63,12 @@ def validate(self): min_version = self._minimum_compilers_version.get( str(self.settings.compiler)) if not min_version: - self.output.warn(f"{self.name} recipe lacks information about the {self.settings.compiler} " + self.output.warn(f"{self.ref} recipe lacks information about the {self.settings.compiler} " "compiler support.") else: if Version(self.settings.compiler.version) < min_version: raise ConanInvalidConfiguration( - f"{self.name} requires C++{self._minimum_cpp_standard} support. " + f"{self.ref} requires C++{self._minimum_cpp_standard} support. " f"The current compiler {self.settings.compiler} {self.settings.compiler.version} does not support it.") def source(self): @@ -102,17 +101,19 @@ def package_id(self): self.info.clear() def package_info(self): + newer_than_1_1_8 = Version(self.version) > "1.1.8" + namespace = "Boost" if newer_than_1_1_8 else "boost" self.cpp_info.set_property("cmake_file_name", "ut") - self.cpp_info.set_property("cmake_target_name", "boost::ut") + self.cpp_info.set_property("cmake_target_name", f"{namespace}::ut") - self.cpp_info.names["cmake_find_package"] = "boost" - self.cpp_info.names["cmake_find_package_multi"] = "boost" + self.cpp_info.names["cmake_find_package"] = namespace + self.cpp_info.names["cmake_find_package_multi"] = namespace self.cpp_info.filenames["cmake_find_package"] = "ut" self.cpp_info.filenames["cmake_find_package_multi"] = "ut" self.cpp_info.components["ut"].names["cmake_find_package"] = "ut" self.cpp_info.components["ut"].names["cmake_find_package_multi"] = "ut" - if Version(self.version) > "1.1.8": + if newer_than_1_1_8: self.cpp_info.components["ut"].includedirs = [os.path.join("include", "ut-" + self.version, "include")] if self.options.get_safe("disable_module"): diff --git a/recipes/boost-ext-ut/all/test_package/CMakeLists.txt b/recipes/boost-ext-ut/all/test_package/CMakeLists.txt index 99ad6ec453970..1f234990a3bc2 100644 --- a/recipes/boost-ext-ut/all/test_package/CMakeLists.txt +++ b/recipes/boost-ext-ut/all/test_package/CMakeLists.txt @@ -1,11 +1,13 @@ -cmake_minimum_required(VERSION 3.16) -project(test_package) - -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED yes) -set(CMAKE_CXX_EXTENSIONS no) +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) find_package(ut REQUIRED CONFIG) +set(namespace Boost) +if(ut_VERSION VERSION_LESS "1.1.9") + set(namespace boost) +endif() + add_executable(test_package test_package.cpp) -target_link_libraries(test_package PRIVATE boost::ut) +target_link_libraries(test_package PRIVATE "${namespace}::ut") +target_compile_features(test_package PRIVATE cxx_std_20) diff --git a/recipes/boost-ext-ut/all/test_package/conanfile.py b/recipes/boost-ext-ut/all/test_package/conanfile.py index 87a7297528bf3..cb68885270b30 100644 --- a/recipes/boost-ext-ut/all/test_package/conanfile.py +++ b/recipes/boost-ext-ut/all/test_package/conanfile.py @@ -8,6 +8,7 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/boost-ext-ut/all/test_v1_package/CMakeLists.txt b/recipes/boost-ext-ut/all/test_v1_package/CMakeLists.txt index 05c457be73ade..b3e2caed93a69 100644 --- a/recipes/boost-ext-ut/all/test_v1_package/CMakeLists.txt +++ b/recipes/boost-ext-ut/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,16 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package) - -set(CMAKE_CXX_STANDARD 20) -set(CMAKE_CXX_STANDARD_REQUIRED yes) -set(CMAKE_CXX_EXTENSIONS no) +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) find_package(ut REQUIRED CONFIG) +set(namespace Boost) +if(ut_VERSION VERSION_LESS "1.1.9") + set(namespace boost) +endif() + add_executable(test_package ../test_package/test_package.cpp) -target_link_libraries(test_package boost::ut) +target_link_libraries(test_package PRIVATE "${namespace}::ut") +target_compile_features(test_package PRIVATE cxx_std_20) diff --git a/recipes/boost-leaf/all/conandata.yml b/recipes/boost-leaf/all/conandata.yml new file mode 100644 index 0000000000000..42c2ccab24961 --- /dev/null +++ b/recipes/boost-leaf/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.81.0": + url: "https://github.com/boostorg/leaf/archive/refs/tags/1.81.0.tar.gz" + sha256: "6a2bfa8727891e844f1f95c9c68af192f4c5f53b1707acce54290932118b48c0" diff --git a/recipes/boost-leaf/all/conanfile.py b/recipes/boost-leaf/all/conanfile.py new file mode 100644 index 0000000000000..b119ea7a5c58a --- /dev/null +++ b/recipes/boost-leaf/all/conanfile.py @@ -0,0 +1,94 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration +import os + + +required_conan_version = ">=1.50.0" + + +class BoostLEAFConan(ConanFile): + name = "boost-leaf" + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/boostorg/leaf" + description = ("Lightweight Error Augmentation Framework") + topics = ("multi-platform", "multi-threading", "cpp11", "error-handling", + "header-only", "low-latency", "no-dependencies", "single-header") + settings = "os", "compiler", "arch", "build_type" + no_copy_source = True + deprecated = True + + def configure(self): + raise ConanInvalidConfiguration(f"{self.ref} is deprecated in favor of Boost >=1.75.0") + + def package_id(self): + self.info.clear() + + @property + def _min_cppstd(self): + return "11" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "4.8", + "Visual Studio": "17", + "msvc": "141", + "clang": "3.9", + "apple-clang": "10.0.0" + } + + def requirements(self): + pass + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def lazy_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + compiler = str(self.settings.compiler) + version = str(self.settings.compiler.version) + minimum_version = self._compilers_minimum_version.get(compiler, False) + + if minimum_version and lazy_lt_semver(version, minimum_version): + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler ({compiler}-{version}) does not support") + + def layout(self): + basic_layout(self) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, "LICENSE_1_0.txt", dst=os.path.join( + self.package_folder, "licenses"), src=self.source_folder) + copy(self, "*.h", dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, "*.hpp", dst=os.path.join(self.package_folder, + "include"), src=os.path.join(self.source_folder, "include")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "boost-leaf") + self.cpp_info.set_property("cmake_target_name", "boost::leaf") + + self.cpp_info.names["cmake_find_package"] = "boost" + self.cpp_info.names["cmake_find_package_multi"] = "boost" + self.cpp_info.filenames["cmake_find_package"] = "boost-leaf" + self.cpp_info.filenames["cmake_find_package_multi"] = "boost-leaf" + self.cpp_info.components["leaf"].names["cmake_find_package"] = "leaf" + self.cpp_info.components["leaf"].names["cmake_find_package_multi"] = "leaf" + + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/boost-leaf/all/test_package/CMakeLists.txt b/recipes/boost-leaf/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..ca3f81cb32f1b --- /dev/null +++ b/recipes/boost-leaf/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(boost-leaf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} main.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS OFF) +target_link_libraries(${PROJECT_NAME} PRIVATE boost::leaf) diff --git a/recipes/boost-leaf/all/test_package/conanfile.py b/recipes/boost-leaf/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8a5bb47f50c4c --- /dev/null +++ b/recipes/boost-leaf/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/boost-leaf/all/test_package/main.cpp b/recipes/boost-leaf/all/test_package/main.cpp new file mode 100644 index 0000000000000..b6cf03bce1653 --- /dev/null +++ b/recipes/boost-leaf/all/test_package/main.cpp @@ -0,0 +1,64 @@ +#include +#include + +using namespace boost; + +enum custom_error_t +{ + err1, + err2, + err3, +}; + +leaf::result f1() +{ + return 5; +} + +leaf::result f2() +{ + return 15; +} + +leaf::result g(int a, int b) +{ + int sum = a + b; + if (sum == 20) + { + return leaf::new_error(custom_error_t::err2); + } + return sum; +} + +int main() +{ + leaf::result r = leaf::try_handle_some( + []() -> leaf::result + { + BOOST_LEAF_AUTO(v1, f1()); + BOOST_LEAF_AUTO(v2, f2()); + + return g(v1, v2); + }, + [](leaf::match) -> leaf::result + { + exit(1); + return -1; + }, + [](custom_error_t e) -> leaf::result + { + printf("Error value [%d] handled\n", static_cast(e)); + return 17; + }); + + if (r) + { + printf("value of r = %d\n", r.value()); + } + else + { + printf("r contains an error!\n"); + } + + return 0; +} diff --git a/recipes/boost-leaf/all/test_v1_package/CMakeLists.txt b/recipes/boost-leaf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..3b99781525c3c --- /dev/null +++ b/recipes/boost-leaf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(boost-leaf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/main.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS OFF) +target_link_libraries(${PROJECT_NAME} PRIVATE boost::leaf) diff --git a/recipes/boost-leaf/all/test_v1_package/conanfile.py b/recipes/boost-leaf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..25bed518a9fa8 --- /dev/null +++ b/recipes/boost-leaf/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class LibhalTestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = ("cmake", "cmake_find_package_multi") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join(self.build_folder, "bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/boost-leaf/config.yml b/recipes/boost-leaf/config.yml new file mode 100644 index 0000000000000..80eea4560f825 --- /dev/null +++ b/recipes/boost-leaf/config.yml @@ -0,0 +1,3 @@ +versions: + "1.81.0": + folder: "all" diff --git a/recipes/boost/all/conandata.yml b/recipes/boost/all/conandata.yml index 3798685661eda..ce580a269e8fd 100644 --- a/recipes/boost/all/conandata.yml +++ b/recipes/boost/all/conandata.yml @@ -1,244 +1,362 @@ sources: - 1.70.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.bz2", - ] - sha256: "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778" - 1.71.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2", - ] - sha256: "d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee" - 1.72.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2", - ] - sha256: "59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722" - 1.73.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.73.0/boost_1_73_0.tar.bz2", - ] - sha256: "4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402" - 1.74.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.74.0/boost_1_74_0.tar.bz2" - ] - sha256: "83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1" - 1.75.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.75.0/boost_1_75_0.tar.bz2" - ] - sha256: "953db31e016db7bb207f11432bef7df100516eeb746843fa0486a222e3fd49cb" - 1.76.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2" - ] - sha256: "f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41" - 1.77.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.77.0/boost_1_77_0.tar.bz2" - ] - sha256: "fc9f85fc030e233142908241af7a846e60630aa7388de9a5fafb1f3a26840854" - 1.78.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.78.0/boost_1_78_0.tar.bz2" - ] - sha256: "8681f175d4bdb26c52222665793eef08490d7758529330f98d3b29dd0735bccc" - 1.79.0: - url: [ - "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2", - "https://sourceforge.net/projects/boost/files/boost/1.79.0/boost_1_79_0.tar.bz2" - ] + "1.81.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.81.0/source/boost_1_81_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.81.0/boost_1_81_0.tar.bz2" + sha256: "71feeed900fbccca04a3b4f2f84a7c217186f28a940ed8b7ed4725986baf99fa" + "1.80.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.80.0/source/boost_1_80_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.80.0/boost_1_80_0.tar.bz2" + sha256: "1e19565d82e43bc59209a168f5ac899d3ba471d55c7610c677d4ccf2c9c500c0" + "1.79.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.79.0/source/boost_1_79_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.79.0/boost_1_79_0.tar.bz2" sha256: "475d589d51a7f8b3ba2ba4eda022b170e562ca3b760ee922c146b6c65856ef39" + "1.78.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.78.0/source/boost_1_78_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.78.0/boost_1_78_0.tar.bz2" + sha256: "8681f175d4bdb26c52222665793eef08490d7758529330f98d3b29dd0735bccc" + "1.77.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.77.0/source/boost_1_77_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.77.0/boost_1_77_0.tar.bz2" + sha256: "fc9f85fc030e233142908241af7a846e60630aa7388de9a5fafb1f3a26840854" + "1.76.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.76.0/source/boost_1_76_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.76.0/boost_1_76_0.tar.bz2" + sha256: "f0397ba6e982c4450f27bf32a2a83292aba035b827a5623a14636ea583318c41" + "1.75.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.75.0/source/boost_1_75_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.75.0/boost_1_75_0.tar.bz2" + sha256: "953db31e016db7bb207f11432bef7df100516eeb746843fa0486a222e3fd49cb" + "1.74.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.74.0/source/boost_1_74_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.74.0/boost_1_74_0.tar.bz2" + sha256: "83bfc1507731a0906e387fc28b7ef5417d591429e51e788417fe9ff025e116b1" + "1.73.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.73.0/source/boost_1_73_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.73.0/boost_1_73_0.tar.bz2" + sha256: "4eb3b8d442b426dc35346235c8733b5ae35ba431690e38c6a8263dce9fcbb402" + "1.72.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.72.0/source/boost_1_72_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.72.0/boost_1_72_0.tar.bz2" + sha256: "59c9b274bc451cf91a9ba1dd2c7fdcaf5d60b1b3aa83f2c9fa143417cc660722" + "1.71.0": + url: "https://boostorg.jfrog.io/artifactory/main/release/1.71.0/source/boost_1_71_0.tar.bz2" + sha256: "d73a8da01e8bf8c7eda40b4c84915071a8c8a0df4a6734537ddde4a8580524ee" + "1.70.0": + url: + - "https://boostorg.jfrog.io/artifactory/main/release/1.70.0/source/boost_1_70_0.tar.bz2" + - "https://sourceforge.net/projects/boost/files/boost/1.70.0/boost_1_70_0.tar.bz2" + sha256: "430ae8354789de4fd19ee52f3b1f739e1fba576f0aded0897c3c2bc00fb38778" patches: - 1.70.0: - - patch_file: "patches/0001-beast-fix-moved-from-executor.patch" - base_path: "source_subfolder" - - patch_file: "patches/bcp_namespace_issues_1_70.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" - base_path: "source_subfolder" - - patch_file: "patches/python_base_prefix.patch" - base_path: "source_subfolder" - - patch_file: "patches/solaris_pthread_data.patch" - base_path: "source_subfolder" + "1.81.0": + - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.81.0-locale-fail-on-missing-backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + "1.80.0": + - patch_file: "patches/1.80.0-locale-fail-on-missing-backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.80.0-0001-filesystem-win-fix-dir-it-net-share.patch" + patch_description: "Directory iterators may fail to construct for a network share on Windows prior to 10" + patch_type: "official" + patch_source: "https://github.com/boostorg/filesystem/issues/245" + - patch_file: "patches/1.80.0-0002-filesystem-fix-weakly-canonical-long-path.patch" + patch_description: 'On Windows, weakly_canonical fails to process paths that start with the "\\?\" prefix' + patch_type: "official" + patch_source: "https://github.com/boostorg/filesystem/issues/247" + - patch_file: "patches/1.80.0-0003-unordered-valid-after-move.patch" + patch_description: "Containers are not in a valid state after moving" + patch_type: "official" + patch_source: "https://github.com/boostorg/unordered/issues/139" + - patch_file: "patches/1.80.0-0004-filesystem-posix-fix-no-at-apis-missing-include.patch" + patch_description: "On POSIX systems that don't support *at APIs, compilation fails due to a missing include" + patch_type: "official" + patch_source: "https://github.com/boostorg/filesystem/issues/250" + "1.79.0": - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-fiber-mingw.patch" + patch_description: "fix layout=versioned for clang@Macos + mingw@Windows" + patch_type: "conan" + - patch_file: "patches/1.79.0-0001-json-array-erase-relocate.patch" + patch_description: "json::array::erase(it) seg fault on linux" + patch_type: "official" + patch_source: "https://github.com/boostorg/json/issues/692" + - patch_file: "patches/1.79.0-smart_ptr_cw_ppc_msync.patch" + patch_description: "Use msync for PowerPC architectures" + patch_type: "portability" + - patch_file: "patches/1.79.0-geometry_no_rtti.patch" + patch_description: "Fix access specifier preventing use of experimental iterators. Allow more granular control over enabled experimental features." + patch_type: "portability" + patch_source: "https://github.com/boostorg/geometry/discussions/1041" + "1.78.0": + - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-fiber-mingw.patch" + patch_description: "fix layout=versioned for clang@Macos + mingw@Windows" + patch_type: "conan" + - patch_file: "patches/1.78.0-b2-fix-install.patch" + patch_description: "Don't skip install targets if there's no in ureqs" + patch_type: "official" + patch_source: "https://github.com/boostorg/build/pull/113" + "1.77.0": + - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + - patch_file: "patches/boost_1_77_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-fiber-mingw.patch" + patch_description: "fix layout=versioned for clang@Macos + mingw@Windows" + patch_type: "conan" + - patch_file: "patches/1.77.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.76.0": + - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-contract-no-system.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.76.0-0001-fix-include-inside-boost-namespace.patch" + patch_description: "Fix #include inside boost namespace" + patch_type: "bugfix" + patch_source: "https://github.com/boostorg/math/pull/670" + - patch_file: "patches/1.77.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.75.0": + - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/python_base_prefix_since_1_74.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + - patch_file: "patches/boost_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.77.0-type_erasure-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.74.0": + - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/python_base_prefix_since_1_74.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" + - patch_file: "patches/boost_mpi_check.patch" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-locale-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.70.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.71.0: - - patch_file: "patches/bcp_namespace_issues_1_71.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.73.0": - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/python_base_prefix.patch" - base_path: "source_subfolder" - - patch_file: "patches/solaris_pthread_data.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-contract-no-system.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.72.0: + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.72.0": - patch_file: "patches/bcp_namespace_issues_1_72.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/python_base_prefix.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/solaris_pthread_data.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/0001-revert-cease-dependence-on-range.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_log_filesystem_no_deprecated_1_72.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.73.0: + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.71.0": + - patch_file: "patches/bcp_namespace_issues_1_71.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/python_base_prefix.patch" - base_path: "source_subfolder" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/solaris_pthread_data.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-contract-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.74.0: - - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch" - base_path: "source_subfolder" - - patch_file: "patches/python_base_prefix_since_1_74.patch" - base_path: "source_subfolder" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" + "1.70.0": + - patch_file: "patches/0001-beast-fix-moved-from-executor.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/bcp_namespace_issues_1_70.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/boost_core_qnx_cxx_provide___cxa_get_globals.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/python_base_prefix.patch" + patch_description: "" + patch_type: "conan" + - patch_file: "patches/solaris_pthread_data.patch" + patch_description: "" + patch_type: "conan" - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when there is no iconv backend" + patch_type: "conan" - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" + patch_description: "Fails the build when mpi is not configured" + patch_type: "conan" + - patch_file: "patches/1.69.0-contract-no-system.patch" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-random-no-system.patch" - base_path: "source_subfolder" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" - patch_file: "patches/1.69.0-type_erasure-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.75.0: - - patch_file: "patches/boost_build_qcc_fix_debug_build_parameter_since_1_74.patch" - base_path: "source_subfolder" - - patch_file: "patches/python_base_prefix_since_1_74.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-type_erasure-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.75.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.76.0: - - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-type_erasure-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.77.0: - - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_1_77_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-type_erasure-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-fiber-mingw.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-boost_build-with-newer-b2.patch" - base_path: "source_subfolder" - 1.78.0: - - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_1_77_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-type_erasure-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-fiber-mingw.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.78.0-b2-fix-install.patch" - base_path: "source_subfolder" - 1.79.0: - - patch_file: "patches/boost_locale_fail_on_missing_backend.patch" - base_path: "source_subfolder" - - patch_file: "patches/boost_1_77_mpi_check.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.69.0-locale-no-system.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.77.0-fiber-mingw.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.79.0-0001-json-array-erase-relocate.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.79.0-smart_ptr_cw_ppc_msync.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.79.0-geometry_no_rtti.patch" - base_path: "source_subfolder" - patch_type: "portability" - url: "https://github.com/boostorg/geometry/commit/b354162798749b3aaa539755e7b9be49d2b9a9c4.patch" - patch_source: "https://github.com/boostorg/geometry/discussions/1041" + patch_description: "This library links to boost_system, even though that library is header-only" + patch_type: "conan" + - patch_file: "patches/1.70.0-boost_build-with-newer-b2.patch" + patch_description: "Bump build_requires of 'b2' to '4.7.1' (was '4.5.0')" + patch_type: "conan" diff --git a/recipes/boost/all/conanfile.py b/recipes/boost/all/conanfile.py index 0342414637931..d5a08f3afd955 100644 --- a/recipes/boost/all/conanfile.py +++ b/recipes/boost/all/conanfile.py @@ -1,26 +1,27 @@ -from conan.tools.apple import is_apple_os -from conan.tools.build import build_jobs, check_min_cppstd, cross_building -from conan.tools.files import apply_conandata_patches, chdir, get, mkdir, rename, replace_in_file, rm, rmdir, save -from conan.tools.microsoft import msvc_runtime_flag from conan import ConanFile from conan.errors import ConanException, ConanInvalidConfiguration -from conans import tools +from conan.tools.apple import is_apple_os, to_apple_arch, XCRun +from conan.tools.build import build_jobs, check_min_cppstd, cross_building, valid_min_cppstd +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, chdir, collect_libs, copy, export_conandata_patches, + get, mkdir, rename, replace_in_file, rm, rmdir, save +) +from conan.tools.gnu import AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, MSBuildToolchain, msvc_runtime_flag, VCVars from conan.tools.scm import Version import glob +from io import StringIO import os import re -import sys import shlex import shutil +import sys import yaml -try: - from cStringIO import StringIO -except ImportError: - from io import StringIO - -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" # When adding (or removing) an option, also add this option to the list in @@ -56,36 +57,36 @@ "thread", "timer", "type_erasure", + "url", "wave", ) class BoostConan(ConanFile): name = "boost" - settings = "os", "arch", "compiler", "build_type" description = "Boost provides free peer-reviewed portable C++ source libraries" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.boost.org" license = "BSL-1.0" topics = ("libraries", "cpp") - _options = None - + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], + "fPIC": [True, False], "header_only": [True, False], "error_code_header_only": [True, False], "system_no_deprecated": [True, False], "asio_no_deprecated": [True, False], "filesystem_no_deprecated": [True, False], + "filesystem_use_std_fs": [True, False], "filesystem_version": [None, "3", "4"], - "fPIC": [True, False], "layout": ["system", "versioned", "tagged", "b2-default"], "magic_autolink": [True, False], # enables BOOST_ALL_NO_LIB "diagnostic_definitions": [True, False], # enables BOOST_LIB_DIAGNOSTIC - "python_executable": "ANY", # system default python installation is used, if None - "python_version": "ANY", # major.minor; computed automatically, if None - "namespace": "ANY", # custom boost namespace for bcp, e.g. myboost + "python_executable": [None, "ANY"], # system default python installation is used, if None + "python_version": [None, "ANY"], # major.minor; computed automatically, if None + "namespace": ["ANY"], # custom boost namespace for bcp, e.g. myboost "namespace_alias": [True, False], # enable namespace alias for bcp, boost=myboost "multithreading": [True, False], # enables multithreading support "numa": [True, False], @@ -96,33 +97,34 @@ class BoostConan(ConanFile): "segmented_stacks": [True, False], "debug_level": list(range(0, 14)), "pch": [True, False], - "extra_b2_flags": "ANY", # custom b2 flags + "extra_b2_flags": [None, "ANY"], # custom b2 flags "i18n_backend": ["iconv", "icu", None, "deprecated"], "i18n_backend_iconv": ["libc", "libiconv", "off"], "i18n_backend_icu": [True, False], "visibility": ["global", "protected", "hidden"], - "addr2line_location": "ANY", + "addr2line_location": ["ANY"], "with_stacktrace_backtrace": [True, False], - "buildid": "ANY", - "python_buildid": "ANY", + "buildid": [None, "ANY"], + "python_buildid": [None, "ANY"], "system_use_utf8": [True, False], } options.update({f"without_{_name}": [True, False] for _name in CONFIGURE_OPTIONS}) default_options = { "shared": False, + "fPIC": True, "header_only": False, "error_code_header_only": False, "system_no_deprecated": False, "asio_no_deprecated": False, "filesystem_no_deprecated": False, + "filesystem_use_std_fs": False, "filesystem_version": None, - "fPIC": True, "layout": "system", "magic_autolink": False, "diagnostic_definitions": False, - "python_executable": "None", - "python_version": "None", + "python_executable": None, + "python_version": None, "namespace": "boost", "namespace_alias": False, "multithreading": True, @@ -134,7 +136,7 @@ class BoostConan(ConanFile): "segmented_stacks": False, "debug_level": 0, "pch": True, - "extra_b2_flags": "None", + "extra_b2_flags": None, "i18n_backend": "deprecated", "i18n_backend_iconv": "libc", "i18n_backend_icu": False, @@ -152,12 +154,11 @@ class BoostConan(ConanFile): no_copy_source = True _cached_dependencies = None - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) - def export(self): - self.copy(self._dependency_filename, src="dependencies", dst="dependencies") + copy(self, f"dependencies/{self._dependency_filename}", src=self.recipe_folder, dst=self.export_folder) + + def export_sources(self): + export_conandata_patches(self) @property def _min_compiler_version_default_cxx11(self): @@ -169,6 +170,7 @@ def _min_compiler_version_default_cxx11(self): "gcc": 6, "clang": 6, "Visual Studio": 14, # guess + "msvc": 190, # guess }.get(str(self.settings.compiler)) @property @@ -178,6 +180,7 @@ def _min_compiler_version_nowide(self): "gcc": 5, "clang": 5, "Visual Studio": 14, # guess + "msvc": 190, # guess }.get(str(self.settings.compiler)) @property @@ -220,26 +223,18 @@ def _all_super_modules(self, name): break return dependencies - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _bcp_dir(self): return "custom-boost" @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property def _is_clang_cl(self): return self.settings.os == "Windows" and self.settings.compiler == "clang" - @property - def _zip_bzip2_requires_needed(self): - return not self.options.without_iostreams and not self.options.header_only - @property def _python_executable(self): """ @@ -253,6 +248,10 @@ def _python_executable(self): def _is_windows_platform(self): return self.settings.os in ["Windows", "WindowsStore", "WindowsCE"] + @property + def _is_apple_embedded_platform(self): + return self.settings.os in ["iOS", "watchOS", "tvOS"] + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -268,11 +267,12 @@ def config_options(self): # nowide requires a c++11-able compiler + movable std::fstream: change default to not build on compiler with too old default c++ standard or too low compiler.cppstd # json requires a c++11-able compiler: change default to not build on compiler with too old default c++ standard or too low compiler.cppstd - if self.settings.compiler.cppstd: - if not tools.valid_min_cppstd(self, 11): + if self.settings.compiler.get_safe("cppstd"): + if not valid_min_cppstd(self, 11): self.options.without_fiber = True self.options.without_nowide = True self.options.without_json = True + self.options.without_url = True else: version_cxx11_standard_json = self._min_compiler_version_default_cxx11 if version_cxx11_standard_json: @@ -280,10 +280,12 @@ def config_options(self): self.options.without_fiber = True self.options.without_json = True self.options.without_nowide = True + self.options.without_url = True else: self.options.without_fiber = True self.options.without_json = True self.options.without_nowide = True + self.options.without_url = True # iconv is off by default on Windows and Solaris if self._is_windows_platform or self.settings.os == "SunOS": @@ -313,13 +315,13 @@ def disable_math(): except ConanException: pass - if self.settings.compiler.cppstd: - if not tools.valid_min_cppstd(self, 11): + if self.settings.compiler.get_safe("cppstd"): + if not valid_min_cppstd(self, 11): disable_math() else: min_compiler_version = self._min_compiler_version_default_cxx11 if min_compiler_version is None: - self.output.warn("Assuming the compiler supports c++11 by default") + self.output.warning("Assuming the compiler supports c++11 by default") elif Version(self.settings.compiler.version) < min_compiler_version: disable_math() @@ -335,16 +337,38 @@ def disable_wave(): except ConanException: pass - if self.settings.compiler.cppstd: - if not tools.valid_min_cppstd(self, 11): + if self.settings.compiler.get_safe("cppstd"): + if not valid_min_cppstd(self, 11): disable_wave() else: min_compiler_version = self._min_compiler_version_default_cxx11 if min_compiler_version is None: - self.output.warn("Assuming the compiler supports c++11 by default") + self.output.warning("Assuming the compiler supports c++11 by default") elif Version(self.settings.compiler.version) < min_compiler_version: disable_wave() + if Version(self.version) >= "1.81.0": + # Starting from 1.81.0, Boost.Locale requires a c++11 capable compiler + # ==> disable it by default for older compilers or c++ standards + + def disable_locale(): + super_modules = self._all_super_modules("locale") + for smod in super_modules: + try: + setattr(self.options, f"without_{smod}", True) + except ConanException: + pass + + if self.settings.compiler.get_safe("cppstd"): + if not valid_min_cppstd(self, 11): + disable_locale() + else: + min_compiler_version = self._min_compiler_version_default_cxx11 + if min_compiler_version is None: + self.output.warning("Assuming the compiler supports c++11 by default") + elif Version(self.settings.compiler.version) < min_compiler_version: + disable_locale() + @property def _configure_options(self): return self._dependencies["configure_options"] @@ -359,20 +383,20 @@ def _shared(self): @property def _stacktrace_addr2line_available(self): - if (self.settings.os in ["iOS", "watchOS", "tvOS"] or self.settings.get_safe("os.subsystem") == "catalyst"): + if (self._is_apple_embedded_platform or self.settings.get_safe("os.subsystem") == "catalyst"): # sandboxed environment - cannot launch external processes (like addr2line), system() function is forbidden return False return not self.options.header_only and not self.options.without_stacktrace and self.settings.os != "Windows" def configure(self): if self.options.header_only: - del self.options.shared - del self.options.fPIC + self.options.rm_safe("shared") + self.options.rm_safe("fPIC") elif self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.i18n_backend != "deprecated": - self.output.warn("i18n_backend option is deprecated, do not use anymore.") + self.output.warning("i18n_backend option is deprecated, do not use anymore.") if self.options.i18n_backend == "iconv": self.options.i18n_backend_iconv = "libiconv" self.options.i18n_backend_icu = False @@ -383,27 +407,42 @@ def configure(self): self.options.i18n_backend_iconv = "off" self.options.i18n_backend_icu = False if self.options.without_locale: - del self.options.i18n_backend_iconv - del self.options.i18n_backend_icu + self.options.rm_safe("i18n_backend_iconv") + self.options.rm_safe("i18n_backend_icu") if not self.options.without_python: if not self.options.python_version: self.options.python_version = self._detect_python_version() self.options.python_executable = self._python_executable else: - del self.options.python_buildid + self.options.rm_safe("python_buildid") if not self._stacktrace_addr2line_available: - del self.options.addr2line_location + self.options.rm_safe("addr2line_location") if self.options.get_safe("without_stacktrace", True): - del self.options.with_stacktrace_backtrace + self.options.rm_safe("with_stacktrace_backtrace") if self.options.layout == "b2-default": self.options.layout = "versioned" if self.settings.os == "Windows" else "system" if self.options.without_fiber: - del self.options.numa + self.options.rm_safe("numa") + + def layout(self): + basic_layout(self, src_folder="src") + + @property + def _cxx11_boost_libraries(self): + libraries = ["fiber", "json", "nowide", "url"] + if Version(self.version) >= "1.76.0": + libraries.append("math") + if Version(self.version) >= "1.79.0": + libraries.append("wave") + if Version(self.version) >= "1.81.0": + libraries.append("locale") + libraries.sort() + return filter(lambda library: f"without_{library}" in self.options, libraries) def validate(self): if not self.options.multithreading: @@ -415,7 +454,7 @@ def validate(self): if not self.options.get_safe(f"without_{lib}"): raise ConanInvalidConfiguration(f"Boost '{lib}' library requires multi threading") - if self._is_msvc and self._shared and "MT" in msvc_runtime_flag(self): + if is_msvc(self) and self._shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Boost can not be built as shared library with MT runtime.") if not self.options.without_locale and self.options.i18n_backend_iconv == "off" and \ @@ -438,55 +477,19 @@ def validate(self): if not self.options.get_safe("without_nowide", True): # nowide require a c++11-able compiler with movable std::fstream mincompiler_version = self._min_compiler_version_nowide - if mincompiler_version: - if Version(self.settings.compiler.version) < mincompiler_version: - raise ConanInvalidConfiguration("This compiler is too old to build Boost.nowide.") + if mincompiler_version and Version(self.settings.compiler.version) < mincompiler_version: + raise ConanInvalidConfiguration("This compiler is too old to build Boost.nowide.") - if self.settings.compiler.cppstd: + if any([not self.options.get_safe(f"without_{library}", True) for library in self._cxx11_boost_libraries]): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) else: version_cxx11_standard = self._min_compiler_version_default_cxx11 - if version_cxx11_standard: - if Version(self.settings.compiler.version) < version_cxx11_standard: - raise ConanInvalidConfiguration("Boost.{fiber,json} require a c++11 compiler (please set compiler.cppstd or use a newer compiler)") - else: - self.output.warn("I don't know what the default c++ standard of this compiler is. I suppose it supports c++11 by default.\n" - "This might cause some boost libraries not being built and conan components to fail.") - - if not all((self.options.without_fiber, self.options.get_safe("without_json", True))): - # fiber/json require a c++11-able compiler. - if self.settings.compiler.cppstd: - check_min_cppstd(self, 11) - else: - version_cxx11_standard = self._min_compiler_version_default_cxx11 - if version_cxx11_standard: - if Version(self.settings.compiler.version) < version_cxx11_standard: - raise ConanInvalidConfiguration("Boost.{fiber,json} requires a c++11 compiler (please set compiler.cppstd or use a newer compiler)") - else: - self.output.warn("I don't know what the default c++ standard of this compiler is. I suppose it supports c++11 by default.\n" - "This might cause some boost libraries not being built and conan components to fail.") - - if Version(self.version) >= "1.76.0": - # Starting from 1.76.0, Boost.Math requires a compiler with c++ standard 11 or higher - if not self.options.without_math: - if self.settings.compiler.cppstd: - check_min_cppstd(self, 11) - else: - min_compiler_version = self._min_compiler_version_default_cxx11 - if min_compiler_version is not None: - if Version(self.settings.compiler.version) < min_compiler_version: - raise ConanInvalidConfiguration("Boost.Math requires (boost:)cppstd>=11 (current one is lower)") - - if Version(self.version) >= "1.79.0": - # Starting from 1.79.0, Boost.Wave requires a compiler with c++ standard 11 or higher - if not self.options.without_wave: - if self.settings.compiler.cppstd: - check_min_cppstd(self, 11) - else: - min_compiler_version = self._min_compiler_version_default_cxx11 - if min_compiler_version is not None: - if Version(self.settings.compiler.version) < min_compiler_version: - raise ConanInvalidConfiguration("Boost.Wave requires (boost:)cppstd>=11 (current one is lower)") + if version_cxx11_standard and Version(self.settings.compiler.version) < version_cxx11_standard: + raise ConanInvalidConfiguration( + f"Boost.{{{','.join(self._cxx11_boost_libraries)}}} requires a c++11 compiler " + "(please set compiler.cppstd or use a newer compiler)" + ) def _with_dependency(self, dependency): """ @@ -528,7 +531,7 @@ def _with_stacktrace_backtrace(self): def requirements(self): if self._with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self._with_bzip2: self.requires("bzip2/1.0.8") if self._with_lzma: @@ -536,38 +539,42 @@ def requirements(self): if self._with_zstd: self.requires("zstd/1.5.2") if self._with_stacktrace_backtrace: - self.requires("libbacktrace/cci.20210118") + self.requires("libbacktrace/cci.20210118", transitive_headers=True, transitive_libs=True) if self._with_icu: - self.requires("icu/71.1") + self.requires("icu/72.1") if self._with_iconv: self.requires("libiconv/1.17") def package_id(self): del self.info.options.i18n_backend - if self.options.header_only: - self.info.header_only() - self.info.options.header_only = True + if self.info.options.header_only: + self.info.clear() else: del self.info.options.debug_level del self.info.options.filesystem_version del self.info.options.pch del self.info.options.python_executable # PATH to the interpreter is not important, only version matters - if self.options.without_python: + if self.info.options.without_python: del self.info.options.python_version - else: - self.info.options.python_version = self._python_version def build_requirements(self): if not self.options.header_only: - self.build_requires("b2/4.9.2") + self.tool_requires("b2/4.9.3") def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + destination=self.source_folder, strip_root=True) apply_conandata_patches(self) + def generate(self): + if not self.options.header_only: + env = VirtualBuildEnv(self) + env.generate() + vc = VCVars(self) + vc.generate() + ##################### BUILDING METHODS ########################### def _run_python_script(self, script): @@ -580,7 +587,7 @@ def _run_python_script(self, script): command = f'"{self._python_executable}" -c "{script}"' self.output.info(f"running {command}") try: - self.run(command=command, output=output) + self.run(command, output, scope="run") except ConanException: self.output.info("(failed)") return None @@ -632,7 +639,7 @@ def _get_python_var(self, name): NOTE: distutils is deprecated and breaks the recipe since Python 3.10 """ - python_version_parts = self.info.options.python_version.split('.') + python_version_parts = str(self.info.options.python_version).split('.') python_major = int(python_version_parts[0]) python_minor = int(python_version_parts[1]) if(python_major >= 3 and python_minor >= 10): @@ -649,7 +656,6 @@ def _detect_python_version(self): "import sys; " "print('{}.{}'.format(sys.version_info[0], sys.version_info[1]))") - @property def _python_version(self): version = self._detect_python_version() @@ -715,9 +721,10 @@ def _python_library_dir(self): multiarch = self._get_python_var("MULTIARCH") masd = self._get_python_var("multiarchsubdir") with_dyld = self._get_python_var("WITH_DYLD") - if libdir and multiarch and masd: + if libdir and multiarch and masd and not libdir.endswith(masd): if masd.startswith(os.sep): masd = masd[len(os.sep):] + self.output.warning(f"Python libdir candidate thingy: {libdir}") libdir = os.path.join(libdir, masd) if not libdir: @@ -725,8 +732,8 @@ def _python_library_dir(self): libdir = os.path.join(os.path.dirname(libdest), "libs") candidates = [ldlibrary, library] - library_prefixes = [""] if self._is_msvc else ["", "lib"] - library_suffixes = [".lib"] if self._is_msvc else [".so", ".dll.a", ".a"] + library_prefixes = [""] if is_msvc(self) else ["", "lib"] + library_suffixes = [".lib"] if is_msvc(self) else [".so", ".dll.a", ".a"] if with_dyld: library_suffixes.insert(0, ".dylib") @@ -750,102 +757,103 @@ def _python_library_dir(self): raise ConanInvalidConfiguration("couldn't locate python libraries - make sure you have installed python development files") def _clean(self): - src = os.path.join(self.source_folder, self._source_subfolder) clean_dirs = [ os.path.join(self.build_folder, "bin.v2"), os.path.join(self.build_folder, "architecture"), os.path.join(self.source_folder, self._bcp_dir), - os.path.join(src, "dist", "bin"), - os.path.join(src, "stage"), - os.path.join(src, "tools", "build", "src", "engine", "bootstrap"), - os.path.join(src, "tools", "build", "src", "engine", "bin.ntx86"), - os.path.join(src, "tools", "build", "src", "engine", "bin.ntx86_64"), + os.path.join(self.source_folder, "dist", "bin"), + os.path.join(self.source_folder, "stage"), + os.path.join(self.source_folder, "tools", "build", "src", "engine", "bootstrap"), + os.path.join(self.source_folder, "tools", "build", "src", "engine", "bin.ntx86"), + os.path.join(self.source_folder, "tools", "build", "src", "engine", "bin.ntx86_64"), ] for d in clean_dirs: if os.path.isdir(d): - self.output.warn(f"removing '{d}'") + self.output.warning(f"removing '{d}'") shutil.rmtree(d) @property def _b2_exe(self): - return "b2.exe" if tools.os_info.is_windows else "b2" + return "b2" @property def _bcp_exe(self): - folder = os.path.join(self.source_folder, self._source_subfolder, "dist", "bin") - return os.path.join(folder, "bcp.exe" if tools.os_info.is_windows else "bcp") + folder = os.path.join(self.source_folder, "dist", "bin") + return os.path.join(folder, "bcp") @property def _use_bcp(self): return self.options.namespace != "boost" - @property - def _boost_dir(self): - return self._bcp_dir if self._use_bcp else self._source_subfolder - @property def _boost_build_dir(self): - return os.path.join(self.source_folder, self._source_subfolder, "tools", "build") + return os.path.join(self.source_folder, "tools", "build") def _build_bcp(self): - folder = os.path.join(self.source_folder, self._source_subfolder, "tools", "bcp") - with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): - with chdir(self, folder): - command = f"{self._b2_exe} -j{build_jobs(self)} --abbreviate-paths toolset={self._toolset}" - command += " -d%d" % self.options.debug_level - self.output.warn(command) - self.run(command, run_environment=True) + folder = os.path.join(self.source_folder, "tools", "bcp") + with chdir(self, folder): + command = f"{self._b2_exe} -j{build_jobs(self)} --abbreviate-paths toolset={self._toolset}" + command += f" -d{self.options.debug_level}" + self.output.warning(command) + self.run(command) def _run_bcp(self): - with tools.vcvars(self.settings) if self._is_msvc or self._is_clang_cl else tools.no_op(): - with chdir(self, self.source_folder): - mkdir(self, self._bcp_dir) - namespace = f"--namespace={self.options.namespace}" - alias = "--namespace-alias" if self.options.namespace_alias else "" - boostdir = f"--boost={self._source_subfolder}" - libraries = {"build", "boost-build.jam", "boostcpp.jam", "boost_install", "headers"} - for d in os.listdir(os.path.join(self._source_subfolder, "boost")): - if os.path.isdir(os.path.join(self._source_subfolder, "boost", d)): - libraries.add(d) - for d in os.listdir(os.path.join(self._source_subfolder, "libs")): - if os.path.isdir(os.path.join(self._source_subfolder, "libs", d)): - libraries.add(d) - libraries = " ".join(libraries) - command = f"{self._bcp_exe} {namespace} {alias} {boostdir} {libraries} {self._bcp_dir}" - self.output.warn(command) - self.run(command) + with chdir(self, self.source_folder): + mkdir(self, self._bcp_dir) + namespace = f"--namespace={self.options.namespace}" + alias = "--namespace-alias" if self.options.namespace_alias else "" + boostdir = f"--boost={self.source_folder}" + libraries = {"build", "boost-build.jam", "boostcpp.jam", "boost_install", "headers"} + for d in os.listdir(os.path.join(self.source_folder, "boost")): + if os.path.isdir(os.path.join(self.source_folder, "boost", d)): + libraries.add(d) + for d in os.listdir(os.path.join(self.source_folder, "libs")): + if os.path.isdir(os.path.join(self.source_folder, "libs", d)): + libraries.add(d) + libraries = " ".join(libraries) + command = f"{self._bcp_exe} {namespace} {alias} {boostdir} {libraries} {self._bcp_dir}" + self.output.warning(command) + self.run(command) def build(self): + stacktrace_jamfile = os.path.join(self.source_folder, "libs", "stacktrace", "build", "Jamfile.v2") if cross_building(self, skip_x64_x86=True): # When cross building, do not attempt to run the test-executable (assume they work) - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "libs", "stacktrace", "build", "Jamfile.v2"), - "$(>) > $(<)", - "echo \"\" > $(<)", strict=False) + replace_in_file(self, stacktrace_jamfile, "$(>) > $(<)", "echo \"\" > $(<)", strict=False) + if self._with_stacktrace_backtrace and self.settings.os != "Windows" and not cross_building(self): + # When libbacktrace is shared, give extra help to the test-executable + linker_var = "DYLD_LIBRARY_PATH" if self.settings.os == "Macos" else "LD_LIBRARY_PATH" + libbacktrace_libdir = self.dependencies["libbacktrace"].cpp_info.aggregated_components().libdirs[0] + patched_run_rule = f"{linker_var}={libbacktrace_libdir} $(>) > $(<)" + replace_in_file(self, stacktrace_jamfile, "$(>) > $(<)", patched_run_rule, strict=False) + if self.dependencies["libbacktrace"].options.shared: + replace_in_file(self, stacktrace_jamfile, "static", "shared", strict=False) + # Older clang releases require a thread_local variable to be initialized by a constant value - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), + replace_in_file(self, os.path.join(self.source_folder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), "/* thread_local */", "thread_local", strict=False) - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), + replace_in_file(self, os.path.join(self.source_folder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), "/* static __thread */", "static __thread", strict=False) if self.settings.compiler == "apple-clang" or (self.settings.compiler == "clang" and Version(self.settings.compiler.version) < 6): - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), + replace_in_file(self, os.path.join(self.source_folder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), "thread_local", "/* thread_local */") - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), + replace_in_file(self, os.path.join(self.source_folder, "boost", "stacktrace", "detail", "libbacktrace_impls.hpp"), "static __thread", "/* static __thread */") - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "tools", "build", "src", "tools", "gcc.jam"), + replace_in_file(self, os.path.join(self.source_folder, "tools", "build", "src", "tools", "gcc.jam"), "local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux ] ;", "local generic-os = [ set.difference $(all-os) : aix darwin vxworks solaris osf hpux iphone appletv ] ;", strict=False) - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "tools", "build", "src", "tools", "gcc.jam"), + replace_in_file(self, os.path.join(self.source_folder, "tools", "build", "src", "tools", "gcc.jam"), "local no-threading = android beos haiku sgi darwin vxworks ;", "local no-threading = android beos haiku sgi darwin vxworks iphone appletv ;", strict=False) - replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "libs", "fiber", "build", "Jamfile.v2"), + replace_in_file(self, os.path.join(self.source_folder, "libs", "fiber", "build", "Jamfile.v2"), " @numa", " shared:.//boost_fiber : @numa", strict=False) if self.options.header_only: - self.output.warn("Header only package, skipping build") + self.output.warning("Header only package, skipping build") return self._clean() @@ -854,25 +862,22 @@ def build(self): self._build_bcp() self._run_bcp() - # Help locating bzip2 and zlib self._create_user_config_jam(self._boost_build_dir) # JOIN ALL FLAGS b2_flags = " ".join(self._build_flags) full_command = f"{self._b2_exe} {b2_flags}" # -d2 is to print more debug info and avoid travis timing out without output - sources = os.path.join(self.source_folder, self._boost_dir) + sources = os.path.join(self.source_folder, self._bcp_dir) if self._use_bcp else self.source_folder full_command += f' --debug-configuration --build-dir="{self.build_folder}"' - self.output.warn(full_command) + self.output.warning(full_command) # If sending a user-specified toolset to B2, setting the vcvars # interferes with the compiler selection. - use_vcvars = self._is_msvc and not self.settings.compiler.get_safe("toolset", default="") - with tools.vcvars(self.settings) if use_vcvars else tools.no_op(): - with chdir(self, sources): - # To show the libraries *1 - # self.run("%s --show-libraries" % b2_exe) - self.run(full_command, run_environment=True) + with chdir(self, sources): + # To show the libraries *1 + # self.run("%s --show-libraries" % b2_exe) + self.run(full_command) @property def _b2_os(self): @@ -969,7 +974,7 @@ def _build_flags(self): flags.append("numa=on") # https://www.boost.org/doc/libs/1_70_0/libs/context/doc/html/context/architectures.html - if self._b2_os: + if not self._is_apple_embedded_platform and self._b2_os: flags.append(f"target-os={self._b2_os}") if self._b2_architecture: flags.append(f"architecture={self._b2_architecture}") @@ -1003,7 +1008,7 @@ def _build_flags(self): flags.append("--disable-iconv") def add_defines(library): - for define in self.deps_cpp_info[library].defines: + for define in self.dependencies[library].cpp_info.aggregated_components().defines: flags.append(f"define={define}") if self._with_zlib: @@ -1015,8 +1020,8 @@ def add_defines(library): if self._with_zstd: add_defines("zstd") - if self._is_msvc: - flags.append(f"runtime-link={'static' if 'MT' in msvc_runtime_flag(self) else 'shared'}" % ()) + if is_msvc(self): + flags.append(f"runtime-link={'static' if is_msvc_static_runtime(self) else 'shared'}") flags.append(f"runtime-debugging={'on' if 'd' in msvc_runtime_flag(self) else 'off'}") # For details https://boostorg.github.io/build/manual/master/index.html @@ -1036,7 +1041,8 @@ def add_defines(library): flags.append(f"toolset={self._toolset}") if self.settings.get_safe("compiler.cppstd"): - flags.append(f"cxxflags={tools.cppstd_flag(self.settings)}") + cppstd_flag = AutotoolsToolchain(self).cppstd + flags.append(f"cxxflags={cppstd_flag}") # LDFLAGS link_flags = [] @@ -1049,10 +1055,9 @@ def add_defines(library): if self.settings.build_type == "RelWithDebInfo": if self.settings.compiler == "gcc" or "clang" in str(self.settings.compiler): cxx_flags.append("-g") - elif self._is_msvc: + elif is_msvc(self): cxx_flags.append("/Z7") - # Standalone toolchain fails when declare the std lib if self.settings.os not in ("Android", "Emscripten"): try: @@ -1076,6 +1081,8 @@ def add_defines(library): flags.append("define=BOOST_ASIO_NO_DEPRECATED=1") if self.options.filesystem_no_deprecated: flags.append("define=BOOST_FILESYSTEM_NO_DEPRECATED=1") + if self.options.filesystem_use_std_fs: + flags.append("define=BOOST_DLL_USE_STD_FS=1") if self.options.system_use_utf8: flags.append("define=BOOST_SYSTEM_USE_UTF8=1") if self.options.segmented_stacks: @@ -1085,38 +1092,34 @@ def add_defines(library): flags.append("pch=on" if self.options.pch else "pch=off") if is_apple_os(self): - os_version = self.settings.get_safe("os.version") - if os_version: - os_subsystem = self.settings.get_safe("os.subsystem") - deployment_target_flag = tools.apple_deployment_target_flag( - self.settings.os, - os_version, - self.settings.get_safe("os.sdk"), - os_subsystem, - self.settings.get_safe("arch") - ) - cxx_flags.append(deployment_target_flag) - link_flags.append(deployment_target_flag) - if os_subsystem == "catalyst": - cxx_flags.append("--target=arm64-apple-ios-macabi") - link_flags.append("--target=arm64-apple-ios-macabi") + apple_min_version_flag = AutotoolsToolchain(self).apple_min_version_flag + if apple_min_version_flag: + cxx_flags.append(apple_min_version_flag) + link_flags.append(apple_min_version_flag) + os_subsystem = self.settings.get_safe("os.subsystem") + if os_subsystem == "catalyst": + cxx_flags.append("--target=arm64-apple-ios-macabi") + link_flags.append("--target=arm64-apple-ios-macabi") if self.settings.os == "iOS": if self.options.multithreading: cxx_flags.append("-DBOOST_SP_USE_SPINLOCK") - cxx_flags.append("-fembed-bitcode") - + if self.conf.get("tools.apple:enable_bitcode", check_type=bool): + cxx_flags.append("-fembed-bitcode") + if self._with_stacktrace_backtrace: + flags.append(f"-sLIBBACKTRACE_PATH={self.dependencies['libbacktrace'].package_folder}") if self._with_iconv: - flags.append(f"-sICONV_PATH={self.deps_cpp_info['libiconv'].rootpath}") + flags.append(f"-sICONV_PATH={self.dependencies['libiconv'].package_folder}") if self._with_icu: - flags.append(f"-sICU_PATH={self.deps_cpp_info['icu'].rootpath}") - if not self.options["icu"].shared: + flags.append(f"-sICU_PATH={self.dependencies['icu'].package_folder}") + if not self.dependencies["icu"].options.shared: # Using ICU_OPTS to pass ICU system libraries is not possible due to Boost.Regex disallowing it. - if self._is_msvc: - icu_ldflags = " ".join(f"{l}.lib" for l in self.deps_cpp_info["icu"].system_libs) + icu_system_libs = self.dependencies["icu"].cpp_info.aggregated_components().system_libs + if is_msvc(self): + icu_ldflags = " ".join(f"{l}.lib" for l in icu_system_libs) else: - icu_ldflags = " ".join(f"-l{l}" for l in self.deps_cpp_info["icu"].system_libs) + icu_ldflags = " ".join(f"-l{l}" for l in icu_system_libs) link_flags.append(icu_ldflags) link_flags = f'linkflags="{" ".join(link_flags)}"' @@ -1141,7 +1144,7 @@ def add_defines(library): f"--prefix={self.package_folder}", f"-j{build_jobs(self)}", "--abbreviate-paths", - "-d%d" % self.options.debug_level, + f"-d{self.options.debug_level}", ]) return flags @@ -1165,66 +1168,71 @@ def _build_cross_flags(self): elif arch.startswith("mips"): pass else: - self.output.warn(f"Unable to detect the appropriate ABI for {arch} architecture.") + self.output.warning(f"Unable to detect the appropriate ABI for {arch} architecture.") self.output.info(f"Cross building flags: {flags}") return flags @property def _ar(self): - if os.environ.get("AR"): - return os.environ["AR"] + ar = VirtualBuildEnv(self).vars().get("AR") + if ar: + return ar if is_apple_os(self) and self.settings.compiler == "apple-clang": - return tools.XCRun(self.settings).ar + return XCRun(self).ar return None @property def _ranlib(self): - if os.environ.get("RANLIB"): - return os.environ["RANLIB"] + ranlib = VirtualBuildEnv(self).vars().get("RANLIB") + if ranlib: + return ranlib if is_apple_os(self) and self.settings.compiler == "apple-clang": - return tools.XCRun(self.settings).ranlib + return XCRun(self).ranlib return None @property def _cxx(self): - if os.environ.get("CXX"): - return os.environ["CXX"] + compilers_by_conf = self.conf.get("tools.build:compiler_executables", default={}, check_type=dict) + cxx = compilers_by_conf.get("cpp") or VirtualBuildEnv(self).vars().get("CXX") + if cxx: + return cxx if is_apple_os(self) and self.settings.compiler == "apple-clang": - return tools.XCRun(self.settings).cxx + return XCRun(self).cxx compiler_version = str(self.settings.compiler.version) major = compiler_version.split(".", maxsplit=1)[0] if self.settings.compiler == "gcc": - return tools.which(f"g++-{compiler_version}") or tools.which(f"g++-{major}") or tools.which("g++") or "" + return shutil.which(f"g++-{compiler_version}") or shutil.which(f"g++-{major}") or shutil.which("g++") or "" if self.settings.compiler == "clang": - return tools.which(f"clang++-{compiler_version}") or tools.which(f"clang++-{major}") or tools.which("clang++") or "" + return shutil.which(f"clang++-{compiler_version}") or shutil.which(f"clang++-{major}") or shutil.which("clang++") or "" return "" def _create_user_config_jam(self, folder): - """To help locating the zlib and bzip2 deps""" - self.output.warn("Patching user-config.jam") + self.output.warning("Patching user-config.jam") + + def create_library_config(deps_name, name): + aggregated_cpp_info = self.dependencies[deps_name].cpp_info.aggregated_components() + includedir = aggregated_cpp_info.includedirs[0].replace("\\", "/") + includedir = f"\"{includedir}\"" + libdir = aggregated_cpp_info.libdirs[0].replace("\\", "/") + libdir = f"\"{libdir}\"" + lib = aggregated_cpp_info.libs[0] + version = self.dependencies[deps_name].ref.version + return f"\nusing {name} : {version} : " \ + f"{includedir} " \ + f"{libdir} " \ + f"{lib} ;" contents = "" - if self._zip_bzip2_requires_needed: - def create_library_config(deps_name, name): - includedir = '"%s"' % self.deps_cpp_info[deps_name].include_paths[0].replace("\\", "/") - libdir = '"%s"' % self.deps_cpp_info[deps_name].lib_paths[0].replace("\\", "/") - lib = self.deps_cpp_info[deps_name].libs[0] - version = self.deps_cpp_info[deps_name].version - return f"\nusing {name} : {version} : " \ - f"{includedir} " \ - f"{libdir} " \ - f"{lib} ;" - - contents = "" - if self._with_zlib: - contents += create_library_config("zlib", "zlib") - if self._with_bzip2: - contents += create_library_config("bzip2", "bzip2") - if self._with_lzma: - contents += create_library_config("xz_utils", "lzma") - if self._with_zstd: - contents += create_library_config("zstd", "zstd") + + if self._with_zlib: + contents += create_library_config("zlib", "zlib") + if self._with_bzip2: + contents += create_library_config("bzip2", "bzip2") + if self._with_lzma: + contents += create_library_config("xz_utils", "lzma") + if self._with_zstd: + contents += create_library_config("zstd", "zstd") if not self.options.without_python: # https://www.boost.org/doc/libs/1_70_0/libs/python/doc/html/building/configuring_boost_build.html @@ -1238,33 +1246,33 @@ def create_library_config(deps_name, name): contents += f'\nusing "{self._toolset}" : {self._toolset_version} : ' cxx_fwd_slahes = self._cxx.replace("\\", "/") - if self._is_msvc: - contents += f' "{cxx_fwd_slahes}"' - else: - contents += f' {cxx_fwd_slahes}' + if cxx_fwd_slahes: + contents += f" \"{cxx_fwd_slahes}\"" if is_apple_os(self): if self.settings.compiler == "apple-clang": - contents += f" -isysroot {tools.XCRun(self.settings).sdk_path}" + contents += f" -isysroot {XCRun(self).sdk_path}" if self.settings.get_safe("arch"): - contents += f" -arch {tools.to_apple_arch(self.settings.arch)}" + contents += f" -arch {to_apple_arch(self)}" contents += " : \n" if self._ar: - ar_path = tools.which(self._ar).replace("\\", "/") + ar_path = self._ar.replace("\\", "/") contents += f'"{ar_path}" ' if self._ranlib: - ranlib_path = tools.which(self._ranlib).replace("\\", "/") + ranlib_path = self._ranlib.replace("\\", "/") contents += f'"{ranlib_path}" ' - cxxflags = tools.get_env("CXXFLAGS", "") + " " - cflags = tools.get_env("CFLAGS", "") + " " - cppflags = tools.get_env("CPPFLAGS", "") + " " - ldflags = tools.get_env("LDFLAGS", "") + " " - asflags = tools.get_env("ASFLAGS", "") + " " + cxxflags = " ".join(self.conf.get("tools.build:cxxflags", default=[], check_type=list)) + " " + cflags = " ".join(self.conf.get("tools.build:cflags", default=[], check_type=list)) + " " + buildenv_vars = VirtualBuildEnv(self).vars() + cppflags = buildenv_vars.get("CPPFLAGS", "") + " " + ldflags = " ".join(self.conf.get("tools.build:sharedlinkflags", default=[], check_type=list)) + " " + asflags = buildenv_vars.get("ASFLAGS", "") + " " if self._with_stacktrace_backtrace: - cppflags += " ".join(f"-I{p}" for p in self.deps_cpp_info["libbacktrace"].include_paths) + " " - ldflags += " ".join(f"-L{p}" for p in self.deps_cpp_info["libbacktrace"].lib_paths) + " " + backtrace_aggregated_cpp_info = self.dependencies["libbacktrace"].cpp_info.aggregated_components() + cppflags += " ".join(f"-I{p}" for p in backtrace_aggregated_cpp_info.includedirs) + " " + ldflags += " ".join(f"-L{p}" for p in backtrace_aggregated_cpp_info.libdirs) + " " if cxxflags.strip(): contents += f'"{cxxflags.strip()}" ' @@ -1277,32 +1285,27 @@ def create_library_config(deps_name, name): if asflags.strip(): contents += f'"{asflags.strip()}" ' + if self._is_apple_embedded_platform: + contents += f'"{self._b2_os}" ' + contents += " ;" - self.output.warn(contents) + self.output.warning(contents) filename = f"{folder}/user-config.jam" save(self, filename, contents) @property def _toolset_version(self): - if self.settings.get_safe("compiler") == "Visual Studio": - toolset = tools.msvs_toolset(self) + toolset = MSBuildToolchain(self).toolset + if toolset: match = re.match(r"v(\d+)(\d)$", toolset) if match: return f"{match.group(1)}.{match.group(2)}" - elif self.settings.get_safe("compiler") == "msvc": - toolsets = {'170': '11.0', - '180': '12.0', - '190': '14.0', - '191': '14.1', - '192': '14.2', - "193": '14.3'} - return toolsets[self.settings.get_safe("compiler.version")] return "" @property def _toolset(self): - if self._is_msvc: + if is_msvc(self): return "clang-win" if self.settings.compiler.get_safe("toolset") == "ClangCL" else "msvc" if self.settings.os == "Windows" and self.settings.compiler == "clang": return "clang-win" @@ -1346,7 +1349,7 @@ def _toolset_tag(self): os_ = "" if self.settings.os == "Macos": os_ = "darwin" - if self._is_msvc: + if is_msvc(self): toolset_version = self._toolset_version.replace(".", "") else: toolset_version = str(Version(self.settings.compiler.version).major) @@ -1360,18 +1363,18 @@ def _toolset_tag(self): def package(self): # This stage/lib is in source_folder... Face palm, looks like it builds in build but then # copy to source with the good lib name - self.copy("LICENSE_1_0.txt", dst="licenses", src=os.path.join(self.source_folder, - self._source_subfolder)) + copy(self, "LICENSE_1_0.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) if self.options.header_only: - self.copy(pattern="*", dst="include/boost", src=f"{self._boost_dir}/boost") + copy(self, "*", src=os.path.join(self.source_folder, "boost"), + dst=os.path.join(self.package_folder, "include", "boost")) if self.settings.os == "Emscripten" and not self.options.header_only: self._create_emscripten_libs() - if self._is_msvc and self._shared: + if is_msvc(self) and self._shared: # Some boost releases contain both static and shared variants of some libraries (if shared=True) - all_libs = set(tools.collect_libs(self, "lib")) + all_libs = set(collect_libs(self, "lib")) static_libs = set(l for l in all_libs if l.startswith("lib")) shared_libs = all_libs.difference(static_libs) static_libs = set(l[3:] for l in static_libs) @@ -1397,7 +1400,7 @@ def _create_emscripten_libs(self): self.package_folder, "lib" ) if not os.path.exists(staged_libs): - self.output.warn(f"Lib folder doesn't exist, can't collect libraries: {staged_libs}") + self.output.warning(f"Lib folder doesn't exist, can't collect libraries: {staged_libs}") return for bc_file in os.listdir(staged_libs): if bc_file.startswith("lib") and bc_file.endswith(".bc"): @@ -1441,6 +1444,9 @@ def package_info(self): if self.options.filesystem_no_deprecated: self.cpp_info.components["headers"].defines.append("BOOST_FILESYSTEM_NO_DEPRECATED") + if self.options.filesystem_use_std_fs: + self.cpp_info.components["headers"].defines.append("BOOST_DLL_USE_STD_FS") + if self.options.filesystem_version: self.cpp_info.components["headers"].defines.append(f"BOOST_FILESYSTEM_VERSION={self.options.filesystem_version}") @@ -1511,7 +1517,7 @@ def package_info(self): # Note that "_libboost" requires "headers" so these defines will be applied to all the libraries too. self.cpp_info.components["headers"].requires.append("disable_autolinking") - if self._is_msvc or self._is_clang_cl: + if is_msvc(self) or self._is_clang_cl: if self.options.magic_autolink: if self.options.layout == "system": self.cpp_info.components["headers"].defines.append("BOOST_AUTO_LINK_SYSTEM") @@ -1554,9 +1560,9 @@ def package_info(self): "ach": "", "version": "", } - if self._is_msvc: # FIXME: mingw? + if is_msvc(self): # FIXME: mingw? # FIXME: add 'y' when using cpython cci package and when python is built in debug mode - static_runtime_key = "s" if "MT" in msvc_runtime_flag(self) else "" + static_runtime_key = "s" if is_msvc_static_runtime(self) else "" debug_runtime_key = "g" if "d" in msvc_runtime_flag(self) else "" debug_key = "d" if self.settings.build_type == "Debug" else "" abi = static_runtime_key + debug_runtime_key + debug_key @@ -1568,7 +1574,8 @@ def package_info(self): if abi: libsuffix_data["abi"] = f"-{abi}" - libsuffix_data["arch"] = f"-{self._b2_architecture[0]}{self._b2_address_model}" + if self._b2_architecture: + libsuffix_data["arch"] = f"-{self._b2_architecture[0]}{self._b2_address_model}" version = Version(self.version) if not version.patch or version.patch == "0": libsuffix_data["version"] = f"-{version.major}_{version.minor}" @@ -1587,11 +1594,11 @@ def package_info(self): def add_libprefix(n): """ On MSVC, static libraries are built with a 'lib' prefix. Some libraries do not support shared, so are always built as a static library. """ libprefix = "" - if self._is_msvc and (not self._shared or n in self._dependencies["static_only"]): + if is_msvc(self) and (not self._shared or n in self._dependencies["static_only"]): libprefix = "lib" return libprefix + n - all_detected_libraries = set(l[:-4] if l.endswith(".dll") else l for l in tools.collect_libs(self)) + all_detected_libraries = set(l[:-4] if l.endswith(".dll") else l for l in collect_libs(self)) all_expected_libraries = set() incomplete_components = [] @@ -1649,11 +1656,15 @@ def filter_transform_module_libraries(names): self.cpp_info.components[module].names["cmake_find_package_multi"] = module self.cpp_info.components[module].names["pkg_config"] = f"boost_{module}" + # extract list of names of direct host dependencies to check for dependencies + # of components that exist in other packages + dependencies = [d.ref.name for d, _ in self.dependencies.direct_host.items()] + for requirement in self._dependencies.get("requirements", {}).get(module, []): if self.options.get_safe(requirement, None) == False: continue conan_requirement = self._option_to_conan_requirement(requirement) - if conan_requirement not in self.requires: + if conan_requirement not in dependencies: continue if module == "locale" and requirement in ("icu", "iconv"): if requirement == "icu" and not self._with_icu: @@ -1663,7 +1674,7 @@ def filter_transform_module_libraries(names): self.cpp_info.components[module].requires.append(f"{conan_requirement}::{conan_requirement}") for incomplete_component in incomplete_components: - self.output.warn(f"Boost component '{incomplete_component}' is missing libraries. Try building boost with '-o boost:without_{incomplete_component}'. (Option is not guaranteed to exist)") + self.output.warning(f"Boost component '{incomplete_component}' is missing libraries. Try building boost with '-o boost:without_{incomplete_component}'. (Option is not guaranteed to exist)") non_used = all_detected_libraries.difference(all_expected_libraries) if non_used: @@ -1709,7 +1720,7 @@ def filter_transform_module_libraries(names): self.cpp_info.components[f"numpy{pyversion.major}{pyversion.minor}"].requires = ["numpy"] - if self._is_msvc or self._is_clang_cl: + if is_msvc(self) or self._is_clang_cl: # https://github.com/conan-community/conan-boost/issues/127#issuecomment-404750974 self.cpp_info.components["_libboost"].system_libs.append("bcrypt") elif self.settings.os == "Linux": @@ -1738,4 +1749,6 @@ def filter_transform_module_libraries(names): self.cpp_info.components["headers"].defines.append("BOOST_SP_USE_SPINLOCK") else: self.cpp_info.components["headers"].defines.extend(["BOOST_AC_DISABLE_THREADS", "BOOST_SP_DISABLE_THREADS"]) + #TODO: remove in the future, user_info deprecated in conan2, but kept for compatibility while recipe is cross-compatible. self.user_info.stacktrace_addr2line_available = self._stacktrace_addr2line_available + self.conf_info.define("user.boost:stacktrace_addr2line_available", self._stacktrace_addr2line_available) diff --git a/recipes/boost/all/dependencies/dependencies-1.80.0.yml b/recipes/boost/all/dependencies/dependencies-1.80.0.yml new file mode 100644 index 0000000000000..4cabd8ca5c44d --- /dev/null +++ b/recipes/boost/all/dependencies/dependencies-1.80.0.yml @@ -0,0 +1,275 @@ +configure_options: +- atomic +- chrono +- container +- context +- contract +- coroutine +- date_time +- exception +- fiber +- filesystem +- graph +- graph_parallel +- iostreams +- json +- locale +- log +- math +- mpi +- nowide +- program_options +- python +- random +- regex +- serialization +- stacktrace +- system +- test +- thread +- timer +- type_erasure +- wave +dependencies: + atomic: [] + chrono: + - system + container: [] + context: [] + contract: + - exception + - thread + coroutine: + - context + - exception + - system + date_time: [] + exception: [] + fiber: + - context + - filesystem + fiber_numa: + - fiber + filesystem: + - atomic + - system + graph: + - math + - random + - regex + - serialization + graph_parallel: + - filesystem + - graph + - mpi + - random + - serialization + iostreams: + - random + - regex + json: + - container + - system + locale: + - thread + log: + - atomic + - container + - date_time + - exception + - filesystem + - random + - regex + - system + - thread + log_setup: + - log + math: [] + math_c99: + - math + math_c99f: + - math + math_c99l: + - math + math_tr1: + - math + math_tr1f: + - math + math_tr1l: + - math + mpi: + - graph + - serialization + mpi_python: + - mpi + - python + nowide: + - filesystem + numpy: + - python + prg_exec_monitor: + - test + program_options: [] + python: [] + random: + - system + regex: [] + serialization: [] + stacktrace: [] + stacktrace_addr2line: + - stacktrace + stacktrace_backtrace: + - stacktrace + stacktrace_basic: + - stacktrace + stacktrace_noop: + - stacktrace + stacktrace_windbg: + - stacktrace + stacktrace_windbg_cached: + - stacktrace + system: [] + test: + - exception + test_exec_monitor: + - test + thread: + - atomic + - chrono + - container + - date_time + - exception + - system + timer: + - chrono + - system + type_erasure: + - thread + unit_test_framework: + - prg_exec_monitor + - test + - test_exec_monitor + wave: + - filesystem + - serialization + wserialization: + - serialization +libs: + atomic: + - boost_atomic + chrono: + - boost_chrono + container: + - boost_container + context: + - boost_context + contract: + - boost_contract + coroutine: + - boost_coroutine + date_time: + - boost_date_time + exception: + - boost_exception + fiber: + - boost_fiber + fiber_numa: + - boost_fiber_numa + filesystem: + - boost_filesystem + graph: + - boost_graph + graph_parallel: + - boost_graph_parallel + iostreams: + - boost_iostreams + json: + - boost_json + locale: + - boost_locale + log: + - boost_log + log_setup: + - boost_log_setup + math: [] + math_c99: + - boost_math_c99 + math_c99f: + - boost_math_c99f + math_c99l: + - boost_math_c99l + math_tr1: + - boost_math_tr1 + math_tr1f: + - boost_math_tr1f + math_tr1l: + - boost_math_tr1l + mpi: + - boost_mpi + mpi_python: + - boost_mpi_python + nowide: + - boost_nowide + numpy: + - boost_numpy{py_major}{py_minor} + prg_exec_monitor: + - boost_prg_exec_monitor + program_options: + - boost_program_options + python: + - boost_python{py_major}{py_minor} + random: + - boost_random + regex: + - boost_regex + serialization: + - boost_serialization + stacktrace: [] + stacktrace_addr2line: + - boost_stacktrace_addr2line + stacktrace_backtrace: + - boost_stacktrace_backtrace + stacktrace_basic: + - boost_stacktrace_basic + stacktrace_noop: + - boost_stacktrace_noop + stacktrace_windbg: + - boost_stacktrace_windbg + stacktrace_windbg_cached: + - boost_stacktrace_windbg_cached + system: + - boost_system + test: [] + test_exec_monitor: + - boost_test_exec_monitor + thread: + - boost_thread + timer: + - boost_timer + type_erasure: + - boost_type_erasure + unit_test_framework: + - boost_unit_test_framework + wave: + - boost_wave + wserialization: + - boost_wserialization +requirements: + iostreams: + - bzip2 + - lzma + - zlib + - zstd + locale: + - iconv + - icu + python: + - python + regex: + - icu + stacktrace: + - backtrace +static_only: +- boost_exception +- boost_test_exec_monitor +version: 1.80.0 diff --git a/recipes/boost/all/dependencies/dependencies-1.81.0.yml b/recipes/boost/all/dependencies/dependencies-1.81.0.yml new file mode 100644 index 0000000000000..838c68bc7e432 --- /dev/null +++ b/recipes/boost/all/dependencies/dependencies-1.81.0.yml @@ -0,0 +1,280 @@ +configure_options: +- atomic +- chrono +- container +- context +- contract +- coroutine +- date_time +- exception +- fiber +- filesystem +- graph +- graph_parallel +- iostreams +- json +- locale +- log +- math +- mpi +- nowide +- program_options +- python +- random +- regex +- serialization +- stacktrace +- system +- test +- thread +- timer +- type_erasure +- url +- wave +dependencies: + atomic: [] + chrono: + - system + container: [] + context: [] + contract: + - exception + - thread + coroutine: + - context + - exception + - system + date_time: [] + exception: [] + fiber: + - context + - filesystem + fiber_numa: + - fiber + filesystem: + - atomic + - system + graph: + - math + - random + - regex + - serialization + graph_parallel: + - filesystem + - graph + - mpi + - random + - serialization + iostreams: + - random + - regex + json: + - container + - system + locale: + - thread + log: + - atomic + - container + - date_time + - exception + - filesystem + - random + - regex + - system + - thread + log_setup: + - log + math: [] + math_c99: + - math + math_c99f: + - math + math_c99l: + - math + math_tr1: + - math + math_tr1f: + - math + math_tr1l: + - math + mpi: + - graph + - serialization + mpi_python: + - mpi + - python + nowide: + - filesystem + numpy: + - python + prg_exec_monitor: + - test + program_options: [] + python: [] + random: + - system + regex: [] + serialization: [] + stacktrace: [] + stacktrace_addr2line: + - stacktrace + stacktrace_backtrace: + - stacktrace + stacktrace_basic: + - stacktrace + stacktrace_noop: + - stacktrace + stacktrace_windbg: + - stacktrace + stacktrace_windbg_cached: + - stacktrace + system: [] + test: + - exception + test_exec_monitor: + - test + thread: + - atomic + - chrono + - container + - date_time + - exception + - system + timer: + - chrono + - system + type_erasure: + - thread + unit_test_framework: + - prg_exec_monitor + - test + - test_exec_monitor + url: + - system + wave: + - filesystem + - serialization + wserialization: + - serialization +libs: + atomic: + - boost_atomic + chrono: + - boost_chrono + container: + - boost_container + context: + - boost_context + contract: + - boost_contract + coroutine: + - boost_coroutine + date_time: + - boost_date_time + exception: + - boost_exception + fiber: + - boost_fiber + fiber_numa: + - boost_fiber_numa + filesystem: + - boost_filesystem + graph: + - boost_graph + graph_parallel: + - boost_graph_parallel + iostreams: + - boost_iostreams + json: + - boost_json + locale: + - boost_locale + log: + - boost_log + log_setup: + - boost_log_setup + math: [] + math_c99: + - boost_math_c99 + math_c99f: + - boost_math_c99f + math_c99l: + - boost_math_c99l + math_tr1: + - boost_math_tr1 + math_tr1f: + - boost_math_tr1f + math_tr1l: + - boost_math_tr1l + mpi: + - boost_mpi + mpi_python: + - boost_mpi_python + nowide: + - boost_nowide + numpy: + - boost_numpy{py_major}{py_minor} + prg_exec_monitor: + - boost_prg_exec_monitor + program_options: + - boost_program_options + python: + - boost_python{py_major}{py_minor} + random: + - boost_random + regex: + - boost_regex + serialization: + - boost_serialization + stacktrace: [] + stacktrace_addr2line: + - boost_stacktrace_addr2line + stacktrace_backtrace: + - boost_stacktrace_backtrace + stacktrace_basic: + - boost_stacktrace_basic + stacktrace_noop: + - boost_stacktrace_noop + stacktrace_windbg: + - boost_stacktrace_windbg + stacktrace_windbg_cached: + - boost_stacktrace_windbg_cached + system: + - boost_system + test: [] + test_exec_monitor: + - boost_test_exec_monitor + thread: + - boost_thread + timer: + - boost_timer + type_erasure: + - boost_type_erasure + unit_test_framework: + - boost_unit_test_framework + url: + - boost_url + wave: + - boost_wave + wserialization: + - boost_wserialization +requirements: + iostreams: + - bzip2 + - lzma + - zlib + - zstd + locale: + - iconv + - icu + python: + - python + regex: + - icu + stacktrace: + - backtrace +static_only: +- boost_exception +- boost_test_exec_monitor +version: 1.81.0 diff --git a/recipes/boost/all/patches/1.76.0-0001-fix-include-inside-boost-namespace.patch b/recipes/boost/all/patches/1.76.0-0001-fix-include-inside-boost-namespace.patch new file mode 100644 index 0000000000000..c06566b5a75fb --- /dev/null +++ b/recipes/boost/all/patches/1.76.0-0001-fix-include-inside-boost-namespace.patch @@ -0,0 +1,33 @@ +From 1ec5c98d80de97f9e962c5627e1a0e6096099894 Mon Sep 17 00:00:00 2001 +From: Daniel Scharrer +Date: Wed, 28 Jul 2021 19:56:31 +0200 +Subject: [PATCH] Fix #include inside boost namespace + +The existing code fails to build if was not already included. +--- + boost/math/tools/mp.hpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/boost/math/tools/mp.hpp b/boost/math/tools/mp.hpp +index 35565646f..dc8440988 100644 +--- a/boost/math/tools/mp.hpp ++++ b/boost/math/tools/mp.hpp +@@ -13,6 +13,7 @@ + + #include + #include ++#include + + namespace boost { namespace math { namespace tools { namespace meta_programming { + +@@ -338,7 +339,6 @@ using mp_remove_if_q = mp_remove_if; + // Index sequence + // Use C++14 index sequence if available + #if defined(__cpp_lib_integer_sequence) && (__cpp_lib_integer_sequence >= 201304) +-#include + template + using index_sequence = std::index_sequence; + +-- +2.39.1 + diff --git a/recipes/boost/all/patches/1.80.0-0001-filesystem-win-fix-dir-it-net-share.patch b/recipes/boost/all/patches/1.80.0-0001-filesystem-win-fix-dir-it-net-share.patch new file mode 100644 index 0000000000000..0d28b86bb670c --- /dev/null +++ b/recipes/boost/all/patches/1.80.0-0001-filesystem-win-fix-dir-it-net-share.patch @@ -0,0 +1,31 @@ +commit 9c9d127bddc2b72187c57f4933c49666255d7a4f +Author: Olavo Belloc +Date: Mon Aug 8 10:54:02 2022 +0200 + + Limit the buffer size for compatibility with previous versions of Windows + + The reported error was reproduced on Windows 7 and 8.1, but not on an early + version of Windows 10 (2004). + + Closes https://github.com/boostorg/filesystem/pull/246. + Likely fixes https://github.com/boostorg/filesystem/issues/245. + +diff --git a/libs/filesystem/src/directory.cpp b/libs/filesystem/src/directory.cpp +index 6a3e1dc..9334893 100644 +--- a/libs/filesystem/src/directory.cpp ++++ b/libs/filesystem/src/directory.cpp +@@ -599,9 +599,12 @@ extra_data_format g_extra_data_format = file_directory_information_format; + * \brief Extra buffer size for GetFileInformationByHandleEx-based or NtQueryDirectoryFile-based directory iterator. + * + * Must be large enough to accommodate at least one FILE_DIRECTORY_INFORMATION or *_DIR_INFO struct and one filename. +- * NTFS, VFAT, exFAT support filenames up to 255 UTF-16/UCS-2 characters. ReFS supports filenames up to 32768 UTF-16 characters. ++ * NTFS, VFAT, exFAT and ReFS support filenames up to 255 UTF-16/UCS-2 characters. (For ReFS, there is no information ++ * on the on-disk format, and it is possible that it supports longer filenames, up to 32768 UTF-16/UCS-2 characters.) ++ * The buffer cannot be larger than 64k, because up to Windows 8.1, NtQueryDirectoryFile and GetFileInformationByHandleEx ++ * fail with ERROR_INVALID_PARAMETER when trying to retrieve the filenames from a network share. + */ +-BOOST_CONSTEXPR_OR_CONST std::size_t dir_itr_extra_size = sizeof(file_id_extd_dir_info) + 65536u; ++BOOST_CONSTEXPR_OR_CONST std::size_t dir_itr_extra_size = 65536u; + + inline system::error_code dir_itr_close(dir_itr_imp& imp) BOOST_NOEXCEPT + { diff --git a/recipes/boost/all/patches/1.80.0-0002-filesystem-fix-weakly-canonical-long-path.patch b/recipes/boost/all/patches/1.80.0-0002-filesystem-fix-weakly-canonical-long-path.patch new file mode 100644 index 0000000000000..9312059a60000 --- /dev/null +++ b/recipes/boost/all/patches/1.80.0-0002-filesystem-fix-weakly-canonical-long-path.patch @@ -0,0 +1,171 @@ +commit 476ca7b6c1d37a5d796f8525813a9a64c9e54ffc +Author: Andrey Semashev +Date: Wed Aug 10 04:57:21 2022 +0300 + + Fix weakly_canonical on Windows with long paths prefix. + + During its operation, weakly_canonical would call status() on the path + consisting only from the root name of the input path. This would fail + with ERROR_INVALID_FUNCTION if the root name starts with the "\\?\" prefix, + as the root name path is not absolute. + + To fix this, we don't check the status of the root name path (which is + not the correct check anyways as it tests the current directory on the + corresponding drive for existence, which is not what we want). Additionally, + avoid calling status() on the paths containing dot and dot-dot elements + during the weakly_canonical execution for the same reason - the "\\?\" + prefix disables most of the path processing in Windows APIs, including + dot and dot-dot elements resolution. + + Fixes https://github.com/boostorg/filesystem/issues/247. + +diff --git a/libs/filesystem/src/operations.cpp b/libs/filesystem/src/operations.cpp +index dd636e9..ca2fff3 100644 +--- a/libs/filesystem/src/operations.cpp ++++ b/libs/filesystem/src/operations.cpp +@@ -4434,7 +4434,7 @@ path weakly_canonical(path const& p, path const& base, system::error_code* ec) + path head(p); + for (; !head.empty(); --itr) + { +- file_status head_status = detail::status_impl(head, &local_ec); ++ file_status head_status(detail::status_impl(head, &local_ec)); + if (BOOST_UNLIKELY(head_status.type() == fs::status_error)) + { + if (!ec) +@@ -4450,32 +4450,83 @@ path weakly_canonical(path const& p, path const& base, system::error_code* ec) + head.remove_filename(); + } + ++ if (head.empty()) ++ return p.lexically_normal(); ++ ++ path const& dot_p = dot_path(); ++ path const& dot_dot_p = dot_dot_path(); ++ + #else + +- // On Windows, filesystem APIs such as GetFileAttributesW perform lexical path normalization internally. +- // As a result, a path like "c:\a\.." can be reported as present even if "c:\a" is not. This would break +- // canonical, as symlink_status that it calls internally would report an error that the file at the intermediate +- // path does not exist. To avoid this, scan the initial path in the forward direction. +- // Also, operate on paths with preferred separators. This can be important on Windows since GetFileAttributesW, +- // which is called in status() may return "file not found" for paths to network shares and mounted cloud +- // storages that have forward slashes as separators. ++ // On Windows, filesystem APIs such as GetFileAttributesW and CreateFileW perform lexical path normalization ++ // internally. As a result, a path like "c:\a\.." can be reported as present even if "c:\a" is not. This would ++ // break canonical, as symlink_status that it calls internally would report an error that the file at the ++ // intermediate path does not exist. To avoid this, scan the initial path in the forward direction. ++ // Also, operate on paths with preferred separators. This can be important on Windows since GetFileAttributesW ++ // or CreateFileW, which is called in status() may return "file not found" for paths to network shares and ++ // mounted cloud storages that have forward slashes as separators. ++ // Also, avoid querying status of the root name such as \\?\c: as CreateFileW returns ERROR_INVALID_FUNCTION for ++ // such path. Querying the status of a root name such as c: is also not right as this path refers to the current ++ // directory on drive C:, which is not what we want to test for existence anyway. + path::iterator itr(p.begin()); + path head; +- for (; itr != p_end; ++itr) ++ if (p.has_root_name()) + { +- path const& p_elem = *itr; +- if (p_elem.size() == 1u && detail::is_directory_separator(p_elem.native()[0])) ++ BOOST_ASSERT(itr != p_end); ++ head = *itr; ++ ++itr; ++ } ++ ++ if (p.has_root_directory()) ++ { ++ BOOST_ASSERT(itr != p_end); ++ // Convert generic separator returned by the iterator for the root directory to ++ // the preferred separator. ++ head += path::preferred_separator; ++ ++itr; ++ } ++ ++ if (!head.empty()) ++ { ++ file_status head_status(detail::status_impl(head, &local_ec)); ++ if (BOOST_UNLIKELY(head_status.type() == fs::status_error)) + { +- // Convert generic separator returned by the iterator for the root directory to +- // the preferred separator. +- head += path::preferred_separator; ++ if (!ec) ++ BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::weakly_canonical", head, local_ec)); ++ ++ *ec = local_ec; ++ return path(); + } +- else ++ ++ if (head_status.type() == fs::file_not_found) ++ { ++ // If the root path does not exist then no path element exists ++ return p.lexically_normal(); ++ } ++ } ++ ++ path const& dot_p = dot_path(); ++ path const& dot_dot_p = dot_dot_path(); ++ for (; itr != p_end; ++itr) ++ { ++ path const& p_elem = *itr; ++ ++ // Avoid querying status of paths containing dot and dot-dot elements, as this will break ++ // if the root name starts with "\\?\". ++ if (p_elem == dot_p) ++ continue; ++ ++ if (p_elem == dot_dot_p) + { +- head /= p_elem; ++ if (head.has_relative_path()) ++ head.remove_filename(); ++ ++ continue; + } + +- file_status head_status = detail::status_impl(head, &local_ec); ++ head /= p_elem; ++ ++ file_status head_status(detail::status_impl(head, &local_ec)); + if (BOOST_UNLIKELY(head_status.type() == fs::status_error)) + { + if (!ec) +@@ -4492,33 +4543,22 @@ path weakly_canonical(path const& p, path const& base, system::error_code* ec) + } + } + ++ if (head.empty()) ++ return p.lexically_normal(); ++ + #endif + +- path const& dot_p = dot_path(); +- path const& dot_dot_p = dot_dot_path(); + path tail; + bool tail_has_dots = false; + for (; itr != p_end; ++itr) + { + path const& tail_elem = *itr; +-#if defined(BOOST_WINDOWS_API) +- if (tail_elem.size() == 1u && detail::is_directory_separator(tail_elem.native()[0])) +- { +- // Convert generic separator returned by the iterator for the root directory to +- // the preferred separator. +- tail += path::preferred_separator; +- continue; +- } +-#endif + tail /= tail_elem; + // for a later optimization, track if any dot or dot-dot elements are present + if (!tail_has_dots && (tail_elem == dot_p || tail_elem == dot_dot_p)) + tail_has_dots = true; + } + +- if (head.empty()) +- return p.lexically_normal(); +- + head = detail::canonical(head, base, &local_ec); + if (BOOST_UNLIKELY(!!local_ec)) + { diff --git a/recipes/boost/all/patches/1.80.0-0003-unordered-valid-after-move.patch b/recipes/boost/all/patches/1.80.0-0003-unordered-valid-after-move.patch new file mode 100644 index 0000000000000..4245f23e76299 --- /dev/null +++ b/recipes/boost/all/patches/1.80.0-0003-unordered-valid-after-move.patch @@ -0,0 +1,175 @@ +diff -urN a/boost/unordered/detail/fca.hpp b/boost/unordered/detail/fca.hpp +--- a/boost/unordered/detail/fca.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ b/boost/unordered/detail/fca.hpp 2022-08-24 19:44:43.139787681 -0400 +@@ -646,7 +646,7 @@ + + size_type bucket_count() const { return size_; } + +- iterator begin() const { return ++at(size_); } ++ iterator begin() const { return size_ == 0 ? end() : ++at(size_); } + + iterator end() const + { +@@ -660,6 +660,10 @@ + + local_iterator begin(size_type n) const + { ++ if (size_ == 0) { ++ return this->end(n); ++ } ++ + return local_iterator( + (buckets + static_cast(n))->next); + } +@@ -670,12 +674,16 @@ + + iterator at(size_type n) const + { +- std::size_t const N = group::N; ++ if (size_ > 0) { ++ std::size_t const N = group::N; + +- iterator pbg(buckets + static_cast(n), +- groups + static_cast(n / N)); ++ iterator pbg(buckets + static_cast(n), ++ groups + static_cast(n / N)); + +- return pbg; ++ return pbg; ++ } else { ++ return this->end(); ++ } + } + + span raw() +diff -urN a/boost/unordered/detail/implementation.hpp b/boost/unordered/detail/implementation.hpp +--- a/boost/unordered/detail/implementation.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ b/boost/unordered/detail/implementation.hpp 2022-08-24 19:44:43.139787681 -0400 +@@ -2054,12 +2054,14 @@ + + std::size_t bucket_size(std::size_t index) const + { +- bucket_iterator itb = buckets_.at(index); +- node_pointer n = itb->next; + std::size_t count = 0; +- while (n) { +- ++count; +- n = n->next; ++ if (size_ > 0) { ++ bucket_iterator itb = buckets_.at(index); ++ node_pointer n = itb->next; ++ while (n) { ++ ++count; ++ n = n->next; ++ } + } + return count; + } +@@ -2420,11 +2422,14 @@ + node_pointer find_node_impl( + Key const& x, bucket_iterator itb) const + { +- key_equal const& pred = this->key_eq(); +- node_pointer p = itb->next; +- for (; p; p = p->next) { +- if (pred(x, extractor::extract(p->value()))) { +- break; ++ node_pointer p = node_pointer(); ++ if (itb != buckets_.end()) { ++ key_equal const& pred = this->key_eq(); ++ p = itb->next; ++ for (; p; p = p->next) { ++ if (pred(x, extractor::extract(p->value()))) { ++ break; ++ } + } + } + return p; +@@ -2453,11 +2458,13 @@ + inline iterator transparent_find( + Key const& k, Hash const& h, Pred const& pred) const + { +- std::size_t const key_hash = h(k); +- bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); +- for (node_pointer p = itb->next; p; p = p->next) { +- if (BOOST_LIKELY(pred(k, extractor::extract(p->value())))) { +- return iterator(p, itb); ++ if (size_ > 0) { ++ std::size_t const key_hash = h(k); ++ bucket_iterator itb = buckets_.at(buckets_.position(key_hash)); ++ for (node_pointer p = itb->next; p; p = p->next) { ++ if (BOOST_LIKELY(pred(k, extractor::extract(p->value())))) { ++ return iterator(p, itb); ++ } + } + } + +@@ -2467,11 +2474,13 @@ + template + node_pointer* find_prev(Key const& key, bucket_iterator itb) + { +- key_equal pred = this->key_eq(); +- for (node_pointer* pp = boost::addressof(itb->next); *pp; +- pp = boost::addressof((*pp)->next)) { +- if (pred(key, extractor::extract((*pp)->value()))) { +- return pp; ++ if (size_ > 0) { ++ key_equal pred = this->key_eq(); ++ for (node_pointer* pp = boost::addressof(itb->next); *pp; ++ pp = boost::addressof((*pp)->next)) { ++ if (pred(key, extractor::extract((*pp)->value()))) { ++ return pp; ++ } + } + } + typedef node_pointer* node_pointer_pointer; +diff -urN a/boost/unordered/unordered_map.hpp b/boost/unordered/unordered_map.hpp +--- a/boost/unordered/unordered_map.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ b/boost/unordered/unordered_map.hpp 2022-08-24 19:44:43.139787681 -0400 +@@ -2069,6 +2069,10 @@ + template + float unordered_map::load_factor() const BOOST_NOEXCEPT + { ++ if (table_.size_ == 0) { ++ return 0.0f; ++ } ++ + BOOST_ASSERT(table_.bucket_count() != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count()); +@@ -2506,6 +2510,10 @@ + template + float unordered_multimap::load_factor() const BOOST_NOEXCEPT + { ++ if (table_.size_ == 0) { ++ return 0.0f; ++ } ++ + BOOST_ASSERT(table_.bucket_count() != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count()); +diff -urN a/boost/unordered/unordered_set.hpp b/boost/unordered/unordered_set.hpp +--- a/boost/unordered/unordered_set.hpp 2022-08-03 22:47:16.000000000 -0400 ++++ b/boost/unordered/unordered_set.hpp 2022-08-24 19:44:43.139787681 -0400 +@@ -1586,6 +1586,10 @@ + template + float unordered_set::load_factor() const BOOST_NOEXCEPT + { ++ if (table_.size_ == 0) { ++ return 0.0f; ++ } ++ + BOOST_ASSERT(table_.bucket_count() != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count()); +@@ -1986,6 +1990,10 @@ + template + float unordered_multiset::load_factor() const BOOST_NOEXCEPT + { ++ if (table_.size_ == 0) { ++ return 0.0f; ++ } ++ + BOOST_ASSERT(table_.bucket_count() != 0); + return static_cast(table_.size_) / + static_cast(table_.bucket_count()); diff --git a/recipes/boost/all/patches/1.80.0-0004-filesystem-posix-fix-no-at-apis-missing-include.patch b/recipes/boost/all/patches/1.80.0-0004-filesystem-posix-fix-no-at-apis-missing-include.patch new file mode 100644 index 0000000000000..dfa4438d93acd --- /dev/null +++ b/recipes/boost/all/patches/1.80.0-0004-filesystem-posix-fix-no-at-apis-missing-include.patch @@ -0,0 +1,21 @@ +commit 5864f397ccad30f6e73221b90bdac57a303b9752 +Author: Andrey Semashev +Date: Fri Aug 12 12:59:56 2022 +0300 + + Fixed a missing include on POSIX systems that don't support *at APIs. + + Fixes https://github.com/boostorg/filesystem/issues/250. + +diff --git a/libs/filesystem/src/operations.cpp b/libs/filesystem/src/operations.cpp +index ca2fff3..e22967e 100644 +--- a/libs/filesystem/src/operations.cpp ++++ b/libs/filesystem/src/operations.cpp +@@ -70,7 +70,7 @@ + + #include + #include +-#if _POSIX_C_SOURCE < 200809L ++#if !defined(BOOST_FILESYSTEM_HAS_POSIX_AT_APIS) + #include + #endif + #include diff --git a/recipes/boost/all/patches/1.80.0-locale-fail-on-missing-backend.patch b/recipes/boost/all/patches/1.80.0-locale-fail-on-missing-backend.patch new file mode 100644 index 0000000000000..e352396226710 --- /dev/null +++ b/recipes/boost/all/patches/1.80.0-locale-fail-on-missing-backend.patch @@ -0,0 +1,84 @@ +diff --git a/libs/locale/build/Jamfile.v2 b/libs/locale/build/Jamfile.v2 +index 3c517c884..0f521dbcf 100644 +--- a/libs/locale/build/Jamfile.v2 ++++ b/libs/locale/build/Jamfile.v2 +@@ -20,6 +20,7 @@ project /boost/locale + # Features + + feature.feature boost.locale.iconv : on off : optional propagated ; ++feature.feature boost.locale.iconv.lib : libc libiconv : optional propagated ; + feature.feature boost.locale.icu : on off : optional propagated ; + feature.feature boost.locale.posix : on off : optional propagated ; + feature.feature boost.locale.std : on off : optional propagated ; +@@ -29,7 +30,8 @@ feature.feature boost.locale.winapi : on off : optional propagated ; + + ## iconv + +-exe has_iconv : $(TOP)/build/has_iconv.cpp ; ++obj has_iconv_libc_obj : $(TOP)/build/has_iconv.cpp ; ++exe has_iconv : has_iconv_libc_obj ; + explicit has_iconv ; + + ICONV_PATH = [ modules.peek : ICONV_PATH ] ; +@@ -43,7 +45,8 @@ lib iconv + + explicit iconv ; + +-exe has_external_iconv : $(TOP)/build/has_iconv.cpp iconv ; ++obj has_iconv_libc_ext : $(TOP)/build/has_iconv.cpp iconv ; ++exe has_external_iconv : has_iconv_libc_ext iconv ; + explicit has_external_iconv ; + + exe accepts_shared_option : $(TOP)/build/option.cpp +@@ -230,10 +233,37 @@ rule configure-full ( properties * : flags-only ) + if [ configure.builds has_iconv : $(properties) : "iconv (libc)" ] + { + found-iconv = true ; +- } else if [ configure.builds has_external_iconv : $(properties) : "iconv (separate)" ] ++ if libiconv in $(properties) ++ { ++ if [ configure.builds has_external_iconv : $(properties) : "iconv (separate)" ] ++ { ++ result += iconv ; ++ } ++ else ++ { ++ EXIT "- Boost.Locale found iconv (libc) instead of iconv (separate) library to be built." ; ++ } ++ } ++ } ++ else if libc in $(properties) + { +- found-iconv = true ; +- result += iconv ; ++ EXIT "- Boost.Locale failed to find iconv (libc) library to be built." ; ++ } ++ else ++ { ++ if [ configure.builds has_external_iconv : $(properties) : "iconv (separate)" ] ++ { ++ found-iconv = true ; ++ result += iconv ; ++ } ++ else if libiconv in $(properties) ++ { ++ EXIT "- Boost.Locale failed to find iconv (separate) library to be built." ; ++ } ++ } ++ if ! $(found-iconv) ++ { ++ EXIT "- Boost.Locale failed to find iconv library to be built." ; + } + } + if $(found-iconv) +@@ -273,6 +303,10 @@ rule configure-full ( properties * : flags-only ) + /boost/thread//boost_thread + ; + } ++ else ++ { ++ EXIT "- Boost.Locale failed to find ICU library to be built." ; ++ } + } + + if ! $(found-iconv) && ! $(found-icu) && ! windows in $(properties) && ! cygwin in $(properties) diff --git a/recipes/boost/all/patches/1.81.0-locale-fail-on-missing-backend.patch b/recipes/boost/all/patches/1.81.0-locale-fail-on-missing-backend.patch new file mode 100644 index 0000000000000..80b22dd54b0e1 --- /dev/null +++ b/recipes/boost/all/patches/1.81.0-locale-fail-on-missing-backend.patch @@ -0,0 +1,12 @@ +diff --git a/libs/locale/build/Jamfile.v2 b/libs/locale/build/Jamfile.v2 +index f1321db3..36899cdc 100644 +--- a/libs/locale/build/Jamfile.v2 ++++ b/libs/locale/build/Jamfile.v2 +@@ -22,6 +22,7 @@ project /boost/locale + # Features + + feature.feature boost.locale.iconv : on off : optional propagated ; ++feature.feature boost.locale.iconv.lib : libc libiconv : optional propagated ; + feature.feature boost.locale.icu : on off : optional propagated ; + feature.feature boost.locale.posix : on off : optional propagated ; + feature.feature boost.locale.std : on off : optional propagated ; diff --git a/recipes/boost/all/rebuild-dependencies.py b/recipes/boost/all/rebuild-dependencies.py index 0ad4028e797b3..05a14b8375a05 100755 --- a/recipes/boost/all/rebuild-dependencies.py +++ b/recipes/boost/all/rebuild-dependencies.py @@ -55,6 +55,7 @@ "thread", "timer", "type_erasure", + "url", "wave", ) diff --git a/recipes/boost/all/test_package/CMakeLists.txt b/recipes/boost/all/test_package/CMakeLists.txt index 0a03121f75920..769ce4cdc3ba2 100644 --- a/recipes/boost/all/test_package/CMakeLists.txt +++ b/recipes/boost/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +enable_testing() if(BOOST_NAMESPACE) add_definitions("-DBOOST_NAMESPACE=${BOOST_NAMESPACE}") @@ -13,30 +12,35 @@ if(NOT HEADER_ONLY) find_package(Boost COMPONENTS random REQUIRED) add_executable(random_exe random.cpp) target_link_libraries(random_exe PRIVATE Boost::random) + add_test(NAME boost_random COMMAND random_exe) endif() if(WITH_REGEX) find_package(Boost COMPONENTS regex REQUIRED) add_executable(regex_exe regex.cpp) target_link_libraries(regex_exe PRIVATE Boost::regex) + add_test(NAME boost_regex COMMAND regex_exe) endif() if(WITH_TEST) find_package(Boost COMPONENTS unit_test_framework REQUIRED) add_executable(test_exe test.cpp) target_link_libraries(test_exe PRIVATE Boost::unit_test_framework) + add_test(NAME boost_test COMMAND test_exe) endif() if(WITH_COROUTINE) find_package(Boost COMPONENTS coroutine REQUIRED) add_executable(coroutine_exe coroutine.cpp) target_link_libraries(coroutine_exe PRIVATE Boost::coroutine) + add_test(NAME coroutine_test COMMAND coroutine_exe) endif() if(WITH_CHRONO) find_package(Boost COMPONENTS chrono REQUIRED) add_executable(chrono_exe chrono.cpp) target_link_libraries(chrono_exe PRIVATE Boost::chrono) + add_test(NAME chrono_test COMMAND chrono_exe) endif() if(WITH_FIBER) @@ -44,6 +48,7 @@ if(NOT HEADER_ONLY) add_executable(fiber_exe fiber.cpp) target_link_libraries(fiber_exe PRIVATE Boost::fiber) set_property(TARGET fiber_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_fiber COMMAND fiber_exe) endif() if(WITH_JSON) @@ -51,6 +56,7 @@ if(NOT HEADER_ONLY) add_executable(json_exe json.cpp) target_link_libraries(json_exe PRIVATE Boost::json) set_property(TARGET json_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_json COMMAND json_exe) endif() if(WITH_NOWIDE) @@ -58,12 +64,14 @@ if(NOT HEADER_ONLY) add_executable(nowide_exe nowide.cpp) target_link_libraries(nowide_exe PRIVATE Boost::nowide) set_property(TARGET nowide_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_nowide COMMAND nowide_exe ${CMAKE_CURRENT_SOURCE_DIR}/conanfile.py) endif() if(WITH_LOCALE) find_package(Boost COMPONENTS locale REQUIRED) add_executable(locale_exe locale.cpp) target_link_libraries(locale_exe PRIVATE Boost::locale) + add_test(NAME boost_locale COMMAND locale_exe) endif() if(WITH_STACKTRACE_ADDR2LINE) @@ -71,12 +79,14 @@ if(NOT HEADER_ONLY) add_executable(stacktrace_addr2line_exe stacktrace.cpp) target_compile_definitions(stacktrace_addr2line_exe PRIVATE TEST_STACKTRACE_IMPL=1) target_link_libraries(stacktrace_addr2line_exe PRIVATE Boost::stacktrace_addr2line) + add_test(NAME boost_stacktrace_addr2line COMMAND stacktrace_addr2line_exe) endif() if(WITH_STACKTRACE_BACKTRACE) add_executable(stacktrace_backtrace_exe stacktrace.cpp) target_compile_definitions(stacktrace_backtrace_exe PRIVATE TEST_STACKTRACE_IMPL=2) target_link_libraries(stacktrace_backtrace_exe PRIVATE Boost::stacktrace_backtrace) + add_test(NAME boost_stacktrace_backtrace COMMAND stacktrace_backtrace_exe) endif() if(WITH_STACKTRACE) @@ -85,19 +95,23 @@ if(NOT HEADER_ONLY) add_executable(stacktrace_noop_exe stacktrace.cpp) target_compile_definitions(stacktrace_noop_exe PRIVATE TEST_STACKTRACE_IMPL=4) target_link_libraries(stacktrace_noop_exe PRIVATE Boost::stacktrace_noop) + add_test(NAME boost_stacktrace_noop COMMAND stacktrace_noop_exe) if(WIN32) add_executable(stacktrace_windbg_exe stacktrace.cpp) target_compile_definitions(stacktrace_windbg_exe PRIVATE TEST_STACKTRACE_IMPL=5) target_link_libraries(stacktrace_windbg_exe PRIVATE Boost::stacktrace_windbg) + add_test(NAME boost_stacktrace_windbg COMMAND stacktrace_windbg_exe) add_executable(stacktrace_windbg_cached_exe stacktrace.cpp) target_compile_definitions(stacktrace_windbg_cached_exe PRIVATE TEST_STACKTRACE_IMPL=6) target_link_libraries(stacktrace_windbg_cached_exe PRIVATE Boost::stacktrace_windbg_cached) + add_test(NAME boost_stacktrace_windbg_cached COMMAND stacktrace_windbg_cached_exe) else() add_executable(stacktrace_basic_exe stacktrace.cpp) target_compile_definitions(stacktrace_basic_exe PRIVATE TEST_STACKTRACE_IMPL=3) target_link_libraries(stacktrace_basic_exe PRIVATE Boost::stacktrace_basic) + add_test(NAME boost_stacktrace_basic COMMAND stacktrace_basic_exe) endif() endif() @@ -106,22 +120,33 @@ if(NOT HEADER_ONLY) add_library(hello_ext MODULE python.cpp) set_property(TARGET hello_ext PROPERTY PREFIX "") - find_package(PythonInterp REQUIRED) - find_package(PythonLibs REQUIRED) + find_package(Python ${PYTHON_VERSION_TO_SEARCH} COMPONENTS Interpreter Development NumPy REQUIRED) - target_include_directories(hello_ext PRIVATE ${PYTHON_INCLUDE_DIRS}) - target_link_libraries(hello_ext PRIVATE Boost::python${PYTHON_COMPONENT_SUFFIX} ${PYTHON_LIBRARIES}) + target_link_libraries(hello_ext PRIVATE Boost::python Python::Python) if(WIN32) set_target_properties(hello_ext PROPERTIES SUFFIX ".pyd") endif() + add_test(NAME boost_python COMMAND Python::Interpreter "${CMAKE_CURRENT_SOURCE_DIR}/python.py") + set_property(TEST boost_python PROPERTY ENVIRONMENT "PYTHONPATH=$") add_executable(numpy_exe numpy.cpp) - target_include_directories(numpy_exe PRIVATE ${PYTHON_INCLUDE_DIRS}) - target_link_libraries(numpy_exe PRIVATE Boost::numpy${PYTHON_COMPONENT_SUFFIX} ${PYTHON_LIBRARIES}) + target_link_libraries(numpy_exe PRIVATE Boost::numpy Python::Python Python::NumPy) + add_test(NAME boost_numpy COMMAND numpy_exe) + set_property(TEST boost_numpy PROPERTY ENVIRONMENT "PYTHONPATH=${Python_SITELIB}") endif() + + if(WITH_URL) + find_package(Boost COMPONENTS url REQUIRED) + add_executable(url_exe url.cpp) + target_link_libraries(url_exe PRIVATE Boost::url) + set_property(TARGET url_exe PROPERTY CXX_STANDARD 11) + add_test(NAME boost_url COMMAND url_exe) + endif() + endif() # Test header-only target find_package(Boost REQUIRED) add_executable(lambda_exe lambda.cpp) target_link_libraries(lambda_exe PRIVATE Boost::headers) +add_test(NAME boost_boost COMMAND lambda_exe) diff --git a/recipes/boost/all/test_package/conanfile.py b/recipes/boost/all/test_package/conanfile.py index 54e431f7b3b68..66ee2b0e2d276 100644 --- a/recipes/boost/all/test_package/conanfile.py +++ b/recipes/boost/all/test_package/conanfile.py @@ -1,94 +1,62 @@ -import os - -from conan.tools.build import cross_building -from conans import ConanFile, CMake, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.errors import ConanException +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import chdir +from conan.tools.scm import Version class TestPackageConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - generators = "cmake", "cmake_find_package" - - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - self.build_requires("cmake/3.20.1") + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def _boost_option(self, name, default): try: - return getattr(self.options["boost"], name, default) + return getattr(self.dependencies["boost"].options, name, default) except (AttributeError, ConanException): return default + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["HEADER_ONLY"] = self.dependencies["boost"].options.header_only + if not self.dependencies["boost"].options.header_only: + tc.cache_variables["Boost_USE_STATIC_LIBS"] = not self.dependencies["boost"].options.shared + tc.cache_variables["WITH_PYTHON"] = not self.dependencies["boost"].options.without_python + if not self.dependencies["boost"].options.without_python: + pyversion = self.dependencies["boost"].options.python_version + tc.cache_variables["PYTHON_VERSION_TO_SEARCH"] = pyversion + tc.cache_variables["Python_EXECUTABLE"] = self.dependencies["boost"].options.python_executable + tc.cache_variables["WITH_RANDOM"] = not self.dependencies["boost"].options.without_random + tc.cache_variables["WITH_REGEX"] = not self.dependencies["boost"].options.without_regex + tc.cache_variables["WITH_TEST"] = not self.dependencies["boost"].options.without_test + tc.cache_variables["WITH_COROUTINE"] = not self.dependencies["boost"].options.without_coroutine + tc.cache_variables["WITH_CHRONO"] = not self.dependencies["boost"].options.without_chrono + tc.cache_variables["WITH_FIBER"] = not self.dependencies["boost"].options.without_fiber + tc.cache_variables["WITH_LOCALE"] = not self.dependencies["boost"].options.without_locale + tc.cache_variables["WITH_NOWIDE"] = not self._boost_option("without_nowide", True) + tc.cache_variables["WITH_JSON"] = not self._boost_option("without_json", True) + tc.cache_variables["WITH_STACKTRACE"] = not self.dependencies["boost"].options.without_stacktrace + tc.cache_variables["WITH_STACKTRACE_ADDR2LINE"] = self.dependencies["boost"].conf_info.get("user.boost:stacktrace_addr2line_available") + tc.cache_variables["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False) + tc.cache_variables["WITH_URL"] = not self._boost_option("without_url", True) + if self.dependencies["boost"].options.namespace != 'boost' and not self.dependencies["boost"].options.namespace_alias: + tc.cache_variables['BOOST_NAMESPACE'] = self.dependencies["boost"].options.namespace + tc.generate() + def build(self): - # FIXME: tools.vcvars added for clang-cl. Remove once conan supports clang-cl properly. (https://github.com/conan-io/conan-center-index/pull/1453) - with tools.vcvars(self.settings) if (self.settings.os == "Windows" and self.settings.compiler == "clang") else tools.no_op(): - cmake = CMake(self) - cmake.definitions["HEADER_ONLY"] = self.options["boost"].header_only - if not self.options["boost"].header_only: - cmake.definitions["Boost_USE_STATIC_LIBS"] = not self.options["boost"].shared - cmake.definitions["WITH_PYTHON"] = not self.options["boost"].without_python - if not self.options["boost"].without_python: - pyversion = tools.Version(self.options["boost"].python_version) - cmake.definitions["Python_ADDITIONAL_VERSIONS"] = "{}.{}".format(pyversion.major, pyversion.minor) - cmake.definitions["PYTHON_COMPONENT_SUFFIX"] = "{}{}".format(pyversion.major, pyversion.minor) - cmake.definitions["WITH_RANDOM"] = not self.options["boost"].without_random - cmake.definitions["WITH_REGEX"] = not self.options["boost"].without_regex - cmake.definitions["WITH_TEST"] = not self.options["boost"].without_test - cmake.definitions["WITH_COROUTINE"] = not self.options["boost"].without_coroutine - cmake.definitions["WITH_CHRONO"] = not self.options["boost"].without_chrono - cmake.definitions["WITH_FIBER"] = not self.options["boost"].without_fiber - cmake.definitions["WITH_LOCALE"] = not self.options["boost"].without_locale - cmake.definitions["WITH_NOWIDE"] = not self._boost_option("without_nowide", True) - cmake.definitions["WITH_JSON"] = not self._boost_option("without_json", True) - cmake.definitions["WITH_STACKTRACE"] = not self.options["boost"].without_stacktrace - cmake.definitions["WITH_STACKTRACE_ADDR2LINE"] = self.deps_user_info["boost"].stacktrace_addr2line_available - cmake.definitions["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False) - if self.options["boost"].namespace != 'boost' and not self.options["boost"].namespace_alias: - cmake.definitions['BOOST_NAMESPACE'] = self.options["boost"].namespace - cmake.configure() - # Disable parallel builds because c3i (=conan-center's test/build infrastructure) seems to choke here - cmake.parallel = False - cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): - if cross_building(self): - return - self.run(os.path.join("bin", "lambda_exe"), run_environment=True) - if self.options["boost"].header_only: + if not can_run(self): return - if not self.options["boost"].without_random: - self.run(os.path.join("bin", "random_exe"), run_environment=True) - if not self.options["boost"].without_regex: - self.run(os.path.join("bin", "regex_exe"), run_environment=True) - if not self.options["boost"].without_test: - self.run(os.path.join("bin", "test_exe"), run_environment=True) - if not self.options["boost"].without_coroutine: - self.run(os.path.join("bin", "coroutine_exe"), run_environment=True) - if not self.options["boost"].without_chrono: - self.run(os.path.join("bin", "chrono_exe"), run_environment=True) - if not self.options["boost"].without_fiber: - self.run(os.path.join("bin", "fiber_exe"), run_environment=True) - if not self.options["boost"].without_locale: - self.run(os.path.join("bin", "locale_exe"), run_environment=True) - if not self._boost_option("without_nowide", True): - self.run("{} {}".format(os.path.join("bin", "nowide_exe"), os.path.join(self.source_folder, "conanfile.py")), run_environment=True) - if not self._boost_option("without_json", True): - self.run(os.path.join("bin", "json_exe"), run_environment=True) - if not self.options["boost"].without_python: - with tools.environment_append({"PYTHONPATH": "{}:{}".format("bin", "lib")}): - self.run("{} {}".format(self.options["boost"].python_executable, os.path.join(self.source_folder, "python.py")), run_environment=True) - self.run(os.path.join("bin", "numpy_exe"), run_environment=True) - if not self.options["boost"].without_stacktrace: - self.run(os.path.join("bin", "stacktrace_noop_exe"), run_environment=True) - if str(self.deps_user_info["boost"].stacktrace_addr2line_available) == "True": - self.run(os.path.join("bin", "stacktrace_addr2line_exe"), run_environment=True) - if self.settings.os == "Windows": - self.run(os.path.join("bin", "stacktrace_windbg_exe"), run_environment=True) - self.run(os.path.join("bin", "stacktrace_windbg_cached_exe"), run_environment=True) - else: - self.run(os.path.join("bin", "stacktrace_basic_exe"), run_environment=True) - if self._boost_option("with_stacktrace_backtrace", False): - self.run(os.path.join("bin", "stacktrace_backtrace_exe"), run_environment=True) + with chdir(self, self.folders.build_folder): + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun") diff --git a/recipes/boost/all/test_package/url.cpp b/recipes/boost/all/test_package/url.cpp new file mode 100644 index 0000000000000..dd65390f85c35 --- /dev/null +++ b/recipes/boost/all/test_package/url.cpp @@ -0,0 +1,14 @@ +// +// Copyright (c) 2022 alandefreitas (alandefreitas@gmail.com) +// +// Distributed under the Boost Software License, Version 1.0. +// https://www.boost.org/LICENSE_1_0.txt +// + +#include +#include + +int main() { + assert(sizeof(boost::urls::url) > 0); + return 0; +} diff --git a/recipes/boost/all/test_v1_package/CMakeLists.txt b/recipes/boost/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..c23ed5cfe6d98 --- /dev/null +++ b/recipes/boost/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_v1_package) + +enable_testing() + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/boost/all/test_v1_package/conanfile.py b/recipes/boost/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4bdbddf498bcc --- /dev/null +++ b/recipes/boost/all/test_v1_package/conanfile.py @@ -0,0 +1,52 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanException +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def _boost_option(self, name, default): + try: + return getattr(self.options["boost"], name, default) + except (AttributeError, ConanException): + return default + + def build(self): + # FIXME: tools.vcvars added for clang-cl. Remove once conan supports clang-cl properly. (https://github.com/conan-io/conan-center-index/pull/1453) + with tools.vcvars(self.settings) if (self.settings.os == "Windows" and self.settings.compiler == "clang") else tools.no_op(): + cmake = CMake(self) + cmake.definitions["HEADER_ONLY"] = self.options["boost"].header_only + if not self.options["boost"].header_only: + cmake.definitions["Boost_USE_STATIC_LIBS"] = not self.options["boost"].shared + cmake.definitions["WITH_PYTHON"] = not self.options["boost"].without_python + if not self.options["boost"].without_python: + pyversion = tools.Version(self.options["boost"].python_version) + cmake.definitions["PYTHON_VERSION_TO_SEARCH"] = pyversion + cmake.definitions["Python_EXECUTABLE"] = self.options["boost"].python_executable + cmake.definitions["WITH_RANDOM"] = not self.options["boost"].without_random + cmake.definitions["WITH_REGEX"] = not self.options["boost"].without_regex + cmake.definitions["WITH_TEST"] = not self.options["boost"].without_test + cmake.definitions["WITH_COROUTINE"] = not self.options["boost"].without_coroutine + cmake.definitions["WITH_CHRONO"] = not self.options["boost"].without_chrono + cmake.definitions["WITH_FIBER"] = not self.options["boost"].without_fiber + cmake.definitions["WITH_LOCALE"] = not self.options["boost"].without_locale + cmake.definitions["WITH_NOWIDE"] = not self._boost_option("without_nowide", True) + cmake.definitions["WITH_JSON"] = not self._boost_option("without_json", True) + cmake.definitions["WITH_STACKTRACE"] = not self.options["boost"].without_stacktrace + cmake.definitions["WITH_STACKTRACE_ADDR2LINE"] = self.deps_user_info["boost"].stacktrace_addr2line_available + cmake.definitions["WITH_STACKTRACE_BACKTRACE"] = self._boost_option("with_stacktrace_backtrace", False) + cmake.definitions["WITH_URL"] = not self._boost_option("without_url", True) + if self.options["boost"].namespace != 'boost' and not self.options["boost"].namespace_alias: + cmake.definitions['BOOST_NAMESPACE'] = self.options["boost"].namespace + cmake.configure() + # Disable parallel builds because c3i (=conan-center's test/build infrastructure) seems to choke here + cmake.parallel = False + cmake.build() + + def test(self): + if tools.cross_building(self): + return + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", run_environment=True) + diff --git a/recipes/boost/config.yml b/recipes/boost/config.yml index a68be93f2ddb0..76bc4f6280af1 100644 --- a/recipes/boost/config.yml +++ b/recipes/boost/config.yml @@ -1,21 +1,25 @@ versions: - 1.70.0: - folder: all - 1.71.0: - folder: all - 1.72.0: - folder: all - 1.73.0: - folder: all - 1.74.0: - folder: all - 1.75.0: - folder: all - 1.76.0: - folder: all - 1.77.0: - folder: all - 1.78.0: - folder: all - 1.79.0: - folder: all + "1.81.0": + folder: all + "1.80.0": + folder: all + "1.79.0": + folder: all + "1.78.0": + folder: all + "1.77.0": + folder: all + "1.76.0": + folder: all + "1.75.0": + folder: all + "1.74.0": + folder: all + "1.73.0": + folder: all + "1.72.0": + folder: all + "1.71.0": + folder: all + "1.70.0": + folder: all diff --git a/recipes/botan/all/conandata.yml b/recipes/botan/all/conandata.yml index 18a9351b51417..b4fd5502f1bd3 100644 --- a/recipes/botan/all/conandata.yml +++ b/recipes/botan/all/conandata.yml @@ -41,6 +41,9 @@ sources: "2.19.2": url: "https://github.com/randombit/botan/archive/2.19.2.tar.gz" sha256: "47bb0330255cf1a439db3f2bc91894b2f41788e58eb71d27e0abf36038d93f1e" + "2.19.3": + url: "https://github.com/randombit/botan/archive/2.19.3.tar.gz" + sha256: "8f568bf74c2e476d92ac8a1cfc2ba8407ec038fe9458bd0a11e7da827a9b8199" patches: "2.12.1": - patch_file: "patches/dll-dir.patch" diff --git a/recipes/botan/config.yml b/recipes/botan/config.yml index 46709103405fc..7fdc77ee53c3b 100644 --- a/recipes/botan/config.yml +++ b/recipes/botan/config.yml @@ -27,3 +27,5 @@ versions: folder: all "2.19.2": folder: all + "2.19.3": + folder: all diff --git a/recipes/box2d/2.4.x/CMakeLists.txt b/recipes/box2d/2.4.x/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/box2d/2.4.x/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/box2d/2.4.x/conandata.yml b/recipes/box2d/2.4.x/conandata.yml index 3e9aef1571a09..c7372e2a8f037 100644 --- a/recipes/box2d/2.4.x/conandata.yml +++ b/recipes/box2d/2.4.x/conandata.yml @@ -7,5 +7,4 @@ sources: sha256: "d6b4650ff897ee1ead27cf77a5933ea197cbeef6705638dd181adc2e816b23c2" patches: "2.4.0": - - patch_file: "patches/install-and-allow-shared.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-install-and-allow-shared.patch" diff --git a/recipes/box2d/2.4.x/conanfile.py b/recipes/box2d/2.4.x/conanfile.py index 0a37f41d13d33..ae09ce435deda 100644 --- a/recipes/box2d/2.4.x/conanfile.py +++ b/recipes/box2d/2.4.x/conanfile.py @@ -1,7 +1,10 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rm, rmdir, copy +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.scm import Version -required_conan_version = ">=1.29.1" +required_conan_version = ">=1.52.0" class Box2dConan(ConanFile): @@ -16,55 +19,53 @@ class Box2dConan(ConanFile): "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True,} - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("box2d-%s" % self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BOX2D_BUILD_TESTBED"] = False - self._cmake.definitions["BOX2D_BUILD_UNIT_TESTS"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.variables["BOX2D_BUILD_TESTBED"] = False + tc.variables["BOX2D_BUILD_UNIT_TESTS"] = False + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.configure() cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.pdb") + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.pdb", self.package_folder, recursive=True) def package_info(self): self.cpp_info.names["cmake_find_package"] = "box2d" self.cpp_info.names["cmake_find_package_multi"] = "box2d" self.cpp_info.libs = ["box2d"] - if tools.Version(self.version) >= "2.4.1" and self.options.shared: + if Version(self.version) >= "2.4.1" and self.options.shared: self.cpp_info.defines.append("B2_SHARED") diff --git a/recipes/box2d/2.4.x/patches/install-and-allow-shared.patch b/recipes/box2d/2.4.x/patches/0001-install-and-allow-shared.patch similarity index 100% rename from recipes/box2d/2.4.x/patches/install-and-allow-shared.patch rename to recipes/box2d/2.4.x/patches/0001-install-and-allow-shared.patch diff --git a/recipes/box2d/2.4.x/test_package/CMakeLists.txt b/recipes/box2d/2.4.x/test_package/CMakeLists.txt index 373fb5bb61846..fb4d8d7f5888a 100644 --- a/recipes/box2d/2.4.x/test_package/CMakeLists.txt +++ b/recipes/box2d/2.4.x/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(box2d REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/box2d/2.4.x/test_package/conanfile.py b/recipes/box2d/2.4.x/test_package/conanfile.py index 7513484720425..d1ce1a2cbc477 100644 --- a/recipes/box2d/2.4.x/test_package/conanfile.py +++ b/recipes/box2d/2.4.x/test_package/conanfile.py @@ -1,10 +1,19 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout class Box2DTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/box2d/2.4.x/test_v1_package/CMakeLists.txt b/recipes/box2d/2.4.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..373fb5bb61846 --- /dev/null +++ b/recipes/box2d/2.4.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(box2d REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} box2d::box2d) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/box2d/2.4.x/test_v1_package/conanfile.py b/recipes/box2d/2.4.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7513484720425 --- /dev/null +++ b/recipes/box2d/2.4.x/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class Box2DTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/box2d/2.4.x/test_v1_package/test_package.cpp b/recipes/box2d/2.4.x/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..7dfa813bc1d2e --- /dev/null +++ b/recipes/box2d/2.4.x/test_v1_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include "box2d/box2d.h" + +int main(void) { + b2Vec2 gravity(0.0f, -10.0f); + b2World world(gravity); + + b2BodyDef groundBodyDef; + groundBodyDef.position.Set(0.0f, -10.0f); + + b2Body* groundBody = world.CreateBody(&groundBodyDef); + b2PolygonShape groundBox; + groundBox.SetAsBox(50.0f, 10.0f); + + return 0; +} diff --git a/recipes/breakpad/all/conandata.yml b/recipes/breakpad/all/conandata.yml index ca1b1d96e427d..0037ecfc65960 100644 --- a/recipes/breakpad/all/conandata.yml +++ b/recipes/breakpad/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "cci.20210521": - patch_file: "patches/0001-Use_conans_lss.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-Remove-hardcoded-fpic.patch" - base_path: "source_subfolder" diff --git a/recipes/breakpad/all/conanfile.py b/recipes/breakpad/all/conanfile.py index 369681d6570ec..f4cdf5d9940e4 100644 --- a/recipes/breakpad/all/conanfile.py +++ b/recipes/breakpad/all/conanfile.py @@ -1,9 +1,12 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout import os -import textwrap -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" + class BreakpadConan(ConanFile): name = "breakpad" @@ -12,66 +15,67 @@ class BreakpadConan(ConanFile): license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://chromium.googlesource.com/breakpad/breakpad/" - settings = "os", "compiler", "build_type", "arch" - provides = "breakpad" - exports_sources = "patches/**" + + settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False] + "fPIC": [True, False], } default_options = { - "fPIC": True + "fPIC": True, } - _env_build = None - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) - def validate(self): - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("Breakpad can only be built on Linux. For other OSs check sentry-breakpad") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("linux-syscall-support/cci.20200813") - def _configure_autotools(self): - if not self._env_build: - self._env_build = AutoToolsBuildEnvironment(self) - self._env_build.configure(configure_dir=self._source_subfolder) - return self._env_build + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration("Breakpad can only be built on Linux. For other OSs check sentry-breakpad") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + # see https://github.com/conan-io/conan/issues/12020 + tc.configure_args.append("--libexecdir=${prefix}/bin") + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - env_build = self._configure_autotools() - env_build.make() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - env_build = self._configure_autotools() - env_build.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - def package_info( self ): + def package_info(self): + self.cpp_info.components["libbreakpad"].set_property("pkg_config_name", "breakpad") self.cpp_info.components["libbreakpad"].libs = ["breakpad"] self.cpp_info.components["libbreakpad"].includedirs.append(os.path.join("include", "breakpad")) - self.cpp_info.components["libbreakpad"].names["pkg_config"] = "breakpad" - - self.cpp_info.components["client"].libs = ["breakpad_client"] - self.cpp_info.components["client"].includedirs.append(os.path.join("include", "breakpad")) - self.cpp_info.components["client"].names["pkg_config"] = "breakpad-client" - - self.cpp_info.components["libbreakpad"].system_libs.append("pthread") self.cpp_info.components["libbreakpad"].requires.append("linux-syscall-support::linux-syscall-support") + self.cpp_info.components["client"].set_property("pkg_config_name", "breakpad-client") + self.cpp_info.components["client"].libs = ["breakpad_client"] + self.cpp_info.components["client"].includedirs.append(os.path.join("include", "breakpad")) self.cpp_info.components["client"].system_libs.append("pthread") self.cpp_info.components["client"].requires.append("linux-syscall-support::linux-syscall-support") - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) + # workaround to always produce a global pkgconfig file for PkgConfigDeps + self.cpp_info.set_property("pkg_config_name", "breakpad-do-not-use") + + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/breakpad/all/test_package/CMakeLists.txt b/recipes/breakpad/all/test_package/CMakeLists.txt index 97c267052c49a..65d0c4df5bef2 100644 --- a/recipes/breakpad/all/test_package/CMakeLists.txt +++ b/recipes/breakpad/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(breakpad REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE breakpad::breakpad) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/breakpad/all/test_package/conanfile.py b/recipes/breakpad/all/test_package/conanfile.py index a04d0f33ab7ca..0a6bc68712d90 100644 --- a/recipes/breakpad/all/test_package/conanfile.py +++ b/recipes/breakpad/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -class BreakpadTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/breakpad/all/test_v1_package/CMakeLists.txt b/recipes/breakpad/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/breakpad/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/breakpad/all/test_v1_package/conanfile.py b/recipes/breakpad/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/breakpad/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/brotli/all/conanfile.py b/recipes/brotli/all/conanfile.py index 1f7e57755d1f4..5ba9ac6bd939f 100644 --- a/recipes/brotli/all/conanfile.py +++ b/recipes/brotli/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class BrotliConan(ConanFile): @@ -14,6 +14,7 @@ class BrotliConan(ConanFile): homepage = "https://github.com/google/brotli" license = "MIT", + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -37,8 +38,7 @@ class BrotliConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -46,22 +46,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/brotli/all/test_package/conanfile.py b/recipes/brotli/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/brotli/all/test_package/conanfile.py +++ b/recipes/brotli/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/brotli/all/test_v1_package/conanfile.py b/recipes/brotli/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/brotli/all/test_v1_package/conanfile.py +++ b/recipes/brotli/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/brynet/all/conandata.yml b/recipes/brynet/all/conandata.yml index 9c73dc59d6547..032ce7485ea1d 100644 --- a/recipes/brynet/all/conandata.yml +++ b/recipes/brynet/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.12.2": + url: "https://github.com/IronsDu/brynet/archive/v1.12.2.tar.gz" + sha256: "b8b740cae39804d1e7037866046321065856c0ea9f565d26f67aeccc7ccd3d51" + "1.12.1": + url: "https://github.com/IronsDu/brynet/archive/v1.12.1.tar.gz" + sha256: "bcd7ce9b1c3a8dd900f34e50e7ac23013226b3c78b1e22b079d781fbc698122d" "1.11.1": url: "https://github.com/IronsDu/brynet/archive/v1.11.1.tar.gz" sha256: "780f7e1be5e16a202b75661178209a9dd572d07d548a7f30e9bcc7f4a768c61d" diff --git a/recipes/brynet/all/conanfile.py b/recipes/brynet/all/conanfile.py index 33bea6b1fd799..ece3fff57254f 100644 --- a/recipes/brynet/all/conanfile.py +++ b/recipes/brynet/all/conanfile.py @@ -1,18 +1,21 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class BrynetConan(ConanFile): name = "brynet" description = "Header Only Cross platform high performance TCP network library using C++ 11." license = "MIT" - topics = ("conan", "brynet", "networking", "tcp", "websocket") - homepage = "https://github.com/IronsDu/brynet" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/IronsDu/brynet" + topics = ("networking", "tcp", "websocket") - settings = "os", "compiler" + settings = "os", "arch", "compiler", "build_type" options = { "with_openssl": [True, False], } @@ -22,30 +25,34 @@ class BrynetConan(ConanFile): no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s", transitive_headers=True, transitive_libs=True) + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self.options.with_openssl: self.cpp_info.defines.append("BRYNET_USE_OPENSSL") if self.settings.os == "Windows": diff --git a/recipes/brynet/all/test_package/CMakeLists.txt b/recipes/brynet/all/test_package/CMakeLists.txt index 33ae887aa6aea..a89c4946c1650 100644 --- a/recipes/brynet/all/test_package/CMakeLists.txt +++ b/recipes/brynet/all/test_package/CMakeLists.txt @@ -1,9 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(brynet REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE brynet::brynet) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +if(brynet_VERSION VERSION_GREATER_EQUAL "1.11.2") + target_compile_definitions(${PROJECT_NAME} PRIVATE BRYNET_EVENTLOOP_TCPSERVICE) +endif() diff --git a/recipes/brynet/all/test_package/conanfile.py b/recipes/brynet/all/test_package/conanfile.py index 5216332f39f5c..0a6bc68712d90 100644 --- a/recipes/brynet/all/test_package/conanfile.py +++ b/recipes/brynet/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/brynet/all/test_package/test_package.cpp b/recipes/brynet/all/test_package/test_package.cpp index 54ae2df3641ce..abfd618f6e876 100644 --- a/recipes/brynet/all/test_package/test_package.cpp +++ b/recipes/brynet/all/test_package/test_package.cpp @@ -1,6 +1,11 @@ #include int main() { +#ifdef BRYNET_EVENTLOOP_TCPSERVICE + // brynet >= 1.11.2 provides IOThreadTcpService and EventLoopTcpService instead of TcpService + auto service = brynet::net::IOThreadTcpService::Create(); +#else auto service = brynet::net::TcpService::Create(); +#endif return 0; } diff --git a/recipes/brynet/all/test_v1_package/CMakeLists.txt b/recipes/brynet/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/brynet/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/brynet/all/test_v1_package/conanfile.py b/recipes/brynet/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/brynet/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/brynet/config.yml b/recipes/brynet/config.yml index 95c35b8102625..dd64cd4c4992b 100644 --- a/recipes/brynet/config.yml +++ b/recipes/brynet/config.yml @@ -1,4 +1,8 @@ versions: + "1.12.2": + folder: all + "1.12.1": + folder: all "1.11.1": folder: all "1.11.0": diff --git a/recipes/bullet3/all/conandata.yml b/recipes/bullet3/all/conandata.yml index ec81e3ffa2344..d8a0753661706 100644 --- a/recipes/bullet3/all/conandata.yml +++ b/recipes/bullet3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.25": + url: "https://github.com/bulletphysics/bullet3/archive/refs/tags/3.25.tar.gz" + sha256: "c45afb6399e3f68036ddb641c6bf6f552bf332d5ab6be62f7e6c54eda05ceb77" "3.24": url: "https://github.com/bulletphysics/bullet3/archive/refs/tags/3.24.tar.gz" sha256: "6b1e987d6f8156fa8a6468652f4eaad17b3e11252c9870359e5bca693e35780b" diff --git a/recipes/bullet3/all/conanfile.py b/recipes/bullet3/all/conanfile.py index 56400df5625cf..7924535e0be65 100644 --- a/recipes/bullet3/all/conanfile.py +++ b/recipes/bullet3/all/conanfile.py @@ -8,7 +8,7 @@ import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class Bullet3Conan(ConanFile): @@ -22,6 +22,7 @@ class Bullet3Conan(ConanFile): license = "ZLIB" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -54,18 +55,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if is_msvc(self) and self.info.options.shared: - raise ConanInvalidConfiguration("Shared libraries on Visual Studio not supported") + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration("Shared libraries on Visual Studio not supported") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -84,8 +84,6 @@ def generate(self): tc.variables["BUILD_UNIT_TESTS"] = False if is_msvc(self): tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" if Version(self.version) < "3.21": # silence warning tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0115"] = "OLD" @@ -182,7 +180,7 @@ def package_info(self): ]) if self.settings.os == "Windows" and self.settings.build_type in ("Debug", "MinSizeRel", "RelWithDebInfo"): lib_suffix = "RelWithDebugInfo" if self.settings.build_type == "RelWithDebInfo" else self.settings.build_type - libs = [lib + "_{}".format(lib_suffix) for lib in libs] + libs = [f"{lib}_{lib_suffix}" for lib in libs] self.cpp_info.libs = libs self.cpp_info.includedirs = ["include", os.path.join("include", "bullet")] diff --git a/recipes/bullet3/all/test_package/conanfile.py b/recipes/bullet3/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/bullet3/all/test_package/conanfile.py +++ b/recipes/bullet3/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/bullet3/all/test_v1_package/CMakeLists.txt b/recipes/bullet3/all/test_v1_package/CMakeLists.txt index 2be76b63171a5..0d20897301b68 100644 --- a/recipes/bullet3/all/test_v1_package/CMakeLists.txt +++ b/recipes/bullet3/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Bullet REQUIRED CONFIG) -include(${BULLET_ROOT_DIR}/${BULLET_USE_FILE}) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${BULLET_LIBRARIES}) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/bullet3/config.yml b/recipes/bullet3/config.yml index 0250c44853be5..dca6debe05137 100644 --- a/recipes/bullet3/config.yml +++ b/recipes/bullet3/config.yml @@ -1,4 +1,6 @@ versions: + "3.25": + folder: all "3.24": folder: all "3.22a": diff --git a/recipes/butteraugli/all/CMakeLists.txt b/recipes/butteraugli/all/CMakeLists.txt index f8e874acb1d64..d92428ae1ee9a 100644 --- a/recipes/butteraugli/all/CMakeLists.txt +++ b/recipes/butteraugli/all/CMakeLists.txt @@ -1,31 +1,31 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) +cmake_minimum_required(VERSION 3.8) +project(butteraugli LANGUAGES CXX) -include(conanbuildinfo.cmake) -conan_basic_setup() +option(BUTTERAUGLI_TOOL "Build comparison tool" ON) -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif(WIN32 AND BUILD_SHARED_LIBS) +add_library(butteraugli_lib ${BUTTERAUGLI_SRC_DIR}/butteraugli/butteraugli.cc) +target_include_directories(butteraugli_lib PUBLIC ${BUTTERAUGLI_SRC_DIR}) +set_target_properties(butteraugli_lib PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) +target_compile_features(butteraugli_lib PUBLIC cxx_std_11) -set(butteraugli_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) - -set(SRCS_FILES ${butteraugli_DIR}/butteraugli/butteraugli.cc) -set(HDRS_FILES ${butteraugli_DIR}/butteraugli/butteraugli.h) -add_library(butteraugli_lib ${SRCS_FILES} ${HDRS_FILES}) -target_include_directories(butteraugli_lib PUBLIC ${butteraugli_DIR}) -set_property(TARGET butteraugli_lib PROPERTY CXX_STANDARD 11) - -find_package(JPEG REQUIRED) -find_package(PNG REQUIRED) - -add_library(butteraugli ${butteraugli_DIR}/butteraugli/butteraugli_main.cc) -target_link_libraries(butteraugli butteraugli_lib ${JPEG_LIBRARIES} ${PNG_LIBRARIES}) -set_property(TARGET butteraugli PROPERTY CXX_STANDARD 11) - -install(TARGETS butteraugli butteraugli_lib +install( + TARGETS butteraugli_lib RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) -install(FILES ${HDRS_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/butteraugli) +install( + FILES ${BUTTERAUGLI_SRC_DIR}/butteraugli/butteraugli.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/butteraugli +) + +if(BUTTERAUGLI_TOOL) + find_package(JPEG REQUIRED) + find_package(PNG REQUIRED) + + add_executable(butteraugli ${BUTTERAUGLI_SRC_DIR}/butteraugli/butteraugli_main.cc) + target_link_libraries(butteraugli PRIVATE butteraugli_lib JPEG::JPEG PNG::PNG) + target_compile_features(butteraugli PRIVATE cxx_std_11) + + install(TARGETS butteraugli DESTINATION ${CMAKE_INSTALL_BINDIR}) +endif() diff --git a/recipes/butteraugli/all/conandata.yml b/recipes/butteraugli/all/conandata.yml index e055fe4ea0162..bcd4f7dd9d272 100644 --- a/recipes/butteraugli/all/conandata.yml +++ b/recipes/butteraugli/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "cci.20190319": - patch_file: "patches/0001-compilation-fixes-for-vs2015.patch" - base_path: "source_subfolder" diff --git a/recipes/butteraugli/all/conanfile.py b/recipes/butteraugli/all/conanfile.py index 08ed283655462..35cd9c65cf914 100644 --- a/recipes/butteraugli/all/conanfile.py +++ b/recipes/butteraugli/all/conanfile.py @@ -1,35 +1,36 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -import glob -from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.53.0" + class ButteraugliConan(ConanFile): name = "butteraugli" description = "A tool for measuring perceived differences between images" license = "Apache-2.0" - topics = ("conan", "image", "butteraugli", "diff") + topics = ("image", "diff") homepage = "https://github.com/google/butteraugli" url = "https://github.com/conan-io/conan-center-index" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake", "cmake_find_package" options = { "shared": [True, False], "fPIC": [True, False], + "tool": [True, False], } default_options = { "shared": False, "fPIC": True, + "tool": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,39 +38,47 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libpng/1.6.37") - self.requires("libjpeg/9d") + if self.options.tool: + self.requires("libpng/1.6.39") + self.requires("libjpeg/9e") - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob('butteraugli-*/')[0] - os.rename(extracted_dir, self._source_subfolder) + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUTTERAUGLI_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["BUTTERAUGLI_TOOL"] = self.options.tool + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - if self.settings.os == "Linux": + self.cpp_info.libs = ["butteraugli_lib"] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] + + if self.options.tool: + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/butteraugli/all/test_package/CMakeLists.txt b/recipes/butteraugli/all/test_package/CMakeLists.txt index 33ae887aa6aea..7f874ff8ee8e1 100644 --- a/recipes/butteraugli/all/test_package/CMakeLists.txt +++ b/recipes/butteraugli/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(butteraugli REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE butteraugli::butteraugli) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/butteraugli/all/test_package/conanfile.py b/recipes/butteraugli/all/test_package/conanfile.py index ea57a464900be..0a6bc68712d90 100644 --- a/recipes/butteraugli/all/test_package/conanfile.py +++ b/recipes/butteraugli/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/butteraugli/all/test_v1_package/CMakeLists.txt b/recipes/butteraugli/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/butteraugli/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/butteraugli/all/test_v1_package/conanfile.py b/recipes/butteraugli/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/butteraugli/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/bx/all/CMakeLists.txt b/recipes/bx/all/CMakeLists.txt deleted file mode 100644 index ba4a65a78f3b0..0000000000000 --- a/recipes/bx/all/CMakeLists.txt +++ /dev/null @@ -1,60 +0,0 @@ -# Custom cmake config because the maintainer doesn't want maintain CMake configs. -# https://github.com/conan-io/conan-center-index/pull/1544/files#r420852884 - -cmake_minimum_required(VERSION 3.0) -project(bx) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -include(GNUInstallDirs) - -set(BX_SOURCE_SUBFOLDER "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder") - -file(GLOB BX_SOURCES ${BX_SOURCE_SUBFOLDER}/src/*.cpp) -list(REMOVE_ITEM BX_SOURCES ${BX_SOURCE_SUBFOLDER}/src/amalgamated.cpp) -add_library(bx STATIC ${BX_SOURCES}) -target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include ${BX_SOURCE_SUBFOLDER}/3rdparty) -install(TARGETS bx PUBLIC_HEADER ARCHIVE LIBRARY RUNTIME) -set_property(TARGET bx PROPERTY CXX_STANDARD 14) -install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/bx DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - -if(MSVC) - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/msvc) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/msvc/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) -elseif(MINGW OR CYGWIN OR MSYS) - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/mingw) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/mingw/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) -elseif(UNIX) - if(APPLE) - if(IOS) - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/ios) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/ios/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) - else() - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/osx) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/osx/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) - endif() - else() - if(SYSTEM_NAME STREQUAL "FreeBSD") - target_include_directories(bx PUBLIC ${BX_SOURCE_SUBFOLDER}/include/compat/freebsd) - install(DIRECTORY ${BX_SOURCE_SUBFOLDER}/include/compat/freebsd/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/bx/compat) - endif() - endif() -endif() - -if(WIN32) - target_link_libraries(bx PUBLIC psapi) -endif() - -target_compile_definitions(bx PUBLIC "__STDC_LIMIT_MACROS" "__STDC_FORMAT_MACROS" "__STDC_CONSTANT_MACROS" PRIVATE "$<$:BX_CONFIG_DEBUG=1>") - -if(UNIX AND NOT APPLE AND NOT ANDROID) - find_package(Threads) - target_link_libraries(bx ${CMAKE_THREAD_LIBS_INIT} dl) - - target_link_libraries(bx rt) -elseif(APPLE) - find_library(FOUNDATION_LIBRARY Foundation) - mark_as_advanced(FOUNDATION_LIBRARY) - target_link_libraries(bx PUBLIC ${FOUNDATION_LIBRARY}) -endif() diff --git a/recipes/bx/all/conandata.yml b/recipes/bx/all/conandata.yml index 4f350d3b1a2c6..f4ae1ed020baa 100644 --- a/recipes/bx/all/conandata.yml +++ b/recipes/bx/all/conandata.yml @@ -1,7 +1,4 @@ sources: - "20200504": - url: "https://github.com/bkaradzic/bx/archive/b6ab66b099044220b8a047e58c41c288a939388c.zip" - sha256: "2074387565d9ace107e7a1dc734ee2e72a9763170574f22b0e70d70072449663" - "20200716": - url: "https://github.com/bkaradzic/bx/archive/c5b9b64c2d7c270494f6ad89cbb4090f8e3e7b64.zip" - sha256: "8c006f0df6ed0ac19fad8e9110451a71d729554aad13d7dcd8239aa0abbc1537" + "cci.20221116": + url: "https://github.com/bkaradzic/bx/archive/aed1086c48884b1b4f1c2f9af34c5198624263f6.tar.gz" + sha256: "6867CF7ABD2BB53A1A92C7B70CBC7F424B97D3AE3A8183F284C6A6507EFE4517" diff --git a/recipes/bx/all/conanfile.py b/recipes/bx/all/conanfile.py index 26064fb83f34b..c1e1bfa91952f 100644 --- a/recipes/bx/all/conanfile.py +++ b/recipes/bx/all/conanfile.py @@ -1,81 +1,247 @@ +from conan import ConanFile +from conan.tools.files import copy, get, rename +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, check_min_vs, is_msvc_static_runtime +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import MSBuild, VCVars +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.env import VirtualBuildEnv +from pathlib import Path import os -import glob -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -class BxConan(ConanFile): +required_conan_version = ">=1.50.0" + + +class bxConan(ConanFile): name = "bx" - description = "Base library used across multiple projects." license = "BSD-2-Clause" - topics = ("conan", "bx") homepage = "https://github.com/bkaradzic/bx" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - settings = "os", "arch", "compiler", "build_type" - options = { - "fPIC": [True, False], - } - default_options = { - "fPIC": True, - } + description = "Base library providing utility functions and macros." + topics = ("general", "utility") + settings = "os", "compiler", "arch", "build_type" + options = {"fPIC": [True, False], "tools": [True, False]} + default_options = {"fPIC": True, "tools": False} + + @property + def _bx_folder(self): + return "bx" @property - def _source_subfolder(self): - return "source_subfolder" + def _bx_path(self): + return os.path.join(self.source_folder, self._bx_folder) @property - def _build_subfolder(self): - return "build_subfolder" + def _genie_extra(self): + genie_extra = "" + if is_msvc(self) and not is_msvc_static_runtime(self): + genie_extra += " --with-dynamic-runtime" + return genie_extra + + @property + def _projs(self): + projs = ["bx"] + if self.options.tools: + projs.extend(["bin2c", "lemon"]) + return projs + + @property + def _compiler_required(self): + return { + "gcc": "8", + "clang": "3.3", + "apple-clang": "5", + } + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def config_options(self): - if self.settings.os == 'Windows': + if self.settings.os == "Windows": del self.options.fPIC - def configure(self): - minimal_cpp_standard = "14" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { - "gcc": "5", - "clang": "3.4", - "apple-clang": "10", - "Visual Studio": "15" - } - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - return - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if not self.options.get_safe("fPIC", True): + raise ConanInvalidConfiguration("This package does not support builds without fPIC.") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + check_min_vs(self, 191) + if not is_msvc(self): + try: + minimum_required_compiler_version = self._compiler_required[str(self.settings.compiler)] + if Version(self.settings.compiler.version) < minimum_required_compiler_version: + raise ConanInvalidConfiguration("This package requires C++14 support. The current compiler does not support it.") + except KeyError: + self.output.warn("This recipe has no checking for the current compiler. Please consider adding it.") + + def build_requirements(self): + self.tool_requires("genie/1170") + if not is_msvc(self) and self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob('bx-*/')[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True, + destination=os.path.join(self.source_folder, self._bx_folder)) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure(build_folder=self._build_subfolder) - return cmake + def generate(self): + vbe = VirtualBuildEnv(self) + vbe.generate() + if is_msvc(self): + tc = VCVars(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - cmake = self._configure_cmake() - cmake.build() + if is_msvc(self): + # Conan to Genie translation maps + vs_ver_to_genie = {"17": "2022", "16": "2019", "15": "2017", + "193": "2022", "192": "2019", "191": "2017"} + + # Use genie directly, then msbuild on specific projects based on requirements + genie_VS = f"vs{vs_ver_to_genie[str(self.settings.compiler.version)]}" + genie_gen = f"{self._genie_extra} {genie_VS}" + self.run(f"genie {genie_gen}", cwd=self._bx_path) + + msbuild = MSBuild(self) + # customize to Release when RelWithDebInfo + msbuild.build_type = "Debug" if self.settings.build_type == "Debug" else "Release" + # use Win32 instead of the default value when building x86 + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(self._bx_path, ".build", "projects", genie_VS, "bx.sln"), targets=self._projs) + else: + # Not sure if XCode can be spefically handled by conan for building through, so assume everything not VS is make + # gcc-multilib and g++-multilib required for 32bit cross-compilation, should see if we can check and install through conan + + # Conan to Genie translation maps + compiler_str = str(self.settings.compiler) + compiler_and_os_to_genie = {"Windows": f"--gcc=mingw-{compiler_str}", "Linux": f"--gcc=linux-{compiler_str}", + "FreeBSD": "--gcc=freebsd", "Macos": "--gcc=osx", + "Android": "--gcc=android", "iOS": "--gcc=ios"} + gmake_os_to_proj = {"Windows": "mingw", "Linux": "linux", "FreeBSD": "freebsd", "Macos": "osx", "Android": "android", "iOS": "ios"} + gmake_arch_to_genie_suffix = {"x86": "-x86", "x86_64": "-x64", "armv8": "-arm64", "armv7": "-arm"} + os_to_use_arch_config_suffix = {"Windows": False, "Linux": False, "FreeBSD": False, "Macos": True, "Android": True, "iOS": True} + + build_type_to_make_config = {"Debug": "config=debug", "Release": "config=release"} + arch_to_make_config_suffix = {"x86": "32", "x86_64": "64"} + os_to_use_make_config_suffix = {"Windows": True, "Linux": True, "FreeBSD": True, "Macos": False, "Android": False, "iOS": False} + + # Generate projects through genie + genieGen = f"{self._genie_extra} {compiler_and_os_to_genie[str(self.settings.os)]}" + if os_to_use_arch_config_suffix[str(self.settings.os)]: + genieGen += f"{gmake_arch_to_genie_suffix[str(self.settings.arch)]}" + genieGen += " gmake" + self.run(f"genie {genieGen}", cwd=self._bx_path) + + # Build project folder and path from given settings + projFolder = f"gmake-{gmake_os_to_proj[str(self.settings.os)]}" + if self.settings.os == "Windows" or compiler_str not in ["gcc", "apple-clang"]: + projFolder += f"-{compiler_str}" #mingw-gcc or mingw-clang for windows; -clang for linux (where gcc on linux has no extra) + if os_to_use_arch_config_suffix[str(self.settings.os)]: + projFolder += gmake_arch_to_genie_suffix[str(self.settings.arch)] + proj_path = os.path.sep.join([self._bx_path, ".build", "projects", projFolder]) + + # Build make args from settings + conf = build_type_to_make_config[str(self.settings.build_type)] + if os_to_use_make_config_suffix[str(self.settings.os)]: + conf += arch_to_make_config_suffix[str(self.settings.arch)] + if self.settings.os == "Windows": + mingw = "MINGW=$MINGW_PREFIX" + proj_path = proj_path.replace("\\", "/") # Fix path for msys... + else: + mingw = "" + autotools = Autotools(self) + # Build with make + for proj in self._projs: + autotools.make(target=proj, args=["-R", f"-C {proj_path}", mingw, conf]) def package(self): - cmake = self._configure_cmake() - cmake.install() - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + # Set platform suffixes and prefixes + if self.settings.os == "Windows": + lib_ext = "*.lib" + package_lib_prefix = "" + elif self.settings.os in ["Linux", "FreeBSD"]: + lib_ext = "*.a" + package_lib_prefix = "lib" + elif self.settings.os == "Macos": + lib_ext = "*.a" + package_lib_prefix = "lib" + + # Get build bin folder + for bx_out_dir in os.listdir(os.path.join(self._bx_path, ".build")): + if not bx_out_dir=="projects": + build_bin = os.path.join(self._bx_path, ".build", bx_out_dir, "bin") + break + + # Copy license + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self._bx_path) + # Copy includes + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._bx_path, "include")) + copy(self, pattern="*.inl", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._bx_path, "include")) + # Copy libs + copy(self, pattern=lib_ext, dst=os.path.join(self.package_folder, "lib"), src=build_bin, keep_path=False) + # Copy tools + if self.options.tools: + copy(self, pattern="bin2c*", dst=os.path.join(self.package_folder, "bin"), src=build_bin, keep_path=False) + copy(self, pattern="lemon*", dst=os.path.join(self.package_folder, "bin"), src=build_bin, keep_path=False) + + # Rename for consistency across platforms and configs + for bx_file in Path(os.path.join(self.package_folder, "lib")).glob("*bx*"): + rename(self, os.path.join(self.package_folder, "lib", bx_file.name), + os.path.join(self.package_folder, "lib", f"{package_lib_prefix}bx{bx_file.suffix}")) + if self.options.tools: + for bx_file in Path(os.path.join(self.package_folder, "bin")).glob("*bin2c*"): + rename(self, os.path.join(self.package_folder, "bin", bx_file.name), + os.path.join(self.package_folder, "bin", f"bin2c{bx_file.suffix}")) + for bx_file in Path(os.path.join(self.package_folder, "bin")).glob("*lemon*"): + rename(self, os.path.join(self.package_folder, "bin", bx_file.name), + os.path.join(self.package_folder, "bin", f"lemon{bx_file.suffix}")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - self.cpp_info.includedirs.append(os.path.join("include", "bx", "compat")) - if self.settings.os == "Linux": - self.cpp_info.system_libs = ["dl", "pthread", "rt"] - if self.settings.os == "Macos": - self.cpp_info.frameworks = ["Foundation"] + self.cpp_info.includedirs = ["include"] + self.cpp_info.libs = ["bx"] + + self.cpp_info.set_property("cmake_file_name", "bx") + self.cpp_info.set_property("cmake_target_name", "bx::bx") + self.cpp_info.set_property("pkg_config_name", "bx") + + if self.settings.build_type == "Debug": + self.cpp_info.defines.extend(["BX_CONFIG_DEBUG=1"]) + else: + self.cpp_info.defines.extend(["BX_CONFIG_DEBUG=0"]) + + if self.settings.os == "Windows": + if self.settings.arch == "x86": + self.cpp_info.system_libs.extend(["psapi"]) + if is_msvc(self): + self.cpp_info.includedirs.extend(["include/compat/msvc"]) + self.cpp_info.cxxflags.extend(["/Zc:__cplusplus"]) + else: + self.cpp_info.includedirs.extend(["include/compat/mingw"]) + elif self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["dl", "pthread"]) + if self.settings.os == "Linux": + self.cpp_info.includedirs.extend(["include/compat/linux"]) + else: + self.cpp_info.includedirs.extend(["include/compat/freebsd"]) + elif self.settings.os in ["Macos", "iOS"]: + self.cpp_info.frameworks.extend(["Foundation", "Cocoa"]) + if self.settings.os == "Macos": + self.cpp_info.includedirs.extend(["include/compat/osx"]) + else: + self.cpp_info.includedirs.extend(["include/compat/ios"]) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "bx" + self.cpp_info.filenames["cmake_find_package_multi"] = "bx" + self.cpp_info.names["cmake_find_package"] = "bx" + self.cpp_info.names["cmake_find_package_multi"] = "bx" diff --git a/recipes/bx/all/test_package/CMakeLists.txt b/recipes/bx/all/test_package/CMakeLists.txt index 57c0d429701ce..71a1766827d58 100644 --- a/recipes/bx/all/test_package/CMakeLists.txt +++ b/recipes/bx/all/test_package/CMakeLists.txt @@ -1,9 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package LANGUAGES CXX) -add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) +find_package(bx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF) +target_link_libraries(${PROJECT_NAME} bx::bx) diff --git a/recipes/bx/all/test_package/conanfile.py b/recipes/bx/all/test_package/conanfile.py index 4903f1a7e8fa0..7914baa434398 100644 --- a/recipes/bx/all/test_package/conanfile.py +++ b/recipes/bx/all/test_package/conanfile.py @@ -1,9 +1,21 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.layout import cmake_layout +from conan.tools.cmake import CMake import os +required_conan_version = ">=1.50.0" + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +23,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/bx/all/test_package/test_package.cpp b/recipes/bx/all/test_package/test_package.cpp index 712588f058897..e62d29351461a 100644 --- a/recipes/bx/all/test_package/test_package.cpp +++ b/recipes/bx/all/test_package/test_package.cpp @@ -1,7 +1,8 @@ -#include +#include -int main() -{ - char tmp[1024]; - prettify(tmp, BX_COUNTOF(tmp), 4000, bx::Units::Kilo); +int main() { + float tLerp = bx::lerp(0.0f, 10.0f, 0.5f); + BX_TRACE("Lerped 0.0f to 10.0f at 0.5f, result %f", tLerp); + BX_ASSERT(bx::isEqual(tLerp, 5.0f, 0.1f), "isEqual failed"); + return 0; } diff --git a/recipes/bx/all/test_v1_package/CMakeLists.txt b/recipes/bx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..3a070c42e7447 --- /dev/null +++ b/recipes/bx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(bx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON CXX_EXTENSIONS OFF) +target_link_libraries(${PROJECT_NAME} bx::bx) diff --git a/recipes/bx/all/test_v1_package/conanfile.py b/recipes/bx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d2959af78862a --- /dev/null +++ b/recipes/bx/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class BxTestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/bx/all/test_v1_package/test_package.cpp b/recipes/bx/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..e62d29351461a --- /dev/null +++ b/recipes/bx/all/test_v1_package/test_package.cpp @@ -0,0 +1,8 @@ +#include + +int main() { + float tLerp = bx::lerp(0.0f, 10.0f, 0.5f); + BX_TRACE("Lerped 0.0f to 10.0f at 0.5f, result %f", tLerp); + BX_ASSERT(bx::isEqual(tLerp, 5.0f, 0.1f), "isEqual failed"); + return 0; +} diff --git a/recipes/bx/config.yml b/recipes/bx/config.yml index c46173d220255..1156867d3e651 100644 --- a/recipes/bx/config.yml +++ b/recipes/bx/config.yml @@ -1,5 +1,3 @@ versions: - "20200504": - folder: all - "20200716": + "cci.20221116": folder: all diff --git a/recipes/bzip2/all/CMakeLists.txt b/recipes/bzip2/all/CMakeLists.txt index a76b3d6139c7e..cce959a4a45c5 100644 --- a/recipes/bzip2/all/CMakeLists.txt +++ b/recipes/bzip2/all/CMakeLists.txt @@ -1,44 +1,41 @@ cmake_minimum_required(VERSION 3.4) -project(bzip2 C) +project(bzip2 LANGUAGES C) include(GNUInstallDirs) -if(MSVC OR MSVC90 OR MSVC10) - set(MSVC ON) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -set(SOURCE_SUBFOLDER ${CMAKE_CURRENT_SOURCE_DIR}/src) -set(BZ2_LIBRARY bz2) - -option(BZ2_BUILD_EXE ON) - -set(BZ2_TARGETS ${BZ2_LIBRARY}) - -add_library(${BZ2_LIBRARY} ${SOURCE_SUBFOLDER}/blocksort.c - ${SOURCE_SUBFOLDER}/bzlib.c - ${SOURCE_SUBFOLDER}/compress.c - ${SOURCE_SUBFOLDER}/crctable.c - ${SOURCE_SUBFOLDER}/decompress.c - ${SOURCE_SUBFOLDER}/huffman.c - ${SOURCE_SUBFOLDER}/randtable.c - ${SOURCE_SUBFOLDER}/bzlib.h - ${SOURCE_SUBFOLDER}/bzlib_private.h) -target_include_directories(${BZ2_LIBRARY} PRIVATE ${SOURCE_SUBFOLDER}) +option(BZ2_BUILD_EXE "Build bzip2 command-line utility" ON) + +add_library( + bz2 + ${BZ2_SRC_DIR}/blocksort.c + ${BZ2_SRC_DIR}/bzlib.c + ${BZ2_SRC_DIR}/compress.c + ${BZ2_SRC_DIR}/crctable.c + ${BZ2_SRC_DIR}/decompress.c + ${BZ2_SRC_DIR}/huffman.c + ${BZ2_SRC_DIR}/randtable.c +) + +target_include_directories(bz2 PUBLIC ${BZ2_SRC_DIR}) +set_target_properties( + bz2 + PROPERTIES + PUBLIC_HEADER "${BZ2_SRC_DIR}/bzlib.h" + SOVERSION ${BZ2_VERSION_MAJOR} + VERSION ${BZ2_VERSION_STRING} + WINDOWS_EXPORT_ALL_SYMBOLS ON +) + +install( + TARGETS bz2 + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) if(BZ2_BUILD_EXE) - add_executable(${CMAKE_PROJECT_NAME} ${SOURCE_SUBFOLDER}/bzip2.c) - target_link_libraries(${CMAKE_PROJECT_NAME} ${BZ2_LIBRARY}) - target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${SOURCE_SUBFOLDER}) - list(APPEND BZ2_TARGETS ${CMAKE_PROJECT_NAME}) + add_executable(bzip2 ${BZ2_SRC_DIR}/bzip2.c) + target_link_libraries(bzip2 PRIVATE bz2) + install(TARGETS bzip2 DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() - -set_target_properties(${BZ2_LIBRARY} PROPERTIES VERSION ${BZ2_VERSION_STRING} SOVERSION ${BZ2_VERSION_MAJOR}) - -install(TARGETS ${BZ2_TARGETS} - BUNDLE DESTINATION ${CMAKE_INSTALL_BINDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -install(FILES ${SOURCE_SUBFOLDER}/bzlib.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/bzip2/all/conanfile.py b/recipes/bzip2/all/conanfile.py index 1c4db485095a2..c890147c5a874 100644 --- a/recipes/bzip2/all/conanfile.py +++ b/recipes/bzip2/all/conanfile.py @@ -1,10 +1,11 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, save +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class Bzip2Conan(ConanFile): @@ -13,8 +14,7 @@ class Bzip2Conan(ConanFile): homepage = "http://www.bzip.org" license = "bzip2-1.0.8" description = "bzip2 is a free and open-source file compression program that uses the Burrows Wheeler algorithm." - topics = ("bzip2", "data-compressor", "file-compression") - + topics = ("data-compressor", "file-compression") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,25 +29,18 @@ class Bzip2Conan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - self.license = "bzip2-{}".format(self.version) + self.license = f"bzip2-{self.version}" def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.compiler.rm_safe("libcxx") + self.settings.compiler.rm_safe("cppstd") def layout(self): cmake_layout(self, src_folder="src") @@ -58,9 +51,10 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["BZ2_VERSION_STRING"] = self.version - tc.variables["BZ2_VERSION_MAJOR"] = str(self.version).split(".")[0] tc.variables["BZ2_BUILD_EXE"] = self.options.build_executable + tc.variables["BZ2_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["BZ2_VERSION_MAJOR"] = Version(self.version).major + tc.variables["BZ2_VERSION_STRING"] = self.version tc.generate() def build(self): @@ -98,7 +92,7 @@ def _create_cmake_module_variables(self, module_file): @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -110,8 +104,5 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "BZip2" self.cpp_info.names["cmake_find_package_multi"] = "BZip2" self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] - if self.options.build_executable: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/bzip2/all/test_package/CMakeLists.txt b/recipes/bzip2/all/test_package/CMakeLists.txt index 41f56a28f0fb3..540d39e432a7e 100644 --- a/recipes/bzip2/all/test_package/CMakeLists.txt +++ b/recipes/bzip2/all/test_package/CMakeLists.txt @@ -2,12 +2,23 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) find_package(BZip2 REQUIRED) -message("BZIP2_FOUND: ${BZIP2_FOUND}") -message("BZIP2_NEED_PREFIX: ${BZIP2_NEED_PREFIX}") -message("BZIP2_INCLUDE_DIRS: ${BZIP2_INCLUDE_DIRS}") -message("BZIP2_INCLUDE_DIR: ${BZIP2_INCLUDE_DIR}") -message("BZIP2_LIBRARIES: ${BZIP2_LIBRARIES}") -message("BZIP2_VERSION_STRING: ${BZIP2_VERSION_STRING}") add_executable(test_package test_package.c) target_link_libraries(test_package PRIVATE BZip2::BZip2) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindBZip2.html are properly defined +set(_custom_vars + BZIP2_FOUND + BZIP2_NEED_PREFIX + BZIP2_INCLUDE_DIRS + BZIP2_INCLUDE_DIR + BZIP2_LIBRARIES + BZIP2_VERSION_STRING +) +foreach(_custom_var ${_custom_vars}) + if(DEFINED _custom_var) + message(STATUS "${_custom_var}: ${${_custom_var}}") + else() + message(FATAL_ERROR "${_custom_var} not defined") + endif() +endforeach() diff --git a/recipes/bzip2/all/test_package/conanfile.py b/recipes/bzip2/all/test_package/conanfile.py index 3a8c6c5442b33..8a5bb47f50c4c 100644 --- a/recipes/bzip2/all/test_package/conanfile.py +++ b/recipes/bzip2/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,6 +7,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) @@ -20,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/bzip2/all/test_v1_package/CMakeLists.txt b/recipes/bzip2/all/test_v1_package/CMakeLists.txt index 5760ab6116294..0d20897301b68 100644 --- a/recipes/bzip2/all/test_v1_package/CMakeLists.txt +++ b/recipes/bzip2/all/test_v1_package/CMakeLists.txt @@ -1,16 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(BZip2 REQUIRED) -message("BZIP2_FOUND: ${BZIP2_FOUND}") -message("BZIP2_NEED_PREFIX: ${BZIP2_NEED_PREFIX}") -message("BZIP2_INCLUDE_DIRS: ${BZIP2_INCLUDE_DIRS}") -message("BZIP2_INCLUDE_DIR: ${BZIP2_INCLUDE_DIR}") -message("BZIP2_LIBRARIES: ${BZIP2_LIBRARIES}") -message("BZIP2_VERSION_STRING: ${BZIP2_VERSION_STRING}") - -add_executable(test_package ../test_package/test_package.c) -target_link_libraries(test_package PRIVATE BZip2::BZip2) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/bzip2/all/test_v1_package/conanfile.py b/recipes/bzip2/all/test_v1_package/conanfile.py index ce96086e831ac..19e6a0c06e3d8 100644 --- a/recipes/bzip2/all/test_v1_package/conanfile.py +++ b/recipes/bzip2/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os @@ -15,4 +14,4 @@ def build(self): def test(self): if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") - self.run("%s --help" % bin_path, run_environment=True) + self.run(bin_path, run_environment=True) diff --git a/recipes/bzip3/all/CMakeLists.txt b/recipes/bzip3/all/CMakeLists.txt index 783a1988b3c10..f58db5b429ac9 100644 --- a/recipes/bzip3/all/CMakeLists.txt +++ b/recipes/bzip3/all/CMakeLists.txt @@ -9,6 +9,12 @@ set(BZIP3_INC ) add_library(bzip3) + +if (BZIP3_VERSION VERSION_GREATER_EQUAL "1.1.5") +target_sources(bzip3 PRIVATE + ${BZIP3_SRC_DIR}/src/libbz3.c +) +else() target_sources(bzip3 PRIVATE ${BZIP3_SRC_DIR}/src/cm.c ${BZIP3_SRC_DIR}/src/crc32.c @@ -17,12 +23,21 @@ target_sources(bzip3 PRIVATE ${BZIP3_SRC_DIR}/src/lzp.c ${BZIP3_SRC_DIR}/src/rle.c ) +endif() target_include_directories(bzip3 PUBLIC ${BZIP3_SRC_DIR}/include) set_target_properties(bzip3 PROPERTIES PUBLIC_HEADER "${BZIP3_INC}" C_VISIBILITY_PRESET hidden C_EXTENSIONS OFF ) +if (BZIP3_VERSION VERSION_GREATER_EQUAL "1.1.6" AND (MSVC OR MSVC90 OR MSVC10) AND BUILD_SHARED_LIBS) + target_compile_definitions(bzip3 PRIVATE "BZIP3_DLL_EXPORT=1") +endif() + +if (BZIP3_VERSION VERSION_GREATER_EQUAL "1.1.7") + target_compile_definitions(bzip3 PRIVATE "VERSION=\"${BZIP3_VERSION}\"") +endif() + if (BZIP3_WITH_THREAD) find_package(Threads REQUIRED) target_link_libraries(bzip3 PRIVATE Threads::Threads) @@ -32,7 +47,7 @@ endif() if (BZIP3_WITH_UTIL) add_executable(bzip3_cmd ${BZIP3_SRC_DIR}/src/main.c) target_link_libraries(bzip3_cmd bzip3) - target_compile_definitions(bzip3_cmd PRIVATE "VERSION=\"${VERSION}\"") + target_compile_definitions(bzip3_cmd PRIVATE "VERSION=\"${BZIP3_VERSION}\"") set_target_properties(bzip3_cmd PROPERTIES OUTPUT_NAME "bzip3") endif() diff --git a/recipes/bzip3/all/conandata.yml b/recipes/bzip3/all/conandata.yml index a3a9020f9818f..eb1cfea3a1d61 100644 --- a/recipes/bzip3/all/conandata.yml +++ b/recipes/bzip3/all/conandata.yml @@ -1,8 +1,31 @@ sources: + "1.2.2": + url: "https://github.com/kspalaiologos/bzip3/archive/1.2.2.tar.gz" + sha256: "e7792f3c83f1d9efd0d7b18da2eb6a1f119ffcdeb5515cf441145c2e9b72652e" + "1.2.1": + url: "https://github.com/kspalaiologos/bzip3/archive/1.2.1.tar.gz" + sha256: "f2fc4c9c7679d3b120e8f44d8c4ecd00f03af9981f53e13dc0f956b5996913c9" + "1.2.0": + url: "https://github.com/kspalaiologos/bzip3/archive/1.2.0.tar.gz" + sha256: "6f9bd935ac1e845cb49e64ad23969db914e4760dad7feec0995f5cdbd336c10d" + "1.1.8": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.8/bzip3-1.1.8.tar.bz2" + sha256: "bc15d0e4599aad18d9ed71ee0f7e859af89051bf5105b0751e8ca3a26117567d" + "1.1.7": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.7/bzip3-1.1.7.tar.bz2" + sha256: "1f74768dd1a76c45417f84779cc04d8d8b1f595ac564a2ea2aeb0248defca803" + "1.1.6": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.6/bzip3-1.1.6.tar.bz2" + sha256: "2bfd35dd57ab80b35b25e3ad628e0ff8f1f5e6dea02a8d472914823ea2e07e96" + "1.1.5": + url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.5/bzip3-1.1.5.tar.bz2" + sha256: "2f5012b0004b6c23d5f606deed9191fdce44849234edbcf26e0316bf7856d114" "1.1.4": url: "https://github.com/kspalaiologos/bzip3/releases/download/1.1.4/bzip3-1.1.4.tar.bz2" sha256: "e23a06ae17fc36192e79d0151950b3bbd4e26381af50ba4b4fd7a2d9797e498f" patches: + "1.1.5": + - patch_file: "patches/1.1.5-0002-export-symbols.patch" "1.1.4": - - patch_file: "patches/0001-make-restrict-alias.patch" - - patch_file: "patches/0002-export-symbols.patch" + - patch_file: "patches/1.1.4-0001-make-restrict-alias.patch" + - patch_file: "patches/1.1.4-0002-export-symbols.patch" diff --git a/recipes/bzip3/all/conanfile.py b/recipes/bzip3/all/conanfile.py index 196224b72dc65..651e96036ca1c 100644 --- a/recipes/bzip3/all/conanfile.py +++ b/recipes/bzip3/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class BZip3Conan(ConanFile): @@ -29,8 +29,7 @@ class BZip3Conan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,15 +42,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") @@ -65,7 +58,7 @@ def generate(self): tc.variables["BZIP3_SRC_DIR"] = self.source_folder.replace("\\", "/") tc.variables["BZIP3_WITH_PTHREAD"] = self.options.get_safe("with_thread", False) tc.variables["BZIP3_WITH_UTIL"] = self.options.with_util - tc.variables["VERSION"] = self.version + tc.variables["BZIP3_VERSION"] = self.version tc.generate() def build(self): @@ -75,7 +68,7 @@ def build(self): cmake.build() def package(self): - copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() diff --git a/recipes/bzip3/all/patches/0001-make-restrict-alias.patch b/recipes/bzip3/all/patches/1.1.4-0001-make-restrict-alias.patch similarity index 100% rename from recipes/bzip3/all/patches/0001-make-restrict-alias.patch rename to recipes/bzip3/all/patches/1.1.4-0001-make-restrict-alias.patch diff --git a/recipes/bzip3/all/patches/0002-export-symbols.patch b/recipes/bzip3/all/patches/1.1.4-0002-export-symbols.patch similarity index 100% rename from recipes/bzip3/all/patches/0002-export-symbols.patch rename to recipes/bzip3/all/patches/1.1.4-0002-export-symbols.patch diff --git a/recipes/bzip3/all/patches/1.1.5-0002-export-symbols.patch b/recipes/bzip3/all/patches/1.1.5-0002-export-symbols.patch new file mode 100644 index 0000000000000..e76dc6e0d184e --- /dev/null +++ b/recipes/bzip3/all/patches/1.1.5-0002-export-symbols.patch @@ -0,0 +1,83 @@ +diff --git a/include/libbz3.h b/include/libbz3.h +index a5ac58a..a9b13fd 100644 +--- a/include/libbz3.h ++++ b/include/libbz3.h +@@ -22,6 +22,16 @@ + + #include + ++#ifdef bzip3_EXPORTS ++#ifdef _WIN32 ++ #define BZIP3_API __declspec(dllexport) ++#else ++ #define BZIP3_API __attribute__((visibility("default"))) ++#endif ++#else ++ #define BZIP3_API ++#endif ++ + #define BZ3_OK 0 + #define BZ3_ERR_OUT_OF_BOUNDS -1 + #define BZ3_ERR_BWT -2 +@@ -35,31 +45,31 @@ struct bz3_state; + /** + * @brief Get the last error number associated with a given state. + */ +-int8_t bz3_last_error(struct bz3_state * state); ++BZIP3_API int8_t bz3_last_error(struct bz3_state * state); + + /** + * @brief Return a user-readable message explaining the cause of the last error. + */ +-const char * bz3_strerror(struct bz3_state * state); ++BZIP3_API const char * bz3_strerror(struct bz3_state * state); + + /** + * @brief Construct a new block encoder state, which will encode blocks as big as the given block size. + * The decoder will be able to decode blocks at most as big as the given block size. + * Returns NULL in case allocation fails or the block size is not between 65K and 511M + */ +-struct bz3_state * bz3_new(int32_t block_size); ++BZIP3_API struct bz3_state * bz3_new(int32_t block_size); + + /** + * @brief Free the memory occupied by a block encoder state. + */ +-void bz3_free(struct bz3_state * state); ++BZIP3_API void bz3_free(struct bz3_state * state); + + /** + * @brief Encode a single block. Returns the amount of bytes written to `buffer'. + * `buffer' must be able to hold at least `size + size / 50 + 32' bytes. The size must not + * exceed the block size associated with the state. + */ +-int32_t bz3_encode_block(struct bz3_state * state, uint8_t * buffer, int32_t size); ++BZIP3_API int32_t bz3_encode_block(struct bz3_state * state, uint8_t * buffer, int32_t size); + + /** + * @brief Decode a single block. +@@ -68,7 +78,7 @@ int32_t bz3_encode_block(struct bz3_state * state, uint8_t * buffer, int32_t siz + * @param size The size of the compressed data in `buffer' + * @param orig_size The original size of the data before compression. + */ +-int32_t bz3_decode_block(struct bz3_state * state, uint8_t * buffer, int32_t size, int32_t orig_size); ++BZIP3_API int32_t bz3_decode_block(struct bz3_state * state, uint8_t * buffer, int32_t size, int32_t orig_size); + + /** + * @brief Encode `n' blocks, all in parallel. +@@ -80,13 +90,13 @@ int32_t bz3_decode_block(struct bz3_state * state, uint8_t * buffer, int32_t siz + * + * Present in the shared library only if -lpthread was present during building. + */ +-void bz3_encode_blocks(struct bz3_state * states[], uint8_t * buffers[], int32_t sizes[], int32_t n); ++BZIP3_API void bz3_encode_blocks(struct bz3_state * states[], uint8_t * buffers[], int32_t sizes[], int32_t n); + + /** + * @brief Decode `n' blocks, all in parallel. + * Same specifics as `bz3_encode_blocks', but doesn't overwrite `sizes'. + */ +-void bz3_decode_blocks(struct bz3_state * states[], uint8_t * buffers[], int32_t sizes[], int32_t orig_sizes[], ++BZIP3_API void bz3_decode_blocks(struct bz3_state * states[], uint8_t * buffers[], int32_t sizes[], int32_t orig_sizes[], + int32_t n); + + #endif diff --git a/recipes/bzip3/all/test_v1_package/CMakeLists.txt b/recipes/bzip3/all/test_v1_package/CMakeLists.txt index 8c1771e7b1081..925ecbe19e448 100644 --- a/recipes/bzip3/all/test_v1_package/CMakeLists.txt +++ b/recipes/bzip3/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(bzip3 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE bzip3::bzip3) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/bzip3/config.yml b/recipes/bzip3/config.yml index f7bc2bb892fbd..e28ea261ce304 100644 --- a/recipes/bzip3/config.yml +++ b/recipes/bzip3/config.yml @@ -1,3 +1,17 @@ versions: + "1.2.2": + folder: all + "1.2.1": + folder: all + "1.2.0": + folder: all + "1.1.8": + folder: all + "1.1.7": + folder: all + "1.1.6": + folder: all + "1.1.5": + folder: all "1.1.4": folder: all diff --git a/recipes/c-ares/all/conandata.yml b/recipes/c-ares/all/conandata.yml index 245e6d426beea..a2f22979a5926 100644 --- a/recipes/c-ares/all/conandata.yml +++ b/recipes/c-ares/all/conandata.yml @@ -1,29 +1,47 @@ sources: + "1.19.0": + url: "https://github.com/c-ares/c-ares/releases/download/cares-1_19_0/c-ares-1.19.0.tar.gz" + sha256: "bfceba37e23fd531293829002cac0401ef49a6dc55923f7f92236585b7ad1dd3" "1.18.1": url: "https://github.com/c-ares/c-ares/releases/download/cares-1_18_1/c-ares-1.18.1.tar.gz" sha256: "1a7d52a8a84a9fbffb1be9133c0f6e17217d91ea5a6fa61f6b4729cda78ebbcf" "1.17.2": - sha256: 444b7dbf33cb6e8a764d069e3485cbaaa28386d60eace6988275c3cb9534d300 - url: https://github.com/c-ares/c-ares/archive/refs/tags/cares-1_17_2.tar.gz + url: "https://github.com/c-ares/c-ares/releases/download/cares-1_17_2/c-ares-1.17.2.tar.gz" + sha256: "4803c844ce20ce510ef0eb83f8ea41fa24ecaae9d280c468c582d2bb25b3913d" "1.17.1": - sha256: 61f7cf09605f5e38d4828f82d0e2ddb9de8e355ecfd6819b740691c644583b8f - url: https://github.com/c-ares/c-ares/archive/cares-1_17_1.tar.gz + url: "https://github.com/c-ares/c-ares/releases/download/cares-1_17_1/c-ares-1.17.1.tar.gz" + sha256: "d73dd0f6de824afd407ce10750ea081af47eba52b8a6cb307d220131ad93fc40" "1.16.1": - sha256: 870962cc8f6b352303c404ce848e2ea1f1072f3c0a940042209a72179511c08c - url: https://github.com/c-ares/c-ares/archive/cares-1_16_1.tar.gz + url: "https://github.com/c-ares/c-ares/releases/download/cares-1_16_1/c-ares-1.16.1.tar.gz" + sha256: "d08312d0ecc3bd48eee0a4cc0d2137c9f194e0a28de2028928c0f6cae85f86ce" "1.15.0": - sha256: 7deb7872cbd876c29036d5f37e30c4cbc3cc068d59d8b749ef85bb0736649f04 - url: https://github.com/c-ares/c-ares/archive/cares-1_15_0.tar.gz + url: "https://github.com/c-ares/c-ares/releases/download/cares-1_15_0/c-ares-1.15.0.tar.gz" + sha256: "6cdb97871f2930530c97deb7cf5c8fa4be5a0b02c7cea6e7c7667672a39d6852" "1.14.0": - sha256: 62dd12f0557918f89ad6f5b759f0bf4727174ae9979499f5452c02be38d9d3e8 - url: https://github.com/c-ares/c-ares/archive/cares-1_14_0.tar.gz + url: "https://github.com/c-ares/c-ares/files/1731591/c-ares-1.14.0.tar.gz" + sha256: "45d3c1fd29263ceec2afc8ff9cd06d5f8f889636eb4e80ce3cc7f0eaf7aadc6e" patches: "1.17.1": - patch_file: "patches/upstream-pr-395-bundle-destination-v16-17.patch" + patch_description: "add `BUNDLE DESTINATION` to install" + patch_type: "portability" + patch_source: "https://github.com/c-ares/c-ares/pull/395" "1.16.1": - patch_file: "patches/upstream-pr-395-bundle-destination-v16-17.patch" + patch_description: "add `BUNDLE DESTINATION` to install" + patch_type: "portability" + patch_source: "https://github.com/c-ares/c-ares/pull/395" "1.15.0": - patch_file: "patches/upstream-pr-395-bundle-destination-v15.patch" + patch_description: "add `BUNDLE DESTINATION` to install" + patch_type: "portability" + patch_source: "https://github.com/c-ares/c-ares/pull/395" "1.14.0": - patch_file: "patches/option-tools.patch" + patch_description: "add `CARES_BUILD_TOOLS` option" + patch_type: "conan" + patch_source: "https://github.com/c-ares/c-ares/pull/214" - patch_file: "patches/upstream-pr-395-bundle-destination-v14.patch" + patch_description: "add `BUNDLE DESTINATION` to install" + patch_type: "portability" + patch_source: "https://github.com/c-ares/c-ares/pull/395" diff --git a/recipes/c-ares/all/conanfile.py b/recipes/c-ares/all/conanfile.py index d8b3c1bbab956..7eea8faebb9ed 100644 --- a/recipes/c-ares/all/conanfile.py +++ b/recipes/c-ares/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rm, rmdir +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rm, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class CAresConan(ConanFile): @@ -13,9 +13,10 @@ class CAresConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" description = "A C library for asynchronous DNS requests" - topics = ("c-ares", "dns") + topics = ("dns", "resolver", "async") homepage = "https://c-ares.haxx.se/" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,8 +30,7 @@ class CAresConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,22 +38,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -97,11 +90,6 @@ def package_info(self): elif is_apple_os(self): self.cpp_info.components["cares"].system_libs.append("resolv") - if self.options.tools: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["pkg_config"] = "libcares" self.cpp_info.components["cares"].names["cmake_find_package"] = "cares" @@ -109,3 +97,5 @@ def package_info(self): self.cpp_info.components["cares"].names["pkg_config"] = "libcares" self.cpp_info.components["cares"].set_property("cmake_target_name", "c-ares::cares") self.cpp_info.components["cares"].set_property("pkg_config_name", "libcares") + if self.options.tools: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/c-ares/all/test_package/conanfile.py b/recipes/c-ares/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/c-ares/all/test_package/conanfile.py +++ b/recipes/c-ares/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/c-ares/all/test_v1_package/CMakeLists.txt b/recipes/c-ares/all/test_v1_package/CMakeLists.txt index 7a0669d9d064c..925ecbe19e448 100644 --- a/recipes/c-ares/all/test_v1_package/CMakeLists.txt +++ b/recipes/c-ares/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(c-ares REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE c-ares::cares) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/c-ares/config.yml b/recipes/c-ares/config.yml index 8355a60395bae..ec5c9c9aa795e 100644 --- a/recipes/c-ares/config.yml +++ b/recipes/c-ares/config.yml @@ -1,4 +1,6 @@ versions: + "1.19.0": + folder: all "1.18.1": folder: all "1.17.2": diff --git a/recipes/c-blosc/all/CMakeLists.txt b/recipes/c-blosc/all/CMakeLists.txt deleted file mode 100644 index 541886c829c5a..0000000000000 --- a/recipes/c-blosc/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/c-blosc/all/conandata.yml b/recipes/c-blosc/all/conandata.yml index ce6bd3efcd60b..c8c0ea232bc21 100644 --- a/recipes/c-blosc/all/conandata.yml +++ b/recipes/c-blosc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.21.3": + url: "https://github.com/Blosc/c-blosc/archive/v1.21.3.tar.gz" + sha256: "941016c4564bca662080bb01aea74f06630bd665e598c6f6967fd91b2e2e0bb6" "1.21.1": url: "https://github.com/Blosc/c-blosc/archive/v1.21.1.tar.gz" sha256: "f387149eab24efa01c308e4cba0f59f64ccae57292ec9c794002232f7903b55b" @@ -21,24 +24,35 @@ sources: url: "https://github.com/Blosc/c-blosc/archive/v1.17.1.tar.gz" sha256: "19a6948b579c27e8ac440b4f077f99fc90e7292b1d9cb896bec0fd781d68fba2" patches: + "1.21.3": + - patch_file: "patches/cmake-dependencies-1.21.2+.patch" + patch_description: "use cci package" + patch_type: "conan" "1.21.1": - patch_file: "patches/cmake-dependencies-1.21.1+.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" "1.21.0": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" "1.20.1": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" "1.20.0": - patch_file: "patches/cmake-dependencies-1.20.0+.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" "1.19.0": - patch_file: "patches/cmake-dependencies-1.19.0.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" "1.18.1": - patch_file: "patches/cmake-dependencies-1.18.1-.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" "1.17.1": - patch_file: "patches/cmake-dependencies-1.18.1-.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" diff --git a/recipes/c-blosc/all/conanfile.py b/recipes/c-blosc/all/conanfile.py index 6d4729341decd..a349a37babbd2 100644 --- a/recipes/c-blosc/all/conanfile.py +++ b/recipes/c-blosc/all/conanfile.py @@ -1,9 +1,11 @@ -from conan import ConanFile, tools -from conan.tools.files import apply_conandata_patches -from conans import CMake +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class CbloscConan(ConanFile): @@ -34,25 +36,8 @@ class CbloscConan(ConanFile): "with_zstd": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -62,73 +47,78 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_lz4: - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.with_snappy: self.requires("snappy/1.1.9") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_zstd: self.requires("zstd/1.5.2") def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BLOSC_INSTALL"] = True + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.variables["BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_TESTS"] = False + if Version(self.version) >= "1.20.0": + tc.variables["BUILD_FUZZERS"] = False + tc.variables["BUILD_BENCHMARKS"] = False + simd_intrinsics = self.options.get_safe("simd_intrinsics", False) + tc.variables["DEACTIVATE_SSE2"] = simd_intrinsics not in ["sse2", "avx2"] + tc.variables["DEACTIVATE_AVX2"] = simd_intrinsics != "avx2" + tc.variables["DEACTIVATE_LZ4"] = not self.options.with_lz4 + tc.variables["DEACTIVATE_SNAPPY"] = not self.options.with_snappy + tc.variables["DEACTIVATE_ZLIB"] = not self.options.with_zlib + tc.variables["DEACTIVATE_ZSTD"] = not self.options.with_zstd + tc.variables["DEACTIVATE_SYMBOLS_CHECK"] = True + tc.variables["PREFER_EXTERNAL_LZ4"] = True + if Version(self.version) < "1.19.0": + tc.variables["PREFER_EXTERNAL_SNAPPY"] = True + tc.variables["PREFER_EXTERNAL_ZLIB"] = True + tc.variables["PREFER_EXTERNAL_ZSTD"] = True + tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True + # Generate a relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() - def build(self): - apply_conandata_patches(self) - tools.files.rmdir(self, os.path.join(self._source_subfolder, "cmake")) - cmake = self._configure_cmake() - cmake.build() + deps = CMakeDeps(self) + deps.generate() + def _patch_sources(self): + apply_conandata_patches(self) + rmdir(self, os.path.join(self.source_folder, "cmake")) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BLOSC_INSTALL"] = True - self._cmake.definitions["BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["BUILD_SHARED"] = self.options.shared - self._cmake.definitions["BUILD_TESTS"] = False - if tools.scm.Version(self.version) >= "1.20.0": - self._cmake.definitions["BUILD_FUZZERS"] = False - self._cmake.definitions["BUILD_BENCHMARKS"] = False - simd_intrinsics = self.options.get_safe("simd_intrinsics", False) - self._cmake.definitions["DEACTIVATE_SSE2"] = simd_intrinsics not in ["sse2", "avx2"] - self._cmake.definitions["DEACTIVATE_AVX2"] = simd_intrinsics != "avx2" - self._cmake.definitions["DEACTIVATE_LZ4"] = not self.options.with_lz4 - self._cmake.definitions["DEACTIVATE_SNAPPY"] = not self.options.with_snappy - self._cmake.definitions["DEACTIVATE_ZLIB"] = not self.options.with_zlib - self._cmake.definitions["DEACTIVATE_ZSTD"] = not self.options.with_zstd - self._cmake.definitions["DEACTIVATE_SYMBOLS_CHECK"] = True - self._cmake.definitions["PREFER_EXTERNAL_LZ4"] = True - if tools.scm.Version(self.version) < "1.19.0": - self._cmake.definitions["PREFER_EXTERNAL_SNAPPY"] = True - self._cmake.definitions["PREFER_EXTERNAL_ZLIB"] = True - self._cmake.definitions["PREFER_EXTERNAL_ZSTD"] = True - # Generate a relocatable shared lib on Macos - self._cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): licenses = ["BLOSC.txt", "BITSHUFFLE.txt", "FASTLZ.txt"] for license_file in licenses: - self.copy(license_file, dst="licenses", src=os.path.join(self._source_subfolder, "LICENSES")) - cmake = self._configure_cmake() + copy(self, license_file, src=os.path.join(self.source_folder, "LICENSES"), dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "blosc") - prefix = "lib" if self._is_msvc and not self.options.shared else "" - self.cpp_info.libs = ["{}blosc".format(prefix)] + prefix = "lib" if is_msvc(self) and not self.options.shared else "" + self.cpp_info.libs = [f"{prefix}blosc"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") - - # TODO: to remove in conan v2 once pkg_config generator removed - self.cpp_info.names["pkg_config"] = "blosc" + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/c-blosc/all/patches/cmake-dependencies-1.18.1-.patch b/recipes/c-blosc/all/patches/cmake-dependencies-1.18.1-.patch index 04f2ab0166de3..d4a2354fd9ed0 100644 --- a/recipes/c-blosc/all/patches/cmake-dependencies-1.18.1-.patch +++ b/recipes/c-blosc/all/patches/cmake-dependencies-1.18.1-.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -122,12 +122,11 @@ option(PREFER_EXTERNAL_ZLIB +@@ -122,12 +122,12 @@ option(PREFER_EXTERNAL_ZLIB option(PREFER_EXTERNAL_ZSTD "Find and use external Zstd library instead of included sources." OFF) @@ -10,6 +10,7 @@ if(NOT DEACTIVATE_LZ4) if(PREFER_EXTERNAL_LZ4) - find_package(LZ4) ++ find_package(lz4 REQUIRED CONFIG) + set(LZ4_FOUND TRUE) else() message(STATUS "Using LZ4 internal sources.") @@ -27,7 +28,7 @@ if (NOT DEACTIVATE_ZSTD) if (PREFER_EXTERNAL_ZSTD) - find_package(Zstd) -+ find_package(zstd) ++ find_package(zstd REQUIRED CONFIG) else () message(STATUS "Using ZSTD internal sources.") endif (PREFER_EXTERNAL_ZSTD) @@ -38,7 +39,7 @@ if(NOT DEACTIVATE_LZ4) if(LZ4_FOUND) - set(LIBS ${LIBS} ${LZ4_LIBRARY}) -+ set(LIBS ${LIBS} "CONAN_PKG::lz4") ++ set(LIBS ${LIBS} $,LZ4::lz4_shared,LZ4::lz4_static>) else(LZ4_FOUND) file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) set(SOURCES ${SOURCES} ${LZ4_FILES}) @@ -65,7 +66,7 @@ if (NOT DEACTIVATE_ZSTD) if (ZSTD_FOUND) - set(LIBS ${LIBS} ${ZSTD_LIBRARY}) -+ set(LIBS ${LIBS} "zstd::zstd") ++ set(LIBS ${LIBS} $,zstd::libzstd_shared,zstd::libzstd_static>) else (ZSTD_FOUND) file(GLOB ZSTD_FILES ${ZSTD_LOCAL_DIR}/common/*.c diff --git a/recipes/c-blosc/all/patches/cmake-dependencies-1.19.0.patch b/recipes/c-blosc/all/patches/cmake-dependencies-1.19.0.patch index 5ef7800ef0bef..3f5a9b46096f3 100644 --- a/recipes/c-blosc/all/patches/cmake-dependencies-1.19.0.patch +++ b/recipes/c-blosc/all/patches/cmake-dependencies-1.19.0.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -117,12 +117,11 @@ option(PREFER_EXTERNAL_ZLIB +@@ -117,12 +117,12 @@ option(PREFER_EXTERNAL_ZLIB option(PREFER_EXTERNAL_ZSTD "Find and use external Zstd library instead of included sources." OFF) @@ -10,6 +10,7 @@ if(NOT DEACTIVATE_LZ4) if(PREFER_EXTERNAL_LZ4) - find_package(LZ4) ++ find_package(lz4 REQUIRED CONFIG) + set(LZ4_FOUND TRUE) else() message(STATUS "Using LZ4 internal sources.") @@ -27,7 +28,7 @@ if (NOT DEACTIVATE_ZSTD) if (PREFER_EXTERNAL_ZSTD) - find_package(Zstd) -+ find_package(zstd) ++ find_package(zstd REQUIRED CONFIG) else () message(STATUS "Using ZSTD internal sources.") endif (PREFER_EXTERNAL_ZSTD) @@ -38,7 +39,7 @@ if(NOT DEACTIVATE_LZ4) if(LZ4_FOUND) - set(LIBS ${LIBS} ${LZ4_LIBRARY}) -+ set(LIBS ${LIBS} "CONAN_PKG::lz4") ++ set(LIBS ${LIBS} $,LZ4::lz4_shared,LZ4::lz4_static>) else(LZ4_FOUND) file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) set(SOURCES ${SOURCES} ${LZ4_FILES}) @@ -65,7 +66,7 @@ if (NOT DEACTIVATE_ZSTD) if (ZSTD_FOUND) - set(LIBS ${LIBS} ${ZSTD_LIBRARY}) -+ set(LIBS ${LIBS} "zstd::zstd") ++ set(LIBS ${LIBS} $,zstd::libzstd_shared,zstd::libzstd_static>) else (ZSTD_FOUND) file(GLOB ZSTD_FILES ${ZSTD_LOCAL_DIR}/common/*.c diff --git a/recipes/c-blosc/all/patches/cmake-dependencies-1.20.0+.patch b/recipes/c-blosc/all/patches/cmake-dependencies-1.20.0+.patch index c943456b7a005..428ddd7762cfb 100644 --- a/recipes/c-blosc/all/patches/cmake-dependencies-1.20.0+.patch +++ b/recipes/c-blosc/all/patches/cmake-dependencies-1.20.0+.patch @@ -1,6 +1,6 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -121,12 +121,11 @@ option(PREFER_EXTERNAL_ZLIB +@@ -121,12 +121,12 @@ option(PREFER_EXTERNAL_ZLIB option(PREFER_EXTERNAL_ZSTD "Find and use external Zstd library instead of included sources." OFF) @@ -10,6 +10,7 @@ if(NOT DEACTIVATE_LZ4) if(PREFER_EXTERNAL_LZ4) - find_package(LZ4) ++ find_package(lz4 REQUIRED CONFIG) + set(LZ4_FOUND TRUE) else() message(STATUS "Using LZ4 internal sources.") @@ -27,7 +28,7 @@ if (NOT DEACTIVATE_ZSTD) if (PREFER_EXTERNAL_ZSTD) - find_package(Zstd) -+ find_package(zstd) ++ find_package(zstd REQUIRED CONFIG) else () message(STATUS "Using ZSTD internal sources.") endif (PREFER_EXTERNAL_ZSTD) @@ -38,7 +39,7 @@ if(NOT DEACTIVATE_LZ4) if(LZ4_FOUND) - set(LIBS ${LIBS} ${LZ4_LIBRARY}) -+ set(LIBS ${LIBS} "CONAN_PKG::lz4") ++ set(LIBS ${LIBS} $,LZ4::lz4_shared,LZ4::lz4_static>) else(LZ4_FOUND) file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) set(SOURCES ${SOURCES} ${LZ4_FILES}) @@ -65,7 +66,7 @@ if (NOT DEACTIVATE_ZSTD) if (ZSTD_FOUND) - set(LIBS ${LIBS} ${ZSTD_LIBRARY}) -+ set(LIBS ${LIBS} "zstd::zstd") ++ set(LIBS ${LIBS} $,zstd::libzstd_shared,zstd::libzstd_static>) else (ZSTD_FOUND) file(GLOB ZSTD_FILES ${ZSTD_LOCAL_DIR}/common/*.c diff --git a/recipes/c-blosc/all/patches/cmake-dependencies-1.21.1+.patch b/recipes/c-blosc/all/patches/cmake-dependencies-1.21.1+.patch index 704fd3e436b1d..fb62441ddd89b 100644 --- a/recipes/c-blosc/all/patches/cmake-dependencies-1.21.1+.patch +++ b/recipes/c-blosc/all/patches/cmake-dependencies-1.21.1+.patch @@ -1,5 +1,3 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f5eff9e..92b35f2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -121,12 +121,12 @@ option(PREFER_EXTERNAL_ZLIB @@ -12,7 +10,7 @@ index f5eff9e..92b35f2 100644 if(NOT DEACTIVATE_LZ4) if(PREFER_EXTERNAL_LZ4) - find_package(LZ4) -+ ### find_package(LZ4) ++ find_package(lz4 REQUIRED CONFIG) + set(LZ4_FOUND TRUE) else() message(STATUS "Using LZ4 internal sources.") @@ -30,12 +28,10 @@ index f5eff9e..92b35f2 100644 if (NOT DEACTIVATE_ZSTD) if (PREFER_EXTERNAL_ZSTD) - find_package(Zstd) -+ find_package(zstd) ++ find_package(zstd REQUIRED CONFIG) else () message(STATUS "Using ZSTD internal sources.") endif (PREFER_EXTERNAL_ZSTD) -diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt -index 84b72e5..20b94e0 100644 --- a/blosc/CMakeLists.txt +++ b/blosc/CMakeLists.txt @@ -91,7 +91,7 @@ endif(WIN32) @@ -43,7 +39,7 @@ index 84b72e5..20b94e0 100644 if(NOT DEACTIVATE_LZ4) if(LZ4_FOUND) - set(LIBS ${LIBS} ${LZ4_LIBRARY}) -+ set(LIBS ${LIBS} "CONAN_PKG::lz4") ++ set(LIBS ${LIBS} $,LZ4::lz4_shared,LZ4::lz4_static>) else(LZ4_FOUND) file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) set(SOURCES ${SOURCES} ${LZ4_FILES}) @@ -70,7 +66,7 @@ index 84b72e5..20b94e0 100644 if (NOT DEACTIVATE_ZSTD) if (ZSTD_FOUND) - set(LIBS ${LIBS} ${ZSTD_LIBRARY}) -+ set(LIBS ${LIBS} "zstd::zstd") ++ set(LIBS ${LIBS} $,zstd::libzstd_shared,zstd::libzstd_static>) else (ZSTD_FOUND) file(GLOB ZSTD_FILES ${ZSTD_LOCAL_DIR}/common/*.c diff --git a/recipes/c-blosc/all/patches/cmake-dependencies-1.21.2+.patch b/recipes/c-blosc/all/patches/cmake-dependencies-1.21.2+.patch new file mode 100644 index 0000000000000..09a5a7401237e --- /dev/null +++ b/recipes/c-blosc/all/patches/cmake-dependencies-1.21.2+.patch @@ -0,0 +1,71 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 54d4817..2ba937d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -134,7 +134,8 @@ include(GNUInstallDirs) + + if(NOT DEACTIVATE_LZ4) + if(PREFER_EXTERNAL_LZ4) +- find_package(LZ4) ++ find_package(lz4 REQUIRED CONFIG) ++ set(LZ4_FOUND TRUE) + else() + message(STATUS "Using LZ4 internal sources.") + endif() +@@ -156,7 +157,6 @@ endif() + if(NOT DEACTIVATE_ZLIB) + # import the ZLIB_ROOT environment variable to help finding the zlib library + if(PREFER_EXTERNAL_ZLIB) +- set(ZLIB_ROOT $ENV{ZLIB_ROOT}) + find_package(ZLIB) + if(NOT ZLIB_FOUND ) + message(STATUS "No zlib found. Using internal sources.") +@@ -171,7 +171,7 @@ endif() + + if(NOT DEACTIVATE_ZSTD) + if(PREFER_EXTERNAL_ZSTD) +- find_package(Zstd) ++ find_package(zstd REQUIRED CONFIG) + else() + message(STATUS "Using ZSTD internal sources.") + endif() +diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt +index fd6d695..8ef909d 100644 +--- a/blosc/CMakeLists.txt ++++ b/blosc/CMakeLists.txt +@@ -88,7 +88,7 @@ endif(WIN32) + + if(NOT DEACTIVATE_LZ4) + if(LZ4_FOUND) +- set(LIBS ${LIBS} ${LZ4_LIBRARY}) ++ set(LIBS ${LIBS} $,LZ4::lz4_shared,LZ4::lz4_static>) + else(LZ4_FOUND) + file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) + set(SOURCES ${SOURCES} ${LZ4_FILES}) +@@ -98,7 +98,7 @@ endif(NOT DEACTIVATE_LZ4) + + if(NOT DEACTIVATE_SNAPPY) + if(SNAPPY_FOUND) +- set(LIBS ${LIBS} ${SNAPPY_LIBRARY}) ++ set(LIBS ${LIBS} "Snappy::snappy") + else(SNAPPY_FOUND) + file(GLOB SNAPPY_FILES ${SNAPPY_LOCAL_DIR}/*.cc) + set(SOURCES ${SOURCES} ${SNAPPY_FILES}) +@@ -108,7 +108,7 @@ endif(NOT DEACTIVATE_SNAPPY) + + if(NOT DEACTIVATE_ZLIB) + if(ZLIB_FOUND) +- set(LIBS ${LIBS} ${ZLIB_LIBRARY}) ++ set(LIBS ${LIBS} "ZLIB::ZLIB") + else(ZLIB_FOUND) + file(GLOB ZLIB_FILES ${ZLIB_LOCAL_DIR}/*.c) + set(SOURCES ${SOURCES} ${ZLIB_FILES}) +@@ -118,7 +118,7 @@ endif(NOT DEACTIVATE_ZLIB) + + if (NOT DEACTIVATE_ZSTD) + if (ZSTD_FOUND) +- set(LIBS ${LIBS} ${ZSTD_LIBRARY}) ++ set(LIBS ${LIBS} $,zstd::libzstd_shared,zstd::libzstd_static>) + else (ZSTD_FOUND) + # Enable assembly code only when not using MSVC *and* x86 is there + if((NOT MSVC) AND COMPILER_SUPPORT_SSE2) # if SSE2 is here, this is an x86 platform diff --git a/recipes/c-blosc/all/test_package/CMakeLists.txt b/recipes/c-blosc/all/test_package/CMakeLists.txt index e54e578850692..e73da46b32d37 100644 --- a/recipes/c-blosc/all/test_package/CMakeLists.txt +++ b/recipes/c-blosc/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(c-blosc REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} c-blosc::c-blosc) +target_link_libraries(${PROJECT_NAME} PRIVATE c-blosc::c-blosc) diff --git a/recipes/c-blosc/all/test_package/conanfile.py b/recipes/c-blosc/all/test_package/conanfile.py index 72910d4a2a0b5..0a6bc68712d90 100644 --- a/recipes/c-blosc/all/test_package/conanfile.py +++ b/recipes/c-blosc/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -from conan import ConanFile, tools -from conans import CMake +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.build.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/c-blosc/all/test_v1_package/CMakeLists.txt b/recipes/c-blosc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de3b75d9538de --- /dev/null +++ b/recipes/c-blosc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/c-blosc/all/test_v1_package/conanfile.py b/recipes/c-blosc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..72910d4a2a0b5 --- /dev/null +++ b/recipes/c-blosc/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conan import ConanFile, tools +from conans import CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.build.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/c-blosc/config.yml b/recipes/c-blosc/config.yml index 600b8bb73358e..5798e3590a6d3 100644 --- a/recipes/c-blosc/config.yml +++ b/recipes/c-blosc/config.yml @@ -1,4 +1,6 @@ versions: + "1.21.3": + folder: all "1.21.1": folder: all "1.21.0": diff --git a/recipes/c-blosc2/all/CMakeLists.txt b/recipes/c-blosc2/all/CMakeLists.txt deleted file mode 100644 index dd348757f3de8..0000000000000 --- a/recipes/c-blosc2/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/c-blosc2/all/conandata.yml b/recipes/c-blosc2/all/conandata.yml index 81c0e81ea55e8..2dea9f28ab028 100644 --- a/recipes/c-blosc2/all/conandata.yml +++ b/recipes/c-blosc2/all/conandata.yml @@ -1,9 +1,45 @@ sources: + "2.6.1": + url: "https://github.com/Blosc/c-blosc2/archive/v2.6.1.tar.gz" + sha256: "514a793368093893c1a7cae030f7e31faca7f86465ae69dd576f256d8bf28c08" + "2.6.0": + url: "https://github.com/Blosc/c-blosc2/archive/v2.6.0.tar.gz" + sha256: "ca4fc79a7c4a4d4f53da856ee0bb7083c16236210fdd6263397124572c25a507" + "2.4.3": + url: "https://github.com/Blosc/c-blosc2/archive/v2.4.3.tar.gz" + sha256: "d4aa5e0794598794f20ab950e973d44f0d0d9c133ea1a5a07cb200fa54d2e036" + "2.4.2": + url: "https://github.com/Blosc/c-blosc2/archive/v2.4.2.tar.gz" + sha256: "763ded7a6286abd248a79b1560ce8bfda11018b699a450b3e43c529f284a5232" + "2.4.1": + url: "https://github.com/Blosc/c-blosc2/archive/refs/tags/v2.4.1.tar.gz" + sha256: "f09a43bfac563ceda611a213c799ca5359c3b629281e0a4f3a543e692a64a931" "2.2.0": url: "https://github.com/Blosc/c-blosc2/archive/refs/tags/v2.2.0.tar.gz" sha256: "66f9977de26d6bc9ea1c0e623d873c3225e4fff709aa09b3335fd09d41d57c0e" patches: + "2.6.1": + - patch_file: "patches/2.6.0-0001-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" + "2.6.0": + - patch_file: "patches/2.6.0-0001-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" + "2.4.3": + - patch_file: "patches/2.4.1-0001-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" + "2.4.2": + - patch_file: "patches/2.4.1-0001-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" + "2.4.1": + - patch_file: "patches/2.4.1-0001-fix-cmake.patch" + patch_description: "use cci package" + patch_type: "conan" "2.2.0": - patch_file: "patches/2.2.0-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" diff --git a/recipes/c-blosc2/all/conanfile.py b/recipes/c-blosc2/all/conanfile.py index 598a57dd49f99..5be0280182140 100644 --- a/recipes/c-blosc2/all/conanfile.py +++ b/recipes/c-blosc2/all/conanfile.py @@ -1,10 +1,13 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile from conan.tools.microsoft import is_msvc +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, copy, rm, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version + import os -import functools import glob -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.52.0" class CBlosc2Conan(ConanFile): name = "c-blosc2" @@ -19,7 +22,7 @@ class CBlosc2Conan(ConanFile): "fPIC": [True, False], "simd_intrinsics": [None, "sse2", "avx2"], "with_lz4": [True, False], - "with_zlib": [None, "zlib", "zlib-ng"], + "with_zlib": [None, "zlib", "zlib-ng", "zlib-ng-compat"], "with_zstd": [True, False], "with_plugins": [True, False], } @@ -32,20 +35,9 @@ class CBlosc2Conan(ConanFile): "with_zstd": True, "with_plugins": True, } - generators = "cmake", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -55,78 +47,114 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + # c-blosc2 uses zlib-ng with zlib compat options. - if self.options.with_zlib == "zlib-ng": + if self.options.with_zlib == "zlib-ng-compat": self.options["zlib-ng"].zlib_compat = True + elif self.options.with_zlib == "zlib-ng": + self.options["zlib-ng"].zlib_compat = False + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_lz4: - self.requires("lz4/1.9.3") - if self.options.with_zlib == "zlib-ng": + self.requires("lz4/1.9.4") + if self.options.with_zlib in ["zlib-ng", "zlib-ng-compat"]: self.requires("zlib-ng/2.0.6") elif self.options.with_zlib == "zlib": - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_zstd: self.requires("zstd/1.5.2") - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "2.4.1" and not self._cmake_new_enough("3.16.3"): + self.tool_requires("cmake/3.25.0") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BLOSC_IS_SUBPROJECT"] = False - cmake.definitions["BLOSC_INSTALL"] = True - cmake.definitions["BUILD_STATIC"] = not self.options.shared - cmake.definitions["BUILD_SHARED"] = self.options.shared - cmake.definitions["BUILD_TESTS"] = False - cmake.definitions["BUILD_FUZZERS"] = False - cmake.definitions["BUILD_BENCHMARKS"] = False - cmake.definitions["BUILD_EXAMPLES"] = False + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BLOSC_IS_SUBPROJECT"] = False + tc.cache_variables["BLOSC_INSTALL"] = True + tc.cache_variables["BUILD_STATIC"] = not bool(self.options.shared) + tc.cache_variables["BUILD_SHARED"] = bool(self.options.shared) + tc.cache_variables["BUILD_TESTS"] = False + tc.cache_variables["BUILD_FUZZERS"] = False + tc.cache_variables["BUILD_BENCHMARKS"] = False + tc.cache_variables["BUILD_EXAMPLES"] = False simd_intrinsics = self.options.get_safe("simd_intrinsics", False) - cmake.definitions["DEACTIVATE_AVX2"] = simd_intrinsics != "avx2" - cmake.definitions["DEACTIVATE_LZ4"] = not self.options.with_lz4 - cmake.definitions["PREFER_EXTERNAL_LZ4"] = self.options.with_lz4 - cmake.definitions["DEACTIVATE_ZLIB"] = self.options.with_zlib == None - cmake.definitions["PREFER_EXTERNAL_ZLIB"] = self.options.with_zlib != None - cmake.definitions["DEACTIVATE_ZSTD"] = not self.options.with_zstd - cmake.definitions["PREFER_EXTERNAL_ZSTD"] = self.options.with_zstd - cmake.definitions["BUILD_PLUGINS"] = self.options.with_plugins - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.cache_variables["DEACTIVATE_AVX2"] = simd_intrinsics != "avx2" + tc.cache_variables["DEACTIVATE_LZ4"] = not bool(self.options.with_lz4) + tc.cache_variables["PREFER_EXTERNAL_LZ4"] = True + tc.cache_variables["DEACTIVATE_ZLIB"] = self.options.with_zlib is None + tc.cache_variables["PREFER_EXTERNAL_ZLIB"] = True + tc.cache_variables["DEACTIVATE_ZSTD"] = not bool(self.options.with_zstd) + tc.cache_variables["PREFER_EXTERNAL_ZSTD"] = True + tc.cache_variables["BUILD_PLUGINS"] = bool(self.options.with_plugins) + if self.options.with_zlib == "zlib-ng-compat": + tc.preprocessor_definitions["ZLIB_COMPAT"] = "1" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) - for filename in glob.glob(os.path.join(self._source_subfolder, "cmake", "Find*.cmake")): + for filename in glob.glob(os.path.join(self.source_folder, "cmake", "Find*.cmake")): if os.path.basename(filename) not in [ "FindSIMD.cmake", ]: - os.remove(filename) + rm(self, os.path.basename(filename), os.path.join(self.source_folder, "cmake")) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): licenses = ["BLOSC.txt", "BITSHUFFLE.txt", "FASTLZ.txt", "LZ4.txt", "ZLIB.txt", "STDINT.txt"] for license_file in licenses: - self.copy(license_file, dst="licenses", src=os.path.join(self._source_subfolder, "LICENSES")) - cmake = self._configure_cmake() + copy(self, pattern=license_file, dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "LICENSES")) + + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # Remove MS runtime files for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), dll_pattern_to_remove) + rm(self, pattern=dll_pattern_to_remove, folder=os.path.join(self.package_folder, "bin"), recursive=True) def package_info(self): self.cpp_info.set_property("pkg_config_name", "blosc2") + prefix = "lib" if is_msvc(self) and not self.options.shared else "" self.cpp_info.libs = ["{}blosc2".format(prefix)] if self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/c-blosc2/all/patches/2.2.0-0001-fix-cmake.patch b/recipes/c-blosc2/all/patches/2.2.0-0001-fix-cmake.patch index ea02b0e3d45f3..cef3c154b1ab2 100644 --- a/recipes/c-blosc2/all/patches/2.2.0-0001-fix-cmake.patch +++ b/recipes/c-blosc2/all/patches/2.2.0-0001-fix-cmake.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index bd8cb34..5d8981f 100644 +index bd8cb34..9c4cfe0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,7 +68,8 @@ if(NOT WIN32) @@ -12,7 +12,7 @@ index bd8cb34..5d8981f 100644 if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} VERSION_GREATER 3.4) cmake_policy(SET CMP0063 NEW) endif() -@@ -144,26 +145,17 @@ if(BUILD_LITE) +@@ -144,26 +145,26 @@ if(BUILD_LITE) endif() if(PREFER_EXTERNAL_LZ4) @@ -26,15 +26,17 @@ index bd8cb34..5d8981f 100644 if(PREFER_EXTERNAL_ZLIB) - find_package(ZLIB_NG) - if (ZLIB_NG_FOUND) -- set(HAVE_ZLIB_NG TRUE) -- else() -- find_package(ZLIB) -- endif() -- ++ find_package(zlib-ng) ++ if (zlib-ng_FOUND) + set(HAVE_ZLIB_NG TRUE) + else() + find_package(ZLIB) + endif() + - if(NOT (ZLIB_NG_FOUND OR ZLIB_FOUND)) -- message(STATUS "No ZLIB found. Using ZLIB-NG internal sources.") -- endif() -+ find_package(ZLIB REQUIRED) ++ if(NOT (zlib-ng_FOUND OR ZLIB_FOUND)) + message(STATUS "No ZLIB found. Using ZLIB-NG internal sources.") + endif() endif() - if (NOT (ZLIB_NG_FOUND OR ZLIB_FOUND)) @@ -42,7 +44,7 @@ index bd8cb34..5d8981f 100644 message(STATUS "Using ZLIB-NG internal sources for ZLIB support.") set(HAVE_ZLIB_NG TRUE) add_definitions(-DZLIB_COMPAT) -@@ -184,7 +176,7 @@ endif() +@@ -184,7 +185,7 @@ endif() if(NOT DEACTIVATE_ZSTD) if(PREFER_EXTERNAL_ZSTD) @@ -51,3 +53,75 @@ index bd8cb34..5d8981f 100644 if(NOT ZSTD_FOUND) message(STATUS "No ZSTD library found. Using internal sources.") endif() +diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt +index 7f3eac6..c7afecd 100644 +--- a/blosc/CMakeLists.txt ++++ b/blosc/CMakeLists.txt +@@ -10,16 +10,16 @@ set(CMAKE_C_VISIBILITY_PRESET hidden) + + # includes + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) +-if(LZ4_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_INCLUDE_DIR}) ++if(lz4_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${lz4_INCLUDE_DIR}) + else() + set(LZ4_LOCAL_DIR ${INTERNAL_LIBS}/lz4-1.9.3) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_LOCAL_DIR}) + endif() + + if(NOT DEACTIVATE_ZLIB) +- if(ZLIB_NG_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_NG_INCLUDE_DIR}) ++ if(zlib-ng_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${zlib-ng_INCLUDE_DIR}) + elseif(ZLIB_FOUND) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) + else() +@@ -29,8 +29,8 @@ if(NOT DEACTIVATE_ZLIB) + endif() + + if(NOT DEACTIVATE_ZSTD) +- if(ZSTD_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_INCLUDE_DIR}) ++ if(zstd_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${zstd_INCLUDE_DIR}) + else() + set(ZSTD_LOCAL_DIR ${INTERNAL_LIBS}/zstd-1.5.2) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_LOCAL_DIR} +@@ -90,8 +90,8 @@ else() + endif() + endif() + +-if(LZ4_FOUND) +- set(LIBS ${LIBS} ${LZ4_LIBRARY}) ++if(lz4_FOUND) ++ set(LIBS ${LIBS} ${lz4_LIBRARIES}) + else() + file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) + set(SOURCES ${SOURCES} ${LZ4_FILES}) +@@ -99,10 +99,10 @@ else() + endif() + + if(NOT DEACTIVATE_ZLIB) +- if(ZLIB_NG_FOUND) +- set(LIBS ${LIBS} ${ZLIB_NG_LIBRARY}) ++ if(zlib-ng_FOUND) ++ set(LIBS ${LIBS} ${zlib-ng_LIBRARIES}) + elseif(ZLIB_FOUND) +- set(LIBS ${LIBS} ${ZLIB_LIBRARY}) ++ set(LIBS ${LIBS} ${ZLIB_LIBRARIES}) + else() + set(ZLIB_LOCAL_DIR ${INTERNAL_LIBS}/${ZLIB_NG_DIR}) + file(GLOB ZLIB_FILES ${ZLIB_LOCAL_DIR}/*.c) +@@ -112,8 +112,8 @@ if(NOT DEACTIVATE_ZLIB) + endif() + + if(NOT DEACTIVATE_ZSTD) +- if(ZSTD_FOUND) +- set(LIBS ${LIBS} ${ZSTD_LIBRARY}) ++ if(zstd_FOUND) ++ set(LIBS ${LIBS} ${zstd_LIBRARIES}) + else() + # Enable assembly code only when not using MSVC *and* x86 is there + if((NOT MSVC) AND COMPILER_SUPPORT_SSE2) # if SSE2 is here, this is an x86 platform diff --git a/recipes/c-blosc2/all/patches/2.4.1-0001-fix-cmake.patch b/recipes/c-blosc2/all/patches/2.4.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..565d775f0be52 --- /dev/null +++ b/recipes/c-blosc2/all/patches/2.4.1-0001-fix-cmake.patch @@ -0,0 +1,119 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 866c7f6..c2e2501 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -144,26 +144,26 @@ if(BUILD_LITE) + endif() + + if(PREFER_EXTERNAL_LZ4) +- find_package(LZ4) ++ find_package(lz4) + else() + message(STATUS "Using LZ4 internal sources.") + endif() + + if(NOT DEACTIVATE_ZLIB) + if(PREFER_EXTERNAL_ZLIB) +- find_package(ZLIB_NG) +- if (ZLIB_NG_FOUND) ++ find_package(zlib-ng) ++ if (zlib-ng_FOUND) + set(HAVE_ZLIB_NG TRUE) + else() + find_package(ZLIB) + endif() + +- if(NOT (ZLIB_NG_FOUND OR ZLIB_FOUND)) ++ if(NOT (zlib-ng_FOUND OR ZLIB_FOUND)) + message(STATUS "No ZLIB found. Using ZLIB-NG internal sources.") + endif() + endif() + +- if (NOT (ZLIB_NG_FOUND OR ZLIB_FOUND)) ++ if (0) + message(STATUS "Using ZLIB-NG internal sources for ZLIB support.") + set(HAVE_ZLIB_NG TRUE) + add_definitions(-DZLIB_COMPAT) +@@ -184,8 +184,8 @@ endif() + + if(NOT DEACTIVATE_ZSTD) + if(PREFER_EXTERNAL_ZSTD) +- find_package(ZSTD) +- if(NOT ZSTD_FOUND) ++ find_package(zstd) ++ if(NOT zstd_FOUND) + message(STATUS "No ZSTD library found. Using internal sources.") + endif() + else() +diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt +index 441bab6..f17e467 100644 +--- a/blosc/CMakeLists.txt ++++ b/blosc/CMakeLists.txt +@@ -10,16 +10,16 @@ set(CMAKE_C_VISIBILITY_PRESET hidden) + + # includes + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) +-if(LZ4_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_INCLUDE_DIR}) ++if(lz4_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${lz4_INCLUDE_DIR}) + else() + set(LZ4_LOCAL_DIR ${INTERNAL_LIBS}/lz4-1.9.4) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_LOCAL_DIR}) + endif() + + if(NOT DEACTIVATE_ZLIB) +- if(ZLIB_NG_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_NG_INCLUDE_DIR}) ++ if(zlib-ng_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${zlib-ng_INCLUDE_DIR}) + elseif(ZLIB_FOUND) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) + else() +@@ -29,8 +29,8 @@ if(NOT DEACTIVATE_ZLIB) + endif() + + if(NOT DEACTIVATE_ZSTD) +- if(ZSTD_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_INCLUDE_DIR}) ++ if(zstd_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${zstd_INCLUDE_DIR}) + else() + set(ZSTD_LOCAL_DIR ${INTERNAL_LIBS}/zstd-1.5.2) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_LOCAL_DIR} +@@ -90,8 +90,8 @@ else() + endif() + endif() + +-if(LZ4_FOUND) +- set(LIBS ${LIBS} ${LZ4_LIBRARY}) ++if(lz4_FOUND) ++ set(LIBS ${LIBS} ${lz4_LIBRARIES}) + else() + file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) + set(SOURCES ${SOURCES} ${LZ4_FILES}) +@@ -99,10 +99,10 @@ else() + endif() + + if(NOT DEACTIVATE_ZLIB) +- if(ZLIB_NG_FOUND) +- set(LIBS ${LIBS} ${ZLIB_NG_LIBRARY}) ++ if(zlib-ng_FOUND) ++ set(LIBS ${LIBS} ${zlib-ng_LIBRARIES}) + elseif(ZLIB_FOUND) +- set(LIBS ${LIBS} ${ZLIB_LIBRARY}) ++ set(LIBS ${LIBS} ${ZLIB_LIBRARIES}) + else() + set(ZLIB_LOCAL_DIR ${INTERNAL_LIBS}/${ZLIB_NG_DIR}) + file(GLOB ZLIB_FILES ${ZLIB_LOCAL_DIR}/*.c) +@@ -112,8 +112,8 @@ if(NOT DEACTIVATE_ZLIB) + endif() + + if(NOT DEACTIVATE_ZSTD) +- if(ZSTD_FOUND) +- set(LIBS ${LIBS} ${ZSTD_LIBRARY}) ++ if(zstd_FOUND) ++ set(LIBS ${LIBS} ${zstd_LIBRARIES}) + else() + # Enable assembly code only when not using MSVC *and* x86 is there + if((NOT MSVC) AND COMPILER_SUPPORT_SSE2) # if SSE2 is here, this is an x86 platform diff --git a/recipes/c-blosc2/all/patches/2.6.0-0001-fix-cmake.patch b/recipes/c-blosc2/all/patches/2.6.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..5c30c1a180c48 --- /dev/null +++ b/recipes/c-blosc2/all/patches/2.6.0-0001-fix-cmake.patch @@ -0,0 +1,122 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 43910d1..199ef1d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -144,26 +144,26 @@ if(BUILD_LITE) + endif() + + if(PREFER_EXTERNAL_LZ4) +- find_package(LZ4) ++ find_package(lz4) + else() + message(STATUS "Using LZ4 internal sources.") + endif() + + if(NOT DEACTIVATE_ZLIB) + if(PREFER_EXTERNAL_ZLIB) +- find_package(ZLIB_NG) +- if(ZLIB_NG_FOUND) +- set(HAVE_ZLIB_NG TRUE) ++ find_package(zlib-ng) ++ if (zlib-ng_FOUND) ++ set(HAVE_ZLIB_NG TRUE) + else() + find_package(ZLIB) + endif() + +- if(NOT (ZLIB_NG_FOUND OR ZLIB_FOUND)) ++ if(NOT (zlib-ng_FOUND OR ZLIB_FOUND)) + message(STATUS "No ZLIB found. Using ZLIB-NG internal sources.") + endif() + endif() + +- if(NOT (ZLIB_NG_FOUND OR ZLIB_FOUND)) ++ if(0) + message(STATUS "Using ZLIB-NG internal sources for ZLIB support.") + set(HAVE_ZLIB_NG TRUE) + add_definitions(-DZLIB_COMPAT) +@@ -184,9 +184,9 @@ endif() + + if(NOT DEACTIVATE_ZSTD) + if(PREFER_EXTERNAL_ZSTD) +- find_package(ZSTD) +- if(NOT ZSTD_FOUND) +- message(STATUS "No ZSTD library found. Using internal sources.") ++ find_package(zstd) ++ if(NOT zstd_FOUND) ++ message(STATUS "No ZSTD library found. Using internal sources.") + endif() + else() + message(STATUS "Using ZSTD internal sources.") +diff --git a/blosc/CMakeLists.txt b/blosc/CMakeLists.txt +index 441bab6..f17e467 100644 +--- a/blosc/CMakeLists.txt ++++ b/blosc/CMakeLists.txt +@@ -10,16 +10,16 @@ set(CMAKE_C_VISIBILITY_PRESET hidden) + + # includes + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}) +-if(LZ4_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_INCLUDE_DIR}) ++if(lz4_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${lz4_INCLUDE_DIR}) + else() + set(LZ4_LOCAL_DIR ${INTERNAL_LIBS}/lz4-1.9.4) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${LZ4_LOCAL_DIR}) + endif() + + if(NOT DEACTIVATE_ZLIB) +- if(ZLIB_NG_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_NG_INCLUDE_DIR}) ++ if(zlib-ng_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${zlib-ng_INCLUDE_DIR}) + elseif(ZLIB_FOUND) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}) + else() +@@ -29,8 +29,8 @@ if(NOT DEACTIVATE_ZLIB) + endif() + + if(NOT DEACTIVATE_ZSTD) +- if(ZSTD_FOUND) +- set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_INCLUDE_DIR}) ++ if(zstd_FOUND) ++ set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${zstd_INCLUDE_DIR}) + else() + set(ZSTD_LOCAL_DIR ${INTERNAL_LIBS}/zstd-1.5.2) + set(BLOSC_INCLUDE_DIRS ${BLOSC_INCLUDE_DIRS} ${ZSTD_LOCAL_DIR} +@@ -90,8 +90,8 @@ else() + endif() + endif() + +-if(LZ4_FOUND) +- set(LIBS ${LIBS} ${LZ4_LIBRARY}) ++if(lz4_FOUND) ++ set(LIBS ${LIBS} ${lz4_LIBRARIES}) + else() + file(GLOB LZ4_FILES ${LZ4_LOCAL_DIR}/*.c) + set(SOURCES ${SOURCES} ${LZ4_FILES}) +@@ -99,10 +99,10 @@ else() + endif() + + if(NOT DEACTIVATE_ZLIB) +- if(ZLIB_NG_FOUND) +- set(LIBS ${LIBS} ${ZLIB_NG_LIBRARY}) ++ if(zlib-ng_FOUND) ++ set(LIBS ${LIBS} ${zlib-ng_LIBRARIES}) + elseif(ZLIB_FOUND) +- set(LIBS ${LIBS} ${ZLIB_LIBRARY}) ++ set(LIBS ${LIBS} ${ZLIB_LIBRARIES}) + else() + set(ZLIB_LOCAL_DIR ${INTERNAL_LIBS}/${ZLIB_NG_DIR}) + file(GLOB ZLIB_FILES ${ZLIB_LOCAL_DIR}/*.c) +@@ -112,8 +112,8 @@ if(NOT DEACTIVATE_ZLIB) + endif() + + if(NOT DEACTIVATE_ZSTD) +- if(ZSTD_FOUND) +- set(LIBS ${LIBS} ${ZSTD_LIBRARY}) ++ if(zstd_FOUND) ++ set(LIBS ${LIBS} ${zstd_LIBRARIES}) + else() + # Enable assembly code only when not using MSVC *and* x86 is there + if((NOT MSVC) AND COMPILER_SUPPORT_SSE2) # if SSE2 is here, this is an x86 platform diff --git a/recipes/c-blosc2/all/test_package/CMakeLists.txt b/recipes/c-blosc2/all/test_package/CMakeLists.txt index 2b52be6633ff8..4e3319b05a4f0 100644 --- a/recipes/c-blosc2/all/test_package/CMakeLists.txt +++ b/recipes/c-blosc2/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(c-blosc2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} c-blosc2::c-blosc2) +target_link_libraries(${PROJECT_NAME} PRIVATE c-blosc2::c-blosc2) diff --git a/recipes/c-blosc2/all/test_package/conanfile.py b/recipes/c-blosc2/all/test_package/conanfile.py index 333435871c7d8..a9fb96656f203 100644 --- a/recipes/c-blosc2/all/test_package/conanfile.py +++ b/recipes/c-blosc2/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -from conans import ConanFile, CMake -from conan import tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.build.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/c-blosc2/all/test_package/test_package.c b/recipes/c-blosc2/all/test_package/test_package.c index 57eacc94c15a2..754d85bde8768 100644 --- a/recipes/c-blosc2/all/test_package/test_package.c +++ b/recipes/c-blosc2/all/test_package/test_package.c @@ -35,6 +35,7 @@ int main(){ data[i] = i; } +#if !defined(BLOSC2_VERSION_MAJOR) /* Register the filter with the library */ printf("Blosc version info: %s (%s)\n", BLOSC_VERSION_STRING, BLOSC_VERSION_DATE); @@ -66,6 +67,40 @@ int main(){ /* After using it, destroy the Blosc environment */ blosc_destroy(); +#else + /* Register the filter with the library */ + printf("Blosc version info: %s (%s)\n", + BLOSC2_VERSION_STRING, BLOSC2_VERSION_DATE); + + /* Initialize the Blosc compressor */ + blosc2_init(); + + /* Compress with clevel=5 and shuffle active */ + csize = blosc2_compress(5, 1, sizeof(float), data, isize, data_out, osize); + if (csize == 0) { + printf("Buffer is uncompressible. Giving up.\n"); + return 1; + } + else if (csize < 0) { + printf("Compression error. Error code: %d\n", csize); + return csize; + } + + printf("Compression: %d -> %d (%.1fx)\n", isize, csize, (1.*isize) / csize); + + /* Decompress */ + dsize = blosc2_decompress(data_out, osize, data_dest, dsize); + if (dsize < 0) { + printf("Decompression error. Error code: %d\n", dsize); + return dsize; + } + + printf("Decompression succesful!\n"); + + /* After using it, destroy the Blosc environment */ + blosc2_destroy(); +#endif + for(i=0;i\n#include ", "#include \n#include " ) @@ -104,31 +105,34 @@ def _build_unix(self): # NOTE: only one job is used, because there are issues with dependency # tracking in parallel builds args = ["IP=6", "-j1"] - AutoToolsBuildEnvironment(self).make(target=target, args=args) + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.make(target=target, args=args) def build(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - if self._is_msvc: - self._patch_msvc() + apply_conandata_patches(self) + if is_msvc(self): self._build_msvc() else: self._build_unix() def package(self): - self.copy("LICENSE.txt", "licenses") - self.copy("c-client/*.h", "include") - if self._is_msvc: - self.copy("*.lib", "lib", "c-client") - else: - self.copy("*.a", "lib", "c-client") + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + # Install headers (headers in build tree are symlinks) + include_folder = os.path.join(self.package_folder, "include", "c-client") + mkdir(self, include_folder) + for header_path in glob.glob(os.path.join(self.source_folder, "c-client", "*.h")): + # conan.tools.files.copy can't be used because it copies symlinks instead of real files + shutil.copy(src=header_path, dst=os.path.join(include_folder, os.path.basename(header_path))) + # Install libs + for lib in ("*.a", "*.lib"): + copy(self, lib, src=os.path.join(self.source_folder, "c-client"), dst=os.path.join(self.package_folder, "lib")) def package_info(self): - if self._is_msvc: - self.cpp_info.system_libs = \ - ["Winmm", "Ws2_32", "Secur32", "Crypt32"] - else: + self.cpp_info.libs = ["cclient" if is_msvc(self) else "c-client"] + if self.settings.os != "Windows": self.cpp_info.defines = ["_DEFAULT_SOURCE"] + if self.settings.os == "Windows": + self.cpp_info.system_libs = ["winmm", "ws2_32", "secur32", "crypt32"] + elif self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["crypt"] - self.cpp_info.requires = ["openssl::crypto", "openssl::ssl"] - self.cpp_info.libs = ["cclient" if self._is_msvc else "c-client"] diff --git a/recipes/c-client/all/test_package/CMakeLists.txt b/recipes/c-client/all/test_package/CMakeLists.txt index 6e4e3c79ee835..0ae631dc1d0fb 100644 --- a/recipes/c-client/all/test_package/CMakeLists.txt +++ b/recipes/c-client/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS KEEP_RPATHS) +project(test_package LANGUAGES C) find_package(c-client REQUIRED CONFIG) diff --git a/recipes/c-client/all/test_package/conanfile.py b/recipes/c-client/all/test_package/conanfile.py index a8c92dea63335..0a6bc68712d90 100644 --- a/recipes/c-client/all/test_package/conanfile.py +++ b/recipes/c-client/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/c-client/all/test_v1_package/CMakeLists.txt b/recipes/c-client/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/c-client/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/c-client/all/test_v1_package/conanfile.py b/recipes/c-client/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/c-client/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/c-dbg-macro/all/conanfile.py b/recipes/c-dbg-macro/all/conanfile.py index 8c02b5c63b5a6..d30bb72e433f7 100644 --- a/recipes/c-dbg-macro/all/conanfile.py +++ b/recipes/c-dbg-macro/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.46.0" class DbgMacroConan(ConanFile): name = "c-dbg-macro" @@ -10,24 +13,27 @@ class DbgMacroConan(ConanFile): homepage = "https://github.com/eerimoq/dbg-macro" license = "MIT" description = "A dbg(...) macro for C" - topics = ("conan", "debugging", "macro", "pretty-printing", "header-only") + topics = ("debugging", "macro", "pretty-printing", "header-only") settings = ("compiler", "build_type", "os", "arch") no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("This library is not compatible with Windows") + def layout(self): + basic_layout(self, src_folder="src") + def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - self.copy("include/dbg.h", dst=".", src=self._source_subfolder) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "dbg.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, "LICENSE", src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + def package_id(self): - self.info.header_only() + self.info.clear() diff --git a/recipes/c-dbg-macro/all/test_package/CMakeLists.txt b/recipes/c-dbg-macro/all/test_package/CMakeLists.txt index 85e615074f940..c764c0709047b 100644 --- a/recipes/c-dbg-macro/all/test_package/CMakeLists.txt +++ b/recipes/c-dbg-macro/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(c-dbg-macro REQUIRED) -add_executable(test_package test_package.c) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE c-dbg-macro::c-dbg-macro) diff --git a/recipes/c-dbg-macro/all/test_package/conanfile.py b/recipes/c-dbg-macro/all/test_package/conanfile.py index c795b378cca50..48499fa0989d9 100644 --- a/recipes/c-dbg-macro/all/test_package/conanfile.py +++ b/recipes/c-dbg-macro/all/test_package/conanfile.py @@ -1,17 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/c-dbg-macro/all/test_v1_package/CMakeLists.txt b/recipes/c-dbg-macro/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..4c9e7ffdd2a28 --- /dev/null +++ b/recipes/c-dbg-macro/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(test_package ../test_package/test_package.c) diff --git a/recipes/c-dbg-macro/all/test_v1_package/conanfile.py b/recipes/c-dbg-macro/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c795b378cca50 --- /dev/null +++ b/recipes/c-dbg-macro/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/c4core/all/CMakeLists.txt b/recipes/c4core/all/CMakeLists.txt deleted file mode 100644 index 29ce322870912..0000000000000 --- a/recipes/c4core/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper LANGUAGES CXX) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/c4core/all/conandata.yml b/recipes/c4core/all/conandata.yml index 469f0c16b8b48..ab9592ebfbdbe 100644 --- a/recipes/c4core/all/conandata.yml +++ b/recipes/c4core/all/conandata.yml @@ -1,7 +1,30 @@ sources: + "0.1.11": + url: "https://github.com/biojppm/c4core/releases/download/v0.1.11/c4core-0.1.11-src.tgz" + sha256: "67f4443f3742424f42453594e26e656f616dddfcf225a1d810e00473a741408c" + "0.1.10": + url: "https://github.com/biojppm/c4core/releases/download/v0.1.10/c4core-0.1.10-src.tgz" + sha256: "e8ab4dedd0e20f86af7c69527cfbe8bc1cf72c84b7fbc0cfd420656f28ae20b2" "0.1.9": url: "https://github.com/biojppm/c4core/releases/download/v0.1.9/c4core-0.1.9-src.tgz" sha256: "818d82456b640d88527fe517e1fef88fe45d8fffb414492eddf54480ee222449" "0.1.8": url: "https://github.com/biojppm/c4core/releases/download/v0.1.8/c4core-0.1.8-src.tgz" sha256: "95c0663192c6bff7a098b50afcb05d22a34dd0fd8e6be2e1b61edad2b9675fde" +patches: + "0.1.11": + - patch_file: "patches/0.1.11-0001-make-fast_float-external.patch" + patch_description: "use cci's fast_float recipe" + patch_type: "conan" + "0.1.10": + - patch_file: "patches/0.1.10-0001-make-fast_float-external.patch" + patch_description: "use cci's fast_float recipe" + patch_type: "conan" + "0.1.9": + - patch_file: "patches/0.1.9-0001-make-fast_float-external.patch" + patch_description: "use cci's fast_float recipe" + patch_type: "conan" + "0.1.8": + - patch_file: "patches/0.1.8-0001-make-fast_float-external.patch" + patch_description: "use cci's fast_float recipe" + patch_type: "conan" diff --git a/recipes/c4core/all/conanfile.py b/recipes/c4core/all/conanfile.py index f253607e96591..24d4f5efff502 100644 --- a/recipes/c4core/all/conanfile.py +++ b/recipes/c4core/all/conanfile.py @@ -1,9 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, rm, rmdir, apply_conandata_patches, export_conandata_patches +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class C4CoreConan(ConanFile): name = "c4core" @@ -11,28 +14,25 @@ class C4CoreConan(ConanFile): "c4core is a library of low-level C++ utilities, written with " "low-latency projects in mind." ) - topics = ("utilities", "low-latency", ) + license = "MIT", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/biojppm/c4core" - license = "MIT", - + topics = ("utilities", "low-latency", ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_fast_float": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_fast_float": True, } - exports_sources = ["CMakeLists.txt"] - generators = "cmake", "cmake_find_package_multi" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -40,51 +40,57 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("fast_float/3.4.0") + if self.options.with_fast_float: + self.requires("fast_float/3.10.0", transitive_headers=True) def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, "11") - ## clang with libc++ is not supported. It is already fixed at 2022-01-03. - if tools.Version(self.version) <= "0.1.8": - if (self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++"): - raise ConanInvalidConfiguration( - "{}/{} doesn't support clang with libc++".format(self.name, self.version), - ) + ## clang with libc++ is not supported. It is already fixed since 0.1.9. + if Version(self.version) <= "0.1.8": + if self.settings.compiler in ["clang", "apple-clang"] and \ + self.settings.compiler.get_safe("libcxx") == "libc++": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support clang with libc++") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["C4CORE_WITH_FASTFLOAT"] = bool(self.options.with_fast_float) + tc.generate() - def build(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "c4/ext/fast_float_all.h", "") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "c4", "ext", "fast_float.hpp"), - '#include "c4/ext/fast_float_all.h"', - '#include "fast_float/fast_float.h"') + deps = CMakeDeps(self) + deps.generate() - cmake = self._configure_cmake() + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "include"), "*.natvis") + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.natvis", os.path.join(self.package_folder, "include")) def package_info(self): + self.cpp_info.libs = ["c4core"] + if not self.options.with_fast_float: + self.cpp_info.defines.append("C4CORE_NO_FAST_FLOAT") + self.cpp_info.set_property("cmake_file_name", "c4core") self.cpp_info.set_property("cmake_target_name", "c4core::c4core") - self.cpp_info.libs = ["c4core"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/c4core/all/patches/0.1.10-0001-make-fast_float-external.patch b/recipes/c4core/all/patches/0.1.10-0001-make-fast_float-external.patch new file mode 100644 index 0000000000000..a530b3907baca --- /dev/null +++ b/recipes/c4core/all/patches/0.1.10-0001-make-fast_float-external.patch @@ -0,0 +1,37 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b2450e1..3f52516 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -72,7 +72,6 @@ set(C4CORE_SRC_FILES + if(C4CORE_WITH_FASTFLOAT) + list(APPEND C4CORE_SRC_FILES + c4/ext/fast_float.hpp +- c4/ext/fast_float_all.h + ) + endif() + set(C4CORE_AMALGAMATED ${C4CORE_SRC_DIR}/../src_singleheader/c4/c4core_all.hpp) +@@ -92,7 +91,10 @@ c4_add_library(c4core + SOURCES ${C4CORE_SRC_FILES} + ) + +-if(NOT C4CORE_WITH_FASTFLOAT) ++if(C4CORE_WITH_FASTFLOAT) ++ find_package(FastFloat REQUIRED CONFIG) ++ target_link_libraries(c4core PUBLIC "FastFloat::fast_float") ++else() + target_compile_definitions(c4core PUBLIC -DC4CORE_NO_FAST_FLOAT) + endif() + +diff --git a/src/c4/ext/fast_float.hpp b/src/c4/ext/fast_float.hpp +index 9e75b5e..64aa2a4 100644 +--- a/src/c4/ext/fast_float.hpp ++++ b/src/c4/ext/fast_float.hpp +@@ -15,7 +15,7 @@ + # pragma GCC diagnostic ignored "-Wuseless-cast" + #endif + +-#include "c4/ext/fast_float_all.h" ++#include "fast_float/fast_float.h" + + #ifdef _MSC_VER + # pragma warning(pop) diff --git a/recipes/c4core/all/patches/0.1.11-0001-make-fast_float-external.patch b/recipes/c4core/all/patches/0.1.11-0001-make-fast_float-external.patch new file mode 100644 index 0000000000000..7532d129ab080 --- /dev/null +++ b/recipes/c4core/all/patches/0.1.11-0001-make-fast_float-external.patch @@ -0,0 +1,37 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 1207d1b..20ffe96 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -73,7 +73,6 @@ set(C4CORE_SRC_FILES + if(C4CORE_WITH_FASTFLOAT) + list(APPEND C4CORE_SRC_FILES + c4/ext/fast_float.hpp +- c4/ext/fast_float_all.h + ) + endif() + set(C4CORE_AMALGAMATED ${C4CORE_SRC_DIR}/../src_singleheader/c4/c4core_all.hpp) +@@ -92,7 +91,10 @@ c4_add_library(c4core + SOURCE_ROOT ${C4CORE_SRC_DIR} + SOURCES ${C4CORE_SRC_FILES} + ) +-if(NOT C4CORE_WITH_FASTFLOAT) ++if(C4CORE_WITH_FASTFLOAT) ++ find_package(FastFloat REQUIRED CONFIG) ++ target_link_libraries(c4core PUBLIC "FastFloat::fast_float") ++else() + target_compile_definitions(c4core PUBLIC -DC4CORE_NO_FAST_FLOAT) + endif() + if(C4CORE_NO_DEBUG_BREAK) +diff --git a/a/src/c4/ext/fast_float.hpp b/b/src/c4/ext/fast_float.hpp +index 9e75b5e..64aa2a4 100644 +--- a/a/src/c4/ext/fast_float.hpp ++++ b/b/src/c4/ext/fast_float.hpp +@@ -15,7 +15,7 @@ + # pragma GCC diagnostic ignored "-Wuseless-cast" + #endif + +-#include "c4/ext/fast_float_all.h" ++#include "fast_float/fast_float.h" + + #ifdef _MSC_VER + # pragma warning(pop) diff --git a/recipes/c4core/all/patches/0.1.8-0001-make-fast_float-external.patch b/recipes/c4core/all/patches/0.1.8-0001-make-fast_float-external.patch new file mode 100644 index 0000000000000..1e139fba70445 --- /dev/null +++ b/recipes/c4core/all/patches/0.1.8-0001-make-fast_float-external.patch @@ -0,0 +1,37 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5bc4b09..ee7a0d8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -69,7 +69,6 @@ set(C4CORE_SRC_FILES + if(C4CORE_WITH_FASTFLOAT) + list(APPEND C4CORE_SRC_FILES + c4/ext/fast_float.hpp +- c4/ext/fast_float_all.h + ) + endif() + set(C4CORE_AMALGAMATED ${C4CORE_SRC_DIR}/../src_singleheader/c4/c4core_all.hpp) +@@ -89,7 +88,10 @@ c4_add_library(c4core + SOURCES ${C4CORE_SRC_FILES} + ) + +-if(NOT C4CORE_WITH_FASTFLOAT) ++if(C4CORE_WITH_FASTFLOAT) ++ find_package(FastFloat REQUIRED CONFIG) ++ target_link_libraries(c4core PUBLIC "FastFloat::fast_float") ++else() + target_compile_definitions(c4core PUBLIC -DC4CORE_NO_FAST_FLOAT) + endif() + +diff --git a/src/c4/ext/fast_float.hpp b/src/c4/ext/fast_float.hpp +index 9e75b5e..64aa2a4 100644 +--- a/src/c4/ext/fast_float.hpp ++++ b/src/c4/ext/fast_float.hpp +@@ -15,7 +15,7 @@ + # pragma GCC diagnostic ignored "-Wuseless-cast" + #endif + +-#include "c4/ext/fast_float_all.h" ++#include "fast_float/fast_float.h" + + #ifdef _MSC_VER + # pragma warning(pop) diff --git a/recipes/c4core/all/patches/0.1.9-0001-make-fast_float-external.patch b/recipes/c4core/all/patches/0.1.9-0001-make-fast_float-external.patch new file mode 100644 index 0000000000000..ae4e2acd03d15 --- /dev/null +++ b/recipes/c4core/all/patches/0.1.9-0001-make-fast_float-external.patch @@ -0,0 +1,37 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index e9412de..7d11193 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -72,7 +72,6 @@ set(C4CORE_SRC_FILES + if(C4CORE_WITH_FASTFLOAT) + list(APPEND C4CORE_SRC_FILES + c4/ext/fast_float.hpp +- c4/ext/fast_float_all.h + ) + endif() + set(C4CORE_AMALGAMATED ${C4CORE_SRC_DIR}/../src_singleheader/c4/c4core_all.hpp) +@@ -92,7 +91,10 @@ c4_add_library(c4core + SOURCES ${C4CORE_SRC_FILES} + ) + +-if(NOT C4CORE_WITH_FASTFLOAT) ++if(C4CORE_WITH_FASTFLOAT) ++ find_package(FastFloat REQUIRED CONFIG) ++ target_link_libraries(c4core PUBLIC "FastFloat::fast_float") ++else() + target_compile_definitions(c4core PUBLIC -DC4CORE_NO_FAST_FLOAT) + endif() + +diff --git a/a/src/c4/ext/fast_float.hpp b/b/src/c4/ext/fast_float.hpp +index 9e75b5e..64aa2a4 100644 +--- a/a/src/c4/ext/fast_float.hpp ++++ b/b/src/c4/ext/fast_float.hpp +@@ -15,7 +15,7 @@ + # pragma GCC diagnostic ignored "-Wuseless-cast" + #endif + +-#include "c4/ext/fast_float_all.h" ++#include "fast_float/fast_float.h" + + #ifdef _MSC_VER + # pragma warning(pop) diff --git a/recipes/c4core/all/test_package/CMakeLists.txt b/recipes/c4core/all/test_package/CMakeLists.txt index d1195867914f9..e0b34e28e562b 100644 --- a/recipes/c4core/all/test_package/CMakeLists.txt +++ b/recipes/c4core/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(c4core REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} c4core::c4core) -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) +target_link_libraries(${PROJECT_NAME} PRIVATE c4core::c4core) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/c4core/all/test_package/conanfile.py b/recipes/c4core/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/c4core/all/test_package/conanfile.py +++ b/recipes/c4core/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/c4core/all/test_v1_package/CMakeLists.txt b/recipes/c4core/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..bc541ea90b512 --- /dev/null +++ b/recipes/c4core/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/c4core/all/test_v1_package/conanfile.py b/recipes/c4core/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/c4core/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/c4core/config.yml b/recipes/c4core/config.yml index af17094a8755f..b3f909b6c9664 100644 --- a/recipes/c4core/config.yml +++ b/recipes/c4core/config.yml @@ -1,4 +1,8 @@ versions: + "0.1.11": + folder: all + "0.1.10": + folder: all "0.1.9": folder: all "0.1.8": diff --git a/recipes/caf/all/CMakeLists.txt b/recipes/caf/all/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c35..0000000000000 --- a/recipes/caf/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/caf/all/conandata.yml b/recipes/caf/all/conandata.yml index 8560c79dbf871..71354ad6bae80 100644 --- a/recipes/caf/all/conandata.yml +++ b/recipes/caf/all/conandata.yml @@ -11,12 +11,3 @@ sources: "0.18.0": url: "https://github.com/actor-framework/actor-framework/archive/0.18.0.tar.gz" sha256: "df765fa78861e67d44e2587c0ac0c1c662d8c93fe5ffc8757f552fc7ac15941f" - "0.17.6": - url: "https://github.com/actor-framework/actor-framework/archive/0.17.6.tar.gz" - sha256: "e2bf5bd243f08bb7d8adde197cfe3e6d71314ed3378fe0692f8932f4c3b3928c" -patches: - "0.17.6": - - patch_file: "patches/win_install.patch" - base_path: "source_subfolder" - - patch_file: "patches/udp.patch" - base_path: "source_subfolder" diff --git a/recipes/caf/all/conanfile.py b/recipes/caf/all/conanfile.py index adbfa98e4822c..46d27d44c64ae 100644 --- a/recipes/caf/all/conanfile.py +++ b/recipes/caf/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd, valid_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class CAFConan(ConanFile): @@ -10,9 +14,10 @@ class CAFConan(ConanFile): description = "An open source implementation of the Actor Model in C++" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/actor-framework/actor-framework" - topics = "conan", "caf", "actor-framework", "actor-model", "pattern-matching", "actors" + topics = "actor-framework", "actor-model", "pattern-matching", "actors" license = "BSD-3-Clause", "BSL-1.0" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,21 +32,20 @@ class CAFConan(ConanFile): "with_openssl": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" @property - def _build_subfolder(self): - return "build_subfolder" - - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + def _minimum_compilers_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "7", + "clang": "6", # Should be 5 but clang 5 has a bug that breaks compiling CAF + # see https://github.com/actor-framework/actor-framework/issues/1226 + "apple-clang": "10", + } def config_options(self): if self.settings.os == "Windows": @@ -49,46 +53,27 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1m") - - def _minimum_compilers_version(self, cppstd): - standards = { - "11": { - "Visual Studio": "15", - "gcc": "4.8", - "clang": "4", - "apple-clang": "9", - }, - "17": { - "Visual Studio": "16", - "gcc": "7", - "clang": "6", # Should be 5 but clang 5 has a bug that breaks compiling CAF - # see https://github.com/actor-framework/actor-framework/issues/1226 - "apple-clang": "10", - }, - } - return standards.get(cppstd) or {} - - @property - def _cppstd(self): - return "11" if tools.Version(self.version) <= "0.17.6" else "17" + self.requires("openssl/1.1.1s") def validate(self): - min_version = self._minimum_compilers_version(self._cppstd).get(str(self.settings.compiler)) - if not min_version: - self.output.warn("{} recipe lacks information about the {} compiler support.".format( - self.name, self.settings.compiler)) - else: - if tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration("{} requires C++{} support. The current compiler {} {} does not support it.".format( - self.name, self._cppstd, self.settings.compiler, self.settings.compiler.version)) - - if self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) > "10.0" and \ - self.settings.arch == 'x86': + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) > "10.0" and \ + self.settings.arch == "x86": raise ConanInvalidConfiguration("clang >= 11.0 does not support x86") if self.options.shared and self.settings.os == "Windows": raise ConanInvalidConfiguration("Shared libraries are not supported on Windows") @@ -96,64 +81,51 @@ def validate(self): raise ConanInvalidConfiguration("OpenSSL is not supported for Windows x86") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _cmake_configure(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["CMAKE_CXX_STANDARD"] = self._cppstd - if tools.Version(self.version) <= "0.17.6": - self._cmake.definitions["CAF_NO_AUTO_LIBCPP"] = True - self._cmake.definitions["CAF_NO_OPENSSL"] = not self.options.with_openssl - for define in ["CAF_NO_EXAMPLES", "CAF_NO_TOOLS", "CAF_NO_UNIT_TESTS", "CAF_NO_PYTHON"]: - self._cmake.definitions[define] = "ON" - self._cmake.definitions["CAF_BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["CAF_BUILD_STATIC_ONLY"] = not self.options.shared - else: - self._cmake.definitions["CAF_ENABLE_OPENSSL_MODULE"] = self.options.with_openssl - for define in ["CAF_ENABLE_EXAMPLES", "CAF_ENABLE_TOOLS", "CAF_ENABLE_TESTING"]: - self._cmake.definitions[define] = "OFF" - self._cmake.definitions["CAF_LOG_LEVEL"] = self.options.log_level.value.upper() - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + tc.variables["CAF_ENABLE_OPENSSL_MODULE"] = self.options.with_openssl + tc.variables["CAF_ENABLE_EXAMPLES"] = False + tc.variables["CAF_ENABLE_TOOLS"] = False + tc.variables["CAF_ENABLE_TESTING"] = False + tc.variables["CAF_LOG_LEVEL"] = self.options.log_level.value.upper() + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set(CMAKE_MODULE_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/cmake\")", - "list(APPEND CMAKE_MODULE_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/cmake\")") - cmake = self._cmake_configure() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._cmake_configure() + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "CAF") - suffix = "_static" if not self.options.shared and tools.Version(self.version) <= "0.17.6" else "" - self.cpp_info.components["caf_core"].set_property("cmake_target_name", "CAF::core") - self.cpp_info.components["caf_core"].libs = ["caf_core{}".format(suffix)] + self.cpp_info.components["caf_core"].libs = ["caf_core"] if self.settings.os == "Windows": self.cpp_info.components["caf_core"].system_libs = ["iphlpapi"] elif self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["caf_core"].system_libs = ["pthread", "m"] self.cpp_info.components["caf_io"].set_property("cmake_target_name", "CAF::io") - self.cpp_info.components["caf_io"].libs = ["caf_io{}".format(suffix)] + self.cpp_info.components["caf_io"].libs = ["caf_io"] self.cpp_info.components["caf_io"].requires = ["caf_core"] if self.settings.os == "Windows": self.cpp_info.components["caf_io"].system_libs = ["ws2_32"] if self.options.with_openssl: self.cpp_info.components["caf_openssl"].set_property("cmake_target_name", "CAF::openssl") - self.cpp_info.components["caf_openssl"].libs = ["caf_openssl{}".format(suffix)] + self.cpp_info.components["caf_openssl"].libs = ["caf_openssl"] self.cpp_info.components["caf_openssl"].requires = ["caf_io", "openssl::openssl"] # TODO: to remove in conan v2 once cmake_find_package* generators removed diff --git a/recipes/caf/all/patches/udp.patch b/recipes/caf/all/patches/udp.patch deleted file mode 100644 index 0ef1f7492484b..0000000000000 --- a/recipes/caf/all/patches/udp.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/libcaf_io/src/io/abstract_broker.cpp b/libcaf_io/src/io/abstract_broker.cpp -index 592d704ff..e98650fed 100644 ---- a/libcaf_io/src/io/abstract_broker.cpp -+++ b/libcaf_io/src/io/abstract_broker.cpp -@@ -214,6 +214,8 @@ void abstract_broker::add_datagram_servant(datagram_servant_ptr ptr) { - launch_servant(ptr); - for (auto& hdl : hdls) - add_hdl_for_datagram_servant(ptr, hdl); -+ auto hdl = ptr->hdl(); -+ add_hdl_for_datagram_servant(std::move(ptr), hdl); - } - - void abstract_broker::add_hdl_for_datagram_servant(datagram_servant_ptr ptr, diff --git a/recipes/caf/all/patches/win_install.patch b/recipes/caf/all/patches/win_install.patch deleted file mode 100644 index e2dcd0088f401..0000000000000 --- a/recipes/caf/all/patches/win_install.patch +++ /dev/null @@ -1,36 +0,0 @@ -Index: libcaf_openssl/CMakeLists.txt -IDEA additional info: -Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP -<+>UTF-8 -=================================================================== ---- libcaf_openssl/CMakeLists.txt (revision b05a4b7b2a6f59b0508db84ea68e5ada2224f904) -+++ libcaf_openssl/CMakeLists.txt (date 1577048348649) -@@ -34,7 +34,7 @@ - SOVERSION ${CAF_VERSION} - VERSION ${CAF_LIB_VERSION} - OUTPUT_NAME caf_openssl) -- if (CYGWIN) -+ if (CYGWIN OR WIN32) - install(TARGETS libcaf_openssl_shared RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) - elseif (NOT WIN32) - install(TARGETS libcaf_openssl_shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -@@ -50,9 +50,7 @@ - ${CAF_LIBRARY_CORE_STATIC} ${CAF_LIBRARY_IO_STATIC} ${OPENSSL_LIBRARIES}) - set_target_properties(libcaf_openssl_static PROPERTIES - OUTPUT_NAME caf_openssl_static) -- if(NOT WIN32) -- install(TARGETS libcaf_openssl_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- endif() -+ install(TARGETS libcaf_openssl_static ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - add_dependencies(libcaf_openssl_static libcaf_openssl) - endif () - -@@ -60,7 +58,5 @@ - include_directories(. ${INCLUDE_DIRS}) - - # install includes --if(NOT WIN32) -- install(DIRECTORY caf/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/caf FILES_MATCHING PATTERN "*.hpp") --endif() -+install(DIRECTORY caf/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/caf FILES_MATCHING PATTERN "*.hpp") - diff --git a/recipes/caf/all/test_package/CMakeLists.txt b/recipes/caf/all/test_package/CMakeLists.txt index 327d84bc52fea..7ef7e73d1a37d 100644 --- a/recipes/caf/all/test_package/CMakeLists.txt +++ b/recipes/caf/all/test_package/CMakeLists.txt @@ -1,15 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(CAF REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} CAF::core CAF::io CAF::openssl) -if(CAF_VERSION VERSION_LESS "0.18.0") - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -else() - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -endif() +target_link_libraries(${PROJECT_NAME} PRIVATE CAF::core CAF::io CAF::openssl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/caf/all/test_package/conanfile.py b/recipes/caf/all/test_package/conanfile.py index 1b0c13a342cd9..98ab55852ad56 100644 --- a/recipes/caf/all/test_package/conanfile.py +++ b/recipes/caf/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -from conans import ConanFile, CMake, tools -from conans.tools import Version +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/caf/all/test_v1_package/CMakeLists.txt b/recipes/caf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/caf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/caf/all/test_v1_package/conanfile.py b/recipes/caf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/caf/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/caf/config.yml b/recipes/caf/config.yml index f96fed142bde9..1e73f6993a454 100644 --- a/recipes/caf/config.yml +++ b/recipes/caf/config.yml @@ -7,5 +7,3 @@ versions: folder: all "0.18.0": folder: all - "0.17.6": - folder: all diff --git a/recipes/cairo/all/conandata.yml b/recipes/cairo/all/conandata.yml index e6ad418ca420e..a2d821e85845f 100644 --- a/recipes/cairo/all/conandata.yml +++ b/recipes/cairo/all/conandata.yml @@ -1,26 +1,26 @@ sources: - "1.17.4": - sha256: "74b24c1ed436bbe87499179a3b27c43f4143b8676d8ad237a6fa787401959705" - url: "https://www.cairographics.org/snapshots/cairo-1.17.4.tar.xz" "1.17.2": sha256: "6b70d4655e2a47a22b101c666f4b29ba746eda4aa8a0f7255b32b2e9408801df" - url: "https://www.cairographics.org/snapshots/cairo-1.17.2.tar.xz" + url: + - "https://www.cairographics.org/snapshots/cairo-1.17.2.tar.xz" + - "https://www.mirrorservice.org/sites/tinycorelinux.net/11.x/x86_64/tcz/src/cairo/cairo-1.17.2.tar.xz" "1.16.0": sha256: "5e7b29b3f113ef870d1e3ecf8adf21f923396401604bda16d44be45e66052331" - url: "https://www.cairographics.org/releases/cairo-1.16.0.tar.xz" + url: + - "https://www.cairographics.org/releases/cairo-1.16.0.tar.xz" + - "https://mirror.koddos.net/blfs/conglomeration/cairo/cairo-1.16.0.tar.xz" patches: - "1.17.4": - - patch_file: "patches/0001-msvc-update-build-scripts-to-compile-with-more-featu.patch" - base_path: "source_subfolder" - - patch_file: "patches/binutils-2.34-libbfd-fix.patch" - base_path: "source_subfolder/util/cairo-trace" "1.17.2": - patch_file: "patches/0001-msvc-update-build-scripts-to-compile-with-more-featu.patch" - base_path: "source_subfolder" - patch_file: "patches/binutils-2.34-libbfd-fix.patch" - base_path: "source_subfolder/util/cairo-trace" + patch_description: "fix build with newer versions of bfd" + patch_type: backport + patch_source: https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/128 + base_path: "util/cairo-trace" "1.16.0": - patch_file: "patches/0001-msvc-update-build-scripts-to-compile-with-more-featu.patch" - base_path: "source_subfolder" - patch_file: "patches/binutils-2.34-libbfd-fix.patch" - base_path: "source_subfolder/util/cairo-trace" + patch_description: "fix build with newer versions of bfd" + patch_type: backport + patch_source: https://gitlab.freedesktop.org/cairo/cairo/-/merge_requests/128 + base_path: "util/cairo-trace" diff --git a/recipes/cairo/all/conanfile.py b/recipes/cairo/all/conanfile.py index 363cd49cb6c52..cce808a738a54 100644 --- a/recipes/cairo/all/conanfile.py +++ b/recipes/cairo/all/conanfile.py @@ -1,13 +1,26 @@ import os -import shutil from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools import files, microsoft, scm -from conans import AutoToolsBuildEnvironment, VisualStudioBuildEnvironment -from conans import tools - -required_conan_version = ">=1.50.0" +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import ( + apply_conandata_patches, + copy, + export_conandata_patches, + get, + replace_in_file, + rename, + rm, + rmdir +) +from conan.tools.gnu import PkgConfigDeps, Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version + +required_conan_version = ">=1.54.0" class CairoConan(ConanFile): @@ -38,31 +51,20 @@ class CairoConan(ConanFile): "with_xcb": True, "with_glib": True, } - - exports_sources = "patches/*" - generators = "pkg_config" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + short_paths = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + def config_options(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd if self.settings.os == "Windows": del self.options.fPIC del self.options.with_fontconfig - if microsoft.is_msvc(self): + if is_msvc(self): del self.options.with_freetype del self.options.with_glib if self.settings.os != "Linux": @@ -72,174 +74,208 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def validate(self): - if microsoft.is_msvc(self): - if self.settings.build_type not in ["Debug", "Release"]: - raise ConanInvalidConfiguration("MSVC build supports only Debug or Release build type") - if self.options.get_safe("with_glib") and self.options["glib"].shared \ - and microsoft.is_msvc_static_runtime(self): - raise ConanInvalidConfiguration( - "Linking shared glib with the MSVC static runtime is not supported" - ) + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.get_safe("with_freetype", True): - self.requires("freetype/2.11.0") + self.requires("freetype/2.12.1") if self.options.get_safe("with_fontconfig", False): self.requires("fontconfig/2.13.93") if self.settings.os == "Linux": if self.options.with_xlib or self.options.with_xlib_xrender or self.options.with_xcb: self.requires("xorg/system") if self.options.get_safe("with_glib", True): - self.requires("glib/2.70.0") - self.requires("zlib/1.2.11") + self.requires("glib/2.75.2") + self.requires("zlib/1.2.13") self.requires("pixman/0.40.0") - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") + + def package_id(self): + if self.options.get_safe("with_glib") and not self.dependencies["glib"].options.shared: + self.info.requires["glib"].full_package_mode() + + def validate(self): + if is_msvc(self): + # TODO autotools build results in LNK1127 error from a library in the WindowsSDK on CCI + # should be retested in case this is just a CCI environment issue + raise ConanInvalidConfiguration("MSVC autotools build is not supported. Use the Meson build instead.") def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.tool_requires("msys2/cci.latest") - if not microsoft.is_msvc(self): - self.tool_requires("libtool/2.4.6") - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("libtool/2.4.7") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("automake/1.16.5") + else: self.tool_requires("gtk-doc-stub/cci.20181216") def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def build(self): - files.apply_conandata_patches(self) - if microsoft.is_msvc(self): - self._build_msvc() - else: - self._build_configure() - - def _build_msvc(self): - with tools.chdir(self._source_subfolder): - # https://cairographics.org/end_to_end_build_for_win32/ - win32_common = os.path.join("build", "Makefile.win32.common") - files.replace_in_file(self, win32_common, "-MD ", f"-{self.settings.compiler.runtime} ") - files.replace_in_file(self, win32_common, "-MDd ", f"-{self.settings.compiler.runtime} ") - files.replace_in_file(self, win32_common, "$(ZLIB_PATH)/lib/zlib1.lib", - self.deps_cpp_info["zlib"].libs[0] + ".lib") - files.replace_in_file(self, win32_common, "$(LIBPNG_PATH)/lib/libpng16.lib", - self.deps_cpp_info["libpng"].libs[0] + ".lib") - files.replace_in_file(self, win32_common, "$(FREETYPE_PATH)/lib/freetype.lib", - self.deps_cpp_info["freetype"].libs[0] + ".lib") - with tools.vcvars(self.settings): - env_msvc = VisualStudioBuildEnvironment(self) - env_msvc.flags.append("/FS") # C1041 if multiple CL.EXE write to the same .PDB file, please use /FS - with tools.environment_append(env_msvc.vars): - env_build = AutoToolsBuildEnvironment(self) - args=[ - "-f", "Makefile.win32", - f"CFG={str(self.settings.build_type).lower()}", - "CAIRO_HAS_FC_FONT=0", - f"ZLIB_PATH={self.deps_cpp_info['zlib'].rootpath}", - f"LIBPNG_PATH={self.deps_cpp_info['libpng'].rootpath}", - f"PIXMAN_PATH={self.deps_cpp_info['pixman'].rootpath}", - f"FREETYPE_PATH={self.deps_cpp_info['freetype'].rootpath}", - f"GOBJECT_PATH={self.deps_cpp_info['glib'].rootpath}" - ] - - env_build.make(args=args) - env_build.make(args=["-C", os.path.join("util", "cairo-gobject")] + args) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - - def boolean(value): + def _create_toolchain(self, namespace, directory): + def is_enabled(value): return "yes" if value else "no" - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - configure_args = [ - f"--datarootdir={tools.unix_path(os.path.join(self.package_folder, 'res'))}", - f"--enable-ft={boolean(self.options.with_freetype)}", - f"--enable-gobject={boolean(self.options.with_glib)}", - f"--enable-fc={boolean(self.options.get_safe('with_fontconfig'))}", - f"--enable-xlib={boolean(self.options.get_safe('with_xlib'))}", - f"--enable-xlib_xrender={boolean(self.options.get_safe('with_xlib_xrender'))}", - f"--enable-xcb={boolean(self.options.get_safe('xcb'))}", - f"--enable-shared={boolean(self.options.shared)}", - f"--enable-static={boolean(not self.options.shared)}", - "--disable-gtk-doc", + def dep_path(dependency): + return unix_path(self, self.deps_cpp_info[dependency].rootpath) + + tc = AutotoolsToolchain(self, namespace=namespace) + tc.configure_args += [ + f"--datarootdir={unix_path(self, os.path.join(self.package_folder, 'res'))}", + f"--enable-ft={is_enabled(self.options.get_safe('with_freetype', True))}", + f"--enable-gobject={is_enabled(self.options.get_safe('with_glib', True))}", + f"--enable-fc={is_enabled(self.options.get_safe('with_fontconfig'))}", + f"--enable-xlib={is_enabled(self.options.get_safe('with_xlib'))}", + f"--enable-xlib_xrender={is_enabled(self.options.get_safe('with_xlib_xrender'))}", + f"--enable-xcb={is_enabled(self.options.get_safe('xcb'))}", + "--disable-gtk-doc" ] + if is_msvc(self): + tc.make_args += [ + "--directory", directory, + "-f", "Makefile.win32", + f"CFG={str(self.settings.build_type).lower()}", + "CAIRO_HAS_FC_FONT=0", + f"ZLIB_PATH={dep_path('zlib')}", + f"LIBPNG_PATH={dep_path('libpng')}", + f"PIXMAN_PATH={dep_path('pixman')}", + f"FREETYPE_PATH={dep_path('freetype')}", + f"GOBJECT_PATH={dep_path('glib')}" + ] + tc.extra_cflags += ["-FS"] + if self.settings.compiler in ["gcc", "clang", "apple-clang"]: - self._autotools.flags.append("-Wno-enum-conversion") - - with tools.run_environment(self): - self._autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return self._autotools - - def _build_configure(self): - with tools.chdir(self._source_subfolder): - # disable build of test suite - files.replace_in_file(self, os.path.join("test", "Makefile.am"), "noinst_PROGRAMS = cairo-test-suite$(EXEEXT)", - "") - if self.options.with_freetype: - files.replace_in_file(self, os.path.join(self.source_folder, self._source_subfolder, "src", "cairo-ft-font.c"), - "#if HAVE_UNISTD_H", "#ifdef HAVE_UNISTD_H") - - tools.touch(os.path.join("boilerplate", "Makefile.am.features")) - tools.touch(os.path.join("src", "Makefile.am.features")) - tools.touch("ChangeLog") - - with tools.environment_append({"GTKDOCIZE": "echo"}): - self.run( - f"{tools.get_env('AUTORECONF')} -fiv", - run_environment=True, - win_bash=tools.os_info.is_windows, - ) - autotools = self._configure_autotools() - autotools.make() + tc.extra_cflags.append("-Wno-enum-conversion") + + return tc + + def generate(self): + VirtualBuildEnv(self).generate() + + if not cross_building(self): + VirtualRunEnv(self).generate(scope="build") + + tc_main = self._create_toolchain("main", unix_path(self, self.source_folder)) + tc_main.generate() + + if is_msvc(self): + tc_gobject = self._create_toolchain("gobject", unix_path(self, os.path.join(self.source_folder, "util", "cairo-gobject"))) + tc_gobject.generate() + + PkgConfigDeps(self).generate() + deps = AutotoolsDeps(self) + if is_msvc(self): + cppflags = deps.vars().get("CPPFLAGS") + deps.environment.append('CFLAGS', cppflags.replace("/I", "-I")) + ldflags = deps.vars().get("LDFLAGS") + deps.environment.define('LDFLAGS', ldflags.replace("/LIBPATH:", "-LIBPATH:")) + deps.environment.append('LDFLAGS', deps.vars().get("LIBS")) + + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + + def fix_freetype_version(): + replace_in_file( + self, + os.path.join(self.source_folder, "configure.ac"), + "FREETYPE_MIN_VERSION=9.7.3", + f"FREETYPE_MIN_VERSION={Version(self.dependencies['freetype'].ref.version)}" + ) + + def exclude_tests_and_docs_from_build(): + makefile_am = os.path.join(self.source_folder, "Makefile.am") + replace_in_file(self, makefile_am, "SUBDIRS += boilerplate test perf", "") + replace_in_file(self, makefile_am, "SUBDIRS = src doc util", "SUBDIRS = src util") + + fix_freetype_version() + exclude_tests_and_docs_from_build() + + if self.options.get_safe("with_freetype"): + replace_in_file(self, os.path.join(self.source_folder, "src", "cairo-ft-font.c"), + "#if HAVE_UNISTD_H", "#ifdef HAVE_UNISTD_H") + + if is_msvc(self): + # https://cairographics.org/end_to_end_build_for_win32/ + win32_common = os.path.join(self.source_folder, "build", "Makefile.win32.common") + replace_in_file(self, win32_common, "-MD ", f"-{self.settings.compiler.runtime} ") + replace_in_file(self, win32_common, "-MDd ", f"-{self.settings.compiler.runtime} ") + replace_in_file(self, win32_common, "$(PIXMAN_PATH)/lib/pixman-1.lib", + self.deps_cpp_info["pixman"].libs[0] + ".lib") + replace_in_file(self, win32_common, "$(FREETYPE_PATH)/lib/freetype.lib", + self.deps_cpp_info["freetype"].libs[0] + ".lib") + replace_in_file(self, win32_common, "$(ZLIB_PATH)/lib/zlib1.lib", + self.deps_cpp_info["zlib"].libs[0] + ".lib") + replace_in_file(self, win32_common, "$(LIBPNG_PATH)/lib/libpng16.lib", + self.deps_cpp_info["libpng"].libs[0] + ".lib") + + def build(self): + self._patch_sources() + autotools = Autotools(self, namespace="main") + if is_msvc(self): + autotools.make() + autotools_gobject = Autotools(self, namespace="gobject") + autotools_gobject.make() + else: + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - if microsoft.is_msvc(self): - src = os.path.join(self._source_subfolder, "src") - cairo_gobject = os.path.join(self._source_subfolder, "util", "cairo-gobject") - inc = os.path.join("include", "cairo") - self.copy(pattern="cairo-version.h", dst=inc, src=(src if scm.Version(self.version) >= "1.17.4" else self._source_subfolder)) - self.copy(pattern="cairo-features.h", dst=inc, src=src) - self.copy(pattern="cairo.h", dst=inc, src=src) - self.copy(pattern="cairo-deprecated.h", dst=inc, src=src) - self.copy(pattern="cairo-win32.h", dst=inc, src=src) - self.copy(pattern="cairo-script.h", dst=inc, src=src) - self.copy(pattern="cairo-ft.h", dst=inc, src=src) - self.copy(pattern="cairo-ps.h", dst=inc, src=src) - self.copy(pattern="cairo-pdf.h", dst=inc, src=src) - self.copy(pattern="cairo-svg.h", dst=inc, src=src) - self.copy(pattern="cairo-gobject.h", dst=inc, src=cairo_gobject) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + if is_msvc(self): + src = os.path.join(self.source_folder, "src") + inc = os.path.join(self.package_folder, "include", "cairo") + copy(self, "cairo-version.h", (src if Version(self.version) >= "1.17.4" else self.source_folder), inc) + copy(self, "cairo-features.h", src, inc) + copy(self, "cairo.h", src, inc) + copy(self, "cairo-deprecated.h", src, inc) + copy(self, "cairo-win32.h", src, inc) + copy(self, "cairo-script.h", src, inc) + copy(self, "cairo-ft.h", src, inc) + copy(self, "cairo-ps.h", src, inc) + copy(self, "cairo-pdf.h", src, inc) + copy(self, "cairo-svg.h", src, inc) + copy(self, "cairo-gobject.h", inc, os.path.join(self.source_folder, "util", "cairo-gobject")) + + config = str(self.settings.build_type).lower() + lib_src_path = os.path.join(self.source_folder, "src", config) + cairo_gobject_src_path = os.path.join(self.source_folder, "util", "cairo-gobject", config) + lib_dest_path = os.path.join(self.package_folder, "lib") + runtime_dest_path = os.path.join(self.package_folder, "bin") + if self.options.shared: - self.copy(pattern="*cairo.lib", dst="lib", src=src, keep_path=False) - self.copy(pattern="*cairo.dll", dst="bin", src=src, keep_path=False) - self.copy(pattern="*cairo-gobject.lib", dst="lib", src=cairo_gobject, keep_path=False) - self.copy(pattern="*cairo-gobject.dll", dst="bin", src=cairo_gobject, keep_path=False) + copy(self, "*cairo.lib", lib_src_path, lib_dest_path) + copy(self, "*cairo.dll", lib_src_path, runtime_dest_path) + copy(self, "*cairo-gobject.lib", cairo_gobject_src_path, lib_dest_path) + copy(self, "*cairo-gobject.dll", cairo_gobject_src_path, runtime_dest_path) else: - self.copy(pattern="*cairo-static.lib", dst="lib", src=src, keep_path=False) - self.copy(pattern="*cairo-gobject.lib", dst="lib", src=cairo_gobject, keep_path=False) - shutil.move(os.path.join(self.package_folder, "lib", "cairo-static.lib"), - os.path.join(self.package_folder, "lib", "cairo.lib")) + copy(self, "cairo-static.lib", lib_src_path, lib_dest_path) + copy(self, "cairo-gobject.lib", cairo_gobject_src_path, lib_dest_path) + rename(self, os.path.join(lib_dest_path, "cairo-static.lib"), os.path.join(lib_dest_path, "cairo.lib")) else: - autotools = self._configure_autotools() + autotools = Autotools(self, namespace="main") autotools.install() - tools.remove_files_by_mask(self.package_folder, "*.la") - self.copy("COPYING*", src=self._source_subfolder, dst="licenses", keep_path=False) - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, "COPYING*", self.source_folder, os.path.join(self.package_folder, "licenses")) + rm(self, "*.la", self.package_folder, recursive=True) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "cairo-all-do-no-use") - self.cpp_info.names["pkg_config"] = "cairo-all-do-not-use" self.cpp_info.components["cairo_"].set_property("pkg_config_name", "cairo") - self.cpp_info.components["cairo_"].names["pkg_config"] = "cairo" self.cpp_info.components["cairo_"].libs = ["cairo"] self.cpp_info.components["cairo_"].includedirs.insert(0, os.path.join("include", "cairo")) self.cpp_info.components["cairo_"].requires = ["pixman::pixman", "libpng::libpng", "zlib::zlib"] @@ -268,49 +304,37 @@ def package_info(self): if self.options.with_xlib: self.cpp_info.components["cairo_"].requires.extend(["xorg::x11", "xorg::xext"]) - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.components["cairo_"].frameworks.append("CoreGraphics") if self.settings.os == "Windows": self.cpp_info.components["cairo-win32"].set_property("pkg_config_name", "cairo-win32") - self.cpp_info.components["cairo-win32"].names["pkg_config"] = "cairo-win32" self.cpp_info.components["cairo-win32"].requires = ["cairo_", "pixman::pixman", "libpng::libpng"] if self.options.get_safe("with_glib", True): self.cpp_info.components["cairo-gobject"].set_property("pkg_config_name", "cairo-gobject") - self.cpp_info.components["cairo-gobject"].names["pkg_config"] = "cairo-gobject" self.cpp_info.components["cairo-gobject"].libs = ["cairo-gobject"] self.cpp_info.components["cairo-gobject"].requires = ["cairo_", "glib::gobject-2.0", "glib::glib-2.0"] if self.settings.os != "Windows": if self.options.with_fontconfig: self.cpp_info.components["cairo-fc"].set_property("pkg_config_name", "cairo-fc") - self.cpp_info.components["cairo-fc"].names["pkg_config"] = "cairo-fc" self.cpp_info.components["cairo-fc"].requires = ["cairo_", "fontconfig::fontconfig"] if self.options.get_safe("with_freetype", True): self.cpp_info.components["cairo-ft"].set_property("pkg_config_name", "cairo-ft") - self.cpp_info.components["cairo-ft"].names["pkg_config"] = "cairo-ft" self.cpp_info.components["cairo-ft"].requires = ["cairo_", "freetype::freetype"] self.cpp_info.components["cairo-pdf"].set_property("pkg_config_name", "cairo-pdf") - self.cpp_info.components["cairo-pdf"].names["pkg_config"] = "cairo-pdf" self.cpp_info.components["cairo-pdf"].requires = ["cairo_", "zlib::zlib"] if self.settings.os == "Linux": if self.options.with_xlib: self.cpp_info.components["cairo-xlib"].set_property("pkg_config_name", "cairo-xlib") - self.cpp_info.components["cairo-xlib"].names["pkg_config"] = "cairo-xlib" self.cpp_info.components["cairo-xlib"].requires = ["cairo_", "xorg::x11", "xorg::xext"] - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.components["cairo-quartz"].set_property("pkg_config_name", "cairo-quartz") - self.cpp_info.components["cairo-quartz"].names["pkg_config"] = "cairo-quartz" self.cpp_info.components["cairo-quartz"].requires = ["cairo_"] self.cpp_info.components["cairo-quartz"].frameworks.extend(["CoreFoundation", "CoreGraphics", "ApplicationServices"]) self.cpp_info.components["cairo-quartz-font"].set_property("pkg_config_name", "cairo-quartz-font") - self.cpp_info.components["cairo-quartz-font"].names["pkg_config"] = "cairo-quartz-font" self.cpp_info.components["cairo-quartz-font"].requires = ["cairo_"] - - def package_id(self): - if self.options.get_safe("with_glib") and not self.options["glib"].shared: - self.info.requires["glib"].full_package_mode() diff --git a/recipes/cairo/all/test_package/CMakeLists.txt b/recipes/cairo/all/test_package/CMakeLists.txt index bed5cd67420b6..4f33d55898eb2 100644 --- a/recipes/cairo/all/test_package/CMakeLists.txt +++ b/recipes/cairo/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1.2) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(cairo CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE cairo::cairo) diff --git a/recipes/cairo/all/test_package/conanfile.py b/recipes/cairo/all/test_package/conanfile.py index 112349b422c25..e904c93b97465 100644 --- a/recipes/cairo/all/test_package/conanfile.py +++ b/recipes/cairo/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cairo/all/test_package/test_package.c b/recipes/cairo/all/test_package/test_package.c index e7474b6da5809..5854291cea177 100644 --- a/recipes/cairo/all/test_package/test_package.c +++ b/recipes/cairo/all/test_package/test_package.c @@ -2,8 +2,35 @@ #include #include +#if defined(WIN32) && CAIRO_HAS_WIN32_SURFACE && CAIRO_HAS_WIN32_FONT + +#include +#include + +#endif + int main() { +#if defined(WIN32) && CAIRO_HAS_WIN32_SURFACE && CAIRO_HAS_WIN32_FONT + + HDC hDC = GetDC(0); + if (hDC) + { + cairo_surface_t * surface = cairo_win32_surface_create(hDC); + if (surface) + { + HFONT hFont = (HFONT)GetStockObject(SYSTEM_FONT); + cairo_font_face_t* font = cairo_win32_font_face_create_for_hfont(hFont); + if (font) + cairo_font_face_destroy(font); + + cairo_surface_destroy(surface); + } + ReleaseDC(0, hDC); + } +#endif + printf("cairo version is %s\n", cairo_version_string()); + return 0; } diff --git a/recipes/cairo/all/test_v1_package/CMakeLists.txt b/recipes/cairo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..692a4909c85a7 --- /dev/null +++ b/recipes/cairo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1.2) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cairo/all/test_v1_package/conanfile.py b/recipes/cairo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..24f9e474d6cd2 --- /dev/null +++ b/recipes/cairo/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self, skip_x64_x86=True): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + diff --git a/recipes/cairo/config.yml b/recipes/cairo/config.yml index fcad6cea70952..248b8521fe8ea 100644 --- a/recipes/cairo/config.yml +++ b/recipes/cairo/config.yml @@ -1,7 +1,9 @@ versions: - "1.16.0": - folder: all - "1.17.2": - folder: all + "1.17.6": + folder: meson "1.17.4": folder: meson + "1.17.2": + folder: all + "1.16.0": + folder: all diff --git a/recipes/cairo/meson/conandata.yml b/recipes/cairo/meson/conandata.yml index 22722dbd3bd7e..da5f931250975 100644 --- a/recipes/cairo/meson/conandata.yml +++ b/recipes/cairo/meson/conandata.yml @@ -1,16 +1,34 @@ sources: + "1.17.6": + sha256: "90496d135c9ef7612c98f8ee358390cdec0825534573778a896ea021155599d2" + url: "https://gitlab.freedesktop.org/cairo/cairo/-/archive/1.17.6/cairo-1.17.6.tar.bz2" "1.17.4": + url: + - "https://www.cairographics.org/snapshots/cairo-1.17.4.tar.xz" + - "https://mirror.koddos.net/blfs/conglomeration/cairo/cairo-1.17.4.tar.xz" sha256: "74b24c1ed436bbe87499179a3b27c43f4143b8676d8ad237a6fa787401959705" - url: "https://www.cairographics.org/snapshots/cairo-1.17.4.tar.xz" patches: "1.17.4": - patch_file: "patches/binutils-2.34-libbfd-fix.patch" - base_path: "source_subfolder/util/cairo-trace" + patch_type: "backport" + patch_description: "fix build with newer versions of bfd" + patch_source: "https://gitlab.freedesktop.org/cairo/cairo/-/commit/e30259f6237571c61992433c110bc6e1ef900244" + base_path: "util/cairo-trace" - patch_file: "patches/cairo-1.17.4-trace-cflags-fix.patch" - base_path: "source_subfolder/util/cairo-trace" + patch_type: "conan" + patch_description: | + Add missing 'PACKAGE' and 'PACKAGE_VERSION' defines for libbfd headers included by 'lookup-symbol.c'. + base_path: "util/cairo-trace" - patch_file: "patches/cairo-1.17.4-xlib-xrender-option.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: >- + This patch adds option to enable or disable xlib-xrender component. + Without it 'xrender' is always required when 'xlib' option is enabled. @sh0 - patch_file: "patches/cairo-1.17.4-symbol-lookup-backport.patch" - base_path: "source_subfolder" + patch_type: "backport" + patch_description: "add symbol-lookup option to allow disabling bfd/libiberty usage" + patch_source: "https://gitlab.freedesktop.org/cairo/cairo/-/commit/e0cf7b869fb1c6b73cf4a9aad2fc8aea4ff1f6ee" - patch_file: "patches/cairo-1.17.4-encoding-backport.patch" - base_path: "source_subfolder" + patch_type: "backport" + patch_description: "use encoding=utf-8 when reading/writing files in helper script" + patch_source: "https://gitlab.freedesktop.org/cairo/cairo/-/commit/9732f4e80f906fab85b97ae55ee44bfd3ee4945e" diff --git a/recipes/cairo/meson/conanfile.py b/recipes/cairo/meson/conanfile.py index ebff14e5fdea3..90cba1b4eab71 100644 --- a/recipes/cairo/meson/conanfile.py +++ b/recipes/cairo/meson/conanfile.py @@ -1,13 +1,26 @@ -import contextlib import glob import os from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools import files, microsoft -from conans import tools, Meson, VisualStudioBuildEnvironment - -required_conan_version = ">=1.50.0" +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, + copy, + export_conandata_patches, + get, + rename, + replace_in_file, + rm, + rmdir) +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import MesonToolchain, Meson +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class CairoConan(ConanFile): @@ -48,32 +61,18 @@ class CairoConan(ConanFile): "with_png": True, "with_opengl": "desktop", "with_symbol_lookup": False, - "tee": True, + "tee": False, } - - generators = "pkg_config" - - _meson = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + short_paths = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd if self.settings.os == "Windows": del self.options.fPIC if self.settings.os != "Linux": @@ -86,28 +85,31 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if self.options.with_glib and self.options.shared: self.options["glib"].shared = True + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): self.requires("pixman/0.40.0") if self.options.with_zlib and self.options.with_png: - self.requires("expat/2.4.8") + self.requires("expat/2.5.0") if self.options.with_lzo: self.requires("lzo/2.10") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_freetype: self.requires("freetype/2.12.1") if self.options.with_fontconfig: self.requires("fontconfig/2.13.93") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_glib: - self.requires("glib/2.73.3") + self.requires("glib/2.75.2") if self.settings.os == "Linux": if self.options.with_xlib or self.options.with_xlib_xrender or self.options.with_xcb: self.requires("xorg/system") @@ -120,16 +122,16 @@ def requirements(self): if self.options.get_safe("with_opengl") and self.settings.os in ["Linux", "FreeBSD"]: self.requires("egl/system") - def build_requirements(self): - self.tool_requires("meson/0.63.1") - self.tool_requires("pkgconf/1.7.4") + def package_id(self): + if self.info.options.with_glib and not self.dependencies["glib"].options.shared: + self.info.requires["glib"].full_package_mode() def validate(self): if self.options.get_safe("with_xlib_xrender") and not self.options.get_safe("with_xlib"): raise ConanInvalidConfiguration("'with_xlib_xrender' option requires 'with_xlib' option to be enabled as well!") if self.options.with_glib: - if self.options["glib"].shared: - if microsoft.is_msvc_static_runtime(self): + if self.dependencies["glib"].options.shared: + if is_msvc_static_runtime(self): raise ConanInvalidConfiguration( "Linking shared glib with the MSVC static runtime is not supported" ) @@ -138,100 +140,104 @@ def validate(self): "Linking a shared library against static glib can cause unexpected behaviour." ) - @contextlib.contextmanager - def _build_context(self): - if microsoft.is_msvc(self): - env_build = VisualStudioBuildEnvironment(self) - if not self.options.shared: - env_build.flags.append("-DCAIRO_WIN32_STATIC_BUILD") - env_build.cxx_flags.append("-DCAIRO_WIN32_STATIC_BUILD") - with tools.environment_append(env_build.vars): - yield - else: - yield + def build_requirements(self): + self.tool_requires("meson/1.0.0") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): - files.get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_meson(self): - def boolean(value): + def generate(self): + def is_enabled(value): return "enabled" if value else "disabled" - meson = Meson(self) + env = VirtualBuildEnv(self) + env.generate() + + pkg_deps = PkgConfigDeps(self) + pkg_deps.generate() - defs = dict() - defs["tests"] = "disabled" - defs["zlib"] = boolean(self.options.with_zlib) - defs["png"] = boolean(self.options.with_png) - defs["freetype"] = boolean(self.options.with_freetype) - defs["fontconfig"] = boolean(self.options.with_fontconfig) + options = dict() + options["tests"] = "disabled" + options["zlib"] = is_enabled(self.options.with_zlib) + options["png"] = is_enabled(self.options.with_png) + options["freetype"] = is_enabled(self.options.with_freetype) + options["fontconfig"] = is_enabled(self.options.with_fontconfig) if self.settings.os == "Linux": - defs["xcb"] = boolean(self.options.get_safe("with_xcb")) - defs["xlib"] = boolean(self.options.get_safe("with_xlib")) - defs["xlib-xrender"] = boolean(self.options.get_safe("with_xlib_xrender")) + options["xcb"] = is_enabled(self.options.with_xcb) + options["xlib"] = is_enabled(self.options.with_xlib) else: - defs["xcb"] = "disabled" - defs["xlib"] = "disabled" + options["xcb"] = "disabled" + options["xlib"] = "disabled" if self.options.get_safe("with_opengl") == "desktop": - defs["gl-backend"] = "gl" + options["gl-backend"] = "gl" elif self.options.get_safe("with_opengl") == "gles2": - defs["gl-backend"] = "glesv2" + options["gl-backend"] = "glesv2" elif self.options.get_safe("with_opengl") == "gles3": - defs["gl-backend"] = "glesv3" + options["gl-backend"] = "glesv3" else: - defs["gl-backend"] = "disabled" - defs["glesv2"] = boolean(self.options.get_safe("with_opengl") == "gles2") - defs["glesv3"] = boolean(self.options.get_safe("with_opengl") == "gles3") - defs["tee"] = boolean(self.options.tee) - defs["symbol-lookup"] = boolean(self.options.get_safe("with_symbol_lookup")) + options["gl-backend"] = "disabled" + options["glesv2"] = is_enabled(self.options.get_safe("with_opengl") == "gles2") + options["glesv3"] = is_enabled(self.options.get_safe("with_opengl") == "gles3") + options["tee"] = is_enabled(self.options.tee) + options["symbol-lookup"] = is_enabled(self.options.get_safe("with_symbol_lookup")) # future options to add, see meson_options.txt. # for now, disabling explicitly, to avoid non-reproducible auto-detection of system libs - defs["cogl"] = "disabled" # https://gitlab.gnome.org/GNOME/cogl - defs["directfb"] = "disabled" - defs["drm"] = "disabled" # not yet compilable in cairo 1.17.4 - defs["openvg"] = "disabled" # https://www.khronos.org/openvg/ - defs["qt"] = "disabled" # not yet compilable in cairo 1.17.4 - defs["gtk2-utils"] = "disabled" - defs["spectre"] = "disabled" # https://www.freedesktop.org/wiki/Software/libspectre/ - - meson.configure( - source_folder=self._source_subfolder, - args=["--wrap-mode=nofallback"], - build_folder=self._build_subfolder, - defs=defs, - ) - return meson + + version = Version(self.version) + if version < "1.17.6": + options["cogl"] = "disabled" # https://gitlab.gnome.org/GNOME/cogl + options["directfb"] = "disabled" + options["drm"] = "disabled" # not yet compilable in cairo 1.17.4 + options["openvg"] = "disabled" # https://www.khronos.org/openvg/ + options["qt"] = "disabled" # not yet compilable in cairo 1.17.4 + if self.settings.os == "Linux": + options["xlib-xrender"] = is_enabled(self.options.with_xlib_xrender) + + options["gtk2-utils"] = "disabled" + options["spectre"] = "disabled" # https://www.freedesktop.org/wiki/Software/libspectre/ + + meson = MesonToolchain(self) + meson.project_options.update(options) + + if is_apple_os(self) and Version(self.version) < "1.17.6": + # This was fixed in the meson build from 1.17.6 + meson.c_link_args += ["-framework", "ApplicationServices", "-framework", "CoreFoundation"] + + if not self.options.shared: + meson.c_args.append("-DCAIRO_WIN32_STATIC_BUILD") + + meson.generate() def build(self): - files.apply_conandata_patches(self) + apply_conandata_patches(self) # Dependency freetype2 found: NO found 2.11.0 but need: '>= 9.7.3' if self.options.with_freetype: - files.replace_in_file(self, "freetype2.pc", - f"Version: {self.deps_cpp_info['freetype'].version}", - "Version: 9.7.3") - with self._build_context(): - meson = self._configure_meson() - meson.build() - - def _fix_library_names(self): - if microsoft.is_msvc(self): - with tools.chdir(os.path.join(self.package_folder, "lib")): - for filename_old in glob.glob("*.a"): - filename_new = filename_old[3:-2] + ".lib" - self.output.info("rename %s into %s" % (filename_old, filename_new)) - files.rename(self, filename_old, filename_new) + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), + "freetype_required_version = '>= 9.7.3'", + f"freetype_required_version = '>= {self.dependencies['freetype'].ref.version}'") + meson = Meson(self) + meson.configure() + meson.build() + + def _fix_library_names(self, path): + if is_msvc(self): + for filename_old in glob.glob(os.path.join(path, "*.a")): + root, _ = os.path.splitext(filename_old) + folder, basename = os.path.split(root) + rename(self, filename_old, os.path.join(folder, basename.replace("lib", "") + ".lib")) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("COPYING*", src=self._source_subfolder, dst="licenses", keep_path=False) - with self._build_context(): - meson = self._configure_meson() - meson.install() - self._fix_library_names() - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - files.rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + meson = Meson(self) + meson.install() + self._fix_library_names(os.path.join(self.package_folder, "lib")) + copy(self, "COPYING*", self.source_folder, os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + fix_apple_shared_install_name(self) def package_info(self): base_requirements = {"pixman::pixman"} @@ -239,7 +245,6 @@ def package_info(self): def add_component_and_base_requirements(component, requirements, system_libs=None): self.cpp_info.components[component].set_property("pkg_config_name", component) - self.cpp_info.components[component].names["pkg_config"] = component self.cpp_info.components[component].requires += ["cairo_"] + requirements base_requirements.update(set(requirements)) if system_libs is not None: @@ -247,10 +252,8 @@ def add_component_and_base_requirements(component, requirements, system_libs=Non base_system_libs.update(set(system_libs)) self.cpp_info.set_property("pkg_config_name", "cairo-all-do-no-use") - self.cpp_info.names["pkg_config"] = "cairo-all-do-no-use" self.cpp_info.components["cairo_"].set_property("pkg_config_name", "cairo") - self.cpp_info.components["cairo_"].names["pkg_config"] = "cairo" self.cpp_info.components["cairo_"].libs = ["cairo"] self.cpp_info.components["cairo_"].includedirs.insert(0, os.path.join("include", "cairo")) @@ -290,28 +293,23 @@ def add_component_and_base_requirements(component, requirements, system_libs=Non if self.options.get_safe("with_xlib"): add_component_and_base_requirements("cairo-xlib-xcb", ["xorg::x11-xcb"]) - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.components["cairo-quartz"].set_property("pkg_config_name", "cairo-quartz") - self.cpp_info.components["cairo-quartz"].names["pkg_config"] = "cairo-quartz" self.cpp_info.components["cairo-quartz"].requires = ["cairo_"] self.cpp_info.components["cairo-quartz-image"].set_property("pkg_config_name", "cairo-quartz-image") - self.cpp_info.components["cairo-quartz-image"].names["pkg_config"] = "cairo-quartz-image" self.cpp_info.components["cairo-quartz-image"].requires = ["cairo_"] self.cpp_info.components["cairo-quartz-font"].set_property("pkg_config_name", "cairo-quartz-font") - self.cpp_info.components["cairo-quartz-font"].names["pkg_config"] = "cairo-quartz-font" self.cpp_info.components["cairo-quartz-font"].requires = ["cairo_"] - self.cpp_info.components["cairo_"].frameworks.append("CoreGraphics") + self.cpp_info.components["cairo_"].frameworks += ["ApplicationServices", "CoreFoundation", "CoreGraphics"] if self.settings.os == "Windows": self.cpp_info.components["cairo-win32"].set_property("pkg_config_name", "cairo-win32") - self.cpp_info.components["cairo-win32"].names["pkg_config"] = "cairo-win32" self.cpp_info.components["cairo-win32"].requires = ["cairo_"] self.cpp_info.components["cairo-win32-font"].set_property("pkg_config_name", "cairo-win32-font") - self.cpp_info.components["cairo-win32-font"].names["pkg_config"] = "cairo-win32-font" self.cpp_info.components["cairo-win32-font"].requires = ["cairo_"] self.cpp_info.components["cairo_"].system_libs.extend(["gdi32", "msimg32", "user32"]) @@ -341,7 +339,6 @@ def add_component_and_base_requirements(component, requirements, system_libs=Non add_component_and_base_requirements("cairo-ps", ["zlib::zlib"]) add_component_and_base_requirements("cairo-pdf", ["zlib::zlib"]) self.cpp_info.components["cairo-script-interpreter"].set_property("pkg_config_name", "cairo-script-interpreter") - self.cpp_info.components["cairo-script-interpreter"].names["pkg_config"] = "cairo-script-interpreter" self.cpp_info.components["cairo-script-interpreter"].libs = ["cairo-script-interpreter"] self.cpp_info.components["cairo-script-interpreter"].requires = ["cairo_"] @@ -351,19 +348,13 @@ def add_component_and_base_requirements(component, requirements, system_libs=Non if self.options.tee: self.cpp_info.components["cairo-tee"].set_property("pkg_config_name", "cairo-tee") - self.cpp_info.components["cairo-tee"].names["pkg_config"] = "cairo-tee" self.cpp_info.components["cairo-tee"].requires = ["cairo_"] # util directory if self.options.with_glib: self.cpp_info.components["cairo-gobject"].set_property("pkg_config_name", "cairo-gobject") - self.cpp_info.components["cairo-gobject"].names["pkg_config"] = "cairo-gobject" self.cpp_info.components["cairo-gobject"].libs = ["cairo-gobject"] self.cpp_info.components["cairo-gobject"].requires = ["cairo_", "glib::gobject-2.0", "glib::glib-2.0"] self.cpp_info.components["cairo_"].requires += list(base_requirements) self.cpp_info.components["cairo_"].system_libs += list(base_system_libs) - - def package_id(self): - if self.options.get_safe("with_glib") and not self.options["glib"].shared: - self.info.requires["glib"].full_package_mode() diff --git a/recipes/cairo/meson/test_package/CMakeLists.txt b/recipes/cairo/meson/test_package/CMakeLists.txt index f544bec65da1e..4f33d55898eb2 100644 --- a/recipes/cairo/meson/test_package/CMakeLists.txt +++ b/recipes/cairo/meson/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1.2) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(cairo CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} cairo::cairo) +target_link_libraries(${PROJECT_NAME} PRIVATE cairo::cairo) diff --git a/recipes/cairo/meson/test_package/conanfile.py b/recipes/cairo/meson/test_package/conanfile.py index 24f9e474d6cd2..e904c93b97465 100644 --- a/recipes/cairo/meson/test_package/conanfile.py +++ b/recipes/cairo/meson/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cairo/meson/test_v1_package/CMakeLists.txt b/recipes/cairo/meson/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..692a4909c85a7 --- /dev/null +++ b/recipes/cairo/meson/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1.2) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cairo/meson/test_v1_package/conanfile.py b/recipes/cairo/meson/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..24f9e474d6cd2 --- /dev/null +++ b/recipes/cairo/meson/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self, skip_x64_x86=True): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + diff --git a/recipes/cajun-jsonapi/all/conanfile.py b/recipes/cajun-jsonapi/all/conanfile.py index 9815e805f346d..55cd07447203f 100644 --- a/recipes/cajun-jsonapi/all/conanfile.py +++ b/recipes/cajun-jsonapi/all/conanfile.py @@ -1,49 +1,89 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, load, save +from conan.tools.scm import Version import os +required_conan_version = ">=1.53.0" + + class CajunJsonApiConan(ConanFile): - name = 'cajun-jsonapi' - description = 'CAJUN* is a C++ API for the JSON object interchange format.' + name = "cajun-jsonapi" + description = "CAJUN* is a C++ API for the JSON object interchange format." topics = ("conan", "cajun", "json") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/cajun-jsonapi/cajun-jsonapi" license = "BSD-3-Clause" - settings = "compiler" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get( + self, + **self.conan_data["sources"][self.version], + destination=self.source_folder, + strip_root=True + ) def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, 11) def _extract_license(self): - file_content = tools.load(os.path.join(self.source_folder, self._source_subfolder, "test.cpp")) - return file_content[:file_content.find("*/")] + file_content = load(self, os.path.join(self.source_folder, "test.cpp")) + return ( + file_content[: file_content.find("*/")] + .split("\n", 2)[-1] + .rsplit("\n", 1)[0] + ) def package(self): - package_version = tools.Version(self.version) + package_version = Version(self.version) if package_version < "2.1.0": # No dedicated LICENSE file in older versions, extracting license text from comments - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + save( + self, + os.path.join(self.package_folder, "licenses", "LICENSE"), + self._extract_license(), + ) # Prior to v2.1.0 there was no "cajun" subfolder in sources but it was present in RPM packages # (e.g. https://centos.pkgs.org/7/epel-x86_64/cajun-jsonapi-devel-2.0.3-2.el7.noarch.rpm.html) # For ease of migration from RPM dependencies to Conan creating intermediate "cajun" folder # so that '#include "cajun/json/..."' statements worked correctly - self.copy('*.h', dst=os.path.join('include', 'cajun', 'json'), src=os.path.join(self._source_subfolder, 'json')) - self.copy('*.inl', dst=os.path.join('include', 'cajun', 'json'), src=os.path.join(self._source_subfolder, 'json')) + copy( + self, + "*.h", + dst=os.path.join(self.package_folder, "include", "cajun", "json"), + src=os.path.join(self.source_folder, "json"), + ) + copy( + self, + "*.inl", + dst=os.path.join(self.package_folder, "include", "cajun", "json"), + src=os.path.join(self.source_folder, "json"), + ) else: - self.copy('*.h', dst=os.path.join('include'), src=os.path.join(self._source_subfolder, 'include')) - self.copy('*.inl', dst=os.path.join('include'), src=os.path.join(self._source_subfolder, 'include')) - self.copy('LICENSE', dst='licenses', src=self._source_subfolder) + copy( + self, + "*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + copy( + self, + "*.inl", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + copy( + self, + "LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) def package_id(self): - self.info.header_only() + self.info.clear() def package_info(self): self.cpp_info.includedirs.append(os.path.join("include", "cajun")) diff --git a/recipes/cajun-jsonapi/all/test_package/CMakeLists.txt b/recipes/cajun-jsonapi/all/test_package/CMakeLists.txt index 55ba603774dce..6361de2a69cab 100644 --- a/recipes/cajun-jsonapi/all/test_package/CMakeLists.txt +++ b/recipes/cajun-jsonapi/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(cajun-jsonapi REQUIRED) add_executable(${PROJECT_NAME} main.cpp) diff --git a/recipes/cajun-jsonapi/all/test_package/conanfile.py b/recipes/cajun-jsonapi/all/test_package/conanfile.py index e065617c053bc..48499fa0989d9 100644 --- a/recipes/cajun-jsonapi/all/test_package/conanfile.py +++ b/recipes/cajun-jsonapi/all/test_package/conanfile.py @@ -1,16 +1,27 @@ -from conans import ConanFile, CMake, tools, RunEnvironment +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os + +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) cmake.configure() - cmake.build() + cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cajun-jsonapi/all/test_v1_package/CMakeLists.txt b/recipes/cajun-jsonapi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7ea0378c83fe1 --- /dev/null +++ b/recipes/cajun-jsonapi/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cajun-jsonapi/all/test_v1_package/conanfile.py b/recipes/cajun-jsonapi/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e065617c053bc --- /dev/null +++ b/recipes/cajun-jsonapi/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools, RunEnvironment +import os + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/calceph/all/conanfile.py b/recipes/calceph/all/conanfile.py index 2c626e956a387..fda6184d24ab9 100644 --- a/recipes/calceph/all/conanfile.py +++ b/recipes/calceph/all/conanfile.py @@ -1,10 +1,14 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -from contextlib import contextmanager -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import chdir, copy, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, NMakeToolchain import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.55.0" class CalcephConan(ConanFile): @@ -12,7 +16,7 @@ class CalcephConan(ConanFile): description = "C Library designed to access the binary planetary ephemeris " \ "files, such INPOPxx, JPL DExxx and SPICE ephemeris files." license = ["CECILL-C", "CECILL-B", "CECILL-2.1"] - topics = ("calceph", "ephemeris", "astronomy", "space", "planet") + topics = ("ephemeris", "astronomy", "space", "planet") homepage = "https://www.imcce.fr/inpop/calceph" url = "https://github.com/conan-io/conan-center-index" @@ -28,14 +32,6 @@ class CalcephConan(ConanFile): "threadsafe": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -43,99 +39,94 @@ def _settings_build(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self._is_msvc: + if is_msvc(self): del self.options.threadsafe def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self._is_msvc and self.options.shared: - raise ConanInvalidConfiguration("calceph doesn't support shared builds with Visual Studio yet") + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support shared builds with Visual Studio yet") def build_requirements(self): - if self._settings_build.os == "Windows" and not self._is_msvc and \ - not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows" and not is_msvc(self): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def build(self): - if self._is_msvc: - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.vc"), - "CFLAGS = /O2 /GR- /MD /nologo /EHs", - "CFLAGS = /nologo /EHs") - with tools.chdir(self._source_subfolder): - with self._msvc_build_environment(): - self.run("nmake -f Makefile.vc {}".format(self._nmake_args)) + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() else: - # relocatable shared lib on macOS - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "-install_name \\$rpath/", - "-install_name @rpath/") - autotools = self._configure_autotools() - autotools.make() - - @contextmanager - def _msvc_build_environment(self): - with tools.vcvars(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - yield + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--enable-thread={yes_no(self.options.threadsafe)}", + "--disable-fortran", + "--disable-python", + "--disable-python-package-system", + "--disable-python-package-user", + "--disable-mex-octave", + ]) + tc.generate() @property def _nmake_args(self): return " ".join([ - "DESTDIR=\"{}\"".format(self.package_folder), + f"DESTDIR=\"{self.package_folder}\"", "ENABLEF2003=0", "ENABLEF77=0", ]) - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-thread={}".format(yes_no(self.options.threadsafe)), - "--disable-fortran", - "--disable-python", - "--disable-python-package-system", - "--disable-python-package-user", - "--disable-mex-octave", - ] - autotools.configure(args=args, configure_dir=self._source_subfolder) - return autotools + def build(self): + if is_msvc(self): + replace_in_file( + self, os.path.join(self.source_folder, "Makefile.vc"), + "CFLAGS = /O2 /GR- /MD /nologo /EHs", + "CFLAGS = /nologo /EHs", + ) + with chdir(self, self.source_folder): + self.run(f"nmake -f Makefile.vc {self._nmake_args}") + else: + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="COPYING*", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - with tools.chdir(self._source_subfolder): - with self._msvc_build_environment(): - self.run("nmake -f Makefile.vc install {}".format(self._nmake_args)) - tools.rmdir(os.path.join(self.package_folder, "doc")) + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + with chdir(self, self.source_folder): + self.run(f"nmake -f Makefile.vc install {self._nmake_args}") + rmdir(self, os.path.join(self.package_folder, "doc")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "libexec")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) + rmdir(self, os.path.join(self.package_folder, "libexec")) def package_info(self): - prefix = "lib" if self._is_msvc else "" - self.cpp_info.libs = ["{}calceph".format(prefix)] + prefix = "lib" if is_msvc(self) else "" + self.cpp_info.libs = [f"{prefix}calceph"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") if self.options.threadsafe: self.cpp_info.system_libs.append("pthread") - if not self._is_msvc: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + # TODO: to remove in conan v2 + if not is_msvc(self): + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/calceph/all/test_package/CMakeLists.txt b/recipes/calceph/all/test_package/CMakeLists.txt index ac91ef75e60e6..5c6dc64f12782 100644 --- a/recipes/calceph/all/test_package/CMakeLists.txt +++ b/recipes/calceph/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(calceph REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} calceph::calceph) +target_link_libraries(${PROJECT_NAME} PRIVATE calceph::calceph) diff --git a/recipes/calceph/all/test_package/conanfile.py b/recipes/calceph/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/calceph/all/test_package/conanfile.py +++ b/recipes/calceph/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/calceph/all/test_v1_package/CMakeLists.txt b/recipes/calceph/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/calceph/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/calceph/all/test_v1_package/conanfile.py b/recipes/calceph/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/calceph/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/canary/all/conandata.yml b/recipes/canary/all/conandata.yml new file mode 100644 index 0000000000000..a5b79d2d07ace --- /dev/null +++ b/recipes/canary/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "v1": + url: "https://github.com/djarek/canary/archive/refs/tags/v1.tar.gz" + sha256: "f3e2e80f5c01b4d60aed4b5ec73663158b495caa4f9324a10d05e55ea8f3938c" diff --git a/recipes/canary/all/conanfile.py b/recipes/canary/all/conanfile.py new file mode 100644 index 0000000000000..1a102a8feb035 --- /dev/null +++ b/recipes/canary/all/conanfile.py @@ -0,0 +1,61 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain +from conan.tools.files import copy, get, rmdir + +required_conan_version = ">=1.53.0" + + +class SocketcanCanaryConan(ConanFile): + name = "canary" + description = "A lightweight implementation of Linux SocketCAN bindings for ASIO/Boost.ASIO" + url = "https://github.com/conan-io/conan-center-index" + license = "BSL-1.0" + homepage = "https://github.com/djarek/canary" + topics = ("socketcan", "can-bus", "can") + + settings = "os", "compiler", "build_type", "arch" + no_copy_source = True + + @property + def _min_cppstd(self): + return 11 + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux.") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def requirements(self): + self.requires("boost/1.74.0", transitive_headers=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + pass + + def package(self): + copy(self, "LICENSE_1_0.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.configure() + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib")) + + def package_id(self): + self.info.clear() + + def package_info(self): + self.cpp_info.requires = ["boost::headers", "boost::system"] + self.cpp_info.set_property("cmake_file_name", "canary") + self.cpp_info.set_property("cmake_target_name", "canary::canary") diff --git a/recipes/canary/all/test_package/CMakeLists.txt b/recipes/canary/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..81f2b230ac92c --- /dev/null +++ b/recipes/canary/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(canary REQUIRED) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PUBLIC canary::canary) +target_compile_features(test_package PRIVATE cxx_std_11) diff --git a/recipes/canary/all/test_package/conanfile.py b/recipes/canary/all/test_package/conanfile.py new file mode 100644 index 0000000000000..d94ba2fb11ca8 --- /dev/null +++ b/recipes/canary/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +import os + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + + +class TestPackage(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/canary/all/test_package/test_package.cpp b/recipes/canary/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ccec8d0783be7 --- /dev/null +++ b/recipes/canary/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include +#include + +int main() +{ + try { + auto index = canary::get_interface_index("vcan0"); + std::cout << "vcan0 interface index: " << index << "\n"; + } + catch (std::exception& exc) { + std::cout << "unable to find vcan0: " << exc.what() << "\n"; + } + + return 0; +} diff --git a/recipes/canary/all/test_v1_package/CMakeLists.txt b/recipes/canary/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..81f2b230ac92c --- /dev/null +++ b/recipes/canary/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(canary REQUIRED) + +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PUBLIC canary::canary) +target_compile_features(test_package PRIVATE cxx_std_11) diff --git a/recipes/canary/all/test_v1_package/conanfile.py b/recipes/canary/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..f8bae5c00ce0a --- /dev/null +++ b/recipes/canary/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import CMake, ConanFile, tools + + +class TestPackage(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join(".", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/canary/all/test_v1_package/test_package.cpp b/recipes/canary/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..ccec8d0783be7 --- /dev/null +++ b/recipes/canary/all/test_v1_package/test_package.cpp @@ -0,0 +1,15 @@ +#include +#include + +int main() +{ + try { + auto index = canary::get_interface_index("vcan0"); + std::cout << "vcan0 interface index: " << index << "\n"; + } + catch (std::exception& exc) { + std::cout << "unable to find vcan0: " << exc.what() << "\n"; + } + + return 0; +} diff --git a/recipes/canary/config.yml b/recipes/canary/config.yml new file mode 100644 index 0000000000000..96340c06c871e --- /dev/null +++ b/recipes/canary/config.yml @@ -0,0 +1,3 @@ +versions: + "v1": + folder: all diff --git a/recipes/canvas_ity/all/conandata.yml b/recipes/canvas_ity/all/conandata.yml new file mode 100644 index 0000000000000..4bd2a5a6b3481 --- /dev/null +++ b/recipes/canvas_ity/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.00": + url: "https://github.com/a-e-k/canvas_ity/archive/f32fbb37e2fe7c0fcaee6ebdc02d3e5385603fd5.tar.gz" + sha256: "be0d9ef9a023ba732e403fe8c1ec9e1cd8f02c75777c09562067c9270612a3ed" diff --git a/recipes/canvas_ity/all/conanfile.py b/recipes/canvas_ity/all/conanfile.py new file mode 100644 index 0000000000000..b4527ac4677c7 --- /dev/null +++ b/recipes/canvas_ity/all/conanfile.py @@ -0,0 +1,48 @@ +from conan import ConanFile +from conan.tools.files import get, copy, load, save +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.50.0" + + +class CanvasItyConan(ConanFile): + name = "canvas_ity" + description = "A tiny, single-header -like 2D rasterizer for C++" + license = "ISC" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/a-e-k/canvas_ity" + topics = ("rasterizer", "canvas", "2d", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + filename = os.path.join(self.source_folder, "src", "canvas_ity.hpp") + file_content = load(self, filename) + license_end = "// ======== ABOUT ========" + license_contents = file_content[:file_content.find(license_end)].replace("//", "") + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/canvas_ity/all/test_package/CMakeLists.txt b/recipes/canvas_ity/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d050dc832dd0b --- /dev/null +++ b/recipes/canvas_ity/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +find_package(canvas_ity REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE canvas_ity::canvas_ity) diff --git a/recipes/canvas_ity/all/test_package/conanfile.py b/recipes/canvas_ity/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/canvas_ity/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/canvas_ity/all/test_package/test_package.cpp b/recipes/canvas_ity/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..84a5a4297d714 --- /dev/null +++ b/recipes/canvas_ity/all/test_package/test_package.cpp @@ -0,0 +1,71 @@ +#include +#include + +#define CANVAS_ITY_IMPLEMENTATION +#include "canvas_ity.hpp" + +int main() { + // Construct the canvas. + static int const width = 256, height = 256; + canvas_ity::canvas context( width, height ); + + // Build a star path. + context.move_to( 128.0f, 28.0f ); context.line_to( 157.0f, 87.0f ); + context.line_to( 223.0f, 97.0f ); context.line_to( 175.0f, 143.0f ); + context.line_to( 186.0f, 208.0f ); context.line_to( 128.0f, 178.0f ); + context.line_to( 69.0f, 208.0f ); context.line_to( 80.0f, 143.0f ); + context.line_to( 32.0f, 97.0f ); context.line_to( 98.0f, 87.0f ); + context.close_path(); + + // Set up the drop shadow. + context.set_shadow_blur( 8.0f ); + context.shadow_offset_y = 4.0f; + context.set_shadow_color( 0.0f, 0.0f, 0.0f, 0.5f ); + + // Fill the star with yellow. + context.set_color( canvas_ity::fill_style, 1.0f, 0.9f, 0.2f, 1.0f ); + context.fill(); + + // Draw the star with a thick red stroke and rounded points. + context.line_join = canvas_ity::rounded; + context.set_line_width( 12.0f ); + context.set_color( canvas_ity::stroke_style, 0.9f, 0.0f, 0.5f, 1.0f ); + context.stroke(); + + // Draw the star again with a dashed thinner orange stroke. + float segments[] = { 21.0f, 9.0f, 1.0f, 9.0f, 7.0f, 9.0f, 1.0f, 9.0f }; + context.set_line_dash( segments, 8 ); + context.line_dash_offset = 10.0f; + context.line_cap = canvas_ity::circle; + context.set_line_width( 6.0f ); + context.set_color( canvas_ity::stroke_style, 0.95f, 0.65f, 0.15f, 1.0f ); + context.stroke(); + + // Turn off the drop shadow. + context.set_shadow_color( 0.0f, 0.0f, 0.0f, 0.0f ); + + // Add a shine layer over the star. + context.set_linear_gradient( canvas_ity::fill_style, 64.0f, 0.0f, 192.0f, 256.0f ); + context.add_color_stop( canvas_ity::fill_style, 0.30f, 1.0f, 1.0f, 1.0f, 0.0f ); + context.add_color_stop( canvas_ity::fill_style, 0.35f, 1.0f, 1.0f, 1.0f, 0.8f ); + context.add_color_stop( canvas_ity::fill_style, 0.45f, 1.0f, 1.0f, 1.0f, 0.8f ); + context.add_color_stop( canvas_ity::fill_style, 0.50f, 1.0f, 1.0f, 1.0f, 0.0f ); + + context.global_composite_operation = canvas_ity::source_atop; + context.fill_rectangle( 0.0f, 0.0f, 256.0f, 256.0f ); + + // Fetch the rendered RGBA pixels from the entire canvas. + unsigned char *image = new unsigned char[ height * width * 4 ]; + context.get_image_data( image, width, height, width * 4, 0, 0 ); + // Write them out to a TGA image file (TGA uses BGRA order). + unsigned char header[] = { 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, + width & 255, width >> 8, height & 255, height >> 8, 32, 40 }; + for ( int pixel = 0; pixel < height * width; ++pixel ) + std::swap( image[ pixel * 4 + 0 ], image[ pixel * 4 + 2 ] ); + std::ofstream stream( "example.tga", std::ios::binary ); + stream.write( reinterpret_cast< char * >( header ), sizeof( header ) ); + stream.write( reinterpret_cast< char * >( image ), height * width * 4 ); + delete[] image; + + return 0; +} diff --git a/recipes/canvas_ity/all/test_v1_package/CMakeLists.txt b/recipes/canvas_ity/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/canvas_ity/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/canvas_ity/all/test_v1_package/conanfile.py b/recipes/canvas_ity/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/canvas_ity/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/canvas_ity/config.yml b/recipes/canvas_ity/config.yml new file mode 100644 index 0000000000000..5ec3e5033421a --- /dev/null +++ b/recipes/canvas_ity/config.yml @@ -0,0 +1,3 @@ +versions: + "1.00": + folder: all diff --git a/recipes/capnproto/all/CMakeLists.txt b/recipes/capnproto/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/capnproto/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/capnproto/all/conandata.yml b/recipes/capnproto/all/conandata.yml index 90455ae513317..8a6eeaab5a8d1 100644 --- a/recipes/capnproto/all/conandata.yml +++ b/recipes/capnproto/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.10.3": + url: "https://github.com/capnproto/capnproto/archive/v0.10.3.tar.gz" + sha256: "e07446f56043c983e009038e69d18ff86a2924909f0b518ccf47eccf5ac03919" "0.10.1": url: "https://github.com/capnproto/capnproto/archive/v0.10.1.tar.gz" sha256: "2e9c918f02c198557c75ca7c635fe281337c9755b752a6ab3a841bcc1cf5176b" @@ -15,36 +18,24 @@ sources: url: "https://github.com/capnproto/capnproto/archive/v0.7.0.tar.gz" sha256: 76c7114a3d142ad08b7208b3964a26e72a6320ee81331d3f0b87569fc9c47a28 patches: + "0.10.3": + - patch_file: patches/0014-disable-tests-for-0.10.1.patch "0.10.1": - patch_file: patches/0014-disable-tests-for-0.10.1.patch - base_path: source_subfolder "0.10.0": - patch_file: patches/0013-disable-tests-for-0.10.0.patch - base_path: source_subfolder "0.9.1": - patch_file: patches/0010-disable-tests-for-0.9.1.patch - base_path: source_subfolder - patch_file: patches/0011-msvc-cpp17-hassubstring-fix-0.9.1.patch - base_path: source_subfolder - patch_file: patches/0012-msvc-nogdi-fix-0.9.1.patch - base_path: source_subfolder "0.8.0": - patch_file: patches/0001-disable-tests.patch - base_path: source_subfolder - patch_file: patches/0002-cmake-compat-header-install.patch - base_path: source_subfolder - patch_file: patches/0003-kj-tls-windows.patch - base_path: source_subfolder - patch_file: patches/0004-cmake-module-path.patch - base_path: source_subfolder - patch_file: patches/0005-msvc-16.7-ice-workaround.patch - base_path: source_subfolder - patch_file: patches/0009-windows-symlink-fix-0.8.0.patch - base_path: source_subfolder "0.7.0": - patch_file: patches/0006-symlink.patch - base_path: source_subfolder - patch_file: patches/0007-cmake-module-path.patch - base_path: source_subfolder - patch_file: patches/0008-disable-tests.patch - base_path: source_subfolder diff --git a/recipes/capnproto/all/conanfile.py b/recipes/capnproto/all/conanfile.py index 4d5fd86b03ef9..31ac13800e74b 100644 --- a/recipes/capnproto/all/conanfile.py +++ b/recipes/capnproto/all/conanfile.py @@ -1,19 +1,26 @@ -from conans import ConanFile, CMake, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import glob import os import textwrap -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class CapnprotoConan(ConanFile): name = "capnproto" description = "Cap'n Proto serialization/RPC system." license = "MIT" - topics = ("capnproto", "serialization", "rpc") + topics = ("serialization", "rpc") homepage = "https://capnproto.org" url = "https://github.com/conan-io/conan-center-index" @@ -31,114 +38,117 @@ class CapnprotoConan(ConanFile): "with_zlib": True, } - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return "14" @property def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "5", "clang": "5", "apple-clang": "5.1", } + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) < "0.8.0": + if Version(self.version) < "0.8.0": del self.options.with_zlib def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + if self.settings.os == "Windows": + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1o") + self.requires("openssl/1.1.1s") if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, self._min_cppstd) minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("Cap'n Proto requires C++14. Your compiler is unknown. Assuming it supports C++14.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("Cap'n Proto requires C++14, which your compiler does not support.") + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) if is_msvc(self) and self.options.shared: - raise ConanInvalidConfiguration("Cap'n Proto doesn't support shared libraries for Visual Studio") - if self.settings.os == "Windows" and tools.Version(self.version) < "0.8.0" and self.options.with_openssl: - raise ConanInvalidConfiguration("Cap'n Proto doesn't support OpenSSL on Windows pre 0.8.0") + raise ConanInvalidConfiguration(f"{self.ref} doesn't support shared libraries for Visual Studio") + if self.settings.os == "Windows" and Version(self.version) < "0.8.0" and self.options.with_openssl: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support OpenSSL on Windows pre 0.8.0") def build_requirements(self): if self.settings.os != "Windows": - self.build_requires("libtool/2.4.6") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = False - cmake.definitions["EXTERNAL_CAPNP"] = False - cmake.definitions["CAPNP_LITE"] = False - cmake.definitions["WITH_OPENSSL"] = self.options.with_openssl - cmake.configure(build_folder=self._build_subfolder) - return cmake - - @functools.lru_cache(1) - def _configure_autotools(self): - args = [ - "--enable-shared" if self.options.shared else "--disable-shared", - "--disable-static" if self.options.shared else "--enable-static", - "--with-openssl" if self.options.with_openssl else "--without-openssl", - "--enable-reflection", - ] - if tools.Version(self.version) >= "0.8.0": - args.append("--with-zlib" if self.options.with_zlib else "--without-zlib") - autotools = AutoToolsBuildEnvironment(self) - # Fix rpath on macOS - if self.settings.os == "Macos": - autotools.link_flags.append("-Wl,-rpath,@loader_path/../lib") - autotools.configure(args=args) - return autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + if self.settings.os == "Windows": + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["EXTERNAL_CAPNP"] = False + tc.variables["CAPNP_LITE"] = False + tc.variables["WITH_OPENSSL"] = self.options.with_openssl + tc.generate() + deps = CMakeDeps(self) + deps.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--with-openssl={yes_no(self.options.with_openssl)}", + "--enable-reflection", + ]) + if Version(self.version) >= "0.8.0": + tc.configure_args.append(f"--with-zlib={yes_no(self.options.with_zlib)}") + # Fix rpath on macOS + if self.settings.os == "Macos": + tc.extra_ldflags.append("-Wl,-rpath,@loader_path/../lib") + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() else: - with tools.chdir(os.path.join(self._source_subfolder, "c++")): - self.run("{} -fiv".format(tools.get_env("AUTORECONF"))) - # relocatable shared libs on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - # avoid SIP issues on macOS when dependencies are shared - if tools.is_apple_os(self.settings.os): - libpaths = ":".join(self.deps_cpp_info.lib_paths) - tools.replace_in_file( - "configure", - "#! /bin/sh\n", - "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n".format(libpaths), - ) - autotools = self._configure_autotools() + with chdir(self, os.path.join(self.source_folder, "c++")): + autotools = Autotools(self) + # TODO: replace by a call to autootols.autoreconf() in c++ folder once https://github.com/conan-io/conan/issues/12103 implemented + self.run("autoreconf --force --install") + autotools.configure(build_script_folder=os.path.join(self.source_folder, "c++")) autotools.make() @property @@ -146,16 +156,17 @@ def _cmake_folder(self): return os.path.join("lib", "cmake", "CapnProto") def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() else: - with tools.chdir(os.path.join(self._source_subfolder, "c++")): - autotools = self._configure_autotools() + with chdir(self, os.path.join(self.source_folder, "c++")): + autotools = Autotools(self) autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) for cmake_file in glob.glob(os.path.join(self.package_folder, self._cmake_folder, "*")): if os.path.basename(cmake_file) != "CapnProtoMacros.cmake": os.remove(cmake_file) @@ -175,7 +186,7 @@ def package(self): set(CAPNP_INCLUDE_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/../../../include") function(CAPNP_GENERATE_CPP SOURCES HEADERS) """) - tools.replace_in_file(os.path.join(self.package_folder, self._cmake_folder, "CapnProtoMacros.cmake"), + replace_in_file(self, os.path.join(self.package_folder, self._cmake_folder, "CapnProtoMacros.cmake"), "function(CAPNP_GENERATE_CPP SOURCES HEADERS)", find_execs) @@ -198,7 +209,7 @@ def package_info(self): components.append({"name": "kj-gzip", "requires": ["kj", "kj-async", "zlib::zlib"]}) if self.options.with_openssl: components.append({"name": "kj-tls", "requires": ["kj", "kj-async", "openssl::openssl"]}) - if tools.Version(self.version) >= "0.9.0": + if Version(self.version) >= "0.9.0": components.append({ "name": "capnp-websocket", "requires": ["capnp", "capnp-rpc", "kj-http", "kj-async", "kj"], @@ -214,18 +225,17 @@ def package_info(self): elif self.settings.os == "Windows": self.cpp_info.components["kj-async"].system_libs = ["ws2_32"] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var with: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "CapnProto" self.cpp_info.names["cmake_find_package_multi"] = "CapnProto" self.cpp_info.components["kj"].build_modules = [capnprotomacros] + bin_path = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH env var with: {bin_path}") + self.env_info.PATH.append(bin_path) def _register_component(self, component): name = component["name"] - self.cpp_info.components[name].set_property("cmake_target_name", "CapnProto::{}".format(name)) + self.cpp_info.components[name].set_property("cmake_target_name", f"CapnProto::{name}") self.cpp_info.components[name].builddirs.append(self._cmake_folder) self.cpp_info.components[name].set_property("pkg_config_name", name) self.cpp_info.components[name].libs = [name] diff --git a/recipes/capnproto/all/test_package/CMakeLists.txt b/recipes/capnproto/all/test_package/CMakeLists.txt index 44e90440833f5..8ffc65e9ffa4b 100644 --- a/recipes/capnproto/all/test_package/CMakeLists.txt +++ b/recipes/capnproto/all/test_package/CMakeLists.txt @@ -1,20 +1,16 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(CapnProto REQUIRED capnp capnp-rpc CONFIG) capnp_generate_cpp(addressbookSources addressbookHeaders addressbook.capnp) add_executable(addressbook addressbook.c++ ${addressbookSources}) -target_link_libraries(addressbook CapnProto::capnp) target_include_directories(addressbook PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -set_property(TARGET addressbook PROPERTY CXX_STANDARD 14) +target_link_libraries(addressbook PRIVATE CapnProto::capnp) +target_compile_features(addressbook PRIVATE cxx_std_14) capnp_generate_cpp(calculatorSources calculatorHeaders calculator.capnp) -add_library(calculator_protocol STATIC) -target_sources(calculator_protocol PRIVATE ${calculatorSources}) +add_library(calculator_protocol STATIC ${calculatorSources}) target_include_directories(calculator_protocol PUBLIC ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(calculator_protocol PUBLIC CapnProto::capnp-rpc) target_compile_features(calculator_protocol PUBLIC cxx_std_14) diff --git a/recipes/capnproto/all/test_package/conanfile.py b/recipes/capnproto/all/test_package/conanfile.py index 10650773f736a..d4d32590a51cc 100644 --- a/recipes/capnproto/all/test_package/conanfile.py +++ b/recipes/capnproto/all/test_package/conanfile.py @@ -1,14 +1,31 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires(str(self.requires["capnproto"])) + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires(self.tested_reference_str) + + def generate(self): + VirtualRunEnv(self).generate() + if hasattr(self, "settings_build") and cross_building(self): + VirtualBuildEnv(self).generate() + else: + VirtualRunEnv(self).generate(scope="build") def build(self): cmake = CMake(self) @@ -16,6 +33,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "addressbook") - self.run("{} write".format(bin_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "addressbook") + self.run(f"{bin_path} write", env="conanrun") diff --git a/recipes/capnproto/all/test_v1_package/CMakeLists.txt b/recipes/capnproto/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/capnproto/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/capnproto/all/test_v1_package/conanfile.py b/recipes/capnproto/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9c7aa58ab8868 --- /dev/null +++ b/recipes/capnproto/all/test_v1_package/conanfile.py @@ -0,0 +1,26 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + if hasattr(self, "settings_build"): + self.build_requires(self.tested_reference_str) + + def build(self): + with tools.no_op() if hasattr(self, "settings_build") else tools.run_environment(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "addressbook") + self.run(f"{bin_path} write", run_environment=True) diff --git a/recipes/capnproto/config.yml b/recipes/capnproto/config.yml index b46b8cb89082c..89d97bce3d850 100644 --- a/recipes/capnproto/config.yml +++ b/recipes/capnproto/config.yml @@ -1,4 +1,6 @@ versions: + "0.10.3": + folder: all "0.10.1": folder: all "0.10.0": diff --git a/recipes/capstone/all/CMakeLists.txt b/recipes/capstone/all/CMakeLists.txt deleted file mode 100644 index 274835e74cb84..0000000000000 --- a/recipes/capstone/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/capstone/all/conandata.yml b/recipes/capstone/all/conandata.yml index e3487780998d8..7e93927333e67 100644 --- a/recipes/capstone/all/conandata.yml +++ b/recipes/capstone/all/conandata.yml @@ -1,4 +1,4 @@ sources: "4.0.2": - url: "https://github.com/aquynh/capstone/archive/refs/tags/4.0.2.tar.gz" + url: "https://github.com/capstone-engine/capstone/archive/refs/tags/4.0.2.tar.gz" sha256: "7c81d798022f81e7507f1a60d6817f63aa76e489aa4e7055255f21a22f5e526a" diff --git a/recipes/capstone/all/conanfile.py b/recipes/capstone/all/conanfile.py index 3d8d2f761f397..148a51bb1323b 100644 --- a/recipes/capstone/all/conanfile.py +++ b/recipes/capstone/all/conanfile.py @@ -1,5 +1,10 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os -from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.53.0" class CapstoneConan(ConanFile): @@ -7,75 +12,75 @@ class CapstoneConan(ConanFile): license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.capstone-engine.org" - description = "Capstone disassembly/disassembler framework: Core (Arm, Arm64, BPF, EVM, M68K, M680X, MOS65xx, Mips, PPC, RISCV, Sparc, SystemZ, TMS320C64x, Web Assembly, X86, X86_64, XCore) + bindings." - topics = ("conan", 'reverse-engineering', 'disassembler', 'security', 'framework', 'arm', 'arm64', 'x86', 'sparc', 'powerpc', 'mips', 'x86-64', 'ethereum', 'systemz', 'webassembly', 'm68k', 'm0s65xx', 'm680x', 'tms320c64x', 'bpf', 'riscv') + description = ( + "Capstone disassembly/disassembler framework: Core (Arm, Arm64, BPF, " + "EVM, M68K, M680X, MOS65xx, Mips, PPC, RISCV, Sparc, SystemZ, " + "TMS320C64x, Web Assembly, X86, X86_64, XCore) + bindings." + ) + topics = ( + "reverse-engineering", "disassembler", "security", "framework", "arm", "arm64", + "x86", "sparc", "powerpc", "mips", "x86-64", "ethereum", "systemz", + "webassembly", "m68k", "m0s65xx", "m680x", "tms320c64x", "bpf", "riscv", + ) + settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], - "fPIC": [True, False], - "use_default_alloc": [True, False]} - default_options = {"shared": False, - "fPIC": True, - "use_default_alloc": True} - exports_sources = ["CMakeLists.txt"] - generators = "cmake", - _cmake = None - _archs = ['arm', 'm68k', 'mips', 'ppc', 'sparc', 'sysz', 'xcore', 'x86', 'tms320c64x', 'm680x', 'evm'] + options = { + "shared": [True, False], + "fPIC": [True, False], + "use_default_alloc": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "use_default_alloc": True, + } + + _archs = ["arm", "m68k", "mips", "ppc", "sparc", "sysz", "xcore", "x86", "tms320c64x", "m680x", "evm"] options.update({a: [True, False] for a in _archs}) default_options.update({a: True for a in _archs}) - @property - def _source_subfolder(self): - return "source_subfolder" - - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") - def _configure_cmake(self): - if self._cmake: - return self._cmake - cmake = CMake(self) - cmake.definitions['CAPSTONE_BUILD_STATIC'] = not self.options.shared - cmake.definitions['CAPSTONE_BUILD_SHARED'] = self.options.shared - cmake.definitions['CAPSTONE_BUILD_TESTS'] = False - cmake.definitions['CAPSTONE_BUILD_CSTOOL'] = False - cmake.definitions['CAPSTONE_ARCHITECUTRE_DEFAULT'] = False - cmake.definitions['CAPSTONE_USE_SYS_DYN_MEM'] = self.options.use_default_alloc + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CAPSTONE_BUILD_STATIC"] = not self.options.shared + tc.variables["CAPSTONE_BUILD_SHARED"] = self.options.shared + tc.variables["CAPSTONE_BUILD_TESTS"] = False + tc.variables["CAPSTONE_BUILD_CSTOOL"] = False + tc.variables["CAPSTONE_ARCHITECUTRE_DEFAULT"] = False + tc.variables["CAPSTONE_USE_SYS_DYN_MEM"] = self.options.use_default_alloc for a in self._archs: - cmake.definitions['CAPSTONE_%s_SUPPORT' % a.upper()] = self.options.get_safe(a) - runtime = self.settings.get_safe("compiler.runtime") - if runtime: - cmake.definitions['CAPSTONE_BUILD_STATIC_RUNTIME'] = 'MT' in runtime - cmake.configure() - self._cmake = cmake - return self._cmake + tc.variables[f"CAPSTONE_{a.upper()}_SUPPORT"] = self.options.get_safe(a) + tc.variables["CAPSTONE_BUILD_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE_LLVM.txt", dst="licenses", src=self._source_subfolder) - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE*.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - # FIXME : add components, if needed def package_info(self): + suffix = "_dll" if is_msvc(self) and self.options.shared else "" + self.cpp_info.libs = [f"capstone{suffix}"] if self.options.shared: - self.cpp_info.defines.append('CAPSTONE_SHARED') - if self.settings.compiler == "Visual Studio" and self.options.shared: - self.cpp_info.libs = ["capstone_dll"] - else: - self.cpp_info.libs = ["capstone"] + self.cpp_info.defines.append("CAPSTONE_SHARED") diff --git a/recipes/capstone/all/test_package/CMakeLists.txt b/recipes/capstone/all/test_package/CMakeLists.txt index 34af13462f44f..7c02e4fe66493 100644 --- a/recipes/capstone/all/test_package/CMakeLists.txt +++ b/recipes/capstone/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(capstone REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE capstone::capstone) diff --git a/recipes/capstone/all/test_package/conanfile.py b/recipes/capstone/all/test_package/conanfile.py index 1d0bdd3779793..0a6bc68712d90 100644 --- a/recipes/capstone/all/test_package/conanfile.py +++ b/recipes/capstone/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/capstone/all/test_v1_package/CMakeLists.txt b/recipes/capstone/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/capstone/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/capstone/all/test_v1_package/conanfile.py b/recipes/capstone/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/capstone/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/catch2/2.x.x/CMakeLists.txt b/recipes/catch2/2.x.x/CMakeLists.txt deleted file mode 100644 index 81d8e3777d4df..0000000000000 --- a/recipes/catch2/2.x.x/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -option(enable_benchmark "Enable benchmark" OFF) - -if (enable_benchmark) - add_definitions(-DCATCH_CONFIG_ENABLE_BENCHMARKING) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/catch2/2.x.x/conandata.yml b/recipes/catch2/2.x.x/conandata.yml index a0d3adb7f0e99..c945ab0313001 100644 --- a/recipes/catch2/2.x.x/conandata.yml +++ b/recipes/catch2/2.x.x/conandata.yml @@ -1,16 +1,16 @@ sources: - "2.11.3": - url: "https://github.com/catchorg/Catch2/archive/v2.11.3.tar.gz" - sha256: "9a6967138062688f04374698fce4ce65908f907d8c0fe5dfe8dc33126bd46543" - "2.12.4": - url: "https://github.com/catchorg/Catch2/archive/v2.12.4.tar.gz" - sha256: "5436725bbc6ee131a0bc9545bef31f0adabbb21fbc39fb6f1b2a42c12e4f8107" - "2.13.7": - url: "https://github.com/catchorg/Catch2/archive/v2.13.7.tar.gz" - sha256: "3cdb4138a072e4c0290034fe22d9f0a80d3bcfb8d7a8a5c49ad75d3a5da24fae" - "2.13.8": - url: "https://github.com/catchorg/Catch2/archive/v2.13.8.tar.gz" - sha256: "b9b592bd743c09f13ee4bf35fc30eeee2748963184f6bea836b146e6cc2a585a" "2.13.9": url: "https://github.com/catchorg/Catch2/archive/v2.13.9.tar.gz" sha256: "06dbc7620e3b96c2b69d57bf337028bf245a211b3cddb843835bfe258f427a52" + "2.13.8": + url: "https://github.com/catchorg/Catch2/archive/v2.13.8.tar.gz" + sha256: "b9b592bd743c09f13ee4bf35fc30eeee2748963184f6bea836b146e6cc2a585a" + "2.13.7": + url: "https://github.com/catchorg/Catch2/archive/v2.13.7.tar.gz" + sha256: "3cdb4138a072e4c0290034fe22d9f0a80d3bcfb8d7a8a5c49ad75d3a5da24fae" + "2.12.4": + url: "https://github.com/catchorg/Catch2/archive/v2.12.4.tar.gz" + sha256: "5436725bbc6ee131a0bc9545bef31f0adabbb21fbc39fb6f1b2a42c12e4f8107" + "2.11.3": + url: "https://github.com/catchorg/Catch2/archive/v2.11.3.tar.gz" + sha256: "9a6967138062688f04374698fce4ce65908f907d8c0fe5dfe8dc33126bd46543" diff --git a/recipes/catch2/2.x.x/conanfile.py b/recipes/catch2/2.x.x/conanfile.py index 948deb78438bd..85e43357d751d 100644 --- a/recipes/catch2/2.x.x/conanfile.py +++ b/recipes/catch2/2.x.x/conanfile.py @@ -1,26 +1,29 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class Catch2Conan(ConanFile): name = "catch2" description = "A modern, C++-native, header-only, framework for unit-tests, TDD and BDD" - topics = ("catch2", "header-only", "unit-test", "tdd", "bdd") + topics = ("header-only", "unit-test", "tdd", "bdd") homepage = "https://github.com/catchorg/Catch2" url = "https://github.com/conan-io/conan-center-index" license = "BSL-1.0" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], "with_main": [True, False], "with_benchmark": [True, False], "with_prefix": [True, False], - "default_reporter": "ANY", + "default_reporter": [None, "ANY"], } default_options = { "fPIC": True, @@ -30,20 +33,9 @@ class Catch2Conan(ConanFile): "default_reporter": None, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _default_reporter_str(self): - return '"{}"'.format(str(self.options.default_reporter).strip('"')) + return str(self.options.default_reporter).strip('"') def config_options(self): if self.settings.os == "Windows": @@ -51,88 +43,92 @@ def config_options(self): def configure(self): if not self.options.with_main: - del self.options.fPIC - del self.options.with_benchmark + self.options.rm_safe("fPIC") + self.options.rm_safe("with_benchmark") + + def layout(self): + cmake_layout(self, src_folder="src") def package_id(self): - if not self.options.with_main: - self.info.header_only() + if not self.info.options.with_main: + self.info.clear() def validate(self): - if tools.Version(self.version) < "2.13.1" and self.settings.arch == "armv8": - raise ConanInvalidConfiguration("ARMv8 is supported by 2.13.1+ only! give up!") - if self.options.with_main and tools.Version(self.version) < "2.13.4": - raise ConanInvalidConfiguration("Option with_main not supported with versions < 2.13.4") + if Version(self.version) < "2.13.1" and self.settings.arch == "armv8": + raise ConanInvalidConfiguration("ARMv8 is not supported by versions < 2.13.1+") + if self.options.get_safe("with_main") and Version(self.version) < "2.13.4": + raise ConanInvalidConfiguration("Option with_main not supported by versions < 2.13.4") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = "OFF" - cmake.definitions["CATCH_INSTALL_DOCS"] = "OFF" - cmake.definitions["CATCH_INSTALL_HELPERS"] = "ON" - cmake.definitions["CATCH_BUILD_STATIC_LIBRARY"] = self.options.with_main - cmake.definitions["enable_benchmark"] = self.options.get_safe("with_benchmark", False) - cmake.definitions["CATCH_CONFIG_PREFIX_ALL"] = self.options.with_prefix + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.cache_variables["CATCH_INSTALL_DOCS"] = False # these are cmake options, so use cache_variables + tc.cache_variables["CATCH_INSTALL_HELPERS"] = "ON" # these are cmake options, so use cache_variables + tc.cache_variables["CATCH_BUILD_STATIC_LIBRARY"] = str(self.options.with_main) # these are cmake options, so use cache_variables (str() is required for conan 1.52) + if self.options.with_prefix: + tc.preprocessor_definitions["CATCH_CONFIG_PREFIX_ALL"] = 1 + if self.options.get_safe("with_benchmark", False): + tc.preprocessor_definitions["CATCH_CONFIG_ENABLE_BENCHMARKING"] = 1 if self.options.default_reporter: - cmake.definitions["CATCH_CONFIG_DEFAULT_REPORTER"] = self._default_reporter_str - - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["CATCH_CONFIG_DEFAULT_REPORTER"] = self._default_reporter_str + tc.generate() def build(self): - # Catch2 does skip install if included as subproject: - # https://github.com/catchorg/Catch2/blob/79a5cd795c387e2da58c13e9dcbfd9ea7a2cfb30/CMakeLists.txt#L100-L102 - main_cml = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(main_cml, "if (NOT_SUBPROJECT)", "if (TRUE)") + cmake = CMake(self) + cmake.configure() if self.options.with_main: - cmake = self._configure_cmake() cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) for cmake_file in ["ParseAndAddCatchTests.cmake", "Catch.cmake", "CatchAddTests.cmake"]: - self.copy( + copy(self, cmake_file, - src=os.path.join(self._source_subfolder, "contrib"), - dst=os.path.join("lib", "cmake", "Catch2"), + src=os.path.join(self.source_folder, "contrib"), + dst=os.path.join(self.package_folder, "lib", "cmake", "Catch2"), ) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Catch2") self.cpp_info.set_property("cmake_target_name", "Catch2::Catch2{}".format("WithMain" if self.options.with_main else "")) - self.cpp_info.set_property("pkg_config_name", "catch2".format("-with-main" if self.options.with_main else "")) - self.cpp_info.names["cmake_find_package"] = "Catch2" - self.cpp_info.names["cmake_find_package_multi"] = "Catch2" + self.cpp_info.set_property("pkg_config_name", "catch2{}".format("-with-main" if self.options.with_main else "")) + + defines = [] + if self.options.get_safe("with_benchmark", False): + defines.append("CATCH_CONFIG_ENABLE_BENCHMARKING") + if self.options.with_prefix: + defines.append("CATCH_CONFIG_PREFIX_ALL") + if self.options.default_reporter: + defines.append(f"CATCH_CONFIG_DEFAULT_REPORTER={self._default_reporter_str}") if self.options.with_main: self.cpp_info.components["_catch2"].set_property("cmake_target_name", "Catch2::Catch2") self.cpp_info.components["_catch2"].set_property("pkg_config_name", "catch2") - self.cpp_info.components["_catch2"].names["cmake_find_package"] = "Catch2" - self.cpp_info.components["_catch2"].names["cmake_find_package_multi"] = "Catch2" + self.cpp_info.components["_catch2"].defines = defines - self.cpp_info.components["catch2_with_main"].builddirs = [os.path.join("lib", "cmake", "Catch2")] + self.cpp_info.components["catch2_with_main"].builddirs.append(os.path.join("lib", "cmake", "Catch2")) self.cpp_info.components["catch2_with_main"].libs = ["Catch2WithMain"] self.cpp_info.components["catch2_with_main"].system_libs = ["log"] if self.settings.os == "Android" else [] self.cpp_info.components["catch2_with_main"].set_property("cmake_target_name", "Catch2::Catch2WithMain") self.cpp_info.components["catch2_with_main"].set_property("pkg_config_name", "catch2-with-main") - self.cpp_info.components["catch2_with_main"].names["cmake_find_package"] = "Catch2WithMain" - self.cpp_info.components["catch2_with_main"].names["cmake_find_package_multi"] = "Catch2WithMain" - defines = self.cpp_info.components["catch2_with_main"].defines + self.cpp_info.components["catch2_with_main"].defines = defines else: self.cpp_info.builddirs = [os.path.join("lib", "cmake", "Catch2")] self.cpp_info.system_libs = ["log"] if self.settings.os == "Android" else [] - defines = self.cpp_info.defines + self.cpp_info.defines = defines - if self.options.get_safe("with_benchmark", False): - defines.append("CATCH_CONFIG_ENABLE_BENCHMARKING") - if self.options.with_prefix: - defines.append("CATCH_CONFIG_PREFIX_ALL") - if self.options.default_reporter: - defines.append("CATCH_CONFIG_DEFAULT_REPORTER={}".format(self._default_reporter_str)) + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.names["cmake_find_package"] = "Catch2" + self.cpp_info.names["cmake_find_package_multi"] = "Catch2" + if self.options.with_main: + self.cpp_info.components["_catch2"].names["cmake_find_package"] = "Catch2" + self.cpp_info.components["_catch2"].names["cmake_find_package_multi"] = "Catch2" + self.cpp_info.components["catch2_with_main"].names["cmake_find_package"] = "Catch2WithMain" + self.cpp_info.components["catch2_with_main"].names["cmake_find_package_multi"] = "Catch2WithMain" diff --git a/recipes/catch2/2.x.x/test_package/000-CatchMain.cpp b/recipes/catch2/2.x.x/test_package/000-CatchMain.cpp index 2894d425add19..f481b16fe25e9 100644 --- a/recipes/catch2/2.x.x/test_package/000-CatchMain.cpp +++ b/recipes/catch2/2.x.x/test_package/000-CatchMain.cpp @@ -1,15 +1,3 @@ -// 000-CatchMain.cpp - -// In a Catch project with multiple files, dedicate one file to compile the -// source code of Catch itself and reuse the resulting object file for linking. - -// Let Catch provide main(): #define CATCH_CONFIG_MAIN #include - -// That's it - -// Compile implementation of Catch for use with files that do contain tests: -// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -c 000-CatchMain.cpp -// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% -c 000-CatchMain.cpp diff --git a/recipes/catch2/2.x.x/test_package/100-Fix-Section.cpp b/recipes/catch2/2.x.x/test_package/100-Fix-Section.cpp deleted file mode 100644 index d0b9f2da5b73a..0000000000000 --- a/recipes/catch2/2.x.x/test_package/100-Fix-Section.cpp +++ /dev/null @@ -1,69 +0,0 @@ -// 100-Fix-Section.cpp - -// Catch has two ways to express fixtures: -// - Sections (this file) -// - Traditional class-based fixtures - -// main() provided in 000-CatchMain.cpp - -#include - -TEST_CASE( "vectors can be sized and resized", "[vector]" ) { - - // For each section, vector v is anew: - - std::vector v( 5 ); - - REQUIRE( v.size() == 5 ); - REQUIRE( v.capacity() >= 5 ); - - SECTION( "resizing bigger changes size and capacity" ) { - v.resize( 10 ); - - REQUIRE( v.size() == 10 ); - REQUIRE( v.capacity() >= 10 ); - } - SECTION( "resizing smaller changes size but not capacity" ) { - v.resize( 0 ); - - REQUIRE( v.size() == 0 ); - REQUIRE( v.capacity() >= 5 ); - } - SECTION( "reserving bigger changes capacity but not size" ) { - v.reserve( 10 ); - - REQUIRE( v.size() == 5 ); - REQUIRE( v.capacity() >= 10 ); - } - SECTION( "reserving smaller does not change size or capacity" ) { - v.reserve( 0 ); - - REQUIRE( v.size() == 5 ); - REQUIRE( v.capacity() >= 5 ); - } -} - -// Compile & run: -// - g++ -std=c++11 -Wall -I$(CATCH_SINGLE_INCLUDE) -o 100-Fix-Section 100-Fix-Section.cpp 000-CatchMain.o && 100-Fix-Section --success -// - cl -EHsc -I%CATCH_SINGLE_INCLUDE% 100-Fix-Section.cpp 000-CatchMain.obj && 100-Fix-Section --success - -// Expected compact output (all assertions): -// -// prompt> 100-Fix-Section.exe --reporter compact --success -// 100-Fix-Section.cpp:17: passed: v.size() == 5 for: 5 == 5 -// 100-Fix-Section.cpp:18: passed: v.capacity() >= 5 for: 5 >= 5 -// 100-Fix-Section.cpp:23: passed: v.size() == 10 for: 10 == 10 -// 100-Fix-Section.cpp:24: passed: v.capacity() >= 10 for: 10 >= 10 -// 100-Fix-Section.cpp:17: passed: v.size() == 5 for: 5 == 5 -// 100-Fix-Section.cpp:18: passed: v.capacity() >= 5 for: 5 >= 5 -// 100-Fix-Section.cpp:29: passed: v.size() == 0 for: 0 == 0 -// 100-Fix-Section.cpp:30: passed: v.capacity() >= 5 for: 5 >= 5 -// 100-Fix-Section.cpp:17: passed: v.size() == 5 for: 5 == 5 -// 100-Fix-Section.cpp:18: passed: v.capacity() >= 5 for: 5 >= 5 -// 100-Fix-Section.cpp:35: passed: v.size() == 5 for: 5 == 5 -// 100-Fix-Section.cpp:36: passed: v.capacity() >= 10 for: 10 >= 10 -// 100-Fix-Section.cpp:17: passed: v.size() == 5 for: 5 == 5 -// 100-Fix-Section.cpp:18: passed: v.capacity() >= 5 for: 5 >= 5 -// 100-Fix-Section.cpp:41: passed: v.size() == 5 for: 5 == 5 -// 100-Fix-Section.cpp:42: passed: v.capacity() >= 5 for: 5 >= 5 -// Passed 1 test case with 16 assertions. diff --git a/recipes/catch2/2.x.x/test_package/100-standalone.cpp b/recipes/catch2/2.x.x/test_package/100-standalone.cpp new file mode 100644 index 0000000000000..d330a979c68b7 --- /dev/null +++ b/recipes/catch2/2.x.x/test_package/100-standalone.cpp @@ -0,0 +1,5 @@ +#include + +TEST_CASE( "compiles and runs" ) { + REQUIRE( true == !false ); +} diff --git a/recipes/catch2/2.x.x/test_package/300-benchmark.cpp b/recipes/catch2/2.x.x/test_package/200-benchmark.cpp similarity index 100% rename from recipes/catch2/2.x.x/test_package/300-benchmark.cpp rename to recipes/catch2/2.x.x/test_package/200-benchmark.cpp diff --git a/recipes/catch2/2.x.x/test_package/200-standalone.cpp b/recipes/catch2/2.x.x/test_package/200-standalone.cpp deleted file mode 100644 index 21f0d14cd7ed8..0000000000000 --- a/recipes/catch2/2.x.x/test_package/200-standalone.cpp +++ /dev/null @@ -1,9 +0,0 @@ -// 200-standalone.cpp - -// main() provided by target Catch2::Catch2WithMain - -#include - -TEST_CASE( "compiles and runs" ) { - REQUIRE( true == !false ); -} diff --git a/recipes/catch2/2.x.x/test_package/400-with-prefix.cpp b/recipes/catch2/2.x.x/test_package/300-standalone-with-prefix.cpp similarity index 100% rename from recipes/catch2/2.x.x/test_package/400-with-prefix.cpp rename to recipes/catch2/2.x.x/test_package/300-standalone-with-prefix.cpp diff --git a/recipes/catch2/2.x.x/test_package/400-benchmark-with-prefix.cpp b/recipes/catch2/2.x.x/test_package/400-benchmark-with-prefix.cpp new file mode 100644 index 0000000000000..147c743b7e14d --- /dev/null +++ b/recipes/catch2/2.x.x/test_package/400-benchmark-with-prefix.cpp @@ -0,0 +1,11 @@ +#include + +unsigned int Factorial( unsigned int number ) { + return number > 1 ? Factorial(number-1)*number : 1; +} + +TEST_CASE( "compiles and runs" ) { + BENCHMARK("factorial 25"){ + return Factorial(25); + }; +} diff --git a/recipes/catch2/2.x.x/test_package/CMakeLists.txt b/recipes/catch2/2.x.x/test_package/CMakeLists.txt index d238929c6accd..7cf72543951f1 100644 --- a/recipes/catch2/2.x.x/test_package/CMakeLists.txt +++ b/recipes/catch2/2.x.x/test_package/CMakeLists.txt @@ -1,32 +1,31 @@ -cmake_minimum_required(VERSION 3.5) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) +enable_testing() -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(Catch2 REQUIRED CONFIG) -find_package(Catch2 REQUIRED) - -if(NOT WITH_PREFIX) - add_executable(test_package 000-CatchMain.cpp 100-Fix-Section.cpp) - target_link_libraries(test_package PRIVATE Catch2::Catch2) - - if(WITH_MAIN) - add_executable(standalone 200-standalone.cpp) - target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) - if(WITH_BENCHMARK) - add_executable(benchmark 300-benchmark.cpp) - target_link_libraries(benchmark PRIVATE Catch2::Catch2WithMain) - endif() - endif() +if(WITH_PREFIX) + set(SRC_STANDALONE 300-standalone-with-prefix.cpp) + set(SRC_BENCHMARK 400-benchmark-with-prefix.cpp) else() - add_executable(test_package 000-CatchMain.cpp 400-with-prefix.cpp) - target_link_libraries(test_package PRIVATE Catch2::Catch2) + set(SRC_STANDALONE 100-standalone.cpp) + set(SRC_BENCHMARK 200-benchmark.cpp) +endif() - if(WITH_MAIN) - add_executable(standalone 400-with-prefix.cpp) - target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) - endif() +add_executable(standalone 000-CatchMain.cpp ${SRC_STANDALONE}) +target_link_libraries(standalone PRIVATE Catch2::Catch2) +target_compile_features(standalone PRIVATE cxx_std_11) +add_test(NAME standalone COMMAND standalone) +if(WITH_MAIN) + add_executable(standalone_with_main ${SRC_STANDALONE}) + target_link_libraries(standalone_with_main PRIVATE Catch2::Catch2WithMain) + target_compile_features(standalone_with_main PRIVATE cxx_std_11) + add_test(NAME standalone_with_main COMMAND standalone_with_main) +endif() +if(WITH_BENCHMARK) + add_executable(benchmark ${SRC_BENCHMARK}) + target_link_libraries(benchmark PRIVATE Catch2::Catch2WithMain) + target_compile_features(benchmark PRIVATE cxx_std_11) + add_test(NAME benchmark COMMAND benchmark) endif() diff --git a/recipes/catch2/2.x.x/test_package/conanfile.py b/recipes/catch2/2.x.x/test_package/conanfile.py index 7197c6f5458cc..cab6586354346 100644 --- a/recipes/catch2/2.x.x/test_package/conanfile.py +++ b/recipes/catch2/2.x.x/test_package/conanfile.py @@ -1,24 +1,33 @@ -from conans import ConanFile, CMake, tools -from conans.tools import Version -import os +from conan import ConanFile +from conan.tools.build import build_jobs, can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import chdir class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_MAIN"] = self.dependencies["catch2"].options.with_main + tc.variables["WITH_BENCHMARK"] = self.dependencies["catch2"].options.get_safe("with_benchmark", False) + tc.variables["WITH_PREFIX"] = self.dependencies["catch2"].options.with_prefix + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["WITH_MAIN"] = self.options["catch2"].with_main - cmake.definitions["WITH_BENCHMARK"] = self.options["catch2"].with_main and self.options["catch2"].with_benchmark - cmake.definitions["WITH_PREFIX"] = self.options["catch2"].with_prefix cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package"), run_environment=True) - if self.options["catch2"].with_main: - self.run(os.path.join("bin", "standalone"), run_environment=True) - if self.options["catch2"].with_benchmark: - self.run(os.path.join("bin", "benchmark"), run_environment=True) + if can_run(self): + with chdir(self, self.build_folder): + self.run(f"ctest --output-on-failure -C {self.settings.build_type} -j {build_jobs(self)}", env="conanrun") diff --git a/recipes/catch2/2.x.x/test_package/test_all.sh b/recipes/catch2/2.x.x/test_package/test_all.sh deleted file mode 100755 index 6d50ad26b2429..0000000000000 --- a/recipes/catch2/2.x.x/test_package/test_all.sh +++ /dev/null @@ -1,10 +0,0 @@ -#!/usr/bin/env bash -# Run with the package reference as an argument -set -ex -DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" -conan test $DIR $1 --build=catch2 -conan test $DIR $1 --build=catch2 -o catch2:with_main=True -o catch2:with_benchmark=True -conan test $DIR $1 --build=catch2 -o catch2:with_prefix=True -conan test $DIR $1 --build=catch2 -o catch2:with_main=True -o catch2:with_prefix=True -conan test $DIR $1 --build=catch2 -o catch2:default_reporter=xml -conan test $DIR $1 --build=catch2 -o catch2:with_main=True -o catch2:default_reporter=xml diff --git a/recipes/catch2/2.x.x/test_v1_package/CMakeLists.txt b/recipes/catch2/2.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..c23ed5cfe6d98 --- /dev/null +++ b/recipes/catch2/2.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_v1_package) + +enable_testing() + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/catch2/2.x.x/test_v1_package/conanfile.py b/recipes/catch2/2.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2ee47800e04e6 --- /dev/null +++ b/recipes/catch2/2.x.x/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["WITH_MAIN"] = self.options["catch2"].with_main + cmake.definitions["WITH_BENCHMARK"] = self.options["catch2"].with_main and self.options["catch2"].with_benchmark + cmake.definitions["WITH_PREFIX"] = self.options["catch2"].with_prefix + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(f"ctest --output-on-failure -C {self.settings.build_type} -j {tools.cpu_count()}", run_environment=True) diff --git a/recipes/catch2/3.x.x/CMakeLists.txt b/recipes/catch2/3.x.x/CMakeLists.txt deleted file mode 100644 index 8a6f93c2da7ef..0000000000000 --- a/recipes/catch2/3.x.x/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(cmake_wrapper) - -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/catch2/3.x.x/conandata.yml b/recipes/catch2/3.x.x/conandata.yml index c9fa14ce205a3..763deea60af04 100644 --- a/recipes/catch2/3.x.x/conandata.yml +++ b/recipes/catch2/3.x.x/conandata.yml @@ -1,4 +1,16 @@ sources: + "3.3.1": + url: "https://github.com/catchorg/Catch2/archive/v3.3.1.tar.gz" + sha256: "d90351cdc55421f640c553cfc0875a8c834428679444e8062e9187d05b18aace" + "3.3.0": + url: "https://github.com/catchorg/Catch2/archive/v3.3.0.tar.gz" + sha256: "fe2f29a54ca775c2dd04bb97ffb79d398e6210e3caa174348b5cd3b7e4ca887d" + "3.2.1": + url: "https://github.com/catchorg/Catch2/archive/v3.2.1.tar.gz" + sha256: "4613d3e8142b672159fcae252a4860d72c8cf8e2df5043b1ae3541db9ef5d73c" + "3.2.0": + url: "https://github.com/catchorg/Catch2/archive/v3.2.0.tar.gz" + sha256: "feee04647e28ac3cbeff46cb42abc8ee2d8d5f646d36e3fb3ba274b8c69a58ea" "3.1.0": url: "https://github.com/catchorg/Catch2/archive/v3.1.0.tar.gz" sha256: "c252b2d9537e18046d8b82535069d2567f77043f8e644acf9a9fffc22ea6e6f7" @@ -7,8 +19,20 @@ sources: sha256: "8c4173c68ae7da1b5b505194a0c2d6f1b2aef4ec1e3e7463bde451f26bbaf4e7" patches: "3.1.0": - - patch_file: "patches/3.0.1-0001-force-not_usbproject-off.patch" - base_path: "source_subfolder" + - patch_file: "patches/3.1.0-0001-fix-dll-install.patch" + patch_description: "Install dll in bin folder" + patch_type: "portability" + patch_source: "https://github.com/catchorg/Catch2/pull/2485" + - patch_file: "patches/3.1.0-0002-dllimport-global-symbols-msvc.patch" + patch_description: "Fix import of global symbols for msvc shared" + patch_type: "portability" + patch_source: "https://github.com/catchorg/Catch2/pull/2527" "3.0.1": - - patch_file: "patches/3.0.1-0001-force-not_usbproject-off.patch" - base_path: "source_subfolder" + - patch_file: "patches/3.0.1-0001-allow-shared.patch" + patch_description: "Allow to build catch2 as a shared library" + patch_type: "portability" + patch_source: "https://github.com/catchorg/Catch2/commit/bea58bf8bbfca887f871c3aa2d720ba62c01f855" + - patch_file: "patches/3.0.1-0002-dllimport-global-symbols-msvc.patch" + patch_description: "Fix import of global symbols for msvc shared" + patch_type: "portability" + patch_source: "https://github.com/catchorg/Catch2/pull/2527" diff --git a/recipes/catch2/3.x.x/conanfile.py b/recipes/catch2/3.x.x/conanfile.py index 88d4e49f20587..9cc83f41b1e3a 100644 --- a/recipes/catch2/3.x.x/conanfile.py +++ b/recipes/catch2/3.x.x/conanfile.py @@ -1,9 +1,14 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save +from conan.tools.scm import Version import os -import functools -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +import textwrap + +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.43.0" class Catch2Conan(ConanFile): name = "catch2" @@ -12,123 +17,168 @@ class Catch2Conan(ConanFile): license = "BSL-1.0" homepage = "https://github.com/catchorg/Catch2" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { + "shared": [True, False], "fPIC": [True, False], "with_prefix": [True, False], - "default_reporter": "ANY", + "default_reporter": [None, "ANY"], + "console_width": [None, "ANY"], } default_options = { + "shared": False, "fPIC": True, "with_prefix": False, "default_reporter": None, + "console_width": "80", } - generators = "cmake" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" @property - def _build_subfolder(self): - return "build_subfolder" + def _min_console_width(self): + # Catch2 doesn't build if less than this value + return 46 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "Visual Studio": "15", + "msvc": "191", + "clang": "5", + "apple-clang": "10", + } @property def _default_reporter_str(self): - return '"{}"'.format(str(self.options.default_reporter).strip('"')) + return str(self.options.default_reporter).strip('"') def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - @property - def _compilers_minimum_version(self): - return { - "gcc": "7", - "Visual Studio": "15", - "clang": "5", - "apple-clang": "10", - } + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{}/{}: Unsupported compiler: {}-{} " - "(https://github.com/p-ranav/structopt#compiler-compatibility)." - .format(self.name, self.version, self.settings.compiler, self.settings.compiler.version)) - else: - self.output.warn("{}/{} requires C++14. Your compiler is unknown. Assuming it supports C++14.".format(self.name, self.version)) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler doesn't support", + ) - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + try: + if int(self.options.console_width) < self._min_console_width: + raise ConanInvalidConfiguration( + f"option 'console_width' must be >= {self._min_console_width}, " + f"got {self.options.console_width}. Contributions welcome if this should work!") + except ValueError as e: + raise ConanInvalidConfiguration(f"option 'console_width' must be an integer, " + f"got '{self.options.console_width}'") from e - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = "OFF" - cmake.definitions["CATCH_INSTALL_DOCS"] = "OFF" - cmake.definitions["CATCH_INSTALL_HELPERS"] = "ON" - cmake.definitions["CATCH_CONFIG_PREFIX_ALL"] = self.options.with_prefix + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.cache_variables["CATCH_INSTALL_DOCS"] = False + tc.cache_variables["CATCH_INSTALL_EXTRAS"] = True + tc.cache_variables["CATCH_DEVELOPMENT_BUILD"] = False + tc.variables["CATCH_CONFIG_PREFIX_ALL"] = self.options.with_prefix + tc.variables["CATCH_CONFIG_CONSOLE_WIDTH"] = self.options.console_width if self.options.default_reporter: - cmake.definitions["CATCH_CONFIG_DEFAULT_REPORTER"] = self._default_reporter_str - cmake.configure(build_folder=self._build_subfolder) - return cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + tc.variables["CATCH_CONFIG_DEFAULT_REPORTER"] = self._default_reporter_str + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) for cmake_file in ["ParseAndAddCatchTests.cmake", "Catch.cmake", "CatchAddTests.cmake"]: - self.copy( + copy( + self, cmake_file, - src=os.path.join(self._source_subfolder, "extras"), - dst=os.path.join("lib", "cmake", "Catch2"), + src=os.path.join(self.source_folder, "extras"), + dst=os.path.join(self.package_folder, "lib", "cmake", "Catch2"), ) + # TODO: to remove in conan v2 once legacy generators removed + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + { + "Catch2::Catch2": "catch2::_catch2", + "Catch2::Catch2WithMain": "catch2::catch2_with_main", + } + ) + + def _create_cmake_module_alias_targets(self, module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent(f"""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + def package_info(self): self.cpp_info.set_property("cmake_file_name", "Catch2") self.cpp_info.set_property("cmake_target_name", "Catch2::Catch2WithMain") self.cpp_info.set_property("pkg_config_name", "catch2-with-main") - self.cpp_info.names["cmake_find_package"] = "Catch2" - self.cpp_info.names["cmake_find_package_multi"] = "Catch2" lib_suffix = "d" if self.settings.build_type == "Debug" else "" self.cpp_info.components["_catch2"].set_property("cmake_target_name", "Catch2::Catch2") self.cpp_info.components["_catch2"].set_property("pkg_config_name", "catch2") - self.cpp_info.components["_catch2"].names["cmake_find_package"] = "Catch2" - self.cpp_info.components["_catch2"].names["cmake_find_package_multi"] = "Catch2" self.cpp_info.components["_catch2"].libs = ["Catch2" + lib_suffix] - self.cpp_info.components["catch2_with_main"].builddirs = [os.path.join("lib", "cmake", "Catch2")] + self.cpp_info.components["catch2_with_main"].builddirs.append(os.path.join("lib", "cmake", "Catch2")) self.cpp_info.components["catch2_with_main"].libs = ["Catch2Main" + lib_suffix] self.cpp_info.components["catch2_with_main"].requires = ["_catch2"] self.cpp_info.components["catch2_with_main"].system_libs = ["log"] if self.settings.os == "Android" else [] self.cpp_info.components["catch2_with_main"].set_property("cmake_target_name", "Catch2::Catch2WithMain") self.cpp_info.components["catch2_with_main"].set_property("pkg_config_name", "catch2-with-main") - self.cpp_info.components["catch2_with_main"].names["cmake_find_package"] = "Catch2WithMain" - self.cpp_info.components["catch2_with_main"].names["cmake_find_package_multi"] = "Catch2WithMain" - defines = self.cpp_info.components["catch2_with_main"].defines - + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["catch2_with_main"].system_libs.append("m") + defines = [] if self.options.with_prefix: defines.append("CATCH_CONFIG_PREFIX_ALL") if self.options.default_reporter: - defines.append("CATCH_CONFIG_DEFAULT_REPORTER={}".format(self._default_reporter_str)) + defines.append(f"CATCH_CONFIG_DEFAULT_REPORTER={self._default_reporter_str}") + self.cpp_info.components["catch2_with_main"].defines = defines + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "Catch2" + self.cpp_info.filenames["cmake_find_package_multi"] = "Catch2" + self.cpp_info.names["cmake_find_package"] = "catch2" + self.cpp_info.names["cmake_find_package_multi"] = "catch2" + self.cpp_info.components["_catch2"].build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.components["_catch2"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.cpp_info.components["catch2_with_main"].build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.components["catch2_with_main"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/catch2/3.x.x/patches/3.0.1-0001-allow-shared.patch b/recipes/catch2/3.x.x/patches/3.0.1-0001-allow-shared.patch new file mode 100644 index 0000000000000..38c31d266b121 --- /dev/null +++ b/recipes/catch2/3.x.x/patches/3.0.1-0001-allow-shared.patch @@ -0,0 +1,64 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -263,9 +263,7 @@ set(REPORTER_SOURCES + ) + set(REPORTER_FILES ${REPORTER_HEADERS} ${REPORTER_SOURCES}) + +-# Fixme: STATIC because for dynamic, we would need to handle visibility +-# and I don't want to do the annotations right now +-add_library(Catch2 STATIC ++add_library(Catch2 + ${REPORTER_FILES} + ${INTERNAL_FILES} + ${BENCHMARK_HEADERS} +@@ -318,7 +316,7 @@ target_include_directories(Catch2 + ) + + +-add_library(Catch2WithMain STATIC ++add_library(Catch2WithMain + ${SOURCES_DIR}/internal/catch_main.cpp + ) + add_build_reproducibility_settings(Catch2WithMain) +@@ -338,8 +336,12 @@ if (NOT_SUBPROJECT) + Catch2WithMain + EXPORT + Catch2Targets +- DESTINATION ++ LIBRARY DESTINATION ++ ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION + ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ++ ${CMAKE_INSTALL_BINDIR} + ) + + +@@ -409,3 +411,27 @@ endif() + + list(APPEND CATCH_WARNING_TARGETS Catch2 Catch2WithMain) + set(CATCH_WARNING_TARGETS ${CATCH_WARNING_TARGETS} PARENT_SCOPE) ++ ++ ++# We still do not support building dynamic library with hidden visibility ++# so we want to check & warn users if they do this. However, we won't abort ++# the configuration step so that we don't have to also provide an override. ++if (BUILD_SHARED_LIBS) ++ if (MSVC) ++ set_target_properties(Catch2 Catch2WithMain ++ PROPERTIES ++ WINDOWS_EXPORT_ALL_SYMBOLS ON ++ ) ++ endif() ++ ++ get_target_property(_VisPreset Catch2 CXX_VISIBILITY_PRESET) ++ if (NOT MSVC AND _VisPreset STREQUAL "hidden") ++ set_target_properties(Catch2 Catch2WithMain ++ PROPERTIES ++ CXX_VISIBILITY_PRESET "default" ++ VISIBILITY_INLINES_HIDDEN OFF ++ ) ++ message(WARNING "Setting Catch2's visibility to default." ++ " Hidden visibility is not supported.") ++ endif() ++endif() diff --git a/recipes/catch2/3.x.x/patches/3.0.1-0001-force-not_usbproject-off.patch b/recipes/catch2/3.x.x/patches/3.0.1-0001-force-not_usbproject-off.patch deleted file mode 100644 index 55da96838204f..0000000000000 --- a/recipes/catch2/3.x.x/patches/3.0.1-0001-force-not_usbproject-off.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 5087361..64b44f6 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -7,6 +7,7 @@ if(NOT DEFINED PROJECT_NAME) - else() - set(NOT_SUBPROJECT OFF) - endif() -+set(NOT_SUBPROJECT ON) - - option(CATCH_INSTALL_DOCS "Install documentation alongside library" ON) - option(CATCH_INSTALL_EXTRAS "Install extras (CMake scripts, debugger helpers) alongside library" ON) diff --git a/recipes/catch2/3.x.x/patches/3.0.1-0002-dllimport-global-symbols-msvc.patch b/recipes/catch2/3.x.x/patches/3.0.1-0002-dllimport-global-symbols-msvc.patch new file mode 100644 index 0000000000000..c797f9d544f0c --- /dev/null +++ b/recipes/catch2/3.x.x/patches/3.0.1-0002-dllimport-global-symbols-msvc.patch @@ -0,0 +1,77 @@ +--- a/CMake/CatchConfigOptions.cmake ++++ b/CMake/CatchConfigOptions.cmake +@@ -45,6 +45,7 @@ set(_OverridableOptions + foreach(OptionName ${_OverridableOptions}) + AddOverridableConfigOption(${OptionName}) + endforeach() ++set(CATCH_CONFIG_SHARED_LIBRARY ${BUILD_SHARED_LIBS}) + + set(_OtherConfigOptions + "DISABLE_EXCEPTIONS" +--- a/src/catch2/catch_tostring.hpp ++++ b/src/catch2/catch_tostring.hpp +@@ -296,13 +296,13 @@ namespace Catch { + template<> + struct StringMaker { + static std::string convert(float value); +- static int precision; ++ CATCH_EXPORT static int precision; + }; + + template<> + struct StringMaker { + static std::string convert(double value); +- static int precision; ++ CATCH_EXPORT static int precision; + }; + + template +--- a/src/catch2/catch_user_config.hpp.in ++++ b/src/catch2/catch_user_config.hpp.in +@@ -181,6 +181,8 @@ + #cmakedefine CATCH_CONFIG_PREFIX_ALL + #cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG + ++#cmakedefine CATCH_CONFIG_SHARED_LIBRARY ++ + + // ------ + // "Variable" defines, these have actual values +--- a/src/catch2/internal/catch_compiler_capabilities.hpp ++++ b/src/catch2/internal/catch_compiler_capabilities.hpp +@@ -364,5 +364,15 @@ + # define CATCH_CONFIG_COLOUR_WIN32 + #endif + ++#if defined( CATCH_CONFIG_SHARED_LIBRARY ) && defined( _MSC_VER ) && \ ++ !defined( CATCH_CONFIG_STATIC ) ++# ifdef Catch2_EXPORTS ++# define CATCH_EXPORT //__declspec( dllexport ) // not needed ++# else ++# define CATCH_EXPORT __declspec( dllimport ) ++# endif ++#else ++# define CATCH_EXPORT ++#endif + + #endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED +--- a/src/catch2/internal/catch_context.hpp ++++ b/src/catch2/internal/catch_context.hpp +@@ -8,6 +8,8 @@ + #ifndef CATCH_CONTEXT_HPP_INCLUDED + #define CATCH_CONTEXT_HPP_INCLUDED + ++#include ++ + namespace Catch { + + class IResultCapture; +@@ -28,7 +30,7 @@ namespace Catch { + virtual void setConfig( IConfig const* config ) = 0; + + private: +- static IMutableContext *currentContext; ++ CATCH_EXPORT static IMutableContext *currentContext; + friend IMutableContext& getCurrentMutableContext(); + friend void cleanUpContext(); + static void createContext(); diff --git a/recipes/catch2/3.x.x/patches/3.1.0-0001-fix-dll-install.patch b/recipes/catch2/3.x.x/patches/3.1.0-0001-fix-dll-install.patch new file mode 100644 index 0000000000000..c7027940432a6 --- /dev/null +++ b/recipes/catch2/3.x.x/patches/3.1.0-0001-fix-dll-install.patch @@ -0,0 +1,16 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -359,8 +359,12 @@ if (NOT_SUBPROJECT) + Catch2WithMain + EXPORT + Catch2Targets +- DESTINATION ++ LIBRARY DESTINATION ++ ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION + ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ++ ${CMAKE_INSTALL_BINDIR} + ) + + diff --git a/recipes/catch2/3.x.x/patches/3.1.0-0002-dllimport-global-symbols-msvc.patch b/recipes/catch2/3.x.x/patches/3.1.0-0002-dllimport-global-symbols-msvc.patch new file mode 100644 index 0000000000000..63e221c1fb44c --- /dev/null +++ b/recipes/catch2/3.x.x/patches/3.1.0-0002-dllimport-global-symbols-msvc.patch @@ -0,0 +1,77 @@ +--- a/CMake/CatchConfigOptions.cmake ++++ b/CMake/CatchConfigOptions.cmake +@@ -45,6 +45,7 @@ set(_OverridableOptions + foreach(OptionName ${_OverridableOptions}) + AddOverridableConfigOption(${OptionName}) + endforeach() ++set(CATCH_CONFIG_SHARED_LIBRARY ${BUILD_SHARED_LIBS}) + + set(_OtherConfigOptions + "DISABLE_EXCEPTIONS" +--- a/src/catch2/catch_tostring.hpp ++++ b/src/catch2/catch_tostring.hpp +@@ -296,13 +296,13 @@ namespace Catch { + template<> + struct StringMaker { + static std::string convert(float value); +- static int precision; ++ CATCH_EXPORT static int precision; + }; + + template<> + struct StringMaker { + static std::string convert(double value); +- static int precision; ++ CATCH_EXPORT static int precision; + }; + + template +--- a/src/catch2/catch_user_config.hpp.in ++++ b/src/catch2/catch_user_config.hpp.in +@@ -181,6 +181,8 @@ + #cmakedefine CATCH_CONFIG_PREFIX_ALL + #cmakedefine CATCH_CONFIG_WINDOWS_CRTDBG + ++#cmakedefine CATCH_CONFIG_SHARED_LIBRARY ++ + + // ------ + // "Variable" defines, these have actual values +--- a/src/catch2/internal/catch_compiler_capabilities.hpp ++++ b/src/catch2/internal/catch_compiler_capabilities.hpp +@@ -376,5 +376,15 @@ + # define CATCH_CONFIG_COLOUR_WIN32 + #endif + ++#if defined( CATCH_CONFIG_SHARED_LIBRARY ) && defined( _MSC_VER ) && \ ++ !defined( CATCH_CONFIG_STATIC ) ++# ifdef Catch2_EXPORTS ++# define CATCH_EXPORT //__declspec( dllexport ) // not needed ++# else ++# define CATCH_EXPORT __declspec( dllimport ) ++# endif ++#else ++# define CATCH_EXPORT ++#endif + + #endif // CATCH_COMPILER_CAPABILITIES_HPP_INCLUDED +--- a/src/catch2/internal/catch_context.hpp ++++ b/src/catch2/internal/catch_context.hpp +@@ -8,6 +8,8 @@ + #ifndef CATCH_CONTEXT_HPP_INCLUDED + #define CATCH_CONTEXT_HPP_INCLUDED + ++#include ++ + namespace Catch { + + class IResultCapture; +@@ -28,7 +30,7 @@ namespace Catch { + virtual void setConfig( IConfig const* config ) = 0; + + private: +- static IMutableContext *currentContext; ++ CATCH_EXPORT static IMutableContext *currentContext; + friend IMutableContext& getCurrentMutableContext(); + friend void cleanUpContext(); + static void createContext(); diff --git a/recipes/catch2/3.x.x/test_package/CMakeLists.txt b/recipes/catch2/3.x.x/test_package/CMakeLists.txt index 93500a54ca713..1e2b06644735c 100644 --- a/recipes/catch2/3.x.x/test_package/CMakeLists.txt +++ b/recipes/catch2/3.x.x/test_package/CMakeLists.txt @@ -1,22 +1,16 @@ -cmake_minimum_required(VERSION 3.12) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Catch2 REQUIRED CONFIG) -set(CMAKE_CXX_STANDARD 14) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -if(NOT WITH_PREFIX) - add_executable(standalone 100-standalone.cpp) - target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) - add_executable(benchmark 200-benchmark.cpp) - target_link_libraries(benchmark PRIVATE Catch2::Catch2WithMain) +if(WITH_PREFIX) + add_executable(standalone 300-standalone-with-prefix.cpp) + add_executable(benchmark 400-benchmark-with-prefix.cpp) else() - add_executable(standalone 300-standalone-with-prefix.cpp) - target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) - add_executable(benchmark 400-benchmark-with-prefix.cpp) - target_link_libraries(benchmark PRIVATE Catch2::Catch2WithMain) + add_executable(standalone 100-standalone.cpp) + add_executable(benchmark 200-benchmark.cpp) endif() +target_link_libraries(standalone PRIVATE Catch2::Catch2WithMain) +target_compile_features(standalone PRIVATE cxx_std_14) +target_link_libraries(benchmark PRIVATE Catch2::Catch2WithMain) +target_compile_features(benchmark PRIVATE cxx_std_14) diff --git a/recipes/catch2/3.x.x/test_package/conanfile.py b/recipes/catch2/3.x.x/test_package/conanfile.py index 752bdb4cf4490..259cc3545b24c 100644 --- a/recipes/catch2/3.x.x/test_package/conanfile.py +++ b/recipes/catch2/3.x.x/test_package/conanfile.py @@ -1,18 +1,31 @@ -from conans import ConanFile, CMake, tools -from conans.tools import Version +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_PREFIX"] = self.dependencies[self.tested_reference_str].options.with_prefix + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["WITH_PREFIX"] = self.options["catch2"].with_prefix cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "standalone"), run_environment=True) - self.run(os.path.join("bin", "benchmark"), run_environment=True) + if can_run(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "standalone"), env="conanrun") + self.run(os.path.join(self.cpp.build.bindirs[0], "benchmark"), env="conanrun") diff --git a/recipes/catch2/3.x.x/test_v1_package/CMakeLists.txt b/recipes/catch2/3.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/catch2/3.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/catch2/3.x.x/test_v1_package/conanfile.py b/recipes/catch2/3.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b62a348e1044b --- /dev/null +++ b/recipes/catch2/3.x.x/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["WITH_PREFIX"] = self.options["catch2"].with_prefix + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join("bin", "standalone"), run_environment=True) + self.run(os.path.join("bin", "benchmark"), run_environment=True) diff --git a/recipes/catch2/config.yml b/recipes/catch2/config.yml index fb9069c88c61b..b5b40d81b175a 100644 --- a/recipes/catch2/config.yml +++ b/recipes/catch2/config.yml @@ -1,15 +1,23 @@ versions: - "2.11.3": + "3.3.1": + folder: 3.x.x + "3.3.0": + folder: 3.x.x + "3.2.1": + folder: 3.x.x + "3.2.0": + folder: 3.x.x + "3.1.0": + folder: 3.x.x + "3.0.1": + folder: 3.x.x + "2.13.9": folder: 2.x.x - "2.12.4": + "2.13.8": folder: 2.x.x "2.13.7": folder: 2.x.x - "2.13.8": + "2.12.4": folder: 2.x.x - "2.13.9": + "2.11.3": folder: 2.x.x - "3.0.1": - folder: 3.x.x - "3.1.0": - folder: 3.x.x diff --git a/recipes/cccl/all/conandata.yml b/recipes/cccl/all/conandata.yml index 698ce1430d5b6..20725ee2a4b27 100644 --- a/recipes/cccl/all/conandata.yml +++ b/recipes/cccl/all/conandata.yml @@ -2,3 +2,6 @@ sources: "1.1": url: https://github.com/swig/cccl/archive/cccl-1.1.tar.gz sha256: 03ed67d04e8b1e165b8f8d42546ab62ff6c42b3623a2358a7c8255ced144ce28 + "1.3": + url: https://github.com/swig/cccl/archive/cccl-1.3.tar.gz + sha256: 1E34E315CE3AB890D39A75FFABAACCE2E55FE5ED21591F036A45AFDA43A3E989 diff --git a/recipes/cccl/all/conanfile.py b/recipes/cccl/all/conanfile.py index 1629b5f8afd2e..3d0509b8a7502 100644 --- a/recipes/cccl/all/conanfile.py +++ b/recipes/cccl/all/conanfile.py @@ -1,5 +1,8 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, replace_in_file, copy +from conan.tools.layout import basic_layout +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc import os @@ -10,6 +13,7 @@ class CcclConan(ConanFile): homepage = "https://github.com/swig/cccl/" url = "https://github.com/conan-io/conan-center-index" license = "GPL-3.0-or-later" + settings = "os", "arch", "compiler", "build_type" options = { "muffle": [True, False], "verbose": [True, False], @@ -18,34 +22,37 @@ class CcclConan(ConanFile): "muffle": True, "verbose": False, } - settings = "compiler", - _source_subfolder = "source_subfolder" + @property + def _cccl_dir(self): + return os.path.join(self.package_folder, "bin") - def configure(self): - if self.settings.compiler != "Visual Studio": - raise ConanInvalidConfiguration("This recipe support only Visual Studio") - del self.settings.compiler + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - del self.info.options.muffle - del self.info.options.verbose + self.info.clear() + + def validate(self): + if not is_msvc(self): + raise ConanInvalidConfiguration("This recipe only supports msvc/Visual Studio.") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + strip_root=True, destination=self.source_folder) - cccl_path = os.path.join(self.source_folder, self._source_subfolder, "cccl") - tools.replace_in_file(cccl_path, + def build(self): + cccl_path = os.path.join(self.source_folder, self.source_folder, "cccl") + replace_in_file(self, cccl_path, " --help)", " *.lib)\n" " linkopt+=(\"$lib\")" " ;;\n\n" " --help)") - tools.replace_in_file(cccl_path, + replace_in_file(self, cccl_path, "clopt+=(\"$lib\")", "linkopt+=(\"$lib\")") - tools.replace_in_file(cccl_path, + replace_in_file(self, cccl_path, " -L*)", " -LIBPATH:*)\n" " linkopt+=(\"$1\")\n" @@ -53,15 +60,12 @@ def source(self): " -L*)") def package(self): - self.copy("cccl", src=os.path.join(self.source_folder, self._source_subfolder), dst="bin") - self.copy("COPYING", src=os.path.join(self.source_folder, self._source_subfolder), dst="licenses") + copy(self, pattern="cccl", src=os.path.join(self.source_folder, self.source_folder), dst=self._cccl_dir) + copy(self, pattern="COPYING", src=os.path.join(self.source_folder, self.source_folder), dst=os.path.join(self.package_folder, "licenses")) def package_info(self): - self.cpp_info.bindirs = ["bin", ] - - bindir = os.path.join(self.package_folder, "bin") - self.output.info('Appending PATH environment variable: {}'.format(bindir)) - self.env_info.PATH.append(bindir) + self.cpp_info.libdirs = [] + self.cpp_info.includedirs = [] cccl_args = [ "sh", @@ -73,9 +77,16 @@ def package_info(self): cccl_args.append("--cccl-verbose") cccl = " ".join(cccl_args) - self.output.info("Setting CC to '{}'".format(cccl)) + self.buildenv_info.define("CC", cccl) + self.buildenv_info.define("CXX", cccl) + self.buildenv_info.define("LD", cccl) + + # TODO: Legacy, to be removed on Conan 2.0 + self.env_info.PATH.append(self._cccl_dir) + + self.output.info(f"Setting CC to '{cccl}'") self.env_info.CC = cccl - self.output.info("Setting CXX to '{}'".format(cccl)) + self.output.info(f"Setting CXX to '{cccl}'") self.env_info.CXX = cccl - self.output.info("Setting LD to '{}'".format(cccl)) + self.output.info(f"Setting LD to '{cccl}'") self.env_info.LD = cccl diff --git a/recipes/cccl/all/test_package/conanfile.py b/recipes/cccl/all/test_package/conanfile.py index be8f7bacce1f6..b0e11ede43362 100644 --- a/recipes/cccl/all/test_package/conanfile.py +++ b/recipes/cccl/all/test_package/conanfile.py @@ -1,28 +1,33 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run import os class CcclTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "VCVars", "VirtualBuildEnv" + test_type = "explicit" + win_bash = True @property def _settings_build(self): + # TODO: Remove for Conan v2 return getattr(self, "settings_build", self.settings) def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires(self.tested_reference_str) + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + self.tool_requires("msys2/cci.latest") def build(self): - environment = {} - if self.settings.compiler == "Visual Studio": - environment.update(tools.vcvars_dict(self.settings)) - with tools.environment_append(environment): - cxx = tools.get_env("CXX") - self.run("{cxx} {src} -o example".format( - cxx=cxx, src=os.path.join(self.source_folder, "example.cpp")), win_bash=self.settings.os is "Windows") + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + return # cccl needs a bash if there isn't a bash we can't build + cxx = "cccl " + src = os.path.join(self.source_folder, "example.cpp").replace("\\", "/") + self.run(f"{cxx} {src} -o example", cwd=self.build_folder) def test(self): - if not tools.cross_building(self): - self.run(os.path.join(self.build_folder, "example")) + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + return # cccl needs a bash if there isn't a bash we can't build + if can_run(self): + self.run("./example") #test self.run still runs in bash, so it needs "./"; seems weird but okay... diff --git a/recipes/cccl/all/test_v1_package/conanfile.py b/recipes/cccl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38669b537fb21 --- /dev/null +++ b/recipes/cccl/all/test_v1_package/conanfile.py @@ -0,0 +1,35 @@ +from conans import ConanFile, tools +from conan.tools.microsoft import is_msvc +import os + + +class CcclTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def build_requirements(self): + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + def build(self): + environment = {} + if is_msvc(self): + environment.update(tools.vcvars_dict(self.settings)) + #for k in environment.keys(): + #self.output.highlight(k) + #self.output.highlight(environment[k]) + with tools.environment_append(environment): + cxxTest = tools.get_env("CXX") + #cxxB = self.buildenv_info.vars["CXX"] + self.output.highlight(f"tools.get_env(\"CXX\") = {cxxTest}") + #self.output.highlight(f"self.buildenv_info.vars[\"CXX\"] = {cxxB}") + cxx = "sh cccl " + self.run("{cxx} {src} -o example".format( + cxx=cxx, src=os.path.join(self.source_folder, "example.cpp")), win_bash=self.settings.os is "Windows", run_environment=True) + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join(self.build_folder, "example")) diff --git a/recipes/cccl/all/test_v1_package/example.cpp b/recipes/cccl/all/test_v1_package/example.cpp new file mode 100644 index 0000000000000..ef5068e37c8cc --- /dev/null +++ b/recipes/cccl/all/test_v1_package/example.cpp @@ -0,0 +1,6 @@ +#include + +int main() { + std::cout << "Hello world\n"; + return 0; +} diff --git a/recipes/cccl/config.yml b/recipes/cccl/config.yml index 3f8a45fae5832..8bade519ff028 100644 --- a/recipes/cccl/config.yml +++ b/recipes/cccl/config.yml @@ -1,3 +1,5 @@ versions: "1.1": folder: all + "1.3": + folder: all diff --git a/recipes/ccfits/all/CMakeLists.txt b/recipes/ccfits/all/CMakeLists.txt deleted file mode 100644 index 10b7b1809aebf..0000000000000 --- a/recipes/ccfits/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(MSVC AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/ccfits/all/conandata.yml b/recipes/ccfits/all/conandata.yml index e0fedb47c4fbe..010d52b6753b2 100644 --- a/recipes/ccfits/all/conandata.yml +++ b/recipes/ccfits/all/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "2.6": - patch_file: "patches/0001-adapt-cmakelists-for-conan-2.6.patch" - base_path: "source_subfolder" "2.5": - patch_file: "patches/0001-adapt-cmakelists-for-conan-2.5.patch" - base_path: "source_subfolder" diff --git a/recipes/ccfits/all/conanfile.py b/recipes/ccfits/all/conanfile.py index 6a796847c1324..c9d53caa2f748 100644 --- a/recipes/ccfits/all/conanfile.py +++ b/recipes/ccfits/all/conanfile.py @@ -1,6 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.scm import Version +import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.52.0" class CcfitsConan(ConanFile): @@ -21,17 +26,8 @@ class CcfitsConan(ConanFile): "fPIC": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,41 +35,47 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("cfitsio/4.0.0") + self.requires("cfitsio/4.1.0") - def validate(self): - if tools.Version(self.version) >= "2.6": + def validate_build(self): + if Version(self.version) >= "2.6": if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + # Export symbols for msvc shared + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("License.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.set_property("pkg_config_name", "CCfits") self.cpp_info.libs = ["CCfits"] - - # TODO: to remove in conan v2 once pkg_config generator removed - self.cpp_info.names["pkg_config"] = "CCfits" diff --git a/recipes/ccfits/all/patches/0001-adapt-cmakelists-for-conan-2.5.patch b/recipes/ccfits/all/patches/0001-adapt-cmakelists-for-conan-2.5.patch index 1a2902b4075b0..76929726440b1 100644 --- a/recipes/ccfits/all/patches/0001-adapt-cmakelists-for-conan-2.5.patch +++ b/recipes/ccfits/all/patches/0001-adapt-cmakelists-for-conan-2.5.patch @@ -1,11 +1,19 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -22,8 +22,6 @@ ENDIF() +@@ -1,5 +1,5 @@ ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1) + PROJECT(CCfits) +-CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0) + + # Allow the developer to select if Dynamic or Static libraries are built + OPTION (BUILD_SHARED_LIBS "Build Shared Libraries" OFF) +@@ -22,8 +22,7 @@ ENDIF() #add_subdirectory (src) -find_package(CFITSIO REQUIRED) -INCLUDE_DIRECTORIES(${CFITSIO_INCLUDE_DIR}) ++find_package(cfitsio REQUIRED CONFIG) SET (LIB_TYPE STATIC) IF (BUILD_SHARED_LIBS) @@ -14,7 +22,7 @@ ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES}) -TARGET_LINK_LIBRARIES(${LIB_NAME} ${CFITSIO_LIBRARY} -+TARGET_LINK_LIBRARIES(${LIB_NAME} ${CONAN_LIBS} ++TARGET_LINK_LIBRARIES(${LIB_NAME} cfitsio::cfitsio ) SET_TARGET_PROPERTIES(${LIB_NAME} PROPERTIES diff --git a/recipes/ccfits/all/patches/0001-adapt-cmakelists-for-conan-2.6.patch b/recipes/ccfits/all/patches/0001-adapt-cmakelists-for-conan-2.6.patch index 3e9594078cac8..7d13bff3f3252 100644 --- a/recipes/ccfits/all/patches/0001-adapt-cmakelists-for-conan-2.6.patch +++ b/recipes/ccfits/all/patches/0001-adapt-cmakelists-for-conan-2.6.patch @@ -1,9 +1,9 @@ --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,8 +1,6 @@ ++CMAKE_MINIMUM_REQUIRED(VERSION 3.8) PROJECT(CCfits) -CMAKE_MINIMUM_REQUIRED(VERSION 3.1) -+CMAKE_MINIMUM_REQUIRED(VERSION 3.8) -set (CMAKE_CXX_STANDARD_REQUIRED on) -set (CMAKE_CXX_STANDARD 11) @@ -16,7 +16,7 @@ -find_package(CFITSIO REQUIRED) -INCLUDE_DIRECTORIES(${CFITSIO_INCLUDE_DIR}) -+ ++find_package(cfitsio REQUIRED CONFIG) SET (LIB_TYPE STATIC) IF (BUILD_SHARED_LIBS) @@ -25,7 +25,7 @@ ADD_LIBRARY(${LIB_NAME} ${LIB_TYPE} ${H_FILES} ${SRC_FILES}) -TARGET_LINK_LIBRARIES(${LIB_NAME} ${CFITSIO_LIBRARY} -+TARGET_LINK_LIBRARIES(${LIB_NAME} ${CONAN_LIBS} ++TARGET_LINK_LIBRARIES(${LIB_NAME} cfitsio::cfitsio ) +TARGET_COMPILE_FEATURES(${LIB_NAME} PRIVATE cxx_std_11) diff --git a/recipes/ccfits/all/test_package/CMakeLists.txt b/recipes/ccfits/all/test_package/CMakeLists.txt index 196188113685c..2112b47f62dd2 100644 --- a/recipes/ccfits/all/test_package/CMakeLists.txt +++ b/recipes/ccfits/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(ccfits REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE ccfits::ccfits) diff --git a/recipes/ccfits/all/test_package/conanfile.py b/recipes/ccfits/all/test_package/conanfile.py index 5c09494bc67c0..0a6bc68712d90 100644 --- a/recipes/ccfits/all/test_package/conanfile.py +++ b/recipes/ccfits/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ccfits/all/test_v1_package/CMakeLists.txt b/recipes/ccfits/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..20c81e8e8eb12 --- /dev/null +++ b/recipes/ccfits/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(ccfits REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ccfits::ccfits) diff --git a/recipes/ccfits/all/test_v1_package/conanfile.py b/recipes/ccfits/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/ccfits/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cctag/all/CMakeLists.txt b/recipes/cctag/all/CMakeLists.txt deleted file mode 100644 index 63ebbfa0b0e57..0000000000000 --- a/recipes/cctag/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.13) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/cctag/all/conandata.yml b/recipes/cctag/all/conandata.yml index 21b5b45039b4d..13ba480ba9f39 100644 --- a/recipes/cctag/all/conandata.yml +++ b/recipes/cctag/all/conandata.yml @@ -5,4 +5,5 @@ sources: patches: "1.0.1": - patch_file: "patches/0001-honor-vc-runtime.patch" - base_path: "source_subfolder" + patch_description: "Honor vc runtime" + patch_type: "conan" diff --git a/recipes/cctag/all/conanfile.py b/recipes/cctag/all/conanfile.py index f770ba481240f..773c86527b19a 100644 --- a/recipes/cctag/all/conanfile.py +++ b/recipes/cctag/all/conanfile.py @@ -1,9 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc_static_runtime import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class CCTagConan(ConanFile): @@ -33,16 +36,8 @@ class CCTagConan(ConanFile): "with_cuda": False, } - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -50,10 +45,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.78.0") + self.requires("boost/1.80.0") self.requires("eigen/3.4.0") self.requires("onetbb/2020.3") self.requires("opencv/4.5.5") @@ -67,74 +65,77 @@ def _required_boost_components(self): def validate(self): miss_boost_required_comp = \ - any(getattr(self.options["boost"], - "without_{}".format(boost_comp), + any(getattr(self.dependencies["boost"].options, + f"without_{boost_comp}", True) for boost_comp in self._required_boost_components) - if self.options["boost"].header_only or miss_boost_required_comp: + if self.dependencies["boost"].options.header_only or miss_boost_required_comp: raise ConanInvalidConfiguration( - "{0} requires non header-only boost with these components: {1}".format( - self.name, ", ".join(self._required_boost_components), - ) + f"{self.ref} requires non header-only boost with these components: " + f"{', '.join(self._required_boost_components)}", ) + if self.settings.compiler == "Visual Studio" and not self.options.shared and \ + is_msvc_static_runtime(self) and self.dependencies["onetbb"].options.shared: + raise ConanInvalidConfiguration("this specific configuration is prevented due to internal c3i limitations") + if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) # FIXME: add cuda support if self.options.with_cuda: raise ConanInvalidConfiguration("CUDA not supported yet") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CCTAG_SERIALIZE"] = self.options.serialize + tc.variables["CCTAG_VISUAL_DEBUG"] = self.options.visual_debug + tc.variables["CCTAG_NO_COUT"] = self.options.no_cout + tc.variables["CCTAG_WITH_CUDA"] = self.options.with_cuda + tc.variables["CCTAG_BUILD_APPS"] = False + tc.variables["CCTAG_CUDA_CC_CURRENT_ONLY"] = False + tc.variables["CCTAG_NVCC_WARNINGS"] = False + tc.variables["CCTAG_EIGEN_NO_ALIGN"] = True + tc.variables["CCTAG_USE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + tc.variables["CCTAG_ENABLE_SIMD_AVX2"] = False + tc.variables["CCTAG_BUILD_TESTS"] = False + tc.variables["CCTAG_BUILD_DOC"] = False + tc.variables["CCTAG_NO_THRUST_COPY_IF"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # Cleanup RPATH if Apple in shared lib of install tree - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") # Link to OpenCV targets - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "${OpenCV_LIBS}", "opencv_core opencv_videoio opencv_imgproc opencv_imgcodecs") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["CCTAG_SERIALIZE"] = self.options.serialize - cmake.definitions["CCTAG_VISUAL_DEBUG"] = self.options.visual_debug - cmake.definitions["CCTAG_NO_COUT"] = self.options.no_cout - cmake.definitions["CCTAG_WITH_CUDA"] = self.options.with_cuda - cmake.definitions["CCTAG_BUILD_APPS"] = False - cmake.definitions["CCTAG_CUDA_CC_CURRENT_ONLY"] = False - cmake.definitions["CCTAG_NVCC_WARNINGS"] = False - cmake.definitions["CCTAG_EIGEN_NO_ALIGN"] = True - cmake.definitions["CCTAG_USE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - cmake.definitions["CCTAG_ENABLE_SIMD_AVX2"] = False - cmake.definitions["CCTAG_BUILD_TESTS"] = False - cmake.definitions["CCTAG_BUILD_DOC"] = False - cmake.definitions["CCTAG_NO_THRUST_COPY_IF"] = False - cmake.configure() - return cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING.md", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "CCTag") self.cpp_info.set_property("cmake_target_name", "CCTag::CCTag") suffix = "d" if self.settings.build_type == "Debug" else "" - self.cpp_info.libs = ["CCTag{}".format(suffix)] + self.cpp_info.libs = [f"CCTag{suffix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["dl", "pthread"]) self.cpp_info.requires = [ diff --git a/recipes/cctag/all/test_package/CMakeLists.txt b/recipes/cctag/all/test_package/CMakeLists.txt index 9ba93733e0fd1..726cfa83f1842 100644 --- a/recipes/cctag/all/test_package/CMakeLists.txt +++ b/recipes/cctag/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(CCTag REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} CCTag::CCTag) +target_link_libraries(${PROJECT_NAME} PRIVATE CCTag::CCTag) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/cctag/all/test_package/conanfile.py b/recipes/cctag/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/cctag/all/test_package/conanfile.py +++ b/recipes/cctag/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cctag/all/test_v1_package/CMakeLists.txt b/recipes/cctag/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cctag/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cctag/all/test_v1_package/conanfile.py b/recipes/cctag/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cctag/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cd3-boost-unit-definitions/all/conandata.yml b/recipes/cd3-boost-unit-definitions/all/conandata.yml new file mode 100644 index 0000000000000..c911db51da07b --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/conandata.yml @@ -0,0 +1,6 @@ +sources: + # Newer versions at the top + "0.2.2": + url: + - "https://github.com/CD3/BoostUnitDefinitions/archive/refs/tags/0.2.2.tar.gz" + sha256: "84b374ce94bd4792994205a40e3a92b4d70694203f596c18f00de2520ba55db3" diff --git a/recipes/cd3-boost-unit-definitions/all/conanfile.py b/recipes/cd3-boost-unit-definitions/all/conanfile.py new file mode 100644 index 0000000000000..23bdb146d0b4e --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/conanfile.py @@ -0,0 +1,96 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "cd3-boost-unit-definitions" + description = "A collection of pre-defined types and unit instances for working with Boost.Units quantities." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/CD3/BoostUnitDefinitions" + topics = ("physical dimensions", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15", + "msvc": "19.0", + "gcc": "5", + "clang": "5", + "apple-clang": "5.1", + } + + def export_sources(self): + pass + + def layout(self): + basic_layout(self) + + def requirements(self): + self.requires("boost/1.80.0", transitive_headers=True) + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False + ) + if ( + minimum_version + and Version(self.settings.compiler.version) < minimum_version + ): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + pass + + def package(self): + copy( + self, + pattern="LICENSE.md", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "BoostUnitDefinitions") + self.cpp_info.set_property( + "cmake_target_name", "BoostUnitDefinitions::BoostUnitDefinitions" + ) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "BoostUnitDefinitions" + self.cpp_info.filenames["cmake_find_package_multi"] = "BoostUnitDefinitions" + self.cpp_info.names["cmake_find_package"] = "BoostUnitDefinitions" + self.cpp_info.names["cmake_find_package_multi"] = "BoostUnitDefinitions" diff --git a/recipes/cd3-boost-unit-definitions/all/test_package/CMakeLists.txt b/recipes/cd3-boost-unit-definitions/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d4bbd419ef9db --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(BoostUnitDefinitions REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE BoostUnitDefinitions::BoostUnitDefinitions) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/cd3-boost-unit-definitions/all/test_package/conanfile.py b/recipes/cd3-boost-unit-definitions/all/test_package/conanfile.py new file mode 100644 index 0000000000000..48499fa0989d9 --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cd3-boost-unit-definitions/all/test_package/test_package.cpp b/recipes/cd3-boost-unit-definitions/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a8708b60bd5f7 --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/test_package/test_package.cpp @@ -0,0 +1,15 @@ +#include +#include +#include + +using namespace boost; +using namespace boost::units; + + +int main(void) { + + quantity x = 2.5*i::m; + std::cout << x << " == " << quantity(x) << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/cd3-boost-unit-definitions/all/test_v1_package/CMakeLists.txt b/recipes/cd3-boost-unit-definitions/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b5b37b01b534c --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) + diff --git a/recipes/cd3-boost-unit-definitions/all/test_v1_package/conanfile.py b/recipes/cd3-boost-unit-definitions/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cd3-boost-unit-definitions/config.yml b/recipes/cd3-boost-unit-definitions/config.yml new file mode 100644 index 0000000000000..bb62e39821ff5 --- /dev/null +++ b/recipes/cd3-boost-unit-definitions/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "0.2.2": + folder: all diff --git a/recipes/cfgfile/all/CMakeLists.txt b/recipes/cfgfile/all/CMakeLists.txt deleted file mode 100644 index 64b7fce508eb0..0000000000000 --- a/recipes/cfgfile/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(cmake_wrapper) - -set(CMAKE_CXX_STANDARD 14) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/cfgfile/all/conandata.yml b/recipes/cfgfile/all/conandata.yml index 2e90d0b7dcbd7..16ce1e88dfbb6 100644 --- a/recipes/cfgfile/all/conandata.yml +++ b/recipes/cfgfile/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.2.11": + url: "https://github.com/igormironchik/cfgfile/archive/refs/tags/0.2.11.tar.gz" + sha256: "fdf76baf157f86acc048fdcaa7e3ed534817026710866265706978a76a8e8238" "0.2.10": url: "https://github.com/igormironchik/cfgfile/archive/refs/tags/0.2.10.tar.gz" sha256: "bfab4deb8c9d71872a62a4f2a06056b56c93faf70b36ebb3bab5f207c8fe2c3f" diff --git a/recipes/cfgfile/all/conanfile.py b/recipes/cfgfile/all/conanfile.py index 1e8c15c48583c..6ce91734444e4 100644 --- a/recipes/cfgfile/all/conanfile.py +++ b/recipes/cfgfile/all/conanfile.py @@ -1,7 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -import textwrap + +required_conan_version = ">=1.50.0" class CfgfileConan(ConanFile): @@ -10,82 +15,78 @@ class CfgfileConan(ConanFile): homepage = "https://github.com/igormironchik/cfgfile.git" license = "MIT" description = "Header-only library for reading/saving configuration files with schema defined in sources." - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" topics = ("cfgfile", "configuration", "file") settings = "os", "arch", "compiler", "build_type" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return "14" @property def _compilers_minimum_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "5", "clang": "3.5", - "apple-clang": "10" + "apple-clang": "10", } - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_TESTS"] = False - if tools.Version(self.version) >= "0.2.9": - self._cmake.definitions["USE_INTERNAL_ARGS_PARSER"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def package_id(self): + del self.info.settings.compiler def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") - - compiler = str(self.settings.compiler) - if compiler not in self._compilers_minimum_version: - self.output.warn("Unknown compiler, assuming it supports at least C++14") - return - - version = tools.Version(self.settings.compiler.version) - if version < self._compilers_minimum_version[compiler]: - raise ConanInvalidConfiguration("cfgfile requires a compiler that supports at least C++14") + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def requirements(self): - if tools.Version(self.version) >= "0.2.10": + if Version(self.version) >= "0.2.10": self.requires("args-parser/6.2.0.1") elif self.version == "0.2.9.1": self.requires("args-parser/6.2.0.1") elif self.version == "0.2.9.0": self.requires("args-parser/6.0.1.0") + def build_requirements(self): + self.tool_requires("cmake/3.25.0") + def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=self.source_folder) cmake.build() + def layout(self): + cmake_layout(self) + def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_EXAMPLES"] = False + tc.cache_variables["BUILD_TESTS"] = False + if Version(self.version) >= "0.2.9": + tc.variables["USE_INTERNAL_ARGS_PARSER"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy("*.hpp", src=os.path.join(self._source_subfolder, "cfgfile"), dst=os.path.join("include", "cfgfile")) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "cfgfile") + self.cpp_info.set_property("cmake_target_name", "cfgfile::cfgfile") + self.cpp_info.includedirs.append(os.path.join("include", "cfgfile")) bin_path = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH env var with : {}".format(bin_path)) self.env_info.PATH.append(bin_path) - self.cpp_info.names["cmake_find_package"] = "cfgfile" - self.cpp_info.names["cmake_find_package_multi"] = "cfgfile" - self.cpp_info.includedirs.append(os.path.join("include", "cfgfile")) - - def package_id(self): - del self.info.settings.compiler diff --git a/recipes/cfgfile/all/test_package/CMakeLists.txt b/recipes/cfgfile/all/test_package/CMakeLists.txt index fa54312562336..678ffe7224c31 100644 --- a/recipes/cfgfile/all/test_package/CMakeLists.txt +++ b/recipes/cfgfile/all/test_package/CMakeLists.txt @@ -1,12 +1,7 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -project(cfgfile.test) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - -conan_basic_setup(TARGETS) - -find_package(cfgfile REQUIRED) +find_package(cfgfile REQUIRED CONFIG) add_custom_command( OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/cfg.hpp" @@ -14,16 +9,7 @@ add_custom_command( DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/session_cfg.conf" ) -include_directories(${CMAKE_CURRENT_BINARY_DIR}) - -add_executable(${PROJECT_NAME} - example.cpp - "${CMAKE_CURRENT_BINARY_DIR}/cfg.hpp" -) - -target_link_libraries(${PROJECT_NAME} cfgfile::cfgfile) - -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED ON -) +add_executable(${PROJECT_NAME} test_package.cpp "${CMAKE_CURRENT_BINARY_DIR}/cfg.hpp") +target_link_libraries(${PROJECT_NAME} PRIVATE cfgfile::cfgfile) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) diff --git a/recipes/cfgfile/all/test_package/conanfile.py b/recipes/cfgfile/all/test_package/conanfile.py index 95fef1a204a6c..cc0263e38af82 100644 --- a/recipes/cfgfile/all/test_package/conanfile.py +++ b/recipes/cfgfile/all/test_package/conanfile.py @@ -1,21 +1,28 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import CMake, cmake_layout import os -class CfgfileTestConan(ConanFile): - generators = "cmake", "cmake_find_package" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): - if not tools.cross_building(self, skip_x64_x86=True): + if not cross_building(self, skip_x64_x86=True): cmake = CMake(self) cmake.configure() cmake.build() - def build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires(str(self.requires["cfgfile"])) - def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "cfgfile.test") - cfg_path = os.path.join(self.source_folder, "test.cfg"); - self.run("{} \"{}\"".format(bin_path, cfg_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + cfg_path = os.path.join(self.source_folder, "test.cfg") + self.run("{} \"{}\"".format(bin_path, cfg_path), env="conanrun") + diff --git a/recipes/cfgfile/all/test_package/example.cpp b/recipes/cfgfile/all/test_package/test_package.cpp similarity index 100% rename from recipes/cfgfile/all/test_package/example.cpp rename to recipes/cfgfile/all/test_package/test_package.cpp diff --git a/recipes/cfgfile/all/test_v1_package/CMakeLists.txt b/recipes/cfgfile/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8af52c8273805 --- /dev/null +++ b/recipes/cfgfile/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cfgfile/all/test_v1_package/conanfile.py b/recipes/cfgfile/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..54b7d470785a9 --- /dev/null +++ b/recipes/cfgfile/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + if not tools.cross_building(self, skip_x64_x86=True): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def build_requirements(self): + if hasattr(self, "settings_build"): + self.build_requires(str(self.requires["cfgfile"])) + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + cfg_path = os.path.join(self.source_folder, os.pardir, "test_package", "test.cfg") + self.run("{} \"{}\"".format(bin_path, cfg_path), run_environment=True) diff --git a/recipes/cfgfile/config.yml b/recipes/cfgfile/config.yml index 26f651ad576a2..5f9aabdfbd6d9 100644 --- a/recipes/cfgfile/config.yml +++ b/recipes/cfgfile/config.yml @@ -1,4 +1,6 @@ versions: + "0.2.11": + folder: all "0.2.10": folder: all "0.2.9.1": diff --git a/recipes/cgal/all/conandata.yml b/recipes/cgal/all/conandata.yml index 3e1bbd3d7b2e6..a9e86a3361343 100644 --- a/recipes/cgal/all/conandata.yml +++ b/recipes/cgal/all/conandata.yml @@ -14,3 +14,6 @@ sources: "5.5": sha256: 98ac395ca08aacf38b7a8170a822b650aedf10355df41dd0e4bfb238408e08a6 url: https://github.com/CGAL/cgal/releases/download/v5.5/CGAL-5.5.tar.xz + "5.5.1": + sha256: 091630def028facdcaf00eb5b68ad79eddac1b855cca6e87eef18a031566edfc + url: https://github.com/CGAL/cgal/releases/download/v5.5.1/CGAL-5.5.1.tar.xz diff --git a/recipes/cgal/all/conanfile.py b/recipes/cgal/all/conanfile.py index f62ead24fa3d7..47cc7c6fa95ce 100644 --- a/recipes/cgal/all/conanfile.py +++ b/recipes/cgal/all/conanfile.py @@ -11,8 +11,8 @@ class CgalConan(ConanFile): license = "GPL-3.0-or-later", "LGPL-3.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/CGAL/cgal" - description = "C++ library that aims to provide easy access to efficient and reliable algorithms"\ - "in computational geometry." + description = "C++ library that provides easy access to efficient and reliable algorithms"\ + " in computational geometry." topics = ("cgal", "geometry", "algorithms") settings = "os", "compiler", "build_type", "arch" generators = "cmake" diff --git a/recipes/cgal/config.yml b/recipes/cgal/config.yml index 857541c90fe5c..72209e170658c 100644 --- a/recipes/cgal/config.yml +++ b/recipes/cgal/config.yml @@ -9,3 +9,5 @@ versions: folder: all "5.5": folder: all + "5.5.1": + folder: all diff --git a/recipes/cgltf/all/conandata.yml b/recipes/cgltf/all/conandata.yml index 690b56f17fa08..e54cb4331e847 100644 --- a/recipes/cgltf/all/conandata.yml +++ b/recipes/cgltf/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.13": + url: "https://github.com/jkuhlmann/cgltf/archive/v1.13.tar.gz" + sha256: "053d5320097334767486c6e33d01dd1b1c6224eac82aac2d720f4ec456d8c50b" "1.12": url: "https://github.com/jkuhlmann/cgltf/archive/v1.12.tar.gz" sha256: "2c429bb26256b49bfed2510aef1e5fa9321b27fe4cf226c9ece9a5867150974f" diff --git a/recipes/cgltf/config.yml b/recipes/cgltf/config.yml index 134adfa22de6f..9f334f27c89c6 100644 --- a/recipes/cgltf/config.yml +++ b/recipes/cgltf/config.yml @@ -1,4 +1,6 @@ versions: + "1.13": + folder: all "1.12": folder: all "1.11": diff --git a/recipes/cgns/all/CMakeLists.txt b/recipes/cgns/all/CMakeLists.txt deleted file mode 100644 index a1b3f866c27c3..0000000000000 --- a/recipes/cgns/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory("source_subfolder") diff --git a/recipes/cgns/all/conandata.yml b/recipes/cgns/all/conandata.yml index f087eac889b03..bbbd27b41a558 100644 --- a/recipes/cgns/all/conandata.yml +++ b/recipes/cgns/all/conandata.yml @@ -1,10 +1,8 @@ sources: - "3.4.1": - url: "https://github.com/CGNS/CGNS/archive/v3.4.1.tar.gz" - sha256: "d32595e7737b9332243bd3de1eb8c018a272f620f09b289dea8292eba1365994" + "4.3.0": + url: "https://github.com/CGNS/CGNS/archive/v4.3.0.tar.gz" + sha256: "7709eb7d99731dea0dd1eff183f109eaef8d9556624e3fbc34dc5177afc0a032" patches: - "3.4.1": - - patch_file: "patches/fix_find_hdf5.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix_static_or_shared.patch" - base_path: "source_subfolder" + "4.3.0": + - patch_file: "patches/4.3.0-fix_find_hdf5.patch" + - patch_file: "patches/4.3.0-fix_static_or_shared.patch" diff --git a/recipes/cgns/all/conanfile.py b/recipes/cgns/all/conanfile.py index 72ba39fc8a3bd..137666452ceb7 100644 --- a/recipes/cgns/all/conanfile.py +++ b/recipes/cgns/all/conanfile.py @@ -1,41 +1,36 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir import os -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.29.1" - +required_conan_version = ">=1.52.0" class CgnsConan(ConanFile): name = "cgns" description = "Standard for data associated with the numerical solution " \ "of fluid dynamics equations." - topics = ("conan", "cgns", "data", "cfd", "fluids") + topics = "data", "cfd", "fluids" homepage = "http://cgns.org/" license = "Zlib" url = "https://github.com/conan-io/conan-center-index" settings = "os", "compiler", "build_type", "arch" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" options = { "shared": [True, False], "fPIC": [True, False], - "with_hdf5": [True, False] + "with_hdf5": [True, False], + "parallel": [True, False], } default_options = { "shared": False, "fPIC": True, - "with_hdf5": True + "with_hdf5": True, + "parallel": False, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,50 +38,91 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_hdf5: - self.requires("hdf5/1.12.0") - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("CGNS-" + self.version, self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake + self.requires("hdf5/1.13.1") - self._cmake = CMake(self) - self._cmake.definitions["CGNS_ENABLE_TESTS"] = False - self._cmake.definitions["CGNS_BUILD_TESTING"] = False - self._cmake.definitions["CGNS_ENABLE_FORTRAN"] = False - self._cmake.definitions["CGNS_ENABLE_HDF5"] = self.options.with_hdf5 - self._cmake.definitions["CGNS_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["CGNS_USE_SHARED"] = self.options.shared - self._cmake.definitions["CGNS_BUILD_CGNSTOOLS"] = False - self._cmake.configure() + def validate(self): + if self.info.options.parallel and not (self.info.options.with_hdf5 and self.dependencies["hdf5"].options.parallel): + raise ConanInvalidConfiguration("The option 'parallel' requires HDF5 with parallel=True") + if self.info.options.parallel and self.info.options.with_hdf5 and self.dependencies["hdf5"].options.enable_cxx: + raise ConanInvalidConfiguration("The option 'parallel' requires HDF5 with enable_cxx=False") - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + cmake = CMakeDeps(self) + cmake.generate() + + tc = CMakeToolchain(self) + tc.variables["CGNS_ENABLE_TESTS"] = False + tc.variables["CGNS_BUILD_TESTING"] = False + tc.variables["CGNS_ENABLE_FORTRAN"] = False + tc.variables["CGNS_ENABLE_HDF5"] = self.options.with_hdf5 + tc.variables["CGNS_BUILD_SHARED"] = self.options.shared + tc.variables["CGNS_USE_SHARED"] = self.options.shared + tc.variables["CGNS_ENABLE_PARALLEL"] = self.options.parallel + tc.variables["CGNS_BUILD_CGNSTOOLS"] = False + tc.generate() + + # Other flags, seen in appveyor.yml in source code, not currently managed. + # CGNS_ENABLE_LFS:BOOL=OFF --- note in code: needed on 32 bit systems + # CGNS_ENABLE_SCOPING:BOOL=OFF --- disabled in VTK's bundle + # HDF5_NEED_ZLIB:BOOL=ON -- should be dealt with by cmake auto dependency management or something? def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build(target="cgns_shared" if self.options.shared else "cgns_static") def package(self): - self.copy("license.txt", dst="licenses", src=self._source_subfolder) + copy(self, "license.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - os.remove(os.path.join(self.package_folder, "include", "cgnsBuild.defs")) + rm(self, "cgnsBuild.defs", os.path.join(self.package_folder, "include")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.libs = ["cgnsdll" if self.settings.os == "Windows" and self.options.shared else "cgns"] - if self.settings.os == "Windows" and self.options.shared: - self.cpp_info.defines = ["CGNSDLL=__declspec(dllimport)"] # we could instead define USE_DLL but it's too generic + self.cpp_info.set_property("cmake_file_name", "CGNS") + self.cpp_info.set_property("cmake_target_name", "CGNS::CGNS") + + if self.options.shared: + self.cpp_info.components["cgns_shared"].set_property("cmake_target_name", "CGNS::cgns_shared") + self.cpp_info.components["cgns_shared"].libs = ["cgnsdll" if self.settings.os == "Windows" else "cgns"] + self.cpp_info.components["cgns_shared"].libdirs = ["lib"] + if self.options.with_hdf5: + self.cpp_info.components["cgns_shared"].requires = ["hdf5::hdf5"] + if self.settings.os == "Windows": + # we could instead define USE_DLL but it's too generic + self.cpp_info.components["cgns_shared"].defines = ["CGNSDLL=__declspec(dllimport)"] + else: + self.cpp_info.components["cgns_static"].set_property("cmake_target_name", "CGNS::cgns_static") + self.cpp_info.components["cgns_static"].libs = ["cgns"] + self.cpp_info.components["cgns_static"].libdirs = ["lib"] + if self.options.with_hdf5: + self.cpp_info.components["cgns_static"].requires = ["hdf5::hdf5"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "CGNS" + self.cpp_info.names["cmake_find_package_multi"] = "CGNS" diff --git a/recipes/cgns/all/patches/4.3.0-fix_find_hdf5.patch b/recipes/cgns/all/patches/4.3.0-fix_find_hdf5.patch new file mode 100644 index 0000000000000..2863a2571c6d2 --- /dev/null +++ b/recipes/cgns/all/patches/4.3.0-fix_find_hdf5.patch @@ -0,0 +1,23 @@ +diff -r -u a/src/CMakeLists.txt b/src/CMakeLists.txt +--- a/src/CMakeLists.txt 2022-05-31 16:13:29.855723400 +0800 ++++ b/src/CMakeLists.txt 2022-05-31 16:40:39.332447379 +0800 +@@ -576,7 +576,7 @@ + add_library(CGNS::cgns-static ALIAS cgns_static) + # Needed to work around a CMake > 3.8 bug on Windows with MSVS and Intel Fortran + set_property(TARGET cgns_static PROPERTY LINKER_LANGUAGE C) +-target_link_libraries(cgns_static PRIVATE $<$:hdf5::hdf5-${CG_HDF5_LINK_TYPE}>) ++target_link_libraries(cgns_static PRIVATE $<$:HDF5::HDF5>) + + # Build a shared version of the library + if(CGNS_BUILD_SHARED) +@@ -592,8 +592,8 @@ + target_compile_definitions(cgns_shared PRIVATE -DBUILD_DLL) + target_compile_definitions(cgns_shared INTERFACE -DUSE_DLL) + endif () +- if (CGNS_ENABLE_HDF5 AND HDF5_LIBRARY) +- target_link_libraries(cgns_shared PUBLIC hdf5::hdf5-${CG_HDF5_LINK_TYPE} $<$>:${CMAKE_DL_LIBS}>) ++ if (CGNS_ENABLE_HDF5) ++ target_link_libraries(cgns_shared PUBLIC HDF5::HDF5 $<$>:${CMAKE_DL_LIBS}>) + if(HDF5_NEED_ZLIB AND ZLIB_LIBRARY) + target_link_libraries(cgns_shared PUBLIC ${ZLIB_LIBRARY}) + endif() diff --git a/recipes/cgns/all/patches/4.3.0-fix_static_or_shared.patch b/recipes/cgns/all/patches/4.3.0-fix_static_or_shared.patch new file mode 100644 index 0000000000000..8d07a513f10d2 --- /dev/null +++ b/recipes/cgns/all/patches/4.3.0-fix_static_or_shared.patch @@ -0,0 +1,24 @@ +Enforces that either static or dynamic libs are built + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 103cb1f..aae21a7 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -674,7 +674,9 @@ if(CGNS_BUILD_SHARED) + endif() + + ++if(NOT CGNS_BUILD_SHARED) + set (install_targets cgns_static) ++endif() + if(CGNS_BUILD_SHARED) + set(install_targets ${install_targets} cgns_shared) + endif () +@@ -738,7 +740,6 @@ install(EXPORT cgns-targets + # Tools # + ######### + +-add_subdirectory(tools) + + ######### + # Tests # diff --git a/recipes/cgns/all/patches/fix_find_hdf5.patch b/recipes/cgns/all/patches/fix_find_hdf5.patch deleted file mode 100644 index 1ca9fbb2be23d..0000000000000 --- a/recipes/cgns/all/patches/fix_find_hdf5.patch +++ /dev/null @@ -1,19 +0,0 @@ -The CGNS build uses the FindHDF5 module that locates the HDF5 libs by invoking the HDF5 compiler. -In order to link to the correct libraries provided by conan, the whole logic is removed from the cmake script. - ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -192,8 +192,11 @@ endif (CGNS_ENABLE_FORTRAN AND HAS_FORTRAN) - ######## - - option(CGNS_ENABLE_HDF5 "Enable or disable HDF5 interface" "OFF") --if (CGNS_ENABLE_HDF5) -- -+include_directories(${CONAN_INCLUDE_DIRS}) -+set(HDF5_LIBRARY CONAN_PKG::hdf5) -+# All this logic is useless for conan -+# (but don't forget to handle HDF5_NEED_MPI cache variable when we could use openmpi in hdf5) -+if(0) - if (CGNS_BUILD_SHARED) - set (FIND_HDF_COMPONENTS C shared) - else (CGNS_BUILD_SHARED) diff --git a/recipes/cgns/all/patches/fix_static_or_shared.patch b/recipes/cgns/all/patches/fix_static_or_shared.patch deleted file mode 100644 index df7af85cd4aa1..0000000000000 --- a/recipes/cgns/all/patches/fix_static_or_shared.patch +++ /dev/null @@ -1,31 +0,0 @@ -Enforces that either static or dynamic libs are built - ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -542,7 +542,7 @@ option(CGNS_USE_SHARED "Link programs to the CGNS shared library" "ON") - if (CGNS_ENABLE_FORTRAN) - add_library(cgns_static STATIC ${cgns_FILES} $) - else (CGNS_ENABLE_FORTRAN) -- add_library(cgns_static STATIC ${cgns_FILES}) -+ add_library(cgns_static STATIC EXCLUDE_FROM_ALL ${cgns_FILES}) - endif (CGNS_ENABLE_FORTRAN) - # Needed to work around a CMake > 3.8 bug on Windows with MSVS and Intel Fortran - set_property(TARGET cgns_static PROPERTY LINKER_LANGUAGE C) -@@ -598,7 +598,9 @@ if(CGNS_BUILD_SHARED) - endif(CGNS_BUILD_SHARED) - - # Set the install path of the static library -+if(NOT CGNS_BUILD_SHARED) - install(TARGETS cgns_static ARCHIVE DESTINATION lib) -+endif() - # Set the install path of the shared library - if(CGNS_BUILD_SHARED) - # for windows, need to install both cgnsdll.dll and cgnsdll.lib -@@ -650,7 +652,6 @@ install(FILES ${headers} - # Tools # - ######### - --add_subdirectory(tools) - - ######### - # Tests # diff --git a/recipes/cgns/all/test_package/CMakeLists.txt b/recipes/cgns/all/test_package/CMakeLists.txt index 9d13f5fdc4323..bb8b97918cf4b 100644 --- a/recipes/cgns/all/test_package/CMakeLists.txt +++ b/recipes/cgns/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(CGNS CONFIG REQUIRED) add_executable(test_package test_package.cpp) -target_link_libraries(test_package ${CONAN_LIBS}) +target_link_libraries(test_package CGNS::CGNS) diff --git a/recipes/cgns/all/test_package/conanfile.py b/recipes/cgns/all/test_package/conanfile.py index b4c9865828e62..7fa7076884d60 100644 --- a/recipes/cgns/all/test_package/conanfile.py +++ b/recipes/cgns/all/test_package/conanfile.py @@ -1,11 +1,20 @@ import os +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run -from conans import ConanFile, CMake, tools - +required_conan_version = ">=1.52.0" class CgnsTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cgns/all/test_v1_package/CMakeLists.txt b/recipes/cgns/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a7c9449fc2eb1 --- /dev/null +++ b/recipes/cgns/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(test_package ../test_package/test_package.cpp) +target_link_libraries(test_package ${CONAN_LIBS}) diff --git a/recipes/cgns/all/test_v1_package/conanfile.py b/recipes/cgns/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b4c9865828e62 --- /dev/null +++ b/recipes/cgns/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +import os + +from conans import ConanFile, CMake, tools + + +class CgnsTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cgns/config.yml b/recipes/cgns/config.yml index d212293f8478b..fefa3b794940e 100644 --- a/recipes/cgns/config.yml +++ b/recipes/cgns/config.yml @@ -1,3 +1,3 @@ versions: - "3.4.1": + "4.3.0": folder: all diff --git a/recipes/charls/all/conandata.yml b/recipes/charls/all/conandata.yml index 0c25d16afadd4..44bdf87dad81c 100644 --- a/recipes/charls/all/conandata.yml +++ b/recipes/charls/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.4.1": + url: "https://github.com/team-charls/charls/archive/2.4.1.tar.gz" + sha256: "f313f556b5acb9215961d9718c21235aafcd43bce6b357bf66f772e5692bba75" + "2.4.0": + url: "https://github.com/team-charls/charls/archive/2.4.0.tar.gz" + sha256: "721f4fd6a8dc3ec6a334d1c3c15d1cb9faa149afddd0eff703466c20e775c294" "2.3.4": url: "https://github.com/team-charls/charls/archive/2.3.4.tar.gz" sha256: "28e895a6e22daee76c24cf4d36c62bb20fd60fad0c9cfefc2eb8fa9b6045ae84" diff --git a/recipes/charls/all/conanfile.py b/recipes/charls/all/conanfile.py index 97c3e37e316b8..b252de9d9dec0 100644 --- a/recipes/charls/all/conanfile.py +++ b/recipes/charls/all/conanfile.py @@ -7,7 +7,7 @@ import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class CharlsConan(ConanFile): @@ -39,7 +39,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): if self.info.settings.compiler.cppstd: @@ -108,6 +108,8 @@ def package_info(self): self.cpp_info.libs = collect_libs(self) if not self.options.shared: self.cpp_info.defines.append("CHARLS_STATIC") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/charls/all/test_package/CMakeLists.txt b/recipes/charls/all/test_package/CMakeLists.txt index 4f9a1f4112d6f..a05d57b66979e 100644 --- a/recipes/charls/all/test_package/CMakeLists.txt +++ b/recipes/charls/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES C CXX) find_package(charls CONFIG REQUIRED) diff --git a/recipes/charls/all/test_v1_package/CMakeLists.txt b/recipes/charls/all/test_v1_package/CMakeLists.txt index 47ece1bc01777..be00a8c7f57c7 100644 --- a/recipes/charls/all/test_v1_package/CMakeLists.txt +++ b/recipes/charls/all/test_v1_package/CMakeLists.txt @@ -4,12 +4,5 @@ project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(charls CONFIG REQUIRED) - -add_executable(test_package_c ../test_package/test_package.c) -target_link_libraries(test_package_c PRIVATE charls) -set_target_properties(test_package_c PROPERTIES LINKER_LANGUAGE CXX) - -add_executable(test_package_cpp ../test_package/test_package.cpp) -target_link_libraries(test_package_cpp PRIVATE charls) -target_compile_features(test_package_cpp PRIVATE cxx_std_14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/charls/config.yml b/recipes/charls/config.yml index a9e865d288a54..96f2c11fde345 100644 --- a/recipes/charls/config.yml +++ b/recipes/charls/config.yml @@ -1,4 +1,8 @@ versions: + "2.4.1": + folder: all + "2.4.0": + folder: all "2.3.4": folder: all "2.2.0": diff --git a/recipes/chipmunk2d/all/conandata.yml b/recipes/chipmunk2d/all/conandata.yml index 89d52afa0965b..0fcc6c23d2ed4 100644 --- a/recipes/chipmunk2d/all/conandata.yml +++ b/recipes/chipmunk2d/all/conandata.yml @@ -1,4 +1,4 @@ sources: "7.0.3": - url: "https://github.com/slembcke/Chipmunk2D/archive/refs/tags/Chipmunk-7.0.3.tar.gz" - sha256: "1e6f093812d6130e45bdf4cb80280cb3c93d1e1833d8cf989d554d7963b7899a" + url: "https://chipmunk-physics.net/release/Chipmunk-7.x/Chipmunk-7.0.3.tgz" + sha256: "048b0c9eff91c27bab8a54c65ad348cebd5a982ac56978e8f63667afbb63491a" diff --git a/recipes/chipmunk2d/all/conanfile.py b/recipes/chipmunk2d/all/conanfile.py index 4608d275e2aff..72a9a9cadd3ff 100644 --- a/recipes/chipmunk2d/all/conanfile.py +++ b/recipes/chipmunk2d/all/conanfile.py @@ -3,18 +3,19 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class Chipmunk2DConan(ConanFile): name = "chipmunk2d" license = "MIT" url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/slembcke/Chipmunk2D" + homepage = "https://chipmunk-physics.net" topics = ("physics", "engine", "game development") description = "Chipmunk2D is a simple, lightweight, fast and portable 2D "\ "rigid body physics library written in C." + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,22 +32,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/chipmunk2d/all/test_package/conanfile.py b/recipes/chipmunk2d/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/chipmunk2d/all/test_package/conanfile.py +++ b/recipes/chipmunk2d/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/chipmunk2d/all/test_v1_package/CMakeLists.txt b/recipes/chipmunk2d/all/test_v1_package/CMakeLists.txt index ca2c1e3f5df78..0d20897301b68 100644 --- a/recipes/chipmunk2d/all/test_v1_package/CMakeLists.txt +++ b/recipes/chipmunk2d/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(chipmunk2d REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE chipmunk2d::chipmunk2d) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cimg/all/conandata.yml b/recipes/cimg/all/conandata.yml index 939c703cb331f..eea92963062f7 100644 --- a/recipes/cimg/all/conandata.yml +++ b/recipes/cimg/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.0": + url: "https://cimg.eu/files/CImg_3.2.0.zip" + sha256: "7a923357c3127d8839696c7b0f4eb4c23982c090d3f49fb133f2c8556ca74a88" "3.0.2": url: "https://cimg.eu/files/CImg_3.0.2.zip" sha256: "ee55a37c33d503a64ff264b53952e502ba7c2887b59ded47c47c86ea52ac5c31" diff --git a/recipes/cimg/all/conanfile.py b/recipes/cimg/all/conanfile.py index 8c0549fa875e2..4c4d65c0ab3d8 100644 --- a/recipes/cimg/all/conanfile.py +++ b/recipes/cimg/all/conanfile.py @@ -1,16 +1,18 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.51.1" class CImgConan(ConanFile): name = "cimg" description = "The CImg Library is a small and open-source C++ toolkit for image processing" homepage = "http://cimg.eu" - topics = ("cimg", "physics", "simulation", "robotics", "kinematics", "engine") + topics = ("physics", "simulation", "robotics", "kinematics", "engine") license = "CeCILL V2" url = "https://github.com/conan-io/conan-center-index" @@ -28,13 +30,13 @@ class CImgConan(ConanFile): "enable_xshm": [True, False], } default_options = { - "enable_fftw": True, - "enable_jpeg": True, - "enable_openexr": True, - "enable_png": True, - "enable_tiff": True, - "enable_ffmpeg": True, - "enable_opencv": True, + "enable_fftw": False, + "enable_jpeg": False, + "enable_openexr": False, + "enable_png": False, + "enable_tiff": False, + "enable_ffmpeg": False, + "enable_opencv": False, "enable_magick": False, "enable_xrandr": False, "enable_xshm": False, @@ -42,10 +44,6 @@ class CImgConan(ConanFile): no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _cimg_defines(self): return [ @@ -61,48 +59,56 @@ def _cimg_defines(self): ("enable_xshm", "cimg_use_xshm"), ] + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): if self.options.enable_fftw: self.requires("fftw/3.3.9") if self.options.enable_jpeg: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") if self.options.enable_openexr: self.requires("openexr/2.5.7") if self.options.enable_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.enable_tiff: - self.requires("libtiff/4.3.0") + self.requires("libtiff/4.4.0") if self.options.enable_ffmpeg: - self.requires("ffmpeg/4.4") + self.requires("ffmpeg/5.0") if self.options.enable_opencv: - self.requires("opencv/4.5.3") + self.requires("opencv/4.5.5") if self.options.enable_magick: self.requires("imagemagick/7.0.11-14") + def package_id(self): + self.info.clear() + def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, "11") # TODO: Update requirements when available in CCI if self.options.enable_xrandr: raise ConanInvalidConfiguration("xrandr not available in CCI yet") if self.options.enable_xshm: raise ConanInvalidConfiguration("xshm not available in CCI yet") - def package_id(self): - self.info.header_only() - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("Licence*", src=self._source_subfolder, dst="licenses") - self.copy("CImg.h", src=self._source_subfolder, dst="include") - shutil.copytree(os.path.join(self.source_folder, self._source_subfolder, "plugins"), + copy(self, "Licence*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "CImg.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + copy(self, "*", os.path.join(self.source_folder, "plugins"), os.path.join(self.package_folder, "include", "plugins")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "CImg") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] for option, define in self._cimg_defines: if getattr(self.options, option): self.cpp_info.defines.append(define) @@ -111,4 +117,3 @@ def package_info(self): # do not use this name in CMakeDeps, it was a mistake, there is no offical CMake config file self.cpp_info.names["cmake_find_package"] = "CImg" self.cpp_info.names["cmake_find_package_multi"] = "CImg" - self.cpp_info.names["pkg_config"] = "CImg" diff --git a/recipes/cimg/all/test_package/CMakeLists.txt b/recipes/cimg/all/test_package/CMakeLists.txt index 54f60fa9925c0..449f2a9e10e69 100644 --- a/recipes/cimg/all/test_package/CMakeLists.txt +++ b/recipes/cimg/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 11) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(cimg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) - +target_link_libraries(${PROJECT_NAME} PRIVATE cimg::cimg) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cimg/all/test_package/conanfile.py b/recipes/cimg/all/test_package/conanfile.py index d919133e5c230..0a6bc68712d90 100644 --- a/recipes/cimg/all/test_package/conanfile.py +++ b/recipes/cimg/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cimg/all/test_v1_package/CMakeLists.txt b/recipes/cimg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9cb59c3d4ef6a --- /dev/null +++ b/recipes/cimg/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(CImg REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE CImg::CImg) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cimg/all/test_v1_package/conanfile.py b/recipes/cimg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cimg/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cimg/config.yml b/recipes/cimg/config.yml index 57d368a954f0b..570cd2f89fed4 100644 --- a/recipes/cimg/config.yml +++ b/recipes/cimg/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.0": + folder: all "3.0.2": folder: all "3.0.0": diff --git a/recipes/circularbuffer/all/conanfile.py b/recipes/circularbuffer/all/conanfile.py index fb5c0728875a4..c3948bef41ba8 100644 --- a/recipes/circularbuffer/all/conanfile.py +++ b/recipes/circularbuffer/all/conanfile.py @@ -1,6 +1,12 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.cmake import CMakeToolchain + +import os + +required_conan_version = ">=1.47.0" -required_conan_version = ">=1.43.0" class CircularBufferConan(ConanFile): name = "circularbuffer" @@ -11,25 +17,34 @@ class CircularBufferConan(ConanFile): homepage = "https://github.com/rlogiacco/CircularBuffer" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - - def package_id(self): - self.info.header_only() - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def layout(self): + basic_layout(self, src_folder="src") def package(self): - self.copy("LICENSE*", "licenses", self._source_subfolder) - self.copy("CircularBuffer.h", "include", self._source_subfolder) - self.copy("CircularBuffer.tpp", "include", self._source_subfolder) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, + "licenses"), src=self.source_folder) + copy(self, "CircularBuffer.h", + dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + copy(self, "CircularBuffer.tpp", + dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + + def package_id(self): + self.info.clear() + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() def package_info(self): self.cpp_info.set_property("cmake_file_name", "CircularBuffer") - self.cpp_info.set_property("cmake_target_name", "CircularBuffer::CircularBuffer") + self.cpp_info.set_property( + "cmake_target_name", "CircularBuffer::CircularBuffer") + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "CircularBuffer" self.cpp_info.filenames["cmake_find_package_multi"] = "CircularBuffer" self.cpp_info.names["cmake_find_package"] = "CircularBuffer" diff --git a/recipes/circularbuffer/all/test_package/CMakeLists.txt b/recipes/circularbuffer/all/test_package/CMakeLists.txt index 3503352121220..d331e75f3a1ad 100644 --- a/recipes/circularbuffer/all/test_package/CMakeLists.txt +++ b/recipes/circularbuffer/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ cmake_minimum_required(VERSION 3.1) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) find_package(CircularBuffer CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} CircularBuffer::CircularBuffer) +target_link_libraries(${PROJECT_NAME} PRIVATE CircularBuffer::CircularBuffer) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/circularbuffer/all/test_package/conanfile.py b/recipes/circularbuffer/all/test_package/conanfile.py index aaf25befb2087..28cb4e311392b 100644 --- a/recipes/circularbuffer/all/test_package/conanfile.py +++ b/recipes/circularbuffer/all/test_package/conanfile.py @@ -1,9 +1,20 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + import os -from conans import ConanFile, CMake, tools -class TestConan(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/circularbuffer/all/test_v1_package/CMakeLists.txt b/recipes/circularbuffer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..3ddfb18ba1fed --- /dev/null +++ b/recipes/circularbuffer/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ + +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(CircularBuffer CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} CircularBuffer::CircularBuffer) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/circularbuffer/all/test_v1_package/conanfile.py b/recipes/circularbuffer/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0a93a273ba575 --- /dev/null +++ b/recipes/circularbuffer/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/circularbuffer/all/test_v1_package/test_package.cpp b/recipes/circularbuffer/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..c9d59e4b258c6 --- /dev/null +++ b/recipes/circularbuffer/all/test_v1_package/test_package.cpp @@ -0,0 +1,10 @@ +#include + +int main() { + CircularBuffer buffer; + + buffer.push(5); + buffer.unshift(1); + + return 0; +} diff --git a/recipes/cista/all/conandata.yml b/recipes/cista/all/conandata.yml index dd598e2bd2c5c..1547b3bc2b229 100644 --- a/recipes/cista/all/conandata.yml +++ b/recipes/cista/all/conandata.yml @@ -1,4 +1,9 @@ sources: + "0.11": + - url: "https://github.com/felixguendling/cista/releases/download/v0.11/cista.h" + sha256: "e2e37fa1f7278e7f1a8dab7d84b6b00f5a0a4fb48f42fbe5761b7ddd0d07314c" + - url: "https://raw.githubusercontent.com/felixguendling/cista/v0.11/LICENSE" + sha256: "fcd47e35fd6dc22feec454c5c1e572ccb7587dedd91d824528ebbb00a7f37c56" "0.10": - url: "https://github.com/felixguendling/cista/releases/download/v0.10/cista.h" sha256: "c06162c73c0fb034170198d79940d2eeecc233140797ab7e3b66053d61a0169b" diff --git a/recipes/cista/all/conanfile.py b/recipes/cista/all/conanfile.py index 6021efe7f6600..a5a461c964a04 100644 --- a/recipes/cista/all/conanfile.py +++ b/recipes/cista/all/conanfile.py @@ -3,10 +3,10 @@ from conan.tools.build import check_min_cppstd from conan.tools.files import copy, download from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" - +required_conan_version = ">=1.52.0" class CistaConan(ConanFile): name = "cista" @@ -21,10 +21,15 @@ class CistaConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True + @property + def _min_cppstd(self): + return 17 + @property def _compilers_minimum_version(self): return { - "Visual Studio": "15.7", + "Visual Studio": "15.7" if Version(self.version) < "0.11" else "16", + "msvc": "191" if Version(self.version) < "0.11" else "192", "gcc": "8", "clang": "6", "apple-clang": "9.1" @@ -35,7 +40,7 @@ def package_id(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 17) + check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -46,7 +51,7 @@ def loose_lt_semver(v1, v2): minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), None) if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration( - f"{self.name} {self.version} requires C++17, which your compiler does not support.", + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", ) def layout(self): @@ -64,7 +69,6 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "cista") self.cpp_info.set_property("cmake_target_name", "cista::cista") + self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/cista/all/test_package/CMakeLists.txt b/recipes/cista/all/test_package/CMakeLists.txt index d342da86f8d00..17a27c55f0b49 100644 --- a/recipes/cista/all/test_package/CMakeLists.txt +++ b/recipes/cista/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) find_package(cista REQUIRED CONFIG) diff --git a/recipes/cista/all/test_v1_package/CMakeLists.txt b/recipes/cista/all/test_v1_package/CMakeLists.txt index d27dfd94cab14..be00a8c7f57c7 100644 --- a/recipes/cista/all/test_v1_package/CMakeLists.txt +++ b/recipes/cista/all/test_v1_package/CMakeLists.txt @@ -4,8 +4,5 @@ project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(cista REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE cista::cista) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cista/config.yml b/recipes/cista/config.yml index 5808152f9189f..ac2c19b16c278 100644 --- a/recipes/cista/config.yml +++ b/recipes/cista/config.yml @@ -1,4 +1,6 @@ versions: + "0.11": + folder: all "0.10": folder: all "0.9": diff --git a/recipes/cityhash/all/conanfile.py b/recipes/cityhash/all/conanfile.py index 35e373369c7eb..2459b5205cee1 100644 --- a/recipes/cityhash/all/conanfile.py +++ b/recipes/cityhash/all/conanfile.py @@ -1,10 +1,15 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -from contextlib import contextmanager -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class CityhashConan(ConanFile): @@ -25,14 +30,6 @@ class CityhashConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -47,69 +44,63 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self._is_msvc and self.options.shared: + if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration("cityhash does not support shared builds with Visual Studio") def build_requirements(self): - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextmanager - def _build_context(self): - if self._is_msvc: - with tools.vcvars(self): - env = { - "CC": "cl -nologo", - "CXX": "cl -nologo", - "LD": "link -nologo", - "AR": "{} lib".format(tools.unix_path(self._user_info_build["automake"].ar_lib)), - } - with tools.environment_append(env): - yield - else: - yield - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-shared={}".format(yes_no(self.options.shared)), - ] - if self._is_msvc: - autotools.cxx_flags.append("-EHsc") - if not (self.settings.compiler == "Visual Studio" and \ - tools.Version(self.settings.compiler.version) < "12"): - autotools.flags.append("-FS") - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + if is_msvc(self): + tc.extra_cxxflags.append("-EHsc") + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + env = tc.environment() + if is_msvc(self): + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} lib") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + tc.generate(env) def build(self): - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # relocatable shared lib on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["cityhash"] diff --git a/recipes/cityhash/all/test_package/CMakeLists.txt b/recipes/cityhash/all/test_package/CMakeLists.txt index 895a4298a7cae..9fbe304115d9e 100644 --- a/recipes/cityhash/all/test_package/CMakeLists.txt +++ b/recipes/cityhash/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(cityhash REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} cityhash::cityhash) +target_link_libraries(${PROJECT_NAME} PRIVATE cityhash::cityhash) diff --git a/recipes/cityhash/all/test_package/conanfile.py b/recipes/cityhash/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/cityhash/all/test_package/conanfile.py +++ b/recipes/cityhash/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cityhash/all/test_v1_package/CMakeLists.txt b/recipes/cityhash/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cityhash/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cityhash/all/test_v1_package/conanfile.py b/recipes/cityhash/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cityhash/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/civetweb/all/conanfile.py b/recipes/civetweb/all/conanfile.py index 8c71ea550c470..181978c12d7a6 100644 --- a/recipes/civetweb/all/conanfile.py +++ b/recipes/civetweb/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get, rmdir from conan.tools.scm import Version from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.52.0" class CivetwebConan(ConanFile): @@ -14,7 +14,7 @@ class CivetwebConan(ConanFile): homepage = "https://github.com/civetweb/civetweb" url = "https://github.com/conan-io/conan-center-index" description = "Embedded C/C++ web server" - topics = ("civetweb", "web-server", "embedded") + topics = ("web-server", "embedded") settings = "os", "arch", "compiler", "build_type" options = { @@ -59,8 +59,7 @@ def _has_zlib_option(self): return Version(self.version) >= "1.15" def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, patch["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -70,18 +69,27 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass if not self.options.with_cxx: - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass if not self.options.with_ssl: del self.options.ssl_dynamic_loading def requirements(self): if self.options.with_ssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if self.options.get_safe("ssl_dynamic_loading") and not self.options["openssl"].shared: @@ -91,13 +99,13 @@ def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") def generate(self): tc = CMakeToolchain(self) if self.options.with_ssl: - openssl_version = Version(self.dependencies["openssl"].ref.version[:-1]) + openssl_version = Version(str(self.dependencies["openssl"].ref.version)[:-1]) tc.variables["CIVETWEB_ENABLE_SSL"] = self.options.with_ssl tc.variables["CIVETWEB_ENABLE_SSL_DYNAMIC_LOADING"] = self.options.ssl_dynamic_loading tc.variables["CIVETWEB_SSL_OPENSSL_API_1_0"] = openssl_version.minor == "0" diff --git a/recipes/civetweb/all/test_v1_package/conanfile.py b/recipes/civetweb/all/test_v1_package/conanfile.py index 7ba1739476336..6f09f10193d23 100644 --- a/recipes/civetweb/all/test_v1_package/conanfile.py +++ b/recipes/civetweb/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file import os from conans import ConanFile, tools, CMake diff --git a/recipes/cjson/all/conanfile.py b/recipes/cjson/all/conanfile.py index 61e30866a795c..e715bfc8ad197 100644 --- a/recipes/cjson/all/conanfile.py +++ b/recipes/cjson/all/conanfile.py @@ -1,22 +1,23 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class CjsonConan(ConanFile): name = "cjson" description = "Ultralightweight JSON parser in ANSI C." license = "MIT" - topics = ("cjson", "json", "parser") + topics = ("json", "parser") homepage = "https://github.com/DaveGamble/cJSON" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,8 +33,7 @@ class CjsonConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -41,26 +41,19 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("shared cjson is not supported with MT runtime") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -78,8 +71,6 @@ def generate(self): tc.variables["ENABLE_CUSTOM_COMPILER_FLAGS"] = False # Relocatable shared libs on macOS tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): @@ -107,17 +98,17 @@ def package(self): def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) + """) save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "cJSON") diff --git a/recipes/cjson/all/test_package/conanfile.py b/recipes/cjson/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/cjson/all/test_package/conanfile.py +++ b/recipes/cjson/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/cjson/all/test_v1_package/CMakeLists.txt b/recipes/cjson/all/test_v1_package/CMakeLists.txt index e84e5df7adee7..0d20897301b68 100644 --- a/recipes/cjson/all/test_v1_package/CMakeLists.txt +++ b/recipes/cjson/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(cJSON REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE cjson) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cjson/all/test_v1_package/conanfile.py b/recipes/cjson/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/cjson/all/test_v1_package/conanfile.py +++ b/recipes/cjson/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/clara/all/conanfile.py b/recipes/clara/all/conanfile.py index beed2eaac8fda..8e0af90e17b97 100644 --- a/recipes/clara/all/conanfile.py +++ b/recipes/clara/all/conanfile.py @@ -1,29 +1,33 @@ import os -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout -required_conan_version = ">=1.28.0" +required_conan_version = ">=1.46.0" class ClaraConan(ConanFile): name = "clara" description = "A simple to use, composable, command line parser for C++ 11 and beyond" homepage = "https://github.com/catchorg/Clara" - topics = ("conan", "clara", "cli", "cpp11", "command-parser") + topics = ("clara", "cli", "cpp11", "command-parser") + settings = "os", "arch", "compiler", "build_type" url = "https://github.com/conan-io/conan-center-index" license = "BSL-1.0" no_copy_source = True deprecated = "lyra" - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("Clara-{}".format(self.version), self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - self.copy(pattern="LICENSE.txt", src=self._source_subfolder, dst="licenses") - self.copy(pattern="*", src=os.path.join(self._source_subfolder, "include"), dst="include", keep_path=True) + copy(self, "LICENSE.txt", src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="*", + src=os.path.join(self.source_folder, "include"), + dst=os.path.join(self.package_folder, "include"), keep_path=True) def package_id(self): - self.info.header_only() + self.info.clear() diff --git a/recipes/clara/all/test_package/CMakeLists.txt b/recipes/clara/all/test_package/CMakeLists.txt index 33ae887aa6aea..1f340c9983632 100644 --- a/recipes/clara/all/test_package/CMakeLists.txt +++ b/recipes/clara/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) # if the project uses c++ -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(clara REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE clara::clara) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/clara/all/test_package/conanfile.py b/recipes/clara/all/test_package/conanfile.py index 3f668ebf0acf9..9ff0633c99a01 100644 --- a/recipes/clara/all/test_package/conanfile.py +++ b/recipes/clara/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run("{} --width 640".format(bin_path), run_environment=True) - self.run("{} --help".format(bin_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run("{} --width 640".format(bin_path), env="conanrun") + self.run("{} --help".format(bin_path), env="conanrun") diff --git a/recipes/clara/all/test_v1_package/CMakeLists.txt b/recipes/clara/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/clara/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/clara/all/test_v1_package/conanfile.py b/recipes/clara/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2489ddc6e36c1 --- /dev/null +++ b/recipes/clara/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run("{} --width 640".format(bin_path), run_environment=True) + self.run("{} --help".format(bin_path), run_environment=True) diff --git a/recipes/cli11/all/conandata.yml b/recipes/cli11/all/conandata.yml index efda5e7b144a2..fb856253269aa 100644 --- a/recipes/cli11/all/conandata.yml +++ b/recipes/cli11/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2.3.2": + url: "https://github.com/CLIUtils/CLI11/archive/v2.3.2.tar.gz" + sha256: "aac0ab42108131ac5d3344a9db0fdf25c4db652296641955720a4fbe52334e22" + "2.3.1": + url: "https://github.com/CLIUtils/CLI11/archive/v2.3.1.tar.gz" + sha256: "378da73d2d1d9a7b82ad6ed2b5bda3e7bc7093c4034a1d680a2e009eb067e7b2" + "2.3.0": + url: "https://github.com/CLIUtils/CLI11/archive/v2.3.0.tar.gz" + sha256: "b6e116ca1555e2b7f2743fd41e3bd18149baae791acd98eb653e5b07e0f20561" "2.2.0": url: "https://github.com/CLIUtils/CLI11/archive/v2.2.0.tar.gz" sha256: "d60440dc4d43255f872d174e416705f56ba40589f6eb07727f76376fb8378fd6" diff --git a/recipes/cli11/all/conanfile.py b/recipes/cli11/all/conanfile.py index bf1a635513afa..6ccc240eeda4f 100644 --- a/recipes/cli11/all/conanfile.py +++ b/recipes/cli11/all/conanfile.py @@ -1,45 +1,64 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, rmdir +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.build import check_min_cppstd import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class CLI11Conan(ConanFile): name = "cli11" homepage = "https://github.com/CLIUtils/CLI11" description = "A command line parser for C++11 and beyond." - topics = ("cli-parser", "cpp11", "no-dependencies", "cli", "header-only") + topics = "cli-parser", "cpp11", "no-dependencies", "cli", "header-only" url = "https://github.com/conan-io/conan-center-index" license = "BSD-3-Clause" settings = "os", "compiler", "build_type", "arch" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "11" + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CLI11_BUILD_EXAMPLES"] = False + tc.variables["CLI11_BUILD_TESTS"] = False + tc.variables["CLI11_BUILD_DOCS"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) cmake = CMake(self) - cmake.definitions["CLI11_BUILD_EXAMPLES"] = False - cmake.definitions["CLI11_BUILD_TESTS"] = False - cmake.definitions["CLI11_BUILD_DOCS"] = False - cmake.configure(source_folder=self._source_subfolder) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # since 2.1.1 - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_id(self): - self.info.header_only() + self.info.clear() def package_info(self): - self.cpp_info.set_property("cmake_target_name", "CLI11::CLI11") self.cpp_info.set_property("cmake_file_name", "CLI11") + self.cpp_info.set_property("cmake_target_name", "CLI11::CLI11") self.cpp_info.set_property("pkg_config_name", "CLI11") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "CLI11" self.cpp_info.names["cmake_find_package_multi"] = "CLI11" self.cpp_info.names["pkg_config"] = "CLI11" diff --git a/recipes/cli11/all/test_package/CMakeLists.txt b/recipes/cli11/all/test_package/CMakeLists.txt index 8f4fafc076f52..0b06b681b8997 100644 --- a/recipes/cli11/all/test_package/CMakeLists.txt +++ b/recipes/cli11/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(CLI11 REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_link_libraries(${CMAKE_PROJECT_NAME} CLI11::CLI11) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE CLI11::CLI11) + +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cli11/all/test_package/conanfile.py b/recipes/cli11/all/test_package/conanfile.py index b30e638816fc5..a9fb96656f203 100644 --- a/recipes/cli11/all/test_package/conanfile.py +++ b/recipes/cli11/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake_find_package_multi", "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin","test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cli11/all/test_v1_package/CMakeLists.txt b/recipes/cli11/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..145dcc03e0f3d --- /dev/null +++ b/recipes/cli11/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cli11/all/test_v1_package/conanfile.py b/recipes/cli11/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b30e638816fc5 --- /dev/null +++ b/recipes/cli11/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake_find_package_multi", "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin","test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cli11/config.yml b/recipes/cli11/config.yml index 5e0bf50730232..37bc8ba7326b9 100644 --- a/recipes/cli11/config.yml +++ b/recipes/cli11/config.yml @@ -1,4 +1,10 @@ versions: + "2.3.2": + folder: all + "2.3.1": + folder: all + "2.3.0": + folder: all "2.2.0": folder: all "2.1.2": diff --git a/recipes/clipper/all/CMakeLists.txt b/recipes/clipper/all/CMakeLists.txt deleted file mode 100644 index 4e3bd0b794bc4..0000000000000 --- a/recipes/clipper/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder/cpp") diff --git a/recipes/clipper/all/conandata.yml b/recipes/clipper/all/conandata.yml index 254caba4d84f9..00528d6271889 100644 --- a/recipes/clipper/all/conandata.yml +++ b/recipes/clipper/all/conandata.yml @@ -2,19 +2,11 @@ sources: "6.4.2": url: "https://sourceforge.net/projects/polyclipping/files/clipper_ver6.4.2.zip" sha256: "a14320d82194807c4480ce59c98aa71cd4175a5156645c4e2b3edd330b930627" - "5.1.6": - url: "https://sourceforge.net/projects/polyclipping/files/Older%20versions/clipper_ver5.1.6.zip" - sha256: "3655a090f55c16815eaebb4c3f863ff6c028d4b9c22111f81d4eac86bdb2f867" "4.10.0": url: "https://sourceforge.net/projects/polyclipping/files/Older%20versions/clipper_ver4.10.0.zip" sha256: "4530e01006d02507a41f7eeaefa758c8067a94a7a0d6e0381fadfa40bc0cf248" patches: "6.4.2": - patch_file: "patches/0001-include-install-directory-6.x.patch" - base_path: "source_subfolder" - "5.1.6": - - patch_file: "patches/0001-include-install-directory-5.x.patch" - base_path: "source_subfolder" "4.10.0": - - patch_file: "patches/0001-include-install-directory-5.x.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-include-install-directory-4.x.patch" diff --git a/recipes/clipper/all/conanfile.py b/recipes/clipper/all/conanfile.py index 8229e6f90aaf8..7b0a2de7fb05b 100644 --- a/recipes/clipper/all/conanfile.py +++ b/recipes/clipper/all/conanfile.py @@ -1,17 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.54.0" class ClipperConan(ConanFile): name = "clipper" description = "Clipper is an open source freeware polygon clipping library" - topics = ("clipper", "clipping", "polygon") + license = "BSL-1.0" + topics = ("clipping", "polygon") url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.angusj.com/delphi/clipper.php" - license = "BSL-1.0" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,21 +23,8 @@ class ClipperConan(ConanFile): "fPIC": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,39 +32,43 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version]) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) + # Export symbols for msvc shared + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True # To install relocatable shared libs on Macos - self._cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "cpp")) cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("License.txt", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "polyclipping") self.cpp_info.libs = ["polyclipping"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed. # Do not use these CMake names in CMakeDeps, it was a mistake, # clipper doesn't provide CMake config file self.cpp_info.names["cmake_find_package"] = "polyclipping" self.cpp_info.names["cmake_find_package_multi"] = "polyclipping" - self.cpp_info.names["pkg_config"] = "polyclipping" diff --git a/recipes/clipper/all/patches/0001-include-install-directory-5.x.patch b/recipes/clipper/all/patches/0001-include-install-directory-4.x.patch similarity index 100% rename from recipes/clipper/all/patches/0001-include-install-directory-5.x.patch rename to recipes/clipper/all/patches/0001-include-install-directory-4.x.patch diff --git a/recipes/clipper/all/test_package/CMakeLists.txt b/recipes/clipper/all/test_package/CMakeLists.txt index 5493ddfd2244c..cb269d6010aa1 100644 --- a/recipes/clipper/all/test_package/CMakeLists.txt +++ b/recipes/clipper/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(clipper REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE clipper::clipper) target_compile_definitions(${PROJECT_NAME} PRIVATE CLIPPER_MAJOR_VERSION=${CLIPPER_MAJOR_VERSION}) diff --git a/recipes/clipper/all/test_package/conanfile.py b/recipes/clipper/all/test_package/conanfile.py index 39cb5d7ca9a3e..3238612bed7d0 100644 --- a/recipes/clipper/all/test_package/conanfile.py +++ b/recipes/clipper/all/test_package/conanfile.py @@ -1,18 +1,32 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.scm import Version import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CLIPPER_MAJOR_VERSION"] = Version(self.dependencies["clipper"].ref.version).major + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["CLIPPER_MAJOR_VERSION"] = tools.Version(self.deps_cpp_info["clipper"].version).major cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/clipper/all/test_v1_package/CMakeLists.txt b/recipes/clipper/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..5a89ce2e8d32a --- /dev/null +++ b/recipes/clipper/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(polyclipping REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE polyclipping::polyclipping) +target_compile_definitions(${PROJECT_NAME} PRIVATE CLIPPER_MAJOR_VERSION=${CLIPPER_MAJOR_VERSION}) diff --git a/recipes/clipper/all/test_v1_package/conanfile.py b/recipes/clipper/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d963e4448d15a --- /dev/null +++ b/recipes/clipper/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["CLIPPER_MAJOR_VERSION"] = tools.Version(self.deps_cpp_info["clipper"].version).major + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/clipper/config.yml b/recipes/clipper/config.yml index 439239872745b..b53e32183cb28 100644 --- a/recipes/clipper/config.yml +++ b/recipes/clipper/config.yml @@ -1,7 +1,5 @@ versions: "6.4.2": folder: all - "5.1.6": - folder: all "4.10.0": folder: all diff --git a/recipes/clove-unit/all/conandata.yml b/recipes/clove-unit/all/conandata.yml index 46805140996fc..2c3695d23b94a 100644 --- a/recipes/clove-unit/all/conandata.yml +++ b/recipes/clove-unit/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.0": + url: "https://github.com/fdefelici/clove-unit/archive/v2.3.0.tar.gz" + sha256: ca94d33643bbe1ff2205f7e6405f3e9c5a95d2f3a076a126814e64b46e3cce8e "2.2.4": url: "https://github.com/fdefelici/clove-unit/archive/v2.2.4.tar.gz" sha256: 0341f13b3e897952f1643eea2ca70cf014c4a086cf83375270980ac05f9d51aa diff --git a/recipes/clove-unit/all/test_package/test_package.cpp b/recipes/clove-unit/all/test_package/test_package.cpp index 86a73c9d5448a..4d57d1c55fccb 100644 --- a/recipes/clove-unit/all/test_package/test_package.cpp +++ b/recipes/clove-unit/all/test_package/test_package.cpp @@ -1,11 +1,9 @@ -#define CLOVE_IMPLEMENTATION #include -char * __clove_exec_path; -char * __clove_exec_base_path; int main() { - __clove_report_console_setup_ansi(); - return 0; + const char* version = __CLOVE_VERSION; + if (version) return 0; + return 1; } diff --git a/recipes/clove-unit/config.yml b/recipes/clove-unit/config.yml index 1b05da0f1b9ea..3c940ec906d09 100644 --- a/recipes/clove-unit/config.yml +++ b/recipes/clove-unit/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.0": + folder: "all" "2.2.4": folder: "all" "2.2.3": diff --git a/recipes/cmake/3.x.x/conandata.yml b/recipes/cmake/3.x.x/conandata.yml index ef081670dc1d0..54adb8af58aa6 100644 --- a/recipes/cmake/3.x.x/conandata.yml +++ b/recipes/cmake/3.x.x/conandata.yml @@ -1,22 +1,22 @@ sources: "3.19.8": - sha256: 09b4fa4837aae55c75fb170f6a6e2b44818deba48335d1969deddfbb34e30369 url: https://github.com/Kitware/CMake/releases/download/v3.19.8/cmake-3.19.8.tar.gz + sha256: 09b4fa4837aae55c75fb170f6a6e2b44818deba48335d1969deddfbb34e30369 "3.20.6": - sha256: a0bd485e1a38dd13c0baec89d5f4adbf61c7fd32fddb38eabc69a75bc0b65d72 url: https://github.com/Kitware/CMake/releases/download/v3.20.6/cmake-3.20.6.tar.gz + sha256: a0bd485e1a38dd13c0baec89d5f4adbf61c7fd32fddb38eabc69a75bc0b65d72 "3.21.7": - sha256: 3523c4a5afc61ac3d7c92835301cdf092129c9b672a6ee17e68c92e928c1375a url: https://github.com/Kitware/CMake/releases/download/v3.21.7/cmake-3.21.7.tar.gz - "3.22.5": - sha256: d3987c3f7759fa0a401c5fcd5076be44a19613bfaa8baee1b5d1835750dc5375 - url: https://github.com/Kitware/CMake/releases/download/v3.22.5/cmake-3.22.5.tar.gz - "3.23.3": - url: "https://github.com/Kitware/CMake/archive/v3.23.3.tar.gz" - sha256: "013f688b7da463dcd1e7afde769081af21cb24365aefc246761cfb2e04cd2872" - "3.24.0": - url: "https://github.com/Kitware/CMake/archive/v3.24.0.tar.gz" - sha256: "d71f48192a0747c0bd46e8f2128773adf3d650d3900a9b03bd2ee5058619bafd" - "3.24.1": - url: "https://github.com/Kitware/CMake/archive/v3.24.1.tar.gz" - sha256: "fe7fd2eb0ecee1c0ad829bca77ac7b516fdb7a982e862fc47ef8df54e714dbc3" + sha256: 3523c4a5afc61ac3d7c92835301cdf092129c9b672a6ee17e68c92e928c1375a + "3.22.6": + url: https://github.com/Kitware/CMake/releases/download/v3.22.6/cmake-3.22.6.tar.gz + sha256: 73933163670ea4ea95c231549007b0c7243282293506a2cf4443714826ad5ec3 + "3.23.5": + url: "https://github.com/Kitware/CMake/releases/download/v3.23.5/cmake-3.23.5.tar.gz" + sha256: "f2944cde7a140b992ba5ccea2009a987a92413762250de22ebbace2319a0f47d" + "3.24.3": + url: "https://github.com/Kitware/CMake/releases/download/v3.24.3/cmake-3.24.3.tar.gz" + sha256: "b53aa10fa82bff84ccdb59065927b72d3bee49f4d86261249fc0984b3b367291" + "3.25.2": + url: "https://github.com/Kitware/CMake/releases/download/v3.25.2/cmake-3.25.2.tar.gz" + sha256: "c026f22cb931dd532f648f087d587f07a1843c6e66a3dfca4fb0ea21944ed33c" diff --git a/recipes/cmake/3.x.x/conanfile.py b/recipes/cmake/3.x.x/conanfile.py index dcee83836341a..99b7b5e57d1a7 100644 --- a/recipes/cmake/3.x.x/conanfile.py +++ b/recipes/cmake/3.x.x/conanfile.py @@ -1,20 +1,26 @@ -import os from conan import ConanFile +from conan.tools.files import chdir, copy, rmdir, get, save, load +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.build import build_jobs, cross_building, check_min_cppstd from conan.tools.scm import Version -from conan.tools.files import rmdir, get -from conans import tools, AutoToolsBuildEnvironment, CMake -from conans.errors import ConanInvalidConfiguration, ConanException +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration + +import os +import json -required_conan_version = ">=1.35.0" +required_conan_version = ">=1.51.0" class CMakeConan(ConanFile): name = "cmake" + package_type = "application" description = "Conan installer for CMake" topics = ("cmake", "build", "installer") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Kitware/CMake" license = "BSD-3-Clause" - generators = "cmake" settings = "os", "arch", "compiler", "build_type" options = { @@ -26,117 +32,134 @@ class CMakeConan(ConanFile): "bootstrap": False, } - _source_subfolder = "source_subfolder" - _cmake = None - - def _minor_version(self): - return ".".join(str(self.version).split(".")[:2]) - def config_options(self): if self.settings.os == "Windows": self.options.with_openssl = False def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") - - def validate(self): - if self.settings.os == "Macos" and self.settings.arch == "x86": - raise ConanInvalidConfiguration("CMake does not support x86 for macOS") + self.requires("openssl/1.1.1t") + def validate_build(self): if self.settings.os == "Windows" and self.options.bootstrap: raise ConanInvalidConfiguration("CMake does not support bootstrapping on Windows") minimal_cpp_standard = "11" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, minimal_cpp_standard) minimal_version = { "gcc": "4.8", "clang": "3.3", "apple-clang": "9", "Visual Studio": "14", + "msvc": "190", } compiler = str(self.settings.compiler) if compiler not in minimal_version: - self.output.warn( - "{} recipe lacks information about the {} compiler standard version support".format(self.name, compiler)) - self.output.warn( - "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) + self.output.warning( + f"{self.name} recipe lacks information about the {compiler} compiler standard version support") + self.output.warning( + f"{self.name} requires a compiler that supports at least C++{minimal_cpp_standard}") return version = Version(self.settings.compiler.version) if version < minimal_version[compiler]: raise ConanInvalidConfiguration( - "{} requires a compiler that supports at least C++{}".format(self.name, minimal_cpp_standard)) + f"{self.name} requires a compiler that supports at least C++{minimal_cpp_standard}") + + def validate(self): + if self.settings.os == "Macos" and self.settings.arch == "x86": + raise ConanInvalidConfiguration("CMake does not support x86 for macOS") + + def layout(self): + if self.options.bootstrap: + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + rmdir(self, os.path.join(self.source_folder, "Tests", "RunCMake", "find_package")) - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) + def generate(self): + if self.options.bootstrap: + tc = AutotoolsToolchain(self) + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() + bootstrap_cmake_options = ["--"] + bootstrap_cmake_options.append(f'-DCMAKE_CXX_STANDARD={"11" if not self.settings.compiler.cppstd else self.settings.compiler.cppstd}') + if self.settings.os == "Linux": + if self.options.with_openssl: + openssl = self.dependencies["openssl"] + bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=ON") + bootstrap_cmake_options.append(f'-DOPENSSL_USE_STATIC_LIBS={"FALSE" if openssl.options.shared else "TRUE"}') + else: + bootstrap_cmake_options.append("-DCMAKE_USE_OPENSSL=OFF") + save(self, "bootstrap_args", json.dumps({"bootstrap_cmake_options": ' '.join(arg for arg in bootstrap_cmake_options)})) + else: + tc = CMakeToolchain(self) + # Disabling testing because CMake tests build can fail in Windows in some cases + tc.variables["BUILD_TESTING"] = False if not self.settings.compiler.cppstd: - self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 - self._cmake.definitions["CMAKE_BOOTSTRAP"] = False + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.variables["CMAKE_BOOTSTRAP"] = False if self.settings.os == "Linux": - self._cmake.definitions["CMAKE_USE_OPENSSL"] = self.options.with_openssl + tc.variables["CMAKE_USE_OPENSSL"] = self.options.with_openssl if self.options.with_openssl: - self._cmake.definitions["OPENSSL_USE_STATIC_LIBS"] = not self.options["openssl"].shared - if tools.cross_building(self): - self._cmake.definitions["HAVE_POLL_FINE_EXITCODE"] = '' - self._cmake.definitions["HAVE_POLL_FINE_EXITCODE__TRYRUN_OUTPUT"] = '' - self._cmake.configure(source_folder=self._source_subfolder) + openssl = self.dependencies["openssl"] + tc.variables["OPENSSL_USE_STATIC_LIBS"] = not openssl.options.shared + if cross_building(self): + tc.variables["HAVE_POLL_FINE_EXITCODE"] = '' + tc.variables["HAVE_POLL_FINE_EXITCODE__TRYRUN_OUTPUT"] = '' + # TODO: Remove after fixing https://github.com/conan-io/conan-center-index/issues/13159 + # C3I workaround to force CMake to choose the highest version of + # the windows SDK available in the system + if is_msvc(self) and not self.conf.get("tools.cmake.cmaketoolchain:system_version"): + tc.variables["CMAKE_SYSTEM_VERSION"] = "10.0" + tc.generate() + tc = CMakeDeps(self) + # CMake try_compile failure: https://github.com/conan-io/conan-center-index/pull/16073#discussion_r1110037534 + tc.set_property("openssl", "cmake_find_mode", "module") + tc.generate() - return self._cmake def build(self): if self.options.bootstrap: - with tools.chdir(self._source_subfolder): - self.run(['./bootstrap', '--prefix={}'.format(self.package_folder), '--parallel={}'.format(tools.cpu_count())]) - autotools = AutoToolsBuildEnvironment(self) + toolchain_file_content = json.loads(load(self, os.path.join(self.generators_folder, "bootstrap_args"))) + bootstrap_cmake_options = toolchain_file_content.get("bootstrap_cmake_options") + with chdir(self, self.source_folder): + self.run(f'./bootstrap --prefix="" --parallel={build_jobs(self)} {bootstrap_cmake_options}') + autotools = Autotools(self) autotools.make() else: - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "project(CMake)", - "project(CMake)\ninclude(\"{}/conanbuildinfo.cmake\")\nconan_basic_setup(NO_OUTPUT_DIRS)".format( - self.install_folder.replace("\\", "/"))) - if self.settings.os == "Linux": - tools.replace_in_file(os.path.join(self._source_subfolder, "Utilities", "cmcurl", "CMakeLists.txt"), - "list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES})", - "list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} ${CMAKE_DL_LIBS} pthread)") - - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("Copyright.txt", dst="licenses", src=self._source_subfolder) + copy(self, "Copyright.txt", self.source_folder, os.path.join(self.package_folder, "licenses"), keep_path=False) if self.options.bootstrap: - with tools.chdir(self._source_subfolder): - autotools = AutoToolsBuildEnvironment(self) + with chdir(self, self.source_folder): + autotools = Autotools(self) autotools.install() else: - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "doc")) def package_id(self): del self.info.settings.compiler + del self.info.options.bootstrap def package_info(self): - minor = self._minor_version() + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + # Needed for compatibility with v1.x - Remove when 2.0 becomes the default bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.output.info(f"Appending PATH environment variable: {bindir}") self.env_info.PATH.append(bindir) - - self.buildenv_info.prepend_path("CMAKE_ROOT", self.package_folder) - self.env_info.CMAKE_ROOT = self.package_folder - mod_path = os.path.join(self.package_folder, "share", "cmake-%s" % minor, "Modules") - self.buildenv_info.prepend_path("CMAKE_MODULE_PATH", mod_path) - self.env_info.CMAKE_MODULE_PATH = mod_path - if not os.path.exists(mod_path): - raise ConanException("Module path not found: %s" % mod_path) - - self.cpp_info.includedirs = [] diff --git a/recipes/cmake/3.x.x/test_package/conanfile.py b/recipes/cmake/3.x.x/test_package/conanfile.py index b36c2327f2da6..df50a01c37d6f 100644 --- a/recipes/cmake/3.x.x/test_package/conanfile.py +++ b/recipes/cmake/3.x.x/test_package/conanfile.py @@ -1,18 +1,24 @@ -import os from six import StringIO -from conans import ConanFile, tools +from conan import ConanFile +import re class TestPackageConan(ConanFile): - settings = "os", "arch" + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - output = StringIO() - self.run("cmake --version", output=output, run_environment=True) - output_str = str(output.getvalue()) - self.output.info("Installed version: {}".format(output_str)) - require_version = str(self.deps_cpp_info["cmake"].version) - self.output.info("Expected version: {}".format(require_version)) - assert_cmake_version = "cmake version %s" % require_version - assert(assert_cmake_version in output_str) + output = StringIO() + # Third arg to self.run renamed "stdout" in Conan 2.0 but 1.x linter doesn't like it + self.run("cmake --version", output) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + tokens = re.split('[@#]', self.tested_reference_str) + require_version = tokens[0].split("/", 1)[1] + self.output.info("Expected version: {}".format(require_version)) + assert_cmake_version = "cmake version %s" % require_version + assert(assert_cmake_version in output_str) diff --git a/recipes/cmake/3.x.x/test_v1_package/conanfile.py b/recipes/cmake/3.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..df9415b7cf880 --- /dev/null +++ b/recipes/cmake/3.x.x/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +import os +from six import StringIO +from conan import ConanFile +import re + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def test(self): + output = StringIO() + self.run("cmake --version", output=output, run_environment=False) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + tokens = re.split('[@#]', self.tested_reference_str) + require_version = tokens[0].split("/", 1)[1] + self.output.info("Expected version: {}".format(require_version)) + assert_cmake_version = "cmake version %s" % require_version + assert(assert_cmake_version in output_str) diff --git a/recipes/cmake/config.yml b/recipes/cmake/config.yml index f755a4bf578b0..a51a4d68aeed6 100644 --- a/recipes/cmake/config.yml +++ b/recipes/cmake/config.yml @@ -5,11 +5,11 @@ versions: folder: "3.x.x" "3.21.7": folder: "3.x.x" - "3.22.5": + "3.22.6": folder: "3.x.x" - "3.23.3": + "3.23.5": folder: "3.x.x" - "3.24.0": + "3.24.3": folder: "3.x.x" - "3.24.1": + "3.25.2": folder: "3.x.x" diff --git a/recipes/cmocka/all/conanfile.py b/recipes/cmocka/all/conanfile.py index a0184c6e3cfae..2c0c2ed7806b8 100644 --- a/recipes/cmocka/all/conanfile.py +++ b/recipes/cmocka/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save import os import textwrap -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class CmockaConan(ConanFile): @@ -15,6 +15,7 @@ class CmockaConan(ConanFile): description = "A unit testing framework for C" topics = ("unit_test", "unittest", "test", "testing", "mock", "mocking") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,8 +27,7 @@ class CmockaConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,22 +35,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/cmocka/all/test_package/conanfile.py b/recipes/cmocka/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/cmocka/all/test_package/conanfile.py +++ b/recipes/cmocka/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/cmocka/all/test_v1_package/CMakeLists.txt b/recipes/cmocka/all/test_v1_package/CMakeLists.txt index 6059ab4d19a64..0d20897301b68 100644 --- a/recipes/cmocka/all/test_v1_package/CMakeLists.txt +++ b/recipes/cmocka/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(cmocka REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_include_directories(${PROJECT_NAME} PRIVATE ${CMOCKA_INCLUDE_DIR}) -target_link_libraries(${PROJECT_NAME} PRIVATE ${CMOCKA_LIBRARY}) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cmp/all/conanfile.py b/recipes/cmp/all/conanfile.py index 5987f311045bf..6c5ef2cd5e0c4 100644 --- a/recipes/cmp/all/conanfile.py +++ b/recipes/cmp/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class CmpConan(ConanFile): @@ -12,8 +12,9 @@ class CmpConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "http://msgpack.org" description = "An implementation of the MessagePack serialization format in C / msgpack.org[C]" - topics = ("cmp", "msgpack", "serialization") + topics = ("msgpack", "serialization") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,22 +33,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/cmp/all/test_package/conanfile.py b/recipes/cmp/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/cmp/all/test_package/conanfile.py +++ b/recipes/cmp/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/cmp/all/test_v1_package/CMakeLists.txt b/recipes/cmp/all/test_v1_package/CMakeLists.txt index bde0b0bffb0fa..0d20897301b68 100644 --- a/recipes/cmp/all/test_v1_package/CMakeLists.txt +++ b/recipes/cmp/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(cmp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE cmp::cmp) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cnpy/all/CMakeLists.txt b/recipes/cnpy/all/CMakeLists.txt deleted file mode 100644 index faa97ba1ac412..0000000000000 --- a/recipes/cnpy/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - -add_subdirectory("source_subfolder") diff --git a/recipes/cnpy/all/conandata.yml b/recipes/cnpy/all/conandata.yml index 953d832ba545b..a4b4bcd8ca10b 100644 --- a/recipes/cnpy/all/conandata.yml +++ b/recipes/cnpy/all/conandata.yml @@ -4,5 +4,4 @@ sources: sha256: "5120abc54a564efa92c642cc0199cc4fd3f345901157de9fbbdcedbb34d28d8a" patches: "cci.20180601": - - patch_file: "patches/0001-exclude-example.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-cmake.patch" diff --git a/recipes/cnpy/all/conanfile.py b/recipes/cnpy/all/conanfile.py index 794d778b22da5..93cc4c7d5cadc 100644 --- a/recipes/cnpy/all/conanfile.py +++ b/recipes/cnpy/all/conanfile.py @@ -1,36 +1,33 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -import glob -from conans import ConanFile, CMake, tools +required_conan_version = ">=1.53.0" + class CnpyConan(ConanFile): name = "cnpy" description = "library to read/write .npy and .npz files in C/C++" license = "MIT" - topics = ("conan", "cnpy") - homepage = "https://github.com/hongyx11/cnpy" + topics = ("numpy", "npy", "npz") + homepage = "https://github.com/rogersce/cnpy" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake", "cmake_find_package" - settings = "os", "arch", "compiler", "build_type" - _cmake = None + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "fPIC": [True, False] + "fPIC": [True, False], } default_options = { "shared": False, - "fPIC": True + "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,36 +35,37 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.11") + self.requires("zlib/1.2.13", transitive_headers=True, transitive_libs=True) + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob(self.name + "-*")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_STATIC"] = not self.options.shared - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.names["cmake_find_package"] = "cnpy" - self.cpp_info.names["cmake_find_package_multi"] = "cnpy" self.cpp_info.libs = ["cnpy"] diff --git a/recipes/cnpy/all/patches/0001-exclude-example.patch b/recipes/cnpy/all/patches/0001-exclude-example.patch deleted file mode 100644 index f39f242261c6a..0000000000000 --- a/recipes/cnpy/all/patches/0001-exclude-example.patch +++ /dev/null @@ -1,37 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9eb550f..d57c6dd 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -5,26 +5,17 @@ endif(COMMAND cmake_policy) - - project(CNPY) - --set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") -- --option(ENABLE_STATIC "Build static (.a) library" ON) -- - find_package(ZLIB REQUIRED) - - include_directories(${ZLIB_INCLUDE_DIRS}) - --add_library(cnpy SHARED "cnpy.cpp") -+add_library(cnpy "cnpy.cpp") - target_link_libraries(cnpy ${ZLIB_LIBRARIES}) --install(TARGETS "cnpy" LIBRARY DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) -- --if(ENABLE_STATIC) -- add_library(cnpy-static STATIC "cnpy.cpp") -- set_target_properties(cnpy-static PROPERTIES OUTPUT_NAME "cnpy") -- install(TARGETS "cnpy-static" ARCHIVE DESTINATION lib) --endif(ENABLE_STATIC) -+set_property(TARGET cnpy PROPERTY CXX_STANDARD 11) -+install(TARGETS "cnpy" -+ LIBRARY DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE -+ ARCHIVE DESTINATION lib -+ RUNTIME DESTINATION bin) - - install(FILES "cnpy.h" DESTINATION include) --install(FILES "mat2npz" "npy2mat" "npz2mat" DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - --add_executable(example1 example1.cpp) --target_link_libraries(example1 cnpy) diff --git a/recipes/cnpy/all/patches/0001-fix-cmake.patch b/recipes/cnpy/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..b3ee3550b104d --- /dev/null +++ b/recipes/cnpy/all/patches/0001-fix-cmake.patch @@ -0,0 +1,40 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,30 +1,18 @@ +-CMAKE_MINIMUM_REQUIRED(VERSION 3.0 FATAL_ERROR) +-if(COMMAND cmake_policy) +- cmake_policy(SET CMP0003 NEW) +-endif(COMMAND cmake_policy) ++CMAKE_MINIMUM_REQUIRED(VERSION 3.8) + +-project(CNPY) ++project(CNPY LANGUAGES CXX) + +-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +-option(ENABLE_STATIC "Build static (.a) library" ON) + + find_package(ZLIB REQUIRED) + +-include_directories(${ZLIB_INCLUDE_DIRS}) + +-add_library(cnpy SHARED "cnpy.cpp") +-target_link_libraries(cnpy ${ZLIB_LIBRARIES}) +-install(TARGETS "cnpy" LIBRARY DESTINATION lib PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) ++add_library(cnpy "cnpy.cpp") ++target_compile_features(cnpy PUBLIC cxx_std_11) ++set_target_properties(cnpy PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ++target_link_libraries(cnpy PUBLIC ZLIB::ZLIB) ++install(TARGETS "cnpy" LIBRARY DESTINATION lib ARCHIVE DESTINATION lib RUNTIME DESTINATION bin) + +-if(ENABLE_STATIC) +- add_library(cnpy-static STATIC "cnpy.cpp") +- set_target_properties(cnpy-static PROPERTIES OUTPUT_NAME "cnpy") +- install(TARGETS "cnpy-static" ARCHIVE DESTINATION lib) +-endif(ENABLE_STATIC) + + install(FILES "cnpy.h" DESTINATION include) +-install(FILES "mat2npz" "npy2mat" "npz2mat" DESTINATION bin PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) + +-add_executable(example1 example1.cpp) +-target_link_libraries(example1 cnpy) diff --git a/recipes/cnpy/all/test_package/CMakeLists.txt b/recipes/cnpy/all/test_package/CMakeLists.txt index 9145952903057..18d71adb9d0d4 100644 --- a/recipes/cnpy/all/test_package/CMakeLists.txt +++ b/recipes/cnpy/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1.0) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() -add_executable(${PROJECT_NAME} example1.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +find_package(cnpy REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cnpy::cnpy) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cnpy/all/test_package/conanfile.py b/recipes/cnpy/all/test_package/conanfile.py index ea57a464900be..0a6bc68712d90 100644 --- a/recipes/cnpy/all/test_package/conanfile.py +++ b/recipes/cnpy/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cnpy/all/test_package/example1.cpp b/recipes/cnpy/all/test_package/test_package.cpp similarity index 100% rename from recipes/cnpy/all/test_package/example1.cpp rename to recipes/cnpy/all/test_package/test_package.cpp diff --git a/recipes/cnpy/all/test_v1_package/CMakeLists.txt b/recipes/cnpy/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cnpy/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cnpy/all/test_v1_package/conanfile.py b/recipes/cnpy/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cnpy/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cocoyaxi/all/CMakeLists.txt b/recipes/cocoyaxi/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/cocoyaxi/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/cocoyaxi/all/conandata.yml b/recipes/cocoyaxi/all/conandata.yml index 35afe0f87d2da..535de47c89a52 100644 --- a/recipes/cocoyaxi/all/conandata.yml +++ b/recipes/cocoyaxi/all/conandata.yml @@ -1,4 +1,4 @@ sources: "2.0.3": - url: "https://github.com/idealvin/cocoyaxi/archive/refs/tags/v2.0.3.tar.gz" - sha256: "c112fafed5e45a3cac27e4b1b5b9f7483df267d510dd03c5dd8272e6405ea61f" + url: "https://github.com/idealvin/coost/archive/refs/tags/v2.0.3.tar.gz" + sha256: "afb5219e56cbcfae1211590e01ad9d9d7f61287e76d9dea5c5f68c432f85bf30" diff --git a/recipes/cocoyaxi/all/conanfile.py b/recipes/cocoyaxi/all/conanfile.py index 86c549c1080d0..217d2d1b7c4e1 100644 --- a/recipes/cocoyaxi/all/conanfile.py +++ b/recipes/cocoyaxi/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class CocoyaxiConan(ConanFile): @@ -12,8 +16,6 @@ class CocoyaxiConan(ConanFile): license = "MIT" description = "A go-style coroutine library in C++11 and more." topics = ("cocoyaxi", "coroutine", "c++11") - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" settings = "os", "arch", "compiler", "build_type" options = { @@ -29,16 +31,6 @@ class CocoyaxiConan(ConanFile): "with_openssl": False, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -51,55 +43,55 @@ def requirements(self): if self.options.with_libcurl: self.requires("libcurl/7.80.0") if self.options.with_libcurl or self.options.with_openssl: - self.requires("openssl/1.1.1m") + self.requires("openssl/1.1.1q") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, 11) + if self.info.options.with_libcurl: + if not self.info.options.with_openssl: + raise ConanInvalidConfiguration(f"{self.name} requires with_openssl=True when using with_libcurl=True") + if self.dependencies["libcurl"].options.with_ssl != "openssl": + raise ConanInvalidConfiguration(f"{self.name} requires libcurl:with_ssl='openssl' to be enabled") + if not self.dependencies["libcurl"].options.with_zlib: + raise ConanInvalidConfiguration(f"{self.name} requires libcurl:with_zlib=True to be enabled") - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # The OSX_ARCHITECTURES target property is now respected for the ASM language - self.build_requires("cmake/3.20.1") + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if is_msvc(self): + tc.variables["STATIC_VS_CRT"] = is_msvc_static_runtime(self) + tc.variables["WITH_LIBCURL"] = self.options.with_libcurl + tc.variables["WITH_OPENSSL"] = self.options.with_openssl + tc.generate() + cd = CMakeDeps(self) + cd.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - runtime = self.settings.get_safe("compiler.runtime") - if runtime: - self._cmake.definitions["STATIC_VS_CRT"] = "MT" in runtime - self._cmake.definitions["WITH_LIBCURL"] = self.options.with_libcurl - self._cmake.definitions["WITH_OPENSSL"] = self.options.with_openssl - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.set_property("cmake_file_name", "cocoyaxi") self.cpp_info.set_property("cmake_target_name", "cocoyaxi::co") - self.cpp_info.names["cmake_find_package"] = "cocoyaxi" - self.cpp_info.names["cmake_find_package_multi"] = "cocoyaxi" - self.cpp_info.components["co"].names["cmake_find_package"] = "co" - self.cpp_info.components["co"].names["cmake_find_package_multi"] = "co" - self.cpp_info.components["co"].set_property("cmake_target_name", "cocoyaxi::co") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["co"].libs = ["co"] - def validate(self): + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.components["co"].set_property("cmake_target_name", "cocoyaxi::co") if self.options.with_libcurl: - if not self.options.with_openssl: - raise ConanInvalidConfiguration(f"{self.name} requires with_openssl=True when using with_libcurl=True") - if self.options["libcurl"].with_ssl != "openssl": - raise ConanInvalidConfiguration(f"{self.name} requires libcurl:with_ssl='openssl' to be enabled") - if not self.options["libcurl"].with_zlib: - raise ConanInvalidConfiguration(f"{self.name} requires libcurl:with_zlib=True to be enabled") + self.cpp_info.components["co"].requires.append("libcurl::libcurl") + if self.options.with_libcurl or self.options.with_openssl: + self.cpp_info.components["co"].requires.append("openssl::openssl") diff --git a/recipes/cocoyaxi/all/test_package/CMakeLists.txt b/recipes/cocoyaxi/all/test_package/CMakeLists.txt index 64ca7d418e69d..2d0878488574e 100644 --- a/recipes/cocoyaxi/all/test_package/CMakeLists.txt +++ b/recipes/cocoyaxi/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -set(CMAKE_CXX_STANDARD 11) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(cocoyaxi REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cc) -target_link_libraries(${PROJECT_NAME} cocoyaxi::co) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cocoyaxi::co) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cocoyaxi/all/test_package/conanfile.py b/recipes/cocoyaxi/all/test_package/conanfile.py index 1bf1c7e26255d..3a8c6c5442b33 100644 --- a/recipes/cocoyaxi/all/test_package/conanfile.py +++ b/recipes/cocoyaxi/all/test_package/conanfile.py @@ -1,9 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if not cross_building(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cocoyaxi/all/test_package/test_package.cc b/recipes/cocoyaxi/all/test_package/test_package.cpp similarity index 100% rename from recipes/cocoyaxi/all/test_package/test_package.cc rename to recipes/cocoyaxi/all/test_package/test_package.cpp diff --git a/recipes/cocoyaxi/all/test_v1_package/CMakeLists.txt b/recipes/cocoyaxi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..882cedffb12e9 --- /dev/null +++ b/recipes/cocoyaxi/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(cocoyaxi REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cocoyaxi::co) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cocoyaxi/all/test_v1_package/conanfile.py b/recipes/cocoyaxi/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cocoyaxi/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/coin-cbc/all/conanfile.py b/recipes/coin-cbc/all/conanfile.py index 0d5cce0751557..ffea985fa3a7d 100644 --- a/recipes/coin-cbc/all/conanfile.py +++ b/recipes/coin-cbc/all/conanfile.py @@ -1,10 +1,14 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import rename, get, apply_conandata_patches, rmdir, mkdir +from conan.tools.build import cross_building +from conan.tools.scm import Version +from conans import AutoToolsBuildEnvironment, tools from contextlib import contextmanager import os import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class CoinCbcConan(ConanFile): name = "coin-cbc" @@ -65,22 +69,22 @@ def _user_info_build(self): return getattr(self, "user_info_build", self.deps_user_info) def build_requirements(self): - self.build_requires("gnu-config/cci.20201022") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("gnu-config/cci.20201022") + self.tool_requires("pkgconf/1.7.4") if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("msys2/cci.latest") if self.settings.compiler == "Visual Studio": - self.build_requires("automake/1.16.4") + self.tool_requires("automake/1.16.5") def validate(self): if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("coin-cbc does not support shared builds on Windows") # FIXME: This issue likely comes from very old autotools versions used to produce configure. - if hasattr(self, "settings_build") and tools.cross_building(self) and self.options.shared: + if hasattr(self, "settings_build") and cross_building(self) and self.options.shared: raise ConanInvalidConfiguration("coin-cbc shared not supported yet when cross-building") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) @contextmanager @@ -112,8 +116,8 @@ def _configure_autotools(self): ] if self.settings.compiler == "Visual Studio": self._autotools.cxx_flags.append("-EHsc") - configure_args.append("--enable-msvc={}".format(self.settings.compiler.runtime)) - if tools.Version(self.settings.compiler.version) >= 12: + configure_args.append(f"--enable-msvc={self.settings.compiler.runtime}") + if Version(self.settings.compiler.version) >= 12: self._autotools.flags.append("-FS") if self.options.parallel: configure_args.append("--with-pthreadsw32-lib={}".format(tools.unix_path(os.path.join(self.deps_cpp_info["pthreads4w"].lib_paths[0], self.deps_cpp_info["pthreads4w"].libs[0] + ".lib")))) @@ -122,8 +126,7 @@ def _configure_autotools(self): return self._autotools def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, os.path.join(self._source_subfolder, "config.sub")) shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, @@ -135,19 +138,20 @@ def build(self): def package(self): self.copy("LICENSE", src=self._source_subfolder, dst="licenses") # Installation script expects include/coin to already exist - tools.mkdir(os.path.join(self.package_folder, "include", "coin")) + mkdir(self, os.path.join(self.package_folder, "include", "coin")) with self._build_context(): autotools = self._configure_autotools() autotools.install() for l in ("CbcSolver", "Cbc", "OsiCbc"): - os.unlink(os.path.join(self.package_folder, "lib", "lib{}.la").format(l)) + os.unlink(f"{self.package_folder}/lib/lib{l}.la") if self.settings.compiler == "Visual Studio": - os.rename(os.path.join(self.package_folder, "lib", "lib{}.a").format(l), - os.path.join(self.package_folder, "lib", "{}.lib").format(l)) + rename(self, + f"{self.package_folder}/lib/lib{l}.a", + f"{self.package_folder}/lib/{l}.lib") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.components["libcbc"].libs = ["CbcSolver", "Cbc"] diff --git a/recipes/coin-cgl/all/conanfile.py b/recipes/coin-cgl/all/conanfile.py index 233e72b7ee4ab..152335302dd9a 100644 --- a/recipes/coin-cgl/all/conanfile.py +++ b/recipes/coin-cgl/all/conanfile.py @@ -1,11 +1,14 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.files import rename +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import rename, get, apply_conandata_patches, rmdir +from conan.tools.build import cross_building +from conan.tools.scm import Version +from conans import AutoToolsBuildEnvironment, tools from contextlib import contextmanager import os import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class CoinCglConan(ConanFile): name = "coin-cgl" @@ -61,22 +64,22 @@ def _user_info_build(self): return getattr(self, "user_info_build", self.deps_user_info) def build_requirements(self): - self.build_requires("gnu-config/cci.20201022") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("gnu-config/cci.20201022") + self.tool_requires("pkgconf/1.7.4") if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("msys2/cci.latest") if self.settings.compiler == "Visual Studio": - self.build_requires("automake/1.16.4") + self.tool_requires("automake/1.16.5") def validate(self): if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("coin-cgl does not support shared builds on Windows") # FIXME: This issue likely comes from very old autotools versions used to produce configure. - if hasattr(self, "settings_build") and tools.cross_building(self) and self.options.shared: + if hasattr(self, "settings_build") and cross_building(self) and self.options.shared: raise ConanInvalidConfiguration("coin-cgl shared not supported yet when cross-building") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) @contextmanager @@ -107,15 +110,14 @@ def _configure_autotools(self): ] if self.settings.compiler == "Visual Studio": self._autotools.cxx_flags.append("-EHsc") - configure_args.append("--enable-msvc={}".format(self.settings.compiler.runtime)) - if tools.Version(self.settings.compiler.version) >= 12: + configure_args.append(f"--enable-msvc={self.settings.compiler.runtime}") + if Version(self.settings.compiler.version) >= 12: self._autotools.flags.append("-FS") self._autotools.configure(configure_dir=os.path.join(self.source_folder, self._source_subfolder), args=configure_args) return self._autotools def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, os.path.join(self._source_subfolder, "config.sub")) shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, @@ -137,8 +139,8 @@ def package(self): os.path.join(self.package_folder, "lib", "libCgl.a"), os.path.join(self.package_folder, "lib", "Cgl.lib")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libs = ["Cgl"] diff --git a/recipes/coin-clp/all/conandata.yml b/recipes/coin-clp/all/conandata.yml index 4ff9da04eac27..b93c37549bc1a 100644 --- a/recipes/coin-clp/all/conandata.yml +++ b/recipes/coin-clp/all/conandata.yml @@ -2,7 +2,13 @@ sources: "1.17.6": url: "https://github.com/coin-or/Clp/archive/releases/1.17.6.tar.gz" sha256: "afff465b1620cfcbb7b7c17b5d331d412039650ff471c4160c7eb24ae01284c9" + "1.17.7": + url: "https://github.com/coin-or/Clp/archive/releases/1.17.7.tar.gz" + sha256: "c4c2c0e014220ce8b6294f3be0f3a595a37bef58a14bf9bac406016e9e73b0f5" patches: "1.17.6": - patch_file: "patches/0001-no-pkg-config-check.patch" base_path: "source_subfolder" + "1.17.7": + - patch_file: "patches/0002-no-pkg-config-check.patch" + base_path: "source_subfolder" diff --git a/recipes/coin-clp/all/conanfile.py b/recipes/coin-clp/all/conanfile.py index 39939b551d54c..1bf9b449492c8 100644 --- a/recipes/coin-clp/all/conanfile.py +++ b/recipes/coin-clp/all/conanfile.py @@ -57,8 +57,8 @@ def configure(self): del self.options.fPIC def requirements(self): - self.requires("coin-utils/2.11.4") - self.requires("coin-osi/0.108.6") + self.requires("coin-utils/2.11.6") + self.requires("coin-osi/0.108.7") def validate(self): if self.settings.os == "Windows" and self.options.shared: diff --git a/recipes/coin-clp/all/patches/0002-no-pkg-config-check.patch b/recipes/coin-clp/all/patches/0002-no-pkg-config-check.patch new file mode 100644 index 0000000000000..62070411f384d --- /dev/null +++ b/recipes/coin-clp/all/patches/0002-no-pkg-config-check.patch @@ -0,0 +1,13 @@ +--- Clp/Makefile.in ++++ Clp/Makefile.in +@@ -924,8 +924,8 @@ + + install-data-hook: + @$(mkdir_p) "$(addlibsdir)" +-@COIN_HAS_PKGCONFIG_TRUE@ PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ +-@COIN_HAS_PKGCONFIG_TRUE@ $(PKG_CONFIG) --libs clp > $(addlibsdir)/clp_addlibs.txt ++@COIN_HAS_PKGCONFIG_TRUE@ #PKG_CONFIG_PATH=@COIN_PKG_CONFIG_PATH@:$(DESTDIR)$(pkgconfiglibdir) \ ++@COIN_HAS_PKGCONFIG_TRUE@ #$(PKG_CONFIG) --libs clp > $(addlibsdir)/clp_addlibs.txt + @COIN_CXX_IS_CL_TRUE@@COIN_HAS_PKGCONFIG_FALSE@ echo "-libpath:`$(CYGPATH_W) @abs_lib_dir@` libClpSolver.lib libClp.lib @CLPLIB_LIBS_INSTALLED@" > $(addlibsdir)/clp_addlibs.txt + @COIN_CXX_IS_CL_FALSE@@COIN_HAS_PKGCONFIG_FALSE@ echo -L@abs_lib_dir@ -lClp @CLPLIB_LIBS_INSTALLED@ > $(addlibsdir)/clp_addlibs.txt + diff --git a/recipes/coin-clp/config.yml b/recipes/coin-clp/config.yml index 34a0fb9afc279..43fcfc3600fa6 100644 --- a/recipes/coin-clp/config.yml +++ b/recipes/coin-clp/config.yml @@ -1,3 +1,5 @@ versions: "1.17.6": folder: "all" + "1.17.7": + folder: "all" diff --git a/recipes/coin-lemon/all/conanfile.py b/recipes/coin-lemon/all/conanfile.py index d76140ba95344..40ed6b1af7267 100644 --- a/recipes/coin-lemon/all/conanfile.py +++ b/recipes/coin-lemon/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class CoinLemonConan(ConanFile): @@ -14,6 +14,7 @@ class CoinLemonConan(ConanFile): description = "LEMON stands for Library for Efficient Modeling and Optimization in Networks." topics = ("data structures", "algorithms", "graphs", "network") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,8 +26,7 @@ class CoinLemonConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -34,14 +34,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/coin-lemon/all/test_package/conanfile.py b/recipes/coin-lemon/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/coin-lemon/all/test_package/conanfile.py +++ b/recipes/coin-lemon/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/coin-lemon/all/test_v1_package/CMakeLists.txt b/recipes/coin-lemon/all/test_v1_package/CMakeLists.txt index d665d92471e4e..0d20897301b68 100644 --- a/recipes/coin-lemon/all/test_v1_package/CMakeLists.txt +++ b/recipes/coin-lemon/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(LEMON REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE LEMON::LEMON) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/coin-osi/all/conandata.yml b/recipes/coin-osi/all/conandata.yml index c50150a2ca050..a952b4f900add 100644 --- a/recipes/coin-osi/all/conandata.yml +++ b/recipes/coin-osi/all/conandata.yml @@ -1,8 +1,12 @@ sources: + "0.108.7": + url: "https://github.com/coin-or/Osi/archive/releases/0.108.7.tar.gz" + sha256: "f1bc53a498585f508d3f8d74792440a30a83c8bc934d0c8ecf8cd8bc0e486228" "0.108.6": url: "https://github.com/coin-or/Osi/archive/releases/0.108.6.tar.gz" sha256: "984a5886825e2da9bf44d8a665f4b92812f0700e451c12baf9883eaa2315fad5" patches: + "0.108.7": + - patch_file: "patches/0001-no-pkg-config-check.patch" "0.108.6": - patch_file: "patches/0001-no-pkg-config-check.patch" - base_path: "source_subfolder" diff --git a/recipes/coin-osi/all/conanfile.py b/recipes/coin-osi/all/conanfile.py index 798aa130f6fe1..af104a9d3fcbb 100644 --- a/recipes/coin-osi/all/conanfile.py +++ b/recipes/coin-osi/all/conanfile.py @@ -1,14 +1,15 @@ from conan import ConanFile -from conan.tools.build import cross_building -from conan.tools.files import get, apply_conandata_patches, rmdir, rm, rename -from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration -from conans import AutoToolsBuildEnvironment, tools -import contextlib +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc, msvc_runtime_flag import os -import shutil -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.57.0" class CoinOsiConan(ConanFile): @@ -17,7 +18,8 @@ class CoinOsiConan(ConanFile): topics = ("clp", "simplex", "solver", "linear", "programming") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/coin-or/Osi" - license = ("EPL-2.0",) + license = "EPL-2.0" + package_type = "library" settings = "os", "arch", "build_type", "compiler" options = { "shared": [True, False], @@ -27,26 +29,13 @@ class CoinOsiConan(ConanFile): "shared": False, "fPIC": True, } - exports_sources = "patches/**.patch" - generators = "pkg_config" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -54,16 +43,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def requirements(self): - self.requires("coin-utils/2.11.4") + def layout(self): + basic_layout(self, src_folder="src") - def build_requirements(self): - self.build_requires("gnu-config/cci.20201022") - self.build_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + def requirements(self): + self.requires("coin-utils/2.11.6") def validate(self): if self.settings.os == "Windows" and self.options.shared: @@ -72,76 +58,80 @@ def validate(self): if hasattr(self, "settings_build") and cross_building(self) and self.options.shared: raise ConanInvalidConfiguration("coin-osi shared not supported yet when cross-building") + def build_requirements(self): + self.tool_requires("gnu-config/cci.20210814") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "cl -nologo", - "CXX": "cl -nologo", - "LD": "link -nologo", - "AR": "lib", - } - with tools.environment_append(env): - yield - else: - yield - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - configure_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--without-blas" - "--without-lapack" - ] - if self.settings.compiler == "Visual Studio": - self._autotools.cxx_flags.append("-EHsc") - configure_args.append(f"--enable-msvc={self.settings.compiler.runtime}") - if Version(self.settings.compiler.version) >= 12: - self._autotools.flags.append("-FS") - self._autotools.configure(configure_dir=self._source_subfolder, args=configure_args) - return self._autotools + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + "--without-blas", + "--without-lapack", + ]) + if is_msvc(self): + tc.extra_cxxflags.append("-EHsc") + tc.configure_args.append(f"--enable-msvc={msvc_runtime_flag(self)}") + if check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + env = tc.environment() + if is_msvc(self): + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", "lib -nologo") + if self._settings_build.os == "Windows": + # TODO: Something to fix in conan client or pkgconf recipe? + # This is a weird workaround when build machine is Windows. Here we have to inject regular + # Windows path to pc files folder instead of unix path flavor injected by AutotoolsToolchain... + env.define("PKG_CONFIG_PATH", self.generators_folder) + tc.generate(env) + + deps = PkgConfigDeps(self) + deps.generate() def build(self): apply_conandata_patches(self) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install(args=["-j1"]) # due to configure generated with old autotools version - + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install(args=["-j1"]) rm(self, "*.la", os.path.join(self.package_folder, "lib")) - - if self.settings.compiler == "Visual Studio": + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) + if is_msvc(self): for l in ("Osi", "OsiCommonTests"): rename(self, os.path.join(self.package_folder, "lib", f"lib{l}.lib"), os.path.join(self.package_folder, "lib", f"{l}.lib")) - rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - rmdir(self, os.path.join(self.package_folder, "share")) - def package_info(self): + self.cpp_info.components["libosi"].set_property("pkg_config_name", "osi") self.cpp_info.components["libosi"].libs = ["Osi"] self.cpp_info.components["libosi"].includedirs = [os.path.join("include", "coin")] self.cpp_info.components["libosi"].requires = ["coin-utils::coin-utils"] - self.cpp_info.components["libosi"].names["pkg_config"] = "osi" + self.cpp_info.components["osi-unittests"].set_property("pkg_config_name", "osi-unittests") self.cpp_info.components["osi-unittests"].libs = ["OsiCommonTests"] self.cpp_info.components["osi-unittests"].requires = ["libosi"] - self.cpp_info.components["osi-unittests"].names["pkg_config"] = "osi-unittests" diff --git a/recipes/coin-osi/all/test_package/CMakeLists.txt b/recipes/coin-osi/all/test_package/CMakeLists.txt index 790c07d8c7899..d49eef53308a3 100644 --- a/recipes/coin-osi/all/test_package/CMakeLists.txt +++ b/recipes/coin-osi/all/test_package/CMakeLists.txt @@ -1,11 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -include(FindPkgConfig) +project(test_package LANGUAGES CXX) +find_package(PkgConfig REQUIRED) pkg_check_modules(OsiUnitTests REQUIRED IMPORTED_TARGET osi-unittests) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/coin-osi/all/test_package/conanfile.py b/recipes/coin-osi/all/test_package/conanfile.py index 9e09e219fdcb3..af1af0ebb3d7f 100644 --- a/recipes/coin-osi/all/test_package/conanfile.py +++ b/recipes/coin-osi/all/test_package/conanfile.py @@ -1,13 +1,23 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "pkg_config" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "PkgConfigDeps", "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - self.build_requires("pkgconf/1.7.4") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") def build(self): cmake = CMake(self) @@ -15,6 +25,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/coin-osi/all/test_v1_package/CMakeLists.txt b/recipes/coin-osi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/coin-osi/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/coin-osi/all/test_v1_package/conanfile.py b/recipes/coin-osi/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e6b0fdb8110e8 --- /dev/null +++ b/recipes/coin-osi/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "pkg_config" + + def build_requirements(self): + self.build_requires("pkgconf/1.9.3") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/coin-osi/config.yml b/recipes/coin-osi/config.yml index 35ff66d1496fa..aca1ba23ffa90 100644 --- a/recipes/coin-osi/config.yml +++ b/recipes/coin-osi/config.yml @@ -1,3 +1,5 @@ versions: + "0.108.7": + folder: "all" "0.108.6": folder: "all" diff --git a/recipes/coin-utils/all/conandata.yml b/recipes/coin-utils/all/conandata.yml index 53efde04b8eaa..cf4b9462b67bc 100644 --- a/recipes/coin-utils/all/conandata.yml +++ b/recipes/coin-utils/all/conandata.yml @@ -1,8 +1,12 @@ sources: + "2.11.6": + url: "https://github.com/coin-or/CoinUtils/archive/releases/2.11.6.tar.gz" + sha256: "6ea31d5214f7eb27fa3ffb2bdad7ec96499dd2aaaeb4a7d0abd90ef852fc79ca" "2.11.4": url: "https://github.com/coin-or/CoinUtils/archive/releases/2.11.4.tar.gz" sha256: "d4effff4452e73356eed9f889efd9c44fe9cd68bd37b608a5ebb2c58bd45ef81" patches: + "2.11.6": + - patch_file: "patches/0001-no-check-pkgconfig.patch" "2.11.4": - patch_file: "patches/0001-no-check-pkgconfig.patch" - base_path: "source_subfolder" diff --git a/recipes/coin-utils/all/conanfile.py b/recipes/coin-utils/all/conanfile.py index 43fc93be8d655..e953f7c06f675 100644 --- a/recipes/coin-utils/all/conanfile.py +++ b/recipes/coin-utils/all/conanfile.py @@ -1,23 +1,29 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os from conan.tools.build import cross_building -from conan.tools.files import get, apply_conandata_patches, rm, rmdir, rename -from conan.tools.scm import Version -from conan.tools.microsoft import is_msvc -from conans import AutoToolsBuildEnvironment, tools -import contextlib -import shutil +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path +import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.57.0" class CoinUtilsConan(ConanFile): name = "coin-utils" - description = "CoinUtils is an open-source collection of classes and helper functions that are generally useful to multiple COIN-OR projects." - topics = ("coin-utils", "sparse", "matrix", "helper", "parsing", "representation") + description = ( + "CoinUtils is an open-source collection of classes and helper " + "functions that are generally useful to multiple COIN-OR projects." + ) + topics = ("coin", "sparse", "matrix", "helper", "parsing", "representation") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/coin-or/CoinUtils" - license = ("EPL-2.0",) + license = "EPL-2.0" + + package_type = "library" settings = "os", "arch", "build_type", "compiler" options = { "shared": [True, False], @@ -28,25 +34,12 @@ class CoinUtilsConan(ConanFile): "fPIC": True, } - exports_sources = "patches/**" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -54,11 +47,14 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.11") self.requires("bzip2/1.0.8") + self.requires("zlib/1.2.13") def validate(self): if self.settings.os == "Windows" and self.options.shared: @@ -70,80 +66,108 @@ def validate(self): raise ConanInvalidConfiguration("coin-utils shared not supported yet when cross-building") def build_requirements(self): - if not is_msvc(self): - self.build_requires("gnu-config/cci.20201022") - - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - if is_msvc(self): - self.build_requires("automake/1.16.4") + self.tool_requires("automake/1.16.5") + else: + self.tool_requires("gnu-config/cci.20210814") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @contextlib.contextmanager - def _build_context(self): - if is_msvc(self): - with tools.vcvars(self): - env = { - "CC": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "CXX": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "LD": "link -nologo", - "AR": "{} lib".format(tools.unix_path(self._user_info_build["automake"].ar_lib)), - } - with tools.environment_append(env): - yield - else: - yield + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] + tc = AutotoolsToolchain(self) if is_msvc(self): - self._autotools.cxx_flags.append("-EHsc") - if Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") - yes_no = lambda v: "yes" if v else "no" - configure_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] + tc.configure_args.append(f"--enable-msvc={self.settings.compiler.runtime}") + tc.extra_cxxflags.append("-EHsc") + if check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + env = tc.environment() if is_msvc(self): - configure_args.append(f"--enable-msvc={self.settings.compiler.runtime}") - self._autotools.configure(configure_dir=self._source_subfolder, args=configure_args) - return self._autotools + compile_wrapper = unix_path(self, self.conf.get("user.automake:compile-wrapper", check_type=str)) + ar_wrapper = unix_path(self, self.conf.get("user.automake:lib-wrapper", check_type=str)) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + tc.generate(env) + + if is_msvc(self): + # Custom AutotoolsDeps for cl like compilers + # workaround for https://github.com/conan-io/conan/issues/12784 + includedirs = [] + defines = [] + libs = [] + libdirs = [] + linkflags = [] + cxxflags = [] + cflags = [] + for dependency in self.dependencies.values(): + deps_cpp_info = dependency.cpp_info.aggregated_components() + includedirs.extend(deps_cpp_info.includedirs) + defines.extend(deps_cpp_info.defines) + libs.extend(deps_cpp_info.libs + deps_cpp_info.system_libs) + libdirs.extend(deps_cpp_info.libdirs) + linkflags.extend(deps_cpp_info.sharedlinkflags + deps_cpp_info.exelinkflags) + cxxflags.extend(deps_cpp_info.cxxflags) + cflags.extend(deps_cpp_info.cflags) + + env = Environment() + env.append("CPPFLAGS", [f"-I{unix_path(self, p)}" for p in includedirs] + [f"-D{d}" for d in defines]) + env.append("_LINK_", [lib if lib.endswith(".lib") else f"{lib}.lib" for lib in libs]) + env.append("LDFLAGS", [f"-L{unix_path(self, p)}" for p in libdirs] + linkflags) + env.append("CXXFLAGS", cxxflags) + env.append("CFLAGS", cflags) + env.vars(self).save_script("conanautotoolsdeps_cl_workaround") + else: + deps = AutotoolsDeps(self) + deps.generate() def build(self): apply_conandata_patches(self) if not is_msvc(self): - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - f"{self._source_subfolder}/config.sub") - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - f"{self._source_subfolder}/config.guess") - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install(args=["-j1"]) - - rm(self, "*.la", f"{self.package_folder}/lib") - rmdir(self, f"{self.package_folder}/lib/pkgconfig") - rmdir(self, f"{self.package_folder}/share") - + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install(args=["-j1"]) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) if is_msvc(self): - rename(self, f"{self.package_folder}/lib/libCoinUtils.a", - f"{self.package_folder}/lib/CoinUtils.lib") + rename(self, os.path.join(self.package_folder, "lib", "libCoinUtils.a"), + os.path.join(self.package_folder, "lib", "CoinUtils.lib")) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "coinutils") self.cpp_info.libs = ["CoinUtils"] - if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs = ["m"] - self.cpp_info.includedirs.append("include/coin") - self.cpp_info.names["pkg_config"] = "coinutils" + self.cpp_info.includedirs.append(os.path.join("include", "coin")) + if not self.options.shared: + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.system_libs = ["m"] + if is_apple_os(self): + self.cpp_info.frameworks.append("Accelerate") diff --git a/recipes/coin-utils/all/test_package/CMakeLists.txt b/recipes/coin-utils/all/test_package/CMakeLists.txt index d3a4cd73e4668..761c9f0a9c670 100644 --- a/recipes/coin-utils/all/test_package/CMakeLists.txt +++ b/recipes/coin-utils/all/test_package/CMakeLists.txt @@ -1,11 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -include(FindPkgConfig) +cmake_minimum_required(VERSION 3.6) +project(test_package LANGUAGES CXX) +find_package(PkgConfig REQUIRED) pkg_check_modules(CoinUtils REQUIRED IMPORTED_TARGET coinutils) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/coin-utils/all/test_package/conanfile.py b/recipes/coin-utils/all/test_package/conanfile.py index a76b4ec929926..af1af0ebb3d7f 100644 --- a/recipes/coin-utils/all/test_package/conanfile.py +++ b/recipes/coin-utils/all/test_package/conanfile.py @@ -1,20 +1,30 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "pkg_config" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "PkgConfigDeps", "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") def build(self): cmake = CMake(self) cmake.configure() cmake.build() - def build_requirements(self): - self.build_requires("pkgconf/1.7.4") - def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/coin-utils/all/test_v1_package/CMakeLists.txt b/recipes/coin-utils/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/coin-utils/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/coin-utils/all/test_v1_package/conanfile.py b/recipes/coin-utils/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e6b0fdb8110e8 --- /dev/null +++ b/recipes/coin-utils/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "pkg_config" + + def build_requirements(self): + self.build_requires("pkgconf/1.9.3") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/coin-utils/config.yml b/recipes/coin-utils/config.yml index 2cbd50d2508a1..a116e38afc5df 100644 --- a/recipes/coin-utils/config.yml +++ b/recipes/coin-utils/config.yml @@ -1,3 +1,5 @@ versions: + "2.11.6": + folder: "all" "2.11.4": folder: "all" diff --git a/recipes/commata/all/conandata.yml b/recipes/commata/all/conandata.yml new file mode 100644 index 0000000000000..9371922d5a0ab --- /dev/null +++ b/recipes/commata/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.2.3": + url: "https://github.com/furfurylic/commata/archive/refs/tags/v0.2.3.tar.gz" + sha256: "47521aa27b26fe650bd985c4e07df44453f9d09ab0d61ee98dd6877afe4c25a0" diff --git a/recipes/commata/all/conanfile.py b/recipes/commata/all/conanfile.py new file mode 100644 index 0000000000000..3b9d7e615f7d7 --- /dev/null +++ b/recipes/commata/all/conanfile.py @@ -0,0 +1,66 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.52.0" + + +class CommataConan(ConanFile): + name = "commata" + description = "Just another header-only C++17 CSV parser" + license = "Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/furfurylic/commata" + topics = ("csv", "parser", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/commata/all/test_package/CMakeLists.txt b/recipes/commata/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f69f5f2677dd5 --- /dev/null +++ b/recipes/commata/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(commata REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE commata::commata) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/commata/all/test_package/conanfile.py b/recipes/commata/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/commata/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/commata/all/test_package/test_package.cpp b/recipes/commata/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..5221c81aef901 --- /dev/null +++ b/recipes/commata/all/test_package/test_package.cpp @@ -0,0 +1,58 @@ +#include +#include + +#include "commata/parse_csv.hpp" + +template +class test_collector +{ + std::vector>>* field_values_; + std::basic_string field_value_; + +public: + using char_type = Ch; + + explicit test_collector( + std::vector>>& field_values) : + field_values_(&field_values) + {} + + void start_record(const Ch* /*record_begin*/) + { + field_values_->emplace_back(); + } + + void update(const Ch* first, const Ch* last) + { + field_value_.append(first, last); + } + + void finalize(const Ch* first, const Ch* last) + { + field_value_.append(first, last); + field_values_->back().emplace_back(); + field_values_->back().back().swap(field_value_); + // field_value_ is cleared here + } + + void end_record(const Ch* /*record_end*/) + {} +}; + +int main(void) { + std::string s = R"(,"col1", col2 ,col3,)" "\r\n" + "\n" + R"( cell10 ,,"cell)" "\r\n" + R"(12","cell""13""","")" "\n"; + + std::stringbuf buf(s); + + std::vector> field_values; + + test_collector collector(field_values); + commata::parse_csv(&buf, collector); + + std::cout << field_values.size() << '\n'; + + return 0; +} diff --git a/recipes/commata/all/test_v1_package/CMakeLists.txt b/recipes/commata/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/commata/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/commata/all/test_v1_package/conanfile.py b/recipes/commata/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/commata/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/commata/config.yml b/recipes/commata/config.yml new file mode 100644 index 0000000000000..cfc2b98c1a462 --- /dev/null +++ b/recipes/commata/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.3": + folder: all diff --git a/recipes/concurrencpp/all/conandata.yml b/recipes/concurrencpp/all/conandata.yml index d56e8bf7aee60..1ea38721cc28a 100644 --- a/recipes/concurrencpp/all/conandata.yml +++ b/recipes/concurrencpp/all/conandata.yml @@ -1,8 +1,14 @@ sources: + "0.1.5": + url: "https://github.com/David-Haim/concurrencpp/archive/refs/tags/v.0.1.5.tar.gz" + sha256: "330150ebe11b3d30ffcb3efdecc184a34cf50a6bd43b68e294a496225d286651" "0.1.4": url: "https://github.com/David-Haim/concurrencpp/archive/refs/tags/v.0.1.4.tar.gz" sha256: "3ad9424f975b766accc6eaedf4acfe1a20b5fdbb57fa3ae71f400e13d471e86f" patches: + "0.1.5": + - patch_file: "patches/cmake-min-version.patch" + - patch_file: "patches/directory-name-0.1.5.patch" "0.1.4": - patch_file: "patches/cmake-min-version.patch" - patch_file: "patches/directory-name.patch" diff --git a/recipes/concurrencpp/all/conanfile.py b/recipes/concurrencpp/all/conanfile.py index afde9cc0d91a3..2898c40e74dd5 100644 --- a/recipes/concurrencpp/all/conanfile.py +++ b/recipes/concurrencpp/all/conanfile.py @@ -2,12 +2,12 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class ConcurrencppConan(ConanFile): @@ -17,6 +17,7 @@ class ConcurrencppConan(ConanFile): topics = ("scheduler", "coroutines", "concurrency", "tasks", "executors", "timers", "await", "multithreading") license = "MIT" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,9 +28,20 @@ class ConcurrencppConan(ConanFile): "fPIC": True, } + @property + def _min_cppstd(self): + return "20" + + @property + def _minimum_compilers_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "clang": "11", + } + def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,45 +49,33 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - @property - def _minimum_compilers_version(self): - return { - "Visual Studio": "16", - "msvc": "192", - "clang": "11", - } + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, "20") - if self.info.options.shared and is_msvc(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + if self.options.shared and is_msvc(self): # see https://github.com/David-Haim/concurrencpp/issues/75 - raise ConanInvalidConfiguration("concurrencpp does not support shared builds with Visual Studio") - if self.info.settings.compiler == "gcc": + raise ConanInvalidConfiguration(f"{self.ref} does not support shared builds with Visual Studio") + if self.settings.compiler == "gcc": raise ConanInvalidConfiguration("gcc is not supported by concurrencpp") + if Version(self.version) >= "0.1.5" and self.settings.compiler == "apple-clang": + # apple-clang does not seem to support the C++20 synchronization library which concurrencpp 0.1.5 depends on + raise ConanInvalidConfiguration("apple-clang is not supported by concurrencpp 0.1.5 and higher") - minimum_version = self._minimum_compilers_version.get( - str(self.info.settings.compiler), False - ) - if not minimum_version: - self.output.warn( - "concurrencpp requires C++20. Your compiler is unknown. Assuming it supports C++20." - ) - elif Version(self.info.settings.compiler.version) < minimum_version: + minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - "concurrencpp requires clang >= 11 or Visual Studio >= 16.8.2 as a compiler!" + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - if self.info.settings.compiler == "clang" and self.info.settings.compiler.libcxx != "libc++": + if self.settings.compiler == "clang" and self.settings.compiler.libcxx != "libc++": raise ConanInvalidConfiguration("libc++ required") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/concurrencpp/all/patches/directory-name-0.1.5.patch b/recipes/concurrencpp/all/patches/directory-name-0.1.5.patch new file mode 100644 index 0000000000000..73d77806a9b8a --- /dev/null +++ b/recipes/concurrencpp/all/patches/directory-name-0.1.5.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -104,8 +104,8 @@ include(CMakePackageConfigHelpers) + include(CMakePackageConfigHelpers) + include(GNUInstallDirs) + +-set(concurrencpp_directory "concurrencpp-${PROJECT_VERSION}") +-set(concurrencpp_include_directory "${CMAKE_INSTALL_INCLUDEDIR}/${concurrencpp_directory}") ++set(concurrencpp_directory "concurrencpp") ++set(concurrencpp_include_directory "${CMAKE_INSTALL_INCLUDEDIR}") + + install(TARGETS concurrencpp + EXPORT concurrencppTargets diff --git a/recipes/concurrencpp/all/test_package/conanfile.py b/recipes/concurrencpp/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/concurrencpp/all/test_package/conanfile.py +++ b/recipes/concurrencpp/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/concurrencpp/all/test_v1_package/CMakeLists.txt b/recipes/concurrencpp/all/test_v1_package/CMakeLists.txt index 82e72fcb03579..0d20897301b68 100644 --- a/recipes/concurrencpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/concurrencpp/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.12) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(concurrencpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE concurrencpp::concurrencpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/concurrencpp/config.yml b/recipes/concurrencpp/config.yml index 051f2438869fd..5fafcacd7c8fb 100644 --- a/recipes/concurrencpp/config.yml +++ b/recipes/concurrencpp/config.yml @@ -1,3 +1,5 @@ versions: + "0.1.5": + folder: all "0.1.4": folder: all diff --git a/recipes/confu_json/all/conandata.yml b/recipes/confu_json/all/conandata.yml index 743fa84e88566..5d78ae9d25a41 100644 --- a/recipes/confu_json/all/conandata.yml +++ b/recipes/confu_json/all/conandata.yml @@ -1,7 +1,13 @@ sources: - 0.0.5: - url: https://github.com/werto87/confu_json/archive/refs/tags/v0.0.5.tar.gz - sha256: bc506d4b7836a7689b1c6a2d89bb0c3441f774c8f845fef79d85c71099df5bf9 - 0.0.9: - url: https://github.com/werto87/confu_json/archive/refs/tags/v0.0.9.tar.gz - sha256: 29b2940b939cb04f11fdab4964c86bcb23ac75c588550bf54048e024444d2718 + "1.0.0": + url: "https://github.com/werto87/confu_json/archive/refs/tags/v1.0.0.tar.gz" + sha256: "f165172220b440d37a7a8301e490cf791b3b25b0cc3f2a08b355609c5f777db0" + "0.0.10": + url: "https://github.com/werto87/confu_json/archive/refs/tags/v0.0.10.tar.gz" + sha256: "b31aab1bce952c0dc0bfc1f955a7b88be5103350b5a5eee1a4586ccec0e51fc1" + "0.0.9": + url: "https://github.com/werto87/confu_json/archive/refs/tags/v0.0.9.tar.gz" + sha256: "29b2940b939cb04f11fdab4964c86bcb23ac75c588550bf54048e024444d2718" + "0.0.5": + url: "https://github.com/werto87/confu_json/archive/refs/tags/v0.0.5.tar.gz" + sha256: "bc506d4b7836a7689b1c6a2d89bb0c3441f774c8f845fef79d85c71099df5bf9" diff --git a/recipes/confu_json/all/conanfile.py b/recipes/confu_json/all/conanfile.py index e2414377fc1df..3137417ca016a 100644 --- a/recipes/confu_json/all/conanfile.py +++ b/recipes/confu_json/all/conanfile.py @@ -1,9 +1,14 @@ -from conan import ConanFile, tools +from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.51.1" -required_conan_version = ">=1.50.0" class ConfuJson(ConanFile): name = "confu_json" @@ -12,64 +17,71 @@ class ConfuJson(ConanFile): topics = ("json parse", "serialization", "user defined type") license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" - settings = "compiler" + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _minimum_cpp_standard(self): - return 20 + def _min_cppstd(self): + return "20" if Version(self.version) < "1.0.0" else "17" @property - def _minimum_compilers_version(self): + def _compilers_minimum_version(self): return { - "Visual Studio": "17", - "gcc": "10", - "clang": "10", - } + "17": { + "Visual Studio": "17", + "msvc": "193", + "gcc": "7", + "clang": "7", + }, + "20": { + "Visual Studio": "17", + "msvc": "193", + "gcc": "10", + "clang": "10", + }, + }.get(self._min_cppstd, {}) + def layout(self): + basic_layout(self, src_folder="src") - - def configure(self): - if is_msvc(self) and Version(self.version) < "0.0.9": - raise ConanInvalidConfiguration( - "Visual Studio is not supported in versions before confu_json/0.0.9") + def requirements(self): + self.requires("boost/1.81.0") + self.requires("magic_enum/0.8.2") + + def package_id(self): + self.info.clear() + + def validate(self): if self.settings.compiler == "apple-clang": - raise ConanInvalidConfiguration( - "apple-clang is not supported. Pull request welcome") + raise ConanInvalidConfiguration("apple-clang is not supported. Pull request welcome") + + if self.settings.compiler == "gcc" and Version(self.version) < "1.0.0": + raise ConanInvalidConfiguration("gcc is only supported in versions greater than or equal 1.0.0.") + + if is_msvc(self) and Version(self.version) < "0.0.9": + raise ConanInvalidConfiguration("Visual Studio is not supported in versions before confu_json/0.0.9") + if self.settings.compiler.get_safe("cppstd"): - tools.build.check_min_cppstd(self, self._minimum_cpp_standard) - - min_version = self._minimum_compilers_version.get( - str(self.settings.compiler)) - if not min_version: - self.output.warn("{} recipe lacks information about the {} " - "compiler support.".format( - self.name, self.settings.compiler)) - else: - if Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration( - "{} requires C++{} support. " - "The current compiler {} {} does not support it.".format( - self.name, self._minimum_cpp_standard, - self.settings.compiler, - self.settings.compiler.version)) + check_min_cppstd(self, self._min_cppstd) - def requirements(self): - self.requires("boost/1.79.0") - self.requires("magic_enum/0.8.0") + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + pass def package(self): - self.copy("*.h*", dst="include/confu_json", - src="source_subfolder/confu_json") - self.copy("*LICENSE.md", dst="licenses", keep_path=False) + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h*", src=os.path.join(self.source_folder, "confu_json"), + dst=os.path.join(self.package_folder, "include", "confu_json")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/confu_json/all/test_package/CMakeLists.txt b/recipes/confu_json/all/test_package/CMakeLists.txt index 1090ad8b4fc01..cbb13e9d5f0af 100644 --- a/recipes/confu_json/all/test_package/CMakeLists.txt +++ b/recipes/confu_json/all/test_package/CMakeLists.txt @@ -1,9 +1,12 @@ -cmake_minimum_required(VERSION 3.5) -project(test_package CXX) +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(confu_json REQUIRED CONFIG) -add_executable(${PROJECT_NAME} example.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::confu_json) -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE confu_json::confu_json) +if(confu_json_VERSION VERSION_LESS "1.0.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/confu_json/all/test_package/conanfile.py b/recipes/confu_json/all/test_package/conanfile.py index b63178709d69f..0a6bc68712d90 100644 --- a/recipes/confu_json/all/test_package/conanfile.py +++ b/recipes/confu_json/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/confu_json/all/test_package/example.cpp b/recipes/confu_json/all/test_package/test_package.cpp similarity index 100% rename from recipes/confu_json/all/test_package/example.cpp rename to recipes/confu_json/all/test_package/test_package.cpp diff --git a/recipes/confu_json/all/test_v1_package/CMakeLists.txt b/recipes/confu_json/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/confu_json/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/confu_json/all/test_v1_package/conanfile.py b/recipes/confu_json/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/confu_json/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/confu_json/config.yml b/recipes/confu_json/config.yml index e2a064596ba3a..337baede02ad0 100644 --- a/recipes/confu_json/config.yml +++ b/recipes/confu_json/config.yml @@ -1,5 +1,9 @@ versions: - 0.0.5: + "1.0.0": folder: all - 0.0.9: + "0.0.10": + folder: all + "0.0.9": + folder: all + "0.0.5": folder: all diff --git a/recipes/continuable/all/conandata.yml b/recipes/continuable/all/conandata.yml index b1c9fe04e8ebc..13887549bde39 100644 --- a/recipes/continuable/all/conandata.yml +++ b/recipes/continuable/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.2.1": + url: "https://github.com/Naios/continuable/archive/4.2.1.tar.gz" + sha256: "19c7c2371c94ec759eac8169dea593703b54057551322b5d682643548c9c0146" "4.2.0": url: "https://github.com/Naios/continuable/archive/4.2.0.tar.gz" sha256: "d85bed930ac19d4b36b23778ad9ae943c2981f7492982bd51dadb89e8908d53f" diff --git a/recipes/continuable/config.yml b/recipes/continuable/config.yml index 71d2cb6211de6..52fa67bcd41e8 100644 --- a/recipes/continuable/config.yml +++ b/recipes/continuable/config.yml @@ -1,4 +1,6 @@ versions: + "4.2.1": + folder: all "4.2.0": folder: all "4.1.0": diff --git a/recipes/cpp-httplib/all/conandata.yml b/recipes/cpp-httplib/all/conandata.yml index 2a7b5fcfca17d..5795dfd52e66a 100644 --- a/recipes/cpp-httplib/all/conandata.yml +++ b/recipes/cpp-httplib/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "0.12.0": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.12.0.tar.gz" + sha256: "423900c9a124b88c406cd34aba08c9e60742e477a02bd29051cf0ecbf9ef0c65" + "0.11.4": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.11.4.tar.gz" + sha256: "28f76b875a332fb80972c3212980c963f0a7d2e11a8fe94a8ed0d847b9a2256f" + "0.11.3": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.11.3.tar.gz" + sha256: "799b2daa0441d207f6cd1179ae3a34869722084a434da6614978be1682c1e12d" + "0.11.2": + url: "https://github.com/yhirose/cpp-httplib/archive/v0.11.2.tar.gz" + sha256: "e620d030215733c4831fdc7813d5eb37a6fd599f8192a730662662e1748a741b" "0.11.1": url: "https://github.com/yhirose/cpp-httplib/archive/v0.11.1.tar.gz" sha256: "1ce2f0393ba779ec34885c5cd937141b4b5b730e2bc2efc34eb8554289c24d61" @@ -8,24 +20,6 @@ sources: "0.10.9": url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.9.tar.gz" sha256: "95ac0740ef760829a079c01a44164fd74af3fdc0748a40fc6beefd0276fd2345" - "0.10.8": - url: "https://github.com/yhirose/cpp-httplib/archive/v0.10.8.tar.gz" - sha256: "2959ae3669e34ca8934dfe066cd72fc2bfff44ba53bfc26f3b2cb81ed664ca0d" - "0.10.7": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.7.tar.gz" - sha256: "f89e2e74f64821f3cd925750dcee5dde7160600b1122e692253a4ebed8e1b1b1" - "0.10.6": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.6.tar.gz" - sha256: "c9024e1f41881f28ca276f0f35c1916eb34dab8c52b6aa32a3c360d4e40eb440" - "0.10.4": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.4.tar.gz" - sha256: "7719ff9f309c807dd8a574048764836b6a12bcb7d6ae9e129e7e4289cfdb4bd4" - "0.10.3": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.3.tar.gz" - sha256: "2c02fe6bca8407fb260944ecca68de367475e7221912b104f882c278b46d4776" - "0.10.1": - url: "https://github.com/yhirose/cpp-httplib/archive/refs/tags/v0.10.1.tar.gz" - sha256: "c3fb2019ed77482681b80b9a5d74ddf49df61a024703be1a5379b28fa13dfa2f" "0.9.10": url: "https://github.com/yhirose/cpp-httplib/archive/v0.9.10.tar.gz" sha256: "49dfa101ced75f8536ec7c865f872ab8fca157c8b49e29be5ef2d2aa11f716e8" @@ -38,6 +32,3 @@ sources: "0.6.6": url: "https://github.com/yhirose/cpp-httplib/archive/v0.6.6.tar.gz" sha256: "35bcc6a3f9612feb92b2153c5e56389ccc1ab46c7ba8781b873a5c2e249eb610" - "0.5.13": - url: "https://github.com/yhirose/cpp-httplib/archive/v0.5.13.tar.gz" - sha256: "a19af3488089a6ed9f5bf4868893d2e2262f5ebab831dd5f8cf2843e8b48b231" diff --git a/recipes/cpp-httplib/all/conanfile.py b/recipes/cpp-httplib/all/conanfile.py index 6aed8f9bb2dcc..a7013c9e5b6b7 100644 --- a/recipes/cpp-httplib/all/conanfile.py +++ b/recipes/cpp-httplib/all/conanfile.py @@ -12,10 +12,9 @@ class CpphttplibConan(ConanFile): name = "cpp-httplib" description = "A C++11 single-file header-only cross platform HTTP/HTTPS library." license = "MIT" - topics = ("cpp-httplib", "http", "https", "header-only") homepage = "https://github.com/yhirose/cpp-httplib" url = "https://github.com/conan-io/conan-center-index" - + topics = ("http", "https", "header-only") settings = "os", "arch", "compiler", "build_type" options = { "with_openssl": [True, False], @@ -27,7 +26,6 @@ class CpphttplibConan(ConanFile): "with_zlib": False, "with_brotli": False, } - no_copy_source = True def config_options(self): @@ -36,9 +34,9 @@ def config_options(self): def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.get_safe("with_brotli"): self.requires("brotli/1.0.9") @@ -53,8 +51,7 @@ def layout(self): basic_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -68,9 +65,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "httplib::httplib") self.cpp_info.includedirs.append(os.path.join("include", "httplib")) self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] if self.options.with_openssl: self.cpp_info.defines.append("CPPHTTPLIB_OPENSSL_SUPPORT") if self.options.with_zlib: diff --git a/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt b/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt index 72809bb080c2c..be00a8c7f57c7 100644 --- a/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt +++ b/recipes/cpp-httplib/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(httplib REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE httplib::httplib) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cpp-httplib/config.yml b/recipes/cpp-httplib/config.yml index 80b45ad7c194c..784320dbc7cf5 100644 --- a/recipes/cpp-httplib/config.yml +++ b/recipes/cpp-httplib/config.yml @@ -1,21 +1,17 @@ versions: - "0.11.1": - folder: all - "0.11.0": - folder: all - "0.10.9": + "0.12.0": folder: all - "0.10.8": + "0.11.4": folder: all - "0.10.7": + "0.11.3": folder: all - "0.10.6": + "0.11.2": folder: all - "0.10.4": + "0.11.1": folder: all - "0.10.3": + "0.11.0": folder: all - "0.10.1": + "0.10.9": folder: all "0.9.10": folder: all @@ -25,5 +21,3 @@ versions: folder: all "0.6.6": folder: all - "0.5.13": - folder: all diff --git a/recipes/cpp-jwt/all/conandata.yml b/recipes/cpp-jwt/all/conandata.yml index e953202e01124..a1d76536a0ad6 100644 --- a/recipes/cpp-jwt/all/conandata.yml +++ b/recipes/cpp-jwt/all/conandata.yml @@ -1,20 +1,17 @@ sources: "1.4": - url: "https://github.com/arun11299/cpp-jwt/archive/v1.4.tar.gz" + url: "https://github.com/arun11299/cpp-jwt/archive/refs/tags/v1.4.tar.gz" sha256: "1cb8039ee15bf9bf735c26082d7ff50c23d2886d65015dd6b0668c65e17dd20f" "1.3": - url: "https://github.com/arun11299/cpp-jwt/archive/v1.3.tar.gz" + url: "https://github.com/arun11299/cpp-jwt/archive/refs/tags/v1.3.tar.gz" sha256: "792889f08dd1acbc14129d11e013f9ef46e663c545ea366dd922402d8becbe05" "1.2": - sha256: 5d0102d182c48ef520f3fb15412fbaa67e002e1bf90b3ba45d5a2c7f850371f7 - url: https://github.com/arun11299/cpp-jwt/archive/v1.2.tar.gz + url: "https://github.com/arun11299/cpp-jwt/archive/refs/tags/v1.2.tar.gz" + sha256: "5d0102d182c48ef520f3fb15412fbaa67e002e1bf90b3ba45d5a2c7f850371f7" patches: "1.4": - patch_file: "patches/001-fix-msvc-14-compilation.patch" - base_path: "source_subfolder" + - patch_file: "patches/001-fix-msvc-14-compilation.patch" "1.3": - patch_file: "patches/001-fix-msvc-14-compilation.patch" - base_path: "source_subfolder" + - patch_file: "patches/001-fix-msvc-14-compilation.patch" "1.2": - patch_file: "patches/001-fix-msvc-14-compilation.patch" - base_path: "source_subfolder" + - patch_file: "patches/001-fix-msvc-14-compilation.patch" diff --git a/recipes/cpp-jwt/all/conanfile.py b/recipes/cpp-jwt/all/conanfile.py index 15d3831c62337..a9da0afcb17e4 100644 --- a/recipes/cpp-jwt/all/conanfile.py +++ b/recipes/cpp-jwt/all/conanfile.py @@ -1,74 +1,92 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -from conans.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.52.0" class CppJwtConan(ConanFile): name = "cpp-jwt" - homepage = "https://github.com/arun11299/cpp-jwt" description = "A C++ library for handling JWT tokens" + license = "MIT" topics = ("jwt", "auth", "header-only") + homepage = "https://github.com/arun11299/cpp-jwt" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "arch", "build_type" - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - exports_sources = ["patches/*"] - license = "MIT" - _cmake = None + package_type = "header-library" + settings = "os", "arch", "compiler", "build_type" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" - def requirements(self): - self.requires("openssl/1.1.1d") - self.requires("nlohmann_json/3.7.3") - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def configure(self): - minimal_cpp_standard = "14" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) - - minimal_version = { + @property + def _compilers_minimum_version(self): + return { "gcc": "6.4", "clang": "5", "apple-clang": "10", - "Visual Studio": "15" + "Visual Studio": "15", + "msvc": "191", } - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - return + def export_sources(self): + export_conandata_patches(self) - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("nlohmann_json/3.11.2") + self.requires("openssl/1.1.1s") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["CPP_JWT_BUILD_EXAMPLES"] = False - self._cmake.definitions["CPP_JWT_BUILD_TESTS"] = False - self._cmake.definitions["CPP_JWT_USE_VENDORED_NLOHMANN_JSON"] = False - self._cmake.configure(source_folder=self._source_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CPP_JWT_BUILD_EXAMPLES"] = False + tc.variables["CPP_JWT_BUILD_TESTS"] = False + tc.variables["CPP_JWT_USE_VENDORED_NLOHMANN_JSON"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - tools.patch(**self.conan_data["patches"][self.version]) - self.copy(pattern="LICENSE*", dst="licenses", - src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "cpp-jwt") + self.cpp_info.set_property("cmake_target_name", "cpp-jwt::cpp-jwt") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/cpp-jwt/all/test_package/CMakeLists.txt b/recipes/cpp-jwt/all/test_package/CMakeLists.txt index 8f3cb08b1e7ce..5141de159bdfd 100644 --- a/recipes/cpp-jwt/all/test_package/CMakeLists.txt +++ b/recipes/cpp-jwt/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(cpp-jwt REQUIRED) +find_package(cpp-jwt REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} cpp-jwt::cpp-jwt) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE cpp-jwt::cpp-jwt) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/cpp-jwt/all/test_package/conanfile.py b/recipes/cpp-jwt/all/test_package/conanfile.py index 2c802f70e1728..98ab55852ad56 100644 --- a/recipes/cpp-jwt/all/test_package/conanfile.py +++ b/recipes/cpp-jwt/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpp-jwt/all/test_v1_package/CMakeLists.txt b/recipes/cpp-jwt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cpp-jwt/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cpp-jwt/all/test_v1_package/conanfile.py b/recipes/cpp-jwt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cpp-jwt/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cpp-lazy/all/conandata.yml b/recipes/cpp-lazy/all/conandata.yml new file mode 100644 index 0000000000000..84cceb8cee130 --- /dev/null +++ b/recipes/cpp-lazy/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "7.0.2": + url: "https://github.com/MarcDirven/cpp-lazy/releases/download/v7.0.2/cpp-lazy-src.zip" + sha256: "fb6dd0870e07050f9e0bba3ddb5f53ee35d8d9a05987f73cb0d667ca1f8348aa" + "6.0.0": + url: "https://github.com/MarcDirven/cpp-lazy/releases/download/v6.0.0/cpp-lazy-src.zip" + sha256: "424973eabaab8c756dae5e1795febeface65bb1dc42f474e5e2e1e4ab3effc5e" +patches: + "6.0.0": + - patch_file: "patches/0001-support-gcc5.patch" + patch_description: "fix compilation errors on gcc5" + patch_type: "portability" + patch_source: "https://github.com/MarcDirven/cpp-lazy/issues/133" diff --git a/recipes/cpp-lazy/all/conanfile.py b/recipes/cpp-lazy/all/conanfile.py new file mode 100644 index 0000000000000..431ebcb132c22 --- /dev/null +++ b/recipes/cpp-lazy/all/conanfile.py @@ -0,0 +1,59 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +import os + +required_conan_version = ">=1.52.0" + +class CpplazyConan(ConanFile): + name = "cpp-lazy" + description = "C++11/14/17/20 library for lazy evaluation " + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/MarcDirven/cpp-lazy" + topics = ("lazy evaluation", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "14.0": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support apple-clang < 14.0.") + + def source(self): + get(self, **self.conan_data["sources"][self.version]) + + def build(self): + apply_conandata_patches(self) + + def package(self): + copy(self, pattern="LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/cpp-lazy/all/patches/0001-support-gcc5.patch b/recipes/cpp-lazy/all/patches/0001-support-gcc5.patch new file mode 100644 index 0000000000000..578428158ca2b --- /dev/null +++ b/recipes/cpp-lazy/all/patches/0001-support-gcc5.patch @@ -0,0 +1,297 @@ +diff --git a/include/Lz/FunctionTools.hpp b/include/Lz/FunctionTools.hpp +index 5beebed..9b1e3c7 100644 +--- a/include/Lz/FunctionTools.hpp ++++ b/include/Lz/FunctionTools.hpp +@@ -91,7 +91,7 @@ LZ_NODISCARD StringSplitter lines(const String& string) + * @return The result of the sum from [from, upToAndIncluding] + */ + template +-LZ_NODISCARD constexpr T sumTo(const T from, const T upToAndIncluding) { ++LZ_NODISCARD LZ_CONSTEXPR_CXX_14 T sumTo(const T from, const T upToAndIncluding) { + static_assert(std::is_integral::value, "T must be integral type"); + const T fromAbs = from < 0 ? -from : from; + const T toAbs = upToAndIncluding < 0 ? -upToAndIncluding : upToAndIncluding; +@@ -114,7 +114,7 @@ LZ_NODISCARD constexpr T sumTo(const T from, const T upToAndIncluding) { + * @return The result of the sum from [0, upToAndIncluding] + */ + template +-LZ_NODISCARD constexpr T sumTo(const T upToAndIncluding) { ++LZ_NODISCARD LZ_CONSTEXPR_CXX_14 T sumTo(const T upToAndIncluding) { + return lz::sumTo(0, upToAndIncluding); + } + +@@ -1241,7 +1241,7 @@ bool startsWith(IteratorA beginA, IteratorA endA, IteratorB beginB, IteratorB en + return std::search(std::move(beginA), std::move(endA), std::move(beginB), std::move(endB), std::move(compare)) != endA; + } + +-template)> ++template)> + bool startsWith(const IterableA& a, const IterableB& b, BinaryPredicate compare = {}) { + return lz::startsWith(std::begin(a), std::end(a), std::begin(b), std::end(b), std::move(compare)); + } +@@ -1255,7 +1255,7 @@ bool endsWith(IteratorA beginA, IteratorA endA, IteratorB beginB, IteratorB endB + return lz::startsWith(std::move(revBegA), std::move(revEndA), std::move(revBegB), std::move(revEndB), std::move(compare)); + } + +-template)> ++template)> + bool endsWith(const IterableA& a, const IterableB& b, BinaryPredicate compare = {}) { + return lz::endsWith(std::begin(a), std::end(a), std::begin(b), std::end(b), std::move(compare)); + } +diff --git a/include/Lz/Zip.hpp b/include/Lz/Zip.hpp +index a3e1560..95c6cf5 100644 +--- a/include/Lz/Zip.hpp ++++ b/include/Lz/Zip.hpp +@@ -15,7 +15,7 @@ Tuple createFakeEnd(const Tuple& begin, Tuple end, IndexSequence) { + // If we use begin + smallestLength, we get compile errors for non random access iterators. However, we know that we are + // dealing with a random access iterator, so std::next does a + internally. It is implemented this way to prevent more + // enable_if's from appearing +- return { std::next(std::get(begin), smallestLength)... }; ++ return Tuple{ std::next(std::get(begin), smallestLength)... }; + } + } // namespace internal + +diff --git a/include/Lz/detail/BasicIteratorView.hpp b/include/Lz/detail/BasicIteratorView.hpp +index 176f878..b5cbff1 100644 +--- a/include/Lz/detail/BasicIteratorView.hpp ++++ b/include/Lz/detail/BasicIteratorView.hpp +@@ -641,7 +641,7 @@ view(Iterable&& iterable) { + template)> + bool equal(const IterableA& a, const IterableB& b, BinaryPredicate predicate = {}) { +- return std::equal(std::begin(a), std::end(a), std::begin(b), std::end(b), std::move(predicate)); ++ return std::equal(std::begin(a), std::end(a), std::begin(b), std::move(predicate)); + } + # else // ^^^ !LZ_HAS_EXECUTION vvv LZ_HAS_EXECUTION + /** +diff --git a/include/Lz/detail/CartesianProductIterator.hpp b/include/Lz/detail/CartesianProductIterator.hpp +index 554e75c..3c63d90 100644 +--- a/include/Lz/detail/CartesianProductIterator.hpp ++++ b/include/Lz/detail/CartesianProductIterator.hpp +@@ -209,7 +209,7 @@ private: + + template + LZ_CONSTEXPR_CXX_20 reference dereference(IndexSequence) const { +- return { *std::get(_iterator)... }; ++ return reference{ *std::get(_iterator)... }; + } + + template +diff --git a/include/Lz/detail/FunctionContainer.hpp b/include/Lz/detail/FunctionContainer.hpp +index c08d9ff..7b721a2 100644 +--- a/include/Lz/detail/FunctionContainer.hpp ++++ b/include/Lz/detail/FunctionContainer.hpp +@@ -28,7 +28,7 @@ class FunctionContainer { + _isConstructed = true; + } + +- constexpr void reset() noexcept { ++ LZ_CONSTEXPR_CXX_14 void reset() noexcept { + if (_isConstructed) { + _func.~Func(); + _isConstructed = false; +diff --git a/include/Lz/detail/LzTools.hpp b/include/Lz/detail/LzTools.hpp +index 919688a..8f57dce 100644 +--- a/include/Lz/detail/LzTools.hpp ++++ b/include/Lz/detail/LzTools.hpp +@@ -223,6 +223,8 @@ using Decay = typename std::decay::type; + + template + using TupleElement = typename std::tuple_element::type; ++ ++# define MAKE_BIN_OP(OP, VALUE_TYPE) OP + # else // ^^^ has cxx 11 vvv cxx > 11 + template + using IndexSequence = std::index_sequence; +@@ -364,7 +366,7 @@ template + struct IsRandomAccess : IsRandomAccessTag> {}; + + template +-inline constexpr bool isEven(const Arithmetic value) noexcept { ++LZ_CONSTEXPR_CXX_14 bool isEven(const Arithmetic value) noexcept { + return (value % 2) == 0; + } + +@@ -373,7 +375,7 @@ inline constexpr void decompose(const Ts&...) noexcept { + } + + template +-inline constexpr Arithmetic roundEven(const Arithmetic a, const Arithmetic b) noexcept { ++LZ_CONSTEXPR_CXX_14 Arithmetic roundEven(const Arithmetic a, const Arithmetic b) noexcept { + LZ_ASSERT(a != 0 && b != 0, "division by zero error"); + if (b == 1) { + return a; +diff --git a/include/Lz/detail/Optional.hpp b/include/Lz/detail/Optional.hpp +index 12bbf3f..885a50a 100644 +--- a/include/Lz/detail/Optional.hpp ++++ b/include/Lz/detail/Optional.hpp +@@ -39,7 +39,7 @@ public: + constexpr Optional(U&& value) : _value(std::forward(value)), _hasValue(true) { + } + +- constexpr Optional(Optional&& right) noexcept(noexcept(construct(std::move(right.value())))) { ++ LZ_CONSTEXPR_CXX_14 Optional(Optional&& right) noexcept { + if (right) { + construct(std::move(right.value())); + } +@@ -55,7 +55,7 @@ public: + } + + template +- constexpr Optional& ++ LZ_CONSTEXPR_CXX_14 Optional& + operator=(U&& value) noexcept { + if (_hasValue) { + _value = std::forward(value); +@@ -70,35 +70,35 @@ public: + return _hasValue; + } + +- constexpr const T& value() const { ++ LZ_CONSTEXPR_CXX_14 const T& value() const { + if (_hasValue) { + return _value; + } + throw std::runtime_error("Cannot get uninitialized optional"); + } + +- constexpr T& value() { ++ LZ_CONSTEXPR_CXX_14 T& value() { + if (_hasValue) { + return _value; + } + throw std::runtime_error("Cannot get uninitialized optional"); + } + +- constexpr T& operator*() noexcept { ++ LZ_CONSTEXPR_CXX_14 T& operator*() noexcept { + return _value; + } + +- constexpr const T& operator*() const noexcept { ++ LZ_CONSTEXPR_CXX_14 const T& operator*() const noexcept { + return _value; + } + + template +- constexpr T value_or(U&& v) const& { ++ LZ_CONSTEXPR_CXX_14 T value_or(U&& v) const& { + return bool(*this) ? this->value() : static_cast(std::forward(v)); + } + + template +- constexpr T value_or(U&& v) && { ++ LZ_CONSTEXPR_CXX_14 T value_or(U&& v) && { + return bool(*this) ? std::move(this->value()) : static_cast(std::forward(v)); + } + }; +diff --git a/include/Lz/detail/RangeIterator.hpp b/include/Lz/detail/RangeIterator.hpp +index 34ca280..7be29b2 100644 +--- a/include/Lz/detail/RangeIterator.hpp ++++ b/include/Lz/detail/RangeIterator.hpp +@@ -25,7 +25,7 @@ EnableIf::value, std::ptrdiff_t> plusImpl(cons + } + + template +-constexpr EnableIf::value, std::ptrdiff_t> ++LZ_CONSTEXPR_CXX_14 EnableIf::value, std::ptrdiff_t> + plusImpl(const ValueType difference, const ValueType step) noexcept { + return static_cast(roundEven(difference, step)); + } +@@ -95,23 +95,23 @@ public: + return *(*this + offset); + } + +- constexpr RangeIterator& operator+=(const difference_type value) noexcept { ++ LZ_CONSTEXPR_CXX_14 RangeIterator& operator+=(const difference_type value) noexcept { + _iterator += static_cast(value) * _step; + return *this; + } + +- LZ_NODISCARD constexpr RangeIterator operator+(const difference_type value) const noexcept { ++ LZ_NODISCARD LZ_CONSTEXPR_CXX_14 RangeIterator operator+(const difference_type value) const noexcept { + RangeIterator tmp(*this); + tmp += value; + return tmp; + } + +- constexpr RangeIterator operator-=(const difference_type value) noexcept { ++ LZ_CONSTEXPR_CXX_14 RangeIterator operator-=(const difference_type value) noexcept { + _iterator -= static_cast(value) * _step; + return *this; + } + +- LZ_NODISCARD constexpr RangeIterator operator-(const difference_type value) const noexcept { ++ LZ_NODISCARD LZ_CONSTEXPR_CXX_14 RangeIterator operator-(const difference_type value) const noexcept { + RangeIterator tmp(*this); + tmp -= value; + return tmp; +diff --git a/include/Lz/detail/SplitIterator.hpp b/include/Lz/detail/SplitIterator.hpp +index e4e58a3..564632e 100644 +--- a/include/Lz/detail/SplitIterator.hpp ++++ b/include/Lz/detail/SplitIterator.hpp +@@ -26,12 +26,12 @@ class SplitIterator { + } + # else + template +- EnableIf::value, std::size_t> getDelimiterLength() const { ++ constexpr EnableIf::value, std::size_t> getDelimiterLength() const { + return 1; + } + + template +- EnableIf::value, std::size_t> getDelimiterLength() const { ++ LZ_CONSTEXPR_CXX_20 EnableIf::value, std::size_t> getDelimiterLength() const { + return _delimiter.length(); + } + # endif +@@ -70,12 +70,12 @@ public: + return FakePointerProxy(**this); + } + +- constexpr friend bool operator!=(const SplitIterator& a, const SplitIterator& b) noexcept { ++ LZ_CONSTEXPR_CXX_14 friend bool operator!=(const SplitIterator& a, const SplitIterator& b) noexcept { + LZ_ASSERT(a._delimiter == b._delimiter, "incompatible iterator types, found different delimiters"); + return a._currentPos != b._currentPos; + } + +- constexpr friend bool operator==(const SplitIterator& a, const SplitIterator& b) noexcept { ++ LZ_CONSTEXPR_CXX_14 friend bool operator==(const SplitIterator& a, const SplitIterator& b) noexcept { + return !(a != b); // NOLINT + } + +diff --git a/include/Lz/detail/ZipIterator.hpp b/include/Lz/detail/ZipIterator.hpp +index 085c816..50e1668 100644 +--- a/include/Lz/detail/ZipIterator.hpp ++++ b/include/Lz/detail/ZipIterator.hpp +@@ -26,7 +26,7 @@ private: + + template + LZ_CONSTEXPR_CXX_20 reference dereference(IndexSequence) const { +- return { *std::get(_iterators)... }; ++ return reference{ *std::get(_iterators)... }; + } + + template +diff --git a/include/Lz/detail/ZipLongestIterator.hpp b/include/Lz/detail/ZipLongestIterator.hpp +index 2263cd9..4959996 100644 +--- a/include/Lz/detail/ZipLongestIterator.hpp ++++ b/include/Lz/detail/ZipLongestIterator.hpp +@@ -48,7 +48,7 @@ private: + + template + LZ_CONSTEXPR_CXX_20 value_type dereference(IndexSequence) const { +- return { dereferenceOne(std::get(_iterators), std::get(_end))... }; ++ return value_type{ dereferenceOne(std::get(_iterators), std::get(_end))... }; + } + + template +@@ -137,7 +137,7 @@ private: + + template + LZ_CONSTEXPR_CXX_20 value_type dereference(IndexSequence) const { +- return { dereferenceOne(std::get(_iterators), std::get(_end))... }; ++ return value_type{ dereferenceOne(std::get(_iterators), std::get(_end))... }; + } + + template diff --git a/recipes/cpp-lazy/all/test_package/CMakeLists.txt b/recipes/cpp-lazy/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..77fddb4fc3c4b --- /dev/null +++ b/recipes/cpp-lazy/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(cpp-lazy REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cpp-lazy::cpp-lazy) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cpp-lazy/all/test_package/conanfile.py b/recipes/cpp-lazy/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/cpp-lazy/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpp-lazy/all/test_package/test_package.cpp b/recipes/cpp-lazy/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..2fb082350a8e9 --- /dev/null +++ b/recipes/cpp-lazy/all/test_package/test_package.cpp @@ -0,0 +1,13 @@ +#include + +#define LZ_STANDALONE +#include + +int main() { + std::array arr = {1, 2, 3, 4}; + std::string result = lz::map(arr, [](int i) { return i + 1; }).toString(" "); // == "2 3 4 5" + + std::cout << result << "\n"; + + return 0; +} diff --git a/recipes/cpp-lazy/all/test_v1_package/CMakeLists.txt b/recipes/cpp-lazy/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/cpp-lazy/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cpp-lazy/all/test_v1_package/conanfile.py b/recipes/cpp-lazy/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/cpp-lazy/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cpp-lazy/config.yml b/recipes/cpp-lazy/config.yml new file mode 100644 index 0000000000000..3001babefa7f1 --- /dev/null +++ b/recipes/cpp-lazy/config.yml @@ -0,0 +1,5 @@ +versions: + "7.0.2": + folder: all + "6.0.0": + folder: all diff --git a/recipes/cpp-optparse/all/conanfile.py b/recipes/cpp-optparse/all/conanfile.py index 4eddbf4e8f909..89caa73425148 100644 --- a/recipes/cpp-optparse/all/conanfile.py +++ b/recipes/cpp-optparse/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class CppOptparseConan(ConanFile): @@ -14,6 +14,7 @@ class CppOptparseConan(ConanFile): description = "Python's excellent OptionParser in C++" topics = ("cpp-optparse", "argument", "parsing") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -32,14 +33,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -58,3 +58,5 @@ def package(self): def package_info(self): self.cpp_info.libs = ["OptionParser"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/cpp-optparse/all/test_package/conanfile.py b/recipes/cpp-optparse/all/test_package/conanfile.py index d1d4c5276c22f..0a2443da94e9c 100644 --- a/recipes/cpp-optparse/all/test_package/conanfile.py +++ b/recipes/cpp-optparse/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(f"{bin_path} --help", env="conanrun") diff --git a/recipes/cpp-optparse/all/test_v1_package/CMakeLists.txt b/recipes/cpp-optparse/all/test_v1_package/CMakeLists.txt index 3b1318982f30f..0d20897301b68 100644 --- a/recipes/cpp-optparse/all/test_v1_package/CMakeLists.txt +++ b/recipes/cpp-optparse/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(cpp-optparse REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE cpp-optparse::cpp-optparse) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cpp-peglib/1.x.x/conandata.yml b/recipes/cpp-peglib/1.x.x/conandata.yml index 192ad7d819240..08e29671dff3e 100644 --- a/recipes/cpp-peglib/1.x.x/conandata.yml +++ b/recipes/cpp-peglib/1.x.x/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.8.2": + url: "https://github.com/yhirose/cpp-peglib/archive/v1.8.2.tar.gz" + sha256: "eca5d06dafb940ffee8a99060a57272ada7f2486fc21ed1663e4e49851a70e0c" + "1.8.1": + url: "https://github.com/yhirose/cpp-peglib/archive/v1.8.1.tar.gz" + sha256: "15d7c39d01780bb6f27db511722936d82d04cb1f5a6c63025021ff5dfe5fe1b2" "1.8.0": url: "https://github.com/yhirose/cpp-peglib/archive/refs/tags/v1.8.0.tar.gz" sha256: "63dc755afb5072ba58468fa39d1037ebadc1206c489b0493d635147524cf5379" diff --git a/recipes/cpp-peglib/1.x.x/conanfile.py b/recipes/cpp-peglib/1.x.x/conanfile.py index 6e5ba98921cbb..c700cd876b542 100644 --- a/recipes/cpp-peglib/1.x.x/conanfile.py +++ b/recipes/cpp-peglib/1.x.x/conanfile.py @@ -1,14 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, stdcpp_library from conan.tools.files import copy, get from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc from conan.tools.scm import Version -from conans import tools as tools_legacy import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class CpppeglibConan(ConanFile): @@ -18,6 +17,7 @@ class CpppeglibConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/yhirose/cpp-peglib" topics = ("peg", "parser", "header-only") + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -31,9 +31,12 @@ def _compilers_minimum_version(self): "Visual Studio": "15.7", "gcc": "7", "clang": "6", - "apple-clang": "10" + "apple-clang": "10", } + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): self.info.clear() @@ -50,19 +53,15 @@ def loose_lt_semver(v1, v2): minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration( - f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", ) if self.settings.compiler == "clang" and Version(self.settings.compiler.version) == "7" and \ - tools_legacy.stdcpp_library(self) == "stdc++": + stdcpp_library(self) == "stdc++": raise ConanInvalidConfiguration(f"{self.name} {self.version} does not support clang 7 with libstdc++.") - def layout(self): - basic_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -73,9 +72,7 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] self.cpp_info.cxxflags.append("-pthread") diff --git a/recipes/cpp-peglib/1.x.x/test_package/conanfile.py b/recipes/cpp-peglib/1.x.x/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/cpp-peglib/1.x.x/test_package/conanfile.py +++ b/recipes/cpp-peglib/1.x.x/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/cpp-peglib/1.x.x/test_v1_package/CMakeLists.txt b/recipes/cpp-peglib/1.x.x/test_v1_package/CMakeLists.txt index 71e37a553ede3..0d20897301b68 100644 --- a/recipes/cpp-peglib/1.x.x/test_v1_package/CMakeLists.txt +++ b/recipes/cpp-peglib/1.x.x/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(cpp-peglib CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE cpp-peglib::cpp-peglib) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cpp-peglib/config.yml b/recipes/cpp-peglib/config.yml index 6205ac1f0d16f..0c3a84819eed8 100644 --- a/recipes/cpp-peglib/config.yml +++ b/recipes/cpp-peglib/config.yml @@ -1,4 +1,8 @@ versions: + "1.8.2": + folder: "1.x.x" + "1.8.1": + folder: "1.x.x" "1.8.0": folder: "1.x.x" "1.6.1": diff --git a/recipes/cpp-sort/all/conandata.yml b/recipes/cpp-sort/all/conandata.yml index 517e6732e09cc..092fe59db4a19 100644 --- a/recipes/cpp-sort/all/conandata.yml +++ b/recipes/cpp-sort/all/conandata.yml @@ -1,34 +1,43 @@ sources: - "1.5.1": - sha256: 39925958dbd773f15d36d74d4ded48f075c05feef7fe604c7c5c4bfae2a4ec55 - url: https://github.com/Morwenn/cpp-sort/archive/1.5.1.tar.gz - "1.6.0": - sha256: df048d15ff555030eb90d3c96f560a75bbec8baee256f2ced647f359c892c9c8 - url: https://github.com/Morwenn/cpp-sort/archive/1.6.0.tar.gz - "1.7.0": - sha256: 4a8230be2c63a92395e140cb7e6593171638a41c46f4cd14d6ffc354ba830e2b - url: https://github.com/Morwenn/cpp-sort/archive/1.7.0.tar.gz + "1.14.0": + url: "https://github.com/Morwenn/cpp-sort/archive/1.14.0.tar.gz" + sha256: "3b85cd4580f54ae3f171777d0630b4f7c89c33cf96e9ae24a1dbebbf200c3195" + "1.13.2": + url: "https://github.com/Morwenn/cpp-sort/archive/1.13.2.tar.gz" + sha256: "f5384ed9c8abef2f26cb010df2687ac8bba52f0e1726935826a80e83c1347b23" + "1.13.1": + url: "https://github.com/Morwenn/cpp-sort/archive/1.13.1.tar.gz" + sha256: "139912c6004df8748bb1cfd3b94f2c6bfc2713885ed4b8e927a783d6b66963a8" + "1.13.0": + url: "https://github.com/Morwenn/cpp-sort/archive/1.13.0.tar.gz" + sha256: "646eca5c592d20cbde0fbff41c65527940bb6430be68e0224fb5fcbf38b0df92" + "1.12.1": + url: "https://github.com/Morwenn/cpp-sort/archive/1.12.1.tar.gz" + sha256: "5b0b6f3b4d9ecc339d6c2204a18479edca49fbc4d487413e0ec747e143569e2a" + "1.12.0": + url: "https://github.com/Morwenn/cpp-sort/archive/1.12.0.tar.gz" + sha256: "70877c1993fa1e5eb53974ac30aeb713448c206344379f193dec8ee887c23998" + "1.11.0": + url: "https://github.com/Morwenn/cpp-sort/archive/1.11.0.tar.gz" + sha256: "a53b3ea240d6f8d8ea9da0a7e0c8e313cf5e714daedf1617473ab34f111ffeec" + "1.10.0": + url: "https://github.com/Morwenn/cpp-sort/archive/1.10.0.tar.gz" + sha256: "48951cac0051d48fee286c3bc02804975f9d83269d80c10dfc5589e76a542765" + "1.9.0": + url: "https://github.com/Morwenn/cpp-sort/archive/1.9.0.tar.gz" + sha256: "e83f3daad30bd91fed668bdb56ad379c4aeea39d7dc640484fdcc55149b6d0e4" + "1.8.1": + url: "https://github.com/Morwenn/cpp-sort/archive/1.8.1.tar.gz" + sha256: "04d518dabb422614fcb4a2b4e258c515f31dd01d51c26e9eaaec76e77c4d3d40" "1.8.0": sha256: a3de426a66cffbe9f8865feb7518ff4f4d1b3aadf3725161b8e118dcbf6fe9b9 url: https://github.com/Morwenn/cpp-sort/archive/1.8.0.tar.gz - "1.8.1": - sha256: 04d518dabb422614fcb4a2b4e258c515f31dd01d51c26e9eaaec76e77c4d3d40 - url: https://github.com/Morwenn/cpp-sort/archive/1.8.1.tar.gz - "1.9.0": - sha256: e83f3daad30bd91fed668bdb56ad379c4aeea39d7dc640484fdcc55149b6d0e4 - url: https://github.com/Morwenn/cpp-sort/archive/1.9.0.tar.gz - "1.10.0": - sha256: 48951cac0051d48fee286c3bc02804975f9d83269d80c10dfc5589e76a542765 - url: https://github.com/Morwenn/cpp-sort/archive/1.10.0.tar.gz - "1.11.0": - sha256: a53b3ea240d6f8d8ea9da0a7e0c8e313cf5e714daedf1617473ab34f111ffeec - url: https://github.com/Morwenn/cpp-sort/archive/1.11.0.tar.gz - "1.12.0": - sha256: 70877c1993fa1e5eb53974ac30aeb713448c206344379f193dec8ee887c23998 - url: https://github.com/Morwenn/cpp-sort/archive/1.12.0.tar.gz - "1.12.1": - sha256: 5b0b6f3b4d9ecc339d6c2204a18479edca49fbc4d487413e0ec747e143569e2a - url: https://github.com/Morwenn/cpp-sort/archive/1.12.1.tar.gz - "1.13.0": - sha256: 646eca5c592d20cbde0fbff41c65527940bb6430be68e0224fb5fcbf38b0df92 - url: https://github.com/Morwenn/cpp-sort/archive/1.13.0.tar.gz + "1.7.0": + sha256: 4a8230be2c63a92395e140cb7e6593171638a41c46f4cd14d6ffc354ba830e2b + url: https://github.com/Morwenn/cpp-sort/archive/1.7.0.tar.gz + "1.6.0": + sha256: df048d15ff555030eb90d3c96f560a75bbec8baee256f2ced647f359c892c9c8 + url: https://github.com/Morwenn/cpp-sort/archive/1.6.0.tar.gz + "1.5.1": + sha256: 39925958dbd773f15d36d74d4ded48f075c05feef7fe604c7c5c4bfae2a4ec55 + url: https://github.com/Morwenn/cpp-sort/archive/1.5.1.tar.gz diff --git a/recipes/cpp-sort/all/conanfile.py b/recipes/cpp-sort/all/conanfile.py index 7b5b4eda80951..cfda199bf6a78 100644 --- a/recipes/cpp-sort/all/conanfile.py +++ b/recipes/cpp-sort/all/conanfile.py @@ -1,83 +1,105 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import os +import os.path -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + +required_conan_version = ">=1.50.0" class CppSortConan(ConanFile): name = "cpp-sort" description = "Additional sorting algorithms & related tools" - topics = "conan", "cpp-sort", "sorting", "algorithms" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Morwenn/cpp-sort" - license = "MIT" + topics = "cpp-sort", "sorting", "algorithms" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "os", "compiler", "build_type", "arch" - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _minimum_cpp_standard(self): return 14 @property - def _minimum_compilers_version(self): + def _compilers_minimum_version(self): return { + "Visual Studio": "16", + "msvc": "192", "apple-clang": "9.4", "clang": "3.8", - "gcc": "5.5", - "Visual Studio": "16" + "gcc": "5.5" } + def layout(self): + cmake_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + def validate(self): if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) + check_min_cppstd(self, self._minimum_cpp_standard) + + if is_msvc(self) and Version(self.version) < "1.10.0": + raise ConanInvalidConfiguration(f"{self.ref} versions older than 1.10.0 do not support MSVC") + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] - compiler = self.settings.compiler + compiler = str(self.settings.compiler) + version = str(self.settings.compiler.version) try: - min_version = self._minimum_compilers_version[str(compiler)] - if tools.Version(compiler.version) < min_version: + minimum_version = self._compilers_minimum_version[str(compiler)] + if minimum_version and loose_lt_semver(version, minimum_version): msg = ( - "{} requires C++{} features which are not supported by compiler {} {}." - ).format(self.name, self._minimum_cpp_standard, compiler, compiler.version) + f"{self.ref} requires C++{self._minimum_cpp_standard} features " + f"which are not supported by compiler {compiler} {version}." + ) raise ConanInvalidConfiguration(msg) except KeyError: msg = ( - "{} recipe lacks information about the {} compiler, " - "support for the required C++{} features is assumed" - ).format(self.name, compiler, self._minimum_cpp_standard) + f"{self.ref} recipe lacks information about the {compiler} compiler, " + f"support for the required C++{self._minimum_cpp_standard} features is assumed" + ) self.output.warn(msg) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = "OFF" + tc.generate() def package(self): # Install with CMake cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = "OFF" - cmake.configure(source_folder=self._source_subfolder) + cmake.configure() cmake.install() # Copy license files - if tools.Version(self.version) < "1.8.0": + if Version(self.version) < "1.8.0": license_files = ["license.txt"] else: license_files = ["LICENSE.txt", "NOTICE.txt"] for license_file in license_files: - self.copy(license_file, dst="licenses", src=self._source_subfolder) + copy(self, license_file, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) # Remove CMake config files (only files in lib) - tools.rmdir(os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "cpp-sort" - self.cpp_info.names["cmake_find_package_multi"] = "cpp-sort" - if self.settings.compiler == "Visual Studio": + self.cpp_info.set_property("cmake_file_name", "cpp-sort") + self.cpp_info.set_property("cmake_target_name", "cpp-sort::cpp-sort") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if is_msvc(self): self.cpp_info.cxxflags = ["/permissive-"] - - def package_id(self): - self.info.header_only() diff --git a/recipes/cpp-sort/all/test_package/CMakeLists.txt b/recipes/cpp-sort/all/test_package/CMakeLists.txt index 4ebb96b60a293..da13330ac49af 100644 --- a/recipes/cpp-sort/all/test_package/CMakeLists.txt +++ b/recipes/cpp-sort/all/test_package/CMakeLists.txt @@ -1,12 +1,9 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(cpp-sort REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} cpp-sort-integrity.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} cpp-sort::cpp-sort) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE cpp-sort::cpp-sort) +target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/cpp-sort/all/test_package/conanfile.py b/recipes/cpp-sort/all/test_package/conanfile.py index b6f0560ab0e48..3c57d0fcd9af8 100644 --- a/recipes/cpp-sort/all/test_package/conanfile.py +++ b/recipes/cpp-sort/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class CppsortTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt b/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2a9b48732268c --- /dev/null +++ b/recipes/cpp-sort/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cpp-sort/all/test_v1_package/conanfile.py b/recipes/cpp-sort/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b6f0560ab0e48 --- /dev/null +++ b/recipes/cpp-sort/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class CppsortTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cpp-sort/config.yml b/recipes/cpp-sort/config.yml index 4f77c5195cd73..c097db627e415 100644 --- a/recipes/cpp-sort/config.yml +++ b/recipes/cpp-sort/config.yml @@ -1,23 +1,29 @@ versions: - "1.5.1": + "1.14.0": folder: all - "1.6.0": + "1.13.2": folder: all - "1.7.0": + "1.13.1": folder: all - "1.8.0": + "1.13.0": folder: all - "1.8.1": + "1.12.1": folder: all - "1.9.0": + "1.12.0": + folder: all + "1.11.0": folder: all "1.10.0": folder: all - "1.11.0": + "1.9.0": folder: all - "1.12.0": + "1.8.1": folder: all - "1.12.1": + "1.8.0": folder: all - "1.13.0": + "1.7.0": + folder: all + "1.6.0": + folder: all + "1.5.1": folder: all diff --git a/recipes/cppbenchmark/all/CMakeLists.txt b/recipes/cppbenchmark/all/CMakeLists.txt deleted file mode 100644 index 73cf8b784328e..0000000000000 --- a/recipes/cppbenchmark/all/CMakeLists.txt +++ /dev/null @@ -1,25 +0,0 @@ -cmake_minimum_required(VERSION 3.13) -project(cmake_wrapper) - -include(${CMAKE_CURRENT_BINARY_DIR}/../conanbuildinfo.cmake) -conan_basic_setup() - -if(WIN32) - add_definitions (-D_CRT_SECURE_NO_WARNINGS) -endif() - -add_subdirectory("source_subfolder") - -conan_target_link_libraries(cppbenchmark) - -target_compile_features(cppbenchmark PUBLIC cxx_std_17) - -install(DIRECTORY source_subfolder/include/ - DESTINATION include - FILES_MATCHING - PATTERN "*.h" - PATTERN "*.inl") - -if(WIN32 AND BUILD_SHARED_LIBS) - set_target_properties(cppbenchmark PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) -endif() diff --git a/recipes/cppbenchmark/all/conandata.yml b/recipes/cppbenchmark/all/conandata.yml index 875ff0c920036..2873a6dc352ca 100644 --- a/recipes/cppbenchmark/all/conandata.yml +++ b/recipes/cppbenchmark/all/conandata.yml @@ -1,14 +1,23 @@ -patches: - "1.0.0.0": - - patch_file: "patches/00001-update-cmakelists.patch" - base_path: "source_subfolder" - "cci.20201029": - - patch_file: "patches/00001-update-cmakelists.patch" - base_path: "source_subfolder" sources: + "1.0.3.0": + url: "https://github.com/chronoxor/CppBenchmark/archive/1.0.3.0.tar.gz" + sha256: "6a62cfdb2aacf91523f74c6d0e42a3e2388ff94a2b7b983bec543c88554cc3e9" "1.0.0.0": url: "https://github.com/chronoxor/CppBenchmark/archive/1.0.0.0.tar.gz" sha256: "8c043731e979ef570e3744484e6644de6e47db228b9543ec6433401e4e2f09b8" "cci.20201029": url: "https://github.com/chronoxor/CppBenchmark/archive/8605a8e886647e964180cb7a622424404a1da01f.tar.gz" sha256: "f0b88802b4418b13c04ae4dfdb859b2cb81142a47ca473ad447a8be087e0adee" +patches: + "1.0.3.0": + - patch_file: "patches/1.0.3.0-0001-fix-cmake.patch" + patch_description: "fix install path, use cci packages, disable tests" + patch_type: "conan" + "1.0.0.0": + - patch_file: "patches/1.0.0.0-0001-fix-cmake.patch" + patch_description: "fix install path, use cci packages, disable tests" + patch_type: "conan" + "cci.20201029": + - patch_file: "patches/1.0.0.0-0001-fix-cmake.patch" + patch_description: "fix install path, use cci packages, disable tests" + patch_type: "conan" diff --git a/recipes/cppbenchmark/all/conanfile.py b/recipes/cppbenchmark/all/conanfile.py index ce5d440897a1f..46bffc2766e8d 100644 --- a/recipes/cppbenchmark/all/conanfile.py +++ b/recipes/cppbenchmark/all/conanfile.py @@ -1,34 +1,33 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -import glob +required_conan_version = ">=1.53.0" class CppBenchmark(ConanFile): name = "cppbenchmark" + description = "Performance benchmark framework for C++ with nanoseconds measure precision." license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/chronoxor/CppBenchmark" - description = "Performance benchmark framework for C++ with nanoseconds measure precision." - topics = ("conan", "utils", "library", "benchmark") - settings = "os", "compiler", "build_type", "arch" - options = {"fPIC": [True, False], - "shared": [True, False]} - default_options = {"fPIC": True, - "shared": False} - requires = ["hdrhistogram-c/0.11.1", "cpp-optparse/cci.20171104"] - generators = "cmake" - exports_sources = ["patches/**", "CMakeLists.txt"] - _cmake = None + topics = ("utils", "library", "benchmark") + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + "shared": [True, False], + } + default_options = { + "fPIC": True, + "shared": False, + } @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - + def _min_cppstd(self): + return 17 @property def _compilers_minimum_version(self): return { @@ -36,23 +35,11 @@ def _compilers_minimum_version(self): "clang": 6, "gcc": 7, "Visual Studio": 16, + "msvc": 191, } - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["CPPBENCHMARK_MODULE"] = "OFF" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("CppBenchmark-*")[0] - os.rename(extracted_dir, self._source_subfolder) + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -60,30 +47,62 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "17") + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("hdrhistogram-c/0.11.1") + self.requires("cpp-optparse/cci.20171104") + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("cppbenchmark requires C++17, which your compiler does not support.") - else: - self.output.warn("cppbenchmark requires C++17. Your compiler is unknown. Assuming it supports C++17.") + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if not self._cmake_new_enough("3.20"): + self.tool_requires("cmake/3.25.1") - def build(self): - self._patch() + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CPPBENCHMARK_MODULE"] = "OFF" + tc.generate() - cmake = self._configure_cmake() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["cppbenchmark"] if self.settings.os == "Linux": self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/cppbenchmark/all/patches/00001-update-cmakelists.patch b/recipes/cppbenchmark/all/patches/00001-update-cmakelists.patch deleted file mode 100644 index 5582805389690..0000000000000 --- a/recipes/cppbenchmark/all/patches/00001-update-cmakelists.patch +++ /dev/null @@ -1,89 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1db1778..1e19e9f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -18,25 +18,25 @@ if(DOXYGEN_FOUND) - endif() - - # CMake module path --set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -+# set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") - - # Compiler features --include(SetCompilerFeatures) --include(SetCompilerWarnings) --include(SetPlatformFeatures) --include(SystemInformation) -+# include(SetCompilerFeatures) -+# include(SetCompilerWarnings) -+# include(SetPlatformFeatures) -+# include(SystemInformation) - - # External packages - find_package(Threads REQUIRED) - - # Modules --add_subdirectory("modules") -+# add_subdirectory("modules") - - # Link libraries - list(APPEND LINKLIBS Threads::Threads) - - # System directories --include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/modules") -+# include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/modules") - - # Library - file(GLOB_RECURSE LIB_HEADER_FILES "include/*.h") -@@ -45,14 +45,14 @@ file(GLOB_RECURSE LIB_SOURCE_FILES "source/*.cpp") - add_library(cppbenchmark ${LIB_HEADER_FILES} ${LIB_INLINE_FILES} ${LIB_SOURCE_FILES}) - set_target_properties(cppbenchmark PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}" FOLDER "libraries") - target_include_directories(cppbenchmark PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") --target_link_libraries(cppbenchmark ${LINKLIBS} cpp-optparse HdrHistogram) -+target_link_libraries(cppbenchmark ${LINKLIBS}) - list(APPEND INSTALL_TARGETS cppbenchmark) - list(APPEND LINKLIBS cppbenchmark) - - # Additional module components: benchmarks, examples, plugins, tests, tools and install - if(NOT CPPBENCHMARK_MODULE) - -- # Examples -+if(FALSE) - file(GLOB EXAMPLE_HEADER_FILES "examples/*.h") - file(GLOB EXAMPLE_INLINE_FILES "examples/*.inl") - file(GLOB EXAMPLE_SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/examples" "examples/*.cpp") -@@ -65,8 +65,8 @@ if(NOT CPPBENCHMARK_MODULE) - list(APPEND INSTALL_TARGETS ${EXAMPLE_TARGET}) - list(APPEND INSTALL_TARGETS_PDB ${EXAMPLE_TARGET}) - endforeach() -- -- # Tests -+endif() -+if(FALSE) - file(GLOB TESTS_HEADER_FILES "tests/*.h") - file(GLOB TESTS_INLINE_FILES "tests/*.inl") - file(GLOB TESTS_SOURCE_FILES "tests/*.cpp") -@@ -80,17 +80,17 @@ if(NOT CPPBENCHMARK_MODULE) - # CTest - enable_testing() - add_test(cppbenchmark-tests cppbenchmark-tests --durations yes --order lex) -- -+endif() - # Install - install(TARGETS ${INSTALL_TARGETS} -- RUNTIME DESTINATION "${PROJECT_SOURCE_DIR}/bin" -- LIBRARY DESTINATION "${PROJECT_SOURCE_DIR}/bin" -- ARCHIVE DESTINATION "${PROJECT_SOURCE_DIR}/bin") -+ RUNTIME DESTINATION bin -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib) - - # Install *.pdb files -- if(MSVC) -+ if(MSVC AND FALSE) - foreach(INSTALL_TARGET_PDB ${INSTALL_TARGETS_PDB}) -- install(FILES $ DESTINATION "${PROJECT_SOURCE_DIR}/bin") -+ install(FILES $ DESTINATION bin OPTIONAL) - endforeach() - endif() - diff --git a/recipes/cppbenchmark/all/patches/1.0.0.0-0001-fix-cmake.patch b/recipes/cppbenchmark/all/patches/1.0.0.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..73ce64552f4a6 --- /dev/null +++ b/recipes/cppbenchmark/all/patches/1.0.0.0-0001-fix-cmake.patch @@ -0,0 +1,82 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 1db1778..0343a94 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -17,41 +17,41 @@ if(DOXYGEN_FOUND) + endif() + endif() + +-# CMake module path +-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +- +-# Compiler features +-include(SetCompilerFeatures) +-include(SetCompilerWarnings) +-include(SetPlatformFeatures) +-include(SystemInformation) +- + # External packages + find_package(Threads REQUIRED) + +-# Modules +-add_subdirectory("modules") +- + # Link libraries + list(APPEND LINKLIBS Threads::Threads) + +-# System directories +-include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/modules") +- + # Library ++find_package(hdr_histogram REQUIRED CONFIG) ++if(TARGET hdr_histogram::hdr_histogram) ++ list(APPEND LINKLIBS hdr_histogram::hdr_histogram) ++else() ++ list(APPEND LINKLIBS hdr_histogram::hdr_histogram_static) ++endif() ++ ++find_package(cpp-optparse REQUIRED CONFIG) ++list(APPEND LINKLIBS cpp-optparse::cpp-optparse) ++ ++ + file(GLOB_RECURSE LIB_HEADER_FILES "include/*.h") + file(GLOB_RECURSE LIB_INLINE_FILES "include/*.inl") + file(GLOB_RECURSE LIB_SOURCE_FILES "source/*.cpp") + add_library(cppbenchmark ${LIB_HEADER_FILES} ${LIB_INLINE_FILES} ${LIB_SOURCE_FILES}) + set_target_properties(cppbenchmark PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}" FOLDER "libraries") + target_include_directories(cppbenchmark PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") +-target_link_libraries(cppbenchmark ${LINKLIBS} cpp-optparse HdrHistogram) ++target_compile_definitions(cppbenchmark PUBLIC _CRT_SECURE_NO_WARNINGS) ++target_compile_features(cppbenchmark PUBLIC cxx_std_17) ++set_target_properties(cppbenchmark PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ++target_link_libraries(cppbenchmark ${LINKLIBS}) + list(APPEND INSTALL_TARGETS cppbenchmark) + list(APPEND LINKLIBS cppbenchmark) + + # Additional module components: benchmarks, examples, plugins, tests, tools and install + if(NOT CPPBENCHMARK_MODULE) + ++ if(0) + # Examples + file(GLOB EXAMPLE_HEADER_FILES "examples/*.h") + file(GLOB EXAMPLE_INLINE_FILES "examples/*.inl") +@@ -80,12 +80,16 @@ if(NOT CPPBENCHMARK_MODULE) + # CTest + enable_testing() + add_test(cppbenchmark-tests cppbenchmark-tests --durations yes --order lex) ++ endif() + + # Install + install(TARGETS ${INSTALL_TARGETS} +- RUNTIME DESTINATION "${PROJECT_SOURCE_DIR}/bin" +- LIBRARY DESTINATION "${PROJECT_SOURCE_DIR}/bin" +- ARCHIVE DESTINATION "${PROJECT_SOURCE_DIR}/bin") ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ ++ install(FILES ${LIB_HEADER_FILES} ${LIB_INLINE_FILES} ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/benchmark) + + # Install *.pdb files + if(MSVC) diff --git a/recipes/cppbenchmark/all/patches/1.0.3.0-0001-fix-cmake.patch b/recipes/cppbenchmark/all/patches/1.0.3.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..92f92dd44a822 --- /dev/null +++ b/recipes/cppbenchmark/all/patches/1.0.3.0-0001-fix-cmake.patch @@ -0,0 +1,82 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index a42103b..59309e8 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -17,41 +17,41 @@ if(DOXYGEN_FOUND) + endif() + endif() + +-# CMake module path +-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +- +-# Compiler features +-include(SetCompilerFeatures) +-include(SetCompilerWarnings) +-include(SetPlatformFeatures) +-include(SystemInformation) +- + # External packages + find_package(Threads REQUIRED) + +-# Modules +-add_subdirectory("modules") +- + # Link libraries + list(APPEND LINKLIBS Threads::Threads) + +-# System directories +-include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/modules") +- + # Library ++find_package(hdr_histogram REQUIRED CONFIG) ++if(TARGET hdr_histogram::hdr_histogram) ++ list(APPEND LINKLIBS hdr_histogram::hdr_histogram) ++else() ++ list(APPEND LINKLIBS hdr_histogram::hdr_histogram_static) ++endif() ++ ++find_package(cpp-optparse REQUIRED CONFIG) ++list(APPEND LINKLIBS cpp-optparse::cpp-optparse) ++ ++ + file(GLOB_RECURSE LIB_HEADER_FILES "include/*.h" "source/*.h") + file(GLOB_RECURSE LIB_INLINE_FILES "include/*.inl" "source/*.inl") + file(GLOB_RECURSE LIB_SOURCE_FILES "include/*.cpp" "source/*.cpp") + add_library(cppbenchmark ${LIB_HEADER_FILES} ${LIB_INLINE_FILES} ${LIB_SOURCE_FILES}) + set_target_properties(cppbenchmark PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}" FOLDER "libraries") + target_include_directories(cppbenchmark PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") +-target_link_libraries(cppbenchmark ${LINKLIBS} cpp-optparse HdrHistogram) ++target_compile_definitions(cppbenchmark PUBLIC _CRT_SECURE_NO_WARNINGS) ++target_compile_features(cppbenchmark PUBLIC cxx_std_17) ++set_target_properties(cppbenchmark PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ++target_link_libraries(cppbenchmark ${LINKLIBS}) + list(APPEND INSTALL_TARGETS cppbenchmark) + list(APPEND LINKLIBS cppbenchmark) + + # Additional module components: benchmarks, examples, plugins, tests, tools and install + if(NOT CPPBENCHMARK_MODULE) + ++ if(0) + # Examples + file(GLOB EXAMPLE_HEADER_FILES "examples/*.h") + file(GLOB EXAMPLE_INLINE_FILES "examples/*.inl") +@@ -80,12 +80,16 @@ if(NOT CPPBENCHMARK_MODULE) + # CTest + enable_testing() + add_test(cppbenchmark-tests cppbenchmark-tests --durations yes --order lex) ++ endif() + + # Install + install(TARGETS ${INSTALL_TARGETS} +- RUNTIME DESTINATION "${PROJECT_SOURCE_DIR}/bin" +- LIBRARY DESTINATION "${PROJECT_SOURCE_DIR}/bin" +- ARCHIVE DESTINATION "${PROJECT_SOURCE_DIR}/bin") ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ ++ install(FILES ${LIB_HEADER_FILES} ${LIB_INLINE_FILES} ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/benchmark) + + # Install *.pdb files + if(MSVC) diff --git a/recipes/cppbenchmark/all/test_package/CMakeLists.txt b/recipes/cppbenchmark/all/test_package/CMakeLists.txt index b5e26694a82fb..ba1f47741565b 100644 --- a/recipes/cppbenchmark/all/test_package/CMakeLists.txt +++ b/recipes/cppbenchmark/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(cppbenchmark REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -conan_target_link_libraries(${PROJECT_NAME}) - -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) +target_link_libraries(${PROJECT_NAME} PRIVATE cppbenchmark::cppbenchmark) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/cppbenchmark/all/test_package/conanfile.py b/recipes/cppbenchmark/all/test_package/conanfile.py index 4903f1a7e8fa0..a9fbb7f543162 100644 --- a/recipes/cppbenchmark/all/test_package/conanfile.py +++ b/recipes/cppbenchmark/all/test_package/conanfile.py @@ -1,9 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cppbenchmark/all/test_package/test_package.cpp b/recipes/cppbenchmark/all/test_package/test_package.cpp index 3a73a4748acc5..741ca9cb18204 100644 --- a/recipes/cppbenchmark/all/test_package/test_package.cpp +++ b/recipes/cppbenchmark/all/test_package/test_package.cpp @@ -1,12 +1,12 @@ #include "benchmark/cppbenchmark.h" -#include +#include // Benchmark sin() call for 1 seconds. // Make 1 attemtps and choose one with the best time result. BENCHMARK("sin", Settings().Duration(1).Operations(1).Attempts(1)) { - sin(123.456); + std::sin(123.456); } BENCHMARK_MAIN() diff --git a/recipes/cppbenchmark/all/test_v1_package/CMakeLists.txt b/recipes/cppbenchmark/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/cppbenchmark/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cppbenchmark/all/test_v1_package/conanfile.py b/recipes/cppbenchmark/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/cppbenchmark/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cppbenchmark/config.yml b/recipes/cppbenchmark/config.yml index d5be188752108..d05d94032be0f 100644 --- a/recipes/cppbenchmark/config.yml +++ b/recipes/cppbenchmark/config.yml @@ -1,5 +1,7 @@ versions: - "cci.20201029": + "1.0.3.0": folder: all "1.0.0.0": folder: all + "cci.20201029": + folder: all diff --git a/recipes/cppcheck/all/CMakeLists.txt b/recipes/cppcheck/all/CMakeLists.txt deleted file mode 100644 index b0b16ec6b271c..0000000000000 --- a/recipes/cppcheck/all/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - -# Set include paths -conan_global_flags() - -# Setup libraries to link -set(Z3_LIBRARIES CONAN_PKG::z3) -set(PCRE_LIBRARY CONAN_PKG::pcre) - -add_subdirectory(source_subfolder) diff --git a/recipes/cppcheck/all/conandata.yml b/recipes/cppcheck/all/conandata.yml index ca1bcf73fc569..8a62855c77e16 100644 --- a/recipes/cppcheck/all/conandata.yml +++ b/recipes/cppcheck/all/conandata.yml @@ -1,22 +1,64 @@ sources: + "2.10": + url: "https://github.com/danmar/cppcheck/archive/2.10.tar.gz" + sha256: "785dcbf711048dfe43ae920b6eff2eeebb4a096e88188a40e173ca4c030f57c3" + "2.9.3": + url: "https://github.com/danmar/cppcheck/archive/2.9.3.tar.gz" + sha256: "46319ca73e33e4b2bd91981a76a0d4f184cd3f86b62dc18e8938eabacd3ad2e3" + "2.9.2": + url: "https://github.com/danmar/cppcheck/archive/2.9.2.tar.gz" + sha256: "93920d24d4442856bf7916ee0e3fc31308bc23948e7029b4fd332e01cac63c3e" + "2.8.2": + url: "https://github.com/danmar/cppcheck/archive/2.8.2.tar.gz" + sha256: "30ba99ab54089c44b83f02e2453da046a7edff5237950d4A0eb1eba4afcb4f45" "2.7.5": url: "https://github.com/danmar/cppcheck/archive/2.7.5.tar.gz" sha256: "6c7ac29e57fa8b3ac7be224510200e579d5a90217e2152591ef46ffc947d8f78" - "2.7.4": - url: "https://github.com/danmar/cppcheck/archive/2.7.4.tar.gz" - sha256: "f0558c497b7807763325f3a821f1c72b743e5d888b037b8d32157dd07d6c26e1" patches: - "2.7.5": - - patch_file: "patches/0001-cmake-source-dir-2.5.patch" - base_path: "source_subfolder" + "2.10": + - patch_file: "patches/0001-cli-remove-dmake-cmake-2.10.patch" + patch_description: "Remove dmake tool from target ALL" + patch_type: "portability" + - patch_file: "patches/0002-htmlreport-python3.patch" + patch_description: "Use Python 3 in Shebang Header" + patch_type: "portability" + - patch_file: "patches/0003-pcre-debuglib-name.patch" + patch_description: "Consider the Debug suffix for Windows" + patch_type: "portability" + "2.9.3": + - patch_file: "patches/0001-cli-remove-dmake-cmake.patch" + patch_description: "Remove dmake tool from target ALL" + patch_type: "portability" + - patch_file: "patches/0002-htmlreport-python3.patch" + patch_description: "Use Python 3 in Shebang Header" + patch_type: "portability" + - patch_file: "patches/0003-pcre-debuglib-name.patch" + patch_description: "Consider the Debug suffix for Windows" + patch_type: "portability" + "2.9.2": + - patch_file: "patches/0001-cli-remove-dmake-cmake.patch" + patch_description: "Remove dmake tool from target ALL" + patch_type: "portability" - patch_file: "patches/0002-htmlreport-python3.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-handle-exename-on-macos.patch" - base_path: "source_subfolder" - "2.7.4": - - patch_file: "patches/0001-cmake-source-dir-2.5.patch" - base_path: "source_subfolder" + patch_description: "Use Python 3 in Shebang Header" + patch_type: "portability" + - patch_file: "patches/0003-pcre-debuglib-name.patch" + patch_description: "Consider the Debug suffix for Windows" + patch_type: "portability" + "2.8.2": + - patch_file: "patches/0001-cli-remove-dmake-cmake-2.8.patch" + patch_description: "Remove dmake tool from target ALL" + patch_type: "portability" + - patch_file: "patches/0002-htmlreport-python3.patch" + patch_description: "Use Python 3 in Shebang Header" + patch_type: "portability" + - patch_file: "patches/0003-pcre-debuglib-name.patch" + patch_description: "Consider the Debug suffix for Windows" + patch_type: "portability" + "2.7.5": - patch_file: "patches/0002-htmlreport-python3.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-handle-exename-on-macos.patch" - base_path: "source_subfolder" + patch_description: "Use Python 3 in Shebang Header" + patch_type: "portability" + - patch_file: "patches/0003-pcre-debuglib-name-2.7.patch" + patch_description: "Consider the Debug suffix for Windows" + patch_type: "portability" diff --git a/recipes/cppcheck/all/conanfile.py b/recipes/cppcheck/all/conanfile.py index 7f61d3fda6eed..e7ed353b601b6 100644 --- a/recipes/cppcheck/all/conanfile.py +++ b/recipes/cppcheck/all/conanfile.py @@ -1,74 +1,75 @@ -from conans import ConanFile, CMake, tools -import functools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class CppcheckConan(ConanFile): name = "cppcheck" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/danmar/cppcheck" - topics = ("Cpp Check", "static analyzer") + topics = ("code quality", "static analyzer", "linter") description = "Cppcheck is an analysis tool for C/C++ code." license = "GPL-3.0-or-later" - generators = "cmake" settings = "os", "arch", "compiler", "build_type" options = {"with_z3": [True, False], "have_rules": [True, False]} default_options = {"with_z3": True, "have_rules": True} - exports_sources = ["CMakeLists.txt", "patches/**"] - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - tools.replace_in_file(os.path.join(self._source_subfolder, "cli", "CMakeLists.txt"), - "RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}", - "DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}") + def config_options(self): + if Version(self.version) >= Version("2.8.0"): + del self.options.with_z3 def requirements(self): - if self.options.with_z3: - self.requires("z3/4.8.8") + if self.options.get_safe("with_z3", default=False): + self.requires("z3/4.10.2") if self.options.have_rules: self.requires("pcre/8.45") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["USE_Z3"] = self.options.with_z3 - cmake.definitions["HAVE_RULES"] = self.options.have_rules - cmake.definitions["USE_MATCHCOMPILER"] = "Auto" - cmake.definitions["ENABLE_OSS_FUZZ"] = False - cmake.configure(build_folder=self._build_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) < "2.8.0": + tc.variables["USE_Z3"] = self.options.with_z3 + tc.variables["HAVE_RULES"] = self.options.have_rules + tc.variables["USE_MATCHCOMPILER"] = "Auto" + tc.variables["ENABLE_OSS_FUZZ"] = False + tc.variables["FILESDIR"] = os.path.join(self.package_folder, "bin").replace('\\', '/') + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - self.copy("*", dst=os.path.join("bin","cfg"), src=os.path.join(self._source_subfolder,"cfg")) - self.copy("cppcheck-htmlreport", dst=os.path.join("bin"), src=os.path.join(self._source_subfolder,"htmlreport")) - cmake = self._configure_cmake() + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder)) + copy(self, "cppcheck-htmlreport", dst=os.path.join(self.package_folder, "bin"), src=os.path.join(self.source_folder, "htmlreport")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + bin_folder = os.path.join(self.package_folder, "bin") - self.output.info("Append %s to environment variable PATH" % bin_folder) + self.output.info(f"Append {bin_folder} to environment variable PATH") self.env_info.PATH.append(bin_folder) - # This is required to run the python script on windows, as we cannot simply add it to the PATH - self.env_info.CPPCHECK_HTMLREPORT = os.path.join(bin_folder, "cppcheck-htmlreport") + cppcheck_htmlreport = os.path.join(bin_folder, "cppcheck-htmlreport") + self.env_info.CPPCHECK_HTMLREPORT = cppcheck_htmlreport + self.runenv_info.define_path("CPPCHECK_HTMLREPORT", cppcheck_htmlreport) diff --git a/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake-2.10.patch b/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake-2.10.patch new file mode 100644 index 0000000000000..22f318312cdf0 --- /dev/null +++ b/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake-2.10.patch @@ -0,0 +1,15 @@ +--- a/cli/CMakeLists.txt 2022-11-08 20:22:59.000000000 +0100 ++++ b/cli/CMakeLists.txt 2022-11-23 21:33:49.347849300 +0100 +@@ -60,11 +60,10 @@ + + add_dependencies(cppcheck copy_cfg) + add_dependencies(cppcheck copy_addons) + add_dependencies(cppcheck copy_platforms) +-add_dependencies(cppcheck run-dmake) + + install(TARGETS cppcheck +- RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} ++ DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + COMPONENT applications) + + install(FILES ${addons} diff --git a/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake-2.8.patch b/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake-2.8.patch new file mode 100644 index 0000000000000..157034975424b --- /dev/null +++ b/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake-2.8.patch @@ -0,0 +1,14 @@ +--- a/cli/CMakeLists.txt 2022-07-12 23:11:29.000000000 +0200 ++++ b/cli/CMakeLists.txt 2022-11-23 22:01:29.111581500 +0100 +@@ -45,10 +45,9 @@ + + add_dependencies(cppcheck copy_cfg) + add_dependencies(cppcheck copy_addons) +-add_dependencies(cppcheck run-dmake) + + install(TARGETS cppcheck +- RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} ++ DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + COMPONENT applications) + + install(FILES ${addons} diff --git a/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake.patch b/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake.patch new file mode 100644 index 0000000000000..18fff8473a497 --- /dev/null +++ b/recipes/cppcheck/all/patches/0001-cli-remove-dmake-cmake.patch @@ -0,0 +1,14 @@ +--- a/cli/CMakeLists.txt 2022-11-08 20:22:59.000000000 +0100 ++++ b/cli/CMakeLists.txt 2022-11-23 21:33:49.347849300 +0100 +@@ -43,10 +43,9 @@ + + add_dependencies(cppcheck copy_cfg) + add_dependencies(cppcheck copy_addons) +-add_dependencies(cppcheck run-dmake) + + install(TARGETS cppcheck +- RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} ++ DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} + COMPONENT applications) + + install(FILES ${addons} diff --git a/recipes/cppcheck/all/patches/0001-cmake-source-dir-2.5.patch b/recipes/cppcheck/all/patches/0001-cmake-source-dir-2.5.patch deleted file mode 100644 index 06286552a0736..0000000000000 --- a/recipes/cppcheck/all/patches/0001-cmake-source-dir-2.5.patch +++ /dev/null @@ -1,36 +0,0 @@ -diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt -index 100f9a9edab3ae26b1736f79dc2f9b875f627cce..6e810d508afb79f015286b92a4eeff53e497b9c8 100644 ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -4,19 +4,19 @@ foreach(file ${srcs_lib}) - set(src "${CMAKE_BINARY_DIR}/lib/build/mc_${file}") - set_source_files_properties(${src} PROPERTIES GENERATED TRUE) - else() -- set(src "${CMAKE_SOURCE_DIR}/lib/${file}") -+ set(src "${PROJECT_SOURCE_DIR}/lib/${file}") - endif() - set(srcs_tools ${srcs_tools} ${src}) - endforeach() - - add_executable(dmake EXCLUDE_FROM_ALL - dmake.cpp -- ${CMAKE_SOURCE_DIR}/cli/filelister.cpp -+ ${PROJECT_SOURCE_DIR}/cli/filelister.cpp - ${srcs_tools} -- ${CMAKE_SOURCE_DIR}/lib/utils.cpp -- ${CMAKE_SOURCE_DIR}/externals/simplecpp/simplecpp.cpp -+ ${PROJECT_SOURCE_DIR}/lib/utils.cpp -+ ${PROJECT_SOURCE_DIR}/externals/simplecpp/simplecpp.cpp - ) --target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp) -+target_include_directories(dmake PRIVATE ${PROJECT_SOURCE_DIR}/cli ${PROJECT_SOURCE_DIR}/lib ${PROJECT_SOURCE_DIR}/externals/simplecpp) - if (WIN32 AND NOT BORLAND) - if(NOT MINGW) - target_link_libraries(dmake Shlwapi.lib) -@@ -26,5 +26,5 @@ if (WIN32 AND NOT BORLAND) - endif() - - add_custom_target(run-dmake $ -- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - DEPENDS dmake) diff --git a/recipes/cppcheck/all/patches/0001-cmake-source-dir.patch b/recipes/cppcheck/all/patches/0001-cmake-source-dir.patch deleted file mode 100644 index 95e8658caedb3..0000000000000 --- a/recipes/cppcheck/all/patches/0001-cmake-source-dir.patch +++ /dev/null @@ -1,35 +0,0 @@ -diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt -index 303b8d55f77cd36bc597ddfc406bc5fe7c2992e5..e25948fa14664d9a8b758586a75369ecde111ddb 100644 ---- a/tools/CMakeLists.txt -+++ b/tools/CMakeLists.txt -@@ -4,23 +4,23 @@ foreach(file ${srcs_lib}) - set(src "${CMAKE_BINARY_DIR}/lib/build/mc_${file}") - set_source_files_properties(${src} PROPERTIES GENERATED TRUE) - else() -- set(src "${CMAKE_SOURCE_DIR}/lib/${file}") -+ set(src "${PROJECT_SOURCE_DIR}/lib/${file}") - endif() - set(srcs_tools ${srcs_tools} ${src}) - endforeach() - - add_executable(dmake EXCLUDE_FROM_ALL - dmake.cpp -- ${CMAKE_SOURCE_DIR}/cli/filelister.cpp -+ ${PROJECT_SOURCE_DIR}/cli/filelister.cpp - ${srcs_tools} -- ${CMAKE_SOURCE_DIR}/lib/utils.cpp -- ${CMAKE_SOURCE_DIR}/externals/simplecpp/simplecpp -+ ${PROJECT_SOURCE_DIR}/lib/utils.cpp -+ ${PROJECT_SOURCE_DIR}/externals/simplecpp/simplecpp - ) --target_include_directories(dmake PRIVATE ${CMAKE_SOURCE_DIR}/cli ${CMAKE_SOURCE_DIR}/lib ${CMAKE_SOURCE_DIR}/externals/simplecpp) -+target_include_directories(dmake PRIVATE ${PROJECT_SOURCE_DIR}/cli ${PROJECT_SOURCE_DIR}/lib ${PROJECT_SOURCE_DIR}/externals/simplecpp) - if (WIN32 AND NOT BORLAND) - target_link_libraries(dmake Shlwapi.lib) - endif() - - add_custom_target(run-dmake $ -- WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} -+ WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} - DEPENDS dmake) -\ No newline at end of file diff --git a/recipes/cppcheck/all/patches/0003-handle-exename-on-macos.patch b/recipes/cppcheck/all/patches/0003-handle-exename-on-macos.patch deleted file mode 100644 index 5975775352f74..0000000000000 --- a/recipes/cppcheck/all/patches/0003-handle-exename-on-macos.patch +++ /dev/null @@ -1,35 +0,0 @@ -commit 3b54e7610c8e512432fefd02c047ade142cde19a -Author: Martin Delille -Date: Sun May 1 19:32:12 2022 +0200 - - Handle exename on macos - -diff --git a/cli/main.cpp b/cli/main.cpp -index ca48497d2..dae782ce6 100644 ---- a/cli/main.cpp -+++ b/cli/main.cpp -@@ -76,6 +76,12 @@ - static char exename[1024] = {0}; - #endif - -+#if defined(__APPLE__) -+#include -+ -+static char exename[1024] = {0}; -+#endif -+ - /** - * Main function of cppcheck - * -@@ -95,6 +101,11 @@ int main(int argc, char* argv[]) - GetModuleFileNameA(nullptr, exename, sizeof(exename)/sizeof(exename[0])-1); - argv[0] = exename; - #endif -+#if defined(__APPLE__) -+ uint32_t size = sizeof(exename); -+ _NSGetExecutablePath(exename, &size); -+ argv[0] = exename; -+#endif - // *INDENT-OFF* - #ifdef NDEBUG - try { diff --git a/recipes/cppcheck/all/patches/0003-pcre-debuglib-name-2.7.patch b/recipes/cppcheck/all/patches/0003-pcre-debuglib-name-2.7.patch new file mode 100644 index 0000000000000..fa8b46fd1608e --- /dev/null +++ b/recipes/cppcheck/all/patches/0003-pcre-debuglib-name-2.7.patch @@ -0,0 +1,28 @@ +--- a/cmake/findDependencies.cmake 2022-04-15 20:23:30.000000000 +0200 ++++ b/cmake/findDependencies.cmake 2022-11-24 13:57:22.099453500 +0100 +@@ -16,7 +16,7 @@ + + if (HAVE_RULES) + find_path(PCRE_INCLUDE pcre.h) +- find_library(PCRE_LIBRARY pcre) ++ find_library(PCRE_LIBRARY NAMES pcre pcred) + if (NOT PCRE_LIBRARY OR NOT PCRE_INCLUDE) + message(FATAL_ERROR "pcre dependency for RULES has not been found") + endif() +@@ -24,16 +24,8 @@ + + if (USE_Z3) + find_package(Z3 QUIET) +- if (NOT Z3_FOUND) + find_library(Z3_LIBRARIES z3) +- if (NOT Z3_LIBRARIES) +- message(FATAL_ERROR "z3 dependency has not been found") +- endif() + find_path(Z3_CXX_INCLUDE_DIRS z3++.h PATH_SUFFIXES "z3") +- if (NOT Z3_CXX_INCLUDE_DIRS) +- message(FATAL_ERROR "z3++.h has not been found") +- endif() +- endif() + endif() + + set(CMAKE_INCLUDE_CURRENT_DIR ON) diff --git a/recipes/cppcheck/all/patches/0003-pcre-debuglib-name.patch b/recipes/cppcheck/all/patches/0003-pcre-debuglib-name.patch new file mode 100644 index 0000000000000..9431d05ce2a2d --- /dev/null +++ b/recipes/cppcheck/all/patches/0003-pcre-debuglib-name.patch @@ -0,0 +1,11 @@ +--- a/cmake/findDependencies.cmake 2022-11-08 20:22:59.000000000 +0100 ++++ b/cmake/findDependencies.cmake 2022-11-23 21:29:50.222152900 +0100 +@@ -36,7 +36,7 @@ + + if (HAVE_RULES) + find_path(PCRE_INCLUDE pcre.h) +- find_library(PCRE_LIBRARY pcre) ++ find_library(PCRE_LIBRARY NAMES pcre pcred) + if (NOT PCRE_LIBRARY OR NOT PCRE_INCLUDE) + message(FATAL_ERROR "pcre dependency for RULES has not been found") + endif() diff --git a/recipes/cppcheck/all/test_package/conanfile.py b/recipes/cppcheck/all/test_package/conanfile.py index 5aa61b686254c..f29289a5751d7 100644 --- a/recipes/cppcheck/all/test_package/conanfile.py +++ b/recipes/cppcheck/all/test_package/conanfile.py @@ -1,20 +1,21 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run import sys -import os -import shutil class TestPackageConan(ConanFile): settings = "os", "arch" + generators = "VirtualRunEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - shutil.copy(os.path.join(self.source_folder, "file_to_check.cpp"), - os.path.join(self.build_folder, "file_to_check.cpp")) - if not tools.cross_building(self.settings): + if can_run(self): self.run("cppcheck --enable=warning,style,performance --std=c++11 .", - cwd=self.source_folder, run_environment=True) - # On windows we need to explicitly use python to run the python script - if self.settings.os == 'Windows': - self.run("{} {} -h".format(sys.executable, tools.get_env("CPPCHECK_HTMLREPORT"))) + cwd=self.source_folder, run_environment=True) + if self.settings.os == "Windows": + self.run(f"{sys.executable} %CPPCHECK_HTMLREPORT% -h", run_environment=True) else: self.run("cppcheck-htmlreport -h", run_environment=True) diff --git a/recipes/cppcheck/all/test_v1_package/conanfile.py b/recipes/cppcheck/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..14b7ebe1713c7 --- /dev/null +++ b/recipes/cppcheck/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conan import ConanFile +from conan.tools.build import can_run +import sys + + +class TestPackageConan(ConanFile): + settings = "os", "arch" + generators = "VirtualRunEnv" + + def test(self): + if can_run(self): + self.run("cppcheck --enable=warning,style,performance --std=c++11 .", + cwd=self.source_folder, run_environment=True) + if self.settings.os == "Windows": + # Unable to work with Environment variable CPPCHECK_HTML_REPORT + self.run(f"{sys.executable} %CPPCHECK_HTMLREPORT% -h", run_environment=True) + else: + self.run("cppcheck-htmlreport -h", run_environment=True) diff --git a/recipes/cppcheck/all/test_v1_package/file_to_check.cpp b/recipes/cppcheck/all/test_v1_package/file_to_check.cpp new file mode 100644 index 0000000000000..33c14ce1d76c0 --- /dev/null +++ b/recipes/cppcheck/all/test_v1_package/file_to_check.cpp @@ -0,0 +1,3 @@ +int main() { + return 0; +} diff --git a/recipes/cppcheck/config.yml b/recipes/cppcheck/config.yml index cd8c614f41055..65c5bcea65ea0 100644 --- a/recipes/cppcheck/config.yml +++ b/recipes/cppcheck/config.yml @@ -1,5 +1,11 @@ versions: - "2.7.5": + "2.10": + folder: all + "2.9.3": + folder: all + "2.9.2": folder: all - "2.7.4": + "2.8.2": + folder: all + "2.7.5": folder: all diff --git a/recipes/cppcodec/all/conanfile.py b/recipes/cppcodec/all/conanfile.py index c843146d3df75..59f96dbe4a59f 100644 --- a/recipes/cppcodec/all/conanfile.py +++ b/recipes/cppcodec/all/conanfile.py @@ -1,5 +1,10 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -from conans import ConanFile, tools + +required_conan_version = ">=1.50.0" class CppcodecConan(ConanFile): @@ -7,21 +12,37 @@ class CppcodecConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/tplgy/cppcodec" - description = "Header-only C++11 library to encode/decode base64, base64url, base32, base32hex and hex (a.k.a. base16) as specified in RFC 4648, plus Crockford's base32" + description = ( + "Header-only C++11 library to encode/decode base64, base64url, base32, " + "base32hex and hex (a.k.a. base16) as specified in RFC 4648, plus Crockford's base32" + ) topics = ("base64", "cpp11", "codec", "base32") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - _source_subfolder = "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def package(self): - self.copy("*hpp", dst=os.path.join("include", "cppcodec"), src=os.path.join(self._source_subfolder, "cppcodec")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + def build(self): + pass - def package_id(self): - self.info.header_only() + def package(self): + copy(self, "*hpp", src=os.path.join(self.source_folder, "cppcodec"), dst=os.path.join(self.package_folder, "include", "cppcodec")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "cppcodec-1") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/cppcodec/all/test_package/CMakeLists.txt b/recipes/cppcodec/all/test_package/CMakeLists.txt index 6aab347eddf53..d359976811ee3 100644 --- a/recipes/cppcodec/all/test_package/CMakeLists.txt +++ b/recipes/cppcodec/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(cppcodec REQUIRED CONFIG) -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) -set_property(TARGET example PROPERTY CXX_STANDARD 11) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cppcodec::cppcodec) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cppcodec/all/test_package/conanfile.py b/recipes/cppcodec/all/test_package/conanfile.py index 9a662bfeb73fe..0a6bc68712d90 100644 --- a/recipes/cppcodec/all/test_package/conanfile.py +++ b/recipes/cppcodec/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class CppcodecTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cppcodec/all/test_package/example.cpp b/recipes/cppcodec/all/test_package/test_package.cpp similarity index 100% rename from recipes/cppcodec/all/test_package/example.cpp rename to recipes/cppcodec/all/test_package/test_package.cpp diff --git a/recipes/cppcodec/all/test_v1_package/CMakeLists.txt b/recipes/cppcodec/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..4e3738c68e0b9 --- /dev/null +++ b/recipes/cppcodec/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(cppcodec REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cppcodec::cppcodec) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cppcodec/all/test_v1_package/conanfile.py b/recipes/cppcodec/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cppcodec/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cppcodec/config.yml b/recipes/cppcodec/config.yml index 4862588660bd8..7e65100e62b2c 100644 --- a/recipes/cppcodec/config.yml +++ b/recipes/cppcodec/config.yml @@ -1,4 +1,3 @@ ---- versions: "0.2": folder: all diff --git a/recipes/cppcommon/all/conandata.yml b/recipes/cppcommon/all/conandata.yml index 7cc3c2120d392..c69e434893cba 100644 --- a/recipes/cppcommon/all/conandata.yml +++ b/recipes/cppcommon/all/conandata.yml @@ -11,6 +11,9 @@ sources: "1.0.2.0": url: "https://github.com/chronoxor/CppCommon/archive/1.0.2.0.tar.gz" sha256: "1a748159ab5d0eb74a6c7b110606718caa779cdf17b3e91bf0dbd0e297823dec" + "1.0.3.0": + url: "https://github.com/chronoxor/CppCommon/archive/1.0.3.0.tar.gz" + sha256: "af530d3550a050d4ed73a680b016e043ea6f4f56e11163226f2a6e24d9eae4ca" patches: "1.0.0.0": @@ -33,3 +36,8 @@ patches: base_path: "source_subfolder" - patch_file: "patches/0003-define-win32-winnt-1-0-1-0.patch" base_path: "source_subfolder" + "1.0.3.0": + - patch_file: "patches/0001-update-cmakelists-1-0-3-0.patch" + base_path: "source_subfolder" + - patch_file: "patches/0003-define-win32-winnt-1-0-1-0.patch" + base_path: "source_subfolder" diff --git a/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-3-0.patch b/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-3-0.patch new file mode 100644 index 0000000000000..83cb81ebe9a49 --- /dev/null +++ b/recipes/cppcommon/all/patches/0001-update-cmakelists-1-0-3-0.patch @@ -0,0 +1,133 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index aa5447a8..10a0065b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.20) ++cmake_minimum_required(VERSION 3.18.2) + + # Global properties + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +@@ -17,49 +17,36 @@ if(DOXYGEN_FOUND) + endif() + endif() + +-# CMake module path +-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +- +-# Compiler features +-include(SetCompilerFeatures) +-include(SetCompilerWarnings) +-include(SetPlatformFeatures) +-include(SystemInformation) +- + # External packages + find_package(Threads REQUIRED) + if(UNIX AND NOT APPLE AND NOT MSYS) + find_package(LibBFD) + find_package(LibDL) + find_package(LibRT) +- find_package(LibUUID) ++ find_package(libuuid) + endif() + if(WIN32 OR MSYS) + find_package(DbgHelp) + find_package(RPC) +- find_package(Userenv) + endif() + +-# Modules +-add_subdirectory("modules") +- + # Link libraries + list(APPEND LINKLIBS Threads::Threads) + if(UNIX AND NOT APPLE AND NOT MSYS) + list(APPEND LINKLIBS ${LIBBFD_LIBRARIES}) + list(APPEND LINKLIBS ${LIBDL_LIBRARIES}) + list(APPEND LINKLIBS ${LIBRT_LIBRARIES}) +- list(APPEND LINKLIBS ${LIBUUID_LIBRARIES}) ++ list(APPEND LINKLIBS CONAN_PKG::libuuid) + endif() + if(WIN32 OR MSYS) + list(APPEND LINKLIBS ${DBGHELP_LIBRARIES}) + list(APPEND LINKLIBS ${RPC_LIBRARIES}) +- list(APPEND LINKLIBS ${USERENV_LIBRARIES}) ++ list(APPEND LINKLIBS userenv) ++ list(APPEND LINKLIBS rpcrt4) + list(APPEND LINKLIBS ${VLD_LIBRARIES}) + endif() + + # System directories +-include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/modules") + include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/plugins") + + # Library +@@ -68,8 +55,9 @@ file(GLOB_RECURSE LIB_INLINE_FILES "include/*.inl" "source/*.inl") + file(GLOB_RECURSE LIB_SOURCE_FILES "include/*.cpp" "source/*.cpp") + add_library(cppcommon ${LIB_HEADER_FILES} ${LIB_INLINE_FILES} ${LIB_SOURCE_FILES}) + set_target_properties(cppcommon PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}" FOLDER "libraries") +-target_include_directories(cppcommon PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" PUBLIC ${vld}) +-target_link_libraries(cppcommon ${LINKLIBS} fmt) ++target_include_directories(cppcommon PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") ++target_compile_features(cppcommon PUBLIC cxx_std_17) ++target_link_libraries(cppcommon PUBLIC ${LINKLIBS} CONAN_PKG::fmt) + list(APPEND INSTALL_TARGETS cppcommon) + list(APPEND LINKLIBS cppcommon) + +@@ -92,6 +80,7 @@ if(NOT CPPCOMMON_MODULE) + endforeach() + + # Examples ++ if(FALSE) + file(GLOB EXAMPLE_HEADER_FILES "examples/*.h") + file(GLOB EXAMPLE_INLINE_FILES "examples/*.inl") + file(GLOB EXAMPLE_SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/examples" "examples/*.cpp") +@@ -105,8 +94,10 @@ if(NOT CPPCOMMON_MODULE) + list(APPEND INSTALL_TARGETS ${EXAMPLE_TARGET}) + list(APPEND INSTALL_TARGETS_PDB ${EXAMPLE_TARGET}) + endforeach() ++ endif() + + # Benchmarks ++ if(FALSE) + file(GLOB BENCHMARK_HEADER_FILES "performance/*.h") + file(GLOB BENCHMARK_INLINE_FILES "performance/*.inl") + file(GLOB BENCHMARK_SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/performance" "performance/*.cpp") +@@ -120,8 +111,10 @@ if(NOT CPPCOMMON_MODULE) + list(APPEND INSTALL_TARGETS ${BENCHMARK_TARGET}) + list(APPEND INSTALL_TARGETS_PDB ${BENCHMARK_TARGET}) + endforeach() ++ endif() + + # Tests ++ if(FALSE) + file(GLOB TESTS_HEADER_FILES "tests/*.h") + file(GLOB TESTS_INLINE_FILES "tests/*.inl") + file(GLOB TESTS_SOURCE_FILES "tests/*.cpp") +@@ -132,19 +125,22 @@ if(NOT CPPCOMMON_MODULE) + target_link_libraries(cppcommon-tests ${LINKLIBS}) + list(APPEND INSTALL_TARGETS cppcommon-tests) + list(APPEND INSTALL_TARGETS_PDB cppcommon-tests) ++ endif() + + # CTest ++ if(FALSE) + enable_testing() + add_test(cppcommon-tests cppcommon-tests --durations yes --order lex) ++ endif() + + # Install + install(TARGETS ${INSTALL_TARGETS} +- RUNTIME DESTINATION "${PROJECT_SOURCE_DIR}/bin" +- LIBRARY DESTINATION "${PROJECT_SOURCE_DIR}/bin" +- ARCHIVE DESTINATION "${PROJECT_SOURCE_DIR}/bin") ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + + # Install *.pdb files +- if(MSVC) ++ if(FALSE) + foreach(INSTALL_TARGET_PDB ${INSTALL_TARGETS_PDB}) + install(FILES $ DESTINATION "${PROJECT_SOURCE_DIR}/bin") + endforeach() diff --git a/recipes/cppcommon/config.yml b/recipes/cppcommon/config.yml index 8613120984c0e..17d2cd502269e 100644 --- a/recipes/cppcommon/config.yml +++ b/recipes/cppcommon/config.yml @@ -7,3 +7,5 @@ versions: folder: all "1.0.2.0": folder: all + "1.0.3.0": + folder: all diff --git a/recipes/cppfront/all/CMakeLists.txt b/recipes/cppfront/all/CMakeLists.txt new file mode 100644 index 0000000000000..91f9698142088 --- /dev/null +++ b/recipes/cppfront/all/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.12) +project(cppfront LANGUAGES CXX) + +add_executable(${PROJECT_NAME} ${CPPFRONT_SRC_DIR}/source/cppfront.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) + +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(DIRECTORY ${CPPFRONT_SRC_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/cppfront/all/conandata.yml b/recipes/cppfront/all/conandata.yml new file mode 100644 index 0000000000000..3db3937d63c0d --- /dev/null +++ b/recipes/cppfront/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "cci.20230103": + url: "https://github.com/hsutter/cppfront/archive/808db2bd6ae92f869166827dfda66cfa42dde0ab.zip" + sha256: "479252c99d66db477c4cd98a6e1707a8929a70afdf000c75589841d944c539f4" + "cci.20221024": + url: "https://github.com/hsutter/cppfront/archive/b1754dbd53a496a9104b43ecde6064c9980246bd.zip" + sha256: "8668bddbd7fc06d4975c867521c005f898eca8f83f018e7c28b54dbcf9aa3ab9" + "cci.20220924": + url: "https://github.com/hsutter/cppfront/archive/98f6dd46957e100f813245241f183c8aedbcb36f.zip" + sha256: "db51c1ac634d45c6047c7eec5c29993ff215443edadf334370f53d09a11cc5b1" diff --git a/recipes/cppfront/all/conanfile.py b/recipes/cppfront/all/conanfile.py new file mode 100644 index 0000000000000..7f4f580a8ec02 --- /dev/null +++ b/recipes/cppfront/all/conanfile.py @@ -0,0 +1,83 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +import os + +required_conan_version = ">=1.50.0" + + +class CppfrontConan(ConanFile): + name = "cppfront" + description = "Cppfront is a experimental compiler from a potential C++ 'syntax 2' (Cpp2) to today's 'syntax 1' (Cpp1)" + topics = ("cpp2", "compiler") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/hsutter/cppfront" + license = "CC-BY-NC-ND-4.0" + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return "20" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "Visual Studio": "16.9", + "msvc": "192.9", + "clang": "12", + "apple-clang": "13", + } + + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + if self.settings.compiler == "clang" and str(self.settings.compiler.version) in ("13", "14"): + raise ConanInvalidConfiguration( + f"{self.ref} currently does not work with Clang {self.settings.compiler.version} on CCI, " + "it enters in an infinite build loop (smells like a compiler bug). Contributions are welcomed!" + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CPPFRONT_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libdirs = [] + + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/cppfront/all/test_package/conanfile.py b/recipes/cppfront/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5c77415f9d7dc --- /dev/null +++ b/recipes/cppfront/all/test_package/conanfile.py @@ -0,0 +1,24 @@ +from conan import ConanFile +from conan.tools.files import copy +from conan.tools.layout import basic_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def layout(self): + basic_layout(self) + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def build(self): + copy(self, "pure2-hello.cpp2", src=self.recipe_folder, dst=self.build_folder) + self.run("cppfront {}".format(os.path.join(self.build_folder, "pure2-hello.cpp2"))) + + def test(self): + self.run("cppfront -h") + assert os.path.isfile(os.path.join(self.build_folder, "pure2-hello.cpp")) diff --git a/recipes/cppfront/all/test_package/pure2-hello.cpp2 b/recipes/cppfront/all/test_package/pure2-hello.cpp2 new file mode 100644 index 0000000000000..338735841ca79 --- /dev/null +++ b/recipes/cppfront/all/test_package/pure2-hello.cpp2 @@ -0,0 +1,13 @@ +main: () -> int = { + std::cout << "Hello " << name() << "\n"; +} + +name: () -> std::string = { + s: std::string = "world"; + decorate(s); + return s; +} + +decorate: (inout s: std::string) = { + s = "[" + s + "]"; +} \ No newline at end of file diff --git a/recipes/cppfront/all/test_v1_package/conanfile.py b/recipes/cppfront/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..13f05370739e6 --- /dev/null +++ b/recipes/cppfront/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile +import os +import shutil + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + + def build(self): + shutil.copy2(src=os.path.join(self.source_folder, os.pardir, "test_package", "pure2-hello.cpp2"), + dst=os.path.join(self.build_folder, "pure2-hello.cpp2")) + self.run("cppfront {}".format(os.path.join(self.build_folder, "pure2-hello.cpp2"))) + + def test(self): + self.run("cppfront -h") + assert os.path.isfile(os.path.join(self.build_folder, "pure2-hello.cpp")) diff --git a/recipes/cppfront/config.yml b/recipes/cppfront/config.yml new file mode 100644 index 0000000000000..50c5629b6e025 --- /dev/null +++ b/recipes/cppfront/config.yml @@ -0,0 +1,7 @@ +versions: + "cci.20230103": + folder: all + "cci.20221024": + folder: all + "cci.20220924": + folder: all diff --git a/recipes/cppkafka/all/conanfile.py b/recipes/cppkafka/all/conanfile.py index bc32e36950898..41a226efdbb76 100644 --- a/recipes/cppkafka/all/conanfile.py +++ b/recipes/cppkafka/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class CppKafkaConan(ConanFile): @@ -15,6 +15,7 @@ class CppKafkaConan(ConanFile): homepage = "https://github.com/mfontanini/cppkafka" license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,8 +27,7 @@ class CppKafkaConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,22 +35,21 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.79.0") - self.requires("librdkafka/1.9.2") + self.requires("boost/1.81.0") + self.requires("librdkafka/2.0.2") def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/cppkafka/all/test_package/conanfile.py b/recipes/cppkafka/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/cppkafka/all/test_package/conanfile.py +++ b/recipes/cppkafka/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/cppkafka/all/test_v1_package/CMakeLists.txt b/recipes/cppkafka/all/test_v1_package/CMakeLists.txt index a83b16bfd9b93..0d20897301b68 100644 --- a/recipes/cppkafka/all/test_v1_package/CMakeLists.txt +++ b/recipes/cppkafka/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(CppKafka REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE CppKafka::cppkafka) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cpprestsdk/all/CMakeLists.txt b/recipes/cpprestsdk/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/cpprestsdk/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/cpprestsdk/all/conandata.yml b/recipes/cpprestsdk/all/conandata.yml index aac669c6455d4..5216074c76f9d 100644 --- a/recipes/cpprestsdk/all/conandata.yml +++ b/recipes/cpprestsdk/all/conandata.yml @@ -1,34 +1,42 @@ sources: - "2.10.15": - url: https://github.com/Microsoft/cpprestsdk/archive/v2.10.15.tar.gz - sha256: 1c027a53457e87b0b3a475e5c8045b94400c475898c8bd51b0fbd218b99a7f7b - "2.10.16": - url: https://github.com/Microsoft/cpprestsdk/archive/v2.10.16.tar.gz - sha256: 3d75e17c7d79131320438f2a15331f7ca6281c38c0e2daa27f051e290eeb8681 - "2.10.17": - url: https://github.com/Microsoft/cpprestsdk/archive/2.10.17.tar.gz - sha256: a2d9dae3ae10cdf7e41caf3dd0fa52f0b9c5012a24ba123901f686cfc484c043 "2.10.18": - url: https://github.com/Microsoft/cpprestsdk/archive/2.10.18.tar.gz - sha256: 6bd74a637ff182144b6a4271227ea8b6b3ea92389f88b25b215e6f94fd4d41cb -patches: - "2.10.15": - - patch_file: "patches/0001-find-cmake-targets.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-remove-wconversion.patch" - base_path: "source_subfolder" + url: "https://github.com/Microsoft/cpprestsdk/archive/2.10.18.tar.gz" + sha256: "6bd74a637ff182144b6a4271227ea8b6b3ea92389f88b25b215e6f94fd4d41cb" + "2.10.17": + url: "https://github.com/Microsoft/cpprestsdk/archive/2.10.17.tar.gz" + sha256: "a2d9dae3ae10cdf7e41caf3dd0fa52f0b9c5012a24ba123901f686cfc484c043" "2.10.16": + url: "https://github.com/Microsoft/cpprestsdk/archive/v2.10.16.tar.gz" + sha256: "3d75e17c7d79131320438f2a15331f7ca6281c38c0e2daa27f051e290eeb8681" + "2.10.15": + url: "https://github.com/Microsoft/cpprestsdk/archive/v2.10.15.tar.gz" + sha256: "1c027a53457e87b0b3a475e5c8045b94400c475898c8bd51b0fbd218b99a7f7b" +patches: + "2.10.18": - patch_file: "patches/0003-find-cmake-targets.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "CMake: internal targets" - patch_file: "patches/0002-remove-wconversion.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "fix warnings" "2.10.17": - patch_file: "patches/0003-find-cmake-targets.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "CMake: internal targets" - patch_file: "patches/0002-remove-wconversion.patch" - base_path: "source_subfolder" - "2.10.18": + patch_type: "conan" + patch_description: "fix warnings" + "2.10.16": - patch_file: "patches/0003-find-cmake-targets.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "CMake: internal targets" + - patch_file: "patches/0002-remove-wconversion.patch" + patch_type: "conan" + patch_description: "fix warnings" + "2.10.15": + - patch_file: "patches/0001-find-cmake-targets.patch" + patch_type: "conan" + patch_description: "CMake: internal targets" - patch_file: "patches/0002-remove-wconversion.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "fix warnings" diff --git a/recipes/cpprestsdk/all/conanfile.py b/recipes/cpprestsdk/all/conanfile.py index f1533fc07b38b..467c812235f66 100644 --- a/recipes/cpprestsdk/all/conanfile.py +++ b/recipes/cpprestsdk/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools import files +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class CppRestSDKConan(ConanFile): @@ -33,21 +35,8 @@ class CppRestSDKConan(ConanFile): "http_listener_impl": "httpsys", } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + files.export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -59,60 +48,64 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - self.requires("boost/1.79.0") - self.requires("openssl/1.1.1o") + self.requires("boost/1.80.0") + self.requires("openssl/1.1.1s") if self.options.with_compression: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_websockets: self.requires("websocketpp/0.8.2") def package_id(self): self.info.requires["boost"].minor_mode() + def layout(self): + cmake_layout(self, src_folder="src") + def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self, set_cmake_flags=True) - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_SAMPLES"] = False - self._cmake.definitions["WERROR"] = False - self._cmake.definitions["CPPREST_EXCLUDE_WEBSOCKETS"] = not self.options.with_websockets - self._cmake.definitions["CPPREST_EXCLUDE_COMPRESSION"] = not self.options.with_compression + files.get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + # upstream CMakeLists.txt sets BUILD_SHARED_LIBS as a CACHE variable + # TODO: remove if required_conan_version = ">=1.54.0" + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_SAMPLES"] = False + tc.variables["WERROR"] = False + tc.variables["CPPREST_EXCLUDE_WEBSOCKETS"] = not self.options.with_websockets + tc.variables["CPPREST_EXCLUDE_COMPRESSION"] = not self.options.with_compression if self.options.get_safe("pplx_impl"): - self._cmake.definitions["CPPREST_PPLX_IMPL"] = self.options.pplx_impl + tc.variables["CPPREST_PPLX_IMPL"] = self.options.pplx_impl if self.options.get_safe("http_client_impl"): - self._cmake.definitions["CPPREST_HTTP_CLIENT_IMPL"] = self.options.http_client_impl + tc.variables["CPPREST_HTTP_CLIENT_IMPL"] = self.options.http_client_impl if self.options.get_safe("http_listener_impl"): - self._cmake.definitions["CPPREST_HTTP_LISTENER_IMPL"] = self.options.http_listener_impl - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["CPPREST_HTTP_LISTENER_IMPL"] = self.options.http_listener_impl + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_clang_libcxx(self): if self.settings.compiler == 'clang' and str(self.settings.compiler.libcxx) in ['libstdc++', 'libstdc++11']: - tools.replace_in_file(os.path.join(self._source_subfolder, 'Release', 'CMakeLists.txt'), + files.replace_in_file(self, os.path.join(self.source_folder, 'Release', 'CMakeLists.txt'), 'libc++', 'libstdc++') def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, {}): - tools.patch(**patch) + files.apply_conandata_patches(self) self._patch_clang_libcxx() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("license.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + files.copy(self, "license.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cpprestsdk")) + files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + files.rmdir(self, os.path.join(self.package_folder, "lib", "cpprestsdk")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "cpprestsdk") @@ -127,7 +120,7 @@ def package_info(self): self.cpp_info.components["cpprestsdk_openssl_internal"].requires = ["openssl::openssl"] # cpprest self.cpp_info.components["cpprest"].set_property("cmake_target_name", "cpprestsdk::cpprest") - self.cpp_info.components["cpprest"].libs = tools.collect_libs(self) + self.cpp_info.components["cpprest"].libs = files.collect_libs(self) self.cpp_info.components["cpprest"].requires = ["cpprestsdk_boost_internal", "cpprestsdk_openssl_internal"] if self.settings.os == "Linux": self.cpp_info.components["cpprest"].system_libs.append("pthread") diff --git a/recipes/cpprestsdk/all/patches/0001-find-cmake-targets.patch b/recipes/cpprestsdk/all/patches/0001-find-cmake-targets.patch index c1b4a4342b8bb..6fdbcbfe30dcb 100644 --- a/recipes/cpprestsdk/all/patches/0001-find-cmake-targets.patch +++ b/recipes/cpprestsdk/all/patches/0001-find-cmake-targets.patch @@ -33,11 +33,7 @@ index 0b49a7e..ed5c24b 100644 - "${CMAKE_BINARY_DIR}/../openssl/x86/lib/libcrypto.a" - CACHE INTERNAL "" - ) -+ if(NOT TARGET cpprestsdk_openssl_internal) -+ add_library(cpprestsdk_openssl_internal INTERFACE) -+ target_include_directories(cpprestsdk_openssl_internal INTERFACE "${CONAN_INCLUDE_DIRS_OPENSSL}") -+ target_link_libraries(cpprestsdk_openssl_internal INTERFACE "${CONAN_LIBS_OPENSSL}") - endif() +- endif() - set(_SSL_LEAK_SUPPRESS_AVAILABLE ON CACHE INTERNAL "") - else() - if(APPLE) @@ -76,13 +72,17 @@ index 0b49a7e..ed5c24b 100644 - # libressl doesn't ship with the cleanup method being used in ws_client_wspp - target_compile_definitions(cpprestsdk_openssl_internal INTERFACE -DCPPREST_NO_SSL_LEAK_SUPPRESS) - endif() ++ if(NOT TARGET cpprestsdk_openssl_internal) ++ add_library(cpprestsdk_openssl_internal INTERFACE) ++ find_package(OpenSSL REQUIRED) ++ target_link_libraries(cpprestsdk_openssl_internal INTERFACE "OpenSSL::SSL") ++ endif() endfunction() -\ No newline at end of file diff --git a/Release/cmake/cpprest_find_websocketpp.cmake b/Release/cmake/cpprest_find_websocketpp.cmake index 94ea81a..f83a777 100644 --- a/Release/cmake/cpprest_find_websocketpp.cmake +++ b/Release/cmake/cpprest_find_websocketpp.cmake -@@ -1,27 +1,7 @@ +@@ -1,26 +1,6 @@ function(cpprest_find_websocketpp) - if(TARGET cpprestsdk_websocketpp_internal) - return() @@ -109,11 +109,9 @@ index 94ea81a..f83a777 100644 - cpprestsdk_boost_internal - cpprestsdk_openssl_internal - ) --endfunction() + if(NOT TARGET cpprestsdk_websocketpp_internal) + add_library(cpprestsdk_websocketpp_internal INTERFACE) -+ target_include_directories(cpprestsdk_websocketpp_internal INTERFACE "${CONAN_INCLUDE_DIRS_WEBSOCKETPP}") -+ target_link_libraries(cpprestsdk_websocketpp_internal INTERFACE "${CONAN_LIBS_WEBSOCKETPP}") ++ find_package(websocketpp REQUIRED) ++ target_link_libraries(cpprestsdk_websocketpp_internal INTERFACE "websocketpp::websocketpp") + endif() -+endfunction() -\ No newline at end of file + endfunction() diff --git a/recipes/cpprestsdk/all/patches/0003-find-cmake-targets.patch b/recipes/cpprestsdk/all/patches/0003-find-cmake-targets.patch index 5ce9d5a891943..b3963409c208d 100644 --- a/recipes/cpprestsdk/all/patches/0003-find-cmake-targets.patch +++ b/recipes/cpprestsdk/all/patches/0003-find-cmake-targets.patch @@ -84,15 +84,15 @@ index 0b49a7e..ed5c24b 100644 - endif() + if(NOT TARGET cpprestsdk_openssl_internal) + add_library(cpprestsdk_openssl_internal INTERFACE) -+ target_include_directories(cpprestsdk_openssl_internal INTERFACE "${CONAN_INCLUDE_DIRS_OPENSSL}") -+ target_link_libraries(cpprestsdk_openssl_internal INTERFACE "${CONAN_LIBS_OPENSSL}") -+ endif() ++ find_package(OpenSSL REQUIRED) ++ target_link_libraries(cpprestsdk_openssl_internal INTERFACE "OpenSSL::SSL") ++ endif() endfunction() diff --git a/Release/cmake/cpprest_find_websocketpp.cmake b/Release/cmake/cpprest_find_websocketpp.cmake index 94ea81a..f83a777 100644 --- a/Release/cmake/cpprest_find_websocketpp.cmake +++ b/Release/cmake/cpprest_find_websocketpp.cmake -@@ -1,27 +1,7 @@ +@@ -1,26 +1,6 @@ function(cpprest_find_websocketpp) - if(TARGET cpprestsdk_websocketpp_internal) - return() @@ -119,11 +119,9 @@ index 94ea81a..f83a777 100644 - cpprestsdk_boost_internal - cpprestsdk_openssl_internal - ) --endfunction() + if(NOT TARGET cpprestsdk_websocketpp_internal) + add_library(cpprestsdk_websocketpp_internal INTERFACE) -+ target_include_directories(cpprestsdk_websocketpp_internal INTERFACE "${CONAN_INCLUDE_DIRS_WEBSOCKETPP}") -+ target_link_libraries(cpprestsdk_websocketpp_internal INTERFACE "${CONAN_LIBS_WEBSOCKETPP}") ++ find_package(websocketpp REQUIRED) ++ target_link_libraries(cpprestsdk_websocketpp_internal INTERFACE "websocketpp::websocketpp") + endif() -+endfunction() -\ No newline at end of file + endfunction() diff --git a/recipes/cpprestsdk/all/test_package/CMakeLists.txt b/recipes/cpprestsdk/all/test_package/CMakeLists.txt index 8fbf3106809a4..b305f36beee8f 100644 --- a/recipes/cpprestsdk/all/test_package/CMakeLists.txt +++ b/recipes/cpprestsdk/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(cpprestsdk REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/cpprestsdk/all/test_package/conanfile.py b/recipes/cpprestsdk/all/test_package/conanfile.py index 38f4483872d47..e845ae751a301 100644 --- a/recipes/cpprestsdk/all/test_package/conanfile.py +++ b/recipes/cpprestsdk/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpprestsdk/all/test_package/test_package.cpp b/recipes/cpprestsdk/all/test_package/test_package.cpp index e3f62537b9963..2e37ce5334db9 100644 --- a/recipes/cpprestsdk/all/test_package/test_package.cpp +++ b/recipes/cpprestsdk/all/test_package/test_package.cpp @@ -1,6 +1,7 @@ -#include +#include int main() { const auto parsed_value = web::json::value::parse(U("-22")); + const auto get_method = web::http::methods::GET; } diff --git a/recipes/cpprestsdk/all/test_v1_package/CMakeLists.txt b/recipes/cpprestsdk/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cpprestsdk/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cpprestsdk/all/test_v1_package/conanfile.py b/recipes/cpprestsdk/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cpprestsdk/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cpprestsdk/config.yml b/recipes/cpprestsdk/config.yml index b6b95a950186e..d4be51c9a70c3 100644 --- a/recipes/cpprestsdk/config.yml +++ b/recipes/cpprestsdk/config.yml @@ -1,9 +1,9 @@ versions: - "2.10.15": - folder: "all" - "2.10.16": + "2.10.18": folder: "all" "2.10.17": folder: "all" - "2.10.18": + "2.10.16": + folder: "all" + "2.10.15": folder: "all" diff --git a/recipes/cppserver/all/CMakeLists.txt b/recipes/cppserver/all/CMakeLists.txt deleted file mode 100644 index 6ba47d078b389..0000000000000 --- a/recipes/cppserver/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/cppserver/all/conandata.yml b/recipes/cppserver/all/conandata.yml index 2fb55836179d9..c101e66da5ee2 100644 --- a/recipes/cppserver/all/conandata.yml +++ b/recipes/cppserver/all/conandata.yml @@ -1,22 +1,41 @@ sources: - "1.0.0.0": - url: "https://github.com/chronoxor/CppServer/archive/1.0.0.0.tar.gz" - sha256: "dc70fb24231ac4c06e813a0489ff911dd5c48f844b75856b1e753ac8dbd64772" + "1.0.2.0": + url: "https://github.com/chronoxor/CppServer/archive/1.0.2.0.tar.gz" + sha256: "512b2ada2ddebcedcfac814e3d0784ccef410506dab5dcf64c56302b40e042d4" "1.0.1.0": url: "https://github.com/chronoxor/CppServer/archive/1.0.1.0.tar.gz" sha256: "eff49607a18821de6b992e6b0d9c3d48fa6726242546a1da08cbc2832f901ffc" -patches: "1.0.0.0": - - patch_file: "patches/0001-cmake-clean-up-1-0-0-0.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-define-win32-winnt-1-0-0-0.patch" - base_path: "source_subfolder" + url: "https://github.com/chronoxor/CppServer/archive/1.0.0.0.tar.gz" + sha256: "dc70fb24231ac4c06e813a0489ff911dd5c48f844b75856b1e753ac8dbd64772" +patches: + "1.0.2.0": + - patch_file: "patches/0001-cmake-clean-up-1-0-2-0.patch" + patch_description: "use cci packages, disable test/example builds" + patch_type: "conan" + - patch_file: "patches/0002-define-win32-winnt-1-0-2-0.patch" + patch_description: "add win32/winnt defines" + patch_type: "portability" - patch_file: "patches/0003-remove-asio-defines-1-0-0-0.patch" - base_path: "source_subfolder" + patch_description: "remove asio defines" + patch_type: "portability" "1.0.1.0": - patch_file: "patches/0001-cmake-clean-up-1-0-1-0.patch" - base_path: "source_subfolder" + patch_description: "use cci packages, disable test/example builds" + patch_type: "conan" - patch_file: "patches/0002-define-win32-winnt-1-0-1-0.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-remove-asio-defines-1-0-1-0.patch" - base_path: "source_subfolder" + patch_description: "add win32/winnt defines" + patch_type: "portability" + - patch_file: "patches/0003-remove-asio-defines-1-0-0-0.patch" + patch_description: "remove asio defines" + patch_type: "portability" + "1.0.0.0": + - patch_file: "patches/0001-cmake-clean-up-1-0-0-0.patch" + patch_description: "use cci packages, disable test/example builds" + patch_type: "conan" + - patch_file: "patches/0002-define-win32-winnt-1-0-0-0.patch" + patch_description: "add win32/winnt defines" + patch_type: "portability" + - patch_file: "patches/0003-remove-asio-defines-1-0-0-0.patch" + patch_description: "remove asio defines" + patch_type: "portability" diff --git a/recipes/cppserver/all/conanfile.py b/recipes/cppserver/all/conanfile.py index 8d6f05452ed13..aecc783ed09c3 100644 --- a/recipes/cppserver/all/conanfile.py +++ b/recipes/cppserver/all/conanfile.py @@ -1,90 +1,116 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, collect_libs +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -import glob +required_conan_version = ">=1.53.0" class CppServer(ConanFile): name = "cppserver" - license = "MIT" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/chronoxor/CppServer" description = "Ultra fast and low latency asynchronous socket server and" \ " client C++ library with support TCP, SSL, UDP, HTTP, HTTPS, WebSocket" \ " protocols and 10K connections problem solution." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/chronoxor/CppServer" topics = ("network", "socket", "asynchronous", "low-latency") - settings = "os", "compiler", "build_type", "arch" - options = {"fPIC": [True, False], - "shared": [True, False]} - default_options = {"fPIC": True, - "shared": False} - requires = ["asio/1.19.1", "openssl/1.1.1k", "cppcommon/1.0.2.0"] - generators = "cmake", "cmake_find_package" - exports_sources = ["patches/**", "CMakeLists.txt"] - _cmake = None + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + "shared": [True, False], + } + default_options = { + "fPIC": True, + "shared": False, + } @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["CPPSERVER_MODULE"] = "OFF" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def _min_cppstd(self): + return 17 @property def _compilers_minimum_version(self): return { "gcc": "9", "Visual Studio": "15", + "msvc": "191", "clang": "5", "apple-clang": "10", } + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") + def layout(self): + cmake_layout(self, src_folder="src") - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + def requirements(self): + self.requires("asio/1.24.0") + self.requires("openssl/1.1.1s") + self.requires("cppcommon/1.0.3.0") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if not minimum_version: - self.output.warn("cppserver requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("cppserver requires a compiler that supports at least C++17") + self.output.warn(f"{self.ref} requires C++17. Your compiler is unknown. Assuming it supports C++17.") + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires a compiler that supports at least C++17") + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "1.0.2.0" and not self._cmake_new_enough("3.20"): + self.tool_requires("cmake/3.25.1") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("CppServer-*")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["CPPSERVER_MODULE"] = False + tc.generate() - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + dpes = CMakeDeps(self) + dpes.generate() - cmake = self._configure_cmake() + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy(pattern="*.inl", dst="include", src=os.path.join(self._source_subfolder, "include")) + + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + copy(self, pattern="*.inl", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32", "crypt32", "mswsock"] diff --git a/recipes/cppserver/all/patches/0001-cmake-clean-up-1-0-0-0.patch b/recipes/cppserver/all/patches/0001-cmake-clean-up-1-0-0-0.patch index edfff9258dabc..757a8d7c15126 100644 --- a/recipes/cppserver/all/patches/0001-cmake-clean-up-1-0-0-0.patch +++ b/recipes/cppserver/all/patches/0001-cmake-clean-up-1-0-0-0.patch @@ -1,8 +1,8 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 5a21eed9..94135f07 100644 +index 5a21eed..399a8ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -18,50 +18,50 @@ if(DOXYGEN_FOUND) +@@ -18,50 +18,51 @@ if(DOXYGEN_FOUND) endif() # CMake module path @@ -59,7 +59,7 @@ index 5a21eed9..94135f07 100644 # Link libraries -list(APPEND LINKLIBS ${OPENSSL_LIBRARIES}) -+list(APPEND LINKLIBS CONAN_PKG::openssl) ++list(APPEND LINKLIBS OpenSSL::SSL) if(WIN32) - list(APPEND LINKLIBS ${CRYPT_LIBRARIES}) - list(APPEND LINKLIBS ${WINSOCK_LIBRARIES}) @@ -67,7 +67,8 @@ index 5a21eed9..94135f07 100644 + list(APPEND LINKLIBS mswsock ws2_32) endif() -list(APPEND LINKLIBS cppcommon) -+list(APPEND LINKLIBS CONAN_PKG::cppcommon) ++find_package(cppcommon REQUIRED) ++list(APPEND LINKLIBS cppcommon::cppcommon) # OpenSSL libraries message(STATUS "OpenSSL version: ${OPENSSL_VERSION} ${OPENSSL_INCLUDE_DIR} ${OPENSSL_LIBRARIES}") @@ -78,12 +79,13 @@ index 5a21eed9..94135f07 100644 # Library file(GLOB_RECURSE LIB_HEADER_FILES "include/*.h") -@@ -70,14 +70,15 @@ file(GLOB_RECURSE LIB_SOURCE_FILES "source/*.cpp") +@@ -70,14 +71,16 @@ file(GLOB_RECURSE LIB_SOURCE_FILES "source/*.cpp") add_library(cppserver ${LIB_HEADER_FILES} ${LIB_INLINE_FILES} ${LIB_SOURCE_FILES}) set_target_properties(cppserver PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}" FOLDER "libraries") target_include_directories(cppserver PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -target_link_libraries(cppserver ${LINKLIBS} asio) -+target_link_libraries(cppserver ${LINKLIBS} CONAN_PKG::asio) ++find_package(asio REQUIRED) ++target_link_libraries(cppserver ${LINKLIBS} asio::asio) +target_compile_features(cppserver PUBLIC cxx_std_17) list(APPEND INSTALL_TARGETS cppserver) list(APPEND LINKLIBS cppserver) @@ -96,7 +98,7 @@ index 5a21eed9..94135f07 100644 file(GLOB EXAMPLE_HEADER_FILES "examples/*.h") file(GLOB EXAMPLE_INLINE_FILES "examples/*.inl") file(GLOB EXAMPLE_SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/examples" "examples/*.cpp") -@@ -90,8 +91,8 @@ if(NOT CPPSERVER_MODULE) +@@ -90,8 +93,8 @@ if(NOT CPPSERVER_MODULE) list(APPEND INSTALL_TARGETS ${EXAMPLE_TARGET}) list(APPEND INSTALL_TARGETS_PDB ${EXAMPLE_TARGET}) endforeach() @@ -107,7 +109,7 @@ index 5a21eed9..94135f07 100644 file(GLOB BENCHMARK_HEADER_FILES "performance/*.h") file(GLOB BENCHMARK_INLINE_FILES "performance/*.inl") file(GLOB BENCHMARK_SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/performance" "performance/*.cpp") -@@ -104,8 +105,8 @@ if(NOT CPPSERVER_MODULE) +@@ -104,8 +107,8 @@ if(NOT CPPSERVER_MODULE) list(APPEND INSTALL_TARGETS ${BENCHMARK_TARGET}) list(APPEND INSTALL_TARGETS_PDB ${BENCHMARK_TARGET}) endforeach() @@ -118,7 +120,7 @@ index 5a21eed9..94135f07 100644 file(GLOB TESTS_HEADER_FILES "tests/*.h") file(GLOB TESTS_INLINE_FILES "tests/*.inl") file(GLOB TESTS_SOURCE_FILES "tests/*.cpp") -@@ -119,15 +120,15 @@ if(NOT CPPSERVER_MODULE) +@@ -119,15 +122,15 @@ if(NOT CPPSERVER_MODULE) # CTest enable_testing() add_test(cppserver-tests cppserver-tests --durations yes --order lex) diff --git a/recipes/cppserver/all/patches/0001-cmake-clean-up-1-0-1-0.patch b/recipes/cppserver/all/patches/0001-cmake-clean-up-1-0-1-0.patch index 336f885c2dec9..b15e8478995a1 100644 --- a/recipes/cppserver/all/patches/0001-cmake-clean-up-1-0-1-0.patch +++ b/recipes/cppserver/all/patches/0001-cmake-clean-up-1-0-1-0.patch @@ -1,17 +1,8 @@ -From 3fa937989fcb8c96a1a73eb016706e5cfb18a799 Mon Sep 17 00:00:00 2001 -From: Alejandro Colomar -Date: Mon, 7 Jun 2021 11:42:21 +0200 -Subject: [PATCH] cmake clean up - ---- - CMakeLists.txt | 59 +++++++++++++++----------------------------------- - 1 file changed, 18 insertions(+), 41 deletions(-) - diff --git a/CMakeLists.txt b/CMakeLists.txt -index 95e9c9e1..2183c531 100644 +index 95e9c9e..8616cb6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -17,52 +17,20 @@ if(DOXYGEN_FOUND) +@@ -17,52 +17,21 @@ if(DOXYGEN_FOUND) endif() endif() @@ -49,7 +40,7 @@ index 95e9c9e1..2183c531 100644 # Link libraries -list(APPEND LINKLIBS ${OPENSSL_LIBRARIES}) -+list(APPEND LINKLIBS CONAN_PKG::openssl) ++list(APPEND LINKLIBS OpenSSL::SSL) if(WIN32) - list(APPEND LINKLIBS ${CRYPT_LIBRARIES}) - list(APPEND LINKLIBS ${WINSOCK_LIBRARIES}) @@ -57,7 +48,8 @@ index 95e9c9e1..2183c531 100644 + list(APPEND LINKLIBS mswsock ws2_32) endif() -list(APPEND LINKLIBS cppcommon) -+list(APPEND LINKLIBS CONAN_PKG::cppcommon) ++find_package(cppcommon REQUIRED) ++list(APPEND LINKLIBS cppcommon::cppcommon) # OpenSSL libraries message(STATUS "OpenSSL version: ${OPENSSL_VERSION} ${OPENSSL_INCLUDE_DIR} ${OPENSSL_LIBRARIES}") @@ -68,17 +60,18 @@ index 95e9c9e1..2183c531 100644 # Library file(GLOB_RECURSE LIB_HEADER_FILES "include/*.h" "source/*.h") file(GLOB_RECURSE LIB_INLINE_FILES "include/*.inl" "source/*.inl") -@@ -70,7 +38,8 @@ file(GLOB_RECURSE LIB_SOURCE_FILES "include/*.cpp" "source/*.cpp") +@@ -70,7 +39,9 @@ file(GLOB_RECURSE LIB_SOURCE_FILES "include/*.cpp" "source/*.cpp") add_library(cppserver ${LIB_HEADER_FILES} ${LIB_INLINE_FILES} ${LIB_SOURCE_FILES}) set_target_properties(cppserver PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}" FOLDER "libraries") target_include_directories(cppserver PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") -target_link_libraries(cppserver ${LINKLIBS} asio) -+target_link_libraries(cppserver ${LINKLIBS} CONAN_PKG::asio) ++find_package(asio REQUIRED) ++target_link_libraries(cppserver ${LINKLIBS} asio::asio) +target_compile_features(cppserver PUBLIC cxx_std_17) list(APPEND INSTALL_TARGETS cppserver) list(APPEND LINKLIBS cppserver) -@@ -78,6 +47,7 @@ list(APPEND LINKLIBS cppserver) +@@ -78,6 +49,7 @@ list(APPEND LINKLIBS cppserver) if(NOT CPPSERVER_MODULE) # Examples @@ -86,7 +79,7 @@ index 95e9c9e1..2183c531 100644 file(GLOB EXAMPLE_HEADER_FILES "examples/*.h") file(GLOB EXAMPLE_INLINE_FILES "examples/*.inl") file(GLOB EXAMPLE_SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/examples" "examples/*.cpp") -@@ -90,8 +60,10 @@ if(NOT CPPSERVER_MODULE) +@@ -90,8 +62,10 @@ if(NOT CPPSERVER_MODULE) list(APPEND INSTALL_TARGETS ${EXAMPLE_TARGET}) list(APPEND INSTALL_TARGETS_PDB ${EXAMPLE_TARGET}) endforeach() @@ -97,7 +90,7 @@ index 95e9c9e1..2183c531 100644 file(GLOB BENCHMARK_HEADER_FILES "performance/*.h") file(GLOB BENCHMARK_INLINE_FILES "performance/*.inl") file(GLOB BENCHMARK_SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/performance" "performance/*.cpp") -@@ -104,8 +76,10 @@ if(NOT CPPSERVER_MODULE) +@@ -104,8 +78,10 @@ if(NOT CPPSERVER_MODULE) list(APPEND INSTALL_TARGETS ${BENCHMARK_TARGET}) list(APPEND INSTALL_TARGETS_PDB ${BENCHMARK_TARGET}) endforeach() @@ -108,7 +101,7 @@ index 95e9c9e1..2183c531 100644 file(GLOB TESTS_HEADER_FILES "tests/*.h") file(GLOB TESTS_INLINE_FILES "tests/*.inl") file(GLOB TESTS_SOURCE_FILES "tests/*.cpp") -@@ -115,19 +89,22 @@ if(NOT CPPSERVER_MODULE) +@@ -115,19 +91,22 @@ if(NOT CPPSERVER_MODULE) target_link_libraries(cppserver-tests ${LINKLIBS}) list(APPEND INSTALL_TARGETS cppserver-tests) list(APPEND INSTALL_TARGETS_PDB cppserver-tests) @@ -135,6 +128,3 @@ index 95e9c9e1..2183c531 100644 foreach(INSTALL_TARGET_PDB ${INSTALL_TARGETS_PDB}) install(FILES $ DESTINATION "${PROJECT_SOURCE_DIR}/bin") endforeach() --- -2.31.1.498.g6c1eba8ee3d - diff --git a/recipes/cppserver/all/patches/0001-cmake-clean-up-1-0-2-0.patch b/recipes/cppserver/all/patches/0001-cmake-clean-up-1-0-2-0.patch new file mode 100644 index 0000000000000..c975a8d3ae2a3 --- /dev/null +++ b/recipes/cppserver/all/patches/0001-cmake-clean-up-1-0-2-0.patch @@ -0,0 +1,133 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 89c0f91..3c842d1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -17,54 +17,25 @@ if(DOXYGEN_FOUND) + endif() + endif() + +-# CMake module path +-set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") +- +-# Compiler features +-include(SetCompilerFeatures) +-include(SetCompilerWarnings) +-include(SetPlatformFeatures) +-include(SystemInformation) +- + # External packages +-if(APPLE) +- set(OPENSSL_ROOT_DIR "/usr/local/opt/openssl@1.1") +-elseif(CYGWIN) +- set(OPENSSL_ROOT_DIR "/usr/lib") +- set(OPENSSL_INCLUDE_DIR "/usr/include") +- set(OPENSSL_CRYPTO_LIBRARY "/usr/lib/libcrypto.dll.a") +- set(OPENSSL_SSL_LIBRARY "/usr/lib/libssl.dll.a") +-elseif(MINGW) +- set(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/modules/OpenSSL/MinGW") +- set(OPENSSL_USE_STATIC_LIBS TRUE) +-elseif(MSVC) +- set(OPENSSL_ROOT_DIR "${CMAKE_CURRENT_SOURCE_DIR}/modules/OpenSSL/VS") +- set(OPENSSL_USE_STATIC_LIBS TRUE) +- set(OPENSSL_MSVC_STATIC_RT TRUE) +-endif() + find_package(OpenSSL REQUIRED) +-if(WIN32) ++if(FALSE) + find_package(Crypt) + find_package(WinSock) + endif() + +-# Modules +-add_subdirectory("modules") +- + # Link libraries +-list(APPEND LINKLIBS ${OPENSSL_LIBRARIES}) ++list(APPEND LINKLIBS OpenSSL::SSL) + if(WIN32) +- list(APPEND LINKLIBS ${CRYPT_LIBRARIES}) +- list(APPEND LINKLIBS ${WINSOCK_LIBRARIES}) ++ list(APPEND LINKLIBS crypt32) ++ list(APPEND LINKLIBS ws2_32) + endif() +-list(APPEND LINKLIBS cppcommon) ++find_package(cppcommon REQUIRED) ++list(APPEND LINKLIBS cppcommon::cppcommon) + + # OpenSSL libraries + message(STATUS "OpenSSL version: ${OPENSSL_VERSION} ${OPENSSL_INCLUDE_DIR} ${OPENSSL_LIBRARIES}") + +-# System directories +-include_directories(SYSTEM "${CMAKE_CURRENT_SOURCE_DIR}/modules") +- + # Library + file(GLOB_RECURSE LIB_HEADER_FILES "include/*.h" "source/*.h") + file(GLOB_RECURSE LIB_INLINE_FILES "include/*.inl" "source/*.inl") +@@ -72,7 +43,9 @@ file(GLOB_RECURSE LIB_SOURCE_FILES "include/*.cpp" "source/*.cpp") + add_library(cppserver ${LIB_HEADER_FILES} ${LIB_INLINE_FILES} ${LIB_SOURCE_FILES}) + set_target_properties(cppserver PROPERTIES COMPILE_FLAGS "${PEDANTIC_COMPILE_FLAGS}" FOLDER "libraries") + target_include_directories(cppserver PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") +-target_link_libraries(cppserver ${LINKLIBS} asio) ++find_package(asio REQUIRED) ++target_link_libraries(cppserver ${LINKLIBS} asio::asio) ++target_compile_features(cppserver PUBLIC cxx_std_17) + list(APPEND INSTALL_TARGETS cppserver) + list(APPEND LINKLIBS cppserver) + +@@ -91,6 +64,7 @@ if(NOT CPPSERVER_MODULE) + list(APPEND LINKLIBS proto) + + # Examples ++ if(FALSE) + file(GLOB EXAMPLE_HEADER_FILES "examples/*.h") + file(GLOB EXAMPLE_INLINE_FILES "examples/*.inl") + file(GLOB EXAMPLE_SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/examples" "examples/*.cpp") +@@ -103,8 +77,10 @@ if(NOT CPPSERVER_MODULE) + list(APPEND INSTALL_TARGETS ${EXAMPLE_TARGET}) + list(APPEND INSTALL_TARGETS_PDB ${EXAMPLE_TARGET}) + endforeach() ++ endif() + + # Benchmarks ++ if(FALSE) + file(GLOB BENCHMARK_HEADER_FILES "performance/*.h") + file(GLOB BENCHMARK_INLINE_FILES "performance/*.inl") + file(GLOB BENCHMARK_SOURCE_FILES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/performance" "performance/*.cpp") +@@ -117,8 +93,10 @@ if(NOT CPPSERVER_MODULE) + list(APPEND INSTALL_TARGETS ${BENCHMARK_TARGET}) + list(APPEND INSTALL_TARGETS_PDB ${BENCHMARK_TARGET}) + endforeach() ++ endif() + + # Tests ++ if(FALSE) + file(GLOB TESTS_HEADER_FILES "tests/*.h") + file(GLOB TESTS_INLINE_FILES "tests/*.inl") + file(GLOB TESTS_SOURCE_FILES "tests/*.cpp") +@@ -128,19 +106,22 @@ if(NOT CPPSERVER_MODULE) + target_link_libraries(cppserver-tests ${LINKLIBS}) + list(APPEND INSTALL_TARGETS cppserver-tests) + list(APPEND INSTALL_TARGETS_PDB cppserver-tests) ++ endif() + + # CTest ++ if(FALSE) + enable_testing() + add_test(cppserver-tests cppserver-tests --durations yes --order lex) ++ endif() + + # Install + install(TARGETS ${INSTALL_TARGETS} +- RUNTIME DESTINATION "${PROJECT_SOURCE_DIR}/bin" +- LIBRARY DESTINATION "${PROJECT_SOURCE_DIR}/bin" +- ARCHIVE DESTINATION "${PROJECT_SOURCE_DIR}/bin") ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + + # Install *.pdb files +- if(MSVC) ++ if(FALSE) + foreach(INSTALL_TARGET_PDB ${INSTALL_TARGETS_PDB}) + install(FILES $ DESTINATION "${PROJECT_SOURCE_DIR}/bin") + endforeach() diff --git a/recipes/cppserver/all/patches/0002-define-win32-winnt-1-0-0-0.patch b/recipes/cppserver/all/patches/0002-define-win32-winnt-1-0-0-0.patch index 0730537c83412..cdbb5c5ddcac9 100644 --- a/recipes/cppserver/all/patches/0002-define-win32-winnt-1-0-0-0.patch +++ b/recipes/cppserver/all/patches/0002-define-win32-winnt-1-0-0-0.patch @@ -1,14 +1,8 @@ -The change present here is handled upstream by this CMake module: - -https://github.com/chronoxor/CppCMakeScripts/blob/1.0.0.0/SetPlatformFeatures.cmake - -Even if it sets _WIN32_WINNT to _WIN32_WINNT_WIN10, here a less strict definiton is chosen (_WIN32_WINNT_VISTA). - diff --git a/CMakeLists.txt b/CMakeLists.txt -index 94135f07..40dcab45 100644 +index 399a8ed..d4590f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -75,6 +75,10 @@ target_compile_features(cppserver PUBLIC cxx_std_17) +@@ -77,6 +77,10 @@ target_compile_features(cppserver PUBLIC cxx_std_17) list(APPEND INSTALL_TARGETS cppserver) list(APPEND LINKLIBS cppserver) diff --git a/recipes/cppserver/all/patches/0002-define-win32-winnt-1-0-1-0.patch b/recipes/cppserver/all/patches/0002-define-win32-winnt-1-0-1-0.patch index 4ba54a1111696..0365fe4134964 100644 --- a/recipes/cppserver/all/patches/0002-define-win32-winnt-1-0-1-0.patch +++ b/recipes/cppserver/all/patches/0002-define-win32-winnt-1-0-1-0.patch @@ -1,33 +1,15 @@ -From 7e22e6744924bf00bcb01bc1efe552446a389915 Mon Sep 17 00:00:00 2001 -From: Alejandro Colomar -Date: Mon, 7 Jun 2021 11:45:37 +0200 -Subject: [PATCH] define win32 winnt - -The change present here is handled upstream by this CMake module: - -https://github.com/chronoxor/CppCMakeScripts/blob/1.0.0.0/SetPlatformFeatures.cmake - -Even if it sets _WIN32_WINNT to _WIN32_WINNT_WIN10, here a less strict -definiton is chosen (_WIN32_WINNT_VISTA). ---- - CMakeLists.txt | 4 ++++ - 1 file changed, 4 insertions(+) - diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2183c531..29fe1a3c 100644 +index 8616cb6..7d26a40 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -43,6 +43,10 @@ target_compile_features(cppserver PUBLIC cxx_std_17) +@@ -45,6 +45,10 @@ target_compile_features(cppserver PUBLIC cxx_std_17) list(APPEND INSTALL_TARGETS cppserver) list(APPEND LINKLIBS cppserver) +if(WIN32 AND NOT MSVC) -+ target_compile_definitions(cppserver PUBLIC -D_WIN32_WINNT=_WIN32_WINNT_VISTA) ++ target_compile_definitions(cppserver PUBLIC -D_WIN32_WINNT=_WIN32_WINNT_VISTA) +endif() + # Additional module components: benchmarks, examples, plugins, tests, tools and install if(NOT CPPSERVER_MODULE) --- -2.31.1.498.g6c1eba8ee3d - diff --git a/recipes/cppserver/all/patches/0002-define-win32-winnt-1-0-2-0.patch b/recipes/cppserver/all/patches/0002-define-win32-winnt-1-0-2-0.patch new file mode 100644 index 0000000000000..4166ac1bfa138 --- /dev/null +++ b/recipes/cppserver/all/patches/0002-define-win32-winnt-1-0-2-0.patch @@ -0,0 +1,15 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3c842d1..0c92512 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -49,6 +49,10 @@ target_compile_features(cppserver PUBLIC cxx_std_17) + list(APPEND INSTALL_TARGETS cppserver) + list(APPEND LINKLIBS cppserver) + ++if(WIN32 AND NOT MSVC) ++ target_compile_definitions(cppserver PUBLIC -D_WIN32_WINNT=_WIN32_WINNT_VISTA) ++endif() ++ + # Additional module components: benchmarks, examples, plugins, tests, tools and install + if(NOT CPPSERVER_MODULE) + diff --git a/recipes/cppserver/all/patches/0003-remove-asio-defines-1-0-1-0.patch b/recipes/cppserver/all/patches/0003-remove-asio-defines-1-0-1-0.patch deleted file mode 100644 index 796ba572a73d1..0000000000000 --- a/recipes/cppserver/all/patches/0003-remove-asio-defines-1-0-1-0.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 3eba074264a5b3a36fedff3e5b13b3743bba2932 Mon Sep 17 00:00:00 2001 -From: Alejandro Colomar -Date: Mon, 7 Jun 2021 11:46:46 +0200 -Subject: [PATCH] remove asio defines - ---- - include/server/asio/asio.h | 2 -- - 1 file changed, 2 deletions(-) - -diff --git a/include/server/asio/asio.h b/include/server/asio/asio.h -index 8ad4d6bc..b8cb7030 100644 ---- a/include/server/asio/asio.h -+++ b/include/server/asio/asio.h -@@ -26,8 +26,6 @@ - - #else - --#define ASIO_STANDALONE --#define ASIO_SEPARATE_COMPILATION - #define ASIO_NO_WIN32_LEAN_AND_MEAN - - #if defined(_MSC_VER) --- -2.31.1.498.g6c1eba8ee3d - diff --git a/recipes/cppserver/all/test_package/CMakeLists.txt b/recipes/cppserver/all/test_package/CMakeLists.txt index ba1e21ea8636c..6a18a7561cd17 100644 --- a/recipes/cppserver/all/test_package/CMakeLists.txt +++ b/recipes/cppserver/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(cppserver REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -conan_target_link_libraries(${PROJECT_NAME}) - -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) +target_link_libraries(${PROJECT_NAME} PRIVATE cppserver::cppserver) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/cppserver/all/test_package/conanfile.py b/recipes/cppserver/all/test_package/conanfile.py index 4903f1a7e8fa0..a9fbb7f543162 100644 --- a/recipes/cppserver/all/test_package/conanfile.py +++ b/recipes/cppserver/all/test_package/conanfile.py @@ -1,9 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cppserver/all/test_v1_package/CMakeLists.txt b/recipes/cppserver/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/cppserver/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cppserver/all/test_v1_package/conanfile.py b/recipes/cppserver/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/cppserver/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cppserver/config.yml b/recipes/cppserver/config.yml index 75c89baf4fb06..bb5222f546170 100644 --- a/recipes/cppserver/config.yml +++ b/recipes/cppserver/config.yml @@ -1,5 +1,7 @@ versions: - "1.0.0.0": + "1.0.2.0": folder: all "1.0.1.0": folder: all + "1.0.0.0": + folder: all diff --git a/recipes/cpptoml/all/conandata.yml b/recipes/cpptoml/all/conandata.yml index ecf28c21afa80..08ce9d848e1e3 100644 --- a/recipes/cpptoml/all/conandata.yml +++ b/recipes/cpptoml/all/conandata.yml @@ -1,4 +1,4 @@ sources: "0.1.1": url: "https://github.com/skystrife/cpptoml/archive/refs/tags/v0.1.1.tar.gz" - sha256: "23AF72468CFD4040984D46A0DD2A609538579C78DDC429D6B8FD7A10A6E24403" + sha256: "23af72468cfd4040984d46a0dd2a609538579c78ddc429d6b8fd7a10a6e24403" diff --git a/recipes/cpptoml/all/conanfile.py b/recipes/cpptoml/all/conanfile.py index ef0c1cce938aa..3085e5c8dce85 100644 --- a/recipes/cpptoml/all/conanfile.py +++ b/recipes/cpptoml/all/conanfile.py @@ -1,5 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get, save +from conan.tools.layout import basic_layout import os +import textwrap + +required_conan_version = ">=1.50.0" class CppTomlConan(ConanFile): @@ -9,20 +14,53 @@ class CppTomlConan(ConanFile): license = "MIT" homepage = "https://github.com/skystrife/cpptoml" url = "https://github.com/conan-io/conan-center-index" + package_type = "header-library" settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + pass def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) - def package_id(self): - self.info.header_only() + # TODO: to remove in conan v2 + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {"cpptoml": "cpptoml::cpptoml"}, + ) + + def _create_cmake_module_alias_targets(self, module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent(f"""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "cpptoml") + self.cpp_info.set_property("cmake_target_name", "cpptoml") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + # TODO: to remove in conan v2 + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/cpptoml/all/test_package/CMakeLists.txt b/recipes/cpptoml/all/test_package/CMakeLists.txt index 10ee7400cfee2..f67d21d53d2fc 100644 --- a/recipes/cpptoml/all/test_package/CMakeLists.txt +++ b/recipes/cpptoml/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(cpptoml CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} cpptoml::cpptoml) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE cpptoml) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cpptoml/all/test_package/conanfile.py b/recipes/cpptoml/all/test_package/conanfile.py index 1bf1c7e26255d..0a6bc68712d90 100644 --- a/recipes/cpptoml/all/test_package/conanfile.py +++ b/recipes/cpptoml/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpptoml/all/test_v1_package/CMakeLists.txt b/recipes/cpptoml/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cpptoml/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cpptoml/all/test_v1_package/conanfile.py b/recipes/cpptoml/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cpptoml/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cppunit/all/conanfile.py b/recipes/cppunit/all/conanfile.py index 25082a8134246..37927a939aa12 100644 --- a/recipes/cppunit/all/conanfile.py +++ b/recipes/cppunit/all/conanfile.py @@ -1,17 +1,27 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -import contextlib +from conan import ConanFile +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +from conan.tools.build import stdcpp_library +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rename, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.57.0" class CppunitConan(ConanFile): name = "cppunit" - description = "CppUnit is the C++ port of the famous JUnit framework for unit testing. Test output is in XML for automatic testing and GUI based for supervised tests." - topics = ("conan", "cppunit", "unit-test", "tdd") + description = ( + "CppUnit is the C++ port of the famous JUnit framework for unit testing. " + "Test output is in XML for automatic testing and GUI based for supervised tests." + ) + topics = ("unit-test", "tdd") license = " LGPL-2.1-or-later" homepage = "https://freedesktop.org/wiki/Software/cppunit/" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,14 +32,6 @@ class CppunitConan(ConanFile): "fPIC": True, } - generators = "pkg_config" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -40,85 +42,84 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - if self.settings.compiler == "Visual Studio": - self.build_requires("automake/1.16.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("automake/1.16.5") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)), - "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "NM": "dumpbin -symbols", - "OBJDUMP": ":", - "RANLIB": ":", - "STRIP": ":", - } - with tools.environment_append(env): - yield - else: - yield + def generate(self): + env = VirtualBuildEnv(self) + env.generate() - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + tc = AutotoolsToolchain(self) if self.settings.os == "Windows" and self.options.shared: - self._autotools.defines.append("CPPUNIT_BUILD_DLL") - if self.settings.compiler == "Visual Studio": - self._autotools.flags.append("-FS") - self._autotools.cxx_flags.append("-EHsc") + tc.extra_defines.append("CPPUNIT_BUILD_DLL") + if is_msvc(self): + tc.extra_cxxflags.append("-EHsc") + if check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + if is_apple_os(self): + # https://github.com/conan-io/conan-center-index/pull/15759#issuecomment-1419046535 + tc.extra_ldflags.append("-headerpad_max_install_names") yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), + tc.configure_args.extend([ "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), "--enable-doxygen=no", "--enable-dot=no", "--enable-werror=no", "--enable-html-docs=no", - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + ]) + env = tc.environment() + if is_msvc(self): + compile_wrapper = unix_path(self, self.conf.get("user.automake:compile-wrapper", check_type=str)) + ar_wrapper = unix_path(self, self.conf.get("user.automake:lib-wrapper", check_type=str)) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + tc.generate(env) def build(self): - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - - if self.settings.compiler == "Visual Studio" and self.options.shared: - os.rename(os.path.join(self.package_folder, "lib", "cppunit.dll.lib"), - os.path.join(self.package_folder, "lib", "cppunit.lib")) - - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + if is_msvc(self) and self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "cppunit.dll.lib"), + os.path.join(self.package_folder, "lib", "cppunit.lib")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "cppunit") self.cpp_info.libs = ["cppunit"] if not self.options.shared: - stdlib = tools.stdcpp_library(self) - if stdlib: - self.cpp_info.system_libs.append(stdlib) - if self.settings.os == "Linux": - self.cpp_info.system_libs.append("dl") + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["dl", "m"]) if self.options.shared and self.settings.os == "Windows": self.cpp_info.defines.append("CPPUNIT_DLL") - self.cpp_info.filenames["pkg_config"] = "cppunit" diff --git a/recipes/cppunit/all/test_package/CMakeLists.txt b/recipes/cppunit/all/test_package/CMakeLists.txt index a5527484bd16a..e62b0d941a7cc 100644 --- a/recipes/cppunit/all/test_package/CMakeLists.txt +++ b/recipes/cppunit/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() +find_package(cppunit REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE cppunit::cppunit) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/cppunit/all/test_package/conanfile.py b/recipes/cppunit/all/test_package/conanfile.py index d4128b0450777..0a6bc68712d90 100644 --- a/recipes/cppunit/all/test_package/conanfile.py +++ b/recipes/cppunit/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cppunit/all/test_v1_package/CMakeLists.txt b/recipes/cppunit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cppunit/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cppunit/all/test_v1_package/conanfile.py b/recipes/cppunit/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cppunit/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cpputest/all/CMakeLists.txt b/recipes/cpputest/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/cpputest/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/cpputest/all/conandata.yml b/recipes/cpputest/all/conandata.yml index 09eda2464fea7..6511c1a3d0188 100644 --- a/recipes/cpputest/all/conandata.yml +++ b/recipes/cpputest/all/conandata.yml @@ -2,3 +2,7 @@ sources: "4.0": url: "https://github.com/cpputest/cpputest/releases/download/v4.0/cpputest-4.0.tar.gz" sha256: 21c692105db15299b5529af81a11a7ad80397f92c122bd7bf1e4a4b0e85654f7 +patches: + "4.0": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "CMake: move cmake_minimum_required() before project()" diff --git a/recipes/cpputest/all/conanfile.py b/recipes/cpputest/all/conanfile.py index da85e23f49b83..ee586cab99d82 100644 --- a/recipes/cpputest/all/conanfile.py +++ b/recipes/cpputest/all/conanfile.py @@ -1,10 +1,10 @@ -from conans import CMake from conan import ConanFile -from conan import tools +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save import os import textwrap -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.52.0" class CppUTestConan(ConanFile): @@ -32,51 +32,44 @@ class CppUTestConan(ConanFile): "with_leak_detection": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") + def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["STD_C"] = True + tc.variables["STD_CPP"] = True + tc.variables["C++11"] = True + tc.variables["MEMORY_LEAK_DETECTION"] = self.options.with_leak_detection + tc.variables["EXTENSIONS"] = self.options.with_extensions + tc.variables["LONGLONG"] = True + tc.variables["COVERAGE"] = False + tc.variables["TESTS"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["STD_C"] = "ON" - self._cmake.definitions["STD_CPP"] = "ON" - self._cmake.definitions["C++11"] = "ON" - self._cmake.definitions["MEMORY_LEAK_DETECTION"] = self.options.with_leak_detection - self._cmake.definitions["EXTENSIONS"] = self.options.with_extensions - self._cmake.definitions["LONGLONG"] = "ON" - self._cmake.definitions["COVERAGE"] = "OFF" - self._cmake.definitions["TESTS"] = "OFF" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "CppUTest")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "CppUTest")) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self._create_cmake_module_alias_targets( @@ -90,13 +83,13 @@ def package(self): def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.files.save(self, module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): diff --git a/recipes/cpputest/all/patches/0001-fix-cmake.patch b/recipes/cpputest/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..a40096caf1d6d --- /dev/null +++ b/recipes/cpputest/all/patches/0001-fix-cmake.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,3 +1,4 @@ ++cmake_minimum_required(VERSION 3.1) + project(CppUTest) + + set(CppUTest_version_major 4) +@@ -5,7 +6,6 @@ set(CppUTest_version_minor 0) + + # 2.6.3 is needed for ctest support + # 3.1 is needed for target_sources +-cmake_minimum_required(VERSION 3.1) + + ############### + # Conan support diff --git a/recipes/cpputest/all/test_package/CMakeLists.txt b/recipes/cpputest/all/test_package/CMakeLists.txt index 969978c25106c..be713b804677f 100644 --- a/recipes/cpputest/all/test_package/CMakeLists.txt +++ b/recipes/cpputest/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(CppUTest REQUIRED CONFIG) add_executable(test_package test_package.cpp) -target_link_libraries(test_package CppUTest) +target_link_libraries(test_package PRIVATE CppUTest) if(WITH_EXTENSIONS) add_executable(test_package_with_extensions test_package_with_extensions.cpp) - target_link_libraries(test_package_with_extensions CppUTestExt) + target_link_libraries(test_package_with_extensions PRIVATE CppUTestExt) endif() diff --git a/recipes/cpputest/all/test_package/conanfile.py b/recipes/cpputest/all/test_package/conanfile.py index 95ba20dea5174..f422d1c08f29f 100644 --- a/recipes/cpputest/all/test_package/conanfile.py +++ b/recipes/cpputest/all/test_package/conanfile.py @@ -1,23 +1,34 @@ -from conans import CMake -from conan import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_EXTENSIONS"] = self.dependencies["cpputest"].options.with_extensions + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["WITH_EXTENSIONS"] = self.options["cpputest"].with_extensions cmake.configure() cmake.build() def test(self): - if tools.build.cross_building(self): - return - - self.run(os.path.join("bin", "test_package"), run_environment=True) - - if self.options["cpputest"].with_extensions: - self.run(os.path.join("bin", "test_package_with_extensions"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + if self.options["cpputest"].with_extensions: + bin_extensions_path = os.path.join(self.cpp.build.bindirs[0], "test_package_with_extensions") + self.run(bin_extensions_path, env="conanrun") diff --git a/recipes/cpputest/all/test_v1_package/CMakeLists.txt b/recipes/cpputest/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cpputest/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cpputest/all/test_v1_package/conanfile.py b/recipes/cpputest/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..cce86300f1595 --- /dev/null +++ b/recipes/cpputest/all/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["WITH_EXTENSIONS"] = self.options["cpputest"].with_extensions + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + if self.options["cpputest"].with_extensions: + bin_extensions_path = os.path.join("bin", "test_package_with_extensions") + self.run(bin_extensions_path, run_environment=True) diff --git a/recipes/cppzmq/all/conandata.yml b/recipes/cppzmq/all/conandata.yml index cff7b41edaca6..263917af47c65 100644 --- a/recipes/cppzmq/all/conandata.yml +++ b/recipes/cppzmq/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.9.0": + url: "https://github.com/zeromq/cppzmq/archive/v4.9.0.tar.gz" + sha256: "3fdf5b100206953f674c94d40599bdb3ea255244dcc42fab0d75855ee3645581" "4.8.1": url: "https://github.com/zeromq/cppzmq/archive/v4.8.1.tar.gz" sha256: "7a23639a45f3a0049e11a188e29aaedd10b2f4845f0000cf3e22d6774ebde0af" diff --git a/recipes/cppzmq/all/conanfile.py b/recipes/cppzmq/all/conanfile.py index b76e007c8835d..44e3718dd5de3 100644 --- a/recipes/cppzmq/all/conanfile.py +++ b/recipes/cppzmq/all/conanfile.py @@ -1,8 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get, save +from conan.tools.layout import basic_layout import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class CppZmqConan(ConanFile): @@ -17,23 +19,25 @@ class CppZmqConan(ConanFile): no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("zeromq/4.3.4") + self.requires("zeromq/4.3.4", transitive_headers=True, transitive_libs=True) def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("zmq*.hpp", dst="include", src=self._source_subfolder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "zmq*.hpp", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self._create_cmake_module_alias_targets( @@ -44,21 +48,20 @@ def package(self): } ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "cppzmq") @@ -67,6 +70,8 @@ def package_info(self): # - cppzmq-static if cppzmq depends on static zeromq self.cpp_info.set_property("cmake_target_name", "cppzmq") self.cpp_info.set_property("cmake_target_aliases", ["cppzmq-static"]) + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "cppzmq" diff --git a/recipes/cppzmq/all/test_package/CMakeLists.txt b/recipes/cppzmq/all/test_package/CMakeLists.txt index 6f9d165d70f7b..207bcc2f27a5a 100644 --- a/recipes/cppzmq/all/test_package/CMakeLists.txt +++ b/recipes/cppzmq/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(cppzmq REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} cppzmq) +target_link_libraries(${PROJECT_NAME} PRIVATE cppzmq) diff --git a/recipes/cppzmq/all/test_package/conanfile.py b/recipes/cppzmq/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/cppzmq/all/test_package/conanfile.py +++ b/recipes/cppzmq/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cppzmq/all/test_v1_package/CMakeLists.txt b/recipes/cppzmq/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/cppzmq/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cppzmq/all/test_v1_package/conanfile.py b/recipes/cppzmq/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cppzmq/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cppzmq/config.yml b/recipes/cppzmq/config.yml index 45c1476bb5ca0..a52b8593d6634 100644 --- a/recipes/cppzmq/config.yml +++ b/recipes/cppzmq/config.yml @@ -1,4 +1,6 @@ versions: + "4.9.0": + folder: all "4.8.1": folder: all "4.7.1": diff --git a/recipes/cpr/all/CMakeLists.txt b/recipes/cpr/all/CMakeLists.txt deleted file mode 100644 index f00dad984610f..0000000000000 --- a/recipes/cpr/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/cpr/all/conandata.yml b/recipes/cpr/all/conandata.yml index d7338e66daa30..277dded29fd34 100644 --- a/recipes/cpr/all/conandata.yml +++ b/recipes/cpr/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.10.0": + url: "https://github.com/libcpr/cpr/archive/refs/tags/1.10.0.tar.gz" + sha256: "d669c028bd63a1c8827c32b348ecc85e46747bb33be3b00ce59b77717b91aee8" + "1.9.3": + url: "https://github.com/libcpr/cpr/archive/refs/tags/1.9.3.tar.gz" + sha256: "df53e7213d80fdc24583528521f7d3349099f5bb4ed05ab05206091a678cc53c" "1.9.0": url: "https://github.com/libcpr/cpr/archive/refs/tags/1.9.0.tar.gz" sha256: "67023cde8979e8371f5ee7d6e586d6d0761af4a3a3a3be6270256353c9bf411f" @@ -18,29 +24,59 @@ sources: url: "https://github.com/libcpr/cpr/archive/1.4.0.tar.gz" sha256: "13baffba95445e02291684e31906b04df41d8c6a3020a1a55253047c6756a004" patches: + "1.10.0": + - patch_file: "patches/008-1.10.0-remove-warning-flags.patch" + patch_description: "disable warning flags and warning as error" + patch_type: "portability" + "1.9.3": + - patch_file: "patches/005-1.9.3-fix-curl-components.patch" + patch_description: "use cci package" + patch_type: "conan" + - patch_file: "patches/008-1.9.3-remove-warning-flags.patch" + patch_description: "disable warning flags and warning as error" + patch_type: "portability" "1.9.0": - patch_file: "patches/005-1.9.0-fix-curl-components.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" + - patch_file: "patches/008-1.8.1-remove-warning-flags.patch" + patch_description: "disable warning flags and warning as error" + patch_type: "portability" "1.8.1": - patch_file: "patches/005-1.8.1-fix-curl-components.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" - patch_file: "patches/007-fix-dll-install.patch" - base_path: "source_subfolder" + patch_description: "fix install path for dll" + patch_type: "conan" + - patch_file: "patches/008-1.8.1-remove-warning-flags.patch" + patch_description: "disable warning flags and warning as error" + patch_type: "portability" "1.7.2": - patch_file: "patches/005-1.7.2-fix-curl-components.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" - patch_file: "patches/007-fix-dll-install.patch" - base_path: "source_subfolder" + patch_description: "fix install path for dll" + patch_type: "conan" + - patch_file: "patches/008-1.7.2-remove-warning-flags.patch" + patch_description: "disable warning flags and warning as error" + patch_type: "portability" "1.6.2": - patch_file: "patches/005-1.6.2-fix-curl-components.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" "1.5.2": - patch_file: "patches/005-1.5.2-fix-curl-components.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" "1.4.0": - patch_file: "patches/002-1.4.0-create-install.patch" - base_path: "source_subfolder" + patch_description: "add install definition" + patch_type: "conan" - patch_file: "patches/003-1.4.0-curl-use-target.patch" - base_path: "source_subfolder" + patch_description: "link curl library as target name" + patch_type: "portability" - patch_file: "patches/004-1.4.0-curl-global-scope.patch" - base_path: "source_subfolder" + patch_description: "use cci package" + patch_type: "conan" diff --git a/recipes/cpr/all/conanfile.py b/recipes/cpr/all/conanfile.py index 90958d55211c7..8b42a60f1a395 100644 --- a/recipes/cpr/all/conanfile.py +++ b/recipes/cpr/all/conanfile.py @@ -1,11 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc -from conan.tools.build import cross_building +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building, check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class CprConan(ConanFile): @@ -25,70 +28,75 @@ class CprConan(ConanFile): "fPIC": [True, False], "with_ssl": ["openssl", "darwinssl", "winssl", _AUTO_SSL, _NO_SSL], "signal": [True, False], + "verbose_logging": [True, False], } default_options = { "shared": False, "fPIC": True, "with_ssl": _AUTO_SSL, "signal": True, + "verbose_logging": False, } - generators = "cmake", "cmake_find_package" - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 if Version(self.version) < "1.10.0" else 17 @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + if self._min_cppstd == 11: + return {} + return { + "gcc": "9", + "clang": "7", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } @property def _supports_openssl(self): # https://github.com/libcpr/cpr/commit/b036a3279ba62720d1e43362d32202bf412ea152 # https://github.com/libcpr/cpr/releases/tag/1.5.0 - return tools.Version(self.version) >= "1.5.0" and not tools.is_apple_os(self.settings.os) + return Version(self.version) >= "1.5.0" and not is_apple_os(self) @property def _supports_winssl(self): # https://github.com/libcpr/cpr/commit/18e1fc5c3fc0ffc07695f1d78897fb69e7474ea9 # https://github.com/libcpr/cpr/releases/tag/1.5.1 - return tools.Version(self.version) >= "1.5.1" and self.settings.os == "Windows" + return Version(self.version) >= "1.5.1" and self.settings.os == "Windows" @property def _supports_darwinssl(self): # https://github.com/libcpr/cpr/releases/tag/1.6.1 - return tools.Version(self.version) >= "1.6.1" and tools.is_apple_os(self.settings.os) + return Version(self.version) >= "1.6.1" and is_apple_os(self.settings.os) @property def _can_auto_ssl(self): # https://github.com/libcpr/cpr/releases/tag/1.6.0 return not self._uses_old_cmake_options and not ( # https://github.com/libcpr/cpr/issues/546 - tools.Version(self.version) in ["1.6.0", "1.6.1"] - and tools.is_apple_os(self.settings.os) + Version(self.version) in ["1.6.0", "1.6.1"] + and is_apple_os(self.settings.os) ) @property def _uses_old_cmake_options(self): # https://github.com/libcpr/cpr/releases/tag/1.6.0 - return tools.Version(self.version) < "1.6.0" + return Version(self.version) < "1.6.0" @property def _uses_valid_abi_and_compiler(self): # https://github.com/conan-io/conan-center-index/pull/5194#issuecomment-821908385 return not ( - tools.Version(self.version) >= "1.6.0" + Version(self.version) >= "1.6.0" and self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libstdc++" - and tools.Version(self.settings.compiler.version) < "9" + and Version(self.settings.compiler.version) < "9" ) def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -103,14 +111,45 @@ def config_options(self): self.output.info("Auto SSL is not available below version 1.6.0 (or below 1.6.2 on macOS), and openssl not supported. Disabling SSL") self.options.with_ssl = CprConan._NO_SSL + if Version(self.version) < "1.10.0": + del self.options.verbose_logging + def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libcurl/7.80.0") + self.requires("libcurl/7.87.0") + + # Check if the system supports the given ssl library + def _supports_ssl_library(self, library): + if library == CprConan._NO_SSL: + return True + elif library == CprConan._AUTO_SSL: + return self._can_auto_ssl + + validators = { + "openssl": self._supports_openssl, + "darwinssl": self._supports_darwinssl, + "winssl": self._supports_winssl, + CprConan._AUTO_SSL: self._can_auto_ssl + } + + # A KeyError should never happen, as the options are validated by conan. + return validators[library] def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + SSL_FAILURE_MESSAGES = { "openssl": "OpenSSL is not supported on macOS or on CPR versions < 1.5.0", "darwinssl": "DarwinSSL is only supported on macOS and on CPR versions >= 1.6.1", @@ -119,34 +158,35 @@ def validate(self): } if not self._uses_valid_abi_and_compiler: - raise ConanInvalidConfiguration("Cannot compile cpr/1.6.0 with libstdc++ on clang < 9") + raise ConanInvalidConfiguration(f"Cannot compile {self.ref} with libstdc++ on clang < 9") - ssl_library = str(self.options.get_safe("with_ssl")) + ssl_library = str(self.options.with_ssl) if not self._supports_ssl_library(ssl_library): raise ConanInvalidConfiguration( - "Invalid SSL selection for the given configuration: {}".format(SSL_FAILURE_MESSAGES[ssl_library]) + f"Invalid SSL selection for the given configuration: {SSL_FAILURE_MESSAGES[ssl_library]}" if ssl_library in SSL_FAILURE_MESSAGES - else "Invalid value of ssl option, {}".format(ssl_library) + else f"Invalid value of ssl option, {ssl_library}" ) if ssl_library not in (CprConan._AUTO_SSL, CprConan._NO_SSL, "winssl") and ssl_library != self.options["libcurl"].with_ssl: - raise ConanInvalidConfiguration("cpr requires libcurl to be built with the option with_ssl='{}'.".format(self.options.get_safe('with_ssl'))) + raise ConanInvalidConfiguration( + f"{self.ref}:with_ssl={self.options.with_ssl} requires libcurl:with_ssl={self.options.with_ssl}" + ) if ssl_library == "winssl" and self.options["libcurl"].with_ssl != "schannel": - raise ConanInvalidConfiguration("cpr requires libcurl to be built with the option with_ssl='schannel'") + raise ConanInvalidConfiguration( + f"{self.ref}:with_ssl=winssl requires libcurl:with_ssl=schannel" + ) - if is_msvc(self) and self.options.shared and "MT" in self.settings.compiler.runtime: + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") - if tools.Version(self.version) == "1.9.0" and self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "6": - raise ConanInvalidConfiguration("{}/{} doesn't support gcc < 6".format(self.name, self.version)) + if Version(self.version) >= "1.9.0" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support gcc < 6") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def _get_cmake_option(self, option): CPR_1_6_CMAKE_OPTIONS_TO_OLD = { @@ -162,18 +202,22 @@ def _get_cmake_option(self, option): if self._uses_old_cmake_options: # Get the translated option if we can, or the original if one isn't defined. return CPR_1_6_CMAKE_OPTIONS_TO_OLD.get(option, option) - else: - return option - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions[self._get_cmake_option("CPR_FORCE_USE_SYSTEM_CURL")] = True - cmake.definitions[self._get_cmake_option("CPR_BUILD_TESTS")] = False - cmake.definitions[self._get_cmake_option("CPR_GENERATE_COVERAGE")] = False - cmake.definitions[self._get_cmake_option("CPR_USE_SYSTEM_GTEST")] = False - cmake.definitions["CPR_CURL_NOSIGNAL"] = not self.options.signal + CPR_1_6_CMAKE_OPTIONS_TO_1_10 = { + "CPR_FORCE_USE_SYSTEM_CURL": "CPR_USE_SYSTEM_CURL" + } + if Version(self.version) >= "1.10.0": + return CPR_1_6_CMAKE_OPTIONS_TO_1_10.get(option, option) + return option + + def generate(self): + tc = CMakeToolchain(self) + tc.variables[self._get_cmake_option("CPR_FORCE_USE_SYSTEM_CURL")] = True + tc.variables[self._get_cmake_option("CPR_BUILD_TESTS")] = False + tc.variables[self._get_cmake_option("CPR_GENERATE_COVERAGE")] = False + tc.variables[self._get_cmake_option("CPR_USE_SYSTEM_GTEST")] = False + tc.variables["CPR_CURL_NOSIGNAL"] = not self.options.signal ssl_value = str(self.options.get_safe("with_ssl")) SSL_OPTIONS = { "CPR_FORCE_DARWINSSL_BACKEND": ssl_value == "darwinssl", @@ -181,60 +225,42 @@ def _configure_cmake(self): "CPR_FORCE_WINSSL_BACKEND": ssl_value == "winssl", "CMAKE_USE_OPENSSL": ssl_value == "openssl" } - for cmake_option, value in SSL_OPTIONS.items(): - cmake.definitions[self._get_cmake_option(cmake_option)] = value - + tc.variables[self._get_cmake_option(cmake_option)] = value # If we are on a version where disabling SSL requires a cmake option, disable it if not self._uses_old_cmake_options and str(self.options.get_safe("with_ssl")) == CprConan._NO_SSL: - cmake.definitions["CPR_ENABLE_SSL"] = False - - if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): - cmake.definitions["THREAD_SANITIZER_AVAILABLE_EXITCODE"] = 1 - cmake.definitions["THREAD_SANITIZER_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 - cmake.definitions["ADDRESS_SANITIZER_AVAILABLE_EXITCODE"] = 1 - cmake.definitions["ADDRESS_SANITIZER_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 - cmake.definitions["ALL_SANITIZERS_AVAILABLE_EXITCODE"] = 1 - cmake.definitions["ALL_SANITIZERS_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 - - cmake.configure(build_folder=self._build_subfolder) - return cmake - - # Check if the system supports the given ssl library - def _supports_ssl_library(self, library): - if library == CprConan._NO_SSL: - return True - elif library == CprConan._AUTO_SSL: - return self._can_auto_ssl - - validators = { - "openssl": self._supports_openssl, - "darwinssl": self._supports_darwinssl, - "winssl": self._supports_winssl, - CprConan._AUTO_SSL: self._can_auto_ssl - } - - # A KeyError should never happen, as the options are validated by conan. - return validators[library] + tc.variables["CPR_ENABLE_SSL"] = False + + if self.options.get_safe("verbose_logging", False): + tc.variables["CURL_VERBOSE_LOGGING"] = True + if cross_building(self, skip_x64_x86=True): + tc.variables["THREAD_SANITIZER_AVAILABLE_EXITCODE"] = 1 + tc.variables["THREAD_SANITIZER_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 + tc.variables["ADDRESS_SANITIZER_AVAILABLE_EXITCODE"] = 1 + tc.variables["ADDRESS_SANITIZER_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 + tc.variables["ALL_SANITIZERS_AVAILABLE_EXITCODE"] = 1 + tc.variables["ALL_SANITIZERS_AVAILABLE_EXITCODE__TRYRUN_OUTPUT"] = 1 + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "cpr") + self.cpp_info.set_property("cmake_target_name", "cpr::cpr") self.cpp_info.libs = ["cpr"] - if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - - self.cpp_info.set_property("cmake_target_name", "cpr::cpr") - - self.cpp_info.names["cmake_find_package"] = "cpr" - self.cpp_info.names["cmake_find_package_multi"] = "cpr" diff --git a/recipes/cpr/all/patches/003-1.4.0-curl-use-target.patch b/recipes/cpr/all/patches/003-1.4.0-curl-use-target.patch index 8c5c37a715199..61ba93886b977 100644 --- a/recipes/cpr/all/patches/003-1.4.0-curl-use-target.patch +++ b/recipes/cpr/all/patches/003-1.4.0-curl-use-target.patch @@ -9,7 +9,7 @@ index c4f9b5b..7e2279d 100644 message(STATUS "Using CURL_LIBRARIES: ${CURL_LIBRARIES}.") -target_link_libraries(${CPR_LIBRARIES} - ${CURL_LIBRARIES}) -+target_link_libraries(cpr PUBLIC CURL::CURL) ++target_link_libraries(cpr PUBLIC CURL::libcurl) include(GNUInstallDirs) install(TARGETS cpr diff --git a/recipes/cpr/all/patches/005-1.9.3-fix-curl-components.patch b/recipes/cpr/all/patches/005-1.9.3-fix-curl-components.patch new file mode 100644 index 0000000000000..dee08272019c7 --- /dev/null +++ b/recipes/cpr/all/patches/005-1.9.3-fix-curl-components.patch @@ -0,0 +1,21 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 0c10971..9627982 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -150,6 +150,8 @@ endif() + + # Curl configuration + if(CPR_FORCE_USE_SYSTEM_CURL) ++ find_package(CURL REQUIRED) ++ if(0) + if(CPR_ENABLE_SSL) + find_package(CURL COMPONENTS HTTP HTTPS) + if(CURL_FOUND) +@@ -174,6 +176,7 @@ if(CPR_FORCE_USE_SYSTEM_CURL) + message(FATAL_ERROR "Curl not found on this system. To use the build in version set CPR_FORCE_USE_SYSTEM_CURL to OFF.") + endif() + endif() ++ endif() + else() + message(STATUS "Configuring build in curl...") + diff --git a/recipes/cpr/all/patches/008-1.10.0-remove-warning-flags.patch b/recipes/cpr/all/patches/008-1.10.0-remove-warning-flags.patch new file mode 100644 index 0000000000000..d4ec5ce51366c --- /dev/null +++ b/recipes/cpr/all/patches/008-1.10.0-remove-warning-flags.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d0e8854..807377f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -103,11 +103,6 @@ if(CPR_ENABLE_CPPCHECK) + include(cmake/cppcheck.cmake) + endif() + +-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") +-else() +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror") +-endif() +- + # SSL + if(CPR_ENABLE_SSL) + if(CPR_FORCE_OPENSSL_BACKEND OR CPR_FORCE_WINSSL_BACKEND OR CPR_FORCE_DARWINSSL_BACKEND OR CPR_FORCE_MBEDTLS_BACKEND) diff --git a/recipes/cpr/all/patches/008-1.7.2-remove-warning-flags.patch b/recipes/cpr/all/patches/008-1.7.2-remove-warning-flags.patch new file mode 100644 index 0000000000000..e05c2f4263fde --- /dev/null +++ b/recipes/cpr/all/patches/008-1.7.2-remove-warning-flags.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fef2d28..6dcbf0d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -67,11 +67,6 @@ if(CPR_ENABLE_CPPCHECK) + include(cmake/cppcheck.cmake) + endif() + +-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") +-else() +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror") +-endif() +- + # SSL + if(CPR_ENABLE_SSL) + if(CPR_FORCE_OPENSSL_BACKEND OR CPR_FORCE_WINSSL_BACKEND OR CPR_FORCE_DARWINSSL_BACKEND) diff --git a/recipes/cpr/all/patches/008-1.8.1-remove-warning-flags.patch b/recipes/cpr/all/patches/008-1.8.1-remove-warning-flags.patch new file mode 100644 index 0000000000000..a252a4d5c3280 --- /dev/null +++ b/recipes/cpr/all/patches/008-1.8.1-remove-warning-flags.patch @@ -0,0 +1,16 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 9317f97..c17a97f 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -71,11 +71,6 @@ if(CPR_ENABLE_CPPCHECK) + include(cmake/cppcheck.cmake) + endif() + +-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") +-else() +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror") +-endif() +- + # SSL + if(CPR_ENABLE_SSL) + if(CPR_FORCE_OPENSSL_BACKEND OR CPR_FORCE_WINSSL_BACKEND OR CPR_FORCE_DARWINSSL_BACKEND OR CPR_FORCE_MBEDTLS_BACKEND) diff --git a/recipes/cpr/all/patches/008-1.9.3-remove-warning-flags.patch b/recipes/cpr/all/patches/008-1.9.3-remove-warning-flags.patch new file mode 100644 index 0000000000000..866d51c58b736 --- /dev/null +++ b/recipes/cpr/all/patches/008-1.9.3-remove-warning-flags.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9627982..481b9a0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -76,11 +76,6 @@ if(CPR_ENABLE_CPPCHECK) + include(cmake/cppcheck.cmake) + endif() + +-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") +-else() +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Werror") +-endif() +- + # SSL + if(CPR_ENABLE_SSL) + if(CPR_FORCE_OPENSSL_BACKEND OR CPR_FORCE_WINSSL_BACKEND OR CPR_FORCE_DARWINSSL_BACKEND OR CPR_FORCE_MBEDTLS_BACKEND) diff --git a/recipes/cpr/all/test_package/CMakeLists.txt b/recipes/cpr/all/test_package/CMakeLists.txt index c003582670c36..c55b28c7485b9 100644 --- a/recipes/cpr/all/test_package/CMakeLists.txt +++ b/recipes/cpr/all/test_package/CMakeLists.txt @@ -1,11 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(cpr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} cpr::cpr) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE cpr::cpr) +if(cpr_VERSION VERSION_LESS "1.10.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/cpr/all/test_package/conanfile.py b/recipes/cpr/all/test_package/conanfile.py index 2490acfa82ff8..98ab55852ad56 100644 --- a/recipes/cpr/all/test_package/conanfile.py +++ b/recipes/cpr/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpr/all/test_v1_package/CMakeLists.txt b/recipes/cpr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cpr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cpr/all/test_v1_package/conanfile.py b/recipes/cpr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cpr/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cpr/config.yml b/recipes/cpr/config.yml index 3ceff74829cd9..e96bbca3a200e 100644 --- a/recipes/cpr/config.yml +++ b/recipes/cpr/config.yml @@ -1,4 +1,8 @@ versions: + "1.10.0": + folder: all + "1.9.3": + folder: all "1.9.0": folder: all "1.8.1": diff --git a/recipes/cpu_features/all/CMakeLists.txt b/recipes/cpu_features/all/CMakeLists.txt deleted file mode 100644 index 1a04042483d18..0000000000000 --- a/recipes/cpu_features/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/cpu_features/all/conandata.yml b/recipes/cpu_features/all/conandata.yml index fc86a2c7b0fc0..a6a49730a3d42 100644 --- a/recipes/cpu_features/all/conandata.yml +++ b/recipes/cpu_features/all/conandata.yml @@ -6,9 +6,7 @@ sources: url: "https://github.com/google/cpu_features/archive/refs/tags/v0.6.0.tar.gz" sha256: "95a1cf6f24948031df114798a97eea2a71143bd38a4d07d9a758dda3924c1932" patches: - "0.6.0": - - patch_file: "patches/0.6.0-0001-fix-bundle-install.patch" - base_path: "source_subfolder" "0.7.0": - patch_file: "patches/0.7.0-0001-support-aarch64-macos.patch" - base_path: "source_subfolder" + "0.6.0": + - patch_file: "patches/0.6.0-0001-fix-bundle-install.patch" diff --git a/recipes/cpu_features/all/conanfile.py b/recipes/cpu_features/all/conanfile.py index f840112991c67..67333f1731762 100644 --- a/recipes/cpu_features/all/conanfile.py +++ b/recipes/cpu_features/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class CpuFeaturesConan(ConanFile): @@ -22,17 +26,8 @@ class CpuFeaturesConan(ConanFile): "fPIC": True, } - generators = "cmake", - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -40,39 +35,40 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.compiler.rm_safe("cppstd") + self.settings.compiler.rm_safe("libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - if tools.Version(self.version) < "0.7.0": - self._cmake.definitions["BUILD_PIC"] = self.options.get_safe("fPIC", True) - if tools.Version(self.version) >= "0.7.0": - self._cmake.definitions["BUILD_TESTING"] = False + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) < "0.7.0": + tc.variables["BUILD_PIC"] = self.options.get_safe("fPIC", True) + if Version(self.version) >= "0.7.0": + tc.variables["BUILD_TESTING"] = False # TODO: should be handled by CMake helper - if tools.is_apple_os(self.settings.os) and self.settings.arch in ["armv8", "armv8_32", "armv8.3"]: - self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "aarch64" - self._cmake.configure() # Does not support out of source builds - return self._cmake + if is_apple_os(self) and self.settings.arch in ["armv8", "armv8_32", "armv8.3"]: + tc.variables["CMAKE_SYSTEM_PROCESSOR"] = "aarch64" + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "CpuFeatures") diff --git a/recipes/cpu_features/all/test_package/CMakeLists.txt b/recipes/cpu_features/all/test_package/CMakeLists.txt index 3dcaabf120d13..34c33e1cc8a13 100644 --- a/recipes/cpu_features/all/test_package/CMakeLists.txt +++ b/recipes/cpu_features/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(CpuFeatures CONFIG REQUIRED) +find_package(CpuFeatures REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} CpuFeatures::cpu_features) +target_link_libraries(${PROJECT_NAME} PRIVATE CpuFeatures::cpu_features) diff --git a/recipes/cpu_features/all/test_package/conanfile.py b/recipes/cpu_features/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/cpu_features/all/test_package/conanfile.py +++ b/recipes/cpu_features/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpu_features/all/test_v1_package/CMakeLists.txt b/recipes/cpu_features/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cpu_features/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cpu_features/all/test_v1_package/conanfile.py b/recipes/cpu_features/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cpu_features/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cpuinfo/all/CMakeLists.txt b/recipes/cpuinfo/all/CMakeLists.txt deleted file mode 100644 index b00769ce686e3..0000000000000 --- a/recipes/cpuinfo/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(NOT CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CONAN_CPUINFO_SYSTEM_PROCESSOR}) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/cpuinfo/all/conanfile.py b/recipes/cpuinfo/all/conanfile.py index 1e97cdf620d4c..3a1f62573cb43 100644 --- a/recipes/cpuinfo/all/conanfile.py +++ b/recipes/cpuinfo/all/conanfile.py @@ -1,9 +1,10 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class CpuinfoConan(ConanFile): @@ -11,8 +12,7 @@ class CpuinfoConan(ConanFile): description = "cpuinfo is a library to detect essential for performance " \ "optimization information about host CPU." license = "BSD-2-Clause" - topics = ("cpuinfo", "cpu", "cpuid", "cpu-cache", "cpu-model", - "instruction-set", "cpu-topology") + topics = ("cpu", "cpuid", "cpu-cache", "cpu-model", "instruction-set", "cpu-topology") homepage = "https://github.com/pytorch/cpuinfo" url = "https://github.com/conan-io/conan-center-index" @@ -28,73 +28,58 @@ class CpuinfoConan(ConanFile): "log_level": "default", } - exports_sources = "CMakeLists.txt" - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("shared cpuinfo not supported on Windows") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "SET_PROPERTY(TARGET clog PROPERTY POSITION_INDEPENDENT_CODE ON)", - "") - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) # cpuinfo - cmake.definitions["CPUINFO_LIBRARY_TYPE"] = "default" - cmake.definitions["CPUINFO_RUNTIME_TYPE"] = "default" - cmake.definitions["CPUINFO_LOG_LEVEL"] = self.options.log_level - cmake.definitions["CPUINFO_BUILD_TOOLS"] = False - cmake.definitions["CPUINFO_BUILD_UNIT_TESTS"] = False - cmake.definitions["CPUINFO_BUILD_MOCK_TESTS"] = False - cmake.definitions["CPUINFO_BUILD_BENCHMARKS"] = False + tc.cache_variables["CPUINFO_LIBRARY_TYPE"] = "default" + tc.cache_variables["CPUINFO_RUNTIME_TYPE"] = "default" + tc.cache_variables["CPUINFO_LOG_LEVEL"] = self.options.log_level + tc.variables["CPUINFO_BUILD_TOOLS"] = False + tc.variables["CPUINFO_BUILD_UNIT_TESTS"] = False + tc.variables["CPUINFO_BUILD_MOCK_TESTS"] = False + tc.variables["CPUINFO_BUILD_BENCHMARKS"] = False # clog (always static) - cmake.definitions["CLOG_RUNTIME_TYPE"] = "default" - cmake.definitions["CLOG_BUILD_TESTS"] = False - cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + tc.cache_variables["CLOG_RUNTIME_TYPE"] = "default" + tc.variables["CLOG_BUILD_TESTS"] = False + tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + tc.generate() - # CMAKE_SYSTEM_PROCESSOR must be manually set if cross-building - if tools.cross_building(self): - cmake_system_processor = { - "armv8": "arm64", - "armv8.3": "arm64", - }.get(str(self.settings.arch), str(self.settings.arch)) - cmake.definitions["CONAN_CPUINFO_SYSTEM_PROCESSOR"] = cmake_system_processor - - cmake.configure() - return cmake + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "SET_PROPERTY(TARGET clog PROPERTY POSITION_INDEPENDENT_CODE ON)", + "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libcpuinfo") diff --git a/recipes/cpuinfo/all/test_package/CMakeLists.txt b/recipes/cpuinfo/all/test_package/CMakeLists.txt index adb88fd87c22f..f7fd88969d977 100644 --- a/recipes/cpuinfo/all/test_package/CMakeLists.txt +++ b/recipes/cpuinfo/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(cpuinfo REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} cpuinfo::cpuinfo) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE cpuinfo::cpuinfo) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/cpuinfo/all/test_package/conanfile.py b/recipes/cpuinfo/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/cpuinfo/all/test_package/conanfile.py +++ b/recipes/cpuinfo/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cpuinfo/all/test_v1_package/CMakeLists.txt b/recipes/cpuinfo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cpuinfo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cpuinfo/all/test_v1_package/conanfile.py b/recipes/cpuinfo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/cpuinfo/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cqrlib/all/conanfile.py b/recipes/cqrlib/all/conanfile.py index ae3ab6223dcac..bcd50abb31e76 100644 --- a/recipes/cqrlib/all/conanfile.py +++ b/recipes/cqrlib/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class CqrlibConan(ConanFile): @@ -33,22 +33,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/crc_cpp/all/conandata.yml b/recipes/crc_cpp/all/conandata.yml index 5080c58c69521..09ada265a5657 100644 --- a/recipes/crc_cpp/all/conandata.yml +++ b/recipes/crc_cpp/all/conandata.yml @@ -8,3 +8,6 @@ sources: "1.1.0": url: "https://github.com/AshleyRoll/crc_cpp/archive/refs/tags/v1.1.0.tar.gz" sha256: "50e46e3c44eb39809f6697b253f7b36c089642d7b7f2ebe2f75adf23c50676be" + "1.2.0": + url: "https://github.com/AshleyRoll/crc_cpp/archive/refs/tags/v1.2.0.tar.gz" + sha256: "508a609d9ef12c3088ed17a8ed820c965161a36dd90738c7358333fbfbe96af5" diff --git a/recipes/crc_cpp/config.yml b/recipes/crc_cpp/config.yml index f0842436f445a..0d463a277e732 100644 --- a/recipes/crc_cpp/config.yml +++ b/recipes/crc_cpp/config.yml @@ -5,3 +5,5 @@ versions: folder: "all" "1.1.0": folder: "all" + "1.2.0": + folder: "all" diff --git a/recipes/create-dmg/all/conandata.yml b/recipes/create-dmg/all/conandata.yml index e7b0eff50ab4f..3bee38ab2012d 100644 --- a/recipes/create-dmg/all/conandata.yml +++ b/recipes/create-dmg/all/conandata.yml @@ -8,6 +8,5 @@ sources: patches: "1.1.0": - patch_file: "patches/0001-change-share-to-res.patch" - base_path: "source_subfolder" patch_type: "conan" patch_description: "Change share folder to res" diff --git a/recipes/create-dmg/all/conanfile.py b/recipes/create-dmg/all/conanfile.py index 3c6d88baeafb6..52e6fe840c8e2 100644 --- a/recipes/create-dmg/all/conanfile.py +++ b/recipes/create-dmg/all/conanfile.py @@ -1,9 +1,10 @@ -from conan.tools.files import apply_conandata_patches -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class CreateDmgConan(ConanFile): @@ -14,33 +15,38 @@ class CreateDmgConan(ConanFile): homepage = "https://github.com/create-dmg/create-dmg" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - exports_sources = 'patches/**' - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.os != "Macos": raise ConanInvalidConfiguration(f"{self.name} works only on MacOS") + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + def build(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) apply_conandata_patches(self) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("create-dmg", dst="bin", src=self._source_subfolder) - self.copy("*", dst=os.path.join("res", "create-dmg", "support"), src=os.path.join(self._source_subfolder,"support")) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="create-dmg", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "res", "create-dmg", "support"), src=os.path.join(self.source_folder, "support")) - tools.rmdir(os.path.join(self.package_folder, "share")) - - def package_id(self): - self.info.header_only() + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - binpath = os.path.join(self.package_folder, "bin") self.cpp_info.includedirs = [] - self.output.info(f"Adding to PATH: {binpath}") - self.env_info.PATH.append(binpath) + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = ["res"] + + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/create-dmg/all/test_package/conanfile.py b/recipes/create-dmg/all/test_package/conanfile.py index 730adce12a11b..5618bda930886 100644 --- a/recipes/create-dmg/all/test_package/conanfile.py +++ b/recipes/create-dmg/all/test_package/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools +from conan import ConanFile class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - self.run("create-dmg --version", run_environment=True) + self.run("create-dmg --version") diff --git a/recipes/create-dmg/all/test_v1_package/conanfile.py b/recipes/create-dmg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3d9d911ea4f98 --- /dev/null +++ b/recipes/create-dmg/all/test_v1_package/conanfile.py @@ -0,0 +1,10 @@ +from conans import ConanFile +from conan.tools.build import can_run + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if can_run(self): + self.run("create-dmg --version", run_environment=True) diff --git a/recipes/crowcpp-crow/all/conandata.yml b/recipes/crowcpp-crow/all/conandata.yml index 3aed5442c57ab..6e89143bb07c8 100644 --- a/recipes/crowcpp-crow/all/conandata.yml +++ b/recipes/crowcpp-crow/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0+5": + url: "https://github.com/CrowCpp/crow/archive/refs/tags/v1.0+5.tar.gz" + sha256: "4eb1b80b97dda4a3c4f613c581c734e0221911c88ff859ed679bda3dd5d7b319" "1.0+3": url: "https://github.com/CrowCpp/crow/archive/refs/tags/v1.0+3.tar.gz" sha256: "509248e7bd30dad725cfb66c383405a8bdc59d1fe7f8f2b464d459444047855e" @@ -15,19 +18,17 @@ sources: url: "https://github.com/CrowCpp/crow/archive/refs/tags/v0.3+2.tar.gz" sha256: "982fe978c113506aefe77c413befb3ab21fffb09d9bdf287ec8e8ba59bd786e7" "0.3": - url: "https://github.com/CrowCpp/crow/archive/v0.3.tar.gz" + url: "https://github.com/CrowCpp/Crow/archive/refs/tags/v0.3.tar.gz" sha256: "95538db88fba73c0bc87bbc40b62dcf488012c133a895634ade015009ebb4f25" "0.2": - url: "https://github.com/CrowCpp/crow/archive/0.2.tar.gz" + url: "https://github.com/CrowCpp/Crow/archive/refs/tags/0.2.tar.gz" sha256: "c419767f0a336f2add71fc8b311ad95434d59601fb8b0e5ba3048407d85d0a71" patches: "0.2": - patch_file: "patches/0.2/0001-normalize-buildsystem.patch" - base_path: "source_subfolder" - # patch_type: "conan" - # description: "Skip tests and examples from build" + patch_description: "Skip tests and examples from build" + patch_type: "conan" - patch_file: "patches/0.2/0002-replace-uint.patch" - base_path: "source_subfolder" - # patch_type: "portability" - # source: "https://github.com/CrowCpp/Crow/commit/5fe3a45793604a50f5c9086909dfa1b50dfa3e88" - # description: "Replace uint (not default type) with unsigned" + patch_description: "Replace uint (not default type) with unsigned" + patch_type: "bugfix" + patch_source: "https://github.com/CrowCpp/Crow/commit/5fe3a45793604a50f5c9086909dfa1b50dfa3e88" diff --git a/recipes/crowcpp-crow/all/conanfile.py b/recipes/crowcpp-crow/all/conanfile.py index ac9c4ed132538..001767af2d0fd 100644 --- a/recipes/crowcpp-crow/all/conanfile.py +++ b/recipes/crowcpp-crow/all/conanfile.py @@ -1,82 +1,135 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.52.0" class CrowConan(ConanFile): name = "crowcpp-crow" - homepage = "http://crowcpp.org/" description = "Crow is a C++ microframework for running web services." - topics = ("web", "microframework", "header-only") + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" + homepage = "http://crowcpp.org/" + topics = ("web", "microframework", "header-only") settings = "os", "compiler", "arch", "build_type" - license = "BSD-3-Clause" - - provides = "crow" - options = { "amalgamation": [True, False], + "with_ssl": [True, False], + "with_compression": [True, False], } default_options = { "amalgamation": False, + "with_ssl": False, + "with_compression": False, } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) + + def configure(self): + if Version(self.version) < "1.0": + del self.options.with_ssl + del self.options.with_compression + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.77.0") + self.requires("boost/1.81.0") if self.version == "0.2": - self.requires("openssl/1.1.1l") + self.requires("openssl/1.1.1s") + if Version(self.version) >= "1.0": + if self.options.with_ssl: + self.requires("openssl/1.1.1s") + if self.options.with_compression: + self.requires("zlib/1.2.13") + + def package_id(self): + self.info.settings.clear() + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get( - **self.conan_data["sources"][self.version], - strip_root=True, - destination=self._source_subfolder - ) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if self.options.amalgamation: + tc = CMakeToolchain(self) + if Version(self.version) < "1.0": + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_TESTING"] = False + else: + tc.variables["CROW_BUILD_EXAMPLES"] = False + tc.variables["CROW_BUILD_TESTS"] = False + tc.variables["CROW_AMALGAMATE"] = True + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if self.options.amalgamation: cmake = CMake(self) - cmake.definitions["BUILD_EXAMPLES"] = False - cmake.definitions["BUILD_TESTING"] = False - cmake.configure(source_folder=self._source_subfolder) - cmake.build(target="amalgamation") + cmake.configure() + if Version(self.version) < "1.0": + cmake.build(target="amalgamation") + else: + cmake.build(target="crow_amalgamated") + def package(self): - self.copy(pattern="LICENSE*", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) if self.options.amalgamation: - self.copy("crow_all.h", dst="include") + copy( + self, + pattern="crow_all.h", + dst=os.path.join(self.package_folder, "include"), + src=self.build_folder, + ) else: - self.copy( - "*.h", - dst=os.path.join("include"), - src=os.path.join(self._source_subfolder, "include"), + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), ) - self.copy( - "*.hpp", - dst=os.path.join("include"), - src=os.path.join(self._source_subfolder, "include"), + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), ) - def package_id(self): - self.info.settings.clear() - def package_info(self): - # These are not official targets, this is just the name (without fork prefix) - self.cpp_info.names["cmake_find_package"] = "crow" - self.cpp_info.names["cmake_find_package_multi"] = "crow" + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.requires.append("boost::headers") if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["pthread"] + + self.cpp_info.set_property("cmake_file_name", "Crow") + self.cpp_info.set_property("cmake_target_name", "Crow::Crow") + + if Version(self.version) >= "1.0": + if self.options.with_ssl: + self.cpp_info.defines.append("CROW_ENABLE_SSL") + self.cpp_info.requires.append("OpenSSL::ssl") + if self.options.with_compression: + self.cpp_info.defines.append("CROW_ENABLE_COMPRESSION") + self.cpp_info.requires.append("zlib::zlib") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "Crow" + self.cpp_info.names["cmake_find_package_multi"] = "Crow" + diff --git a/recipes/crowcpp-crow/all/test_package/CMakeLists.txt b/recipes/crowcpp-crow/all/test_package/CMakeLists.txt index 4455b8e2005b1..5031b19e1cde3 100644 --- a/recipes/crowcpp-crow/all/test_package/CMakeLists.txt +++ b/recipes/crowcpp-crow/all/test_package/CMakeLists.txt @@ -1,19 +1,16 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(crow REQUIRED) +find_package(Crow REQUIRED) option(CROW_AMALGAMATION "CROW IS DEPLOYED AS AMALGAMATION" ON) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} crow::crow) +target_link_libraries(${PROJECT_NAME} PRIVATE Crow::Crow) if(CROW_AMALGAMATION) target_compile_definitions(${PROJECT_NAME} PRIVATE CROW_AMALGAMATION) endif(CROW_AMALGAMATION) unset(CROW_AMALGAMATION CACHE) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/crowcpp-crow/all/test_package/conanfile.py b/recipes/crowcpp-crow/all/test_package/conanfile.py index 1fe1e3f89e80b..3022a3897300e 100644 --- a/recipes/crowcpp-crow/all/test_package/conanfile.py +++ b/recipes/crowcpp-crow/all/test_package/conanfile.py @@ -1,18 +1,31 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CROW_AMALGAMATION"] = self.dependencies["crowcpp-crow"].options.amalgamation + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["CROW_AMALGAMATION"] = self.options["crowcpp-crow"].amalgamation cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/crowcpp-crow/all/test_v1_package/CMakeLists.txt b/recipes/crowcpp-crow/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/crowcpp-crow/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/crowcpp-crow/all/test_v1_package/conanfile.py b/recipes/crowcpp-crow/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c082cadf5e3a2 --- /dev/null +++ b/recipes/crowcpp-crow/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["CROW_AMALGAMATION"] = self.options["crowcpp-crow"].amalgamation + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/crowcpp-crow/config.yml b/recipes/crowcpp-crow/config.yml index 3d9d8637004db..7907b04141a3f 100644 --- a/recipes/crowcpp-crow/config.yml +++ b/recipes/crowcpp-crow/config.yml @@ -1,4 +1,6 @@ versions: + "1.0+5": + folder: all "1.0+3": folder: all "1.0+1": diff --git a/recipes/crunch/all/conanfile.py b/recipes/crunch/all/conanfile.py index 5ab8dbac9b42d..801134fcba6d0 100644 --- a/recipes/crunch/all/conanfile.py +++ b/recipes/crunch/all/conanfile.py @@ -1,17 +1,17 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.52.0" class CrunchConan(ConanFile): name = "crunch" description = "Advanced DXTc texture compression and transcoding library" homepage = "https://github.com/BinomialLLC/crunch" - topics = ("crunch", "DXTc", "texture", "compression", "decompression", "transcoding") + topics = ("DXTc", "texture", "compression", "decompression", "transcoding") url = "https://github.com/conan-io/conan-center-index" license = "Zlib" @@ -25,23 +25,21 @@ class CrunchConan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - def validate(self): - if self.info.settings.os not in ["Windows", "Linux", "FreeBSD"]: - raise ConanInvalidConfiguration("Crunch is not supported on {}.".format(self.info.settings.os)) - def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.os not in ["Windows", "Linux", "FreeBSD"]: + raise ConanInvalidConfiguration(f"Crunch is not supported on {self.settings.os}.") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -64,6 +62,5 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bin_path}") - self.env_info.PATH.append(bin_path) + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/crunch/all/test_package/conanfile.py b/recipes/crunch/all/test_package/conanfile.py index af5acf9102cc8..7a2122729677a 100644 --- a/recipes/crunch/all/test_package/conanfile.py +++ b/recipes/crunch/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,20 +7,21 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str, run=True) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): img_path = os.path.join(self.source_folder, "test.png") self.run(f"crunch -file {img_path}", env="conanrun") bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") diff --git a/recipes/crunch/all/test_v1_package/CMakeLists.txt b/recipes/crunch/all/test_v1_package/CMakeLists.txt index da707efbd7a2e..0d20897301b68 100644 --- a/recipes/crunch/all/test_v1_package/CMakeLists.txt +++ b/recipes/crunch/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(crunch REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE crunch::crunch) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cryptopp/all/conandata.yml b/recipes/cryptopp/all/conandata.yml index 4b9948cbfa771..83270c254fc7c 100644 --- a/recipes/cryptopp/all/conandata.yml +++ b/recipes/cryptopp/all/conandata.yml @@ -1,4 +1,11 @@ sources: + "8.7.0": + source: + url: "https://github.com/weidai11/cryptopp/archive/CRYPTOPP_8_7_0.tar.gz" + sha256: "8d6a4064b8e9f34cd3e838f5a12c40067ee7b95ee37d9173ec273cb0913e7ca2" + cmake: + url: "https://github.com/abdes/cryptopp-cmake/archive/CRYPTOPP_8_7_0.tar.gz" + sha256: "c113aba8069842edb201b4aaa2925e2c9d6ca081c4fd6b049ff74fedf6e8bae3" "8.6.0": source: url: "https://github.com/weidai11/cryptopp/archive/CRYPTOPP_8_6_0.tar.gz" @@ -28,7 +35,23 @@ sources: url: "https://github.com/noloader/cryptopp-cmake/archive/CRYPTOPP_8_2_0.tar.gz" sha256: "f41f6a32b1177c094c3ef97423916713c902d0ac26cbee30ec70b1e8ab0e6fba" patches: + "8.7.0": + - patch_file: "patches/8.7.0-0001-fix-msvc-arm64.patch" "8.6.0": - - patch_file: "patches/0001-fix-cmake-8.6.0.patch" + - patch_file: "patches/8.6.0-0001-fix-cmake.patch" + - patch_file: "patches/8.6.0-0002-relocatable-macos.patch" + patch_description: "Relocatable shared lib on macOS" + patch_type: "conan" + "8.5.0": + - patch_file: "patches/8.4.0-0001-relocatable-macos.patch" + patch_description: "Relocatable shared lib on macOS" + patch_type: "conan" + "8.4.0": + - patch_file: "patches/8.4.0-0001-relocatable-macos.patch" + patch_description: "Relocatable shared lib on macOS" + patch_type: "conan" "8.2.0": - - patch_file: "patches/0001-fix-cmake-8.2.0.patch" + - patch_file: "patches/8.2.0-0001-fix-cmake.patch" + - patch_file: "patches/8.2.0-0002-relocatable-macos.patch" + patch_description: "Relocatable shared lib on macOS" + patch_type: "conan" diff --git a/recipes/cryptopp/all/conanfile.py b/recipes/cryptopp/all/conanfile.py index 0b5197c10fa18..dd7d5c2edad76 100644 --- a/recipes/cryptopp/all/conanfile.py +++ b/recipes/cryptopp/all/conanfile.py @@ -1,12 +1,16 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rename, replace_in_file, rmdir, save +from conan.tools.files import ( + apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, + rename, replace_in_file, rmdir, save +) from conan.tools.scm import Version -from conans import tools as tools_legacy + import os import textwrap -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class CryptoPPConan(ConanFile): @@ -15,8 +19,9 @@ class CryptoPPConan(ConanFile): homepage = "https://cryptopp.com" license = "BSL-1.0" description = "Crypto++ Library is a free C++ class library of cryptographic schemes." - topics = ("cryptopp", "crypto", "cryptographic", "security") + topics = ("crypto", "cryptographic", "security") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,8 +33,7 @@ class CryptoPPConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,49 +41,82 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.options.shared and Version(self.version) >= "8.7.0": + raise ConanInvalidConfiguration("cryptopp 8.7.0 and higher do not support shared builds") + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "8.7.0" and not self._cmake_new_enough("3.20"): + self.tool_requires("cmake/3.25.2") + def source(self): - # Get sources - get(self, **self.conan_data["sources"][self.version]["source"], - destination=self.source_folder, strip_root=True) - - # Get CMakeLists - base_source_dir = os.path.join(self.source_folder, os.pardir) - get(self, **self.conan_data["sources"][self.version]["cmake"], destination=base_source_dir) - src_folder = os.path.join( - base_source_dir, - f"cryptopp-cmake-CRYPTOPP_{self.version.replace('.', '_')}", - ) - for file in ("CMakeLists.txt", "cryptopp-config.cmake"): - rename(self, src=os.path.join(src_folder, file), dst=os.path.join(self.source_folder, file)) - rmdir(self, src_folder) + # Get cryptopp sources + get(self, **self.conan_data["sources"][self.version]["source"], strip_root=True) + + if Version(self.version) < "8.7.0": + # Get CMakeLists + base_source_dir = os.path.join(self.source_folder, os.pardir) + get(self, **self.conan_data["sources"][self.version]["cmake"], destination=base_source_dir) + src_folder = os.path.join( + base_source_dir, + f"cryptopp-cmake-CRYPTOPP_{self.version.replace('.', '_')}", + ) + for file in ("CMakeLists.txt", "cryptopp-config.cmake"): + rename(self, src=os.path.join(src_folder, file), dst=os.path.join(self.source_folder, file)) + rmdir(self, src_folder) + else: + # Get cryptopp-cmake sources + get(self, **self.conan_data["sources"][self.version]["cmake"], + destination=os.path.join(self.source_folder, "cryptopp-cmake"), strip_root=True) def generate(self): tc = CMakeToolchain(self) - tc.variables["BUILD_STATIC"] = not self.options.shared - tc.variables["BUILD_SHARED"] = self.options.shared - tc.variables["BUILD_TESTING"] = False - tc.variables["BUILD_DOCUMENTATION"] = False - tc.variables["USE_INTERMEDIATE_OBJECTS_TARGET"] = False - if self.settings.os == "Android": - tc.variables["CRYPTOPP_NATIVE_ARCH"] = True - if self.settings.os == "Macos" and self.settings.arch == "armv8" and Version(self.version) <= "8.4.0": - tc.variables["CMAKE_CXX_FLAGS"] = "-march=armv8-a" - # For msvc shared - tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True - # Relocatable shared libs on macOS - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + if Version(self.version) < "8.7.0": + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.variables["BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_DOCUMENTATION"] = False + tc.variables["USE_INTERMEDIATE_OBJECTS_TARGET"] = False + if self.settings.os == "Android": + tc.variables["CRYPTOPP_NATIVE_ARCH"] = True + if self.settings.os == "Macos" and self.settings.arch == "armv8" and Version(self.version) <= "8.4.0": + tc.variables["CMAKE_CXX_FLAGS"] = "-march=armv8-a" + # For msvc shared + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + else: + tc.cache_variables["CRYPTOPP_SOURCES"] = self.source_folder.replace("\\", "/") + tc.cache_variables["CRYPTOPP_BUILD_TESTING"] = False + tc.cache_variables["CRYPTOPP_BUILD_DOCUMENTATION"] = False + tc.cache_variables["CRYPTOPP_USE_INTERMEDIATE_OBJECTS_TARGET"] = False + if self.settings.os == "Android": + tc.cache_variables["CRYPTOPP_NATIVE_ARCH"] = True tc.generate() def _patch_sources(self): apply_conandata_patches(self) # Use cpu-features.h from Android NDK - if self.settings.os == "Android": - android_ndk_home = tools_legacy.get_env("ANDROID_NDK_HOME") + if self.settings.os == "Android" and Version(self.version) < "8.4.0": + # Replicate logic from: https://github.com/weidai11/cryptopp/blob/CRYPTOPP_8_2_0/cpu.cpp#L46-L52 + # In more recent versions this is already taken care of by cryptopp-cmake + android_ndk_home = self.conf.get("tools.android:ndk_path") if android_ndk_home: copy( self, @@ -88,20 +125,30 @@ def _patch_sources(self): dst=self.source_folder, ) # Honor fPIC option - replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), - "SET(CMAKE_POSITION_INDEPENDENT_CODE 1)", "") + if Version(self.version) < "8.7.0": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "SET(CMAKE_POSITION_INDEPENDENT_CODE 1)", "") + else: + replace_in_file(self, os.path.join(self.source_folder, "cryptopp-cmake", "cryptopp", "CMakeLists.txt"), + "set(CMAKE_POSITION_INDEPENDENT_CODE 1)", "") def build(self): self._patch_sources() cmake = CMake(self) - cmake.configure() + if Version(self.version) < "8.7.0": + cmake.configure() + else: + cmake.configure(build_script_folder="cryptopp-cmake") cmake.build() def package(self): copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() - rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + if Version(self.version) < "8.7.0": + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + else: + rmdir(self, os.path.join(self.package_folder, "share")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), @@ -127,9 +174,10 @@ def _module_file_rel_path(self): return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): - cmake_target = "cryptopp-shared" if self.options.shared else "cryptopp-static" self.cpp_info.set_property("cmake_file_name", "cryptopp") - self.cpp_info.set_property("cmake_target_name", cmake_target) + self.cpp_info.set_property("cmake_target_name", "cryptopp::cryptopp") + legacy_cmake_target = "cryptopp-shared" if self.options.shared else "cryptopp-static" + self.cpp_info.set_property("cmake_target_name_aliases", [legacy_cmake_target]) self.cpp_info.set_property("pkg_config_name", "libcryptopp") # TODO: back to global scope once cmake_find_package* generators removed @@ -139,13 +187,13 @@ def package_info(self): elif self.settings.os == "SunOS": self.cpp_info.components["libcryptopp"].system_libs = ["nsl", "socket"] elif self.settings.os == "Windows": - self.cpp_info.components["libcryptopp"].system_libs = ["ws2_32"] + self.cpp_info.components["libcryptopp"].system_libs = ["bcrypt", "ws2_32"] # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["pkg_config"] = "libcryptopp" - self.cpp_info.components["libcryptopp"].names["cmake_find_package"] = cmake_target - self.cpp_info.components["libcryptopp"].names["cmake_find_package_multi"] = cmake_target + self.cpp_info.components["libcryptopp"].names["cmake_find_package"] = legacy_cmake_target + self.cpp_info.components["libcryptopp"].names["cmake_find_package_multi"] = legacy_cmake_target self.cpp_info.components["libcryptopp"].build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.components["libcryptopp"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - self.cpp_info.components["libcryptopp"].set_property("cmake_target_name", cmake_target) + self.cpp_info.components["libcryptopp"].set_property("cmake_target_name", "cryptopp::cryptopp") self.cpp_info.components["libcryptopp"].set_property("pkg_config_name", "libcryptopp") diff --git a/recipes/cryptopp/all/patches/0001-fix-cmake-8.2.0.patch b/recipes/cryptopp/all/patches/8.2.0-0001-fix-cmake.patch similarity index 100% rename from recipes/cryptopp/all/patches/0001-fix-cmake-8.2.0.patch rename to recipes/cryptopp/all/patches/8.2.0-0001-fix-cmake.patch diff --git a/recipes/cryptopp/all/patches/8.2.0-0002-relocatable-macos.patch b/recipes/cryptopp/all/patches/8.2.0-0002-relocatable-macos.patch new file mode 100644 index 0000000000000..2733f328862a4 --- /dev/null +++ b/recipes/cryptopp/all/patches/8.2.0-0002-relocatable-macos.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -100,7 +100,6 @@ set(CRYPTOPP_COMPILE_OPTIONS) + set(LIB_VER ${cryptopp_VERSION_MAJOR}${cryptopp_VERSION_MINOR}${cryptopp_VERSION_PATCH}) + + # Don't use RPATH's. The resulting binary could fail a security audit. +-set(CMAKE_MACOSX_RPATH 0) + + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + list(APPEND CRYPTOPP_COMPILE_OPTIONS -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180) diff --git a/recipes/cryptopp/all/patches/8.4.0-0001-relocatable-macos.patch b/recipes/cryptopp/all/patches/8.4.0-0001-relocatable-macos.patch new file mode 100644 index 0000000000000..03772e1e4a7e1 --- /dev/null +++ b/recipes/cryptopp/all/patches/8.4.0-0001-relocatable-macos.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -99,7 +99,6 @@ set(CRYPTOPP_COMPILE_OPTIONS) + set(LIB_VER ${cryptopp_VERSION_MAJOR}${cryptopp_VERSION_MINOR}${cryptopp_VERSION_PATCH}) + + # Don't use RPATH's. The resulting binary could fail a security audit. +-set(CMAKE_MACOSX_RPATH 0) + + if (CMAKE_CXX_COMPILER_ID STREQUAL "Intel") + list(APPEND CRYPTOPP_COMPILE_OPTIONS -wd68 -wd186 -wd279 -wd327 -wd161 -wd3180) diff --git a/recipes/cryptopp/all/patches/0001-fix-cmake-8.6.0.patch b/recipes/cryptopp/all/patches/8.6.0-0001-fix-cmake.patch similarity index 100% rename from recipes/cryptopp/all/patches/0001-fix-cmake-8.6.0.patch rename to recipes/cryptopp/all/patches/8.6.0-0001-fix-cmake.patch diff --git a/recipes/cryptopp/all/patches/8.6.0-0002-relocatable-macos.patch b/recipes/cryptopp/all/patches/8.6.0-0002-relocatable-macos.patch new file mode 100644 index 0000000000000..d835b100d1b64 --- /dev/null +++ b/recipes/cryptopp/all/patches/8.6.0-0002-relocatable-macos.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -127,7 +127,6 @@ set(CRYPTOPP_COMPILE_OPTIONS) + + # Stop CMake complaining... + if (CMAKE_SYSTEM_NAME STREQUAL "Darwin") +- set(MACOSX_RPATH FALSE) + endif() + + # Always 1 ahead in Master. Also see http://groups.google.com/forum/#!topic/cryptopp-users/SFhqLDTQPG4 diff --git a/recipes/cryptopp/all/patches/8.7.0-0001-fix-msvc-arm64.patch b/recipes/cryptopp/all/patches/8.7.0-0001-fix-msvc-arm64.patch new file mode 100755 index 0000000000000..1e813c076823d --- /dev/null +++ b/recipes/cryptopp/all/patches/8.7.0-0001-fix-msvc-arm64.patch @@ -0,0 +1,35 @@ +--- a/arm_simd.h ++++ b/arm_simd.h +@@ -307,28 +307,32 @@ inline uint64x2_t PMULL_HIGH(const uint64x2_t a, const uint64x2_t b) + #endif + } + ++// This function will be removed in the next version of Crypto++: ++// https://github.com/weidai11/cryptopp/commit/31fa3384160071793bc428a32383938551b3652c ++#if !defined(_MSC_VER) || defined(_M_ARM) + /// \brief Vector extraction + /// \param a the first value + /// \param b the second value + /// \param c the byte count + /// \return vector + /// \details VEXT_U8() extracts the first c bytes of vector + /// a and the remaining bytes in b. VEXT_U8 is provided + /// as GCC inline assembly due to Clang and lack of support for the intrinsic. + /// \since Crypto++ 8.0 + inline uint64x2_t VEXT_U8(uint64x2_t a, uint64x2_t b, unsigned int c) + { + #if defined(_MSC_VER) + return vreinterpretq_u64_u8(vextq_u8( + vreinterpretq_u8_u64(a), vreinterpretq_u8_u64(b), c)); + #else + uint64x2_t r; + __asm__ ("ext %0.16b, %1.16b, %2.16b, %3 \n\t" + :"=w" (r) : "w" (a), "w" (b), "I" (c) ); + return r; + #endif + } ++#endif + + /// \brief Vector extraction + /// \tparam C the byte count + /// \param a the first value diff --git a/recipes/cryptopp/all/test_package/CMakeLists.txt b/recipes/cryptopp/all/test_package/CMakeLists.txt index a2bf3d6bb06b3..b742b78c960d8 100644 --- a/recipes/cryptopp/all/test_package/CMakeLists.txt +++ b/recipes/cryptopp/all/test_package/CMakeLists.txt @@ -4,8 +4,4 @@ project(test_package LANGUAGES CXX) find_package(cryptopp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -if(TARGET cryptopp-shared) - target_link_libraries(${PROJECT_NAME} PRIVATE cryptopp-shared) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE cryptopp-static) -endif() +target_link_libraries(${PROJECT_NAME} PRIVATE cryptopp::cryptopp) diff --git a/recipes/cryptopp/all/test_package/conanfile.py b/recipes/cryptopp/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/cryptopp/all/test_package/conanfile.py +++ b/recipes/cryptopp/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/cryptopp/all/test_v1_package/CMakeLists.txt b/recipes/cryptopp/all/test_v1_package/CMakeLists.txt index 344dcc7df8b41..0d20897301b68 100644 --- a/recipes/cryptopp/all/test_v1_package/CMakeLists.txt +++ b/recipes/cryptopp/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(cryptopp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -if(TARGET cryptopp-shared) - target_link_libraries(${PROJECT_NAME} PRIVATE cryptopp-shared) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE cryptopp-static) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cryptopp/config.yml b/recipes/cryptopp/config.yml index a125b6d12d4c5..0cf6dab66b6c7 100644 --- a/recipes/cryptopp/config.yml +++ b/recipes/cryptopp/config.yml @@ -1,4 +1,6 @@ versions: + "8.7.0": + folder: "all" "8.6.0": folder: "all" "8.5.0": diff --git a/recipes/cs_libguarded/all/conandata.yml b/recipes/cs_libguarded/all/conandata.yml index 7054b1c7f8dac..6464993e20067 100644 --- a/recipes/cs_libguarded/all/conandata.yml +++ b/recipes/cs_libguarded/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.4.0": + url: "https://github.com/copperspice/cs_libguarded/archive/libguarded-1.4.0.tar.gz" + sha256: "3911c56db6e7b222e2ec4c45513021f819ce647e7e6e803ca64dc720e8645d8e" + "1.3.0": + url: "https://github.com/copperspice/cs_libguarded/archive/libguarded-1.3.0.tar.gz" + sha256: "4059db286bb6386faa748cdcdb53c0e5ce785ca3644fb4a01410011b8ea97be2" "1.1.0": - url: https://github.com/copperspice/cs_libguarded/archive/libguarded-1.1.0.tar.gz - sha256: ad51992e5a8ba29ce55e7bd6dfb653f4b483a52edf07806871e8b15e67278af3 + url: "https://github.com/copperspice/cs_libguarded/archive/libguarded-1.1.0.tar.gz" + sha256: "ad51992e5a8ba29ce55e7bd6dfb653f4b483a52edf07806871e8b15e67278af3" diff --git a/recipes/cs_libguarded/all/conanfile.py b/recipes/cs_libguarded/all/conanfile.py index 1be2009a9320a..39578ddadb423 100644 --- a/recipes/cs_libguarded/all/conanfile.py +++ b/recipes/cs_libguarded/all/conanfile.py @@ -1,25 +1,102 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -from conans import ConanFile, tools +required_conan_version = ">=1.52.0" class CsLibguardedConan(ConanFile): name = "cs_libguarded" + description = "The libGuarded library is a standalone header-only library for multithreaded programming." license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/copperspice/libguarded" - description = "The libGuarded library is a standalone header-only library for multithreaded programming." - topics = ("multithreading", "templates", "cpp14", "mutexes") + topics = ("multithreading", "templates", "cpp14", "mutexes", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 if Version(self.version) < "1.3" else 17 + + @property + def _compilers_minimum_version(self): + if Version(self.version) < "1.3": + return { + "Visual Studio": "15.2", + "msvc": "191", + "gcc": "5", + "clang": "5", + "apple-clang": "5", + } + else: + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + compiler = str(self.settings.compiler) + version = str(self.settings.compiler.version) + + minimum_version = self._compilers_minimum_version.get(compiler, False) + if minimum_version and loose_lt_semver(version, minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler ({compiler}-{version}) does not support") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "cs_libguarded-libguarded-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - self.copy("*.hpp", dst='include', src=os.path.join(self._source_subfolder, "src")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + if Version(self.version) < "1.3": + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src"), + ) + else: + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include", "CsLibGuarded"), + src=os.path.join(self.source_folder, "src"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if Version(self.version) >= "1.3": + self.cpp_info.includedirs.append(os.path.join("include", "CsLibGuarded")) + + self.cpp_info.set_property("cmake_file_name", "CsLibGuarded") + self.cpp_info.set_property("cmake_target_name", "CsLibGuarded::CsLibGuarded") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "CsLibGuarded" + self.cpp_info.filenames["cmake_find_package_multi"] = "CsLibGuarded" + self.cpp_info.names["cmake_find_package"] = "CsLibGuarded" + self.cpp_info.names["cmake_find_package_multi"] = "CsLibGuarded" diff --git a/recipes/cs_libguarded/all/test_package/CMakeLists.txt b/recipes/cs_libguarded/all/test_package/CMakeLists.txt index 406c687ef37e1..d5463ebc7c858 100644 --- a/recipes/cs_libguarded/all/test_package/CMakeLists.txt +++ b/recipes/cs_libguarded/all/test_package/CMakeLists.txt @@ -1,9 +1,15 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +add_executable(${PROJECT_NAME} test_package.cpp) -add_executable(main main.cpp) -target_link_libraries(main ${CONAN_LIBS}) -set_property(TARGET main PROPERTY CXX_STANDARD 11) +find_package(cs_libguarded CONFIG) +if (cs_libguarded_FOUND) + target_link_libraries(${PROJECT_NAME} PRIVATE cs_libguarded::cs_libguarded) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + find_package(CsLibGuarded REQUIRED CONFIG) + target_link_libraries(${PROJECT_NAME} PRIVATE CsLibGuarded::CsLibGuarded) + target_compile_definitions(${PROJECT_NAME} PRIVATE CS_LIBGUARDED_1_3_0_LATER) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/cs_libguarded/all/test_package/conanfile.py b/recipes/cs_libguarded/all/test_package/conanfile.py index 19d05dfdde2b7..e845ae751a301 100644 --- a/recipes/cs_libguarded/all/test_package/conanfile.py +++ b/recipes/cs_libguarded/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "main"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cs_libguarded/all/test_package/main.cpp b/recipes/cs_libguarded/all/test_package/main.cpp deleted file mode 100644 index 6cd1ecd9307c2..0000000000000 --- a/recipes/cs_libguarded/all/test_package/main.cpp +++ /dev/null @@ -1,8 +0,0 @@ -#include -#include - -int main() { - libguarded::guarded g; - *g.lock() = 42; - return 0; -} diff --git a/recipes/cs_libguarded/all/test_package/test_package.cpp b/recipes/cs_libguarded/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9befabd77ff2c --- /dev/null +++ b/recipes/cs_libguarded/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#ifndef CS_LIBGUARDED_1_3_0_LATER + #include +#else + #include +#endif + +int main() { +#ifndef CS_LIBGUARDED_1_3_0_LATER + libguarded::guarded g; +#else + libguarded::plain_guarded g; +#endif + *g.lock() = 42; + return 0; +} diff --git a/recipes/cs_libguarded/all/test_v1_package/CMakeLists.txt b/recipes/cs_libguarded/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/cs_libguarded/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/cs_libguarded/all/test_v1_package/conanfile.py b/recipes/cs_libguarded/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/cs_libguarded/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cs_libguarded/config.yml b/recipes/cs_libguarded/config.yml index 954a8c5b4d65a..942362a3d6c93 100644 --- a/recipes/cs_libguarded/config.yml +++ b/recipes/cs_libguarded/config.yml @@ -1,4 +1,7 @@ ---- versions: + "1.4.0": + folder: all + "1.3.0": + folder: all "1.1.0": folder: all diff --git a/recipes/csvmonkey/all/conanfile.py b/recipes/csvmonkey/all/conanfile.py index 70c4748ec7036..49542ed86e55c 100644 --- a/recipes/csvmonkey/all/conanfile.py +++ b/recipes/csvmonkey/all/conanfile.py @@ -1,56 +1,78 @@ -import os - +from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan import ConanFile, tools +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class CSVMONEKYConan(ConanFile): name = "csvmonkey" + description = "Header-only vectorized, lazy-decoding, zero-copy CSV file parser" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" - description = "Header-only vectorized, lazy-decoding, zero-copy CSV file parser " - topics = ("csv-parser", "header-only", "vectorized") homepage = "https://github.com/dw/csvmonkey/" - settings = "arch", "compiler" + topics = ("csv-parser", "header-only", "vectorized") + settings = "os", "arch", "compiler", "build_type" + options = { + "with_spirit": [True, False], + } + default_options = { + "with_spirit": False, + } no_copy_source = True - options = {"with_spirit": [True, False]} - default_options = {"with_spirit": False} @property - def _source_subfolder(self): - return "source_subfolder" - - def validate(self): - if self.settings.arch not in ("x86", "x86_64",): - raise ConanInvalidConfiguration("{} requires x86 architecture.".format(self.name)) + def _min_cppstd(self): + return 11 - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("{} doesn't support Visual Studio C++.".format(self.name)) + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_spirit: - self.requires("boost/1.77.0") + self.requires("boost/1.81.0") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + if self.settings.arch not in ("x86", "x86_64",): + raise ConanInvalidConfiguration(f"{self.ref} requires x86 architecture.") + + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio C++.") def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE*", "licenses", self._source_subfolder) - self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) - - def package_id(self): - self.info.header_only() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "csvmonkey") self.cpp_info.set_property("cmake_target_name", "csvmonkey::csvmonkey") self.cpp_info.set_property("pkg_config_name", "csvmonkey") + if self.options.with_spirit: + self.cpp_info.defines.append("USE_SPIRIT") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "csvmonkey" self.cpp_info.filenames["cmake_find_package_multi"] = "csvmonkey" self.cpp_info.names["cmake_find_package"] = "csvmonkey" self.cpp_info.names["cmake_find_package_multi"] = "csvmonkey" - - if self.options.with_spirit: - self.cpp_info.defines.append("USE_SPIRIT") diff --git a/recipes/csvmonkey/all/test_package/CMakeLists.txt b/recipes/csvmonkey/all/test_package/CMakeLists.txt index 6f39b9addc9e6..fd4b892a1c012 100644 --- a/recipes/csvmonkey/all/test_package/CMakeLists.txt +++ b/recipes/csvmonkey/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(csvmonkey CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} csvmonkey::csvmonkey) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE csvmonkey::csvmonkey) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/csvmonkey/all/test_package/conanfile.py b/recipes/csvmonkey/all/test_package/conanfile.py index 69bc51936474f..a9fb96656f203 100644 --- a/recipes/csvmonkey/all/test_package/conanfile.py +++ b/recipes/csvmonkey/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conan import ConanFile, tools -from conans import CMake -class CSVMonkeyTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.build.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/csvmonkey/all/test_v1_package/CMakeLists.txt b/recipes/csvmonkey/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/csvmonkey/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/csvmonkey/all/test_v1_package/conanfile.py b/recipes/csvmonkey/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/csvmonkey/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/ctre/all/conandata.yml b/recipes/ctre/all/conandata.yml index a31566c9bce74..0cbb6fc297fa1 100644 --- a/recipes/ctre/all/conandata.yml +++ b/recipes/ctre/all/conandata.yml @@ -1,34 +1,31 @@ sources: - "2.8.4": - url: https://github.com/hanickadot/compile-time-regular-expressions/archive/v2.8.4.tar.gz - sha256: 99b981857f1b66cab5e71161ae74deca268ed39a96ec6507def92d4f445cadd6 - "2.9.2": - url: https://github.com/hanickadot/compile-time-regular-expressions/archive/v2.9.2.tar.gz - sha256: 763cb6f26e6fc68b4c98a809efbf55aab1a21c7773da8150d41c31baf5f8b711 - "2.10": - url: https://github.com/hanickadot/compile-time-regular-expressions/archive/v2.10.tar.gz - sha256: 2e166b672c5a733b5448bb9fc83db54d92852c39e3e19097b79307cc6a327c31 - "3.0.1": - url: https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.0.1.tar.gz - sha256: 0838ce0af9e9e89ffc10854dc98c88b2dd40d1866ceaf0dc6c1663d6c39882cc - "3.1": - url: https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.1.tar.gz - sha256: c209ab0533b56a4fbbc7959e10c91c89fe2c9cb1725b64ed52be272a534a1d83 - "3.2": - url: https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.2.tar.gz - sha256: d4e734e3dd501f741424aceb5198f5ebbc35c624335c99f7e202a9ecb31cd3e6 - "3.3.4": - url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.3.4.tar.gz" - sha256: "8161f0d3100fc690590f475aa9acb70163ed7f2922e35e13136dececc52c49a9" - "3.4.1": - url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.4.1.tar.gz" - sha256: "c4a1a88b8c4a8c267507a3da3707f29a2b7c1f722e27d695296f152501a414ab" - "3.5": - url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.5.tar.gz" - sha256: "94b5cbf90057b252119e9a0ce459e3b488decb98e57163b00a6c7c494cd0761e" - "3.6": - url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.6.tar.gz" - sha256: "82633af08edff556f1401e1cf247e44eeef50f0588202731fddab183e9fda6d0" + "3.7.2": + url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.7.2.tar.gz" + sha256: "0711a6f97496e010f72adab69839939a9e50ba35ad87779e422ae3ff3b0edfc3" + "3.7.1": + url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.7.1.tar.gz" + sha256: "d00d7eaa0e22f2fdaa947a532b81b6fc35880acf4887b50a5ac9bfb7411ced03" "3.7": url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.7.tar.gz" sha256: "12be2a37f7fe39c489f646d3faee534f965871fd998258162962f36a19a455ef" + "3.6": + url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.6.tar.gz" + sha256: "82633af08edff556f1401e1cf247e44eeef50f0588202731fddab183e9fda6d0" + "3.5": + url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.5.tar.gz" + sha256: "94b5cbf90057b252119e9a0ce459e3b488decb98e57163b00a6c7c494cd0761e" + "3.4.1": + url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.4.1.tar.gz" + sha256: "c4a1a88b8c4a8c267507a3da3707f29a2b7c1f722e27d695296f152501a414ab" + "3.3.4": + url: "https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.3.4.tar.gz" + sha256: "8161f0d3100fc690590f475aa9acb70163ed7f2922e35e13136dececc52c49a9" + "3.2": + url: https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.2.tar.gz + sha256: d4e734e3dd501f741424aceb5198f5ebbc35c624335c99f7e202a9ecb31cd3e6 + "3.1": + url: https://github.com/hanickadot/compile-time-regular-expressions/archive/v3.1.tar.gz + sha256: c209ab0533b56a4fbbc7959e10c91c89fe2c9cb1725b64ed52be272a534a1d83 + "2.10": + url: https://github.com/hanickadot/compile-time-regular-expressions/archive/v2.10.tar.gz + sha256: 2e166b672c5a733b5448bb9fc83db54d92852c39e3e19097b79307cc6a327c31 diff --git a/recipes/ctre/all/conanfile.py b/recipes/ctre/all/conanfile.py index f98178ac4b67c..4a9068c2ee4fe 100644 --- a/recipes/ctre/all/conanfile.py +++ b/recipes/ctre/all/conanfile.py @@ -1,57 +1,64 @@ import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout +from conan.tools.files import get, copy + +required_conan_version = ">=1.50.0" -required_conan_version = ">=1.33.0" class CtreConan(ConanFile): name = "ctre" - homepage = "https://github.com/hanickadot/compile-time-regular-expressions" - url = "https://github.com/conan-io/conan-center-index" description = "Compile Time Regular Expression for C++17/20" - topics = ("cpp17", "regex", "compile-time-regular-expressions") license = ("Apache-2.0", "LLVM-exception") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/hanickadot/compile-time-regular-expressions" + topics = ("cpp17", "regex", "compile-time-regular-expressions", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "compiler" - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def validate(self): compiler = self.settings.compiler - compiler_version = tools.Version(self.settings.compiler.version) - ctre_version = tools.Version(self.version) + compiler_version = Version(self.settings.compiler.version) + ctre_version = Version(self.version) min_gcc = "7.4" if ctre_version < "3" else "8" if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") + check_min_cppstd(self, "17") if is_msvc(self): if compiler_version < "15": - raise ConanInvalidConfiguration("{}/{} doesn't support MSVC < 15".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support MSVC < 15") if ctre_version >= "3.7" and compiler_version < 16: - raise ConanInvalidConfiguration("{}/{} doesn't support MSVC < 16".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support MSVC < 16") elif compiler == "gcc" and compiler_version < min_gcc: - raise ConanInvalidConfiguration("{}/{} doesn't support gcc < {}".format(self.name, self.version, min_gcc)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support gcc < {min_gcc}") elif compiler == "clang" and compiler_version < "6.0": - raise ConanInvalidConfiguration("{}/{} doesn't support clang < 6.0".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support clang < 6.0") elif compiler == "apple-clang": if compiler_version < "10.0": - raise ConanInvalidConfiguration("{}/{} doesn't support Apple clang < 10.0".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Apple clang < 10.0") # "library does not compile with (at least) Xcode 12.0-12.4" # https://github.com/hanickadot/compile-time-regular-expressions/issues/188 # it's also occurred in Xcode 13. if ctre_version.major == "3" and ctre_version.minor == "4" and compiler_version >= "12": - raise ConanInvalidConfiguration("{}/{} doesn't support Apple clang".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Apple clang") def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, pattern="*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/ctre/all/test_package/CMakeLists.txt b/recipes/ctre/all/test_package/CMakeLists.txt index b2fb1f2436ed0..a3f2fba7b1674 100644 --- a/recipes/ctre/all/test_package/CMakeLists.txt +++ b/recipes/ctre/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(ctre CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/ctre/all/test_package/conanfile.py b/recipes/ctre/all/test_package/conanfile.py index 38f44a943c8f6..5641139581565 100644 --- a/recipes/ctre/all/test_package/conanfile.py +++ b/recipes/ctre/all/test_package/conanfile.py @@ -1,9 +1,23 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout class CtreTestConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +25,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ctre/all/test_v1_package/CMakeLists.txt b/recipes/ctre/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..bdcd221de0a2c --- /dev/null +++ b/recipes/ctre/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/ctre/all/test_v1_package/conanfile.py b/recipes/ctre/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f44a943c8f6 --- /dev/null +++ b/recipes/ctre/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class CtreTestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/ctre/config.yml b/recipes/ctre/config.yml index f537d25fd0f0b..791985db54420 100644 --- a/recipes/ctre/config.yml +++ b/recipes/ctre/config.yml @@ -1,23 +1,21 @@ versions: - "2.8.4": + "3.7.2": folder: all - "2.9.2": + "3.7.1": folder: all - "2.10": + "3.7": folder: all - "3.0.1": + "3.6": folder: all - "3.1": + "3.5": folder: all - "3.2": + "3.4.1": folder: all "3.3.4": folder: all - "3.4.1": - folder: all - "3.5": + "3.2": folder: all - "3.6": + "3.1": folder: all - "3.7": + "2.10": folder: all diff --git a/recipes/cxxopts/all/conandata.yml b/recipes/cxxopts/all/conandata.yml index cc2bb6b4b5c85..80d718f14d1a0 100644 --- a/recipes/cxxopts/all/conandata.yml +++ b/recipes/cxxopts/all/conandata.yml @@ -1,13 +1,13 @@ sources: - "1.4.4": - url: https://github.com/jarro2783/cxxopts/archive/v1.4.4.zip - sha256: 7c8ec885fcc58e10a8268b57ae04d5cbeac895d150d3a09c15605ff7ef05cf87 - "2.2.0": - url: https://github.com/jarro2783/cxxopts/archive/v2.2.0.zip - sha256: f9640c00d9938bedb291a21f9287902a3a8cee38db6910b905f8eba4a6416204 - "2.2.1": - url: https://github.com/jarro2783/cxxopts/archive/v2.2.1.zip - sha256: 7021ce97f51a40f7fd3558da416ab6914b1d3f758ccf68a1e8734ad10b49b676 "3.0.0": - url: https://github.com/jarro2783/cxxopts/archive/v3.0.0.zip - sha256: 1eefdf5af3ba0c66458258de05df2a113262ad5e85cac489de0a456088e9f9b0 + url: "https://github.com/jarro2783/cxxopts/archive/refs/tags/v3.0.0.tar.gz" + sha256: "36f41fa2a46b3c1466613b63f3fa73dc24d912bc90d667147f1e43215a8c6d00" + "2.2.1": + url: "https://github.com/jarro2783/cxxopts/archive/refs/tags/v2.2.1.tar.gz" + sha256: "984aa3c8917d649b14d7f6277104ce38dd142ce378a9198ec926f03302399681" + "2.2.0": + url: "https://github.com/jarro2783/cxxopts/archive/refs/tags/v2.2.0.tar.gz" + sha256: "447dbfc2361fce9742c5d1c9cfb25731c977b405f9085a738fbd608626da8a4d" + "1.4.4": + url: "https://github.com/jarro2783/cxxopts/archive/refs/tags/v1.4.4.tar.gz" + sha256: "1d0eedb39ecbc64a0f82d8b6fe40d5c8e611501702969cfbd14a07ce6ddb8501" diff --git a/recipes/cxxopts/all/conanfile.py b/recipes/cxxopts/all/conanfile.py index c7ce483a6966b..bd4038d2213ad 100644 --- a/recipes/cxxopts/all/conanfile.py +++ b/recipes/cxxopts/all/conanfile.py @@ -1,6 +1,12 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.51.1" class CxxOptsConan(ConanFile): @@ -10,55 +16,64 @@ class CxxOptsConan(ConanFile): description = "Lightweight C++ option parser library, supporting the standard GNU style syntax for options." license = "MIT" topics = ("option-parser", "positional-arguments ", "header-only") - settings = "compiler" - options = { "unicode": [True, False] } - default_options = { "unicode": False } - no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "unicode": [True, False], + } + default_options = { + "unicode": False, + } + no_copy_source = True @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 11 @property def _minimum_compilers_version(self): return { "Visual Studio": "14", - "gcc": "5", + "gcc": "4.9", "clang": "3.9", "apple-clang": "8", } - def configure(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) - min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) - if not min_version: - self.output.warn("{} recipe lacks information about the {} compiler support.".format( - self.name, self.settings.compiler)) - else: - if tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration("{} requires C++{} support. The current compiler {} {} does not support it.".format( - self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.unicode: - self.requires("icu/70.1") + self.requires("icu/71.1") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) + if min_version and Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("{}.hpp".format(self.name), dst="include", src=os.path.join(self._source_subfolder, "include")) + def build(self): + pass - def package_id(self): - self.info.header_only() + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "cxxopts.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "cxxopts") + self.cpp_info.set_property("cmake_target_name", "cxxopts::cxxopts") + self.cpp_info.set_property("pkg_config_name", "cxxopts") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self.options.unicode: self.cpp_info.defines = ["CXXOPTS_USE_UNICODE"] diff --git a/recipes/cxxopts/all/test_package/CMakeLists.txt b/recipes/cxxopts/all/test_package/CMakeLists.txt index 7f2172dfd2a9c..9ceb2f747d84e 100644 --- a/recipes/cxxopts/all/test_package/CMakeLists.txt +++ b/recipes/cxxopts/all/test_package/CMakeLists.txt @@ -1,9 +1,16 @@ -cmake_minimum_required(VERSION 3.1.3) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +enable_testing() -add_executable(${PROJECT_NAME} main.cpp) -target_link_libraries(${PROJECT_NAME} CONAN_PKG::cxxopts) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +find_package(cxxopts REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE cxxopts::cxxopts) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME} -f 41 --bar baria --baz) +if(WITH_UNICODE) + # This will fail if it was not enabled in the package https://github.com/jarro2783/cxxopts#unrecognised-arguments + add_test(NAME unicode COMMAND ${PROJECT_NAME} -f 41 --bar baria --baz -q quxis) +endif() diff --git a/recipes/cxxopts/all/test_package/conanfile.py b/recipes/cxxopts/all/test_package/conanfile.py index 7da0637b28118..1e91d7e0cc26d 100644 --- a/recipes/cxxopts/all/test_package/conanfile.py +++ b/recipes/cxxopts/all/test_package/conanfile.py @@ -1,10 +1,24 @@ -import os -from io import StringIO -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import build_jobs, can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import chdir + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_UNICODE"] = self.dependencies["cxxopts"].options.unicode + tc.generate() def build(self): cmake = CMake(self) @@ -12,15 +26,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - output = StringIO() - bin_path = os.path.join("bin", "test_package") - option_string = "-f 41 --bar baria --baz"; - if self.options["cxxopts"].unicode: - option_string += " -q quxis"; - self.run("{} {}".format(bin_path, option_string), run_environment=True, output=output) - output_lines = set(output.getvalue().splitlines()) - expected_lines = {"foo:41", "bar:baria", "baz:1"} - if self.options["cxxopts"].unicode: - expected_lines.add("qux:quxis") - assert(expected_lines.issubset(output_lines)) + if can_run(self): + with chdir(self, self.build_folder): + self.run(f"ctest --output-on-failure -C {self.settings.build_type} -j {build_jobs(self)}", env="conanrun") diff --git a/recipes/cxxopts/all/test_package/main.cpp b/recipes/cxxopts/all/test_package/test_package.cpp similarity index 100% rename from recipes/cxxopts/all/test_package/main.cpp rename to recipes/cxxopts/all/test_package/test_package.cpp diff --git a/recipes/cxxopts/all/test_v1_package/CMakeLists.txt b/recipes/cxxopts/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cxxopts/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cxxopts/all/test_v1_package/conanfile.py b/recipes/cxxopts/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c68398ab15a88 --- /dev/null +++ b/recipes/cxxopts/all/test_v1_package/conanfile.py @@ -0,0 +1,27 @@ +from conans import ConanFile, CMake, tools +from io import StringIO +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + output = StringIO() + bin_path = os.path.join("bin", "test_package") + option_string = "-f 41 --bar baria --baz" + if self.options["cxxopts"].unicode: + option_string += " -q quxis" + self.run(f"{bin_path} {option_string}", run_environment=True, output=output) + output_lines = set(output.getvalue().splitlines()) + expected_lines = {"foo:41", "bar:baria", "baz:1"} + if self.options["cxxopts"].unicode: + expected_lines.add("qux:quxis") + assert(expected_lines.issubset(output_lines)) diff --git a/recipes/cxxopts/config.yml b/recipes/cxxopts/config.yml index cc3a23a64de0f..69689683a4346 100644 --- a/recipes/cxxopts/config.yml +++ b/recipes/cxxopts/config.yml @@ -1,9 +1,9 @@ versions: - "1.4.4": - folder: all - "2.2.0": + "3.0.0": folder: all "2.2.1": folder: all - "3.0.0": + "2.2.0": + folder: all + "1.4.4": folder: all diff --git a/recipes/cyclonedds/all/conandata.yml b/recipes/cyclonedds/all/conandata.yml new file mode 100644 index 0000000000000..d4037567cc2c5 --- /dev/null +++ b/recipes/cyclonedds/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "0.10.2": + url: "https://github.com/eclipse-cyclonedds/cyclonedds/archive/refs/tags/0.10.2.tar.gz" + sha256: "bc84e137e0c8a055b8cd97fbeafec94e36de1b0c2e88800896a82384fd867ae5" +patches: + "0.10.2": + - patch_file: "patches/0.10.2-0001-fix-find-iceoryx.patch" + patch_description: "Fix cmake find for iceoryx package" + patch_type: "conan" diff --git a/recipes/cyclonedds/all/conanfile.py b/recipes/cyclonedds/all/conanfile.py new file mode 100644 index 0000000000000..28044cd38689c --- /dev/null +++ b/recipes/cyclonedds/all/conanfile.py @@ -0,0 +1,172 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class CycloneDDSConan(ConanFile): + name = "cyclonedds" + license = "EPL-2.0" + homepage = "https://cyclonedds.io/" + url = "https://github.com/conan-io/conan-center-index" + description = "Eclipse Cyclone DDS - An implementation"\ + " of the OMG Data Distribution Service (DDS) specification" + topics = ("dds", "ipc", "ros", "middleware") + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_ssl": [True, False], + "with_shm" : [True, False], + "enable_security" : [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_ssl": False, + "with_shm": False, + "enable_security": False, + } + + short_paths = True + + @property + def _min_cppstd(self): + return "14" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "Visual Studio": "16", + "msvc": "192", + "clang": "7", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self,src_folder="src") + + def requirements(self): + if self.options.with_shm: + self.requires("iceoryx/2.0.2") + if self.options.with_ssl: + self.requires("openssl/1.1.1t") + + def validate(self): + if self.options.enable_security and not self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} currently do not support"\ + "static build and security on") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r"cmake version (\d+\.\d+\.\d+)", output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if not self._cmake_new_enough("3.16"): + self.tool_requires("cmake/3.25.2") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + # TODO : determine how to do in conan : + # - idlc is a code generator that is used as tool (and so not cross compiled) + # - other tools like ddsperf is cross compiled for target + # - maybe separate package like cyclonedds_idlc + tc.variables["BUILD_IDLC"] = False + tc.variables["BUILD_IDLC_TESTING"] = False + tc.variables["BUILD_DDSPERF"] = False + tc.variables["BUILD_IDLC_TESTING"] = False + # variables which effects build + tc.variables["ENABLE_SSL"] = self.options.with_ssl + tc.variables["ENABLE_SHM"] = self.options.with_shm + tc.variables["ENABLE_SECURITY"] = self.options.enable_security + tc.generate() + + cd = CMakeDeps(self) + cd.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + if self.settings.os == "Windows" and self.options.shared: + for p in ("*.pdb", "concrt*.dll", "msvcp*.dll", "vcruntime*.dll"): + rm(self, p, os.path.join(self.package_folder, "bin")) + else: + rmdir(self, os.path.join(self.package_folder, "bin")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "CycloneDDS") + self.cpp_info.set_property("cmake_target_name", "CycloneDDS::ddsc") + self.cpp_info.set_property("pkg_config_name", "CycloneDDS") + # TODO: back to global scope in conan v2 + self.cpp_info.components["CycloneDDS"].libs = ["ddsc"] + requires = [] + if self.options.with_shm: + requires.append("iceoryx::iceoryx_binding_c") + if self.options.with_ssl: + requires.append("openssl::openssl") + self.cpp_info.components["CycloneDDS"].requires = requires + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["CycloneDDS"].system_libs = ["dl", "pthread"] + elif self.settings.os == "Windows": + self.cpp_info.components["CycloneDDS"].system_libs = [ + "ws2_32", + "dbghelp", + "bcrypt", + "iphlpapi" + ] + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "CycloneDDS" + self.cpp_info.names["cmake_find_package_multi"] = "CycloneDDS" + self.cpp_info.components["CycloneDDS"].names["cmake_find_package"] = "ddsc" + self.cpp_info.components["CycloneDDS"].names["cmake_find_package_multi"] = "ddsc" + self.cpp_info.components["CycloneDDS"].set_property("cmake_target_name", "CycloneDDS::ddsc") + self.cpp_info.components["CycloneDDS"].set_property("pkg_config_name", "CycloneDDS") diff --git a/recipes/cyclonedds/all/patches/0.10.2-0001-fix-find-iceoryx.patch b/recipes/cyclonedds/all/patches/0.10.2-0001-fix-find-iceoryx.patch new file mode 100644 index 0000000000000..228ee7dba0b01 --- /dev/null +++ b/recipes/cyclonedds/all/patches/0.10.2-0001-fix-find-iceoryx.patch @@ -0,0 +1,15 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index fa08094a..516806dd 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -55,8 +55,8 @@ if(ENABLE_SHM) + else() + set(iceoryx_required QUIET) + endif() +- find_package(iceoryx_binding_c ${iceoryx_required}) +- set(ENABLE_SHM ${iceoryx_binding_c_FOUND} CACHE STRING "" FORCE) ++ find_package(iceoryx ${iceoryx_required}) ++ set(ENABLE_SHM ${iceoryx_FOUND} CACHE STRING "" FORCE) + if(ENABLE_SHM AND APPLE) + get_filename_component(iceoryx_libdir "${ICEORYX_LIB}" DIRECTORY) + set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${iceoryx_libdir}") diff --git a/recipes/cyclonedds/all/test_package/CMakeLists.txt b/recipes/cyclonedds/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f30c0b29578a0 --- /dev/null +++ b/recipes/cyclonedds/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(CycloneDDS REQUIRED CONFIG) + +add_executable(test_package test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE CycloneDDS::ddsc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/cyclonedds/all/test_package/conanfile.py b/recipes/cyclonedds/all/test_package/conanfile.py new file mode 100644 index 0000000000000..422a7d5c03da2 --- /dev/null +++ b/recipes/cyclonedds/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +import os +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run + +class CycloneDDSTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cyclonedds/all/test_package/test_package.cpp b/recipes/cyclonedds/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9966d58481774 --- /dev/null +++ b/recipes/cyclonedds/all/test_package/test_package.cpp @@ -0,0 +1,21 @@ + +#include +#include +#include +#include +#include +#include + +#include "dds/dds.h" + +int main() { + dds_entity_t participant; + dds_entity_t topic; + + /* Create a Participant. */ + participant = dds_create_participant (DDS_DOMAIN_DEFAULT, NULL, NULL); + if (participant < 0) + DDS_FATAL("dds_create_participant: %s\n", dds_strretcode(-participant)); + + return EXIT_SUCCESS; +} diff --git a/recipes/cyclonedds/all/test_v1_package/CMakeLists.txt b/recipes/cyclonedds/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cyclonedds/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cyclonedds/all/test_v1_package/conanfile.py b/recipes/cyclonedds/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1a9e66f7126fc --- /dev/null +++ b/recipes/cyclonedds/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake +from conan.tools import build + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = ["cmake", "cmake_find_package_multi"] + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not build.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/cyclonedds/config.yml b/recipes/cyclonedds/config.yml new file mode 100644 index 0000000000000..6c8041d964ef5 --- /dev/null +++ b/recipes/cyclonedds/config.yml @@ -0,0 +1,3 @@ +versions: + "0.10.2": + folder: all diff --git a/recipes/cyrus-sasl/all/conanfile.py b/recipes/cyrus-sasl/all/conanfile.py index 80693c3331c36..03e66247f9633 100644 --- a/recipes/cyrus-sasl/all/conanfile.py +++ b/recipes/cyrus-sasl/all/conanfile.py @@ -1,10 +1,14 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import unix_path import os -import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class CyrusSaslConan(ConanFile): @@ -17,7 +21,7 @@ class CyrusSaslConan(ConanFile): "It can be used on the client or server side " "to provide authentication and authorization services." ) - topics = ("SASL", "authentication", "authorization") + topics = ("sasl", "authentication", "authorization") settings = "os", "arch", "compiler", "build_type" options = { @@ -54,12 +58,8 @@ class CyrusSaslConan(ConanFile): } @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def config_options(self): if self.settings.os == "Windows": @@ -67,64 +67,52 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.with_postgresql: - self.requires("libpq/14.2") + self.requires("libpq/14.5") if self.options.with_mysql: - self.requires("libmysqlclient/8.0.29") + self.requires("libmysqlclient/8.0.30") if self.options.with_sqlite3: - self.requires("sqlite3/3.39.2") - if self.options.with_gssapi: - raise ConanInvalidConfiguration("with_gssapi requires krb5 recipe, not yet available in CCI") - self.requires("krb5/1.18.3") + self.requires("sqlite3/3.39.4") def validate(self): - if self.settings.os == "Windows": + if self.info.settings.os == "Windows": raise ConanInvalidConfiguration( "Cyrus SASL package is not compatible with Windows yet." ) + if self.options.with_gssapi: + raise ConanInvalidConfiguration( + f"{self.name}:with_gssapi=True requires krb5 recipe, not yet available in conan-center", + ) def build_requirements(self): - self.build_requires("gnu-config/cci.20210814") + self.tool_requires("gnu-config/cci.20210814") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config", "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config", "config.guess")) - - configure = os.path.join(self._source_subfolder, "configure") - # relocatable shared libs on macOS - tools.replace_in_file(configure, "-install_name \\$rpath/", "-install_name @rpath/") - # avoid SIP issues on macOS when dependencies are shared - if tools.is_apple_os(self.settings.os): - libpaths = ":".join(self.deps_cpp_info.lib_paths) - tools.replace_in_file( - configure, - "#! /bin/sh\n", - "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n".format(libpaths), - ) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - rootpath = lambda req: tools.unix_path(self.deps_cpp_info[req].rootpath) - rootpath_no = lambda v, req: rootpath(req) if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), + rootpath_no = lambda v, req: unix_path(self, self.dependencies[req].package_folder) if v else "no" + tc.configure_args.extend([ "--disable-sample", "--disable-macos-framework", "--with-dblib=none", @@ -143,33 +131,49 @@ def _configure_autotools(self): "--with-mysql={}".format(rootpath_no(self.options.with_mysql, "libmysqlclient")), "--without-sqlite", "--with-sqlite3={}".format(rootpath_no(self.options.with_sqlite3, "sqlite3")), - ] + ]) if self.options.with_gssapi: - args.append("--with-gss_impl=mit") + tc.configure_args.append("--with-gss_impl=mit") + tc.generate() - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + deps = AutotoolsDeps(self) + deps.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + def _patch_sources(self): + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), + src=os.path.dirname(gnu_config), + dst=os.path.join(self.source_folder, "config")) + # relocatable executable & shared libs on macOS + replace_in_file(self, os.path.join(self.source_folder, "configure"), "-install_name \\$rpath/", "-install_name @rpath/") def build(self): self._patch_sources() - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy(pattern="COPYING", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib"), recursive=True) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libsasl2") self.cpp_info.libs = ["sasl2"] + # TODO: to remove in conan v2 bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.output.info(f"Appending PATH environment variable: {bindir}") self.env_info.PATH.append(bindir) - - # TODO: to remove in conan v2 once pkg_config generator removed - self.cpp_info.names["pkg_config"] = "libsasl2" diff --git a/recipes/cyrus-sasl/all/test_package/CMakeLists.txt b/recipes/cyrus-sasl/all/test_package/CMakeLists.txt index 375b2961c4d5f..b50bb405e7050 100644 --- a/recipes/cyrus-sasl/all/test_package/CMakeLists.txt +++ b/recipes/cyrus-sasl/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(cyrus-sasl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} cyrus-sasl::cyrus-sasl) +target_link_libraries(${PROJECT_NAME} PRIVATE cyrus-sasl::cyrus-sasl) diff --git a/recipes/cyrus-sasl/all/test_package/conanfile.py b/recipes/cyrus-sasl/all/test_package/conanfile.py index e0a85886fc12c..0a6bc68712d90 100644 --- a/recipes/cyrus-sasl/all/test_package/conanfile.py +++ b/recipes/cyrus-sasl/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/cyrus-sasl/all/test_v1_package/CMakeLists.txt b/recipes/cyrus-sasl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/cyrus-sasl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/cyrus-sasl/all/test_v1_package/conanfile.py b/recipes/cyrus-sasl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e0a85886fc12c --- /dev/null +++ b/recipes/cyrus-sasl/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import CMake, ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/czmq/all/CMakeLists.txt b/recipes/czmq/all/CMakeLists.txt deleted file mode 100644 index 9b9d3d634acc0..0000000000000 --- a/recipes/czmq/all/CMakeLists.txt +++ /dev/null @@ -1,20 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -if(MSVC) - add_definitions("-D_NOEXCEPT=noexcept") -endif() - -if(NOT BUILD_SHARED_LIBS) - add_definitions("-DCZMQ_STATIC") -endif() - -add_subdirectory(source_subfolder) - -foreach(TARGET zmakecert zsp test_randof czmq_selftest) - set_target_properties("${TARGET}" - PROPERTIES EXCLUDE_FROM_ALL ON) -endforeach() diff --git a/recipes/czmq/all/conandata.yml b/recipes/czmq/all/conandata.yml index ae7b2a74b8950..f252ab078883b 100644 --- a/recipes/czmq/all/conandata.yml +++ b/recipes/czmq/all/conandata.yml @@ -1,14 +1,20 @@ sources: + "4.2.1": + url: "https://github.com/zeromq/czmq/releases/download/v4.2.1/czmq-4.2.1.tar.gz" + sha256: "5d720a204c2a58645d6f7643af15d563a712dad98c9d32c1ed913377daa6ac39" "4.2.0": - url: "https://github.com/zeromq/czmq/archive/v4.2.0.tar.gz" - sha256: "31185090b500b64855003be2450ced00efa6b58544639acfc68aa13c9ec249f8" + url: "https://github.com/zeromq/czmq/releases/download/v4.2.0/czmq-4.2.0.tar.gz" + sha256: "cfab29c2b3cc8a845749758a51e1dd5f5160c1ef57e2a41ea96e4c2dcc8feceb" patches: + "4.2.1": + - patch_file: patches/4.2.1-0001-fix-cmake.patch + patch_description: "set LINKER_LANGUAGE, disable executable and tests" + patch_type: "conan" + - patch_file: patches/4.2.1-0002-fix-zsys_thread-issue.patch + patch_description: "addresses three problems related to ZSYS_THREAD_NAME_PREFIX / ZSYS_THREAD_NAME_PREFIX_STR:" + patch_type: "bugfix" + patch_source: "https://github.com/zeromq/czmq/pull/2162" "4.2.0": - - base_path: source_subfolder - patch_file: patches/0001-allow-cmake-subproject.patch - - base_path: source_subfolder - patch_file: patches/0002-dont-build-zmakecert.patch - - base_path: source_subfolder - patch_file: patches/0003-fix-cmake-find-package.patch - - base_path: source_subfolder - patch_file: patches/0004-make-czmq-link-using-cxx-compiler.patch + - patch_file: patches/4.2.0-0001-fix-cmake.patch + patch_description: "add options which are added in 4.2.1, set LINKER_LANGUAGE, disable executable and tests" + patch_type: "conan" diff --git a/recipes/czmq/all/conanfile.py b/recipes/czmq/all/conanfile.py index 916303c3f9b24..88618f4797ed7 100644 --- a/recipes/czmq/all/conanfile.py +++ b/recipes/czmq/all/conanfile.py @@ -1,125 +1,143 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, save +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class CzmqConan(ConanFile): name = "czmq" - homepage = "https://github.com/zeromq/czmq" description = "High-level C binding for ZeroMQ" - topics = ("zmq", "libzmq", "message-queue", "asynchronous") - url = "https://github.com/conan-io/conan-center-index" license = "MPL-2.0" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/zeromq/czmq" + topics = ("zmq", "libzmq", "message-queue", "asynchronous") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "enable_drafts": [True, False], "with_libcurl": [True, False], "with_lz4": [True, False], "with_libuuid": [True, False], + "with_libmicrohttpd": [True, False], + "with_systemd": [True, False], } default_options = { "shared": False, + "enable_drafts": False, "fPIC": True, "with_libcurl": True, "with_lz4": True, "with_libuuid": True, + "with_libmicrohttpd": True, + "with_systemd": False, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC # libuuid is not available on Windows del self.options.with_libuuid + if self.settings.os == "Linux": + del self.options.with_systemd def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + if not self.options.enable_drafts: + del self.options.with_libcurl + del self.options.with_libmicrohttpd + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("openssl/1.1.1m") # zdigest depends on openssl self.requires("zeromq/4.3.4") - if self.options.with_libcurl: - self.requires("libcurl/7.80.0") + if self.options.get_safe("with_libmicrohttpd"): + self.requires("libmicrohttpd/0.9.75") + if self.options.get_safe("with_libcurl"): + self.requires("libcurl/7.87.0") if self.options.with_lz4: - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.get_safe("with_libuuid"): self.requires("libuuid/1.0.3") + if self.options.get_safe("with_systemd"): + self.requires("libsystemd/252.4") + + def validate(self): + if is_apple_os(self) and self.options.shared and self.settings.build_type == "Debug": + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared and debug on apple-clang.") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CZMQ_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["CZMQ_BUILD_STATIC"] = not self.options.shared - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_DRAFTS"] = self.options.enable_drafts + tc.variables["CZMQ_BUILD_SHARED"] = self.options.shared + tc.variables["CZMQ_BUILD_STATIC"] = not self.options.shared + tc.variables["CZMQ_WITH_UUID"] = self.options.get_safe("with_libuuid", False) + tc.variables["CZMQ_WITH_SYSTEMD"] = self.options.get_safe("with_systemd", False) + tc.variables["CZMQ_WITH_LZ4"] = self.options.with_lz4 + tc.variables["CZMQ_WITH_LIBCURL"] = self.options.get_safe("with_libcurl", False) + tc.variables["CZMQ_WITH_LIBMICROHTTPD"] = self.options.get_safe("with_libmicrohttpd", False) + if Version(self.version) >= "4.2.1": + tc.variables["CZMQ_WITH_NSS"] = False + if is_msvc(self): + tc.preprocessor_definitions["_NOEXCEPT"] = "noexcept" + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + + dpes = CMakeDeps(self) + dpes.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + # remove custom Finduuid.cmake to use cci Finduuid.cmake + rm(self, "Finduuid.cmake", self.source_folder) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "CMake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - # TODO: to remove in conan v2 once cmake_find_package_* generators removed + rmdir(self, os.path.join(self.package_folder, "CMake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {self._czmq_target: "czmq::czmq"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property def _czmq_target(self): @@ -129,20 +147,15 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "czmq") self.cpp_info.set_property("cmake_target_name", self._czmq_target) self.cpp_info.set_property("pkg_config_name", "libczmq") - prefix = "lib" if self._is_msvc and not self.options.shared else "" - self.cpp_info.libs = ["{}czmq".format(prefix)] + prefix = "lib" if is_msvc(self) and not self.options.shared else "" + self.cpp_info.libs = [f"{prefix}czmq"] if not self.options.shared: self.cpp_info.defines.append("CZMQ_STATIC") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["pthread", "m"]) elif self.settings.os == "Windows": self.cpp_info.system_libs.append("rpcrt4") - if not self.options.shared: - stdcpp_library = tools.stdcpp_library(self) - if stdcpp_library: - self.cpp_info.system_libs.append(stdcpp_library) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - self.cpp_info.names["pkg_config"] = "libczmq" diff --git a/recipes/czmq/all/patches/0001-allow-cmake-subproject.patch b/recipes/czmq/all/patches/0001-allow-cmake-subproject.patch deleted file mode 100644 index ba289825b0a1f..0000000000000 --- a/recipes/czmq/all/patches/0001-allow-cmake-subproject.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -74,7 +74,7 @@ endif() - - file(REMOVE "${SOURCE_DIR}/src/platform.h") - --file(WRITE "${CMAKE_BINARY_DIR}/platform.h.in" " -+file(WRITE "${PROJECT_BINARY_DIR}/platform.h.in" " - #cmakedefine HAVE_LINUX_WIRELESS_H - #cmakedefine HAVE_NET_IF_H - #cmakedefine HAVE_NET_IF_MEDIA_H -@@ -82,7 +82,7 @@ file(WRITE "${CMAKE_BINARY_DIR}/platform.h.in" " - #cmakedefine HAVE_FREEIFADDRS - ") - --configure_file("${CMAKE_BINARY_DIR}/platform.h.in" "${CMAKE_BINARY_DIR}/platform.h") -+configure_file("${PROJECT_BINARY_DIR}/platform.h.in" "${PROJECT_BINARY_DIR}/platform.h") - - #The MSVC C compiler is too out of date, - #so the sources have to be compiled as c++ -@@ -299,7 +299,7 @@ install(FILES ${czmq_headers} DESTINATION include) - ######################################################################## - - --include_directories("${SOURCE_DIR}/src" "${SOURCE_DIR}/include" "${CMAKE_BINARY_DIR}") -+include_directories("${SOURCE_DIR}/src" "${SOURCE_DIR}/include" "${PROJECT_BINARY_DIR}") - set (czmq_sources - src/zactor.c - src/zarmour.c -@@ -658,17 +658,17 @@ ENDIF (ENABLE_DRAFTS) - - add_custom_target( - copy-selftest-ro ALL -- COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/src/selftest-ro ${CMAKE_BINARY_DIR}/src/selftest-ro -+ COMMAND ${CMAKE_COMMAND} -E copy_directory ${PROJECT_SOURCE_DIR}/src/selftest-ro ${PROJECT_BINARY_DIR}/src/selftest-ro - ) - - add_custom_target( - make-selftest-rw ALL -- COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_BINARY_DIR}/src/selftest-rw -+ COMMAND ${CMAKE_COMMAND} -E make_directory ${PROJECT_BINARY_DIR}/src/selftest-rw - ) - - set_directory_properties( - PROPERTIES -- ADDITIONAL_MAKE_CLEAN_FILES "${CMAKE_BINARY_DIR}/src/selftest-ro;${CMAKE_BINARY_DIR}/src/selftest-rw" -+ ADDITIONAL_MAKE_CLEAN_FILES "${PROJECT_BINARY_DIR}/src/selftest-ro;${PROJECT_BINARY_DIR}/src/selftest-rw" - ) - - foreach(TEST_CLASS ${TEST_CLASSES}) -@@ -693,22 +693,22 @@ include(CTest) - ######################################################################## - add_custom_target (distclean @echo Cleaning for source distribution) - --set(cmake_generated ${CMAKE_BINARY_DIR}/CMakeCache.txt -- ${CMAKE_BINARY_DIR}/cmake_install.cmake -- ${CMAKE_BINARY_DIR}/Makefile -- ${CMAKE_BINARY_DIR}/CMakeFiles -- ${CMAKE_BINARY_DIR}/CTestTestfile.cmake -- ${CMAKE_BINARY_DIR}/DartConfiguration.tcl -- ${CMAKE_BINARY_DIR}/Testing -- ${CMAKE_BINARY_DIR}/compile_commands.json -- ${CMAKE_BINARY_DIR}/platform.h -- ${CMAKE_BINARY_DIR}/src/libczmq.pc -- ${CMAKE_BINARY_DIR}/src/libczmq.so -- ${CMAKE_BINARY_DIR}/src/czmq_selftest -- ${CMAKE_BINARY_DIR}/src/zmakecert -- ${CMAKE_BINARY_DIR}/src/zsp -- ${CMAKE_BINARY_DIR}/src/test_randof -- ${CMAKE_BINARY_DIR}/src/czmq_selftest -+set(cmake_generated ${PROJECT_BINARY_DIR}/CMakeCache.txt -+ ${PROJECT_BINARY_DIR}/cmake_install.cmake -+ ${PROJECT_BINARY_DIR}/Makefile -+ ${PROJECT_BINARY_DIR}/CMakeFiles -+ ${PROJECT_BINARY_DIR}/CTestTestfile.cmake -+ ${PROJECT_BINARY_DIR}/DartConfiguration.tcl -+ ${PROJECT_BINARY_DIR}/Testing -+ ${PROJECT_BINARY_DIR}/compile_commands.json -+ ${PROJECT_BINARY_DIR}/platform.h -+ ${PROJECT_BINARY_DIR}/src/libczmq.pc -+ ${PROJECT_BINARY_DIR}/src/libczmq.so -+ ${PROJECT_BINARY_DIR}/src/czmq_selftest -+ ${PROJECT_BINARY_DIR}/src/zmakecert -+ ${PROJECT_BINARY_DIR}/src/zsp -+ ${PROJECT_BINARY_DIR}/src/test_randof -+ ${PROJECT_BINARY_DIR}/src/czmq_selftest - ) - - add_custom_command( --- -2.21.0 - diff --git a/recipes/czmq/all/patches/0002-dont-build-zmakecert.patch b/recipes/czmq/all/patches/0002-dont-build-zmakecert.patch deleted file mode 100644 index 069bf10a74ad8..0000000000000 --- a/recipes/czmq/all/patches/0002-dont-build-zmakecert.patch +++ /dev/null @@ -1,24 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -502,7 +502,7 @@ - # executables - ######################################################################## - add_executable( -+ zmakecert EXCLUDE_FROM_ALL -- zmakecert - "${SOURCE_DIR}/src/zmakecert.c" - ) - if (TARGET czmq) -@@ -522,9 +522,9 @@ - ${OPTIONAL_LIBRARIES_STATIC} - ) - endif() --install(TARGETS zmakecert -- RUNTIME DESTINATION bin --) -+#install(TARGETS zmakecert -+# RUNTIME DESTINATION bin -+#) - add_executable( - zsp - "${SOURCE_DIR}/src/zsp.c" diff --git a/recipes/czmq/all/patches/0003-fix-cmake-find-package.patch b/recipes/czmq/all/patches/0003-fix-cmake-find-package.patch deleted file mode 100644 index ff1a6455a6955..0000000000000 --- a/recipes/czmq/all/patches/0003-fix-cmake-find-package.patch +++ /dev/null @@ -1,203 +0,0 @@ ---- Findlibcurl.cmake -+++ Findlibcurl.cmake -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LIBCURL "libcurl") - if (PC_LIBCURL_FOUND) -@@ -17,17 +17,9 @@ - endif(PC_LIBCURL_FOUND) - endif (NOT MSVC) - --find_path ( -- LIBCURL_INCLUDE_DIRS -- NAMES curl/curl.h -- HINTS ${PC_LIBCURL_INCLUDE_HINTS} --) -- --find_library ( -- LIBCURL_LIBRARIES -- NAMES curl -- HINTS ${PC_LIBCURL_LIBRARY_HINTS} --) -+set(LIBCURL_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_CURL}) -+ -+set(LIBCURL_LIBRARIES CONAN_PKG::CURL) - - include(FindPackageHandleStandardArgs) - ---- Findlibmicrohttpd.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Findlibmicrohttpd.cmake 2019-12-14 14:54:53.667244809 +0100 -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LIBMICROHTTPD "libmicrohttpd") - if (PC_LIBMICROHTTPD_FOUND) -@@ -17,17 +17,9 @@ - endif(PC_LIBMICROHTTPD_FOUND) - endif (NOT MSVC) - --find_path ( -- LIBMICROHTTPD_INCLUDE_DIRS -- NAMES microhttpd.h -- HINTS ${PC_LIBMICROHTTPD_INCLUDE_HINTS} --) -- --find_library ( -- LIBMICROHTTPD_LIBRARIES -- NAMES microhttpd -- HINTS ${PC_LIBMICROHTTPD_LIBRARY_HINTS} --) -+set(LIBMICROHTTPD_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LIBMICROHTTPD}) -+link_directories(${CONAN_LIB_DIRS_LIBMICROHTTPD}) -+set(LIBLIBMICROHTTPD_LIBRARIES_DIRS ${CONAN_LIBS_LIBLIBMICROHTTPD} ${CONAN_SYSTEM_LIBS_LIBLIBMICROHTTPD}) - - include(FindPackageHandleStandardArgs) - ---- Findlibsodium.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Findlibsodium.cmake 2019-12-14 14:54:53.667244809 +0100 -@@ -3,7 +3,7 @@ - # Please refer to the README for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LIBSODIUM "libsodium") - if (NOT PC_LIBSODIUM_FOUND) -@@ -18,17 +18,10 @@ - endif(PC_LIBSODIUM_FOUND) - endif (NOT MSVC) - --find_path ( -- LIBSODIUM_INCLUDE_DIRS -- NAMES sodium.h -- HINTS ${PC_LIBSODIUM_INCLUDE_HINTS} --) -- --find_library ( -- LIBSODIUM_LIBRARIES -- NAMES sodium -- HINTS ${PC_LIBSODIUM_LIBRARY_HINTS} --) -+set(LIBSODIUM_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LIBSODIUM}) -+link_directories(${CONAN_LIB_DIRS_LIBSODIUM}) -+set(LIBSODIUM_LIBRARIES ${CONAN_LIBS_LIBSODIUM} ${CONAN_SYSTEM_LIBS_LIBSODIUM}) -+add_definitions(${CONAN_DEFINES_LIBSODIUM}) - - include(FindPackageHandleStandardArgs) - ---- Findlibzmq.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Findlibzmq.cmake 2019-12-14 14:54:53.667244809 +0100 -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LIBZMQ "libzmq") - if (PC_LIBZMQ_FOUND) -@@ -17,19 +17,16 @@ - endif(PC_LIBZMQ_FOUND) - endif (NOT MSVC) - --find_path ( -- LIBZMQ_INCLUDE_DIRS -- NAMES zmq.h -- HINTS ${PC_LIBZMQ_INCLUDE_HINTS} --) -- --find_library ( -- LIBZMQ_LIBRARIES -- NAMES zmq -- HINTS ${PC_LIBZMQ_LIBRARY_HINTS} --) -- -+set(LIBZMQ_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_ZEROMQ}) -+link_directories(${CONAN_LIB_DIRS_ZEROMQ}) -+set(LIBZMQ_LIBRARIES ${CONAN_LIBS_ZEROMQ} ${CONAN_SYSTEM_LIBS_ZEROMQ}) - include(FindPackageHandleStandardArgs) -+add_definitions(${CONAN_DEFINES_ZEROMQ}) -+ -+if(DEFINED CONAN_INCLUDE_DIRS_LIBSODIUM) -+ find_package(libsodium REQUIRED) -+ list(APPEND LIBZMQ_LIBRARIES ${LIBSODIUM_LIBRARIES}) -+endif() - - find_package_handle_standard_args( - LIBZMQ ---- Findlz4.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Findlz4.cmake 2019-12-14 14:54:53.667244809 +0100 -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_LZ4 "liblz4") - if (PC_LZ4_FOUND) -@@ -17,17 +17,10 @@ - endif(PC_LZ4_FOUND) - endif (NOT MSVC) - --find_path ( -- LZ4_INCLUDE_DIRS -- NAMES lz4.h -- HINTS ${PC_LZ4_INCLUDE_HINTS} --) -- --find_library ( -- LZ4_LIBRARIES -- NAMES lz4 -- HINTS ${PC_LZ4_LIBRARY_HINTS} --) -+set(LZ4_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LZ4}) -+link_directories(${CONAN_LIB_DIRS_LZ4}) -+set(LZ4_LIBRARIES ${CONAN_LIBS_LZ4} ${CONAN_SYSTEM_LIBS_LZ4}) -+add_definitions(${CONAN_DEFINES_LZ4}) - - include(FindPackageHandleStandardArgs) - ---- Finduuid.cmake 2019-02-10 18:47:44.000000000 +0100 -+++ Finduuid.cmake 2019-12-14 14:54:53.668244813 +0100 -@@ -3,7 +3,7 @@ - # Read the zproject/README.md for information about making permanent changes. # - ################################################################################ - --if (NOT MSVC) -+if (0) - include(FindPkgConfig) - pkg_check_modules(PC_UUID "uuid") - if (PC_UUID_FOUND) -@@ -17,17 +17,10 @@ - endif(PC_UUID_FOUND) - endif (NOT MSVC) - --find_path ( -- UUID_INCLUDE_DIRS -- NAMES uuid/uuid.h -- HINTS ${PC_UUID_INCLUDE_HINTS} --) -- --find_library ( -- UUID_LIBRARIES -- NAMES uuid -- HINTS ${PC_UUID_LIBRARY_HINTS} --) -+set(UUID_INCLUDE_DIRS ${CONAN_INCLUDE_DIRS_LIBUUID}) -+link_directories(${CONAN_LIB_DIRS_LIBUUID}) -+set(UUID_LIBRARIES ${CONAN_LIBS_LIBUUID} ${CONAN_SYSTEM_LIBS_LIBUUID}) -+add_definitions(${CONAN_DEFINES_LIBUUID}) - - include(FindPackageHandleStandardArgs) - diff --git a/recipes/czmq/all/patches/0004-make-czmq-link-using-cxx-compiler.patch b/recipes/czmq/all/patches/0004-make-czmq-link-using-cxx-compiler.patch deleted file mode 100644 index 5137f6e7d0c15..0000000000000 --- a/recipes/czmq/all/patches/0004-make-czmq-link-using-cxx-compiler.patch +++ /dev/null @@ -1,9 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -380,5 +380,6 @@ - ENDIF (MSVC) - - set_target_properties (czmq PROPERTIES -+ LINKER_LANGUAGE CXX - PUBLIC_HEADER "${public_headers}" - DEFINE_SYMBOL "CZMQ_EXPORTS" diff --git a/recipes/czmq/all/patches/4.2.0-0001-fix-cmake.patch b/recipes/czmq/all/patches/4.2.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..b52b335d8bd61 --- /dev/null +++ b/recipes/czmq/all/patches/4.2.0-0001-fix-cmake.patch @@ -0,0 +1,167 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -120,27 +120,25 @@ set(OPTIONAL_LIBRARIES_STATIC) + ######################################################################## + # LIBZMQ dependency + ######################################################################## +-find_package(libzmq REQUIRED) +-IF (LIBZMQ_FOUND) +- include_directories(${LIBZMQ_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${LIBZMQ_LIBRARIES}) ++IF (1) ++ find_package(ZeroMQ REQUIRED CONFIG) ++ list(APPEND MORE_LIBRARIES $,libzmq,libzmq-static>) + IF (PC_LIBZMQ_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} libzmq") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_LIBZMQ_STATIC_LDFLAGS}) + ELSE (PC_LIBZMQ_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lzmq") + ENDIF (PC_LIBZMQ_FOUND) +-ELSE (LIBZMQ_FOUND) ++ELSE () + message( FATAL_ERROR "libzmq not found." ) +-ENDIF (LIBZMQ_FOUND) ++ENDIF () + + ######################################################################## + # UUID dependency + ######################################################################## +-find_package(uuid) +-IF (UUID_FOUND) +- include_directories(${UUID_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${UUID_LIBRARIES}) ++IF (CZMQ_WITH_UUID) ++ find_package(libuuid REQUIRED CONFIG) ++ list(APPEND MORE_LIBRARIES libuuid::libuuid) + IF (PC_UUID_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} uuid") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_UUID_STATIC_LDFLAGS}) +@@ -148,16 +146,14 @@ IF (UUID_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -luuid") + ENDIF (PC_UUID_FOUND) + add_definitions(-DHAVE_UUID) +- list(APPEND OPTIONAL_LIBRARIES ${UUID_LIBRARIES}) +-ENDIF (UUID_FOUND) ++ENDIF () + + ######################################################################## + # SYSTEMD dependency + ######################################################################## +-find_package(systemd) +-IF (SYSTEMD_FOUND) +- include_directories(${SYSTEMD_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${SYSTEMD_LIBRARIES}) ++IF (CZMQ_WITH_SYSTEMD) ++ find_package(libsystemd REQUIRED CONFIG) ++ list(APPEND MORE_LIBRARIES libsystemd::libsystemd) + IF (PC_SYSTEMD_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} libsystemd >= 200.0.0") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_SYSTEMD_STATIC_LDFLAGS}) +@@ -165,16 +161,14 @@ IF (SYSTEMD_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lsystemd") + ENDIF (PC_SYSTEMD_FOUND) + add_definitions(-DHAVE_LIBSYSTEMD) +- list(APPEND OPTIONAL_LIBRARIES ${SYSTEMD_LIBRARIES}) +-ENDIF (SYSTEMD_FOUND) ++ENDIF () + + ######################################################################## + # LZ4 dependency + ######################################################################## +-find_package(lz4) +-IF (LZ4_FOUND) +- include_directories(${LZ4_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${LZ4_LIBRARIES}) ++IF (CZMQ_WITH_LZ4) ++ find_package(lz4 REQUIRED CONFIG) ++ list(APPEND MORE_LIBRARIES $,LZ4::lz4_shared,LZ4::lz4_static>) + IF (PC_LZ4_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} liblz4") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_LZ4_STATIC_LDFLAGS}) +@@ -182,16 +176,14 @@ IF (LZ4_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -llz4") + ENDIF (PC_LZ4_FOUND) + add_definitions(-DHAVE_LIBLZ4) +- list(APPEND OPTIONAL_LIBRARIES ${LZ4_LIBRARIES}) +-ENDIF (LZ4_FOUND) ++ENDIF () + + ######################################################################## + # LIBCURL dependency + ######################################################################## +-find_package(libcurl) +-IF (LIBCURL_FOUND) +- include_directories(${LIBCURL_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${LIBCURL_LIBRARIES}) ++IF (CZMQ_WITH_LIBCURL) ++ find_package(CURL REQUIRED) ++ list(APPEND MORE_LIBRARIES CURL::libcurl) + IF (PC_LIBCURL_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} libcurl >= 7.28.0") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_LIBCURL_STATIC_LDFLAGS}) +@@ -199,16 +191,14 @@ IF (LIBCURL_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lcurl") + ENDIF (PC_LIBCURL_FOUND) + add_definitions(-DHAVE_LIBCURL) +- list(APPEND OPTIONAL_LIBRARIES ${LIBCURL_LIBRARIES}) +-ENDIF (LIBCURL_FOUND) ++ENDIF () + + ######################################################################## + # LIBMICROHTTPD dependency + ######################################################################## +-find_package(libmicrohttpd) +-IF (LIBMICROHTTPD_FOUND) +- include_directories(${LIBMICROHTTPD_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${LIBMICROHTTPD_LIBRARIES}) ++IF (CZMQ_WITH_LIBMICROHTTPD) ++ find_package(libmicrohttpd REQUIRED CONFIG) ++ list(APPEND MORE_LIBRARIES libmicrohttpd::libmicrohttpd) + IF (PC_LIBMICROHTTPD_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} libmicrohttpd") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_LIBMICROHTTPD_STATIC_LDFLAGS}) +@@ -216,8 +206,7 @@ IF (LIBMICROHTTPD_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lmicrohttpd") + ENDIF (PC_LIBMICROHTTPD_FOUND) + add_definitions(-DHAVE_LIBMICROHTTPD) +- list(APPEND OPTIONAL_LIBRARIES ${LIBMICROHTTPD_LIBRARIES}) +-ENDIF (LIBMICROHTTPD_FOUND) ++ENDIF () + + ######################################################################## + # version +@@ -368,7 +357,10 @@ IF (NOT MSVC) + # avoid building everything twice for shared + static + # only on *nix, as Windows needs different preprocessor defines in static builds + add_library (czmq_objects OBJECT ${czmq_sources}) ++ target_link_libraries(czmq_objects PUBLIC ${MORE_LIBRARIES}) ++ if(CZMQ_BUILD_SHARED) + set_property(TARGET czmq_objects PROPERTY POSITION_INDEPENDENT_CODE ON) ++ endif() + ENDIF (NOT MSVC) + + # shared +@@ -380,6 +372,7 @@ if (CZMQ_BUILD_SHARED) + ENDIF (MSVC) + + set_target_properties (czmq PROPERTIES ++ LINKER_LANGUAGE CXX + PUBLIC_HEADER "${public_headers}" + DEFINE_SYMBOL "CZMQ_EXPORTS" + SOVERSION "4" +@@ -501,6 +494,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/czmqConfig.cmake + ######################################################################## + # executables + ######################################################################## ++if(0) + add_executable( + zmakecert + "${SOURCE_DIR}/src/zmakecert.c" +@@ -720,6 +714,7 @@ add_custom_command( + ) + + include(ClangFormat OPTIONAL) ++endif() + + ######################################################################## + # summary diff --git a/recipes/czmq/all/patches/4.2.1-0001-fix-cmake.patch b/recipes/czmq/all/patches/4.2.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..e3926f0dd2b31 --- /dev/null +++ b/recipes/czmq/all/patches/4.2.1-0001-fix-cmake.patch @@ -0,0 +1,200 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -130,28 +130,26 @@ set(OPTIONAL_LIBRARIES_STATIC) + ######################################################################## + # LIBZMQ dependency + ######################################################################## +-find_package(libzmq REQUIRED) +-IF (LIBZMQ_FOUND) +- include_directories(${LIBZMQ_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${LIBZMQ_LIBRARIES}) ++IF (1) ++ find_package(ZeroMQ REQUIRED CONFIG) ++ list(APPEND MORE_LIBRARIES $,libzmq,libzmq-static>) + IF (PC_LIBZMQ_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} libzmq") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_LIBZMQ_STATIC_LDFLAGS}) + ELSE (PC_LIBZMQ_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lzmq") + ENDIF (PC_LIBZMQ_FOUND) +-ELSE (LIBZMQ_FOUND) ++ELSE () + message( FATAL_ERROR "libzmq not found." ) +-ENDIF (LIBZMQ_FOUND) ++ENDIF () + + ######################################################################## + # UUID dependency + ######################################################################## +-find_package(uuid) +-option(CZMQ_WITH_UUID "Build czmq with uuid" ${UUID_FOUND}) +-IF (CZMQ_WITH_UUID AND UUID_FOUND) +- include_directories(${UUID_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${UUID_LIBRARIES}) ++option(CZMQ_WITH_UUID "Build czmq with uuid" OFF) ++IF (CZMQ_WITH_UUID) ++ find_package(libuuid REQUIRED CONFIG) ++ list(APPEND MORE_LIBRARIES libuuid::libuuid) + IF (PC_UUID_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} uuid") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_UUID_STATIC_LDFLAGS}) +@@ -159,17 +157,15 @@ IF (CZMQ_WITH_UUID AND UUID_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -luuid") + ENDIF (PC_UUID_FOUND) + add_definitions(-DHAVE_UUID) +- list(APPEND OPTIONAL_LIBRARIES ${UUID_LIBRARIES}) +-ENDIF (CZMQ_WITH_UUID AND UUID_FOUND) ++ENDIF () + + ######################################################################## + # SYSTEMD dependency + ######################################################################## +-find_package(systemd) +-option(CZMQ_WITH_SYSTEMD "Build czmq with systemd" ${SYSTEMD_FOUND}) +-IF (CZMQ_WITH_SYSTEMD AND SYSTEMD_FOUND) +- include_directories(${SYSTEMD_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${SYSTEMD_LIBRARIES}) ++option(CZMQ_WITH_SYSTEMD "Build czmq with systemd" OFF) ++IF (CZMQ_WITH_SYSTEMD) ++ find_package(libsystemd REQUIRED CONFIG) ++ list(APPEND MORE_LIBRARIES libsystemd::libsystemd) + IF (PC_SYSTEMD_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} libsystemd >= 200.0.0") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_SYSTEMD_STATIC_LDFLAGS}) +@@ -177,17 +173,15 @@ IF (CZMQ_WITH_SYSTEMD AND SYSTEMD_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lsystemd") + ENDIF (PC_SYSTEMD_FOUND) + add_definitions(-DHAVE_LIBSYSTEMD) +- list(APPEND OPTIONAL_LIBRARIES ${SYSTEMD_LIBRARIES}) +-ENDIF (CZMQ_WITH_SYSTEMD AND SYSTEMD_FOUND) ++ENDIF () + + ######################################################################## + # LZ4 dependency + ######################################################################## +-find_package(lz4) +-option(CZMQ_WITH_LZ4 "Build czmq with lz4" ${LZ4_FOUND}) +-IF (CZMQ_WITH_LZ4 AND LZ4_FOUND) +- include_directories(${LZ4_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${LZ4_LIBRARIES}) ++option(CZMQ_WITH_LZ4 "Build czmq with lz4" ON) ++IF (CZMQ_WITH_LZ4) ++ find_package(lz4 REQUIRED CONFIG) ++ list(APPEND MORE_LIBRARIES $,LZ4::lz4_shared,LZ4::lz4_static>) + IF (PC_LZ4_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} liblz4") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_LZ4_STATIC_LDFLAGS}) +@@ -195,17 +189,15 @@ IF (CZMQ_WITH_LZ4 AND LZ4_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -llz4") + ENDIF (PC_LZ4_FOUND) + add_definitions(-DHAVE_LIBLZ4) +- list(APPEND OPTIONAL_LIBRARIES ${LZ4_LIBRARIES}) +-ENDIF (CZMQ_WITH_LZ4 AND LZ4_FOUND) ++ENDIF () + + ######################################################################## + # LIBCURL dependency + ######################################################################## +-find_package(libcurl) +-option(CZMQ_WITH_LIBCURL "Build czmq with libcurl" ${LIBCURL_FOUND}) +-IF (CZMQ_WITH_LIBCURL AND LIBCURL_FOUND) +- include_directories(${LIBCURL_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${LIBCURL_LIBRARIES}) ++option(CZMQ_WITH_LIBCURL "Build czmq with libcurl" ON) ++IF (CZMQ_WITH_LIBCURL) ++ find_package(CURL REQUIRED) ++ list(APPEND MORE_LIBRARIES CURL::libcurl) + IF (PC_LIBCURL_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} libcurl >= 7.28.0") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_LIBCURL_STATIC_LDFLAGS}) +@@ -213,17 +205,15 @@ IF (CZMQ_WITH_LIBCURL AND LIBCURL_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lcurl") + ENDIF (PC_LIBCURL_FOUND) + add_definitions(-DHAVE_LIBCURL) +- list(APPEND OPTIONAL_LIBRARIES ${LIBCURL_LIBRARIES}) +-ENDIF (CZMQ_WITH_LIBCURL AND LIBCURL_FOUND) ++ENDIF () + + ######################################################################## + # NSS dependency + ######################################################################## +-find_package(nss) +-option(CZMQ_WITH_NSS "Build czmq with nss" ${NSS_FOUND}) +-IF (CZMQ_WITH_NSS AND NSS_FOUND) +- include_directories(${NSS_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${NSS_LIBRARIES}) ++option(CZMQ_WITH_NSS "Build czmq with nss" OFF) ++IF (CZMQ_WITH_NSS) ++ find_package(nss REQUIRED CONFIG) ++ list(APPEND MORE_LIBRARIES nss::nss) + IF (PC_NSS_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} nss") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_NSS_STATIC_LDFLAGS}) +@@ -231,17 +221,15 @@ IF (CZMQ_WITH_NSS AND NSS_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lnss") + ENDIF (PC_NSS_FOUND) + add_definitions(-DHAVE_NSS) +- list(APPEND OPTIONAL_LIBRARIES ${NSS_LIBRARIES}) +-ENDIF (CZMQ_WITH_NSS AND NSS_FOUND) ++ENDIF () + + ######################################################################## + # LIBMICROHTTPD dependency + ######################################################################## +-find_package(libmicrohttpd) +-option(CZMQ_WITH_LIBMICROHTTPD "Build czmq with libmicrohttpd" ${LIBMICROHTTPD_FOUND}) +-IF (CZMQ_WITH_LIBMICROHTTPD AND LIBMICROHTTPD_FOUND) +- include_directories(${LIBMICROHTTPD_INCLUDE_DIRS}) +- list(APPEND MORE_LIBRARIES ${LIBMICROHTTPD_LIBRARIES}) ++option(CZMQ_WITH_LIBMICROHTTPD "Build czmq with libmicrohttpd" OFF) ++IF (CZMQ_WITH_LIBMICROHTTPD) ++ find_package(libmicrohttpd REQUIRED CONFIG) ++ list(APPEND MORE_LIBRARIES libmicrohttpd::libmicrohttpd) + IF (PC_LIBMICROHTTPD_FOUND) + set(pkg_config_names_private "${pkg_config_names_private} libmicrohttpd") + list(APPEND OPTIONAL_LIBRARIES_STATIC ${PC_LIBMICROHTTPD_STATIC_LDFLAGS}) +@@ -249,8 +237,7 @@ IF (CZMQ_WITH_LIBMICROHTTPD AND LIBMICROHTTPD_FOUND) + set(pkg_config_libs_private "${pkg_config_libs_private} -lmicrohttpd") + ENDIF (PC_LIBMICROHTTPD_FOUND) + add_definitions(-DHAVE_LIBMICROHTTPD) +- list(APPEND OPTIONAL_LIBRARIES ${LIBMICROHTTPD_LIBRARIES}) +-ENDIF (CZMQ_WITH_LIBMICROHTTPD AND LIBMICROHTTPD_FOUND) ++ENDIF () + + ######################################################################## + # version +@@ -403,7 +390,10 @@ IF (NOT MSVC) + # avoid building everything twice for shared + static + # only on *nix, as Windows needs different preprocessor defines in static builds + add_library (czmq_objects OBJECT ${czmq_sources}) ++ target_link_libraries(czmq_objects PUBLIC ${MORE_LIBRARIES}) ++ if(CZMQ_BUILD_SHARED) + set_property(TARGET czmq_objects PROPERTY POSITION_INDEPENDENT_CODE ON) ++ endif() + ENDIF (NOT MSVC) + + # shared +@@ -419,6 +409,7 @@ if (CZMQ_BUILD_SHARED) + ENDIF(APPLE) + + set_target_properties (czmq PROPERTIES ++ LINKER_LANGUAGE CXX + PUBLIC_HEADER "${public_headers}" + DEFINE_SYMBOL "CZMQ_EXPORTS" + SOVERSION "4" +@@ -544,6 +535,7 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/czmqConfig.cmake + ######################################################################## + # executables + ######################################################################## ++if(0) + add_executable( + zmakecert + "${SOURCE_DIR}/src/zmakecert.c" +@@ -778,6 +770,7 @@ add_custom_command( + ) + + include(ClangFormat OPTIONAL) ++endif() + + ######################################################################## + # summary diff --git a/recipes/czmq/all/patches/4.2.1-0002-fix-zsys_thread-issue.patch b/recipes/czmq/all/patches/4.2.1-0002-fix-zsys_thread-issue.patch new file mode 100644 index 0000000000000..82cede0540471 --- /dev/null +++ b/recipes/czmq/all/patches/4.2.1-0002-fix-zsys_thread-issue.patch @@ -0,0 +1,43 @@ +diff --git a/src/zsock.c b/src/zsock.c +index 46bbb63..36ad5e0 100644 +--- a/src/zsock.c ++++ b/src/zsock.c +@@ -2376,6 +2376,7 @@ zsock_test (bool verbose) + zstr_free (&addr); + zstr_free (&message); + ++#ifndef __APPLE__ + // ZMQ_DGRAM ipv4 multicast test + zsock_t* mdgramr = zsock_new_dgram ("udp://225.25.25.25:7777"); + assert (mdgramr); +@@ -2389,6 +2390,7 @@ zsock_test (bool verbose) + + char *mdmessage, *maddr; + ++ // this call blocks forever on MacOS + zmsg_t *mdmsg = zmsg_recv( mdgramr ); + assert (mdmsg); + maddr = zmsg_popstr (mdmsg); +@@ -2400,6 +2402,7 @@ zsock_test (bool verbose) + zstr_free (&mdmessage); + zstr_free (&maddr); + zstr_free (&mdmessage); ++#endif + + // // ipv6 (not supported yet) + // zsys_set_ipv6(1); +diff --git a/src/zsys.c b/src/zsys.c +index 7c7301b..f384051 100644 +--- a/src/zsys.c ++++ b/src/zsys.c +@@ -334,9 +334,7 @@ zsys_init (void) + zsys_set_thread_name_prefix (s_thread_name_prefix); + + if (getenv ("ZSYS_THREAD_NAME_PREFIX_STR")) +- zsys_set_thread_name_prefix_str (getenv ("ZSYS_THREAD_NAME_PREFIX")); +- else +- zsys_set_thread_name_prefix_str (s_thread_name_prefix_str); ++ zsys_set_thread_name_prefix_str (getenv ("ZSYS_THREAD_NAME_PREFIX_STR")); + + return s_process_ctx; + } diff --git a/recipes/czmq/all/test_package/CMakeLists.txt b/recipes/czmq/all/test_package/CMakeLists.txt index 48b3bf1fe3b3f..5ffa50b2e16b5 100644 --- a/recipes/czmq/all/test_package/CMakeLists.txt +++ b/recipes/czmq/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C CXX) find_package(czmq REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) -target_compile_definitions(${PROJECT_NAME} PRIVATE $<$:"WITH_LIBSODIUM">) +add_executable(${PROJECT_NAME} test_package.c) +set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE CXX) if(TARGET czmq-static) - target_link_libraries(${PROJECT_NAME} czmq-static) + target_link_libraries(${PROJECT_NAME} PRIVATE czmq-static) else() - target_link_libraries(${PROJECT_NAME} czmq) + target_link_libraries(${PROJECT_NAME} PRIVATE czmq) endif() diff --git a/recipes/czmq/all/test_package/conanfile.py b/recipes/czmq/all/test_package/conanfile.py index 5eac88580e108..98ab55852ad56 100644 --- a/recipes/czmq/all/test_package/conanfile.py +++ b/recipes/czmq/all/test_package/conanfile.py @@ -1,18 +1,26 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) - cmake.definitions["WITH_LIBSODIUM"] = self.options["zeromq"].encryption == "libsodium" cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/czmq/all/test_package/test_package.cpp b/recipes/czmq/all/test_package/test_package.c similarity index 100% rename from recipes/czmq/all/test_package/test_package.cpp rename to recipes/czmq/all/test_package/test_package.c diff --git a/recipes/czmq/all/test_v1_package/CMakeLists.txt b/recipes/czmq/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/czmq/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/czmq/all/test_v1_package/conanfile.py b/recipes/czmq/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/czmq/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/czmq/config.yml b/recipes/czmq/config.yml index da3be1903f085..5074502634e2b 100644 --- a/recipes/czmq/config.yml +++ b/recipes/czmq/config.yml @@ -1,3 +1,5 @@ versions: + "4.2.1": + folder: all "4.2.0": folder: all diff --git a/recipes/dacap-clip/all/conandata.yml b/recipes/dacap-clip/all/conandata.yml new file mode 100644 index 0000000000000..daa1ee060995e --- /dev/null +++ b/recipes/dacap-clip/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.5": + url: "https://github.com/dacap/clip/archive/refs/tags/v1.5.tar.gz" + sha256: "8f6f8a427075a09011fafbb75bfdbf1213e4492a13cff4a70975aab361c99382" diff --git a/recipes/dacap-clip/all/conanfile.py b/recipes/dacap-clip/all/conanfile.py new file mode 100644 index 0000000000000..e2bd672a9b3d1 --- /dev/null +++ b/recipes/dacap-clip/all/conanfile.py @@ -0,0 +1,114 @@ +import os + +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd + +required_conan_version = ">=1.51.3" + +class DacapClipConan(ConanFile): + name = "dacap-clip" + description = "Cross-platform C++ library to copy/paste clipboard content" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/dacap/clip/" + topics = ("clipboard", "copy", "paste") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_png": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_png": True, + } + + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + if self.settings.os not in ["Linux", "FreeBSD"]: + del self.options.with_png + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.get_safe("with_png", False): + self.requires("libpng/1.6.37") + if self.settings.os == "Linux": + self.requires("xorg/system") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, 11) + if is_msvc(self) and self.info.settings.build_type == "Debug" and self.info.options.shared == True: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support MSVC debug shared build (now).") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) + + def generate(self): + toolchain = CMakeToolchain(self) + toolchain.variables["CLIP_EXAMPLES"] = False + toolchain.variables["CLIP_TESTS"] = False + toolchain.variables["CLIP_X11_WITH_PNG"] = self.options.get_safe("with_png", False) + if is_msvc(self): + toolchain.cache_variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = bool(self.options.shared) + toolchain.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "clip.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + copy(self, "*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.so", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dylib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + + def package_info(self): + self.cpp_info.libs = ["clip"] + + if self.options.get_safe("with_png", False): + self.cpp_info.requires.append("libpng::libpng") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.requires.append("xorg::xcb") + self.cpp_info.system_libs.append("pthread") + elif is_apple_os(self): + self.cpp_info.frameworks = ['Cocoa', 'Carbon', 'CoreFoundation', 'Foundation', 'AppKit'] + elif self.settings.os == "Windows": + self.cpp_info.system_libs.extend([ + "shlwapi", + "windowscodecs", + ]) + + self.cpp_info.set_property("cmake_file_name", "clip") + self.cpp_info.set_property("cmake_target_name", "clip::clip") + + # TODO: Remove on Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "clip" + self.cpp_info.names["cmake_find_package_multi"] = "clip" diff --git a/recipes/dacap-clip/all/test_package/CMakeLists.txt b/recipes/dacap-clip/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..63e11b22a301b --- /dev/null +++ b/recipes/dacap-clip/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(clip REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} clip::clip) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/dacap-clip/all/test_package/conanfile.py b/recipes/dacap-clip/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5a673574d7a5b --- /dev/null +++ b/recipes/dacap-clip/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +import os + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/dacap-clip/all/test_package/test_package.cpp b/recipes/dacap-clip/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..78ce3cdf1d299 --- /dev/null +++ b/recipes/dacap-clip/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include "clip.h" + +int main() { + clip::set_text("Hello World"); + + std::string value; + clip::get_text(value); + std::cout << value << std::endl; + + return 0; +} diff --git a/recipes/dacap-clip/all/test_v1_package/CMakeLists.txt b/recipes/dacap-clip/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..784c43a27c83a --- /dev/null +++ b/recipes/dacap-clip/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +include("${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(clip REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} clip::clip) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/dacap-clip/all/test_v1_package/conanfile.py b/recipes/dacap-clip/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e9bf8aa5f82dd --- /dev/null +++ b/recipes/dacap-clip/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +import os + +from conans import ConanFile, CMake +from conan.tools.build import cross_building + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/dacap-clip/config.yml b/recipes/dacap-clip/config.yml new file mode 100644 index 0000000000000..84f49b2850870 --- /dev/null +++ b/recipes/dacap-clip/config.yml @@ -0,0 +1,3 @@ +versions: + "1.5": + folder: "all" diff --git a/recipes/dataframe/all/conandata.yml b/recipes/dataframe/all/conandata.yml index 91566611b6db3..61fe550263e99 100644 --- a/recipes/dataframe/all/conandata.yml +++ b/recipes/dataframe/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.22.0": + url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/1.22.0.tar.gz" + sha256: "4b244241cd56893fccb22f7c874588f0d86b444912382ed6e9a4cf95e55ffda2" "1.21.0": url: "https://github.com/hosseinmoein/DataFrame/archive/refs/tags/1.21.0.tar.gz" sha256: "a6b07eaaf628225a34e4402c1a6e311430e8431455669ac03691d92f44081172" @@ -9,31 +12,20 @@ sources: url: "https://github.com/hosseinmoein/DataFrame/archive/1.19.0.tar.gz" sha256: "81382e9c68df7c52f69f645b1830fcd3634eedc07fa3d2024ee6c57cf2cdb7ff" "1.18.0": - sha256: 8cdb8b246263fbd8fcef07b6300f6aefb58b3a54cd67e5cbe5383bc948305844 - url: https://github.com/hosseinmoein/DataFrame/archive/1.18.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.18.0.tar.gz" + sha256: "8cdb8b246263fbd8fcef07b6300f6aefb58b3a54cd67e5cbe5383bc948305844" "1.17.0": - sha256: 669e9663de358330b15eacaa783ccf42fe16db27b9556fdcd18f1114c0335557 - url: https://github.com/hosseinmoein/DataFrame/archive/1.17.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.17.0.tar.gz" + sha256: "669e9663de358330b15eacaa783ccf42fe16db27b9556fdcd18f1114c0335557" "1.16.0": - sha256: a5a24ec07fb4761a294a291d7bed7c72e82e2dde8bba8bfc1ca2f68e07afd7fc - url: https://github.com/hosseinmoein/DataFrame/archive/1.16.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.16.0.tar.gz" + sha256: "a5a24ec07fb4761a294a291d7bed7c72e82e2dde8bba8bfc1ca2f68e07afd7fc" "1.15.0": - sha256: 68eb3fca66dff3f8473722d561e9391800957a09c2c6d4dde5f9ad37cbf88954 - url: https://github.com/hosseinmoein/DataFrame/archive/1.15.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.15.0.tar.gz" + sha256: "68eb3fca66dff3f8473722d561e9391800957a09c2c6d4dde5f9ad37cbf88954" "1.14.0": - sha256: 45991cc16e478b24641d0548aab24fd59ad534ada30fca8776fd9990e1914ac7 - url: https://github.com/hosseinmoein/DataFrame/archive/1.14.0.tar.gz + url: "https://github.com/hosseinmoein/DataFrame/archive/1.14.0.tar.gz" + sha256: "45991cc16e478b24641d0548aab24fd59ad534ada30fca8776fd9990e1914ac7" "1.12.0": - sha256: e951a699bd048bd7a034ac60bdd45f15cf066a04fda33cb22030d192b91a836c - url: https://github.com/hosseinmoein/DataFrame/archive/1.12.0.tar.gz - "1.8.0": - sha256: 43b057f6dedbdfc328667dc4dcdcd3384b4551cc2825ca546405ec955fb8cb35 - url: https://github.com/hosseinmoein/DataFrame/archive/1.8.0.tar.gz - "1.7.0": - sha256: b5f25e331bcd25f2ddd222e65563df3c316d726d92134789f043338545faa4d4 - url: https://github.com/hosseinmoein/DataFrame/archive/1.7.0.tar.gz -patches: - "1.8.0": - - patch_file: "patches/0001-remove-tests-bin-for-conan-package.patch" - "1.7.0": - - patch_file: "patches/0001-remove-tests-bin-for-conan-package.patch" + url: "https://github.com/hosseinmoein/DataFrame/archive/1.12.0.tar.gz" + sha256: "e951a699bd048bd7a034ac60bdd45f15cf066a04fda33cb22030d192b91a836c" diff --git a/recipes/dataframe/all/conanfile.py b/recipes/dataframe/all/conanfile.py index 33492673970a7..95fdd9bafb34a 100644 --- a/recipes/dataframe/all/conanfile.py +++ b/recipes/dataframe/all/conanfile.py @@ -2,13 +2,13 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class DataFrameConan(ConanFile): @@ -38,6 +38,7 @@ class DataFrameConan(ConanFile): "large-data", ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -48,18 +49,22 @@ class DataFrameConan(ConanFile): "fPIC": True, } + @property + def _min_cppstd(self): + return "17" + @property def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "7", "clang": "6", - "apple-clang": "10.0" if Version(self.version) >= "1.12.0" else "9.0", + "apple-clang": "10.0", } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -67,29 +72,26 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if is_msvc(self) and self.info.options.shared and Version(self.version) < "1.20.0": - raise ConanInvalidConfiguration( - "dataframe {} doesn't support shared lib with Visual Studio".format(self.version) - ) + if is_msvc(self) and self.options.shared and Version(self.version) < "1.20.0": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support shared lib with Visual Studio") - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, "17") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - minimum_version = self._minimum_compilers_version.get(str(self.info.settings.compiler), False) - if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - "{} requires C++17, which your compiler does not support.".format(self.name) + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -144,7 +146,7 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "DataFrame") self.cpp_info.libs = ["DataFrame"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.extend(["pthread", "rt"]) + self.cpp_info.system_libs.extend(["pthread", "rt", "m"]) if is_msvc(self): self.cpp_info.defines.append("_USE_MATH_DEFINES") if Version(self.version) < "1.20.0" and not self.options.shared: @@ -156,4 +158,3 @@ def package_info(self): # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "DataFrame" self.cpp_info.names["cmake_find_package_multi"] = "DataFrame" - self.cpp_info.names["pkg_config"] = "DataFrame" diff --git a/recipes/dataframe/all/patches/0001-remove-tests-bin-for-conan-package.patch b/recipes/dataframe/all/patches/0001-remove-tests-bin-for-conan-package.patch deleted file mode 100644 index 1eae4efbddc42..0000000000000 --- a/recipes/dataframe/all/patches/0001-remove-tests-bin-for-conan-package.patch +++ /dev/null @@ -1,166 +0,0 @@ -From 6cfbda5ec6f3d1d5987242c00af16ed4c1a65e7d Mon Sep 17 00:00:00 2001 -From: "Jimmy M. Gong" -Date: Mon, 10 Feb 2020 22:05:52 +0800 -Subject: [PATCH] remove tests bin for conan package - ---- - CMakeLists.txt | 146 ------------------------------------------------- - 1 file changed, 146 deletions(-) - -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 362bd95..b33ed49 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -216,149 +216,3 @@ endif(MSVC) - - # Add the uninstall target - include(AddUninstallTarget) -- --# Build the test binary --add_executable(dataframe_tester test/dataframe_tester.cc) --add_executable(dataframe_performance test/dataframe_performance.cc) --add_executable(vectors_tester test/vectors_tester.cc) --add_executable(vector_ptr_view_tester test/vector_ptr_view_tester.cc) --add_executable(date_time_tester test/date_time_tester.cc) --add_executable(mmfile_tester test/mmfile_tester.cc) --add_executable(obj_vector_tester test/obj_vector_tester.cc) --add_executable(obj_vector_erase_tester test/obj_vector_erase_tester.cc) --add_executable(sharedmem_tester test/sharedmem_tester.cc) --add_executable(gen_rand_tester test/gen_rand_tester.cc) -- --# Link the DataFrame library to the test binary --target_link_libraries(dataframe_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(dataframe_performance DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(vectors_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(vector_ptr_view_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(date_time_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(mmfile_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(obj_vector_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(obj_vector_erase_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(sharedmem_tester DataFrame) -- --# Link the DataFrame library to the test binary --target_link_libraries(gen_rand_tester DataFrame) -- --if (UNIX) -- # Find pthreads library -- set(THREADS_PREFER_PTHREAD_FLAG ON) -- find_package(Threads REQUIRED) -- target_link_libraries(dataframe_tester Threads::Threads) -- target_link_libraries(dataframe_performance Threads::Threads) -- target_link_libraries(vectors_tester Threads::Threads) -- target_link_libraries(vector_ptr_view_tester Threads::Threads) -- target_link_libraries(date_time_tester Threads::Threads) -- target_link_libraries(mmfile_tester Threads::Threads) -- target_link_libraries(obj_vector_tester Threads::Threads) -- target_link_libraries(obj_vector_erase_tester Threads::Threads) -- target_link_libraries(sharedmem_tester Threads::Threads) -- target_link_libraries(gen_rand_tester Threads::Threads) --endif (UNIX) -- --if (UNIX AND NOT APPLE) -- target_link_libraries(dataframe_tester rt) -- target_link_libraries(dataframe_performance rt) -- target_link_libraries(vectors_tester rt) -- target_link_libraries(vector_ptr_view_tester rt) -- target_link_libraries(date_time_tester rt) -- target_link_libraries(mmfile_tester rt) -- target_link_libraries(obj_vector_tester rt) -- target_link_libraries(obj_vector_erase_tester rt) -- target_link_libraries(sharedmem_tester rt) -- target_link_libraries(gen_rand_tester rt) --endif() -- --# Enable ctest, testing so we can see if unit tests pass or fail in CI --enable_testing() --add_test(NAME dataframe_tester -- COMMAND dataframe_tester -- WORKING_DIRECTORY $) -- --# For some unknown reason to me, this test sigfaults in AppVeyor --# --# add_test(NAME vectors_tester --# COMMAND vectors_tester --# WORKING_DIRECTORY $) -- --add_test(NAME vector_ptr_view_tester -- COMMAND vector_ptr_view_tester -- WORKING_DIRECTORY $) --add_test(NAME date_time_tester -- COMMAND date_time_tester -- WORKING_DIRECTORY $) -- --# For some unknown reason to me, this test hangs in Travis CI --# --# add_test(NAME mmfile_tester --# COMMAND mmfile_tester --# WORKING_DIRECTORY $) -- --add_test(NAME obj_vector_tester -- COMMAND obj_vector_tester -- WORKING_DIRECTORY $) -- --add_test(NAME obj_vector_erase_tester -- COMMAND obj_vector_erase_tester -- WORKING_DIRECTORY $) --add_test(NAME gen_rand_tester -- COMMAND gen_rand_tester -- WORKING_DIRECTORY $) -- --message("-- Copying files for testing") --# Ctest require this files in the build dir, on all platforms --add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD -- COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.csv -- ${CMAKE_CURRENT_BINARY_DIR}/sample_data.csv) --add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD -- COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.json -- ${CMAKE_CURRENT_BINARY_DIR}/sample_data.json) --add_custom_command( -- TARGET ${PROJECT_NAME} POST_BUILD -- COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_dt_index.csv -- ${CMAKE_CURRENT_BINARY_DIR}/sample_data_dt_index.csv) --add_custom_command( -- TARGET ${PROJECT_NAME} POST_BUILD -- COMMAND ${CMAKE_COMMAND} -E copy -- ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_string_index.csv -- ${CMAKE_CURRENT_BINARY_DIR}/sample_data_string_index.csv) -- --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Release) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.json -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data.json -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Release) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_dt_index.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_dt_index.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Release) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_string_index.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Debug) --file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/test/sample_data_string_index.csv -- DESTINATION ${CMAKE_CURRENT_BINARY_DIR}/bin/Release) --message("-- Copying files for testing - done") --- -2.25.0 - diff --git a/recipes/dataframe/all/test_package/conanfile.py b/recipes/dataframe/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/dataframe/all/test_package/conanfile.py +++ b/recipes/dataframe/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/dataframe/all/test_v1_package/CMakeLists.txt b/recipes/dataframe/all/test_v1_package/CMakeLists.txt index ff71d0aea5f2c..be00a8c7f57c7 100644 --- a/recipes/dataframe/all/test_v1_package/CMakeLists.txt +++ b/recipes/dataframe/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(DataFrame REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE DataFrame::DataFrame) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/dataframe/all/test_v1_package/conanfile.py b/recipes/dataframe/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/dataframe/all/test_v1_package/conanfile.py +++ b/recipes/dataframe/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/dataframe/config.yml b/recipes/dataframe/config.yml index ee0214f11ffb3..55fe67d4b4581 100644 --- a/recipes/dataframe/config.yml +++ b/recipes/dataframe/config.yml @@ -1,4 +1,6 @@ versions: + "1.22.0": + folder: all "1.21.0": folder: all "1.20.0": @@ -17,7 +19,3 @@ versions: folder: all "1.12.0": folder: all - "1.8.0": - folder: all - "1.7.0": - folder: all diff --git a/recipes/date/all/CMakeLists.txt b/recipes/date/all/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c35..0000000000000 --- a/recipes/date/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/date/all/conandata.yml b/recipes/date/all/conandata.yml index 3a000e554ebbb..5d465add42677 100644 --- a/recipes/date/all/conandata.yml +++ b/recipes/date/all/conandata.yml @@ -1,24 +1,29 @@ sources: "2.4.1": - sha256: 98907d243397483bd7ad889bf6c66746db0d7d2a39cc9aacc041834c40b65b98 - url: https://github.com/HowardHinnant/date/archive/v2.4.1.tar.gz + sha256: "98907d243397483bd7ad889bf6c66746db0d7d2a39cc9aacc041834c40b65b98" + url: "https://github.com/HowardHinnant/date/archive/v2.4.1.tar.gz" "3.0.0": - sha256: 87bba2eaf0ebc7ec539e5e62fc317cb80671a337c1fb1b84cb9e4d42c6dbebe3 - url: https://github.com/HowardHinnant/date/archive/v3.0.0.tar.gz + sha256: "87bba2eaf0ebc7ec539e5e62fc317cb80671a337c1fb1b84cb9e4d42c6dbebe3" + url: "https://github.com/HowardHinnant/date/archive/v3.0.0.tar.gz" "3.0.1": - sha256: 7a390f200f0ccd207e8cff6757e04817c1a0aec3e327b006b7eb451c57ee3538 - url: https://github.com/HowardHinnant/date/archive/v3.0.1.tar.gz + sha256: "7a390f200f0ccd207e8cff6757e04817c1a0aec3e327b006b7eb451c57ee3538" + url: "https://github.com/HowardHinnant/date/archive/v3.0.1.tar.gz" patches: "2.4.1": - - base_path: source_subfolder - patch_file: patches/0001-fix-uwp.patch - - base_path: source_subfolder - patch_file: patches/cmake.patch - - base_path: source_subfolder - patch_file: patches/string_view.patch + - patch_file: "patches/0001-fix-uwp.patch" + patch_description: "Fix Universal Windows Platform (UWP) unhandled exception support. See https://github.com/microsoft/vcpkg/pull/8151#issuecomment-531175393." + patch_type: "portability" + - patch_file: "patches/cmake.patch" + patch_description: "Add libcurl target for conan compatibility" + patch_type: "conan" + - patch_file: "patches/string_view.patch" + patch_description: "Disable string view to workaround clang 5 not having it" + patch_type: "portability" "3.0.0": - - base_path: source_subfolder - patch_file: patches/cmake-3.0.0.patch + - patch_file: "patches/cmake-3.0.0.patch" + patch_description: "Disable string view to workaround clang 5 not having it" + patch_type: "portability" "3.0.1": - - base_path: source_subfolder - patch_file: patches/cmake-3.0.1.patch + - patch_file: "patches/cmake-3.0.1.patch" + patch_description: "Disable string view to workaround clang 5 not having it" + patch_type: "portability" diff --git a/recipes/date/all/conanfile.py b/recipes/date/all/conanfile.py index c6c05647b84c5..0114595ddce02 100644 --- a/recipes/date/all/conanfile.py +++ b/recipes/date/all/conanfile.py @@ -1,7 +1,12 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import get, rmdir, apply_conandata_patches, export_conandata_patches, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version + import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class DateConan(ConanFile): @@ -29,13 +34,8 @@ class DateConan(ConanFile): "use_tz_db_in_dot": False, } - exports_sources = ["patches/*", "CMakeLists.txt"] - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -46,6 +46,8 @@ def config_options(self): def configure(self): if self.options.shared: del self.options.fPIC + if self.options.header_only: + del self.options.shared def requirements(self): if not self.options.header_only and not self.options.use_system_tz_db: @@ -53,70 +55,75 @@ def requirements(self): def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, 11) def package_id(self): - if self.options.header_only: - self.info.header_only() + if self.info.options.header_only: + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - cmake = CMake(self) - cmake.definitions["ENABLE_DATE_TESTING"] = False - cmake.definitions["USE_SYSTEM_TZ_DB"] = self.options.use_system_tz_db - cmake.definitions["USE_TZ_DB_IN_DOT"] = self.options.use_tz_db_in_dot - cmake.definitions["BUILD_TZ_LIB"] = not self.options.header_only + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_DATE_TESTING"] = False + tc.variables["USE_SYSTEM_TZ_DB"] = self.options.use_system_tz_db + tc.variables["USE_TZ_DB_IN_DOT"] = self.options.use_tz_db_in_dot + tc.variables["BUILD_TZ_LIB"] = not self.options.header_only # workaround for clang 5 not having string_view - if tools.Version(self.version) >= "3.0.0" and self.settings.compiler == "clang" \ - and tools.Version(self.settings.compiler.version) <= "5.0": - cmake.definitions["DISABLE_STRING_VIEW"] = True - cmake.configure() + if Version(self.version) >= "3.0.0" and self.settings.compiler == "clang" \ + and Version(self.settings.compiler.version) <= "5.0": + tc.cache_variables["DISABLE_STRING_VIEW"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() - self._cmake = cmake - return self._cmake def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if not self.options.header_only: - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", - src=self._source_subfolder) + copy(self, "LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) if self.options.header_only: - src = os.path.join(self._source_subfolder, "include", "date") - dst = os.path.join("include", "date") - self.copy(pattern="date.h", dst=dst, src=src) - self.copy(pattern="tz.h", dst=dst, src=src) - self.copy(pattern="ptz.h", dst=dst, src=src) - self.copy(pattern="iso_week.h", dst=dst, src=src) - self.copy(pattern="julian.h", dst=dst, src=src) - self.copy(pattern="islamic.h", dst=dst, src=src) + src = os.path.join(self.source_folder, "include", "date") + dst = os.path.join(self.package_folder, "include", "date") + copy(self, "date.h", dst=dst, src=src) + copy(self, "tz.h", dst=dst, src=src) + copy(self, "ptz.h", dst=dst, src=src) + copy(self, "iso_week.h", dst=dst, src=src) + copy(self, "julian.h", dst=dst, src=src) + copy(self, "islamic.h", dst=dst, src=src) else: - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "CMake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "CMake")) def package_info(self): + self.cpp_info.set_property("cmake_target_name", "date::date") + # TODO: Remove legacy .names attribute when conan 2.0 is released self.cpp_info.names["cmake_find_package"] = "date" self.cpp_info.names["cmake_find_package_multi"] = "date" # date-tz if not self.options.header_only: + self.cpp_info.components["date-tz"].set_property("cmake_target_name", "date::date-tz") + # TODO: Remove legacy .names attribute when conan 2.0 is released self.cpp_info.components["date-tz"].names["cmake_find_package"] = "date-tz" self.cpp_info.components["date-tz"].names["cmake_find_package_multi"] = "date-tz" - lib_name = "{}tz".format("date-" if tools.Version(self.version) >= "3.0.0" else "") + lib_name = "{}tz".format("date-" if Version(self.version) >= "3.0.0" else "") self.cpp_info.components["date-tz"].libs = [lib_name] if self.settings.os == "Linux": self.cpp_info.components["date-tz"].system_libs.append("pthread") + self.cpp_info.components["date-tz"].system_libs.append("m") if not self.options.use_system_tz_db: self.cpp_info.components["date-tz"].requires.append("libcurl::libcurl") @@ -131,3 +138,5 @@ def package_info(self): defines.append("DATE_USE_DLL=1") self.cpp_info.components["date-tz"].defines.extend(defines) + else: + self.cpp_info.defines.append("DATE_HEADER_ONLY") diff --git a/recipes/date/all/patches/cmake.patch b/recipes/date/all/patches/cmake.patch index c3f6702791a5a..3f9df797629dd 100644 --- a/recipes/date/all/patches/cmake.patch +++ b/recipes/date/all/patches/cmake.patch @@ -1,27 +1,19 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index f025a3a..c316d4a 100644 +index f025a3a..7bc93df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -56,16 +56,18 @@ else( ) - target_compile_definitions( tz PRIVATE -DUSE_AUTOLOAD=1 ) +@@ -57,8 +57,12 @@ else( ) target_compile_definitions( tz PRIVATE -DHAS_REMOTE_API=1 ) target_compile_definitions( tz PUBLIC -DUSE_OS_TZDB=0 ) -- find_package( CURL REQUIRED ) + find_package( CURL REQUIRED ) - include_directories( SYSTEM ${CURL_INCLUDE_DIRS} ) - set( OPTIONAL_LIBRARIES ${CURL_LIBRARIES} ) -+endif( ) ++ set( OPTIONAL_LIBRARIES CURL::libcurl ) ++endif() + +if( BUILD_SHARED_LIBS ) -+ target_compile_definitions( tz PRIVATE -DDATE_BUILD_DLL=1 ) -+ target_compile_definitions( tz PUBLIC -DDATE_USE_DLL=1 ) ++ target_compile_definitions( tz PRIVATE -DDATE_BUILD_DLL=1 ) ++ target_compile_definitions( tz PUBLIC -DDATE_USE_DLL=1 ) endif( ) if( USE_TZ_DB_IN_DOT ) - target_compile_definitions( tz PRIVATE -DINSTALL=. ) - endif( ) - --target_link_libraries( tz ${CMAKE_THREAD_LIBS_INIT} ${OPTIONAL_LIBRARIES} ) -+target_link_libraries( tz ${CMAKE_THREAD_LIBS_INIT} ${CONAN_LIBS} ) - - # add include folders to the library and targets that consume it - target_include_directories(tz PUBLIC diff --git a/recipes/date/all/test_package/CMakeLists.txt b/recipes/date/all/test_package/CMakeLists.txt index d11e14143f1da..50d2a69300bc2 100644 --- a/recipes/date/all/test_package/CMakeLists.txt +++ b/recipes/date/all/test_package/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(date REQUIRED) -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} src/test_package.cpp) +target_link_libraries(${PROJECT_NAME} date::date) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) if(DATE_HEADER_ONLY) target_compile_definitions(${PROJECT_NAME} PRIVATE DATE_HEADER_ONLY) diff --git a/recipes/date/all/test_package/conanfile.py b/recipes/date/all/test_package/conanfile.py index d153c8c1a4bbe..c42e6bff2267a 100644 --- a/recipes/date/all/test_package/conanfile.py +++ b/recipes/date/all/test_package/conanfile.py @@ -1,18 +1,35 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.build import cross_building -class TestPackageConan(ConanFile): + +class FooTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + # VirtualBuildEnv and VirtualRunEnv can be avoided if "tools.env.virtualenv:auto_use" is defined + # (it will be defined in Conan 2.0) + generators = "CMakeDeps", "VirtualRunEnv" + apply_env = False + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DATE_HEADER_ONLY"] = self.dependencies["date"].options.header_only + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["DATE_HEADER_ONLY"] = self.options["date:header_only"] cmake.configure() cmake.build() + def layout(self): + cmake_layout(self) + def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if not cross_building(self): + cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/date/all/test_package/test_package.cpp b/recipes/date/all/test_package/src/test_package.cpp similarity index 100% rename from recipes/date/all/test_package/test_package.cpp rename to recipes/date/all/test_package/src/test_package.cpp diff --git a/recipes/date/all/test_v1_package/CMakeLists.txt b/recipes/date/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/date/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/date/all/test_v1_package/conanfile.py b/recipes/date/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d8cd3583b838d --- /dev/null +++ b/recipes/date/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.definitions["DATE_HEADER_ONLY"] = self.options["date:header_only"] + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/dav1d/all/conanfile.py b/recipes/dav1d/all/conanfile.py index 58cc7327c8da1..e866a507dca5f 100644 --- a/recipes/dav1d/all/conanfile.py +++ b/recipes/dav1d/all/conanfile.py @@ -8,7 +8,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class Dav1dConan(ConanFile): @@ -48,31 +48,27 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if not self.options.assembly: - del self.options.with_avx512 + self.options.rm_safe("with_avx512") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - self.tool_requires("meson/0.63.1") + self.tool_requires("meson/1.0.0") if self.options.assembly: self.tool_requires("nasm/2.15.05") - def layout(self): - basic_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) tc.project_options["enable_tests"] = False tc.project_options["enable_asm"] = self.options.assembly @@ -83,14 +79,8 @@ def generate(self): tc.project_options["bitdepths"] = "8,16" else: tc.project_options["bitdepths"] = str(self.options.bit_depth) - # TODO: fixed in conan 1.51.0? - tc.project_options["bindir"] = "bin" - tc.project_options["libdir"] = "lib" tc.generate() - env = VirtualBuildEnv(self) - env.generate(scope="build") - def _patch_sources(self): replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('doc')", "") @@ -117,16 +107,15 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["dl", "pthread"]) + # TODO: to remove in conan v2 if self.options.with_tools: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) def fix_msvc_libname(conanfile, remove_lib_prefix=True): - """remove lib prefix & change extension to .lib""" + """remove lib prefix & change extension to .lib in case of cl like compiler""" from conan.tools.files import rename import glob - if not is_msvc(conanfile): + if not conanfile.settings.get_safe("compiler.runtime"): return libdirs = getattr(conanfile.cpp.package, "libdirs") for libdir in libdirs: diff --git a/recipes/dav1d/all/test_package/conanfile.py b/recipes/dav1d/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/dav1d/all/test_package/conanfile.py +++ b/recipes/dav1d/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/dav1d/all/test_v1_package/CMakeLists.txt b/recipes/dav1d/all/test_v1_package/CMakeLists.txt index d3dffeef53fe1..0d20897301b68 100644 --- a/recipes/dav1d/all/test_v1_package/CMakeLists.txt +++ b/recipes/dav1d/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(dav1d REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE dav1d::dav1d) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/dav1d/all/test_v1_package/conanfile.py b/recipes/dav1d/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/dav1d/all/test_v1_package/conanfile.py +++ b/recipes/dav1d/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/daw_header_libraries/all/conandata.yml b/recipes/daw_header_libraries/all/conandata.yml index 617ae23bce78f..ed2e2f4b08ab6 100644 --- a/recipes/daw_header_libraries/all/conandata.yml +++ b/recipes/daw_header_libraries/all/conandata.yml @@ -1,40 +1,31 @@ sources: + "2.85.1": + url: "https://github.com/beached/header_libraries/archive/v2.85.1.tar.gz" + sha256: "fb4880e254a481e3c750261fdb75a1696afc9ef4404e095a7f3ba0683bcd9930" + "2.79.0": + url: "https://github.com/beached/header_libraries/archive/v2.79.0.tar.gz" + sha256: "2dfa8fc9495499379cff39ed648c6bba156a87eb177fc91a860045a410aebb99" + "2.76.3": + url: "https://github.com/beached/header_libraries/archive/v2.76.3.tar.gz" + sha256: "2d66f9aec38fb9a42779e0283fa2fc5842e04d34f2bf655c72a9beb4bf5cc8c8" + "2.76.2": + url: "https://github.com/beached/header_libraries/archive/v2.76.2.tar.gz" + sha256: "bfa2da192360a66e400d03a52f8a7bf0fccd23de1f446a812a8890b11df2c592" + "2.74.2": + url: "https://github.com/beached/header_libraries/archive/v2.74.2.tar.gz" + sha256: "32871df3d314cc9b4e293a9a8c79968d1c963dfd3dd60965dbf704eb18acb218" + "2.73.1": + url: "https://github.com/beached/header_libraries/archive/v2.73.1.tar.gz" + sha256: "62bd26398afa7eba1aae7bbbf107865044b8be0539d266085c36aed82557ae07" + "2.72.0": + url: "https://github.com/beached/header_libraries/archive/v2.72.0.tar.gz" + sha256: "f681755183af4af35f4741f3bcb7d99c6707911806e39e3acc982f9532aacc08" + "2.71.0": + url: "https://github.com/beached/header_libraries/archive/v2.71.0.tar.gz" + sha256: "50b9ddebdbc808a5714408a45f686fafe9d1d3b78c988df3973c12c9928828b9" "2.68.3": url: "https://github.com/beached/header_libraries/archive/v2.68.3.tar.gz" sha256: "9bb7d25d161b89ad4a0ac857c28734c061cf53f6e80212c7fe70b8e0fd14789f" - "2.68.1": - url: "https://github.com/beached/header_libraries/archive/v2.68.1.tar.gz" - sha256: "51bdb042959373729009f91449c492f58bb63262146463a767f17d3de6fb2687" - "2.65.1": - url: "https://github.com/beached/header_libraries/archive/v2.65.1.tar.gz" - sha256: "fd52024bb361d1ac8011cd03def39b4d6aea35015f26163f3865ca65df91ca57" - "2.65.0": - url: "https://github.com/beached/header_libraries/archive/v2.65.0.tar.gz" - sha256: "9059d12bcacf2895ffa98cfa59d32914247e9cd601945ba6d574348babf7fdb4" - "2.64.2": - url: "https://github.com/beached/header_libraries/archive/v2.64.2.tar.gz" - sha256: "886cabc542714e3959d8d00799c0becbf00437278844b3ef399c99acab2e23fa" - "2.53.3": - url: "https://github.com/beached/header_libraries/archive/v2.53.3.tar.gz" - sha256: "04c83338d21e40f1973fa7ba42cbc9a71c314fdebfabc8d612e330b7c7043d77" - "2.50.0": - url: "https://github.com/beached/header_libraries/archive/v2.50.0.tar.gz" - sha256: "c0e0b3c0b10f8894bf61f4fb01eeb9b2093301faa0f96740e519ecb951de9acd" - "2.46.0": - url: "https://github.com/beached/header_libraries/archive/v2.46.0.tar.gz" - sha256: "fa3069a038c347a623af0e35a853aa561dc8616051baf708cd0ac17eb1032741" - "2.33.2": - url: "https://github.com/beached/header_libraries/archive/v2.33.2.tar.gz" - sha256: "daa31640001af84b19349472ca40d07b84137ad92c46af314ac3b10bbbc6c559" - "2.23.0": - url: "https://github.com/beached/header_libraries/archive/v2.23.0.tar.gz" - sha256: "5619830ff745319615736036bfd3437577d6a8438ea9f34023208599fdf2cdda" - "2.15.1": - url: "https://github.com/beached/header_libraries/archive/v2.15.1.tar.gz" - sha256: "3ddfc484448a762fcf13c6143b0fcff643cbd98dabc639e043bcf493235fc54d" - "2.5.3": - url: "https://github.com/beached/header_libraries/archive/refs/tags/v2.5.3.tar.gz" - sha256: "0fd08b31947e5f0da45c875bbb44d178d4250225e2623fb845cd458605390233" "1.29.7": url: "https://github.com/beached/header_libraries/archive/refs/tags/v1.29.7.tar.gz" sha256: "524c34f3f5d2af498e7bcaff7802b914ba42acde29f7e3ecce41a035db0bf5bd" diff --git a/recipes/daw_header_libraries/all/conanfile.py b/recipes/daw_header_libraries/all/conanfile.py index 87bc6d262d6a4..81865adfe60e7 100644 --- a/recipes/daw_header_libraries/all/conanfile.py +++ b/recipes/daw_header_libraries/all/conanfile.py @@ -1,71 +1,73 @@ -import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.layout import basic_layout -from conans.errors import ConanInvalidConfiguration -from conans import ConanFile, CMake, tools +import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class DawHeaderLibrariesConan(ConanFile): name = "daw_header_libraries" + description = "Various header libraries mostly future std lib, replacements for(e.g. visit), or some misc" license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" - description = "Various header libraries mostly future std lib, replacements for(e.g. visit), or some misc" - topics = ("algorithms", "helpers", "data-structures") homepage = "https://github.com/beached/header_libraries" - settings = "compiler", - generators = "cmake", + topics = ("algorithms", "helpers", "data-structures") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - _compiler_required_cpp17 = { - "Visual Studio": "16", - "gcc": "8", - "clang": "7", - "apple-clang": "12.0", - } - @property - def _source_subfolder(self): - return "source_subfolder" + def _compiler_required_cpp17(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12.0", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") + check_min_cppstd(self, "17") minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) + if minimum_version and Version(self.settings.get_safe("compiler.version")) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++17, which your compiler does not support.") else: - self.output.warn("{0} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + self.output.warn(f"{self.ref} requires C++17. Your compiler is unknown. Assuming it supports C++17.") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure(source_folder=self._source_subfolder) - return cmake + def build(self): + pass def package(self): - self.copy("LICENSE*", "licenses", self._source_subfolder) + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) - cmake = self._configure_cmake() - cmake.install() - - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] - def package_id(self): - self.info.header_only() + self.cpp_info.set_property("cmake_file_name", "daw-header-libraries") + self.cpp_info.set_property("cmake_target_name", "daw::daw-header-libraries") + self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-header-libraries") - def package_info(self): + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "daw-header-libraries" self.cpp_info.filenames["cmake_find_package_multi"] = "daw-header-libraries" - self.cpp_info.set_property("cmake_file_name", "daw-header-libraries") - self.cpp_info.names["cmake_find_package"] = "daw" self.cpp_info.names["cmake_find_package_multi"] = "daw" - self.cpp_info.set_property("cmake_target_name", "daw::daw-header-libraries") - self.cpp_info.components["daw"].names["cmake_find_package"] = "daw-header-libraries" self.cpp_info.components["daw"].names["cmake_find_package_multi"] = "daw-header-libraries" - self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-header-libraries") diff --git a/recipes/daw_header_libraries/all/test_package/CMakeLists.txt b/recipes/daw_header_libraries/all/test_package/CMakeLists.txt index 927d4cdc2126b..817fb2a992dc4 100644 --- a/recipes/daw_header_libraries/all/test_package/CMakeLists.txt +++ b/recipes/daw_header_libraries/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) -find_package(daw-header-libraries CONFIG REQUIRED) +find_package(daw-header-libraries REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} daw::daw-header-libraries) +target_link_libraries(${PROJECT_NAME} PRIVATE daw::daw-header-libraries) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/daw_header_libraries/all/test_package/conanfile.py b/recipes/daw_header_libraries/all/test_package/conanfile.py index de03d357e14e0..a9fbb7f543162 100644 --- a/recipes/daw_header_libraries/all/test_package/conanfile.py +++ b/recipes/daw_header_libraries/all/test_package/conanfile.py @@ -1,9 +1,18 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools -class DawHeaderLibrariesTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/daw_header_libraries/all/test_v1_package/CMakeLists.txt b/recipes/daw_header_libraries/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..bc541ea90b512 --- /dev/null +++ b/recipes/daw_header_libraries/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/daw_header_libraries/all/test_v1_package/conanfile.py b/recipes/daw_header_libraries/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/daw_header_libraries/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/daw_header_libraries/config.yml b/recipes/daw_header_libraries/config.yml index 0dae96daeb7f5..e18abeaf72479 100644 --- a/recipes/daw_header_libraries/config.yml +++ b/recipes/daw_header_libraries/config.yml @@ -1,27 +1,21 @@ versions: - "2.68.3": - folder: all - "2.68.1": - folder: all - "2.65.1": + "2.85.1": folder: all - "2.65.0": + "2.79.0": folder: all - "2.64.2": + "2.76.3": folder: all - "2.53.3": + "2.76.2": folder: all - "2.50.0": + "2.74.2": folder: all - "2.46.0": + "2.73.1": folder: all - "2.33.2": + "2.72.0": folder: all - "2.23.0": + "2.71.0": folder: all - "2.15.1": - folder: all - "2.5.3": + "2.68.3": folder: all "1.29.7": folder: all diff --git a/recipes/daw_json_link/all/conandata.yml b/recipes/daw_json_link/all/conandata.yml index 8866827f93aee..4f222b4af5c45 100644 --- a/recipes/daw_json_link/all/conandata.yml +++ b/recipes/daw_json_link/all/conandata.yml @@ -1,28 +1,34 @@ sources: - "3.0.5": - url: "https://github.com/beached/daw_json_link/archive/v3.0.5.tar.gz" - sha256: "77abe2ca525083d59a1e4e8e9aa1d2633e5382d98a0d5d838cd2379eaf8d7edf" - "3.0.4": - url: "https://github.com/beached/daw_json_link/archive/v3.0.4.tar.gz" - sha256: "bf45d116d96337b37b31daa4031ba05beb2579693dd1115bf70b15420e1905a7" - "3.0.1": - url: "https://github.com/beached/daw_json_link/archive/v3.0.1.tar.gz" - sha256: "589e1cc8c6ea2e0624bf7755209c4589cc5dba25cde6b52628b10bdbc8420669" - "3.0.0": - url: "https://github.com/beached/daw_json_link/archive/v3.0.0.tar.gz" - sha256: "298a9ed0cbc228d7ae99594c1babccfaceabc5e0e2a23e0d67d32cbd4bf72f86" + "3.14.1": + url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.14.1.tar.gz" + sha256: "a761c594dabd14b7484f5d286db31e9272f633d2ad0dab44cdae5ff3f06db6fb" + "3.14.0": + url: "https://github.com/beached/daw_json_link/archive/refs/tags/v3.14.tar.gz" + sha256: "07171e1b8f09f525116627015b6618990dc9cfb32357ba821512c0508730c9a4" + "3.12.0": + url: "https://github.com/beached/daw_json_link/archive/v3.12.0.tar.gz" + sha256: "b32097954caae14071893232fd85febbfda1deec34bb939f6aad76c077c6c5d5" + "3.11.1": + url: "https://github.com/beached/daw_json_link/archive/v3.11.1.tar.gz" + sha256: "d2b5cb221892c6b1ecd30fd2e45d168d6b378e97d134e75349703104c5882309" + "3.10.0": + url: "https://github.com/beached/daw_json_link/archive/v3.10.0.tar.gz" + sha256: "8a2e635e695d57eb147815f516c56d48360b103fbefc06f720607e8cf93c2937" + "3.8.1": + url: "https://github.com/beached/daw_json_link/archive/v3.8.1.tar.gz" + sha256: "b0f20310d1e295babaca62b83488b22f438cc4aacf8a7a47dcc92ad7386baaec" + "3.5.0": + url: "https://github.com/beached/daw_json_link/archive/v3.5.0.tar.gz" + sha256: "d1643725711b4564fb166f1f4bac0acb386fbbdb761f822c99a4ef585d8bdd71" + "3.4.1": + url: "https://github.com/beached/daw_json_link/archive/v3.4.1.tar.gz" + sha256: "3f57ccc936a9999b5c8c5684b2b3b8b989f50ef6e1ea8dce7bc311d1c77195ac" + "3.3.0": + url: "https://github.com/beached/daw_json_link/archive/v3.3.0.tar.gz" + sha256: "fd806245fc8b944e613b29da5ef0570c0e6881b6049a7bf65eb0285c58848f40" + "3.1.1": + url: "https://github.com/beached/daw_json_link/archive/v3.1.1.tar.gz" + sha256: "7d340886898b2ea3c595f0f871c81e4c7382fe53d22d80edc5629768e49fa634" "2.15.3": url: "https://github.com/beached/daw_json_link/archive/v2.15.3.tar.gz" sha256: "ec0457a5682a76c5aec709f2d6959ef7bafa0b54c5e7740f911d97991188ee84" - "2.15.2": - url: "https://github.com/beached/daw_json_link/archive/v2.15.2.tar.gz" - sha256: "90a7b375b3c9ffd76541815b1b2107c3f6f7df3bae8d94fb7b64f4fcf8d60c0c" - "2.14.0": - url: "https://github.com/beached/daw_json_link/archive/v2.14.0.tar.gz" - sha256: "811d0c5ab9ed9c79c84fc5837c8e7ef48f1f45177b7931bc849363c48a62261b" - "2.12.9": - url: "https://github.com/beached/daw_json_link/archive/v2.12.9.tar.gz" - sha256: "a55d1517ff785aed58ddf9e570cad5175231b5c356d7066c097bfca129d0b7c8" - "2.11.0": - url: "https://github.com/beached/daw_json_link/archive/v2.11.0.tar.gz" - sha256: "e0c616bb647c6fd1d91e614a3512779000689ba68ab9f88fa284e91b6066801e" diff --git a/recipes/daw_json_link/all/conanfile.py b/recipes/daw_json_link/all/conanfile.py index 78f23a579daae..0760a2df29ec3 100644 --- a/recipes/daw_json_link/all/conanfile.py +++ b/recipes/daw_json_link/all/conanfile.py @@ -1,8 +1,13 @@ -from conans.errors import ConanInvalidConfiguration -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version + import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class DawJsonLinkConan(ConanFile): name = "daw_json_link" @@ -12,70 +17,77 @@ class DawJsonLinkConan(ConanFile): homepage = "https://github.com/beached/daw_json_link" topics = ("json", "parse", "json-parser", "serialization", "constexpr", "header-only") settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" no_copy_source = True short_paths = True - _compiler_required_cpp17 = { - "Visual Studio": "16", - "gcc": "8", - "clang": "7", - "apple-clang": "12.0", - } + @property + def _minimum_cpp_standard(self): + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - if tools.Version(self.version) < "2.11.0": - self.requires("daw_header_libraries/1.29.7") - elif tools.Version(self.version) < "2.12.0": - self.requires("daw_header_libraries/2.5.3") - else: - self.requires("daw_header_libraries/2.68.1") - self.requires("daw_utf_range/2.2.2") + self.requires("daw_header_libraries/2.85.1") + self.requires("daw_utf_range/2.2.3") - def validate(self): - if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") + def package_id(self): + self.info.clear() - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{0} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DAW_USE_PACKAGE_MANAGEMENT"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): cmake = CMake(self) - cmake.definitions["DAW_USE_PACKAGE_MANAGEMENT"] = True - cmake.configure(source_folder=self._source_subfolder) - return cmake + cmake.configure() def package(self): - self.copy("LICENSE*", "licenses", self._source_subfolder) - - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] - def package_id(self): - self.info.header_only() + self.cpp_info.set_property("cmake_file_name", "daw-json-link") + self.cpp_info.set_property("cmake_target_name", "daw::daw-json-link") + self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-json-link") + self.cpp_info.components["daw"].requires = ["daw_header_libraries::daw", "daw_utf_range::daw"] - def package_info(self): + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "daw-json-link" self.cpp_info.filenames["cmake_find_package_multi"] = "daw-json-link" - self.cpp_info.set_property("cmake_file_name", "daw-json-link") self.cpp_info.names["cmake_find_package"] = "daw" self.cpp_info.names["cmake_find_package_multi"] = "daw" - self.cpp_info.set_property("cmake_target_name", "daw::daw-json-link") self.cpp_info.components["daw"].names["cmake_find_package"] = "daw-json-link" self.cpp_info.components["daw"].names["cmake_find_package_multi"] = "daw-json-link" - self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-json-link") - self.cpp_info.components["daw"].requires = ["daw_header_libraries::daw", "daw_utf_range::daw"] diff --git a/recipes/daw_json_link/all/test_package/CMakeLists.txt b/recipes/daw_json_link/all/test_package/CMakeLists.txt index fb88deca223e6..5162d77931f1e 100644 --- a/recipes/daw_json_link/all/test_package/CMakeLists.txt +++ b/recipes/daw_json_link/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(daw-json-link CONFIG REQUIRED) +find_package(daw-json-link REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} daw::daw-json-link) +target_link_libraries(${PROJECT_NAME} PRIVATE daw::daw-json-link) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/daw_json_link/all/test_package/conanfile.py b/recipes/daw_json_link/all/test_package/conanfile.py index 103e285f2d1a0..e845ae751a301 100644 --- a/recipes/daw_json_link/all/test_package/conanfile.py +++ b/recipes/daw_json_link/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -class DawJsonLinkTestConan(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/daw_json_link/all/test_v1_package/CMakeLists.txt b/recipes/daw_json_link/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b4b25bff2f0cd --- /dev/null +++ b/recipes/daw_json_link/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/daw_json_link/all/test_v1_package/conanfile.py b/recipes/daw_json_link/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..103e285f2d1a0 --- /dev/null +++ b/recipes/daw_json_link/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class DawJsonLinkTestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/daw_json_link/config.yml b/recipes/daw_json_link/config.yml index 5a6f25ed87d19..6e573dfaf9a06 100644 --- a/recipes/daw_json_link/config.yml +++ b/recipes/daw_json_link/config.yml @@ -1,19 +1,23 @@ versions: - "3.0.5": + "3.14.1": folder: "all" - "3.0.4": + "3.14.0": folder: "all" - "3.0.1": + "3.12.0": folder: "all" - "3.0.0": + "3.11.1": folder: "all" - "2.15.3": + "3.10.0": + folder: "all" + "3.8.1": folder: "all" - "2.15.2": + "3.5.0": folder: "all" - "2.14.0": + "3.4.1": folder: "all" - "2.12.9": + "3.3.0": folder: "all" - "2.11.0": + "3.1.1": + folder: "all" + "2.15.3": folder: "all" diff --git a/recipes/daw_utf_range/all/conandata.yml b/recipes/daw_utf_range/all/conandata.yml index 44dc799bb2b6b..179be6adbbd6e 100644 --- a/recipes/daw_utf_range/all/conandata.yml +++ b/recipes/daw_utf_range/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.2.3": + url: "https://github.com/beached/utf_range/archive/v2.2.3.tar.gz" + sha256: "cfa36285ffbdf8d4d08fbbe95d054e67ad845c064a92419ea68a770415ad7a98" "2.2.2": url: "https://github.com/beached/utf_range/archive/refs/tags/v2.2.2.tar.gz" sha256: "5380ade7c7eb5c82a748211896fc7385eaec00d3215af1374aec8f0e326f91fd" diff --git a/recipes/daw_utf_range/all/conanfile.py b/recipes/daw_utf_range/all/conanfile.py index c477b5e71f23a..8372750c140f9 100644 --- a/recipes/daw_utf_range/all/conanfile.py +++ b/recipes/daw_utf_range/all/conanfile.py @@ -1,9 +1,13 @@ -import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conans.errors import ConanInvalidConfiguration -from conans import ConanFile, CMake, tools +import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.47.0" class DawUtfRangeConan(ConanFile): name = "daw_utf_range" @@ -13,62 +17,74 @@ class DawUtfRangeConan(ConanFile): homepage = "https://github.com/beached/utf_range/" topics = ("utf", "validator", "iterator") settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi", "cmake_find_package" no_copy_source = True - _compiler_required_cpp17 = { - "Visual Studio": "16", - "gcc": "8", - "clang": "7", - "apple-clang": "12.0", - } + @property + def _minimum_cpp_standard(self): + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("daw_header_libraries/2.85.1") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def requirements(self): - self.requires("daw_header_libraries/2.68.1") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DAW_USE_PACKAGE_MANAGEMENT"] = True + tc.generate() - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + deps = CMakeDeps(self) + deps.generate() - def _configure_cmake(self): + def build(self): cmake = CMake(self) - cmake.definitions["DAW_USE_PACKAGE_MANAGEMENT"] = True - cmake.configure(source_folder=self._source_subfolder) - return cmake + cmake.configure() def package(self): - self.copy("LICENSE*", "licenses", self._source_subfolder) - - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] - def package_id(self): - self.info.header_only() + self.cpp_info.set_property("cmake_file_name", "daw-utf-range") + self.cpp_info.set_property("cmake_target_name", "daw::daw-utf-range") + self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-utf-range") + self.cpp_info.components["daw"].requires = ["daw_header_libraries::daw"] - def package_info(self): + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "daw-utf-range" self.cpp_info.filenames["cmake_find_package_multi"] = "daw-utf-range" - self.cpp_info.set_property("cmake_file_name", "daw-utf-range") self.cpp_info.names["cmake_find_package"] = "daw" self.cpp_info.names["cmake_find_package_multi"] = "daw" - self.cpp_info.set_property("cmake_target_name", "daw::daw-utf-range") self.cpp_info.components["daw"].names["cmake_find_package"] = "daw-utf-range" self.cpp_info.components["daw"].names["cmake_find_package_multi"] = "daw-utf-range" - self.cpp_info.components["daw"].set_property("cmake_target_name", "daw::daw-utf-range") - self.cpp_info.components["daw"].requires = ["daw_header_libraries::daw"] diff --git a/recipes/daw_utf_range/all/test_package/CMakeLists.txt b/recipes/daw_utf_range/all/test_package/CMakeLists.txt index 93ca38b7d3fb4..423476843bbe4 100644 --- a/recipes/daw_utf_range/all/test_package/CMakeLists.txt +++ b/recipes/daw_utf_range/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(daw-utf-range CONFIG REQUIRED) +find_package(daw-utf-range REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} daw::daw-utf-range) +target_link_libraries(${PROJECT_NAME} PRIVATE daw::daw-utf-range) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/daw_utf_range/all/test_package/conanfile.py b/recipes/daw_utf_range/all/test_package/conanfile.py index e4d8733790192..a9fb96656f203 100644 --- a/recipes/daw_utf_range/all/test_package/conanfile.py +++ b/recipes/daw_utf_range/all/test_package/conanfile.py @@ -1,9 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools -class DawUtfRangeTestConan(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt b/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/daw_utf_range/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/daw_utf_range/all/test_v1_package/conanfile.py b/recipes/daw_utf_range/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e4d8733790192 --- /dev/null +++ b/recipes/daw_utf_range/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class DawUtfRangeTestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/daw_utf_range/config.yml b/recipes/daw_utf_range/config.yml index 86b3b2518ef53..20edb7543cf05 100644 --- a/recipes/daw_utf_range/config.yml +++ b/recipes/daw_utf_range/config.yml @@ -1,4 +1,6 @@ versions: + "2.2.3": + folder: "all" "2.2.2": folder: "all" "2.2.0": diff --git a/recipes/dbcppp/all/conandata.yml b/recipes/dbcppp/all/conandata.yml new file mode 100644 index 0000000000000..ee0c7b702a4f7 --- /dev/null +++ b/recipes/dbcppp/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "3.2.6": + url: https://github.com/xR3b0rn/dbcppp/archive/refs/tags/v3.2.6.tar.gz + sha256: "e54829abf503abbc95513629e9318450224c1b22c0fcee4febc16cbfd73afafb" +patches: + "3.2.6": + - patch_file: "patches/0001-dep-cmake-rem-kcd.patch" + patch_type: "conan" + patch_description: "Disable use of KCD to ensure compatibility with conan" diff --git a/recipes/dbcppp/all/conanfile.py b/recipes/dbcppp/all/conanfile.py new file mode 100644 index 0000000000000..3a0d9d2ce43eb --- /dev/null +++ b/recipes/dbcppp/all/conanfile.py @@ -0,0 +1,111 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.53.0" + +class DBCpppConan(ConanFile): + name = "dbcppp" + description = ".dbc library for C/C++" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/xR3b0rn/dbcppp" + topics = ("can", "dbc", "network") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_tools": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_tools": False, + } + + @property + def _minimum_cpp_standard(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "9", + "clang": "12", + "apple-clang": "12", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.options["boost"].header_only = True + + def layout(self): + cmake_layout(self) + + def requirements(self): + if self.options.with_tools: + self.requires("cxxopts/3.0.0") + self.requires("boost/1.80.0") + + def validate(self): + if self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} does not currently support {self.ref}:shared=True") + + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][str(self.version)],destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if is_msvc(self): + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) + tc.variables["build_tests"] = False + tc.variables["build_examples"] = False + tc.variables["build_tools"] = self.options.with_tools + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + rm(self, "KCD2Network.cpp", self.source_folder, recursive=True) # Cannot support KCD because of weird dll issues + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + def package_info(self): + self.cpp_info.libs = ["libdbcppp"] + self.env_info.path.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/dbcppp/all/patches/0001-dep-cmake-rem-kcd.patch b/recipes/dbcppp/all/patches/0001-dep-cmake-rem-kcd.patch new file mode 100644 index 0000000000000..094014da38730 --- /dev/null +++ b/recipes/dbcppp/all/patches/0001-dep-cmake-rem-kcd.patch @@ -0,0 +1,317 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d905b29..d35d486 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,53 +5,16 @@ project("libdbcppp" VERSION 0.1.0) + + option(build_tests "Build tests" ON) + option(build_examples "Build examples" ON) ++option(build_tools "Build tools" ON) + +-set(CMAKE_CXX_STANDARD 17) +-set(CMAKE_STATIC_LIBRARY_PREFIX "") +-set(CMAKE_SHARED_LIBRARY_PREFIX "") +-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) ++set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + + if (CMAKE_CXX_COMPILER_ID MATCHES "MSVC") + add_definitions("/bigobj") + endif() + + include_directories("include") +-include_directories("third-party/libxml2/include") +-include_directories("third-party/libxmlmm/libxmlmm") +-include_directories("third-party/boost") +-include_directories("third-party/cxxopts/include") + +-set(LIBXML2_WITH_ICONV OFF) +-set(LIBXML2_WITH_LZMA OFF) +-set(LIBXML2_WITH_PYTHON OFF) +-set(LIBXML2_WITH_ZLIB OFF) +-set(LIBXML2_WITH_TESTS OFF) +- +-add_subdirectory(third-party/libxml2) +- +-file(GLOB libxmlmm_header +- "third-party/libxmlmm/libxmlmm/*.h" +-) +-file(GLOB libxmlmm_src +- "third-party/libxmlmm/libxmlmm/*.cpp" +-) +- +-add_library(libxmlmm SHARED "") +-target_link_libraries(libxmlmm LibXml2) +- +-target_sources("libxmlmm" +- PRIVATE ${libxmlmm_header} +- PRIVATE ${libxmlmm_src} +-) +- +-install( +- TARGETS "libxmlmm" "LibXml2" EXPORT ${PROJECT_NAME}Targets +- DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-install( +- DIRECTORY "libxmlmm" +- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libxmlmm +- FILES_MATCHING PATTERN "*.h") +- + add_subdirectory(src) + if (build_tests) + add_subdirectory(tests) +@@ -59,7 +22,3 @@ endif() + if (build_examples) + add_subdirectory(examples) + endif() +- +-set(CMAKE_STATIC_LIBRARY_PREFIX "") +-set(CMAKE_SHARED_LIBRARY_PREFIX "") +-set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) +diff --git a/include/dbcppp/Export.h b/include/dbcppp/Export.h +index 00dac6a..2ebe898 100644 +--- a/include/dbcppp/Export.h ++++ b/include/dbcppp/Export.h +@@ -1,12 +1,4 @@ + + #pragma once + +-#ifdef _WIN32 +-# ifdef DBCPPP_EXPORT +-# define DBCPPP_API __declspec(dllexport) +-# else +-# define DBCPPP_API __declspec(dllimport) +-# endif +-#else +-# define DBCPPP_API +-#endif ++#define DBCPPP_API +diff --git a/include/dbcppp/Network.h b/include/dbcppp/Network.h +index 34459e9..f36084b 100644 +--- a/include/dbcppp/Network.h ++++ b/include/dbcppp/Network.h +@@ -39,7 +39,6 @@ namespace dbcppp + , std::string&& comment); + static std::map> LoadNetworkFromFile(const std::filesystem::path& filename); + static std::unique_ptr LoadDBCFromIs(std::istream& is); +- static std::map> LoadKCDFromIs(std::istream& is); + + virtual std::unique_ptr Clone() const = 0; + +diff --git a/src/dbcppp/CMakeLists.txt b/src/dbcppp/CMakeLists.txt +index 371cbbf..6d56ae9 100644 +--- a/src/dbcppp/CMakeLists.txt ++++ b/src/dbcppp/CMakeLists.txt +@@ -1,8 +1,6 @@ +- +-include_directories( +- ${CMAKE_SOURCE_DIR}/src +- ${CMAKE_BINARY_DIR}/src +-) ++if(NOT build_tools) ++ return() ++endif() + + file(GLOB header + "*.h" +@@ -11,10 +9,12 @@ file(GLOB src + "*.cpp" + ) + ++find_package(cxxopts CONFIG REQUIRED) ++ + add_executable(dbcppp ${header} ${src}) + set_property(TARGET dbcppp PROPERTY CXX_STANDARD 17) + add_dependencies(dbcppp ${PROJECT_NAME}) +-target_link_libraries(dbcppp ${PROJECT_NAME} ${Boost_LIBRARIES}) ++target_link_libraries(dbcppp ${PROJECT_NAME} cxxopts::cxxopts) + + install( + TARGETS dbcppp +diff --git a/src/dbcppp/main.cpp b/src/dbcppp/main.cpp +index 462af2e..9ce93a6 100644 +--- a/src/dbcppp/main.cpp ++++ b/src/dbcppp/main.cpp +@@ -6,6 +6,7 @@ + #include + #include + #include ++#include + #include + + #include +@@ -35,11 +36,7 @@ int main(int argc, char** argv) + ("f,format", "Output format (C, DBC, human)", cxxopts::value()) + ("dbc", "List of DBC files", cxxopts::value>()); + +- for (std::size_t i = 1; i < argc - 1; i++) +- { +- argv[i] = argv[i + 1]; +- } +- auto vm = options.parse(argc - 1, argv); ++ auto vm = options.parse(argc, argv); + + if (vm.count("help")) + { +@@ -89,10 +86,6 @@ int main(int argc, char** argv) + options.add_options() + ("h,help", "Produce help message") + ("bus", "List of buses in format <:>", cxxopts::value>()); +- for (std::size_t i = 1; i < argc - 1; i++) +- { +- argv[i] = argv[i + 1]; +- } + auto vm = options.parse(argc, argv); + if (vm.count("help")) + { +diff --git a/src/libdbcppp/CMakeLists.txt b/src/libdbcppp/CMakeLists.txt +index 9a69748..0ced933 100644 +--- a/src/libdbcppp/CMakeLists.txt ++++ b/src/libdbcppp/CMakeLists.txt +@@ -2,12 +2,11 @@ + include(GNUInstallDirs) + include(TestBigEndian) + +-add_library(${PROJECT_NAME} SHARED "") ++add_library(${PROJECT_NAME} "") + set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) + +-target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} ${LIBXML2_LIBRARIES} "libxmlmm") +- +-add_compile_definitions(DBCPPP_EXPORT) ++find_package(Boost CONFIG REQUIRED) ++target_link_libraries(${PROJECT_NAME} boost::boost) + + include_directories( + ${CMAKE_SOURCE_DIR}/src +@@ -45,9 +44,6 @@ target_sources(${PROJECT_NAME} + ) + set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${header_interface}") + +-include(GenerateExportHeader) +-generate_export_header(${PROJECT_NAME}) +- + # install + install( + TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}Targets +@@ -57,35 +53,3 @@ install( + FILES + $ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/dbcppp) +- +-include(CMakePackageConfigHelpers) +-write_basic_package_version_file( +- "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake" +- VERSION ${Upstream_VERSION} +- COMPATIBILITY AnyNewerVersion +-) +- +-export(EXPORT ${PROJECT_NAME}Targets +- FILE "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Targets.cmake" +-) +-configure_file(cmake/${PROJECT_NAME}Config.cmake +- "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake" +- @ONLY +-) +- +-set(ConfigPackageLocation ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}) +-install(EXPORT ${PROJECT_NAME}Targets +- FILE +- ${PROJECT_NAME}Targets.cmake +- DESTINATION +- ${ConfigPackageLocation} +-) +-install( +- FILES +- cmake/${PROJECT_NAME}Config.cmake +- "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake" +- DESTINATION +- ${ConfigPackageLocation} +- COMPONENT +- Devel +-) +\ No newline at end of file +diff --git a/src/libdbcppp/DBCAST2Network.cpp b/src/libdbcppp/DBCAST2Network.cpp +index fbbf155..d2fb973 100644 +--- a/src/libdbcppp/DBCAST2Network.cpp ++++ b/src/libdbcppp/DBCAST2Network.cpp +@@ -3,6 +3,7 @@ + #include + #include + #include ++#include + + #include + +diff --git a/src/libdbcppp/Export.h b/src/libdbcppp/Export.h +index 00dac6a..2ebe898 100644 +--- a/src/libdbcppp/Export.h ++++ b/src/libdbcppp/Export.h +@@ -1,12 +1,4 @@ + + #pragma once + +-#ifdef _WIN32 +-# ifdef DBCPPP_EXPORT +-# define DBCPPP_API __declspec(dllexport) +-# else +-# define DBCPPP_API __declspec(dllimport) +-# endif +-#else +-# define DBCPPP_API +-#endif ++#define DBCPPP_API +diff --git a/src/libdbcppp/Network2DBC.cpp b/src/libdbcppp/Network2DBC.cpp +index 3de0623..2fc7caa 100644 +--- a/src/libdbcppp/Network2DBC.cpp ++++ b/src/libdbcppp/Network2DBC.cpp +@@ -1,5 +1,6 @@ + #include "../../include/dbcppp/Network2Functions.h" + #include "NetworkImpl.h" ++#include + + using namespace dbcppp; + using namespace dbcppp::Network2DBC; +diff --git a/src/libdbcppp/Network2Human.cpp b/src/libdbcppp/Network2Human.cpp +index d61ee14..3110f2f 100644 +--- a/src/libdbcppp/Network2Human.cpp ++++ b/src/libdbcppp/Network2Human.cpp +@@ -1,6 +1,7 @@ + + #include + #include "../../include/dbcppp/Network2Functions.h" ++#include + + using namespace dbcppp; + +diff --git a/src/libdbcppp/NetworkImpl.cpp b/src/libdbcppp/NetworkImpl.cpp +index 04ce841..eab54e5 100644 +--- a/src/libdbcppp/NetworkImpl.cpp ++++ b/src/libdbcppp/NetworkImpl.cpp +@@ -1,5 +1,6 @@ + #include + #include ++#include + #include "../../include/dbcppp/Network.h" + #include "NetworkImpl.h" + +@@ -339,9 +340,5 @@ std::map> INetwork::LoadNetworkFromFile(c + result.insert(std::make_pair("", std::move(net))); + } + } +- else if (filename.extension() == ".kcd") +- { +- result = LoadKCDFromIs(is); +- } + return std::move(result); + } +\ No newline at end of file +diff --git a/src/libdbcppp/SignalMultiplexerValueImpl.cpp b/src/libdbcppp/SignalMultiplexerValueImpl.cpp +index 9c9a601..fea0544 100644 +--- a/src/libdbcppp/SignalMultiplexerValueImpl.cpp ++++ b/src/libdbcppp/SignalMultiplexerValueImpl.cpp +@@ -1,5 +1,6 @@ + + #include "SignalMultiplexerValueImpl.h" ++#include + + using namespace dbcppp; + diff --git a/recipes/dbcppp/all/test_package/CMakeLists.txt b/recipes/dbcppp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c5a24dec129dd --- /dev/null +++ b/recipes/dbcppp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(dbcppp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE dbcppp::dbcppp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/dbcppp/all/test_package/conanfile.py b/recipes/dbcppp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fbb7f543162 --- /dev/null +++ b/recipes/dbcppp/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/dbcppp/all/test_package/test_package.cpp b/recipes/dbcppp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9adb143af2782 --- /dev/null +++ b/recipes/dbcppp/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ + +#include +#include +#include + +#include + +int main() { + constexpr char* test_dbc = + "VERSION \"\"\n" + "NS_ :\n" + "BS_: 1 : 2, 3\n" + "BU_:\n" + "BO_ 1 Msg0: 8 Sender0\n" + " SG_ Sig0: 0|1@1+ (1,0) [1|12] \"Unit0\" Vector__XXX\n" + " SG_ Sig1 m0 : 1|1@0- (1,0) [1|12] \"Unit1\" Recv0, Recv1\n" + " SG_ Sig2 M : 2|1@0- (1,0) [1|12] \"Unit2\" Recv0, Recv1\n"; + + std::istringstream iss(test_dbc); + auto net = dbcppp::INetwork::LoadDBCFromIs(iss); + for (const auto& msg : net->Messages()) { + std::cout << "Message ID: " << msg.Id() << " Name: " << msg.Name() << std::endl; + for (const auto& sig : msg.Signals()) { + std::cout << '\t' << "Signal ID: " << sig.Name() << " Unit: " << sig.Unit() << std::endl; + } + } +} diff --git a/recipes/dbcppp/all/test_v1_package/CMakeLists.txt b/recipes/dbcppp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/dbcppp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/dbcppp/all/test_v1_package/conanfile.py b/recipes/dbcppp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e4d8733790192 --- /dev/null +++ b/recipes/dbcppp/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class DawUtfRangeTestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/dbcppp/config.yml b/recipes/dbcppp/config.yml new file mode 100644 index 0000000000000..501f2f8a2e3d1 --- /dev/null +++ b/recipes/dbcppp/config.yml @@ -0,0 +1,3 @@ +versions: + "3.2.6": + folder: all diff --git a/recipes/dbus/1.x.x/CMakeLists.txt b/recipes/dbus/1.x.x/CMakeLists.txt deleted file mode 100644 index b117333a50fcc..0000000000000 --- a/recipes/dbus/1.x.x/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(../conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("cmake") diff --git a/recipes/dbus/1.x.x/conandata.yml b/recipes/dbus/1.x.x/conandata.yml index 42752d935328d..20ee5e48052c8 100644 --- a/recipes/dbus/1.x.x/conandata.yml +++ b/recipes/dbus/1.x.x/conandata.yml @@ -1,15 +1,30 @@ sources: + "1.15.2": + url: "https://dbus.freedesktop.org/releases/dbus/dbus-1.15.2.tar.xz" + sha256: "7e640803084af59f5e477b7ded11fd888b5380910a895c51ca3aedd63c0626ca" + "1.15.0": + url: "https://dbus.freedesktop.org/releases/dbus/dbus-1.15.0.tar.xz" + sha256: "5073c8cb9ad20226647bb38f4965182b762a6e1f595ccdc8e59411014bfd640a" + "1.14.0": + url: "https://dbus.freedesktop.org/releases/dbus/dbus-1.14.0.tar.xz" + sha256: "ccd7cce37596e0a19558fd6648d1272ab43f011d80c8635aea8fd0bad58aebd4" "1.12.20": url: "https://dbus.freedesktop.org/releases/dbus/dbus-1.12.20.tar.gz" sha256: "f77620140ecb4cdc67f37fb444f8a6bea70b5b6461f12f1cbe2cec60fa7de5fe" patches: - "1.12.20": - - patch_file: "patches/cmake_current_source_dir.patch" - base_path: "source_subfolder" + "1.15.2": + - patch_file: "patches/0003-meson-monotonic-clock-check.patch" + patch_type: "portability" + patch_description: "Fix detection of necessary monotonic clock functions in pthread" + patch_source: "https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/352" + "1.15.0": + - patch_file: "patches/0003-meson-monotonic-clock-check.patch" patch_type: "portability" - patch_source: "https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/332" - - patch_file: "patches/cmake_configure_checks_list_separator.patch" - base_path: "source_subfolder" + patch_description: "Fix detection of necessary monotonic clock functions in pthread" + patch_source: "https://gitlab.freedesktop.org/dbus/dbus/-/merge_requests/352" + "1.12.20": + - patch_file: "patches/0001-cmake-project.patch" + - patch_file: "patches/0002-cmake_configure_checks_list_separator.patch" patch_type: "portability" url: "https://gitlab.freedesktop.org/dbus/dbus/-/commit/8cd1c2155252938ed38d2612e4d054c7fc0244c3.patch" patch_source: "https://gitlab.freedesktop.org/dbus/dbus/-/issues/324" diff --git a/recipes/dbus/1.x.x/conanfile.py b/recipes/dbus/1.x.x/conanfile.py index b229ca53b3684..eac8625ebd775 100644 --- a/recipes/dbus/1.x.x/conanfile.py +++ b/recipes/dbus/1.x.x/conanfile.py @@ -1,13 +1,17 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, cmake_layout, CMakeDeps, CMakeToolchain +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, rename, rm, rmdir, save +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.scm import Version import os import textwrap -from conan import ConanFile -from conan.tools.files import apply_conandata_patches, copy, get, mkdir, rename, rmdir, save, rm -from conans import CMake -# TODO: Update to conan.tools.apple after 1.51.3 -from conans.tools import is_apple_os - -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class DbusConan(ConanFile): @@ -16,92 +20,148 @@ class DbusConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.freedesktop.org/wiki/Software/dbus" description = "D-Bus is a simple system for interprocess communication and coordination." - topics = ("dbus") - + topics = "bus", "interprocess", "message" settings = "os", "arch", "compiler", "build_type" + short_paths = True options = { - "system_socket": "ANY", - "system_pid_file": "ANY", + "system_socket": ["ANY"], + "system_pid_file": ["ANY"], "with_x11": [True, False], "with_glib": [True, False], + "with_systemd": [True, False], "with_selinux": [True, False], + "session_socket_dir": ["ANY"], } default_options = { "system_socket": "", "system_pid_file": "", "with_x11": False, "with_glib": False, + "with_systemd": False, "with_selinux": False, + "session_socket_dir": "/tmp", } - generators = "cmake", "cmake_find_package", "VirtualBuildEnv", "VirtualRunEnv" - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _meson_available(self): + return Version(self.version) >= "1.15.0" - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): + if self.settings.os not in ("Linux", "FreeBSD") or Version(self.version) < "1.14.0": + del self.options.with_systemd if self.settings.os not in ("Linux", "FreeBSD"): del self.options.with_x11 def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + if self._meson_available: + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") + + def build_requirements(self): + if self._meson_available: + self.tool_requires("meson/1.0.0") + self.tool_requires("pkgconf/1.9.3") def requirements(self): - self.requires("expat/2.4.8") + self.requires("expat/2.5.0") if self.options.with_glib: - self.requires("glib/2.72.0") + self.requires("glib/2.75.2") + if self.options.get_safe("with_systemd"): + self.requires("libsystemd/252.4") if self.options.with_selinux: - self.requires("selinux/3.3") + self.requires("libselinux/3.3") if self.options.get_safe("with_x11"): self.requires("xorg/system") - - def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) - copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder, self._source_subfolder)) - def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + def validate(self): + if Version(self.version) >= "1.14.0": + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < 7: + raise ConanInvalidConfiguration(f"{self.ref} requires at least gcc 7.") - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) + if not self._meson_available and self.info.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} does not support Windows. Contributions welcome.") - self._cmake.definitions["DBUS_BUILD_TESTS"] = False - self._cmake.definitions["DBUS_ENABLE_DOXYGEN_DOCS"] = False - self._cmake.definitions["DBUS_ENABLE_XML_DOCS"] = False - - self._cmake.definitions["DBUS_BUILD_X11"] = self.options.get_safe("with_x11", False) - self._cmake.definitions["DBUS_WITH_GLIB"] = self.options.with_glib - self._cmake.definitions["DBUS_DISABLE_ASSERT"] = is_apple_os(self.settings.os) - self._cmake.definitions["DBUS_DISABLE_CHECKS"] = False + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + if self._meson_available: + tc = MesonToolchain(self) + tc.project_options["asserts"] = not is_apple_os(self) + tc.project_options["checks"] = False + tc.project_options["doxygen_docs"] = "disabled" + tc.project_options["modular_tests"] = "disabled" + tc.project_options["session_socket_dir"] = str(self.options.session_socket_dir) + tc.project_options["selinux"] = "enabled" if self.options.get_safe("with_selinux", False) else "disabled" + tc.project_options["systemd"] = "enabled" if self.options.get_safe("with_systemd", False) else "disabled" + if self.options.get_safe("with_systemd", False): + tc.project_options["systemd_system_unitdir"] = os.path.join(self.package_folder, "lib", "systemd", "system") + tc.project_options["systemd_user_unitdir"] = os.path.join(self.package_folder, "lib", "systemd", "user") + if is_apple_os(self): + tc.project_options["launchd_agent_dir"] = os.path.join(self.package_folder, "res", "LaunchAgents") + tc.project_options["x11_autolaunch"] = "enabled" if self.options.get_safe("with_x11", False) else "disabled" + tc.project_options["xml_docs"] = "disabled" + tc.generate() + env = VirtualBuildEnv(self) + env.generate(scope="build") + else: + tc = CMakeToolchain(self) + tc.variables["DBUS_BUILD_TESTS"] = False + tc.variables["DBUS_ENABLE_DOXYGEN_DOCS"] = False + tc.variables["DBUS_ENABLE_XML_DOCS"] = False + tc.variables["DBUS_BUILD_X11"] = bool(self.options.get_safe("with_x11", False)) + tc.variables["ENABLE_SYSTEMD"] = "ON" if self.options.get_safe("with_systemd", False) else "OFF" + tc.variables["DBUS_WITH_GLIB"] = bool(self.options.get_safe("with_glib", False)) + tc.variables["DBUS_DISABLE_ASSERT"] = is_apple_os(self) + tc.variables["DBUS_DISABLE_CHECKS"] = False # Conan does not provide an EXPAT_LIBRARIES CMake variable for the Expat library. # Define EXPAT_LIBRARIES to be the expat::expat target provided by Conan to fix linking. - self._cmake.definitions["EXPAT_LIBRARIES"] = "expat::expat" + tc.variables["EXPAT_LIBRARIES"] = "expat::expat" + + # https://github.com/freedesktop/dbus/commit/e827309976cab94c806fda20013915f1db2d4f5a + tc.variables["DBUS_SESSION_SOCKET_DIR"] = str(self.options.session_socket_dir) - self._cmake.configure(source_folder=self._source_subfolder, - build_folder=self._build_subfolder) - return self._cmake + tc.cache_variables["CMAKE_FIND_PACKAGE_PREFER_CONFIG"] = False + tc.generate() + cmake_deps = CMakeDeps(self) + cmake_deps.generate() + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() def build(self): apply_conandata_patches(self) - cmake = self._configure_cmake() - cmake.build() + if self._meson_available: + meson = Meson(self) + meson.configure() + meson.build() + else: + cmake = CMake(self) + build_script_folder = None + if Version(self.version) < "1.14.0": + build_script_folder = "cmake" + cmake.configure(build_script_folder=build_script_folder) + cmake.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", - src=self._source_subfolder) - cmake = self._configure_cmake() - cmake.install() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if self._meson_available: + meson = Meson(self) + meson.install() + else: + cmake = CMake(self) + cmake.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) rmdir(self, os.path.join(self.package_folder, "share", "doc")) mkdir(self, os.path.join(self.package_folder, "res")) for i in ["var", "share", "etc"]: @@ -110,7 +170,6 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "lib", "systemd")) - rm(self, "*.la", self.package_folder) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self._create_cmake_module_alias_targets( @@ -121,17 +180,17 @@ def package(self): def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) + """) save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "DBus1") @@ -141,6 +200,7 @@ def package_info(self): os.path.join("include", "dbus-1.0"), os.path.join("lib", "dbus-1.0", "include"), ]) + self.cpp_info.resdirs = ["res"] self.cpp_info.libs = ["dbus-1"] if self.settings.os == "Linux": self.cpp_info.system_libs.append("rt") diff --git a/recipes/dbus/1.x.x/patches/0001-cmake-project.patch b/recipes/dbus/1.x.x/patches/0001-cmake-project.patch new file mode 100644 index 0000000000000..2d00f57d33527 --- /dev/null +++ b/recipes/dbus/1.x.x/patches/0001-cmake-project.patch @@ -0,0 +1,23 @@ +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -1,10 +1,3 @@ +-# where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked +-list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules") +- +-# we do not need to have WIN32 defined +-set(CMAKE_LEGACY_CYGWIN_WIN32 0) +- +-project(dbus) + + # we need to be up to date + CMAKE_MINIMUM_REQUIRED(VERSION 3.0.2 FATAL_ERROR) +@@ -19,6 +12,9 @@ if(CMAKE_MAJOR_VERSION GREATER 2) + cmake_policy(SET CMP0054 NEW) + endif() + endif() ++set(CMAKE_LEGACY_CYGWIN_WIN32 0) ++project(dbus) ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules") + + # detect version + include(MacrosAutotools) diff --git a/recipes/dbus/1.x.x/patches/cmake_configure_checks_list_separator.patch b/recipes/dbus/1.x.x/patches/0002-cmake_configure_checks_list_separator.patch similarity index 100% rename from recipes/dbus/1.x.x/patches/cmake_configure_checks_list_separator.patch rename to recipes/dbus/1.x.x/patches/0002-cmake_configure_checks_list_separator.patch diff --git a/recipes/dbus/1.x.x/patches/0003-meson-monotonic-clock-check.patch b/recipes/dbus/1.x.x/patches/0003-meson-monotonic-clock-check.patch new file mode 100644 index 0000000000000..7e9e94edfd469 --- /dev/null +++ b/recipes/dbus/1.x.x/patches/0003-meson-monotonic-clock-check.patch @@ -0,0 +1,15 @@ +diff --git a/meson.build b/meson.build +index 3b5b182c..4e400a52 100644 +--- a/meson.build ++++ b/meson.build +@@ -328,7 +328,9 @@ data_config.set('top_builddir', meson.project_build_root()) + threads = dependency('threads') + config.set( + 'HAVE_MONOTONIC_CLOCK', +- cc.has_header_symbol('pthread.h', 'CLOCK_MONOTONIC', args: compile_args_c), ++ cc.has_header_symbol('pthread.h', 'CLOCK_MONOTONIC', args: compile_args_c) ++ and cc.has_header_symbol('pthread.h', 'pthread_condattr_setclock', args: compile_args_c) ++ and cc.has_header_symbol('time.h', 'clock_getres', args: compile_args_c), + ) + + glib = dependency( diff --git a/recipes/dbus/1.x.x/patches/cmake_current_source_dir.patch b/recipes/dbus/1.x.x/patches/cmake_current_source_dir.patch deleted file mode 100644 index b4b275a75ae3d..0000000000000 --- a/recipes/dbus/1.x.x/patches/cmake_current_source_dir.patch +++ /dev/null @@ -1,112 +0,0 @@ -diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt -index 3ac71a5a..9d203d5f 100644 ---- a/cmake/CMakeLists.txt -+++ b/cmake/CMakeLists.txt -@@ -1,5 +1,5 @@ - # where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked --list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/modules") -+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/modules") - - # we do not need to have WIN32 defined - set(CMAKE_LEGACY_CYGWIN_WIN32 0) -@@ -114,7 +114,7 @@ endif (CYGWIN) - # search for required packages - if (WIN32) - # include local header first to avoid using old installed header -- set (CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${CMAKE_SOURCE_DIR}/..) -+ set (CMAKE_INCLUDE_PATH ${CMAKE_INCLUDE_PATH} ${PROJECT_SOURCE_DIR}/..) - find_package(LibIconv) - include(Win32Macros) - addExplorerWrapper(${CMAKE_PROJECT_NAME}) -@@ -148,7 +148,7 @@ add_definitions(-D_GNU_SOURCE) - INCLUDE(ConfigureChecks.cmake) - - # @TODO: how to remove last dir from ${CMAKE_SOURCE_DIR} ? --SET(DBUS_SOURCE_DIR ${CMAKE_SOURCE_DIR}/..) -+SET(DBUS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/..) - - # make some more macros available - include (MacroLibrary) -@@ -281,7 +281,7 @@ endif (WIN32 OR CYGWIN) - set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}/bin) - - # for including config.h and for includes like --include_directories( ${CMAKE_SOURCE_DIR}/.. ${CMAKE_BINARY_DIR} ${CMAKE_INCLUDE_PATH} ) -+include_directories( ${PROJECT_SOURCE_DIR}/.. ${PROJECT_BINARY_DIR} ${CMAKE_INCLUDE_PATH} ) - - # linker search directories - link_directories(${DBUS_LIB_DIR} ${LIBRARY_OUTPUT_PATH} ) -diff --git a/cmake/bus/CMakeLists.txt b/cmake/bus/CMakeLists.txt -index 4c5bdcf2..5ac8454c 100644 ---- a/cmake/bus/CMakeLists.txt -+++ b/cmake/bus/CMakeLists.txt -@@ -1,7 +1,7 @@ - add_definitions(-DDBUS_COMPILATION) - - SET(EFENCE "") --SET(BUS_DIR ${CMAKE_SOURCE_DIR}/../bus) -+SET(BUS_DIR ${PROJECT_SOURCE_DIR}/../bus) - - # config files for installation - CONFIGURE_FILE( "${BUS_DIR}/session.conf.in" "${CMAKE_CURRENT_BINARY_DIR}/session.conf" IMMEDIATE @ONLY) -@@ -16,7 +16,7 @@ endif() - - # copy services for local daemon start to local service dir data/dbus-1/services - SET (SERVICE_FILES test/data/valid-service-files) --FILE(GLOB FILES "${CMAKE_SOURCE_DIR}/../${SERVICE_FILES}/*.service.in" ) -+FILE(GLOB FILES "${PROJECT_SOURCE_DIR}/../${SERVICE_FILES}/*.service.in" ) - FOREACH(FILE ${FILES}) - GET_FILENAME_COMPONENT(FILENAME ${FILE} NAME_WE) - SET (TARGET ${CMAKE_BINARY_DIR}/data/dbus-1/services/${FILENAME}.service) -@@ -84,7 +84,7 @@ endif(DBUS_ENABLE_STATS) - - include_directories( - ${CMAKE_BINARY_DIR} -- ${CMAKE_SOURCE_DIR}/.. -+ ${PROJECT_SOURCE_DIR}/.. - ${EXPAT_INCLUDE_DIR} - ) - -diff --git a/cmake/dbus/CMakeLists.txt b/cmake/dbus/CMakeLists.txt -index 8a01d918..93e541a5 100644 ---- a/cmake/dbus/CMakeLists.txt -+++ b/cmake/dbus/CMakeLists.txt -@@ -1,4 +1,4 @@ --SET(DBUS_DIR ${CMAKE_SOURCE_DIR}/../dbus) -+SET(DBUS_DIR ${PROJECT_SOURCE_DIR}/../dbus) - - configure_file(${DBUS_DIR}/dbus-arch-deps.h.in ${CMAKE_CURRENT_BINARY_DIR}/dbus-arch-deps.h ) - -@@ -98,7 +98,7 @@ set (DBUS_LIB_HEADERS - ${DBUS_DIR}/dbus-transport.h - ${DBUS_DIR}/dbus-transport-protected.h - ${DBUS_DIR}/dbus-watch.h -- ${CMAKE_BINARY_DIR}/config.h -+ ${PROJECT_BINARY_DIR}/config.h - ) - if(UNIX) - set (DBUS_LIB_HEADERS ${DBUS_LIB_HEADERS} -@@ -330,7 +330,7 @@ else(WIN32) - endif(WIN32) - - if (DBUS_ENABLE_EMBEDDED_TESTS) -- add_test_executable(test-dbus ${CMAKE_SOURCE_DIR}/../dbus/dbus-test-main.c ${DBUS_INTERNAL_LIBRARIES}) -+ add_test_executable(test-dbus ${PROJECT_SOURCE_DIR}/../dbus/dbus-test-main.c ${DBUS_INTERNAL_LIBRARIES}) - set_target_properties(test-dbus PROPERTIES COMPILE_FLAGS ${DBUS_INTERNAL_CLIENT_DEFINITIONS}) - ENDIF (DBUS_ENABLE_EMBEDDED_TESTS) - -diff --git a/cmake/modules/CPackInstallConfig.cmake b/cmake/modules/CPackInstallConfig.cmake -index 46e8fb6d..e2331425 100644 ---- a/cmake/modules/CPackInstallConfig.cmake -+++ b/cmake/modules/CPackInstallConfig.cmake -@@ -9,8 +9,8 @@ endif (DBUS_INSTALL_SYSTEM_LIBS) - - SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "D-BUS For Windows") - SET(CPACK_PACKAGE_VENDOR "D-BUS Windows Team") --SET(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/../README") --SET(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/../COPYING") -+SET(CPACK_PACKAGE_DESCRIPTION_FILE "${PROJECT_SOURCE_DIR}/../README") -+SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/../COPYING") - # duplicated from VERSION - SET(CPACK_PACKAGE_VERSION_MAJOR ${VERSION_MAJOR}) - SET(CPACK_PACKAGE_VERSION_MINOR ${VERSION_MINOR}) diff --git a/recipes/dbus/1.x.x/test_package/CMakeLists.txt b/recipes/dbus/1.x.x/test_package/CMakeLists.txt index ac7664d0c79b8..497b3ee2b047c 100644 --- a/recipes/dbus/1.x.x/test_package/CMakeLists.txt +++ b/recipes/dbus/1.x.x/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(DBus1 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} dbus-1) +target_link_libraries(${PROJECT_NAME} PRIVATE dbus-1) diff --git a/recipes/dbus/1.x.x/test_package/conanfile.py b/recipes/dbus/1.x.x/test_package/conanfile.py index 2098e89bdb0f6..3cb242daa016f 100644 --- a/recipes/dbus/1.x.x/test_package/conanfile.py +++ b/recipes/dbus/1.x.x/test_package/conanfile.py @@ -1,13 +1,19 @@ -import os - from conan import ConanFile -from conan.tools.build import cross_building -from conans import CMake +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi", "VirtualBuildEnv", "VirtualRunEnv" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -15,6 +21,7 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - self.run("dbus-monitor --help", run_environment=True) - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + self.run("dbus-monitor --help", env="conanrun") + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/dbus/1.x.x/test_v1_package/CMakeLists.txt b/recipes/dbus/1.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/dbus/1.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/dbus/1.x.x/test_v1_package/conanfile.py b/recipes/dbus/1.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3a412edafcc0d --- /dev/null +++ b/recipes/dbus/1.x.x/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run("dbus-monitor --help", run_environment=True) + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/dbus/config.yml b/recipes/dbus/config.yml index 25658d2dae43d..cc866e2f4cf3b 100644 --- a/recipes/dbus/config.yml +++ b/recipes/dbus/config.yml @@ -1,3 +1,9 @@ versions: + "1.15.2": + folder: 1.x.x + "1.15.0": + folder: 1.x.x + "1.14.0": + folder: 1.x.x "1.12.20": folder: 1.x.x diff --git a/recipes/dcmtk/all/conanfile.py b/recipes/dcmtk/all/conanfile.py index a22b5ac9d4a21..9b544546330a2 100644 --- a/recipes/dcmtk/all/conanfile.py +++ b/recipes/dcmtk/all/conanfile.py @@ -1,11 +1,15 @@ +from conans import CMake +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan.tools.scm import Version import functools import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class DCMTKConan(ConanFile): @@ -33,6 +37,7 @@ class DCMTKConan(ConanFile): "builtin_private_tags": [True, False], "external_dictionary": [None, True, False], "wide_io": [True, False], + "enable_stl": [True, False], } default_options = { "shared": False, @@ -50,6 +55,7 @@ class DCMTKConan(ConanFile): "builtin_private_tags": False, "external_dictionary": None, "wide_io": False, + "enable_stl": True, } generators = "cmake", "cmake_find_package" @@ -68,8 +74,7 @@ def _is_msvc(self): def export_sources(self): self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -103,13 +108,13 @@ def requirements(self): self.requires("tcp-wrappers/7.6") def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self) and \ + if hasattr(self, "settings_build") and cross_building(self) and \ self.settings.os == "Macos" and self.settings.arch == "armv8": # FIXME: Probable issue with flags, build includes header 'mmintrin.h' raise ConanInvalidConfiguration("Cross building to Macos M1 is not supported (yet)") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) @functools.lru_cache(1) @@ -146,7 +151,10 @@ def _configure_cmake(self): if self.options.with_zlib: cmake.definitions["WITH_ZLIBINC"] = self.deps_cpp_info["zlib"].rootpath - cmake.definitions["DCMTK_ENABLE_STL"] = "ON" + if self.options.enable_stl: + cmake.definitions["DCMTK_ENABLE_STL"] = "ON" + else: + cmake.definitions["DCMTK_ENABLE_STL"] = "OFF" cmake.definitions["DCMTK_ENABLE_CXX11"] = True cmake.definitions["DCMTK_ENABLE_MANPAGE"] = False @@ -170,12 +178,8 @@ def _configure_cmake(self): cmake.configure(build_folder=self._build_subfolder) return cmake - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - def build(self): - self._patch_sources() + apply_conandata_patches(self) cmake = self._configure_cmake() cmake.build() @@ -185,18 +189,17 @@ def package(self): cmake = self._configure_cmake() cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "etc")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "share")) self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {target: "DCMTK::{}".format(target) for target in self._dcmtk_components.keys()} + {target: f"DCMTK::{target}" for target in self._dcmtk_components} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -205,7 +208,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_subfolder(self): @@ -213,8 +216,7 @@ def _module_subfolder(self): @property def _module_file_rel_path(self): - return os.path.join(self._module_subfolder, - "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join(self._module_subfolder, "conan-official-{self.name}-targets.cmake") @property def _dcmtk_components(self): @@ -241,7 +243,7 @@ def tcpwrappers(): def xml2(): return ["libxml2::libxml2"] if self.options.with_libxml2 else [] - charls = "dcmtkcharls" if tools.Version("3.6.6") <= self.version else "charls" + charls = "dcmtkcharls" if Version("3.6.6") <= self.version else "charls" return { "ofstd" : charset_conversion(), @@ -309,12 +311,12 @@ def register_components(components): register_components(self._dcmtk_components) dcmdictpath = os.path.join(self._dcm_datadictionary_path, "dcmtk", "dicom.dic") - self.output.info("Settings DCMDICTPATH environment variable: {}".format(dcmdictpath)) + self.output.info(f"Settings DCMDICTPATH environment variable: {dcmdictpath}") self.runenv_info.define_path("DCMDICTPATH", dcmdictpath) self.env_info.DCMDICTPATH = dcmdictpath # remove in conan v2? if self.options.with_applications: self.buildenv_info.define_path("DCMDICTPATH", dcmdictpath) bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/dcmtk/all/test_package/conanfile.py b/recipes/dcmtk/all/test_package/conanfile.py index 38f4483872d47..c5fa77486cfa5 100644 --- a/recipes/dcmtk/all/test_package/conanfile.py +++ b/recipes/dcmtk/all/test_package/conanfile.py @@ -1,4 +1,6 @@ -from conans import ConanFile, CMake, tools +from conans import CMake +from conan import ConanFile +from conan.tools.build import cross_building import os @@ -12,6 +14,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if not cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) diff --git a/recipes/dice-template-library/all/conandata.yml b/recipes/dice-template-library/all/conandata.yml index e2b3fe7a9dcda..a56456e70c621 100644 --- a/recipes/dice-template-library/all/conandata.yml +++ b/recipes/dice-template-library/all/conandata.yml @@ -5,3 +5,6 @@ sources: "0.2.0": url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v0.2.0.tar.gz" sha256: "0f981aeb5604eb305a190d3aef6625032bbb2a34a0bcd17f17ae0cef19fac384" + "0.3.0": + url: "https://github.com/dice-group/dice-template-library/archive/refs/tags/v0.3.0.tar.gz" + sha256: "2c02278f86c7b5fe1c684f5126f30529952a03784fa7c883cc4fd44965b3c33e" diff --git a/recipes/dice-template-library/config.yml b/recipes/dice-template-library/config.yml index f97c9e447ad07..b657866f6cca6 100644 --- a/recipes/dice-template-library/config.yml +++ b/recipes/dice-template-library/config.yml @@ -3,3 +3,5 @@ versions: folder: all "0.2.0": folder: all + "0.3.0": + folder: all diff --git a/recipes/diligent-core/all/CMakeLists.txt b/recipes/diligent-core/all/CMakeLists.txt index 3c184a638f2ac..a00123a14d403 100644 --- a/recipes/diligent-core/all/CMakeLists.txt +++ b/recipes/diligent-core/all/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.2) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(SPIRV-Tools REQUIRED CONFIG) find_package(spirv-cross REQUIRED CONFIG) find_package(glslang REQUIRED CONFIG) @@ -12,9 +9,14 @@ find_package(xxHash REQUIRED CONFIG) add_library(glslang INTERFACE) target_link_libraries(glslang INTERFACE glslang::glslang) -target_include_directories(glslang INTERFACE ${CONAN_INCLUDE_DIRS_GLSLANG}/glslang) +target_include_directories(glslang INTERFACE ${glslang_INCLUDE_DIR}/glslang) add_library(SPIRV ALIAS glslang::SPIRV) add_library(SPIRV-Headers ALIAS SPIRV-Headers::SPIRV-Headers) +add_library(SPIRV-Tools-opt ALIAS spirv-tools::spirv-tools) +add_library(spirv-tools-core ALIAS spirv-tools::spirv-tools) +add_library(SPIRV-Tools-static ALIAS spirv-tools::spirv-tools) + add_subdirectory(source_subfolder) + diff --git a/recipes/diligent-core/all/conandata.yml b/recipes/diligent-core/all/conandata.yml index 0b9b5a5985bfa..a48d5fbd77dc8 100644 --- a/recipes/diligent-core/all/conandata.yml +++ b/recipes/diligent-core/all/conandata.yml @@ -1,7 +1,13 @@ sources: + "api.252009": + url: "https://github.com/DiligentGraphics/DiligentCore/archive/refs/tags/API252009.tar.gz" + sha256: "48d62ba72551166ea47eec4d2ad0589811e51c76c40d1998ad5049096efe8c19" + "api.252005": + url: "https://github.com/DiligentGraphics/DiligentCore/archive/refs/tags/API252005.tar.gz" + sha256: "20d164b36ec6ff6f1ef69aa44210bb46f3244af1c0d9538ac3758ca2437fb2e1" "api.252004": url: "https://github.com/DiligentGraphics/DiligentCore/archive/refs/tags/API252004.tar.gz" - sha256: "f1a5a46f60b26cd7f07e27a64b90e76e28643a09cb3af786d04141ce7c306452" + sha256: "06e4ee5f95163ae74bbe62f59dcdf1da5e181ff2d6a8e3982319bb5c8f97c53b" "api.252003": url: "https://github.com/DiligentGraphics/DiligentCore/archive/refs/tags/API252003.tar.gz" sha256: "18f17eaa0b6425022be4019c61fede441b9feec4b94c2b7e8ab73d86a7f6a913" @@ -43,8 +49,6 @@ patches: "api.250014": - patch_file: "patches/0007-API250014-remove_warning_as_error.patch" base_path: "source_subfolder" - - patch_file: "patches/0008-API250014-use_conan_dependencies_in_shader_tools.patch" - base_path: "source_subfolder" - patch_file: "patches/0009-API250014-use_conan_dependencies_in_third_party.patch" base_path: "source_subfolder" - patch_file: "patches/0010-API250014-use_volk_from_conan.patch" diff --git a/recipes/diligent-core/all/conanfile.py b/recipes/diligent-core/all/conanfile.py index 8f3afdf2864e7..a02de86844027 100644 --- a/recipes/diligent-core/all/conanfile.py +++ b/recipes/diligent-core/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building, check_min_cppstd +from conan.tools.scm import Version +from conan.tools.files import rm, get, rmdir, rename, collect_libs, patches, export_conandata_patches, copy, apply_conandata_patches +from conan.tools.apple import is_apple_os import os -from conan.tools.build import cross_building -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class DiligentCoreConan(ConanFile): @@ -24,19 +28,8 @@ class DiligentCoreConan(ConanFile): "fPIC": True, "with_glslang": True } - generators = "cmake_find_package", "cmake", "cmake_find_package_multi" - _cmake = None - exports_sources = ["CMakeLists.txt", "patches/**"] short_paths = True - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _minimum_compilers_version(self): return { @@ -52,20 +45,25 @@ def _minimum_cpp_standard(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) + check_min_cppstd(self, self._minimum_cpp_standard) min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) if not min_version: self.output.warn("{} recipe lacks information about the {} compiler support.".format( self.name, self.settings.compiler)) else: - if tools.Version(self.settings.compiler.version) < min_version: + if Version(self.settings.compiler.version) < min_version: raise ConanInvalidConfiguration("{} requires C++{} support. The current compiler {} {} does not support it.".format( self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) if self.settings.compiler == "Visual Studio" and "MT" in self.settings.compiler.runtime: raise ConanInvalidConfiguration("Visual Studio build with MT runtime is not supported") + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder, keep_path=False) + export_conandata_patches(self) + def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=os.path.join(self.source_folder, "source_subfolder"), strip_root=True) def package_id(self): if self.settings.compiler == "Visual Studio": @@ -74,6 +72,28 @@ def package_id(self): else: self.info.settings.compiler.runtime = "MT/MTd" + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DILIGENT_BUILD_SAMPLES"] = False + tc.variables["DILIGENT_NO_FORMAT_VALIDATION"] = True + tc.variables["DILIGENT_BUILD_TESTS"] = False + tc.variables["DILIGENT_NO_DXC"] = True + tc.variables["DILIGENT_NO_GLSLANG"] = not self.options.with_glslang + tc.variables["SPIRV_CROSS_NAMESPACE_OVERRIDE"] = self.options["spirv-cross"].namespace + tc.variables["BUILD_SHARED_LIBS"] = False + tc.variables["DILIGENT_CLANG_COMPILE_OPTIONS"] = "" + tc.variables["DILIGENT_MSVC_COMPILE_OPTIONS"] = "" + tc.variables["ENABLE_RTTI"] = True + tc.variables["ENABLE_EXCEPTIONS"] = True + tc.variables[self._diligent_platform()] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def layout(self): + cmake_layout(self) + def configure(self): if self.options.shared: del self.options.fPIC @@ -83,22 +103,23 @@ def config_options(self): del self.options.fPIC def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + patches.apply_conandata_patches(self) def build_requirements(self): - self.build_requires("cmake/3.22.0") + self.tool_requires("cmake/3.24.2") def requirements(self): self.requires("opengl/system") + if self.settings.os == "Linux": + self.requires("wayland/1.21.0") - self.requires("spirv-cross/1.3.216.0") - self.requires("spirv-tools/1.3.216.0") + self.requires("spirv-cross/1.3.224.0") + self.requires("spirv-tools/1.3.224.0") if self.options.with_glslang: - self.requires("glslang/1.3.216.0") - self.requires("vulkan-headers/1.3.216.0") - self.requires("vulkan-validationlayers/1.3.216.0") - self.requires("volk/1.3.216.0") + self.requires("glslang/1.3.224.0") + self.requires("vulkan-headers/1.3.224.1") + self.requires("vulkan-validationlayers/1.3.224.1") + self.requires("volk/1.3.224.1") self.requires("xxhash/0.8.1") if self.settings.os in ["Linux", "FreeBSD"]: @@ -122,66 +143,45 @@ def _diligent_platform(self): elif self.settings.os == "watchOS": return "PLATFORM_TVOS" - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["DILIGENT_BUILD_SAMPLES"] = False - self._cmake.definitions["DILIGENT_NO_FORMAT_VALIDATION"] = True - self._cmake.definitions["DILIGENT_BUILD_TESTS"] = False - self._cmake.definitions["DILIGENT_NO_DXC"] = True - self._cmake.definitions["DILIGENT_NO_GLSLANG"] = not self.options.with_glslang - self._cmake.definitions["SPIRV_CROSS_NAMESPACE_OVERRIDE"] = self.options["spirv-cross"].namespace - self._cmake.definitions["BUILD_SHARED_LIBS"] = False - self._cmake.definitions["DILIGENT_CLANG_COMPILE_OPTIONS"] = "" - self._cmake.definitions["DILIGENT_MSVC_COMPILE_OPTIONS"] = "" - - self._cmake.definitions["ENABLE_RTTI"] = True - self._cmake.definitions["ENABLE_EXCEPTIONS"] = True - - self._cmake.definitions[self._diligent_platform()] = True - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rename(src=os.path.join(self.package_folder, "include", "source_subfolder"), + rename(self, src=os.path.join(self.package_folder, "include", "source_subfolder"), dst=os.path.join(self.package_folder, "include", "DiligentCore")) - tools.rmdir(os.path.join(self.package_folder, "Licenses")) - tools.rmdir(os.path.join(self.package_folder, "lib")) - tools.rmdir(os.path.join(self.package_folder, "bin")) - self.copy("License.txt", dst="licenses", src=self._source_subfolder) + rmdir(self, os.path.join(self.package_folder, "Licenses")) + rmdir(self, os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "bin")) + copy(self, "License.txt", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.package_folder, self.source_folder, "source_subfolder")) if self.options.shared: - self.copy(pattern="*.dylib", dst="lib", keep_path=False) - self.copy(pattern="*.so", dst="lib", keep_path=False) - self.copy(pattern="*.dll", dst="bin", keep_path=False) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.a") + copy(self, pattern="*.dylib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.so", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder, keep_path=False) + rm(self, os.path.join(self.package_folder, "lib"), "*.a", recursive=True) if self.settings.os != "Windows": - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.lib") + rm(self, os.path.join(self.package_folder, "lib"), "*.lib", recursive=True) else: - self.copy(pattern="*.a", dst="lib", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.dylib") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.so") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.dll") - - self.copy(pattern="*.fxh", dst="res", keep_path=False) - - self.copy("File2String*", src=os.path.join(self._build_subfolder, "bin"), dst="bin", keep_path=False) - tools.remove_files_by_mask(self.package_folder, "*.pdb") + copy(self, pattern="*.a", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + rm(self, os.path.join(self.package_folder, "lib"), "*.dylib", recursive=True) + rm(self, os.path.join(self.package_folder, "lib"), "*.so", recursive=True) + rm(self, os.path.join(self.package_folder, "lib"), "*.dll", recursive=True) + + copy(self, pattern="*.fxh", dst=os.path.join(self.package_folder, "res"), src=self.source_folder, keep_path=False) + copy(self, "File2String*", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder, keep_path=False) + rm(self, "*.pdb", self.package_folder, recursive=True) # MinGw creates many invalid files, called objects.a, remove them here: - tools.remove_files_by_mask(self.package_folder, "objects.a") + rm(self, "objects.a", self.package_folder, recursive=True) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) # included as discussed here https://github.com/conan-io/conan-center-index/pull/10732#issuecomment-1123596308 self.cpp_info.includedirs.append(os.path.join(self.package_folder, "include")) self.cpp_info.includedirs.append(os.path.join(self.package_folder, "include", "DiligentCore", "Common")) @@ -203,7 +203,7 @@ def package_info(self): self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Basic", "interface")) if self.settings.os == "Android": self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Android", "interface")) - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Apple", "interface")) elif self.settings.os == "Emscripten": self.cpp_info.includedirs.append(os.path.join("include", "DiligentCore", "Platforms", "Emscripten", "interface")) diff --git a/recipes/diligent-core/all/patches/0002-use_conan_dependencies.patch b/recipes/diligent-core/all/patches/0002-use_conan_dependencies.patch index 7626749f44005..b6e7c03e3b6d6 100644 --- a/recipes/diligent-core/all/patches/0002-use_conan_dependencies.patch +++ b/recipes/diligent-core/all/patches/0002-use_conan_dependencies.patch @@ -1,24 +1,3 @@ -diff --git a/Graphics/ShaderTools/CMakeLists.txt b/Graphics/ShaderTools/CMakeLists.txt -index 00e63426..ad9041d9 100644 ---- a/Graphics/ShaderTools/CMakeLists.txt -+++ b/Graphics/ShaderTools/CMakeLists.txt -@@ -146,13 +146,13 @@ if(ENABLE_SPIRV) - if (${USE_GLSLANG}) - target_link_libraries(Diligent-ShaderTools - PRIVATE -- SPIRV -- glslang -+ spirv-tools::SPIRV-Tools-opt -+ glslang::SPIRV glslang::glslang glslang::MachineIndependent glslang::GenericCodeGen glslang::OSDependent glslang::OGLCompiler glslang::HLSL - ) - - target_include_directories(Diligent-ShaderTools - PRIVATE -- ../../ThirdParty/glslang -+ ${CONAN_INCLUDE_DIRS_GLSLANG}/glslang/ - ) - endif() - endif() diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt index e329495f..d61520cd 100644 --- a/ThirdParty/CMakeLists.txt diff --git a/recipes/diligent-core/all/patches/0003-use_volk_from_conan.patch b/recipes/diligent-core/all/patches/0003-use_volk_from_conan.patch index 9c4d1d3d9645f..3a247cb516390 100644 --- a/recipes/diligent-core/all/patches/0003-use_volk_from_conan.patch +++ b/recipes/diligent-core/all/patches/0003-use_volk_from_conan.patch @@ -7,8 +7,8 @@ index e760513d..a0d2de9c 100644 include ../../ThirdParty - ../../ThirdParty/Vulkan-Headers/include -+${CONAN_INCLUDE_DIRS_VULKAN-HEADERS}/include/ -+${CONAN_INCLUDE_DIRS_VOLK}/ ++${VulkanHeaders_INCLUDE_DIR} ++${volk_INCLUDE_DIR}/ ) set(PRIVATE_DEPENDENCIES diff --git a/recipes/diligent-core/all/patches/0008-API250014-use_conan_dependencies_in_shader_tools.patch b/recipes/diligent-core/all/patches/0008-API250014-use_conan_dependencies_in_shader_tools.patch deleted file mode 100644 index bb8200d8897d1..0000000000000 --- a/recipes/diligent-core/all/patches/0008-API250014-use_conan_dependencies_in_shader_tools.patch +++ /dev/null @@ -1,21 +0,0 @@ -diff --git a/Graphics/ShaderTools/CMakeLists.txt b/Graphics/ShaderTools/CMakeLists.txt -index dc47ac4b..83630de3 100644 ---- a/Graphics/ShaderTools/CMakeLists.txt -+++ b/Graphics/ShaderTools/CMakeLists.txt -@@ -147,13 +147,13 @@ if(ENABLE_SPIRV) - if (${USE_GLSLANG}) - target_link_libraries(Diligent-ShaderTools - PRIVATE -- SPIRV -- glslang -+ spirv-tools::SPIRV-Tools-opt -+ glslang::SPIRV glslang::glslang glslang::MachineIndependent glslang::GenericCodeGen glslang::OSDependent glslang::OGLCompiler glslang::HLSL - ) - - target_include_directories(Diligent-ShaderTools - PRIVATE -- ../../ThirdParty/glslang -+ ${CONAN_INCLUDE_DIRS_GLSLANG}/glslang/ - ) - endif() - endif() diff --git a/recipes/diligent-core/all/patches/0010-API250014-use_volk_from_conan.patch b/recipes/diligent-core/all/patches/0010-API250014-use_volk_from_conan.patch index bd12169aea37c..fd00b73de0f8b 100644 --- a/recipes/diligent-core/all/patches/0010-API250014-use_volk_from_conan.patch +++ b/recipes/diligent-core/all/patches/0010-API250014-use_volk_from_conan.patch @@ -7,8 +7,8 @@ index 34451f2dd..d61797325 100644 include ../../ThirdParty - ../../ThirdParty/Vulkan-Headers/include -+${CONAN_INCLUDE_DIRS_VULKAN-HEADERS}/include/ -+${CONAN_INCLUDE_DIRS_VOLK}/ ++${VulkanHeaders_INCLUDE_DIR} ++${volk_INCLUDE_DIR}/ ) set(PRIVATE_DEPENDENCIES diff --git a/recipes/diligent-core/all/patches/0013-API250014-use-vulkan-headers-in-archiver.patch b/recipes/diligent-core/all/patches/0013-API250014-use-vulkan-headers-in-archiver.patch index eb670a8735544..c6f5c58e9c39c 100644 --- a/recipes/diligent-core/all/patches/0013-API250014-use-vulkan-headers-in-archiver.patch +++ b/recipes/diligent-core/all/patches/0013-API250014-use-vulkan-headers-in-archiver.patch @@ -7,8 +7,8 @@ index 1552937ce..73c77158e 100644 PRIVATE ../GraphicsEngineVulkan/include - ../../ThirdParty/Vulkan-Headers/include -+ ${CONAN_INCLUDE_DIRS_VULKAN-HEADERS}/include/ -+ ${CONAN_INCLUDE_DIRS_VOLK}/ ++ ${VulkanHeaders_INCLUDE_DIR} ++ ${volk_INCLUDE_DIR}/ ) endif() diff --git a/recipes/diligent-core/all/test_package/test_package.cpp b/recipes/diligent-core/all/test_package/test_package.cpp index 3a2aacb2d6c1e..797079ee15abf 100644 --- a/recipes/diligent-core/all/test_package/test_package.cpp +++ b/recipes/diligent-core/all/test_package/test_package.cpp @@ -1,3 +1,5 @@ +#include + #include "Common/interface/RefCntAutoPtr.hpp" #include "Graphics/GraphicsEngine/interface/PipelineState.h" #include "Graphics/GraphicsEngine/interface/SwapChain.h" @@ -6,6 +8,34 @@ int main() { +#ifdef PLATFORM_WIN32 + std::cout << "PLATFORM_WIN32: " << PLATFORM_WIN32; +#endif + +#ifdef PLATFORM_MACOS + std::cout << "PLATFORM_MACOS: " << PLATFORM_MACOS; +#endif + +#ifdef PLATFORM_LINUX + std::cout << "PLATFORM_LINUX: " << PLATFORM_LINUX; +#endif + +#ifdef PLATFORM_ANDROID + std::cout << "PLATFORM_ANDROID: " << PLATFORM_ANDROID; +#endif + +#ifdef PLATFORM_IOS + std::cout << "PLATFORM_IOS: " << PLATFORM_IOS; +#endif + +#ifdef PLATFORM_EMSCRIPTEN + std::cout << "PLATFORM_EMSCRIPTEN: " << PLATFORM_EMSCRIPTEN; +#endif + +#ifdef PLATFORM_TVOS + std::cout << "PLATFORM_TVOS: " << PLATFORM_TVOS; +#endif + Diligent::RefCntAutoPtr _pDevice; Diligent::RefCntAutoPtr _pImmediateContext; Diligent::RefCntAutoPtr _pSwapChain; diff --git a/recipes/diligent-core/config.yml b/recipes/diligent-core/config.yml index 67c44ebd2001b..fbdb8d06e169e 100644 --- a/recipes/diligent-core/config.yml +++ b/recipes/diligent-core/config.yml @@ -1,4 +1,8 @@ versions: + "api.252009": + folder: "all" + "api.252005": + folder: "all" "api.252004": folder: "all" "api.252003": diff --git a/recipes/diligent-fx/all/conandata.yml b/recipes/diligent-fx/all/conandata.yml index d6e013762a1b4..c9711b69e2711 100644 --- a/recipes/diligent-fx/all/conandata.yml +++ b/recipes/diligent-fx/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "api.252009": + url: "https://github.com/DiligentGraphics/DiligentFX/archive/refs/tags/API252009.tar.gz" + sha256: "4a7822e21d07d018fb5436fb286c552e160847ba5104561c17af6e86fa837c7d" + "api.252005": + url: "https://github.com/DiligentGraphics/DiligentFX/archive/refs/tags/API252005.tar.gz" + sha256: "1f6b4e0e81a8300ebd89bbf1a94d73b508e7c0b2e1170c3f9faa9d22645d19dd" "2.5.2": url: "https://github.com/DiligentGraphics/DiligentFX/archive/refs/tags/v2.5.2.tar.gz" sha256: "2875e7d1e449c32c3c10a7f563cc5b3ad56b3465374dec2a9ed598411ab3b65f" @@ -9,6 +15,12 @@ sources: url: "https://github.com/DiligentGraphics/DiligentFX/archive/3757c8c99141400e0d215e0bb8865eef404a5488.tar.gz" sha256: "09f347dc00b968f3ccc383bb3e9af0e9197641f1ba7a5d22652a1cee5552786a" patches: + "api.252009": + - patch_file: "patches/0001-use-conan-dependencies.diff" + base_path: "source_subfolder" + "api.252005": + - patch_file: "patches/0001-use-conan-dependencies.diff" + base_path: "source_subfolder" "2.5.2": - patch_file: "patches/0001-use-conan-dependencies.diff" base_path: "source_subfolder" @@ -18,4 +30,3 @@ patches: "cci.20220219": - patch_file: "patches/0001-use-conan-dependencies.diff" base_path: "source_subfolder" - diff --git a/recipes/diligent-fx/all/conanfile.py b/recipes/diligent-fx/all/conanfile.py index 12afa72c71c9e..e5b2755279d0d 100644 --- a/recipes/diligent-fx/all/conanfile.py +++ b/recipes/diligent-fx/all/conanfile.py @@ -1,8 +1,12 @@ import os -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conans import CMake +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, collect_libs, export_conandata_patches, apply_conandata_patches, rename import shutil +required_conan_version = ">=1.52.0" + class DiligentFxConan(ConanFile): name = "diligent-fx" url = "https://github.com/conan-io/conan-center-index" @@ -19,7 +23,6 @@ class DiligentFxConan(ConanFile): } generators = "cmake_find_package", "cmake" _cmake = None - exports_sources = ["CMakeLists.txt", "BuildUtils.cmake", "script.py", "patches/**"] short_paths = True @property @@ -30,8 +33,14 @@ def _source_subfolder(self): def _build_subfolder(self): return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) + self.copy("CMakeLists.txt") + self.copy("BuildUtils.cmake") + self.copy("script.py") + def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def validate(self): if self.options.shared: @@ -46,11 +55,13 @@ def configure(self): del self.options.fPIC def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def requirements(self): - self.requires("diligent-tools/2.5.2") + if self.version == "cci.20220219" or self.version == "cci.20211112": + self.requires("diligent-tools/2.5.2") + else: + self.requires("diligent-tools/{}".format(self.version)) @property def _diligent_platform(self): @@ -89,7 +100,7 @@ def package(self): cmake = self._configure_cmake() cmake.install() self.copy("License.txt", dst="licenses", src=self._source_subfolder) - tools.rename(src=os.path.join(self.package_folder, "include", "source_subfolder"), + rename(self, src=os.path.join(self.package_folder, "include", "source_subfolder"), dst=os.path.join(self.package_folder, "include", "DiligentFx")) shutil.move(os.path.join(self.package_folder, "Shaders"), os.path.join(self.package_folder, "res", "Shaders")) @@ -100,7 +111,7 @@ def package(self): self.copy(pattern="*.a", src=self._build_subfolder, dst="lib", keep_path=False) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) self.cpp_info.includedirs.append(os.path.join("include", "DiligentFx")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentFx", "Components", "interface")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentFx", "GLTF_PBR_Renderer", "interface")) diff --git a/recipes/diligent-fx/config.yml b/recipes/diligent-fx/config.yml index 48e5be37ff93b..0ef99607c429d 100644 --- a/recipes/diligent-fx/config.yml +++ b/recipes/diligent-fx/config.yml @@ -1,4 +1,8 @@ versions: + "api.252009": + folder: "all" + "api.252005": + folder: "all" "cci.20211112": folder: "all" "cci.20220219": diff --git a/recipes/diligent-tools/all/CMakeLists.txt b/recipes/diligent-tools/all/CMakeLists.txt index 5c0d35b6516be..67d43c91fddd2 100644 --- a/recipes/diligent-tools/all/CMakeLists.txt +++ b/recipes/diligent-tools/all/CMakeLists.txt @@ -18,12 +18,16 @@ set(Diligent-GraphicsEngine_SOURCE_DIR ${CONAN_DILIGENT-CORE_ROOT}/include/Dilig set(DILIGENT_ARGS_DIR ${CONAN_INCLUDE_DIRS_TAYWEE-ARGS}) set(DILIGENT_DEAR_IMGUI_PATH ${CONAN_INCLUDE_DIRS_IMGUI}) -add_library(Diligent-BuildSettings ALIAS diligent-core::diligent-core) -add_library(Diligent-Common ALIAS diligent-core::diligent-core) -add_library(Diligent-PlatformInterface ALIAS diligent-core::diligent-core) -add_library(Diligent-GraphicsEngineInterface ALIAS diligent-core::diligent-core) -add_library(Diligent-GraphicsAccessories ALIAS diligent-core::diligent-core) -add_library(Diligent-GraphicsTools ALIAS diligent-core::diligent-core) -add_library(Diligent-Archiver-static ALIAS diligent-core::diligent-core) +add_library(Diligent-BuildSettings ALIAS diligent-core::diligent-core) +add_library(Diligent-Common ALIAS diligent-core::diligent-core) +add_library(Diligent-PlatformInterface ALIAS diligent-core::diligent-core) +add_library(Diligent-GraphicsEngineInterface ALIAS diligent-core::diligent-core) +add_library(Diligent-GraphicsAccessories ALIAS diligent-core::diligent-core) +add_library(Diligent-GraphicsTools ALIAS diligent-core::diligent-core) +add_library(Diligent-Archiver-static ALIAS diligent-core::diligent-core) +add_library(Diligent-HLSL2GLSLConverterLib ALIAS diligent-core::diligent-core) +add_library(Diligent-TargetPlatform ALIAS diligent-core::diligent-core) +add_library(Diligent-GraphicsEngineOpenGL-static ALIAS diligent-core::diligent-core) +add_library(imgui ALIAS imgui::imgui) add_subdirectory(source_subfolder) diff --git a/recipes/diligent-tools/all/conandata.yml b/recipes/diligent-tools/all/conandata.yml index 3de1a935e006e..27798ef8a71ae 100644 --- a/recipes/diligent-tools/all/conandata.yml +++ b/recipes/diligent-tools/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "api.252009": + url: "https://github.com/DiligentGraphics/DiligentTools/archive/refs/tags/API252009.tar.gz" + sha256: "f0ffd7e7145df2b66694d88a9d7854325032171ee6a9650f348da69f735d57a3" + "api.252005": + url: "https://github.com/DiligentGraphics/DiligentTools/archive/refs/tags/API252004.tar.gz" + sha256: "28caa91bc1a7d8b1e7bf0198da23c74a8ea0cfda447c72eeb39b5766d01a754a" "2.5.2": url: "https://github.com/DiligentGraphics/DiligentTools/archive/refs/tags/v2.5.2.tar.gz" sha256: "6519f3d5871a1119876928531d249c45ef46392237ab7bacc6531b4d538551ca" @@ -6,6 +12,14 @@ sources: url: "https://github.com/DiligentGraphics/DiligentTools/archive/846ffbe83ac5ae0c96135f5a772d0077d0d086a8.tar.gz" sha256: "12ec01e730aefd64ca0d335b5ac6af47279f5e58617f37bc062cd83422f81703" patches: + "api.252009": + - patch_file: "patches/0012-2.5.2-fix-imgui-include-path.diff" + base_path: "source_subfolder" + "api.252005": + - patch_file: "patches/0006-2.5.2-use-imgui-from-conan.diff" + base_path: "source_subfolder" + - patch_file: "patches/0012-2.5.2-fix-imgui-include-path.diff" + base_path: "source_subfolder" "2.5.2": - patch_file: "patches/0006-2.5.2-use-imgui-from-conan.diff" base_path: "source_subfolder" diff --git a/recipes/diligent-tools/all/conanfile.py b/recipes/diligent-tools/all/conanfile.py index 794dd648d479f..958f6428f4048 100644 --- a/recipes/diligent-tools/all/conanfile.py +++ b/recipes/diligent-tools/all/conanfile.py @@ -1,8 +1,12 @@ import os -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conans import CMake +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, rmdir, rm, collect_libs, patches, export_conandata_patches +from conan.tools.scm import Version -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class DiligentToolsConan(ConanFile): name = "diligent-tools" @@ -13,12 +17,20 @@ class DiligentToolsConan(ConanFile): topics = ("graphics", "texture", "gltf", "draco", "imgui") settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False], - "fPIC": [True, False]} + "fPIC": [True, False], + "jpeg": [False, "libjpeg-turbo", "libjpeg"], + "with_render_state_packager": [True, False], + "with_archiver": [True, False], + } default_options = {"shared": False, - "fPIC": True} - generators = "cmake_find_package", "cmake" + "fPIC": True, + "jpeg": "libjpeg", + "with_render_state_packager": False, + "with_archiver": True, + } + + generators = "cmake_find_package", "cmake_find_package_multi", "cmake" _cmake = None - exports_sources = ["CMakeLists.txt", "patches/**", "BuildUtils.cmake"] short_paths = True @property @@ -29,8 +41,13 @@ def _source_subfolder(self): def _build_subfolder(self): return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) + self.copy("CMakeLists.txt") + self.copy("BuildUtils.cmake") + def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def package_id(self): if self.settings.compiler == "Visual Studio": @@ -48,15 +65,17 @@ def configure(self): del self.options.fPIC def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + patches.apply_conandata_patches(self) def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) if self.options.shared: raise ConanInvalidConfiguration("Can't build diligent tools as shared lib") + def build_requirements(self): + self.tool_requires("cmake/3.24.2") + def requirements(self): if self.version == "cci.20211009": self.requires("diligent-core/2.5.1") @@ -66,7 +85,10 @@ def requirements(self): self.requires('taywee-args/6.3.0') self.requires("imgui/1.85") - self.requires("libjpeg/9d") + if self.options.jpeg == "libjpeg": + self.requires("libjpeg/9e") + if self.options.jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") self.requires("libpng/1.6.37") self.requires("libtiff/4.3.0") self.requires("zlib/1.2.12") @@ -99,6 +121,16 @@ def _configure_cmake(self): self._cmake.definitions["DILIGENT_BUILD_TESTS"] = False self._cmake.definitions["DILIGENT_BUILD_TOOLS_TESTS"] = False self._cmake.definitions["DILIGENT_BUILD_TOOLS_INCLUDE_TEST"] = False + self._cmake.definitions["DILIGENT_NO_RENDER_STATE_PACKAGER"] = not self.options.with_render_state_packager + self._cmake.definitions["ARCHIVER_SUPPORTED"] = not self.options.with_archiver + + if self.version != "cci.20211009" and \ + (self.version.startswith("api") and self.version >= "api.252005") or \ + (self.version > "2.5.2"): + self._cmake.definitions["GL_SUPPORTED"] = True + self._cmake.definitions["GLES_SUPPORTED"] = True + self._cmake.definitions["VULKAN_SUPPORTED"] = True + self._cmake.definitions["METAL_SUPPORTED"] = True self._cmake.definitions[self._diligent_platform] = True self._cmake.configure(build_folder=self._build_subfolder) @@ -115,11 +147,13 @@ def package(self): self.copy(pattern="*.dylib", src=self._build_subfolder, dst="lib", keep_path=False) self.copy(pattern="*.lib", src=self._build_subfolder, dst="lib", keep_path=False) self.copy(pattern="*.a", src=self._build_subfolder, dst="lib", keep_path=False) - tools.rmdir(os.path.join(self.package_folder, "Licenses")) + self.copy("*", src=os.path.join(self._build_subfolder, "bin"), dst="bin", keep_path=False) + rmdir(self, os.path.join(self.package_folder, "Licenses")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) self.copy("License.txt", dst="licenses", src=self._source_subfolder) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) self.cpp_info.includedirs.append(os.path.join("include", "DiligentTools")) self.cpp_info.includedirs.append(os.path.join("include", "DiligentTools", "AssetLoader", "interface")) diff --git a/recipes/diligent-tools/all/patches/0012-2.5.2-fix-imgui-include-path.diff b/recipes/diligent-tools/all/patches/0012-2.5.2-fix-imgui-include-path.diff index 00514f081f409..c8b1088f0d524 100644 --- a/recipes/diligent-tools/all/patches/0012-2.5.2-fix-imgui-include-path.diff +++ b/recipes/diligent-tools/all/patches/0012-2.5.2-fix-imgui-include-path.diff @@ -11,3 +11,16 @@ index 3b5c217..6cdabdb 100644 #import namespace Diligent +diff --git a/Imgui/src/ImGuiImplWin32.cpp b/Imgui/src/ImGuiImplWin32.cpp +index d5f4767..b7cefb2 100644 +--- a/Imgui/src/ImGuiImplWin32.cpp ++++ b/Imgui/src/ImGuiImplWin32.cpp +@@ -32,7 +32,7 @@ + #include "GraphicsTypes.h" + #include "imgui.h" + #include "ImGuiImplWin32.hpp" +-#include "backends/imgui_impl_win32.h" ++#include "../res/bindings/imgui_impl_win32.h" + #include "DebugUtilities.hpp" + + IMGUI_IMPL_API LRESULT ImGui_ImplWin32_WndProcHandler(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); \ No newline at end of file diff --git a/recipes/diligent-tools/all/patches/0013-api.252004-fix_pip3_modules_install.diff b/recipes/diligent-tools/all/patches/0013-api.252004-fix_pip3_modules_install.diff deleted file mode 100644 index 5913f79a5dcef..0000000000000 --- a/recipes/diligent-tools/all/patches/0013-api.252004-fix_pip3_modules_install.diff +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/RenderStateNotation/CMakeLists.txt b/RenderStateNotation/CMakeLists.txt -index b135f13..babe8a4 100644 ---- a/RenderStateNotation/CMakeLists.txt -+++ b/RenderStateNotation/CMakeLists.txt -@@ -23,18 +23,6 @@ file(MAKE_DIRECTORY "${RSN_PARSER_GENERATED_HEADERS_DIR}") - - find_package(PythonInterp 3 REQUIRED) - --execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install libclang -- RESULT_VARIABLE PYTHON_PIP_LIBCLANG_RESULT) --if(NOT PYTHON_PIP_LIBCLANG_RESULT EQUAL "0") -- message(FATAL_ERROR "python -m pip install libclang failed with ${PYTHON_PIP_LIBCLANG_RESULT}") --endif() -- --execute_process(COMMAND ${PYTHON_EXECUTABLE} -m pip install jinja2 -- RESULT_VARIABLE PYTHON_PIP_JINJIA_RESULT) --if(NOT PYTHON_PIP_JINJIA_RESULT EQUAL "0") -- message(FATAL_ERROR "python -m pip install jinja2 failed with ${PYTHON_PIP_JINJIA_RESULT}") --endif() -- - file(GLOB INCLUDE include/*) - file(GLOB INTERFACE interface/*) - file(GLOB SOURCE src/*) -@@ -80,7 +68,7 @@ PUBLIC - interface - PRIVATE - include -- ../../DiligentCore/Graphics/Archiver/interface -+ ${Diligent-GraphicsEngine_SOURCE_DIR}/../Archiver/interface/ - ${RSN_PARSER_HEADERS_DIR} - ) - - diff --git a/recipes/diligent-tools/config.yml b/recipes/diligent-tools/config.yml index e5937a2e97e28..961e780a18a9f 100644 --- a/recipes/diligent-tools/config.yml +++ b/recipes/diligent-tools/config.yml @@ -1,4 +1,8 @@ versions: + "api.252009": + folder: "all" + "api.252005": + folder: "all" "cci.20211009": folder: "all" "2.5.2": diff --git a/recipes/discount/all/conanfile.py b/recipes/discount/all/conanfile.py index 75f806fa8b9b9..c7bfdf5809fd4 100644 --- a/recipes/discount/all/conanfile.py +++ b/recipes/discount/all/conanfile.py @@ -2,20 +2,21 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import cross_building from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class DiscountConan(ConanFile): name = "discount" description = "DISCOUNT is a implementation of John Gruber & Aaron Swartz's Markdown markup language." license = "BSD-3-Clause" - topics = ("discount", "markdown") + topics = ("markdown",) homepage = "http://www.pell.portland.or.us/~orc/Code/discount" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,8 +28,7 @@ class DiscountConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -36,26 +36,19 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): if hasattr(self, "settings_build") and cross_building(self): raise ConanInvalidConfiguration("discount doesn't support cross-build yet") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/discount/all/test_package/conanfile.py b/recipes/discount/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/discount/all/test_package/conanfile.py +++ b/recipes/discount/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/discount/all/test_v1_package/CMakeLists.txt b/recipes/discount/all/test_v1_package/CMakeLists.txt index 4e7a2a3fdc6d8..0d20897301b68 100644 --- a/recipes/discount/all/test_v1_package/CMakeLists.txt +++ b/recipes/discount/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(discount REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE discount::libmarkdown) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/docopt.cpp/all/CMakeLists.txt b/recipes/docopt.cpp/all/CMakeLists.txt deleted file mode 100644 index c55df0a582d8f..0000000000000 --- a/recipes/docopt.cpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -CONAN_BASIC_SETUP() - -add_subdirectory("source_subfolder") diff --git a/recipes/docopt.cpp/all/conandata.yml b/recipes/docopt.cpp/all/conandata.yml index 9c028b4d8773f..ce21cb936020c 100644 --- a/recipes/docopt.cpp/all/conandata.yml +++ b/recipes/docopt.cpp/all/conandata.yml @@ -8,13 +8,18 @@ sources: patches: "0.6.3": - patch_file: "patches/cmake-library-0.6.3.patch" - base_path: "source_subfolder" + patch_description: "fix install path, separate static/shared build" + patch_type: "conan" - patch_file: "patches/msvc-dll-export-0.6.3.patch" - base_path: "source_subfolder" + patch_description: "export ostream<< to dll" + patch_type: "portability" "0.6.2": - patch_file: "patches/include-stdexcept.patch" - base_path: "source_subfolder" + patch_description: "include stdexcept" + patch_type: "portability" - patch_file: "patches/cmake-library-0.6.2.patch" - base_path: "source_subfolder" + patch_description: "fix install path, separate static/shared build" + patch_type: "conan" - patch_file: "patches/msvc-dll-export-0.6.2.patch" - base_path: "source_subfolder" + patch_description: "export ostream<< to dll" + patch_type: "portability" diff --git a/recipes/docopt.cpp/all/conanfile.py b/recipes/docopt.cpp/all/conanfile.py index 1342254943457..0745cc959331b 100644 --- a/recipes/docopt.cpp/all/conanfile.py +++ b/recipes/docopt.cpp/all/conanfile.py @@ -1,14 +1,17 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.microsoft import is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, save +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os import textwrap -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class DocoptCppConan(ConanFile): name = "docopt.cpp" - license = "MIT" description = "C++11 port of docopt" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/docopt/docopt.cpp" topics = ("cli", "getopt", "options", "argparser") @@ -25,25 +28,12 @@ class DocoptCppConan(ConanFile): "boost_regex": False, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _min_cppstd(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,40 +41,42 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.boost_regex: - self.requires("boost/1.76.0") + self.requires("boost/1.81.0") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_BOOST_REGEX"] = self.options.boost_regex + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USE_BOOST_REGEX"] = self.options.boost_regex - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + dpes = CMakeDeps(self) + dpes.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self._create_cmake_module_alias_targets( @@ -96,8 +88,7 @@ def package(self): def _cmake_target(self): return "docopt" if self.options.shared else "docopt_s" - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -106,7 +97,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): @@ -120,7 +111,7 @@ def package_info(self): self.cpp_info.components["docopt"].libs = ["docopt"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["docopt"].system_libs = ["m"] - if self._is_msvc and self.options.shared: + if is_msvc(self) and self.options.shared: self.cpp_info.components["docopt"].defines = ["DOCOPT_DLL"] if self.options.boost_regex: self.cpp_info.components["docopt"].requires.append("boost::boost") diff --git a/recipes/docopt.cpp/all/test_package/CMakeLists.txt b/recipes/docopt.cpp/all/test_package/CMakeLists.txt index bfb18efe2d7e0..2f25c54702003 100644 --- a/recipes/docopt.cpp/all/test_package/CMakeLists.txt +++ b/recipes/docopt.cpp/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(docopt REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) if(TARGET docopt_s) - target_link_libraries(${PROJECT_NAME} docopt_s) + target_link_libraries(${PROJECT_NAME} PRIVATE docopt_s) else() - target_link_libraries(${PROJECT_NAME} docopt) + target_link_libraries(${PROJECT_NAME} PRIVATE docopt) endif() diff --git a/recipes/docopt.cpp/all/test_package/conanfile.py b/recipes/docopt.cpp/all/test_package/conanfile.py index 96f53ca4b9bf0..c72c51b464c6d 100644 --- a/recipes/docopt.cpp/all/test_package/conanfile.py +++ b/recipes/docopt.cpp/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - exec_path = os.path.join("bin", "test_package") - self.run("{} --help".format(exec_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(f"{bin_path} --help", env="conanrun") diff --git a/recipes/docopt.cpp/all/test_v1_package/CMakeLists.txt b/recipes/docopt.cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/docopt.cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/docopt.cpp/all/test_v1_package/conanfile.py b/recipes/docopt.cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..85a33f9580148 --- /dev/null +++ b/recipes/docopt.cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(f"{bin_path} --help", run_environment=True) diff --git a/recipes/doctest/2.x.x/conanfile.py b/recipes/doctest/2.x.x/conanfile.py index db899278087d4..4a5f3a48700e9 100644 --- a/recipes/doctest/2.x.x/conanfile.py +++ b/recipes/doctest/2.x.x/conanfile.py @@ -1,5 +1,6 @@ -from conans import ConanFile, tools, CMake import os +from conan import ConanFile +from conan.tools import files class DoctestConan(ConanFile): @@ -17,7 +18,7 @@ def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" def source(self): - tools.get(**self.conan_data["sources"][self.version]) + files.get(self, **self.conan_data["sources"][self.version]) extracted_dir = self.name + "-" + self.version os.rename(extracted_dir, self._source_subfolder) @@ -46,4 +47,4 @@ def package_info(self): self.cpp_info.build_modules.append("lib/cmake/doctest.cmake") def package_id(self): - self.info.header_only() + self.info.clear() diff --git a/recipes/double-conversion/all/conanfile.py b/recipes/double-conversion/all/conanfile.py index d55569734dafe..9abd55fe46dcf 100644 --- a/recipes/double-conversion/all/conanfile.py +++ b/recipes/double-conversion/all/conanfile.py @@ -1,11 +1,10 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir, rm -from conan.tools.scm import Version +from conan.tools.microsoft import check_min_vs import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class DoubleConversionConan(ConanFile): @@ -14,8 +13,9 @@ class DoubleConversionConan(ConanFile): homepage = "https://github.com/google/double-conversion" description = "Efficient binary-decimal and decimal-binary conversion routines for IEEE doubles." license = "BSD-3-Clause" - topics = ("double-conversion", "google", "decimal-binary", "conversion") + topics = ("google", "decimal-binary", "conversion") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,24 +32,19 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.settings.compiler == "Visual Studio" and \ - Version(self.settings.compiler.version) < "14": - raise ConanInvalidConfiguration("Double Convertion could not be built by MSVC <14") + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + check_min_vs(self, "190") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True tc.generate() diff --git a/recipes/double-conversion/all/test_package/conanfile.py b/recipes/double-conversion/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/double-conversion/all/test_package/conanfile.py +++ b/recipes/double-conversion/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/double-conversion/all/test_v1_package/CMakeLists.txt b/recipes/double-conversion/all/test_v1_package/CMakeLists.txt index 92ad1c8732fe6..0d20897301b68 100644 --- a/recipes/double-conversion/all/test_v1_package/CMakeLists.txt +++ b/recipes/double-conversion/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(double-conversion REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE double-conversion::double-conversion) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/double-conversion/all/test_v1_package/conanfile.py b/recipes/double-conversion/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/double-conversion/all/test_v1_package/conanfile.py +++ b/recipes/double-conversion/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/doxygen/all/CMakeLists.txt b/recipes/doxygen/all/CMakeLists.txt deleted file mode 100644 index e4233e81e86f0..0000000000000 --- a/recipes/doxygen/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/doxygen/all/conandata.yml b/recipes/doxygen/all/conandata.yml index 610b80f65e242..675b6fcaaaeca 100644 --- a/recipes/doxygen/all/conandata.yml +++ b/recipes/doxygen/all/conandata.yml @@ -20,16 +20,21 @@ sources: patches: "1.9.2": - patch_file: "patches/1.9.2-0001-imported-target.patch" - base_path: "source_subfolder" + patch_description: "Fix includes" + patch_type: "portability" "1.9.1": - patch_file: "patches/1.9.1-0001-imported-target.patch" - base_path: "source_subfolder" + patch_description: "Fix includes" + patch_type: "portability" "1.8.20": - - patch_file: "patches/1.8.20-0001-relocatable-cmake.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.8-0001-xapian.patch" + patch_description: "Fix xapian find_package command" + patch_type: "portability" "1.8.18": - - patch_file: "patches/1.8.18-0001-relocatable-cmake.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.8-0001-xapian.patch" + patch_description: "Fix xapian find_package command" + patch_type: "portability" "1.8.17": - - patch_file: "patches/1.8.17-0001-relocatable-cmake.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.8-0001-xapian.patch" + patch_description: "Fix xapian find_package command" + patch_type: "portability" diff --git a/recipes/doxygen/all/conanfile.py b/recipes/doxygen/all/conanfile.py index b8ce7f7a1bd88..49abcf58094ae 100644 --- a/recipes/doxygen/all/conanfile.py +++ b/recipes/doxygen/all/conanfile.py @@ -1,11 +1,12 @@ from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get +from conan.tools.microsoft import is_msvc_static_runtime from conan.tools.scm import Version -from conan import tools -from conans import CMake from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.50.2" +required_conan_version = ">=1.52.0" class DoxygenConan(ConanFile): @@ -25,24 +26,16 @@ class DoxygenConan(ConanFile): "enable_search": True, } - exports_sources = "CMakeLists.txt", "patches/*" - generators = "cmake", "cmake_find_package" - short_paths = True - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def layout(self): + cmake_layout(self, src_folder="src") + + def export_sources(self): + export_conandata_patches(self) + def _minimum_compiler_version(self): if Version(self.version) <= "1.9.1": return { @@ -55,17 +48,18 @@ def _minimum_compiler_version(self): def configure(self): del self.settings.compiler.cppstd + def requirements(self): if self.options.enable_search: self.requires("xapian-core/1.4.19") - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def build_requirements(self): if self._settings_build.os == "Windows": - self.build_requires("winflexbison/2.5.24") + self.tool_requires("winflexbison/2.5.24") else: - self.build_requires("flex/2.6.4") - self.build_requires("bison/3.7.1") + self.tool_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") def validate(self): minimum_compiler_version = self._minimum_compiler_version() @@ -79,42 +73,33 @@ def validate(self): def package_id(self): del self.info.settings.compiler - - # Doxygen doesn't make code. Any package that will run is ok to use. - # It's ok in general to use a release version of the tool that matches the - # build os and architecture. compatible_pkg = self.info.clone() compatible_pkg.settings.build_type = "Release" self.compatible_packages.append(compatible_pkg) def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["build_parse"] = self.options.enable_parse - self._cmake.definitions["build_search"] = self.options.enable_search - self._cmake.definitions["use_libc++"] = self.settings.compiler.get_safe("libcxx") == "libc++" - self._cmake.definitions["win_static"] = "MT" in self.settings.compiler.get_safe("runtime", "") - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["build_parse"] = self.options.enable_parse + tc.variables["build_search"] = self.options.enable_search + tc.variables["use_libc++"] = self.settings.compiler.get_safe("libcxx") == "libc++" + tc.variables["win_static"] = is_msvc_static_runtime(self) + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - if os.path.isfile("Findflex.cmake"): - os.unlink("Findflex.cmake") - if os.path.isfile("Findbison.cmake"): - os.unlink("Findbison.cmake") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.files.patch(self, **patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + self.copy("LICENSE", src=self.source_folder, dst="licenses") + cmake = CMake(self) cmake.install() def package_info(self): @@ -123,3 +108,4 @@ def package_info(self): bin_path = os.path.join(self.package_folder, "bin") self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) + self.cpp_info.set_property("cmake_find_mode", "none") diff --git a/recipes/doxygen/all/patches/1.8-0001-xapian.patch b/recipes/doxygen/all/patches/1.8-0001-xapian.patch new file mode 100644 index 0000000000000..c892c87957f88 --- /dev/null +++ b/recipes/doxygen/all/patches/1.8-0001-xapian.patch @@ -0,0 +1,13 @@ +--- a/addon/doxysearch/CMakeLists.txt 2020-08-24 13:12:55.000000000 +0200 ++++ b/addon/doxysearch/CMakeLists.txt 2022-12-16 20:41:07.040801300 +0100 +@@ -1,8 +1,8 @@ +-find_package(Xapian REQUIRED) ++find_package(xapian REQUIRED) + find_package(ZLIB REQUIRED) + + if (WIN32) +- set(WIN_EXTRA_LIBS "uuid.lib rpcrt4.lib ws2_32.lib") ++ set(WIN_EXTRA_LIBS uuid.lib rpcrt4.lib ws2_32.lib) + endif() + + include_directories( diff --git a/recipes/doxygen/all/patches/1.8.17-0001-relocatable-cmake.patch b/recipes/doxygen/all/patches/1.8.17-0001-relocatable-cmake.patch deleted file mode 100644 index 36bf9770c665b..0000000000000 --- a/recipes/doxygen/all/patches/1.8.17-0001-relocatable-cmake.patch +++ /dev/null @@ -1,490 +0,0 @@ -Result of running: -- find . -type f -exec sed -i s/CMAKE_SOURCE_DIR/PROJECT_SOURCE_DIR/g {} \; -- find . -type f -exec sed -i s/CMAKE_BINARY_DIR/PROJECT_BINARY_DIR/g {} \; -- fix addon/doxysearch/CMakeLists.txt to use lower case xapian_LIBRARIES and xapian_INCLUDE_DIRS -FIXME: latest should be fixed by conan!!! - ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -29,8 +29,8 @@ - - SET(enlarge_lex_buffers "262144" CACHE INTERNAL "Sets the lex input and read buffers to the specified size") - --list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") --set(TOP "${CMAKE_SOURCE_DIR}") -+list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") -+set(TOP "${PROJECT_SOURCE_DIR}") - include(version) - - set(sqlite3 "0" CACHE INTERNAL "used in settings.h") -@@ -64,7 +64,7 @@ - if (WIN32) - if (NOT CMAKE_GENERATOR MATCHES "MinGW Makefiles") - if (NOT ICONV_DIR) -- set(ICONV_DIR "${CMAKE_SOURCE_DIR}/winbuild") -+ set(ICONV_DIR "${PROJECT_SOURCE_DIR}/winbuild") - endif() - set(CMAKE_REQUIRED_DEFINITIONS "-DLIBICONV_STATIC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # needed for language.cpp on 64bit -@@ -112,10 +112,10 @@ - include_directories(${ICONV_INCLUDE_DIR}) - - --#set(DOXYDOCS ${CMAKE_SOURCE_DIR}/doc CACHE INTERNAL "Path to doxygen docs") -+#set(DOXYDOCS ${PROJECT_SOURCE_DIR}/doc CACHE INTERNAL "Path to doxygen docs") - set(DOXYDOCS ${PROJECT_BINARY_DIR}/doc) - set(ENV{DOXYGEN_DOCDIR} ${DOXYDOCS}) --set(GENERATED_SRC "${CMAKE_BINARY_DIR}/generated_src" CACHE INTERNAL "Stores generated files") -+set(GENERATED_SRC "${PROJECT_BINARY_DIR}/generated_src" CACHE INTERNAL "Stores generated files") - set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) - set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) - -@@ -127,7 +127,7 @@ - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${EXECUTABLE_OUTPUT_PATH}) - - # gather lang codes for translation --file(GLOB lang_files RELATIVE "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/translator_??.h") -+file(GLOB lang_files RELATIVE "${PROJECT_SOURCE_DIR}/src" "${PROJECT_SOURCE_DIR}/src/translator_??.h") - if (english_only) # user only wants English - set(lcodes "ENONLY") - else () ---- addon/doxmlparser/src/CMakeLists.txt -+++ addon/doxmlparser/src/CMakeLists.txt -@@ -1,7 +1,7 @@ - include_directories( - . - ../include -- ${CMAKE_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/qtools - ) - add_library(doxmlparser STATIC - basehandler.cpp ---- addon/doxmlparser/test/CMakeLists.txt -+++ addon/doxmlparser/test/CMakeLists.txt -@@ -1,7 +1,7 @@ - - include_directories( - ../include -- ${CMAKE_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/qtools - ) - - add_executable(doxmlparser_test ---- addon/doxyapp/CMakeLists.txt -+++ addon/doxyapp/CMakeLists.txt -@@ -1,10 +1,10 @@ - find_package(Iconv) - - include_directories( -- ${CMAKE_SOURCE_DIR}/src -- ${CMAKE_SOURCE_DIR}/libversion -+ ${PROJECT_SOURCE_DIR}/src -+ ${PROJECT_SOURCE_DIR}/libversion - ${GENERATED_SRC} -- ${CMAKE_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/qtools - ${ICONV_INCLUDE_DIR} - ${CLANG_INCLUDEDIR} - ) ---- addon/doxyparse/CMakeLists.txt -+++ addon/doxyparse/CMakeLists.txt -@@ -1,10 +1,10 @@ - find_package(Iconv) - - include_directories( -- ${CMAKE_SOURCE_DIR}/src -- ${CMAKE_SOURCE_DIR}/libversion -+ ${PROJECT_SOURCE_DIR}/src -+ ${PROJECT_SOURCE_DIR}/libversion - ${GENERATED_SRC} -- ${CMAKE_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/qtools - ${ICONV_INCLUDE_DIR} - ${CLANG_INCLUDEDIR} - ) ---- addon/doxysearch/CMakeLists.txt -+++ addon/doxysearch/CMakeLists.txt -@@ -1,12 +1,12 @@ --find_package(Xapian REQUIRED) -+find_package(xapian REQUIRED) - find_package(ZLIB REQUIRED) - - if (WIN32) -- set(WIN_EXTRA_LIBS "uuid.lib rpcrt4.lib ws2_32.lib") -+ set(WIN_EXTRA_LIBS uuid.lib rpcrt4.lib ws2_32.lib) - endif() - - include_directories( -- ${CMAKE_SOURCE_DIR}/qtools -- ${XAPIAN_INCLUDE_DIR} -+ ${PROJECT_SOURCE_DIR}/qtools -+ ${xapian_INCLUDE_DIR} - ${ZLIB_INCLUDE_DIRS} - ) -@@ -14,7 +14,7 @@ endif() - doxyindexer.cpp - ) - target_link_libraries(doxyindexer -- ${XAPIAN_LIBRARIES} -+ ${xapian_LIBRARIES} - ${ZLIB_LIBRARIES} - ${WIN_EXTRA_LIBS} - qtools -@@ -24,7 +24,7 @@ add_executable(doxysearch.cgi - doxysearch.cpp - ) - target_link_libraries(doxysearch.cgi -- ${XAPIAN_LIBRARIES} -+ ${xapian_LIBRARIES} - ${ZLIB_LIBRARIES} - ${WIN_EXTRA_LIBS} - ) ---- addon/doxywizard/CMakeLists.txt -+++ addon/doxywizard/CMakeLists.txt -@@ -30,8 +30,8 @@ - - include_directories( - . -- ${CMAKE_SOURCE_DIR}/libversion -- ${CMAKE_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/libversion -+ ${PROJECT_SOURCE_DIR}/qtools - ${GENERATED_SRC} - ) - -@@ -58,15 +58,15 @@ - - # generate version.cpp - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/version.py ${VERSION} > ${GENERATED_SRC_WIZARD}/version.cpp -- DEPENDS ${CMAKE_SOURCE_DIR}/VERSION ${CMAKE_SOURCE_DIR}/src/version.py -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/version.py ${VERSION} > ${GENERATED_SRC_WIZARD}/version.cpp -+ DEPENDS ${PROJECT_SOURCE_DIR}/VERSION ${PROJECT_SOURCE_DIR}/src/version.py - OUTPUT ${GENERATED_SRC_WIZARD}/version.cpp - ) - set_source_files_properties(${GENERATED_SRC_WIZARD}/version.cpp PROPERTIES GENERATED 1) - - # generate configdoc.cpp - add_custom_command( --COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/configgen.py -wiz ${CMAKE_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC_WIZARD}/configdoc.cpp -+COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/configgen.py -wiz ${PROJECT_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC_WIZARD}/configdoc.cpp - OUTPUT ${GENERATED_SRC_WIZARD}/configdoc.cpp - ) - set_source_files_properties(${GENERATED_SRC_WIZARD}/configdoc.cpp PROPERTIES GENERATED 1) -@@ -74,8 +74,8 @@ - set(LEX_FILES config_doxyw) - foreach(lex_file ${LEX_FILES}) - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/addon/doxywizard/${lex_file}.l > ${GENERATED_SRC_WIZARD}/${lex_file}.l.h -- DEPENDS ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/addon/doxywizard/${lex_file}.l -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/addon/doxywizard/${lex_file}.l > ${GENERATED_SRC_WIZARD}/${lex_file}.l.h -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/addon/doxywizard/${lex_file}.l - OUTPUT ${GENERATED_SRC_WIZARD}/${lex_file}.l.h - ) - set_source_files_properties(${GENERATED_SRC_WIZARD}/${lex_file}.l.h PROPERTIES GENERATED 1) ---- cmake/doxygen_version.cmake -+++ cmake/doxygen_version.cmake -@@ -40,7 +40,7 @@ - - CHECK_REQUIRED_VARIABLE(PRE_CONFIGURE_DOXYGEN_VERSION_FILE) - CHECK_REQUIRED_VARIABLE(POST_CONFIGURE_DOXYGEN_VERSION_FILE) --CHECK_OPTIONAL_VARIABLE(DOXY_STATE_FILE "${CMAKE_SOURCE_DIR}/VERSION") -+CHECK_OPTIONAL_VARIABLE(DOXY_STATE_FILE "${PROJECT_SOURCE_DIR}/VERSION") - - # Function: DoxygenStateChangedAction - # Description: this function is executed when the ---- cmake/git_watcher.cmake -+++ cmake/git_watcher.cmake -@@ -64,7 +64,7 @@ - CHECK_REQUIRED_VARIABLE(POST_CONFIGURE_GIT_VERSION_FILE) - CHECK_OPTIONAL_VARIABLE(GIT_STATE_FILE "${GENERATED_SRC}/git_state") - #CHECK_REQUIRED_VARIABLE(GIT_STATE_FILE) --CHECK_OPTIONAL_VARIABLE(GIT_WORKING_DIR "${CMAKE_SOURCE_DIR}") -+CHECK_OPTIONAL_VARIABLE(GIT_WORKING_DIR "${PROJECT_SOURCE_DIR}") - - # Check the optional git variable. - # If it's not set, we'll try to find it using the CMake packaging system. ---- doc/CMakeLists.txt -+++ doc/CMakeLists.txt -@@ -107,8 +107,8 @@ - - foreach (f ${DOC_FILES}) - add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/${f} -- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/ -- DEPENDS ${CMAKE_SOURCE_DIR}/doc/${f} -+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/ -+ DEPENDS ${PROJECT_SOURCE_DIR}/doc/${f} - ) - set_source_files_properties(${PROJECT_BINARY_DIR}/doc/${f} PROPERTIES GENERATED 1) - list(APPEND OUT_DOC_FILES "${PROJECT_BINARY_DIR}/doc/${f}") -@@ -116,23 +116,23 @@ - - foreach (f ${DOC_FILES_CHM}) - add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/${f} -- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/ -- DEPENDS ${CMAKE_SOURCE_DIR}/doc/${f} -+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/ -+ DEPENDS ${PROJECT_SOURCE_DIR}/doc/${f} - ) - set_source_files_properties(${PROJECT_BINARY_DIR}/doc/${f} PROPERTIES GENERATED 1) - list(APPEND OUT_DOC_CHM_FILES "${PROJECT_BINARY_DIR}/doc/${f}") - endforeach() - --configure_file(${CMAKE_SOURCE_DIR}/doc/manual.sty ${PROJECT_BINARY_DIR}/doc/manual.sty) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxygen_manual.tex ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxygen.1 ${PROJECT_BINARY_DIR}/man/doxygen.1) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxywizard.1 ${PROJECT_BINARY_DIR}/man/doxywizard.1) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxysearch.1 ${PROJECT_BINARY_DIR}/man/doxysearch.1) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxyindexer.1 ${PROJECT_BINARY_DIR}/man/doxyindexer.1) -+configure_file(${PROJECT_SOURCE_DIR}/doc/manual.sty ${PROJECT_BINARY_DIR}/doc/manual.sty) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxygen_manual.tex ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxygen.1 ${PROJECT_BINARY_DIR}/man/doxygen.1) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxywizard.1 ${PROJECT_BINARY_DIR}/man/doxywizard.1) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxysearch.1 ${PROJECT_BINARY_DIR}/man/doxysearch.1) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxyindexer.1 ${PROJECT_BINARY_DIR}/man/doxyindexer.1) - - # doc/language.doc (see tag Doxyfile:INPUT) - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} translator.py ${CMAKE_SOURCE_DIR} -+ COMMAND ${PYTHON_EXECUTABLE} translator.py ${PROJECT_SOURCE_DIR} - DEPENDS ${PROJECT_BINARY_DIR}/doc/maintainers.txt ${PROJECT_BINARY_DIR}/doc/language.tpl ${PROJECT_BINARY_DIR}/doc/translator.py - OUTPUT language.doc - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc -@@ -163,7 +163,7 @@ - COMMAND ${CMAKE_COMMAND} -E remove refman.tex - COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex . - COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc/manual.sty . -- COMMAND ${EPSTOPDF} ${CMAKE_SOURCE_DIR}/doc/doxygen_logo.eps --outfile=doxygen_logo.pdf -+ COMMAND ${EPSTOPDF} ${PROJECT_SOURCE_DIR}/doc/doxygen_logo.eps --outfile=doxygen_logo.pdf - COMMAND ${PDFLATEX} -shell-escape doxygen_manual.tex - COMMAND ${MAKEINDEX} doxygen_manual.idx - COMMAND ${PDFLATEX} -shell-escape doxygen_manual.tex ---- examples/CMakeLists.txt -+++ examples/CMakeLists.txt -@@ -1,6 +1,6 @@ - file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/examples - ${PROJECT_BINARY_DIR}/html/examples) --file(GLOB EXAMPLE_FILES RELATIVE ${CMAKE_SOURCE_DIR}/examples "*") -+file(GLOB EXAMPLE_FILES RELATIVE ${PROJECT_SOURCE_DIR}/examples "*") - - if (DOT) - set(DIAGRAM_EXAMPLE ${PROJECT_BINARY_DIR}/html/examples/diagrams/html/index.html) -@@ -8,8 +8,8 @@ - - foreach (f ${EXAMPLE_FILES}) - add_custom_command( -- COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/examples/${f}" "${PROJECT_BINARY_DIR}/examples/" -- DEPENDS "${CMAKE_SOURCE_DIR}/examples/${f}" -+ COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/examples/${f}" "${PROJECT_BINARY_DIR}/examples/" -+ DEPENDS "${PROJECT_SOURCE_DIR}/examples/${f}" - OUTPUT "${PROJECT_BINARY_DIR}/examples/${f}" - ) - set_source_files_properties("${PROJECT_BINARY_DIR}/examples/${f}" PROPERTIES GENERATED 1) ---- libmscgen/CMakeLists.txt -+++ libmscgen/CMakeLists.txt -@@ -1,14 +1,14 @@ - include_directories( -- ${CMAKE_SOURCE_DIR}/liblodepng -- ${CMAKE_SOURCE_DIR}/libmscgen -+ ${PROJECT_SOURCE_DIR}/liblodepng -+ ${PROJECT_SOURCE_DIR}/libmscgen - ${GENERATED_SRC} - ) - - set(LEX_FILES mscgen_lexer) - foreach(lex_file ${LEX_FILES}) - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/libmscgen/${lex_file}.l > ${GENERATED_SRC}/${lex_file}.l.h -- DEPENDS ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/libmscgen/${lex_file}.l -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/libmscgen/${lex_file}.l > ${GENERATED_SRC}/${lex_file}.l.h -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/libmscgen/${lex_file}.l - OUTPUT ${GENERATED_SRC}/${lex_file}.l.h - ) - set_source_files_properties(${GENERATED_SRC}/${lex_file}.l.h PROPERTIES GENERATED 1) ---- libversion/CMakeLists.txt -+++ libversion/CMakeLists.txt -@@ -1,15 +1,15 @@ - # vim:ts=4:sw=4:expandtab:autoindent: - - # setup information for doxygen version handling --set(PRE_CONFIGURE_DOXYGEN_VERSION_FILE "${CMAKE_SOURCE_DIR}/libversion/doxyversion.cpp.in") -+set(PRE_CONFIGURE_DOXYGEN_VERSION_FILE "${PROJECT_SOURCE_DIR}/libversion/doxyversion.cpp.in") - set(POST_CONFIGURE_DOXYGEN_VERSION_FILE "${GENERATED_SRC}/doxyversion.cpp") - - # setup information for git version handling --set(PRE_CONFIGURE_GIT_VERSION_FILE "${CMAKE_SOURCE_DIR}/libversion/gitversion.cpp.in") -+set(PRE_CONFIGURE_GIT_VERSION_FILE "${PROJECT_SOURCE_DIR}/libversion/gitversion.cpp.in") - set(POST_CONFIGURE_GIT_VERSION_FILE "${GENERATED_SRC}/gitversion.cpp") - --include(${CMAKE_SOURCE_DIR}/cmake/git_watcher.cmake) --include(${CMAKE_SOURCE_DIR}/cmake/doxygen_version.cmake) -+include(${PROJECT_SOURCE_DIR}/cmake/git_watcher.cmake) -+include(${PROJECT_SOURCE_DIR}/cmake/doxygen_version.cmake) - - include_directories( - . ---- src/CMakeLists.txt -+++ src/CMakeLists.txt -@@ -1,20 +1,20 @@ - # vim:ts=4:sw=4:expandtab:autoindent: - - include_directories( -- ${CMAKE_SOURCE_DIR}/qtools -- ${CMAKE_SOURCE_DIR}/libmd5 -- ${CMAKE_SOURCE_DIR}/liblodepng -- ${CMAKE_SOURCE_DIR}/libmscgen -- ${CMAKE_SOURCE_DIR}/libversion -- ${CMAKE_SOURCE_DIR}/vhdlparser -- ${CMAKE_SOURCE_DIR}/src -+ ${PROJECT_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/libmd5 -+ ${PROJECT_SOURCE_DIR}/liblodepng -+ ${PROJECT_SOURCE_DIR}/libmscgen -+ ${PROJECT_SOURCE_DIR}/libversion -+ ${PROJECT_SOURCE_DIR}/vhdlparser -+ ${PROJECT_SOURCE_DIR}/src - ${CLANG_INCLUDEDIR} - ${GENERATED_SRC} - ) - - - file(MAKE_DIRECTORY ${GENERATED_SRC}) --file(GLOB LANGUAGE_FILES "${CMAKE_SOURCE_DIR}/src/translator_??.h") -+file(GLOB LANGUAGE_FILES "${PROJECT_SOURCE_DIR}/src/translator_??.h") - - # instead of increasebuffer.py - add_definitions(-DYY_BUF_SIZE=${enlarge_lex_buffers} -DYY_READ_BUF_SIZE=${enlarge_lex_buffers}) -@@ -35,8 +35,8 @@ - - # configvalues.h - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/configgen.py -maph ${CMAKE_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configvalues.h -- DEPENDS ${CMAKE_SOURCE_DIR}/src/config.xml ${CMAKE_SOURCE_DIR}/src/configgen.py -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/configgen.py -maph ${PROJECT_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configvalues.h -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/config.xml ${PROJECT_SOURCE_DIR}/src/configgen.py - OUTPUT ${GENERATED_SRC}/configvalues.h - ) - set_source_files_properties(${GENERATED_SRC}/configvalues.h PROPERTIES GENERATED 1) -@@ -47,16 +47,16 @@ - - # configvalues.cpp - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/configgen.py -maps ${CMAKE_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configvalues.cpp -- DEPENDS ${CMAKE_SOURCE_DIR}/src/config.xml ${CMAKE_SOURCE_DIR}/src/configgen.py -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/configgen.py -maps ${PROJECT_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configvalues.cpp -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/config.xml ${PROJECT_SOURCE_DIR}/src/configgen.py - OUTPUT ${GENERATED_SRC}/configvalues.cpp - ) - set_source_files_properties(${GENERATED_SRC}/configvalues.cpp PROPERTIES GENERATED 1) - - # configoptions.cpp - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/configgen.py -cpp ${CMAKE_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configoptions.cpp -- DEPENDS ${CMAKE_SOURCE_DIR}/src/config.xml ${CMAKE_SOURCE_DIR}/src/configgen.py -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/configgen.py -cpp ${PROJECT_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configoptions.cpp -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/config.xml ${PROJECT_SOURCE_DIR}/src/configgen.py - OUTPUT ${GENERATED_SRC}/configoptions.cpp - ) - set_source_files_properties(${GENERATED_SRC}/configoptions.cpp PROPERTIES GENERATED 1) -@@ -64,8 +64,8 @@ - - # ce_parse.h - add_custom_command( -- COMMAND ${BISON_EXECUTABLE} -l -d -p ce_parsexpYY ${CMAKE_SOURCE_DIR}/src/constexp.y -o ce_parse.c -- DEPENDS ${CMAKE_SOURCE_DIR}/src/constexp.y -+ COMMAND ${BISON_EXECUTABLE} -l -d -p ce_parsexpYY ${PROJECT_SOURCE_DIR}/src/constexp.y -o ce_parse.c -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/constexp.y - OUTPUT ${GENERATED_SRC}/ce_parse.h - WORKING_DIRECTORY ${GENERATED_SRC} - ) -@@ -74,19 +74,19 @@ - # lang_cfg.h - add_custom_command( - COMMENT "Generating ${GENERATED_SRC}/lang_cfg.h" -- COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/lang_cfg.cmake ${GENERATED_SRC}/lang_cfg.h ${LANG_CODES} -+ COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/lang_cfg.cmake ${GENERATED_SRC}/lang_cfg.h ${LANG_CODES} - DEPENDS ${LANGUAGE_FILES} - OUTPUT ${GENERATED_SRC}/lang_cfg.h - ) - set_source_files_properties(${GENERATED_SRC}/lang_cfg.h PROPERTIES GENERATED 1) - - # all resource files --file(GLOB RESOURCES ${CMAKE_SOURCE_DIR}/templates/*/*) -+file(GLOB RESOURCES ${PROJECT_SOURCE_DIR}/templates/*/*) - - # resources.cpp - add_custom_command( - COMMENT "Generating ${GENERATED_SRC}/resources.cpp" -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/res2cc_cmd.py ${CMAKE_SOURCE_DIR}/templates ${GENERATED_SRC}/resources.cpp -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/res2cc_cmd.py ${PROJECT_SOURCE_DIR}/templates ${GENERATED_SRC}/resources.cpp - DEPENDS ${RESOURCES} - OUTPUT ${GENERATED_SRC}/resources.cpp - ) -@@ -94,8 +94,8 @@ - - # layout_default.xml - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/to_c_cmd.py < ${CMAKE_SOURCE_DIR}/src/layout_default.xml > ${GENERATED_SRC}/layout_default.xml.h -- DEPENDS ${CMAKE_SOURCE_DIR}/src/layout_default.xml -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/to_c_cmd.py < ${PROJECT_SOURCE_DIR}/src/layout_default.xml > ${GENERATED_SRC}/layout_default.xml.h -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/layout_default.xml - OUTPUT ${GENERATED_SRC}/layout_default.xml.h - ) - set_source_files_properties(${GENERATED_SRC}/layout_default.xml.h PROPERTIES GENERATED 1) -@@ -124,8 +124,8 @@ - set(LEX_FILES_H ${LEX_FILES_H} " " ${GENERATED_SRC}/${lex_file}.l.h CACHE INTERNAL "Stores generated files") - set(LEX_FILES_CPP ${LEX_FILES_CPP} " " ${GENERATED_SRC}/${lex_file}.cpp CACHE INTERNAL "Stores generated files") - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/src/${lex_file}.l > ${GENERATED_SRC}/${lex_file}.l.h -- DEPENDS ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/src/${lex_file}.l -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/src/${lex_file}.l > ${GENERATED_SRC}/${lex_file}.l.h -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/src/${lex_file}.l - OUTPUT ${GENERATED_SRC}/${lex_file}.l.h - ) - set_source_files_properties(${GENERATED_SRC}/${lex_file}.l.h PROPERTIES GENERATED 1) ---- testing/CMakeLists.txt -+++ testing/CMakeLists.txt -@@ -1,9 +1,9 @@ - add_custom_target(tests - COMMENT "Running doxygen tests..." -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/testing/runtests.py --doxygen ${PROJECT_BINARY_DIR}/bin/doxygen --inputdir ${CMAKE_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/testing/runtests.py --doxygen ${PROJECT_BINARY_DIR}/bin/doxygen --inputdir ${PROJECT_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing - DEPENDS doxygen - ) - add_test(NAME suite -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/testing/runtests.py --doxygen $ --inputdir ${CMAKE_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/testing/runtests.py --doxygen $ --inputdir ${PROJECT_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing - ) - ---- vhdlparser/CMakeLists.txt -+++ vhdlparser/CMakeLists.txt -@@ -1,14 +1,14 @@ - find_package(Javacc) - if (JAVACC_FOUND) - add_custom_command( -- COMMAND ${JAVACC_EXECUTABLE} ${JAVACC_FLAGS} -OUTPUT_DIRECTORY=${CMAKE_SOURCE_DIR}/vhdlparser ${CMAKE_SOURCE_DIR}/vhdlparser/vhdlparser.jj -- DEPENDS ${CMAKE_SOURCE_DIR}/vhdlparser/vhdlparser.jj -- OUTPUT ${CMAKE_SOURCE_DIR}/vhdlparser/CharStream.cc ${CMAKE_SOURCE_DIR}/vhdlparser/CharStream.h ${CMAKE_SOURCE_DIR}/vhdlparser/ErrorHandler.h ${CMAKE_SOURCE_DIR}/vhdlparser/JavaCC.h ${CMAKE_SOURCE_DIR}/vhdlparser/ParseException.cc ${CMAKE_SOURCE_DIR}/vhdlparser/ParseException.h ${CMAKE_SOURCE_DIR}/vhdlparser/Token.cc ${CMAKE_SOURCE_DIR}/vhdlparser/Token.h ${CMAKE_SOURCE_DIR}/vhdlparser/TokenManager.h ${CMAKE_SOURCE_DIR}/vhdlparser/TokenMgrError.cc ${CMAKE_SOURCE_DIR}/vhdlparser/TokenMgrError.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParser.cc ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParser.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserConstants.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.cc ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.h -+ COMMAND ${JAVACC_EXECUTABLE} ${JAVACC_FLAGS} -OUTPUT_DIRECTORY=${PROJECT_SOURCE_DIR}/vhdlparser ${PROJECT_SOURCE_DIR}/vhdlparser/vhdlparser.jj -+ DEPENDS ${PROJECT_SOURCE_DIR}/vhdlparser/vhdlparser.jj -+ OUTPUT ${PROJECT_SOURCE_DIR}/vhdlparser/CharStream.cc ${PROJECT_SOURCE_DIR}/vhdlparser/CharStream.h ${PROJECT_SOURCE_DIR}/vhdlparser/ErrorHandler.h ${PROJECT_SOURCE_DIR}/vhdlparser/JavaCC.h ${PROJECT_SOURCE_DIR}/vhdlparser/ParseException.cc ${PROJECT_SOURCE_DIR}/vhdlparser/ParseException.h ${PROJECT_SOURCE_DIR}/vhdlparser/Token.cc ${PROJECT_SOURCE_DIR}/vhdlparser/Token.h ${PROJECT_SOURCE_DIR}/vhdlparser/TokenManager.h ${PROJECT_SOURCE_DIR}/vhdlparser/TokenMgrError.cc ${PROJECT_SOURCE_DIR}/vhdlparser/TokenMgrError.h ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParser.cc ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParser.h ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParserConstants.h ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.cc ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.h - ) - - endif() - --include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/qtools ${GENERATED_SRC}) -+include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/qtools ${GENERATED_SRC}) - add_library(vhdlparser STATIC - CharStream.cc - ParseException.cc ---- cmake/FindXapian.cmake -+++ cmake/FindXapian.cmake -@@ -37,6 +37,8 @@ - ENDIF(NOT Xapian_FIND_QUIETLY) - ENDIF(XAPIAN_FOUND) - -+LIST(APPEND XAPIAN_LIBRARIES CONAN_PKG::xapian-core) -+ - # show the XAPIAN_INCLUDE_DIR and XAPIAN_LIBRARIES variables only in the advanced view - MARK_AS_ADVANCED(XAPIAN_INCLUDE_DIR XAPIAN_LIBRARIES) - diff --git a/recipes/doxygen/all/patches/1.8.18-0001-relocatable-cmake.patch b/recipes/doxygen/all/patches/1.8.18-0001-relocatable-cmake.patch deleted file mode 100644 index 9cb529bd59d80..0000000000000 --- a/recipes/doxygen/all/patches/1.8.18-0001-relocatable-cmake.patch +++ /dev/null @@ -1,491 +0,0 @@ -Result of running: -- find . -type f -exec sed -i s/CMAKE_SOURCE_DIR/PROJECT_SOURCE_DIR/g {} \; -- find . -type f -exec sed -i s/CMAKE_BINARY_DIR/PROJECT_BINARY_DIR/g {} \; -- fix addon/doxysearch/CMakeLists.txt to use lower case xapian_LIBRARIES and xapian_INCLUDE_DIRS -FIXME: latest should be fixed by conan!!! - ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -29,8 +29,8 @@ - - SET(enlarge_lex_buffers "262144" CACHE INTERNAL "Sets the lex input and read buffers to the specified size") - --list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") --set(TOP "${CMAKE_SOURCE_DIR}") -+list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") -+set(TOP "${PROJECT_SOURCE_DIR}") - include(version) - - set(sqlite3 "0" CACHE INTERNAL "used in settings.h") -@@ -65,7 +65,7 @@ - if ((NOT CMAKE_GENERATOR MATCHES "MinGW Makefiles") AND - (NOT CMAKE_GENERATOR MATCHES "MSYS Makefiles")) - if (NOT ICONV_DIR) -- set(ICONV_DIR "${CMAKE_SOURCE_DIR}/winbuild") -+ set(ICONV_DIR "${PROJECT_SOURCE_DIR}/winbuild") - endif() - set(CMAKE_REQUIRED_DEFINITIONS "-DLIBICONV_STATIC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # needed for language.cpp on 64bit -@@ -113,10 +113,10 @@ - include_directories(${ICONV_INCLUDE_DIR}) - - --#set(DOXYDOCS ${CMAKE_SOURCE_DIR}/doc CACHE INTERNAL "Path to doxygen docs") -+#set(DOXYDOCS ${PROJECT_SOURCE_DIR}/doc CACHE INTERNAL "Path to doxygen docs") - set(DOXYDOCS ${PROJECT_BINARY_DIR}/doc) - set(ENV{DOXYGEN_DOCDIR} ${DOXYDOCS}) --set(GENERATED_SRC "${CMAKE_BINARY_DIR}/generated_src" CACHE INTERNAL "Stores generated files") -+set(GENERATED_SRC "${PROJECT_BINARY_DIR}/generated_src" CACHE INTERNAL "Stores generated files") - set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) - set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) - -@@ -128,7 +128,7 @@ - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${EXECUTABLE_OUTPUT_PATH}) - - # gather lang codes for translation --file(GLOB lang_files RELATIVE "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/translator_??.h") -+file(GLOB lang_files RELATIVE "${PROJECT_SOURCE_DIR}/src" "${PROJECT_SOURCE_DIR}/src/translator_??.h") - if (english_only) # user only wants English - set(lcodes "ENONLY") - else () ---- addon/doxmlparser/src/CMakeLists.txt -+++ addon/doxmlparser/src/CMakeLists.txt -@@ -1,7 +1,7 @@ - include_directories( - . - ../include -- ${CMAKE_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/qtools - ) - add_library(doxmlparser STATIC - basehandler.cpp ---- addon/doxmlparser/test/CMakeLists.txt -+++ addon/doxmlparser/test/CMakeLists.txt -@@ -1,7 +1,7 @@ - - include_directories( - ../include -- ${CMAKE_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/qtools - ) - - add_executable(doxmlparser_test ---- addon/doxyapp/CMakeLists.txt -+++ addon/doxyapp/CMakeLists.txt -@@ -1,10 +1,10 @@ - find_package(Iconv) - - include_directories( -- ${CMAKE_SOURCE_DIR}/src -- ${CMAKE_SOURCE_DIR}/libversion -+ ${PROJECT_SOURCE_DIR}/src -+ ${PROJECT_SOURCE_DIR}/libversion - ${GENERATED_SRC} -- ${CMAKE_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/qtools - ${ICONV_INCLUDE_DIR} - ${CLANG_INCLUDEDIR} - ) ---- addon/doxyparse/CMakeLists.txt -+++ addon/doxyparse/CMakeLists.txt -@@ -1,10 +1,10 @@ - find_package(Iconv) - - include_directories( -- ${CMAKE_SOURCE_DIR}/src -- ${CMAKE_SOURCE_DIR}/libversion -+ ${PROJECT_SOURCE_DIR}/src -+ ${PROJECT_SOURCE_DIR}/libversion - ${GENERATED_SRC} -- ${CMAKE_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/qtools - ${ICONV_INCLUDE_DIR} - ${CLANG_INCLUDEDIR} - ) ---- addon/doxysearch/CMakeLists.txt -+++ addon/doxysearch/CMakeLists.txt -@@ -1,12 +1,12 @@ --find_package(Xapian REQUIRED) -+find_package(xapian REQUIRED) - find_package(ZLIB REQUIRED) - - if (WIN32) -- set(WIN_EXTRA_LIBS "uuid.lib rpcrt4.lib ws2_32.lib") -+ set(WIN_EXTRA_LIBS uuid.lib rpcrt4.lib ws2_32.lib) - endif() - - include_directories( -- ${CMAKE_SOURCE_DIR}/qtools -- ${XAPIAN_INCLUDE_DIR} -+ ${PROJECT_SOURCE_DIR}/qtools -+ ${xapian_INCLUDE_DIR} - ${ZLIB_INCLUDE_DIRS} - ) -@@ -14,7 +14,7 @@ endif() - doxyindexer.cpp - ) - target_link_libraries(doxyindexer -- ${XAPIAN_LIBRARIES} -+ ${xapian_LIBRARIES} - ${ZLIB_LIBRARIES} - ${WIN_EXTRA_LIBS} - qtools -@@ -24,7 +24,7 @@ add_executable(doxysearch.cgi - doxysearch.cpp - ) - target_link_libraries(doxysearch.cgi -- ${XAPIAN_LIBRARIES} -+ ${xapian_LIBRARIES} - ${ZLIB_LIBRARIES} - ${WIN_EXTRA_LIBS} - ) ---- addon/doxywizard/CMakeLists.txt -+++ addon/doxywizard/CMakeLists.txt -@@ -30,8 +30,8 @@ - - include_directories( - . -- ${CMAKE_SOURCE_DIR}/libversion -- ${CMAKE_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/libversion -+ ${PROJECT_SOURCE_DIR}/qtools - ${GENERATED_SRC} - ) - -@@ -58,15 +58,15 @@ - - # generate version.cpp - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/version.py ${VERSION} > ${GENERATED_SRC_WIZARD}/version.cpp -- DEPENDS ${CMAKE_SOURCE_DIR}/VERSION ${CMAKE_SOURCE_DIR}/src/version.py -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/version.py ${VERSION} > ${GENERATED_SRC_WIZARD}/version.cpp -+ DEPENDS ${PROJECT_SOURCE_DIR}/VERSION ${PROJECT_SOURCE_DIR}/src/version.py - OUTPUT ${GENERATED_SRC_WIZARD}/version.cpp - ) - set_source_files_properties(${GENERATED_SRC_WIZARD}/version.cpp PROPERTIES GENERATED 1) - - # generate configdoc.cpp - add_custom_command( --COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/configgen.py -wiz ${CMAKE_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC_WIZARD}/configdoc.cpp -+COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/configgen.py -wiz ${PROJECT_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC_WIZARD}/configdoc.cpp - OUTPUT ${GENERATED_SRC_WIZARD}/configdoc.cpp - ) - set_source_files_properties(${GENERATED_SRC_WIZARD}/configdoc.cpp PROPERTIES GENERATED 1) -@@ -74,8 +74,8 @@ - set(LEX_FILES config_doxyw) - foreach(lex_file ${LEX_FILES}) - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/addon/doxywizard/${lex_file}.l > ${GENERATED_SRC_WIZARD}/${lex_file}.l.h -- DEPENDS ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/addon/doxywizard/${lex_file}.l -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/addon/doxywizard/${lex_file}.l > ${GENERATED_SRC_WIZARD}/${lex_file}.l.h -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/addon/doxywizard/${lex_file}.l - OUTPUT ${GENERATED_SRC_WIZARD}/${lex_file}.l.h - ) - set_source_files_properties(${GENERATED_SRC_WIZARD}/${lex_file}.l.h PROPERTIES GENERATED 1) ---- cmake/doxygen_version.cmake -+++ cmake/doxygen_version.cmake -@@ -40,7 +40,7 @@ - - CHECK_REQUIRED_VARIABLE(PRE_CONFIGURE_DOXYGEN_VERSION_FILE) - CHECK_REQUIRED_VARIABLE(POST_CONFIGURE_DOXYGEN_VERSION_FILE) --CHECK_OPTIONAL_VARIABLE(DOXY_STATE_FILE "${CMAKE_SOURCE_DIR}/VERSION") -+CHECK_OPTIONAL_VARIABLE(DOXY_STATE_FILE "${PROJECT_SOURCE_DIR}/VERSION") - - # Function: DoxygenStateChangedAction - # Description: this function is executed when the ---- cmake/git_watcher.cmake -+++ cmake/git_watcher.cmake -@@ -64,7 +64,7 @@ - CHECK_REQUIRED_VARIABLE(POST_CONFIGURE_GIT_VERSION_FILE) - CHECK_OPTIONAL_VARIABLE(GIT_STATE_FILE "${GENERATED_SRC}/git_state") - #CHECK_REQUIRED_VARIABLE(GIT_STATE_FILE) --CHECK_OPTIONAL_VARIABLE(GIT_WORKING_DIR "${CMAKE_SOURCE_DIR}") -+CHECK_OPTIONAL_VARIABLE(GIT_WORKING_DIR "${PROJECT_SOURCE_DIR}") - - # Check the optional git variable. - # If it's not set, we'll try to find it using the CMake packaging system. ---- doc/CMakeLists.txt -+++ doc/CMakeLists.txt -@@ -107,8 +107,8 @@ - - foreach (f ${DOC_FILES}) - add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/${f} -- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/ -- DEPENDS ${CMAKE_SOURCE_DIR}/doc/${f} -+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/ -+ DEPENDS ${PROJECT_SOURCE_DIR}/doc/${f} - ) - set_source_files_properties(${PROJECT_BINARY_DIR}/doc/${f} PROPERTIES GENERATED 1) - list(APPEND OUT_DOC_FILES "${PROJECT_BINARY_DIR}/doc/${f}") -@@ -116,23 +116,23 @@ - - foreach (f ${DOC_FILES_CHM}) - add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/${f} -- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/ -- DEPENDS ${CMAKE_SOURCE_DIR}/doc/${f} -+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/ -+ DEPENDS ${PROJECT_SOURCE_DIR}/doc/${f} - ) - set_source_files_properties(${PROJECT_BINARY_DIR}/doc/${f} PROPERTIES GENERATED 1) - list(APPEND OUT_DOC_CHM_FILES "${PROJECT_BINARY_DIR}/doc/${f}") - endforeach() - --configure_file(${CMAKE_SOURCE_DIR}/doc/manual.sty ${PROJECT_BINARY_DIR}/doc/manual.sty) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxygen_manual.tex ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxygen.1 ${PROJECT_BINARY_DIR}/man/doxygen.1) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxywizard.1 ${PROJECT_BINARY_DIR}/man/doxywizard.1) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxysearch.1 ${PROJECT_BINARY_DIR}/man/doxysearch.1) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxyindexer.1 ${PROJECT_BINARY_DIR}/man/doxyindexer.1) -+configure_file(${PROJECT_SOURCE_DIR}/doc/manual.sty ${PROJECT_BINARY_DIR}/doc/manual.sty) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxygen_manual.tex ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxygen.1 ${PROJECT_BINARY_DIR}/man/doxygen.1) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxywizard.1 ${PROJECT_BINARY_DIR}/man/doxywizard.1) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxysearch.1 ${PROJECT_BINARY_DIR}/man/doxysearch.1) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxyindexer.1 ${PROJECT_BINARY_DIR}/man/doxyindexer.1) - - # doc/language.doc (see tag Doxyfile:INPUT) - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} translator.py ${CMAKE_SOURCE_DIR} -+ COMMAND ${PYTHON_EXECUTABLE} translator.py ${PROJECT_SOURCE_DIR} - DEPENDS ${PROJECT_BINARY_DIR}/doc/maintainers.txt ${PROJECT_BINARY_DIR}/doc/language.tpl ${PROJECT_BINARY_DIR}/doc/translator.py - OUTPUT language.doc - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc -@@ -163,7 +163,7 @@ - COMMAND ${CMAKE_COMMAND} -E remove refman.tex - COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex . - COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc/manual.sty . -- COMMAND ${EPSTOPDF} ${CMAKE_SOURCE_DIR}/doc/doxygen_logo.eps --outfile=doxygen_logo.pdf -+ COMMAND ${EPSTOPDF} ${PROJECT_SOURCE_DIR}/doc/doxygen_logo.eps --outfile=doxygen_logo.pdf - COMMAND ${PDFLATEX} -shell-escape doxygen_manual.tex - COMMAND ${MAKEINDEX} doxygen_manual.idx - COMMAND ${PDFLATEX} -shell-escape doxygen_manual.tex ---- examples/CMakeLists.txt -+++ examples/CMakeLists.txt -@@ -1,6 +1,6 @@ - file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/examples - ${PROJECT_BINARY_DIR}/html/examples) --file(GLOB EXAMPLE_FILES RELATIVE ${CMAKE_SOURCE_DIR}/examples "*") -+file(GLOB EXAMPLE_FILES RELATIVE ${PROJECT_SOURCE_DIR}/examples "*") - - if (DOT) - set(DIAGRAM_EXAMPLE ${PROJECT_BINARY_DIR}/html/examples/diagrams/html/index.html) -@@ -8,8 +8,8 @@ - - foreach (f ${EXAMPLE_FILES}) - add_custom_command( -- COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/examples/${f}" "${PROJECT_BINARY_DIR}/examples/" -- DEPENDS "${CMAKE_SOURCE_DIR}/examples/${f}" -+ COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/examples/${f}" "${PROJECT_BINARY_DIR}/examples/" -+ DEPENDS "${PROJECT_SOURCE_DIR}/examples/${f}" - OUTPUT "${PROJECT_BINARY_DIR}/examples/${f}" - ) - set_source_files_properties("${PROJECT_BINARY_DIR}/examples/${f}" PROPERTIES GENERATED 1) ---- libmscgen/CMakeLists.txt -+++ libmscgen/CMakeLists.txt -@@ -1,14 +1,14 @@ - include_directories( -- ${CMAKE_SOURCE_DIR}/liblodepng -- ${CMAKE_SOURCE_DIR}/libmscgen -+ ${PROJECT_SOURCE_DIR}/liblodepng -+ ${PROJECT_SOURCE_DIR}/libmscgen - ${GENERATED_SRC} - ) - - set(LEX_FILES mscgen_lexer) - foreach(lex_file ${LEX_FILES}) - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/libmscgen/${lex_file}.l > ${GENERATED_SRC}/${lex_file}.l.h -- DEPENDS ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/libmscgen/${lex_file}.l -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/libmscgen/${lex_file}.l > ${GENERATED_SRC}/${lex_file}.l.h -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/libmscgen/${lex_file}.l - OUTPUT ${GENERATED_SRC}/${lex_file}.l.h - ) - set_source_files_properties(${GENERATED_SRC}/${lex_file}.l.h PROPERTIES GENERATED 1) ---- libversion/CMakeLists.txt -+++ libversion/CMakeLists.txt -@@ -1,16 +1,16 @@ - # vim:ts=4:sw=4:expandtab:autoindent: - - # setup information for doxygen version handling --set(PRE_CONFIGURE_DOXYGEN_VERSION_FILE "${CMAKE_SOURCE_DIR}/libversion/doxyversion.cpp.in") -+set(PRE_CONFIGURE_DOXYGEN_VERSION_FILE "${PROJECT_SOURCE_DIR}/libversion/doxyversion.cpp.in") - set(POST_CONFIGURE_DOXYGEN_VERSION_FILE "${GENERATED_SRC}/doxyversion.cpp") - - # setup information for git version handling --set(PRE_CONFIGURE_GIT_VERSION_FILE "${CMAKE_SOURCE_DIR}/libversion/gitversion.cpp.in") -+set(PRE_CONFIGURE_GIT_VERSION_FILE "${PROJECT_SOURCE_DIR}/libversion/gitversion.cpp.in") - set(POST_CONFIGURE_GIT_VERSION_FILE "${GENERATED_SRC}/gitversion.cpp") - set(GIT_STATE_FILE "${GENERATED_SRC}/git_state") - --include(${CMAKE_SOURCE_DIR}/cmake/git_watcher.cmake) --include(${CMAKE_SOURCE_DIR}/cmake/doxygen_version.cmake) -+include(${PROJECT_SOURCE_DIR}/cmake/git_watcher.cmake) -+include(${PROJECT_SOURCE_DIR}/cmake/doxygen_version.cmake) - - include_directories( - . ---- src/CMakeLists.txt -+++ src/CMakeLists.txt -@@ -1,20 +1,20 @@ - # vim:ts=4:sw=4:expandtab:autoindent: - - include_directories( -- ${CMAKE_SOURCE_DIR}/qtools -- ${CMAKE_SOURCE_DIR}/libmd5 -- ${CMAKE_SOURCE_DIR}/liblodepng -- ${CMAKE_SOURCE_DIR}/libmscgen -- ${CMAKE_SOURCE_DIR}/libversion -- ${CMAKE_SOURCE_DIR}/vhdlparser -- ${CMAKE_SOURCE_DIR}/src -+ ${PROJECT_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/libmd5 -+ ${PROJECT_SOURCE_DIR}/liblodepng -+ ${PROJECT_SOURCE_DIR}/libmscgen -+ ${PROJECT_SOURCE_DIR}/libversion -+ ${PROJECT_SOURCE_DIR}/vhdlparser -+ ${PROJECT_SOURCE_DIR}/src - ${CLANG_INCLUDEDIR} - ${GENERATED_SRC} - ) - - - file(MAKE_DIRECTORY ${GENERATED_SRC}) --file(GLOB LANGUAGE_FILES "${CMAKE_SOURCE_DIR}/src/translator_??.h") -+file(GLOB LANGUAGE_FILES "${PROJECT_SOURCE_DIR}/src/translator_??.h") - - # instead of increasebuffer.py - add_definitions(-DYY_BUF_SIZE=${enlarge_lex_buffers} -DYY_READ_BUF_SIZE=${enlarge_lex_buffers}) -@@ -35,8 +35,8 @@ - - # configvalues.h - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/configgen.py -maph ${CMAKE_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configvalues.h -- DEPENDS ${CMAKE_SOURCE_DIR}/src/config.xml ${CMAKE_SOURCE_DIR}/src/configgen.py -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/configgen.py -maph ${PROJECT_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configvalues.h -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/config.xml ${PROJECT_SOURCE_DIR}/src/configgen.py - OUTPUT ${GENERATED_SRC}/configvalues.h - ) - set_source_files_properties(${GENERATED_SRC}/configvalues.h PROPERTIES GENERATED 1) -@@ -47,16 +47,16 @@ - - # configvalues.cpp - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/configgen.py -maps ${CMAKE_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configvalues.cpp -- DEPENDS ${CMAKE_SOURCE_DIR}/src/config.xml ${CMAKE_SOURCE_DIR}/src/configgen.py -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/configgen.py -maps ${PROJECT_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configvalues.cpp -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/config.xml ${PROJECT_SOURCE_DIR}/src/configgen.py - OUTPUT ${GENERATED_SRC}/configvalues.cpp - ) - set_source_files_properties(${GENERATED_SRC}/configvalues.cpp PROPERTIES GENERATED 1) - - # configoptions.cpp - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/configgen.py -cpp ${CMAKE_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configoptions.cpp -- DEPENDS ${CMAKE_SOURCE_DIR}/src/config.xml ${CMAKE_SOURCE_DIR}/src/configgen.py -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/configgen.py -cpp ${PROJECT_SOURCE_DIR}/src/config.xml > ${GENERATED_SRC}/configoptions.cpp -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/config.xml ${PROJECT_SOURCE_DIR}/src/configgen.py - OUTPUT ${GENERATED_SRC}/configoptions.cpp - ) - set_source_files_properties(${GENERATED_SRC}/configoptions.cpp PROPERTIES GENERATED 1) -@@ -64,8 +64,8 @@ - - # ce_parse.h - add_custom_command( -- COMMAND ${BISON_EXECUTABLE} -l -d -p ce_parsexpYY ${CMAKE_SOURCE_DIR}/src/constexp.y -o ce_parse.c -- DEPENDS ${CMAKE_SOURCE_DIR}/src/constexp.y -+ COMMAND ${BISON_EXECUTABLE} -l -d -p ce_parsexpYY ${PROJECT_SOURCE_DIR}/src/constexp.y -o ce_parse.c -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/constexp.y - OUTPUT ${GENERATED_SRC}/ce_parse.h - WORKING_DIRECTORY ${GENERATED_SRC} - ) -@@ -74,19 +74,19 @@ - # lang_cfg.h - add_custom_command( - COMMENT "Generating ${GENERATED_SRC}/lang_cfg.h" -- COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/lang_cfg.cmake ${GENERATED_SRC}/lang_cfg.h ${LANG_CODES} -+ COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/lang_cfg.cmake ${GENERATED_SRC}/lang_cfg.h ${LANG_CODES} - DEPENDS ${LANGUAGE_FILES} - OUTPUT ${GENERATED_SRC}/lang_cfg.h - ) - set_source_files_properties(${GENERATED_SRC}/lang_cfg.h PROPERTIES GENERATED 1) - - # all resource files --file(GLOB RESOURCES ${CMAKE_SOURCE_DIR}/templates/*/*) -+file(GLOB RESOURCES ${PROJECT_SOURCE_DIR}/templates/*/*) - - # resources.cpp - add_custom_command( - COMMENT "Generating ${GENERATED_SRC}/resources.cpp" -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/res2cc_cmd.py ${CMAKE_SOURCE_DIR}/templates ${GENERATED_SRC}/resources.cpp -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/res2cc_cmd.py ${PROJECT_SOURCE_DIR}/templates ${GENERATED_SRC}/resources.cpp - DEPENDS ${RESOURCES} - OUTPUT ${GENERATED_SRC}/resources.cpp - ) -@@ -94,8 +94,8 @@ - - # layout_default.xml - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/to_c_cmd.py < ${CMAKE_SOURCE_DIR}/src/layout_default.xml > ${GENERATED_SRC}/layout_default.xml.h -- DEPENDS ${CMAKE_SOURCE_DIR}/src/layout_default.xml -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/to_c_cmd.py < ${PROJECT_SOURCE_DIR}/src/layout_default.xml > ${GENERATED_SRC}/layout_default.xml.h -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/layout_default.xml - OUTPUT ${GENERATED_SRC}/layout_default.xml.h - ) - set_source_files_properties(${GENERATED_SRC}/layout_default.xml.h PROPERTIES GENERATED 1) -@@ -123,8 +123,8 @@ - set(LEX_FILES_H ${LEX_FILES_H} " " ${GENERATED_SRC}/${lex_file}.l.h CACHE INTERNAL "Stores generated files") - set(LEX_FILES_CPP ${LEX_FILES_CPP} " " ${GENERATED_SRC}/${lex_file}.cpp CACHE INTERNAL "Stores generated files") - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/src/${lex_file}.l > ${GENERATED_SRC}/${lex_file}.l.h -- DEPENDS ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/src/${lex_file}.l -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/src/${lex_file}.l > ${GENERATED_SRC}/${lex_file}.l.h -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/src/${lex_file}.l - OUTPUT ${GENERATED_SRC}/${lex_file}.l.h - ) - set_source_files_properties(${GENERATED_SRC}/${lex_file}.l.h PROPERTIES GENERATED 1) ---- testing/CMakeLists.txt -+++ testing/CMakeLists.txt -@@ -1,9 +1,9 @@ - add_custom_target(tests - COMMENT "Running doxygen tests..." -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/testing/runtests.py --doxygen ${PROJECT_BINARY_DIR}/bin/doxygen --inputdir ${CMAKE_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/testing/runtests.py --doxygen ${PROJECT_BINARY_DIR}/bin/doxygen --inputdir ${PROJECT_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing - DEPENDS doxygen - ) - add_test(NAME suite -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/testing/runtests.py --doxygen $ --inputdir ${CMAKE_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/testing/runtests.py --doxygen $ --inputdir ${PROJECT_SOURCE_DIR}/testing --outputdir ${PROJECT_BINARY_DIR}/testing - ) - ---- vhdlparser/CMakeLists.txt -+++ vhdlparser/CMakeLists.txt -@@ -1,14 +1,14 @@ - find_package(Javacc) - if (JAVACC_FOUND) - add_custom_command( -- COMMAND ${JAVACC_EXECUTABLE} ${JAVACC_FLAGS} -OUTPUT_DIRECTORY=${CMAKE_SOURCE_DIR}/vhdlparser ${CMAKE_SOURCE_DIR}/vhdlparser/vhdlparser.jj -- DEPENDS ${CMAKE_SOURCE_DIR}/vhdlparser/vhdlparser.jj -- OUTPUT ${CMAKE_SOURCE_DIR}/vhdlparser/CharStream.cc ${CMAKE_SOURCE_DIR}/vhdlparser/CharStream.h ${CMAKE_SOURCE_DIR}/vhdlparser/ErrorHandler.h ${CMAKE_SOURCE_DIR}/vhdlparser/ParseException.cc ${CMAKE_SOURCE_DIR}/vhdlparser/ParseException.h ${CMAKE_SOURCE_DIR}/vhdlparser/Token.cc ${CMAKE_SOURCE_DIR}/vhdlparser/Token.h ${CMAKE_SOURCE_DIR}/vhdlparser/TokenManager.h ${CMAKE_SOURCE_DIR}/vhdlparser/TokenMgrError.cc ${CMAKE_SOURCE_DIR}/vhdlparser/TokenMgrError.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParser.cc ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParser.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserConstants.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.cc ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.h -+ COMMAND ${JAVACC_EXECUTABLE} ${JAVACC_FLAGS} -OUTPUT_DIRECTORY=${PROJECT_SOURCE_DIR}/vhdlparser ${PROJECT_SOURCE_DIR}/vhdlparser/vhdlparser.jj -+ DEPENDS ${PROJECT_SOURCE_DIR}/vhdlparser/vhdlparser.jj -+ OUTPUT ${PROJECT_SOURCE_DIR}/vhdlparser/CharStream.cc ${PROJECT_SOURCE_DIR}/vhdlparser/CharStream.h ${PROJECT_SOURCE_DIR}/vhdlparser/ErrorHandler.h ${PROJECT_SOURCE_DIR}/vhdlparser/ParseException.cc ${PROJECT_SOURCE_DIR}/vhdlparser/ParseException.h ${PROJECT_SOURCE_DIR}/vhdlparser/Token.cc ${PROJECT_SOURCE_DIR}/vhdlparser/Token.h ${PROJECT_SOURCE_DIR}/vhdlparser/TokenManager.h ${PROJECT_SOURCE_DIR}/vhdlparser/TokenMgrError.cc ${PROJECT_SOURCE_DIR}/vhdlparser/TokenMgrError.h ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParser.cc ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParser.h ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParserConstants.h ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.cc ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.h - ) - - endif() - --include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/qtools ${GENERATED_SRC}) -+include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/qtools ${GENERATED_SRC}) - add_library(vhdlparser STATIC - CharStream.cc - ParseException.cc ---- cmake/FindXapian.cmake -+++ cmake/FindXapian.cmake -@@ -37,6 +37,8 @@ - ENDIF(NOT Xapian_FIND_QUIETLY) - ENDIF(XAPIAN_FOUND) - -+LIST(APPEND XAPIAN_LIBRARIES CONAN_PKG::xapian-core) -+ - # show the XAPIAN_INCLUDE_DIR and XAPIAN_LIBRARIES variables only in the advanced view - MARK_AS_ADVANCED(XAPIAN_INCLUDE_DIR XAPIAN_LIBRARIES) - diff --git a/recipes/doxygen/all/patches/1.8.20-0001-relocatable-cmake.patch b/recipes/doxygen/all/patches/1.8.20-0001-relocatable-cmake.patch deleted file mode 100644 index 74791751691df..0000000000000 --- a/recipes/doxygen/all/patches/1.8.20-0001-relocatable-cmake.patch +++ /dev/null @@ -1,337 +0,0 @@ -Result of running: -- find . -type f -exec sed -i s/CMAKE_SOURCE_DIR/PROJECT_SOURCE_DIR/g {} \; -- find . -type f -exec sed -i s/CMAKE_BINARY_DIR/PROJECT_BINARY_DIR/g {} \; -- fix addon/doxysearch/CMakeLists.txt to use lower case xapian_LIBRARIES and xapian_INCLUDE_DIRS -FIXME: latest should be fixed by conan!!! - ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -34,9 +34,9 @@ - - SET(enlarge_lex_buffers "262144" CACHE INTERNAL "Sets the lex input and read buffers to the specified size") - --list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake") --list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Sanitizers") --set(TOP "${CMAKE_SOURCE_DIR}") -+list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") -+list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Sanitizers") -+set(TOP "${PROJECT_SOURCE_DIR}") - include(version) - - set(sqlite3 "0" CACHE INTERNAL "used in settings.h") -@@ -71,7 +71,7 @@ - if ((NOT CMAKE_GENERATOR MATCHES "MinGW Makefiles") AND - (NOT CMAKE_GENERATOR MATCHES "MSYS Makefiles")) - if (NOT ICONV_DIR) -- set(ICONV_DIR "${CMAKE_SOURCE_DIR}/winbuild") -+ set(ICONV_DIR "${PROJECT_SOURCE_DIR}/winbuild") - endif() - set(CMAKE_REQUIRED_DEFINITIONS "-DLIBICONV_STATIC") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj") # needed for language.cpp on 64bit -@@ -120,10 +120,10 @@ - include_directories(${ICONV_INCLUDE_DIR}) - - --#set(DOXYDOCS ${CMAKE_SOURCE_DIR}/doc CACHE INTERNAL "Path to doxygen docs") -+#set(DOXYDOCS ${PROJECT_SOURCE_DIR}/doc CACHE INTERNAL "Path to doxygen docs") - set(DOXYDOCS ${PROJECT_BINARY_DIR}/doc) - set(ENV{DOXYGEN_DOCDIR} ${DOXYDOCS}) --set(GENERATED_SRC "${CMAKE_BINARY_DIR}/generated_src" CACHE INTERNAL "Stores generated files") -+set(GENERATED_SRC "${PROJECT_BINARY_DIR}/generated_src" CACHE INTERNAL "Stores generated files") - set(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}/lib) - set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin) - -@@ -135,7 +135,7 @@ - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${EXECUTABLE_OUTPUT_PATH}) - - # gather lang codes for translation --file(GLOB lang_files RELATIVE "${CMAKE_SOURCE_DIR}/src" "${CMAKE_SOURCE_DIR}/src/translator_??.h") -+file(GLOB lang_files RELATIVE "${PROJECT_SOURCE_DIR}/src" "${PROJECT_SOURCE_DIR}/src/translator_??.h") - if (english_only) # user only wants English - set(lcodes "ENONLY") - else () ---- addon/doxyparse/CMakeLists.txt -+++ addon/doxyparse/CMakeLists.txt -@@ -1,10 +1,10 @@ - find_package(Iconv) - - include_directories( -- ${CMAKE_SOURCE_DIR}/src -- ${CMAKE_SOURCE_DIR}/libversion -+ ${PROJECT_SOURCE_DIR}/src -+ ${PROJECT_SOURCE_DIR}/libversion - ${GENERATED_SRC} -- ${CMAKE_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/qtools - ${ICONV_INCLUDE_DIR} - ${CLANG_INCLUDEDIR} - ) ---- addon/doxysearch/CMakeLists.txt -+++ addon/doxysearch/CMakeLists.txt -@@ -1,12 +1,12 @@ --find_package(Xapian REQUIRED) -+find_package(xapian REQUIRED) - find_package(ZLIB REQUIRED) - - if (WIN32) -- set(WIN_EXTRA_LIBS "uuid.lib rpcrt4.lib ws2_32.lib") -+ set(WIN_EXTRA_LIBS uuid.lib rpcrt4.lib ws2_32.lib) - endif() - - include_directories( -- ${CMAKE_SOURCE_DIR}/qtools -- ${XAPIAN_INCLUDE_DIR} -+ ${PROJECT_SOURCE_DIR}/qtools -+ ${xapian_INCLUDE_DIR} - ${ZLIB_INCLUDE_DIRS} - ) -@@ -14,7 +14,7 @@ endif() - doxyindexer.cpp - ) - target_link_libraries(doxyindexer -- ${XAPIAN_LIBRARIES} -+ ${xapian_LIBRARIES} - ${ZLIB_LIBRARIES} - ${WIN_EXTRA_LIBS} - ${COVERAGE_LINKER_FLAGS} -@@ -25,7 +25,7 @@ add_executable(doxysearch.cgi - doxysearch.cpp - ) - target_link_libraries(doxysearch.cgi -- ${XAPIAN_LIBRARIES} -+ ${xapian_LIBRARIES} - ${ZLIB_LIBRARIES} - ${WIN_EXTRA_LIBS} - ) ---- cmake/doxygen_version.cmake -+++ cmake/doxygen_version.cmake -@@ -40,7 +40,7 @@ - - CHECK_REQUIRED_VARIABLE(PRE_CONFIGURE_DOXYGEN_VERSION_FILE) - CHECK_REQUIRED_VARIABLE(POST_CONFIGURE_DOXYGEN_VERSION_FILE) --CHECK_OPTIONAL_VARIABLE(DOXY_STATE_FILE "${CMAKE_SOURCE_DIR}/VERSION") -+CHECK_OPTIONAL_VARIABLE(DOXY_STATE_FILE "${PROJECT_SOURCE_DIR}/VERSION") - - # Function: DoxygenStateChangedAction - # Description: this function is executed when the ---- doc/CMakeLists.txt -+++ doc/CMakeLists.txt -@@ -107,8 +107,8 @@ - - foreach (f ${DOC_FILES}) - add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/${f} -- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/ -- DEPENDS ${CMAKE_SOURCE_DIR}/doc/${f} -+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/ -+ DEPENDS ${PROJECT_SOURCE_DIR}/doc/${f} - ) - set_source_files_properties(${PROJECT_BINARY_DIR}/doc/${f} PROPERTIES GENERATED 1) - list(APPEND OUT_DOC_FILES "${PROJECT_BINARY_DIR}/doc/${f}") -@@ -116,24 +116,24 @@ - - foreach (f ${DOC_FILES_CHM}) - add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/doc/${f} -- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/ -- DEPENDS ${CMAKE_SOURCE_DIR}/doc/${f} -+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/doc/${f} ${PROJECT_BINARY_DIR}/doc/ -+ DEPENDS ${PROJECT_SOURCE_DIR}/doc/${f} - ) - set_source_files_properties(${PROJECT_BINARY_DIR}/doc/${f} PROPERTIES GENERATED 1) - list(APPEND OUT_DOC_CHM_FILES "${PROJECT_BINARY_DIR}/doc/${f}") - endforeach() - --configure_file(${CMAKE_SOURCE_DIR}/doc/manual.sty ${PROJECT_BINARY_DIR}/doc/manual.sty) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxygen_manual.tex ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxygen.1 ${PROJECT_BINARY_DIR}/man/doxygen.1) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxywizard.1 ${PROJECT_BINARY_DIR}/man/doxywizard.1) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxysearch.1 ${PROJECT_BINARY_DIR}/man/doxysearch.1) --configure_file(${CMAKE_SOURCE_DIR}/doc/doxyindexer.1 ${PROJECT_BINARY_DIR}/man/doxyindexer.1) -+configure_file(${PROJECT_SOURCE_DIR}/doc/manual.sty ${PROJECT_BINARY_DIR}/doc/manual.sty) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxygen_manual.tex ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxygen.1 ${PROJECT_BINARY_DIR}/man/doxygen.1) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxywizard.1 ${PROJECT_BINARY_DIR}/man/doxywizard.1) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxysearch.1 ${PROJECT_BINARY_DIR}/man/doxysearch.1) -+configure_file(${PROJECT_SOURCE_DIR}/doc/doxyindexer.1 ${PROJECT_BINARY_DIR}/man/doxyindexer.1) - - # doc/language.doc (see tag Doxyfile:INPUT) - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} translator.py ${CMAKE_SOURCE_DIR} -- DEPENDS ${CMAKE_SOURCE_DIR}/doc/maintainers.txt ${CMAKE_SOURCE_DIR}/doc/language.tpl ${PROJECT_BINARY_DIR}/doc/translator.py ${LANG_FILES} -+ COMMAND ${PYTHON_EXECUTABLE} translator.py ${PROJECT_SOURCE_DIR} -+ DEPENDS ${PROJECT_SOURCE_DIR}/doc/maintainers.txt ${PROJECT_SOURCE_DIR}/doc/language.tpl ${PROJECT_BINARY_DIR}/doc/translator.py ${LANG_FILES} - OUTPUT language.doc - WORKING_DIRECTORY ${PROJECT_BINARY_DIR}/doc - ) -@@ -163,7 +163,7 @@ - COMMAND ${CMAKE_COMMAND} -E remove refman.tex - COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc/doxygen_manual.tex . - COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_BINARY_DIR}/doc/manual.sty . -- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/doc/doxygen_logo.pdf . -+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/doc/doxygen_logo.pdf . - COMMAND ${PDFLATEX} -shell-escape doxygen_manual.tex - COMMAND ${MAKEINDEX} doxygen_manual.idx - COMMAND ${PDFLATEX} -shell-escape doxygen_manual.tex ---- examples/CMakeLists.txt -+++ examples/CMakeLists.txt -@@ -1,6 +1,6 @@ - file(MAKE_DIRECTORY ${PROJECT_BINARY_DIR}/examples - ${PROJECT_BINARY_DIR}/html/examples) --file(GLOB EXAMPLE_FILES RELATIVE ${CMAKE_SOURCE_DIR}/examples "*") -+file(GLOB EXAMPLE_FILES RELATIVE ${PROJECT_SOURCE_DIR}/examples "*") - - if (DOT) - set(DIAGRAM_EXAMPLE ${PROJECT_BINARY_DIR}/html/examples/diagrams/html/index.html) -@@ -8,8 +8,8 @@ - - foreach (f ${EXAMPLE_FILES}) - add_custom_command( -- COMMAND ${CMAKE_COMMAND} -E copy "${CMAKE_SOURCE_DIR}/examples/${f}" "${PROJECT_BINARY_DIR}/examples/" -- DEPENDS "${CMAKE_SOURCE_DIR}/examples/${f}" -+ COMMAND ${CMAKE_COMMAND} -E copy "${PROJECT_SOURCE_DIR}/examples/${f}" "${PROJECT_BINARY_DIR}/examples/" -+ DEPENDS "${PROJECT_SOURCE_DIR}/examples/${f}" - OUTPUT "${PROJECT_BINARY_DIR}/examples/${f}" - ) - set_source_files_properties("${PROJECT_BINARY_DIR}/examples/${f}" PROPERTIES GENERATED 1) ---- libmscgen/CMakeLists.txt -+++ libmscgen/CMakeLists.txt -@@ -1,14 +1,14 @@ - include_directories( -- ${CMAKE_SOURCE_DIR}/liblodepng -- ${CMAKE_SOURCE_DIR}/libmscgen -+ ${PROJECT_SOURCE_DIR}/liblodepng -+ ${PROJECT_SOURCE_DIR}/libmscgen - ${GENERATED_SRC} - ) - - set(LEX_FILES mscgen_lexer) - foreach(lex_file ${LEX_FILES}) - add_custom_command( -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/libmscgen/${lex_file}.l > ${GENERATED_SRC}/${lex_file}.l.h -- DEPENDS ${CMAKE_SOURCE_DIR}/src/scan_states.py ${CMAKE_SOURCE_DIR}/libmscgen/${lex_file}.l -+ COMMAND ${PYTHON_EXECUTABLE} ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/libmscgen/${lex_file}.l > ${GENERATED_SRC}/${lex_file}.l.h -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/scan_states.py ${PROJECT_SOURCE_DIR}/libmscgen/${lex_file}.l - OUTPUT ${GENERATED_SRC}/${lex_file}.l.h - ) - set_source_files_properties(${GENERATED_SRC}/${lex_file}.l.h PROPERTIES GENERATED 1) ---- libversion/CMakeLists.txt -+++ libversion/CMakeLists.txt -@@ -1,16 +1,16 @@ - # vim:ts=4:sw=4:expandtab:autoindent: - - # setup information for doxygen version handling --set(PRE_CONFIGURE_DOXYGEN_VERSION_FILE "${CMAKE_SOURCE_DIR}/libversion/doxyversion.cpp.in") -+set(PRE_CONFIGURE_DOXYGEN_VERSION_FILE "${PROJECT_SOURCE_DIR}/libversion/doxyversion.cpp.in") - set(POST_CONFIGURE_DOXYGEN_VERSION_FILE "${GENERATED_SRC}/doxyversion.cpp") - - # setup information for git version handling --set(PRE_CONFIGURE_GIT_VERSION_FILE "${CMAKE_SOURCE_DIR}/libversion/gitversion.cpp.in") -+set(PRE_CONFIGURE_GIT_VERSION_FILE "${PROJECT_SOURCE_DIR}/libversion/gitversion.cpp.in") - set(POST_CONFIGURE_GIT_VERSION_FILE "${GENERATED_SRC}/gitversion.cpp") - set(GIT_STATE_FILE "${GENERATED_SRC}/git_state") - --include(${CMAKE_SOURCE_DIR}/cmake/git_watcher.cmake) --include(${CMAKE_SOURCE_DIR}/cmake/doxygen_version.cmake) -+include(${PROJECT_SOURCE_DIR}/cmake/git_watcher.cmake) -+include(${PROJECT_SOURCE_DIR}/cmake/doxygen_version.cmake) - - include_directories( - . ---- src/CMakeLists.txt -+++ src/CMakeLists.txt -@@ -1,13 +1,13 @@ - # vim:ts=4:sw=4:expandtab:autoindent: - - include_directories( -- ${CMAKE_SOURCE_DIR}/qtools -- ${CMAKE_SOURCE_DIR}/libmd5 -- ${CMAKE_SOURCE_DIR}/liblodepng -- ${CMAKE_SOURCE_DIR}/libmscgen -- ${CMAKE_SOURCE_DIR}/libversion -- ${CMAKE_SOURCE_DIR}/vhdlparser -- ${CMAKE_SOURCE_DIR}/src -+ ${PROJECT_SOURCE_DIR}/qtools -+ ${PROJECT_SOURCE_DIR}/libmd5 -+ ${PROJECT_SOURCE_DIR}/liblodepng -+ ${PROJECT_SOURCE_DIR}/libmscgen -+ ${PROJECT_SOURCE_DIR}/libversion -+ ${PROJECT_SOURCE_DIR}/vhdlparser -+ ${PROJECT_SOURCE_DIR}/src - ${CLANG_INCLUDEDIR} - ${GENERATED_SRC} - ) -@@ -78,7 +78,7 @@ - # lang_cfg.h - add_custom_command( - COMMENT "Generating ${GENERATED_SRC}/lang_cfg.h" -- COMMAND ${CMAKE_COMMAND} -P ${CMAKE_SOURCE_DIR}/cmake/lang_cfg.cmake ${GENERATED_SRC}/lang_cfg.h ${LANG_CODES} -+ COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/cmake/lang_cfg.cmake ${GENERATED_SRC}/lang_cfg.h ${LANG_CODES} - DEPENDS ${LANGUAGE_FILES} - OUTPUT ${GENERATED_SRC}/lang_cfg.h - ) -@@ -86,15 +86,15 @@ - - # all resource files - if (${CMAKE_VERSION} VERSION_EQUAL "3.11.0" OR ${CMAKE_VERSION} VERSION_GREATER "3.11.0") -- file(GLOB RESOURCES CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/templates/*/*) -+ file(GLOB RESOURCES CONFIGURE_DEPENDS ${PROJECT_SOURCE_DIR}/templates/*/*) - else() -- file(GLOB RESOURCES ${CMAKE_SOURCE_DIR}/templates/*/*) -+ file(GLOB RESOURCES ${PROJECT_SOURCE_DIR}/templates/*/*) - endif() - - # resources.cpp - add_custom_command( - COMMENT "Generating ${GENERATED_SRC}/resources.cpp" -- COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/res2cc_cmd.py ${CMAKE_SOURCE_DIR}/templates ${GENERATED_SRC}/resources.cpp -+ COMMAND ${PYTHON_EXECUTABLE} ${CMAKE_CURRENT_LIST_DIR}/res2cc_cmd.py ${PROJECT_SOURCE_DIR}/templates ${GENERATED_SRC}/resources.cpp - DEPENDS ${RESOURCES} ${CMAKE_CURRENT_LIST_DIR}/res2cc_cmd.py - OUTPUT ${GENERATED_SRC}/resources.cpp - ) -@@ -138,9 +138,9 @@ - set_source_files_properties(${GENERATED_SRC}/${lex_file}.l.h PROPERTIES GENERATED 1) - # for code coverage we need the flex sources in the build src directory - add_custom_command( -- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/${lex_file}.l ${CMAKE_BINARY_DIR}/src/${lex_file}.l -- DEPENDS ${CMAKE_SOURCE_DIR}/src/${lex_file}.l -- OUTPUT ${CMAKE_BINARY_DIR}/src/${lex_file}.l -+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/src/${lex_file}.l ${PROJECT_BINARY_DIR}/src/${lex_file}.l -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/${lex_file}.l -+ OUTPUT ${PROJECT_BINARY_DIR}/src/${lex_file}.l - ) - - FLEX_TARGET(${lex_file} -@@ -156,9 +156,9 @@ - COMPILE_FLAGS "${YACC_FLAGS}") - - add_custom_command( -- COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/src/constexp.y ${CMAKE_BINARY_DIR}/src -- DEPENDS ${CMAKE_SOURCE_DIR}/src/constexp.y -- OUTPUT ${CMAKE_BINARY_DIR}/src/constexp.y -+ COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/src/constexp.y ${PROJECT_BINARY_DIR}/src -+ DEPENDS ${PROJECT_SOURCE_DIR}/src/constexp.y -+ OUTPUT ${PROJECT_BINARY_DIR}/src/constexp.y - ) - - add_library(doxycfg STATIC ---- vhdlparser/CMakeLists.txt -+++ vhdlparser/CMakeLists.txt -@@ -21,15 +21,15 @@ - else() - - add_custom_command( -- COMMAND ${JAVACC_EXECUTABLE} ${JAVACC_FLAGS} -OUTPUT_DIRECTORY=${CMAKE_SOURCE_DIR}/vhdlparser ${CMAKE_SOURCE_DIR}/vhdlparser/vhdlparser.jj -- DEPENDS ${CMAKE_SOURCE_DIR}/vhdlparser/vhdlparser.jj -- OUTPUT ${CMAKE_SOURCE_DIR}/vhdlparser/CharStream.cc ${CMAKE_SOURCE_DIR}/vhdlparser/CharStream.h ${CMAKE_SOURCE_DIR}/vhdlparser/ErrorHandler.h ${CMAKE_SOURCE_DIR}/vhdlparser/ParseException.cc ${CMAKE_SOURCE_DIR}/vhdlparser/ParseException.h ${CMAKE_SOURCE_DIR}/vhdlparser/Token.cc ${CMAKE_SOURCE_DIR}/vhdlparser/Token.h ${CMAKE_SOURCE_DIR}/vhdlparser/TokenManager.h ${CMAKE_SOURCE_DIR}/vhdlparser/TokenMgrError.cc ${CMAKE_SOURCE_DIR}/vhdlparser/TokenMgrError.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParser.cc ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParser.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserConstants.h ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.cc ${CMAKE_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.h -+ COMMAND ${JAVACC_EXECUTABLE} ${JAVACC_FLAGS} -OUTPUT_DIRECTORY=${PROJECT_SOURCE_DIR}/vhdlparser ${PROJECT_SOURCE_DIR}/vhdlparser/vhdlparser.jj -+ DEPENDS ${PROJECT_SOURCE_DIR}/vhdlparser/vhdlparser.jj -+ OUTPUT ${PROJECT_SOURCE_DIR}/vhdlparser/CharStream.cc ${PROJECT_SOURCE_DIR}/vhdlparser/CharStream.h ${PROJECT_SOURCE_DIR}/vhdlparser/ErrorHandler.h ${PROJECT_SOURCE_DIR}/vhdlparser/ParseException.cc ${PROJECT_SOURCE_DIR}/vhdlparser/ParseException.h ${PROJECT_SOURCE_DIR}/vhdlparser/Token.cc ${PROJECT_SOURCE_DIR}/vhdlparser/Token.h ${PROJECT_SOURCE_DIR}/vhdlparser/TokenManager.h ${PROJECT_SOURCE_DIR}/vhdlparser/TokenMgrError.cc ${PROJECT_SOURCE_DIR}/vhdlparser/TokenMgrError.h ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParser.cc ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParser.h ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParserConstants.h ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.cc ${PROJECT_SOURCE_DIR}/vhdlparser/VhdlParserTokenManager.h - ) - - endif() - endif() - --include_directories(${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/qtools ${GENERATED_SRC}) -+include_directories(${PROJECT_SOURCE_DIR}/src ${PROJECT_SOURCE_DIR}/qtools ${GENERATED_SRC}) - add_library(vhdlparser STATIC - CharStream.cc - ParseException.cc diff --git a/recipes/doxygen/all/patches/1.9.1-0001-imported-target.patch b/recipes/doxygen/all/patches/1.9.1-0001-imported-target.patch index 53f65acfedfa3..170bfd9753ce3 100644 --- a/recipes/doxygen/all/patches/1.9.1-0001-imported-target.patch +++ b/recipes/doxygen/all/patches/1.9.1-0001-imported-target.patch @@ -1,25 +1,3 @@ -diff --git a/addon/doxysearch/CMakeLists.txt b/addon/doxysearch/CMakeLists.txt -index d0c8724..ac66577 100644 ---- addon/doxysearch/CMakeLists.txt -+++ addon/doxysearch/CMakeLists.txt -@@ -15,7 +15,7 @@ add_executable(doxyindexer - doxyindexer.cpp - ) - target_link_libraries(doxyindexer -- ${XAPIAN_LIBRARIES} -+ CONAN_PKG::xapian-core - ${ZLIB_LIBRARIES} - ${WIN_EXTRA_LIBS} - ${COVERAGE_LINKER_FLAGS} -@@ -28,7 +28,7 @@ add_executable(doxysearch.cgi - ) - target_link_libraries(doxysearch.cgi - doxygen_version -- ${XAPIAN_LIBRARIES} -+ CONAN_PKG::xapian-core - ${ZLIB_LIBRARIES} - ${WIN_EXTRA_LIBS} - ) diff --git a/libmscgen/mscgen_bool.h b/libmscgen/mscgen_bool.h index e982d80..d16ef98 100644 --- libmscgen/mscgen_bool.h diff --git a/recipes/doxygen/all/patches/1.9.2-0001-imported-target.patch b/recipes/doxygen/all/patches/1.9.2-0001-imported-target.patch index 57875eaf4cec1..aa88aa13aa307 100644 --- a/recipes/doxygen/all/patches/1.9.2-0001-imported-target.patch +++ b/recipes/doxygen/all/patches/1.9.2-0001-imported-target.patch @@ -1,23 +1,3 @@ ---- addon/doxysearch/CMakeLists.txt -+++ addon/doxysearch/CMakeLists.txt -@@ -15,7 +15,7 @@ - doxyindexer.cpp - ) - target_link_libraries(doxyindexer -- ${XAPIAN_LIBRARIES} -+ CONAN_PKG::xapian-core - ${ZLIB_LIBRARIES} - ${WIN_EXTRA_LIBS} - ${COVERAGE_LINKER_FLAGS} -@@ -28,7 +28,7 @@ add_executable(doxysearch.cgi - ) - target_link_libraries(doxysearch.cgi - doxygen_version -- ${XAPIAN_LIBRARIES} -+ CONAN_PKG::xapian-core - ${ZLIB_LIBRARIES} - ${WIN_EXTRA_LIBS} - ) --- libmscgen/mscgen_bool.h +++ libmscgen/mscgen_bool.h @@ -23,6 +23,14 @@ diff --git a/recipes/doxygen/all/test_package/CMakeLists.txt b/recipes/doxygen/all/test_package/CMakeLists.txt index 08bb0b438cb03..b6fd34c4e5056 100644 --- a/recipes/doxygen/all/test_package/CMakeLists.txt +++ b/recipes/doxygen/all/test_package/CMakeLists.txt @@ -1,7 +1,6 @@ -cmake_minimum_required(VERSION 3.3) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +project(test_package) find_package(Doxygen REQUIRED) diff --git a/recipes/doxygen/all/test_package/conanfile.py b/recipes/doxygen/all/test_package/conanfile.py index a0fbd76152051..1778a98f9bbef 100644 --- a/recipes/doxygen/all/test_package/conanfile.py +++ b/recipes/doxygen/all/test_package/conanfile.py @@ -1,20 +1,29 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +from conan.errors import ConanException import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): - if not tools.cross_building(self, skip_x64_x86=True): + if can_run(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self, skip_x64_x86=True): + if can_run(self): if not os.path.isdir(os.path.join(self.build_folder, "html")): raise ConanException("doxygen did not create html documentation directory") diff --git a/recipes/doxygen/all/test_v1_package/CMakeLists.txt b/recipes/doxygen/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..08bb0b438cb03 --- /dev/null +++ b/recipes/doxygen/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.3) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) + +find_package(Doxygen REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) + +doxygen_add_docs(docs test_package.cpp ALL COMMENT "generate HTML") diff --git a/recipes/doxygen/all/test_v1_package/conanfile.py b/recipes/doxygen/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a0fbd76152051 --- /dev/null +++ b/recipes/doxygen/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanException +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + if not tools.cross_building(self, skip_x64_x86=True): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self, skip_x64_x86=True): + if not os.path.isdir(os.path.join(self.build_folder, "html")): + raise ConanException("doxygen did not create html documentation directory") + + self.output.info("Version:") + self.run("doxygen --version", run_environment=True) diff --git a/recipes/doxygen/all/test_v1_package/test_package.cpp b/recipes/doxygen/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..4caefdf4a378f --- /dev/null +++ b/recipes/doxygen/all/test_v1_package/test_package.cpp @@ -0,0 +1,8 @@ +#include + +/// \brief just a simple main function for the hello world +int main() +{ + std::cout << "bincrafters" << std::endl; + return 0; +} diff --git a/recipes/draco/all/conandata.yml b/recipes/draco/all/conandata.yml index 1870fef6caf18..5105546d4c2a2 100644 --- a/recipes/draco/all/conandata.yml +++ b/recipes/draco/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.5.5": + url: "https://github.com/google/draco/archive/refs/tags/1.5.5.tar.gz" + sha256: "6b7994150bbc513abcdbe22ad778d6b2df10fc8cdc7035e916985b2a209ab826" + "1.5.4": + url: "https://github.com/google/draco/archive/refs/tags/1.5.4.tar.gz" + sha256: "7698cce91c24725562fb73811d24823f0f0a25e3ac0941e792993c5191d3baee" "1.5.3": url: "https://github.com/google/draco/archive/refs/tags/1.5.3.tar.gz" sha256: "7882a942a1da14a9ae9d557b1a3af7f44bdee7f5d42b745c4e474fb8b28d4e5e" diff --git a/recipes/draco/all/conanfile.py b/recipes/draco/all/conanfile.py index c2b1fa42ec123..fcf412b2c827e 100644 --- a/recipes/draco/all/conanfile.py +++ b/recipes/draco/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rm, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class DracoConan(ConanFile): @@ -43,27 +43,29 @@ class DracoConan(ConanFile): short_paths = True def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass if not self.options.enable_mesh_compression: del self.options.enable_standard_edgebreaker del self.options.enable_predictive_edgebreaker - if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) diff --git a/recipes/draco/all/test_package/conanfile.py b/recipes/draco/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/draco/all/test_package/conanfile.py +++ b/recipes/draco/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/draco/all/test_v1_package/conanfile.py b/recipes/draco/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/draco/all/test_v1_package/conanfile.py +++ b/recipes/draco/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/draco/config.yml b/recipes/draco/config.yml index fca6d7abd2366..1d0bf1ab356f5 100644 --- a/recipes/draco/config.yml +++ b/recipes/draco/config.yml @@ -1,4 +1,8 @@ versions: + "1.5.5": + folder: all + "1.5.4": + folder: all "1.5.3": folder: all "1.5.2": diff --git a/recipes/dragonbox/all/conandata.yml b/recipes/dragonbox/all/conandata.yml new file mode 100644 index 0000000000000..fbf31246d5c77 --- /dev/null +++ b/recipes/dragonbox/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.1.3": + url: "https://github.com/jk-jeon/dragonbox/archive/refs/tags/1.1.3.tar.gz" + sha256: "09d63b05e9c594ec423778ab59b7a5aa1d76fdd71d25c7048b0258c4ec9c3384" +patches: + "1.1.3": + - patch_file: "patches/1.1.3-fix-include-directory.patch" + patch_description: "fix include path" + patch_type: "conan" diff --git a/recipes/dragonbox/all/conanfile.py b/recipes/dragonbox/all/conanfile.py new file mode 100644 index 0000000000000..89c3a6984496c --- /dev/null +++ b/recipes/dragonbox/all/conanfile.py @@ -0,0 +1,98 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout + +import os + + +required_conan_version = ">=1.53.0" + + +class DragonboxConan(ConanFile): + name = "dragonbox" + description = "Reference implementation of Dragonbox in C++" + license = ("Apache-2.0", "LLVM-exception", "BSL-1.0") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jk-jeon/dragonbox" + topics = ("float-to-string", "grisu", "grisu-exact") + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["DRAGONBOX_INSTALL_TO_CHARS"] = True + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.set_property("cmake_module_file_name", "dragonbox") + self.cpp_info.components["_dragonbox"].set_property("cmake_target_name", "dragonbox::dragonbox") + self.cpp_info.components["dragonbox_to_chars_headers"].set_property("cmake_target_name", "dragonbox::dragonbox_to_chars") + self.cpp_info.components["dragonbox_to_chars_headers"].libs = ["dragonbox_to_chars"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "dragonbox" + self.cpp_info.filenames["cmake_find_package_multi"] = "dragonbox" + self.cpp_info.names["cmake_find_package"] = "dragonbox" + self.cpp_info.names["cmake_find_package_multi"] = "dragonbox" + self.cpp_info.components["_dragonbox"].names["cmake_find_package"] = "dragonbox" + self.cpp_info.components["_dragonbox"].names["cmake_find_package_multi"] = "dragonbox" + self.cpp_info.components["dragonbox_to_chars_headers"].names["cmake_find_package"] = "dragonbox_to_chars" + self.cpp_info.components["dragonbox_to_chars_headers"].names["cmake_find_package_multi"] = "dragonbox_to_chars" diff --git a/recipes/dragonbox/all/patches/1.1.3-fix-include-directory.patch b/recipes/dragonbox/all/patches/1.1.3-fix-include-directory.patch new file mode 100644 index 0000000000000..906ca02b2235e --- /dev/null +++ b/recipes/dragonbox/all/patches/1.1.3-fix-include-directory.patch @@ -0,0 +1,13 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index a9d80b9..e0417d7 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -58,7 +58,7 @@ option(DRAGONBOX_INSTALL_TO_CHARS + On) + + set(dragonbox_directory "dragonbox-${PROJECT_VERSION}") +-set(dragonbox_include_directory "${CMAKE_INSTALL_INCLUDEDIR}/${dragonbox_directory}") ++set(dragonbox_include_directory "${CMAKE_INSTALL_INCLUDEDIR}") + set(dragonbox_install_targets "dragonbox") + + if (DRAGONBOX_INSTALL_TO_CHARS) diff --git a/recipes/dragonbox/all/test_package/CMakeLists.txt b/recipes/dragonbox/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7523e1c1d0d5d --- /dev/null +++ b/recipes/dragonbox/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(dragonbox REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE dragonbox::dragonbox_to_chars) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/dragonbox/all/test_package/conanfile.py b/recipes/dragonbox/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/dragonbox/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/dragonbox/all/test_package/test_package.cpp b/recipes/dragonbox/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..7f20adde8e681 --- /dev/null +++ b/recipes/dragonbox/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include +#include + +#include "dragonbox/dragonbox_to_chars.h" + +int main(void) { + constexpr int buffer_length = 1 + // for '\0' + jkj::dragonbox::max_output_string_length; + double x = 1.234; // Also works for float + char buffer[buffer_length]; + + // Null-terminate the buffer and return the pointer to the null character + // Hence, the length of the string is (end_ptr - buffer) + // buffer is now { '1', '.', '2', '3', '4', 'E', '0', '\0', (garbages) } + char* end_ptr = jkj::dragonbox::to_chars(x, buffer); + + // Does not null-terminate the buffer; returns the next-to-end pointer + // buffer is now { '1', '.', '2', '3', '4', 'E', '0', (garbages) } + // you can wrap the buffer with things like std::string_view + end_ptr = jkj::dragonbox::to_chars_n(x, buffer); + + return 0; +} diff --git a/recipes/dragonbox/all/test_v1_package/CMakeLists.txt b/recipes/dragonbox/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/dragonbox/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/dragonbox/all/test_v1_package/conanfile.py b/recipes/dragonbox/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/dragonbox/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/dragonbox/config.yml b/recipes/dragonbox/config.yml new file mode 100644 index 0000000000000..e1c4f3be24983 --- /dev/null +++ b/recipes/dragonbox/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.3": + folder: all diff --git a/recipes/drflac/all/CMakeLists.txt b/recipes/drflac/all/CMakeLists.txt index 9947cecd07f94..f2a49258562bf 100644 --- a/recipes/drflac/all/CMakeLists.txt +++ b/recipes/drflac/all/CMakeLists.txt @@ -1,21 +1,21 @@ cmake_minimum_required(VERSION 3.4) -project(dr_flac C) +project(dr_flac LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) +include(GNUInstallDirs) set(BUFFER_SIZE "0" CACHE STRING "Value for define DR_FLAC_BUFFER_SIZE. 0 means default buffer size.") option(NO_CRC "Build with define DR_FLAC_NO_CRC" OFF) option(NO_OGG "Build with define DR_FLAC_NO_OGG" OFF) option(NO_SIMD "Build with define DR_FLAC_NO_SIMD" OFF) option(NO_STDIO "Build with define DR_FLAC_NO_STDIO" OFF) +option(NO_WCHAR "Build with define DR_FLAC_NO_WCHAR" OFF) add_library(${CMAKE_PROJECT_NAME} dr_flac.c) -target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE source_subfolder) +target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${DRFLAC_SRC_DIR}) set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES - PUBLIC_HEADER source_subfolder/dr_flac.h + PUBLIC_HEADER ${DRFLAC_SRC_DIR}/dr_flac.h C_STANDARD 99 ) @@ -37,10 +37,13 @@ endif() if(NO_STDIO) target_compile_definitions(${CMAKE_PROJECT_NAME} PUBLIC -DDR_FLAC_NO_STDIO) endif() +if(NO_WCHAR) + target_compile_definitions(${CMAKE_PROJECT_NAME} PUBLIC -DDR_FLAC_NO_WCHAR) +endif() install(TARGETS ${CMAKE_PROJECT_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - PUBLIC_HEADER DESTINATION include + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/recipes/drflac/all/conandata.yml b/recipes/drflac/all/conandata.yml index a1542e09ff6d5..4b8f26778e5b0 100644 --- a/recipes/drflac/all/conandata.yml +++ b/recipes/drflac/all/conandata.yml @@ -1,4 +1,8 @@ sources: + # NOTE: https://github.com/mackron/dr_libs/blob/dd762b861ecadf5ddd5fb03e9ca1db6707b54fbb/dr_flac.h#L3 + "0.12.39": + url: https://github.com/mackron/dr_libs/archive/dd762b861ecadf5ddd5fb03e9ca1db6707b54fbb.zip + sha256: "077d6b29a78da5132065fcc9b44ca50e7e168b94250f2c25614101d3f808bcc1" # NOTE: https://github.com/mackron/dr_libs/blob/089deaa62268e6dacf2026754b1b228e54eb3993/dr_flac.h#L3 "0.12.38": url: https://github.com/mackron/dr_libs/archive/089deaa62268e6dacf2026754b1b228e54eb3993.zip diff --git a/recipes/drflac/all/conanfile.py b/recipes/drflac/all/conanfile.py index b3cc0f89c667c..ae9f5ee425002 100644 --- a/recipes/drflac/all/conanfile.py +++ b/recipes/drflac/all/conanfile.py @@ -1,6 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +from conan.tools.scm import Version +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.46.0" class DrflacConan(ConanFile): @@ -10,15 +14,16 @@ class DrflacConan(ConanFile): topics = ("audio", "flac", "sound") license = ("Unlicense", "MIT-0") url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "buffer_size": "ANY", + "buffer_size": ["ANY"], "no_crc": [True, False], "no_ogg": [True, False], "no_simd": [True, False], - "no_stdio": [True, False] + "no_stdio": [True, False], + "no_wchar": [True, False] } default_options = { "shared": False, @@ -27,24 +32,16 @@ class DrflacConan(ConanFile): "no_crc": False, "no_ogg": False, "no_simd": False, - "no_stdio": False + "no_stdio": False, + "no_wchar": False } - generators = "cmake" exports_sources = ["CMakeLists.txt", "dr_flac.c"] - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "0.12.39": + del self.options.no_wchar def configure(self): if self.options.shared: @@ -52,28 +49,31 @@ def configure(self): del self.settings.compiler.cppstd del self.settings.compiler.libcxx + def layout(self): + cmake_layout(self) + def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUFFER_SIZE"] = self.options.buffer_size - self._cmake.definitions["NO_CRC"] = self.options.no_crc - self._cmake.definitions["NO_OGG"] = self.options.no_ogg - self._cmake.definitions["NO_SIMD"] = self.options.no_simd - self._cmake.definitions["NO_STDIO"] = self.options.no_stdio - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DRFLAC_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["BUFFER_SIZE"] = self.options.buffer_size + tc.variables["NO_CRC"] = self.options.no_crc + tc.variables["NO_OGG"] = self.options.no_ogg + tc.variables["NO_SIMD"] = self.options.no_simd + tc.variables["NO_STDIO"] = self.options.no_stdio + tc.variables["NO_WCHAR"] = self.options.get_safe("no_wchar", False) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): @@ -90,3 +90,5 @@ def package_info(self): self.cpp_info.defines.append("DR_FLAC_NO_SIMD") if self.options.no_stdio: self.cpp_info.defines.append("DR_FLAC_NO_STDIO") + if self.options.get_safe("no_wchar", False): + self.cpp_info.defines.append("DR_FLAC_NO_WCHAR") diff --git a/recipes/drflac/all/test_package/CMakeLists.txt b/recipes/drflac/all/test_package/CMakeLists.txt index 6cc16ae422649..f1c86abcb3be6 100644 --- a/recipes/drflac/all/test_package/CMakeLists.txt +++ b/recipes/drflac/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(drflac CONFIG REQUIRED) diff --git a/recipes/drflac/all/test_package/conanfile.py b/recipes/drflac/all/test_package/conanfile.py index 6a8d179b4301b..3a8c6c5442b33 100644 --- a/recipes/drflac/all/test_package/conanfile.py +++ b/recipes/drflac/all/test_package/conanfile.py @@ -1,11 +1,18 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" -class DrflacTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if not cross_building(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/drflac/all/test_v1_package/CMakeLists.txt b/recipes/drflac/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..d9f4971c6bf0a --- /dev/null +++ b/recipes/drflac/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(drflac CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} drflac::drflac) +set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) diff --git a/recipes/drflac/all/test_v1_package/conanfile.py b/recipes/drflac/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/drflac/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/drflac/config.yml b/recipes/drflac/config.yml index d73a7f8fb45ce..f7ff0941f9f1b 100644 --- a/recipes/drflac/config.yml +++ b/recipes/drflac/config.yml @@ -1,3 +1,5 @@ versions: + "0.12.39": + folder: all "0.12.38": folder: all diff --git a/recipes/drmp3/all/CMakeLists.txt b/recipes/drmp3/all/CMakeLists.txt index c5aad107a6862..c44a0bb77d180 100644 --- a/recipes/drmp3/all/CMakeLists.txt +++ b/recipes/drmp3/all/CMakeLists.txt @@ -1,18 +1,17 @@ cmake_minimum_required(VERSION 3.4) -project(dr_mp3 C) +project(dr_mp3 LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) +include(GNUInstallDirs) option(NO_SIMD "Build with define DR_MP3_NO_SIMD" OFF) option(NO_STDIO "Build with define DR_MP3_NO_STDIO" OFF) add_library(${CMAKE_PROJECT_NAME} dr_mp3.c) -target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE source_subfolder) +target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${DRMP3_SRC_DIR}) set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES - PUBLIC_HEADER source_subfolder/dr_mp3.h + PUBLIC_HEADER ${DRMP3_SRC_DIR}/dr_mp3.h C_STANDARD 99 ) @@ -27,8 +26,8 @@ if(NO_STDIO) endif() install(TARGETS ${CMAKE_PROJECT_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - PUBLIC_HEADER DESTINATION include + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/recipes/drmp3/all/conandata.yml b/recipes/drmp3/all/conandata.yml index 70b1ddd16bfdf..a26d9e9dbb871 100644 --- a/recipes/drmp3/all/conandata.yml +++ b/recipes/drmp3/all/conandata.yml @@ -1,4 +1,8 @@ sources: + # NOTE: https://github.com/mackron/dr_libs/blob/dd762b861ecadf5ddd5fb03e9ca1db6707b54fbb/dr_mp3.h#L3 + "0.6.34": + url: https://github.com/mackron/dr_libs/archive/dd762b861ecadf5ddd5fb03e9ca1db6707b54fbb.zip + sha256: "077d6b29a78da5132065fcc9b44ca50e7e168b94250f2c25614101d3f808bcc1" # NOTE: https://github.com/mackron/dr_libs/blob/9497270f581f43e6b795ce5d98d8764861fb6a50/dr_mp3.h#L3 "0.6.32": url: https://github.com/mackron/dr_libs/archive/9497270f581f43e6b795ce5d98d8764861fb6a50.zip diff --git a/recipes/drmp3/all/conanfile.py b/recipes/drmp3/all/conanfile.py index fed3d6f624287..e21eeff31877c 100644 --- a/recipes/drmp3/all/conanfile.py +++ b/recipes/drmp3/all/conanfile.py @@ -1,6 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.46.0" class Drmp3Conan(ConanFile): @@ -10,7 +13,7 @@ class Drmp3Conan(ConanFile): topics = ("audio", "mp3", "sound") license = ("Unlicense", "MIT-0") url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -23,19 +26,10 @@ class Drmp3Conan(ConanFile): "no_simd": False, "no_stdio": False } - generators = "cmake" exports_sources = ["CMakeLists.txt", "dr_mp3.c"] _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -46,25 +40,27 @@ def configure(self): del self.settings.compiler.cppstd del self.settings.compiler.libcxx + def layout(self): + cmake_layout(self) + def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["NO_SIMD"] = self.options.no_simd - self._cmake.definitions["NO_STDIO"] = self.options.no_stdio - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DRMP3_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["NO_SIMD"] = self.options.no_simd + tc.variables["NO_STDIO"] = self.options.no_stdio + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/drmp3/all/test_package/CMakeLists.txt b/recipes/drmp3/all/test_package/CMakeLists.txt index 3c9aefac6058f..b5b2e6102e202 100644 --- a/recipes/drmp3/all/test_package/CMakeLists.txt +++ b/recipes/drmp3/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(drmp3 CONFIG REQUIRED) diff --git a/recipes/drmp3/all/test_package/conanfile.py b/recipes/drmp3/all/test_package/conanfile.py index a145e03938e8e..3a8c6c5442b33 100644 --- a/recipes/drmp3/all/test_package/conanfile.py +++ b/recipes/drmp3/all/test_package/conanfile.py @@ -1,11 +1,18 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" -class Drmp3TestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if not cross_building(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/drmp3/all/test_v1_package/CMakeLists.txt b/recipes/drmp3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..bfd7908ef1c6f --- /dev/null +++ b/recipes/drmp3/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(drmp3 CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} drmp3::drmp3) +set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) diff --git a/recipes/drmp3/all/test_v1_package/conanfile.py b/recipes/drmp3/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/drmp3/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/drmp3/config.yml b/recipes/drmp3/config.yml index a231e824ba399..dda44114b507b 100644 --- a/recipes/drmp3/config.yml +++ b/recipes/drmp3/config.yml @@ -1,3 +1,5 @@ versions: + "0.6.34": + folder: all "0.6.32": folder: all diff --git a/recipes/drogon/all/CMakeLists.txt b/recipes/drogon/all/CMakeLists.txt deleted file mode 100644 index 1480db2f856ab..0000000000000 --- a/recipes/drogon/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(conan_wrapper CXX) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/drogon/all/conandata.yml b/recipes/drogon/all/conandata.yml index 1e5a3f8b0fae0..3d2e4a7aaaaea 100644 --- a/recipes/drogon/all/conandata.yml +++ b/recipes/drogon/all/conandata.yml @@ -1,12 +1,62 @@ sources: + "1.8.3": + url: "https://github.com/drogonframework/drogon/archive/v1.8.3.tar.gz" + sha256: "db6d92a0c40ec52d5704fb4128860b9eecdc284653e8d85113b4219b96dc7129" + "1.8.2": + url: "https://github.com/drogonframework/drogon/archive/v1.8.2.tar.gz" + sha256: "1182cab00c33e400eac617c6dbf44fa2f358e1844990b6b8c5c87783024f9971" + "1.8.0": + url: "https://github.com/drogonframework/drogon/archive/refs/tags/v1.8.0.tar.gz" + sha256: "bc6503cf213ed961d4a5e9fd7cb8e75b6b11045a67840ea2241e57321dd8711b" "1.7.5": url: "https://github.com/drogonframework/drogon/archive/refs/tags/v1.7.5.tar.gz" sha256: "e2af7c55dcabafef16f26f5b3242692f5a2b54c19b7b626840bf9132d24766f6" patches: + "1.8.3": + - patch_file: "patches/1.8.0-0001-disable-unused-data.patch" + patch_description: "Consume Trantor package from Conan instead of using the\ + \ subproject" + patch_type: "conan" + - patch_file: "patches/1.8.0-0002-find-package-jsoncpp.patch" + patch_description: "Fix jsoncpp cmake target name" + patch_type: "conan" + - patch_file: "patches/1.8.3-0003-find-package-sqlite.patch" + patch_description: "Fix sqlite cmake target name" + patch_type: "conan" + + "1.8.2": + - patch_file: "patches/1.8.0-0001-disable-unused-data.patch" + patch_description: "Consume Trantor package from Conan instead of using the\ + \ subproject" + patch_type: "conan" + - patch_file: "patches/1.8.0-0002-find-package-jsoncpp.patch" + patch_description: "Fix jsoncpp cmake target name" + patch_type: "conan" + - patch_file: "patches/1.8.2-0003-find-package-sqlite.patch" + patch_description: "Fix sqlite cmake target name" + patch_type: "conan" + + "1.8.0": + - patch_file: "patches/1.8.0-0001-disable-unused-data.patch" + patch_description: "Consume Trantor package from Conan instead of using the subproject" + patch_type: "conan" + - patch_file: "patches/1.8.0-0002-find-package-jsoncpp.patch" + patch_description: "Fix jsoncpp cmake target name" + patch_type: "conan" + - patch_file: "patches/1.8.0-0003-find-package-sqlite.patch" + patch_description: "Fix sqlite cmake target name" + patch_type: "conan" + "1.7.5": - - base_path: "source_subfolder" - patch_file: "patches/1.7.5-0001-disable_trantor.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.7.5-0002-remove-boost-components.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.7.5-0003-find-package-trantor.patch" + - patch_file: "patches/1.7.5-0001-disable_trantor.patch" + patch_description: "Consume Trantor package from Conan instead of using the subproject" + patch_type: "conan" + - patch_file: "patches/1.7.5-0002-remove-boost-components.patch" + patch_description: "Do not consume specific Boost components" + patch_type: "conan" + - patch_file: "patches/1.7.5-0003-find-package-trantor.patch" + patch_description: "Fix Trantor cmake target name" + patch_type: "conan" + - patch_file: "patches/1.7.5-0004-find-package-jsoncpp.patch" + patch_description: "Fix jsoncpp cmake target name" + patch_type: "conan" diff --git a/recipes/drogon/all/conanfile.py b/recipes/drogon/all/conanfile.py index a74f416e70f3e..05e8a3e45cfa1 100644 --- a/recipes/drogon/all/conanfile.py +++ b/recipes/drogon/all/conanfile.py @@ -1,9 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class DrogonConan(ConanFile): name = "drogon" @@ -13,7 +16,6 @@ class DrogonConan(ConanFile): homepage = "https://github.com/drogonframework/drogon" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" options = { "shared": [False, True], "fPIC": [True, False], @@ -43,14 +45,8 @@ class DrogonConan(ConanFile): "with_redis": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -58,7 +54,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") self.options["trantor"].shared = True if not self.options.with_orm: del self.options.with_postgres @@ -69,96 +65,114 @@ def configure(self): elif not self.options.with_postgres: del self.options.with_postgres_batch + @property + def _min_cppstd(self): + return 14 if Version(self.version) < "1.8.2" else 17 + @property def _compilers_minimum_version(self): - return { - "gcc": "6", - "Visual Studio": "15.0", - "clang": "5", - "apple-clang": "10", - } + if Version(self.version) < "1.8.2": + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "6", + "clang": "5", + "apple-clang": "10", + } + else: + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++14, which your compiler does not support.".format(self.name)) + if Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") else: - self.output.warn("{} requires C++14. Your compiler is unknown. Assuming it supports C++14.".format(self.name)) + self.output.warn(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") def requirements(self): - self.requires("trantor/1.5.5") + self.requires("trantor/1.5.8") self.requires("jsoncpp/1.9.5") - self.requires("openssl/1.1.1o") - self.requires("zlib/1.2.12") + self.requires("openssl/1.1.1s") + self.requires("zlib/1.2.13") if self.settings.os == "Linux": self.requires("libuuid/1.0.3") if self.options.with_profile: self.requires("coz/cci.20210322") if self.options.with_boost: - self.requires("boost/1.79.0") + self.requires("boost/1.81.0") if self.options.with_brotli: self.requires("brotli/1.0.9") if self.options.get_safe("with_postgres"): - self.requires("libpq/14.2") + self.requires("libpq/14.5") if self.options.get_safe("with_mysql"): - self.requires("libmysqlclient/8.0.25") + self.requires("libmysqlclient/8.0.30") if self.options.get_safe("with_sqlite"): - self.requires("sqlite3/3.38.5") + self.requires("sqlite3/3.40.0") if self.options.get_safe("with_redis"): - self.requires("hiredis/1.0.2") + self.requires("hiredis/1.1.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_CTL"] = self.options.with_ctl + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_ORM"] = self.options.with_orm + tc.variables["COZ_PROFILING"] = self.options.with_profile + tc.variables["BUILD_DROGON_SHARED"] = self.options.shared + tc.variables["BUILD_DOC"] = False + tc.variables["BUILD_BROTLI"] = self.options.with_brotli + tc.variables["BUILD_POSTGRESQL"] = self.options.get_safe("with_postgres", False) + tc.variables["BUILD_POSTGRESQL_BATCH"] = self.options.get_safe("with_postgres_batch", False) + tc.variables["BUILD_MYSQL"] = self.options.get_safe("with_mysql", False) + tc.variables["BUILD_SQLITE"] = self.options.get_safe("with_sqlite", False) + tc.variables["BUILD_REDIS"] = self.options.get_safe("with_redis", False) + tc.generate() + tc = CMakeDeps(self) + tc.generate() - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): + apply_conandata_patches(self) cmake = CMake(self) - cmake.definitions["BUILD_CTL"] = self.options.with_ctl - cmake.definitions["BUILD_EXAMPLES"] = False - cmake.definitions["BUILD_ORM"] = self.options.with_orm - cmake.definitions["COZ_PROFILING"] = self.options.with_profile - cmake.definitions["BUILD_DROGON_SHARED"] = self.options.shared - cmake.definitions["BUILD_DOC"] = False - cmake.definitions["BUILD_BROTLI"] = self.options.with_brotli - cmake.definitions["BUILD_POSTGRESQL"] = self.options.get_safe("with_postgres", False) - cmake.definitions["BUILD_POSTGRESQL_BATCH"] = self.options.get_safe("with_postgres_batch", False) - cmake.definitions["BUILD_MYSQL"] = self.options.get_safe("with_mysql", False) - cmake.definitions["BUILD_SQLITE"] = self.options.get_safe("with_sqlite", False) - cmake.definitions["BUILD_REDIS"] = self.options.get_safe("with_redis", False) cmake.configure() - return cmake - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() cmake.build() def package(self): - self.copy("LICENSE", "licenses", self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.libs = ["drogon"] if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["rpcrt4", "ws2_32", "crypt32", "advapi32"]) - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version).major == "8": + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == "8": self.cpp_info.system_libs.append("stdc++fs") if self.options.with_ctl: bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) self.cpp_info.set_property("cmake_file_name", "Drogon") self.cpp_info.set_property("cmake_target_name", "Drogon::Drogon") + # TODO: Remove after Conan 2.0 self.cpp_info.filenames["cmake_find_package"] = "Drogon" self.cpp_info.filenames["cmake_find_package_multi"] = "Drogon" self.cpp_info.names["cmake_find_package"] = "Drogon" diff --git a/recipes/drogon/all/patches/1.7.5-0004-find-package-jsoncpp.patch b/recipes/drogon/all/patches/1.7.5-0004-find-package-jsoncpp.patch new file mode 100644 index 0000000000000..dc4849690a251 --- /dev/null +++ b/recipes/drogon/all/patches/1.7.5-0004-find-package-jsoncpp.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d2e2f69..61fb3bf 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -199,9 +199,9 @@ else() + endif() + + # jsoncpp +-find_package(Jsoncpp REQUIRED) +-target_link_libraries(${PROJECT_NAME} PUBLIC Jsoncpp_lib) +-list(APPEND INCLUDE_DIRS_FOR_DYNAMIC_VIEW ${JSONCPP_INCLUDE_DIRS}) ++find_package(jsoncpp REQUIRED) ++target_link_libraries(${PROJECT_NAME} PUBLIC jsoncpp_lib) ++list(APPEND INCLUDE_DIRS_FOR_DYNAMIC_VIEW ${jsoncpp_INCLUDE_DIRS}) + + if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" + AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" diff --git a/recipes/drogon/all/patches/1.8.0-0001-disable-unused-data.patch b/recipes/drogon/all/patches/1.8.0-0001-disable-unused-data.patch new file mode 100644 index 0000000000000..3038da266a3a2 --- /dev/null +++ b/recipes/drogon/all/patches/1.8.0-0001-disable-unused-data.patch @@ -0,0 +1,41 @@ +index ca6dff2..ba015d2 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -16,7 +16,6 @@ option(BUILD_CTL "Build drogon_ctl" ${BUILD_PROGRAMS}) + option(BUILD_EXAMPLES "Build examples" ${BUILD_PROGRAMS}) + option(BUILD_ORM "Build orm" ON) + option(COZ_PROFILING "Use coz for profiling" OFF) +-option(BUILD_SHARED_LIBS "Build drogon as a shared lib" OFF) + option(BUILD_DOC "Build Doxygen documentation" OFF) + option(BUILD_BROTLI "Build Brotli" ON) + +@@ -106,7 +105,6 @@ target_include_directories( + $ + $ + $ +- $ + $ + $) + +@@ -116,9 +114,8 @@ if (WIN32) + PRIVATE $) + endif (WIN32) + +-add_subdirectory(trantor) +- +-target_link_libraries(${PROJECT_NAME} PUBLIC trantor) ++find_package(Trantor REQUIRED) ++target_link_libraries(${PROJECT_NAME} PUBLIC Trantor::Trantor) + + if(${CMAKE_SYSTEM_NAME} STREQUAL "Haiku") + target_link_libraries(${PROJECT_NAME} PRIVATE network) +@@ -177,7 +174,8 @@ if (${CMAKE_SYSTEM_NAME} STREQUAL "Android") + endif () + + if(NEED_BOOST_FS) +- find_package(Boost 1.49.0 COMPONENTS filesystem system REQUIRED) ++ # TODO: component specified find_package is always failed. Need to fix it. ++ find_package(Boost 1.49.0 REQUIRED) + message(STATUS "Using Boost filesytem::path") + message(STATUS "Boost include dir: " ${Boost_INCLUDE_DIR}) + include_directories(${BOOST_INCLUDE_DIRS}) diff --git a/recipes/drogon/all/patches/1.8.0-0002-find-package-jsoncpp.patch b/recipes/drogon/all/patches/1.8.0-0002-find-package-jsoncpp.patch new file mode 100644 index 0000000000000..2402bc2bfdf71 --- /dev/null +++ b/recipes/drogon/all/patches/1.8.0-0002-find-package-jsoncpp.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index ba015d2..02c2ccc 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -195,9 +195,9 @@ else() + endif() + + # jsoncpp +-find_package(Jsoncpp REQUIRED) +-target_link_libraries(${PROJECT_NAME} PUBLIC Jsoncpp_lib) +-list(APPEND INCLUDE_DIRS_FOR_DYNAMIC_VIEW ${JSONCPP_INCLUDE_DIRS}) ++find_package(jsoncpp REQUIRED) ++target_link_libraries(${PROJECT_NAME} PUBLIC jsoncpp_lib) ++list(APPEND INCLUDE_DIRS_FOR_DYNAMIC_VIEW ${jsoncpp_INCLUDE_DIRS}) + + if (NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" + AND NOT ${CMAKE_SYSTEM_NAME} STREQUAL "OpenBSD" diff --git a/recipes/drogon/all/patches/1.8.0-0003-find-package-sqlite.patch b/recipes/drogon/all/patches/1.8.0-0003-find-package-sqlite.patch new file mode 100644 index 0000000000000..908cb3b2952e3 --- /dev/null +++ b/recipes/drogon/all/patches/1.8.0-0003-find-package-sqlite.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5d92323..b971267 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -394,7 +394,7 @@ # Find sqlite3. + find_package(SQLite3 QUIET) + find_package(unofficial-sqlite3 QUIET) + if (SQLite3_FOUND) +- target_link_libraries(${PROJECT_NAME} PRIVATE SQLite3_lib) ++ target_link_libraries(${PROJECT_NAME} PRIVATE SQLite::SQLite3) + set(DROGON_FOUND_SQLite3 TRUE) + elseif (unofficial-sqlite3_FOUND) + target_link_libraries(${PROJECT_NAME} PRIVATE unofficial::sqlite3::sqlite3) diff --git a/recipes/drogon/all/patches/1.8.2-0003-find-package-sqlite.patch b/recipes/drogon/all/patches/1.8.2-0003-find-package-sqlite.patch new file mode 100644 index 0000000000000..c54242f8776df --- /dev/null +++ b/recipes/drogon/all/patches/1.8.2-0003-find-package-sqlite.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5d92323..b971267 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -402,7 +402,7 @@ # Find sqlite3. + find_package(SQLite3 QUIET) + find_package(unofficial-sqlite3 QUIET) + if (SQLite3_FOUND) +- target_link_libraries(${PROJECT_NAME} PRIVATE SQLite3_lib) ++ target_link_libraries(${PROJECT_NAME} PRIVATE SQLite::SQLite3) + set(DROGON_FOUND_SQLite3 TRUE) + elseif (unofficial-sqlite3_FOUND) + target_link_libraries(${PROJECT_NAME} PRIVATE unofficial::sqlite3::sqlite3) diff --git a/recipes/drogon/all/patches/1.8.3-0003-find-package-sqlite.patch b/recipes/drogon/all/patches/1.8.3-0003-find-package-sqlite.patch new file mode 100644 index 0000000000000..f4d98d1fd03e8 --- /dev/null +++ b/recipes/drogon/all/patches/1.8.3-0003-find-package-sqlite.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 680dc46..28cbcf4 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -405,7 +405,7 @@ if (BUILD_SQLITE) + find_package(SQLite3 QUIET) + find_package(unofficial-sqlite3 QUIET) + if (SQLite3_FOUND) +- target_link_libraries(${PROJECT_NAME} PRIVATE SQLite3_lib) ++ target_link_libraries(${PROJECT_NAME} PRIVATE SQLite::SQLite3) + set(DROGON_FOUND_SQLite3 TRUE) + elseif (unofficial-sqlite3_FOUND) + target_link_libraries(${PROJECT_NAME} PRIVATE unofficial::sqlite3::sqlite3) diff --git a/recipes/drogon/all/test_package/CMakeLists.txt b/recipes/drogon/all/test_package/CMakeLists.txt index a8db5b906c051..cf16e9b501eaa 100644 --- a/recipes/drogon/all/test_package/CMakeLists.txt +++ b/recipes/drogon/all/test_package/CMakeLists.txt @@ -1,17 +1,14 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(Drogon CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Drogon::Drogon) +target_link_libraries(${PROJECT_NAME} PRIVATE Drogon::Drogon) # drogon uses string_view when MSVC_VERSION is greater than 1900. # https://github.com/drogonframework/drogon/blob/v1.7.5/lib/inc/drogon/utils/string_view.h#L16 -if(DEFINED MSVC_VERSION AND MSVC_VERSION GREATER 1900) +if((DEFINED MSVC_VERSION AND MSVC_VERSION GREATER 1900) OR Drogon_VERSION VERSION_GREATER_EQUAL "1.8.2") target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) else() target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/drogon/all/test_package/conanfile.py b/recipes/drogon/all/test_package/conanfile.py index e0660e0801b96..84eaa369e4a72 100644 --- a/recipes/drogon/all/test_package/conanfile.py +++ b/recipes/drogon/all/test_package/conanfile.py @@ -1,9 +1,18 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type", - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,5 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/drogon/all/test_v1_package/CMakeLists.txt b/recipes/drogon/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/drogon/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/drogon/all/test_v1_package/conanfile.py b/recipes/drogon/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..db6f728ae05ec --- /dev/null +++ b/recipes/drogon/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake +from conan.tools.build import cross_building + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type", + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/drogon/config.yml b/recipes/drogon/config.yml index 6793cfc73710a..0ab8881109d24 100644 --- a/recipes/drogon/config.yml +++ b/recipes/drogon/config.yml @@ -1,3 +1,9 @@ versions: + "1.8.3": + folder: "all" + "1.8.2": + folder: "all" + "1.8.0": + folder: "all" "1.7.5": folder: "all" diff --git a/recipes/drwav/all/CMakeLists.txt b/recipes/drwav/all/CMakeLists.txt index 474406a6484d5..64cb2f4533122 100644 --- a/recipes/drwav/all/CMakeLists.txt +++ b/recipes/drwav/all/CMakeLists.txt @@ -1,18 +1,18 @@ cmake_minimum_required(VERSION 3.4) -project(dr_wav C) +project(dr_wav LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) +include(GNUInstallDirs) option(NO_CONVERSION_API "Build with define DR_WAV_NO_CONVERSION_API" OFF) option(NO_STDIO "Build with define DR_WAV_NO_STDIO" OFF) +option(NO_WCHAR "Build with define DR_WAV_NO_WCHAR" OFF) add_library(${CMAKE_PROJECT_NAME} dr_wav.c) -target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE source_subfolder) +target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${DRWAV_SRC_DIR}) set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES - PUBLIC_HEADER source_subfolder/dr_wav.h + PUBLIC_HEADER ${DRWAV_SRC_DIR}/dr_wav.h C_STANDARD 99 ) @@ -25,10 +25,13 @@ endif() if(NO_STDIO) target_compile_definitions(${CMAKE_PROJECT_NAME} PUBLIC -DDR_WAV_NO_STDIO) endif() +if(NO_WCHAR) + target_compile_definitions(${CMAKE_PROJECT_NAME} PUBLIC -DDR_WAV_NO_WCHAR) +endif() install(TARGETS ${CMAKE_PROJECT_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - PUBLIC_HEADER DESTINATION include + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/recipes/drwav/all/conandata.yml b/recipes/drwav/all/conandata.yml index 65fecfb0a75c8..449e35d180bee 100644 --- a/recipes/drwav/all/conandata.yml +++ b/recipes/drwav/all/conandata.yml @@ -1,4 +1,8 @@ sources: + # NOTE: https://github.com/mackron/dr_libs/blob/4f6da71ed357ade92dc91f00e6be7301ec9a82a3/dr_wav.h#L3 + "0.13.7": + url: https://github.com/mackron/dr_libs/archive/4f6da71ed357ade92dc91f00e6be7301ec9a82a3.zip + sha256: "0a77850ca558633e0516a68383481fb36823064256f2c50911056714420bc5b1" # NOTE: https://github.com/mackron/dr_libs/blob/15f37e3ab01654c1a3bc98cff2a9ca64e8296fa9/dr_wav.h#L3 "0.13.6": url: https://github.com/mackron/dr_libs/archive/15f37e3ab01654c1a3bc98cff2a9ca64e8296fa9.zip diff --git a/recipes/drwav/all/conanfile.py b/recipes/drwav/all/conanfile.py index e41ae45bae883..634d49129395e 100644 --- a/recipes/drwav/all/conanfile.py +++ b/recipes/drwav/all/conanfile.py @@ -1,6 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.46.0" class DrwavConan(ConanFile): @@ -10,32 +13,23 @@ class DrwavConan(ConanFile): topics = ("audio", "wav", "wave", "sound") license = ("Unlicense", "MIT-0") url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "no_conversion_api": [True, False], - "no_stdio": [True, False] + "no_stdio": [True, False], + "no_wchar": [True, False] } default_options = { "shared": False, "fPIC": True, "no_conversion_api": False, - "no_stdio": False + "no_stdio": False, + "no_wchar": False } - generators = "cmake" exports_sources = ["CMakeLists.txt", "dr_wav.c"] - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -46,25 +40,28 @@ def configure(self): del self.settings.compiler.cppstd del self.settings.compiler.libcxx + def layout(self): + cmake_layout(self) + def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["NO_CONVERSION_API"] = self.options.no_conversion_api - self._cmake.definitions["NO_STDIO"] = self.options.no_stdio - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DRWAV_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["NO_CONVERSION_API"] = self.options.no_conversion_api + tc.variables["NO_STDIO"] = self.options.no_stdio + tc.variables["NO_WCHAR"] = self.options.no_wchar + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): @@ -75,3 +72,5 @@ def package_info(self): self.cpp_info.defines.append("DR_WAV_NO_CONVERSION_API") if self.options.no_stdio: self.cpp_info.defines.append("DR_WAV_NO_STDIO") + if self.options.no_wchar: + self.cpp_info.defines.append("DR_WAV_NO_WCHAR") diff --git a/recipes/drwav/all/test_package/CMakeLists.txt b/recipes/drwav/all/test_package/CMakeLists.txt index 1df2c3edd2222..8eb51f5f1843e 100644 --- a/recipes/drwav/all/test_package/CMakeLists.txt +++ b/recipes/drwav/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(drwav CONFIG REQUIRED) diff --git a/recipes/drwav/all/test_package/conanfile.py b/recipes/drwav/all/test_package/conanfile.py index bb25bb74037a3..3a8c6c5442b33 100644 --- a/recipes/drwav/all/test_package/conanfile.py +++ b/recipes/drwav/all/test_package/conanfile.py @@ -1,11 +1,18 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" -class DrwavTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if not cross_building(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/drwav/all/test_v1_package/CMakeLists.txt b/recipes/drwav/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b7b4d6635b758 --- /dev/null +++ b/recipes/drwav/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(drwav CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} drwav::drwav) +set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) diff --git a/recipes/drwav/all/test_v1_package/conanfile.py b/recipes/drwav/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/drwav/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/drwav/config.yml b/recipes/drwav/config.yml index 6d9e481111084..6c8f065f79d49 100644 --- a/recipes/drwav/config.yml +++ b/recipes/drwav/config.yml @@ -1,3 +1,5 @@ versions: + "0.13.7": + folder: all "0.13.6": folder: all diff --git a/recipes/duckdb/all/conandata.yml b/recipes/duckdb/all/conandata.yml new file mode 100644 index 0000000000000..3126108b09688 --- /dev/null +++ b/recipes/duckdb/all/conandata.yml @@ -0,0 +1,30 @@ +sources: + "0.6.1": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v0.6.0.tar.gz" + sha256: "700b09114f8b99892a9d19ba21ca962ae65d1ea8085622418a2fa50ff915b244" + "0.6.0": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v0.6.0.tar.gz" + sha256: "700b09114f8b99892a9d19ba21ca962ae65d1ea8085622418a2fa50ff915b244" + "0.5.1": + url: "https://github.com/duckdb/duckdb/archive/refs/tags/v0.5.1.tar.gz" + sha256: "3dab7ba0d0f8d024d3c73fd3d4fb8834203c31d7b0ddb1e8539ee266e11b0e9b" + +patches: + "0.6.1": + - patch_file: "patches/0.6.0-0001-fix-cmake.patch" + patch_description: "install static of shared library, add installation for odbc extention" + patch_type: "portability" + - patch_file: "patches/0.6.0-0002-include-stdlib.patch" + patch_description: "include stdlib for abort function" + patch_type: "portability" + "0.6.0": + - patch_file: "patches/0.6.0-0001-fix-cmake.patch" + patch_description: "install static of shared library, add installation for odbc extention" + patch_type: "portability" + - patch_file: "patches/0.6.0-0002-include-stdlib.patch" + patch_description: "include stdlib for abort function" + patch_type: "portability" + "0.5.1": + - patch_file: "patches/0.5.1-0001-fix-cmake.patch" + patch_description: "install static of shared library, add installation for odbc extention" + patch_type: "portability" diff --git a/recipes/duckdb/all/conanfile.py b/recipes/duckdb/all/conanfile.py new file mode 100644 index 0000000000000..994004c113240 --- /dev/null +++ b/recipes/duckdb/all/conanfile.py @@ -0,0 +1,204 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + +import os + +required_conan_version = ">=1.53.0" + +class DuckdbConan(ConanFile): + name = "duckdb" + description = "DuckDB is an embeddable SQL OLAP Database Management System" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/cwida/duckdb" + topics = ("sql", "database", "olap", "embedded-database") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_icu": [True, False], + "with_parquet": [True, False], + "with_tpch": [True, False], + "with_tpcds": [True, False], + "with_fts": [True, False], + "with_httpfs": [True, False], + "with_visualizer": [True, False], + "with_json": [True, False], + "with_excel": [True, False], + "with_sqlsmith": [True, False], + "with_odbc": [True, False], + "with_query_log": [True, False], + "with_shell": [True, False], + "with_threads": [True, False], + "with_rdtsc": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_icu": False, + "with_parquet": False, + "with_tpch": False, + "with_tpcds": False, + "with_fts": False, + "with_httpfs": False, + "with_visualizer": False, + "with_json": False, + "with_excel": False, + "with_sqlsmith": False, + "with_odbc": False, + "with_query_log": False, + "with_shell": False, + "with_threads": True, + "with_rdtsc": False, + } + short_paths = True + + @property + def _minimum_cpp_standard(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + # FIXME: duckdb vendors a bunch of deps by modify the source code to have their own namespace + if self.options.with_odbc: + self.requires("odbc/2.3.11") + if self.options.with_httpfs: + self.requires("openssl/3.0.7") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DUCKDB_MAJOR_VERSION"] = Version(self.version).major + tc.variables["DUCKDB_MINOR_VERSION"] = Version(self.version).minor + tc.variables["DUCKDB_PATCH_VERSION"] = Version(self.version).patch + tc.variables["DUCKDB_DEV_ITERATION"] = 0 + tc.variables["BUILD_ICU_EXTENSION"] = self.options.with_icu + tc.variables["BUILD_PARQUET_EXTENSION"] = self.options.with_parquet + tc.variables["BUILD_TPCH_EXTENSION"] = self.options.with_tpch + tc.variables["BUILD_TPCDS_EXTENSION"] = self.options.with_tpcds + tc.variables["BUILD_FTS_EXTENSION"] = self.options.with_fts + tc.variables["BUILD_HTTPFS_EXTENSION"] = self.options.with_httpfs + tc.variables["BUILD_VISUALIZER_EXTENSION"] = self.options.with_visualizer + tc.variables["BUILD_JSON_EXTENSION"] = self.options.with_json + tc.variables["BUILD_EXCEL_EXTENSION"] = self.options.with_excel + tc.variables["BUILD_SQLSMITH_EXTENSION"] = self.options.with_sqlsmith + tc.variables["BUILD_ODBC_DRIVER"] = self.options.with_odbc + tc.variables["FORCE_QUERY_LOG"] = self.options.with_query_log + tc.variables["BUILD_SHELL"] = self.options.with_shell + tc.variables["DISABLE_THREADS"] = not self.options.with_threads + tc.variables["BUILD_UNITTESTS"] = False + tc.variables["BUILD_RDTSC"] = self.options.with_rdtsc + tc.variables["EXTENSION_STATIC_BUILD"] = not self.options.shared + tc.variables["ENABLE_SANITIZER"] = False + tc.variables["ENABLE_UBSAN"] = False + if is_msvc(self) and not self.options.shared: + tc.preprocessor_definitions["DUCKDB_API"] = "" + tc.generate() + + dpes = CMakeDeps(self) + dpes.generate() + + def build(self): + apply_conandata_patches(self) + if is_msvc(self) and not self.options.shared: + replace_in_file(self, os.path.join(self.source_folder, "src", "include", "duckdb.h"), + "#define DUCKDB_API __declspec(dllimport)", + "#define DUCKDB_API" + ) + replace_in_file(self, os.path.join(self.source_folder, "src", "include", "duckdb", "common", "winapi.hpp"), + "#define DUCKDB_API __declspec(dllimport)", + "#define DUCKDB_API" + ) + + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + if self.options.shared: + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + rm(self, "duckdb_*.lib", os.path.join(self.package_folder, "lib")) + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + + def package_info(self): + if self.options.shared: + self.cpp_info.libs = ["duckdb"] + else: + self.cpp_info.libs = [ + "duckdb_static", + "duckdb_fmt", + "duckdb_pg_query", + "duckdb_re2", + "duckdb_miniz", + "duckdb_utf8proc", + "duckdb_hyperloglog", + "duckdb_fastpforlib", + "duckdb_mbedtls", + ] + if Version(self.version) >= "0.6.0": + self.cpp_info.libs.append("duckdb_fsst") + + if self.options.with_icu: + self.cpp_info.libs.append("icu_extension") + if self.options.with_parquet: + self.cpp_info.libs.append("parquet_extension") + if self.options.with_tpch: + self.cpp_info.libs.append("tpch_extension") + if self.options.with_tpcds: + self.cpp_info.libs.append("tpcds_extension") + if self.options.with_fts: + self.cpp_info.libs.append("fts_extension") + if self.options.with_httpfs: + self.cpp_info.libs.append("httpfs_extension") + if self.options.with_visualizer: + self.cpp_info.libs.append("visualizer_extension") + if Version(self.version) >= "0.6.0" and self.settings.os == "Linux": + self.cpp_info.libs.append("jemalloc_extension") + if self.options.with_json: + self.cpp_info.libs.append("json_extension") + if self.options.with_excel: + self.cpp_info.libs.append("excel_extension") + if self.options.with_sqlsmith: + self.cpp_info.libs.append("sqlsmith_extension") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("dl") + self.cpp_info.system_libs.append("m") + + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") + + if self.options.with_shell: + binpath = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH env var: {binpath}") + self.env_info.PATH.append(binpath) diff --git a/recipes/duckdb/all/patches/0.5.1-0001-fix-cmake.patch b/recipes/duckdb/all/patches/0.5.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..4c586f0038760 --- /dev/null +++ b/recipes/duckdb/all/patches/0.5.1-0001-fix-cmake.patch @@ -0,0 +1,82 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cc43104..5b034d2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -196,6 +196,8 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS") + set(SUN TRUE) + endif() + ++if(0) # conan patch ++ + execute_process( + COMMAND git log -1 --format=%h + WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +@@ -236,6 +238,10 @@ else() + set(DUCKDB_VERSION "v${DUCKDB_MAJOR_VERSION}.${DUCKDB_MINOR_VERSION}.${DUCKDB_PATCH_VERSION}-dev${DUCKDB_DEV_ITERATION}") + endif() + ++else() # conan patch ++set(DUCKDB_VERSION "v${DUCKDB_MAJOR_VERSION}.${DUCKDB_MINOR_VERSION}.${DUCKDB_PATCH_VERSION}-dev${DUCKDB_DEV_ITERATION}") ++endif() # conan patch ++ + option(AMALGAMATION_BUILD + "Build from the amalgamation files, rather than from the normal sources." + FALSE) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 7e07a47..8027d90 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -166,9 +166,18 @@ if(BUILD_PYTHON + endif() + endif() + +-install( +- TARGETS duckdb duckdb_static +- EXPORT "${DUCKDB_EXPORT_SET}" +- LIBRARY DESTINATION "${INSTALL_LIB_DIR}" +- ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" +- RUNTIME DESTINATION "${INSTALL_BIN_DIR}") ++if(BUILD_SHARED_LIBS) ++ install( ++ TARGETS duckdb ++ EXPORT "${DUCKDB_EXPORT_SET}" ++ LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ++ ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" ++ RUNTIME DESTINATION "${INSTALL_BIN_DIR}") ++else() ++ install( ++ TARGETS duckdb_static ++ EXPORT "${DUCKDB_EXPORT_SET}" ++ LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ++ ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" ++ RUNTIME DESTINATION "${INSTALL_BIN_DIR}") ++endif() +diff --git a/tools/odbc/CMakeLists.txt b/tools/odbc/CMakeLists.txt +index 9d116b9..b46e5bd 100644 +--- a/tools/odbc/CMakeLists.txt ++++ b/tools/odbc/CMakeLists.txt +@@ -53,3 +53,11 @@ add_library( + set_target_properties(duckdb_odbc PROPERTIES DEFINE_SYMBOL "DUCKDB_ODBC_API") + + target_link_libraries(duckdb_odbc ${LINK_LIB_LIST} duckdb_static) ++ ++install( ++ TARGETS duckdb_odbc ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ++) +diff --git a/tools/sqlite3_api_wrapper/CMakeLists.txt b/tools/sqlite3_api_wrapper/CMakeLists.txt +index cef9622..ca7e1f1 100644 +--- a/tools/sqlite3_api_wrapper/CMakeLists.txt ++++ b/tools/sqlite3_api_wrapper/CMakeLists.txt +@@ -14,7 +14,7 @@ add_library(sqlite3_api_wrapper_static STATIC sqlite3_api_wrapper.cpp + target_link_libraries(sqlite3_api_wrapper_static duckdb_static duckdb_utf8proc) + link_threads(sqlite3_api_wrapper_static) + +-if(NOT WIN32) ++if(BUILD_SHARED_LIBS AND NOT WIN32) + add_library(sqlite3_api_wrapper SHARED sqlite3_api_wrapper.cpp + ${ALL_OBJECT_FILES}) + target_link_libraries(sqlite3_api_wrapper duckdb ${DUCKDB_EXTRA_LINK_FLAGS}) diff --git a/recipes/duckdb/all/patches/0.6.0-0001-fix-cmake.patch b/recipes/duckdb/all/patches/0.6.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..d43649a21a753 --- /dev/null +++ b/recipes/duckdb/all/patches/0.6.0-0001-fix-cmake.patch @@ -0,0 +1,58 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index b1bb843..4a4949c 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -167,9 +167,18 @@ if(BUILD_PYTHON + endif() + endif() + +-install( +- TARGETS duckdb duckdb_static +- EXPORT "${DUCKDB_EXPORT_SET}" +- LIBRARY DESTINATION "${INSTALL_LIB_DIR}" +- ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" +- RUNTIME DESTINATION "${INSTALL_BIN_DIR}") ++if(BUILD_SHARED_LIBS) ++ install( ++ TARGETS duckdb ++ EXPORT "${DUCKDB_EXPORT_SET}" ++ LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ++ ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" ++ RUNTIME DESTINATION "${INSTALL_BIN_DIR}") ++else() ++ install( ++ TARGETS duckdb_static ++ EXPORT "${DUCKDB_EXPORT_SET}" ++ LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ++ ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" ++ RUNTIME DESTINATION "${INSTALL_BIN_DIR}") ++endif() +diff --git a/tools/odbc/CMakeLists.txt b/tools/odbc/CMakeLists.txt +index 9d116b9..b46e5bd 100644 +--- a/tools/odbc/CMakeLists.txt ++++ b/tools/odbc/CMakeLists.txt +@@ -53,3 +53,11 @@ add_library( + set_target_properties(duckdb_odbc PROPERTIES DEFINE_SYMBOL "DUCKDB_ODBC_API") + + target_link_libraries(duckdb_odbc ${LINK_LIB_LIST} duckdb_static) ++ ++install( ++ TARGETS duckdb_odbc ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ++) +diff --git a/tools/sqlite3_api_wrapper/CMakeLists.txt b/tools/sqlite3_api_wrapper/CMakeLists.txt +index e785d4f..922746f 100644 +--- a/tools/sqlite3_api_wrapper/CMakeLists.txt ++++ b/tools/sqlite3_api_wrapper/CMakeLists.txt +@@ -17,7 +17,7 @@ add_library(sqlite3_api_wrapper_static STATIC ${SQLITE_API_WRAPPER_FILES}) + target_link_libraries(sqlite3_api_wrapper_static duckdb_static duckdb_utf8proc) + link_threads(sqlite3_api_wrapper_static) + +-if(NOT WIN32) ++if(BUILD_SHARED_LIBS AND NOT WIN32) + add_library(sqlite3_api_wrapper SHARED ${SQLITE_API_WRAPPER_FILES}) + target_link_libraries(sqlite3_api_wrapper duckdb ${DUCKDB_EXTRA_LINK_FLAGS}) + link_threads(sqlite3_api_wrapper) diff --git a/recipes/duckdb/all/patches/0.6.0-0002-include-stdlib.patch b/recipes/duckdb/all/patches/0.6.0-0002-include-stdlib.patch new file mode 100644 index 0000000000000..e9e04e59a49cc --- /dev/null +++ b/recipes/duckdb/all/patches/0.6.0-0002-include-stdlib.patch @@ -0,0 +1,12 @@ +diff --git a/extension/jemalloc/jemalloc/include/jemalloc/internal/jemalloc_preamble.h b/extension/jemalloc/jemalloc/include/jemalloc/internal/jemalloc_preamble.h +index 47455cb..cfd73bc 100644 +--- a/extension/jemalloc/jemalloc/include/jemalloc/internal/jemalloc_preamble.h ++++ b/extension/jemalloc/jemalloc/include/jemalloc/internal/jemalloc_preamble.h +@@ -4,6 +4,7 @@ + #include + #include + #include ++#include + + #include "jemalloc/internal/jemalloc_internal_defs.h" + #include "jemalloc/internal/jemalloc_internal_decls.h" diff --git a/recipes/duckdb/all/test_package/CMakeLists.txt b/recipes/duckdb/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..139856fb65898 --- /dev/null +++ b/recipes/duckdb/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(duckdb REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE duckdb::duckdb) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/duckdb/all/test_package/conanfile.py b/recipes/duckdb/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fbb7f543162 --- /dev/null +++ b/recipes/duckdb/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/duckdb/all/test_package/test_package.cpp b/recipes/duckdb/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..66bd4253c138b --- /dev/null +++ b/recipes/duckdb/all/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include +#include "duckdb.hpp" + +int main() { + duckdb::DuckDB db(nullptr); + duckdb::Connection con(db); +} diff --git a/recipes/duckdb/all/test_v1_package/CMakeLists.txt b/recipes/duckdb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/duckdb/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/duckdb/all/test_v1_package/conanfile.py b/recipes/duckdb/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/duckdb/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/duckdb/config.yml b/recipes/duckdb/config.yml new file mode 100644 index 0000000000000..49d19e4d3a5cb --- /dev/null +++ b/recipes/duckdb/config.yml @@ -0,0 +1,7 @@ +versions: + "0.6.1": + folder: "all" + "0.6.0": + folder: "all" + "0.5.1": + folder: "all" diff --git a/recipes/earcut/all/conandata.yml b/recipes/earcut/all/conandata.yml index 87ccbe5b9a3f8..e7672ce5fb5f3 100644 --- a/recipes/earcut/all/conandata.yml +++ b/recipes/earcut/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.2.4": + url: "https://github.com/mapbox/earcut.hpp/archive/v2.2.4.tar.gz" + sha256: "fcfa6a47a52d4c94dc960bdb747f17e077609235517b0bb5ce8097d6b747695a" "2.2.3": url: "https://github.com/mapbox/earcut.hpp/archive/v2.2.3.tar.gz" sha256: "f382616de763289c698f37ec3a5b9fcd3d6d821cbef0b3c72e43bdd909c81b5a" diff --git a/recipes/earcut/config.yml b/recipes/earcut/config.yml index 9252671a6fdf5..dc295dd4a8376 100644 --- a/recipes/earcut/config.yml +++ b/recipes/earcut/config.yml @@ -1,4 +1,6 @@ versions: + "2.2.4": + folder: "all" "2.2.3": folder: "all" "0.12.4": diff --git a/recipes/easyexif/all/CMakeLists.txt b/recipes/easyexif/all/CMakeLists.txt index 22135247879f7..de50a2ead5152 100644 --- a/recipes/easyexif/all/CMakeLists.txt +++ b/recipes/easyexif/all/CMakeLists.txt @@ -4,21 +4,16 @@ project(easyexif) set(CMAKE_CXX_STANDARD_REQUIRED True) set(CMAKE_CXX_STANDARD 11) -include(conanbuildinfo.cmake) -conan_basic_setup() - if(WIN32 AND BUILD_SHARED_LIBS) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) endif() -set(SOURCE_SUBFOLDER "source_subfolder") - -add_library(easyexif ${SOURCE_SUBFOLDER}/exif.cpp) -target_include_directories(easyexif PUBLIC ${SOURCE_SUBFOLDER}/exif.h) +add_library(easyexif exif.cpp) +target_include_directories(easyexif PUBLIC exif.h) install(TARGETS easyexif RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -install(FILES ${SOURCE_SUBFOLDER}/exif.h DESTINATION include/easyexif) +install(FILES exif.h DESTINATION include/easyexif) diff --git a/recipes/easyexif/all/conanfile.py b/recipes/easyexif/all/conanfile.py index 6deb69e5aa23b..c2f91926a073b 100644 --- a/recipes/easyexif/all/conanfile.py +++ b/recipes/easyexif/all/conanfile.py @@ -1,5 +1,11 @@ import os -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get + +required_conan_version = ">=1.53.0" + class EasyExifConan(ConanFile): name = "easyexif" @@ -15,44 +21,38 @@ class EasyExifConan(ConanFile): "fPIC": [True, False] } default_options = {"shared": False, "fPIC": True} - generators = "cmake" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") def configure(self): if self.options.shared: - del self.options.fPIC - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") + + def validate(self): + if self.info.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, 11) + + def layout(self): + cmake_layout(self) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) def package_info(self): self.cpp_info.libs = ["easyexif"] diff --git a/recipes/easyexif/all/test_v1_package/CMakeLists.txt b/recipes/easyexif/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a84ec58a29d01 --- /dev/null +++ b/recipes/easyexif/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(easyexif REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/example.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE easyexif::easyexif) diff --git a/recipes/easyexif/all/test_v1_package/conanfile.py b/recipes/easyexif/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a691174f8ed16 --- /dev/null +++ b/recipes/easyexif/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + diff --git a/recipes/easyhttpcpp/all/CMakeLists.txt b/recipes/easyhttpcpp/all/CMakeLists.txt deleted file mode 100644 index e8b95837a314d..0000000000000 --- a/recipes/easyhttpcpp/all/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(NOT CMAKE_CXX_STANDARD) - set(CMAKE_CXX_STANDARD 11) -endif() - -if(WIN32 AND BUILD_SHARED_LIBS) - add_definitions(-DEASYHTTPCPP_DLL -DEASYHTTPCPP_API_EXPORTS) -endif() - -add_subdirectory("source_subfolder") - diff --git a/recipes/easyhttpcpp/all/conandata.yml b/recipes/easyhttpcpp/all/conandata.yml index 06ce6d2b32d4e..cf0e07a0bd9a5 100644 --- a/recipes/easyhttpcpp/all/conandata.yml +++ b/recipes/easyhttpcpp/all/conandata.yml @@ -1,10 +1,12 @@ sources: "2.1.0": - url: "https://github.com/sony/easyhttpcpp/archive/2.1.0.tar.gz" + url: "https://github.com/sony/easyhttpcpp/archive/refs/tags/2.1.0.tar.gz" sha256: "a20216039af129900a270e020917c3e7e7b9eb45d73ff09b1c5d9b44777a6b75" patches: "2.1.0": - - patch_file: "patches/0001-allow-inclusion-as-subproject.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-use-poco-target.cmake" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-cmake-config-in-path.patch" + patch_description: "Fix path to easyhttpcppeasyhttpConfig.cmake.in" + patch_type: "conan" + - patch_file: "patches/0002-use-poco-targets.patch" + patch_description: "Use Poco targets, remove OpenSSL from direct dependencies" + patch_type: "conan" diff --git a/recipes/easyhttpcpp/all/conanfile.py b/recipes/easyhttpcpp/all/conanfile.py index 853529f9fe974..519369a7d9e1a 100644 --- a/recipes/easyhttpcpp/all/conanfile.py +++ b/recipes/easyhttpcpp/all/conanfile.py @@ -1,17 +1,22 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd, valid_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os +required_conan_version = ">=1.53.0" + class EasyhttpcppConan(ConanFile): name = "easyhttpcpp" description = "A cross-platform HTTP client library with a focus on usability and speed" - license = ("MIT",) - topics = ("conan", "easyhttpcpp", "http", "client", "protocol") + license = "MIT" + topics = ("http", "client", "protocol") homepage = "https://github.com/sony/easyhttpcpp" url = "https://github.com/conan-io/conan-center-index" - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,9 +26,15 @@ class EasyhttpcppConan(ConanFile): "shared": False, "fPIC": True, } + short_paths = True - _cmake = None + @property + def _min_cppstd(self): + return "11" + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -31,20 +42,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - @property - def _source_subfolder(self): - return "source_subfolder" + self.options.rm_safe("fPIC") - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("{}-{}".format(self.name, self.version), self._source_subfolder) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("poco/1.10.1") - if self.settings.os != "Windows": - self.requires("openssl/1.1.1g") + self.requires("poco/1.12.4", transitive_headers=True, transitive_libs=True) @property def _required_poco_components(self): @@ -55,42 +59,67 @@ def _required_poco_components(self): comps.append("enable_netssl") return comps - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["FORCE_SHAREDLIB"] = self.options.shared - self._cmake.configure() - return self._cmake + def validate(self): + if any([not self.dependencies["poco"].options.get_safe(comp, False) for comp in self._required_poco_components]): + raise ConanInvalidConfiguration( + f"{self.ref} requires the following poco options enabled: {', '.join(self._required_poco_components)}" + ) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - def _patch_sources(self): - for patch in self.conan_data["patches"].get(self.version, []): - tools.patch(**patch) + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def build(self): - for comp in self._required_poco_components: - if not getattr(self.options["poco"], comp): - raise ConanInvalidConfiguration("{} requires the following poco option enabled: '{}'".format(self.name, comp)) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["FORCE_SHAREDLIB"] = self.options.shared + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + if self.settings.os == "Windows" and self.options.shared: + tc.preprocessor_definitions["EASYHTTPCPP_DLL"] = "1" + tc.preprocessor_definitions["EASYHTTPCPP_API_EXPORTS"] = "1" + tc.generate() + deps = CMakeDeps(self) + deps.generate() - self._patch_sources() - cmake = self._configure_cmake() + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "easyhttpcppeasyhttp") + self.cpp_info.set_property("cmake_target_name", "easyhttpcpp::easyhttp") + # TODO: back to global scope in conan v2 libsuffix = "" if self.settings.build_type == "Debug": - if self.settings.os == "Windows": - if not self.options.shared: - libsuffix += "md" + if self.settings.os == "Windows" and not self.options.shared: + libsuffix += "md" libsuffix += "d" - self.cpp_info.libs = ["easyhttp{}".format(libsuffix)] + self.cpp_info.components["easyhttp"].libs = [f"easyhttp{libsuffix}"] if self.settings.os == "Windows" and self.options.shared: - self.cpp_info.defines.append("EASYHTTPCPP_DLL") - self.cpp_info.names["cmake_find_package"] = "easyhttpcppeasyhttp" - self.cpp_info.names["cmake_find_package_multi"] = "easyhttpcppeasyhttp" + self.cpp_info.components["easyhttp"].defines.append("EASYHTTPCPP_DLL") + self.cpp_info.components["easyhttp"].requires = [ + "poco::poco_foundation", "poco::poco_data", + "poco::poco_datasqlite", "poco::poco_net", + ] + if self.settings.os == "Windows": + self.cpp_info.components["easyhttp"].requires.append("poco::poco_netsslwin") + else: + self.cpp_info.components["easyhttp"].requires.append("poco::poco_netssl") + + # TODO: to remove in conan v2 + self.cpp_info.filenames["cmake_find_package"] = "easyhttpcppeasyhttp" + self.cpp_info.filenames["cmake_find_package_multi"] = "easyhttpcppeasyhttp" + self.cpp_info.names["cmake_find_package"] = "easyhttpcpp" + self.cpp_info.names["cmake_find_package_multi"] = "easyhttpcpp" + self.cpp_info.components["easyhttp"].names["cmake_find_package"] = "easyhttp" + self.cpp_info.components["easyhttp"].names["cmake_find_package_multi"] = "easyhttp" + self.cpp_info.components["easyhttp"].set_property("cmake_target_name", "easyhttpcpp::easyhttp") diff --git a/recipes/easyhttpcpp/all/patches/0001-allow-inclusion-as-subproject.patch b/recipes/easyhttpcpp/all/patches/0001-allow-inclusion-as-subproject.patch deleted file mode 100644 index 54091b3c5d5b2..0000000000000 --- a/recipes/easyhttpcpp/all/patches/0001-allow-inclusion-as-subproject.patch +++ /dev/null @@ -1,264 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -14,7 +14,7 @@ option(EASYHTTPCPP_VERBOSE_MESSAGES "Enable informational messages during config - set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) - set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib) - set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) --set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -- -+set(PROJECT_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_MODULE_PATH}) - if (WIN32) - if (NOT FORCE_SHAREDLIB) -@@ -52,12 +53,12 @@ if (FORCE_SHAREDLIB) - set(CMAKE_POSITION_INDEPENDENT_CODE ON) - set(LIB_MODE SHARED) - if (EASYHTTPCPP_VERBOSE_MESSAGES) -- message(STATUS "Building shared ${CMAKE_PROJECT_NAME} libraries") -+ message(STATUS "Building shared ${PROJECT_NAME} libraries") - endif () - else () - set(LIB_MODE STATIC) - if (EASYHTTPCPP_VERBOSE_MESSAGES) -- message(STATUS "Building static ${CMAKE_PROJECT_NAME} libraries") -+ message(STATUS "Building static ${PROJECT_NAME} libraries") - endif () - endif () - -@@ -170,19 +170,19 @@ endif () - - include(CMakePackageConfigHelpers) - write_basic_package_version_file( -- "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake" -+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake" - VERSION ${PROJECT_VERSION} - COMPATIBILITY AnyNewerVersion - ) - - configure_file(cmake/DefineProjectConfig.cmake.in -- "${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}Config.cmake" @ONLY) -+ "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake" @ONLY) - install( - FILES -- ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}Config.cmake -- ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}ConfigVersion.cmake -+ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}Config.cmake -+ ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}ConfigVersion.cmake - DESTINATION -- "lib/cmake/${CMAKE_PROJECT_NAME}" -+ "lib/cmake/${PROJECT_NAME}" - COMPONENT - Devel - ) ---- cmake/DefineProjectConfig.cmake.in -+++ cmake/DefineProjectConfig.cmake.in -@@ -1,49 +1,49 @@ - if (CMAKE_VERSION VERSION_LESS 3.0) -- message(FATAL_ERROR "@CMAKE_PROJECT_NAME@ requires at least CMake version 3.0") -+ message(FATAL_ERROR "@PROJECT_NAME@ requires at least CMake version 3.0") - endif () - --set(_@CMAKE_PROJECT_NAME@_FIND_PARTS_REQUIRED) --if (@CMAKE_PROJECT_NAME@_FIND_REQUIRED) -- set(_@CMAKE_PROJECT_NAME@_FIND_PARTS_REQUIRED REQUIRED) -+set(_@PROJECT_NAME@_FIND_PARTS_REQUIRED) -+if (@PROJECT_NAME@_FIND_REQUIRED) -+ set(_@PROJECT_NAME@_FIND_PARTS_REQUIRED REQUIRED) - endif () --set(_@CMAKE_PROJECT_NAME@_FIND_PARTS_QUIET) --if (@CMAKE_PROJECT_NAME@_FIND_QUIETLY) -- set(_@CMAKE_PROJECT_NAME@_FIND_PARTS_QUIET QUIET) -+set(_@PROJECT_NAME@_FIND_PARTS_QUIET) -+if (@PROJECT_NAME@_FIND_QUIETLY) -+ set(_@PROJECT_NAME@_FIND_PARTS_QUIET QUIET) - endif () - --get_filename_component(_@CMAKE_PROJECT_NAME@_install_prefix "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE) -+get_filename_component(_@PROJECT_NAME@_install_prefix "${CMAKE_CURRENT_LIST_DIR}" ABSOLUTE) - --set(_@CMAKE_PROJECT_NAME@_NOTFOUND_MESSAGE) -+set(_@PROJECT_NAME@_NOTFOUND_MESSAGE) - --set(_@CMAKE_PROJECT_NAME@_CMAKE_PREFIX_PATH_old ${CMAKE_PREFIX_PATH}) --set(CMAKE_PREFIX_PATH ${_@CMAKE_PROJECT_NAME@_install_prefix}) -+set(_@PROJECT_NAME@_CMAKE_PREFIX_PATH_old ${CMAKE_PREFIX_PATH}) -+set(CMAKE_PREFIX_PATH ${_@PROJECT_NAME@_install_prefix}) - - set(module @LIBRARY_TARGET_NAME@) --find_package(@CMAKE_PROJECT_NAME@${module} -- ${_@CMAKE_PROJECT_NAME@_FIND_PARTS_QUIET} -- ${_@CMAKE_PROJECT_NAME@_FIND_PARTS_REQUIRED} -- PATHS "${_@CMAKE_PROJECT_NAME@_install_prefix}" NO_DEFAULT_PATH -+find_package(@PROJECT_NAME@${module} -+ ${_@PROJECT_NAME@_FIND_PARTS_QUIET} -+ ${_@PROJECT_NAME@_FIND_PARTS_REQUIRED} -+ PATHS "${_@PROJECT_NAME@_install_prefix}" NO_DEFAULT_PATH - ) --if (NOT @CMAKE_PROJECT_NAME@${module}_FOUND) -- if (@CMAKE_PROJECT_NAME@_FIND_REQUIRED_${module}) -- set(_@CMAKE_PROJECT_NAME@_NOTFOUND_MESSAGE -- "${_@CMAKE_PROJECT_NAME@_NOTFOUND_MESSAGE}Failed to find @CMAKE_PROJECT_NAME@ component \"${module}\" config file at \"${_@CMAKE_PROJECT_NAME@_install_prefix}/@CMAKE_PROJECT_NAME@${module}/@CMAKE_PROJECT_NAME@${module}Config.cmake\"\n") -- elseif (NOT @CMAKE_PROJECT_NAME@_FIND_QUIETLY) -- message(WARNING "Failed to find @CMAKE_PROJECT_NAME@ component \"${module}\" config file at \"${_@CMAKE_PROJECT_NAME@_install_prefix}/@CMAKE_PROJECT_NAME@${module}/@CMAKE_PROJECT_NAME@${module}Config.cmake\"") -+if (NOT @PROJECT_NAME@${module}_FOUND) -+ if (@PROJECT_NAME@_FIND_REQUIRED_${module}) -+ set(_@PROJECT_NAME@_NOTFOUND_MESSAGE -+ "${_@PROJECT_NAME@_NOTFOUND_MESSAGE}Failed to find @PROJECT_NAME@ component \"${module}\" config file at \"${_@PROJECT_NAME@_install_prefix}/@PROJECT_NAME@${module}/@PROJECT_NAME@${module}Config.cmake\"\n") -+ elseif (NOT @PROJECT_NAME@_FIND_QUIETLY) -+ message(WARNING "Failed to find @PROJECT_NAME@ component \"${module}\" config file at \"${_@PROJECT_NAME@_install_prefix}/@PROJECT_NAME@${module}/@PROJECT_NAME@${module}Config.cmake\"") - endif () - endif () - - # For backward compatibility set the LIBRARIES variable --list(APPEND @CMAKE_PROJECT_NAME@_LIBRARIES "@CMAKE_PROJECT_NAME@::${module}") -+list(APPEND @PROJECT_NAME@_LIBRARIES "@PROJECT_NAME@::${module}") - - # For backward compatibility set the INCLUDE_DIR(s) variables --list(APPEND @CMAKE_PROJECT_NAME@_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include") --list(APPEND @CMAKE_PROJECT_NAME@_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include") -+list(APPEND @PROJECT_NAME@_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include") -+list(APPEND @PROJECT_NAME@_INCLUDE_DIRS "@CMAKE_INSTALL_PREFIX@/include") - - # Restore the original CMAKE_PREFIX_PATH value --set(CMAKE_PREFIX_PATH ${_@CMAKE_PROJECT_NAME@_CMAKE_PREFIX_PATH_old}) -+set(CMAKE_PREFIX_PATH ${_@PROJECT_NAME@_CMAKE_PREFIX_PATH_old}) - --if (_@CMAKE_PROJECT_NAME@_NOTFOUND_MESSAGE) -- set(@CMAKE_PROJECT_NAME@_NOT_FOUND_MESSAGE "${_@CMAKE_PROJECT_NAME@_NOTFOUND_MESSAGE}") -- set(@CMAKE_PROJECT_NAME@_FOUND False) -+if (_@PROJECT_NAME@_NOTFOUND_MESSAGE) -+ set(@PROJECT_NAME@_NOT_FOUND_MESSAGE "${_@PROJECT_NAME@_NOTFOUND_MESSAGE}") -+ set(@PROJECT_NAME@_FOUND False) - endif () ---- cmake/DefineProjectMacros.cmake -+++ cmake/DefineProjectMacros.cmake -@@ -9,34 +9,34 @@ - macro(easyhttpcpp_generate_package target_name) - include(CMakePackageConfigHelpers) - write_basic_package_version_file( -- "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}${target_name}ConfigVersion.cmake" -+ "${PROJECT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}ConfigVersion.cmake" - VERSION ${PROJECT_VERSION} - COMPATIBILITY AnyNewerVersion - ) - export(EXPORT "${target_name}Targets" -- FILE "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}${target_name}Targets.cmake" -- NAMESPACE "${CMAKE_PROJECT_NAME}::" -+ FILE "${PROJECT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Targets.cmake" -+ NAMESPACE "${PROJECT_NAME}::" - ) - -- configure_file("${CMAKE_MODULE_PATH}/${CMAKE_PROJECT_NAME}${target_name}Config.cmake.in" -- "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}${target_name}Config.cmake" -+ configure_file("${PROJECT_MODULE_PATH}/${PROJECT_NAME}${target_name}Config.cmake.in" -+ "${PROJECT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake" - @ONLY - ) - -- set(ConfigPackageLocation "lib/cmake/${CMAKE_PROJECT_NAME}") -+ set(ConfigPackageLocation "lib/cmake/${PROJECT_NAME}") - - install( - EXPORT "${target_name}Targets" -- FILE "${CMAKE_PROJECT_NAME}${target_name}Targets.cmake" -- NAMESPACE "${CMAKE_PROJECT_NAME}::" -- DESTINATION "lib/cmake/${CMAKE_PROJECT_NAME}" -+ FILE "${PROJECT_NAME}${target_name}Targets.cmake" -+ NAMESPACE "${PROJECT_NAME}::" -+ DESTINATION "lib/cmake/${PROJECT_NAME}" - ) - - install( - FILES -- "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}${target_name}Config.cmake" -- "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}${target_name}ConfigVersion.cmake" -- DESTINATION "lib/cmake/${CMAKE_PROJECT_NAME}" -+ "${PROJECT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}Config.cmake" -+ "${PROJECT_BINARY_DIR}/${PROJECT_NAME}/${PROJECT_NAME}${target_name}ConfigVersion.cmake" -+ DESTINATION "lib/cmake/${PROJECT_NAME}" - COMPONENT Devel - ) - endmacro() ---- cmake/DefineProjectVersion.cmake -+++ cmake/DefineProjectVersion.cmake -@@ -12,7 +12,7 @@ - - if (EASYHTTPCPP_VERBOSE_MESSAGES) - message(STATUS) -- message(STATUS "################# ${CMAKE_PROJECT_NAME} version details #################") -+ message(STATUS "################# ${PROJECT_NAME} version details #################") - endif () - - file(STRINGS "${PROJECT_SOURCE_DIR}/libversion" SHARED_LIBRARY_VERSION) -@@ -22,7 +22,7 @@ file(STRINGS "${PROJECT_SOURCE_DIR}/VERSION" PACKAGE_VERSION) - add_definitions(-DPACKAGE_VERSION=${PACKAGE_VERSION}) - - if (EASYHTTPCPP_VERBOSE_MESSAGES) -- message(STATUS "${CMAKE_PROJECT_NAME} package version: ${PACKAGE_VERSION}") -+ message(STATUS "${PROJECT_NAME} package version: ${PACKAGE_VERSION}") - endif () - - string(REGEX REPLACE "([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" CPACK_PACKAGE_VERSION_MAJOR ${PACKAGE_VERSION}) -@@ -41,16 +41,16 @@ add_definitions(-DPACKAGE_VERSION_PATCH=${CPACK_PACKAGE_VERSION_PATCH}) - add_definitions(-DPACKAGE_VERSION_EXT=${CPACK_PACKAGE_VERSION_EXT}) - - if (EASYHTTPCPP_VERBOSE_MESSAGES) -- message(STATUS "${CMAKE_PROJECT_NAME} package version major: ${CPACK_PACKAGE_VERSION_MAJOR}") -- message(STATUS "${CMAKE_PROJECT_NAME} package version minor: ${CPACK_PACKAGE_VERSION_MINOR}") -- message(STATUS "${CMAKE_PROJECT_NAME} package version patch: ${CPACK_PACKAGE_VERSION_PATCH}") -- message(STATUS "${CMAKE_PROJECT_NAME} package version extensions: ${CPACK_PACKAGE_VERSION_EXT}") -+ message(STATUS "${PROJECT_NAME} package version major: ${CPACK_PACKAGE_VERSION_MAJOR}") -+ message(STATUS "${PROJECT_NAME} package version minor: ${CPACK_PACKAGE_VERSION_MINOR}") -+ message(STATUS "${PROJECT_NAME} package version patch: ${CPACK_PACKAGE_VERSION_PATCH}") -+ message(STATUS "${PROJECT_NAME} package version extensions: ${CPACK_PACKAGE_VERSION_EXT}") - endif () - - set(PROJECT_VERSION ${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}) - - if (EASYHTTPCPP_VERBOSE_MESSAGES) -- message(STATUS "${CMAKE_PROJECT_NAME} project version: ${PROJECT_VERSION}") -- message(STATUS "################# ${CMAKE_PROJECT_NAME} version details #################") -+ message(STATUS "${PROJECT_NAME} project version: ${PROJECT_VERSION}") -+ message(STATUS "################# ${PROJECT_NAME} version details #################") - message(STATUS) - endif () ---- cmake/easyhttpcppeasyhttpConfig.cmake.in -+++ cmake/easyhttpcppeasyhttpConfig.cmake.in -@@ -1 +1 @@ --include("${CMAKE_CURRENT_LIST_DIR}/@CMAKE_PROJECT_NAME@@LIBRARY_TARGET_NAME@Targets.cmake") -\ No newline at end of file -+include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@@LIBRARY_TARGET_NAME@Targets.cmake") ---- doc/Doxyfile.in -+++ doc/Doxyfile.in -@@ -32,7 +32,7 @@ DOXYFILE_ENCODING = UTF-8 - # title of most generated pages and in a few other places. - # The default value is: My Project. - --PROJECT_NAME = @CMAKE_PROJECT_NAME@ -+PROJECT_NAME = @PROJECT_NAME@ - - # The PROJECT_NUMBER tag can be used to enter a project or revision number. This - # could be handy for archiving the generated documentation or if some version -@@ -2424,4 +2424,4 @@ GENERATE_LEGEND = YES - # The default value is: YES. - # This tag requires that the tag HAVE_DOT is set to YES. - --DOT_CLEANUP = YES -\ No newline at end of file -+DOT_CLEANUP = YES ---- samples/AsyncHttpClient/CMakeLists.txt -+++ samples/AsyncHttpClient/CMakeLists.txt -@@ -1,4 +1,4 @@ --set(SAMPLE_NAME "${CMAKE_PROJECT_NAME}-AsyncHttpClient") -+set(SAMPLE_NAME "${PROJECT_NAME}-AsyncHttpClient") - - set(SAMPLE_SRCS "AsyncHttpClient.cpp") - ---- samples/SimpleHttpClient/CMakeLists.txt -+++ samples/SimpleHttpClient/CMakeLists.txt -@@ -1,4 +1,4 @@ --set(SAMPLE_NAME "${CMAKE_PROJECT_NAME}-SimpleHttpClient") -+set(SAMPLE_NAME "${PROJECT_NAME}-SimpleHttpClient") - - set(SAMPLE_SRCS "SimpleHttpClient.cpp") - diff --git a/recipes/easyhttpcpp/all/patches/0001-fix-cmake-config-in-path.patch b/recipes/easyhttpcpp/all/patches/0001-fix-cmake-config-in-path.patch new file mode 100644 index 0000000000000..02ab32989983b --- /dev/null +++ b/recipes/easyhttpcpp/all/patches/0001-fix-cmake-config-in-path.patch @@ -0,0 +1,11 @@ +--- a/cmake/DefineProjectMacros.cmake ++++ b/cmake/DefineProjectMacros.cmake +@@ -18,7 +18,7 @@ macro(easyhttpcpp_generate_package target_name) + NAMESPACE "${CMAKE_PROJECT_NAME}::" + ) + +- configure_file("${CMAKE_MODULE_PATH}/${CMAKE_PROJECT_NAME}${target_name}Config.cmake.in" ++ configure_file("${PROJECT_SOURCE_DIR}/cmake/${CMAKE_PROJECT_NAME}${target_name}Config.cmake.in" + "${CMAKE_BINARY_DIR}/${CMAKE_PROJECT_NAME}/${CMAKE_PROJECT_NAME}${target_name}Config.cmake" + @ONLY + ) diff --git a/recipes/easyhttpcpp/all/patches/0002-use-poco-target.cmake b/recipes/easyhttpcpp/all/patches/0002-use-poco-target.cmake deleted file mode 100644 index 35f0c34ff9ecd..0000000000000 --- a/recipes/easyhttpcpp/all/patches/0002-use-poco-target.cmake +++ /dev/null @@ -1,11 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -110,7 +110,7 @@ - ) - - target_link_libraries(${LIBRARY_TARGET_NAME} -- ${Poco_LIBRARIES} -+ Poco::Poco - ${OPENSSL_SSL_LIBRARY} - ${OPENSSL_CRYPTO_LIBRARY}) - diff --git a/recipes/easyhttpcpp/all/patches/0002-use-poco-targets.patch b/recipes/easyhttpcpp/all/patches/0002-use-poco-targets.patch new file mode 100644 index 0000000000000..32b3faa52f217 --- /dev/null +++ b/recipes/easyhttpcpp/all/patches/0002-use-poco-targets.patch @@ -0,0 +1,27 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -70,7 +70,6 @@ set(LIBRARY_TARGET_NAME "easyhttp") + if (WIN32) + find_package(Poco REQUIRED Foundation Data DataSQLite Net NetSSLWin CONFIG) + else () +- find_package(OpenSSL REQUIRED) + find_package(Poco REQUIRED Foundation Data DataSQLite Net NetSSL Crypto CONFIG) + endif () + +@@ -109,10 +108,12 @@ set_target_properties(${LIBRARY_TARGET_NAME} + OUTPUT_NAME ${LIBRARY_TARGET_NAME} + ) + +-target_link_libraries(${LIBRARY_TARGET_NAME} +- ${Poco_LIBRARIES} +- ${OPENSSL_SSL_LIBRARY} +- ${OPENSSL_CRYPTO_LIBRARY}) ++target_link_libraries(${LIBRARY_TARGET_NAME} PUBLIC Poco::Foundation Poco::Data Poco::DataSQLite Poco::Net) ++if(WIN32) ++ target_link_libraries(${LIBRARY_TARGET_NAME} PUBLIC Poco::NetSSLWin) ++else() ++ target_link_libraries(${LIBRARY_TARGET_NAME} PUBLIC Poco::NetSSL Poco::Crypto) ++endif() + + target_include_directories(${LIBRARY_TARGET_NAME} + PUBLIC diff --git a/recipes/easyhttpcpp/all/test_package/CMakeLists.txt b/recipes/easyhttpcpp/all/test_package/CMakeLists.txt index 829b5ca81b9ce..1c309d560ea6a 100644 --- a/recipes/easyhttpcpp/all/test_package/CMakeLists.txt +++ b/recipes/easyhttpcpp/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(easyhttpcppeasyhttp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE easyhttpcpp::easyhttp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/easyhttpcpp/all/test_package/conanfile.py b/recipes/easyhttpcpp/all/test_package/conanfile.py index e4d11bddfce22..99768c9dfed80 100644 --- a/recipes/easyhttpcpp/all/test_package/conanfile.py +++ b/recipes/easyhttpcpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run("{} {}".format(bin_path, "http://localhost:80"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(f"{bin_path} http://localhost:80", env="conanrun") diff --git a/recipes/easyhttpcpp/all/test_v1_package/CMakeLists.txt b/recipes/easyhttpcpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/easyhttpcpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/easyhttpcpp/all/test_v1_package/conanfile.py b/recipes/easyhttpcpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5da5f0f382b3f --- /dev/null +++ b/recipes/easyhttpcpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(f"{bin_path} http://localhost:80", run_environment=True) diff --git a/recipes/easyloggingpp/all/CMakeLists.txt b/recipes/easyloggingpp/all/CMakeLists.txt index dfcb8a6b0f135..f6fc5c33e69b0 100644 --- a/recipes/easyloggingpp/all/CMakeLists.txt +++ b/recipes/easyloggingpp/all/CMakeLists.txt @@ -7,6 +7,14 @@ option(enable_crash_log "Enable crash log handler" OFF) option(enable_thread_safe "Enable thread safety for use in multithreaded env" OFF) option(enable_debug_errors "Enable debug errors in case of configuration issues" OFF) option(enable_default_logfile "Enable creation of default logfile" ON) +option(disable_logs "Disables all logs" OFF) +option(disable_debug_logs "Disables debug logs" OFF) +option(disable_info_logs "Disables info logs" OFF) +option(disable_warning_logs "Disables warning logs" OFF) +option(disable_error_logs "Disables error logs" OFF) +option(disable_fatal_logs "Disables fatal logs" OFF) +option(disable_verbose_logs "Disables verbose logs" OFF) +option(disable_trace_logs "Disables trace logs" OFF) if (enable_crash_log) add_definitions(-DELPP_FEATURE_CRASH_LOG) @@ -24,4 +32,36 @@ if (NOT enable_default_logfile) add_definitions(-DELPP_NO_DEFAULT_LOG_FILE) endif() +if (disable_logs) + add_definitions(-DELPP_DISABLE_LOGS) +endif() + +if (disable_debug_logs) + add_definitions(-DELPP_DISABLE_DEBUG_LOGS) +endif() + +if (disable_info_logs) + add_definitions(-DELPP_DISABLE_INFO_LOGS) +endif() + +if (disable_warning_logs) + add_definitions(-DELPP_DISABLE_WARNING_LOGS) +endif() + +if (disable_error_logs) + add_definitions(-DELPP_DISABLE_ERROR_LOGS) +endif() + +if (disable_fatal_logs) + add_definitions(-DELPP_DISABLE_FATAL_LOGS) +endif() + +if (disable_verbose_logs) + add_definitions(-DELPP_DISABLE_VERBOSE_LOGS) +endif() + +if (disable_trace_logs) + add_definitions(-DELPP_DISABLE_TRACE_LOGS) +endif() + add_subdirectory("source_subfolder") diff --git a/recipes/easyloggingpp/all/conanfile.py b/recipes/easyloggingpp/all/conanfile.py index db2ac67a56416..b5d1f9b44e060 100644 --- a/recipes/easyloggingpp/all/conanfile.py +++ b/recipes/easyloggingpp/all/conanfile.py @@ -1,5 +1,7 @@ import os -from conans import ConanFile, CMake, tools +from conans import CMake +from conan.tools import files +from conan import ConanFile required_conan_version = ">=1.33.0" @@ -19,12 +21,28 @@ class EasyloggingppConan(ConanFile): "enable_thread_safe": [True, False], "enable_debug_errors": [True, False], "enable_default_logfile": [True, False], + "disable_logs": [True, False], + "disable_debug_logs": [True, False], + "disable_info_logs": [True, False], + "disable_warning_logs": [True, False], + "disable_error_logs": [True, False], + "disable_fatal_logs": [True, False], + "disable_verbose_logs": [True, False], + "disable_trace_logs": [True, False] } default_options = { "enable_crash_log": False, "enable_thread_safe": False, "enable_debug_errors": False, "enable_default_logfile": True, + "disable_logs": False, + "disable_debug_logs": False, + "disable_info_logs": False, + "disable_warning_logs": False, + "disable_error_logs": False, + "disable_fatal_logs": False, + "disable_verbose_logs": False, + "disable_trace_logs": False } _cmake = None @@ -45,11 +63,19 @@ def _configure_cmake(self): self._cmake.definitions["enable_thread_safe"] = self.options.enable_thread_safe self._cmake.definitions["enable_debug_errors"] = self.options.enable_debug_errors self._cmake.definitions["enable_default_logfile"] = self.options.enable_default_logfile + self._cmake.definitions["disable_logs"] = self.options.disable_logs + self._cmake.definitions["disable_debug_logs"] = self.options.disable_debug_logs + self._cmake.definitions["disable_info_logs"] = self.options.disable_info_logs + self._cmake.definitions["disable_warning_logs"] = self.options.disable_warning_logs + self._cmake.definitions["disable_error_logs"] = self.options.disable_error_logs + self._cmake.definitions["disable_fatal_logs"] = self.options.disable_fatal_logs + self._cmake.definitions["disable_verbose_logs"] = self.options.disable_verbose_logs + self._cmake.definitions["disable_trace_logs"] = self.options.disable_trace_logs self._cmake.configure(build_folder=self._build_subfolder) return self._cmake def source(self): - tools.get(**self.conan_data["sources"][self.version], + files.get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def build(self): @@ -59,7 +85,7 @@ def build(self): def package(self): cmake = self._configure_cmake() cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + files.rmdir(self, os.path.join(self.package_folder, "share")) self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) @@ -76,3 +102,20 @@ def package_info(self): self.cpp_info.defines.append("ELPP_DEBUG_ERRORS") if self.options.enable_default_logfile: self.cpp_info.defines.append("ELPP_NO_DEFAULT_LOG_FILE") + if self.options.disable_logs: + self.cpp_info.defines.append("ELPP_DISABLE_LOGS") + if self.options.disable_debug_logs: + self.cpp_info.defines.append("ELPP_DISABLE_DEBUG_LOGS") + if self.options.disable_info_logs: + self.cpp_info.defines.append("ELPP_DISABLE_INFO_LOGS") + if self.options.disable_warning_logs: + self.cpp_info.defines.append("ELPP_DISABLE_WARNING_LOGS") + if self.options.disable_error_logs: + self.cpp_info.defines.append("ELPP_DISABLE_ERROR_LOGS") + if self.options.disable_fatal_logs: + self.cpp_info.defines.append("ELPP_DISABLE_FATAL_LOGS") + if self.options.disable_verbose_logs: + self.cpp_info.defines.append("ELPP_DISABLE_VERBOSE_LOGS") + if self.options.disable_trace_logs: + self.cpp_info.defines.append("ELPP_DISABLE_TRACE_LOGS") + diff --git a/recipes/ecos/all/CMakeLists.txt b/recipes/ecos/all/CMakeLists.txt deleted file mode 100644 index c5630c8098ba3..0000000000000 --- a/recipes/ecos/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - -add_subdirectory(source_subfolder) diff --git a/recipes/ecos/all/conandata.yml b/recipes/ecos/all/conandata.yml index ddfac800071fa..3034805590c75 100644 --- a/recipes/ecos/all/conandata.yml +++ b/recipes/ecos/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "2.0.8": - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-missing-include.patch" - base_path: "source_subfolder" diff --git a/recipes/ecos/all/conanfile.py b/recipes/ecos/all/conanfile.py index 48767c8ddc05e..6947c543e0352 100644 --- a/recipes/ecos/all/conanfile.py +++ b/recipes/ecos/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class EcosConan(ConanFile): @@ -24,13 +26,8 @@ class EcosConan(ConanFile): "use_long": True, } - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,41 +35,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): # TODO: unvendor suitesparse pass def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USE_LONG"] = self.options.use_long - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_LONG"] = self.options.use_long + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "ecos" - self.cpp_info.names["cmake_find_package_multi"] = "ecos" + self.cpp_info.set_property("cmake_file_name", "ecos") + self.cpp_info.set_property("cmake_target_name", "ecos::ecos") self.cpp_info.libs = ["ecos"] self.cpp_info.defines.append("CTRLC=1") if self.options.use_long: diff --git a/recipes/ecos/all/test_package/CMakeLists.txt b/recipes/ecos/all/test_package/CMakeLists.txt index 9bc6a076f7ed2..006729666b6b5 100644 --- a/recipes/ecos/all/test_package/CMakeLists.txt +++ b/recipes/ecos/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(ecos REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ecos::ecos) +target_link_libraries(${PROJECT_NAME} PRIVATE ecos::ecos) diff --git a/recipes/ecos/all/test_package/conanfile.py b/recipes/ecos/all/test_package/conanfile.py index a9f777f7680ff..0a6bc68712d90 100644 --- a/recipes/ecos/all/test_package/conanfile.py +++ b/recipes/ecos/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ecos/all/test_v1_package/CMakeLists.txt b/recipes/ecos/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..465202cc7e581 --- /dev/null +++ b/recipes/ecos/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(ecos REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE ecos::ecos) diff --git a/recipes/ecos/all/test_v1_package/conanfile.py b/recipes/ecos/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/ecos/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/edlib/all/conanfile.py b/recipes/edlib/all/conanfile.py index a6092b1452f30..df371a10db550 100644 --- a/recipes/edlib/all/conanfile.py +++ b/recipes/edlib/all/conanfile.py @@ -1,24 +1,24 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, stdcpp_library from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version -from conans import tools as tools_legacy import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.54.0" class EdlibConan(ConanFile): name = "edlib" description = "Lightweight, super fast C/C++ (& Python) library for " \ "sequence alignment using edit (Levenshtein) distance." - topics = ("edlib", "sequence-alignment", "edit-distance", "levehnstein-distance", "alignment-path") + topics = ("sequence-alignment", "edit-distance", "levehnstein-distance", "alignment-path") license = "MIT" homepage = "https://github.com/Martinsos/edlib" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,9 +29,24 @@ class EdlibConan(ConanFile): "fPIC": True, } + @property + def _min_cppstd(self): + return "11" if Version(self.version) < "1.2.7" else "14" + + @property + def _minimum_compilers_version(self): + return { + "14": { + "Visual Studio": "15", + "msvc": "191", + "gcc": "5", + "clang": "5", + "apple-clang": "5.1", + }, + }.get(self._min_cppstd, {}) + def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,38 +54,23 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - @property - def _minimum_compilers_version(self): - return { - "Visual Studio": "15", - "gcc": "5", - "clang": "5", - "apple-clang": "5.1", - } + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if Version(self.version) < "1.2.7": - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) - return + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 14) - - minimum_version = self._minimum_compilers_version.get(str(self.info.settings.compiler), False) - if not minimum_version: - self.output.warn("{}/{} requires C++14. Your compiler is unknown. Assuming it supports C++14.".format(self.name, self.version)) - elif Version(self.info.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{}/{} requires C++14, which your compiler does not support.".format(self.name, self.version)) - - def layout(self): - cmake_layout(self, src_folder="src") + minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -100,11 +100,13 @@ def package(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "edlib") self.cpp_info.set_property("cmake_target_name", "edlib::edlib") - self.cpp_info.set_property("pkg_config_name", "edlib-{}".format(Version(self.version).major)) + self.cpp_info.set_property("pkg_config_name", f"edlib-{Version(self.version).major}") self.cpp_info.libs = ["edlib"] if self.options.shared: self.cpp_info.defines = ["EDLIB_SHARED"] if not self.options.shared: - stdcpp_library = tools_legacy.stdcpp_library(self) - if stdcpp_library: - self.cpp_info.system_libs.append(stdcpp_library) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/edlib/all/test_package/conanfile.py b/recipes/edlib/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/edlib/all/test_package/conanfile.py +++ b/recipes/edlib/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/edlib/all/test_v1_package/CMakeLists.txt b/recipes/edlib/all/test_v1_package/CMakeLists.txt index 1e3a08ac13187..0d20897301b68 100644 --- a/recipes/edlib/all/test_v1_package/CMakeLists.txt +++ b/recipes/edlib/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(edlib REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE edlib::edlib) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/edlib/all/test_v1_package/conanfile.py b/recipes/edlib/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/edlib/all/test_v1_package/conanfile.py +++ b/recipes/edlib/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/edyn/all/CMakeLists.txt b/recipes/edyn/all/CMakeLists.txt deleted file mode 100644 index 05ca2858f3f12..0000000000000 --- a/recipes/edyn/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper CXX) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/edyn/all/conandata.yml b/recipes/edyn/all/conandata.yml index f6b51ad6e6f7c..4f8e161949ad2 100644 --- a/recipes/edyn/all/conandata.yml +++ b/recipes/edyn/all/conandata.yml @@ -1,4 +1,4 @@ sources: - "1.0.0": - url: "https://github.com/xissburg/edyn/archive/refs/tags/v1.0.0.tar.gz" - sha256: "171ec6dd9fd6dae2b79a45496e1c0322a0b10badc801f921280fe78454f58928" + "1.2.1": + url: "https://github.com/xissburg/edyn/archive/refs/tags/v1.2.1.tar.gz" + sha256: "d088dac1bebed65cd342c76f27661fbb557b95f959a67137f4df1000d9698b13" diff --git a/recipes/edyn/all/conanfile.py b/recipes/edyn/all/conanfile.py index 0461ba3ef69ff..d6278b4cb5dcb 100644 --- a/recipes/edyn/all/conanfile.py +++ b/recipes/edyn/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" + class EdynConan(ConanFile): name = "edyn" @@ -12,8 +16,8 @@ class EdynConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/xissburg/edyn" topics = ("physics", "game-development", "ecs") + package_type = "library" settings = "os", "arch", "compiler", "build_type" - options = { "shared": [True, False], "fPIC": [True, False], @@ -24,20 +28,20 @@ class EdynConan(ConanFile): "fPIC": True, "floating_type": "float", } - generators = "cmake", "cmake_find_package_multi" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" @property - def _build_subfolder(self): - return "build_subfolder" - - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + def _compilers_minimum_version(self): + return { + "gcc": "9.3", # GCC 9.3 started supporting attributes in constructor arguments + "clang": "8", + "apple-clang": "10", + "Visual Studio": "16", + "msvc": "192", + } def config_options(self): if self.settings.os == "Windows": @@ -45,73 +49,61 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def requirements(self): - self.requires("entt/3.9.0") + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _compiler_required(self): - return { - "gcc": "9.3", # GCC 9.3 started supporting attributes in constructor arguments - } + def requirements(self): + self.requires("entt/3.10.3", transitive_headers=True) def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) - try: - minimum_required_compiler_version = self._compiler_required[str(self.settings.compiler)] - if tools.Version(self.settings.compiler.version) < minimum_required_compiler_version: - raise ConanInvalidConfiguration("This package requires C++17 support. The current compiler does not support it.") - except KeyError: - self.output.warn("This recipe has no support for the current compiler. Please consider adding it.") - + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["EDYN_CONFIG_DOUBLE"] = self.options.floating_type == "double" + tc.variables["EDYN_INSTALL"] = True + tc.variables["EDYN_BUILD_EXAMPLES"] = False + tc.variables["EDYN_BUILD_TESTS"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["EDYN_INSTALL"] = True - cmake.configure(build_folder=self._build_subfolder) - return cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, pattern="*.pdb", folder=self.package_folder, recursive=True) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - - self.cpp_info.set_property("cmake_find_mode", "both") - self.cpp_info.set_property("cmake_module_file_name", "Edyn") self.cpp_info.set_property("cmake_file_name", "Edyn") self.cpp_info.set_property("cmake_target_name", "Edyn::Edyn") - self.cpp_info.set_property("pkg_config_name", "Edyn") - + suffix = "_d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [f"Edyn{suffix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs += ["m", "pthread"] elif self.settings.os == "Windows": self.cpp_info.system_libs = ["winmm"] # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.filenames["cmake_find_package"] = "Edyn" - self.cpp_info.filenames["cmake_find_package_multi"] = "Edyn" self.cpp_info.names["cmake_find_package"] = "Edyn" self.cpp_info.names["cmake_find_package_multi"] = "Edyn" diff --git a/recipes/edyn/all/test_package/CMakeLists.txt b/recipes/edyn/all/test_package/CMakeLists.txt index e2cfbe0f46b9e..c81d1ceba454a 100644 --- a/recipes/edyn/all/test_package/CMakeLists.txt +++ b/recipes/edyn/all/test_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.1) - -project(test_package CXX) - - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Edyn REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) -target_link_libraries(${PROJECT_NAME} Edyn::Edyn) +target_link_libraries(${PROJECT_NAME} PRIVATE Edyn::Edyn) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/edyn/all/test_package/conanfile.py b/recipes/edyn/all/test_package/conanfile.py index a500b98343c74..4e578144a798a 100644 --- a/recipes/edyn/all/test_package/conanfile.py +++ b/recipes/edyn/all/test_package/conanfile.py @@ -1,9 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/edyn/all/test_v1_package/CMakeLists.txt b/recipes/edyn/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/edyn/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/edyn/all/test_v1_package/conanfile.py b/recipes/edyn/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/edyn/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/edyn/config.yml b/recipes/edyn/config.yml index 40341aa3db6cd..b230418434b61 100644 --- a/recipes/edyn/config.yml +++ b/recipes/edyn/config.yml @@ -1,3 +1,3 @@ versions: - "1.0.0": + "1.2.1": folder: all diff --git a/recipes/egl-headers/all/conandata.yml b/recipes/egl-headers/all/conandata.yml new file mode 100644 index 0000000000000..9599f3d0a9488 --- /dev/null +++ b/recipes/egl-headers/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20220525": + url: "https://github.com/KhronosGroup/EGL-Registry/archive/84f25dd4c04a01ea48480f7296ba9d64d435fa87.tar.gz" + sha256: "6a4cbc7cf8b9057250c5c3982939b2bf46b1c2bfe0795e1445b8f7f39bd33988" diff --git a/recipes/egl-headers/all/conanfile.py b/recipes/egl-headers/all/conanfile.py new file mode 100644 index 0000000000000..5f6e1786a60cb --- /dev/null +++ b/recipes/egl-headers/all/conanfile.py @@ -0,0 +1,46 @@ +from conan import ConanFile +from conan.tools.files import copy, get, load, save +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" + + +class EglHeadersConan(ConanFile): + name = "egl-headers" + description = "EGL Header files." + license = "Apache-2.0" + topics = ("egl-headers", "egl") + homepage = "https://github.com/KhronosGroup/EGL-Registry" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("khrplatform/cci.20200529") + + def package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + license_data = load(self, os.path.join(self.source_folder, "api", "EGL", "egl.h")) + begin = license_data.find("/*") + len("/*") + end = license_data.find("*/") + license_data = license_data[begin:end] + license_data = license_data.replace("**", "") + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_data) + + copy(self, "*", src=os.path.join(self.source_folder, "api", "EGL"), dst=os.path.join(self.package_folder, "include", "EGL")) + + def package_info(self): + pass diff --git a/recipes/egl-headers/all/test_package/CMakeLists.txt b/recipes/egl-headers/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8c6a625d847ec --- /dev/null +++ b/recipes/egl-headers/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(egl-headers REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} egl-headers::egl-headers) diff --git a/recipes/egl-headers/all/test_package/conanfile.py b/recipes/egl-headers/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/egl-headers/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/egl-headers/all/test_package/test_package.c b/recipes/egl-headers/all/test_package/test_package.c new file mode 100644 index 0000000000000..966cb253f7d85 --- /dev/null +++ b/recipes/egl-headers/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include "EGL/egl.h" +#include "EGL/eglext.h" +#include +#include + +int main() { + EGLBoolean value = EGL_TRUE; + printf("EGL_TRUE: %d\n", value); + return EXIT_SUCCESS; +} diff --git a/recipes/egl-headers/all/test_v1_package/CMakeLists.txt b/recipes/egl-headers/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de3b75d9538de --- /dev/null +++ b/recipes/egl-headers/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/egl-headers/all/test_v1_package/conanfile.py b/recipes/egl-headers/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..90f7a062ba0d0 --- /dev/null +++ b/recipes/egl-headers/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conans import CMake +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/egl-headers/config.yml b/recipes/egl-headers/config.yml new file mode 100644 index 0000000000000..cc6aac6874544 --- /dev/null +++ b/recipes/egl-headers/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20220525": + folder: all diff --git a/recipes/egl/system/conanfile.py b/recipes/egl/system/conanfile.py index 818059aea10ed..4afda7591156a 100644 --- a/recipes/egl/system/conanfile.py +++ b/recipes/egl/system/conanfile.py @@ -1,5 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.gnu import PkgConfig +from conan.tools.system import package_manager + +required_conan_version = ">=1.47" class SysConfigEGLConan(ConanFile): @@ -10,66 +14,36 @@ class SysConfigEGLConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.khronos.org/egl" license = "MIT" - settings = "os" + settings = "os", "arch", "compiler", "build_type" def configure(self): if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration("This recipes supports only Linux and FreeBSD") - + def package_id(self): - self.info.header_only() + self.info.clear() - def _fill_cppinfo_from_pkgconfig(self, name): - pkg_config = tools.PkgConfig(name) - if not pkg_config.provides: - raise ConanException("EGL development files aren't available, give up") - libs = [lib[2:] for lib in pkg_config.libs_only_l] - lib_dirs = [lib[2:] for lib in pkg_config.libs_only_L] - ldflags = [flag for flag in pkg_config.libs_only_other] - include_dirs = [include[2:] for include in pkg_config.cflags_only_I] - cflags = [flag for flag in pkg_config.cflags_only_other if not flag.startswith("-D")] - defines = [flag[2:] for flag in pkg_config.cflags_only_other if flag.startswith("-D")] + def system_requirements(self): + dnf = package_manager.Dnf(self) + dnf.install(["mesa-libEGL-devel"], update=True, check=True) - self.cpp_info.system_libs.extend(libs) - self.cpp_info.libdirs.extend(lib_dirs) - self.cpp_info.sharedlinkflags.extend(ldflags) - self.cpp_info.exelinkflags.extend(ldflags) - self.cpp_info.defines.extend(defines) - self.cpp_info.includedirs.extend(include_dirs) - self.cpp_info.cflags.extend(cflags) - self.cpp_info.cxxflags.extend(cflags) + yum = package_manager.Yum(self) + yum.install(["mesa-libEGL-devel"], update=True, check=True) - def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_yum: - packages = ["mesa-libEGL-devel"] - elif tools.os_info.with_apt: - ubuntu_20_or_later = tools.os_info.linux_distro == "ubuntu" and tools.os_info.os_version >= "20" - debian_11_or_later = tools.os_info.linux_distro == "debian" and tools.os_info.os_version >= "11" - pop_os_20_or_later = tools.os_info.linux_distro == "pop" and tools.os_info.os_version >= "20" - if ubuntu_20_or_later or debian_11_or_later or pop_os_20_or_later: - packages = ["libegl-dev"] - else: - packages = ["libegl1-mesa-dev"] - elif tools.os_info.with_pacman: - packages = ["libglvnd"] - elif tools.os_info.with_zypper: - packages = ["Mesa-libEGL-devel"] - else: - self.output.warn("Don't know how to install EGL for your distro.") - if tools.os_info.is_freebsd and self.settings.os == "FreeBSD": - packages = ["libglvnd"] - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify') - for p in packages: - package_tool.install(update=True, packages=p) + apt = package_manager.Apt(self) + apt.install_substitutes(["libegl-dev"], ["libegl1-mesa-dev"], update=True, check=True) - def package_info(self): - # TODO: Workaround for #2311 until a better solution can be found - self.cpp_info.filenames["cmake_find_package"] = "egl_system" - self.cpp_info.filenames["cmake_find_package_multi"] = "egl_system" + pacman = package_manager.PacMan(self) + pacman.install(["libglvnd"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["Mesa-libEGL-devel"], update=True, check=True) + pkg = package_manager.Pkg(self) + pkg.install(["libglvnd"], update=True, check=True) + + def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] - self._fill_cppinfo_from_pkgconfig('egl') + pkg_config = PkgConfig(self, "egl") + pkg_config.fill_cpp_info(self.cpp_info, is_system=True) diff --git a/recipes/egl/system/test_package/CMakeLists.txt b/recipes/egl/system/test_package/CMakeLists.txt index 950b4165b7aa4..b6c53602ff568 100644 --- a/recipes/egl/system/test_package/CMakeLists.txt +++ b/recipes/egl/system/test_package/CMakeLists.txt @@ -1,10 +1,10 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() set(SOURCES test_package.c) +find_package(egl REQUIRED) + add_executable(${PROJECT_NAME} ${SOURCES}) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE egl::egl) diff --git a/recipes/egl/system/test_package/conanfile.py b/recipes/egl/system/test_package/conanfile.py index bd7165a553cf4..49ea0c6cecc47 100644 --- a/recipes/egl/system/test_package/conanfile.py +++ b/recipes/egl/system/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/egl/system/test_v1_package/CMakeLists.txt b/recipes/egl/system/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7a8ae2ad50945 --- /dev/null +++ b/recipes/egl/system/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_v1_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/egl/system/test_v1_package/conanfile.py b/recipes/egl/system/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1d0bdd3779793 --- /dev/null +++ b/recipes/egl/system/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/eigen/all/conandata.yml b/recipes/eigen/all/conandata.yml index 05c8913f08d5f..6e757c6f87da5 100644 --- a/recipes/eigen/all/conandata.yml +++ b/recipes/eigen/all/conandata.yml @@ -12,5 +12,16 @@ sources: url: "https://gitlab.com/libeigen/eigen/-/archive/3.3.7/eigen-3.3.7.tar.bz2" sha256: "685adf14bd8e9c015b78097c1dc22f2f01343756f196acdc76a678e1ae352e11" patches: + "3.3.9": + - patch_file: "patches/0002-cmake-minimum-required.patch" + patch_description: "CMake: Move cmake_minimum_required() before project()" + patch_type: "conan" "3.3.8": - patch_file: "patches/0001-assert-exception-upstream-issue-2011.patch" + - patch_file: "patches/0002-cmake-minimum-required.patch" + patch_description: "CMake: Move cmake_minimum_required() before project()" + patch_type: "conan" + "3.3.7": + - patch_file: "patches/0002-cmake-minimum-required.patch" + patch_description: "CMake: Move cmake_minimum_required() before project()" + patch_type: "conan" diff --git a/recipes/eigen/all/conanfile.py b/recipes/eigen/all/conanfile.py index 54efcdf97a0f3..e988fa6d4d9e5 100644 --- a/recipes/eigen/all/conanfile.py +++ b/recipes/eigen/all/conanfile.py @@ -1,10 +1,9 @@ -import os - from conan import ConanFile from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir +import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class EigenConan(ConanFile): @@ -13,7 +12,8 @@ class EigenConan(ConanFile): homepage = "http://eigen.tuxfamily.org" description = "Eigen is a C++ template library for linear algebra: matrices, vectors," \ " numerical solvers, and related algorithms." - topics = ("eigen", "algebra", "linear-algebra", "vector", "numerical") + topics = ("algebra", "linear-algebra", "matrix", "vector", "numerical") + license = ("MPL-2.0", "LGPL-3.0-or-later") # Taking into account the default value of MPL2_only option settings = "os", "arch", "compiler", "build_type" options = { @@ -22,7 +22,9 @@ class EigenConan(ConanFile): default_options = { "MPL2_only": False, } - license = ("MPL-2.0", "LGPL-3.0-or-later") # Taking into account the default value of MPL2_only option + + def export_sources(self): + export_conandata_patches(self) def configure(self): self.license = "MPL-2.0" if self.options.MPL2_only else ("MPL-2.0", "LGPL-3.0-or-later") @@ -30,15 +32,12 @@ def configure(self): def layout(self): cmake_layout(self, src_folder="src") - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, patch["patch_file"], self.recipe_folder, self.export_sources_folder) - def package_id(self): self.info.clear() def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -50,6 +49,7 @@ def build(self): apply_conandata_patches(self) cmake = CMake(self) cmake.configure() + cmake.build() def package(self): cmake = CMake(self) @@ -63,6 +63,8 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "Eigen3::Eigen") self.cpp_info.set_property("pkg_config_name", "eigen3") # TODO: back to global scope once cmake_find_package* generators removed + self.cpp_info.components["eigen3"].bindirs = [] + self.cpp_info.components["eigen3"].libdirs = [] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["eigen3"].system_libs = ["m"] if self.options.MPL2_only: diff --git a/recipes/eigen/all/patches/0002-cmake-minimum-required.patch b/recipes/eigen/all/patches/0002-cmake-minimum-required.patch new file mode 100644 index 0000000000000..ed2fc38f4da97 --- /dev/null +++ b/recipes/eigen/all/patches/0002-cmake-minimum-required.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,6 @@ ++cmake_minimum_required(VERSION 2.8.5) + project(Eigen3) + +-cmake_minimum_required(VERSION 2.8.5) + + # guard against in-source builds + diff --git a/recipes/eigen/all/test_package/CMakeLists.txt b/recipes/eigen/all/test_package/CMakeLists.txt index c4fdf0bd1c765..7a24919989d14 100644 --- a/recipes/eigen/all/test_package/CMakeLists.txt +++ b/recipes/eigen/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ -cmake_minimum_required(VERSION 3.16) -project(test_package) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) find_package(Eigen3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Eigen3::Eigen) +target_link_libraries(${PROJECT_NAME} PRIVATE Eigen3::Eigen) diff --git a/recipes/eigen/all/test_package/conanfile.py b/recipes/eigen/all/test_package/conanfile.py index cf2b5ffb9883d..c0ba081cf41ea 100644 --- a/recipes/eigen/all/test_package/conanfile.py +++ b/recipes/eigen/all/test_package/conanfile.py @@ -7,6 +7,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/eigen/all/test_package/test_package.cpp b/recipes/eigen/all/test_package/test_package.cpp index 69a884db4af91..a253d7f1b2200 100644 --- a/recipes/eigen/all/test_package/test_package.cpp +++ b/recipes/eigen/all/test_package/test_package.cpp @@ -9,8 +9,8 @@ int main(void) Eigen::MatrixXi A(N, N); A.setRandom(); - std::cout << "A =\n" << A << '\n' < +#include + +using namespace ELFIO; + +int main() { + // just check we can create an reader, that means the recipe works + elfio reader; + if ( !reader.load( "/does/not/exist" ) ) { + return EXIT_SUCCESS; + } + return EXIT_FAILURE; +} diff --git a/recipes/elfio/config.yml b/recipes/elfio/config.yml index 9fda1f4e349b2..387fbf23f814b 100644 --- a/recipes/elfio/config.yml +++ b/recipes/elfio/config.yml @@ -1,4 +1,6 @@ versions: + "3.11": + folder: all "3.10": folder: all "3.9": diff --git a/recipes/embree3/all/CMakeLists.txt b/recipes/embree3/all/CMakeLists.txt deleted file mode 100644 index 27f20e640dcb8..0000000000000 --- a/recipes/embree3/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.0.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/embree3/all/conandata.yml b/recipes/embree3/all/conandata.yml index c3ac808692380..2254366a65cdf 100644 --- a/recipes/embree3/all/conandata.yml +++ b/recipes/embree3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.13.5": + url: "https://github.com/embree/embree/archive/v3.13.5.tar.gz" + sha256: "b8c22d275d9128741265537c559d0ea73074adbf2f2b66b0a766ca52c52d665b" "3.13.3": url: "https://github.com/embree/embree/archive/v3.13.3.tar.gz" sha256: "74ec785afb8f14d28ea5e0773544572c8df2e899caccdfc88509f1bfff58716f" @@ -8,3 +11,24 @@ sources: "3.12.0": url: "https://github.com/embree/embree/archive/refs/tags/v3.12.0.tar.gz" sha256: "f3646977c45a9ece1fb0cfe107567adcc645b1c77c27b36572d0aa98b888190c" +patches: + "3.13.5": + - patch_file: "patches/3.13.x-0001-cmake-minimum-required.patch" + patch_description: "CMake: Fix position of cmake_minimum_required()" + patch_type: "backport" + patch_source: "https://github.com/embree/embree/pull/406" + "3.13.3": + - patch_file: "patches/3.13.x-0001-cmake-minimum-required.patch" + patch_description: "CMake: Fix position of cmake_minimum_required()" + patch_type: "backport" + patch_source: "https://github.com/embree/embree/pull/406" + "3.13.1": + - patch_file: "patches/3.13.x-0001-cmake-minimum-required.patch" + patch_description: "CMake: Fix position of cmake_minimum_required()" + patch_type: "backport" + patch_source: "https://github.com/embree/embree/pull/406" + "3.12.0": + - patch_file: "patches/3.12.x-0001-cmake-minimum-required.patch" + patch_description: "CMake: Fix position of cmake_minimum_required()" + patch_type: "backport" + patch_source: "https://github.com/embree/embree/pull/406" diff --git a/recipes/embree3/all/conanfile.py b/recipes/embree3/all/conanfile.py index 295f4cee2d984..f8e429587b3e0 100644 --- a/recipes/embree3/all/conanfile.py +++ b/recipes/embree3/all/conanfile.py @@ -1,11 +1,15 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.files import save, load +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, rm, rmdir, save +from conan.tools.microsoft import check_min_vs +from conan.tools.apple import is_apple_os +from conan.tools.scm import Version import glob import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class EmbreeConan(ConanFile): @@ -25,6 +29,8 @@ class EmbreeConan(ConanFile): "avx": [True, False], "avx2": [True, False], "avx512": [True, False], + "neon": [True, False], + "neon2x": [True, False], "geometry_curve": [True, False], "geometry_grid": [True, False], "geometry_instance": [True, False], @@ -36,6 +42,7 @@ class EmbreeConan(ConanFile): "ray_masking": [True, False], "backface_culling": [True, False], "ignore_invalid_rays": [True, False], + "with_tbb": [True, False], } default_options = { @@ -46,6 +53,8 @@ class EmbreeConan(ConanFile): "avx": False, "avx2": False, "avx512": False, + "neon": False, + "neon2x": False, "geometry_curve": True, "geometry_grid": True, "geometry_instance": True, @@ -57,42 +66,45 @@ class EmbreeConan(ConanFile): "ray_masking": False, "backface_culling": False, "ignore_invalid_rays": False, + "with_tbb": False, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _has_sse_avx(self): return self.settings.arch in ["x86", "x86_64"] @property def _embree_has_neon_support(self): - return tools.Version(self.version) >= "3.13.0" + return Version(self.version) >= "3.13.0" + + @property + def _embree_has_neon2x_support(self): + return Version(self.version) >= "3.13.4" @property def _has_neon(self): return "arm" in self.settings.arch + @property + def _has_neon2x(self): + return "arm" in self.settings.arch and is_apple_os(self) + @property def _num_isa(self): num_isa = 0 - if self._embree_has_neon_support and self._has_neon: - num_isa += 1 + if self._has_neon: + if self._embree_has_neon_support and self.options.neon: + num_isa += 1 + if self._embree_has_neon2x_support and self.options.neon2x: + num_isa += 1 for simd_option in ["sse2", "sse42", "avx", "avx2", "avx512"]: if self.options.get_safe(simd_option): num_isa += 1 return num_isa + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -102,101 +114,123 @@ def config_options(self): del self.options.avx del self.options.avx2 del self.options.avx512 + if not self._has_neon: + del self.options.neon + del self.options.neon2x + else: + if not self._embree_has_neon_support: + del self.options.neon + if not self._embree_has_neon2x_support: + del self.options.neon2x def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_tbb: + self.requires("onetbb/2021.6.0") def validate(self): if not (self._has_sse_avx or (self._embree_has_neon_support and self._has_neon)): raise ConanInvalidConfiguration("Embree {} doesn't support {}".format(self.version, self.settings.arch)) - compiler_version = tools.Version(self.settings.compiler.version) - if self.settings.compiler == "clang" and compiler_version < "4": + compiler_version = Version(self.info.settings.compiler.version) + if self.info.settings.compiler == "clang" and compiler_version < "4": raise ConanInvalidConfiguration("Clang < 4 is not supported") - elif self.settings.compiler == "Visual Studio" and compiler_version < "15": - raise ConanInvalidConfiguration("Visual Studio < 15 is not supported") - if self.settings.os == "Linux" and self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++": - raise ConanInvalidConfiguration("conan recipe for Embree v{0} \ - cannot be built with clang libc++, use libstdc++ instead".format(self.version)) + check_min_vs(self, 191) + + if self.info.settings.os == "Linux" and self.info.settings.compiler == "clang" and self.info.settings.compiler.libcxx == "libc++": + raise ConanInvalidConfiguration(f"{self.ref} cannot be built with clang libc++, use libstdc++ instead") - if self.settings.compiler == "apple-clang" and not self.options.shared and compiler_version >= "9.0" and self._num_isa > 1: + if self.info.settings.compiler == "apple-clang" and not self.info.options.shared and compiler_version >= "9.0" and self._num_isa > 1: raise ConanInvalidConfiguration("Embree static with apple-clang >=9 and multiple ISA (simd) is not supported") if self._num_isa == 0: raise ConanInvalidConfiguration("At least one ISA (simd) must be enabled") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - - # Configure CMake library build: - self._cmake.definitions["EMBREE_STATIC_LIB"] = not self.options.shared - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["EMBREE_TUTORIALS"] = False - self._cmake.definitions["EMBREE_GEOMETRY_CURVE"] = self.options.geometry_curve - self._cmake.definitions["EMBREE_GEOMETRY_GRID"] = self.options.geometry_grid - self._cmake.definitions["EMBREE_GEOMETRY_INSTANCE"] = self.options.geometry_instance - self._cmake.definitions["EMBREE_GEOMETRY_QUAD"] = self.options.geometry_quad - self._cmake.definitions["EMBREE_GEOMETRY_SUBDIVISION"] = self.options.geometry_subdivision - self._cmake.definitions["EMBREE_GEOMETRY_TRIANGLE"] = self.options.geometry_triangle - self._cmake.definitions["EMBREE_GEOMETRY_USER"] = self.options.geometry_user - self._cmake.definitions["EMBREE_RAY_PACKETS"] = self.options.ray_packets - self._cmake.definitions["EMBREE_RAY_MASK"] = self.options.ray_masking - self._cmake.definitions["EMBREE_BACKFACE_CULLING"] = self.options.backface_culling - self._cmake.definitions["EMBREE_IGNORE_INVALID_RAYS"] = self.options.ignore_invalid_rays - self._cmake.definitions["EMBREE_ISPC_SUPPORT"] = False - self._cmake.definitions["EMBREE_TASKING_SYSTEM"] = "INTERNAL" - self._cmake.definitions["EMBREE_MAX_ISA"] = "NONE" + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["EMBREE_STATIC_LIB"] = not self.options.shared + tc.variables["BUILD_TESTING"] = False + tc.variables["EMBREE_TUTORIALS"] = False + tc.variables["EMBREE_GEOMETRY_CURVE"] = self.options.geometry_curve + tc.variables["EMBREE_GEOMETRY_GRID"] = self.options.geometry_grid + tc.variables["EMBREE_GEOMETRY_INSTANCE"] = self.options.geometry_instance + tc.variables["EMBREE_GEOMETRY_QUAD"] = self.options.geometry_quad + tc.variables["EMBREE_GEOMETRY_SUBDIVISION"] = self.options.geometry_subdivision + tc.variables["EMBREE_GEOMETRY_TRIANGLE"] = self.options.geometry_triangle + tc.variables["EMBREE_GEOMETRY_USER"] = self.options.geometry_user + tc.variables["EMBREE_RAY_PACKETS"] = self.options.ray_packets + tc.variables["EMBREE_RAY_MASK"] = self.options.ray_masking + tc.variables["EMBREE_BACKFACE_CULLING"] = self.options.backface_culling + tc.variables["EMBREE_IGNORE_INVALID_RAYS"] = self.options.ignore_invalid_rays + tc.variables["EMBREE_ISPC_SUPPORT"] = False + tc.variables["EMBREE_TASKING_SYSTEM"] = "TBB" if self.options.with_tbb else "INTERNAL" + tc.variables["EMBREE_MAX_ISA"] = "NONE" if self._embree_has_neon_support: - self._cmake.definitions["EMBREE_ISA_NEON"] = self._has_neon - self._cmake.definitions["EMBREE_ISA_SSE2"] = self.options.get_safe("sse2", False) - self._cmake.definitions["EMBREE_ISA_SSE42"] = self.options.get_safe("sse42", False) - self._cmake.definitions["EMBREE_ISA_AVX"] = self.options.get_safe("avx", False) - self._cmake.definitions["EMBREE_ISA_AVX2"] = self.options.get_safe("avx2", False) - if tools.Version(self.version) < "3.12.2": + tc.variables["EMBREE_ISA_NEON"] = self.options.get_safe("neon", False) + if self._embree_has_neon2x_support: + tc.variables["EMBREE_ISA_NEON2X"] = self.options.get_safe("neon2x", False) + + tc.variables["EMBREE_ISA_SSE2"] = self.options.get_safe("sse2", False) + tc.variables["EMBREE_ISA_SSE42"] = self.options.get_safe("sse42", False) + tc.variables["EMBREE_ISA_AVX"] = self.options.get_safe("avx", False) + tc.variables["EMBREE_ISA_AVX2"] = self.options.get_safe("avx2", False) + if Version(self.version) < "3.12.2": # TODO: probably broken if avx512 enabled, must cumbersome to add specific options in the recipe - self._cmake.definitions["EMBREE_ISA_AVX512KNL"] = self.options.get_safe("avx512", False) - self._cmake.definitions["EMBREE_ISA_AVX512SKX"] = self.options.get_safe("avx512", False) + tc.variables["EMBREE_ISA_AVX512KNL"] = self.options.get_safe("avx512", False) + tc.variables["EMBREE_ISA_AVX512SKX"] = self.options.get_safe("avx512", False) else: - self._cmake.definitions["EMBREE_ISA_AVX512"] = self.options.get_safe("avx512", False) + tc.variables["EMBREE_ISA_AVX512"] = self.options.get_safe("avx512", False) + tc.generate() - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + deps = CMakeDeps(self) + deps.generate() - def build(self): + def _patch_sources(self): + apply_conandata_patches(self) # some compilers (e.g. clang) do not like UTF-16 sources - rc = os.path.join(self._source_subfolder, "kernels", "embree.rc") + rc = os.path.join(self.source_folder, "kernels", "embree.rc") content = load(self, rc, encoding="utf_16_le") if content[0] == '\ufeff': content = content[1:] content = "#pragma code_page(65001)\n" + content save(self, rc, content) - os.remove(os.path.join(self._source_subfolder, "common", "cmake", "FindTBB.cmake")) - cmake = self._configure_cmake() + os.remove(os.path.join(self.source_folder, "common", "cmake", "FindTBB.cmake")) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder), "*.command") - tools.remove_files_by_mask(os.path.join(self.package_folder), "*.cmake") + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.command", os.path.join(self.package_folder)) + rm(self, "*.cmake", os.path.join(self.package_folder)) if self.settings.os == "Windows" and self.options.shared: for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: - tools.remove_files_by_mask(os.path.join(self.package_folder), dll_pattern_to_remove) + rm(self, dll_pattern_to_remove, os.path.join(self.package_folder, "bin")) else: - tools.rmdir(os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "bin")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self._create_cmake_module_alias_targets( @@ -204,34 +238,33 @@ def package(self): {"embree": "embree::embree"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "embree") self.cpp_info.set_property("cmake_target_name", "embree") def _lib_exists(name): - return True if glob.glob(os.path.join(self.package_folder, "lib", "*{}.*".format(name))) else False + return bool(glob.glob(os.path.join(self.package_folder, "lib", f"*{name}.*"))) self.cpp_info.libs = ["embree3"] if not self.options.shared: self.cpp_info.libs.extend(["sys", "math", "simd", "lexers", "tasking"]) simd_libs = ["embree_sse42", "embree_avx", "embree_avx2"] - simd_libs.extend(["embree_avx512knl", "embree_avx512skx"] if tools.Version(self.version) < "3.12.2" else ["embree_avx512"]) + simd_libs.extend(["embree_avx512knl", "embree_avx512skx"] if Version(self.version) < "3.12.2" else ["embree_avx512"]) for lib in simd_libs: if _lib_exists(lib): self.cpp_info.libs.append(lib) diff --git a/recipes/embree3/all/patches/3.12.x-0001-cmake-minimum-required.patch b/recipes/embree3/all/patches/3.12.x-0001-cmake-minimum-required.patch new file mode 100644 index 0000000000000..d07ff0aa4e590 --- /dev/null +++ b/recipes/embree3/all/patches/3.12.x-0001-cmake-minimum-required.patch @@ -0,0 +1,17 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,6 @@ + ## Copyright 2009-2020 Intel Corporation + ## SPDX-License-Identifier: Apache-2.0 ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0) + + SET(EMBREE_VERSION_MAJOR 3) + SET(EMBREE_VERSION_MINOR 12) +@@ -12,7 +13,6 @@ SET(CPACK_RPM_PACKAGE_RELEASE 1) + + PROJECT(embree${EMBREE_VERSION_MAJOR}) + +-CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0) + + # We use our own strip tool on macOS to sign during install. This is required as CMake modifies RPATH of the binary during install. + IF (APPLE AND EMBREE_SIGN_FILE) diff --git a/recipes/embree3/all/patches/3.13.x-0001-cmake-minimum-required.patch b/recipes/embree3/all/patches/3.13.x-0001-cmake-minimum-required.patch new file mode 100644 index 0000000000000..6208148722846 --- /dev/null +++ b/recipes/embree3/all/patches/3.13.x-0001-cmake-minimum-required.patch @@ -0,0 +1,17 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,6 @@ + ## Copyright 2009-2021 Intel Corporation + ## SPDX-License-Identifier: Apache-2.0 ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0) + + SET(EMBREE_VERSION_MAJOR 3) + SET(EMBREE_VERSION_MINOR 13) +@@ -12,7 +13,6 @@ SET(CPACK_RPM_PACKAGE_RELEASE 1) + + PROJECT(embree${EMBREE_VERSION_MAJOR}) + +-CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0) + + # We use our own strip tool on macOS to sign during install. This is required as CMake modifies RPATH of the binary during install. + IF (APPLE AND EMBREE_SIGN_FILE) diff --git a/recipes/embree3/all/test_package/CMakeLists.txt b/recipes/embree3/all/test_package/CMakeLists.txt index 401ddb44db0d5..fe2724327bb76 100644 --- a/recipes/embree3/all/test_package/CMakeLists.txt +++ b/recipes/embree3/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(embree REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} embree) +target_link_libraries(${PROJECT_NAME} PRIVATE embree) diff --git a/recipes/embree3/all/test_package/conanfile.py b/recipes/embree3/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/embree3/all/test_package/conanfile.py +++ b/recipes/embree3/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/embree3/all/test_v1_package/CMakeLists.txt b/recipes/embree3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..42932a8412566 --- /dev/null +++ b/recipes/embree3/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(embree REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE embree) diff --git a/recipes/embree3/all/test_v1_package/conanfile.py b/recipes/embree3/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/embree3/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/embree3/config.yml b/recipes/embree3/config.yml index 76ce418f25fd9..f3cd7c6b5617a 100644 --- a/recipes/embree3/config.yml +++ b/recipes/embree3/config.yml @@ -1,4 +1,6 @@ versions: + "3.13.5": + folder: all "3.13.3": folder: all "3.13.1": diff --git a/recipes/emsdk/all/conandata.yml b/recipes/emsdk/all/conandata.yml index 3bd99a86c6c6b..8a32427b651c2 100644 --- a/recipes/emsdk/all/conandata.yml +++ b/recipes/emsdk/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "3.1.31": + url: "https://github.com/emscripten-core/emsdk/archive/3.1.31.tar.gz" + sha256: "1d38b7375e12e85197165a4c51d76d90e1d9db8c2c593b64cfaec4338af54750" + "3.1.30": + url: "https://github.com/emscripten-core/emsdk/archive/3.1.30.tar.gz" + sha256: "7b9c4e0b19f08df9f0d807112926f3908fe73a2960b752a87c3862956da8b9a8" + "3.1.29": + url: "https://github.com/emscripten-core/emsdk/archive/refs/tags/3.1.29.tar.gz" + sha256: "506376d0d2a71fc3dd1a4dba6fb4cf18f0a2fa4e1936aa04ba4b59f2d435bf3f" + "3.1.23": + url: "https://github.com/emscripten-core/emsdk/archive/3.1.23.tar.gz" + sha256: "a2609fd97580e4e332acbf49b6cc363714982f06cb6970d54c9789df8e91381c" "3.1.20": url: "https://github.com/emscripten-core/emsdk/archive/3.1.20.tar.gz" sha256: "fd336c6d3e51c7205a8ec68e835c442dcbb187f92e50c42b3d7d54a312072ef7" diff --git a/recipes/emsdk/all/conanfile.py b/recipes/emsdk/all/conanfile.py index 8f8aa6a455299..64d00c5064905 100644 --- a/recipes/emsdk/all/conanfile.py +++ b/recipes/emsdk/all/conanfile.py @@ -1,12 +1,13 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.build import cross_building from conan.tools.env import Environment from conan.tools.files import chdir, copy, get, replace_in_file from conan.tools.layout import basic_layout +from conan.tools.scm import Version import json import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.52.0" class EmSDKConan(ConanFile): @@ -24,6 +25,9 @@ class EmSDKConan(ConanFile): def _settings_build(self): return getattr(self, "settings_build", self.settings) + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): self.requires("nodejs/16.3.0") # self.requires("python") # FIXME: Not available as Conan package @@ -33,9 +37,6 @@ def package_id(self): del self.info.settings.compiler del self.info.settings.build_type - def layout(self): - basic_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -71,8 +72,7 @@ def generate(self): env.define_path("EMSCRIPTEN", self._emscripten) env.define_path("EM_CONFIG", self._em_config) env.define_path("EM_CACHE", self._em_cache) - envvars = env.vars(self, scope="emsdk") - envvars.save_script("emsdk_env_file") + env.vars(self, scope="emsdk").save_script("emsdk_env_file") @staticmethod def _chmod_plus_x(filename): @@ -159,8 +159,13 @@ def package_info(self): self.buildenv_info.define_path("EM_CONFIG", self._em_config) self.buildenv_info.define_path("EM_CACHE", self._em_cache) - self.buildenv_info.define_path("CC", self._define_tool_var("emcc")) - self.buildenv_info.define_path("CXX", self._define_tool_var("em++")) + compiler_executables = { + "c": self._define_tool_var("emcc"), + "cpp": self._define_tool_var("em++"), + } + self.conf_info.update("tools.build:compiler_executables", compiler_executables) + self.buildenv_info.define_path("CC", compiler_executables["c"]) + self.buildenv_info.define_path("CXX", compiler_executables["cpp"]) self.buildenv_info.define_path("AR", self._define_tool_var("emar")) self.buildenv_info.define_path("NM", self._define_tool_var("emnm")) self.buildenv_info.define_path("RANLIB", self._define_tool_var("emranlib")) @@ -176,16 +181,16 @@ def package_info(self): os.path.join("bin", "upstream", "lib", "cmake", "llvm"), ] - # TODO: conan v1 stuff, to remove in conan v2? - self.env_info.PATH.extend(self._paths) - self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = toolchain - self.env_info.EMSDK = self._emsdk - self.env_info.EMSCRIPTEN = self._emscripten - self.env_info.EM_CONFIG = self._em_config - self.env_info.EM_CACHE = self._em_cache - self.env_info.CC = self._define_tool_var("emcc") - self.env_info.CXX = self._define_tool_var("em++") - self.env_info.AR = self._define_tool_var("emar") - self.env_info.NM = self._define_tool_var("emnm") - self.env_info.RANLIB = self._define_tool_var("emranlib") - self.env_info.STRIP = self._define_tool_var("emstrip") + if Version(conan_version).major < 2: + self.env_info.PATH.extend(self._paths) + self.env_info.CONAN_CMAKE_TOOLCHAIN_FILE = toolchain + self.env_info.EMSDK = self._emsdk + self.env_info.EMSCRIPTEN = self._emscripten + self.env_info.EM_CONFIG = self._em_config + self.env_info.EM_CACHE = self._em_cache + self.env_info.CC = compiler_executables["c"] + self.env_info.CXX = compiler_executables["cpp"] + self.env_info.AR = self._define_tool_var("emar") + self.env_info.NM = self._define_tool_var("emnm") + self.env_info.RANLIB = self._define_tool_var("emranlib") + self.env_info.STRIP = self._define_tool_var("emstrip") diff --git a/recipes/emsdk/config.yml b/recipes/emsdk/config.yml index 8cb71bb34e538..82752e0f1209d 100644 --- a/recipes/emsdk/config.yml +++ b/recipes/emsdk/config.yml @@ -1,4 +1,12 @@ versions: + "3.1.31": + folder: all + "3.1.30": + folder: all + "3.1.29": + folder: all + "3.1.23": + folder: all "3.1.20": folder: all "3.1.18": diff --git a/recipes/enet/all/conandata.yml b/recipes/enet/all/conandata.yml index 872fdb0986138..c03ba9c9c59fb 100644 --- a/recipes/enet/all/conandata.yml +++ b/recipes/enet/all/conandata.yml @@ -1,16 +1,16 @@ sources: "1.3.17": - url: "https://github.com/lsalzman/enet/archive/v1.3.17.tar.gz" + url: "https://github.com/lsalzman/enet/archive/refs/tags/v1.3.17.tar.gz" sha256: "1e0b4bc0b7127a2d779dd7928f0b31830f5b3dcb7ec9588c5de70033e8d2434a" "1.3.16": - url: "https://github.com/lsalzman/enet/archive/v1.3.16.tar.gz" + url: "https://github.com/lsalzman/enet/archive/refs/tags/v1.3.16.tar.gz" sha256: "b3aa85b43e4309fec9441b4e6639c268e22962a578bd5e2307bb3a7b6fe73714" "1.3.15": - url: "https://github.com/lsalzman/enet/archive/v1.3.15.tar.gz" + url: "https://github.com/lsalzman/enet/archive/refs/tags/v1.3.15.tar.gz" sha256: "e749887a19b5a4a0a16daae2d695fd7ed581ec517f3b15aedc3cdce2d999d471" "1.3.14": - url: "http://enet.bespin.org/download/enet-1.3.14.tar.gz" - sha256: "98f6f57aab0a424469619ed3047728f0d3901ce8f0dea919c11e7966d807e870" + url: "https://github.com/lsalzman/enet/archive/refs/tags/v1.3.14.tar.gz" + sha256: "3660e12d32164b2d814a897f50caa4e68db6396c00ef22806db45c2308b439e6" patches: "1.3.17": - patch_file: "patches/fix-cmake.patch" diff --git a/recipes/enet/all/conanfile.py b/recipes/enet/all/conanfile.py index 9cc3b378394fc..cc4771c9c977b 100644 --- a/recipes/enet/all/conanfile.py +++ b/recipes/enet/all/conanfile.py @@ -1,20 +1,21 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class EnetConan(ConanFile): name = "enet" description = "ENet reliable UDP networking library" - topics = ("enet", "udp", "networking") + topics = ("udp", "networking") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lsalzman/enet" license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,8 +27,7 @@ class EnetConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,22 +35,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/enet/all/test_package/conanfile.py b/recipes/enet/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/enet/all/test_package/conanfile.py +++ b/recipes/enet/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/enet/all/test_v1_package/CMakeLists.txt b/recipes/enet/all/test_v1_package/CMakeLists.txt index a9be27f4a22a2..0d20897301b68 100644 --- a/recipes/enet/all/test_v1_package/CMakeLists.txt +++ b/recipes/enet/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(enet REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE enet::enet) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/entityx/all/conanfile.py b/recipes/entityx/all/conanfile.py index 5f5cad42e9c30..e534a04fb16dd 100644 --- a/recipes/entityx/all/conanfile.py +++ b/recipes/entityx/all/conanfile.py @@ -2,11 +2,11 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class EntityXConan(ConanFile): @@ -20,6 +20,7 @@ class EntityXConan(ConanFile): topics = ("entity", "c++11", "type-safe", "component") license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,8 +32,7 @@ class EntityXConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -40,21 +40,20 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) - def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - if is_msvc(self) and self.info.options.shared: + if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration("entityx shared library does not export all symbols with Visual Studio") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): tc = CMakeToolchain(self) tc.variables["ENTITYX_BUILD_SHARED"] = self.options.shared diff --git a/recipes/entityx/all/test_package/conanfile.py b/recipes/entityx/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/entityx/all/test_package/conanfile.py +++ b/recipes/entityx/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/entityx/all/test_v1_package/CMakeLists.txt b/recipes/entityx/all/test_v1_package/CMakeLists.txt index 2d78aabc2eace..0d20897301b68 100644 --- a/recipes/entityx/all/test_v1_package/CMakeLists.txt +++ b/recipes/entityx/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(entityx REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE entityx::entityx) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/entt/3.x.x/conandata.yml b/recipes/entt/3.x.x/conandata.yml index 363a32016287d..b55145bf44224 100644 --- a/recipes/entt/3.x.x/conandata.yml +++ b/recipes/entt/3.x.x/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.11.1": + url: "https://github.com/skypjack/entt/archive/refs/tags/v3.11.1.tar.gz" + sha256: "0ac010f232d3089200c5e545bcbd6480cf68b705de6930d8ff7cdb0a29f5b47b" + "3.11.0": + url: "https://github.com/skypjack/entt/archive/refs/tags/v3.11.0.tar.gz" + sha256: "7cca2bd4d4aeef6c5bdbe06b9e047e7f2519ebaff901207cc81ac71a2bbe185e" "3.10.3": url: "https://github.com/skypjack/entt/archive/refs/tags/v3.10.3.tar.gz" sha256: "315918fc678e89a326ce1c13b0e9d3e53882dd9c58a63fef413325917a5c753b" @@ -50,3 +56,12 @@ sources: "3.2.2": url: "https://github.com/skypjack/entt/archive/v3.2.2.tar.gz" sha256: "94592270b6750dd0b057a4af9d2c1ea8798369b3bb127927a8f70db232808f93" +patches: + "3.11.1": + - patch_file: "patches/0001-3.11.0-fix-gcc-7.0-7.3.patch" + patch_description: "Fix GCC 7.0 to 7.3" + patch_type: "portability" + "3.11.0": + - patch_file: "patches/0001-3.11.0-fix-gcc-7.0-7.3.patch" + patch_description: "Fix GCC 7.0 to 7.3" + patch_type: "portability" diff --git a/recipes/entt/3.x.x/conanfile.py b/recipes/entt/3.x.x/conanfile.py index 1281fdc6cfe41..bcce48c1ce46c 100644 --- a/recipes/entt/3.x.x/conanfile.py +++ b/recipes/entt/3.x.x/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd -from conan.tools.files import copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class EnttConan(ConanFile): @@ -15,53 +15,54 @@ class EnttConan(ConanFile): homepage = "https://github.com/skypjack/entt" url = "https://github.com/conan-io/conan-center-index" license = "MIT" - no_copy_source = True settings = "os", "arch", "compiler", "build_type" - def package_id(self): - self.info.clear() - - def validate(self): - # TODO: use self.info.settings in validate() instead of self.settings - minimal_cpp_standard = "17" - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, minimal_cpp_standard) + @property + def _min_cppstd(self): + return "17" - minimal_version = { + @property + def _compilers_minimum_version(self): + return { "Visual Studio": "15.9", + "msvc": "191", "gcc": "7", "clang": "5", - "apple-clang": "10" + "apple-clang": "10", } - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - return + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + # TODO: use self.info.settings in validate() instead of self.settings + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - # Compare versions asuming minor satisfies if not explicitly set - def lazy_lt_semver(v1, v2): + def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] - if lazy_lt_semver(str(self.settings.compiler.version), minimal_version[compiler]): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - - def layout(self): - basic_layout(self, src_folder="src") + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def build(self): - pass + apply_conandata_patches(self) def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) @@ -71,8 +72,8 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "EnTT") self.cpp_info.set_property("cmake_target_name", "EnTT::EnTT") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] + + # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "EnTT" self.cpp_info.names["cmake_find_package_multi"] = "EnTT" diff --git a/recipes/entt/3.x.x/patches/0001-3.11.0-fix-gcc-7.0-7.3.patch b/recipes/entt/3.x.x/patches/0001-3.11.0-fix-gcc-7.0-7.3.patch new file mode 100644 index 0000000000000..f525e3855f87c --- /dev/null +++ b/recipes/entt/3.x.x/patches/0001-3.11.0-fix-gcc-7.0-7.3.patch @@ -0,0 +1,20 @@ +--- a/src/entt/meta/meta.hpp ++++ b/src/entt/meta/meta.hpp +@@ -1613,7 +1613,7 @@ public: + using reference = value_type; + using iterator_category = std::input_iterator_tag; + +- constexpr meta_iterator() noexcept ++ meta_iterator() noexcept + : ctx{}, + vtable{}, + handle{} {} +@@ -1707,7 +1707,7 @@ public: + using reference = value_type; + using iterator_category = std::input_iterator_tag; + +- constexpr meta_iterator() noexcept ++ meta_iterator() noexcept + : ctx{}, + vtable{}, + handle{} {} diff --git a/recipes/entt/3.x.x/test_package/conanfile.py b/recipes/entt/3.x.x/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/entt/3.x.x/test_package/conanfile.py +++ b/recipes/entt/3.x.x/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/entt/3.x.x/test_v1_package/CMakeLists.txt b/recipes/entt/3.x.x/test_v1_package/CMakeLists.txt index 04ae3ec2b1203..0d20897301b68 100644 --- a/recipes/entt/3.x.x/test_v1_package/CMakeLists.txt +++ b/recipes/entt/3.x.x/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(EnTT REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE EnTT::EnTT) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -if(EnTT_VERSION VERSION_LESS "3.4.0") - target_compile_definitions(${PROJECT_NAME} PRIVATE "ENTT_LESS_3_4_0") -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/entt/3.x.x/test_v1_package/conanfile.py b/recipes/entt/3.x.x/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/entt/3.x.x/test_v1_package/conanfile.py +++ b/recipes/entt/3.x.x/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/entt/config.yml b/recipes/entt/config.yml index 006844e9243c0..0000b93d983f2 100644 --- a/recipes/entt/config.yml +++ b/recipes/entt/config.yml @@ -1,4 +1,8 @@ versions: + "3.11.1": + folder: 3.x.x + "3.11.0": + folder: 3.x.x "3.10.3": folder: 3.x.x "3.10.1": diff --git a/recipes/enum-flags/0.1a/conandata.yml b/recipes/enum-flags/0.1a/conandata.yml deleted file mode 100644 index d66c5931610b6..0000000000000 --- a/recipes/enum-flags/0.1a/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -sources: - "0.1a": - url: "https://github.com/grisumbras/enum-flags/archive/v0.1a.zip" - sha256: "ee1a819d48b52f2d0088a154976e1a36bb3ae511104610b61ff77fc307037fb3" diff --git a/recipes/enum-flags/0.1a/conanfile.py b/recipes/enum-flags/0.1a/conanfile.py deleted file mode 100644 index 7f2b10fab40ee..0000000000000 --- a/recipes/enum-flags/0.1a/conanfile.py +++ /dev/null @@ -1,48 +0,0 @@ -from conans import ConanFile, tools -import os - -required_conan_version = ">=1.28.0" - -class EnumFlagsConan(ConanFile): - name = "enum-flags" - description = "Bit flags for C++11 scoped enums" - homepage = "https://github.com/grisumbras/enum-flags" - url = "https://github.com/conan-io/conan-center-index" - topics = ("bitmask", "enum") - license = "MIT" - settings = "compiler" - options = {"forbid_implicit_conversions": [True, False]} - default_options = {"forbid_implicit_conversions": True} - generators = "cmake" - no_copy_source = True - - @property - def _source_subfolder(self): - return "source_subfolder" - - def configure(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - - def package_id(self): - self.info.header_only() - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def package(self): - self.copy("include*", src=self._source_subfolder) - self.copy("*LICENSE", dst="licenses", keep_path=False) - - def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "enumflags" - self.cpp_info.filenames["cmake_find_package_multi"] = "enumflags" - self.cpp_info.names["cmake_find_package"] = "EnumFlags" - self.cpp_info.names["cmake_find_package_multi"] = "EnumFlags" - # Yes, there is a typo in the macro name. - # This macro is only useful when using regular C enums, - # since enum classes prevent implicit conversions already. - if self.options.forbid_implicit_conversions: - self.cpp_info.defines = ["ENUM_CLASS_FLAGS_FORBID_IMPLICT_CONVERSION"] diff --git a/recipes/enum-flags/0.1a/test_package/CMakeLists.txt b/recipes/enum-flags/0.1a/test_package/CMakeLists.txt deleted file mode 100644 index be06370daa883..0000000000000 --- a/recipes/enum-flags/0.1a/test_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -find_package(enumflags REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} EnumFlags::EnumFlags) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/enum-flags/0.1a/test_package/conanfile.py b/recipes/enum-flags/0.1a/test_package/conanfile.py deleted file mode 100644 index db8b24b0978af..0000000000000 --- a/recipes/enum-flags/0.1a/test_package/conanfile.py +++ /dev/null @@ -1,24 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - exe_name = "test_package" - if self.settings.os == "Emscripten": - exe_name += ".js" - elif tools.os_info.is_windows: - exe_name += ".exe" - exec_path = os.path.join("bin", exe_name) - if tools.cross_building(self.settings): - assert(os.path.exists(exec_path)) - else: - self.run(exec_path, run_environment=True) diff --git a/recipes/enum-flags/all/conandata.yml b/recipes/enum-flags/all/conandata.yml new file mode 100644 index 0000000000000..d29d7bbf48ded --- /dev/null +++ b/recipes/enum-flags/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1a": + url: "https://github.com/grisumbras/enum-flags/archive/refs/tags/v0.1a.tar.gz" + sha256: "34a952a39e9f079357003566da01cabae434e3679c52fafc6bc09f94d0b9d525" diff --git a/recipes/enum-flags/all/conanfile.py b/recipes/enum-flags/all/conanfile.py new file mode 100644 index 0000000000000..81ac78601093a --- /dev/null +++ b/recipes/enum-flags/all/conanfile.py @@ -0,0 +1,64 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" + + +class EnumFlagsConan(ConanFile): + name = "enum-flags" + description = "Bit flags for C++11 scoped enums" + homepage = "https://github.com/grisumbras/enum-flags" + url = "https://github.com/conan-io/conan-center-index" + topics = ("bitmask", "enum") + license = "MIT" + + settings = "os", "arch", "compiler", "build_type" + options = { + "forbid_implicit_conversions": [True, False], + } + default_options = { + "forbid_implicit_conversions": True, + } + + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "enumflags") + self.cpp_info.set_property("cmake_target_name", "EnumFlags::EnumFlags") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + # Yes, there is a typo in the macro name. + # This macro is only useful when using regular C enums, + # since enum classes prevent implicit conversions already. + if self.options.forbid_implicit_conversions: + self.cpp_info.defines = ["ENUM_CLASS_FLAGS_FORBID_IMPLICT_CONVERSION"] + + # TODO: to remove in conan v2 + self.cpp_info.filenames["cmake_find_package"] = "enumflags" + self.cpp_info.filenames["cmake_find_package_multi"] = "enumflags" + self.cpp_info.names["cmake_find_package"] = "EnumFlags" + self.cpp_info.names["cmake_find_package_multi"] = "EnumFlags" diff --git a/recipes/enum-flags/all/test_package/CMakeLists.txt b/recipes/enum-flags/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..62594120f0543 --- /dev/null +++ b/recipes/enum-flags/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(enumflags REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE EnumFlags::EnumFlags) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/enum-flags/all/test_package/conanfile.py b/recipes/enum-flags/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/enum-flags/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/enum-flags/0.1a/test_package/test_package.cpp b/recipes/enum-flags/all/test_package/test_package.cpp similarity index 100% rename from recipes/enum-flags/0.1a/test_package/test_package.cpp rename to recipes/enum-flags/all/test_package/test_package.cpp diff --git a/recipes/enum-flags/all/test_v1_package/CMakeLists.txt b/recipes/enum-flags/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/enum-flags/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/enum-flags/all/test_v1_package/conanfile.py b/recipes/enum-flags/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/enum-flags/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/enum-flags/config.yml b/recipes/enum-flags/config.yml index b03833f25d2c0..26aefcacb9d5d 100644 --- a/recipes/enum-flags/config.yml +++ b/recipes/enum-flags/config.yml @@ -1,3 +1,3 @@ versions: "0.1a": - folder: "0.1a" + folder: all diff --git a/recipes/erikzenker-hsm/all/conandata.yml b/recipes/erikzenker-hsm/all/conandata.yml index cf53ed0fed4b1..ee7984b9e6e76 100644 --- a/recipes/erikzenker-hsm/all/conandata.yml +++ b/recipes/erikzenker-hsm/all/conandata.yml @@ -1,7 +1,10 @@ sources: + "2.3.0": + url: "https://github.com/erikzenker/hsm/archive/v2.3.0.tar.gz" + sha256: "b3a13cd70fa2470fba4db09fad3c22afbfe6042c8da81da4396f890d02ee3518" "2.1.0": url: "https://github.com/erikzenker/hsm/archive/v2.1.0.tar.gz" sha256: "956eb4950e1bee3074e10fe85279164386ba34e4e96fabe694aaf20b24adcdef" "1.4.7": - sha256: e56fd4a71337448727dbb9e2abe18992224d496a7ab5567030d6717a00680364 - url: https://github.com/erikzenker/hsm/archive/refs/tags/v1.4.7.tar.gz + url: "https://github.com/erikzenker/hsm/archive/refs/tags/v1.4.7.tar.gz" + sha256: "e56fd4a71337448727dbb9e2abe18992224d496a7ab5567030d6717a00680364" diff --git a/recipes/erikzenker-hsm/all/conanfile.py b/recipes/erikzenker-hsm/all/conanfile.py index 67b3efc1712c4..dd35c89776d73 100644 --- a/recipes/erikzenker-hsm/all/conanfile.py +++ b/recipes/erikzenker-hsm/all/conanfile.py @@ -12,7 +12,7 @@ class HsmConan(ConanFile): name = "erikzenker-hsm" license = "MIT" - homepage = "https://github.com/erikzenker/hsm.git" + homepage = "https://github.com/erikzenker/hsm" url = "https://github.com/conan-io/conan-center-index" description = ( "The hana state machine (hsm) is a finite state machine library based " @@ -26,7 +26,7 @@ class HsmConan(ConanFile): generators = "CMakeDeps" def requirements(self): - self.requires("boost/1.79.0") + self.requires("boost/1.81.0") def package_id(self): self.info.clear() @@ -42,7 +42,7 @@ def validate(self): raise ConanInvalidConfiguration("GCC 8+ is required") def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/erikzenker-hsm/all/test_v1_package/CMakeLists.txt b/recipes/erikzenker-hsm/all/test_v1_package/CMakeLists.txt index be32b126aba4d..be00a8c7f57c7 100644 --- a/recipes/erikzenker-hsm/all/test_v1_package/CMakeLists.txt +++ b/recipes/erikzenker-hsm/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(hsm REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE hsm::hsm) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/erikzenker-hsm/all/test_v1_package/conanfile.py b/recipes/erikzenker-hsm/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/erikzenker-hsm/all/test_v1_package/conanfile.py +++ b/recipes/erikzenker-hsm/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/erikzenker-hsm/config.yml b/recipes/erikzenker-hsm/config.yml index c4e6cb2ec4176..70460f0d554d4 100644 --- a/recipes/erikzenker-hsm/config.yml +++ b/recipes/erikzenker-hsm/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.0": + folder: all "2.1.0": folder: all "1.4.7": diff --git a/recipes/erkir/all/CMakeLists.txt b/recipes/erkir/all/CMakeLists.txt deleted file mode 100644 index 2d29a388d78da..0000000000000 --- a/recipes/erkir/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.4) - -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory("source_subfolder") diff --git a/recipes/erkir/all/conandata.yml b/recipes/erkir/all/conandata.yml index 253d5bb957704..24a6857c0b7eb 100644 --- a/recipes/erkir/all/conandata.yml +++ b/recipes/erkir/all/conandata.yml @@ -1,8 +1,25 @@ sources: + "2.0.0": + url: "https://github.com/vahancho/erkir/archive/refs/tags/v2.0.0.tar.gz" + sha256: "98d095adcf0f2f11e3ba345bd5bbe890568cde69de9680b2c2a424f0008453ac" "1.0.0": - url: https://github.com/vahancho/erkir/archive/refs/tags/1.0.0.tar.gz - sha256: 0bc5122fe2fef0f9036de275483af7f8adb947f6e8dd63fc18ac085ef31e9421 + url: "https://github.com/vahancho/erkir/archive/refs/tags/1.0.0.tar.gz" + sha256: "0bc5122fe2fef0f9036de275483af7f8adb947f6e8dd63fc18ac085ef31e9421" patches: + "2.0.0": + - patch_file: "patches/2.0.0-0001-remove-specify-architecture.patch" + patch_description: "fix supported architectures limited to x86/x86_64" + patch_type: "conan" + - patch_file: "patches/2.0.0-0002-fix-cmake.patch" + patch_description: "disable shared and fPIC options" + patch_type: "conan" + - patch_file: "patches/2.0.0-0003-fix-erkir_export.patch" + patch_description: "define ERKIR_EXPORT as empty on static build" + patch_type: "conan" "1.0.0": - - patch_file: patches/remove-testing-1.0.0.patch - base_path: source_subfolder + - patch_file: "patches/1.0.0-0001-remove-testing.patch" + patch_description: "stop executing test codes" + patch_type: "conan" + - patch_file: "patches/1.0.0-0002-export-symbols.patch" + patch_description: "export all symbols on windows" + patch_type: "backport" diff --git a/recipes/erkir/all/conanfile.py b/recipes/erkir/all/conanfile.py index 1511a37648558..941e33312f121 100644 --- a/recipes/erkir/all/conanfile.py +++ b/recipes/erkir/all/conanfile.py @@ -1,17 +1,21 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class ErkirConan(ConanFile): name = "erkir" + description = "a C++ library for geodetic and trigonometric calculations" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/vahancho/erkir" - license = "MIT" - description = "a C++ library for geodetic and trigonometric calculations" topics = ("earth", "geodesy", "geography", "coordinate-systems", "geodetic", "datum") - exports_sources = "CMakeLists.txt", "patches/*" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,49 +25,63 @@ class ErkirConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" - + def _min_cppstd(self): + return "11" + + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CODE_COVERAGE"] = False + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CODE_COVERAGE"] = False - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("*", src=os.path.join(self._source_subfolder, "include"), dst=os.path.join("include", "erkir")) - self.copy("*.lib", dst="lib", keep_path=False) - self.copy("*.dll", dst="bin", keep_path=False) - self.copy("*.dylib*", dst="lib", keep_path=False) - self.copy("*.so", dst="lib", keep_path=False) - self.copy("*.a", dst="lib", keep_path=False) - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + if Version(self.version) < "2.0.0": + copy(self, pattern="*", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.dylib*", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.so", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.a", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + else: + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.libs = ["erkir"] + self.cpp_info.set_property("cmake_file_name", "erkir") + self.cpp_info.set_property("cmake_target_name", "erkir::erkir") + postfix = "d" if Version(self.version) >= "2.0.0" and self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [f"erkir{postfix}"] diff --git a/recipes/erkir/all/patches/remove-testing-1.0.0.patch b/recipes/erkir/all/patches/1.0.0-0001-remove-testing.patch similarity index 100% rename from recipes/erkir/all/patches/remove-testing-1.0.0.patch rename to recipes/erkir/all/patches/1.0.0-0001-remove-testing.patch diff --git a/recipes/erkir/all/patches/1.0.0-0002-export-symbols.patch b/recipes/erkir/all/patches/1.0.0-0002-export-symbols.patch new file mode 100644 index 0000000000000..190ff9b9a3f95 --- /dev/null +++ b/recipes/erkir/all/patches/1.0.0-0002-export-symbols.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 851f78a..6575859 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -24,6 +24,8 @@ add_library(erkir::erkir ALIAS erkir) + # Includes + target_include_directories(erkir PUBLIC include) + ++set_target_properties(erkir PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ++ + # Coverage support. + option(CODE_COVERAGE "Enable coverage reporting" ON) + if (CODE_COVERAGE AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") diff --git a/recipes/erkir/all/patches/2.0.0-0001-remove-specify-architecture.patch b/recipes/erkir/all/patches/2.0.0-0001-remove-specify-architecture.patch new file mode 100644 index 0000000000000..0a3aad55accce --- /dev/null +++ b/recipes/erkir/all/patches/2.0.0-0001-remove-specify-architecture.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 52e5571..b97d9d0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -17,7 +17,7 @@ include(GNUInstallDirs) + option(BUILD_SHARED_LIBS "Build using shared libraries" ON) + option(ENABLE_TESTING "Enable unit test build" OFF) + +-if (NOT MSVC) ++if (0) + # Specify the target architecture (Linux). For Windows based generator use rather + # '-A Win32' or '-A x64 options' + set(TARGET_ARCH x86 CACHE STRING "the target architecture") diff --git a/recipes/erkir/all/patches/2.0.0-0002-fix-cmake.patch b/recipes/erkir/all/patches/2.0.0-0002-fix-cmake.patch new file mode 100644 index 0000000000000..50bd8af00a0b8 --- /dev/null +++ b/recipes/erkir/all/patches/2.0.0-0002-fix-cmake.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b97d9d0..0152f84 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -3,7 +3,6 @@ cmake_minimum_required(VERSION 3.9) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) + set(CMAKE_CXX_STANDARD 11) +-set(CMAKE_POSITION_INDEPENDENT_CODE ON) + + # The project definition + project(erkir VERSION 2.0.0 +@@ -14,7 +13,6 @@ project(erkir VERSION 2.0.0 + include(GNUInstallDirs) + + # General options +-option(BUILD_SHARED_LIBS "Build using shared libraries" ON) + option(ENABLE_TESTING "Enable unit test build" OFF) + + if (0) diff --git a/recipes/erkir/all/patches/2.0.0-0003-fix-erkir_export.patch b/recipes/erkir/all/patches/2.0.0-0003-fix-erkir_export.patch new file mode 100644 index 0000000000000..cef30fbc03eea --- /dev/null +++ b/recipes/erkir/all/patches/2.0.0-0003-fix-erkir_export.patch @@ -0,0 +1,28 @@ +diff --git a/include/export.h b/include/export.h +index edcb0b3..e090174 100644 +--- a/include/export.h ++++ b/include/export.h +@@ -1,7 +1,7 @@ + #ifndef __EXPORT_H_ + #define __EXPORT_H_ + +-#ifdef _WIN32 ++#if defined(_WIN32) && defined(ERKIR_SHARED) + #ifdef MAKEDLL + # define ERKIR_EXPORT __declspec(dllexport) + #else +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index ccb807b..8eb005d 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -37,6 +37,10 @@ if (MSVC) + target_compile_definitions(${TARGET} PUBLIC MAKEDLL) + endif() + ++if (BUILD_SHARED_LIBS) ++ target_compile_definitions(${TARGET} PUBLIC ERKIR_SHARED) ++endif() ++ + ############################################################################### + # The installation and packaging + # diff --git a/recipes/erkir/all/test_package/CMakeLists.txt b/recipes/erkir/all/test_package/CMakeLists.txt index 1d7b745144727..135087f122cde 100644 --- a/recipes/erkir/all/test_package/CMakeLists.txt +++ b/recipes/erkir/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) -set(CMAKE_CXX_STANDARD 11) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package CXX) find_package(erkir REQUIRED CONFIG) -add_executable(${PROJECT_NAME} example.cpp) -target_link_libraries(${PROJECT_NAME} erkir::erkir) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE erkir::erkir) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/erkir/all/test_package/conanfile.py b/recipes/erkir/all/test_package/conanfile.py index c7f8c914c58a1..a9fb96656f203 100644 --- a/recipes/erkir/all/test_package/conanfile.py +++ b/recipes/erkir/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -class ErkirTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/erkir/all/test_package/example.cpp b/recipes/erkir/all/test_package/example.cpp deleted file mode 100644 index 0a2d9f956a461..0000000000000 --- a/recipes/erkir/all/test_package/example.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include -#include -#include - -int main(int argc, char **argv) -{ - // Calculate great-circle distance between two points. - erkir::spherical::Point p1{ 52.205, 0.119 }; - erkir::spherical::Point p2{ 48.857, 2.351 }; - auto d = p1.distanceTo(p2); // 404.3 km - - // Get destination point by given distance (shortest) and bearing from start point. - erkir::spherical::Point p3{ 51.4778, -0.0015 }; - auto dest = p3.destinationPoint(7794.0, 300.7); // 51.5135°N, 000.0983°W - - // Convert a point from one coordinates system to another. - erkir::ellipsoidal::Point pWGS84(51.4778, -0.0016, 0, erkir::ellipsoidal::Datum::Type::WGS84); - auto pOSGB = pWGS84.toDatum(erkir::ellipsoidal::Datum::Type::OSGB36); // 51.4778°N, 000.0000°E - - // Convert to Cartesian coordinates. - auto cartesian = pWGS84.toCartesianPoint(); - - // Convert Cartesian point to a geodetic one. - auto geoPoint = cartesian->toGeoPoint(); - - return 0; -} diff --git a/recipes/erkir/all/test_package/test_package.cpp b/recipes/erkir/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..887871e867da3 --- /dev/null +++ b/recipes/erkir/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include +#include +#include + +int main(int argc, char **argv) +{ + // Calculate great-circle distance between two points. + erkir::spherical::Point p1{ 52.205, 0.119 }; + erkir::spherical::Point p2{ 48.857, 2.351 }; + auto d = p1.distanceTo(p2); // 404.3 km + + // Get destination point by given distance (shortest) and bearing from start point. + erkir::spherical::Point p3{ 51.4778, -0.0015 }; + auto dest = p3.destinationPoint(7794.0, 300.7); // 51.5135°N, 000.0983°W + + // Convert a point from one coordinates system to another. + erkir::ellipsoidal::Point pWGS84(51.4778, -0.0016, 0, erkir::ellipsoidal::Datum::Type::WGS84); + auto pOSGB = pWGS84.toDatum(erkir::ellipsoidal::Datum::Type::OSGB36); // 51.4778°N, 000.0000°E + + // Convert to Cartesian coordinates. + auto cartesian = pWGS84.toCartesianPoint(); + + // Convert Cartesian point to a geodetic one. + auto geoPoint = cartesian->toGeoPoint(); + + return 0; +} diff --git a/recipes/erkir/all/test_v1_package/CMakeLists.txt b/recipes/erkir/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/erkir/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/erkir/all/test_v1_package/conanfile.py b/recipes/erkir/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/erkir/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/erkir/config.yml b/recipes/erkir/config.yml index 40341aa3db6cd..870fb33e55af0 100644 --- a/recipes/erkir/config.yml +++ b/recipes/erkir/config.yml @@ -1,3 +1,5 @@ versions: + "2.0.0": + folder: all "1.0.0": folder: all diff --git a/recipes/eternal/all/conandata.yml b/recipes/eternal/all/conandata.yml new file mode 100644 index 0000000000000..8214ea0955a49 --- /dev/null +++ b/recipes/eternal/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.1": + url: "https://github.com/mapbox/eternal/archive/refs/tags/v1.0.1.tar.gz" + sha256: "7d799381b3786d0bd987eea75df2a81f581a64ee962e922a2f7a7d3d0c3d0421" diff --git a/recipes/eternal/all/conanfile.py b/recipes/eternal/all/conanfile.py new file mode 100644 index 0000000000000..fd3a53c2138bb --- /dev/null +++ b/recipes/eternal/all/conanfile.py @@ -0,0 +1,69 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.51.3" + + +class EternalConan(ConanFile): + name = "eternal" + description = "A C++14 compile-time/constexpr map and hash map with minimal binary footprint" + license = "ISC" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mapbox/eternal" + topics = ("hashing", "map", "constexpr", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _minimum_cpp_standard(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "5", + "clang": "4", + "apple-clang": "10", + } + + def export_sources(self): + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.get_safe("compiler.version")) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, pattern="LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="*.hpp", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/eternal/all/test_package/CMakeLists.txt b/recipes/eternal/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8d5920de9d2e0 --- /dev/null +++ b/recipes/eternal/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(eternal REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE eternal::eternal) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/eternal/all/test_package/conanfile.py b/recipes/eternal/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/eternal/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/eternal/all/test_package/test_package.cpp b/recipes/eternal/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..11565bc6294ec --- /dev/null +++ b/recipes/eternal/all/test_package/test_package.cpp @@ -0,0 +1,41 @@ +#include +#include +#include + +#include "mapbox/eternal.hpp" + +struct Color { + constexpr inline Color() { + } + constexpr inline Color(unsigned char r_, unsigned char g_, unsigned char b_, float a_) + : r(r_), g(g_), b(b_), a(a_ > 1 ? 1 : a_ < 0 ? 0 : a_) { + } + unsigned char r = 0, g = 0, b = 0; + float a = 1.0f; + + constexpr bool operator==(const Color& rhs) const { + return r == rhs.r && g == rhs.g && b == rhs.b && + (a >= rhs.a ? a - rhs.a : rhs.a - a) < std::numeric_limits::epsilon(); + } +}; + +MAPBOX_ETERNAL_CONSTEXPR const auto multi_colors = mapbox::eternal::map({ + { "red", { 255, 0, 0, 1 } }, + { "yellow", { 255, 255, 0, 1 } }, + { "white", { 255, 255, 255, 1 } }, // comes before yellow! + { "yellow", { 255, 220, 0, 1 } }, // a darker yellow +}); + +int main(void) { + static_assert(!multi_colors.unique(), "multi_colors are not unique"); + static_assert(multi_colors.find("yellow") != multi_colors.end(), "colors contains yellow"); + static_assert(multi_colors.find("yellow")->second == Color(255, 255, 0, 1), "yellow returns the correct color"); + static_assert((++multi_colors.find("yellow"))->second == Color(255, 220, 0, 1), "yellow returns the correct color"); + static_assert(multi_colors.equal_range("white").first == multi_colors.find("white"), "white range returns the correct begin"); + static_assert(multi_colors.equal_range("white").second == multi_colors.find("yellow"), "white range end is the next color"); + static_assert(multi_colors.equal_range("yellow").first == multi_colors.find("yellow"), "yellow range returns the correct begin"); + static_assert(multi_colors.equal_range("yellow").second == multi_colors.end(), "yellow range end returns end"); + static_assert(multi_colors.count("yellow") == 2, "has 2 yellows"); + + return EXIT_SUCCESS; +} diff --git a/recipes/eternal/all/test_v1_package/CMakeLists.txt b/recipes/eternal/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..e900db203f73f --- /dev/null +++ b/recipes/eternal/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(eternal REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE eternal::eternal) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/eternal/all/test_v1_package/conanfile.py b/recipes/eternal/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/eternal/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/eternal/config.yml b/recipes/eternal/config.yml new file mode 100644 index 0000000000000..715e55357a17b --- /dev/null +++ b/recipes/eternal/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.1": + folder: all diff --git a/recipes/etl/all/conandata.yml b/recipes/etl/all/conandata.yml index 3b4ff0a1ede88..99eb9f1e0eb76 100644 --- a/recipes/etl/all/conandata.yml +++ b/recipes/etl/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "20.35.11": + url: "https://github.com/ETLCPP/etl/archive/20.35.11.tar.gz" + sha256: "64a9eed9b9ac8a278349aac8e5888320fda0e090ba24373651767b7a8b8793fc" + "20.35.8": + url: "https://github.com/ETLCPP/etl/archive/20.35.8.tar.gz" + sha256: "7d0a6402b24fc91cf66328b95391a38c52d20f582f42497fb9b0a99d71ab8879" + "20.35.7": + url: "https://github.com/ETLCPP/etl/archive/20.35.7.tar.gz" + sha256: "20127e36c12a33142645dd5ec0a08d12b34ce9b33986847eeaa8c4201e025895" + "20.35.5": + url: "https://github.com/ETLCPP/etl/archive/20.35.5.tar.gz" + sha256: "d67aead4f1c023eaeb9ae67b62b0aed76138aa1b7dac48f627530ab3ea366281" + "20.35.0": + url: "https://github.com/ETLCPP/etl/archive/20.35.0.tar.gz" + sha256: "1bfbc5679bce41625add0e5d7354ab8521dc4811f13e1627a9816af65f49f42b" + "20.34.0": + url: "https://github.com/ETLCPP/etl/archive/20.34.0.tar.gz" + sha256: "56e25968f20167a161ee50c3eecda3daa91f696660ba59654c1afd22e502c465" "20.33.0": url: "https://github.com/ETLCPP/etl/archive/20.33.0.tar.gz" sha256: "46068e44cc3cbd626fc8adc5344101b4654c675b9a5faec0c80989176419cd7d" diff --git a/recipes/etl/config.yml b/recipes/etl/config.yml index dd0382811d331..9d23a0b77c0a4 100644 --- a/recipes/etl/config.yml +++ b/recipes/etl/config.yml @@ -1,4 +1,16 @@ versions: + "20.35.11": + folder: all + "20.35.8": + folder: all + "20.35.7": + folder: all + "20.35.5": + folder: all + "20.35.0": + folder: all + "20.34.0": + folder: all "20.33.0": folder: all "20.32.1": diff --git a/recipes/exiv2/all/CMakeLists.txt b/recipes/exiv2/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/exiv2/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/exiv2/all/conandata.yml b/recipes/exiv2/all/conandata.yml index b738a41a9258f..63e5ef9836649 100644 --- a/recipes/exiv2/all/conandata.yml +++ b/recipes/exiv2/all/conandata.yml @@ -1,12 +1,21 @@ sources: + "0.27.5": + url: "https://github.com/Exiv2/exiv2/releases/download/v0.27.5/exiv2-0.27.5-Source.tar.gz" + sha256: "35a58618ab236a901ca4928b0ad8b31007ebdc0386d904409d825024e45ea6e2" "0.27.4": - url: "https://github.com/Exiv2/exiv2/archive/refs/tags/v0.27.4.tar.gz" - sha256: "9fb2752c92f63c9853e0bef9768f21138eeac046280f40ded5f37d06a34880d9" + url: "https://github.com/Exiv2/exiv2/releases/download/v0.27.4/exiv2-0.27.4-Source.tar.gz" + sha256: "84366dba7c162af9a7603bcd6c16f40fe0e9af294ba2fd2f66ffffb9fbec904e" patches: + "0.27.5": + - patch_file: "patches/0001-link-0.27.5.patch" + - patch_file: "patches/0003-fix-ios.patch" + - patch_file: "patches/0004-find-expat.patch" + patch_description: "enforce usage of FindEXPAT.cmake" + patch_type: "conan" "0.27.4": - patch_file: "patches/0001-link.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-fpic.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-fix-ios.patch" - base_path: "source_subfolder" + - patch_file: "patches/0004-find-expat.patch" + patch_description: "enforce usage of FindEXPAT.cmake" + patch_type: "conan" diff --git a/recipes/exiv2/all/conanfile.py b/recipes/exiv2/all/conanfile.py index d444470618ff4..34ee99761cacc 100644 --- a/recipes/exiv2/all/conanfile.py +++ b/recipes/exiv2/all/conanfile.py @@ -1,10 +1,12 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps +from conan.tools.files import get, copy, rmdir, save, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class Exiv2Conan(ConanFile): @@ -16,6 +18,7 @@ class Exiv2Conan(ConanFile): homepage = "https://www.exiv2.org" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,25 +37,8 @@ class Exiv2Conan(ConanFile): provides = [] - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -60,63 +46,68 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.with_xmp == "bundled": # recipe has bundled xmp-toolkit-sdk of old version # avoid conflict with a future xmp recipe self.provides.append("xmp-toolkit-sdk") + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("libiconv/1.16") + self.requires("libiconv/1.17") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") + self.requires("zlib/1.2.13") if self.options.with_xmp == "bundled": - self.requires("expat/2.4.3") + self.requires("expat/2.5.0") if self.options.with_curl: - self.requires("libcurl/7.80.0") + self.requires("libcurl/7.87.0") def validate(self): if self.options.with_xmp == "external": raise ConanInvalidConfiguration("adobe-xmp-toolkit is not available on cci (yet)") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["EXIV2_BUILD_SAMPLES"] = False + tc.variables["EXIV2_BUILD_EXIV2_COMMAND"] = False + tc.variables["EXIV2_ENABLE_PNG"] = self.options.with_png + tc.variables["EXIV2_ENABLE_XMP"] = self.options.with_xmp == "bundled" + tc.variables["EXIV2_ENABLE_EXTERNAL_XMP"] = self.options.with_xmp == "external" + # NLS is used only for tool which is not built + tc.variables["EXIV2_ENABLE_NLS"] = False + tc.variables["EXIV2_ENABLE_WEBREADY"] = self.options.with_curl + tc.variables["EXIV2_ENABLE_CURL"] = self.options.with_curl + tc.variables["EXIV2_ENABLE_SSH"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + + if is_msvc(self): + tc.variables["EXIV2_ENABLE_DYNAMIC_RUNTIME"] = not is_msvc_static_runtime(self) + # set PIC manually because of object target exiv2_int + tc.cache_variables["CMAKE_POSITION_INDEPENDENT_CODE"] = bool(self.options.get_safe("fPIC", True)) + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["EXIV2_BUILD_SAMPLES"] = False - self._cmake.definitions["EXIV2_BUILD_EXIV2_COMMAND"] = False - self._cmake.definitions["EXIV2_ENABLE_PNG"] = self.options.with_png - self._cmake.definitions["EXIV2_ENABLE_XMP"] = self.options.with_xmp == "bundled" - self._cmake.definitions["EXIV2_ENABLE_EXTERNAL_XMP"] = self.options.with_xmp == "external" - # NLS is used only for tool which is not built - self._cmake.definitions["EXIV2_ENABLE_NLS"] = False - self._cmake.definitions["EXIV2_ENABLE_WEBREADY"] = self.options.with_curl - self._cmake.definitions["EXIV2_ENABLE_CURL"] = self.options.with_curl - self._cmake.definitions["EXIV2_ENABLE_SSH"] = False - if self._is_msvc: - self._cmake.definitions["EXIV2_ENABLE_DYNAMIC_RUNTIME"] = "MD" in msvc_runtime_flag(self) - # set PIC manually because of object target exiv2_int - self._cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed targets = {"exiv2lib": "exiv2::exiv2lib"} @@ -127,21 +118,20 @@ def package(self): targets ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "exiv2") @@ -152,7 +142,7 @@ def package_info(self): self.cpp_info.components["exiv2lib"].libs = ["exiv2"] self.cpp_info.components["exiv2lib"].requires = [ "libiconv::libiconv"] if self.options.with_png: - self.cpp_info.components["exiv2lib"].requires.append("libpng::libpng") + self.cpp_info.components["exiv2lib"].requires.extend(["libpng::libpng", "zlib::zlib"]) if self.options.with_curl: self.cpp_info.components["exiv2lib"].requires.append("libcurl::libcurl") diff --git a/recipes/exiv2/all/patches/0001-link-0.27.5.patch b/recipes/exiv2/all/patches/0001-link-0.27.5.patch new file mode 100644 index 0000000000000..b94b7e7a8c10c --- /dev/null +++ b/recipes/exiv2/all/patches/0001-link-0.27.5.patch @@ -0,0 +1,29 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 26e5a951..141211ef 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -142,11 +142,6 @@ if (MSVC) + set_target_properties(exiv2lib PROPERTIES LINK_FLAGS "/ignore:4099") + endif() + +-set_target_properties( exiv2lib_int PROPERTIES +- POSITION_INDEPENDENT_CODE ON +- COMPILE_DEFINITIONS exiv2lib_EXPORTS +-) +- + # NOTE: Cannot use target_link_libraries on OBJECT libraries with old versions of CMake + target_include_directories(exiv2lib_int PRIVATE ${ZLIB_INCLUDE_DIR}) + target_include_directories(exiv2lib SYSTEM PRIVATE +diff --git a/xmpsdk/CMakeLists.txt b/xmpsdk/CMakeLists.txt +index a22698fb..9ef87970 100644 +--- a/xmpsdk/CMakeLists.txt ++++ b/xmpsdk/CMakeLists.txt +@@ -28,7 +28,7 @@ add_library(exiv2-xmp STATIC + + target_link_libraries(exiv2-xmp + PRIVATE +- $ ++ EXPAT::EXPAT + ) + + target_include_directories(exiv2-xmp diff --git a/recipes/exiv2/all/patches/0004-find-expat.patch b/recipes/exiv2/all/patches/0004-find-expat.patch new file mode 100644 index 0000000000000..5bb571eb0f807 --- /dev/null +++ b/recipes/exiv2/all/patches/0004-find-expat.patch @@ -0,0 +1,15 @@ +Ensure to use FindEXPAT.cmake instead of expat-config.cmake +(side effect of CMAKE_FIND_PACKAGE_PREFER_CONFIG ON, see https://github.com/conan-io/conan/issues/10387) +diff --git a/cmake/findDependencies.cmake b/cmake/findDependencies.cmake +index ec3a43f5..27bf42d3 100644 +--- a/cmake/findDependencies.cmake ++++ b/cmake/findDependencies.cmake +@@ -42,7 +42,7 @@ if (EXIV2_ENABLE_XMP AND EXIV2_ENABLE_EXTERNAL_XMP) + message(FATAL_ERROR "EXIV2_ENABLE_XMP AND EXIV2_ENABLE_EXTERNAL_XMP are mutually exclusive. You can only choose one of them") + else() + if (EXIV2_ENABLE_XMP) +- find_package(EXPAT REQUIRED) ++ find_package(EXPAT REQUIRED MODULE) + elseif (EXIV2_ENABLE_EXTERNAL_XMP) + find_package(XmpSdk REQUIRED) + endif () diff --git a/recipes/exiv2/all/test_package/CMakeLists.txt b/recipes/exiv2/all/test_package/CMakeLists.txt index e1868b6302fec..3bd4318c428ba 100644 --- a/recipes/exiv2/all/test_package/CMakeLists.txt +++ b/recipes/exiv2/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(exiv2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/exiv2/all/test_package/conanfile.py b/recipes/exiv2/all/test_package/conanfile.py index b6a26067f365d..0a6bc68712d90 100644 --- a/recipes/exiv2/all/test_package/conanfile.py +++ b/recipes/exiv2/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/exiv2/all/test_v1_package/CMakeLists.txt b/recipes/exiv2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/exiv2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/exiv2/all/test_v1_package/conanfile.py b/recipes/exiv2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b6a26067f365d --- /dev/null +++ b/recipes/exiv2/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os + +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/exiv2/config.yml b/recipes/exiv2/config.yml index 487a32d2a9454..470d3a327a30b 100644 --- a/recipes/exiv2/config.yml +++ b/recipes/exiv2/config.yml @@ -1,3 +1,5 @@ versions: + "0.27.5": + folder: all "0.27.4": folder: all diff --git a/recipes/expat/all/conandata.yml b/recipes/expat/all/conandata.yml index 492b377cb1c27..f3b9d575c901c 100644 --- a/recipes/expat/all/conandata.yml +++ b/recipes/expat/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.5.0": + url: "https://github.com/libexpat/libexpat/releases/download/R_2_5_0/expat-2.5.0.tar.xz" + sha256: "ef2420f0232c087801abf705e89ae65f6257df6b7931d37846a193ef2e8cdcbe" + "2.4.9": + sha256: "6e8c0728fe5c7cd3f93a6acce43046c5e4736c7b4b68e032e9350daa0efc0354" + url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_9/expat-2.4.9.tar.xz" "2.4.8": sha256: "f79b8f904b749e3e0d20afeadecf8249c55b2e32d4ebb089ae378df479dcaf25" url: "https://github.com/libexpat/libexpat/releases/download/R_2_4_8/expat-2.4.8.tar.xz" @@ -29,19 +35,6 @@ sources: "2.2.10": sha256: "bf42d1f52371d23684de36cc6d2f0f1acd02de264d1105bdc17792bbeb7e7ceb" url: "https://github.com/libexpat/libexpat/releases/download/R_2_2_10/expat-2.2.10.tar.gz" - "2.2.9": - sha256: "4456e0aa72ecc7e1d4b3368cd545a5eec7f9de5133a8dc37fdb1efa6174c4947" - url: "https://github.com/libexpat/libexpat/releases/download/R_2_2_9/expat-2.2.9.tar.gz" - "2.2.8": - sha256: "bd507cba42716ca9afe46dd3687fb0d46c09347517beb9770f53a435d2c67ea0" - url: "https://github.com/libexpat/libexpat/releases/download/R_2_2_8/expat-2.2.8.tar.gz" - "2.2.7": - sha256: "42241742da97d40557857726cc4f02008cd14f2b44134c6e33af043967cd9d15" - url: "https://github.com/libexpat/libexpat/releases/download/R_2_2_7/expat-2.2.7.tar.gz" patches: "2.3.0": - patch_file: "patches/0001-2.3.0-relax-vs-restriction.patch" - "2.2.7": - - patch_file: "patches/0002-2.2.7-fix-set-cmake-policies.patch" - patch_description: "cmake_minimum_required(VERSION) should be called before project() for cmake policies to work" - patch_type: "conan" diff --git a/recipes/expat/all/conanfile.py b/recipes/expat/all/conanfile.py index 6fd73d9225948..04caae4cbe008 100644 --- a/recipes/expat/all/conanfile.py +++ b/recipes/expat/all/conanfile.py @@ -1,21 +1,20 @@ -from conan import ConanFile, tools +from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, rmdir +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class ExpatConan(ConanFile): name = "expat" description = "Fast streaming XML parser written in C." - topics = ("expat", "xml", "parsing") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/libexpat/libexpat" - license = "MIT" - settings = "os", "compiler", "build_type", "arch" + topics = ("xml", "parsing") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -28,60 +27,35 @@ class ExpatConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if Version(self.version) < "2.2.8": - del self.options.char_type def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - tools.files.get(self, - **self.conan_data["sources"][self.version], - destination=self.source_folder, - strip_root=True - ) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): tc = CMakeToolchain(self) - if Version(self.version) < "2.2.8": - tc.variables["BUILD_doc"] = False - tc.variables["BUILD_examples"] = False - tc.variables["BUILD_shared"] = self.options.shared - tc.variables["BUILD_tests"] = False - tc.variables["BUILD_tools"] = False - # Generate a relocatable shared lib on Macos - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - else: - # These options were renamed in 2.2.8 to be more consistent - tc.variables["EXPAT_BUILD_DOCS"] = False - tc.variables["EXPAT_BUILD_EXAMPLES"] = False - tc.variables["EXPAT_SHARED_LIBS"] = self.options.shared - tc.variables["EXPAT_BUILD_TESTS"] = False - tc.variables["EXPAT_BUILD_TOOLS"] = False - # EXPAT_CHAR_TYPE was added in 2.2.8 - tc.variables["EXPAT_CHAR_TYPE"] = self.options.char_type - if is_msvc(self): - tc.variables["EXPAT_MSVC_STATIC_CRT"] = is_msvc_static_runtime(self) - if Version(self.version) >= "2.2.10": - tc.variables["EXPAT_BUILD_PKGCONFIG"] = False + tc.variables["EXPAT_BUILD_DOCS"] = False + tc.variables["EXPAT_BUILD_EXAMPLES"] = False + tc.variables["EXPAT_SHARED_LIBS"] = self.options.shared + tc.variables["EXPAT_BUILD_TESTS"] = False + tc.variables["EXPAT_BUILD_TOOLS"] = False + tc.variables["EXPAT_CHAR_TYPE"] = self.options.char_type + if is_msvc(self): + tc.variables["EXPAT_MSVC_STATIC_CRT"] = is_msvc_static_runtime(self) + tc.variables["EXPAT_BUILD_PKGCONFIG"] = False tc.generate() def build(self): @@ -106,9 +80,6 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "expat::expat") self.cpp_info.set_property("pkg_config_name", "expat") - self.cpp_info.names["cmake_find_package"] = "EXPAT" - self.cpp_info.names["cmake_find_package_multi"] = "expat" - self.cpp_info.libs = collect_libs(self) if not self.options.shared: self.cpp_info.defines = ["XML_STATIC"] @@ -116,3 +87,10 @@ def package_info(self): self.cpp_info.defines.append("XML_UNICODE") elif self.options.get_safe("char_type") == "wchar_t": self.cpp_info.defines.append("XML_UNICODE_WCHAR_T") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "EXPAT" + self.cpp_info.names["cmake_find_package_multi"] = "expat" diff --git a/recipes/expat/all/patches/0002-2.2.7-fix-set-cmake-policies.patch b/recipes/expat/all/patches/0002-2.2.7-fix-set-cmake-policies.patch deleted file mode 100644 index 270be0cdfdcc6..0000000000000 --- a/recipes/expat/all/patches/0002-2.2.7-fix-set-cmake-policies.patch +++ /dev/null @@ -1,16 +0,0 @@ -diff --git a/expat/CMakeLists.txt b/expat/CMakeLists.txt -index 99b55d5e4..f0e613430 100644 ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -1,9 +1,10 @@ - # This file is copyrighted under the BSD-license for buildsystem files of KDE - # copyright 2010, Patrick Spendrin - -+cmake_minimum_required(VERSION 2.8.10) -+ - project(expat) - --cmake_minimum_required(VERSION 2.8.10) - set(PACKAGE_BUGREPORT "expat-bugs@libexpat.org") - set(PACKAGE_NAME "expat") - set(PACKAGE_VERSION "2.2.7") diff --git a/recipes/expat/all/test_package/CMakeLists.txt b/recipes/expat/all/test_package/CMakeLists.txt index 0112493aefb59..5129dd0d2152f 100644 --- a/recipes/expat/all/test_package/CMakeLists.txt +++ b/recipes/expat/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -find_package(EXPAT REQUIRED) +find_package(expat REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} expat::expat) +target_link_libraries(${PROJECT_NAME} PRIVATE expat::expat) diff --git a/recipes/expat/all/test_package/conanfile.py b/recipes/expat/all/test_package/conanfile.py index 796b3ffe4e77f..98ab55852ad56 100644 --- a/recipes/expat/all/test_package/conanfile.py +++ b/recipes/expat/all/test_package/conanfile.py @@ -1,12 +1,13 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def layout(self): cmake_layout(self) @@ -20,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/expat/all/test_package_module/CMakeLists.txt b/recipes/expat/all/test_package_module/CMakeLists.txt new file mode 100644 index 0000000000000..cc3b096a67958 --- /dev/null +++ b/recipes/expat/all/test_package_module/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.10) +project(test_package LANGUAGES C) + +find_package(EXPAT REQUIRED MODULE) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE EXPAT::EXPAT) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindEXPAT.html +# are properly defined in conan generators +set(_custom_vars + EXPAT_INCLUDE_DIRS + EXPAT_LIBRARIES + EXPAT_FOUND +) +foreach(_custom_var ${_custom_vars}) + if(DEFINED _custom_var) + message(STATUS "${_custom_var}: ${${_custom_var}}") + else() + message(FATAL_ERROR "${_custom_var} not defined") + endif() +endforeach() diff --git a/recipes/expat/all/test_package_module/conanfile.py b/recipes/expat/all/test_package_module/conanfile.py new file mode 100644 index 0000000000000..98ab55852ad56 --- /dev/null +++ b/recipes/expat/all/test_package_module/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/expat/all/test_v1_package/CMakeLists.txt b/recipes/expat/all/test_v1_package/CMakeLists.txt index 24c02212fc751..de3b75d9538de 100644 --- a/recipes/expat/all/test_v1_package/CMakeLists.txt +++ b/recipes/expat/all/test_v1_package/CMakeLists.txt @@ -4,7 +4,5 @@ project(test_package LANGUAGES C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(EXPAT REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE EXPAT::EXPAT) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/expat/all/test_v1_package/conanfile.py b/recipes/expat/all/test_v1_package/conanfile.py index ce55a020e87e9..5a05af3c2dfd2 100644 --- a/recipes/expat/all/test_v1_package/conanfile.py +++ b/recipes/expat/all/test_v1_package/conanfile.py @@ -1,11 +1,11 @@ -# pylint: skip-file -from conans import ConanFile, CMake, tools +from conans import ConanFile, CMake +from conan.tools.build import cross_building import os -class TestPackageConan(ConanFile): +class TestPackageV1Conan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) @@ -13,6 +13,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if not cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) diff --git a/recipes/expat/all/test_v1_package_module/CMakeLists.txt b/recipes/expat/all/test_v1_package_module/CMakeLists.txt new file mode 100644 index 0000000000000..1626621388ae7 --- /dev/null +++ b/recipes/expat/all/test_v1_package_module/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package_module/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package_module/) diff --git a/recipes/expat/all/test_v1_package_module/conanfile.py b/recipes/expat/all/test_v1_package_module/conanfile.py new file mode 100644 index 0000000000000..5f9efeb33878b --- /dev/null +++ b/recipes/expat/all/test_v1_package_module/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/expat/config.yml b/recipes/expat/config.yml index 5659be52c682e..e09e9d75495cc 100644 --- a/recipes/expat/config.yml +++ b/recipes/expat/config.yml @@ -1,4 +1,8 @@ versions: + "2.5.0": + folder: all + "2.4.9": + folder: all "2.4.8": folder: all "2.4.7": @@ -19,9 +23,3 @@ versions: folder: all "2.2.10": folder: all - "2.2.9": - folder: all - "2.2.8": - folder: all - "2.2.7": - folder: all diff --git a/recipes/exprtk/all/conandata.yml b/recipes/exprtk/all/conandata.yml index 7cc52941e132f..8720b949093ed 100755 --- a/recipes/exprtk/all/conandata.yml +++ b/recipes/exprtk/all/conandata.yml @@ -1,4 +1,8 @@ sources: + "0.0.2": + url: "https://github.com/ArashPartow/exprtk/archive/0.0.2.tar.gz" + sha256: "7e8de4a0bfc9855c1316d8b8bc422061aef9a307c2f42d2e66298980463195c1" + "0.0.1": url: "https://github.com/ArashPartow/exprtk/archive/refs/tags/0.0.1.tar.gz" sha256: "fb72791c88ae3b3426e14fdad630027715682584daf56b973569718c56e33f28" diff --git a/recipes/exprtk/config.yml b/recipes/exprtk/config.yml index fcaa7fd847f94..9873c37c1518d 100755 --- a/recipes/exprtk/config.yml +++ b/recipes/exprtk/config.yml @@ -1,3 +1,5 @@ versions: + "0.0.2": + folder: "all" "0.0.1": folder: "all" diff --git a/recipes/ezc3d/all/conanfile.py b/recipes/ezc3d/all/conanfile.py index d28fe42575811..61652bf6c8d41 100644 --- a/recipes/ezc3d/all/conanfile.py +++ b/recipes/ezc3d/all/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class Ezc3dConan(ConanFile): @@ -17,6 +17,7 @@ class Ezc3dConan(ConanFile): homepage = "https://github.com/pyomeca/ezc3d" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,8 +29,7 @@ class Ezc3dConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,18 +37,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -85,17 +84,17 @@ def package(self): def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) + """) save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "ezc3d") @@ -103,7 +102,7 @@ def package_info(self): self.cpp_info.includedirs.append(os.path.join("include", "ezc3d")) lib_suffix = {"Debug": "_debug"}.get(str(self.settings.build_type), "") - self.cpp_info.libs = ["ezc3d" + lib_suffix] + self.cpp_info.libs = [f"ezc3d{lib_suffix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/ezc3d/all/test_package/conanfile.py b/recipes/ezc3d/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/ezc3d/all/test_package/conanfile.py +++ b/recipes/ezc3d/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/ezc3d/all/test_v1_package/CMakeLists.txt b/recipes/ezc3d/all/test_v1_package/CMakeLists.txt index 05feb4e3a5565..0d20897301b68 100644 --- a/recipes/ezc3d/all/test_v1_package/CMakeLists.txt +++ b/recipes/ezc3d/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(ezc3d REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE ezc3d) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/ezc3d/all/test_v1_package/conanfile.py b/recipes/ezc3d/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/ezc3d/all/test_v1_package/conanfile.py +++ b/recipes/ezc3d/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/faac/all/conandata.yml b/recipes/faac/all/conandata.yml index 187de5684ab94..a217e9fd92fd5 100644 --- a/recipes/faac/all/conandata.yml +++ b/recipes/faac/all/conandata.yml @@ -2,10 +2,15 @@ sources: "1.30": url: "https://github.com/knik0/faac/archive/1_30.tar.gz" sha256: "adc387ce588cca16d98c03b6ec1e58f0ffd9fc6eadb00e254157d6b16203b2d2" - "1.28": - url: "https://github.com/knik0/faac/archive/refs/tags/faac1_28.tar.gz" - sha256: "fec821797a541e8359f086fef454b947a7f7246fe8ec6207668968b86606a7dd" patches: "1.30": - - patch_file: "patches/001-fix-out-of-root-build.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.30-0001-fix-out-of-root-build.patch" + patch_description: "Fix out of root build" + patch_source: "https://github.com/knik0/faac/commit/c8d12a5c7c5b6f1c4593f0a6c1eeceacc4d7c941.patch" + patch_type: "conan" + - patch_file: "patches/1.30-0002-dont-hardcode-x86.patch" + patch_description: "Allow to build for x86_64" + patch_type: "portability" + - patch_file: "patches/1.30-0003-relax-windows-sdk.patch" + patch_description: "Don't constrain Windows SDK" + patch_type: "portability" diff --git a/recipes/faac/all/conanfile.py b/recipes/faac/all/conanfile.py index bd64d9ff6cbb8..101a73acd4cc4 100644 --- a/recipes/faac/all/conanfile.py +++ b/recipes/faac/all/conanfile.py @@ -1,10 +1,15 @@ -from conan.tools.files import apply_conandata_patches -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class FaacConan(ConanFile): @@ -29,14 +34,6 @@ class FaacConan(ConanFile): "drm": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" @@ -47,11 +44,18 @@ def _settings_build(self): @property def _has_mp4_option(self): - return tools.Version(self.version) < "1.29.1" + return Version(self.version) < "1.29.1" + + @property + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + + @property + def _sln_folder(self): + return os.path.join(self.source_folder, "project", "msvc") def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -61,69 +65,127 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): # FIXME: libfaac depends on kissfft. Try to unvendor this dependency pass def validate(self): - if self._is_msvc: - # FIXME: add msvc support since there are MSBuild files upstream - raise ConanInvalidConfiguration("libfaac conan-center recipe doesn't support building with Visual Studio yet") + if is_msvc(self): + if self.settings.arch not in ["x86", "x86_64"]: + raise ConanInvalidConfiguration(f"{self.ref} only supports x86 and x86_64 with Visual Studio") + if self.options.drm and not self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} with drm support can't be built as static with Visual Studio") if self.options.get_safe("with_mp4"): # TODO: as mpv4v2 as a conan package raise ConanInvalidConfiguration("building with mp4v2 is not supported currently") def build_requirements(self): - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not is_msvc(self): + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-drm={}".format(yes_no(self.options.drm)), - ] - if self._has_mp4_option: - args.append("--with-mp4v2={}".format(yes_no(self.options.with_mp4))) - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.generate() + else: + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.append(f"--enable-drm={yes_no(self.options.drm)}") + if self._has_mp4_option: + tc.configure_args.append(f"--with-mp4v2={yes_no(self.options.with_mp4)}") + tc.generate() def build(self): apply_conandata_patches(self) - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") + if is_msvc(self): + #========================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + vcxproj_files = ["faac.vcxproj", "libfaac.vcxproj", "libfaac_dll.vcxproj", "libfaac_dll_drm.vcxproj"] + platform_toolset = MSBuildToolchain(self).toolset + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + for vcxproj_file in vcxproj_files: + replace_in_file( + self, os.path.join(self._sln_folder, vcxproj_file), + "v141", + f"{platform_toolset}", + ) + replace_in_file( + self, os.path.join(self._sln_folder, vcxproj_file), + "", + f"", + ) + #========================== + + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + # Allow to build for other archs than Win32 + if self.settings.arch != "x86": + for vc_proj_file in ( + "faac.sln", "faac.vcxproj", "libfaac.vcxproj", + "libfaac_dll.vcxproj", "libfaac_dll_drm.vcxproj" + ): + replace_in_file(self, os.path.join(self._sln_folder, vc_proj_file), "Win32", msbuild.platform) + targets = ["faac"] + if self.options.drm: + targets.append("libfaac_dll_drm") + else: + targets.append("libfaac_dll" if self.options.shared else "libfaac") + msbuild.build(os.path.join(self._sln_folder, "faac.sln"), targets=targets) + else: + autotools = Autotools(self) + autotools.autoreconf() if self._is_mingw and self.options.shared: - tools.replace_in_file(os.path.join("libfaac", "Makefile"), - "\nlibfaac_la_LIBADD = ", - "\nlibfaac_la_LIBADD = -no-undefined ") - autotools = self._configure_autotools() - autotools.make() + replace_in_file(self, os.path.join(self.build_folder, "libfaac", "Makefile"), + "\nlibfaac_la_LIBADD = ", + "\nlibfaac_la_LIBADD = -no-undefined ") + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + output_folder = os.path.join(self._sln_folder, "bin", self._msbuild_configuration) + copy(self, "*.exe", src=output_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.dll", src=output_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + if self.options.drm: + old_libname = "libfaacdrm.lib" + new_libname = "faac_drm.lib" + else: + old_libname = "libfaac_dll.lib" if self.options.shared else "libfaac.lib" + new_libname = "faac.lib" + lib_folder = os.path.join(self.package_folder, "lib") + copy(self, old_libname, src=output_folder, dst=lib_folder, keep_path=False) + rename(self, os.path.join(lib_folder, old_libname), os.path.join(lib_folder, new_libname)) + else: + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.libs = ["faac"] + suffix = "_drm" if self.options.drm else "" + self.cpp_info.libs = [f"faac{suffix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/faac/all/patches/001-fix-out-of-root-build.patch b/recipes/faac/all/patches/1.30-0001-fix-out-of-root-build.patch similarity index 100% rename from recipes/faac/all/patches/001-fix-out-of-root-build.patch rename to recipes/faac/all/patches/1.30-0001-fix-out-of-root-build.patch diff --git a/recipes/faac/all/patches/1.30-0002-dont-hardcode-x86.patch b/recipes/faac/all/patches/1.30-0002-dont-hardcode-x86.patch new file mode 100644 index 0000000000000..f39de0190d9d7 --- /dev/null +++ b/recipes/faac/all/patches/1.30-0002-dont-hardcode-x86.patch @@ -0,0 +1,74 @@ +--- a/project/msvc/faac.vcxproj ++++ b/project/msvc/faac.vcxproj +@@ -66,7 +66,7 @@ + 0x0413 + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + true + Console +@@ -89,7 +89,7 @@ + 0x0413 + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + Console + +--- a/project/msvc/libfaac_dll.vcxproj ++++ b/project/msvc/libfaac_dll.vcxproj +@@ -61,10 +61,9 @@ + true + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + .\libfaac.def +- MachineX86 + + + Retrieving package version... +@@ -84,11 +83,10 @@ + EditAndContinue + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + .\libfaac.def + true +- MachineX86 + + + Retrieving package version... +--- a/project/msvc/libfaac_dll_drm.vcxproj ++++ b/project/msvc/libfaac_dll_drm.vcxproj +@@ -61,10 +61,9 @@ + true + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + .\libfaac.def +- MachineX86 + $(OutDir)libfaacdrm.lib + + +@@ -85,11 +84,10 @@ + EditAndContinue + + +- /MACHINE:I386 %(AdditionalOptions) ++ %(AdditionalOptions) + true + .\libfaac.def + true +- MachineX86 + $(OutDir)libfaacdrm.lib + + diff --git a/recipes/faac/all/patches/1.30-0003-relax-windows-sdk.patch b/recipes/faac/all/patches/1.30-0003-relax-windows-sdk.patch new file mode 100644 index 0000000000000..772fe863051a4 --- /dev/null +++ b/recipes/faac/all/patches/1.30-0003-relax-windows-sdk.patch @@ -0,0 +1,40 @@ +--- a/project/msvc/faac.vcxproj ++++ b/project/msvc/faac.vcxproj +@@ -12,7 +12,6 @@ + + + {92992E74-AEDE-46DC-AD8C-ADEA876F1A4C} +- 8.1 + + + +--- a/project/msvc/libfaac.vcxproj ++++ b/project/msvc/libfaac.vcxproj +@@ -13,7 +13,6 @@ + + libfaac + {9CC48C6E-92EB-4814-AD37-97AB3622AB65} +- 8.1 + + + +--- a/project/msvc/libfaac_dll.vcxproj ++++ b/project/msvc/libfaac_dll.vcxproj +@@ -13,7 +13,6 @@ + + libfaac_dll + {856BB8CF-B944-4D7A-9D59-4945316229AA} +- 8.1 + + + +--- a/project/msvc/libfaac_dll_drm.vcxproj ++++ b/project/msvc/libfaac_dll_drm.vcxproj +@@ -13,7 +13,6 @@ + + libfaac_dll_drm + {AA2D0EFE-E73D-40AD-ADCE-8A2B54F34C6F} +- 8.1 + + + diff --git a/recipes/faac/all/test_package/CMakeLists.txt b/recipes/faac/all/test_package/CMakeLists.txt index 366ecce0962e7..d2d4532f8451f 100644 --- a/recipes/faac/all/test_package/CMakeLists.txt +++ b/recipes/faac/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1.0) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) find_package(faac REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} faac::faac) +target_link_libraries(${PROJECT_NAME} PRIVATE faac::faac) diff --git a/recipes/faac/all/test_package/conanfile.py b/recipes/faac/all/test_package/conanfile.py index 697dfef261b53..0a6bc68712d90 100644 --- a/recipes/faac/all/test_package/conanfile.py +++ b/recipes/faac/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/faac/all/test_v1_package/CMakeLists.txt b/recipes/faac/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/faac/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/faac/all/test_v1_package/conanfile.py b/recipes/faac/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/faac/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/faac/config.yml b/recipes/faac/config.yml index e34a7ad292edb..a6f1b0cffc2dd 100644 --- a/recipes/faac/config.yml +++ b/recipes/faac/config.yml @@ -1,5 +1,3 @@ versions: "1.30": folder: all - "1.28": - folder: all diff --git a/recipes/fakeit/all/conandata.yml b/recipes/fakeit/all/conandata.yml index 822858ea79ad4..6c84b299ffd6c 100644 --- a/recipes/fakeit/all/conandata.yml +++ b/recipes/fakeit/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.3.2": + url: "https://github.com/eranpeer/FakeIt/archive/2.3.2.tar.gz" + sha256: "d2472d0d4b3dce83e8c9672e9221375c7a0c32aa8fe57c20075776928142b495" + "2.3.1": + url: "https://github.com/eranpeer/FakeIt/archive/2.3.1.tar.gz" + sha256: "8dea371c729ff4b5f007dafc95e7807ea146402a3b0da1b5a11cace538a57b61" "2.3.0": url: "https://github.com/eranpeer/FakeIt/archive/2.3.0.tar.gz" sha256: "990469c1e4608ebf662d64e979aa607a0c32faa40cc5ffe38b74c7dd6968ed2d" diff --git a/recipes/fakeit/config.yml b/recipes/fakeit/config.yml index 46e3c97d8884a..a05c93c91a063 100644 --- a/recipes/fakeit/config.yml +++ b/recipes/fakeit/config.yml @@ -1,4 +1,8 @@ versions: + "2.3.2": + folder: all + "2.3.1": + folder: all "2.3.0": folder: all "2.2.0": diff --git a/recipes/farmhash/all/conanfile.py b/recipes/farmhash/all/conanfile.py index 181eb1efed8e6..f0ae10679b01c 100644 --- a/recipes/farmhash/all/conanfile.py +++ b/recipes/farmhash/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class FarmhashConan(ConanFile): @@ -14,6 +14,7 @@ class FarmhashConan(ConanFile): homepage = "https://github.com/google/farmhash" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,14 +35,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/farmhash/all/test_package/conanfile.py b/recipes/farmhash/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/farmhash/all/test_package/conanfile.py +++ b/recipes/farmhash/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/farmhash/all/test_v1_package/CMakeLists.txt b/recipes/farmhash/all/test_v1_package/CMakeLists.txt index a9619dd221925..0d20897301b68 100644 --- a/recipes/farmhash/all/test_v1_package/CMakeLists.txt +++ b/recipes/farmhash/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(farmhash REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE farmhash::farmhash) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/fast-cdr/all/CMakeLists.txt b/recipes/fast-cdr/all/CMakeLists.txt deleted file mode 100644 index d17aaff199b4a..0000000000000 --- a/recipes/fast-cdr/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/fast-cdr/all/conanfile.py b/recipes/fast-cdr/all/conanfile.py index 9d48556480b99..c39c56b44ddc4 100644 --- a/recipes/fast-cdr/all/conanfile.py +++ b/recipes/fast-cdr/all/conanfile.py @@ -1,10 +1,13 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import collect_libs, copy, get, rm, rmdir, save +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class FastCDRConan(ConanFile): @@ -15,6 +18,7 @@ class FastCDRConan(ConanFile): description = "eProsima FastCDR library for serialization" topics = ("dds", "middleware", "serialization") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,30 +29,21 @@ class FastCDRConan(ConanFile): "fPIC": True, } - generators = "cmake" - exports_sources = ["CMakeLists.txt"] - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - if self._is_msvc and self.options.shared and "MT" in msvc_runtime_flag(self): + check_min_cppstd(self, 11) + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): # This combination leads to an fast-cdr error when linking # linking dynamic '*.dll' and static MT runtime # see https://github.com/eProsima/Fast-CDR/blob/v1.0.21/include/fastcdr/eProsima_auto_link.h#L37 @@ -56,35 +51,26 @@ def validate(self): raise ConanInvalidConfiguration("Mixing a dll eprosima library with a static runtime is a bad idea") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_STATIC"] = not self.options.shared - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask( - directory=os.path.join(self.package_folder, "lib"), - pattern="*.pdb" - ) - tools.remove_files_by_mask( - directory=os.path.join(self.package_folder, "bin"), - pattern="*.pdb" - ) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self._create_cmake_module_alias_targets( @@ -92,26 +78,25 @@ def package(self): {"fastcdr": "fastcdr::fastcdr"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "fastcdr") self.cpp_info.set_property("cmake_target_name", "fastcdr") - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("FASTCDR_DYN_LINK") diff --git a/recipes/fast-cdr/all/test_package/CMakeLists.txt b/recipes/fast-cdr/all/test_package/CMakeLists.txt index 1a53780608ec4..2a71d2d409cc4 100644 --- a/recipes/fast-cdr/all/test_package/CMakeLists.txt +++ b/recipes/fast-cdr/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(fastcdr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} fastcdr) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE fastcdr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/fast-cdr/all/test_package/conanfile.py b/recipes/fast-cdr/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/fast-cdr/all/test_package/conanfile.py +++ b/recipes/fast-cdr/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fast-cdr/all/test_v1_package/CMakeLists.txt b/recipes/fast-cdr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/fast-cdr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/fast-cdr/all/test_v1_package/conanfile.py b/recipes/fast-cdr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/fast-cdr/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/fast_double_parser/all/conandata.yml b/recipes/fast_double_parser/all/conandata.yml index c25ac034457d1..e6359076757f6 100644 --- a/recipes/fast_double_parser/all/conandata.yml +++ b/recipes/fast_double_parser/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.7.0": + url: "https://github.com/lemire/fast_double_parser/archive/v0.7.0.tar.gz" + sha256: "eb80a1d9c406bbe8cb22fffd3c007651f716abd03225009302d8aba8e9c4df77" "0.6.0": url: "https://github.com/lemire/fast_double_parser/archive/refs/tags/v0.6.0.tar.gz" sha256: "90835c770a2577a38442601e92330207ad8b917f956614938303b8439d13b282" diff --git a/recipes/fast_double_parser/all/conanfile.py b/recipes/fast_double_parser/all/conanfile.py index cbd0fdda17f5a..a704c8e783d7f 100644 --- a/recipes/fast_double_parser/all/conanfile.py +++ b/recipes/fast_double_parser/all/conanfile.py @@ -1,7 +1,10 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -from conans import ConanFile, tools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class FastDoubleParserConan(ConanFile): @@ -15,22 +18,21 @@ class FastDoubleParserConan(ConanFile): settings = "os", "compiler", "build_type", "arch" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self) def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def package(self): - include_folder = os.path.join(self._source_subfolder, "include") - self.copy("*.h", dst="include", src=include_folder) - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) + include_folder = os.path.join(self.source_folder, "include") + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=include_folder) + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) diff --git a/recipes/fast_double_parser/all/test_package/CMakeLists.txt b/recipes/fast_double_parser/all/test_package/CMakeLists.txt index af9981ea9a394..00ff6376bfebe 100644 --- a/recipes/fast_double_parser/all/test_package/CMakeLists.txt +++ b/recipes/fast_double_parser/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(fast_double_parser REQUIRED CONFIG) diff --git a/recipes/fast_double_parser/all/test_package/conanfile.py b/recipes/fast_double_parser/all/test_package/conanfile.py index 90eb89e3f2f46..e845ae751a301 100644 --- a/recipes/fast_double_parser/all/test_package/conanfile.py +++ b/recipes/fast_double_parser/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fast_double_parser/all/test_v1_package/CMakeLists.txt b/recipes/fast_double_parser/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/fast_double_parser/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/fast_double_parser/all/test_v1_package/conanfile.py b/recipes/fast_double_parser/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..90eb89e3f2f46 --- /dev/null +++ b/recipes/fast_double_parser/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/fast_double_parser/config.yml b/recipes/fast_double_parser/config.yml index 33d7618432d30..d61439bae1bc3 100644 --- a/recipes/fast_double_parser/config.yml +++ b/recipes/fast_double_parser/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.0": + folder: all "0.6.0": folder: all "0.5.0": diff --git a/recipes/fast_float/all/conandata.yml b/recipes/fast_float/all/conandata.yml index fe32a448f6463..8be05c2c192fd 100644 --- a/recipes/fast_float/all/conandata.yml +++ b/recipes/fast_float/all/conandata.yml @@ -1,31 +1,34 @@ sources: + "3.10.0": + url: "https://github.com/fastfloat/fast_float/archive/v3.10.0.tar.gz" + sha256: "9167ad938f29464ca2312fe32565646a61328249e16f84b2a23969c627cc93f5" + "3.9.0": + url: "https://github.com/fastfloat/fast_float/archive/v3.9.0.tar.gz" + sha256: "a10443e13748291709b422b2da49fc6753a1a43bf24205d4600595dfe3d811bb" + "3.8.1": + url: "https://github.com/fastfloat/fast_float/archive/v3.8.1.tar.gz" + sha256: "823d7f8df7fadc3ed24738eb0cf4a40f0450068edd92805698916be40966d87a" + "3.8.0": + url: "https://github.com/fastfloat/fast_float/archive/v3.8.0.tar.gz" + sha256: "8cb82dc35da3b745b3beb1a9974402307c9ded0e875aea077dbb3ea63833dd2e" + "3.7.0": + url: "https://github.com/fastfloat/fast_float/archive/v3.7.0.tar.gz" + sha256: "4a30c43d14bbc979130a7807aecb2de5ff513951dd99a8b77cc32acfc610f850" + "3.6.0": + url: "https://github.com/fastfloat/fast_float/archive/v3.6.0.tar.gz" + sha256: "0852175e5ebf2b59bcde9c3be2ccd50441f2997350884652302d034785a4fbf5" "3.5.1": url: "https://github.com/fastfloat/fast_float/archive/v3.5.1.tar.gz" sha256: "8558bf9c66ccd2f7d03c94461a107f49ad9cf6e4f6c0c84e148fec0aa32b4dd9" "3.4.0": url: "https://github.com/fastfloat/fast_float/archive/v3.4.0.tar.gz" sha256: "a242877d2fae81ca412033f5ebf5dbc43cb029c56b4af78e33106b9a69f8f58e" - "3.2.0": - url: "https://github.com/fastfloat/fast_float/archive/v3.2.0.tar.gz" - sha256: "c26d78b2b76704b117c416292bc47fa3e4bb69a131e82debe0e8fd5c7afdf18e" - "3.1.0": - url: "https://github.com/fastfloat/fast_float/archive/v3.1.0.tar.gz" - sha256: "755ee0bdde8ee0cc10ae16e1f283c2833d9cfa7ea114950ab807dc7ee108f722" "2.0.0": url: "https://github.com/fastfloat/fast_float/archive/v2.0.0.tar.gz" sha256: "5d528ec20811577c5f2b2873528c085c500fdcd2b2c0901450509a71de5f1fa4" "1.1.2": url: "https://github.com/fastfloat/fast_float/archive/v1.1.2.tar.gz" sha256: "580655a9ad2aeac7507de4433dcf985d8699ae8128b97c2cabc0962aa5beb513" - "1.1.1": - url: "https://github.com/fastfloat/fast_float/archive/refs/tags/v1.1.1.tar.gz" - sha256: "d17eb86f597e9f4972a1d5f81c42c7dee041aaae2e826b80685ed90dad5b3593" - "1.0.0": - url: "https://github.com/fastfloat/fast_float/archive/v1.0.0.tar.gz" - sha256: "694e87e6f5e08d4a5f22efcc8fb1977e30f3d63bfc7995a6a7a7288c3d581d75" "0.9.0": url: "https://github.com/fastfloat/fast_float/archive/v0.9.0.tar.gz" sha256: "1e40982107e03559a98323a0b97fc2110d73b0743818fe2cdc09abe77c4c5af8" - "0.8.0": - url: "https://github.com/fastfloat/fast_float/archive/v0.8.0.tar.gz" - sha256: "0c10d6b476504f601a380846f51939d3e1ae483888e025ad12d6d36a4b441346" diff --git a/recipes/fast_float/all/conanfile.py b/recipes/fast_float/all/conanfile.py index 3750e947efcf2..6b67f83a814ef 100644 --- a/recipes/fast_float/all/conanfile.py +++ b/recipes/fast_float/all/conanfile.py @@ -6,15 +6,14 @@ required_conan_version = ">=1.50.0" - class FastFloatConan(ConanFile): name = "fast_float" description = "Fast and exact implementation of the C++ from_chars " \ "functions for float and double types." license = ("Apache-2.0", "MIT") - topics = ("fast_float", "conversion", "from_chars") - homepage = "https://github.com/fastfloat/fast_float" + topics = ("fast_float", "conversion", "from_chars", "header-only") url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/fastfloat/fast_float" settings = "os", "arch", "compiler", "build_type" no_copy_source = True @@ -29,8 +28,7 @@ def layout(self): basic_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -43,9 +41,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "FastFloat") self.cpp_info.set_property("cmake_target_name", "FastFloat::fast_float") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.names["cmake_find_package"] = "FastFloat" diff --git a/recipes/fast_float/all/test_v1_package/CMakeLists.txt b/recipes/fast_float/all/test_v1_package/CMakeLists.txt index e5e8bb319fc1f..be00a8c7f57c7 100644 --- a/recipes/fast_float/all/test_v1_package/CMakeLists.txt +++ b/recipes/fast_float/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(FastFloat REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE FastFloat::fast_float) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/fast_float/config.yml b/recipes/fast_float/config.yml index 737d1ff111527..5399bb76a4fda 100644 --- a/recipes/fast_float/config.yml +++ b/recipes/fast_float/config.yml @@ -1,21 +1,23 @@ versions: - "3.5.1": + "3.10.0": folder: all - "3.4.0": + "3.9.0": folder: all - "3.2.0": + "3.8.1": folder: all - "3.1.0": + "3.8.0": folder: all - "2.0.0": + "3.7.0": folder: all - "1.1.2": + "3.6.0": folder: all - "1.1.1": + "3.5.1": folder: all - "1.0.0": + "3.4.0": folder: all - "0.9.0": + "2.0.0": folder: all - "0.8.0": + "1.1.2": + folder: all + "0.9.0": folder: all diff --git a/recipes/fastpfor/all/CMakeLists.txt b/recipes/fastpfor/all/CMakeLists.txt deleted file mode 100644 index 7d5ba25565b0a..0000000000000 --- a/recipes/fastpfor/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/fastpfor/all/conandata.yml b/recipes/fastpfor/all/conandata.yml index 79aae084fc25c..e16837fea8797 100644 --- a/recipes/fastpfor/all/conandata.yml +++ b/recipes/fastpfor/all/conandata.yml @@ -1,9 +1,17 @@ sources: + "cci.20221225": + url: "https://github.com/lemire/FastPFor/archive/3e7358f8656b4456f4ea1762075553f2984fefcf.tar.gz" + sha256: "cc50b03421db3aa21be2243f5996ea6d027a6563e0863b77cfc46dd08bcfcaf5" "cci.20220205": url: "https://github.com/lemire/FastPFor/archive/773283d4a11fa2440a1b3b28fd77f775e86d7898.tar.gz" sha256: "d4419512420f3bcc65862c5c367021f201b5ba3e8cb0dad895cdf444e0867b30" patches: + "cci.20221225": + - patch_file: "patches/cci.20221225-0001-fix-cmake.patch" + patch_description: "enable shared build, disable unittest/utility" + patch_type: "conan" "cci.20220205": - patch_file: "patches/cci.20220205-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "enable shared build, disable unittest/utility" + patch_type: "conan" diff --git a/recipes/fastpfor/all/conanfile.py b/recipes/fastpfor/all/conanfile.py index 03c242e83bf88..3ea949a5a46d9 100644 --- a/recipes/fastpfor/all/conanfile.py +++ b/recipes/fastpfor/all/conanfile.py @@ -1,17 +1,18 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -import functools - -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class FastPFORConan(ConanFile): name = "fastpfor" description = "Fast integer compression" - topics = ("compression", "sorted-lists", "simd", "x86", "x86-64") + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lemire/FastPFor" - license = "Apache-2.0" + topics = ("compression", "sorted-lists", "simd", "x86", "x86-64") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,16 +22,9 @@ class FastPFORConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,38 +32,39 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): if self.settings.arch != "x86_64": - raise ConanInvalidConfiguration("{} architecture is not supported".format(self.settings.arch)) + raise ConanInvalidConfiguration(f"{self.settings.arch} architecture is not supported") if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, "11") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libs = ["FastPFOR"] @@ -77,6 +72,10 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "FastPFOR") self.cpp_info.set_property("cmake_target_name", "FastPFOR::FastPFOR") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "FastPFOR" self.cpp_info.filenames["cmake_find_package_multi"] = "FastPFOR" self.cpp_info.names["cmake_find_package"] = "FastPFOR" diff --git a/recipes/fastpfor/all/patches/cci.20221225-0001-fix-cmake.patch b/recipes/fastpfor/all/patches/cci.20221225-0001-fix-cmake.patch new file mode 100644 index 0000000000000..9ac6f1894f7c7 --- /dev/null +++ b/recipes/fastpfor/all/patches/cci.20221225-0001-fix-cmake.patch @@ -0,0 +1,71 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 118fc00..d57a46e 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -94,6 +94,10 @@ elseif(WIN32) + if(NOT MSVC12) + message(STATUS "On Windows, only MSVC version 12 is supported!") + endif() ++ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /arch:AVX") ++ set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /arch:AVX") ++ set (CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /arch:AVX") ++ set (CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /arch:AVX") + else () + message(FATAL_ERROR "Please, use GCC, Clang, or the Intel compiler!") + endif() +@@ -108,7 +112,7 @@ MESSAGE( STATUS "CMAKE_C_FLAGS_RELEASE: " ${CMAKE_C_FLAGS_RELEASE} ) + + # library target + include_directories(headers) +-add_library(FastPFOR STATIC ++add_library(FastPFOR + src/bitpacking.cpp + src/bitpackingaligned.cpp + src/bitpackingunaligned.cpp +@@ -118,9 +122,9 @@ add_library(FastPFOR STATIC + src/simdbitpacking.cpp + src/varintdecode.c + src/streamvbyte.c) +-set_target_properties(FastPFOR PROPERTIES POSITION_INDEPENDENT_CODE TRUE) + + ++if(0) + # other executables + add_executable(gapstats src/gapstats.cpp) + add_executable(partitionbylength src/partitionbylength.cpp) +@@ -133,6 +137,7 @@ if( SUPPORT_SSE42 ) + add_executable(benchbitpacking src/benchbitpacking.cpp) + target_link_libraries(benchbitpacking FastPFOR) + endif() ++endif() + + find_package(snappy) + if(NOT ${snappy_FOUND}) +@@ -142,6 +147,7 @@ else() + message(STATUS "Snappy was found. Building additional targets " + "codecssnappy and inmemorybenchmarksnappy.") + include_directories(${snappy_INCLUDE_DIRS}) ++ if(0) + add_executable(codecssnappy src/codecs.cpp) + set_target_properties(codecssnappy PROPERTIES DEFINE_SYMBOL USESNAPPY) + target_link_libraries(codecssnappy FastPFOR ${snappy_LIBRARIES}) +@@ -149,8 +155,10 @@ else() + add_executable(inmemorybenchmarksnappy src/inmemorybenchmark.cpp) + set_target_properties(inmemorybenchmarksnappy PROPERTIES DEFINE_SYMBOL USESNAPPY) + target_link_libraries(inmemorybenchmarksnappy FastPFOR ${snappy_LIBRARIES}) ++ endif() + endif() + ++if(0) + # Download and unpack googletest at configure time + configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt) + execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . +@@ -208,7 +216,7 @@ target_link_libraries(FastPFOR_unittest gtest FastPFOR) + enable_testing() + add_test("unit" unit) + add_test("FastPFOR_unittest" FastPFOR_unittest) +- ++endif() + + include(GNUInstallDirs) + install(TARGETS FastPFOR diff --git a/recipes/fastpfor/all/test_package/CMakeLists.txt b/recipes/fastpfor/all/test_package/CMakeLists.txt index 0a186fecd6200..f466c43ce9867 100644 --- a/recipes/fastpfor/all/test_package/CMakeLists.txt +++ b/recipes/fastpfor/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(FastPFOR REQUIRED CONFIG) diff --git a/recipes/fastpfor/all/test_package/conanfile.py b/recipes/fastpfor/all/test_package/conanfile.py index 38f4483872d47..a9fbb7f543162 100644 --- a/recipes/fastpfor/all/test_package/conanfile.py +++ b/recipes/fastpfor/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fastpfor/all/test_package/test_package.cpp b/recipes/fastpfor/all/test_package/test_package.cpp index acd0edc6fe5da..ebb317a740251 100644 --- a/recipes/fastpfor/all/test_package/test_package.cpp +++ b/recipes/fastpfor/all/test_package/test_package.cpp @@ -3,8 +3,9 @@ int main() { using namespace FastPForLib; + CODECFactory factory; - IntegerCODEC &codec = *CODECFactory::getFromName("simdfastpfor256"); + IntegerCODEC &codec = *factory.getFromName("simdfastpfor256"); size_t N = 10 * 1000; std::vector mydata(N); diff --git a/recipes/fastpfor/all/test_v1_package/CMakeLists.txt b/recipes/fastpfor/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/fastpfor/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/fastpfor/all/test_v1_package/conanfile.py b/recipes/fastpfor/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/fastpfor/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/fastpfor/config.yml b/recipes/fastpfor/config.yml index 19127b42445cc..216ef81b387a5 100644 --- a/recipes/fastpfor/config.yml +++ b/recipes/fastpfor/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20221225": + folder: all "cci.20220205": folder: all diff --git a/recipes/fastprng/all/conanfile.py b/recipes/fastprng/all/conanfile.py index 24c2d30f05cf2..c83ba01f89440 100644 --- a/recipes/fastprng/all/conanfile.py +++ b/recipes/fastprng/all/conanfile.py @@ -1,6 +1,11 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout +from conan.tools.files import get, copy +import os + +required_conan_version = ">=1.50.0" -required_conan_version = ">=1.33.0" class FastPRNGConan(ConanFile): name = "fastprng" @@ -10,23 +15,26 @@ class FastPRNGConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/BrutPitt/fastPRNG" settings = "os", "arch", "compiler", "build_type" - generators = "cmake", no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self) def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, "11") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get( + self, + **self.conan_data["sources"][self.version], + destination=self.source_folder, + strip_root=True + ) def package(self): - self.copy("license.txt", "licenses", self._source_subfolder) - self.copy("*.h", "include", self._source_subfolder) + copy(self, "*.h", self.source_folder, os.path.join(self.package_folder, "include")) + copy(self, "license.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) diff --git a/recipes/fastprng/all/test_package/CMakeLists.txt b/recipes/fastprng/all/test_package/CMakeLists.txt index 0cffef73c6d3e..a0f34e4c094ac 100644 --- a/recipes/fastprng/all/test_package/CMakeLists.txt +++ b/recipes/fastprng/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(fastprng CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} fastprng::fastprng) +target_link_libraries(${PROJECT_NAME} PRIVATE fastprng::fastprng) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/fastprng/all/test_package/conanfile.py b/recipes/fastprng/all/test_package/conanfile.py index aaf25befb2087..48499fa0989d9 100644 --- a/recipes/fastprng/all/test_package/conanfile.py +++ b/recipes/fastprng/all/test_package/conanfile.py @@ -1,9 +1,20 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools -class TestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fastprng/all/test_v1_package/CMakeLists.txt b/recipes/fastprng/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7ea0378c83fe1 --- /dev/null +++ b/recipes/fastprng/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/fastprng/all/test_v1_package/conanfile.py b/recipes/fastprng/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..aaf25befb2087 --- /dev/null +++ b/recipes/fastprng/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +import os +from conans import ConanFile, CMake, tools + +class TestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/fcl/all/conanfile.py b/recipes/fcl/all/conanfile.py index 2c8e8687c5122..7e41afda3be3f 100644 --- a/recipes/fcl/all/conanfile.py +++ b/recipes/fcl/all/conanfile.py @@ -2,12 +2,12 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.53.0" class FclConan(ConanFile): @@ -15,10 +15,11 @@ class FclConan(ConanFile): description = "C++11 library for performing three types of proximity " \ "queries on a pair of geometric models composed of triangles." license = "BSD-3-Clause" - topics = ("fcl", "geometry", "collision") + topics = ("geometry", "collision") homepage = "https://github.com/flexible-collision-library/fcl" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,8 +33,7 @@ class FclConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -41,7 +41,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("eigen/3.4.0") @@ -50,19 +53,13 @@ def requirements(self): self.requires("octomap/1.9.7") def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - if self.info.settings.os == "Windows" and self.info.options.shared: - raise ConanInvalidConfiguration( - "fcl {} doesn't properly support shared lib on Windows".format(self.version) - ) - - def layout(self): - cmake_layout(self, src_folder="src") + if self.settings.os == "Windows" and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} doesn't properly support shared lib on Windows") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -114,17 +111,17 @@ def package(self): def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) + """) save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "fcl") @@ -132,11 +129,6 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "fcl") self.cpp_info.libs = ["fcl"] - # TODO: to remove if required_conan_version updated to 1.51.1 (see https://github.com/conan-io/conan/pull/11790) - self.cpp_info.requires = ["eigen::eigen", "libccd::libccd"] - if self.options.with_octomap: - self.cpp_info.requires.append("octomap::octomap") - # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/fcl/all/test_package/conanfile.py b/recipes/fcl/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/fcl/all/test_package/conanfile.py +++ b/recipes/fcl/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/fcl/all/test_v1_package/CMakeLists.txt b/recipes/fcl/all/test_v1_package/CMakeLists.txt index 94f82041a6218..0d20897301b68 100644 --- a/recipes/fcl/all/test_v1_package/CMakeLists.txt +++ b/recipes/fcl/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(fcl REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE fcl) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/fcl/all/test_v1_package/conanfile.py b/recipes/fcl/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/fcl/all/test_v1_package/conanfile.py +++ b/recipes/fcl/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/ffmpeg/all/conandata.yml b/recipes/ffmpeg/all/conandata.yml index 6aef92a63b2d6..8386cd3bd7bca 100644 --- a/recipes/ffmpeg/all/conandata.yml +++ b/recipes/ffmpeg/all/conandata.yml @@ -1,7 +1,13 @@ sources: + "5.1": + url: "https://ffmpeg.org/releases/ffmpeg-5.1.tar.bz2" + sha256: "32b56fb01ce90d452958ae25e91c9564abf49ed5453c127bec23c63e530aa8fa" "5.0": url: "https://ffmpeg.org/releases/ffmpeg-5.0.tar.bz2" sha256: "c0130b8db2c763430fd1c6905288d61bc44ee0548ad5fcd2dfd650b88432bed9" + "4.4.3": + url: "https://ffmpeg.org/releases/ffmpeg-4.4.3.tar.bz2" + sha256: "33b8c2dbcd530fe1db5710415345609b4ca227bd0da1e3a9332dbb0f11fd273a" "4.4": url: "https://ffmpeg.org/releases/ffmpeg-4.4.tar.bz2" sha256: "42093549751b582cf0f338a21a3664f52e0a9fbe0d238d3c992005e493607d0e" diff --git a/recipes/ffmpeg/all/conanfile.py b/recipes/ffmpeg/all/conanfile.py index 6dcb1c09c0f02..f0a1d0fdee146 100644 --- a/recipes/ffmpeg/all/conanfile.py +++ b/recipes/ffmpeg/all/conanfile.py @@ -1,13 +1,17 @@ -from conan.tools.files import rename -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building +from conan.tools.files import get, rename, rmdir +from conan.tools.scm import Version +from conans import AutoToolsBuildEnvironment, tools import os import contextlib import glob import shutil import re -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.51.3" class FFMpegConan(ConanFile): @@ -236,7 +240,7 @@ def config_options(self): del self.options.with_coreimage del self.options.with_audiotoolbox del self.options.with_videotoolbox - if not tools.is_apple_os(self.settings.os): + if not is_apple_os(self): del self.options.with_avfoundation if not self._version_supports_vulkan(): del self.options.with_vulkan @@ -249,7 +253,7 @@ def configure(self): def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_bzip2: self.requires("bzip2/1.0.8") if self.options.with_lzma: @@ -269,9 +273,9 @@ def requirements(self): if self.options.with_zeromq: self.requires("zeromq/4.3.4") if self.options.with_sdl: - self.requires("sdl/2.0.20") + self.requires("sdl/2.26.0") if self.options.with_libx264: - self.requires("libx264/20191217") + self.requires("libx264/cci.20220602") if self.options.with_libx265: self.requires("libx265/3.4") if self.options.with_libvpx: @@ -281,9 +285,9 @@ def requirements(self): if self.options.with_libfdk_aac: self.requires("libfdk_aac/2.0.2") if self.options.with_libwebp: - self.requires("libwebp/1.2.3") + self.requires("libwebp/1.2.4") if self.options.with_ssl == "openssl": - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.get_safe("with_libalsa"): self.requires("libalsa/1.2.7.2") if self.options.get_safe("with_xcb") or self.options.get_safe("with_vaapi"): @@ -295,10 +299,10 @@ def requirements(self): if self.options.get_safe("with_vdpau"): self.requires("vdpau/system") if self._version_supports_vulkan() and self.options.get_safe("with_vulkan"): - self.requires("vulkan-loader/1.3.221") + self.requires("vulkan-loader/1.3.236.0") def validate(self): - if self.options.with_ssl == "securetransport" and not tools.is_apple_os(self.settings.os): + if self.options.with_ssl == "securetransport" and not is_apple_os(self): raise ConanInvalidConfiguration( "securetransport is only available on Apple") @@ -315,22 +319,22 @@ def validate(self): def build_requirements(self): if self.settings.arch in ("x86", "x86_64"): self.build_requires("yasm/1.3.0") - self.build_requires("pkgconf/1.7.4") + self.build_requires("pkgconf/1.9.3") if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): self.build_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) @property def _target_arch(self): - target_arch, _, _ = tools.get_gnu_triplet( - "Macos" if tools.is_apple_os( - self.settings.os) else str(self.settings.os), + triplet = tools.get_gnu_triplet( + "Macos" if is_apple_os(self) else str(self.settings.os), str(self.settings.arch), str(self.settings.compiler) if self.settings.os == "Windows" else None, - ).split("-") + ) + target_arch = triplet.split("-")[0] return target_arch @property @@ -338,18 +342,20 @@ def _target_os(self): if self._is_msvc: return "win32" else: - _, _, target_os = tools.get_gnu_triplet( - "Macos" if tools.is_apple_os( - self.settings.os) else str(self.settings.os), + triplet = tools.get_gnu_triplet( + "Macos" if is_apple_os(self) else str(self.settings.os), str(self.settings.arch), str(self.settings.compiler) if self.settings.os == "Windows" else None, - ).split("-") - if target_os == "gnueabihf": + ) + target_os = triplet.split("-")[2] + if target_os in ["gnueabihf", "gnueabi"]: target_os = "gnu" # could also be "linux" + if target_os.startswith("android"): + target_os = "android" return target_os def _patch_sources(self): - if self._is_msvc and self.options.with_libx264 and not self.options["libx264"].shared: + if self._is_msvc and self.options.with_libx264 and not self.options["libx264"].shared and Version(self.version) <= "5.0": # suppress MSVC linker warnings: https://trac.ffmpeg.org/ticket/7396 # warning LNK4049: locally defined symbol x264_levels imported # warning LNK4049: locally defined symbol x264_bit_depth imported @@ -389,7 +395,7 @@ def opt_append_disable_if_set(args, what, v): args = [ "--pkg-config-flags=--static", "--disable-doc", - opt_enable_disable("cross-compile", tools.cross_building(self)), + opt_enable_disable("cross-compile", cross_building(self)), opt_enable_disable("asm", self.options.with_asm), # Libraries opt_enable_disable("shared", self.options.shared), @@ -517,7 +523,7 @@ def opt_append_disable_if_set(args, what, v): if self._version_supports_vulkan(): args.append(opt_enable_disable( "vulkan", self.options.get_safe("with_vulkan"))) - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): # relocatable shared libs args.append("--install-name-dir=@rpath") args.append("--arch={}".format(self._target_arch)) @@ -530,16 +536,24 @@ def opt_append_disable_if_set(args, what, v): ]) if not self.options.with_programs: args.append("--disable-programs") - # since ffmpeg"s build system ignores CC and CXX + # since ffmpeg"s build system ignores toolchain variables + if tools.get_env("AR"): + args.append("--ar={}".format(tools.get_env("AR"))) if tools.get_env("AS"): args.append("--as={}".format(tools.get_env("AS"))) if tools.get_env("CC"): args.append("--cc={}".format(tools.get_env("CC"))) if tools.get_env("CXX"): args.append("--cxx={}".format(tools.get_env("CXX"))) + if tools.get_env("NM"): + args.append("--nm={}".format(tools.get_env("NM"))) + if tools.get_env("RANLIB"): + args.append("--ranlib={}".format(tools.get_env("RANLIB"))) + if tools.get_env("STRIP"): + args.append("--strip={}".format(tools.get_env("STRIP"))) extra_cflags = [] extra_ldflags = [] - if tools.is_apple_os(self.settings.os) and self.settings.os.version: + if is_apple_os(self) and self.settings.os.version: extra_cflags.append(tools.apple_deployment_target_flag( self.settings.os, self.settings.os.version)) extra_ldflags.append(tools.apple_deployment_target_flag( @@ -550,13 +564,16 @@ def opt_append_disable_if_set(args, what, v): if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) <= "12": # Visual Studio 2013 (and earlier) doesn't support "inline" keyword for C (only for C++) self._autotools.defines.append("inline=__inline") - if tools.cross_building(self): + if cross_building(self): if self._target_os == "emscripten": args.append("--target-os=none") else: args.append("--target-os={}".format(self._target_os)) - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): + if self.options.with_audiotoolbox: + args.append("--disable-outdev=audiotoolbox") + xcrun = tools.XCRun(self.settings) apple_arch = tools.to_apple_arch(str(self.settings.arch)) extra_cflags.extend( @@ -600,8 +617,8 @@ def package(self): autotools = self._configure_autotools() autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) if self._is_msvc: if self.options.shared: @@ -766,15 +783,14 @@ def package_info(self): self.cpp_info.components["avdevice"].system_libs = ["m"] elif self.settings.os == "Windows": if self.options.avcodec: - self.cpp_info.components["avcodec"].system_libs = [ - "Mfplat", "Mfuuid", "strmiids"] + self.cpp_info.components["avcodec"].system_libs = ["mfplat", "mfuuid", "strmiids"] if self.options.avdevice: self.cpp_info.components["avdevice"].system_libs = [ "ole32", "psapi", "strmiids", "uuid", "oleaut32", "shlwapi", "gdi32", "vfw32"] self.cpp_info.components["avutil"].system_libs = [ "user32", "bcrypt"] self.cpp_info.components["avformat"].system_libs = ["secur32"] - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): if self.options.avdevice: self.cpp_info.components["avdevice"].frameworks = [ "CoreFoundation", "Foundation", "CoreGraphics"] @@ -783,7 +799,7 @@ def package_info(self): "CoreGraphics"] if self.options.avcodec: self.cpp_info.components["avcodec"].frameworks = [ - "CoreVideo", "CoreMedia"] + "CoreFoundation", "CoreVideo", "CoreMedia"] if self.settings.os == "Macos": if self.options.avdevice: self.cpp_info.components["avdevice"].frameworks.append( @@ -886,7 +902,7 @@ def package_info(self): if self.options.get_safe("with_coreimage"): self.cpp_info.components["avfilter"].frameworks.append( "CoreImage") - if tools.Version(self.version) >= "5.0" and tools.is_apple_os(self.settings.os): + if Version(self.version) >= "5.0" and is_apple_os(self): self.cpp_info.components["avfilter"].frameworks.append("Metal") if self.options.get_safe("with_vaapi"): @@ -901,4 +917,4 @@ def package_info(self): "vulkan-loader::vulkan-loader") def _version_supports_vulkan(self): - return tools.Version(self.version) >= "4.3.0" + return Version(self.version) >= "4.3.0" diff --git a/recipes/ffmpeg/config.yml b/recipes/ffmpeg/config.yml index a1b74e4cc0f84..c829a400b90aa 100644 --- a/recipes/ffmpeg/config.yml +++ b/recipes/ffmpeg/config.yml @@ -1,6 +1,10 @@ versions: + "5.1": + folder: "all" "5.0": folder: "all" + "4.4.3": + folder: "all" "4.4": folder: "all" "4.3.2": diff --git a/recipes/fft/all/conanfile.py b/recipes/fft/all/conanfile.py index 0c2d7fca71f8c..70af1f1a66f4c 100644 --- a/recipes/fft/all/conanfile.py +++ b/recipes/fft/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.files import get, save import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class FftConan(ConanFile): @@ -16,8 +16,9 @@ class FftConan(ConanFile): "This is a package to calculate Discrete Fourier/Cosine/Sine " "Transforms of 2,3-dimensional sequences of length 2^N." ) - topics = ("fft", "fft2d", "fft3d", "dct", "dst", "dft") + topics = ("fft2d", "fft3d", "dct", "dst", "dft") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -42,37 +43,30 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if not self.options.threads: del self.options.max_threads del self.options.threads_begin_n + def layout(self): + cmake_layout(self, src_folder="src") + def validate(self): def _is_power_of_two(n): return (n != 0) and (n & (n-1) == 0) - if self.info.options.threads: - if not self.info.options.max_threads.isdigit(): + if self.options.threads: + if not self.options.max_threads.isdigit(): raise ConanInvalidConfiguration("max_threads must be an integer") - if not self.info.options.threads_begin_n.isdigit(): + if not self.options.threads_begin_n.isdigit(): raise ConanInvalidConfiguration("threads_begin_n must be an integer") - if not _is_power_of_two(int(self.info.options.max_threads)): + if not _is_power_of_two(int(self.options.max_threads)): raise ConanInvalidConfiguration("max_threads must be a power of 2") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/fft/all/test_package/conanfile.py b/recipes/fft/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/fft/all/test_package/conanfile.py +++ b/recipes/fft/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/fft/all/test_v1_package/CMakeLists.txt b/recipes/fft/all/test_v1_package/CMakeLists.txt index b02d7f9d31172..0d20897301b68 100644 --- a/recipes/fft/all/test_v1_package/CMakeLists.txt +++ b/recipes/fft/all/test_v1_package/CMakeLists.txt @@ -1,13 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(fft REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE fft::fft) -if(MSVC) - target_compile_definitions(${PROJECT_NAME} PRIVATE "CRT_SECURE_NO_WARNINGS=1") -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/fftw/all/conandata.yml b/recipes/fftw/all/conandata.yml index 8588823dd80ee..bd47f81790fc2 100644 --- a/recipes/fftw/all/conandata.yml +++ b/recipes/fftw/all/conandata.yml @@ -1,10 +1,8 @@ sources: "3.3.9": url: - [ - "https://www.fftw.org/fftw-3.3.9.tar.gz", - "https://fftw.org/fftw-3.3.9.tar.gz", - ] + - "https://www.fftw.org/fftw-3.3.9.tar.gz" + - "https://fftw.org/fftw-3.3.9.tar.gz" sha256: "bf2c7ce40b04ae811af714deb512510cc2c17b9ab9d6ddcf49fe4487eea7af3d" "3.3.8": url: "http://www.fftw.org/fftw-3.3.8.tar.gz" diff --git a/recipes/fftw/all/conanfile.py b/recipes/fftw/all/conanfile.py index 6fc7fd577d259..633f3bfb2dc71 100644 --- a/recipes/fftw/all/conanfile.py +++ b/recipes/fftw/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.54.0" class FFTWConan(ConanFile): @@ -15,6 +15,7 @@ class FFTWConan(ConanFile): license = "GPL-2.0" topics = ("fftw", "dft", "dct", "dst") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,8 +37,7 @@ class FFTWConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,18 +45,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if not self.options.threads: del self.options.combinedthreads + def layout(self): + cmake_layout(self, src_folder="src") + def validate(self): if self.settings.os == "Windows" and self.options.shared: if self.options.openmp: @@ -64,12 +61,8 @@ def validate(self): if self.options.threads and not self.options.combinedthreads: raise ConanInvalidConfiguration("Shared fftw with threads and not combinedthreads can't be built on Windows") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -83,8 +76,6 @@ def generate(self): tc.variables["ENABLE_SSE2"] = self.options.simd == "sse2" tc.variables["ENABLE_AVX"] = self.options.simd == "avx" tc.variables["ENABLE_AVX2"] = self.options.simd == "avx2" - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): @@ -109,7 +100,7 @@ def package_info(self): lib_name = "fftw3" + prec_suffix self.cpp_info.set_property("cmake_file_name", cmake_config_name) - self.cpp_info.set_property("cmake_target_name", "{}::{}".format(cmake_namespace, cmake_target_name)) + self.cpp_info.set_property("cmake_target_name", f"{cmake_namespace}::{cmake_target_name}") self.cpp_info.set_property("pkg_config_name", pkgconfig_name) # TODO: back to global scope in conan v2 once cmake_find_package_* & pkg_config generators removed @@ -130,7 +121,7 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = cmake_namespace self.cpp_info.components["fftwlib"].names["cmake_find_package"] = cmake_target_name self.cpp_info.components["fftwlib"].names["cmake_find_package_multi"] = cmake_target_name - self.cpp_info.components["fftwlib"].set_property("cmake_target_name", "{}::{}".format(cmake_namespace, cmake_target_name)) + self.cpp_info.components["fftwlib"].set_property("cmake_target_name", f"{cmake_namespace}::{cmake_target_name}") self.cpp_info.components["fftwlib"].set_property("pkg_config_name", pkgconfig_name) @property diff --git a/recipes/fftw/all/test_package/conanfile.py b/recipes/fftw/all/test_package/conanfile.py index 54a72f37e7a08..ae78315e3f3d3 100644 --- a/recipes/fftw/all/test_package/conanfile.py +++ b/recipes/fftw/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def generate(self): tc = CMakeToolchain(self) tc.variables["ENABLE_DOUBLE_PRECISION"] = self.dependencies["fftw"].options.precision == "double" @@ -27,6 +28,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/fftw/all/test_v1_package/CMakeLists.txt b/recipes/fftw/all/test_v1_package/CMakeLists.txt index 30bfee7a37424..0d20897301b68 100644 --- a/recipes/fftw/all/test_v1_package/CMakeLists.txt +++ b/recipes/fftw/all/test_v1_package/CMakeLists.txt @@ -1,27 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) - -option(ENABLE_DOUBLE_PRECISION "Enable FFTW single precision" ON) -option(ENABLE_SINGLE_PRECISION "Enable FFTW single precision" OFF) -option(ENABLE_LONG_DOUBLE_PRECISION "Enable FFTW single precision" OFF) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -if(ENABLE_SINGLE_PRECISION) - find_package(FFTW3f REQUIRED CONFIG) -elseif(ENABLE_LONG_DOUBLE_PRECISION) - find_package(FFTW3l REQUIRED CONFIG) -else() - find_package(FFTW3 REQUIRED CONFIG) -endif() - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} - $<$:FFTW3::fftw3> - $<$:FFTW3::fftw3f> - $<$:FFTW3::fftw3l>) - -target_compile_options(${PROJECT_NAME} PRIVATE - $<$:-DENABLE_SINGLE_PRECISION=1> - $<$:-DENABLE_LONG_DOUBLE_PRECISION=1>) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/fftw/all/test_v1_package/conanfile.py b/recipes/fftw/all/test_v1_package/conanfile.py index 51b0480e60c8e..0608a56e96b9b 100644 --- a/recipes/fftw/all/test_v1_package/conanfile.py +++ b/recipes/fftw/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/flac/all/conandata.yml b/recipes/flac/all/conandata.yml index b7edb40c63666..b0d1e5271b850 100644 --- a/recipes/flac/all/conandata.yml +++ b/recipes/flac/all/conandata.yml @@ -1,7 +1,16 @@ sources: + "1.4.2": + url: "https://github.com/xiph/flac/releases/download/1.4.2/flac-1.4.2.tar.xz" + sha256: "e322d58a1f48d23d9dd38f432672865f6f79e73a6f9cc5a5f57fcaa83eb5a8e4" "1.3.3": url: "https://github.com/xiph/flac/archive/1.3.3.tar.gz" sha256: "668cdeab898a7dd43cf84739f7e1f3ed6b35ece2ef9968a5c7079fe9adfe1689" patches: + "1.4.2": + - patch_file: "patches/fix-cmake-1.4.2.patch" + patch_description: "Adapts find_package commands and install destination paths in CMakeLists.txt files." + patch_type: "conan" "1.3.3": - - patch_file: "patches/fix-cmake.patch" + - patch_file: "patches/fix-cmake-1.3.3.patch" + patch_description: "Various adaptations in CMakeLists.txt files to improve compatibility with Conan." + patch_type: "conan" diff --git a/recipes/flac/all/conanfile.py b/recipes/flac/all/conanfile.py index 43cf472dcf5c0..e8e39c9a71f0a 100644 --- a/recipes/flac/all/conanfile.py +++ b/recipes/flac/all/conanfile.py @@ -1,10 +1,11 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.54.0" class FlacConan(ConanFile): @@ -26,8 +27,7 @@ class FlacConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,13 +35,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): self.requires("ogg/1.3.5") def build_requirements(self): - if self.settings.arch in ["x86", "x86_64"]: + if Version(self.version) < "1.4.2" and self.settings.arch in ["x86", "x86_64"]: self.tool_requires("nasm/2.15.05") def layout(self): @@ -79,6 +79,8 @@ def package(self): copy(self, "*.h", src=os.path.join(self.source_folder, "include", "share", "grabbag"), dst=os.path.join(self.package_folder, "include", "share", "grabbag"), keep_path=False) rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "flac") @@ -101,7 +103,7 @@ def package_info(self): self.output.info("Appending PATH environment variable: {}".format(bin_path)) self.env_info.PATH.append(bin_path) - # TODO: to remove in conan v2 once cmake_find_package_* generators removed + # TODO: to remove in conan v2 self.cpp_info.filenames["cmake_find_package"] = "flac" self.cpp_info.filenames["cmake_find_package_multi"] = "flac" self.cpp_info.names["cmake_find_package"] = "FLAC" diff --git a/recipes/flac/all/patches/fix-cmake.patch b/recipes/flac/all/patches/fix-cmake-1.3.3.patch similarity index 100% rename from recipes/flac/all/patches/fix-cmake.patch rename to recipes/flac/all/patches/fix-cmake-1.3.3.patch diff --git a/recipes/flac/all/patches/fix-cmake-1.4.2.patch b/recipes/flac/all/patches/fix-cmake-1.4.2.patch new file mode 100644 index 0000000000000..bd5a0ebdb6997 --- /dev/null +++ b/recipes/flac/all/patches/fix-cmake-1.4.2.patch @@ -0,0 +1,38 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -43,7 +43,7 @@ if(WITH_OGG) + endif() + else() + if(NOT TARGET Ogg::ogg) +- find_package(Ogg REQUIRED) ++ find_package(Ogg REQUIRED CONFIG) + else() + set(OGG_FOUND 1 CACHE INTERNAL "ogg has already been built") + endif() +--- a/src/flac/CMakeLists.txt ++++ b/src/flac/CMakeLists.txt +@@ -21,4 +21,4 @@ target_link_libraries(flacapp + utf8) + + install(TARGETS flacapp EXPORT targets +- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ++ DESTINATION "${CMAKE_INSTALL_BINDIR}") +--- a/src/metaflac/CMakeLists.txt ++++ b/src/metaflac/CMakeLists.txt +@@ -14,4 +14,4 @@ add_executable(metaflac + target_link_libraries(metaflac FLAC getopt utf8) + + install(TARGETS metaflac EXPORT targets +- RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") ++ DESTINATION "${CMAKE_INSTALL_BINDIR}") +--- a/src/share/getopt/CMakeLists.txt ++++ b/src/share/getopt/CMakeLists.txt +@@ -1,8 +1,7 @@ + check_include_file("string.h" HAVE_STRING_H) + + if(NOT WIN32) +- find_package(Intl) + endif() + + add_library(getopt STATIC getopt.c getopt1.c) + diff --git a/recipes/flac/config.yml b/recipes/flac/config.yml index 3abfca40293f6..fac8ae5f33f51 100644 --- a/recipes/flac/config.yml +++ b/recipes/flac/config.yml @@ -1,3 +1,5 @@ versions: + "1.4.2": + folder: all "1.3.3": folder: all diff --git a/recipes/flann/all/conanfile.py b/recipes/flann/all/conanfile.py index 0668657726b10..2bbd3c0dc4f8c 100644 --- a/recipes/flann/all/conanfile.py +++ b/recipes/flann/all/conanfile.py @@ -1,22 +1,22 @@ from conan import ConanFile -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, stdcpp_library from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rm, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir, save from conan.tools.scm import Version -from conans import tools as tools_legacy import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class FlannConan(ConanFile): name = "flann" description = "Fast Library for Approximate Nearest Neighbors" - topics = ("flann", "nns", "nearest-neighbor-search", "knn", "kd-tree") + topics = ("nns", "nearest-neighbor-search", "knn", "kd-tree") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.cs.ubc.ca/research/flann/" license = "BSD-3-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,8 +28,7 @@ class FlannConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,21 +36,20 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") def validate(self): - if Version(self.version) >= "1.9.2" and self.info.settings.compiler.cppstd: + if Version(self.version) >= "1.9.2" and self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -125,15 +123,17 @@ def package_info(self): # flann_cpp flann_cpp_lib = "flann_cpp" if self.options.shared else "flann_cpp_s" - self.cpp_info.components["flann_cpp"].set_property("cmake_target_name", "flann::{}".format(flann_cpp_lib)) + self.cpp_info.components["flann_cpp"].set_property("cmake_target_name", f"flann::{flann_cpp_lib}") self.cpp_info.components["flann_cpp"].libs = [flann_cpp_lib] - if not self.options.shared and tools_legacy.stdcpp_library(self): - self.cpp_info.components["flann_cpp"].system_libs.append(tools_legacy.stdcpp_library(self)) + if not self.options.shared: + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.components["flann_cpp"].system_libs.append(libcxx) self.cpp_info.components["flann_cpp"].requires = ["lz4::lz4"] # flann flann_c_lib = "flann" if self.options.shared else "flann_s" - self.cpp_info.components["flann_c"].set_property("cmake_target_name", "flann::{}".format(flann_c_lib)) + self.cpp_info.components["flann_c"].set_property("cmake_target_name", f"flann::{flann_c_lib}") self.cpp_info.components["flann_c"].libs = [flann_c_lib] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["flann_c"].system_libs.append("m") diff --git a/recipes/flann/all/test_package/conanfile.py b/recipes/flann/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/flann/all/test_package/conanfile.py +++ b/recipes/flann/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/flann/all/test_v1_package/CMakeLists.txt b/recipes/flann/all/test_v1_package/CMakeLists.txt index e25fe67f56dda..0d20897301b68 100644 --- a/recipes/flann/all/test_v1_package/CMakeLists.txt +++ b/recipes/flann/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(flann REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -if(TARGET flann::flann_s) - target_link_libraries(${PROJECT_NAME} PRIVATE flann::flann_s) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE flann::flann) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/flann/all/test_v1_package/conanfile.py b/recipes/flann/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/flann/all/test_v1_package/conanfile.py +++ b/recipes/flann/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/flatbuffers/all/conandata.yml b/recipes/flatbuffers/all/conandata.yml index 2146bbb3a8a77..93f9eb1d779b9 100644 --- a/recipes/flatbuffers/all/conandata.yml +++ b/recipes/flatbuffers/all/conandata.yml @@ -1,22 +1,40 @@ sources: + "23.1.21": + url: "https://github.com/google/flatbuffers/archive/v23.1.21.tar.gz" + sha256: "d84cb25686514348e615163b458ae0767001b24b42325f426fd56406fd384238" + "23.1.4": + url: "https://github.com/google/flatbuffers/archive/v23.1.4.tar.gz" + sha256: "801871ff3747838c0dd9730fc44ca9cc453ff42f9c8a0a2f1b33776d2ca5e4b9" + "22.12.06": + url: "https://github.com/google/flatbuffers/archive/v22.12.06.tar.gz" + sha256: "209823306f2cbedab6ff70997e0d236fcfd1864ca9ad082cbfdb196e7386daed" + "22.11.23": + url: "https://github.com/google/flatbuffers/archive/v22.11.23.tar.gz" + sha256: "8e9bacc942db59ca89a383dd7923f3e69a377d6e579d1ba13557de1fdfddf56a" + "22.10.26": + url: "https://github.com/google/flatbuffers/archive/v22.10.26.tar.gz" + sha256: "34f1820cfd78a3d92abc880fbb1a644c7fb31a71238995f4ed6b5915a1ad4e79" + "22.9.29": + url: "https://github.com/google/flatbuffers/archive/refs/tags/v22.9.29.tar.gz" + sha256: "372df01795c670f6538055a7932fc7eb3e81b3653be4a216c081e9c3c26b1b6d" + "22.9.24": + url: "https://github.com/google/flatbuffers/archive/refs/tags/v22.9.24.tar.gz" + sha256: "40e0788873012def4d66a2fdbac15fbe012784473c01a703ccb5be33383556bf" + "2.0.8": + url: "https://github.com/google/flatbuffers/archive/refs/tags/v2.0.8.tar.gz" + sha256: "f97965a727d26386afaefff950badef2db3ab6af9afe23ed6d94bfb65f95f37e" + "2.0.6": + url: "https://github.com/google/flatbuffers/archive/refs/tags/v2.0.6.tar.gz" + sha256: "e2dc24985a85b278dd06313481a9ca051d048f9474e0f199e372fea3ea4248c9" "2.0.5": url: "https://github.com/google/flatbuffers/archive/refs/tags/v2.0.5.tar.gz" sha256: "b01e97c988c429e164c5c7df9e87c80007ca87f593c0d73733ba536ddcbc8f98" - "2.0.0": - url: "https://github.com/google/flatbuffers/archive/v2.0.0.tar.gz" - sha256: "9ddb9031798f4f8754d00fca2f1a68ecf9d0f83dfac7239af1311e4fd9a565c4" "1.12.0": url: "https://github.com/google/flatbuffers/archive/v1.12.0.tar.gz" sha256: "62f2223fb9181d1d6338451375628975775f7522185266cd5296571ac152bc45" - "1.11.0": - url: "https://github.com/google/flatbuffers/archive/v1.11.0.tar.gz" - sha256: "3f4a286642094f45b1b77228656fbd7ea123964f19502f9ecfd29933fd23a50b" patches: + "2.0.6": + - patch_file: "patches/0004-no-flatc-execution-build-time.patch" "2.0.5": - patch_file: "patches/0002-apple-no-universal-build.patch" - patch_file: "patches/0003-no-flatc-execution-build-time.patch" - "1.11.0": - - patch_file: "patches/0001-fix-copy-ctor.patch" - patch_description: "Fix build with Clang" - patch_type: "portability" - patch_source: "https://github.com/google/flatbuffers/pull/5650" diff --git a/recipes/flatbuffers/all/conanfile.py b/recipes/flatbuffers/all/conanfile.py index ad32669a4f07f..0c70d737a3d00 100644 --- a/recipes/flatbuffers/all/conanfile.py +++ b/recipes/flatbuffers/all/conanfile.py @@ -2,11 +2,11 @@ from conan.tools.apple import is_apple_os from conan.tools.build import check_min_cppstd, valid_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, replace_in_file, rmdir +from conan.tools.files import export_conandata_patches, apply_conandata_patches, collect_libs, copy, get, replace_in_file, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class FlatbuffersConan(ConanFile): @@ -14,7 +14,7 @@ class FlatbuffersConan(ConanFile): license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "http://google.github.io/flatbuffers" - topics = ("flatbuffers", "serialization", "rpc", "json-parser") + topics = ("serialization", "rpc", "json-parser") description = "Memory Efficient Serialization Library" settings = "os", "arch", "compiler", "build_type" @@ -36,16 +36,30 @@ def _has_flatc(self): def export_sources(self): copy(self, os.path.join("cmake", "FlatcTargets.cmake"), self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "2.0.7" and not self._cmake_new_enough("3.16"): + self.tool_requires("cmake/3.25.1") + def configure(self): if self.options.shared or self.options.header_only: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.header_only: del self.options.shared @@ -77,9 +91,10 @@ def generate(self): tc.variables["FLATBUFFERS_LIBCXX_WITH_CLANG"] = False # Mimic upstream CMake/Version.cmake removed in _patch_sources() version = Version(self.version) - tc.variables["VERSION_MAJOR"] = version.major - tc.variables["VERSION_MINOR"] = version.minor - tc.variables["VERSION_PATCH"] = version.patch + tc.cache_variables["VERSION_MAJOR"] = str(version.major) + tc.cache_variables["VERSION_MINOR"] = str(version.minor or "0") + tc.cache_variables["VERSION_PATCH"] = str(version.patch or "0") + tc.cache_variables["VERSION_COMMIT"] = str(version.pre or "0") # For msvc shared tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True # Relocatable shared libs on Macos @@ -131,8 +146,8 @@ def _module_path(self): def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") - self.cpp_info.set_property("cmake_module_file_name", "FlatBuffers") - self.cpp_info.set_property("cmake_file_name", "Flatbuffers") + self.cpp_info.set_property("cmake_module_file_name", "flatbuffers") + self.cpp_info.set_property("cmake_file_name", "flatbuffers") cmake_target = "flatbuffers" if not self.options.header_only and self.options.shared: cmake_target += "_shared" @@ -157,8 +172,8 @@ def package_info(self): self.env_info.PATH.append(bindir) # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.filenames["cmake_find_package"] = "FlatBuffers" - self.cpp_info.filenames["cmake_find_package_multi"] = "Flatbuffers" + self.cpp_info.filenames["cmake_find_package"] = "flatbuffers" + self.cpp_info.filenames["cmake_find_package_multi"] = "flatbuffers" self.cpp_info.names["cmake_find_package"] = "flatbuffers" self.cpp_info.names["cmake_find_package_multi"] = "flatbuffers" self.cpp_info.components["libflatbuffers"].names["cmake_find_package"] = cmake_target diff --git a/recipes/flatbuffers/all/patches/0001-fix-copy-ctor.patch b/recipes/flatbuffers/all/patches/0001-fix-copy-ctor.patch deleted file mode 100644 index 0dad562100bfb..0000000000000 --- a/recipes/flatbuffers/all/patches/0001-fix-copy-ctor.patch +++ /dev/null @@ -1,24 +0,0 @@ -diff --git a/include/flatbuffers/flatbuffers.h b/include/flatbuffers/flatbuffers.h -index a1a95f0..ef293f2 100644 ---- a/include/flatbuffers/flatbuffers.h -+++ b/include/flatbuffers/flatbuffers.h -@@ -1709,6 +1709,7 @@ class FlatBufferBuilder { - /// @cond FLATBUFFERS_INTERNAL - template struct TableKeyComparator { - TableKeyComparator(vector_downward &buf) : buf_(buf) {} -+ TableKeyComparator(const TableKeyComparator &other) : buf_(other.buf_) {} - bool operator()(const Offset &a, const Offset &b) const { - auto table_a = reinterpret_cast(buf_.data_at(a.o)); - auto table_b = reinterpret_cast(buf_.data_at(b.o)); -@@ -1717,7 +1718,10 @@ class FlatBufferBuilder { - vector_downward &buf_; - - private: -- TableKeyComparator &operator=(const TableKeyComparator &); -+ TableKeyComparator &operator=(const TableKeyComparator &other) { -+ buf_ = other.buf_; -+ return *this; -+ } - }; - /// @endcond - diff --git a/recipes/flatbuffers/all/patches/0004-no-flatc-execution-build-time.patch b/recipes/flatbuffers/all/patches/0004-no-flatc-execution-build-time.patch new file mode 100644 index 0000000000000..11da02ea5d8c9 --- /dev/null +++ b/recipes/flatbuffers/all/patches/0004-no-flatc-execution-build-time.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 21e90151..2ce3eb48 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -536,6 +536,7 @@ function(compile_flatbuffers_schema_to_embedded_binary SRC_FBS OPT) + register_generated_output(${GEN_BFBS_HEADER}) + endfunction() + ++if(0) + # Look if we have python 3.5 installed so that we can run the generate code + # python script after flatc is built. + find_package(Python3 3.5 COMPONENTS Interpreter) +@@ -559,6 +560,7 @@ if(Python3_Interpreter_FOUND) + else() + message("No Python3 interpreter found! Unable to generate files automatically.") + endif() ++endif() + + if(FLATBUFFERS_BUILD_TESTS) + file(COPY "${CMAKE_CURRENT_SOURCE_DIR}/tests" DESTINATION "${CMAKE_CURRENT_BINARY_DIR}") diff --git a/recipes/flatbuffers/all/test_package/CMakeLists.txt b/recipes/flatbuffers/all/test_package/CMakeLists.txt index e6501abcaf1ef..e4d22dcbf68fe 100644 --- a/recipes/flatbuffers/all/test_package/CMakeLists.txt +++ b/recipes/flatbuffers/all/test_package/CMakeLists.txt @@ -1,7 +1,7 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -find_package(Flatbuffers REQUIRED CONFIG) +find_package(FlatBuffers REQUIRED CONFIG) if(TARGET flatbuffers::flatbuffers_shared) set(FLATBUFFERS_TARGET flatbuffers::flatbuffers_shared) else() diff --git a/recipes/flatbuffers/all/test_v1_package/CMakeLists.txt b/recipes/flatbuffers/all/test_v1_package/CMakeLists.txt index 82b6707821d58..be00a8c7f57c7 100644 --- a/recipes/flatbuffers/all/test_v1_package/CMakeLists.txt +++ b/recipes/flatbuffers/all/test_v1_package/CMakeLists.txt @@ -1,39 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Flatbuffers REQUIRED CONFIG) -if(TARGET flatbuffers::flatbuffers_shared) - set(FLATBUFFERS_TARGET flatbuffers::flatbuffers_shared) -else() - set(FLATBUFFERS_TARGET flatbuffers::flatbuffers) -endif() - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE ${FLATBUFFERS_TARGET}) -if(FLATBUFFERS_HEADER_ONLY) - target_compile_definitions(${PROJECT_NAME} PRIVATE FLATBUFFERS_HEADER_ONLY) -endif() -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) - -if(NOT (CMAKE_CROSSCOMPILING AND FLATBUFFERS_HEADER_ONLY)) # due to missing package id of build requirement if header_only - add_executable(sample_binary ../test_package/sample_binary.cpp) - target_link_libraries(sample_binary PRIVATE ${FLATBUFFERS_TARGET}) - target_compile_features(sample_binary PRIVATE cxx_std_11) - - set(MONSTER_GENERATED_HEADER ${CMAKE_CURRENT_BINARY_DIR}/monster_generated.h) - set(MONSTER_FBS ${CMAKE_CURRENT_SOURCE_DIR}/../test_package/monster.fbs) - add_custom_command( - OUTPUT ${MONSTER_GENERATED_HEADER} - COMMAND $ - --cpp - -o ${CMAKE_CURRENT_BINARY_DIR} - ${MONSTER_FBS} - DEPENDS ${MONSTER_FBS} - ) - add_custom_target(generate_monster_header DEPENDS ${MONSTER_GENERATED_HEADER}) - add_dependencies(sample_binary generate_monster_header) - target_include_directories(sample_binary PRIVATE ${CMAKE_CURRENT_BINARY_DIR}) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/flatbuffers/config.yml b/recipes/flatbuffers/config.yml index e341a05045ae4..db16b3569f848 100644 --- a/recipes/flatbuffers/config.yml +++ b/recipes/flatbuffers/config.yml @@ -1,9 +1,23 @@ versions: - "2.0.5": + "23.1.21": folder: all - "2.0.0": + "23.1.4": folder: all - "1.12.0": + "22.12.06": + folder: all + "22.11.23": + folder: all + "22.10.26": + folder: all + "22.9.29": + folder: all + "22.9.24": folder: all - "1.11.0": + "2.0.8": + folder: all + "2.0.6": + folder: all + "2.0.5": + folder: all + "1.12.0": folder: all diff --git a/recipes/flecs/all/conandata.yml b/recipes/flecs/all/conandata.yml index 651673d78917b..d95e9e88c952a 100644 --- a/recipes/flecs/all/conandata.yml +++ b/recipes/flecs/all/conandata.yml @@ -1,4 +1,19 @@ sources: + "3.1.4": + url: "https://github.com/SanderMertens/flecs/archive/v3.1.4.tar.gz" + sha256: "cc73d529ddc47891fc16c7dd965ca9c4239d1caccae024c81364bf3d49286fe0" + "3.1.3": + url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.1.3.tar.gz" + sha256: "52da12a8bae260be21bf29d97af622241efd822737d0a15e551cd92e30abd5c9" + "3.1.2": + url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.1.2.tar.gz" + sha256: "1fe4f78b44f2ded1355179a8395bb254fbd8a9db88b9f8ecd890472d60acf723" + "3.1.1": + url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.1.1.tar.gz" + sha256: "f31edfa258b90d086c311ad5ccc60e8e1ab0448aa10856d96e9e503cc15c1c63" + "3.1.0": + url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.1.0.tar.gz" + sha256: "67e7cf4ff2abe661d9269b9d7f52ec7c39192f22e69bab638f27ef4337c12905" "3.0.4": url: "https://github.com/SanderMertens/flecs/archive/refs/tags/v3.0.4.tar.gz" sha256: "370e2bf1bd9fd6dc79b515887e7f048be676b0d95e23d43b2c8b76a5e645c8f4" diff --git a/recipes/flecs/all/conanfile.py b/recipes/flecs/all/conanfile.py index 18d41fdbab49c..b4d76faa5ed41 100644 --- a/recipes/flecs/all/conanfile.py +++ b/recipes/flecs/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class FlecsConan(ConanFile): @@ -33,15 +33,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") @@ -52,10 +46,14 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["FLECS_STATIC_LIBS"] = not self.options.shared + if Version(self.version) < "3.0.1": + tc.variables["FLECS_STATIC_LIBS"] = not self.options.shared + tc.variables["FLECS_SHARED_LIBS"] = self.options.shared + tc.variables["FLECS_DEVELOPER_WARNINGS"] = False + else: + tc.variables["FLECS_STATIC"] = not self.options.shared + tc.variables["FLECS_SHARED"] = self.options.shared tc.variables["FLECS_PIC"] = self.options.get_safe("fPIC", True) - tc.variables["FLECS_SHARED_LIBS"] = self.options.shared - tc.variables["FLECS_DEVELOPER_WARNINGS"] = False tc.generate() def build(self): @@ -72,10 +70,10 @@ def package(self): def package_info(self): suffix = "" if self.options.shared else "_static" self.cpp_info.set_property("cmake_file_name", "flecs") - self.cpp_info.set_property("cmake_target_name", "flecs::flecs{}".format(suffix)) + self.cpp_info.set_property("cmake_target_name", f"flecs::flecs{suffix}") # TODO: back to global scope once cmake_find_package* generators removed - self.cpp_info.components["_flecs"].libs = ["flecs{}".format(suffix)] + self.cpp_info.components["_flecs"].libs = [f"flecs{suffix}"] if not self.options.shared: self.cpp_info.components["_flecs"].defines.append("flecs_STATIC") if Version(self.version) >= "3.0.0": @@ -87,6 +85,6 @@ def package_info(self): # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "flecs" self.cpp_info.names["cmake_find_package_multi"] = "flecs" - self.cpp_info.components["_flecs"].names["cmake_find_package"] = "flecs{}".format(suffix) - self.cpp_info.components["_flecs"].names["cmake_find_package_multi"] = "flecs{}".format(suffix) - self.cpp_info.components["_flecs"].set_property("cmake_target_name", "flecs::flecs{}".format(suffix)) + self.cpp_info.components["_flecs"].names["cmake_find_package"] = f"flecs{suffix}" + self.cpp_info.components["_flecs"].names["cmake_find_package_multi"] = f"flecs{suffix}" + self.cpp_info.components["_flecs"].set_property("cmake_target_name", f"flecs::flecs{suffix}") diff --git a/recipes/flecs/all/test_package/conanfile.py b/recipes/flecs/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/flecs/all/test_package/conanfile.py +++ b/recipes/flecs/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/flecs/all/test_v1_package/CMakeLists.txt b/recipes/flecs/all/test_v1_package/CMakeLists.txt index 6492027d79956..0d20897301b68 100644 --- a/recipes/flecs/all/test_v1_package/CMakeLists.txt +++ b/recipes/flecs/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(flecs REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -if(TARGET flecs::flecs_static) - target_link_libraries(${PROJECT_NAME} PRIVATE flecs::flecs_static) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE flecs::flecs) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/flecs/all/test_v1_package/conanfile.py b/recipes/flecs/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/flecs/all/test_v1_package/conanfile.py +++ b/recipes/flecs/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/flecs/config.yml b/recipes/flecs/config.yml index d116302226cc6..6dd38fdadfe17 100644 --- a/recipes/flecs/config.yml +++ b/recipes/flecs/config.yml @@ -1,4 +1,14 @@ versions: + "3.1.4": + folder: all + "3.1.3": + folder: all + "3.1.2": + folder: all + "3.1.1": + folder: all + "3.1.0": + folder: all "3.0.4": folder: all "3.0.1": diff --git a/recipes/flex/all/conandata.yml b/recipes/flex/all/conandata.yml index 9e7a18bce3852..590bff3866793 100644 --- a/recipes/flex/all/conandata.yml +++ b/recipes/flex/all/conandata.yml @@ -2,3 +2,9 @@ sources: "2.6.4": sha256: "e87aae032bf07c26f85ac0ed3250998c37621d95f8bd748b31f15b33c45ee995" url: "https://github.com/westes/flex/releases/download/v2.6.4/flex-2.6.4.tar.gz" +patches: + "2.6.4": + - patch_file: patches/darwin-newer-versions.patch + patch_description: "missing linker flags skipped due to a problem in configure." + patch_source: "https://github.com/westes/flex/issues/509" + patch_type: "portability" diff --git a/recipes/flex/all/conanfile.py b/recipes/flex/all/conanfile.py index 9bfc21b1ff79c..1a19a7b9aedd3 100644 --- a/recipes/flex/all/conanfile.py +++ b/recipes/flex/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import functools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.files import get, rmdir, copy, rm, export_conandata_patches, apply_conandata_patches +from conan.tools.gnu import AutotoolsToolchain, Autotools + +required_conan_version = ">=1.53.0" class FlexConan(ConanFile): @@ -24,41 +28,37 @@ class FlexConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def export_sources(self): + export_conandata_patches(self) def requirements(self): + # Flex requires M4 to be compiled. If consumer does not have M4 + # installed, Conan will need to know that Flex requires it. self.requires("m4/1.4.19") def build_requirements(self): - self.build_requires("m4/1.4.19") - if hasattr(self, "settings_build") and tools.cross_building(self): - self.build_requires(f"{self.name}/{self.version}") + self.tool_requires("m4/1.4.19") + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires(f"{self.name}/{self.version}") - def config_options(self): + def validate(self): if self.settings.os == "Windows": - del self.options.fPIC + raise ConanInvalidConfiguration("Flex package is not compatible with Windows. " + "Consider using winflexbison instead.") def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("Flex package is not compatible with Windows. Consider using winflexbison instead.") - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self) - yes_no = lambda v: "yes" if v else "no" - configure_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(not yes_no(self.options.shared)), + self.options.rm_safe("fPIC") + + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def generate(self): + at = AutotoolsToolchain(self) + at.configure_args.extend([ "--disable-nls", "--disable-bootstrap", "HELP2MAN=/bin/true", @@ -67,24 +67,28 @@ def _configure_autotools(self): "ac_cv_func_malloc_0_nonnull=yes", "ac_cv_func_realloc_0_nonnull=yes", # https://github.com/easybuilders/easybuild-easyconfigs/pull/5792 "ac_cv_func_reallocarray=no", - ] - - autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return autotools + ]) + at.generate() def build(self): - autotools = self._configure_autotools() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["fl"] + self.cpp_info.system_libs = ["m"] + # Avoid CMakeDeps messing with Conan targets + self.cpp_info.set_property("cmake_find_mode", "none") bindir = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bindir)) diff --git a/recipes/flex/all/patches/darwin-newer-versions.patch b/recipes/flex/all/patches/darwin-newer-versions.patch new file mode 100644 index 0000000000000..d0a7b8300861e --- /dev/null +++ b/recipes/flex/all/patches/darwin-newer-versions.patch @@ -0,0 +1,13 @@ +diff --git a/configure b/configure +index d88c47c..827c01a 100755 +--- a/configure ++++ b/configure +@@ -6842,7 +6842,7 @@ $as_echo "$lt_cv_ld_force_load" >&6; } + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + 10.[012][,.]*) + _lt_dar_allow_undefined='$wl-flat_namespace $wl-undefined ${wl}suppress' ;; +- 10.*) ++ *) + _lt_dar_allow_undefined='$wl-undefined ${wl}dynamic_lookup' ;; + esac + ;; diff --git a/recipes/flex/all/test_package/CMakeLists.txt b/recipes/flex/all/test_package/CMakeLists.txt index f1594602f9e1c..1c6f9d490deb4 100644 --- a/recipes/flex/all/test_package/CMakeLists.txt +++ b/recipes/flex/all/test_package/CMakeLists.txt @@ -1,20 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) -# Find FLEX before `conanbuildinfo.cmake` because that file will let `find_program` -# look for executables in host packages (let's hope conan 2.0 fixes this) find_package(FLEX REQUIRED) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - -find_package(FLEX REQUIRED) - -flex_target(flex_scanner basic_nr.l "${PROJECT_BINARY_DIR}/basic_nr.cpp") +flex_target(flex_scanner basic_nr.l ${PROJECT_BINARY_DIR}/basic_nr.cpp) add_executable(${PROJECT_NAME} basic_nr.cpp) target_include_directories(${PROJECT_NAME} PRIVATE ${FLEX_INCLUDE_DIRS}) target_link_libraries(${PROJECT_NAME} PRIVATE ${FLEX_LIBRARIES}) - -add_executable(test_yywrap test_yywrap.c) -target_link_libraries(test_yywrap PRIVATE ${FLEX_LIBRARIES}) diff --git a/recipes/flex/all/test_package/conanfile.py b/recipes/flex/all/test_package/conanfile.py index ea2fd2ff6d920..4270466e9e01c 100644 --- a/recipes/flex/all/test_package/conanfile.py +++ b/recipes/flex/all/test_package/conanfile.py @@ -1,40 +1,50 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanException import os +import re +from io import StringIO + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "VirtualBuildEnv", "VirtualRunEnv", "CMakeDeps" test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) def build_requirements(self): - self.build_requires(self.tested_reference_str) + self.tool_requires(self.tested_reference_str) - def build(self): - if not hasattr(self, "settings_build"): - # Only test location of flex executable when not cross building - flex_bin = tools.which("flex") - if not flex_bin.startswith(self.deps_cpp_info["flex"].rootpath): - raise ConanException("Wrong flex executable captured") + def layout(self): + cmake_layout(self) - if not tools.cross_building(self, skip_x64_x86=True) or hasattr(self, "settings_build"): - self.run("flex --version", run_environment=not hasattr(self, "settings_build")) + def _assert_expected_version(self): - print(os.environ["PATH"]) - cmake = CMake(self) - cmake.definitions["FLEX_ROOT"] = self.deps_cpp_info["flex"].rootpath - cmake.configure() - cmake.build() + def tested_reference_version(): + tokens = re.split('[@#]', self.tested_reference_str) + return tokens[0].split("/", 1)[1] - def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - bin_path = os.path.join("bin", "test_package") - src = os.path.join(self.source_folder, "basic_nr.txt") - self.run("{} {}".format(bin_path, src), run_environment=True) + output = StringIO() + self.run("flex --version", output) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + expected_version = tested_reference_version() + self.output.info("Expected version: {}".format(expected_version)) + assert_flex_version = "flex {}".format(expected_version) + assert(assert_flex_version in output_str) - test_yywrap = os.path.join("bin", "test_yywrap") - self.run(test_yywrap, run_environment=True) + def build(self): + # Let's check flex version installed + self._assert_expected_version() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + txt_file = os.path.join(self.source_folder, "basic_nr.txt") + self.run(f"{bin_path} {txt_file}", env="conanrun") diff --git a/recipes/flex/all/test_package/test_yywrap.c b/recipes/flex/all/test_package/test_yywrap.c deleted file mode 100644 index c98a000f1dc22..0000000000000 --- a/recipes/flex/all/test_package/test_yywrap.c +++ /dev/null @@ -1,10 +0,0 @@ -#include - -int yywrap(void); -int yylex(void) { - return 0; -} - -int main() { - printf("yywrap() returned: %d.\n", yywrap()); -} diff --git a/recipes/flex/all/test_v1_package/CMakeLists.txt b/recipes/flex/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b93b03cb34ebf --- /dev/null +++ b/recipes/flex/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(FLEX REQUIRED) +flex_target(flex_scanner basic_nr.l ${PROJECT_BINARY_DIR}/basic_nr.cpp) + +add_executable(${PROJECT_NAME} basic_nr.cpp) +target_include_directories(${PROJECT_NAME} PRIVATE ${FLEX_INCLUDE_DIRS}) +target_link_libraries(${PROJECT_NAME} PRIVATE ${FLEX_LIBRARIES}) diff --git a/recipes/flex/all/test_v1_package/basic_nr.l b/recipes/flex/all/test_v1_package/basic_nr.l new file mode 100644 index 0000000000000..71fa5d65f82c6 --- /dev/null +++ b/recipes/flex/all/test_v1_package/basic_nr.l @@ -0,0 +1,89 @@ +/* + * This file is part of flex. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE. + */ + +%option C++ noyywrap + +%{ +int mylineno = 0; +%} + +string \"[^\n"]+\" + +ws [ \t]+ + +alpha [A-Za-z] +dig [0-9] +name ({alpha}|{dig}|\$)({alpha}|{dig}|\_|\.|\-|\/|\$)* +num1 [-+]?{dig}+\.?([eE][-+]?{dig}+)? +num2 [-+]?{dig}*\.{dig}+([eE][-+]?{dig}+)? +number {num1}|{num2} + +%% + +{ws} /* skip blanks and tabs */ + +"/*" { + int c; + + while((c = yyinput()) != 0) + { + if(c == '\n') + ++mylineno; + + else if(c == '*') + { + if((c = yyinput()) == '/') + break; + else + unput(c); + } + } + } + +{number} std::cout << "number " << YYText() << '\n'; + +\n mylineno++; + +{name} std::cout << "name " << YYText() << '\n'; + +{string} std::cout << "string " << YYText() << '\n'; + +%% + +extern "C" { + int yylex() {return 0;} +} + +#include + +int main( int argc, const char *argv[]) { + if (argc < 2) { + fprintf(stderr, "Need an argument\n"); + return 1; + } + std::ifstream ifs(argv[1]); + FlexLexer *lexer = new yyFlexLexer(ifs, std::cout); + while(lexer->yylex() != 0) + ; + return 0; +} diff --git a/recipes/flex/all/test_v1_package/basic_nr.txt b/recipes/flex/all/test_v1_package/basic_nr.txt new file mode 100644 index 0000000000000..3dca798730b64 --- /dev/null +++ b/recipes/flex/all/test_v1_package/basic_nr.txt @@ -0,0 +1,6 @@ +/* this is a multi line comment +still in the comment +and done */ +foo = "bar" +num = 43 +setting = false diff --git a/recipes/flex/all/test_v1_package/conanfile.py b/recipes/flex/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4d0b7ff593f64 --- /dev/null +++ b/recipes/flex/all/test_v1_package/conanfile.py @@ -0,0 +1,47 @@ +import os +import re +from io import StringIO + +from conans import ConanFile, tools, CMake + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def _assert_expected_version(self): + + def tested_reference_version(): + tokens = re.split('[@#]', self.tested_reference_str) + return tokens[0].split("/", 1)[1] + + output = StringIO() + self.run(f"flex --version", output, run_environment=False) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + expected_version = tested_reference_version() + self.output.info("Expected version: {}".format(expected_version)) + assert_flex_version = "flex {}".format(expected_version) + assert(assert_flex_version in output_str) + + def build(self): + # Let's check flex version installed + self._assert_expected_version() + # FIXME: CMake legacy is not working as expected when cross-compiling + if not tools.cross_building(self, skip_x64_x86=True): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self, skip_x64_x86=True): + bin_path = os.path.join("bin", "test_package") + txt_file = os.path.join(self.source_folder, "basic_nr.txt") + self.run(f"{bin_path} {txt_file}", run_environment=True) diff --git a/recipes/fmt/all/conandata.yml b/recipes/fmt/all/conandata.yml index 62a5ea0960895..2e3e916ce6875 100644 --- a/recipes/fmt/all/conandata.yml +++ b/recipes/fmt/all/conandata.yml @@ -1,25 +1,25 @@ sources: - "5.3.0": - sha256: defa24a9af4c622a7134076602070b45721a43c51598c8456ec6f2c4dbb51c89 - url: https://github.com/fmtlib/fmt/archive/5.3.0.tar.gz - "6.2.1": - sha256: 5edf8b0f32135ad5fafb3064de26d063571e95e8ae46829c2f4f4b52696bbff0 - url: https://github.com/fmtlib/fmt/archive/6.2.1.tar.gz - "7.1.3": - sha256: 5cae7072042b3043e12d53d50ef404bbb76949dad1de368d7f993a15c8c05ecc - url: https://github.com/fmtlib/fmt/archive/7.1.3.tar.gz - "8.0.1": - url: "https://github.com/fmtlib/fmt/archive/8.0.1.tar.gz" - sha256: "b06ca3130158c625848f3fb7418f235155a4d389b2abc3a6245fb01cb0eb1e01" - "8.1.1": - url: "https://github.com/fmtlib/fmt/archive/8.1.1.tar.gz" - sha256: "3d794d3cf67633b34b2771eb9f073bde87e846e0d395d254df7b211ef1ec7346" - "9.0.0": - url: "https://github.com/fmtlib/fmt/archive/9.0.0.tar.gz" - sha256: "9a1e0e9e843a356d65c7604e2c8bf9402b50fe294c355de0095ebd42fb9bd2c5" "9.1.0": - url: "https://github.com/fmtlib/fmt/archive/9.1.0.tar.gz" - sha256: "5dea48d1fcddc3ec571ce2058e13910a0d4a6bab4cc09a809d8b1dd1c88ae6f2" + url: "https://github.com/fmtlib/fmt/releases/download/9.1.0/fmt-9.1.0.zip" + sha256: "cceb4cb9366e18a5742128cb3524ce5f50e88b476f1e54737a47ffdf4df4c996" + "9.0.0": + url: "https://github.com/fmtlib/fmt/releases/download/9.0.0/fmt-9.0.0.zip" + sha256: "fc96dd2d2fdf2bded630787adba892c23cb9e35c6fd3273c136b0c57d4651ad6" + "8.1.1": + url: "https://github.com/fmtlib/fmt/releases/download/8.1.1/fmt-8.1.1.zip" + sha256: "23778bad8edba12d76e4075da06db591f3b0e3c6c04928ced4a7282ca3400e5d" + "8.0.1": + url: "https://github.com/fmtlib/fmt/releases/download/8.0.1/fmt-8.0.1.zip" + sha256: "a627a56eab9554fc1e5dd9a623d0768583b3a383ff70a4312ba68f94c9d415bf" + "7.1.3": + url: "https://github.com/fmtlib/fmt/releases/download/7.1.3/fmt-7.1.3.zip" + sha256: "5d98c504d0205f912e22449ecdea776b78ce0bb096927334f80781e720084c9f" + "6.2.1": + url: "https://github.com/fmtlib/fmt/releases/download/6.2.1/fmt-6.2.1.zip" + sha256: "94fea742ddcccab6607b517f6e608b1e5d63d712ddbc5982e44bafec5279881a" + "5.3.0": + url: "https://github.com/fmtlib/fmt/releases/download/5.3.0/fmt-5.3.0.zip" + sha256: "4c0741e10183f75d7d6f730b8708a99b329b2f942dad5a9da3385ab92bb4a15c" patches: "5.3.0": - patch_file: "patches/fix-install-5.3.0.patch" diff --git a/recipes/fmt/all/conanfile.py b/recipes/fmt/all/conanfile.py index f581eaba97d14..9e0bb36bb8099 100644 --- a/recipes/fmt/all/conanfile.py +++ b/recipes/fmt/all/conanfile.py @@ -1,23 +1,22 @@ import os from conan import ConanFile -from conan.tools.scm import Version from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import get, apply_conandata_patches, copy, rmdir - +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.layout import basic_layout +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class FmtConan(ConanFile): name = "fmt" homepage = "https://github.com/fmtlib/fmt" description = "A safe and fast alternative to printf and IOStreams." - topics = ("fmt", "format", "iostream", "printf") + topics = ("format", "iostream", "printf") url = "https://github.com/conan-io/conan-center-index" license = "MIT" - exports_sources = "patches/*" - settings = "os", "arch", "compiler", "build_type" options = { "header_only": [True, False], @@ -36,21 +35,10 @@ class FmtConan(ConanFile): @property def _has_with_os_api_option(self): - return Version(str(self.version)) >= "7.0.0" - - def generate(self): - if not self.options.header_only: - tc = CMakeToolchain(self) - tc.cache_variables["FMT_DOC"] = False - tc.cache_variables["FMT_TEST"] = False - tc.cache_variables["FMT_INSTALL"] = True - tc.cache_variables["FMT_LIB_DIR"] = "lib" - if self._has_with_os_api_option: - tc.cache_variables["FMT_OS"] = bool(self.options.with_os_api) - tc.generate() + return Version(self.version) >= "7.0.0" - def layout(self): - cmake_layout(self, src_folder="src") + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -62,11 +50,17 @@ def config_options(self): def configure(self): if self.options.header_only: - del self.options.fPIC - del self.options.shared - del self.options.with_os_api + self.options.rm_safe("fPIC") + self.options.rm_safe("shared") + self.options.rm_safe("with_os_api") elif self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + if self.options.header_only: + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") def package_id(self): if self.info.options.header_only: @@ -74,8 +68,23 @@ def package_id(self): else: del self.info.options.with_fmt_alias + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][str(self.version)], strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if not self.options.header_only: + tc = CMakeToolchain(self) + tc.cache_variables["FMT_DOC"] = False + tc.cache_variables["FMT_TEST"] = False + tc.cache_variables["FMT_INSTALL"] = True + tc.cache_variables["FMT_LIB_DIR"] = "lib" + if self._has_with_os_api_option: + tc.cache_variables["FMT_OS"] = bool(self.options.with_os_api) + tc.generate() def build(self): apply_conandata_patches(self) @@ -97,37 +106,30 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "fmt" - self.cpp_info.names["cmake_find_package_multi"] = "fmt" - self.cpp_info.names["pkg_config"] = "fmt" - target = "fmt-header-only" if self.options.header_only else "fmt" - self.cpp_info.set_property("cmake_target_name", "fmt::{}".format(target)) + self.cpp_info.set_property("cmake_file_name", "fmt") + self.cpp_info.set_property("cmake_target_name", f"fmt::{target}") + self.cpp_info.set_property("pkg_config_name", "fmt") # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["_fmt"].includedirs.extend(["include"]) + if self.options.with_fmt_alias: + self.cpp_info.components["_fmt"].defines.append("FMT_STRING_ALIAS=1") + if self.options.header_only: self.cpp_info.components["_fmt"].defines.append("FMT_HEADER_ONLY=1") - if self.options.with_fmt_alias: - self.cpp_info.components["_fmt"].defines.append("FMT_STRING_ALIAS=1") else: postfix = "d" if self.settings.build_type == "Debug" else "" libname = "fmt" + postfix self.cpp_info.components["_fmt"].libs = [libname] if self.settings.os == "Linux": self.cpp_info.components["_fmt"].system_libs.extend(["m"]) - # FIXME: remove when Conan 1.50 is used in c3i and update the Conan required version - # from that version components don't have empty libdirs by default - self.cpp_info.components["_fmt"].libdirs.extend(["lib"]) - self.cpp_info.components["_fmt"].bindirs.extend(["bin"]) - if self.options.with_fmt_alias: - self.cpp_info.components["_fmt"].defines.append("FMT_STRING_ALIAS=1") if self.options.shared: self.cpp_info.components["_fmt"].defines.append("FMT_SHARED") # TODO: to remove in conan v2 once cmake_find_package* generators removed + self.cpp_info.names["cmake_find_package"] = "fmt" + self.cpp_info.names["cmake_find_package_multi"] = "fmt" + self.cpp_info.names["pkg_config"] = "fmt" self.cpp_info.components["_fmt"].names["cmake_find_package"] = target self.cpp_info.components["_fmt"].names["cmake_find_package_multi"] = target - self.cpp_info.components["_fmt"].set_property("cmake_target_name", "fmt::{}".format(target)) - # FIXME: Remove as soon as Conan client provide a hotfix. See conan-io/conan-center-index#12149 - self.cpp_info.components["_fmt"].builddirs = [""] + self.cpp_info.components["_fmt"].set_property("cmake_target_name", f"fmt::{target}") diff --git a/recipes/fmt/all/test_package/CMakeLists.txt b/recipes/fmt/all/test_package/CMakeLists.txt index 66300c1349564..a71cd67f135ec 100644 --- a/recipes/fmt/all/test_package/CMakeLists.txt +++ b/recipes/fmt/all/test_package/CMakeLists.txt @@ -1,22 +1,20 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(fmt REQUIRED CONFIG) -# TEST_PACKAGE ################################################################# -add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) +add_executable(test_package test_package.cpp) +target_compile_features(test_package PRIVATE cxx_std_14) if(FMT_HEADER_ONLY) - target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt-header-only) + target_link_libraries(test_package PRIVATE fmt::fmt-header-only) else() - target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt) + target_link_libraries(test_package PRIVATE fmt::fmt) endif() -# TEST_RANGES ################################################################## add_executable(test_ranges test_ranges.cpp) -set_property(TARGET test_ranges PROPERTY CXX_STANDARD 14) +target_compile_features(test_ranges PRIVATE cxx_std_14) if(FMT_HEADER_ONLY) - target_link_libraries(test_ranges fmt::fmt-header-only) + target_link_libraries(test_ranges PRIVATE fmt::fmt-header-only) else() - target_link_libraries(test_ranges fmt::fmt) + target_link_libraries(test_ranges PRIVATE fmt::fmt) endif() diff --git a/recipes/fmt/all/test_package/conanfile.py b/recipes/fmt/all/test_package/conanfile.py index 8a8fc7d357d57..943effe9479aa 100644 --- a/recipes/fmt/all/test_package/conanfile.py +++ b/recipes/fmt/all/test_package/conanfile.py @@ -1,14 +1,16 @@ import os from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain from conan.tools.build import can_run -from conan.tools.cmake import cmake_layout +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -required_conan_version = ">=1.50.0" class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) def requirements(self): self.requires(self.tested_reference_str) @@ -18,9 +20,6 @@ def generate(self): tc.variables["FMT_HEADER_ONLY"] = self.dependencies[self.tested_reference_str].options.header_only tc.generate() - def layout(self): - cmake_layout(self) - def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/fmt/all/test_v1_package/CMakeLists.txt b/recipes/fmt/all/test_v1_package/CMakeLists.txt index e4a5b85441935..925ecbe19e448 100644 --- a/recipes/fmt/all/test_v1_package/CMakeLists.txt +++ b/recipes/fmt/all/test_v1_package/CMakeLists.txt @@ -1,25 +1,8 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(fmt REQUIRED CONFIG) - -# TEST_PACKAGE ################################################################# -add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 14) -if(FMT_HEADER_ONLY) - target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt-header-only) -else() - target_link_libraries(${CMAKE_PROJECT_NAME} fmt::fmt) -endif() - -# TEST_RANGES ################################################################## -add_executable(test_ranges test_ranges.cpp) -set_property(TARGET test_ranges PROPERTY CXX_STANDARD 14) -if(FMT_HEADER_ONLY) - target_link_libraries(test_ranges fmt::fmt-header-only) -else() - target_link_libraries(test_ranges fmt::fmt) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/fmt/all/test_v1_package/conanfile.py b/recipes/fmt/all/test_v1_package/conanfile.py index 65778c702047d..f99cfc80791d2 100644 --- a/recipes/fmt/all/test_v1_package/conanfile.py +++ b/recipes/fmt/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/fmt/all/test_v1_package/test_package.cpp b/recipes/fmt/all/test_v1_package/test_package.cpp deleted file mode 100644 index bcd009407212d..0000000000000 --- a/recipes/fmt/all/test_v1_package/test_package.cpp +++ /dev/null @@ -1,62 +0,0 @@ -#include -#include -#include -#include -#include -#include - - -#include -#include -#include -#include - - -void vreport(const char *format, fmt::format_args args) { - fmt::vprint(format, args); -} - -template -void report(const char *format, const Args & ... args) { - vreport(format, fmt::make_format_args(args...)); -} - -class Date { - int year_, month_, day_; - public: - Date(int year, int month, int day) : year_(year), month_(month), day_(day) {} - - friend std::ostream &operator<<(std::ostream &os, const Date &d) { - return os << d.year_ << '-' << d.month_ << '-' << d.day_; - } -}; - -#if FMT_VERSION >= 90000 -namespace fmt { - template <> struct formatter : ostream_formatter {}; -} -#endif - -int main() { - const std::string thing("World"); - fmt::print("PRINT: Hello {}!\n", thing); - fmt::printf("PRINTF: Hello, %s!\n", thing); - - const std::string formatted = fmt::format("{0}{1}{0}", "abra", "cad"); - fmt::print("{}\n", formatted); - - fmt::memory_buffer buf; - fmt::format_to(std::begin(buf), "{}", 2.7182818); - fmt::print("Euler number: {}\n", fmt::to_string(buf)); - - const std::string date = fmt::format("The date is {}\n", Date(2012, 12, 9)); - fmt::print(date); - - report("{} {} {}\n", "Conan", 42, 3.14159); - - fmt::print(std::cout, "{} {}\n", "Magic number", 42); - - fmt::print(fg(fmt::color::aqua), "Bincrafters\n"); - - return EXIT_SUCCESS; -} diff --git a/recipes/fmt/all/test_v1_package/test_ranges.cpp b/recipes/fmt/all/test_v1_package/test_ranges.cpp deleted file mode 100644 index b808d6987b07e..0000000000000 --- a/recipes/fmt/all/test_v1_package/test_ranges.cpp +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include "fmt/ranges.h" - -int main() { - std::vector numbers; - fmt::format_to(std::back_inserter(numbers), "{}{}{}", 1, 2, 3); - const std::string str_numbers = fmt::format("{}", numbers); - fmt::print("numbers: {}\n", str_numbers); - return EXIT_SUCCESS; -} diff --git a/recipes/fmt/config.yml b/recipes/fmt/config.yml index 5da590b43a6cd..7251dde3fac9f 100644 --- a/recipes/fmt/config.yml +++ b/recipes/fmt/config.yml @@ -1,15 +1,15 @@ versions: - "5.3.0": + "9.1.0": folder: all - "6.2.1": + "9.0.0": folder: all - "7.1.3": + "8.1.1": folder: all "8.0.1": folder: all - "8.1.1": + "7.1.3": folder: all - "9.0.0": + "6.2.1": folder: all - "9.1.0": + "5.3.0": folder: all diff --git a/recipes/fmtlog/all/conandata.yml b/recipes/fmtlog/all/conandata.yml new file mode 100644 index 0000000000000..181d1e80ed96e --- /dev/null +++ b/recipes/fmtlog/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "2.2.1": + url: "https://github.com/MengRao/fmtlog/archive/refs/tags/v2.2.1.tar.gz" + sha256: "9bc2f1ea37eece0f4807689962b529d2d4fa07654baef184f051319b4eac9304" +patches: + "2.2.1": + - patch_file: "patches/2.2.1-0001-fix-cmake.patch" + patch_description: "make shared, static library separately" + patch_type: "conan" diff --git a/recipes/fmtlog/all/conanfile.py b/recipes/fmtlog/all/conanfile.py new file mode 100644 index 0000000000000..e1fd99b8fca24 --- /dev/null +++ b/recipes/fmtlog/all/conanfile.py @@ -0,0 +1,119 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "fmtlog" + description = "fmtlog is a performant fmtlib-style logging library with latency in nanoseconds." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/MengRao/fmtlog" + topics = ("logging", "low-latency", "topic3") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "header_only": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "header_only": False, + } + + @property + def _minimum_cpp_standard(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "Visual Studio": "15.7", + "msvc": "191", + "clang": "7", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + if self.options.header_only: + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("fmt/9.1.0") + + def package_id(self): + if self.options.header_only: + self.info.clear() + + def validate(self): + # FIXME: self.info.settings.compiler does not work with header-only packages + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + if self.options.header_only: + return + + tc = CMakeToolchain(self) + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + if self.options.header_only: + return + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + if self.options.header_only: + copy(self, pattern="fmtlog*.h", dst=os.path.join(self.package_folder, "include", "fmtlog"), src=self.source_folder) + else: + cmake = CMake(self) + cmake.install() + + def package_info(self): + if self.options.header_only: + self.cpp_info.defines.append("FMTLOG_HEADER_ONLY") + else: + self.cpp_info.libs = ["fmtlog-shared" if self.options.shared else "fmtlog-static"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/fmtlog/all/patches/2.2.1-0001-fix-cmake.patch b/recipes/fmtlog/all/patches/2.2.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..08354bb048c10 --- /dev/null +++ b/recipes/fmtlog/all/patches/2.2.1-0001-fix-cmake.patch @@ -0,0 +1,39 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c45e569..6dc75d4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,23 +12,24 @@ else() + link_libraries(pthread) + endif() + +-link_directories(.) +-include_directories(fmt/include) ++find_package(fmt REQUIRED CONFIG) + ++if(BUILD_SHARED_LIBS) + add_library(fmtlog-shared SHARED fmtlog.cc) +-if(MSVC) +- target_link_libraries(fmtlog-shared fmt) ++if(1) ++ target_link_libraries(fmtlog-shared PUBLIC fmt::fmt) + endif() ++set_property(TARGET fmtlog-shared PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON) + install(TARGETS fmtlog-shared) + ++else() ++ + add_library(fmtlog-static fmtlog.cc) +-if(MSVC) +- target_link_libraries(fmtlog-static fmt) ++if(1) ++ target_link_libraries(fmtlog-static PUBLIC fmt::fmt) + endif() + install(TARGETS fmtlog-static) + +-add_subdirectory(fmt) +-add_subdirectory(test) +-if(NOT MSVC) +- add_subdirectory(bench) + endif() ++ ++install(FILES fmtlog.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fmtlog) diff --git a/recipes/fmtlog/all/test_package/CMakeLists.txt b/recipes/fmtlog/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..42a1ef5c3a35e --- /dev/null +++ b/recipes/fmtlog/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(fmtlog REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fmtlog::fmtlog) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/fmtlog/all/test_package/conanfile.py b/recipes/fmtlog/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/fmtlog/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fmtlog/all/test_package/test_package.cpp b/recipes/fmtlog/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..25429fa8fbed2 --- /dev/null +++ b/recipes/fmtlog/all/test_package/test_package.cpp @@ -0,0 +1,5 @@ +#include "fmtlog/fmtlog.h" +int main() +{ + FMTLOG(fmtlog::INF, "The answer is {}.", 42); +} diff --git a/recipes/fmtlog/all/test_v1_package/CMakeLists.txt b/recipes/fmtlog/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..885bdb9ba0ee8 --- /dev/null +++ b/recipes/fmtlog/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(fmtlog REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fmtlog::fmtlog) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/fmtlog/all/test_v1_package/conanfile.py b/recipes/fmtlog/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/fmtlog/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/fmtlog/config.yml b/recipes/fmtlog/config.yml new file mode 100644 index 0000000000000..a816d92f78ee3 --- /dev/null +++ b/recipes/fmtlog/config.yml @@ -0,0 +1,3 @@ +versions: + "2.2.1": + folder: all diff --git a/recipes/folly/all/conanfile.py b/recipes/folly/all/conanfile.py index f1a32a1e02e30..06dc6965155a7 100755 --- a/recipes/folly/all/conanfile.py +++ b/recipes/folly/all/conanfile.py @@ -2,8 +2,9 @@ from conan.tools.build import can_run from conan.tools.scm import Version from conan.tools import files -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conans import CMake, tools +from conan.errors import ConanInvalidConfiguration import functools import os @@ -22,10 +23,12 @@ class FollyConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "use_sse4_2" : [True, False], } default_options = { "shared": False, "fPIC": True, + "use_sse4_2" : False } generators = "cmake", "cmake_find_package" @@ -57,10 +60,14 @@ def export_sources(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): self.copy(patch["patch_file"]) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if str(self.settings.arch) not in ['x86', 'x86_64']: + del self.options.use_sse4_2 + def configure(self): if self.options.shared: del self.options.fPIC @@ -103,7 +110,7 @@ def validate(self): raise ConanInvalidConfiguration("{} requires C++{} support. The current compiler {} {} does not support it.".format( self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) - if self.version < "2022.01.31.00" and self.settings.os != "Linux": + if Version(self.version) < "2022.01.31.00" and self.settings.os != "Linux": raise ConanInvalidConfiguration("Conan support for non-Linux platforms starts with Folly version 2022.01.31.00") if self.settings.os == "Macos" and self.settings.arch != "x86_64": @@ -115,7 +122,7 @@ def validate(self): if self.settings.os in ["Macos", "Windows"] and self.options.shared: raise ConanInvalidConfiguration("Folly could not be built on {} as shared library".format(self.settings.os)) - if self.version == "2020.08.10.00" and self.settings.compiler == "clang" and self.options.shared: + if Version(self.version) == "2020.08.10.00" and self.settings.compiler == "clang" and self.options.shared: raise ConanInvalidConfiguration("Folly could not be built by clang as a shared library") if self.options["boost"].header_only: @@ -133,6 +140,9 @@ def validate(self): raise ConanInvalidConfiguration("{} requires C++{} support. The current compiler {} {} does not support it.".format( self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) + if self.options.get_safe("use_sse4_2") and str(self.settings.arch) not in ['x86', 'x86_64']: + raise ConanInvalidConfiguration(f"{self.ref} can use the option use_sse4_2 only on x86 and x86_64 archs.") + # FIXME: Freeze max. CMake version at 3.16.2 to fix the Linux build def build_requirements(self): self.build_requires("cmake/3.16.9") @@ -152,6 +162,16 @@ def _configure_cmake(self): cmake.definitions["FOLLY_HAVE_WCHAR_SUPPORT_EXITCODE__TRYRUN_OUTPUT"] = "" cmake.definitions["HAVE_VSNPRINTF_ERRORS_EXITCODE"] = "0" cmake.definitions["HAVE_VSNPRINTF_ERRORS_EXITCODE__TRYRUN_OUTPUT"] = "" + + if self.options.get_safe("use_sse4_2") and str(self.settings.arch) in ['x86', 'x86_64']: + # in folly, if simd >=sse4.2, we also needs -mfma flag to avoid compiling error. + if not is_msvc(self): + cmake.definitions["CMAKE_C_FLAGS"] = "-mfma" + cmake.definitions["CMAKE_CXX_FLAGS"] = "-mfma" + else: + cmake.definitions["CMAKE_C_FLAGS"] = "/arch:FMA" + cmake.definitions["CMAKE_CXX_FLAGS"] = "/arch:FMA" + cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) cxx_std_flag = tools.cppstd_flag(self.settings) @@ -164,6 +184,7 @@ def _configure_cmake(self): cmake.configure() return cmake + def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): tools.patch(**patch) @@ -244,6 +265,9 @@ def package_info(self): if self.settings.os == "Macos" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version.value) >= "11.0": self.cpp_info.components["libfolly"].system_libs.append("c++abi") + if self.options.get_safe("use_sse4_2") and str(self.settings.arch) in ['x86', 'x86_64']: + self.cpp_info.components["libfolly"].defines = ["FOLLY_SSE=4", "FOLLY_SSE_MINOR=2"] + # TODO: to remove in conan v2 once cmake_find_package_* & pkg_config generators removed self.cpp_info.filenames["cmake_find_package"] = "folly" self.cpp_info.filenames["cmake_find_package_multi"] = "folly" @@ -254,3 +278,30 @@ def package_info(self): self.cpp_info.components["libfolly"].names["cmake_find_package_multi"] = "folly" self.cpp_info.components["libfolly"].set_property("cmake_target_name", "Folly::folly") self.cpp_info.components["libfolly"].set_property("pkg_config_name", "libfolly") + + if Version(self.version) >= "2019.10.21.00": + self.cpp_info.components["follybenchmark"].set_property("cmake_target_name", "Folly::follybenchmark") + self.cpp_info.components["follybenchmark"].set_property("pkg_config_name", "libfollybenchmark") + self.cpp_info.components["follybenchmark"].libs = ["follybenchmark"] + self.cpp_info.components["follybenchmark"].requires = ["libfolly"] + + self.cpp_info.components["folly_test_util"].set_property("cmake_target_name", "Folly::folly_test_util") + self.cpp_info.components["folly_test_util"].set_property("pkg_config_name", "libfolly_test_util") + self.cpp_info.components["folly_test_util"].libs = ["folly_test_util"] + self.cpp_info.components["folly_test_util"].requires = ["libfolly"] + + if Version(self.version) >= "2020.08.10.00" and self.settings.os == "Linux": + self.cpp_info.components["folly_exception_tracer_base"].set_property("cmake_target_name", "Folly::folly_exception_tracer_base") + self.cpp_info.components["folly_exception_tracer_base"].set_property("pkg_config_name", "libfolly_exception_tracer_base") + self.cpp_info.components["folly_exception_tracer_base"].libs = ["folly_exception_tracer_base"] + self.cpp_info.components["folly_exception_tracer_base"].requires = ["libfolly"] + + self.cpp_info.components["folly_exception_tracer"].set_property("cmake_target_name", "Folly::folly_exception_tracer") + self.cpp_info.components["folly_exception_tracer"].set_property("pkg_config_name", "libfolly_exception_tracer") + self.cpp_info.components["folly_exception_tracer"].libs = ["folly_exception_tracer"] + self.cpp_info.components["folly_exception_tracer"].requires = ["folly_exception_tracer_base"] + + self.cpp_info.components["folly_exception_counter"].set_property("cmake_target_name", "Folly::folly_exception_counter") + self.cpp_info.components["folly_exception_counter"].set_property("pkg_config_name", "libfolly_exception_counter") + self.cpp_info.components["folly_exception_counter"].libs = ["folly_exception_counter"] + self.cpp_info.components["folly_exception_counter"].requires = ["folly_exception_tracer"] diff --git a/recipes/folly/all/patches/0016-find-packages.patch b/recipes/folly/all/patches/0016-find-packages.patch index ad83fc73d121c..c6cd14fad52c9 100644 --- a/recipes/folly/all/patches/0016-find-packages.patch +++ b/recipes/folly/all/patches/0016-find-packages.patch @@ -1,8 +1,8 @@ diff --git a/CMake/folly-deps.cmake b/CMake/folly-deps.cmake -index e0e02c0..2bd4940 100644 +index 9c9d9ea60..e78611542 100644 --- a/CMake/folly-deps.cmake +++ b/CMake/folly-deps.cmake -@@ -48,11 +48,11 @@ find_package(Boost 1.51.0 MODULE +@@ -48,25 +48,25 @@ find_package(Boost 1.51.0 MODULE list(APPEND FOLLY_LINK_LIBRARIES ${Boost_LIBRARIES}) list(APPEND FOLLY_INCLUDE_DIRECTORIES ${Boost_INCLUDE_DIRS}) @@ -12,12 +12,19 @@ index e0e02c0..2bd4940 100644 list(APPEND FOLLY_INCLUDE_DIRECTORIES ${DOUBLE_CONVERSION_INCLUDE_DIR}) -find_package(Gflags MODULE) +-set(FOLLY_HAVE_LIBGFLAGS ${LIBGFLAGS_FOUND}) +-if(LIBGFLAGS_FOUND) +- list(APPEND FOLLY_LINK_LIBRARIES ${LIBGFLAGS_LIBRARY}) +- list(APPEND FOLLY_INCLUDE_DIRECTORIES ${LIBGFLAGS_INCLUDE_DIR}) +- set(FOLLY_LIBGFLAGS_LIBRARY ${LIBGFLAGS_LIBRARY}) +- set(FOLLY_LIBGFLAGS_INCLUDE ${LIBGFLAGS_INCLUDE_DIR}) +find_package(gflags MODULE) - set(FOLLY_HAVE_LIBGFLAGS ${LIBGFLAGS_FOUND}) - if(LIBGFLAGS_FOUND) - list(APPEND FOLLY_LINK_LIBRARIES ${LIBGFLAGS_LIBRARY}) -@@ -61,12 +61,12 @@ if(LIBGFLAGS_FOUND) - set(FOLLY_LIBGFLAGS_INCLUDE ${LIBGFLAGS_INCLUDE_DIR}) ++set(FOLLY_HAVE_LIBGFLAGS ${gflags_FOUND}) ++if(gflags_FOUND) ++ list(APPEND FOLLY_LINK_LIBRARIES ${gflags_LIBRARIES}) ++ list(APPEND FOLLY_INCLUDE_DIRECTORIES ${gflags_INCLUDE_DIRS}) ++ set(FOLLY_LIBGFLAGS_LIBRARY ${gflags_LIBRARIES}) ++ set(FOLLY_LIBGFLAGS_INCLUDE ${gflags_INCLUDE_DIRS}) endif() -find_package(Glog MODULE) diff --git a/recipes/folly/all/test_package/CMakeLists.txt b/recipes/folly/all/test_package/CMakeLists.txt index 7ecfe43826b6f..6a9df4ea0b752 100644 --- a/recipes/folly/all/test_package/CMakeLists.txt +++ b/recipes/folly/all/test_package/CMakeLists.txt @@ -4,7 +4,9 @@ project(test_package CXX) find_package(folly REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Folly::folly) +target_link_libraries(${PROJECT_NAME} + Folly::folly + Folly::follybenchmark) if (${FOLLY_VERSION} VERSION_LESS "2021.07.20.00") diff --git a/recipes/folly/all/test_v1_package/conanfile.py b/recipes/folly/all/test_v1_package/conanfile.py index 46bc83449db7c..8b8cfae4c1882 100644 --- a/recipes/folly/all/test_v1_package/conanfile.py +++ b/recipes/folly/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/fontconfig/all/conandata.yml b/recipes/fontconfig/all/conandata.yml index 5044cb40ea10c..d4f92f5455a44 100644 --- a/recipes/fontconfig/all/conandata.yml +++ b/recipes/fontconfig/all/conandata.yml @@ -1,14 +1,7 @@ sources: - "2.13.93": - url: "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.13.93.tar.gz" - sha256: "0f302a18ee52dde0793fe38b266bf269dfe6e0c0ae140e30d72c6cca5dc08db5" "2.13.92": url: "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.13.92.tar.gz" sha256: "3406a05b83a42231e3df68d02bc0a0cf47b3f2e8f11c8ede62267daf5f130016" "2.13.91": url: "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.13.91.tar.gz" sha256: "19e5b1bc9d013a52063a44e1307629711f0bfef35b9aca16f9c793971e2eb1e5" -patches: - "2.13.93": - - patch_file: "patches/0001-meson-win32.patch" - base_path: "source_subfolder" diff --git a/recipes/fontconfig/all/conanfile.py b/recipes/fontconfig/all/conanfile.py index e2f97bddbdf34..f372086d95a23 100644 --- a/recipes/fontconfig/all/conanfile.py +++ b/recipes/fontconfig/all/conanfile.py @@ -1,12 +1,15 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools import files, scm, microsoft -from conans import tools, AutoToolsBuildEnvironment, Meson -import contextlib -import functools +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.50.2" +required_conan_version = ">=1.54.0" class FontconfigConan(ConanFile): @@ -26,149 +29,104 @@ class FontconfigConan(ConanFile): "fPIC": True, } - generators = "pkg_config" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("freetype/2.12.1") - self.requires("expat/2.4.8") + self.requires("expat/2.5.0") if self.settings.os == "Linux": self.requires("libuuid/1.0.3") def validate(self): - if microsoft.is_msvc(self) and scm.Version(self.version) < "2.13.93": + if is_msvc(self): raise ConanInvalidConfiguration("fontconfig does not support Visual Studio for versions < 2.13.93.") def build_requirements(self): - self.build_requires("gperf/3.1") - self.build_requires("pkgconf/1.7.4") - if microsoft.is_msvc(self): - self.build_requires("meson/0.63.1") - elif self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("gperf/3.1") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - files.get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), + tc.configure_args.extend([ + f"--enable-shared={yes_no(self.options.shared)}", + f"--enable-static={yes_no(not self.options.shared)}", "--disable-docs", "--disable-nls", - "--sysconfdir={}".format(tools.unix_path(os.path.join(self.package_folder, "bin", "etc"))), - "--datadir={}".format(tools.unix_path(os.path.join(self.package_folder, "bin", "share"))), - "--datarootdir={}".format(tools.unix_path(os.path.join(self.package_folder, "bin", "share"))), - "--localstatedir={}".format(tools.unix_path(os.path.join(self.package_folder, "bin", "var"))), - ] - autotools.configure(configure_dir=self._source_subfolder, args=args) - files.replace_in_file(self, "Makefile", "po-conf test", "po-conf") - return autotools - - @functools.lru_cache(1) - def _configure_meson(self): - meson = Meson(self) - meson.options["doc"] = "disabled" - meson.options["nls"] = "disabled" - meson.options["tests"] = "disabled" - meson.options["tools"] = "disabled" - meson.configure(source_folder=self._source_subfolder, build_folder=self._build_subfolder) - return meson + "--sysconfdir=${prefix}/bin/etc", + "--datadir=${prefix}/bin/share", + "--datarootdir=${prefix}/bin/share", + "--localstatedir=${prefix}/bin/var", + ]) + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() + deps = PkgConfigDeps(self) + deps.generate() def _patch_files(self): - files.apply_conandata_patches(self) # fontconfig requires libtool version number, change it for the corresponding freetype one - files.replace_in_file(self, os.path.join(self.install_folder, "freetype2.pc"), - "Version: {}".format(self.deps_cpp_info["freetype"].version), - "Version: {}".format(self.deps_user_info["freetype"].LIBTOOL_VERSION)) + replace_in_file( + self, os.path.join(self.generators_folder, "freetype2.pc"), + "Version: {}".format(self.dependencies["freetype"].ref.version), + "Version: {}".format(self.dependencies["freetype"].conf_info.get("user.freetype:libtool_version")), + ) # disable fc-cache test to enable cross compilation but also builds with shared libraries on MacOS - files.replace_in_file(self, - os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, + os.path.join(self.source_folder, "Makefile.in"), "@CROSS_COMPILING_TRUE@RUN_FC_CACHE_TEST = false", "RUN_FC_CACHE_TEST=false" ) - @contextlib.contextmanager - def _build_context(self): - if microsoft.is_msvc(self): - with tools.vcvars(self): - env = { - "CC": "cl", - "CXX": "cl", - "LD": "link", - "AR": "lib", - } - with tools.environment_append(env): - yield - else: - yield - def build(self): self._patch_files() - if microsoft.is_msvc(self): - with self._build_context(): - meson = self._configure_meson() - meson.build() - else: - # relocatable shared lib on macOS - files.replace_in_file(self, - os.path.join(self._source_subfolder, "configure"), - "-install_name \\$rpath/", - "-install_name @rpath/" - ) - with tools.run_environment(self): - autotools = self._configure_autotools() - autotools.make() + autotools = Autotools(self) + autotools.configure() + replace_in_file(self, os.path.join(self.build_folder, "Makefile"), "po-conf test", "po-conf") + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - if microsoft.is_msvc(self): - with self._build_context(): - meson = self._configure_meson() - meson.install() - if os.path.isfile(os.path.join(self.package_folder, "lib", "libfontconfig.a")): - files.rename(self, os.path.join(self.package_folder, "lib", "libfontconfig.a"), - os.path.join(self.package_folder, "lib", "fontconfig.lib")) - else: - with tools.run_environment(self): - autotools = self._configure_autotools() - autotools.install() - files.rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) - files.rm(self, "*.conf", os.path.join(self.package_folder, "bin", "etc", "fonts", "conf.d")) - files.rm(self, "*.def", os.path.join(self.package_folder, "lib")) - files.rm(self, "*.la", os.path.join(self.package_folder, "lib")) - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - files.rmdir(self, os.path.join(self.package_folder, "etc")) - files.rmdir(self, os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rm(self, "*.conf", os.path.join(self.package_folder, "bin", "etc", "fonts", "conf.d")) + rm(self, "*.def", os.path.join(self.package_folder, "lib")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -179,15 +137,14 @@ def package_info(self): if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.system_libs.extend(["m", "pthread"]) - self.cpp_info.names["cmake_find_package"] = "Fontconfig" - self.cpp_info.names["cmake_find_package_multi"] = "Fontconfig" - fontconfig_file = os.path.join(self.package_folder, "bin", "etc", "fonts", "fonts.conf") - self.output.info(f"Creating FONTCONFIG_FILE environment variable: {fontconfig_file}") self.runenv_info.prepend_path("FONTCONFIG_FILE", fontconfig_file) - self.env_info.FONTCONFIG_FILE = fontconfig_file # TODO: remove in conan v2? fontconfig_path = os.path.join(self.package_folder, "bin", "etc", "fonts") - self.output.info(f"Creating FONTCONFIG_PATH environment variable: {fontconfig_path}") self.runenv_info.prepend_path("FONTCONFIG_PATH", fontconfig_path) - self.env_info.FONTCONFIG_PATH = fontconfig_path # TODO: remove in conan v2? + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "Fontconfig" + self.cpp_info.names["cmake_find_package_multi"] = "Fontconfig" + self.env_info.FONTCONFIG_FILE = fontconfig_file + self.env_info.FONTCONFIG_PATH = fontconfig_path diff --git a/recipes/fontconfig/all/test_package/CMakeLists.txt b/recipes/fontconfig/all/test_package/CMakeLists.txt index b6e6cbcb01868..5def13d67bcff 100644 --- a/recipes/fontconfig/all/test_package/CMakeLists.txt +++ b/recipes/fontconfig/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.14) +project(test_package LANGUAGES C) find_package(Fontconfig REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} Fontconfig::Fontconfig) -set_target_properties(${PROJECT_NAME} PROPERTIES C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE Fontconfig::Fontconfig) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/fontconfig/all/test_package/conanfile.py b/recipes/fontconfig/all/test_package/conanfile.py index f66887c4fac91..98ab55852ad56 100644 --- a/recipes/fontconfig/all/test_package/conanfile.py +++ b/recipes/fontconfig/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fontconfig/all/test_v1_package/CMakeLists.txt b/recipes/fontconfig/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/fontconfig/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/fontconfig/all/test_v1_package/conanfile.py b/recipes/fontconfig/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/fontconfig/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/fontconfig/config.yml b/recipes/fontconfig/config.yml index 50284f29c712d..266274964008f 100644 --- a/recipes/fontconfig/config.yml +++ b/recipes/fontconfig/config.yml @@ -1,6 +1,6 @@ versions: "2.13.93": - folder: all + folder: meson "2.13.92": folder: all "2.13.91": diff --git a/recipes/fontconfig/meson/conandata.yml b/recipes/fontconfig/meson/conandata.yml new file mode 100644 index 0000000000000..e1bea51c30825 --- /dev/null +++ b/recipes/fontconfig/meson/conandata.yml @@ -0,0 +1,10 @@ +sources: + "2.13.93": + url: "https://www.freedesktop.org/software/fontconfig/release/fontconfig-2.13.93.tar.gz" + sha256: "0f302a18ee52dde0793fe38b266bf269dfe6e0c0ae140e30d72c6cca5dc08db5" +patches: + "2.13.93": + - patch_file: "patches/0001-meson-win32.patch" + patch_type: "portability" + patch_source: "https://gitlab.freedesktop.org/fontconfig/fontconfig/-/commit/7bfbaecf819a8b1630dfc8f56126e31f985d5fb3" + patch_description: "Windows: Fix symlink privilege error detection" diff --git a/recipes/fontconfig/meson/conanfile.py b/recipes/fontconfig/meson/conanfile.py new file mode 100644 index 0000000000000..e60f229ce0e62 --- /dev/null +++ b/recipes/fontconfig/meson/conanfile.py @@ -0,0 +1,142 @@ +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, copy, export_conandata_patches, get, + replace_in_file, rm, rmdir +) +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.scm import Version + +import os + +required_conan_version = ">=1.53.0" + + +class FontconfigConan(ConanFile): + name = "fontconfig" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + description = "Fontconfig is a library for configuring and customizing font access" + homepage = "https://gitlab.freedesktop.org/fontconfig/fontconfig" + topics = ("fonts", "freedesktop") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("freetype/2.12.1") + self.requires("expat/2.5.0") + if self.settings.os == "Linux": + self.requires("libuuid/1.0.3") + + def build_requirements(self): + self.tool_requires("gperf/3.1") + self.tool_requires("meson/1.0.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + deps = PkgConfigDeps(self) + deps.generate() + + tc = MesonToolchain(self) + tc.project_options.update({ + "doc": "disabled", + "nls": "disabled", + "tests": "disabled", + "tools": "disabled" + }) + tc.generate() + + def _patch_files(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), + "freetype_req = '>= 21.0.15'", + f"freetype_req = '{Version(self.dependencies['freetype'].ref.version)}'") + + def build(self): + self._patch_files() + meson = Meson(self) + meson.configure() + meson.build() + + def package(self): + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rm(self, "*.conf", os.path.join(self.package_folder, "bin", "etc", "fonts", "conf.d")) + rm(self, "*.def", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) + + def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "Fontconfig") + self.cpp_info.set_property("cmake_target_name", "Fontconfig::Fontconfig") + self.cpp_info.set_property("pkg_config_name", "fontconfig") + self.cpp_info.libs = ["fontconfig"] + if self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.system_libs.extend(["m", "pthread"]) + + fontconfig_file = os.path.join(self.package_folder, "bin", "etc", "fonts", "fonts.conf") + self.runenv_info.prepend_path("FONTCONFIG_FILE", fontconfig_file) + + fontconfig_path = os.path.join(self.package_folder, "bin", "etc", "fonts") + self.runenv_info.prepend_path("FONTCONFIG_PATH", fontconfig_path) + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "Fontconfig" + self.cpp_info.names["cmake_find_package_multi"] = "Fontconfig" + self.env_info.FONTCONFIG_FILE = fontconfig_file + self.env_info.FONTCONFIG_PATH = fontconfig_path + +def fix_msvc_libname(conanfile, remove_lib_prefix=True): + """remove lib prefix & change extension to .lib in case of cl like compiler""" + if not conanfile.settings.get_safe("compiler.runtime"): + return + from conan.tools.files import rename + import glob + libdirs = getattr(conanfile.cpp.package, "libdirs") + for libdir in libdirs: + for ext in [".dll.a", ".dll.lib", ".a"]: + full_folder = os.path.join(conanfile.package_folder, libdir) + for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")): + libname = os.path.basename(filepath)[0:-len(ext)] + if remove_lib_prefix and libname[0:3] == "lib": + libname = libname[3:] + rename(conanfile, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib")) diff --git a/recipes/fontconfig/all/patches/0001-meson-win32.patch b/recipes/fontconfig/meson/patches/0001-meson-win32.patch similarity index 100% rename from recipes/fontconfig/all/patches/0001-meson-win32.patch rename to recipes/fontconfig/meson/patches/0001-meson-win32.patch diff --git a/recipes/fontconfig/meson/test_package/CMakeLists.txt b/recipes/fontconfig/meson/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5def13d67bcff --- /dev/null +++ b/recipes/fontconfig/meson/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.14) +project(test_package LANGUAGES C) + +find_package(Fontconfig REQUIRED) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE Fontconfig::Fontconfig) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/fontconfig/meson/test_package/conanfile.py b/recipes/fontconfig/meson/test_package/conanfile.py new file mode 100644 index 0000000000000..42aa9d19c7fbe --- /dev/null +++ b/recipes/fontconfig/meson/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fontconfig/meson/test_package/test_package.c b/recipes/fontconfig/meson/test_package/test_package.c new file mode 100644 index 0000000000000..7703ab64bbdec --- /dev/null +++ b/recipes/fontconfig/meson/test_package/test_package.c @@ -0,0 +1,24 @@ +#include +#include +#include + +int main() { + FcConfig* config = FcInitLoadConfigAndFonts(); + FcPattern* pat = FcNameParse((const FcChar8*)"Arial"); + FcConfigSubstitute(config, pat, FcMatchPattern); + FcDefaultSubstitute(pat); + char* fontFile; + FcResult result; + FcPattern* font = FcFontMatch(config, pat, &result); + if (font) { + FcChar8* file = NULL; + if (FcPatternGetString(font, FC_FILE, 0, &file) == FcResultMatch) { + fontFile = (char*)file; + printf("%s\n",fontFile); + } + } else { + printf("Ops! I can't find any font!\n"); + } + FcPatternDestroy(pat); + return EXIT_SUCCESS; +} diff --git a/recipes/fontconfig/meson/test_v1_package/CMakeLists.txt b/recipes/fontconfig/meson/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9e65290cb3f89 --- /dev/null +++ b/recipes/fontconfig/meson/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/ +) diff --git a/recipes/fontconfig/meson/test_v1_package/conanfile.py b/recipes/fontconfig/meson/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/fontconfig/meson/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/foonathan-lexy/all/conandata.yml b/recipes/foonathan-lexy/all/conandata.yml new file mode 100644 index 0000000000000..98cd033191be3 --- /dev/null +++ b/recipes/foonathan-lexy/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "2022.12.1": + url: "https://github.com/foonathan/lexy/releases/download/v2022.12.1/lexy-src.zip" + sha256: "4c16efd31d03f908c7125352ebacbdb6c028de3788ca56940175e7017dbc6c7f" + "2022.12.00": + url: "https://github.com/foonathan/lexy/releases/download/v2022.12.0/lexy-src.zip" + sha256: "62afda502963abce28f051416b977dcc8f11581ba0773f4b1da39a9b4842b19d" + "2022.05.01": + url: "https://github.com/foonathan/lexy/releases/download/v2022.05.1/lexy-src.zip" + sha256: "de2199f8233ea5ed9d4dbe86a8eaf88d754decd28e28554329a7b29b4d952773" diff --git a/recipes/foonathan-lexy/all/conanfile.py b/recipes/foonathan-lexy/all/conanfile.py new file mode 100644 index 0000000000000..d95ef191b17a0 --- /dev/null +++ b/recipes/foonathan-lexy/all/conanfile.py @@ -0,0 +1,118 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rm, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.53.0" + +class FoonathanLexyConan(ConanFile): + name = "foonathan-lexy" + description = "lexy is a parser combinator library for C++17 and onwards." + license = "BSL-1.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/foonathan/lexy" + topics = ("parser", "parser-combinators", "grammar") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "10", + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if not self._cmake_new_enough("3.18"): + self.tool_requires("cmake/3.25.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LEXY_BUILD_EXAMPLES"] = False + tc.variables["LEXY_BUILD_TESTS"] = False + tc.variables["LEXY_BUILD_PACKAGE"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + # some files extensions and folders are not allowed. Please, read the FAQs to get informed. + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "lexy") + self.cpp_info.set_property("cmake_target_name", "foonathan::lexy") + + self.cpp_info.components["lexy_core"].set_property("cmake_target_name", "foonathan::lexy::lexy_core") + + self.cpp_info.components["lexy_file"].set_property("cmake_target_name", "foonathan::lexy::lexy_file") + self.cpp_info.components["lexy_file"].libs = ["lexy_file"] + + self.cpp_info.components["lexy_unicode"].set_property("cmake_target_name", "lexy::lexy_unicode") + self.cpp_info.components["lexy_unicode"].defines.append("LEXY_HAS_UNICODE_DATABASE=1") + + self.cpp_info.components["lexy_ext"].set_property("cmake_target_name", "lexy::lexy_ext") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "lexy" + self.cpp_info.filenames["cmake_find_package_multi"] = "lexy" + self.cpp_info.names["cmake_find_package"] = "foonathan" + self.cpp_info.names["cmake_find_package_multi"] = "foonathan" + self.cpp_info.components["foonathan"].names["cmake_find_package"] = "lexy" + self.cpp_info.components["foonathan"].names["cmake_find_package_multi"] = "lexy" diff --git a/recipes/foonathan-lexy/all/test_package/CMakeLists.txt b/recipes/foonathan-lexy/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..caf4fe13f8177 --- /dev/null +++ b/recipes/foonathan-lexy/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(lexy REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE foonathan::lexy) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/foonathan-lexy/all/test_package/conanfile.py b/recipes/foonathan-lexy/all/test_package/conanfile.py new file mode 100644 index 0000000000000..1111583fea732 --- /dev/null +++ b/recipes/foonathan-lexy/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/foonathan-lexy/all/test_package/test_package.cpp b/recipes/foonathan-lexy/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..6efe05caf5ed2 --- /dev/null +++ b/recipes/foonathan-lexy/all/test_package/test_package.cpp @@ -0,0 +1,43 @@ +#include + +#include +#include +#include +#include +#include + +struct Color +{ + std::uint8_t r, g, b; +}; + +namespace grammar +{ +namespace dsl = lexy::dsl; + +struct channel +{ + static constexpr auto rule = dsl::integer(dsl::n_digits<2, dsl::hex>); + static constexpr auto value = lexy::forward; +}; + +struct color +{ + static constexpr auto rule = dsl::hash_sign + dsl::times<3>(dsl::p); + static constexpr auto value = lexy::construct; +}; +} // namespace grammar + +int main() { + unsigned char array[] = {'#', '5', '5', 'A', 'A', '0', '5'}; + + auto input = lexy::string_input(array, array + 7); + auto result = lexy::parse(input, lexy_ext::report_error); + if (result.has_value()) + { + auto color = result.value(); + std::printf("#%02x%02x%02x\n", color.r, color.g, color.b); + } + + return result ? 0 : 1; +} diff --git a/recipes/foonathan-lexy/all/test_v1_package/CMakeLists.txt b/recipes/foonathan-lexy/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/foonathan-lexy/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/foonathan-lexy/all/test_v1_package/conanfile.py b/recipes/foonathan-lexy/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/foonathan-lexy/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/foonathan-lexy/config.yml b/recipes/foonathan-lexy/config.yml new file mode 100644 index 0000000000000..9b16b933ef1b6 --- /dev/null +++ b/recipes/foonathan-lexy/config.yml @@ -0,0 +1,7 @@ +versions: + "2022.12.1": + folder: all + "2022.12.00": + folder: all + "2022.05.01": + folder: all diff --git a/recipes/foonathan-memory/all/conandata.yml b/recipes/foonathan-memory/all/conandata.yml index 6d32734359ac0..5438e06adfb02 100644 --- a/recipes/foonathan-memory/all/conandata.yml +++ b/recipes/foonathan-memory/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.7.3": + url: "https://github.com/foonathan/memory/archive/refs/tags/v0.7-3.tar.gz" + sha256: "4203d15db22a94a3978eeb1afb59a37d35c57c0f148733f0f1a53a6281cb74dd" + "0.7.2": + url: "https://github.com/foonathan/memory/archive/refs/tags/v0.7-2.tar.gz" + sha256: "8aba7211bb0e59b7538decda453e492cc6e36f8781508ed92b38cbafe8a48762" "0.7.1": url: "https://github.com/foonathan/memory/archive/refs/tags/v0.7-1.tar.gz" sha256: "19eb61c5cba6ccc40b8ee741350fd29402a46641ba752c30b7079528d87dbc79" @@ -8,3 +14,5 @@ sources: patches: "0.7.0": - patch_file: "patches/0.7.0-0001-fix-virtualAllocFromApp.patch" + patch_description: "use VirtualAlloc on Desktop environment" + patch_type: "portability" diff --git a/recipes/foonathan-memory/all/conanfile.py b/recipes/foonathan-memory/all/conanfile.py index f33ee87c12f43..b341ffe0edc58 100644 --- a/recipes/foonathan-memory/all/conanfile.py +++ b/recipes/foonathan-memory/all/conanfile.py @@ -6,7 +6,7 @@ import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class FoonathanMemoryConan(ConanFile): @@ -43,7 +43,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): # FIXME: jenkins servers throw error with this combination diff --git a/recipes/foonathan-memory/all/test_v1_package/CMakeLists.txt b/recipes/foonathan-memory/all/test_v1_package/CMakeLists.txt index 196d155baea0c..9d54a092e0a67 100644 --- a/recipes/foonathan-memory/all/test_v1_package/CMakeLists.txt +++ b/recipes/foonathan-memory/all/test_v1_package/CMakeLists.txt @@ -4,8 +4,5 @@ project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(foonathan_memory REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE foonathan_memory) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/foonathan-memory/config.yml b/recipes/foonathan-memory/config.yml index 66110ce1bf566..d4d016ea9d423 100644 --- a/recipes/foonathan-memory/config.yml +++ b/recipes/foonathan-memory/config.yml @@ -1,4 +1,8 @@ versions: + "0.7.3": + folder: all + "0.7.2": + folder: all "0.7.1": folder: all "0.7.0": diff --git a/recipes/fp16/all/conandata.yml b/recipes/fp16/all/conandata.yml index 21f0e1bd08b32..cf80322a4b8bb 100644 --- a/recipes/fp16/all/conandata.yml +++ b/recipes/fp16/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "cci.20200514": - url: "https://github.com/Maratyszcza/FP16/archive/4dfe081cf6bcd15db339cf2680b9281b8451eeb3.zip" - sha256: "d973501a40c55126b31accc2d9f08d931ec3cc190c0430309a5e341d3c0ce32a" "cci.20210320": url: "https://github.com/Maratyszcza/FP16/archive/0a92994d729ff76a58f692d3028ca1b64b145d91.zip" sha256: "e66e65515fa09927b348d3d584c68be4215cfe664100d01c9dbc7655a5716d70" + "cci.20200514": + url: "https://github.com/Maratyszcza/FP16/archive/4dfe081cf6bcd15db339cf2680b9281b8451eeb3.zip" + sha256: "d973501a40c55126b31accc2d9f08d931ec3cc190c0430309a5e341d3c0ce32a" diff --git a/recipes/fp16/all/conanfile.py b/recipes/fp16/all/conanfile.py index 971e7f2d0585d..75666c9f3bd71 100644 --- a/recipes/fp16/all/conanfile.py +++ b/recipes/fp16/all/conanfile.py @@ -1,33 +1,41 @@ -from conans import ConanFile, tools -import glob +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.52.0" + class Fp16Conan(ConanFile): name = "fp16" description = "Conversion to/from half-precision floating point formats." license = "MIT" - topics = ("conan", "fp16", "half-precision-floating-point") + topics = ("half-precision-floating-point") homepage = "https://github.com/Maratyszcza/FP16" url = "https://github.com/conan-io/conan-center-index" - + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("psimd/cci.20200517") + self.requires("psimd/cci.20200517", transitive_headers=True) def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("FP16-*")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/fp16/all/test_package/CMakeLists.txt b/recipes/fp16/all/test_package/CMakeLists.txt index fd126a732c403..1e502f0857d7c 100644 --- a/recipes/fp16/all/test_package/CMakeLists.txt +++ b/recipes/fp16/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(fp16 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE fp16::fp16) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/fp16/all/test_package/conanfile.py b/recipes/fp16/all/test_package/conanfile.py index 5216332f39f5c..0a6bc68712d90 100644 --- a/recipes/fp16/all/test_package/conanfile.py +++ b/recipes/fp16/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fp16/all/test_v1_package/CMakeLists.txt b/recipes/fp16/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..d609dc2f83e68 --- /dev/null +++ b/recipes/fp16/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(fp16 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE fp16::fp16) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/fp16/all/test_v1_package/conanfile.py b/recipes/fp16/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/fp16/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/fp16/config.yml b/recipes/fp16/config.yml index 5fda81fa041c9..97367a08f7fea 100644 --- a/recipes/fp16/config.yml +++ b/recipes/fp16/config.yml @@ -1,5 +1,5 @@ versions: - "cci.20200514": - folder: all "cci.20210320": folder: all + "cci.20200514": + folder: all diff --git a/recipes/freeglut/all/conandata.yml b/recipes/freeglut/all/conandata.yml index 23cb4c420e8a3..1b8ca276b4eda 100644 --- a/recipes/freeglut/all/conandata.yml +++ b/recipes/freeglut/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.2": + sha256: "c5944a082df0bba96b5756dddb1f75d0cd72ce27b5395c6c1dde85c2ff297a50" + url: "https://github.com/FreeGLUTProject/freeglut/releases/download/v3.2.2/freeglut-3.2.2.tar.gz" "3.2.1": sha256: "d4000e02102acaf259998c870e25214739d1f16f67f99cb35e4f46841399da68" - url: "http://downloads.sourceforge.net/freeglut/freeglut/freeglut-3.2.1.tar.gz" + url: "https://github.com/FreeGLUTProject/freeglut/releases/download/v3.2.1/freeglut-3.2.1.tar.gz" diff --git a/recipes/freeglut/all/conanfile.py b/recipes/freeglut/all/conanfile.py index e5c9e6fa2e2ed..4fbf2e2eb4cf5 100644 --- a/recipes/freeglut/all/conanfile.py +++ b/recipes/freeglut/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.scm import Version +from conan.tools.files import get, rmdir, collect_libs +from conans import CMake import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.47.0" class freeglutConan(ConanFile): @@ -44,8 +47,6 @@ def _build_subfolder(self): def export_sources(self): self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) def config_options(self): if self.settings.os == "Windows": @@ -69,13 +70,14 @@ def validate(self): # and https://sourceforge.net/p/freeglut/bugs/218/ # also, it seems to require `brew cask install xquartz` raise ConanInvalidConfiguration("%s does not support macos" % self.name) - if (self.settings.compiler == "gcc" and self.settings.compiler.version >= tools.Version("10.0")) or \ - (self.settings.compiler == "clang" and self.settings.compiler.version >= tools.Version("11.0")): - # see https://github.com/dcnieho/FreeGLUT/issues/86 - raise ConanInvalidConfiguration("%s does not support gcc >= 10 and clang >= 11" % self.name) + if Version(self.version) < "3.2.2": + if (self.settings.compiler == "gcc" and Version(self.settings.compiler.version) >= "10.0") or \ + (self.settings.compiler == "clang" and Version(self.settings.compiler.version) >= "11.0"): + # see https://github.com/dcnieho/FreeGLUT/issues/86 + raise ConanInvalidConfiguration("%s does not support gcc >= 10 and clang >= 11" % self.name) def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def _configure_cmake(self): @@ -107,8 +109,8 @@ def package(self): self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) cmake = self._configure_cmake() cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): config_target = "freeglut" if self.options.shared else "freeglut_static" @@ -122,7 +124,7 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", pkg_config) # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["freeglut_"].libs = tools.collect_libs(self) + self.cpp_info.components["freeglut_"].libs = collect_libs(self) if self.settings.os == "Linux": self.cpp_info.components["freeglut_"].system_libs.extend(["pthread", "m", "dl", "rt"]) elif self.settings.os == "Windows": diff --git a/recipes/freeglut/config.yml b/recipes/freeglut/config.yml index c09805f11822d..31ef026aaa09c 100644 --- a/recipes/freeglut/config.yml +++ b/recipes/freeglut/config.yml @@ -1,3 +1,5 @@ versions: + "3.2.2": + folder: all "3.2.1": folder: all diff --git a/recipes/freeimage/all/conanfile.py b/recipes/freeimage/all/conanfile.py index 44eea75a589aa..11a3b438484c7 100644 --- a/recipes/freeimage/all/conanfile.py +++ b/recipes/freeimage/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class FreeImageConan(ConanFile): @@ -14,13 +14,14 @@ class FreeImageConan(ConanFile): homepage = "https://freeimage.sourceforge.io" url = "https://github.com/conan-io/conan-center-index" license = "FreeImage", "GPL-3.0-or-later", "GPL-2.0-or-later" - topics = ("freeimage", "image", "decoding", "graphics") + topics = ("image", "decoding", "graphics") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_jpeg": [False, "libjpeg", "libjpeg-turbo"], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], "with_png": [True, False], "with_tiff": [True, False], "with_jpeg2000": [True, False], @@ -48,8 +49,7 @@ class FreeImageConan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -57,28 +57,34 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - self.output.warn("G3 plugin and JPEGTransform are disabled.") + self.options.rm_safe("fPIC") + self.output.warning("G3 plugin and JPEGTransform are disabled.") if bool(self.options.with_jpeg): if self.options.with_tiff: self.options["libtiff"].jpeg = self.options.with_jpeg + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_jpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.4") + self.requires("libjpeg-turbo/2.1.5") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") if self.options.with_jpeg2000: self.requires("openjpeg/2.5.0") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_webp: - self.requires("libwebp/1.2.4") + self.requires("libwebp/1.3.0") if self.options.with_tiff or self.options.with_openexr: # can't upgrade to openexr/3.x.x because plugin tiff requires openexr/2.x.x header files self.requires("openexr/2.5.7") if self.options.with_raw: + # can't upgrade to libraw >= 0.21 (error: no member named 'shot_select' in 'libraw_output_params_t') self.requires("libraw/0.20.2") if self.options.with_jxr: self.requires("jxrlib/cci.20170615") @@ -86,20 +92,16 @@ def requirements(self): self.requires("libtiff/4.4.0") def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, "11") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) tc.variables["FREEIMAGE_FOLDER"] = self.source_folder.replace("\\", "/") - tc.variables["FREEIMAGE_WITH_JPEG"] = self.options.with_jpeg != False + tc.variables["FREEIMAGE_WITH_JPEG"] = bool(self.options.with_jpeg) tc.variables["FREEIMAGE_WITH_OPENJPEG"] = self.options.with_jpeg2000 tc.variables["FREEIMAGE_WITH_PNG"] = self.options.with_png tc.variables["FREEIMAGE_WITH_WEBP"] = self.options.with_webp @@ -137,8 +139,12 @@ def package_info(self): def imageformats_deps(): components = [] components.append("zlib::zlib") - if self.options.with_jpeg: - components.append("{0}::{0}".format(self.options.with_jpeg)) + if self.options.with_jpeg == "libjpeg": + components.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + components.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + components.append("mozjpeg::libjpeg") if self.options.with_jpeg2000: components.append("openjpeg::openjpeg") if self.options.with_png: diff --git a/recipes/freeimage/all/patches/014_no_auto_ptr.patch b/recipes/freeimage/all/patches/014_no_auto_ptr.patch index 31d357cd93617..7118f0a2f320f 100644 --- a/recipes/freeimage/all/patches/014_no_auto_ptr.patch +++ b/recipes/freeimage/all/patches/014_no_auto_ptr.patch @@ -1,5 +1,5 @@ ---- /Source/FreeImage/MultiPage.cpp -+++ /Source/FreeImage/MultiPage.cpp +--- a/Source/FreeImage/MultiPage.cpp ++++ b/Source/FreeImage/MultiPage.cpp @@ -271,8 +271,8 @@ FreeImage_OpenMultiBitmap(FREE_IMAGE_FORMAT fif, const char *filename, BOOL crea } } diff --git a/recipes/freeimage/all/test_package/conanfile.py b/recipes/freeimage/all/test_package/conanfile.py index de9c0e321b02f..9f97d7f9f47a9 100644 --- a/recipes/freeimage/all/test_package/conanfile.py +++ b/recipes/freeimage/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,20 +7,21 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") bees = os.path.join(self.source_folder, "test.png") self.run(f"{bin_path} {bees}", env="conanrun") diff --git a/recipes/freeimage/all/test_v1_package/CMakeLists.txt b/recipes/freeimage/all/test_v1_package/CMakeLists.txt index 194a54c3b3a89..0d20897301b68 100644 --- a/recipes/freeimage/all/test_v1_package/CMakeLists.txt +++ b/recipes/freeimage/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(freeimage REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE freeimage::freeimage) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/freetype/all/CMakeLists.txt b/recipes/freetype/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/freetype/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/freetype/all/conandata.yml b/recipes/freetype/all/conandata.yml index d87a9087670e2..ba0c7f323c387 100644 --- a/recipes/freetype/all/conandata.yml +++ b/recipes/freetype/all/conandata.yml @@ -1,19 +1,26 @@ sources: + "2.13.0": + url: + - "https://download.savannah.gnu.org/releases/freetype/freetype-2.13.0.tar.xz" + - "https://sourceforge.net/projects/freetype/files/freetype2/2.13.0/freetype-2.13.0.tar.xz" + sha256: "5ee23abd047636c24b2d43c6625dcafc66661d1aca64dec9e0d05df29592624c" "2.12.1": - url: [ - "https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.gz", - "https://sourceforge.net/projects/freetype/files/freetype2/2.12.1/freetype-2.12.1.tar.gz/download", - ] - sha256: "efe71fd4b8246f1b0b1b9bfca13cfff1c9ad85930340c27df469733bbb620938" + url: + - "https://download.savannah.gnu.org/releases/freetype/freetype-2.12.1.tar.xz" + - "https://sourceforge.net/projects/freetype/files/freetype2/2.12.1/freetype-2.12.1.tar.xz" + sha256: "4766f20157cc4cf0cd292f80bf917f92d1c439b243ac3018debf6b9140c41a7f" "2.11.1": - url: [ - "https://download.savannah.gnu.org/releases/freetype/freetype-2.11.1.tar.gz", - "https://sourceforge.net/projects/freetype/files/freetype2/2.11.1/freetype-2.11.1.tar.gz/download", - ] - sha256: "f8db94d307e9c54961b39a1cc799a67d46681480696ed72ecf78d4473770f09b" + url: + - "https://download.savannah.gnu.org/releases/freetype/freetype-2.11.1.tar.xz" + - "https://sourceforge.net/projects/freetype/files/freetype2/2.11.1/freetype-2.11.1.tar.xz" + sha256: "3333ae7cfda88429c97a7ae63b7d01ab398076c3b67182e960e5684050f2c5c8" "2.10.4": - url: [ - "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.4.tar.gz", - "https://sourceforge.net/projects/freetype/files/freetype2/2.10.4/freetype-2.10.4.tar.gz/download", - ] - sha256: "5eab795ebb23ac77001cfb68b7d4d50b5d6c7469247b0b01b2c953269f658dac" + url: + - "https://download.savannah.gnu.org/releases/freetype/freetype-2.10.4.tar.xz" + - "https://sourceforge.net/projects/freetype/files/freetype2/2.10.4/freetype-2.10.4.tar.xz" + sha256: "86a854d8905b19698bbc8f23b860bc104246ce4854dcea8e3b0fb21284f75784" +patches: + "2.13.0": + - patch_file: "patches/2.13.0-0001-fix-fallthrough.patch" + patch_description: "Fix FALL_THROUGH macro for clang 10 & 11" + patch_type: "portability" diff --git a/recipes/freetype/all/conanfile.py b/recipes/freetype/all/conanfile.py index ed2932bf3082b..d7628440e1cc7 100644 --- a/recipes/freetype/all/conanfile.py +++ b/recipes/freetype/all/conanfile.py @@ -1,12 +1,15 @@ from conan import ConanFile -from conan.tools import files, scm -from conans import CMake, tools +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import ( + apply_conandata_patches, collect_libs, copy, export_conandata_patches, load, + get, rename, replace_in_file, rmdir, save +) +from conan.tools.scm import Version import os import re -import shutil import textwrap -required_conan_version = ">=1.50.2" +required_conan_version = ">=1.53.0" class FreetypeConan(ConanFile): @@ -37,21 +40,12 @@ class FreetypeConan(ConanFile): "subpixel": False } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _has_with_brotli_option(self): - return scm.Version(self.version) >= "2.10.2" + return Version(self.version) >= "2.10.2" + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -61,93 +55,111 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_bzip2: self.requires("bzip2/1.0.8") if self.options.get_safe("with_brotli"): self.requires("brotli/1.0.9") def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + + tc = CMakeToolchain(self) + if Version(self.version) >= "2.11.0": + tc.variables["FT_REQUIRE_ZLIB"] = self.options.with_zlib + tc.variables["FT_DISABLE_ZLIB"] = not self.options.with_zlib + tc.variables["FT_REQUIRE_PNG"] = self.options.with_png + tc.variables["FT_DISABLE_PNG"] = not self.options.with_png + tc.variables["FT_REQUIRE_BZIP2"] = self.options.with_bzip2 + tc.variables["FT_DISABLE_BZIP2"] = not self.options.with_bzip2 + # TODO: Harfbuzz can be added as an option as soon as it is available. + tc.variables["FT_REQUIRE_HARFBUZZ"] = False + tc.variables["FT_DISABLE_HARFBUZZ"] = True + if self._has_with_brotli_option: + tc.variables["FT_REQUIRE_BROTLI"] = self.options.with_brotli + tc.variables["FT_DISABLE_BROTLI"] = not self.options.with_brotli + else: + tc.variables["FT_WITH_ZLIB"] = self.options.with_zlib + tc.variables["FT_WITH_PNG"] = self.options.with_png + tc.variables["FT_WITH_BZIP2"] = self.options.with_bzip2 + # TODO: Harfbuzz can be added as an option as soon as it is available. + tc.variables["FT_WITH_HARFBUZZ"] = False + if self._has_with_brotli_option: + tc.variables["FT_WITH_BROTLI"] = self.options.with_brotli + # Generate a relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() def _patch_sources(self): + apply_conandata_patches(self) # Do not accidentally enable dependencies we have disabled - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - find_harfbuzz = "find_package(HarfBuzz {})".format("1.3.0" if scm.Version(self.version) < "2.10.2" else "${HARFBUZZ_MIN_VERSION}") - if_harfbuzz_found = "if ({})".format("HARFBUZZ_FOUND" if scm.Version(self.version) < "2.11.0" else "HarfBuzz_FOUND") - tools.replace_in_file(cmakelists, find_harfbuzz, "") - tools.replace_in_file(cmakelists, if_harfbuzz_found, "if(0)") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + find_harfbuzz = "find_package(HarfBuzz {})".format("1.3.0" if Version(self.version) < "2.10.2" else "${HARFBUZZ_MIN_VERSION}") + if_harfbuzz_found = "if ({})".format("HARFBUZZ_FOUND" if Version(self.version) < "2.11.0" else "HarfBuzz_FOUND") + replace_in_file(self, cmakelists, find_harfbuzz, "") + replace_in_file(self, cmakelists, if_harfbuzz_found, "if(0)") if not self.options.with_png: - tools.replace_in_file(cmakelists, "find_package(PNG)", "") - tools.replace_in_file(cmakelists, "if (PNG_FOUND)", "if(0)") + replace_in_file(self, cmakelists, "find_package(PNG)", "") + replace_in_file(self, cmakelists, "if (PNG_FOUND)", "if(0)") if not self.options.with_zlib: - tools.replace_in_file(cmakelists, "find_package(ZLIB)", "") - tools.replace_in_file(cmakelists, "if (ZLIB_FOUND)", "if(0)") + replace_in_file(self, cmakelists, "find_package(ZLIB)", "") + replace_in_file(self, cmakelists, "if (ZLIB_FOUND)", "if(0)") if not self.options.with_bzip2: - tools.replace_in_file(cmakelists, "find_package(BZip2)", "") - tools.replace_in_file(cmakelists, "if (BZIP2_FOUND)", "if(0)") + replace_in_file(self, cmakelists, "find_package(BZip2)", "") + replace_in_file(self, cmakelists, "if (BZIP2_FOUND)", "if(0)") if self._has_with_brotli_option: # the custom FindBrotliDec of upstream is too fragile - tools.replace_in_file(cmakelists, + replace_in_file(self, cmakelists, "find_package(BrotliDec REQUIRED)", "find_package(Brotli REQUIRED)\n" "set(BROTLIDEC_FOUND 1)\n" - "set(BROTLIDEC_LIBRARIES \"Brotli::Brotli\")") + "set(BROTLIDEC_LIBRARIES \"brotli::brotli\")") if not self.options.with_brotli: - tools.replace_in_file(cmakelists, "find_package(BrotliDec)", "") - tools.replace_in_file(cmakelists, "if (BROTLIDEC_FOUND)", "if(0)") + replace_in_file(self, cmakelists, "find_package(BrotliDec)", "") + replace_in_file(self, cmakelists, "if (BROTLIDEC_FOUND)", "if(0)") - config_h = os.path.join(self._source_subfolder, "include", "freetype", "config", "ftoption.h") + config_h = os.path.join(self.source_folder, "include", "freetype", "config", "ftoption.h") if self.options.subpixel: - tools.replace_in_file(config_h, "/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */", "#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["FT_WITH_ZLIB"] = self.options.with_zlib - self._cmake.definitions["FT_WITH_PNG"] = self.options.with_png - self._cmake.definitions["FT_WITH_BZIP2"] = self.options.with_bzip2 - # TODO: Harfbuzz can be added as an option as soon as it is available. - self._cmake.definitions["FT_WITH_HARFBUZZ"] = False - if self._has_with_brotli_option: - self._cmake.definitions["FT_WITH_BROTLI"] = self.options.with_brotli - # Generate a relocatable shared lib on Macos - self._cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - self._cmake.configure(build_dir=self._build_subfolder) - return self._cmake + replace_in_file(self, config_h, "/* #define FT_CONFIG_OPTION_SUBPIXEL_RENDERING */", "#define FT_CONFIG_OPTION_SUBPIXEL_RENDERING") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def _make_freetype_config(self, version): - freetype_config_in = os.path.join(self._source_subfolder, "builds", "unix", "freetype-config.in") + freetype_config_in = os.path.join(self.source_folder, "builds", "unix", "freetype-config.in") if not os.path.isdir(os.path.join(self.package_folder, "bin")): os.makedirs(os.path.join(self.package_folder, "bin")) freetype_config = os.path.join(self.package_folder, "bin", "freetype-config") - shutil.copy(freetype_config_in, freetype_config) + rename(self, freetype_config_in, freetype_config) libs = "-lfreetyped" if self.settings.build_type == "Debug" else "-lfreetype" staticlibs = f"-lm {libs}" if self.settings.os == "Linux" else libs - tools.replace_in_file(freetype_config, r"%PKG_CONFIG%", r"/bin/false") # never use pkg-config - tools.replace_in_file(freetype_config, r"%prefix%", r"$conan_prefix") - tools.replace_in_file(freetype_config, r"%exec_prefix%", r"$conan_exec_prefix") - tools.replace_in_file(freetype_config, r"%includedir%", r"$conan_includedir") - tools.replace_in_file(freetype_config, r"%libdir%", r"$conan_libdir") - tools.replace_in_file(freetype_config, r"%ft_version%", r"$conan_ftversion") - tools.replace_in_file(freetype_config, r"%LIBSSTATIC_CONFIG%", r"$conan_staticlibs") - tools.replace_in_file(freetype_config, r"-lfreetype", libs) - tools.replace_in_file(freetype_config, r"export LC_ALL", textwrap.dedent("""\ + replace_in_file(self, freetype_config, r"%PKG_CONFIG%", r"/bin/false") # never use pkg-config + replace_in_file(self, freetype_config, r"%prefix%", r"$conan_prefix") + replace_in_file(self, freetype_config, r"%exec_prefix%", r"$conan_exec_prefix") + replace_in_file(self, freetype_config, r"%includedir%", r"$conan_includedir") + replace_in_file(self, freetype_config, r"%libdir%", r"$conan_libdir") + replace_in_file(self, freetype_config, r"%ft_version%", r"$conan_ftversion") + replace_in_file(self, freetype_config, r"%LIBSSTATIC_CONFIG%", r"$conan_staticlibs") + replace_in_file(self, freetype_config, r"-lfreetype", libs) + replace_in_file(self, freetype_config, r"export LC_ALL", textwrap.dedent("""\ export LC_ALL BINDIR=$(dirname $0) conan_prefix=$(dirname $BINDIR) @@ -159,7 +171,7 @@ def _make_freetype_config(self, version): """).format(version=version, staticlibs=staticlibs)) def _extract_libtool_version(self): - conf_raw = tools.load(os.path.join(self._source_subfolder, "builds", "unix", "configure.raw")) + conf_raw = load(self, os.path.join(self.source_folder, "builds", "unix", "configure.raw")) return next(re.finditer(r"^version_info='([0-9:]+)'", conf_raw, flags=re.M)).group(1).replace(":", ".") @property @@ -167,19 +179,21 @@ def _libtool_version_txt(self): return os.path.join(self.package_folder, "res", "freetype-libtool-version.txt") def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() libtool_version = self._extract_libtool_version() - tools.save(self._libtool_version_txt, libtool_version) + save(self, self._libtool_version_txt, libtool_version) self._make_freetype_config(libtool_version) - self.copy("FTL.TXT", src=os.path.join(self._source_subfolder, "docs"), dst="licenses") - self.copy("GPLv2.TXT", src=os.path.join(self._source_subfolder, "docs"), dst="licenses") - self.copy("LICENSE.TXT", src=os.path.join(self._source_subfolder, "docs"), dst="licenses") + doc_folder = os.path.join(self.source_folder, "docs") + license_folder = os.path.join(self.package_folder, "licenses") + copy(self, "FTL.TXT", doc_folder, license_folder) + copy(self, "GPLv2.TXT", doc_folder, license_folder) + copy(self, "LICENSE.TXT", doc_folder, license_folder) - files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_vars_rel_path) ) @@ -188,12 +202,9 @@ def package(self): {"freetype": "Freetype::Freetype"} ) - @staticmethod - def _create_cmake_module_variables(module_file): + def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ - if(DEFINED Freetype_FOUND) - set(FREETYPE_FOUND ${Freetype_FOUND}) - endif() + set(FREETYPE_FOUND TRUE) if(DEFINED Freetype_INCLUDE_DIRS) set(FREETYPE_INCLUDE_DIRS ${Freetype_INCLUDE_DIRS}) endif() @@ -204,10 +215,9 @@ def _create_cmake_module_variables(module_file): set(FREETYPE_VERSION_STRING ${Freetype_VERSION}) endif() """) - tools.save(module_file, content) + save(self, module_file, content) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -216,21 +226,15 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) - - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake") + save(self, module_file, content) @property def _module_vars_rel_path(self): - return os.path.join(self._module_subfolder, - f"conan-official-{self.name}-variables.cmake") + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") @property def _module_target_rel_path(self): - return os.path.join(self._module_subfolder, - f"conan-official-{self.name}-targets.cmake") + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @staticmethod def _chmod_plus_x(filename): @@ -243,20 +247,15 @@ def package_info(self): self.cpp_info.set_property("cmake_module_target_name", "Freetype::Freetype") self.cpp_info.set_property("cmake_file_name", "freetype") self.cpp_info.set_property("cmake_target_name", "freetype") - self.cpp_info.builddirs.append(self._module_subfolder) self.cpp_info.set_property("cmake_build_modules", [self._module_vars_rel_path]) self.cpp_info.set_property("pkg_config_name", "freetype2") - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") self.cpp_info.includedirs.append(os.path.join("include", "freetype2")) - freetype_config = os.path.join(self.package_folder, "bin", "freetype-config") - self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) - self.env_info.FT2_CONFIG = freetype_config - self._chmod_plus_x(freetype_config) - libtool_version = tools.load(self._libtool_version_txt).strip() - self.user_info.LIBTOOL_VERSION = libtool_version + libtool_version = load(self, self._libtool_version_txt).strip() + self.conf_info.define("user.freetype:libtool_version", libtool_version) # FIXME: need to do override the pkg_config version (pkg_config_custom_content does not work) # self.cpp_info.version["pkg_config"] = pkg_config_version @@ -268,3 +267,8 @@ def package_info(self): self.cpp_info.build_modules["cmake_find_package"] = [self._module_vars_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_target_rel_path] self.cpp_info.names["pkg_config"] = "freetype2" + freetype_config = os.path.join(self.package_folder, "bin", "freetype-config") + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.FT2_CONFIG = freetype_config + self._chmod_plus_x(freetype_config) + self.user_info.LIBTOOL_VERSION = libtool_version diff --git a/recipes/freetype/all/patches/2.13.0-0001-fix-fallthrough.patch b/recipes/freetype/all/patches/2.13.0-0001-fix-fallthrough.patch new file mode 100644 index 0000000000000..0386998dea7bb --- /dev/null +++ b/recipes/freetype/all/patches/2.13.0-0001-fix-fallthrough.patch @@ -0,0 +1,13 @@ +--- a/include/freetype/internal/compiler-macros.h ++++ b/include/freetype/internal/compiler-macros.h +@@ -42,8 +42,8 @@ FT_BEGIN_HEADER + ( defined( __cplusplus ) && __cplusplus > 201402L ) + # define FALL_THROUGH [[__fallthrough__]] + # elif ( defined( __GNUC__ ) && __GNUC__ >= 7 ) || \ +- ( defined( __clang__ ) && __clang_major__ >= 10 ) +-# define FALL_THROUGH __attribute__(( __fallthrough__ )) ++ ( defined( __clang__ ) && __clang_major__ >= 12 ) ++# define FALL_THROUGH __attribute__((fallthrough)) + # else + # define FALL_THROUGH ( (void)0 ) + # endif diff --git a/recipes/freetype/all/test_package/CMakeLists.txt b/recipes/freetype/all/test_package/CMakeLists.txt index 8fe0c73fa6337..9ac9bd88e8a63 100644 --- a/recipes/freetype/all/test_package/CMakeLists.txt +++ b/recipes/freetype/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(Freetype REQUIRED) +find_package(freetype REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} Freetype::Freetype) +target_link_libraries(${PROJECT_NAME} PRIVATE freetype) diff --git a/recipes/freetype/all/test_package/conanfile.py b/recipes/freetype/all/test_package/conanfile.py index e301073d04822..5da019d033eb1 100644 --- a/recipes/freetype/all/test_package/conanfile.py +++ b/recipes/freetype/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") font_path = os.path.join(self.source_folder, "OpenSans-Bold.ttf") - self.run("{} {}".format(bin_path, font_path), run_environment=True) + self.run(f"{bin_path} {font_path}", env="conanrun") diff --git a/recipes/freetype/all/test_package_module/CMakeLists.txt b/recipes/freetype/all/test_package_module/CMakeLists.txt new file mode 100644 index 0000000000000..3a9f9ffa7c630 --- /dev/null +++ b/recipes/freetype/all/test_package_module/CMakeLists.txt @@ -0,0 +1,23 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(Freetype REQUIRED MODULE) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE Freetype::Freetype) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindFreetype.html +# are properly defined in conan generators +set(_custom_vars + FREETYPE_FOUND + FREETYPE_INCLUDE_DIRS + FREETYPE_LIBRARIES + FREETYPE_VERSION_STRING +) +foreach(_custom_var ${_custom_vars}) + if(DEFINED _custom_var) + message(STATUS "${_custom_var}: ${${_custom_var}}") + else() + message(FATAL_ERROR "${_custom_var} not defined") + endif() +endforeach() diff --git a/recipes/freetype/all/test_package_module/conanfile.py b/recipes/freetype/all/test_package_module/conanfile.py new file mode 100644 index 0000000000000..e789c017730b3 --- /dev/null +++ b/recipes/freetype/all/test_package_module/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + font_path = os.path.join(self.source_folder, os.pardir, "test_package", "OpenSans-Bold.ttf") + self.run(f"{bin_path} {font_path}", env="conanrun") diff --git a/recipes/freetype/all/test_v1_package/CMakeLists.txt b/recipes/freetype/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/freetype/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/freetype/all/test_v1_package/conanfile.py b/recipes/freetype/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..da2d908b1d4a7 --- /dev/null +++ b/recipes/freetype/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + font_path = os.path.join(self.source_folder, os.pardir, "test_package", "OpenSans-Bold.ttf") + self.run(f"{bin_path} {font_path}", run_environment=True) diff --git a/recipes/freetype/all/test_v1_package_module/CMakeLists.txt b/recipes/freetype/all/test_v1_package_module/CMakeLists.txt new file mode 100644 index 0000000000000..27f7a57e7a0b3 --- /dev/null +++ b/recipes/freetype/all/test_v1_package_module/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package_module + ${CMAKE_CURRENT_BINARY_DIR}/test_package_module) diff --git a/recipes/freetype/all/test_v1_package_module/conanfile.py b/recipes/freetype/all/test_v1_package_module/conanfile.py new file mode 100644 index 0000000000000..7834358365541 --- /dev/null +++ b/recipes/freetype/all/test_v1_package_module/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + font_path = os.path.join(self.source_folder, os.pardir, "test_package", "OpenSans-Bold.ttf") + self.run(f"{bin_path} {font_path}", run_environment=True) diff --git a/recipes/freetype/config.yml b/recipes/freetype/config.yml index 3617de8da17d5..03088d905ff89 100644 --- a/recipes/freetype/config.yml +++ b/recipes/freetype/config.yml @@ -1,4 +1,6 @@ versions: + "2.13.0": + folder: all "2.12.1": folder: all "2.11.1": diff --git a/recipes/freexl/all/conandata.yml b/recipes/freexl/all/conandata.yml index cad6629b77bd2..1ded763735f94 100644 --- a/recipes/freexl/all/conandata.yml +++ b/recipes/freexl/all/conandata.yml @@ -8,9 +8,6 @@ sources: patches: "1.0.6": - patch_file: "patches/fix-nmake-1.0.6.patch" - base_path: "source_subfolder" "1.0.5": - patch_file: "patches/fix-nmake-1.0.5.patch" - base_path: "source_subfolder" - patch_file: "patches/msvc-round-lround.patch" - base_path: "source_subfolder" diff --git a/recipes/freexl/all/conanfile.py b/recipes/freexl/all/conanfile.py index 008d173e58af5..794b52fdc98a5 100644 --- a/recipes/freexl/all/conanfile.py +++ b/recipes/freexl/all/conanfile.py @@ -1,9 +1,14 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment, tools -import functools +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, NMakeDeps, NMakeToolchain import os -import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.55.0" class FreexlConan(ConanFile): @@ -11,7 +16,7 @@ class FreexlConan(ConanFile): description = "FreeXL is an open source library to extract valid data " \ "from within an Excel (.xls) spreadsheet." license = ["MPL-1.0", "GPL-2.0-only", "LGPL-2.1-only"] - topics = ("freexl", "excel", "xls") + topics = ("excel", "xls") homepage = "https://www.gaia-gis.it/fossil/freexl/index" url = "https://github.com/conan-io/conan-center-index" @@ -25,25 +30,12 @@ class FreexlConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,74 +43,77 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("libiconv/1.16") + self.requires("libiconv/1.17") def build_requirements(self): - if not self._is_msvc: - self.build_requires("gnu-config/cci.20201022") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not is_msvc(self): + self.tool_requires("gnu-config/cci.20210814") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + deps = NMakeDeps(self) + deps.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - if self._is_msvc: - self._build_msvc() + apply_conandata_patches(self) + if is_msvc(self): + args = "freexl_i.lib FREEXL_EXPORT=-DDLL_EXPORT" if self.options.shared else "freexl.lib" + with chdir(self, self.source_folder): + self.run(f"nmake -f makefile.vc {args}") else: - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - # relocatable shared lib on macOS - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "-install_name \\$rpath/", - "-install_name @rpath/") - autotools = self._configure_autotools() + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) + autotools = Autotools(self) + autotools.configure() autotools.make() - def _build_msvc(self): - args = "freexl_i.lib FREEXL_EXPORT=-DDLL_EXPORT" if self.options.shared else "freexl.lib" - with tools.chdir(self._source_subfolder): - with tools.vcvars(self.settings): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - self.run("nmake -f makefile.vc {}".format(args)) - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - autotools.configure(args=args, configure_dir=self._source_subfolder) - return autotools - def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self.copy("freexl.h", dst="include", src=os.path.join(self._source_subfolder, "headers")) - self.copy("*.lib", dst="lib", src=self._source_subfolder) - self.copy("*.dll", dst="bin", src=self._source_subfolder) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + copy(self, "freexl.h", src=os.path.join(self.source_folder, "headers"), dst=os.path.join(self.package_folder, "include")) + copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "freexl") - suffix = "_i" if self._is_msvc and self.options.shared else "" - self.cpp_info.libs = ["freexl{}".format(suffix)] + suffix = "_i" if is_msvc(self) and self.options.shared else "" + self.cpp_info.libs = [f"freexl{suffix}"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs.append("m") diff --git a/recipes/freexl/all/test_package/CMakeLists.txt b/recipes/freexl/all/test_package/CMakeLists.txt index a9baa640ef0d8..e92c3ad896b62 100644 --- a/recipes/freexl/all/test_package/CMakeLists.txt +++ b/recipes/freexl/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(freexl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} freexl::freexl) +target_link_libraries(${PROJECT_NAME} PRIVATE freexl::freexl) diff --git a/recipes/freexl/all/test_package/conanfile.py b/recipes/freexl/all/test_package/conanfile.py index e8957977baa1d..fa2bdcf79755e 100644 --- a/recipes/freexl/all/test_package/conanfile.py +++ b/recipes/freexl/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") xls_path = os.path.join(self.source_folder, "simple2003_21.xls") - bin_path = os.path.join("bin", "test_package") - self.run("{0} {1}".format(bin_path, xls_path), run_environment=True) + self.run(f"{bin_path} {xls_path}", env="conanrun") diff --git a/recipes/freexl/all/test_v1_package/CMakeLists.txt b/recipes/freexl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/freexl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/freexl/all/test_v1_package/conanfile.py b/recipes/freexl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..305903625c5ac --- /dev/null +++ b/recipes/freexl/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + xls_path = os.path.join(self.source_folder, os.pardir, "test_package", "simple2003_21.xls") + self.run(f"{bin_path} {xls_path}", run_environment=True) diff --git a/recipes/fribidi/all/conanfile.py b/recipes/fribidi/all/conanfile.py index b303aebbbf036..0867aa984f255 100644 --- a/recipes/fribidi/all/conanfile.py +++ b/recipes/fribidi/all/conanfile.py @@ -1,23 +1,24 @@ from conan import ConanFile from conan.tools.apple import fix_apple_shared_install_name from conan.tools.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, get, rm, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir from conan.tools.layout import basic_layout from conan.tools.meson import Meson, MesonToolchain from conan.tools.scm import Version import os -required_conan_version = ">=1.51.0" +required_conan_version = ">=1.53.0" class FriBiDiCOnan(ConanFile): name = "fribidi" description = "The Free Implementation of the Unicode Bidirectional Algorithm" - topics = ("fribidi", "unicode", "bidirectional", "text") + topics = ("unicode", "bidirectional", "text") license = "LGPL-2.1" homepage = "https://github.com/fribidi/fribidi" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,8 +32,7 @@ class FriBiDiCOnan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -40,27 +40,22 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass - - def build_requirements(self): - self.tool_requires("meson/0.63.1") + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): basic_layout(self, src_folder="src") + def build_requirements(self): + self.tool_requires("meson/1.0.0") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + env = VirtualBuildEnv(self) + env.generate() tc = MesonToolchain(self) tc.project_options["deprecated"] = self.options.with_deprecated tc.project_options["docs"] = False @@ -68,8 +63,6 @@ def generate(self): tc.project_options["bin"] = False tc.project_options["tests"] = False tc.generate() - env = VirtualBuildEnv(self) - env.generate() def build(self): apply_conandata_patches(self) @@ -97,11 +90,10 @@ def package_info(self): self.cpp_info.defines.append("FRIBIDI_STATIC") def fix_msvc_libname(conanfile, remove_lib_prefix=True): - """remove lib prefix & change extension to .lib""" + """remove lib prefix & change extension to .lib in case of cl like compiler""" from conan.tools.files import rename - from conan.tools.microsoft import is_msvc import glob - if not is_msvc(conanfile): + if not conanfile.settings.get_safe("compiler.runtime"): return libdirs = getattr(conanfile.cpp.package, "libdirs") for libdir in libdirs: diff --git a/recipes/fribidi/all/test_package/conanfile.py b/recipes/fribidi/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/fribidi/all/test_package/conanfile.py +++ b/recipes/fribidi/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/fribidi/all/test_v1_package/CMakeLists.txt b/recipes/fribidi/all/test_v1_package/CMakeLists.txt index e0e1750238bcb..0d20897301b68 100644 --- a/recipes/fribidi/all/test_v1_package/CMakeLists.txt +++ b/recipes/fribidi/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(fribidi REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE fribidi::fribidi) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/frozen/all/conandata.yml b/recipes/frozen/all/conandata.yml index 065252f10ae12..4d9b977925cb2 100644 --- a/recipes/frozen/all/conandata.yml +++ b/recipes/frozen/all/conandata.yml @@ -1,10 +1,10 @@ sources: + "1.1.1": + url: "https://github.com/serge-sans-paille/frozen/archive/1.1.1.tar.gz" + sha256: "f7c7075750e8fceeac081e9ef01944f221b36d9725beac8681cbd2838d26be45" + "1.0.1": + url: "https://github.com/serge-sans-paille/frozen/archive/1.0.1.tar.gz" + sha256: "29ab5de4eb6bebfb803cd4bd33e324777488fb035116dab1aea27f9118809d0d" "1.0.0": - url: https://github.com/serge-sans-paille/frozen/archive/1.0.0.tar.gz - sha256: 590440d45dd53c6150b47df86071bba5128055e823ccc8715b363f75fc531269 - "1.0.1": - url: https://github.com/serge-sans-paille/frozen/archive/1.0.1.tar.gz - sha256: 29ab5de4eb6bebfb803cd4bd33e324777488fb035116dab1aea27f9118809d0d - "1.1.1": - url: https://github.com/serge-sans-paille/frozen/archive/1.1.1.tar.gz - sha256: f7c7075750e8fceeac081e9ef01944f221b36d9725beac8681cbd2838d26be45 + url: "https://github.com/serge-sans-paille/frozen/archive/1.0.0.tar.gz" + sha256: "590440d45dd53c6150b47df86071bba5128055e823ccc8715b363f75fc531269" diff --git a/recipes/frozen/all/conanfile.py b/recipes/frozen/all/conanfile.py index 17ac78e40e9cd..e1444fa2a4c65 100644 --- a/recipes/frozen/all/conanfile.py +++ b/recipes/frozen/all/conanfile.py @@ -1,6 +1,13 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.50.0" + class FrozenConan(ConanFile): name = "frozen" @@ -9,39 +16,52 @@ class FrozenConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" topics = ("gperf", "constexpr", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "compiler" - _source_subfolder = "source_subfolder" - - def configure(self): - minimal_cpp_standard = "14" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { + + @property + def _min_cppstd(self): + return "14" + + @property + def _minimum_compilers_version(self): + return { "gcc": "5", "clang": "3.4", "apple-clang": "10", - "Visual Studio": "14" + "Visual Studio": "14", + "msvc": "190", } - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - return - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy(pattern="*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "frozen") + self.cpp_info.set_property("cmake_target_name", "frozen::frozen") + self.cpp_info.set_property("cmake_target_aliases", ["frozen::frozen-headers"]) + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/frozen/all/test_package/CMakeLists.txt b/recipes/frozen/all/test_package/CMakeLists.txt index 3300ff7750277..bf59d5df3d910 100644 --- a/recipes/frozen/all/test_package/CMakeLists.txt +++ b/recipes/frozen/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(frozen REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE frozen::frozen) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/frozen/all/test_package/conanfile.py b/recipes/frozen/all/test_package/conanfile.py index 2cdb1d2b3578c..0a6bc68712d90 100644 --- a/recipes/frozen/all/test_package/conanfile.py +++ b/recipes/frozen/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join(self.build_folder, "bin", "test_package") - self.run(command=bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/frozen/all/test_v1_package/CMakeLists.txt b/recipes/frozen/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..ed695ba529434 --- /dev/null +++ b/recipes/frozen/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(frozen REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE frozen::frozen) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/frozen/all/test_v1_package/conanfile.py b/recipes/frozen/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/frozen/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/frozen/config.yml b/recipes/frozen/config.yml index 8e89f9a7945c9..9234b604d8ed1 100644 --- a/recipes/frozen/config.yml +++ b/recipes/frozen/config.yml @@ -1,7 +1,7 @@ versions: - "1.0.0": + "1.1.1": folder: all "1.0.1": folder: all - "1.1.1": + "1.0.0": folder: all diff --git a/recipes/fruit/all/CMakeLists.txt b/recipes/fruit/all/CMakeLists.txt deleted file mode 100644 index 6cae2db60d5c0..0000000000000 --- a/recipes/fruit/all/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(NOT "${CMAKE_CXX_STANDARD}") - set(CMAKE_CXX_STANDARD 11) -endif() -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/fruit/all/conandata.yml b/recipes/fruit/all/conandata.yml index e04138d7921b0..76fd9cdd1653e 100644 --- a/recipes/fruit/all/conandata.yml +++ b/recipes/fruit/all/conandata.yml @@ -1,28 +1,64 @@ sources: - "3.4.0": - url: "https://github.com/google/fruit/archive/v3.4.0.tar.gz" - sha256: "0f3793ee5e437437c3d6360a037866429a7f1975451fd60d740f9d2023e92034" - "3.5.0": - url: "https://github.com/google/fruit/archive/v3.5.0.tar.gz" - sha256: "1e1f26fb2ec100550e0e29ee0f4ad0df9f7a8144a65c0b9cb9954cd2e4d6a529" + "3.7.1": + url: "https://github.com/google/fruit/archive/v3.7.1.tar.gz" + sha256: "ed4c6b7ebfbf75e14a74e21eb74ce2703b8485bfc9e660b1c36fb7fe363172d0" + "3.7.0": + url: "https://github.com/google/fruit/archive/v3.7.0.tar.gz" + sha256: "134d65c8e6dff204aeb771058c219dcd9a353853e30a3961a5d17a6cff434a09" "3.6.0": url: "https://github.com/google/fruit/archive/v3.6.0.tar.gz" sha256: "b35b9380f3affe0b3326f387505fa80f3584b0d0a270362df1f4ca9c39094eb5" -patches: - "3.4.0": - - patch_file: "patches/0001-fruit-3.4.0-cmake.patch" - base_path: "source_subfolder" "3.5.0": - - patch_file: "patches/0002-remove-cmake-extra-target-3.5.0.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-supports-cmake-multi-configuration-generator.patch" - base_path: "source_subfolder" + url: "https://github.com/google/fruit/archive/v3.5.0.tar.gz" + sha256: "1e1f26fb2ec100550e0e29ee0f4ad0df9f7a8144a65c0b9cb9954cd2e4d6a529" + "3.4.0": + url: "https://github.com/google/fruit/archive/v3.4.0.tar.gz" + sha256: "0f3793ee5e437437c3d6360a037866429a7f1975451fd60d740f9d2023e92034" +patches: + "3.7.1": + - patch_file: "patches/0002-remove-cmake-extra-target-3.7.1.patch" + patch_description: "remove CMake extra target" + patch_type: "conan" + - patch_file: "patches/0003-supports-cmake-multi-configuration-generator-3.7.patch" + patch_description: "support CMake multi configuration generator" + patch_type: "conan" + - patch_file: "patches/0004-set-options-for-cmake-target.patch" + patch_description: "Set options for CMake target" + patch_type: "conan" + "3.7.0": + - patch_file: "patches/0002-remove-cmake-extra-target-3.7.0.patch" + patch_description: "remove CMake extra target" + patch_type: "conan" + - patch_file: "patches/0003-supports-cmake-multi-configuration-generator-3.7.patch" + patch_description: "support CMake multi configuration generator" + patch_type: "conan" - patch_file: "patches/0004-set-options-for-cmake-target.patch" - base_path: "source_subfolder" + patch_description: "Set options for CMake target" + patch_type: "conan" "3.6.0": - patch_file: "patches/0002-remove-cmake-extra-target-3.6.0.patch" - base_path: "source_subfolder" + patch_description: "remove CMake extra target" + patch_type: "conan" - patch_file: "patches/0003-supports-cmake-multi-configuration-generator.patch" - base_path: "source_subfolder" + patch_description: "support CMake multi configuration generator" + patch_type: "conan" - patch_file: "patches/0004-set-options-for-cmake-target.patch" - base_path: "source_subfolder" + patch_description: "Set options for CMake target" + patch_type: "conan" + "3.5.0": + - patch_file: "patches/0002-remove-cmake-extra-target-3.5.0.patch" + patch_description: "remove CMake extra target" + patch_type: "conan" + - patch_file: "patches/0003-supports-cmake-multi-configuration-generator.patch" + patch_description: "support CMake multi configuration generator" + patch_type: "conan" + - patch_file: "patches/0004-set-options-for-cmake-target.patch" + patch_description: "Set options for CMake target" + patch_type: "conan" + "3.4.0": + - patch_file: "patches/0001-fruit-3.4.0-cmake.patch" + patch_description: "Adapt CMake for Conan" + patch_type: "conan" + - patch_file: "patches/0004-3.4.0-set-options-for-cmake-target.patch" + patch_description: "Set Boost cmake target" + patch_type: "conan" diff --git a/recipes/fruit/all/conanfile.py b/recipes/fruit/all/conanfile.py index 3187adf0c463e..39e570bb06b3a 100644 --- a/recipes/fruit/all/conanfile.py +++ b/recipes/fruit/all/conanfile.py @@ -1,9 +1,15 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version -from fnmatch import fnmatch import os +import shutil import tarfile +from fnmatch import fnmatch + +from conan import ConanFile, Version +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, download, export_conandata_patches, get + +required_conan_version = ">=1.53.0" class FruitConan(ConanFile): @@ -12,36 +18,45 @@ class FruitConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/google/fruit" license = "Apache-2.0" - topics = ("conan", "fruit", "injection") + topics = ("injection", "framework") settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False], - "use_boost": [True, False], + "use_boost": [True, False, "deprecated"], + "with_boost": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "use_boost": True, "fPIC": True} - generators = "cmake", "cmake_find_package" - exports_sources = ["CMakeLists.txt", "patches/*"] - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + default_options = { + "shared": False, + "use_boost": "deprecated", + "with_boost": True, + "fPIC": True} - def build_requirements(self): - if self.options.use_boost: - self.build_requires("boost/1.72.0") + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") + + def package_id(self): + del self.info.options.use_boost def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + if self.options.use_boost != "deprecated": + self.output.warn("use_boost option is deprecated, use the option with_boost instead.") + self.options.with_boost = self.options.use_boost + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_boost: + self.requires("boost/1.80.0") + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, "11") compiler = str(self.settings.compiler) compiler_version = Version(self.settings.compiler.version.value) @@ -54,21 +69,15 @@ def configure(self): if compiler in minimal_version and \ compiler_version < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports" - " at least C++11. %s %s is not" - " supported." % (self.name, compiler, compiler_version)) - - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") - - @property - def _extracted_dir(self): - return self.name + "-" + self.version + raise ConanInvalidConfiguration(f"{self.name} requires a compiler that supports" + " at least C++11. {compiler} {compiler_version} is not" + " supported.") - def _get_source(self): + def source(self): if Version(self.version) == "3.4.0": filename = os.path.basename(self.conan_data["sources"][self.version]["url"]) - tools.download(filename=filename, **self.conan_data["sources"][self.version]) + download(self, filename=filename, **self.conan_data["sources"][self.version]) + extracted_dir = self.name + "-" + self.version with tarfile.TarFile.open(filename, 'r:*') as tarredgzippedFile: # NOTE: In fruit v3.4.0, The archive file contains the file names @@ -76,47 +85,40 @@ def _get_source(self): # Extraction fails on a case-insensitive file system due to file # name conflicts. # Exclude build as a workaround. - exclude_pattern = "%s/extras/bazel_root/third_party/fruit/build" % (self._extracted_dir,) + exclude_pattern = f"{extracted_dir}/extras/bazel_root/third_party/fruit/build" members = list(filter(lambda m: not fnmatch(m.name, exclude_pattern), tarredgzippedFile.getmembers())) - tarredgzippedFile.extractall(".", members=members) + tarredgzippedFile.extractall(path=self.source_folder, members=members) + allfiles = os.listdir(os.path.join(self.source_folder, extracted_dir)) + for file_name in allfiles: + shutil.move(os.path.join(self.source_folder, extracted_dir, file_name), self.source_folder) else: - tools.get(**self.conan_data["sources"][self.version]) - - def source(self): - self._get_source() - - os.rename(self._extracted_dir, self._source_subfolder) - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["FRUIT_USES_BOOST"] = self.options.use_boost - self._cmake.definitions["FRUIT_ENABLE_COVERAGE"] = False - self._cmake.definitions["RUN_TESTS_UNDER_VALGRIND"] = False - self._cmake.definitions["FRUIT_ENABLE_CLANG_TIDY"] = False - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch_files(self): - if self.version in self.conan_data["patches"]: - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["FRUIT_USES_BOOST"] = self.options.with_boost + tc.variables["FRUIT_ENABLE_COVERAGE"] = False + tc.variables["RUN_TESTS_UNDER_VALGRIND"] = False + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0091"] = "NEW" + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - self._patch_files() - - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - - cmake = self._configure_cmake() + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["fruit"] if self.settings.os == "Linux": self.cpp_info.system_libs = ["m"] diff --git a/recipes/fruit/all/patches/0001-fruit-3.4.0-cmake.patch b/recipes/fruit/all/patches/0001-fruit-3.4.0-cmake.patch index d16240da87acc..e567a9b5299ec 100644 --- a/recipes/fruit/all/patches/0001-fruit-3.4.0-cmake.patch +++ b/recipes/fruit/all/patches/0001-fruit-3.4.0-cmake.patch @@ -1,7 +1,14 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index d77de0c..338abb8 100644 +index d77de0c..0cbf39b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ +-project(Fruit) + cmake_minimum_required(VERSION 2.8) ++project(Fruit) + + if (POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) @@ -8,19 +8,8 @@ endif() # CMake on OSX likes to see this set explicitly, otherwise it outputs a warning. set(CMAKE_MACOSX_RPATH 1) diff --git a/recipes/fruit/all/patches/0002-remove-cmake-extra-target-3.7.0.patch b/recipes/fruit/all/patches/0002-remove-cmake-extra-target-3.7.0.patch new file mode 100644 index 0000000000000..c63577ff5ae4a --- /dev/null +++ b/recipes/fruit/all/patches/0002-remove-cmake-extra-target-3.7.0.patch @@ -0,0 +1,37 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 74c62a5..03444f5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 3.2) + + project(Fruit VERSION 3.7.0 LANGUAGES CXX) + +-set(FRUIT_IS_BEING_BUILT_BY_CONAN FALSE CACHE BOOL "This is set in Conan builds.") +-if("${FRUIT_IS_BEING_BUILT_BY_CONAN}") +- include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +- conan_basic_setup() +-endif() +- + if (POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) + endif() +@@ -130,19 +124,6 @@ include(GNUInstallDirs) + add_subdirectory(configuration) + add_subdirectory(src) + +-if(NOT "${FRUIT_IS_BEING_BUILT_BY_CONAN}") +- if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") +- # Do not exclude these from "make all" in debug mode, they must build. +- add_subdirectory(examples) +- add_subdirectory(tests) +- else() +- add_subdirectory(examples EXCLUDE_FROM_ALL) +- add_subdirectory(tests) +- endif() +- +- add_subdirectory(extras EXCLUDE_FROM_ALL) +-endif() +- + install(DIRECTORY include/fruit/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fruit + FILES_MATCHING PATTERN "*.h") diff --git a/recipes/fruit/all/patches/0002-remove-cmake-extra-target-3.7.1.patch b/recipes/fruit/all/patches/0002-remove-cmake-extra-target-3.7.1.patch new file mode 100644 index 0000000000000..f72cc8e6e525a --- /dev/null +++ b/recipes/fruit/all/patches/0002-remove-cmake-extra-target-3.7.1.patch @@ -0,0 +1,37 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 74c62a5..03444f5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,12 +2,6 @@ cmake_minimum_required(VERSION 3.2) + + project(Fruit VERSION 3.7.1 LANGUAGES CXX) + +-set(FRUIT_IS_BEING_BUILT_BY_CONAN FALSE CACHE BOOL "This is set in Conan builds.") +-if("${FRUIT_IS_BEING_BUILT_BY_CONAN}") +- include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +- conan_basic_setup() +-endif() +- + if (POLICY CMP0054) + cmake_policy(SET CMP0054 NEW) + endif() +@@ -130,19 +124,6 @@ include(GNUInstallDirs) + add_subdirectory(configuration) + add_subdirectory(src) + +-if(NOT "${FRUIT_IS_BEING_BUILT_BY_CONAN}") +- if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") +- # Do not exclude these from "make all" in debug mode, they must build. +- add_subdirectory(examples) +- add_subdirectory(tests) +- else() +- add_subdirectory(examples EXCLUDE_FROM_ALL) +- add_subdirectory(tests) +- endif() +- +- add_subdirectory(extras EXCLUDE_FROM_ALL) +-endif() +- + install(DIRECTORY include/fruit/ + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/fruit + FILES_MATCHING PATTERN "*.h") diff --git a/recipes/fruit/all/patches/0003-supports-cmake-multi-configuration-generator-3.7.patch b/recipes/fruit/all/patches/0003-supports-cmake-multi-configuration-generator-3.7.patch new file mode 100644 index 0000000000000..7d45a68e3e529 --- /dev/null +++ b/recipes/fruit/all/patches/0003-supports-cmake-multi-configuration-generator-3.7.patch @@ -0,0 +1,91 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 03444f5..46d3918 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -14,15 +14,8 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON) + # CMake on OSX likes to see this set explicitly, otherwise it outputs a warning. + set(CMAKE_MACOSX_RPATH 1) + +-if(NOT "${CMAKE_BUILD_TYPE}" MATCHES "^(Debug|Release|RelWithDebInfo|MinSizeRel)$") +- message(FATAL_ERROR "Please re-run CMake, specifying -DCMAKE_BUILD_TYPE=Debug , -DCMAKE_BUILD_TYPE=Release , -DCMAKE_BUILD_TYPE=RelWithDebInfo or -DCMAKE_BUILD_TYPE=MinSizeRel .") +-endif() +- + option(BUILD_SHARED_LIBS "Build shared library" ON) + +-# The Visual Studio CMake generators default to multiple configurations, but Fruit doesn't support multi-configuration build directories. +-set(CMAKE_CONFIGURATION_TYPES "${CMAKE_BUILD_TYPE}") +- + set(FRUIT_ADDITIONAL_CXX_FLAGS "" CACHE STRING "Additional CXX compiler flags." FORCE) + + set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_CXX_FLAGS}") +@@ -36,23 +29,18 @@ if(NOT "${CMAKE_CXX_COMPILER_ID}" MATCHES "^(GNU|Clang|AppleClang|MSVC)$") + # - https://software.intel.com/en-us/forums/intel-c-compiler/topic/606049 + endif() + +-option(FRUIT_ADD_WNO_UNKNOWN_WARNING_OPTION "Add -Wno-unknown-warning-option to the compiler options for GCC, Clang, ICC and AppleClang" ON) ++set(FRUIT_ADDITIONAL_COMPILE_FLAGS_GNU ${FRUIT_ADDITIONAL_COMPILE_FLAGS} -W -Wall -Wno-unknown-warning-option -Wno-missing-braces) ++set(FRUIT_ADDITIONAL_COMPILE_FLAGS_Clang ${FRUIT_ADDITIONAL_COMPILE_FLAGS} -W -Wall -Wno-unknown-warning-option -Wno-missing-braces) ++set(FRUIT_ADDITIONAL_COMPILE_FLAGS_Intel ${FRUIT_ADDITIONAL_COMPILE_FLAGS} -W -Wall -Wno-unknown-warning-option -Wno-missing-braces) ++set(FRUIT_ADDITIONAL_COMPILE_FLAGS_AppleClang ${FRUIT_ADDITIONAL_COMPILE_FLAGS} -W -Wall -Wno-unknown-warning-option -Wno-missing-braces) ++set(FRUIT_ADDITIONAL_COMPILE_FLAGS_MSVC ${FRUIT_ADDITIONAL_COMPILE_FLAGS} /nologo /FS /W4 /wd4324 /wd4709 /wd4459 /wd4141 /wd4714 /wd4577 /wd4530 /wd5205 /D_SCL_SECURE_NO_WARNINGS) + +-if("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(GNU|Clang|Intel|AppleClang)$") +- set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_COMPILE_FLAGS} -std=c++11 -W -Wall -Wno-missing-braces") +- if(${FRUIT_ADD_WNO_UNKNOWN_WARNING_OPTION}) +- set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_COMPILE_FLAGS} -Wno-unknown-warning-option") +- endif() +-elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "^(MSVC)$") +- # TODO: we currently disable the warning C4709 because MSVC emits it even when there is no reason to. Re-enable it when possible. +- # TODO: the warning C4141 is disabled, because MSVC emits it ("'inline': used more than once") when a function/method is marked with both __forceinline and inline. +- # TODO: the warning C4714 is disabled, MSVC emits it when it decides not to inline a __forceinline function/method. +- # The warning C4577 is disabled because we don't need a termination guarantee on exceptions for functions marked with +- # 'noexcept'. +- # The warning C4530 is disabled because it's triggered by MSVC's STL. +- # The warning C5205 is disabled, MSVC emits it for abstract classes in example code with non-virtual destructors, but we never call delete on those (even though std::default_delete is instantiated for those types). +- set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_COMPILE_FLAGS} /nologo /FS /W4 /wd4324 /wd4709 /wd4459 /wd4141 /wd4714 /wd4577 /wd4530 /wd5205 /D_SCL_SECURE_NO_WARNINGS") +-endif() ++list(APPEND FRUIT_ADDITIONAL_COMPILE_FLAGS ++ $<$:${FRUIT_ADDITIONAL_COMPILE_FLAGS_GNU}> ++ $<$:${FRUIT_ADDITIONAL_COMPILE_FLAGS_Clang}> ++ $<$:${FRUIT_ADDITIONAL_COMPILE_FLAGS_Intel}> ++ $<$:${FRUIT_ADDITIONAL_COMPILE_FLAGS_AppleClang}> ++ $<$:${FRUIT_ADDITIONAL_COMPILE_FLAGS_MSVC}>) + + option(FRUIT_ENABLE_COVERAGE "Enable collection of test coverage. This is meant to be used by Fruit developers. It's only supported when using GCC on Linux." OFF) + if("${FRUIT_ENABLE_COVERAGE}") +@@ -94,12 +82,6 @@ set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FRUIT_ADDITIONAL_LINKER_ + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FRUIT_ADDITIONAL_LINKER_FLAGS}") + set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${FRUIT_ADDITIONAL_LINKER_FLAGS}") + +-if ("${CMAKE_BUILD_TYPE}" STREQUAL "Release") +- set(FRUIT_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_RELEASE} ${FRUIT_ADDITIONAL_COMPILE_FLAGS}") +-else() +- set(FRUIT_COMPILE_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_CXX_FLAGS_DEBUG} ${FRUIT_ADDITIONAL_COMPILE_FLAGS}") +-endif() +- + set(FRUIT_CLANG_TIDY_CHECKS + bugprone*,-bugprone-reserved-identifier,-bugprone-exception-escape,clang-analyzer*,performance*,google*,-google-readability*,-google-runtime-references,clang-diagnostic-unused-command-line-argument,misc-macro-parentheses,-clang-diagnostic-dtor-name) + +diff --git a/configuration/CMakeLists.txt b/configuration/CMakeLists.txt +index 11d8445..a78a5bb 100644 +--- a/configuration/CMakeLists.txt ++++ b/configuration/CMakeLists.txt +@@ -1,7 +1,17 @@ + + include(CheckCXXSourceCompiles) + +-set(CMAKE_REQUIRED_FLAGS "${FRUIT_COMPILE_FLAGS}") ++if("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU") ++ set(CMAKE_REQUIRED_FLAGS ${FRUIT_ADDITIONAL_COMPILE_FLAGS_GNU}) ++elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "^Clang$") ++ set(CMAKE_REQUIRED_FLAGS ${FRUIT_ADDITIONAL_COMPILE_FLAGS_Clang}) ++elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel") ++ set(CMAKE_REQUIRED_FLAGS ${FRUIT_ADDITIONAL_COMPILE_FLAGS_Intel}) ++elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "AppleClang") ++ set(CMAKE_REQUIRED_FLAGS ${FRUIT_ADDITIONAL_COMPILE_FLAGS_AppleClang}) ++elseif("${CMAKE_CXX_COMPILER_ID}" MATCHES "MSVC") ++ set(CMAKE_REQUIRED_FLAGS ${FRUIT_ADDITIONAL_COMPILE_FLAGS_MSVC}) ++endif() + + CHECK_CXX_SOURCE_COMPILES(" + int main() {} diff --git a/recipes/fruit/all/patches/0004-3.4.0-set-options-for-cmake-target.patch b/recipes/fruit/all/patches/0004-3.4.0-set-options-for-cmake-target.patch new file mode 100644 index 0000000000000..972eec63bdee1 --- /dev/null +++ b/recipes/fruit/all/patches/0004-3.4.0-set-options-for-cmake-target.patch @@ -0,0 +1,16 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 9c75ec6..0d7100d 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -27,9 +27,8 @@ target_compile_options(fruit + ${FRUIT_ADDITIONAL_COMPILE_FLAGS}) + + if(FRUIT_USES_BOOST) +- target_include_directories(fruit +- PRIVATE +- ${CONAN_INCLUDE_DIRS_BOOST}) ++ find_package(Boost REQUIRED CONFIG) ++ target_link_libraries(fruit PUBLIC Boost::boost) + endif() + + install(TARGETS fruit diff --git a/recipes/fruit/all/patches/0004-set-options-for-cmake-target.patch b/recipes/fruit/all/patches/0004-set-options-for-cmake-target.patch index f5679b29ec5f0..bdea499c081e9 100644 --- a/recipes/fruit/all/patches/0004-set-options-for-cmake-target.patch +++ b/recipes/fruit/all/patches/0004-set-options-for-cmake-target.patch @@ -1,12 +1,11 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index c85be1b..738c6fe 100644 +index 46d3918..9d6bb1c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -54,21 +54,6 @@ set(FRUIT_USES_BOOST TRUE CACHE BOOL - "Whether to use Boost (specifically, boost::unordered_set and boost::unordered_map). +@@ -55,18 +55,7 @@ set(FRUIT_USES_BOOST TRUE CACHE BOOL If this is false, Fruit will use std::unordered_set and std::unordered_map instead (however this causes injection to be a bit slower).") - --if(${FRUIT_USES_BOOST}) + + if(${FRUIT_USES_BOOST}) - - if(DEFINED BOOST_DIR) - message(DEPRECATION "BOOST_DIR is deprecated. Use Boost_INCLUDE_DIR instead.") @@ -19,60 +18,42 @@ index c85be1b..738c6fe 100644 - else() - message(FATAL_ERROR "Please re-run CMake, specifying the boost library path as Boost_INCLUDE_DIR, e.g. -DBoost_INCLUDE_DIR=C:\\boost\\boost_1_62_0, or specify -DFRUIT_USES_BOOST=False to not use boost.") - endif() --endif() -- ++ find_package(Boost REQUIRED CONFIG) + endif() + set(RUN_TESTS_UNDER_VALGRIND FALSE CACHE BOOL "Whether to run Fruit tests under valgrind") - if ("${RUN_TESTS_UNDER_VALGRIND}") - set(RUN_TESTS_UNDER_VALGRIND_FLAG "1") -@@ -77,7 +62,6 @@ endif() +@@ -77,7 +66,6 @@ endif() # Unsafe, only for debugging/benchmarking. #set(FRUIT_ADDITIONAL_COMPILE_FLAGS "${FRUIT_ADDITIONAL_COMPILE_FLAGS} -DFRUIT_NO_LOOP_CHECK=1") - + -add_definitions(${FRUIT_ADDITIONAL_COMPILE_FLAGS}) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FRUIT_ADDITIONAL_LINKER_FLAGS}") set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${FRUIT_ADDITIONAL_LINKER_FLAGS}") set(CMAKE_MODULE_LINKER_FLAGS "${CMAKE_MODULE_LINKER_FLAGS} ${FRUIT_ADDITIONAL_LINKER_FLAGS}") -@@ -94,8 +78,7 @@ if(${FRUIT_ENABLE_CLANG_TIDY}) +@@ -94,9 +82,7 @@ if(${FRUIT_ENABLE_CLANG_TIDY}) -warnings-as-errors=*;) endif() - + -include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) -include_directories(${CMAKE_CURRENT_BINARY_DIR}/include) +- +set(FRUIT_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/include" "${CMAKE_CURRENT_BINARY_DIR}/include") - # (debug-only) compile switch to get deep template instantiation stacktraces for errors (instead # of the user-friendly default that hides Fruit internals). + #add_definitions(-DFRUIT_DEEP_TEMPLATE_INSTANTIATION_STACKTRACES_FOR_ERRORS=1) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 0e328cf..9c75ec6 100644 +index 0e328cf..bf437e9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt -@@ -11,16 +11,27 @@ normalized_component_storage_holder.cpp - semistatic_map.cpp - semistatic_graph.cpp) - --if("${BUILD_SHARED_LIBS}") -+if(BUILD_SHARED_LIBS) - add_library(fruit SHARED ${FRUIT_SOURCES}) - -- if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") -- set_target_properties(fruit PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) -- endif() -+ set_target_properties(fruit PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - else() +@@ -21,6 +21,13 @@ else() add_library(fruit STATIC ${FRUIT_SOURCES}) endif() - -+target_include_directories(fruit -+ PUBLIC -+ ${FRUIT_INCLUDE_DIRS}) -+target_compile_options(fruit -+ PUBLIC -+ ${FRUIT_ADDITIONAL_COMPILE_FLAGS}) + ++target_include_directories(fruit PUBLIC ${FRUIT_INCLUDE_DIRS}) ++target_compile_options(fruit PUBLIC ${FRUIT_ADDITIONAL_COMPILE_FLAGS}) + +if(FRUIT_USES_BOOST) -+ target_include_directories(fruit -+ PRIVATE -+ ${CONAN_INCLUDE_DIRS_BOOST}) ++ target_link_libraries(fruit PRIVATE Boost::boost) +endif() + install(TARGETS fruit diff --git a/recipes/fruit/all/test_package/CMakeLists.txt b/recipes/fruit/all/test_package/CMakeLists.txt index 8e1944a07b1be..a965663f9c6ad 100644 --- a/recipes/fruit/all/test_package/CMakeLists.txt +++ b/recipes/fruit/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(fruit REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} fruit) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON) +target_link_libraries(${PROJECT_NAME} PRIVATE fruit::fruit) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/fruit/all/test_package/conanfile.py b/recipes/fruit/all/test_package/conanfile.py index bd7165a553cf4..a9fb96656f203 100644 --- a/recipes/fruit/all/test_package/conanfile.py +++ b/recipes/fruit/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/fruit/all/test_v1_package/CMakeLists.txt b/recipes/fruit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7ea0378c83fe1 --- /dev/null +++ b/recipes/fruit/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/fruit/all/test_v1_package/conanfile.py b/recipes/fruit/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/fruit/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/fruit/config.yml b/recipes/fruit/config.yml index 065536f740388..684a4c74b2542 100644 --- a/recipes/fruit/config.yml +++ b/recipes/fruit/config.yml @@ -5,3 +5,7 @@ versions: folder: all "3.6.0": folder: all + "3.7.0": + folder: all + "3.7.1": + folder: all diff --git a/recipes/function2/all/conandata.yml b/recipes/function2/all/conandata.yml index aac289a2373ad..4a8c1d45eb5f5 100644 --- a/recipes/function2/all/conandata.yml +++ b/recipes/function2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.2.2": + url: "https://github.com/Naios/function2/archive/refs/tags/4.2.2.tar.gz" + sha256: "f755cb79712dfb9ceefcf7f7ff3225f7c99d22a164dae109044dbfad55d7111e" "4.2.1": url: "https://github.com/Naios/function2/archive/4.2.1.tar.gz" sha256: "dfaf12f6cc4dadc4fc7051af7ac57be220c823aaccfd2fecebcb45a0a03a6eb0" diff --git a/recipes/function2/all/conanfile.py b/recipes/function2/all/conanfile.py index 7dfb1cbbe3253..e29faac1dac09 100644 --- a/recipes/function2/all/conanfile.py +++ b/recipes/function2/all/conanfile.py @@ -1,7 +1,12 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +required_conan_version = ">=1.50.0" class Function2Conan(ConanFile): @@ -11,42 +16,53 @@ class Function2Conan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Naios/function2" license = "BSL-1.0" - settings = "compiler" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" - - def configure(self): - minimal_cpp_standard = "14" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { + def _min_cppstd(self): + return 14 + + @property + def _compiler_minimal_version(self): + return { "gcc": "5", "clang": "3.4", "apple-clang": "10", "Visual Studio": "14" } + + def layout(self): + basic_layout(self) + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) compiler = str(self.settings.compiler) - if compiler not in minimal_version: + if compiler not in self._compiler_minimal_version: self.output.warn( "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + "%s requires a compiler that supports at least C++%s" % (self.name, self._min_cppstd)) return - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + version = Version(self.settings.compiler.version) + if version < self._compiler_minimal_version[compiler]: + raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, self._min_cppstd)) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "function2-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.hpp", dst=os.path.join("include", "function2"), src=os.path.join(self._source_subfolder, "include", "function2")) + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/function2/all/test_package/CMakeLists.txt b/recipes/function2/all/test_package/CMakeLists.txt index bf79ed3126423..85a339e09a26c 100644 --- a/recipes/function2/all/test_package/CMakeLists.txt +++ b/recipes/function2/all/test_package/CMakeLists.txt @@ -1,16 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.10) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package CXX) -add_executable(${PROJECT_NAME} test_package.cpp) +find_package(function2 REQUIRED CONFIG) -set_target_properties( - ${PROJECT_NAME} PROPERTIES +add_executable(${PROJECT_NAME} test_package.cpp) - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED ON -) +target_link_libraries(${PROJECT_NAME} PRIVATE function2::function2) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/function2/all/test_package/conanfile.py b/recipes/function2/all/test_package/conanfile.py index bd7165a553cf4..b4a4c16800289 100644 --- a/recipes/function2/all/test_package/conanfile.py +++ b/recipes/function2/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/function2/all/test_v1_package/CMakeLists.txt b/recipes/function2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..5816ff152bbfe --- /dev/null +++ b/recipes/function2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.10) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(function2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) + +target_link_libraries(${PROJECT_NAME} PRIVATE function2::function2) + +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/function2/all/test_v1_package/conanfile.py b/recipes/function2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8037a9296cc42 --- /dev/null +++ b/recipes/function2/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/function2/config.yml b/recipes/function2/config.yml index 52fa67bcd41e8..955cd0773fc58 100644 --- a/recipes/function2/config.yml +++ b/recipes/function2/config.yml @@ -1,4 +1,6 @@ versions: + "4.2.2": + folder: all "4.2.1": folder: all "4.2.0": diff --git a/recipes/g3log/all/conandata.yml b/recipes/g3log/all/conandata.yml index 140d23e5b67d1..cd2a9bc1927b4 100644 --- a/recipes/g3log/all/conandata.yml +++ b/recipes/g3log/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.2": + url: "https://github.com/KjellKod/g3log/archive/2.2.tar.gz" + sha256: "9ce18295f71936eaa12d890996ca48fdb578bf0bde16ab652e86b8f30dbe1f1e" + "2.1": + url: "https://github.com/KjellKod/g3log/archive/2.1.tar.gz" + sha256: "13c9d8cc0387792301f264c4f623618fc4dea9814d9b5844931ffbfd9aafb1fe" "1.3.4": url: "https://github.com/KjellKod/g3log/archive/refs/tags/1.3.4.tar.gz" sha256: "2fe8815e5f5afec6b49bdfedfba1e86b8e58a5dc89fd97f4868fb7f3141aed19" @@ -14,3 +20,5 @@ sources: patches: "1.3.2": - patch_file: "patches/0002-remove-explicit-stdlib-setting.patch" + patch_description: "fix compilation and link errors on Linux" + patch_type: "portability" diff --git a/recipes/g3log/all/conanfile.py b/recipes/g3log/all/conanfile.py index 298068a223096..206d4de4cffa8 100644 --- a/recipes/g3log/all/conanfile.py +++ b/recipes/g3log/all/conanfile.py @@ -2,26 +2,25 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir, save +from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get, rmdir, save from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class G3logConan(ConanFile): name = "g3log" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/KjellKod/g3log" - license = "The Unlicense" description = ( "G3log is an asynchronous, \"crash safe\", logger that is easy to use " "with default logging sinks or you can add your own." ) - topics = ("g3log", "log") - + license = "The Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/KjellKod/g3log" + topics = ("logging", "log", "asynchronous") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -46,18 +45,31 @@ class G3logConan(ConanFile): "debug_break_at_fatal_signal": False, } + @property + def _min_cppstd(self): + return 14 if Version(self.version) < "2.0" else 17 + @property def _compilers_minimum_version(self): - return { - "gcc": "6.1", - "clang": "3.4", - "apple-clang": "5.1", - "Visual Studio": "15", - } + if Version(self.version) < "2.0": + return { + "gcc": "6.1", + "clang": "3.4", + "apple-clang": "5.1", + "Visual Studio": "15", + "msvc": "191", + } + else: + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -68,11 +80,11 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, "14") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -80,18 +92,15 @@ def loose_lt_semver(v1, v2): min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] - minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) - if minimum_version and loose_lt_semver(str(self.info.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration( - "{} requires C++14, which your compiler does not support.".format(self.name) - ) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -147,8 +156,13 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "g3log") self.cpp_info.set_property("cmake_target_name", "g3log") self.cpp_info.libs = ["g3logger" if Version(self.version) < "1.3.4" else "g3log"] - if self.settings.os in ["Linux", "Android"]: + + if self.settings.os in ["Linux", "FreeBSD", "Android"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("rt") self.cpp_info.system_libs.append("pthread") + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("dbghelp") # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/g3log/all/test_package/CMakeLists.txt b/recipes/g3log/all/test_package/CMakeLists.txt index 6bcbaa08a0d71..c9d535ba3d96a 100644 --- a/recipes/g3log/all/test_package/CMakeLists.txt +++ b/recipes/g3log/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(g3log REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE g3log) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +if(g3log_VERSION VERSION_LESS 2.0) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/g3log/all/test_v1_package/CMakeLists.txt b/recipes/g3log/all/test_v1_package/CMakeLists.txt index a12ddaa2ea948..be00a8c7f57c7 100644 --- a/recipes/g3log/all/test_v1_package/CMakeLists.txt +++ b/recipes/g3log/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(g3log REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE g3log) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/g3log/config.yml b/recipes/g3log/config.yml index c34ce10c74ca3..dd2ee1df416cc 100644 --- a/recipes/g3log/config.yml +++ b/recipes/g3log/config.yml @@ -1,4 +1,8 @@ versions: + "2.2": + folder: all + "2.1": + folder: all "1.3.4": folder: all "1.3.3": diff --git a/recipes/gainput/all/CMakeLists.txt b/recipes/gainput/all/CMakeLists.txt deleted file mode 100644 index f62f6ae283c5f..0000000000000 --- a/recipes/gainput/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/gainput/all/conandata.yml b/recipes/gainput/all/conandata.yml index c40ee685fc480..663b4be81a94a 100644 --- a/recipes/gainput/all/conandata.yml +++ b/recipes/gainput/all/conandata.yml @@ -5,6 +5,3 @@ sources: patches: "1.0.0": - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-fix-cmake-win32-condition.patch" - base_path: "source_subfolder" diff --git a/recipes/gainput/all/conanfile.py b/recipes/gainput/all/conanfile.py index 804c784b2f7e3..609bad1913a9e 100644 --- a/recipes/gainput/all/conanfile.py +++ b/recipes/gainput/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, CMake, tools -import functools +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class GainputConan(ConanFile): @@ -22,16 +25,8 @@ class GainputConan(ConanFile): "fPIC": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,35 +34,39 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.settings.os in ["Linux", "FreeBSD"]: self.requires("xorg/system") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["GAINPUT_SAMPLES"] = False - cmake.definitions["GAINPUT_TESTS"] = False - cmake.definitions["GAINPUT_BUILD_SHARED"] = self.options.shared - cmake.definitions["GAINPUT_BUILD_STATIC"] = not self.options.shared - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["GAINPUT_SAMPLES"] = False + tc.variables["GAINPUT_TESTS"] = False + tc.variables["GAINPUT_BUILD_SHARED"] = self.options.shared + tc.variables["GAINPUT_BUILD_STATIC"] = not self.options.shared + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): @@ -78,8 +77,8 @@ def package_info(self): self.cpp_info.system_libs.extend(["xinput", "ws2_32"]) elif self.settings.os == "Android": self.cpp_info.system_libs.extend(["native_app_glue", "log", "android"]) - elif tools.is_apple_os(self.settings.os): - self.cpp_info.frameworks.extend(["Foundation", "IOKit", "GameController"]) + elif is_apple_os(self): + self.cpp_info.frameworks.extend(["CoreFoundation", "CoreGraphics", "Foundation", "IOKit", "GameController"]) if self.settings.os == "iOS": self.cpp_info.frameworks.extend(["UIKit", "CoreMotion"]) else: diff --git a/recipes/gainput/all/patches/0001-fix-cmake.patch b/recipes/gainput/all/patches/0001-fix-cmake.patch index 82814407ce388..39ae12ecf689f 100644 --- a/recipes/gainput/all/patches/0001-fix-cmake.patch +++ b/recipes/gainput/all/patches/0001-fix-cmake.patch @@ -1,6 +1,26 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,5 @@ + cmake_minimum_required(VERSION 2.8) ++project(gainput) + set(GAINPUT_MAJOR_VERSION 1) + set(GAINPUT_MINOR_VERSION 0) + set(GAINPUT_PATCH_VERSION 0) +@@ -9,7 +10,7 @@ option(GAINPUT_TESTS "Build Tests for Gainput" ON) + option(GAINPUT_BUILD_SHARED "BUILD_SHARED" ON) + option(GAINPUT_BUILD_STATIC "BUILD_STATIC" ON) + +-if(!WIN32) ++if(NOT WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra") + else() + set(XINPUT "Xinput9_1_0") --- a/lib/CMakeLists.txt +++ b/lib/CMakeLists.txt -@@ -4,7 +4,6 @@ message(STATUS "GAINPUT version ${GAINPUT_VERSION}") +@@ -1,10 +1,8 @@ +-project(gainput) + message(STATUS "GAINPUT version ${GAINPUT_VERSION}") + set(CMAKE_MACOSX_RPATH 1) if(CMAKE_COMPILER_IS_GNUCXX) @@ -8,7 +28,7 @@ endif() include_directories (include/) -@@ -36,12 +35,11 @@ if (GAINPUT_BUILD_STATIC) +@@ -36,12 +34,11 @@ if (GAINPUT_BUILD_STATIC) set(install_libs ${install_libs} gainputstatic) endif (GAINPUT_BUILD_STATIC) @@ -22,7 +42,7 @@ target_link_libraries(gainput native_app_glue log android) elseif(APPLE) find_library(FOUNDATION Foundation) -@@ -58,6 +56,7 @@ elseif(APPLE) +@@ -58,6 +55,7 @@ elseif(APPLE) target_link_libraries(gainput ${APPKIT}) endif() endif() diff --git a/recipes/gainput/all/patches/0002-fix-cmake-win32-condition.patch b/recipes/gainput/all/patches/0002-fix-cmake-win32-condition.patch deleted file mode 100644 index 67267ea9d14b1..0000000000000 --- a/recipes/gainput/all/patches/0002-fix-cmake-win32-condition.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a443b66..2c920eb 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -9,7 +9,7 @@ option(GAINPUT_TESTS "Build Tests for Gainput" ON) - option(GAINPUT_BUILD_SHARED "BUILD_SHARED" ON) - option(GAINPUT_BUILD_STATIC "BUILD_STATIC" ON) - --if(!WIN32) -+if(NOT WIN32) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra") - else() - set(XINPUT "Xinput9_1_0") diff --git a/recipes/gainput/all/test_package/CMakeLists.txt b/recipes/gainput/all/test_package/CMakeLists.txt index 9c4193fe391cf..f0a0ee2f13583 100644 --- a/recipes/gainput/all/test_package/CMakeLists.txt +++ b/recipes/gainput/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(gainput REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} gainput::gainput) +target_link_libraries(${PROJECT_NAME} PRIVATE gainput::gainput) diff --git a/recipes/gainput/all/test_package/conanfile.py b/recipes/gainput/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/gainput/all/test_package/conanfile.py +++ b/recipes/gainput/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gainput/all/test_v1_package/CMakeLists.txt b/recipes/gainput/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7e3274020b8ef --- /dev/null +++ b/recipes/gainput/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(gainput REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gainput::gainput) diff --git a/recipes/gainput/all/test_v1_package/conanfile.py b/recipes/gainput/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/gainput/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/gamma/all/CMakeLists.txt b/recipes/gamma/all/CMakeLists.txt index 13eecd482b342..d7ab29edac81b 100644 --- a/recipes/gamma/all/CMakeLists.txt +++ b/recipes/gamma/all/CMakeLists.txt @@ -1,33 +1,28 @@ cmake_minimum_required(VERSION 3.8) -project(Gamma) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) +project(Gamma LANGUAGES CXX) option(GAMMA_AUDIO_IO "Provide Audio Class" ON) option(GAMMA_SOUNDFILE "Provide SoundFile Class" ON) include(GNUInstallDirs) -set(GAMMA_DIR source_subfolder) - -file(GLOB GAMMA_PUBLIC_HEADERS ${GAMMA_DIR}/Gamma/*.h) +file(GLOB GAMMA_PUBLIC_HEADERS ${GAMMA_SRC_DIR}/Gamma/*.h) add_library(Gamma - ${GAMMA_DIR}/src/arr.cpp - ${GAMMA_DIR}/src/Conversion.cpp - ${GAMMA_DIR}/src/Domain.cpp - ${GAMMA_DIR}/src/DFT.cpp - ${GAMMA_DIR}/src/FFT_fftpack.cpp - ${GAMMA_DIR}/src/fftpack++1.cpp - ${GAMMA_DIR}/src/fftpack++2.cpp - ${GAMMA_DIR}/src/Print.cpp - ${GAMMA_DIR}/src/scl.cpp - ${GAMMA_DIR}/src/Recorder.cpp - ${GAMMA_DIR}/src/Scheduler.cpp - ${GAMMA_DIR}/src/Timer.cpp + ${GAMMA_SRC_DIR}/src/arr.cpp + ${GAMMA_SRC_DIR}/src/Conversion.cpp + ${GAMMA_SRC_DIR}/src/Domain.cpp + ${GAMMA_SRC_DIR}/src/DFT.cpp + ${GAMMA_SRC_DIR}/src/FFT_fftpack.cpp + ${GAMMA_SRC_DIR}/src/fftpack++1.cpp + ${GAMMA_SRC_DIR}/src/fftpack++2.cpp + ${GAMMA_SRC_DIR}/src/Print.cpp + ${GAMMA_SRC_DIR}/src/scl.cpp + ${GAMMA_SRC_DIR}/src/Recorder.cpp + ${GAMMA_SRC_DIR}/src/Scheduler.cpp + ${GAMMA_SRC_DIR}/src/Timer.cpp ) -target_include_directories(Gamma PUBLIC ${GAMMA_DIR}) +target_include_directories(Gamma PUBLIC ${GAMMA_SRC_DIR}) target_compile_features(Gamma PUBLIC cxx_std_14) set_target_properties(Gamma PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) @@ -39,7 +34,7 @@ endif() if(GAMMA_AUDIO_IO) find_package(portaudio REQUIRED CONFIG) target_link_libraries(Gamma PRIVATE portaudio::portaudio) - target_sources(Gamma PRIVATE ${GAMMA_DIR}/src/AudioIO.cpp) + target_sources(Gamma PRIVATE ${GAMMA_SRC_DIR}/src/AudioIO.cpp) else() list(FILTER GAMMA_PUBLIC_HEADERS EXCLUDE REGEX ".*AudioIO\\.h$") endif() @@ -47,7 +42,7 @@ endif() if(GAMMA_SOUNDFILE) find_package(SndFile REQUIRED CONFIG) target_link_libraries(Gamma PRIVATE SndFile::sndfile) - target_sources(Gamma PRIVATE ${GAMMA_DIR}/src/SoundFile.cpp) + target_sources(Gamma PRIVATE ${GAMMA_SRC_DIR}/src/SoundFile.cpp) target_compile_definitions(Gamma PRIVATE GAM_USE_LIBSNDFILE) else() list(FILTER GAMMA_PUBLIC_HEADERS EXCLUDE REGEX ".*SoundFile\\.h$") diff --git a/recipes/gamma/all/conanfile.py b/recipes/gamma/all/conanfile.py index d791afea8a139..451083af4f13c 100644 --- a/recipes/gamma/all/conanfile.py +++ b/recipes/gamma/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.51.1" class Gammaconan(ConanFile): @@ -12,7 +15,7 @@ class Gammaconan(ConanFile): "and filtering of signals." ) license = "MIT" - topics = ("gamma", "signal-processing", "sound", "audio") + topics = ("signal-processing", "sound", "audio") homepage = "https://github.com/LancePutnam/Gamma" url = "https://github.com/conan-io/conan-center-index" @@ -31,11 +34,6 @@ class Gammaconan(ConanFile): } exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -43,41 +41,49 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.soundfile: self.requires("libsndfile/1.0.31") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) - if self.options.audio_io: + if self.info.options.audio_io: # TODO: add audio_io support once portaudio added to CCI raise ConanInvalidConfiguration( "gamma:audio_io=True requires portaudio, not available in conan-center yet" ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["GAMMA_AUDIO_IO"] = self.options.audio_io - cmake.definitions["GAMMA_SOUNDFILE"] = self.options.soundfile - cmake.configure() - return cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["GAMMA_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["GAMMA_AUDIO_IO"] = self.options.audio_io + tc.variables["GAMMA_SOUNDFILE"] = self.options.soundfile + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/gamma/all/test_package/CMakeLists.txt b/recipes/gamma/all/test_package/CMakeLists.txt index f8bf6bdc344e3..98f55fe7ea287 100644 --- a/recipes/gamma/all/test_package/CMakeLists.txt +++ b/recipes/gamma/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(gamma REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} gamma::gamma) +target_link_libraries(${PROJECT_NAME} PRIVATE gamma::gamma) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/gamma/all/test_package/conanfile.py b/recipes/gamma/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/gamma/all/test_package/conanfile.py +++ b/recipes/gamma/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gamma/all/test_v1_package/CMakeLists.txt b/recipes/gamma/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..c32216450f32e --- /dev/null +++ b/recipes/gamma/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(gamma REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gamma::gamma) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/gamma/all/test_v1_package/conanfile.py b/recipes/gamma/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/gamma/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/gcc/all/conandata.yml b/recipes/gcc/all/conandata.yml index 393f23096fa91..f7f3429651883 100644 --- a/recipes/gcc/all/conandata.yml +++ b/recipes/gcc/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "12.2.0": + sha256: ac6b317eb4d25444d87cf29c0d141dedc1323a1833ec9995211b13e1a851261c + url: https://ftp.gnu.org/gnu/gcc/gcc-12.2.0/gcc-12.2.0.tar.gz + "11.3.0": + sha256: 98438e6cc7294298b474cf0da7655d9a8c8b796421bb0210531c294a950374ed + url: https://ftp.gnu.org/gnu/gcc/gcc-11.3.0/gcc-11.3.0.tar.gz "10.2.0": sha256: 27e879dccc639cd7b0cc08ed575c1669492579529b53c9ff27b0b96265fa867d url: https://ftp.gnu.org/gnu/gcc/gcc-10.2.0/gcc-10.2.0.tar.gz diff --git a/recipes/gcc/all/conanfile.py b/recipes/gcc/all/conanfile.py index 309ef5f64d0ab..103152cf95e82 100644 --- a/recipes/gcc/all/conanfile.py +++ b/recipes/gcc/all/conanfile.py @@ -1,126 +1,188 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.errors import ConanInvalidConfiguration +from conan.tools.layout import basic_layout +from conan.tools.apple import XCRun +from conan.tools.files import copy, get, replace_in_file, rmdir, rm +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.29.1" +required_conan_version = ">=1.55.0" class GccConan(ConanFile): name = "gcc" - description = "The GNU Compiler Collection includes front ends for C, " \ - "C++, Objective-C, Fortran, Ada, Go, and D, as well as " \ - "libraries for these languages (libstdc++,...). " + description = ( + "The GNU Compiler Collection includes front ends for C, " + "C++, Objective-C, Fortran, Ada, Go, and D, as well as " + "libraries for these languages (libstdc++,...). " + ) topics = ("gcc", "gnu", "compiler", "c", "c++") homepage = "https://gcc.gnu.org" url = "https://github.com/conan-io/conan-center-index" license = "GPL-3.0-only" settings = "os", "compiler", "arch", "build_type" - _autotools = None - def build_requirements(self): - self.build_requires("flex/2.6.4") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - pkgversion = 'conan GCC %s' % self.version - bugurl = self.url + '/issues' - libdir = "%s/lib/gcc/%s" % (self.package_folder, self.version) - args = [ - "--enable-languages=c,c++", - "--disable-nls", - "--disable-multilib", - "--disable-bootstrap", - "--with-system-zlib", - "--with-gmp=%s" % self.deps_cpp_info['gmp'].rootpath, - '--with-mpc=%s' % self.deps_cpp_info["mpc"].rootpath, - "--with-mpfr=%s" % self.deps_cpp_info["mpfr"].rootpath, - "--without-isl", - "--libdir=%s" % libdir, - '--with-pkgversion=%s' % pkgversion, - "--program-suffix=-%s" % self.version, - "--with-bugurl=%s" % bugurl - ] - if self.settings.os == "Macos": - xcrun = tools.XCRun(self.settings) - args.extend([ - '--with-native-system-header-dir=/usr/include', - "--with-sysroot={}".format(xcrun.sdk_path) - ]) - self._autotools.libs = [] # otherwise causes config.log to fail finding -lmpc + def configure(self): if self.settings.compiler in ["clang", "apple-clang"]: - # xgcc: error: unrecognized command-line option -stdlib=libc++ - if self.settings.compiler.libcxx == "libc++": - self._autotools.cxx_flags.remove("-stdlib=libc++") - elif self.settings.compiler.libcxx in ["libstdc++", "libstdc++11"]: - self._autotools.cxx_flags.remove("-stdlib=libstdc++") - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools - - @property - def _source_subfolder(self): - return "source_subfolder" + # Can't remove this from cxxflags with autotools - so get rid of it + del self.settings.compiler.libcxx + + def build_requirements(self): + if self.settings.os == "Linux": + # binutils recipe is broken for Macos, and Windows uses tools + # distributed with msys/mingw + self.tool_requires("binutils/2.38") + self.tool_requires("flex/2.6.4") def requirements(self): self.requires("mpc/1.2.0") self.requires("mpfr/4.1.0") - self.requires("gmp/6.2.0") - self.requires("zlib/1.2.11") + self.requires("gmp/6.2.1") + self.requires("zlib/1.2.13") + self.requires("isl/0.24") - def configure(self): - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("Windows builds aren't supported (yet), sorry") - if tools.cross_building(self.settings): - raise ConanInvalidConfiguration("no cross-building support (yet), sorry") + def package_id(self): + del self.info.settings.compiler - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "gcc-%s" % self.version - os.rename(extracted_dir, self._source_subfolder) + def validate_build(self): + if is_msvc(self): + raise ConanInvalidConfiguration("GCC can't be built with MSVC") - @property - def _make_args(self): + def validate(self): + if self.settings.os == "Windows": + raise ConanInvalidConfiguration( + "Windows builds aren't currently supported. Contributions to support this are welcome." + ) if self.settings.os == "Macos": - return ["BOOT_LDFLAGS=-Wl,-headerpad_max_install_names"] - return [] + # FIXME: This recipe should largely support Macos, however the following + # errors are present when building using the c3i CI: + # clang: error: unsupported option '-print-multi-os-directory' + # clang: error: no input files + raise ConanInvalidConfiguration( + "Macos builds aren't currently supported. Contributions to support this are welcome." + ) + if cross_building(self): + raise ConanInvalidConfiguration( + "Cross builds are not current supported. Contributions to support this are welcome" + ) + + def layout(self): + basic_layout(self, src_folder="src") + + def generate(self): + # Ensure binutils and flex are on the path. + # TODO: Remove when conan 2.0 is released as this will be default behaviour + buildenv = VirtualBuildEnv(self) + buildenv.generate() + + tc = AutotoolsToolchain(self) + tc.configure_args.append("--enable-languages=c,c++,fortran") + tc.configure_args.append("--disable-nls") + tc.configure_args.append("--disable-multilib") + tc.configure_args.append("--disable-bootstrap") + tc.configure_args.append(f"--with-zlib={self.dependencies['zlib'].package_folder}") + tc.configure_args.append(f"--with-isl={self.dependencies['isl'].package_folder}") + tc.configure_args.append(f"--with-gmp={self.dependencies['gmp'].package_folder}") + tc.configure_args.append(f"--with-mpc={self.dependencies['mpc'].package_folder}") + tc.configure_args.append(f"--with-mpfr={self.dependencies['mpfr'].package_folder}") + tc.configure_args.append(f"--with-pkgversion=conan GCC {self.version}") + tc.configure_args.append(f"--program-suffix=-{self.version}") + tc.configure_args.append(f"--with-bugurl={self.url}/issues") + + if self.settings.os == "Macos": + xcrun = XCRun(self) + tc.configure_args.append(f"--with-sysroot={xcrun.sdk_path}") + # Set native system header dir to ${{sysroot}}/usr/include to + # isolate installation from the system as much as possible + tc.configure_args.append("--with-native-system-header-dir=/usr/include") + tc.make_args.append("BOOT_LDFLAGS=-Wl,-headerpad_max_install_names") + tc.generate() + + # Don't use AutotoolsDeps here - deps are passed directly in configure_args. + # Using AutotoolsDeps causes the compiler tests to fail by erroneously adding + # additional $LIBS to the test compilation + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): # If building on x86_64, change the default directory name for 64-bit libraries to "lib": - libdir = "%s/lib/gcc/%s" % (self.package_folder, self.version) - tools.replace_in_file(os.path.join(self.source_folder, - self._source_subfolder, "gcc", "config", "i386", "t-linux64"), - "m64=../lib64", "m64=../lib", strict=False) + replace_in_file( + self, + os.path.join(self.source_folder, "gcc", "config", "i386", "t-linux64"), + "m64=../lib64", + "m64=../lib", + strict=False, + ) + # Ensure correct install names when linking against libgcc_s; # see discussion in https://github.com/Homebrew/legacy-homebrew/pull/34303 - tools.replace_in_file(os.path.join(self.source_folder, - self._source_subfolder, "libgcc", "config", "t-slibgcc-darwin"), - "@shlib_slibdir@", libdir, strict=False) - autotools = self._configure_autotools() - autotools.make(args=self._make_args) - - def package_id(self): - del self.info.settings.compiler + replace_in_file( + self, + os.path.join(self.source_folder, "libgcc", "config", "t-slibgcc-darwin"), + "@shlib_slibdir@", + os.path.join(self.package_folder, "lib"), + strict=False, + ) + + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - autotools = self._configure_autotools() - if self.settings.build_type == "Debug": - autotools.install(args=self._make_args) - else: - autotools.make(args=["install-strip"] + self._make_args) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(self.package_folder, "*.la") - self.copy(pattern="COPYING*", dst="licenses", src=self._source_subfolder) + autotools = Autotools(self) + autotools.install(target="install-strip") + + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", self.package_folder, recursive=True) + copy( + self, + pattern="COPYING*", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + keep_path=False, + ) def package_info(self): + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("rt") + self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("dl") + bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var with : " + bindir) - self.env_info.PATH.append(bindir) - cc = os.path.join(bindir, "gcc-%s" % self.version) - self.output.info("Creating CC env var with : " + cc) - self.env_info.CC = cc + cc = os.path.join(bindir, f"gcc-{self.version}") + self.output.info("Creating CC env var with: " + cc) + self.buildenv_info.define("CC", cc) - cxx = os.path.join(bindir, "g++-%s" % self.version) - self.output.info("Creating CXX env var with : " + cxx) + cxx = os.path.join(bindir, f"g++-{self.version}") + self.output.info("Creating CXX env var with: " + cxx) + self.buildenv_info.define("CXX", cxx) + + fc = os.path.join(bindir, f"gfortran-{self.version}") + self.output.info("Creating FC env var with: " + fc) + self.buildenv_info.define("FC", fc) + + ar = os.path.join(bindir, f"gcc-ar-{self.version}") + self.output.info("Creating AR env var with: " + ar) + self.buildenv_info.define("AR", ar) + + nm = os.path.join(bindir, f"gcc-nm-{self.version}") + self.output.info("Creating NM env var with: " + nm) + self.buildenv_info.define("NM", nm) + + ranlib = os.path.join(bindir, f"gcc-ranlib-{self.version}") + self.output.info("Creating RANLIB env var with: " + ranlib) + self.buildenv_info.define("RANLIB", ranlib) + + # TODO: Remove after conan 2.0 is released + self.env_info.CC = cc self.env_info.CXX = cxx + self.env_info.FC = fc + self.env_info.AR = ar + self.env_info.NM = nm + self.env_info.RANLIB = ranlib diff --git a/recipes/gcc/all/test_package/conanfile.py b/recipes/gcc/all/test_package/conanfile.py index 05b3ec8808f4c..439f1c3ddfe86 100644 --- a/recipes/gcc/all/test_package/conanfile.py +++ b/recipes/gcc/all/test_package/conanfile.py @@ -1,34 +1,84 @@ -from conans import ConanFile, tools import os +import shutil +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + + @property + def file_io(self): + return { + "c": { + "compiler": "$CC", + "src": os.path.join(self.source_folder, "hello.c"), + "bin": os.path.join(self.build_folder, "hello_c"), + }, + "cpp": { + "compiler": "$CXX", + "src": os.path.join(self.source_folder, "hello.cpp"), + "bin": os.path.join(self.build_folder, "hello_cpp"), + }, + "fortran": { + "compiler": "$FC", + "src": os.path.join(self.source_folder, "hello.f90"), + "bin": os.path.join(self.build_folder, "hello_f90"), + }, + } + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + buildenv = VirtualBuildEnv(self) + buildenv.generate() + + runenv = VirtualRunEnv(self) + runenv.generate() + + def build(self): + self.run("echo PATH: $PATH") + for language, files in self.file_io.items(): + self.output.info(f"Testing build using {language} compiler") + # Confirm compiler is propagated to env + envvar = files["compiler"].split("$")[1] + self.run(f"echo {envvar}: {files['compiler']}", env="conanbuild") + self.run(f"{files['compiler']} --version", env="conanbuild") + self.run(f"{files['compiler']} -dumpversion", env="conanbuild") + + # Confirm files can be compiled + self.run( + f"{files['compiler']} {files['src']} -o {files['bin']}", + env="conanbuild", + ) + self.output.info(f"Successfully built {files['bin']}") def test(self): def chmod_plus_x(name): - if os.name == 'posix': + if os.name == "posix": os.chmod(name, os.stat(name).st_mode | 0o111) - cc = os.environ["CC"] - cxx = os.environ["CXX"] - hello_c = os.path.join(self.source_folder, "hello.c") - hello_cpp = os.path.join(self.source_folder, "hello.cpp") - self.run("%s --version" % cc, run_environment=True) - self.run("%s --version" % cxx, run_environment=True) - self.run("%s -dumpversion" % cc, run_environment=True) - self.run("%s -dumpversion" % cxx, run_environment=True) - self.run("%s %s -o hello_c" % (cc, hello_c), run_environment=True) - self.run("%s %s -o hello_cpp" % (cxx, hello_cpp), run_environment=True) - if not tools.cross_building(self.settings): - chmod_plus_x("hello_c") - chmod_plus_x("hello_cpp") - self.run("./hello_c", run_environment=True) - self.run("./hello_cpp", run_environment=True) - if tools.which("readelf"): - self.run("readelf -l hello_c", run_environment=True) - self.run("readelf -l hello_cpp", run_environment=True) - if tools.which("otool"): - self.run("otool -L hello_c", run_environment=True) - self.run("otool -L hello_cpp", run_environment=True) + for language, files in self.file_io.items(): + self.output.info(f"Testing application built using {language} compiler") + if not cross_building(self): + chmod_plus_x(f"{files['bin']}") + + if self.settings.os == "Linux": + if shutil.which("readelf"): + self.run(f"readelf -l {files['bin']}", env="conanrun") + else: + self.output.info( + "readelf is not on the PATH. Skipping readelf test." + ) + + if self.settings.os == "Macos": + if shutil.which("otool"): + self.run(f"otool -L {files['bin']}", env="conanrun") + else: + self.output.info( + "otool is not on the PATH. Skipping otool test." + ) + + self.run(f"{files['bin']}", env="conanrun") diff --git a/recipes/gcc/all/test_package/hello.c b/recipes/gcc/all/test_package/hello.c index d3e2001010e85..63fdcbf2713ba 100644 --- a/recipes/gcc/all/test_package/hello.c +++ b/recipes/gcc/all/test_package/hello.c @@ -2,7 +2,7 @@ int main() { - puts("Bincrafters\n"); + puts(" gcc: Hello, World!"); return 0; } diff --git a/recipes/gcc/all/test_package/hello.cpp b/recipes/gcc/all/test_package/hello.cpp index 1577292fece17..6cf57370b3281 100644 --- a/recipes/gcc/all/test_package/hello.cpp +++ b/recipes/gcc/all/test_package/hello.cpp @@ -2,7 +2,7 @@ int main() { - std::cout << "Bincrafters\n"; + std::cout << " g++: Hello, World!\n"; return 0; } diff --git a/recipes/gcc/all/test_package/hello.f90 b/recipes/gcc/all/test_package/hello.f90 new file mode 100644 index 0000000000000..ff78fe23454f7 --- /dev/null +++ b/recipes/gcc/all/test_package/hello.f90 @@ -0,0 +1,4 @@ +program hello + implicit none + write(*,*) 'gfortran: Hello, World!' +end program hello diff --git a/recipes/gcc/all/test_v1_package/conanfile.py b/recipes/gcc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a9e585e6ddfd4 --- /dev/null +++ b/recipes/gcc/all/test_v1_package/conanfile.py @@ -0,0 +1,34 @@ +from conans import ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + + def test(self): + def chmod_plus_x(name): + if os.name == 'posix': + os.chmod(name, os.stat(name).st_mode | 0o111) + + cc = self.deps_env_info["gcc"].CC + cxx = self.deps_env_info["gcc"].CXX + hello_c = os.path.join(self.source_folder, "hello.c") + hello_cpp = os.path.join(self.source_folder, "hello.cpp") + self.run("%s --version" % cc, run_environment=True) + self.run("%s --version" % cxx, run_environment=True) + self.run("%s -dumpversion" % cc, run_environment=True) + self.run("%s -dumpversion" % cxx, run_environment=True) + self.run("%s %s -o hello_c" % (cc, hello_c), run_environment=True) + self.run("%s %s -o hello_cpp" % (cxx, hello_cpp), run_environment=True) + if not tools.cross_building(self.settings): + chmod_plus_x("hello_c") + chmod_plus_x("hello_cpp") + self.run("./hello_c", run_environment=True) + self.run("./hello_cpp", run_environment=True) + if tools.which("readelf"): + self.run("readelf -l hello_c", run_environment=True) + self.run("readelf -l hello_cpp", run_environment=True) + if tools.which("otool"): + self.run("otool -L hello_c", run_environment=True) + self.run("otool -L hello_cpp", run_environment=True) diff --git a/recipes/gcc/all/test_v1_package/hello.c b/recipes/gcc/all/test_v1_package/hello.c new file mode 100644 index 0000000000000..52029834a425b --- /dev/null +++ b/recipes/gcc/all/test_v1_package/hello.c @@ -0,0 +1,8 @@ +#include + +int main() +{ + puts("Hello, World!\n"); + return 0; +} + diff --git a/recipes/gcc/all/test_v1_package/hello.cpp b/recipes/gcc/all/test_v1_package/hello.cpp new file mode 100644 index 0000000000000..e59b7b15826e3 --- /dev/null +++ b/recipes/gcc/all/test_v1_package/hello.cpp @@ -0,0 +1,8 @@ +#include + +int main() +{ + std::cout << "Hello, World!\n"; + return 0; +} + diff --git a/recipes/gcc/config.yml b/recipes/gcc/config.yml index f434f75e33a4b..20d860f029e5e 100644 --- a/recipes/gcc/config.yml +++ b/recipes/gcc/config.yml @@ -1,3 +1,7 @@ versions: + "12.2.0": + folder: all + "11.3.0": + folder: all "10.2.0": folder: all diff --git a/recipes/gcem/all/conandata.yml b/recipes/gcem/all/conandata.yml index c1f3e869f5737..58f1cc5b754a9 100644 --- a/recipes/gcem/all/conandata.yml +++ b/recipes/gcem/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.16.0": + url: "https://github.com/kthohr/gcem/archive/v1.16.0.tar.gz" + sha256: "119c742b9371c0adc7d9cd710c3cbc575459a98fb63f6be4c636215dcf8404ce" "1.14.1": url: "https://github.com/kthohr/gcem/archive/v1.14.1.tar.gz" sha256: "fd0860e89f47eeddf5a2280dd6fb3f9b021ce36fe8798116b3f703fa0e01409d" diff --git a/recipes/gcem/all/conanfile.py b/recipes/gcem/all/conanfile.py index 704c38286eb3c..90bc15dd9edc5 100644 --- a/recipes/gcem/all/conanfile.py +++ b/recipes/gcem/all/conanfile.py @@ -1,7 +1,12 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, save +from conan.tools.layout import basic_layout import os +import textwrap + +required_conan_version = ">=1.50.0" -required_conan_version = ">=1.33.0" class GcemConan(ConanFile): name = "gcem" @@ -14,22 +19,54 @@ class GcemConan(ConanFile): no_copy_source = True settings = "os", "arch", "compiler", "build_type", - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy(pattern="*", dst="include", - src=os.path.join(self._source_subfolder, "include")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) - def package_id(self): - self.info.header_only() + # TODO: to remove in conan v2 + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {"gcem": "gcem::gcem"}, + ) + + def _create_cmake_module_alias_targets(self, module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent(f"""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "gcem") + self.cpp_info.set_property("cmake_target_name", "gcem") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + # TODO: to remove in conan v2 + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/gcem/all/test_package/CMakeLists.txt b/recipes/gcem/all/test_package/CMakeLists.txt index 0204806165c23..434ba12e4a1c5 100644 --- a/recipes/gcem/all/test_package/CMakeLists.txt +++ b/recipes/gcem/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(gcem CONFIG REQUIRED) +find_package(gcem REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} gcem::gcem) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE gcem) +target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/gcem/all/test_package/conanfile.py b/recipes/gcem/all/test_package/conanfile.py index 8adcbaf0b4bc6..0a6bc68712d90 100644 --- a/recipes/gcem/all/test_package/conanfile.py +++ b/recipes/gcem/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type", - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin","test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gcem/all/test_v1_package/CMakeLists.txt b/recipes/gcem/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/gcem/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gcem/all/test_v1_package/conanfile.py b/recipes/gcem/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..071ca3ed857af --- /dev/null +++ b/recipes/gcem/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type", + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin","test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/gcem/config.yml b/recipes/gcem/config.yml index 0a915e1d20f7d..cc18649bfe195 100644 --- a/recipes/gcem/config.yml +++ b/recipes/gcem/config.yml @@ -1,4 +1,6 @@ versions: + "1.16.0": + folder: all "1.14.1": folder: all "1.13.1": diff --git a/recipes/gdal/config.yml b/recipes/gdal/config.yml index 5c91c444b2c8a..3a324b7465d34 100644 --- a/recipes/gdal/config.yml +++ b/recipes/gdal/config.yml @@ -1,4 +1,8 @@ versions: + "3.5.2": + folder: "post_3.5.0" + "3.5.1": + folder: "post_3.5.0" "3.4.3": folder: "pre_3.5.0" "3.4.1": diff --git a/recipes/gdal/post_3.5.0/CMakeLists.txt b/recipes/gdal/post_3.5.0/CMakeLists.txt new file mode 100644 index 0000000000000..c0e666f41f1de --- /dev/null +++ b/recipes/gdal/post_3.5.0/CMakeLists.txt @@ -0,0 +1,117 @@ +cmake_minimum_required(VERSION 3.15) +project(gdal_cmake_wrapper) + +set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}) +include(conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +include(CMakePushCheckState) + + +if (${GDAL_USE_POPPLER}) + find_package(poppler) + set(Poppler_VERSION_STRING ${poppler_VERSION}) + add_library(Poppler::Poppler ALIAS poppler::libpoppler) +endif() + +file(GLOB CONAN_GENERATED_CMAKE_FILES "${CMAKE_CURRENT_SOURCE_DIR}/Find*.cmake") +foreach(CMAKE_FILE ${CONAN_GENERATED_CMAKE_FILES}) + include(${CMAKE_FILE}) +endforeach() + +if (${GDAL_USE_ARROW}) + find_package(Arrow REQUIRED) + add_library(arrow_shared ALIAS arrow::arrow) +endif() + +if (${GDAL_USE_CRYPTOPP}) + find_package(cryptopp REQUIRED) + add_library(CRYPTOPP::CRYPTOPP ALIAS cryptopp::cryptopp-static) +endif() + +if (${GDAL_USE_DEFLATE}) + find_package(libdeflate REQUIRED) + add_library(Deflate::Deflate ALIAS libdeflate::libdeflate) +endif() + +if (${GDAL_USE_LZ4}) + find_package(lz4 REQUIRED) + add_library(LZ4::LZ4 ALIAS lz4::lz4) +endif() + +if (${GDAL_USE_BLOSC}) + find_package(c-blosc REQUIRED) + add_library(Blosc::Blosc ALIAS c-blosc::c-blosc) +endif() + +if (${GDAL_USE_OPENEXR}) + find_package(Imath REQUIRED) + find_package(OpenEXR REQUIRED) + add_library(OpenEXR::IlmImf ALIAS OpenEXR::IlmThread) + add_library(OpenEXR::IlmImfUtil ALIAS OpenEXR::OpenEXR) + add_library(OpenEXR::Half ALIAS Imath::Imath) + # gdal includes without "Imath/" folder prefix + target_include_directories(Imath::Imath INTERFACE ${Imath_INCLUDE_DIR}) + # and also without "OpenEXR/" prefix + target_include_directories(OpenEXR::OpenEXR INTERFACE ${OpenEXR_INCLUDE_DIR}) +endif() + +if (${GDAL_USE_FREEXL}) + find_package(freexl REQUIRED) + add_library(FREEXL::freexl ALIAS freexl::freexl) +endif() + +if (${GDAL_USE_OPENJPEG}) + add_library(OPENJPEG::OpenJPEG ALIAS OpenJPEG::OpenJPEG) +endif() + +if (${GDAL_USE_GIF}) + find_package(GIF REQUIRED) +endif() + +if (${GDAL_USE_CFITSIO}) + find_package(cfitsio) + add_library(CFITSIO::CFITSIO ALIAS cfitsio::cfitsio) +endif() + +if (${GDAL_USE_SQLITE3}) + find_package(SQLite3) +endif() + +if (${GDAL_USE_LIBXML2}) + find_package(LibXml2) +endif() + +if (${GDAL_USE_POSTGRESQL}) + find_package(PostgreSQL) + add_library(PostgreSQL::PostgreSQL ALIAS PostgreSQL::pq) +endif() + +if (${GDAL_USE_HDF5}) + find_package(HDF5) + set(HDF5_C_LIBRARIES HDF5::C) +endif() + +if ("${GDAL_CONAN_PACKAGE_FOR_MYSQL}" STREQUAL "libmysqlclient") + find_package(mysql REQUIRED) +endif() +if ("${GDAL_CONAN_PACKAGE_FOR_MYSQL}" STREQUAL "mariadb-connector-c") + find_package(mariadb-connector-c REQUIRED) +endif() + +if (${GDAL_USE_ZLIB}) + find_package(ZLIB) +endif() + +if ("${GDAL_CONAN_PACKAGE_FOR_JPEG}" STREQUAL "libjpeg-turbo") + find_package(libjpeg-turbo REQUIRED) + add_library(JPEG::JPEG ALIAS ${TARGET_FOR_JPEG}) +endif() + +if (${GDAL_USE_PCRE2}) + find_package(PCRE2 REQUIRED) + add_library(PCRE2::PCRE2-8 ALIAS PCRE2::8BIT) +endif() + + +add_subdirectory("source_subfolder") diff --git a/recipes/gdal/post_3.5.0/conandata.yml b/recipes/gdal/post_3.5.0/conandata.yml new file mode 100644 index 0000000000000..2dbc2d17b374f --- /dev/null +++ b/recipes/gdal/post_3.5.0/conandata.yml @@ -0,0 +1,14 @@ +sources: + "3.5.2": + url: "https://github.com/OSGeo/gdal/releases/download/v3.5.2/gdal-3.5.2.tar.gz" + sha256: "fbd696e1b2a858fbd2eb3718db16b14ed9ba82521d3578770d480c74fe1146d2" + "3.5.1": + url: "https://github.com/OSGeo/gdal/releases/download/v3.5.1/gdal-3.5.1.tar.gz" + sha256: "7c4406ca010dc8632703a0a326f39e9db25d9f1f6ebaaeca64a963e3fac123d1" +patches: + "3.5.2": + - patch_file: "patches/3.5.2/0-replace-find-package.patch" + base_path: "source_subfolder" + "3.5.1": + - patch_file: "patches/3.5.1/0-replace-find-package.patch" + base_path: "source_subfolder" diff --git a/recipes/gdal/post_3.5.0/conanfile.py b/recipes/gdal/post_3.5.0/conanfile.py new file mode 100644 index 0000000000000..d03de4e5125cc --- /dev/null +++ b/recipes/gdal/post_3.5.0/conanfile.py @@ -0,0 +1,899 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, get, files +from conan.errors import ConanInvalidConfiguration +from conans import CMake +import functools +import os + +class GdalConan(ConanFile): + name = "gdal" + description = "GDAL is an open source X/MIT licensed translator library " \ + "for raster and vector geospatial data formats." + license = "MIT" + topics = ("osgeo", "geospatial", "raster", "vector") + homepage = "https://github.com/OSGeo/gdal" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + + generators = "cmake", "cmake_find_package", "cmake_find_package_multi" + + # A list of gdal dependencies can be taken from cmake/helpers/CheckDependentLibraries.cmake + # within gdal sources with the command: + # grep -E '^[ \t]*gdal_check_package\(' cmake/helpers/CheckDependentLibraries.cmake \ + # | sed 's/[ \t]*gdal_check_package(\([a-zA-Z_0-9]\+\) "\(.*\)"\(.*\)/{ 'dep': \'\1\', 'descr': \'\2\' },/' \ + # | sort | uniq + + options = { + "shared": [True, False], + "fPIC": [True, False], + "tools": [True, False], + "with_armadillo": [True, False], + "with_arrow": [True, False], + "with_blosc": [True, False], + "with_cfitsio": [True, False], + # with_cypto option has been renamed with_openssl in version 3.5.1 + "with_crypto": [True, False, "deprecated"], + "with_cryptopp": [True, False], + "with_curl": [True, False], + "with_dds": [True, False], + "with_expat": [True, False], + "with_exr": [True, False], + "with_freexl": [True, False], + "with_geos": [True, False], + "with_gif": [True, False], + "with_gta": [True, False], + "with_hdf4": [True, False], + "with_hdf5": [True, False], + "with_heif": [True, False], + "with_kea": [True, False], + "with_libdeflate": [True, False], + "with_libiconv": [True, False], + "with_jpeg": [None, "libjpeg", "libjpeg-turbo"], + "with_libkml": [True, False], + "with_libtiff": [True, False], + "with_lz4": [True, False], + "with_mongocxx": [True, False], + "with_mysql": [None, "libmysqlclient", "mariadb-connector-c"], + "with_netcdf": [True, False], + "with_odbc": [True, False], + "with_openjpeg": [True, False], + "with_openssl": [True, False], + "with_pcre": [True, False], + "with_pcre2": [True, False], + "with_pg": [True, False], + "with_png": [True, False], + "with_podofo": [True, False], + "with_poppler": [True, False], + "with_proj": [True, False], + "with_qhull": [True, False], + "with_sqlite3": [True, False], + "with_webp": [True, False], + "with_xerces": [True, False], + "with_xml2": [True, False], + "with_zlib": [True, False], + "with_zstd": [True, False], + } + + default_options = { + "shared": False, + "fPIC": True, + "tools": False, + "with_armadillo": False, + "with_arrow": False, + "with_blosc": False, + "with_cfitsio": False, + "with_crypto": "deprecated", + "with_cryptopp": False, + "with_curl": False, + "with_dds": False, + "with_expat": False, + "with_exr": False, + "with_freexl": False, + "with_geos": True, + "with_gif": True, + "with_gta": False, + "with_hdf4": False, + "with_hdf5": False, + "with_heif": False, + "with_kea": False, + "with_libdeflate": True, + "with_libiconv": True, + "with_jpeg": "libjpeg", + "with_libkml": False, + "with_libtiff": True, + "with_lz4": False, + "with_mongocxx": False, + "with_mysql": None, + "with_netcdf": False, + "with_odbc": False, + "with_openjpeg": False, + "with_openssl": False, + "with_pcre": False, + "with_pcre2": False, + "with_pg": False, + "with_png": True, + "with_podofo": False, + "with_poppler": False, + "with_proj": True, + "with_qhull": True, + "with_sqlite3": True, + "with_webp": False, + "with_xerces": False, + "with_xml2": False, + "with_zlib": True, + "with_zstd": False, + } + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build" + + def export_sources(self): + self.copy("CMakeLists.txt") + for patch in self.conan_data.get("patches", {}).get(self.version, []): + self.copy(patch["patch_file"]) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.with_crypto != "deprecated": + self.output.error("with_crypto option is deprecated, use with_openssl instead.") + + if self.options.shared: + try: + del self.options.fPIC + except: + pass + + def requirements(self): + self.requires("json-c/0.16") + self.requires("libgeotiff/1.7.1") + + if self.options.with_armadillo: + self.requires("armadillo/10.7.3") + + if self.options.with_arrow: + self.requires("arrow/8.0.1") + + if self.options.with_blosc: + self.requires("c-blosc/1.21.1") + + if self.options.with_cfitsio: + self.requires("cfitsio/4.1.0") + + if self.options.with_cryptopp: + self.requires("cryptopp/8.7.0") + + if self.options.with_curl: + self.requires("libcurl/7.85.0") + + if self.options.with_dds: + self.requires("crunch/cci.20190615") + + if self.options.with_expat: + self.requires("expat/2.4.9") + + if self.options.with_exr: + self.requires("openexr/3.1.5") + self.requires("imath/3.1.5") + + if self.options.with_freexl: + self.requires("freexl/1.0.6") + + if self.options.with_geos: + self.requires("geos/3.11.0") + + if self.options.with_gif: + self.requires("giflib/5.2.1") + + if self.options.with_gta: + self.requires("libgta/1.2.1") + + if self.options.with_hdf4: + self.requires("hdf4/4.2.15") + + if self.options.with_hdf5: + self.requires("hdf5/1.13.1") + + if self.options.with_heif: + self.requires("libheif/1.13.0") + + if self.options.with_jpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.with_jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + + if self.options.with_kea: + self.requires("kealib/1.4.14") + + if self.options.with_libdeflate: + self.requires("libdeflate/1.12") + + if self.options.with_libiconv: + self.requires("libiconv/1.17") + + if self.options.with_libkml: + self.requires("libkml/1.3.0") + + if self.options.with_libtiff: + self.requires("libtiff/4.4.0") + + if self.options.with_lz4: + self.requires("lz4/1.9.4") + + if self.options.with_mongocxx: + self.requires("mongo-cxx-driver/3.6.7") + + if self.options.with_mysql == "libmysqlclient": + self.requires("libmysqlclient/8.0.30") + elif self.options.with_mysql == "mariadb-connector-c": + self.requires("mariadb-connector-c/3.1.12") + + if self.options.with_netcdf: + self.requires("netcdf/4.8.1") + + if self.options.with_odbc: + self.requires("odbc/2.3.11") + + if self.options.with_openjpeg: + self.requires("openjpeg/2.5.0") + + if self.options.with_openssl: + self.requires("openssl/1.1.1q") + + if self.options.with_pcre: + self.requires("pcre/8.45") + + if self.options.with_pcre2: + self.requires("pcre2/10.40") + + if self.options.with_pg: + self.requires("libpq/14.5") + + if self.options.with_png: + self.requires("libpng/1.6.38") + + if self.options.with_podofo: + self.requires("podofo/0.9.7") + + if self.options.with_poppler: + self.requires("poppler/21.07.0") + + if self.options.with_proj: + self.requires("proj/9.0.1") + + if self.options.with_qhull: + self.requires("qhull/8.0.1") + + if self.options.with_sqlite3: + self.requires("sqlite3/3.39.3") + + if self.options.with_webp: + self.requires("libwebp/1.2.4") + + if self.options.with_xerces: + self.requires("xerces-c/3.2.3") + + if self.options.with_xml2: + self.requires("libxml2/2.9.14") + + if self.options.with_zlib: + self.requires("zlib/1.2.12") + + if self.options.with_zstd: + self.requires("zstd/1.5.2") + + def package_id(self): + del self.info.options.with_crypto + + def validate(self): + if self.options.get_safe("with_pcre") and self.options.get_safe("with_pcre2"): + raise ConanInvalidConfiguration("Enable either pcre or pcre2, not both") + + if self.options.get_safe("with_sqlite3") and not self.options["sqlite3"].enable_column_metadata: + raise ConanInvalidConfiguration("gdql requires sqlite3:enable_column_metadata=True") + + if self.options.get_safe("with_libtiff") and self.options["libtiff"].jpeg != self.options.get_safe("with_jpeg"): + msg = "libtiff:jpeg and gdal:with_jpeg must be set to the same value, either libjpeg or libjpeg-turbo." + # For some reason, the ConanInvalidConfiguration message is not shown, only + # ERROR: At least two recipes provides the same functionality: + # - 'libjpeg' provided by 'libjpeg-turbo/2.1.2', 'libjpeg/9d' + # So we print the error message manually. + self.output.error(msg) + raise ConanInvalidConfiguration(msg) + + if self.options.get_safe("with_poppler") and self.options["poppler"].with_libjpeg != self.options.get_safe("with_jpeg"): + msg = "poppler:with_libjpeg and gdal:with_jpeg must be set to the same value, either libjpeg or libjpeg-turbo." + self.output.error(msg) + raise ConanInvalidConfiguration(msg) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + @functools.lru_cache(1) + def _configure_cmake(self): + cmake = CMake(self) + + if self.options.get_safe("fPIC", True): + cmake.definitions[ + "GDAL_OBJECT_LIBRARIES_POSITION_INDEPENDENT_CODE"] = True + + cmake.definitions["BUILD_JAVA_BINDINGS"] = False + cmake.definitions["BUILD_CSHARP_BINDINGS"] = False + cmake.definitions["BUILD_PYTHON_BINDINGS"] = False + + cmake.definitions["BUILD_TESTING"] = False + cmake.definitions["GDAL_USE_ZLIB_INTERNAL"] = False + cmake.definitions["GDAL_USE_JSONC_INTERNAL"] = False + cmake.definitions["GDAL_USE_JPEG_INTERNAL"] = False + cmake.definitions["GDAL_USE_JPEG12_INTERNAL"] = False + cmake.definitions["GDAL_USE_TIFF_INTERNAL"] = False + cmake.definitions["GDAL_USE_GEOTIFF_INTERNAL"] = False + cmake.definitions["GDAL_USE_GIF_INTERNAL"] = False + cmake.definitions["GDAL_USE_PNG_INTERNAL"] = False + + cmake.definitions["GDAL_USE_LERC_INTERNAL"] = True + cmake.definitions["GDAL_USE_SHAPELIB_INTERNAL"] = True + + cmake.definitions["BUILD_APPS"] = self.options.tools + + cmake.definitions["SQLite3_HAS_COLUMN_METADATA"] = \ + self.options["sqlite3"].enable_column_metadata + + cmake.definitions["SQLite3_HAS_RTREE"] = self.options[ + "sqlite3"].enable_rtree + + cmake.definitions["GDAL_USE_JSONC"] = True + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_JSONC"] = "json-c" + + cmake.definitions["GDAL_USE_GEOTIFF"] = True + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_GEOTIFF"] = "libgeotiff" + cmake.definitions["TARGET_FOR_GEOTIFF"] = "GeoTIFF::GeoTIFF" + + cmake.definitions["GDAL_USE_ARMADILLO"] = self.options.with_armadillo + if self.options.with_armadillo: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_ARMADILLO"] = "armadillo" + cmake.definitions["TARGET_FOR_ARMADILLO"] = \ + self.dependencies["armadillo"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["Armadillo_FOUND"] = False + + cmake.definitions["GDAL_USE_ARROW"] = self.options.with_arrow + if self.options.with_arrow: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_ARROW"] = "arrow" + cmake.definitions["TARGET_FOR_ARROW"] = \ + self.dependencies["arrow"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["Arrow_FOUND"] = False + + cmake.definitions["GDAL_USE_BLOSC"] = self.options.with_blosc + if self.options.with_blosc: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_BLOSC"] = "c-blosc" + cmake.definitions["TARGET_FOR_BLOSC"] = \ + self.dependencies["c-blosc"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["Blosc_FOUND"] = False + + cmake.definitions["GDAL_USE_CFITSIO"] = self.options.with_cfitsio + if self.options.with_cfitsio: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_CFITSIO"] = "cfitsio" + cmake.definitions["TARGET_FOR_CFITSIO"] = \ + self.dependencies["cfitsio"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["CFITSIO_FOUND"] = False + + cmake.definitions["GDAL_USE_CRYPTOPP"] = self.options.with_cryptopp + if self.options.with_cryptopp: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_CRYPTOPP"] = "cryptopp" + cmake.definitions["TARGET_FOR_CRYPTOPP"] = \ + self.dependencies["cryptopp"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["CryptoPP_FOUND"] = False + + cmake.definitions["GDAL_USE_CURL"] = self.options.with_curl + if self.options.with_curl: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_CURL"] = "libcurl" + cmake.definitions["TARGET_FOR_CURL"] = \ + self.dependencies["libcurl"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["CURL_FOUND"] = False + + cmake.definitions["GDAL_USE_CRNLIB"] = self.options.with_dds + if self.options.with_dds: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_CRNLIB"] = "crunch" + cmake.definitions["TARGET_FOR_CRNLIB"] = \ + self.dependencies["crunch"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["Crnlib_FOUND"] = False + + cmake.definitions["GDAL_USE_EXPAT"] = self.options.with_expat + if self.options.with_expat: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_EXPAT"] = "expat" + cmake.definitions["TARGET_FOR_EXPAT"] = "EXPAT::EXPAT" + else: + cmake.definitions["EXPAT_FOUND"] = False + + cmake.definitions["GDAL_USE_OPENEXR"] = self.options.with_exr + if self.options.with_exr: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_OPENEXR"] = "openexr" + cmake.definitions["TARGET_FOR_OPENEXR"] = \ + self.dependencies["openexr"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["OpenEXR_FOUND"] = False + + cmake.definitions["GDAL_USE_FREEXL"] = self.options.with_freexl + if self.options.with_freexl: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_FREEXL"] = "freexl" + cmake.definitions["TARGET_FOR_FREEXL"] = "freexl::freexl" + else: + cmake.definitions["FreeXL_FOUND"] = False + + cmake.definitions["GDAL_USE_GEOS"] = self.options.with_geos + if self.options.with_geos: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_GEOS"] = "geos" + cmake.definitions["TARGET_FOR_GEOS"] = \ + self.dependencies["geos"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["GEOS_FOUND"] = False + + cmake.definitions["GDAL_USE_GIF"] = self.options.with_gif + if self.options.with_gif: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_GIF"] = "giflib" + cmake.definitions["TARGET_FOR_GIF"] = \ + self.dependencies["giflib"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["GIF_FOUND"] = False + + cmake.definitions["GDAL_USE_GTA"] = self.options.with_gta + if self.options.with_gta: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_GTA"] = "libgta" + cmake.definitions["TARGET_FOR_GTA"] = \ + self.dependencies["libgta"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["GTA_FOUND"] = False + + cmake.definitions["GDAL_USE_HDF4"] = self.options.with_hdf4 + if self.options.with_hdf4: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_HDF4"] = "hdf4" + cmake.definitions["TARGET_FOR_HDF4"] = \ + self.dependencies["hdf4"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["HDF4_FOUND"] = False + + cmake.definitions["GDAL_USE_HDF5"] = self.options.with_hdf5 + if self.options.with_hdf5: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_HDF5"] = "hdf5" + cmake.definitions["TARGET_FOR_HDF5"] = \ + self.dependencies["hdf5"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["HDF5_FOUND"] = False + + cmake.definitions["GDAL_USE_HEIF"] = self.options.with_heif + if self.options.with_heif: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_HEIF"] = "libheif" + cmake.definitions["TARGET_FOR_HEIF"] = \ + self.dependencies["libheif"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["HEIF_FOUND"] = False + + cmake.definitions["GDAL_USE_KEA"] = self.options.with_kea + if self.options.with_kea: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_KEA"] = "kealib" + cmake.definitions["TARGET_FOR_KEA"] = \ + self.dependencies["kealib"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["KEA_FOUND"] = False + + cmake.definitions["GDAL_USE_DEFLATE"] = self.options.with_libdeflate + if self.options.with_libdeflate: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_DEFLATE"] = "libdeflate" + cmake.definitions["TARGET_FOR_DEFLATE"] = \ + self.dependencies["libdeflate"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["Deflate_FOUND"] = False + + cmake.definitions["GDAL_USE_ICONV"] = self.options.with_libiconv + if self.options.with_libiconv: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_ICONV"] = "libiconv" + cmake.definitions["TARGET_FOR_ICONV"] = \ + self.dependencies["libiconv"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["Iconv_FOUND"] = False + + if self.options.with_jpeg == "libjpeg" or self.options.with_jpeg == "libjpeg-turbo": + print(f'self.options.with_jpeg: {self.options.with_jpeg}') + cmake.definitions["GDAL_USE_JPEG"] = True + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_JPEG"] = self.options.with_jpeg + cmake.definitions["TARGET_FOR_JPEG"] = ( + "JPEG::JPEG" if self.options.with_jpeg == "libjpeg" else + self.dependencies["libjpeg-turbo"].cpp_info.components["turbojpeg"] \ + .get_property("cmake_target_name")) + else: + cmake.definitions["JPEG_FOUND"] = False + + cmake.definitions["GDAL_USE_LIBKML"] = self.options.with_libkml + if self.options.with_libkml: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_LIBKML"] = "libkml" + cmake.definitions["TARGET_FOR_LIBKML"] = \ + self.dependencies["libkml"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["LibKML_FOUND"] = False + + cmake.definitions["GDAL_USE_TIFF"] = self.options.with_libtiff + if self.options.with_libtiff: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_TIFF"] = "libtiff" + cmake.definitions["TARGET_FOR_TIFF"] = \ + self.dependencies["libtiff"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["TIFF_FOUND"] = False + + cmake.definitions["GDAL_USE_LZ4"] = self.options.with_lz4 + if self.options.with_lz4: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_LZ4"] = "lz4" + cmake.definitions["TARGET_FOR_LZ4"] = \ + self.dependencies["lz4"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["LZ4_FOUND"] = False + + cmake.definitions["GDAL_USE_MONGOCXX"] = self.options.with_mongocxx + if self.options.with_mongocxx: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_MONGOCXX"] = "mongo-cxx-driver" + cmake.definitions["TARGET_FOR_MONGOCXX"] = \ + self.dependencies["mongo-cxx-driver"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["MONGOCXX_FOUND"] = False + + if self.options.with_mysql == "libmysqlclient" or self.options.with_mysql == "mariadb-connector-c": + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_MYSQL"] = str(self.options.with_mysql) + cmake.definitions["TARGET_FOR_MYSQL"] = \ + "mariadb-connector-c::mariadb-connector-c" \ + if self.options.with_mysql == "mariadb-connector-c" \ + else "libmysqlclient::libmysqlclient" + else: + cmake.definitions["MYSQL_FOUND"] = False + + cmake.definitions["GDAL_USE_NETCDF"] = self.options.with_netcdf + if self.options.with_netcdf: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_NETCDF"] = "netcdf" + cmake.definitions["TARGET_FOR_NETCDF"] = \ + self.dependencies["netcdf"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["NetCDF_FOUND"] = False + + cmake.definitions["GDAL_USE_ODBC"] = self.options.with_odbc + if self.options.with_odbc: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_ODBC"] = "odbc" + cmake.definitions["TARGET_FOR_ODBC"] = \ + self.dependencies["odbc"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["ODBC_FOUND"] = False + + cmake.definitions["GDAL_USE_OPENJPEG"] = self.options.with_openjpeg + if self.options.with_openjpeg: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_OPENJPEG"] = "openjpeg" + cmake.definitions["TARGET_FOR_OPENJPEG"] = \ + self.dependencies["openjpeg"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["OPENJPEG_FOUND"] = False + + cmake.definitions["GDAL_USE_OPENSSL"] = self.options.with_openssl + if self.options.with_openssl: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_OPENSSL"] = "openssl" + cmake.definitions["TARGET_FOR_OPENSSL"] = \ + self.dependencies["openssl"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["OpenSSL_FOUND"] = False + + cmake.definitions["GDAL_USE_PCRE"] = self.options.with_pcre + if self.options.with_pcre: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_PCRE"] = "pcre" + cmake.definitions["TARGET_FOR_PCRE"] = \ + self.dependencies["pcre"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["PCRE_FOUND"] = False + + cmake.definitions["GDAL_USE_PCRE2"] = self.options.with_pcre2 + if self.options.with_pcre2: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_PCRE2"] = "pcre2" + cmake.definitions["TARGET_FOR_PCRE2"] = \ + self.dependencies["pcre2"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["PCRE2_FOUND"] = False + + cmake.definitions["GDAL_USE_PDFIUM"] = False + cmake.definitions["PDFIUM_FOUND"] = False + + cmake.definitions["GDAL_USE_POSTGRESQL"] = self.options.with_pg + if self.options.with_pg: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_POSTGRESQL"] = "libpq" + cmake.definitions["TARGET_FOR_POSTGRESQL"] = \ + self.dependencies["libpq"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["PostgreSQL_FOUND"] = False + + cmake.definitions["GDAL_USE_PNG"] = self.options.with_png + if self.options.with_png: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_PNG"] = "libpng" + cmake.definitions["TARGET_FOR_PNG"] = \ + self.dependencies["libpng"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["PNG_FOUND"] = False + + cmake.definitions["GDAL_USE_PODOFO"] = self.options.with_podofo + if self.options.with_podofo: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_PODOFO"] = "podofo" + cmake.definitions["TARGET_FOR_PODOFO"] = \ + self.dependencies["podofo"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["Podofo_FOUND"] = False + + cmake.definitions["GDAL_USE_POPPLER"] = self.options.with_poppler + if self.options.with_poppler: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_POPPLER"] = "poppler" + cmake.definitions["TARGET_FOR_POPPLER"] = \ + self.dependencies["poppler"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["Poppler_FOUND"] = False + + cmake.definitions["GDAL_USE_PROJ"] = self.options.with_proj + if self.options.with_proj: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_PROJ"] = "proj" + cmake.definitions["TARGET_FOR_PROJ"] = \ + self.dependencies["proj"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["PROJ_FOUND"] = False + + cmake.definitions["GDAL_USE_QHULL"] = self.options.with_qhull + if self.options.with_qhull: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_QHULL"] = "qhull" + cmake.definitions["TARGET_FOR_QHULL"] = \ + self.dependencies["qhull"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["QHULL_FOUND"] = False + + cmake.definitions["GDAL_USE_SQLITE3"] = self.options.with_sqlite3 + if self.options.with_sqlite3: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_SQLITE3"] = "sqlite3" + cmake.definitions["TARGET_FOR_SQLITE3"] = \ + self.dependencies["sqlite3"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["SQLite3_FOUND"] = False + + cmake.definitions["GDAL_USE_WEBP"] = self.options.with_webp + if self.options.with_webp: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_WEBP"] = "libwebp" + cmake.definitions["TARGET_FOR_WEBP"] = \ + self.dependencies["libwebp"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["WebP_FOUND"] = False + + cmake.definitions["GDAL_USE_XERCESC"] = self.options.with_xerces + if self.options.with_xerces: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_XERCESC"] = "xerces-c" + cmake.definitions["TARGET_FOR_XERCESC"] = \ + self.dependencies["xerces-c"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["XercesC_FOUND"] = False + + cmake.definitions["GDAL_USE_LIBXML2"] = self.options.with_xml2 + if self.options.with_xml2: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_LIBXML2"] = "libxml2" + cmake.definitions["TARGET_FOR_LIBXML2"] = \ + self.dependencies["libxml2"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["LibXml2_FOUND"] = False + + cmake.definitions["GDAL_USE_ZLIB"] = self.options.with_zlib + if self.options.with_zlib: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_ZLIB"] = "zlib" + cmake.definitions["TARGET_FOR_ZLIB"] = \ + self.dependencies["zlib"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["ZLIB_FOUND"] = False + + cmake.definitions["GDAL_USE_ZSTD"] = self.options.with_zstd + if self.options.with_zstd: + cmake.definitions["GDAL_CONAN_PACKAGE_FOR_ZSTD"] = "zstd" + cmake.definitions["TARGET_FOR_ZSTD"] = \ + self.dependencies["zstd"].cpp_info.get_property("cmake_target_name") + else: + cmake.definitions["ZSTD_FOUND"] = False + + + for k, v in cmake.definitions.items(): + print(k, " = ", v) + + cmake.configure(build_folder=self._build_subfolder) + return cmake + + def build(self): + apply_conandata_patches(self) + cmake = self._configure_cmake() + + cmake.build() + + def package(self): + self.copy("LICENSE.TXT", dst="licenses", src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + + files.rmdir(self, os.path.join(self.package_folder, "share")) + files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + + self.cpp_info.set_property("cmake_file_name", "GDAL") + self.cpp_info.set_property("cmake_target_name", "GDAL::GDAL") + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("pkg_config_name", "gdal") + + self.cpp_info.names["cmake_find_package"] = "GDAL" + self.cpp_info.names["cmake_find_package_multi"] = "GDAL" + self.cpp_info.filenames["cmake_find_package"] = "GDAL" + self.cpp_info.filenames["cmake_find_package_multi"] = "GDAL" + + libname = "gdal" + if self.settings.os == "Windows": + if self.settings.build_type == "Debug": + libname += "d" + self.cpp_info.libs = [ libname ] + + self.cpp_info.requires.extend(['json-c::json-c']) + self.cpp_info.requires.extend(['libgeotiff::libgeotiff']) + + if self.options.with_armadillo: + self.cpp_info.requires.extend(['armadillo::armadillo']) + + if self.options.with_arrow: + self.cpp_info.requires.extend(['arrow::libarrow']) + + if self.options.with_blosc: + self.cpp_info.requires.extend(['c-blosc::c-blosc']) + + if self.options.with_cfitsio: + self.cpp_info.requires.extend(['cfitsio::cfitsio']) + + if self.options.with_cryptopp: + self.cpp_info.requires.extend(['cryptopp::libcryptopp']) + + if self.options.with_curl: + self.cpp_info.requires.extend(['libcurl::curl']) + + if self.options.with_dds: + self.cpp_info.requires.extend(['crunch::crunch']) + + if self.options.with_expat: + self.cpp_info.requires.extend(['expat::expat']) + + if self.options.with_exr: + self.cpp_info.requires.extend(['openexr::openexr', 'imath::imath']) + + if self.options.with_freexl: + self.cpp_info.requires.extend(['freexl::freexl']) + + if self.options.with_geos: + self.cpp_info.requires.extend(['geos::geos_c']) + + if self.options.with_gif: + self.cpp_info.requires.extend(['giflib::giflib']) + + if self.options.with_gta: + self.cpp_info.requires.extend(['libgta::libgta']) + + if self.options.with_hdf4: + self.cpp_info.requires.extend(['hdf4::hdf4']) + + if self.options.with_hdf5: + self.cpp_info.requires.extend(['hdf5::hdf5_c']) + + if self.options.with_heif: + self.cpp_info.requires.extend(['libheif::libheif']) + + if self.options.with_kea: + self.cpp_info.requires.extend(['kealib::kealib']) + + if self.options.with_libdeflate: + self.cpp_info.requires.extend(['libdeflate::libdeflate']) + + if self.options.with_libiconv: + self.cpp_info.requires.extend(['libiconv::libiconv']) + + if self.options.with_jpeg == "libjpeg": + self.cpp_info.requires.extend(['libjpeg::libjpeg']) + elif self.options.with_jpeg == "libjpeg-turbo": + self.cpp_info.requires.extend(['libjpeg-turbo::turbojpeg']) + + if self.options.with_libkml: + self.cpp_info.requires.extend(['libkml::kmldom', 'libkml::kmlengine']) + + if self.options.with_libtiff: + self.cpp_info.requires.extend(['libtiff::libtiff']) + + if self.options.with_lz4: + self.cpp_info.requires.extend(['lz4::lz4']) + + if self.options.with_mongocxx: + self.cpp_info.requires.extend(['mongo-cxx-driver::mongo-cxx-driver']) + + if self.options.with_mysql == "libmysqlclient": + self.cpp_info.requires.extend(['libmysqlclient::libmysqlclient']) + elif self.options.with_mysql == "mariadb-connector-c": + self.cpp_info.requires.extend(['mariadb-connector-c::mariadb-connector-c']) + + if self.options.with_netcdf: + self.cpp_info.requires.extend(['netcdf::netcdf']) + + if self.options.with_odbc: + self.cpp_info.requires.extend(['odbc::odbc']) + + if self.options.with_openjpeg: + self.cpp_info.requires.extend(['openjpeg::openjpeg']) + + if self.options.with_openssl: + self.cpp_info.requires.extend(['openssl::ssl']) + + if self.options.with_pcre: + self.cpp_info.requires.extend(['pcre::pcre']) + + if self.options.with_pcre2: + self.cpp_info.requires.extend(['pcre2::pcre2-8']) + + if self.options.with_pg: + self.cpp_info.requires.extend(['libpq::pq']) + + if self.options.with_png: + self.cpp_info.requires.extend(['libpng::libpng']) + + if self.options.with_podofo: + self.cpp_info.requires.extend(['podofo::podofo']) + + if self.options.with_poppler: + self.cpp_info.requires.extend(['poppler::libpoppler']) + + if self.options.with_proj: + self.cpp_info.requires.extend(['proj::projlib']) + + if self.options.with_qhull: + self.cpp_info.requires.extend(['qhull::libqhull']) + + if self.options.with_sqlite3: + self.cpp_info.requires.extend(['sqlite3::sqlite']) + + if self.options.with_webp: + self.cpp_info.requires.extend(['libwebp::libwebp']) + + if self.options.with_xerces: + self.cpp_info.requires.extend(['xerces-c::xerces-c']) + + if self.options.with_xml2: + self.cpp_info.requires.extend(['libxml2::libxml2']) + + if self.options.with_zlib: + self.cpp_info.requires.extend(['zlib::zlib']) + + if self.options.with_zstd: + self.cpp_info.requires.extend(['zstd::zstdlib']) + + gdal_data_path = os.path.join(self.package_folder, "res", "gdal") + self.output.info( + "Prepending to GDAL_DATA environment variable: {}".format( + gdal_data_path)) + self.runenv_info.prepend_path("GDAL_DATA", gdal_data_path) + # TODO: to remove after conan v2, it allows to not break consumers still relying on virtualenv generator + self.env_info.GDAL_DATA = gdal_data_path + + if self.options.tools: + self.buildenv_info.prepend_path("GDAL_DATA", gdal_data_path) + bin_path = os.path.join(self.package_folder, "bin") + self.output.info( + "Appending PATH environment variable: {}".format(bin_path)) + self.env_info.PATH.append(bin_path) diff --git a/recipes/gdal/post_3.5.0/patches/3.5.1/0-replace-find-package.patch b/recipes/gdal/post_3.5.0/patches/3.5.1/0-replace-find-package.patch new file mode 100644 index 0000000000000..e790a586d8abd --- /dev/null +++ b/recipes/gdal/post_3.5.0/patches/3.5.1/0-replace-find-package.patch @@ -0,0 +1,266 @@ +diff --git a/alg/CMakeLists.txt b/alg/CMakeLists.txt +index edf75158c7..4200309ca8 100644 +--- a/alg/CMakeLists.txt ++++ b/alg/CMakeLists.txt +@@ -72,7 +72,7 @@ if (GDAL_USE_OPENCL) + target_sources(alg PRIVATE gdalwarpkernel_opencl.h gdalwarpkernel_opencl.cpp) + endif () + +-gdal_target_link_libraries(alg PRIVATE PROJ::proj) ++target_link_libraries(alg PUBLIC PROJ::proj) + + if (GDAL_USE_QHULL_INTERNAL) + target_compile_definitions(alg PRIVATE -DINTERNAL_QHULL) +diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt +index a49165d14a..91d6170067 100644 +--- a/apps/CMakeLists.txt ++++ b/apps/CMakeLists.txt +@@ -25,7 +25,7 @@ target_include_directories( + appslib PRIVATE $ $ + $ $) + +-gdal_target_link_libraries(appslib PRIVATE PROJ::proj) ++target_link_libraries(appslib PUBLIC PROJ::proj) + + set_property(TARGET appslib PROPERTY POSITION_INDEPENDENT_CODE ${GDAL_OBJECT_LIBRARIES_POSITION_INDEPENDENT_CODE}) + if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16) +diff --git a/cmake/helpers/CheckDependentLibraries.cmake b/cmake/helpers/CheckDependentLibraries.cmake +index 7fa3b565c7..77a610f223 100644 +--- a/cmake/helpers/CheckDependentLibraries.cmake ++++ b/cmake/helpers/CheckDependentLibraries.cmake +@@ -11,7 +11,10 @@ Detect GDAL dependencies and set variable HAVE_* + include(CheckFunctionExists) + include(CMakeDependentOption) + include(FeatureSummary) +-include(DefineFindPackage2) ++ ++# Conan recipes should rely on config files from generators so let's just disble GDAL's ++include(ConanFindPackage) ++ + include(CheckSymbolExists) + + option( +@@ -111,47 +114,7 @@ macro (gdal_check_package name purpose) + set(_find_dependency_args "") + find_package2(${name} QUIET OUT_DEPENDENCY _find_dependency) + if (NOT DEFINED ${key}_FOUND) +- set(_find_package_args) +- if (_GCP_VERSION) +- list(APPEND _find_package_args ${_GCP_VERSION}) +- endif () +- if (_GCP_CONFIG) +- list(APPEND _find_package_args CONFIG) +- endif () +- if (_GCP_COMPONENTS) +- list(APPEND _find_package_args COMPONENTS ${_GCP_COMPONENTS}) +- endif () +- if (_GCP_PATHS) +- list(APPEND _find_package_args PATHS ${_GCP_PATHS}) +- endif () +- if (_GCP_NAMES) +- set(GDAL_CHECK_PACKAGE_${name}_NAMES "${_GCP_NAMES}" CACHE STRING "Config file name for ${name}") +- mark_as_advanced(GDAL_CHECK_PACKAGE_${name}_NAMES) +- endif () +- if (_GCP_TARGETS) +- set(GDAL_CHECK_PACKAGE_${name}_TARGETS "${_GCP_TARGETS}" CACHE STRING "Target name candidates for ${name}") +- mark_as_advanced(GDAL_CHECK_PACKAGE_${name}_TARGETS) +- endif () +- if (GDAL_CHECK_PACKAGE_${name}_NAMES) +- find_package(${name} NAMES ${GDAL_CHECK_PACKAGE_${name}_NAMES} ${_find_package_args}) +- gdal_check_package_target(${name} ${GDAL_CHECK_PACKAGE_${name}_TARGETS} REQUIRED) +- if (${name}_FOUND) +- get_filename_component(_find_dependency_args "${${name}_CONFIG}" NAME) +- string(REPLACE ";" " " _find_dependency_args "${name} NAMES ${GDAL_CHECK_PACKAGE_${name}_NAMES} CONFIGS ${_find_dependency_args} ${_find_package_args}") +- endif () +- endif () +- if (NOT ${name}_FOUND) +- find_package(${name} ${_find_package_args}) +- if (${name}_FOUND) +- gdal_check_package_target(${name} ${GDAL_CHECK_PACKAGE_${name}_TARGETS}) +- elseif (${key}_FOUND) # Some find modules do not set _FOUND +- gdal_check_package_target(${key} ${GDAL_CHECK_PACKAGE_${name}_TARGETS}) +- set(${name}_FOUND "${key}_FOUND") +- endif () +- if (${name}_FOUND) +- string(REPLACE ";" " " _find_dependency_args "${name} ${_find_package_args}") +- endif() +- endif () ++ message(FATAL_ERROR "Conan recipes should rely on config files from generators so let's just disble GDAL's") + endif () + if (${key}_FOUND OR ${name}_FOUND) + set(HAVE_${key} ON) +@@ -321,14 +284,15 @@ if (GDAL_USE_CRYPTOPP) + endif () + + # First check with CMake config files (starting at version 8, due to issues with earlier ones), and then fallback to the FindPROJ module. +-find_package(PROJ 9 CONFIG QUIET) +-if (NOT PROJ_FOUND) +- find_package(PROJ 8 CONFIG QUIET) +-endif() ++find_package2(PROJ) ++target_include_directories(PROJ::proj INTERFACE ${PROJ_INCLUDE_DIRS}) ++#if (NOT PROJ_FOUND) ++# find_package(proj 8 CONFIG QUIET) ++#endif() + if (PROJ_FOUND) + string(APPEND GDAL_IMPORT_DEPENDENCIES "find_dependency(PROJ ${PROJ_VERSION_MAJOR} CONFIG)\n") + else() +- find_package(PROJ 6.0 REQUIRED) ++ find_package(proj 6.0 REQUIRED) + string(APPEND GDAL_IMPORT_DEPENDENCIES "find_dependency(PROJ 6.0)\n") + endif () + +@@ -379,15 +343,10 @@ gdal_check_package(JSONC "json-c library (external)" CAN_DISABLE + TARGETS json-c::json-c JSONC::JSONC + ) + gdal_internal_library(JSONC REQUIRED) +-if(TARGET json-c::json-c) +- get_target_property(include_dirs json-c::json-c INTERFACE_INCLUDE_DIRECTORIES) +- find_path(GDAL_JSON_INCLUDE_DIR NAMES json.h PATHS ${include_dirs} PATH_SUFFIXES json-c NO_DEFAULT_PATH) +- list(APPEND include_dirs "${GDAL_JSON_INCLUDE_DIR}") +- list(REMOVE_DUPLICATES include_dirs) +- set_target_properties(json-c::json-c PROPERTIES +- INTERFACE_INCLUDE_DIRECTORIES "${GDAL_JSON_INCLUDE_DIR}" +- ) +-endif() ++get_target_property(include_dirs json-c::json-c INTERFACE_INCLUDE_DIRECTORIES) ++list(APPEND include_dirs "${JSONC_INCLUDE_DIRS}/json-c") ++set_target_properties(json-c::json-c PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${include_dirs}") ++message("Setting include for json-c: ${include_dirs}") + + gdal_check_package(OpenCAD "libopencad (external, used by OpenCAD driver)" CAN_DISABLE) + gdal_internal_library(OPENCAD) +@@ -482,7 +441,7 @@ if (GDAL_USE_RASTERLITE2) + endif () + cmake_dependent_option(GDAL_USE_RASTERLITE2 "Set ON to use Rasterlite2" ON HAVE_RASTERLITE2 OFF) + +-find_package(LibKML COMPONENTS DOM ENGINE) ++find_package(LibKML COMPONENTS kmlengine kmldom kmlbase) + if (GDAL_USE_LIBKML) + if (NOT LibKML_FOUND) + message(FATAL_ERROR "Configured to use GDAL_USE_LIBKML, but not found") +diff --git a/cmake/helpers/ConanFindPackage.cmake b/cmake/helpers/ConanFindPackage.cmake +new file mode 100644 +index 0000000000..9dfa8193a3 +--- /dev/null ++++ b/cmake/helpers/ConanFindPackage.cmake +@@ -0,0 +1,43 @@ ++ ++function(define_find_package2 pkgname include_file library_name) ++endfunction() ++ ++function(find_package2 pkgname) ++ set(_options QUIET REQUIRED) ++ set(_oneValueArgs OUT_DEPENDENCY) ++ set(_multiValueArgs) ++ cmake_parse_arguments(arg "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) ++ if(arg_QUIET) ++ set(${pkgname}_FIND_QUIETLY TRUE) ++ endif() ++ if(arg_REQUIRED) ++ set(${pkgname}_FIND_REQUIRED TRUE) ++ endif() ++ ++ string(TOUPPER ${pkgname} key) ++ ++ set(docstring "Configured for conan package ${GDAL_CONAN_PACKAGE_FOR_${key}}") ++ if (DEFINED GDAL_CONAN_PACKAGE_FOR_${key}) ++ message("Using conan package ${GDAL_CONAN_PACKAGE_FOR_${key}} for dependency ${pkgname}") ++ set(conan_package ${GDAL_CONAN_PACKAGE_FOR_${key}}) ++ string(TOUPPER ${conan_package} conan_package_upper) ++ ++ set(${key}_INCLUDE_DIRS "${CONAN_INCLUDE_DIRS_${conan_package_upper}}" CACHE STRING ${docstring}) ++ if (NOT TARGET_FOR_${key}) ++ set(TARGET_FOR_${key} "${conan_package}::${conan_package}") ++ endif() ++ set(${key}_LIBRARIES "${TARGET_FOR_${key}}" CACHE STRING ${docstring}) ++ set(${key}_LIBRARY "${TARGET_FOR_${key}}" CACHE STRING ${docstring}) ++ set(${key}_TARGET "${TARGET_FOR_${key}}" CACHE STRING ${docstring}) ++ set(${pkgname}_INCLUDE_DIRS "CONAN_INCLUDE_DIRS_${conan_package_upper}" CACHE STRING ${docstring}) ++ set(${pkgname}_LIBRARIES "${TARGET_FOR_${key}}" CACHE STRING ${docstring}) ++ set(${pkgname}_LIBRARY "${TARGET_FOR_${key}}" CACHE STRING ${docstring}) ++ set(${pkgname}_TARGET "${TARGET_FOR_${key}}" CACHE STRING ${docstring}) ++ set(${key}_FOUND TRUE CACHE BOOL ${docstring}) ++ ++ else () ++ message("dependency ${pkgname} has no conan package") ++ set(${key}_FOUND FALSE CACHE BOOL ${docstring}) ++ endif() ++ ++endfunction() +diff --git a/frmts/hfa/CMakeLists.txt b/frmts/hfa/CMakeLists.txt +index e5b7138e91..039cac7361 100644 +--- a/frmts/hfa/CMakeLists.txt ++++ b/frmts/hfa/CMakeLists.txt +@@ -15,7 +15,8 @@ add_gdal_driver( + hfa_overviews.cpp + BUILTIN) + gdal_standard_includes(gdal_HFA) +-target_include_directories(gdal_HFA PRIVATE $) ++target_link_libraries(gdal_HFA INTERFACE PROJ::proj) ++target_include_directories(gdal_HFA PRIVATE ${PROJ_INCLUDE_DIRS}) + target_compile_definitions(gdal_HFA PRIVATE $) + + if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) +diff --git a/gdal.cmake b/gdal.cmake +index ff1ca7e6f6..e98875f1b9 100644 +--- a/gdal.cmake ++++ b/gdal.cmake +@@ -795,25 +795,6 @@ if (NOT GDAL_ENABLE_MACOSX_FRAMEWORK) + ${CMAKE_CURRENT_BINARY_DIR}/GDALConfig.cmake @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/GDALConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/gdal/) + +- # Generate gdal-config utility command and pkg-config module gdal.pc +- include(GdalGenerateConfig) +- gdal_generate_config( +- TARGET +- "${GDAL_LIB_TARGET_NAME}" +- GLOBAL_PROPERTY +- "gdal_private_link_libraries" +- GDAL_CONFIG +- "${PROJECT_BINARY_DIR}/apps/gdal-config" +- PKG_CONFIG +- "${CMAKE_CURRENT_BINARY_DIR}/gdal.pc") +- install( +- PROGRAMS ${PROJECT_BINARY_DIR}/apps/gdal-config +- DESTINATION ${CMAKE_INSTALL_BINDIR} +- COMPONENT applications) +- install( +- FILES ${CMAKE_CURRENT_BINARY_DIR}/gdal.pc +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +- COMPONENT libraries) + endif () + + configure_file(${GDAL_CMAKE_TEMPLATE_PATH}/uninstall.cmake.in ${PROJECT_BINARY_DIR}/cmake_uninstall.cmake @ONLY) +diff --git a/ogr/CMakeLists.txt b/ogr/CMakeLists.txt +index 19ba4e12fe..87cd123c54 100644 +--- a/ogr/CMakeLists.txt ++++ b/ogr/CMakeLists.txt +@@ -88,12 +88,12 @@ endif () + + target_compile_definitions(ogr PRIVATE HAVE_MITAB) + +-gdal_target_link_libraries(ogr PRIVATE PROJ::proj) ++target_link_libraries(ogr PUBLIC PROJ::proj) + + # External libs then + if (GDAL_USE_GEOS) + target_compile_definitions(ogr PRIVATE -DHAVE_GEOS=1) +- gdal_target_link_libraries(ogr PRIVATE ${GEOS_TARGET}) ++ target_link_libraries(ogr PUBLIC ${GEOS_TARGET}) + endif () + + if (GDAL_USE_SFCGAL) +diff --git a/ogr/ogr_proj_p.h b/ogr/ogr_proj_p.h +index 88928ad1ad..7cdd587db7 100644 +--- a/ogr/ogr_proj_p.h ++++ b/ogr/ogr_proj_p.h +@@ -29,7 +29,7 @@ + #ifndef OGR_PROJ_P_H_INCLUDED + #define OGR_PROJ_P_H_INCLUDED + +-#include "proj.h" ++#include + + #include "cpl_mem_cache.h" + diff --git a/recipes/gdal/post_3.5.0/patches/3.5.2/0-replace-find-package.patch b/recipes/gdal/post_3.5.0/patches/3.5.2/0-replace-find-package.patch new file mode 100644 index 0000000000000..b01b5b271034c --- /dev/null +++ b/recipes/gdal/post_3.5.0/patches/3.5.2/0-replace-find-package.patch @@ -0,0 +1,266 @@ +diff --git a/alg/CMakeLists.txt b/alg/CMakeLists.txt +index edf75158c7..4200309ca8 100644 +--- a/alg/CMakeLists.txt ++++ b/alg/CMakeLists.txt +@@ -72,7 +72,7 @@ if (GDAL_USE_OPENCL) + target_sources(alg PRIVATE gdalwarpkernel_opencl.h gdalwarpkernel_opencl.cpp) + endif () + +-gdal_target_link_libraries(alg PRIVATE PROJ::proj) ++target_link_libraries(alg PUBLIC PROJ::proj) + + if (GDAL_USE_QHULL_INTERNAL) + target_compile_definitions(alg PRIVATE -DINTERNAL_QHULL) +diff --git a/apps/CMakeLists.txt b/apps/CMakeLists.txt +index 8b02cea456..ad4adbfc9e 100644 +--- a/apps/CMakeLists.txt ++++ b/apps/CMakeLists.txt +@@ -25,7 +25,7 @@ target_include_directories( + appslib PRIVATE $ $ + $ $) + +-gdal_target_link_libraries(appslib PRIVATE PROJ::proj) ++target_link_libraries(appslib PUBLIC PROJ::proj) + + set_property(TARGET appslib PROPERTY POSITION_INDEPENDENT_CODE ${GDAL_OBJECT_LIBRARIES_POSITION_INDEPENDENT_CODE}) + if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.16) +diff --git a/cmake/helpers/CheckDependentLibraries.cmake b/cmake/helpers/CheckDependentLibraries.cmake +index 0a66b44fec..152ff42ff7 100644 +--- a/cmake/helpers/CheckDependentLibraries.cmake ++++ b/cmake/helpers/CheckDependentLibraries.cmake +@@ -11,7 +11,10 @@ Detect GDAL dependencies and set variable HAVE_* + include(CheckFunctionExists) + include(CMakeDependentOption) + include(FeatureSummary) +-include(DefineFindPackage2) ++ ++# Conan recipes should rely on config files from generators so let's just disble GDAL's ++include(ConanFindPackage) ++ + include(CheckSymbolExists) + + option( +@@ -111,47 +114,7 @@ macro (gdal_check_package name purpose) + set(_find_dependency_args "") + find_package2(${name} QUIET OUT_DEPENDENCY _find_dependency) + if (NOT DEFINED ${key}_FOUND) +- set(_find_package_args) +- if (_GCP_VERSION) +- list(APPEND _find_package_args ${_GCP_VERSION}) +- endif () +- if (_GCP_CONFIG) +- list(APPEND _find_package_args CONFIG) +- endif () +- if (_GCP_COMPONENTS) +- list(APPEND _find_package_args COMPONENTS ${_GCP_COMPONENTS}) +- endif () +- if (_GCP_PATHS) +- list(APPEND _find_package_args PATHS ${_GCP_PATHS}) +- endif () +- if (_GCP_NAMES) +- set(GDAL_CHECK_PACKAGE_${name}_NAMES "${_GCP_NAMES}" CACHE STRING "Config file name for ${name}") +- mark_as_advanced(GDAL_CHECK_PACKAGE_${name}_NAMES) +- endif () +- if (_GCP_TARGETS) +- set(GDAL_CHECK_PACKAGE_${name}_TARGETS "${_GCP_TARGETS}" CACHE STRING "Target name candidates for ${name}") +- mark_as_advanced(GDAL_CHECK_PACKAGE_${name}_TARGETS) +- endif () +- if (GDAL_CHECK_PACKAGE_${name}_NAMES) +- find_package(${name} NAMES ${GDAL_CHECK_PACKAGE_${name}_NAMES} ${_find_package_args}) +- gdal_check_package_target(${name} ${GDAL_CHECK_PACKAGE_${name}_TARGETS} REQUIRED) +- if (${name}_FOUND) +- get_filename_component(_find_dependency_args "${${name}_CONFIG}" NAME) +- string(REPLACE ";" " " _find_dependency_args "${name} NAMES ${GDAL_CHECK_PACKAGE_${name}_NAMES} CONFIGS ${_find_dependency_args} ${_find_package_args}") +- endif () +- endif () +- if (NOT ${name}_FOUND) +- find_package(${name} ${_find_package_args}) +- if (${name}_FOUND) +- gdal_check_package_target(${name} ${GDAL_CHECK_PACKAGE_${name}_TARGETS}) +- elseif (${key}_FOUND) # Some find modules do not set _FOUND +- gdal_check_package_target(${key} ${GDAL_CHECK_PACKAGE_${name}_TARGETS}) +- set(${name}_FOUND "${key}_FOUND") +- endif () +- if (${name}_FOUND) +- string(REPLACE ";" " " _find_dependency_args "${name} ${_find_package_args}") +- endif() +- endif () ++ message(FATAL_ERROR "Conan recipes should rely on config files from generators so let's just disble GDAL's") + endif () + if (${key}_FOUND OR ${name}_FOUND) + set(HAVE_${key} ON) +@@ -345,14 +308,15 @@ if (GDAL_USE_CRYPTOPP) + endif () + + # First check with CMake config files (starting at version 8, due to issues with earlier ones), and then fallback to the FindPROJ module. +-find_package(PROJ 9 CONFIG QUIET) +-if (NOT PROJ_FOUND) +- find_package(PROJ 8 CONFIG QUIET) +-endif() ++find_package2(PROJ) ++target_include_directories(PROJ::proj INTERFACE ${PROJ_INCLUDE_DIRS}) ++#if (NOT PROJ_FOUND) ++# find_package(proj 8 CONFIG QUIET) ++#endif() + if (PROJ_FOUND) + string(APPEND GDAL_IMPORT_DEPENDENCIES "find_dependency(PROJ ${PROJ_VERSION_MAJOR} CONFIG)\n") + else() +- find_package(PROJ 6.0 REQUIRED) ++ find_package(proj 6.0 REQUIRED) + string(APPEND GDAL_IMPORT_DEPENDENCIES "find_dependency(PROJ 6.0)\n") + endif () + +@@ -412,15 +376,10 @@ gdal_check_package(JSONC "json-c library (external)" CAN_DISABLE + TARGETS json-c::json-c JSONC::JSONC + ) + gdal_internal_library(JSONC REQUIRED) +-if(TARGET json-c::json-c) +- get_target_property(include_dirs json-c::json-c INTERFACE_INCLUDE_DIRECTORIES) +- find_path(GDAL_JSON_INCLUDE_DIR NAMES json.h PATHS ${include_dirs} PATH_SUFFIXES json-c NO_DEFAULT_PATH) +- list(APPEND include_dirs "${GDAL_JSON_INCLUDE_DIR}") +- list(REMOVE_DUPLICATES include_dirs) +- set_target_properties(json-c::json-c PROPERTIES +- INTERFACE_INCLUDE_DIRECTORIES "${GDAL_JSON_INCLUDE_DIR}" +- ) +-endif() ++get_target_property(include_dirs json-c::json-c INTERFACE_INCLUDE_DIRECTORIES) ++list(APPEND include_dirs "${JSONC_INCLUDE_DIRS}/json-c") ++set_target_properties(json-c::json-c PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${include_dirs}") ++message("Setting include for json-c: ${include_dirs}") + + gdal_check_package(OpenCAD "libopencad (external, used by OpenCAD driver)" CAN_DISABLE) + gdal_internal_library(OPENCAD) +@@ -517,7 +476,7 @@ if (GDAL_USE_RASTERLITE2) + endif () + cmake_dependent_option(GDAL_USE_RASTERLITE2 "Set ON to use Rasterlite2" ON HAVE_RASTERLITE2 OFF) + +-find_package(LibKML COMPONENTS DOM ENGINE) ++find_package(LibKML COMPONENTS kmlengine kmldom kmlbase) + if (GDAL_USE_LIBKML) + if (NOT LibKML_FOUND) + message(FATAL_ERROR "Configured to use GDAL_USE_LIBKML, but not found") +diff --git a/cmake/helpers/ConanFindPackage.cmake b/cmake/helpers/ConanFindPackage.cmake +new file mode 100644 +index 0000000000..9dfa8193a3 +--- /dev/null ++++ b/cmake/helpers/ConanFindPackage.cmake +@@ -0,0 +1,43 @@ ++ ++function(define_find_package2 pkgname include_file library_name) ++endfunction() ++ ++function(find_package2 pkgname) ++ set(_options QUIET REQUIRED) ++ set(_oneValueArgs OUT_DEPENDENCY) ++ set(_multiValueArgs) ++ cmake_parse_arguments(arg "${_options}" "${_oneValueArgs}" "${_multiValueArgs}" ${ARGN}) ++ if(arg_QUIET) ++ set(${pkgname}_FIND_QUIETLY TRUE) ++ endif() ++ if(arg_REQUIRED) ++ set(${pkgname}_FIND_REQUIRED TRUE) ++ endif() ++ ++ string(TOUPPER ${pkgname} key) ++ ++ set(docstring "Configured for conan package ${GDAL_CONAN_PACKAGE_FOR_${key}}") ++ if (DEFINED GDAL_CONAN_PACKAGE_FOR_${key}) ++ message("Using conan package ${GDAL_CONAN_PACKAGE_FOR_${key}} for dependency ${pkgname}") ++ set(conan_package ${GDAL_CONAN_PACKAGE_FOR_${key}}) ++ string(TOUPPER ${conan_package} conan_package_upper) ++ ++ set(${key}_INCLUDE_DIRS "${CONAN_INCLUDE_DIRS_${conan_package_upper}}" CACHE STRING ${docstring}) ++ if (NOT TARGET_FOR_${key}) ++ set(TARGET_FOR_${key} "${conan_package}::${conan_package}") ++ endif() ++ set(${key}_LIBRARIES "${TARGET_FOR_${key}}" CACHE STRING ${docstring}) ++ set(${key}_LIBRARY "${TARGET_FOR_${key}}" CACHE STRING ${docstring}) ++ set(${key}_TARGET "${TARGET_FOR_${key}}" CACHE STRING ${docstring}) ++ set(${pkgname}_INCLUDE_DIRS "CONAN_INCLUDE_DIRS_${conan_package_upper}" CACHE STRING ${docstring}) ++ set(${pkgname}_LIBRARIES "${TARGET_FOR_${key}}" CACHE STRING ${docstring}) ++ set(${pkgname}_LIBRARY "${TARGET_FOR_${key}}" CACHE STRING ${docstring}) ++ set(${pkgname}_TARGET "${TARGET_FOR_${key}}" CACHE STRING ${docstring}) ++ set(${key}_FOUND TRUE CACHE BOOL ${docstring}) ++ ++ else () ++ message("dependency ${pkgname} has no conan package") ++ set(${key}_FOUND FALSE CACHE BOOL ${docstring}) ++ endif() ++ ++endfunction() +diff --git a/frmts/hfa/CMakeLists.txt b/frmts/hfa/CMakeLists.txt +index e5b7138e91..039cac7361 100644 +--- a/frmts/hfa/CMakeLists.txt ++++ b/frmts/hfa/CMakeLists.txt +@@ -15,7 +15,8 @@ add_gdal_driver( + hfa_overviews.cpp + BUILTIN) + gdal_standard_includes(gdal_HFA) +-target_include_directories(gdal_HFA PRIVATE $) ++target_link_libraries(gdal_HFA INTERFACE PROJ::proj) ++target_include_directories(gdal_HFA PRIVATE ${PROJ_INCLUDE_DIRS}) + target_compile_definitions(gdal_HFA PRIVATE $) + + if (CMAKE_VERSION VERSION_GREATER_EQUAL 3.12) +diff --git a/gdal.cmake b/gdal.cmake +index 4bae2e2760..7695df40c8 100644 +--- a/gdal.cmake ++++ b/gdal.cmake +@@ -787,25 +787,6 @@ if (NOT GDAL_ENABLE_MACOSX_FRAMEWORK) + ${CMAKE_CURRENT_BINARY_DIR}/GDALConfig.cmake @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/GDALConfig.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/gdal/) + +- # Generate gdal-config utility command and pkg-config module gdal.pc +- include(GdalGenerateConfig) +- gdal_generate_config( +- TARGET +- "${GDAL_LIB_TARGET_NAME}" +- GLOBAL_PROPERTY +- "gdal_private_link_libraries" +- GDAL_CONFIG +- "${PROJECT_BINARY_DIR}/apps/gdal-config" +- PKG_CONFIG +- "${CMAKE_CURRENT_BINARY_DIR}/gdal.pc") +- install( +- PROGRAMS ${PROJECT_BINARY_DIR}/apps/gdal-config +- DESTINATION ${CMAKE_INSTALL_BINDIR} +- COMPONENT applications) +- install( +- FILES ${CMAKE_CURRENT_BINARY_DIR}/gdal.pc +- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig +- COMPONENT libraries) + endif () + + configure_file(${GDAL_CMAKE_TEMPLATE_PATH}/uninstall.cmake.in ${PROJECT_BINARY_DIR}/cmake_uninstall.cmake @ONLY) +diff --git a/ogr/CMakeLists.txt b/ogr/CMakeLists.txt +index 19ba4e12fe..87cd123c54 100644 +--- a/ogr/CMakeLists.txt ++++ b/ogr/CMakeLists.txt +@@ -88,12 +88,12 @@ endif () + + target_compile_definitions(ogr PRIVATE HAVE_MITAB) + +-gdal_target_link_libraries(ogr PRIVATE PROJ::proj) ++target_link_libraries(ogr PUBLIC PROJ::proj) + + # External libs then + if (GDAL_USE_GEOS) + target_compile_definitions(ogr PRIVATE -DHAVE_GEOS=1) +- gdal_target_link_libraries(ogr PRIVATE ${GEOS_TARGET}) ++ target_link_libraries(ogr PUBLIC ${GEOS_TARGET}) + endif () + + if (GDAL_USE_SFCGAL) +diff --git a/ogr/ogr_proj_p.h b/ogr/ogr_proj_p.h +index 88928ad1ad..7cdd587db7 100644 +--- a/ogr/ogr_proj_p.h ++++ b/ogr/ogr_proj_p.h +@@ -29,7 +29,7 @@ + #ifndef OGR_PROJ_P_H_INCLUDED + #define OGR_PROJ_P_H_INCLUDED + +-#include "proj.h" ++#include + + #include "cpl_mem_cache.h" + diff --git a/recipes/gdal/post_3.5.0/test_package/CMakeLists.txt b/recipes/gdal/post_3.5.0/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..861d8d69409b0 --- /dev/null +++ b/recipes/gdal/post_3.5.0/test_package/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(GDAL REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} GDAL::GDAL) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) + +add_executable(${PROJECT_NAME}_c test_package.c) +target_link_libraries(${PROJECT_NAME}_c GDAL::GDAL) diff --git a/recipes/gdal/post_3.5.0/test_package/conanfile.py b/recipes/gdal/post_3.5.0/test_package/conanfile.py new file mode 100644 index 0000000000000..9dced2ad9cf71 --- /dev/null +++ b/recipes/gdal/post_3.5.0/test_package/conanfile.py @@ -0,0 +1,23 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conans import CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + if self.options["gdal"].tools: + self.run("gdal_translate --formats", run_environment=True) + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + bin_path_c = os.path.join("bin", "test_package_c") + self.run(bin_path_c, run_environment=True) diff --git a/recipes/gdal/post_3.5.0/test_package/test_package.c b/recipes/gdal/post_3.5.0/test_package/test_package.c new file mode 100644 index 0000000000000..e4faf1b9e561d --- /dev/null +++ b/recipes/gdal/post_3.5.0/test_package/test_package.c @@ -0,0 +1,58 @@ +#include + +#include +#include + +int main() { + GDALAllRegister(); + + const char *pszDriverName = "ESRI Shapefile"; + GDALDriverH hDriver = GDALGetDriverByName(pszDriverName); + if (!hDriver) { + printf("%s driver not available.\n", pszDriverName); + exit(1); + } + + GDALDatasetH hDS = GDALCreate(hDriver, "point_out_c.shp", 0, 0, 0, GDT_Unknown, NULL); + if (!hDS) { + printf("Creation of output file failed.\n"); + exit(1); + } + + OGRLayerH hLayer = GDALDatasetCreateLayer(hDS, "point_out", NULL, wkbPoint, NULL); + if (!hLayer) { + printf("Layer creation failed.\n"); + exit(1); + } + + OGRFieldDefnH hFieldDefn = OGR_Fld_Create("Name", OFTString); + + OGR_Fld_SetWidth(hFieldDefn, 32); + + if (OGR_L_CreateField(hLayer, hFieldDefn, TRUE) != OGRERR_NONE) { + printf("Creating Name field failed.\n"); + exit(1); + } + + OGR_Fld_Destroy(hFieldDefn); + + OGRFeatureH hFeature = OGR_F_Create(OGR_L_GetLayerDefn(hLayer)); + OGR_F_SetFieldString(hFeature, OGR_F_GetFieldIndex(hFeature, "Name"), "conan"); + + OGRGeometryH hPt = OGR_G_CreateGeometry(wkbPoint); + OGR_G_SetPoint_2D(hPt, 0, 40.74, -27.891); + + OGR_F_SetGeometry(hFeature, hPt); + OGR_G_DestroyGeometry(hPt); + + if (OGR_L_CreateFeature(hLayer, hFeature) != OGRERR_NONE) { + printf("Failed to create feature in shapefile.\n"); + exit(1); + } + + OGR_F_Destroy(hFeature); + + GDALClose(hDS); + + return 0; +} diff --git a/recipes/gdal/post_3.5.0/test_package/test_package.cpp b/recipes/gdal/post_3.5.0/test_package/test_package.cpp new file mode 100644 index 0000000000000..ec77987bc5ece --- /dev/null +++ b/recipes/gdal/post_3.5.0/test_package/test_package.cpp @@ -0,0 +1,54 @@ +#include + +#include +#include + +int main() { + GDALAllRegister(); + + const char *pszDriverName = "ESRI Shapefile"; + GDALDriver *poDriver = GetGDALDriverManager()->GetDriverByName(pszDriverName); + if (!poDriver) { + printf("%s driver not available.\n", pszDriverName); + exit(1); + } + + GDALDataset *poDS = poDriver->Create("point_out_cpp.shp", 0, 0, 0, GDT_Unknown, NULL); + if (!poDS) { + printf("Creation of output file failed.\n"); + exit(1); + } + + OGRLayer *poLayer = poDS->CreateLayer("point_out", NULL, wkbPoint, NULL); + if (!poLayer) { + printf("Layer creation failed.\n"); + exit(1); + } + + OGRFieldDefn oField("Name", OFTString); + oField.SetWidth(32); + + if (poLayer->CreateField(&oField) != OGRERR_NONE) { + printf("Creating Name field failed.\n"); + exit(1); + } + + OGRFeature *poFeature = OGRFeature::CreateFeature(poLayer->GetLayerDefn()); + poFeature->SetField("Name", "conan"); + + OGRPoint pt; + pt.setX(40.74); + pt.setY(-27.891); + poFeature->SetGeometry(&pt); + + if (poLayer->CreateFeature(poFeature) != OGRERR_NONE) { + printf("Failed to create feature in shapefile.\n"); + exit( 1 ); + } + + OGRFeature::DestroyFeature(poFeature); + + GDALClose(poDS); + + return 0; +} diff --git a/recipes/gdal/pre_3.5.0/conandata.yml b/recipes/gdal/pre_3.5.0/conandata.yml index e05a3af06bfda..4ca595dd10256 100644 --- a/recipes/gdal/pre_3.5.0/conandata.yml +++ b/recipes/gdal/pre_3.5.0/conandata.yml @@ -17,60 +17,33 @@ sources: patches: "3.4.3": - patch_file: "patches/3.4.x/fix-autotools-3.4.3.patch" - base_path: "source_subfolder" - patch_file: "patches/3.4.x/fix-nmake.patch" - base_path: "source_subfolder" - patch_file: "patches/3.4.x/fix-include-jsonc-3.4.3.patch" - base_path: "source_subfolder" - patch_file: "patches/3.4.x/fix-include-xerces.patch" - base_path: "source_subfolder" - patch_file: "patches/3.4.x/fix-include-podofo.patch" - base_path: "source_subfolder" "3.4.1": - patch_file: "patches/3.4.x/fix-autotools-3.4.1.patch" - base_path: "source_subfolder" - patch_file: "patches/3.4.x/fix-nmake.patch" - base_path: "source_subfolder" - patch_file: "patches/3.4.x/fix-include-jsonc-3.4.1.patch" - base_path: "source_subfolder" - patch_file: "patches/3.4.x/fix-include-xerces.patch" - base_path: "source_subfolder" - patch_file: "patches/3.4.x/fix-include-podofo.patch" - base_path: "source_subfolder" "3.3.3": - patch_file: "patches/3.3.x/fix-autotools-3.3.3.patch" - base_path: "source_subfolder" - patch_file: "patches/3.3.x/fix-nmake.patch" - base_path: "source_subfolder" - patch_file: "patches/3.3.x/fix-include-jsonc.patch" - base_path: "source_subfolder" - patch_file: "patches/3.3.x/fix-include-xerces.patch" - base_path: "source_subfolder" - patch_file: "patches/3.3.x/fix-include-podofo.patch" - base_path: "source_subfolder" "3.2.3": - patch_file: "patches/3.2.x/fix-autotools.patch" - base_path: "source_subfolder" - patch_file: "patches/3.2.x/fix-nmake.patch" - base_path: "source_subfolder" - patch_file: "patches/3.2.x/fix-include-jsonc.patch" - base_path: "source_subfolder" - patch_file: "patches/3.2.x/fix-include-xerces.patch" - base_path: "source_subfolder" - patch_file: "patches/3.2.x/fix-include-podofo.patch" - base_path: "source_subfolder" "3.1.4": - patch_file: "patches/3.1.x/fix-autotools-3.1.4.patch" - base_path: "source_subfolder" - patch_file: "patches/3.1.x/fix-nmake-common.patch" - base_path: "source_subfolder" - patch_file: "patches/3.1.x/fix-nmake-opt-3.1.2.patch" - base_path: "source_subfolder" - patch_file: "patches/3.1.x/fix-import-dll-msvc.patch" - base_path: "source_subfolder" - patch_file: "patches/3.1.x/fix-include-jsonc.patch" - base_path: "source_subfolder" - patch_file: "patches/3.1.x/fix-include-xerces-3.1.2.patch" - base_path: "source_subfolder" - patch_file: "patches/3.1.x/fix-include-podofo.patch" - base_path: "source_subfolder" diff --git a/recipes/gdal/pre_3.5.0/conanfile.py b/recipes/gdal/pre_3.5.0/conanfile.py index 18506b71dd2ea..7ecdfb6713c6a 100644 --- a/recipes/gdal/pre_3.5.0/conanfile.py +++ b/recipes/gdal/pre_3.5.0/conanfile.py @@ -1,12 +1,16 @@ -from conan.tools.files import apply_conandata_patches -from conan.tools.microsoft import is_msvc -from conans import ConanFile, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -from contextlib import contextmanager -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import check_min_cppstd, cross_building, stdcpp_library, valid_min_cppstd +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, NMakeDeps, NMakeToolchain, unix_path +from conan.tools.scm import Version import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.58.0" class GdalConan(ConanFile): @@ -18,6 +22,7 @@ class GdalConan(ConanFile): homepage = "https://github.com/OSGeo/gdal" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,7 +44,7 @@ class GdalConan(ConanFile): "with_dds": [True, False], "with_gta": [True, False], "with_pcidsk": [True, False], - "with_jpeg": [None, "libjpeg", "libjpeg-turbo"], + "with_jpeg": [None, "libjpeg", "libjpeg-turbo", "mozjpeg"], "with_charls": [True, False], "with_gif": [True, False], # "with_ogdi": [True, False], @@ -156,52 +161,49 @@ class GdalConan(ConanFile): "with_heif": False, } - generators = "pkg_config" - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property def _has_with_exr_option(self): - return tools.Version(self.version) >= "3.1.0" + return Version(self.version) >= "3.1.0" @property def _has_with_libdeflate_option(self): - return tools.Version(self.version) >= "3.2.0" + return Version(self.version) >= "3.2.0" @property def _has_with_heif_option(self): - return tools.Version(self.version) >= "3.2.0" + return Version(self.version) >= "3.2.0" @property def _has_with_blosc_option(self): - return tools.Version(self.version) >= "3.4.0" + return Version(self.version) >= "3.4.0" @property def _has_with_lz4_option(self): - return tools.Version(self.version) >= "3.4.0" + return Version(self.version) >= "3.4.0" @property def _has_with_brunsli_option(self): - return tools.Version(self.version) >= "3.4.0" + return Version(self.version) >= "3.4.0" @property def _has_with_pcre2_option(self): - return tools.Version(self.version) >= "3.4.1" + return Version(self.version) >= "3.4.1" @property def _has_reentrant_qhull_support(self): - return tools.Version(self.version) >= "3.4.1" + return Version(self.version) >= "3.4.1" def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - # if tools.Version(self.version) < "3.0.0": + # if Version(self.version) < "3.0.0": # del self.options.with_tiledb if not self._has_with_exr_option: del self.options.with_exr @@ -220,49 +222,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.settings.arch not in ["x86", "x86_64"]: - del self.options.simd_intrinsics + self.options.rm_safe("simd_intrinsics") if self.options.without_lerc: - del self.options.with_zstd + self.options.rm_safe("with_zstd") # if self.options.with_spatialite: - # del self.options.with_sqlite3 - if not self.options.get_safe("with_sqlite3", False): - del self.options.with_pcre - del self.options.with_pcre2 + # self.options.rm_safe("with_sqlite3 + if not self.options.get_safe("with_sqlite3"): + self.options.rm_safe("with_pcre") + self.options.rm_safe("with_pcre2") if is_msvc(self): - del self.options.threadsafe - del self.options.with_null - del self.options.with_zlib # zlib and png are always used in nmake build, - del self.options.with_png # and it's not trivial to fix - self._strict_options_requirements() + self.options.rm_safe("threadsafe") + self.options.rm_safe("with_null") + self.options.rm_safe("with_zlib") # zlib and png are always used in nmake build, + self.options.rm_safe("with_png") # and it's not trivial to fix - def _strict_options_requirements(self): if self.options.with_qhull: self.options["qhull"].reentrant = self._has_reentrant_qhull_support + def layout(self): + basic_layout(self, src_folder="src") + self.folders.build = self.folders.source + def requirements(self): - self.requires("json-c/0.15") + self.requires("json-c/0.16") self.requires("libgeotiff/1.7.1") # self.requires("libopencad/0.0.2") # TODO: use conan recipe when available instead of internal one - self.requires("libtiff/4.3.0") - self.requires("proj/9.0.0") - if tools.Version(self.version) >= "3.1.0": + self.requires("libtiff/4.4.0") + self.requires("proj/9.1.1") + if Version(self.version) >= "3.1.0": self.requires("flatbuffers/2.0.5") if self.options.get_safe("with_zlib", True): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.get_safe("with_libdeflate"): - self.requires("libdeflate/1.12") + self.requires("libdeflate/1.17") if self.options.with_libiconv: - self.requires("libiconv/1.16") + self.requires("libiconv/1.17") if self.options.get_safe("with_zstd"): self.requires("zstd/1.5.2") if self.options.get_safe("with_blosc"): - self.requires("c-blosc/1.21.1") + self.requires("c-blosc/1.21.3") if self.options.get_safe("with_lz4"): - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.with_pg: - self.requires("libpq/14.2") + self.requires("libpq/14.5") # if self.options.with_libgrass: # self.requires("libgrass/x.x.x") if self.options.with_cfitsio: @@ -270,7 +274,7 @@ def requirements(self): # if self.options.with_pcraster: # self.requires("pcraster-rasterformat/1.3.2") if self.options.get_safe("with_png", True): - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_dds: self.requires("crunch/cci.20190615") if self.options.with_gta: @@ -278,11 +282,13 @@ def requirements(self): # if self.options.with_pcidsk: # self.requires("pcidsk/x.x.x") if self.options.with_jpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.2") + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") if self.options.with_charls: - self.requires("charls/2.3.4") + self.requires("charls/2.4.1") if self.options.with_gif: self.requires("giflib/5.2.1") # if self.options.with_ogdi: @@ -290,60 +296,60 @@ def requirements(self): # if self.options.with_sosi: # self.requires("fyba/4.1.1") if self.options.with_mongocxx: - self.requires("mongo-cxx-driver/3.6.6") + self.requires("mongo-cxx-driver/3.6.7") if self.options.with_hdf4: self.requires("hdf4/4.2.15") if self.options.with_hdf5: - self.requires("hdf5/1.12.1") + self.requires("hdf5/1.14.0") if self.options.with_kea: self.requires("kealib/1.4.14") if self.options.with_netcdf: self.requires("netcdf/4.8.1") if self.options.with_jasper: - self.requires("jasper/2.0.33") + self.requires("jasper/4.0.0") if self.options.with_openjpeg: self.requires("openjpeg/2.5.0") # if self.options.with_fgdb: # self.requires("file-geodatabase-api/x.x.x") if self.options.with_mysql == "libmysqlclient": - self.requires("libmysqlclient/8.0.29") + self.requires("libmysqlclient/8.0.31") elif self.options.with_mysql == "mariadb-connector-c": self.requires("mariadb-connector-c/3.1.12") if self.options.with_xerces: - self.requires("xerces-c/3.2.3") + self.requires("xerces-c/3.2.4") if self.options.with_expat: - self.requires("expat/2.4.8") + self.requires("expat/2.5.0") if self.options.with_libkml: self.requires("libkml/1.3.0") if self.options.with_odbc and self.settings.os != "Windows": - self.requires("odbc/2.3.9") + self.requires("odbc/2.3.11") # if self.options.with_dods_root: # self.requires("libdap/3.20.6") if self.options.with_curl: - self.requires("libcurl/7.83.1") + self.requires("libcurl/7.87.0") if self.options.with_xml2: - self.requires("libxml2/2.9.14") + self.requires("libxml2/2.10.3") # if self.options.with_spatialite: # self.requires("libspatialite/4.3.0a") if self.options.get_safe("with_sqlite3"): - self.requires("sqlite3/3.38.5") + self.requires("sqlite3/3.40.1") # if self.options.with_rasterlite2: # self.requires("rasterlite2/x.x.x") if self.options.get_safe("with_pcre"): self.requires("pcre/8.45") if self.options.get_safe("with_pcre2"): - self.requires("pcre2/10.40") + self.requires("pcre2/10.42") if self.options.with_webp: - self.requires("libwebp/1.2.2") + self.requires("libwebp/1.3.0") if self.options.with_geos: - self.requires("geos/3.10.2") + self.requires("geos/3.11.1") # if self.options.with_sfcgal: # self.requires("sfcgal/1.3.7") if self.options.with_qhull: self.requires("qhull/8.0.1") if self.options.with_opencl: - self.requires("opencl-headers/2022.01.04") - self.requires("opencl-icd-loader/2022.01.04") + self.requires("opencl-headers/2022.09.30") + self.requires("opencl-icd-loader/2022.09.30") if self.options.with_freexl: self.requires("freexl/1.0.6") if self.options.with_poppler: @@ -359,64 +365,61 @@ def requirements(self): # if self.options.with_armadillo: # self.requires("armadillo/9.880.1") if self.options.with_cryptopp: - self.requires("cryptopp/8.6.0") + self.requires("cryptopp/8.7.0") if self.options.with_crypto: - self.requires("openssl/1.1.1o") + self.requires("openssl/1.1.1s") # if not self.options.without_lerc: # self.requires("lerc/2.1") # TODO: use conan recipe (not possible yet because lerc API is broken for GDAL) if self.options.get_safe("with_exr"): self.requires("openexr/3.1.5") if self.options.get_safe("with_heif"): - self.requires("libheif/1.12.0") + self.requires("libheif/1.13.0") def validate(self): if self.settings.compiler.get_safe("cppstd"): min_cppstd = 14 if self.options.with_charls else 11 - tools.check_min_cppstd(self, min_cppstd) + check_min_cppstd(self, min_cppstd) if self.options.get_safe("with_pcre") and self.options.get_safe("with_pcre2"): raise ConanInvalidConfiguration("Enable either pcre or pcre2, not both") - if self.options.get_safe("with_pcre2") and not self.options["pcre2"].build_pcre2_8: + if self.options.get_safe("with_pcre2") and not self.dependencies["pcre2"].options.build_pcre2_8: raise ConanInvalidConfiguration("gdal:with_pcre2=True requires pcre2:build_pcre2_8=True") if self.options.get_safe("with_brunsli"): raise ConanInvalidConfiguration("brunsli not available in conan-center yet") if self.options.get_safe("with_libdeflate") and not self.options.get_safe("with_zlib", True): raise ConanInvalidConfiguration("gdal:with_libdeflate=True requires gdal:with_zlib=True") if self.options.with_qhull: - if self._has_reentrant_qhull_support and not self.options["qhull"].reentrant: - raise ConanInvalidConfiguration("gdal {} depends on reentrant qhull.".format(self.version)) - elif not self._has_reentrant_qhull_support and self.options["qhull"].reentrant: - raise ConanInvalidConfiguration("gdal {} depends on non-reentrant qhull.".format(self.version)) - if hasattr(self, "settings_build") and tools.cross_building(self): + if self._has_reentrant_qhull_support and not self.dependencies["qhull"].options.reentrant: + raise ConanInvalidConfiguration(f"{self.ref} depends on reentrant qhull.") + elif not self._has_reentrant_qhull_support and self.dependencies["qhull"].options.reentrant: + raise ConanInvalidConfiguration(f"{self.ref} depends on non-reentrant qhull.") + if hasattr(self, "settings_build") and cross_building(self): if self.options.shared: - raise ConanInvalidConfiguration("GDAL build system can't cross-build shared lib") + raise ConanInvalidConfiguration(f"{self.ref} can't cross-build shared lib") if self.options.tools: - raise ConanInvalidConfiguration("GDAL build system can't cross-build tools") + raise ConanInvalidConfiguration(f"{self.ref} can't cross-build tools") - def _validate_dependency_graph(self): - if tools.Version(self.deps_cpp_info["libtiff"].version) < "4.0.0": - raise ConanInvalidConfiguration("gdal {} requires libtiff >= 4.0.0".format(self.version)) + if Version(self.dependencies["libtiff"].ref.version) < "4.0.0": + raise ConanInvalidConfiguration(f"{self.ref} requires libtiff >= 4.0.0") if self.options.with_mongocxx: - mongocxx_version = tools.Version(self.deps_cpp_info["mongo-cxx-driver"].version) + mongocxx_version = Version(self.dependencies["mongo-cxx-driver"].ref.version) if mongocxx_version < "3.0.0": # TODO: handle mongo-cxx-driver v2 - raise ConanInvalidConfiguration("gdal with mongo-cxx-driver < 3.0.0 not yet supported in this recipe.") + raise ConanInvalidConfiguration(f"{self.ref} with mongo-cxx-driver < 3.0.0 not yet supported in this recipe.") elif mongocxx_version < "3.4.0": - raise ConanInvalidConfiguration("gdal with mongo-cxx-driver v3 requires 3.4.0 at least.") - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + raise ConanInvalidConfiguration(f"{self.ref} with mongo-cxx-driver v3 requires 3.4.0 at least.") def build_requirements(self): if not is_msvc(self): - self.build_requires("libtool/2.4.6") - self.build_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def _patch_sources(self): apply_conandata_patches(self) @@ -431,111 +434,103 @@ def _patch_sources(self): # os.path.join("ogr", "ogrsf_frmts", "cad", "libopencad"), # TODO: uncomment when libopencad available os.path.join("ogr", "ogrsf_frmts", "geojson", "libjson"), ] - if tools.Version(self.version) >= "3.1.0": + if Version(self.version) >= "3.1.0": embedded_libs.append(os.path.join("ogr", "ogrsf_frmts", "flatgeobuf", "flatbuffers")) for lib_subdir in embedded_libs: - tools.rmdir(os.path.join(self._source_subfolder, lib_subdir)) + rmdir(self, os.path.join(self.source_folder, lib_subdir)) # OpenCL headers - tools.replace_in_file(os.path.join(self._source_subfolder, "alg", "gdalwarpkernel_opencl.h"), + replace_in_file(self, os.path.join(self.source_folder, "alg", "gdalwarpkernel_opencl.h"), "#include ", "#include ") # More patches for autotools build if not is_msvc(self): - configure_ac = os.path.join(self._source_subfolder, "configure.ac") + configure_ac = os.path.join(self.source_folder, "configure.ac") # Workaround for nc-config not packaged in netcdf recipe (gdal relies on it to check nc4 and hdf4 support in netcdf): - if self.options.with_netcdf and self.options["netcdf"].netcdf4 and self.options["netcdf"].with_hdf5: - tools.replace_in_file(configure_ac, - "NETCDF_HAS_NC4=no", - "NETCDF_HAS_NC4=yes") + if self.options.with_netcdf: + if self.dependencies["netcdf"].options.netcdf4 and self.dependencies["netcdf"].options.with_hdf5: + replace_in_file(self, configure_ac, "NETCDF_HAS_NC4=no", "NETCDF_HAS_NC4=yes") # Fix zlib checks and -lz injection to ensure to use external zlib and not fail others checks if self.options.get_safe("with_zlib", True): - zlib_name = self.deps_cpp_info["zlib"].libs[0] - tools.replace_in_file(configure_ac, - "AC_CHECK_LIB(z,", - "AC_CHECK_LIB({},".format(zlib_name)) - tools.replace_in_file(configure_ac, - "-lz ", - "-l{} ".format(zlib_name)) + zlib_name = self.dependencies["zlib"].cpp_info.aggregated_components().libs[0] + replace_in_file(self, configure_ac, "AC_CHECK_LIB(z,", f"AC_CHECK_LIB({zlib_name},") + replace_in_file(self, configure_ac, "-lz ", f"-l{zlib_name} ") # Workaround for autoconf 2.71 - with open(os.path.join(self._source_subfolder, "config.rpath"), "w"): + with open(os.path.join(self.source_folder, "config.rpath"), "w"): pass # Disable tools if not self.options.tools: # autotools - gnumakefile_apps = os.path.join(self._source_subfolder, "apps", "GNUmakefile") - tools.replace_in_file(gnumakefile_apps, + gnumakefile_apps = os.path.join(self.source_folder, "apps", "GNUmakefile") + replace_in_file(self, gnumakefile_apps, "default: gdal-config-inst gdal-config $(BIN_LIST)", "default: gdal-config-inst gdal-config") - if tools.Version(self.version) < "3.4.0": + if Version(self.version) < "3.4.0": clean_pattern = "$(RM) *.o $(BIN_LIST) core gdal-config gdal-config-inst" else: clean_pattern = "$(RM) *.o $(BIN_LIST) $(NON_DEFAULT_LIST) core gdal-config gdal-config-inst" - tools.replace_in_file(gnumakefile_apps, + replace_in_file(self, gnumakefile_apps, clean_pattern, "$(RM) *.o core gdal-config gdal-config-inst") - tools.replace_in_file(gnumakefile_apps, + replace_in_file(self, gnumakefile_apps, "for f in $(BIN_LIST) ; do $(INSTALL) $$f $(DESTDIR)$(INST_BIN) ; done", "") # msvc - vcmakefile_apps = os.path.join(self._source_subfolder, "apps", "makefile.vc") - tools.replace_in_file(vcmakefile_apps, - "default: ", - "default: \n\nold-default: ") - tools.replace_in_file(vcmakefile_apps, - "copy *.exe $(BINDIR)", - "") + vcmakefile_apps = os.path.join(self.source_folder, "apps", "makefile.vc") + replace_in_file(self, vcmakefile_apps, "default: ", "default: \n\nold-default: ") + replace_in_file(self, vcmakefile_apps, "copy *.exe $(BINDIR)", "") + + def _build_nmake(self): + def replace_in_nmake_opt(str1, str2): + replace_in_file(self, os.path.join(self.source_folder, "nmake.opt"), str1, str2) - def _edit_nmake_opt(self): simd_intrinsics = str(self.options.get_safe("simd_intrinsics", False)) if simd_intrinsics != "avx": - self._replace_in_nmake_opt("AVXFLAGS = /DHAVE_AVX_AT_COMPILE_TIME", "") + replace_in_nmake_opt("AVXFLAGS = /DHAVE_AVX_AT_COMPILE_TIME", "") if simd_intrinsics not in ["sse3", "avx"]: - self._replace_in_nmake_opt("SSSE3FLAGS = /DHAVE_SSSE3_AT_COMPILE_TIME", "") + replace_in_nmake_opt("SSSE3FLAGS = /DHAVE_SSSE3_AT_COMPILE_TIME", "") if simd_intrinsics not in ["sse", "sse3", "avx"]: - self._replace_in_nmake_opt("SSEFLAGS = /DHAVE_SSE_AT_COMPILE_TIME", "") + replace_in_nmake_opt("SSEFLAGS = /DHAVE_SSE_AT_COMPILE_TIME", "") if self.options.without_pam: - self._replace_in_nmake_opt("PAM_SETTING=-DPAM_ENABLED", "") + replace_in_nmake_opt("PAM_SETTING=-DPAM_ENABLED", "") if not self.options.with_gnm: - self._replace_in_nmake_opt("INCLUDE_GNM_FRMTS = YES", "") + replace_in_nmake_opt("INCLUDE_GNM_FRMTS = YES", "") if not self.options.with_odbc: - self._replace_in_nmake_opt("ODBC_SUPPORTED = 1", "") + replace_in_nmake_opt("ODBC_SUPPORTED = 1", "") if not bool(self.options.with_jpeg): - self._replace_in_nmake_opt("JPEG_SUPPORTED = 1", "") - self._replace_in_nmake_opt("JPEG12_SUPPORTED = 1", "") + replace_in_nmake_opt("JPEG_SUPPORTED = 1", "") + replace_in_nmake_opt("JPEG12_SUPPORTED = 1", "") if not self.options.with_pcidsk: - self._replace_in_nmake_opt("PCIDSK_SETTING=INTERNAL", "") + replace_in_nmake_opt("PCIDSK_SETTING=INTERNAL", "") if self.options.with_pg: - self._replace_in_nmake_opt("#PG_LIB = n:\\pkg\\libpq_win32\\lib\\libpqdll.lib wsock32.lib", "PG_LIB=") + replace_in_nmake_opt("#PG_LIB = n:\\pkg\\libpq_win32\\lib\\libpqdll.lib wsock32.lib", "PG_LIB=") if bool(self.options.with_mysql): - self._replace_in_nmake_opt("#MYSQL_LIB = D:\\Software\\MySQLServer4.1\\lib\\opt\\libmysql.lib advapi32.lib", "MYSQL_LIB=") + replace_in_nmake_opt("#MYSQL_LIB = D:\\Software\\MySQLServer4.1\\lib\\opt\\libmysql.lib advapi32.lib", "MYSQL_LIB=") if self.options.get_safe("with_sqlite3"): - self._replace_in_nmake_opt("#SQLITE_LIB=N:\\pkg\\sqlite-win32\\sqlite3_i.lib", "SQLITE_LIB=") + replace_in_nmake_opt("#SQLITE_LIB=N:\\pkg\\sqlite-win32\\sqlite3_i.lib", "SQLITE_LIB=") if self.options.with_curl: - self._replace_in_nmake_opt("#CURL_LIB = $(CURL_DIR)/libcurl.lib wsock32.lib wldap32.lib winmm.lib", "CURL_LIB=") + replace_in_nmake_opt("#CURL_LIB = $(CURL_DIR)/libcurl.lib wsock32.lib wldap32.lib winmm.lib", "CURL_LIB=") if self.options.with_freexl: - self._replace_in_nmake_opt("#FREEXL_LIBS = e:/freexl-1.0.0a/freexl_i.lib", "FREEXL_LIBS=") + replace_in_nmake_opt("#FREEXL_LIBS = e:/freexl-1.0.0a/freexl_i.lib", "FREEXL_LIBS=") if not (self.options.get_safe("with_zlib", True) and self.options.get_safe("with_png", True) and bool(self.options.with_jpeg)): - self._replace_in_nmake_opt("MRF_SETTING=yes", "") + replace_in_nmake_opt("MRF_SETTING=yes", "") if self.options.with_charls: - self._replace_in_nmake_opt("#CHARLS_LIB=e:\\work\\GIS\\gdal\\supportlibs\\charls\\bin\\Release\\x86\\CharLS.lib", "CHARLS_LIB=") - # Inject required systems libs of dependencies - self._replace_in_nmake_opt("ADD_LIBS =", "ADD_LIBS={}".format(" ".join([lib + ".lib" for lib in self.deps_cpp_info.system_libs]))) + replace_in_nmake_opt("#CHARLS_LIB=e:\\work\\GIS\\gdal\\supportlibs\\charls\\bin\\Release\\x86\\CharLS.lib", "CHARLS_LIB=") # Trick to enable OpenCL (option missing in upstream nmake files) if self.options.with_opencl: - tools.replace_in_file(os.path.join(self._source_subfolder, "alg", "makefile.vc"), + replace_in_file(self, os.path.join(self.source_folder, "alg", "makefile.vc"), "$(GEOS_CFLAGS)", "$(GEOS_CFLAGS) /DHAVE_OPENCL") - def _replace_in_nmake_opt(self, str1, str2): - tools.replace_in_file(os.path.join(self.build_folder, self._source_subfolder, "nmake.opt"), str1, str2) + with chdir(self, self.source_folder): + self.run(f"nmake -f makefile.vc {' '.join(self._nmake_args)}") @property def _nmake_args(self): - rootpath = lambda req: self.deps_cpp_info[req].rootpath - include_paths = lambda req: " -I".join(self.deps_cpp_info[req].include_paths) - version = lambda req: tools.Version(self.deps_cpp_info[req].version) + rootpath = lambda req: self.dependencies[req].package_folder + include_paths = lambda req: " -I".join(self.dependencies[req].cpp_info.aggregated_components().includedirs) + version = lambda req: Version(self.dependencies[req].ref.version) args = [] args.append("GDAL_HOME=\"{}\"".format(self.package_folder)) @@ -554,6 +549,8 @@ def _nmake_args(self): args.append("JPEGDIR=\"{}\"".format(include_paths("libjpeg"))) elif self.options.with_jpeg == "libjpeg-turbo": args.append("JPEGDIR=\"{}\"".format(include_paths("libjpeg-turbo"))) + elif self.options.with_jpeg == "mozjpeg": + args.append("JPEGDIR=\"{}\"".format(include_paths("mozjpeg"))) args.append("PNG_EXTERNAL_LIB=1") args.append("PNGDIR=\"{}\"".format(include_paths("libpng"))) if self.options.with_gif: @@ -600,10 +597,10 @@ def _nmake_args(self): "NETCDF_SETTING=YES", "NETCDF_INC_DIR=\"{}\"".format(include_paths("netcdf")) ]) - if self.options["netcdf"].netcdf4 and self.options["netcdf"].with_hdf5: + if self.dependencies["netcdf"].options.netcdf4 and self.dependencies["netcdf"].options.with_hdf5: args.append("NETCDF_HAS_NC4=YES") - if tools.Version(self.version) >= "3.3.0" and \ - os.path.isfile(os.path.join(self.deps_cpp_info["netcdf"].rootpath, "include", "netcdf_mem.h")): + if Version(self.version) >= "3.3.0" and \ + os.path.isfile(os.path.join(rootpath("netcdf"), "include", "netcdf_mem.h")): args.append("NETCDF_HAS_NETCDF_MEM=YES") if self.options.with_curl: args.append("CURL_INC=\"-I{}\"".format(include_paths("libcurl"))) @@ -641,11 +638,11 @@ def _nmake_args(self): if self.options.with_mongocxx: args.append("MONGOCXXV3_CFLAGS=\"-I{}\"".format(include_paths("mongo-cxx-driver"))) args.append("QHULL_SETTING={}".format("EXTERNAL" if self.options.with_qhull else "NO")) - if self.options.with_qhull and self.options["qhull"].reentrant: + if self.options.with_qhull and self.dependencies["qhull"].options.reentrant: args.append("QHULL_IS_LIBQHULL_R=1") if self.options.with_cryptopp: args.append("CRYPTOPP_INC=\"-I{}\"".format(include_paths("cryptopp"))) - if self.options["cryptopp"].shared: + if self.dependencies["cryptopp"].options.shared: args.append("USE_ONLY_CRYPTODLL_ALG=YES") if self.options.with_crypto: args.append("OPENSSL_INC=\"-I{}\"".format(include_paths("openssl"))) @@ -672,248 +669,224 @@ def _nmake_args(self): return args def _gather_libs(self, p): - libs = self.deps_cpp_info[p].libs + self.deps_cpp_info[p].system_libs - for dep in self.deps_cpp_info[p].public_deps: + deps_cpp_info = self.dependencies[p].cpp_info.aggregated_components() + libs = deps_cpp_info.libs + deps_cpp_info.system_libs + for dep in self.dependencies[p].dependencies: for l in self._gather_libs(dep): if not l in libs: libs.append(l) return libs - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - - yes_no = lambda v: "yes" if v else "no" - internal_no = lambda v: "internal" if v else "no" - rootpath = lambda req: tools.unix_path(self.deps_cpp_info[req].rootpath) - rootpath_no = lambda v, req: rootpath(req) if v else "no" - - args = [] - args.append("--datarootdir={}".format(tools.unix_path(os.path.join(self.package_folder, "res")))) - # Shared/Static - args.extend([ - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-shared={}".format(yes_no(self.options.shared)), - ]) - args.append("--includedir={}".format(tools.unix_path(os.path.join(self.package_folder, "include", "gdal")))) - - # Enable C++14 if requested in conan profile or if with_charls enabled - if (self.settings.compiler.cppstd and tools.valid_min_cppstd(self, 14)) or self.options.with_charls: - args.append("--with-cpp14") - # Debug - if self.settings.build_type == "Debug": - args.append("--enable-debug") - # SIMD Intrinsics - simd_intrinsics = self.options.get_safe("simd_intrinsics", False) - if not simd_intrinsics: - args.extend(["--without-sse", "--without-ssse3", "--without-avx"]) - elif simd_intrinsics == "sse": - args.extend(["--with-sse", "--without-ssse3", "--without-avx"]) - elif simd_intrinsics == "ssse3": - args.extend(["--with-sse", "--with-ssse3", "--without-avx"]) - elif simd_intrinsics == "avx": - args.extend(["--with-sse", "--with-ssse3", "--with-avx"]) - # LTO (disabled) - args.append("--disable-lto") - # Symbols - args.append("--with-hide_internal_symbols") - # Do not add /usr/local/lib and /usr/local/include - args.append("--without-local") - # Threadsafe - args.append("--with-threads={}".format(yes_no(self.options.threadsafe))) - # Depencencies: - args.append("--with-proj=yes") # always required ! - args.append("--with-libz={}".format(yes_no(self.options.with_zlib))) - if self._has_with_libdeflate_option: - args.append("--with-libdeflate={}".format(yes_no(self.options.with_libdeflate))) - args.append("--with-libiconv-prefix={}".format(rootpath_no(self.options.with_libiconv, "libiconv"))) - args.append("--with-liblzma=no") # always disabled: liblzma is an optional transitive dependency of gdal (through libtiff). - args.append("--with-zstd={}".format(yes_no(self.options.get_safe("with_zstd")))) # Optional direct dependency of gdal only if lerc lib enabled - if self._has_with_blosc_option: - args.append("--with-blosc={}".format(yes_no(self.options.with_blosc))) - if self._has_with_lz4_option: - args.append("--with-lz4={}".format(yes_no(self.options.with_lz4))) - # Drivers: - if not (self.options.with_zlib and self.options.with_png and bool(self.options.with_jpeg)): - # MRF raster driver always depends on zlib, libpng and libjpeg: https://github.com/OSGeo/gdal/issues/2581 - if tools.Version(self.version) < "3.0.0": - args.append("--without-mrf") - else: - args.append("--disable-driver-mrf") - args.append("--with-pg={}".format(yes_no(self.options.with_pg))) - args.extend(["--without-grass", "--without-libgrass"]) # TODO: to implement when libgrass lib available - args.append("--with-cfitsio={}".format(rootpath_no(self.options.with_cfitsio, "cfitsio"))) - args.append("--with-pcraster={}".format(internal_no(self.options.with_pcraster))) # TODO: use conan recipe when available instead of internal one - args.append("--with-png={}".format(rootpath_no(self.options.with_png, "libpng"))) - args.append("--with-dds={}".format(rootpath_no(self.options.with_dds, "crunch"))) - args.append("--with-gta={}".format(rootpath_no(self.options.with_gta, "libgta"))) - args.append("--with-pcidsk={}".format(internal_no(self.options.with_pcidsk))) # TODO: use conan recipe when available instead of internal one - args.append("--with-libtiff={}".format(rootpath("libtiff"))) # always required ! - args.append("--with-geotiff={}".format(rootpath("libgeotiff"))) # always required ! - if self.options.with_jpeg == "libjpeg": - args.append("--with-jpeg={}".format(rootpath("libjpeg"))) - elif self.options.with_jpeg == "libjpeg-turbo": - args.append("--with-jpeg={}".format(rootpath("libjpeg-turbo"))) - else: - args.append("--without-jpeg") - args.append("--without-jpeg12") # disabled: it requires internal libjpeg and libgeotiff - args.append("--with-charls={}".format(yes_no(self.options.with_charls))) - args.append("--with-gif={}".format(rootpath_no(self.options.with_gif, "giflib"))) - args.append("--without-ogdi") # TODO: to implement when ogdi lib available (https://sourceforge.net/projects/ogdi/) - args.append("--without-fme") # commercial library - args.append("--without-sosi") # TODO: to implement when fyba lib available - args.append("--without-mongocxx") # TODO: handle mongo-cxx-driver v2 - args.append("--with-mongocxxv3={}".format(yes_no(self.options.with_mongocxx))) - args.append("--with-hdf4={}".format(yes_no(self.options.with_hdf4))) - args.append("--with-hdf5={}".format(yes_no(self.options.with_hdf5))) - args.append("--with-kea={}".format(yes_no(self.options.with_kea))) - args.append("--with-netcdf={}".format(rootpath_no(self.options.with_netcdf, "netcdf"))) - args.append("--with-jasper={}".format(rootpath_no(self.options.with_jasper, "jasper"))) - args.append("--with-openjpeg={}".format(yes_no(self.options.with_openjpeg))) - args.append("--without-fgdb") # TODO: to implement when file-geodatabase-api lib available - args.append("--without-ecw") # commercial library - args.append("--without-kakadu") # commercial library - args.extend(["--without-mrsid", "--without-jp2mrsid", "--without-mrsid_lidar"]) # commercial library - args.append("--without-jp2lura") # commercial library - args.append("--without-msg") # commercial library - args.append("--without-oci") # TODO - args.append("--with-gnm={}".format(yes_no(self.options.with_gnm))) - args.append("--with-mysql={}".format(yes_no(self.options.with_mysql))) - args.append("--without-ingres") # commercial library - args.append("--with-xerces={}".format(rootpath_no(self.options.with_xerces, "xerces-c"))) - args.append("--with-expat={}".format(yes_no(self.options.with_expat))) - args.append("--with-libkml={}".format(rootpath_no(self.options.with_libkml, "libkml"))) - if self.options.with_odbc: - args.append("--with-odbc={}".format("yes" if self.settings.os == "Windows" else rootpath("odbc"))) + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + deps = NMakeDeps(self) + deps.generate() else: - args.append("--without-odbc") - args.append("--without-dods-root") # TODO: to implement when libdap lib available - args.append("--with-curl={}".format(yes_no(self.options.with_curl))) - args.append("--with-xml2={}".format(yes_no(self.options.with_xml2))) - args.append("--without-spatialite") # TODO: to implement when libspatialite lib available - args.append("--with-sqlite3={}".format(yes_no(self.options.get_safe("with_sqlite3")))) - args.append("--without-rasterlite2") # TODO: to implement when rasterlite2 lib available - if self._has_with_pcre2_option: - args.append("--with-pcre2={}".format(yes_no(self.options.get_safe("with_pcre2")))) - args.append("--with-pcre={}".format(yes_no(self.options.get_safe("with_pcre")))) - args.append("--without-teigha") # commercial library - args.append("--without-idb") # commercial library - if tools.Version(self.version) < "3.2.0": - args.append("--without-sde") # commercial library - if tools.Version(self.version) < "3.3.0": - args.append("--without-epsilon") - args.append("--with-webp={}".format(rootpath_no(self.options.with_webp, "libwebp"))) - args.append("--with-geos={}".format(yes_no(self.options.with_geos))) - args.append("--without-sfcgal") # TODO: to implement when sfcgal lib available - args.append("--with-qhull={}".format(yes_no(self.options.with_qhull))) - if self.options.with_opencl: - args.extend([ - "--with-opencl", - "--with-opencl-include={}".format(tools.unix_path(self.deps_cpp_info["opencl-headers"].include_paths[0])), - "--with-opencl-lib=-L{}".format(tools.unix_path(self.deps_cpp_info["opencl-icd-loader"].lib_paths[0])) + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + + yes_no = lambda v: "yes" if v else "no" + internal_no = lambda v: "internal" if v else "no" + rootpath = lambda req: unix_path(self, self.dependencies[req].package_folder) + rootpath_no = lambda v, req: rootpath(req) if v else "no" + + tc.configure_args.extend([ + "--includedir=${prefix}/include/gdal", + "--datarootdir=${prefix}/res", ]) - else: - args.append("--without-opencl") - args.append("--with-freexl={}".format(yes_no(self.options.with_freexl))) - args.append("--with-libjson-c={}".format(rootpath("json-c"))) # always required ! - if self.options.without_pam: - args.append("--without-pam") - args.append("--with-poppler={}".format(yes_no(self.options.with_poppler))) - args.append("--with-podofo={}".format(rootpath_no(self.options.with_podofo, "podofo"))) - if self.options.with_podofo: - args.append("--with-podofo-lib=-l{}".format(" -l".join(self._gather_libs("podofo")))) - args.append("--without-pdfium") # TODO: to implement when pdfium lib available - args.append("--without-perl") - args.append("--without-python") - args.append("--without-java") - args.append("--without-hdfs") - if tools.Version(self.version) >= "3.0.0": - args.append("--without-tiledb") # TODO: to implement when tiledb lib available - args.append("--without-mdb") - args.append("--without-rasdaman") # TODO: to implement when rasdaman lib available - if self._has_with_brunsli_option: - args.append("--with-brunsli={}".format(yes_no(self.options.with_brunsli))) - if tools.Version(self.version) >= "3.1.0": - args.append("--without-rdb") # commercial library - args.append("--without-armadillo") # TODO: to implement when armadillo lib available - args.append("--with-cryptopp={}".format(rootpath_no(self.options.with_cryptopp, "cryptopp"))) - args.append("--with-crypto={}".format(yes_no(self.options.with_crypto))) - if tools.Version(self.version) >= "3.3.0": - args.append("--with-lerc={}".format(internal_no(not self.options.without_lerc))) - else: - args.append("--with-lerc={}".format(yes_no(not self.options.without_lerc))) - if self.options.with_null: - args.append("--with-null") - if self._has_with_exr_option: - args.append("--with-exr={}".format(yes_no(self.options.with_exr))) - if self._has_with_heif_option: - args.append("--with-heif={}".format(yes_no(self.options.with_heif))) - - # Inject -stdlib=libc++ for clang with libc++ - env_build_vars = autotools.vars - if self.settings.compiler == "clang" and \ - self.settings.os == "Linux" and tools.stdcpp_library(self) == "c++": - env_build_vars["LDFLAGS"] = "-stdlib=libc++ {}".format(env_build_vars["LDFLAGS"]) - - autotools.configure(args=args, vars=env_build_vars) - return autotools - - @contextmanager - def _msvc_build_environment(self): - with tools.chdir(self._source_subfolder): - with tools.vcvars(self.settings): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - yield - - @contextmanager - def _autotools_build_environment(self): - with tools.chdir(self._source_subfolder): - with tools.run_environment(self): - with tools.environment_append({"PKG_CONFIG_PATH": tools.unix_path(self.build_folder)}): - yield + + # Enable C++14 if requested in conan profile or if with_charls enabled + if (self.settings.compiler.get_safe("cppstd") and valid_min_cppstd(self, 14)) or self.options.with_charls: + tc.configure_args.append("--with-cpp14") + # Debug + if self.settings.build_type == "Debug": + tc.configure_args.append("--enable-debug") + # SIMD Intrinsics + simd_intrinsics = self.options.get_safe("simd_intrinsics", False) + if not simd_intrinsics: + tc.configure_args.extend(["--without-sse", "--without-ssse3", "--without-avx"]) + elif simd_intrinsics == "sse": + tc.configure_args.extend(["--with-sse", "--without-ssse3", "--without-avx"]) + elif simd_intrinsics == "ssse3": + tc.configure_args.extend(["--with-sse", "--with-ssse3", "--without-avx"]) + elif simd_intrinsics == "avx": + tc.configure_args.extend(["--with-sse", "--with-ssse3", "--with-avx"]) + # LTO (disabled) + tc.configure_args.append("--disable-lto") + # Symbols + tc.configure_args.append("--with-hide_internal_symbols") + # Do not add /usr/local/lib and /usr/local/include + tc.configure_args.append("--without-local") + # Threadsafe + tc.configure_args.append("--with-threads={}".format(yes_no(self.options.threadsafe))) + # Depencencies: + tc.configure_args.append("--with-proj=yes") # always required ! + tc.configure_args.append("--with-libz={}".format(yes_no(self.options.with_zlib))) + if self._has_with_libdeflate_option: + tc.configure_args.append("--with-libdeflate={}".format(yes_no(self.options.with_libdeflate))) + tc.configure_args.append("--with-libiconv-prefix={}".format(rootpath_no(self.options.with_libiconv, "libiconv"))) + tc.configure_args.append("--with-liblzma=no") # always disabled: liblzma is an optional transitive dependency of gdal (through libtiff). + tc.configure_args.append("--with-zstd={}".format(yes_no(self.options.get_safe("with_zstd")))) # Optional direct dependency of gdal only if lerc lib enabled + if self._has_with_blosc_option: + tc.configure_args.append("--with-blosc={}".format(yes_no(self.options.with_blosc))) + if self._has_with_lz4_option: + tc.configure_args.append("--with-lz4={}".format(yes_no(self.options.with_lz4))) + # Drivers: + if not (self.options.with_zlib and self.options.with_png and bool(self.options.with_jpeg)): + # MRF raster driver always depends on zlib, libpng and libjpeg: https://github.com/OSGeo/gdal/issues/2581 + if Version(self.version) < "3.0.0": + tc.configure_args.append("--without-mrf") + else: + tc.configure_args.append("--disable-driver-mrf") + tc.configure_args.append("--with-pg={}".format(yes_no(self.options.with_pg))) + tc.configure_args.extend(["--without-grass", "--without-libgrass"]) # TODO: to implement when libgrass lib available + tc.configure_args.append("--with-cfitsio={}".format(rootpath_no(self.options.with_cfitsio, "cfitsio"))) + tc.configure_args.append("--with-pcraster={}".format(internal_no(self.options.with_pcraster))) # TODO: use conan recipe when available instead of internal one + tc.configure_args.append("--with-png={}".format(rootpath_no(self.options.with_png, "libpng"))) + tc.configure_args.append("--with-dds={}".format(rootpath_no(self.options.with_dds, "crunch"))) + tc.configure_args.append("--with-gta={}".format(rootpath_no(self.options.with_gta, "libgta"))) + tc.configure_args.append("--with-pcidsk={}".format(internal_no(self.options.with_pcidsk))) # TODO: use conan recipe when available instead of internal one + tc.configure_args.append("--with-libtiff={}".format(rootpath("libtiff"))) # always required ! + tc.configure_args.append("--with-geotiff={}".format(rootpath("libgeotiff"))) # always required ! + if self.options.with_jpeg == "libjpeg": + tc.configure_args.append("--with-jpeg={}".format(rootpath("libjpeg"))) + elif self.options.with_jpeg == "libjpeg-turbo": + tc.configure_args.append("--with-jpeg={}".format(rootpath("libjpeg-turbo"))) + elif self.options.with_jpeg == "mozjpeg": + tc.configure_args.append("--with-jpeg={}".format(rootpath("mozjpeg"))) + else: + tc.configure_args.append("--without-jpeg") + tc.configure_args.append("--without-jpeg12") # disabled: it requires internal libjpeg and libgeotiff + tc.configure_args.append("--with-charls={}".format(yes_no(self.options.with_charls))) + tc.configure_args.append("--with-gif={}".format(rootpath_no(self.options.with_gif, "giflib"))) + tc.configure_args.append("--without-ogdi") # TODO: to implement when ogdi lib available (https://sourceforge.net/projects/ogdi/) + tc.configure_args.append("--without-fme") # commercial library + tc.configure_args.append("--without-sosi") # TODO: to implement when fyba lib available + tc.configure_args.append("--without-mongocxx") # TODO: handle mongo-cxx-driver v2 + tc.configure_args.append("--with-mongocxxv3={}".format(yes_no(self.options.with_mongocxx))) + tc.configure_args.append("--with-hdf4={}".format(yes_no(self.options.with_hdf4))) + tc.configure_args.append("--with-hdf5={}".format(yes_no(self.options.with_hdf5))) + tc.configure_args.append("--with-kea={}".format(yes_no(self.options.with_kea))) + tc.configure_args.append("--with-netcdf={}".format(rootpath_no(self.options.with_netcdf, "netcdf"))) + tc.configure_args.append("--with-jasper={}".format(rootpath_no(self.options.with_jasper, "jasper"))) + tc.configure_args.append("--with-openjpeg={}".format(yes_no(self.options.with_openjpeg))) + tc.configure_args.append("--without-fgdb") # TODO: to implement when file-geodatabase-api lib available + tc.configure_args.append("--without-ecw") # commercial library + tc.configure_args.append("--without-kakadu") # commercial library + tc.configure_args.extend(["--without-mrsid", "--without-jp2mrsid", "--without-mrsid_lidar"]) # commercial library + tc.configure_args.append("--without-jp2lura") # commercial library + tc.configure_args.append("--without-msg") # commercial library + tc.configure_args.append("--without-oci") # TODO + tc.configure_args.append("--with-gnm={}".format(yes_no(self.options.with_gnm))) + tc.configure_args.append("--with-mysql={}".format(yes_no(self.options.with_mysql))) + tc.configure_args.append("--without-ingres") # commercial library + tc.configure_args.append("--with-xerces={}".format(rootpath_no(self.options.with_xerces, "xerces-c"))) + tc.configure_args.append("--with-expat={}".format(yes_no(self.options.with_expat))) + tc.configure_args.append("--with-libkml={}".format(rootpath_no(self.options.with_libkml, "libkml"))) + if self.options.with_odbc: + tc.configure_args.append("--with-odbc={}".format("yes" if self.settings.os == "Windows" else rootpath("odbc"))) + else: + tc.configure_args.append("--without-odbc") + tc.configure_args.append("--without-dods-root") # TODO: to implement when libdap lib available + tc.configure_args.append("--with-curl={}".format(yes_no(self.options.with_curl))) + tc.configure_args.append("--with-xml2={}".format(yes_no(self.options.with_xml2))) + tc.configure_args.append("--without-spatialite") # TODO: to implement when libspatialite lib available + tc.configure_args.append("--with-sqlite3={}".format(yes_no(self.options.get_safe("with_sqlite3")))) + tc.configure_args.append("--without-rasterlite2") # TODO: to implement when rasterlite2 lib available + if self._has_with_pcre2_option: + tc.configure_args.append("--with-pcre2={}".format(yes_no(self.options.get_safe("with_pcre2")))) + tc.configure_args.append("--with-pcre={}".format(yes_no(self.options.get_safe("with_pcre")))) + tc.configure_args.append("--without-teigha") # commercial library + tc.configure_args.append("--without-idb") # commercial library + if Version(self.version) < "3.2.0": + tc.configure_args.append("--without-sde") # commercial library + if Version(self.version) < "3.3.0": + tc.configure_args.append("--without-epsilon") + tc.configure_args.append("--with-webp={}".format(rootpath_no(self.options.with_webp, "libwebp"))) + tc.configure_args.append("--with-geos={}".format(yes_no(self.options.with_geos))) + tc.configure_args.append("--without-sfcgal") # TODO: to implement when sfcgal lib available + tc.configure_args.append("--with-qhull={}".format(yes_no(self.options.with_qhull))) + if self.options.with_opencl: + tc.configure_args.extend([ + "--with-opencl", + "--with-opencl-include={}".format(unix_path(self, self.dependencies["opencl-headers"].cpp_info.aggregated_components().includedirs[0])), + "--with-opencl-lib=-L{}".format(unix_path(self, self.dependencies["opencl-icd-loader"].cpp_info.aggregated_components().libdirs[0])) + ]) + else: + tc.configure_args.append("--without-opencl") + tc.configure_args.append("--with-freexl={}".format(yes_no(self.options.with_freexl))) + tc.configure_args.append("--with-libjson-c={}".format(rootpath("json-c"))) # always required ! + if self.options.without_pam: + tc.configure_args.append("--without-pam") + tc.configure_args.append("--with-poppler={}".format(yes_no(self.options.with_poppler))) + tc.configure_args.append("--with-podofo={}".format(rootpath_no(self.options.with_podofo, "podofo"))) + if self.options.with_podofo: + tc.configure_args.append("--with-podofo-lib=-l{}".format(" -l".join(self._gather_libs("podofo")))) + tc.configure_args.append("--without-pdfium") # TODO: to implement when pdfium lib available + tc.configure_args.append("--without-perl") + tc.configure_args.append("--without-python") + tc.configure_args.append("--without-java") + tc.configure_args.append("--without-hdfs") + if Version(self.version) >= "3.0.0": + tc.configure_args.append("--without-tiledb") # TODO: to implement when tiledb lib available + tc.configure_args.append("--without-mdb") + tc.configure_args.append("--without-rasdaman") # TODO: to implement when rasdaman lib available + if self._has_with_brunsli_option: + tc.configure_args.append("--with-brunsli={}".format(yes_no(self.options.with_brunsli))) + if Version(self.version) >= "3.1.0": + tc.configure_args.append("--without-rdb") # commercial library + tc.configure_args.append("--without-armadillo") # TODO: to implement when armadillo lib available + tc.configure_args.append("--with-cryptopp={}".format(rootpath_no(self.options.with_cryptopp, "cryptopp"))) + tc.configure_args.append("--with-crypto={}".format(yes_no(self.options.with_crypto))) + if Version(self.version) >= "3.3.0": + tc.configure_args.append("--with-lerc={}".format(internal_no(not self.options.without_lerc))) + else: + tc.configure_args.append("--with-lerc={}".format(yes_no(not self.options.without_lerc))) + if self.options.with_null: + tc.configure_args.append("--with-null") + if self._has_with_exr_option: + tc.configure_args.append("--with-exr={}".format(yes_no(self.options.with_exr))) + if self._has_with_heif_option: + tc.configure_args.append("--with-heif={}".format(yes_no(self.options.with_heif))) + tc.generate() + + AutotoolsDeps(self).generate() + PkgConfigDeps(self).generate() def build(self): - self._validate_dependency_graph() self._patch_sources() if is_msvc(self): - self._edit_nmake_opt() - with self._msvc_build_environment(): - self.run("nmake -f makefile.vc {}".format(" ".join(self._nmake_args))) + self._build_nmake() else: - with self._autotools_build_environment(): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # Required for cross-build to iOS, see https://github.com/OSGeo/gdal/issues/4123 - tools.replace_in_file(os.path.join("port", "cpl_config.h.in"), - "/* port/cpl_config.h.in", - "#pragma once\n/* port/cpl_config.h.in") - # Relocatable shared lib on macOS - tools.replace_in_file("configure", - "-install_name \\$rpath/", - "-install_name @rpath/") - # avoid SIP issues on macOS when dependencies are shared - if tools.is_apple_os(self.settings.os): - libpaths = ":".join(self.deps_cpp_info.lib_paths) - tools.replace_in_file( - "configure", - "#! /bin/sh\n", - "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n".format(libpaths), - ) - autotools = self._configure_autotools() - autotools.make() + autotools = Autotools(self) + autotools.autoreconf() + # Required for cross-build to iOS, see https://github.com/OSGeo/gdal/issues/4123 + replace_in_file(self, os.path.join(self.source_folder, "port", "cpl_config.h.in"), + "/* port/cpl_config.h.in", + "#pragma once\n/* port/cpl_config.h.in") + autotools.configure() + autotools.make() def package(self): - self.copy("LICENSE.TXT", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE.TXT", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - with self._msvc_build_environment(): - self.run("nmake -f makefile.vc devinstall {}".format(" ".join(self._nmake_args))) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.pdb") + with chdir(self, self.source_folder): + self.run(f"nmake -f makefile.vc devinstall {' '.join(self._nmake_args)}") + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) else: - with self._autotools_build_environment(): - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "gdalplugins")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "lib", "gdalplugins")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("cmake_file_name", "GDAL") @@ -921,11 +894,8 @@ def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("pkg_config_name", "gdal") - self.cpp_info.names["cmake_find_package"] = "GDAL" - self.cpp_info.names["cmake_find_package_multi"] = "GDAL" - self.cpp_info.filenames["cmake_find_package"] = "GDAL" - self.cpp_info.filenames["cmake_find_package_multi"] = "GDAL" self.cpp_info.includedirs.append(os.path.join("include", "gdal")) + self.cpp_info.resdirs = ["res"] lib_suffix = "" if is_msvc(self): @@ -933,30 +903,32 @@ def package_info(self): lib_suffix += "_i" if self.settings.build_type == "Debug": lib_suffix += "_d" - self.cpp_info.libs = ["gdal{}".format(lib_suffix)] + self.cpp_info.libs = [f"gdal{lib_suffix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["dl", "m"]) if self.options.threadsafe: self.cpp_info.system_libs.append("pthread") elif self.settings.os == "Windows": self.cpp_info.system_libs.extend(["psapi", "ws2_32"]) - if tools.Version(self.version) >= "3.2.0" and is_msvc(self): + if Version(self.version) >= "3.2.0" and is_msvc(self): self.cpp_info.system_libs.append("wbemuuid") if self.options.with_odbc and not self.options.shared: self.cpp_info.system_libs.extend(["odbc32", "odbccp32"]) if is_msvc(self): self.cpp_info.system_libs.append("legacy_stdio_definitions") - if not self.options.shared and tools.stdcpp_library(self): - self.cpp_info.system_libs.append(tools.stdcpp_library(self)) + if not self.options.shared: + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) gdal_data_path = os.path.join(self.package_folder, "res", "gdal") - self.output.info("Prepending to GDAL_DATA environment variable: {}".format(gdal_data_path)) self.runenv_info.prepend_path("GDAL_DATA", gdal_data_path) - # TODO: to remove after conan v2, it allows to not break consumers still relying on virtualenv generator - self.env_info.GDAL_DATA = gdal_data_path - if self.options.tools: self.buildenv_info.prepend_path("GDAL_DATA", gdal_data_path) - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "GDAL" + self.cpp_info.names["cmake_find_package_multi"] = "GDAL" + self.env_info.GDAL_DATA = gdal_data_path + if self.options.tools: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/gdal/pre_3.5.0/test_package/CMakeLists.txt b/recipes/gdal/pre_3.5.0/test_package/CMakeLists.txt index 861d8d69409b0..48be1c2ca7812 100644 --- a/recipes/gdal/pre_3.5.0/test_package/CMakeLists.txt +++ b/recipes/gdal/pre_3.5.0/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(GDAL REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} GDAL::GDAL) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE GDAL::GDAL) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) add_executable(${PROJECT_NAME}_c test_package.c) -target_link_libraries(${PROJECT_NAME}_c GDAL::GDAL) +target_link_libraries(${PROJECT_NAME}_c PRIVATE GDAL::GDAL) diff --git a/recipes/gdal/pre_3.5.0/test_package/conanfile.py b/recipes/gdal/pre_3.5.0/test_package/conanfile.py index 2c2e49d53ca18..850e6a3727288 100644 --- a/recipes/gdal/pre_3.5.0/test_package/conanfile.py +++ b/recipes/gdal/pre_3.5.0/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,10 +21,10 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): if self.options["gdal"].tools: - self.run("gdal_translate --formats", run_environment=True) - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - bin_path_c = os.path.join("bin", "test_package_c") - self.run(bin_path_c, run_environment=True) + self.run("gdal_translate --formats", env="conanrun") + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + bin_path_c = os.path.join(self.cpp.build.bindirs[0], "test_package_c") + self.run(bin_path_c, env="conanrun") diff --git a/recipes/gdal/pre_3.5.0/test_v1_package/CMakeLists.txt b/recipes/gdal/pre_3.5.0/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/gdal/pre_3.5.0/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gdal/pre_3.5.0/test_v1_package/conanfile.py b/recipes/gdal/pre_3.5.0/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..45e13620d8746 --- /dev/null +++ b/recipes/gdal/pre_3.5.0/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + if self.options["gdal"].tools: + self.run("gdal_translate --formats", run_environment=True) + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + bin_path_c = os.path.join("bin", "test_package_c") + self.run(bin_path_c, run_environment=True) diff --git a/recipes/gdcm/all/CMakeLists.txt b/recipes/gdcm/all/CMakeLists.txt deleted file mode 100644 index 1a5609e8abe82..0000000000000 --- a/recipes/gdcm/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.9.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(src) diff --git a/recipes/gdcm/all/conandata.yml b/recipes/gdcm/all/conandata.yml index e4eb70c004754..00f65ba461aeb 100644 --- a/recipes/gdcm/all/conandata.yml +++ b/recipes/gdcm/all/conandata.yml @@ -1,10 +1,56 @@ sources: + "3.0.20": + url: "https://sourceforge.net/projects/gdcm/files/gdcm%203.x/GDCM%203.0.20/gdcm-3.0.20.tar.bz2" + sha256: "d299731e229fe7595001f17e6b81e6f9a27daac3df7295543753525242cea0b2" "3.0.9": - url: "https://github.com/malaterre/GDCM/archive/refs/tags/v3.0.9.tar.gz" - sha256: "fcfc50ea8809bd4a173550c7d7bb4f8722ae0781fbf17240ce84a04e90af0e9b" + url: "https://sourceforge.net/projects/gdcm/files/gdcm%203.x/GDCM%203.0.9/gdcm-3.0.9.tar.bz2" + sha256: "1d518b0e4709cecfb7330c9bd9b3a73cfd01ffe70d1c178f36a4c847283c4672" patches: + "3.0.20": + - patch_file: "patches/0001-charls-linking.patch" + patch_description: "fix symbol export for gdcmcharls" + patch_type: "portability" + - patch_file: "patches/0002-3.0.20-openjpeg.patch" + patch_description: "fix variable names for openjpeg" + patch_type: "conan" + - patch_file: "patches/0004-3.0.20-find-expat.patch" + patch_description: "enforce usage of FindEXPAT.cmake" + patch_type: "conan" + - patch_file: "patches/0005-3.0.20-openssl.patch" + patch_description: "skip check_cxx_source_compiles usage for openssl" + patch_type: "conan" + - patch_file: "patches/0006-json.patch" + patch_description: "skip check_cxx_source_compiles usage for json-c" + patch_type: "conan" + - patch_file: "patches/0007-3.0.20-find-json.patch" + patch_description: "fix find_package for json-c" + patch_type: "conan" + - patch_file: "patches/0008-3.0.20-find-libuuid.patch" + patch_description: "fix find_package for libuuid" + patch_type: "conan" "3.0.9": - patch_file: "patches/0001-charls-linking.patch" - base_path: "src" - - patch_file: "patches/0002-openjpeg-integration.patch" - base_path: "src" + patch_description: "fix symbol export for gdcmcharls" + patch_type: "portability" + - patch_file: "patches/0002-3.0.9-openjpeg.patch" + patch_description: "fix variable names for openjpeg" + patch_type: "conan" + - patch_file: "patches/0003-gcc-11-compilation.patch" + patch_description: "add missing includes for GCC 11" + patch_type: "portability" + patch_source: "https://github.com/malaterre/GDCM/commit/4404b770be337bd0d5d3c2289abfd34426433db2" + - patch_file: "patches/0004-3.0.9-find-expat.patch" + patch_description: "enforce usage of FindEXPAT.cmake" + patch_type: "conan" + - patch_file: "patches/0005-3.0.9-openssl.patch" + patch_description: "skip check_cxx_source_compiles usage for openssl" + patch_type: "conan" + - patch_file: "patches/0006-json.patch" + patch_description: "skip check_cxx_source_compiles usage for json-c" + patch_type: "conan" + - patch_file: "patches/0007-3.0.9-find-json.patch" + patch_description: "fix find_package for json-c" + patch_type: "conan" + - patch_file: "patches/0008-3.0.9-find-libuuid.patch" + patch_description: "fix find_package for libuuid" + patch_type: "conan" diff --git a/recipes/gdcm/all/conanfile.py b/recipes/gdcm/all/conanfile.py index 6eebe789201e9..3c096776bcba9 100644 --- a/recipes/gdcm/all/conanfile.py +++ b/recipes/gdcm/all/conanfile.py @@ -1,49 +1,46 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd, valid_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, save +from conan.tools.microsoft import is_msvc_static_runtime +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" + +required_conan_version = ">=1.53.0" class GDCMConan(ConanFile): name = "gdcm" - topics = ("dicom", "images") - homepage = "http://gdcm.sourceforge.net/" - url = "https://github.com/conan-io/conan-center-index" - license = "BSD-3-Clause" + package_type = "library" description = "C++ library for DICOM medical files" - + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "http://gdcm.sourceforge.net/" + topics = ("dicom", "images", "medical-imaging") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_json": [True, False], + "with_openssl": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_json": True, + "with_openssl": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "src" - @property - def _build_subfolder(self): - return "build" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _min_cppstd(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,75 +48,85 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("expat/2.4.8") - self.requires("openjpeg/2.4.0") - self.requires("zlib/1.2.12") + self.requires("expat/2.5.0") + self.requires("openjpeg/2.5.0") + self.requires("zlib/1.2.13") + if self.settings.os != "Windows": + self.requires("libuuid/1.0.3") + if Version(self.version) >= Version("3.0.20"): + self.requires("libiconv/1.17") + if self.options.with_json: + self.requires("json-c/0.16") + if self.options.with_openssl: + self.requires("openssl/1.1.1s") def validate(self): - if self.options.shared and self._is_msvc and "MT" in msvc_runtime_flag(self): - raise ConanInvalidConfiguration("shared gdcm can't be built with MT or MTd") if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, self._min_cppstd) + if is_msvc_static_runtime(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} does not support shared and static runtime together.") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["GDCM_BUILD_DOCBOOK_MANPAGES"] = False - self._cmake.definitions["GDCM_BUILD_SHARED_LIBS"] = self.options.shared + def generate(self): + tc = CMakeToolchain(self) + tc.variables["GDCM_BUILD_DOCBOOK_MANPAGES"] = False + tc.variables["GDCM_BUILD_SHARED_LIBS"] = bool(self.options.shared) # FIXME: unvendor deps https://github.com/conan-io/conan-center-index/pull/5705#discussion_r647224146 - self._cmake.definitions["GDCM_USE_SYSTEM_EXPAT"] = True - self._cmake.definitions["GDCM_USE_SYSTEM_OPENJPEG"] = True - self._cmake.definitions["GDCM_USE_SYSTEM_ZLIB"] = True - if not tools.valid_min_cppstd(self, 11): - self._cmake.definitions["CMAKE_CXX_STANDARD"] = 11 + tc.variables["GDCM_USE_SYSTEM_EXPAT"] = True + tc.variables["GDCM_USE_SYSTEM_JSON"] = self.options.with_json + tc.variables["GDCM_USE_SYSTEM_OPENJPEG"] = True + tc.variables["GDCM_USE_SYSTEM_OPENSSL"] = self.options.with_openssl + tc.variables["GDCM_USE_SYSTEM_UUID"] = self.settings.os != "Windows" + tc.variables["GDCM_USE_SYSTEM_ZLIB"] = True + + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + tc.generate() + deps = CMakeDeps(self) + deps.generate() - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def _patch_sources(self): + apply_conandata_patches(self) + rm(self, "Find*.cmake", os.path.join(self.source_folder, "CMake")) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("Copyright.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="Copyright.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() + if self.settings.os == "Windows": bin_dir = os.path.join(self.package_folder, "bin") - tools.remove_files_by_mask(bin_dir, "[!gs]*.dll") - tools.remove_files_by_mask(bin_dir, "*.pdb") - lib_dir = os.path.join(self.package_folder, "lib") - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(lib_dir, self._gdcm_subdir), "[!U]*.cmake") #leave UseGDCM.cmake untouched + rm(self, "[!gs]*.dll", bin_dir) + rm(self, "*.pdb", bin_dir) + + rm(self, "[!U]*.cmake", os.path.join(self.package_folder, "lib", self._gdcm_subdir)) #leave UseGDCM.cmake untouched + rmdir(self, os.path.join(self.package_folder, "share")) self._create_cmake_variables(os.path.join(self.package_folder, self._gdcm_cmake_variables_path)) # TODO: to remove in conan v2 once cmake_find_package* generators removed - self._create_cmake_module_alias_targets( - os.path.join(self.package_folder, self._gdcm_cmake_module_aliases_path), - {library: "GDCM::{}".format(library) for library in self._gdcm_libraries}, - ) + self._create_cmake_module_alias_targets() def _create_cmake_variables(self, variables_file): - v = tools.Version(self.version) - content = textwrap.dedent("""\ + v = Version(self.version) + content = textwrap.dedent(f"""\ # The GDCM version number. - set(GDCM_MAJOR_VERSION "{v_major}") - set(GDCM_MINOR_VERSION "{v_minor}") - set(GDCM_BUILD_VERSION "{v_patch}") + set(GDCM_MAJOR_VERSION "{v.major}") + set(GDCM_MINOR_VERSION "{v.minor}") + set(GDCM_BUILD_VERSION "{v.patch}") get_filename_component(SELF_DIR "${{CMAKE_CURRENT_LIST_FILE}}" PATH) @@ -130,7 +137,7 @@ def _create_cmake_variables(self, variables_file): set(GDCM_CMAKE_DIR "") # The configuration options. - set(GDCM_BUILD_SHARED_LIBS "{build_shared_libs}") + set(GDCM_BUILD_SHARED_LIBS "{"ON" if self.options.shared else "OFF"}") set(GDCM_USE_VTK "OFF") @@ -140,33 +147,25 @@ def _create_cmake_variables(self, variables_file): # The VTK options. set(GDCM_VTK_DIR "") - get_filename_component(GDCM_INCLUDE_ROOT "${{SELF_DIR}}/../../include/{gdcm_subdir}" ABSOLUTE) + get_filename_component(GDCM_INCLUDE_ROOT "${{SELF_DIR}}/../../include/{self._gdcm_subdir}" ABSOLUTE) set(GDCM_INCLUDE_DIRS ${{GDCM_INCLUDE_ROOT}}) get_filename_component(GDCM_LIB_ROOT "${{SELF_DIR}}/../../lib" ABSOLUTE) set(GDCM_LIBRARY_DIRS ${{GDCM_LIB_ROOT}}) - """.format(v_major=v.major, - v_minor=v.minor, - v_patch=v.patch, - build_shared_libs="ON" if self.options.shared else "OFF", - gdcm_subdir=self._gdcm_subdir)) - tools.save(variables_file, content) - - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + """) + save(self, variables_file, content) + + def _create_cmake_module_alias_targets(self): + module_file = os.path.join(self.package_folder, self._gdcm_cmake_module_aliases_path) + targets = {library: f"GDCM::{library}" for library in self._gdcm_libraries} content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) - - @property - def _gdcm_subdir(self): - v = tools.Version(self.version) - return "gdcm-{}.{}".format(v.major, v.minor) + """) + save(self, module_file, content) @property def _gdcm_builddir(self): @@ -199,10 +198,13 @@ def _gdcm_libraries(self): "socketxx"] if self.settings.os == "Windows": gdcm_libs.append("gdcmgetopt") - else: - gdcm_libs.append("gdcmuuid") return gdcm_libs + @property + def _gdcm_subdir(self): + v = Version(self.version) + return f"gdcm-{v.major}.{v.minor}" + def package_info(self): self.cpp_info.set_property("cmake_file_name", "GDCM") self.cpp_info.set_property("cmake_build_modules", [self._gdcm_cmake_variables_path]) @@ -218,9 +220,17 @@ def package_info(self): self.cpp_info.components[lib].build_modules["cmake_find_package"] = self._gdcm_build_modules self.cpp_info.components[lib].build_modules["cmake_find_package_multi"] = self._gdcm_build_modules + if self.options.with_openssl: + self.cpp_info.components["gdcmCommon"].requires.append("openssl::openssl") self.cpp_info.components["gdcmDSED"].requires.extend(["gdcmCommon", "zlib::zlib"]) self.cpp_info.components["gdcmIOD"].requires.extend(["gdcmDSED", "gdcmCommon", "expat::expat"]) self.cpp_info.components["gdcmMSFF"].requires.extend(["gdcmIOD", "gdcmDSED", "gdcmDICT", "openjpeg::openjpeg"]) + if self.options.with_json: + self.cpp_info.components["gdcmMSFF"].requires.append("json-c::json-c") + if self.settings.os != "Windows": + self.cpp_info.components["gdcmMSFF"].requires.append("libuuid::libuuid") + if Version(self.version) >= Version("3.0.20"): + self.cpp_info.components["gdcmMSFF"].requires.append("libiconv::libiconv") if not self.options.shared: self.cpp_info.components["gdcmDICT"].requires.extend(["gdcmDSED", "gdcmIOD"]) self.cpp_info.components["gdcmMEXD"].requires.extend(["gdcmMSFF", "gdcmDICT", "gdcmDSED", "gdcmIOD", "socketxx"]) @@ -231,10 +241,8 @@ def package_info(self): self.cpp_info.components["gdcmMSFF"].system_libs = ["rpcrt4"] self.cpp_info.components["socketxx"].system_libs = ["ws2_32"] else: - self.cpp_info.components["gdcmMSFF"].requires.append("gdcmuuid") - self.cpp_info.components["gdcmCommon"].system_libs = ["dl"] - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.components["gdcmCommon"].frameworks = ["CoreFoundation"] # TODO: to remove in conan v2 once cmake_find_package* generators removed diff --git a/recipes/gdcm/all/patches/0002-3.0.20-openjpeg.patch b/recipes/gdcm/all/patches/0002-3.0.20-openjpeg.patch new file mode 100644 index 0000000000000..59aa76d14cfc8 --- /dev/null +++ b/recipes/gdcm/all/patches/0002-3.0.20-openjpeg.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -360,7 +360,7 @@ endif() + + if(GDCM_USE_SYSTEM_OPENJPEG) + find_package(OpenJPEG 2.0.0 REQUIRED) +- set(GDCM_OPENJPEG_LIBRARIES ${OPENJPEG_LIBRARIES}) ++ set(GDCM_OPENJPEG_LIBRARIES ${OpenJPEG_LIBRARIES}) + else() + set(GDCM_OPENJPEG_LIBRARIES gdcmopenjp2) + endif() +--- a/Source/MediaStorageAndFileFormat/CMakeLists.txt ++++ b/Source/MediaStorageAndFileFormat/CMakeLists.txt +@@ -161,7 +161,7 @@ else() + ) + endif() + if(GDCM_USE_SYSTEM_OPENJPEG) +- include_directories(${OPENJPEG_INCLUDE_DIRS} ) ++ include_directories(${OpenJPEG_INCLUDE_DIRS} ) + else() + include_directories( + "${GDCM_BINARY_DIR}/Utilities/gdcmopenjpeg" diff --git a/recipes/gdcm/all/patches/0002-openjpeg-integration.patch b/recipes/gdcm/all/patches/0002-3.0.9-openjpeg.patch similarity index 100% rename from recipes/gdcm/all/patches/0002-openjpeg-integration.patch rename to recipes/gdcm/all/patches/0002-3.0.9-openjpeg.patch diff --git a/recipes/gdcm/all/patches/0003-gcc-11-compilation.patch b/recipes/gdcm/all/patches/0003-gcc-11-compilation.patch new file mode 100644 index 0000000000000..ff438c185dc4f --- /dev/null +++ b/recipes/gdcm/all/patches/0003-gcc-11-compilation.patch @@ -0,0 +1,68 @@ +From 4404b770be337bd0d5d3c2289abfd34426433db2 Mon Sep 17 00:00:00 2001 +From: Axel Braun +Date: Mon, 7 Jun 2021 16:27:52 +0200 +Subject: [PATCH] gdcm fails to build with gcc11 compiler + +gdcm fails to build with gcc11 compiler: +cd +/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/build/Source/MediaStorageAndFileFormat +&& /usr/bin/c++ -DgdcmMSFF_EXPORTS +-I/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/Source/Common +-I/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/build/Source/Common +-I/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/Source/DataStructureAndEncodingDefinition +-I/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/Source/DataDictionary +-I/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/Source/InformationObjectDefinition +-I/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/Source/MediaStorageAndFileFormat +-I/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/Utilities +-I/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/build/Utilities +-I/usr/include/charls -I/usr/include/openjpeg-2.4 -I/usr/include/json-c +-I/usr/include/json -O2 -Wall -D_FORTIFY_SOURCE=2 +-fstack-protector-strong -funwind-tables -fasynchronous-unwind-tables +-fstack-clash-protection -Werror=return-type -flto=auto -g -fpermissive +-O2 -g -DNDEBUG -fPIC -MD -MT +Source/MediaStorageAndFileFormat/CMakeFiles/gdcmMSFF.dir/gdcmImageChangePhotometricInterpretation.cxx.o +-MF +CMakeFiles/gdcmMSFF.dir/gdcmImageChangePhotometricInterpretation.cxx.o.d +-o +CMakeFiles/gdcmMSFF.dir/gdcmImageChangePhotometricInterpretation.cxx.o +-c +/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.cxx +[ 131s] In file included from +/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.cxx:14: +[ 131s] +/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.h: +In function 'T gdcm::Clamp(int)': +[ 131s] +/home/abuild/rpmbuild/BUILD/gdcm-3.0.8/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.h:67:32: +error: 'numeric_limits' is not a member of 'std' +[ 131s] 67 | return v < 0 ? 0 : (v > std::numeric_limits::max() +? std::numeric_limits::max() : v); +--- + Source/MediaStorageAndFileFormat/gdcmImage.cxx | 1 + + .../gdcmImageChangePhotometricInterpretation.h | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/Source/MediaStorageAndFileFormat/gdcmImage.cxx b/Source/MediaStorageAndFileFormat/gdcmImage.cxx +index f59fdd7b7..78a1f7a5c 100644 +--- a/Source/MediaStorageAndFileFormat/gdcmImage.cxx ++++ b/Source/MediaStorageAndFileFormat/gdcmImage.cxx +@@ -20,6 +20,7 @@ + #include "gdcmFragment.h" + + #include ++#include + + namespace gdcm + { +diff --git a/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.h b/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.h +index d55a5ee47..798d3dfa6 100644 +--- a/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.h ++++ b/Source/MediaStorageAndFileFormat/gdcmImageChangePhotometricInterpretation.h +@@ -16,6 +16,7 @@ + + #include "gdcmImageToImageFilter.h" + #include "gdcmPhotometricInterpretation.h" ++#include + + namespace gdcm + { diff --git a/recipes/gdcm/all/patches/0004-3.0.20-find-expat.patch b/recipes/gdcm/all/patches/0004-3.0.20-find-expat.patch new file mode 100644 index 0000000000000..8922436502476 --- /dev/null +++ b/recipes/gdcm/all/patches/0004-3.0.20-find-expat.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -419,7 +419,7 @@ endif() + + if(GDCM_USE_SYSTEM_EXPAT) + # If user say so, then this is a requirement ! +- find_package(EXPAT REQUIRED) ++ find_package(EXPAT REQUIRED MODULE) + set(GDCM_EXPAT_LIBRARIES ${EXPAT_LIBRARIES}) + else() + set(GDCM_EXPAT_LIBRARIES "gdcmexpat") diff --git a/recipes/gdcm/all/patches/0004-3.0.9-find-expat.patch b/recipes/gdcm/all/patches/0004-3.0.9-find-expat.patch new file mode 100644 index 0000000000000..174d4de82d842 --- /dev/null +++ b/recipes/gdcm/all/patches/0004-3.0.9-find-expat.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -423,7 +423,7 @@ endif() + + if(GDCM_USE_SYSTEM_EXPAT) + # If user say so, then this is a requirement ! +- find_package(EXPAT REQUIRED) ++ find_package(EXPAT REQUIRED MODULE) + set(GDCM_EXPAT_LIBRARIES ${EXPAT_LIBRARIES}) + else() + set(GDCM_EXPAT_LIBRARIES "gdcmexpat") diff --git a/recipes/gdcm/all/patches/0005-3.0.20-openssl.patch b/recipes/gdcm/all/patches/0005-3.0.20-openssl.patch new file mode 100644 index 0000000000000..f66b7d5bc18bd --- /dev/null +++ b/recipes/gdcm/all/patches/0005-3.0.20-openssl.patch @@ -0,0 +1,23 @@ +--- a/Source/Common/CMakeLists.txt ++++ b/Source/Common/CMakeLists.txt +@@ -68,18 +68,8 @@ CHECK_CXX_SOURCE_COMPILES( + "\#include \n#include \n#include \nint main() { std::u16string u16; std::string utf8 = std::wstring_convert, char16_t>{}.to_bytes(u16); }" + GDCM_HAVE_CODECVT) + if(GDCM_USE_SYSTEM_OPENSSL) +-set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +-set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES} +- ${CMAKE_DL_LIBS} # FIXME ?? +- ) +-CHECK_CXX_SOURCE_COMPILES( +- # "\#include \nint main() { CMS_add0_recipient_key(0); return 0;}" +- #HAVE_CMS_RECIPIENT_KEY) +- "\#include \nint main() { CMS_add0_recipient_password(0,0,0,0,0,0,0); return 0;}" +- GDCM_HAVE_CMS_RECIPIENT_PASSWORD) +-CHECK_CXX_SOURCE_COMPILES( +- "\#include \nint main() { const void*mem; int len; BIO_new_mem_buf(mem, len); }" +- OPENSSL_HAS_CONST_VOID_BIO_NEW_MEM_BUF) ++ set(GDCM_HAVE_CMS_RECIPIENT_PASSWORD ON CACHE INTERNAL "") ++ set(OPENSSL_HAS_CONST_VOID_BIO_NEW_MEM_BUF ON CACHE INTERNAL "") + endif() + + #----------------------------------------------------------------------------- diff --git a/recipes/gdcm/all/patches/0005-3.0.9-openssl.patch b/recipes/gdcm/all/patches/0005-3.0.9-openssl.patch new file mode 100644 index 0000000000000..fe118a13f6970 --- /dev/null +++ b/recipes/gdcm/all/patches/0005-3.0.9-openssl.patch @@ -0,0 +1,19 @@ +--- a/Source/Common/CMakeLists.txt ++++ b/Source/Common/CMakeLists.txt +@@ -65,15 +65,7 @@ CHECK_CXX_SOURCE_COMPILES( + "\#include \nint main() { const wchar_t fn[10] = {}; std::ifstream is( fn ); return 0;}" + GDCM_HAVE_WCHAR_IFSTREAM) + if(GDCM_USE_SYSTEM_OPENSSL) +-set(CMAKE_REQUIRED_INCLUDES ${OPENSSL_INCLUDE_DIR}) +-set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES} +- ${CMAKE_DL_LIBS} # FIXME ?? +- ) +-CHECK_CXX_SOURCE_COMPILES( +- # "\#include \nint main() { CMS_add0_recipient_key(0); return 0;}" +- #HAVE_CMS_RECIPIENT_KEY) +- "\#include \nint main() { CMS_add0_recipient_password(0,0,0,0,0,0,0); return 0;}" +- GDCM_HAVE_CMS_RECIPIENT_PASSWORD) ++ set(GDCM_HAVE_CMS_RECIPIENT_PASSWORD ON CACHE INTERNAL "") + endif() + + #----------------------------------------------------------------------------- diff --git a/recipes/gdcm/all/patches/0006-json.patch b/recipes/gdcm/all/patches/0006-json.patch new file mode 100644 index 0000000000000..5010643b169c4 --- /dev/null +++ b/recipes/gdcm/all/patches/0006-json.patch @@ -0,0 +1,13 @@ +--- a/Source/Common/CMakeLists.txt ++++ b/Source/Common/CMakeLists.txt +@@ -52,9 +52,7 @@ unset(CMAKE_REQUIRED_LIBRARIES) + CHECK_FUNCTION_EXISTS(gettimeofday GDCM_HAVE_GETTIMEOFDAY) + # json-c API changed: + if(GDCM_USE_SYSTEM_JSON) +- set(CMAKE_REQUIRED_INCLUDES ${JSON_INCLUDE_DIRS}) +- set(CMAKE_REQUIRED_LIBRARIES ${JSON_LIBRARIES}) +- CHECK_SYMBOL_EXISTS(json_object_object_get_ex "json.h" GDCM_HAVE_JSON_OBJECT_OBJECT_GET_EX) ++ set(GDCM_HAVE_JSON_OBJECT_OBJECT_GET_EX ON CACHE INTERNAL "") + endif() + + include(CheckCXXSourceCompiles) diff --git a/recipes/gdcm/all/patches/0007-3.0.20-find-json.patch b/recipes/gdcm/all/patches/0007-3.0.20-find-json.patch new file mode 100644 index 0000000000000..5790521e58be6 --- /dev/null +++ b/recipes/gdcm/all/patches/0007-3.0.20-find-json.patch @@ -0,0 +1,45 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -426,7 +426,7 @@ else() + endif() + + if(GDCM_USE_SYSTEM_JSON) +- find_package(JSON REQUIRED) ++ find_package(json-c REQUIRED CONFIG) + endif() + if(GDCM_USE_SYSTEM_PAPYRUS3) + find_package(PAPYRUS3 REQUIRED) +--- a/Source/MediaStorageAndFileFormat/CMakeLists.txt ++++ b/Source/MediaStorageAndFileFormat/CMakeLists.txt +@@ -187,11 +187,6 @@ else() + ) + set(GDCMUUID gdcmuuid) + endif() +-if(GDCM_USE_SYSTEM_JSON) +- include_directories( +- ${JSON_INCLUDE_DIRS} +- ) +-endif() + + add_library(gdcmMSFF ${MSFF_SRCS}) + # gdcmPVRGCodec calls gdcmjpeg +@@ -226,7 +221,7 @@ else() + target_link_libraries(gdcmMSFF LINK_PRIVATE ${GDCMUUID}) + endif() + if(GDCM_USE_SYSTEM_JSON) +- target_link_libraries(gdcmMSFF LINK_PRIVATE ${JSON_LIBRARIES}) ++ target_link_libraries(gdcmMSFF PRIVATE json-c::json-c) + endif() + if(UNIX) + find_package(Iconv) +--- a/Source/MediaStorageAndFileFormat/gdcmJSON.cxx ++++ b/Source/MediaStorageAndFileFormat/gdcmJSON.cxx +@@ -18,7 +18,7 @@ + #include "gdcmSystem.h" + + #ifdef GDCM_USE_SYSTEM_JSON +-#include ++#include + #endif + + #ifdef GDCM_HAVE_JSON_OBJECT_OBJECT_GET_EX diff --git a/recipes/gdcm/all/patches/0007-3.0.9-find-json.patch b/recipes/gdcm/all/patches/0007-3.0.9-find-json.patch new file mode 100644 index 0000000000000..1c072edc979dd --- /dev/null +++ b/recipes/gdcm/all/patches/0007-3.0.9-find-json.patch @@ -0,0 +1,45 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -430,7 +430,7 @@ else() + endif() + + if(GDCM_USE_SYSTEM_JSON) +- find_package(JSON REQUIRED) ++ find_package(json-c REQUIRED CONFIG) + endif() + if(GDCM_USE_SYSTEM_PAPYRUS3) + find_package(PAPYRUS3 REQUIRED) +--- a/Source/MediaStorageAndFileFormat/CMakeLists.txt ++++ b/Source/MediaStorageAndFileFormat/CMakeLists.txt +@@ -175,11 +175,6 @@ else() + ) + set(GDCMUUID gdcmuuid) + endif() +-if(GDCM_USE_SYSTEM_JSON) +- include_directories( +- ${JSON_INCLUDE_DIRS} +- ) +-endif() + + add_library(gdcmMSFF ${MSFF_SRCS}) + # gdcmPVRGCodec calls gdcmjpeg +@@ -214,7 +209,7 @@ else() + target_link_libraries(gdcmMSFF LINK_PRIVATE ${GDCMUUID}) + endif() + if(GDCM_USE_SYSTEM_JSON) +- target_link_libraries(gdcmMSFF LINK_PRIVATE ${JSON_LIBRARIES}) ++ target_link_libraries(gdcmMSFF PRIVATE json-c::json-c) + endif() + # handling of static lib within shared is a mess: + #target_link_libraries(gdcmMSFF gdcmrle) +--- a/Source/MediaStorageAndFileFormat/gdcmJSON.cxx ++++ b/Source/MediaStorageAndFileFormat/gdcmJSON.cxx +@@ -18,7 +18,7 @@ + #include "gdcmSystem.h" + + #ifdef GDCM_USE_SYSTEM_JSON +-#include ++#include + #endif + + #ifdef GDCM_HAVE_JSON_OBJECT_OBJECT_GET_EX diff --git a/recipes/gdcm/all/patches/0008-3.0.20-find-libuuid.patch b/recipes/gdcm/all/patches/0008-3.0.20-find-libuuid.patch new file mode 100644 index 0000000000000..72cf47eea31a2 --- /dev/null +++ b/recipes/gdcm/all/patches/0008-3.0.20-find-libuuid.patch @@ -0,0 +1,40 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -411,7 +411,7 @@ endif() + + if(GDCM_USE_SYSTEM_UUID) + # If user say so, then this is a requirement ! +- find_package(UUID REQUIRED) ++ find_package(libuuid REQUIRED) + set(GDCM_UUID_LIBRARIES ${UUID_LIBRARIES}) + else() + set(GDCM_UUID_LIBRARIES "gdcmuuid") +--- a/Source/MediaStorageAndFileFormat/CMakeLists.txt ++++ b/Source/MediaStorageAndFileFormat/CMakeLists.txt +@@ -176,17 +176,6 @@ if(NOT GDCM_USE_SYSTEM_ZLIB) + "${GDCM_BINARY_DIR}/Utilities/gdcmzlib" + ) + endif() +-if(GDCM_USE_SYSTEM_UUID) +- include_directories( +- ${UUID_INCLUDE_DIR} +- ) +- set(GDCMUUID ${UUID_LIBRARIES}) +-else() +- include_directories( +- "${GDCM_BINARY_DIR}/Utilities/gdcmuuid" # uuid_mangle.h +- ) +- set(GDCMUUID gdcmuuid) +-endif() + + add_library(gdcmMSFF ${MSFF_SRCS}) + # gdcmPVRGCodec calls gdcmjpeg +@@ -218,7 +207,7 @@ if(WIN32) + target_link_libraries(gdcmMSFF LINK_PRIVATE rpcrt4) + #endif() + else() +- target_link_libraries(gdcmMSFF LINK_PRIVATE ${GDCMUUID}) ++ target_link_libraries(gdcmMSFF LINK_PRIVATE libuuid::libuuid) + endif() + if(GDCM_USE_SYSTEM_JSON) + target_link_libraries(gdcmMSFF PRIVATE json-c::json-c) diff --git a/recipes/gdcm/all/patches/0008-3.0.9-find-libuuid.patch b/recipes/gdcm/all/patches/0008-3.0.9-find-libuuid.patch new file mode 100644 index 0000000000000..e455940c59566 --- /dev/null +++ b/recipes/gdcm/all/patches/0008-3.0.9-find-libuuid.patch @@ -0,0 +1,40 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -415,7 +415,7 @@ endif() + + if(GDCM_USE_SYSTEM_UUID) + # If user say so, then this is a requirement ! +- find_package(UUID REQUIRED) ++ find_package(libuuid REQUIRED) + set(GDCM_UUID_LIBRARIES ${UUID_LIBRARIES}) + else() + set(GDCM_UUID_LIBRARIES "gdcmuuid") +--- a/Source/MediaStorageAndFileFormat/CMakeLists.txt ++++ b/Source/MediaStorageAndFileFormat/CMakeLists.txt +@@ -164,17 +164,6 @@ if(NOT GDCM_USE_SYSTEM_ZLIB) + "${GDCM_BINARY_DIR}/Utilities/gdcmzlib" + ) + endif() +-if(GDCM_USE_SYSTEM_UUID) +- include_directories( +- ${UUID_INCLUDE_DIR} +- ) +- set(GDCMUUID ${UUID_LIBRARIES}) +-else() +- include_directories( +- "${GDCM_BINARY_DIR}/Utilities/gdcmuuid" # uuid_mangle.h +- ) +- set(GDCMUUID gdcmuuid) +-endif() + + add_library(gdcmMSFF ${MSFF_SRCS}) + # gdcmPVRGCodec calls gdcmjpeg +@@ -206,7 +195,7 @@ if(WIN32) + target_link_libraries(gdcmMSFF LINK_PRIVATE rpcrt4) + #endif() + else() +- target_link_libraries(gdcmMSFF LINK_PRIVATE ${GDCMUUID}) ++ target_link_libraries(gdcmMSFF LINK_PRIVATE libuuid::libuuid) + endif() + if(GDCM_USE_SYSTEM_JSON) + target_link_libraries(gdcmMSFF PRIVATE json-c::json-c) diff --git a/recipes/gdcm/all/test_package/CMakeLists.txt b/recipes/gdcm/all/test_package/CMakeLists.txt index 10a69d9c406b3..5465ea8e54b6d 100644 --- a/recipes/gdcm/all/test_package/CMakeLists.txt +++ b/recipes/gdcm/all/test_package/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package CXX) find_package(GDCM REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) include(${GDCM_USE_FILE}) -target_link_libraries(${PROJECT_NAME} gdcmMSFF) +target_link_libraries(${PROJECT_NAME} PRIVATE gdcmMSFF) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/gdcm/all/test_package/conanfile.py b/recipes/gdcm/all/test_package/conanfile.py index 76c08c761eb2b..1f94130dd62ec 100644 --- a/recipes/gdcm/all/test_package/conanfile.py +++ b/recipes/gdcm/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.files import mkdir import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,10 +21,10 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") input_file = os.path.join(self.source_folder, "DCMTK_JPEGExt_12Bits.dcm") test_dir = "test_dir" - tools.mkdir(test_dir) + mkdir(self, test_dir) output_file = os.path.join(test_dir, "output.dcm") - self.run([bin_path, input_file, output_file], run_environment=True) + self.run(f"\"{bin_path}\" \"{input_file}\" \"{output_file}\"", env="conanrun") diff --git a/recipes/gdcm/all/test_package/test_package.cpp b/recipes/gdcm/all/test_package/test_package.cpp index bce75e82a246e..38a0b1316570a 100644 --- a/recipes/gdcm/all/test_package/test_package.cpp +++ b/recipes/gdcm/all/test_package/test_package.cpp @@ -16,11 +16,37 @@ */ #include "gdcmReader.h" +#include "gdcmUIDGenerator.h" #include "gdcmWriter.h" #include "gdcmAttribute.h" #include +#ifdef GDCM_USE_SYSTEM_OPENSSL +#include "gdcmCryptoFactory.h" +void test_openssl_link() +{ + (void)gdcm::CryptoFactory::GetFactoryInstance(gdcm::CryptoFactory::OPENSSL); +} +#endif + +#ifdef GDCM_USE_SYSTEM_JSON +#include "gdcmJSON.h" +void test_json_link() +{ + gdcm::JSON json; + json.PrettyPrintOn(); +} +#endif + +bool test_uid() +{ + gdcm::UIDGenerator uid; + uid.SetRoot( "1.2.3.4.0.0.1" ); + const char *s = uid.Generate(); + return gdcm::UIDGenerator::IsValid(s); +} + int main(int argc, char* argv[]) { if (argc < 3) @@ -68,7 +94,7 @@ int main(int argc, char* argv[]) std::cerr << "Could not write: " << outfilename << std::endl; return 1; } - + std::cout << "GDCM test: success\n"; return 0; } diff --git a/recipes/gdcm/all/test_v1_package/CMakeLists.txt b/recipes/gdcm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/gdcm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gdcm/all/test_v1_package/conanfile.py b/recipes/gdcm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a38d3dbb55dca --- /dev/null +++ b/recipes/gdcm/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +from conan.tools.files import mkdir +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + input_file = os.path.join(self.source_folder, os.pardir, "test_package", "DCMTK_JPEGExt_12Bits.dcm") + test_dir = "test_dir" + mkdir(self, test_dir) + output_file = os.path.join(test_dir, "output.dcm") + self.run([bin_path, input_file, output_file], run_environment=True) diff --git a/recipes/gdcm/config.yml b/recipes/gdcm/config.yml index 638e4d986a94c..f1b37cf5e936f 100644 --- a/recipes/gdcm/config.yml +++ b/recipes/gdcm/config.yml @@ -1,3 +1,5 @@ versions: + "3.0.20": + folder: "all" "3.0.9": folder: "all" diff --git a/recipes/gdk-pixbuf/all/conandata.yml b/recipes/gdk-pixbuf/all/conandata.yml index 6f9d2bf4d0568..20b0c843bbfec 100644 --- a/recipes/gdk-pixbuf/all/conandata.yml +++ b/recipes/gdk-pixbuf/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.42.10": + url: "https://download.gnome.org/sources/gdk-pixbuf/2.42/gdk-pixbuf-2.42.10.tar.xz" + sha256: "ee9b6c75d13ba096907a2e3c6b27b61bcd17f5c7ebeab5a5b439d2f2e39fe44b" "2.42.9": url: "https://download.gnome.org/sources/gdk-pixbuf/2.42/gdk-pixbuf-2.42.9.tar.xz" sha256: "28f7958e7bf29a32d4e963556d241d0a41a6786582ff6a5ad11665e0347fc962" @@ -12,4 +15,6 @@ sources: patches: "2.42.8": - patch_file: "patches/define_dllmain_only_when_shared.patch" - base_path: "source_subfolder" + patch_type: backport + patch_description: Disable relocation when built as a static libary on Windows + patch_source: "https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/merge_requests/136" diff --git a/recipes/gdk-pixbuf/all/conanfile.py b/recipes/gdk-pixbuf/all/conanfile.py index 86b05696bec82..c7ef320ce9ef9 100644 --- a/recipes/gdk-pixbuf/all/conanfile.py +++ b/recipes/gdk-pixbuf/all/conanfile.py @@ -1,13 +1,25 @@ from conan import ConanFile -from conan.tools import files, scm, microsoft -from conan.errors import ConanInvalidConfiguration, ConanException -from conans import CMake, Meson, tools -from tempfile import TemporaryDirectory -import functools +from conan.tools.meson import MesonToolchain, Meson +from conan.tools.gnu import PkgConfigDeps +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, + copy, + export_conandata_patches, + get, + rename, + replace_in_file, + rm, + rmdir +) +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + import os -import shutil -required_conan_version = ">=1.50.2" +required_conan_version = ">=1.53.0" class GdkPixbufConan(ConanFile): @@ -35,166 +47,145 @@ class GdkPixbufConan(ConanFile): "with_libjpeg": "libjpeg", "with_introspection": False, } - - generators = "pkg_config" - exports_sources = "patches/**" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + short_paths = True def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") if self.options.shared: self.options["glib"].shared = True - def requirements(self): - self.requires("glib/2.73.0") - if self.options.with_libpng: - self.requires("libpng/1.6.37") - if self.options.with_libtiff: - self.requires("libtiff/4.3.0") - if self.options.with_libjpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.2") - elif self.options.with_libjpeg == "libjpeg": - self.requires("libjpeg/9d") + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.options.shared and not self.options["glib"].shared: + if self.info.options.shared and not self.dependencies["glib"].options.shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." ) - if self.settings.os == "Macos": + if self.info.settings.os == "Macos": # when running gdk-pixbuf-query-loaders # dyld: malformed mach-o: load commands size (97560) > 32768 raise ConanInvalidConfiguration("This package does not support Macos currently") + if self.dependencies["glib"].options.shared and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration( + "Linking shared glib with the MSVC static runtime is not supported" + ) + + @property + def _requires_compiler_rt(self): + return self.settings.compiler == "clang" and Version(self.settings.compiler.version) <= "12" and self.settings.build_type == "Debug" + + def generate(self): + def is_enabled(value): + return "enabled" if value else "disabled" + + def is_true(value): + return "true" if value else "false" + + deps = PkgConfigDeps(self) + deps.generate() + + tc = MesonToolchain(self) + tc.project_options.update({ + "builtin_loaders": "all", + "gio_sniffing": "false", + "introspection": is_enabled(self.options.with_introspection), + "docs": "false", + "man": "false", + "installed_tests": "false" + }) + if Version(self.version) < "2.42.0": + tc.project_options["gir"] = "false" + + if Version(self.version) >= "2.42.8": + tc.project_options.update({ + "png": is_enabled(self.options.with_libpng), + "tiff": is_enabled(self.options.with_libtiff), + "jpeg": is_enabled(self.options.with_libjpeg) + }) + else: + tc.project_options.update({ + "png": is_true(self.options.with_libpng), + "tiff": is_true(self.options.with_libtiff), + "jpeg": is_true(self.options.with_libjpeg) + }) + + # Workaround for https://bugs.llvm.org/show_bug.cgi?id=16404 + # Only really for the purposes of building on CCI - end users can + # workaround this by appropriately setting global linker flags in their profile + if self._requires_compiler_rt: + tc.c_link_args.append("-rtlib=compiler-rt") + tc.generate() + + venv = VirtualBuildEnv(self) + venv.generate() + + def requirements(self): + self.requires("glib/2.75.0") + if self.options.with_libpng: + self.requires("libpng/1.6.39") + if self.options.with_libtiff: + self.requires("libtiff/4.4.0") + if self.options.with_libjpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_libjpeg == "libjpeg": + self.requires("libjpeg/9e") def build_requirements(self): - self.build_requires("meson/0.61.2") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("meson/0.64.1") + self.tool_requires("pkgconf/1.9.3") if self.options.with_introspection: - self.build_requires("gobject-introspection/1.70.0") + self.tool_requires("gobject-introspection/1.72.0") + + def export_sources(self): + export_conandata_patches(self) def source(self): - files.get(self, **self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def _patch_sources(self): - files.apply_conandata_patches(self) + apply_conandata_patches(self) - meson_build = os.path.join(self._source_subfolder, "meson.build") - files.replace_in_file(self, meson_build, "subdir('tests')", "#subdir('tests')") - files.replace_in_file(self, meson_build, "subdir('thumbnailer')", "#subdir('thumbnailer')") - files.replace_in_file(self, meson_build, - "gmodule_dep.get_variable(pkgconfig: 'gmodule_supported')" if scm.Version(self.version) >= "2.42.6" + meson_build = os.path.join(self.source_folder, "meson.build") + replace_in_file(self, meson_build, "subdir('tests')", "#subdir('tests')") + replace_in_file(self, meson_build, "subdir('thumbnailer')", "#subdir('thumbnailer')") + replace_in_file(self, meson_build, + "gmodule_dep.get_variable(pkgconfig: 'gmodule_supported')" if Version(self.version) >= "2.42.6" else "gmodule_dep.get_pkgconfig_variable('gmodule_supported')", "'true'") # workaround https://gitlab.gnome.org/GNOME/gdk-pixbuf/-/issues/203 - if scm.Version(self.version) >= "2.42.6": - files.replace_in_file(self, os.path.join(self._source_subfolder, "build-aux", "post-install.py"), + if Version(self.version) >= "2.42.6": + replace_in_file(self, os.path.join(self.source_folder, "build-aux", "post-install.py"), "close_fds=True", "close_fds=(sys.platform != 'win32')") - if scm.Version(self.version) >= "2.42.9": - files.replace_in_file(self, meson_build, "is_msvc_like ? 'png' : 'libpng'", "'libpng'") - files.replace_in_file(self, meson_build, "is_msvc_like ? 'jpeg' : 'libjpeg'", "'libjpeg'") - files.replace_in_file(self, meson_build, "is_msvc_like ? 'tiff' : 'libtiff-4'", "'libtiff-4'") - - @property - def _requires_compiler_rt(self): - return self.settings.compiler == "clang" and self.settings.build_type == "Debug" - - def _test_for_compiler_rt(self): - cmake = CMake(self) - with TemporaryDirectory() as tmp: - def open_temp_file(file_name): - return open(os.path.join(tmp, file_name), "w", encoding="utf-8") - - with open_temp_file("CMakeLists.txt") as cmake_file: - cmake_file.write(r""" - cmake_minimum_required(VERSION 3.16) - project(compiler_rt_test) - try_compile(HAS_COMPILER_RT ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/test.c OUTPUT_VARIABLE OUTPUT) - if(NOT HAS_COMPILER_RT) - message(FATAL_ERROR compiler-rt not present) - endif()""") - with open_temp_file("test.c") as test_source: - test_source.write(r""" - extern __int128_t __muloti4(__int128_t a, __int128_t b, int* overflow); - int main() { - __int128_t a; - __int128_t b; - int overflow; - __muloti4(a, b, &overflow); - return 0; - }""") - cmake.definitions["CMAKE_EXE_LINKER_FLAGS"] = "-rtlib=compiler-rt" - try: - cmake.configure(source_folder=tmp) - except ConanException as ex: - raise ConanInvalidConfiguration("LLVM Compiler RT is required to link gdk-pixbuf in debug mode") from ex - - @functools.lru_cache(1) - def _configure_meson(self): - meson = Meson(self) - defs = {} - if scm.Version(self.version) >= "2.42.0": - defs["introspection"] = "false" - else: - defs["gir"] = "false" - defs["docs"] = "false" - defs["man"] = "false" - defs["installed_tests"] = "false" - if scm.Version(self.version) >= "2.42.8": - defs["png"] = "enabled" if self.options.with_libpng else "disabled" - defs["tiff"] = "enabled" if self.options.with_libtiff else "disabled" - defs["jpeg"] = "enabled" if self.options.with_libjpeg else "disabled" - else: - defs["png"] = "true" if self.options.with_libpng else "false" - defs["tiff"] = "true" if self.options.with_libtiff else "false" - defs["jpeg"] = "true" if self.options.with_libjpeg else "false" - - defs["builtin_loaders"] = "all" - defs["gio_sniffing"] = "false" - defs["introspection"] = "enabled" if self.options.with_introspection else "disabled" - args = [] - # Workaround for https://bugs.llvm.org/show_bug.cgi?id=16404 - # Ony really for the purporses of building on CCI - end users can - # workaround this by appropriately setting global linker flags in their profile - if self._requires_compiler_rt: - args.append('-Dc_link_args="-rtlib=compiler-rt"') - args.append("--wrap-mode=nofallback") - meson.configure(defs=defs, build_folder=self._build_subfolder, source_folder=self._source_subfolder, pkg_config_paths=".", args=args) - return meson + if Version(self.version) >= "2.42.9": + replace_in_file(self, meson_build, "is_msvc_like ? 'png' : 'libpng'", "'libpng'") + replace_in_file(self, meson_build, "is_msvc_like ? 'jpeg' : 'libjpeg'", "'libjpeg'") + replace_in_file(self, meson_build, "is_msvc_like ? 'tiff' : 'libtiff-4'", "'libtiff-4'") def build(self): - if self._requires_compiler_rt: - self._test_for_compiler_rt() - self._patch_sources() - if self.options.with_libpng: - shutil.copy("libpng.pc", "libpng16.pc") - meson = self._configure_meson() + meson = Meson(self) + meson.configure() meson.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - with tools.environment_append({"LD_LIBRARY_PATH": os.path.join(self.package_folder, "lib")}): - meson = self._configure_meson() - meson.install() - if microsoft.is_msvc(self) and not self.options.shared: - files.rename(self, os.path.join(self.package_folder, "lib", "libgdk_pixbuf-2.0.a"), os.path.join(self.package_folder, "lib", "gdk_pixbuf-2.0.lib")) - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) - files.rmdir(self, os.path.join(self.package_folder, "share")) - files.rm(self, "*.pdb", self.package_folder, recursive=True) + meson = Meson(self) + meson.install() + + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + if is_msvc(self) and not self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "libgdk_pixbuf-2.0.a"), os.path.join(self.package_folder, "lib", "gdk_pixbuf-2.0.lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.pdb", self.package_folder, recursive=True) + + def package_info(self): self.cpp_info.set_property("pkg_config_name", "gdk-pixbuf-2.0") @@ -209,6 +200,20 @@ def package_info(self): self.cpp_info.exelinkflags = ldflags self.cpp_info.sharedlinkflags = ldflags + pkgconfig_variables = { + "bindir": "${prefix}/bin", + "gdk_pixbuf_binary_version": "2.10.0", + "gdk_pixbuf_binarydir": "${libdir1}/gdk-pixbuf-2.0/2.10", + "gdk_pixbuf_moduledir": "${gdk_pixbuf_binarydir}/loaders", + "gdk_pixbuf_cache_file": "${gdk_pixbuf_binarydir}/loaders.cache", + "gdk_pixbuf_csource": "${bindir}/gdk-pixbuf-csource", + "gdk_pixbuf_pixdata": "${bindir}/gdk-pixbuf-pixdata", + "gdk_pixbuf_query_loaders": "${bindir}/gdk-pixbuf-query-loaders" + } + self.cpp_info.set_property( + "pkg_config_custom_content", + "\n".join(f"{key}={value}" for key, value in pkgconfig_variables.items())) + gdk_pixbuf_pixdata = os.path.join(self.package_folder, "bin", "gdk-pixbuf-pixdata") self.runenv_info.define_path("GDK_PIXBUF_PIXDATA", gdk_pixbuf_pixdata) self.env_info.GDK_PIXBUF_PIXDATA = gdk_pixbuf_pixdata # remove in conan v2? @@ -217,4 +222,5 @@ def package_info(self): self.cpp_info.names["pkg_config"] = "gdk-pixbuf-2.0" def package_id(self): - self.info.requires["glib"].full_package_mode() + if not self.options["glib"].shared: + self.info.requires["glib"].full_package_mode() diff --git a/recipes/gdk-pixbuf/all/test_package/CMakeLists.txt b/recipes/gdk-pixbuf/all/test_package/CMakeLists.txt index faddb9cd23ec7..f31a35477a32f 100644 --- a/recipes/gdk-pixbuf/all/test_package/CMakeLists.txt +++ b/recipes/gdk-pixbuf/all/test_package/CMakeLists.txt @@ -1,8 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) find_package(gdk-pixbuf REQUIRED CONFIG) diff --git a/recipes/gdk-pixbuf/all/test_package/conanfile.py b/recipes/gdk-pixbuf/all/test_package/conanfile.py index 42f6f019466b0..f04bef385c6cc 100644 --- a/recipes/gdk-pixbuf/all/test_package/conanfile.py +++ b/recipes/gdk-pixbuf/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools import build import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run("gdk-pixbuf-pixdata -v", run_environment=True) - self.run(bin_path, run_environment=True) + if not build.can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + self.run("gdk-pixbuf-pixdata -v", env="conanrun") diff --git a/recipes/gdk-pixbuf/all/test_v1_package/CMakeLists.txt b/recipes/gdk-pixbuf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..cb19ae21c7964 --- /dev/null +++ b/recipes/gdk-pixbuf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(gdk-pixbuf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} gdk-pixbuf::gdk-pixbuf) diff --git a/recipes/gdk-pixbuf/all/test_v1_package/conanfile.py b/recipes/gdk-pixbuf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..42f6f019466b0 --- /dev/null +++ b/recipes/gdk-pixbuf/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run("gdk-pixbuf-pixdata -v", run_environment=True) + self.run(bin_path, run_environment=True) diff --git a/recipes/gdk-pixbuf/config.yml b/recipes/gdk-pixbuf/config.yml index fd82dce2fff7b..5fd1bb955b361 100644 --- a/recipes/gdk-pixbuf/config.yml +++ b/recipes/gdk-pixbuf/config.yml @@ -1,4 +1,6 @@ versions: + "2.42.10": + folder: all "2.42.9": folder: all "2.42.8": diff --git a/recipes/gemmlowp/all/CMakeLists.txt b/recipes/gemmlowp/all/CMakeLists.txt deleted file mode 100644 index b8272b9837356..0000000000000 --- a/recipes/gemmlowp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory("source_subfolder/contrib") diff --git a/recipes/gemmlowp/all/conandata.yml b/recipes/gemmlowp/all/conandata.yml index 2c4031a28ae9f..5f6290c4c906d 100644 --- a/recipes/gemmlowp/all/conandata.yml +++ b/recipes/gemmlowp/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "cci.20210928": - patch_file: "patches/build-static-libraries.patch" - base_path: "source_subfolder" diff --git a/recipes/gemmlowp/all/conanfile.py b/recipes/gemmlowp/all/conanfile.py index 33bb3d1a0e29a..14a41c63d1d09 100644 --- a/recipes/gemmlowp/all/conanfile.py +++ b/recipes/gemmlowp/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" class GemmlowpConan(ConanFile): @@ -22,25 +26,9 @@ class GemmlowpConan(ConanFile): "fPIC": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -50,33 +38,33 @@ def configure(self): if self.options.shared: del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") + def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, {}): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "contrib")) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "gemmlowp") @@ -85,7 +73,7 @@ def package_info(self): self.cpp_info.components["eight_bit_int_gemm"].set_property("cmake_target_name", "gemmlowp::eight_bit_int_gemm") self.cpp_info.components["eight_bit_int_gemm"].includedirs.append(os.path.join("include", "gemmlowp")) self.cpp_info.components["eight_bit_int_gemm"].libs = ["eight_bit_int_gemm"] - if self._is_msvc: + if is_msvc(self): self.cpp_info.components["eight_bit_int_gemm"].defines = ["NOMINMAX"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["eight_bit_int_gemm"].system_libs.extend(["pthread"]) diff --git a/recipes/gemmlowp/all/test_package/CMakeLists.txt b/recipes/gemmlowp/all/test_package/CMakeLists.txt index 9a7186a46dc81..f1605354570fc 100644 --- a/recipes/gemmlowp/all/test_package/CMakeLists.txt +++ b/recipes/gemmlowp/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(gemmlowp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} gemmlowp::gemmlowp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE gemmlowp::gemmlowp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/gemmlowp/all/test_package/conanfile.py b/recipes/gemmlowp/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/gemmlowp/all/test_package/conanfile.py +++ b/recipes/gemmlowp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gemmlowp/all/test_v1_package/CMakeLists.txt b/recipes/gemmlowp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..d3568415c41be --- /dev/null +++ b/recipes/gemmlowp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(gemmlowp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gemmlowp::gemmlowp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/gemmlowp/all/test_v1_package/conanfile.py b/recipes/gemmlowp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/gemmlowp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/genie/all/conandata.yml b/recipes/genie/all/conandata.yml index 4b11320b35cb5..1b0883fe01d12 100644 --- a/recipes/genie/all/conandata.yml +++ b/recipes/genie/all/conandata.yml @@ -8,3 +8,6 @@ sources: "1160": url: "https://github.com/bkaradzic/GENie/archive/f9bd455a8439dbcb807816c0be9e4aedf5991bc3.zip" sha256: "6fe7e2f0107c965ebe9d099b0168128dfcaee67d7368d4b15b42d80808e3d373" + "1170": + url: "https://github.com/bkaradzic/GENie/archive/22cc907a4351db46c55f73e6aa901f1b2f0c52ad.zip" + sha256: "C7691E50F8FB6F2346D0D3CEED14A26F9DE7AEE658CE30B61770F8BE87C1FE00" diff --git a/recipes/genie/all/conanfile.py b/recipes/genie/all/conanfile.py index e77b5e93152f3..d29587bee35bc 100644 --- a/recipes/genie/all/conanfile.py +++ b/recipes/genie/all/conanfile.py @@ -1,10 +1,15 @@ +from conan import ConanFile +from conan.tools.files import get, replace_in_file, copy +from conan.tools.build import cross_building +from conan.tools.layout import basic_layout +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +from conan.tools.microsoft import VCVars, is_msvc +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.apple import is_apple_os import os -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration - - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.51.3" class GenieConan(ConanFile): name = "genie" @@ -15,35 +20,35 @@ class GenieConan(ConanFile): topics = ("genie", "project", "generator", "build", "build-systems") settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): + # TODO: Remove for Conan v2 return getattr(self, "settings_build", self.settings) - def build_requirements(self): - if self.settings.compiler == "Visual Studio": - self.build_requires("cccl/1.1") + def layout(self): + basic_layout(self, src_folder="src") - if self.settings.os == "Windows" and self._settings_build.os == "Windows": - if "make" not in os.environ.get("CONAN_MAKE_PROGRAM", ""): - self.build_requires("make/4.3") + def package_id(self): + del self.info.settings.compiler - if not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self): + if hasattr(self, "settings_build") and cross_building(self): raise ConanInvalidConfiguration("Cross building is not yet supported. Contributions are welcome") + def build_requirements(self): + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("cccl/1.3") + def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @property def _os(self): - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): return "darwin" return { "Windows": "windows", @@ -52,23 +57,31 @@ def _os(self): }[str(self.settings.os)] def _patch_compiler(self, cc, cxx): - tools.replace_in_file(os.path.join(self._source_subfolder, "build", "gmake.{}".format(self._os), "genie.make"), "CC = gcc", "CC = {}".format(cc)) - tools.replace_in_file(os.path.join(self._source_subfolder, "build", "gmake.{}".format(self._os), "genie.make"), "CXX = g++", "CXX = {}".format(cxx)) + replace_in_file(self, os.path.join(self.source_folder, "build", f"gmake.{self._os}", "genie.make"), "CC = gcc", f"CC = {cc}") + replace_in_file(self, os.path.join(self.source_folder, "build", f"gmake.{self._os}", "genie.make"), "CXX = g++", f"CXX = {cxx}") @property def _genie_config(self): return "debug" if self.settings.build_type == "Debug" else "release" + def generate(self): + vbe = VirtualBuildEnv(self) + vbe.generate() + if is_msvc(self): + ms = VCVars(self) + ms.generate() + else: + tc = AutotoolsToolchain(self) + tc.generate() + def build(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self._patch_compiler("cccl", "cccl") - with tools.vcvars(self.settings): - with tools.chdir(self._source_subfolder): - self.run("make", win_bash=tools.os_info.is_windows) + self.run("make", cwd=self.source_folder) else: - cc = tools.get_env("CC") - cxx = tools.get_env("CXX") - if tools.is_apple_os(self.settings.os): + cc = os.environ.get("CC") + cxx = os.environ.get("CXX") + if is_apple_os(self): if not cc: cc = "clang" if not cxx: @@ -80,26 +93,26 @@ def build(self): cxx = "clang++" if self.settings.compiler == "clang" else "g++" self._patch_compiler(cc, cxx) - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with tools.chdir(self._source_subfolder): - autotools.make(args=["OS={}".format(self._os), "config={}".format(self._genie_config)]) + autotools = Autotools(self) + autotools.make(args=[f"-C {self.source_folder}", f"OS={self._os}", f"config={self._genie_config}"]) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) bin_ext = ".exe" if self.settings.os == "Windows" else "" - self.copy("genie{}".format(bin_ext), dst="bin", src=os.path.join(self._source_subfolder, "bin", self._os)) + copy(self, pattern=f"genie{bin_ext}", src=os.path.join(self.source_folder, "bin", self._os), dst=os.path.join(self.package_folder, "bin")) if self.settings.build_type == "Debug": - self.copy("*.lua", dst="res", src=os.path.join(self._source_subfolder, "src")) - - def package_id(self): - del self.info.settings.compiler + copy(self, pattern="*.lua", src=os.path.join(self.source_folder, "src"), dst=os.path.join(self.package_folder,"res")) def package_info(self): + self.cpp_info.libdirs = [] + self.cpp_info.includedirs = [] + + #TODO remove for conan v2 bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.output.info(f"Appending PATH environment variable: {bindir}") self.env_info.PATH.append(bindir) if self.settings.build_type == "Debug": resdir = os.path.join(self.package_folder, "res") - self.output.info("Appending PREMAKE_PATH environment variable: {}".format(resdir)) + self.output.info(f"Appending PREMAKE_PATH environment variable: {resdir}") self.env_info.PREMAKE_PATH.append(resdir) diff --git a/recipes/genie/all/test_package/conanfile.py b/recipes/genie/all/test_package/conanfile.py index c42e447e51741..aeafeb9ac53d2 100644 --- a/recipes/genie/all/test_package/conanfile.py +++ b/recipes/genie/all/test_package/conanfile.py @@ -1,10 +1,16 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run +required_conan_version = ">=1.49.0" class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "VirtualBuildEnv" + test_type = "explicit" - settings = "os", "arch" + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self.settings): - self.run('genie ninja --scripts="{}"'.format(self.source_folder), run_environment=True) + if can_run(self): + self.run("genie ninja") diff --git a/recipes/genie/all/test_v1_package/conanfile.py b/recipes/genie/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..00bbdee2789b3 --- /dev/null +++ b/recipes/genie/all/test_v1_package/conanfile.py @@ -0,0 +1,11 @@ +from conans import ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not tools.cross_building(self): + self.run("genie ninja", run_environment=True, cwd=os.path.join(self.source_folder, "..", "test_package")) diff --git a/recipes/genie/config.yml b/recipes/genie/config.yml index a369afc26c54f..f8c262eda3d07 100644 --- a/recipes/genie/config.yml +++ b/recipes/genie/config.yml @@ -5,3 +5,5 @@ versions: folder: "all" "1160": folder: "all" + "1170": + folder: "all" diff --git a/recipes/geographiclib/all/conandata.yml b/recipes/geographiclib/all/conandata.yml index c7a7d43bcf927..d77a331b2e16a 100644 --- a/recipes/geographiclib/all/conandata.yml +++ b/recipes/geographiclib/all/conandata.yml @@ -12,16 +12,16 @@ patches: "1.52": - patch_file: "patches/0002-cmake-minimum-required-1.52.patch" patch_description: "Add cmake_minimum_required() to top CMakeLists" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/geographiclib/geographiclib/commit/d9ca6c6ec0b721326b9a690eee259eac643b927f" "1.51": - patch_file: "patches/0002-cmake-minimum-required-1.51.patch" patch_description: "Add cmake_minimum_required() to top CMakeLists" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/geographiclib/geographiclib/commit/d9ca6c6ec0b721326b9a690eee259eac643b927f" "1.50.1": - patch_file: "patches/0001-streamoff.patch" - patch_file: "patches/0002-cmake-minimum-required-1.50.1.patch" patch_description: "Add cmake_minimum_required() to top CMakeLists" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/geographiclib/geographiclib/commit/d9ca6c6ec0b721326b9a690eee259eac643b927f" diff --git a/recipes/geographiclib/all/conanfile.py b/recipes/geographiclib/all/conanfile.py index 39ad5c7f95f2a..d3a9097b7417e 100644 --- a/recipes/geographiclib/all/conanfile.py +++ b/recipes/geographiclib/all/conanfile.py @@ -2,11 +2,14 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, replace_in_file, rm, rmdir +from conan.tools.files import ( + apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, + replace_in_file, rm, rmdir +) from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class GeographiclibConan(ConanFile): @@ -32,8 +35,7 @@ class GeographiclibConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -41,7 +43,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") @property def _compilers_minimum_version(self): @@ -51,34 +56,33 @@ def _compilers_minimum_version(self): "gcc": "4.9", "clang": "6", "Visual Studio": "14", # guess + "msvc": "190", } def validate(self): if Version(self.version) >= "1.51": - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - def lazy_lt_semver(v1, v2): + def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] - minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) - if minimum_version and lazy_lt_semver(str(self.info.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("geographiclib {} requires C++11 math functions, which your compiler does not support.".format(self.version)) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++11 math functions, which your compiler does not support." + ) - if self.info.options.precision not in ["float", "double"]: + if self.options.precision not in ["float", "double"]: # FIXME: add support for extended, quadruple and variable precisions # (may require external libs: boost multiprecision for quadruple, mpfr for variable) raise ConanInvalidConfiguration("extended, quadruple and variable precisions not yet supported in this recipe") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _cmake_option_precision(self): @@ -135,13 +139,10 @@ def package_info(self): self.cpp_info.libs = collect_libs(self) self.cpp_info.defines.append("GEOGRAPHICLIB_SHARED_LIB={}".format("1" if self.options.shared else "0")) - if self.options.tools: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "geographiclib" self.cpp_info.filenames["cmake_find_package_multi"] = "geographiclib" self.cpp_info.names["cmake_find_package"] = "GeographicLib" self.cpp_info.names["cmake_find_package_multi"] = "GeographicLib" + if self.options.tools: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/geographiclib/all/test_package/conanfile.py b/recipes/geographiclib/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/geographiclib/all/test_package/conanfile.py +++ b/recipes/geographiclib/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/geographiclib/all/test_v1_package/CMakeLists.txt b/recipes/geographiclib/all/test_v1_package/CMakeLists.txt index 9164dbad5458a..0d20897301b68 100644 --- a/recipes/geographiclib/all/test_v1_package/CMakeLists.txt +++ b/recipes/geographiclib/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(geographiclib REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE GeographicLib::GeographicLib) - -if(geographiclib_VERSION VERSION_GREATER_EQUAL "1.51") - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/geographiclib/all/test_v1_package/conanfile.py b/recipes/geographiclib/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/geographiclib/all/test_v1_package/conanfile.py +++ b/recipes/geographiclib/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/geos/all/conandata.yml b/recipes/geos/all/conandata.yml index 5b00d521ae8e3..4f7cf64f30b1f 100644 --- a/recipes/geos/all/conandata.yml +++ b/recipes/geos/all/conandata.yml @@ -1,10 +1,13 @@ sources: + "3.11.1": + url: "https://github.com/libgeos/geos/releases/download/3.11.1/geos-3.11.1.tar.bz2" + sha256: "be83ed195ffb82373710c90befc580911ea0eb57003a2d703e30101c5b262f62" "3.11.0": url: "https://github.com/libgeos/geos/releases/download/3.11.0/geos-3.11.0.tar.bz2" sha256: "79ab8cabf4aa8604d161557b52e3e4d84575acdc0d08cb09ab3f7aaefa4d858a" "3.10.3": - url: "https://github.com/libgeos/geos/archive/refs/tags/3.10.3.tar.gz" - sha256: "5af5a7ba0cc1225e7301fdcd7818521d65eb77e2f06647168e1969276d800cc1" + url: "https://download.osgeo.org/geos/geos-3.10.3.tar.bz2" + sha256: "3c141b07d61958a758345d5f54e3c735834b2f4303edb9f67fb26914f0d44770" "3.10.2": - url: "https://github.com/libgeos/geos/archive/refs/tags/3.10.2.tar.gz" - sha256: "d71932b444c9bd5d0bdf9eab4d22f25d9c31c122a73d619e2ec15294fb32147d" + url: "https://download.osgeo.org/geos/geos-3.10.2.tar.bz2" + sha256: "50bbc599ac386b4c2b3962dcc411f0040a61f204aaef4eba7225ecdd0cf45715" diff --git a/recipes/geos/all/conanfile.py b/recipes/geos/all/conanfile.py index 56c666612835a..356d3348ea008 100644 --- a/recipes/geos/all/conanfile.py +++ b/recipes/geos/all/conanfile.py @@ -1,12 +1,11 @@ from conan import ConanFile -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, stdcpp_library from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir from conan.tools.scm import Version -from conans import tools as tools_legacy import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class GeosConan(ConanFile): @@ -43,22 +42,26 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) - tc.variables["BUILD_BENCHMARKS"] = False + if Version(self.version) < "3.11.0": + # these 2 options are declared before project() in geos < 3.11.0 + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.cache_variables["BUILD_BENCHMARKS"] = False + else: + tc.variables["BUILD_BENCHMARKS"] = False if self._has_inline_option: tc.variables["DISABLE_GEOS_INLINE"] = not self.options.inline tc.variables["BUILD_TESTING"] = False @@ -108,9 +111,9 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["geos_cpp"].system_libs.append("m") if not self.options.shared: - stdcpp_library = tools_legacy.stdcpp_library(self) - if stdcpp_library: - self.cpp_info.components["geos_cpp"].system_libs.append(stdcpp_library) + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.components["geos_cpp"].system_libs.append(libcxx) self.cpp_info.components["geos_cpp"].requires = ["geos_cxx_flags"] # GEOS::geos_c diff --git a/recipes/geos/all/test_package/conanfile.py b/recipes/geos/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/geos/all/test_package/conanfile.py +++ b/recipes/geos/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/geos/all/test_v1_package/CMakeLists.txt b/recipes/geos/all/test_v1_package/CMakeLists.txt index d9acb1c061240..0d20897301b68 100644 --- a/recipes/geos/all/test_v1_package/CMakeLists.txt +++ b/recipes/geos/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(geos CONFIG REQUIRED geos_c) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE GEOS::geos_c) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/geos/all/test_v1_package/conanfile.py b/recipes/geos/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/geos/all/test_v1_package/conanfile.py +++ b/recipes/geos/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/geos/config.yml b/recipes/geos/config.yml index 05ecdd10986a5..40c19a7a4131d 100644 --- a/recipes/geos/config.yml +++ b/recipes/geos/config.yml @@ -1,4 +1,6 @@ versions: + "3.11.1": + folder: all "3.11.0": folder: all "3.10.3": diff --git a/recipes/geotrans/all/CMakeLists.txt b/recipes/geotrans/all/CMakeLists.txt index 4e9341cf898cb..70f2583ebeb4e 100644 --- a/recipes/geotrans/all/CMakeLists.txt +++ b/recipes/geotrans/all/CMakeLists.txt @@ -1,19 +1,13 @@ cmake_minimum_required(VERSION 3.8) project(geotrans LANGUAGES CXX) -#### -# Conan -#### -include(${CMAKE_SOURCE_DIR}/conanbuildinfo.cmake) -conan_basic_setup() #### # Directories #### -set(SRC_SUBFOLDER "${CMAKE_SOURCE_DIR}/source_subfolder") -set(DTCCDIR "${SRC_SUBFOLDER}/CCS/src/dtcc/CoordinateSystems") -set(CCSERVICEDIR "${SRC_SUBFOLDER}/CCS/src") -set(SRCDIR "${SRC_SUBFOLDER}/GEOTRANS3/java_gui/geotrans3/jni") +set(DTCCDIR "${GEOTRANS_SRC_DIR}/CCS/src/dtcc/CoordinateSystems") +set(CCSERVICEDIR "${GEOTRANS_SRC_DIR}/CCS/src") +set(SRCDIR "${GEOTRANS_SRC_DIR}/GEOTRANS3/java_gui/geotrans3/jni") #### # Sources @@ -79,4 +73,4 @@ install(TARGETS MSPdtcc MSPCoordinateConversionService RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) -install(DIRECTORY "${SRC_SUBFOLDER}/data/" DESTINATION res) +install(DIRECTORY "${GEOTRANS_SRC_DIR}/data/" DESTINATION res) diff --git a/recipes/geotrans/all/conandata.yml b/recipes/geotrans/all/conandata.yml index 5a03071eff8ed..2b4068a9ac96e 100644 --- a/recipes/geotrans/all/conandata.yml +++ b/recipes/geotrans/all/conandata.yml @@ -1,8 +1,12 @@ sources: + "3.9": + url: "https://c3i.jfrog.io/artifactory/cci-sources-backup/sources/geotrans/geotrans-3.9.tgz" + sha256: "06712b1c52e0a321bad1b5e6b38babbdbfd89f709669a238644fd878e8ccb4f2" "3.8": url: "https://c3i.jfrog.io/artifactory/cci-sources-backup/sources/geotrans/geotrans-3.8.tgz" - sha256: "BAA72D3B1AE12F237A8AD30F2DEB3FED2B80FEB759528EA0A72B4B42CB77C565" + sha256: "baa72d3b1ae12f237a8ad30f2deb3fed2b80feb759528ea0a72b4b42cb77c565" patches: + "3.9": + - patch_file: "patches/3.x-fix-for-cxx20.patch" "3.8": - - patch_file: "patches/3.8-fix-for-cxx20.patch" - base_path: "source_subfolder" + - patch_file: "patches/3.x-fix-for-cxx20.patch" diff --git a/recipes/geotrans/all/conanfile.py b/recipes/geotrans/all/conanfile.py index 3958995e4e27e..416bae1b78a53 100644 --- a/recipes/geotrans/all/conanfile.py +++ b/recipes/geotrans/all/conanfile.py @@ -1,27 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -required_conan_version = ">=1.35.0" +required_conan_version = ">=1.53.0" + class GeotransConan(ConanFile): name = "geotrans" - license = ( - "NGA GEOTRANS ToS (https://earth-info.nga.mil/php/download.php?file=wgs-terms)" - ) + license = "NGA GEOTRANS ToS (https://earth-info.nga.mil/php/download.php?file=wgs-terms)" url = "https://github.com/conan-io/conan-center-index" homepage = "https://earth-info.nga.mil/" description = "MSP GEOTRANS is the NGA and DOD approved coordinate converter and datum translator." - topics = ( - "geotrans", - "geodesic", - "geographic", - "coordinate", - "datum", - "geodetic", - "conversion", - "transformation", - ) - + topics = ("geotrans", "geodesic", "geographic", "coordinate", "datum", "geodetic", "conversion", "transformation") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,21 +25,9 @@ class GeotransConan(ConanFile): "fPIC": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -54,36 +35,34 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get( - **self.conan_data["sources"][self.version], - strip_root=True, - destination=self._source_subfolder, - filename="master.tgz" - ) + get(self, **self.conan_data["sources"][self.version], strip_root=True, filename=f"geotrans-{self.version}.tgz") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["GEOTRANS_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy( - "*.txt", - dst="licenses", - src=os.path.join(self._source_subfolder, "GEOTRANS3", "docs"), - ) - cmake = self._configure_cmake() + copy(self, "*.txt", + src=os.path.join(self.source_folder, "GEOTRANS3", "docs"), + dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): @@ -91,6 +70,7 @@ def package_info(self): self.cpp_info.components["dtcc"].includedirs = [ path[0] for path in os.walk("include") ] + self.cpp_info.components["dtcc"].res = ["res"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["dtcc"].system_libs.append("pthread") self.cpp_info.components["dtcc"].system_libs.append("m") @@ -100,9 +80,9 @@ def package_info(self): self.cpp_info.components["ccs"].includedirs = [ path[0] for path in os.walk("include") ] + self.cpp_info.components["ccs"].res = ["res"] - mpccs_data_path = os.path.join(self.package_folder, "res") - self.output.info("Prepending to MPCCS_DATA runtime environment variable: {}".format(mpccs_data_path)) - self.runenv_info.prepend_path("MPCCS_DATA", mpccs_data_path) + mspccs_data_path = os.path.join(self.package_folder, "res") + self.runenv_info.define_path("MSPCCS_DATA", mspccs_data_path) # TODO: to remove after conan v2, it allows to not break consumers still relying on virtualenv generator - self.env_info.MPCCS_DATA.append(mpccs_data_path) + self.env_info.MSPCCS_DATA = mspccs_data_path diff --git a/recipes/geotrans/all/patches/3.8-fix-for-cxx20.patch b/recipes/geotrans/all/patches/3.x-fix-for-cxx20.patch similarity index 100% rename from recipes/geotrans/all/patches/3.8-fix-for-cxx20.patch rename to recipes/geotrans/all/patches/3.x-fix-for-cxx20.patch diff --git a/recipes/geotrans/all/test_package/CMakeLists.txt b/recipes/geotrans/all/test_package/CMakeLists.txt index 78896a18d2b6d..5e9431340ab31 100644 --- a/recipes/geotrans/all/test_package/CMakeLists.txt +++ b/recipes/geotrans/all/test_package/CMakeLists.txt @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(geotrans REQUIRED dtcc ccs CONFIG) + add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} geotrans::dtcc geotrans::ccs) +target_link_libraries(${PROJECT_NAME} PRIVATE geotrans::dtcc geotrans::ccs) diff --git a/recipes/geotrans/all/test_package/conanfile.py b/recipes/geotrans/all/test_package/conanfile.py index ee41239123dbb..0a6bc68712d90 100644 --- a/recipes/geotrans/all/test_package/conanfile.py +++ b/recipes/geotrans/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -class GeotransTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,16 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - # NOTE: In order to use this library, the MPCCS_DATA environment variable *must* be set. - # The path to the appropriate data directory is available in the env_info variable. This can be - # accessed from a consumer package using `self.deps_env_info["geotrans"].MPCCS_DATA. - # Alternatively, this data directory can be moved to a location of your choice from its location - # in `res`, using the `imports()` method. - # This new location can then be used as the value for the MPCCS_DATA environment variable. - # TODO: should be automatically injected in self.run in conan v2 - with tools.environment_append( - {"MSPCCS_DATA": self.deps_env_info["geotrans"].MPCCS_DATA} - ): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/geotrans/all/test_v1_package/CMakeLists.txt b/recipes/geotrans/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/geotrans/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/geotrans/all/test_v1_package/conanfile.py b/recipes/geotrans/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2f992fa32bae6 --- /dev/null +++ b/recipes/geotrans/all/test_v1_package/conanfile.py @@ -0,0 +1,29 @@ +from conans import ConanFile, CMake, tools +from contextlib import contextmanager +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + @contextmanager + def _workaround_2profiles(self): + if hasattr(self, "settings_build"): + with tools.environment_append( + {"MSPCCS_DATA": os.path.join(self.deps_cpp_info["geotrans"].rootpath, "res")} + ): + yield + else: + yield + + def test(self): + if not tools.cross_building(self): + with self._workaround_2profiles(): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/geotrans/config.yml b/recipes/geotrans/config.yml index a874c72606420..bc00071b32bef 100644 --- a/recipes/geotrans/config.yml +++ b/recipes/geotrans/config.yml @@ -1,3 +1,5 @@ versions: + "3.9": + folder: all "3.8": folder: all diff --git a/recipes/gettext/all/conandata.yml b/recipes/gettext/all/conandata.yml index 1c02d8978221d..e03cab34f1431 100644 --- a/recipes/gettext/all/conandata.yml +++ b/recipes/gettext/all/conandata.yml @@ -8,11 +8,13 @@ sources: patches: "0.21": - patch_file: "patches/0002-memmove-is-intrinsic-function-on-MSVC.patch" - base_path: "source_subfolder" + - patch_file: "patches/0004-autopoint-relocatable.patch" + patch_description: "relocatable autopoint with resources relative to script" + patch_type: "conan" "0.20.1": - patch_file: "patches/0.20.1-0001-fix-build-errors-with-MSVC.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-memmove-is-intrinsic-function-on-MSVC.patch" - base_path: "source_subfolder" - patch_file: "patches/0.20.1-0003-Reported-by-Gabor-Z.-Papp-gzp-papp.hu.patch" - base_path: "source_subfolder" + - patch_file: "patches/0004-autopoint-relocatable.patch" + patch_description: "relocatable autopoint with resources relative to script" + patch_type: "conan" diff --git a/recipes/gettext/all/conanfile.py b/recipes/gettext/all/conanfile.py index d7020710e49c9..72a7afc2b30cc 100644 --- a/recipes/gettext/all/conanfile.py +++ b/recipes/gettext/all/conanfile.py @@ -1,93 +1,69 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import contextlib import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path, unix_path_package_info_legacy +from conan.tools.scm import Version +required_conan_version = ">=1.57.0" class GetTextConan(ConanFile): name = "gettext" + package_type = "application" description = "An internationalization and localization system for multilingual programs" - topics = ("gettext", "intl", "libintl", "i18n") + topics = ("intl", "libintl", "i18n") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.gnu.org/software/gettext" license = "GPL-3.0-or-later" - settings = "os", "arch", "compiler" - - exports_sources = "patches/*" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + settings = "os", "arch", "compiler", "build_type" @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - - @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" + def export_sources(self): + export_conandata_patches(self) def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def requirements(self): self.requires("libiconv/1.17") def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - if self._is_msvc: + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.win_bash = True + self.tool_requires("msys2/cci.latest") + if is_msvc(self): self.build_requires("automake/1.16.5") def validate(self): - if tools.Version(self.version) < "0.21" and self.settings.compiler == "Visual Studio": + if Version(self.version) < "0.21" and is_msvc(self): raise ConanInvalidConfiguration("MSVC builds of gettext for versions < 0.21 are not supported.") # FIXME: it used to be possible. What changed? def package_id(self): del self.info.settings.compiler def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - env = { - "CC": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "LD": "link -nologo", - "NM": "dumpbin -symbols", - "STRIP": ":", - "AR": "{} lib".format(tools.unix_path(self._user_info_build["automake"].ar_lib)), - "RANLIB": ":", - } - with tools.vcvars(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - with tools.environment_append(env): - yield - else: - yield - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] - libiconv_prefix = tools.unix_path(self.deps_cpp_info["libiconv"].rootpath) - args = [ + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + libiconv = self.dependencies["libiconv"] + libiconv_root = unix_path(self, libiconv.package_folder) + tc.configure_args.extend([ "HELP2MAN=/bin/true", "EMACS=no", - "--datarootdir={}".format(tools.unix_path(os.path.join(self.package_folder, "res"))), - "--with-libiconv-prefix={}".format(libiconv_prefix), + "--datarootdir=${prefix}/res", + "--with-libiconv-prefix={}".format(libiconv_root), "--disable-shared", "--disable-static", "--disable-nls", @@ -98,62 +74,75 @@ def _configure_autotools(self): "--disable-csharp", "--disable-libasprintf", "--disable-curses", - ] - build = None - host = None - if self._is_msvc: - rc = None - self._autotools.flags.append("-FS") - # INSTALL.windows: Native binaries, built using the MS Visual C/C++ tool chain. - build = False - if self.settings.arch == "x86": - host = "i686-w64-mingw32" - rc = "windres --target=pe-i386" - elif self.settings.arch == "x86_64": - host = "x86_64-w64-mingw32" - rc = "windres --target=pe-x86-64" - if rc: - args.extend([ - "RC={}".format(rc), - "WINDRES={}".format(rc), - ]) - self._autotools.configure(args=args, configure_dir=self._source_subfolder, build=build, host=host) - return self._autotools + ]) + + if is_msvc(self): + if check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") #TODO: reference github issue + + # The flag above `--with-libiconv-prefix` fails to correctly detect libiconv on windows+msvc + # so it needs an extra nudge. We could use `AutotoolsDeps` but it's currently affected by the + # following outstanding issue: https://github.com/conan-io/conan/issues/12784 + iconv_includedir = unix_path(self, libiconv.cpp_info.aggregated_components().includedirs[0]) + iconv_libdir = unix_path(self, libiconv.cpp_info.aggregated_components().libdirs[0]) + tc.extra_cflags.append(f"-I{iconv_includedir}") + tc.extra_ldflags.append(f"-L{iconv_libdir}") + + env = Environment() + compile_wrapper = self.dependencies.build["automake"].conf_info.get("user.automake:compile-wrapper") + lib_wrapper = self.dependencies.build["automake"].conf_info.get("user.automake:lib-wrapper") + env.define("CC", "{} cl -nologo".format(unix_path(self, compile_wrapper))) + env.define("LD", "link -nologo") + env.define("NM", "dumpbin -symbols") + env.define("STRIP", ":") + env.define("AR", "{} lib".format(unix_path(self, lib_wrapper))) + env.define("RANLIB", ":") + + # One of the checks performed by the configure script requires this as a preprocessor flag + # rather than a C compiler flag + env.prepend("CPPFLAGS", f"-I{iconv_includedir}") + + windres_arch = {"x86": "i686", "x86_64": "x86-64"}[str(self.settings.arch)] + env.define("RC", f"windres --target=pe-{windres_arch}") + env.vars(self).save_script("conanbuild_msvc") + + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.replace_in_file(os.path.join(self._source_subfolder, "gettext-tools", "misc", "autopoint.in"), "@prefix@", "$GETTEXT_ROOT_UNIX") - tools.replace_in_file(os.path.join(self._source_subfolder, "gettext-tools", "misc", "autopoint.in"), "@datarootdir@", "$prefix/res") - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="COPYING", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib")) - tools.rmdir(os.path.join(self.package_folder, "include")) - tools.rmdir(os.path.join(self.package_folder, "share", "doc")) - tools.rmdir(os.path.join(self.package_folder, "share", "info")) - tools.rmdir(os.path.join(self.package_folder, "share", "man")) + autotools = Autotools(self) + autotools.install() + + copy(self, pattern="COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + rmdir(self, os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "include")) + rmdir(self, os.path.join(self.package_folder, "share", "doc")) + rmdir(self, os.path.join(self.package_folder, "share", "info")) + rmdir(self, os.path.join(self.package_folder, "share", "man")) def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] + aclocal = os.path.join(self.package_folder, "res", "aclocal") + autopoint = os.path.join(self.package_folder, "bin", "autopoint") + self.buildenv_info.append_path("ACLOCAL_PATH", aclocal) + self.buildenv_info.define_path("AUTOPOINT", autopoint) + + # TODO: the following can be removed when the recipe supports Conan >= 2.0 only bindir = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bindir)) self.env_info.PATH.append(bindir) - aclocal = tools.unix_path(os.path.join(self.package_folder, "res", "aclocal")) self.output.info("Appending AUTOMAKE_CONAN_INCLUDES environment variable: {}".format(aclocal)) - self.env_info.AUTOMAKE_CONAN_INCLUDES.append(aclocal) + self.env_info.AUTOMAKE_CONAN_INCLUDES.append(unix_path_package_info_legacy(self, aclocal)) - autopoint = tools.unix_path(os.path.join(self.package_folder, "bin", "autopoint")) self.output.info("Setting AUTOPOINT environment variable: {}".format(autopoint)) - self.env_info.AUTOPOINT = autopoint - - self.env_info.GETTEXT_ROOT_UNIX = tools.unix_path(self.package_folder) + self.env_info.AUTOPOINT = unix_path_package_info_legacy(self, autopoint) diff --git a/recipes/gettext/all/patches/0004-autopoint-relocatable.patch b/recipes/gettext/all/patches/0004-autopoint-relocatable.patch new file mode 100644 index 0000000000000..29613a326dfbf --- /dev/null +++ b/recipes/gettext/all/patches/0004-autopoint-relocatable.patch @@ -0,0 +1,27 @@ +diff --git a/gettext-tools/misc/autopoint.in b/gettext-tools/misc/autopoint.in +index 3a24eee..a53c65a 100644 +--- a/gettext-tools/misc/autopoint.in ++++ b/gettext-tools/misc/autopoint.in +@@ -27,9 +27,10 @@ archive_version=@ARCHIVE_VERSION@ + + # Set variables + # - gettext_datadir directory where the data files are stored. +-prefix="@prefix@" +-datarootdir="@datarootdir@" +-: ${gettext_datadir="@datadir@/gettext"} ++scriptdir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) ++prefix="$scriptdir/.." ++datarootdir="$prefix/res" ++: ${gettext_datadir="${datarootdir}/gettext"} + : ${AUTOM4TE=autom4te} + + # func_tmpdir +@@ -130,7 +131,7 @@ func_find_prefixes () + } + if test "@RELOCATABLE@" = yes; then + exec_prefix="@exec_prefix@" +- bindir="@bindir@" ++ bindir="$prefix/bin" + orig_installdir="$bindir" # see Makefile.am's *_SCRIPTS variables + func_find_curr_installdir # determine curr_installdir + func_find_prefixes diff --git a/recipes/gettext/all/test_package/conanfile.py b/recipes/gettext/all/test_package/conanfile.py index 9e810ecf433fc..8ef53a96f7ded 100644 --- a/recipes/gettext/all/test_package/conanfile.py +++ b/recipes/gettext/all/test_package/conanfile.py @@ -1,13 +1,17 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -import contextlib -import os -import shutil +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.env import Environment, VirtualRunEnv, VirtualBuildEnv +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc + class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler" + settings = "os", "arch", "compiler", "build_type" exports_sources = "configure.ac", test_type = "explicit" + win_bash = True @property def _settings_build(self): @@ -17,35 +21,38 @@ def requirements(self): self.requires(self.tested_reference_str) def build_requirements(self): - self.build_requires(self.tested_reference_str) - self.build_requires("automake/1.16.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "cl -nologo", - "LD": "link -nologo", - } - with tools.environment_append(env): - yield - else: - yield + self.tool_requires(self.tested_reference_str) + self.tool_requires("automake/1.16.5") + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def layout(self): + basic_layout(self, src_folder="src") + + def generate(self): + buildenv = VirtualBuildEnv(self) + buildenv.generate() + + at = AutotoolsToolchain(self) + at.generate() + + if is_msvc(self): + env = Environment() + env.define("CC", "cl -nologo") + env.define("LD", "link -nologo") + env.vars(self).save_script("conanbuild_libsmacker_msvc") + + runenv = VirtualRunEnv(self) + runenv.generate() def build(self): - for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), os.path.join(self.build_folder, src)) - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows, run_environment=True) - with self._build_context(): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - autotools.configure() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + def test(self): - if not tools.cross_building(self, skip_x64_x86=True): + if can_run(self): for exe in ["gettext", "ngettext", "msgcat", "msgmerge"]: - self.run("{} --version".format(exe), run_environment=True) + self.run("{} --version".format(exe), env="conanrun") diff --git a/recipes/gettext/all/test_package/configure.ac b/recipes/gettext/all/test_package/src/configure.ac similarity index 100% rename from recipes/gettext/all/test_package/configure.ac rename to recipes/gettext/all/test_package/src/configure.ac diff --git a/recipes/gettext/all/test_v1_package/conanfile.py b/recipes/gettext/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9e810ecf433fc --- /dev/null +++ b/recipes/gettext/all/test_v1_package/conanfile.py @@ -0,0 +1,51 @@ +from conans import ConanFile, tools, AutoToolsBuildEnvironment +import contextlib +import os +import shutil + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler" + exports_sources = "configure.ac", + test_type = "explicit" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + self.build_requires("automake/1.16.4") + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + @contextlib.contextmanager + def _build_context(self): + if self.settings.compiler == "Visual Studio": + with tools.vcvars(self): + env = { + "CC": "cl -nologo", + "LD": "link -nologo", + } + with tools.environment_append(env): + yield + else: + yield + + def build(self): + for src in self.exports_sources: + shutil.copy(os.path.join(self.source_folder, src), os.path.join(self.build_folder, src)) + + self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows, run_environment=True) + with self._build_context(): + autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + autotools.libs = [] + autotools.configure() + + def test(self): + if not tools.cross_building(self, skip_x64_x86=True): + for exe in ["gettext", "ngettext", "msgcat", "msgmerge"]: + self.run("{} --version".format(exe), run_environment=True) diff --git a/recipes/gettext/all/test_v1_package/configure.ac b/recipes/gettext/all/test_v1_package/configure.ac new file mode 100644 index 0000000000000..b2c4f352a64de --- /dev/null +++ b/recipes/gettext/all/test_v1_package/configure.ac @@ -0,0 +1,6 @@ +AC_INIT([test_package_gettext],[1.0]) +AC_PREREQ([2.69]) + +AM_GNU_GETTEXT_REQUIRE_VERSION([0.20]) +AM_GNU_GETTEXT([external], [need-ngettext]) +AM_ICONV diff --git a/recipes/gflags/all/conanfile.py b/recipes/gflags/all/conanfile.py index fda8b67b4cb6e..985562e799cab 100644 --- a/recipes/gflags/all/conanfile.py +++ b/recipes/gflags/all/conanfile.py @@ -4,17 +4,18 @@ import os import textwrap -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class GflagsConan(ConanFile): name = "gflags" description = "The gflags package contains a C++ library that implements commandline flags processing" - topics = ("gflags", "cli", "flags", "commandline") + topics = ("cli", "flags", "commandline") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/gflags/gflags" license = "BSD-3-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,14 +36,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/gflags/all/test_package/conanfile.py b/recipes/gflags/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/gflags/all/test_package/conanfile.py +++ b/recipes/gflags/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/gflags/all/test_v1_package/CMakeLists.txt b/recipes/gflags/all/test_v1_package/CMakeLists.txt index ea0c4e2bee799..0d20897301b68 100644 --- a/recipes/gflags/all/test_v1_package/CMakeLists.txt +++ b/recipes/gflags/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(gflags REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE gflags::gflags) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gfortran/all/conandata.yml b/recipes/gfortran/all/conandata.yml index 9585b50f82122..7baa9c9b5ccf6 100644 --- a/recipes/gfortran/all/conandata.yml +++ b/recipes/gfortran/all/conandata.yml @@ -1,13 +1,14 @@ sources: "10.2": - "url": - "Windows": - url: https://downloads.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win64/Personal%20Builds/ray_linn/GCC-10.X-with-ada/GCC-10.2.0-crt-8.0.0-with-ada-20201019.7z - filename: GCC-10.2.0-crt-8.0.0-with-ada-20201019.7z - sha256: 5c3fc254494bc24eb201870f4b781d401cf7279bd03ea1aba6f2ffae771ded44 - "Linux": - url: https://gfortran.meteodat.ch/download/x86_64/snapshots/gcc-10-20210109.tar.xz - sha256: 494e9d881d6d9bb4a5707bfa149f77001599f093090c6c78fdb19cefbacda7b8 - "Macos": - url: https://downloads.sourceforge.net/project/hpc/hpc/g95/gfortran-10.2-bin.tar.gz - sha256: 2de46f571eefc2b544db4ed6c958c78a5e3e78c4b4b5daab38aabc1b08dd5666 + "Windows": + "x86_64": + url: "https://downloads.sourceforge.net/project/mingw-w64/Toolchains%20targetting%20Win64/Personal%20Builds/ray_linn/GCC-10.X-with-ada/GCC-10.2.0-crt-8.0.0-with-ada-20201019.7z" + sha256: "5c3fc254494bc24eb201870f4b781d401cf7279bd03ea1aba6f2ffae771ded44" + "Linux": + "x86_64": + url: "https://gfortran.meteodat.ch/download/x86_64/releases/gcc-10.2.0.tar.xz" + sha256: "5cfaf152db442bb967963ca62d4590980cb2664c5902c1a9578fc8a9c6efe40f" + "Macos": + "x86_64": + url: "https://downloads.sourceforge.net/project/hpc/hpc/g95/gfortran-10.2-bin.tar.gz" + sha256: "2de46f571eefc2b544db4ed6c958c78a5e3e78c4b4b5daab38aabc1b08dd5666" diff --git a/recipes/gfortran/all/conanfile.py b/recipes/gfortran/all/conanfile.py index 43279cdb234c8..209997c47d1fa 100644 --- a/recipes/gfortran/all/conanfile.py +++ b/recipes/gfortran/all/conanfile.py @@ -1,11 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, load, save, download import os -import glob - - -required_conan_version = ">=1.32.0" +required_conan_version = ">=1.46.0" class GFortranConan(ConanFile): name = "gfortran" @@ -14,12 +12,9 @@ class GFortranConan(ConanFile): homepage = "https://gcc.gnu.org/fortran" topics = ("gnu", "gcc", "fortran", "compiler") license = "GPL-3.0-or-later" - settings = "os", "arch" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - - @property - def _source_subfolder(self): - return os.path.join(self.source_folder, "source_subfolder_{}".format(str(self.settings.os))) + short_paths = True def validate(self): if self.settings.arch != "x86_64": @@ -29,38 +24,56 @@ def validate(self): def build_requirements(self): if self.settings.os == "Windows": - self.build_requires("7zip/19.00") + self.tool_requires("7zip/19.00") + + def build(self): + if self.settings.os == "Windows": + filename = os.path.join(self.build_folder, "GCC-10.2.0-crt-8.0.0-with-ada-20201019.7z") + download(self, **self.conan_data["sources"][self.version][str(self.settings.os)]["x86_64"], filename=filename) + self.run(f"7z x {filename}") + else: + get(self, **self.conan_data["sources"][self.version][str(self.settings.os)]["x86_64"], + destination=self.build_folder, strip_root=True) - def source(self): - url = self.conan_data["sources"][self.version]["url"] - for it in url.keys(): - if self.settings.os == "Windows" and it == "Windows": - filename = url[it]["filename"] - tools.download(**url[it]) - self.run("7z x {0}".format(filename)) - os.unlink(filename) - os.rename("mingw64", "source_subfolder_Windows") - elif it != "Windows": - tools.get(**url[it]) - pattern = "gcc-*" if it == "Linux" else "usr" - os.rename(glob.glob(pattern)[0], "source_subfolder_{}".format(it)) + @property + def _archive_contents_path(self): + if self.settings.os == "Macos": + return os.path.join(self.build_folder, "local") + elif self.settings.os == "Windows": + return os.path.join(self.build_folder, "mingw64") + else: + return os.path.join(self.build_folder) + + @property + def _license_path(self): + return os.path.join(self._archive_contents_path, "share", "info") + + @property + def _library_source_path(self): + return os.path.join(self._archive_contents_path, { + "Linux": "lib64", + "Macos": "lib", + "Windows": os.path.join("lib", "gcc", "x86_64-w64-mingw32", "10.2.0") + }[str(self.settings.os)]) def _extract_license(self): - info = tools.load(os.path.join(self.source_folder, "source_subfolder_Linux", "share", "info", "gfortran.info")) + info = load(self, os.path.join(self._license_path, "gfortran.info")) license_contents = info[info.find("Version 3"):info.find("END OF TERMS", 1)] - tools.save("LICENSE", license_contents) + save(self, os.path.join(self.build_folder, "LICENSE"), license_contents) + + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type # The binaries are not specific def package(self): self._extract_license() - self.copy("LICENSE", dst="licenses") - self.copy("gfortran*", dst="bin", src=os.path.join(self._source_subfolder, "bin")) - self.copy("gfortran", dst="bin", src=os.path.join(self._source_subfolder, "local", "bin")) - self.copy("libgfortran.a", dst="lib", src=os.path.join(self._source_subfolder, "lib64")) - self.copy("libgfortran.a", dst="lib", src=os.path.join(self._source_subfolder, "local", "lib")) - self.copy("libgfortran.a", dst="lib", src=os.path.join(self._source_subfolder, "lib", "gcc", "x86_64-w64-mingw32", "10.2.0")) + copy(self, "LICENSE", src=self.build_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "gfortran*", src=os.path.join(self._archive_contents_path, "bin"), dst=os.path.join(self.package_folder, "bin")) + copy(self, "libgfortran.a", src=self._library_source_path, dst=os.path.join(self.package_folder, "lib")) def package_info(self): bin_path = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.cpp_info.includedirs = [] self.env_info.PATH.append(bin_path) self.cpp_info.libs = ["gfortran"] diff --git a/recipes/gfortran/all/test_package/conanfile.py b/recipes/gfortran/all/test_package/conanfile.py index c9380771129c0..9d3aaf213929b 100644 --- a/recipes/gfortran/all/test_package/conanfile.py +++ b/recipes/gfortran/all/test_package/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - self.run("gfortran --version", run_environment=True) + if can_run(self): + self.run("gfortran --version", env="conanrun") diff --git a/recipes/gfortran/all/test_v1_package/conanfile.py b/recipes/gfortran/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c9380771129c0 --- /dev/null +++ b/recipes/gfortran/all/test_v1_package/conanfile.py @@ -0,0 +1,8 @@ +from conans import ConanFile, tools + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not tools.cross_building(self): + self.run("gfortran --version", run_environment=True) diff --git a/recipes/ghc-filesystem/all/conanfile.py b/recipes/ghc-filesystem/all/conanfile.py index e6d1ea4b6a59c..e7b402102ac33 100644 --- a/recipes/ghc-filesystem/all/conanfile.py +++ b/recipes/ghc-filesystem/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class GhcFilesystemRecipe(ConanFile): @@ -14,26 +16,31 @@ class GhcFilesystemRecipe(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + cmake_layout(self) def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + + tc.variables["GHC_FILESYSTEM_BUILD_TESTING"] = False + tc.variables["GHC_FILESYSTEM_BUILD_EXAMPLES"] = False + tc.variables["GHC_FILESYSTEM_WITH_INSTALL"] = True + + tc.generate() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder,"licenses"), src=self.source_folder) cmake = CMake(self) - cmake.definitions["GHC_FILESYSTEM_BUILD_TESTING"] = False - cmake.definitions["GHC_FILESYSTEM_BUILD_EXAMPLES"] = False - cmake.definitions["GHC_FILESYSTEM_WITH_INSTALL"] = True - cmake.configure(source_folder=self._source_subfolder) + cmake.configure() cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "ghc_filesystem") diff --git a/recipes/ghc-filesystem/all/test_package/CMakeLists.txt b/recipes/ghc-filesystem/all/test_package/CMakeLists.txt index ce18702a4641b..b3075eb110867 100644 --- a/recipes/ghc-filesystem/all/test_package/CMakeLists.txt +++ b/recipes/ghc-filesystem/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(ghc_filesystem REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ghcFilesystem::ghc_filesystem) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE ghcFilesystem::ghc_filesystem) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/ghc-filesystem/all/test_package/conanfile.py b/recipes/ghc-filesystem/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/ghc-filesystem/all/test_package/conanfile.py +++ b/recipes/ghc-filesystem/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ghc-filesystem/all/test_v1_package/CMakeLists.txt b/recipes/ghc-filesystem/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/ghc-filesystem/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/ghc-filesystem/all/test_v1_package/conanfile.py b/recipes/ghc-filesystem/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/ghc-filesystem/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/giflib/5.2.x/conanfile.py b/recipes/giflib/5.2.x/conanfile.py index 9992925056c52..a310e9327cab1 100644 --- a/recipes/giflib/5.2.x/conanfile.py +++ b/recipes/giflib/5.2.x/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class GiflibConan(ConanFile): @@ -13,7 +13,7 @@ class GiflibConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" license = "MIT" homepage = "http://giflib.sourceforge.net" - topics = ("giflib", "image", "multimedia", "format", "graphics") + topics = ("gif", "image", "multimedia", "format", "graphics") settings = "os", "arch", "compiler", "build_type" options = { @@ -29,8 +29,7 @@ class GiflibConan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,23 +37,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if is_msvc(self) and self.options.utils: self.requires("getopt-for-visual-studio/20200201") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -84,14 +77,11 @@ def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "GIF") self.cpp_info.set_property("cmake_target_name", "GIF::GIF") - - self.cpp_info.names["cmake_find_package"] = "GIF" - self.cpp_info.names["cmake_find_package_multi"] = "GIF" - self.cpp_info.libs = ["gif"] if is_msvc(self): self.cpp_info.defines.append("USE_GIF_DLL" if self.options.shared else "USE_GIF_LIB") - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "GIF" + self.cpp_info.names["cmake_find_package_multi"] = "GIF" + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/giflib/5.2.x/test_package/conanfile.py b/recipes/giflib/5.2.x/test_package/conanfile.py index 9c8ff0928e452..b9fa3f37a5fb4 100644 --- a/recipes/giflib/5.2.x/test_package/conanfile.py +++ b/recipes/giflib/5.2.x/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,20 +7,21 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(f"{bin_path} testimg.gif", env="conanrun") assert os.path.isfile("testimg.gif") diff --git a/recipes/giflib/5.2.x/test_v1_package/CMakeLists.txt b/recipes/giflib/5.2.x/test_v1_package/CMakeLists.txt index 49201124fb63e..0d20897301b68 100644 --- a/recipes/giflib/5.2.x/test_v1_package/CMakeLists.txt +++ b/recipes/giflib/5.2.x/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(GIF REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE GIF::GIF) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/giflib/5.2.x/test_v1_package/conanfile.py b/recipes/giflib/5.2.x/test_v1_package/conanfile.py index 918b4b3259bfc..15e08a8cf4897 100644 --- a/recipes/giflib/5.2.x/test_v1_package/conanfile.py +++ b/recipes/giflib/5.2.x/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/glaze/all/conandata.yml b/recipes/glaze/all/conandata.yml new file mode 100644 index 0000000000000..863588140bb9b --- /dev/null +++ b/recipes/glaze/all/conandata.yml @@ -0,0 +1,45 @@ +sources: + "0.3.6": + url: "https://github.com/stephenberry/glaze/archive/v0.3.6.tar.gz" + sha256: "bc87d4fd458f0634a146d6f4c902a952b66c3f718c3e20f680b99066224b51a1" + "0.3.5": + url: "https://github.com/stephenberry/glaze/archive/v0.3.5.tar.gz" + sha256: "4a3e81a4862b57a21b03ed6d5b823397291e50e7b7d24944cc4932c5ae256cf7" + "0.3.2": + url: "https://github.com/stephenberry/glaze/archive/v0.3.2.tar.gz" + sha256: "41f19b1b4872a637ecb63bccb07578255f54c8842faf1bab78779e6342b2fa7e" + "0.2.2": + url: "https://github.com/stephenberry/glaze/archive/v0.2.2.tar.gz" + sha256: "d0d2edcc546b0ebb4bedaeedfb4a54aa678a6fdffa6b20dd6b252ef6325a9e75" + "0.2.1": + url: "https://github.com/stephenberry/glaze/archive/v0.2.1.tar.gz" + sha256: "dcf9ddf51b186dbc4cfd3b9324f9ee238cc1ba46fc2a62effa9293971ac4d1d4" + "0.2.0": + url: "https://github.com/stephenberry/glaze/archive/v0.2.0.tar.gz" + sha256: "2ad0d91f89465eac94efbeb91e435a5b36b7d54c9d8d6ccfb0708f6c6c0c5f87" + "0.1.8": + url: "https://github.com/stephenberry/glaze/archive/v0.1.8.tar.gz" + sha256: "8268ec2a8e0f2d9de2e65830ad9f7a623577c7bd47d465d4c6e4bed9d266ad48" + "0.1.7": + url: "https://github.com/stephenberry/glaze/archive/v0.1.7.tar.gz" + sha256: "7dc31ceaa444fd92339a48a69be638e92daa2858c3228f347b1df54a824b8f62" + "0.1.4": + url: "https://github.com/stephenberry/glaze/archive/v0.1.4.tar.gz" + sha256: "dd46e77973fe5b3cf4cd68fd597ba6b1010ecffd3e10cd8ccbd6cd615e6ffaff" + "0.0.7": + url: "https://github.com/stephenberry/glaze/archive/refs/tags/v0.0.7.tar.gz" + sha256: "124f7e8fea58c012b548ba1b643684fe428c7dbfeb8d8a5f701eb7db4356a759" + +patches: + "0.2.2": + - patch_file: "patches/0.2.0-0001-use-cci-frozen.patch" + patch_description: "use cci's frozen" + patch_type: "conan" + "0.2.1": + - patch_file: "patches/0.2.0-0001-use-cci-frozen.patch" + patch_description: "use cci's frozen" + patch_type: "conan" + "0.2.0": + - patch_file: "patches/0.2.0-0001-use-cci-frozen.patch" + patch_description: "use cci's frozen" + patch_type: "conan" diff --git a/recipes/glaze/all/conanfile.py b/recipes/glaze/all/conanfile.py new file mode 100644 index 0000000000000..f7e2a6bc471e7 --- /dev/null +++ b/recipes/glaze/all/conanfile.py @@ -0,0 +1,87 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, export_conandata_patches, apply_conandata_patches +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.51.1" + +class GlazeConan(ConanFile): + name = "glaze" + description = "Extremely fast, in memory, JSON and interface library for modern C++" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/stephenberry/glaze" + topics = ("json", "memory", "header-only") + settings = "os", "arch", "compiler", "build_type" + + @property + def _minimum_cpp_standard(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "11" if Version(self.version) < "0.2.4" else "12", + "clang": "12" if Version(self.version) < "0.2.4" else "13", + "apple-clang": "13.1", + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + if Version(self.version) < "0.2.4": + self.requires("fmt/9.1.0") + self.requires("frozen/1.1.1") + self.requires("nanorange/20200505") + if Version(self.version) < "0.2.3": + self.requires("fast_float/3.9.0") + if "0.1.5" <= Version(self.version) < "0.2.3": + self.requires("dragonbox/1.1.3") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._minimum_cpp_standard}, which your compiler does not support.", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + apply_conandata_patches(self) + + def package(self): + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + excludes="glaze/frozen/*.hpp" if Version(self.version) < "0.2.4" else "", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/glaze/all/patches/0.2.0-0001-use-cci-frozen.patch b/recipes/glaze/all/patches/0.2.0-0001-use-cci-frozen.patch new file mode 100644 index 0000000000000..01b0c786fa02b --- /dev/null +++ b/recipes/glaze/all/patches/0.2.0-0001-use-cci-frozen.patch @@ -0,0 +1,28 @@ +diff --git a/include/glaze/core/common.hpp b/include/glaze/core/common.hpp +index aed6ce6..6cf4ace 100644 +--- a/include/glaze/core/common.hpp ++++ b/include/glaze/core/common.hpp +@@ -12,8 +12,8 @@ + #include + #include + +-#include "glaze/frozen/string.hpp" +-#include "glaze/frozen/unordered_map.hpp" ++#include "frozen/string.h" ++#include "frozen/unordered_map.h" + + #include "glaze/core/context.hpp" + #include "glaze/core/meta.hpp" +diff --git a/include/glaze/util/hash_map.hpp b/include/glaze/util/hash_map.hpp +index eaaec57..ae75ee2 100644 +--- a/include/glaze/util/hash_map.hpp ++++ b/include/glaze/util/hash_map.hpp +@@ -4,7 +4,7 @@ + #include + #include + +-#include "glaze/frozen/random.hpp" ++#include "frozen/random.h" + #include "glaze/util/string_cmp.hpp" + + namespace glz diff --git a/recipes/glaze/all/test_package/CMakeLists.txt b/recipes/glaze/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4811c5114c3c2 --- /dev/null +++ b/recipes/glaze/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(glaze REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE glaze::glaze) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/glaze/all/test_package/conanfile.py b/recipes/glaze/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/glaze/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/glaze/all/test_package/test_package.cpp b/recipes/glaze/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..19dbb41c1ae8f --- /dev/null +++ b/recipes/glaze/all/test_package/test_package.cpp @@ -0,0 +1,33 @@ +#include "glaze/glaze.hpp" +#include "glaze/json/json_ptr.hpp" +#include "glaze/api/impl.hpp" + +struct my_struct +{ + int i = 287; + double d = 3.14; + std::string hello = "Hello World"; + std::array arr = { 1, 2, 3 }; +}; + +template <> +struct glz::meta { + using T = my_struct; + static constexpr auto value = object( + "i", &T::i, + "d", &T::d, + "hello", &T::hello, + "arr", &T::arr + ); +}; + +int main(void) { + std::string buffer = R"({"i":287,"d":3.14,"hello":"Hello World","arr":[1,2,3]})"; + auto s = glz::read_json(buffer); + + (void)s.d; + (void)s.hello; + (void)s.arr; + + return 0; +} diff --git a/recipes/glaze/all/test_v1_package/CMakeLists.txt b/recipes/glaze/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9652e22fc19d5 --- /dev/null +++ b/recipes/glaze/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.12) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/glaze/all/test_v1_package/conanfile.py b/recipes/glaze/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/glaze/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/glaze/config.yml b/recipes/glaze/config.yml new file mode 100644 index 0000000000000..9c0070436df28 --- /dev/null +++ b/recipes/glaze/config.yml @@ -0,0 +1,21 @@ +versions: + "0.3.6": + folder: all + "0.3.5": + folder: all + "0.3.2": + folder: all + "0.2.2": + folder: all + "0.2.1": + folder: all + "0.2.0": + folder: all + "0.1.8": + folder: all + "0.1.7": + folder: all + "0.1.4": + folder: all + "0.0.7": + folder: all diff --git a/recipes/glbinding/all/conanfile.py b/recipes/glbinding/all/conanfile.py index 995638a6477cf..f3b937be48106 100644 --- a/recipes/glbinding/all/conanfile.py +++ b/recipes/glbinding/all/conanfile.py @@ -1,20 +1,21 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class GlbindingConan(ConanFile): name = "glbinding" description = "A C++ binding for the OpenGL API, generated using the gl.xml specification." license = "MIT" - topics = ("glbinding", "opengl", "binding") + topics = ("opengl", "binding") homepage = "https://glbinding.org/" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,8 +27,7 @@ class GlbindingConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,28 +35,28 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) - tc.variables["OPTION_SELF_CONTAINED"] = False - tc.variables["OPTION_BUILD_TESTS"] = False - tc.variables["OPTION_BUILD_DOCS"] = False - tc.variables["OPTION_BUILD_TOOLS"] = False - tc.variables["OPTION_BUILD_EXAMPLES"] = False - tc.variables["OPTION_BUILD_WITH_BOOST_THREAD"] = False - tc.variables["OPTION_BUILD_CHECK"] = False + tc.cache_variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.cache_variables["OPTION_SELF_CONTAINED"] = False + tc.cache_variables["OPTION_BUILD_TESTS"] = False + tc.cache_variables["OPTION_BUILD_DOCS"] = False + tc.cache_variables["OPTION_BUILD_TOOLS"] = False + tc.cache_variables["OPTION_BUILD_EXAMPLES"] = False + tc.cache_variables["OPTION_BUILD_WITH_BOOST_THREAD"] = False + tc.cache_variables["OPTION_BUILD_CHECK"] = False # TODO: might be a good idea to fix upstream CMakeLists to not rely on # WriteCompilerDetectionHeader, and just use cxx_std_11 compile feature tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0120"] = "OLD" diff --git a/recipes/glbinding/all/test_package/conanfile.py b/recipes/glbinding/all/test_package/conanfile.py index 1a18c15c05fda..64eabdd7c894e 100644 --- a/recipes/glbinding/all/test_package/conanfile.py +++ b/recipes/glbinding/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,20 +7,21 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) def requirements(self): self.requires(self.tested_reference_str) self.requires("glfw/3.3.8") - def layout(self): - cmake_layout(self) - def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/glbinding/all/test_v1_package/CMakeLists.txt b/recipes/glbinding/all/test_v1_package/CMakeLists.txt index d7d5df21ee2a2..0d20897301b68 100644 --- a/recipes/glbinding/all/test_v1_package/CMakeLists.txt +++ b/recipes/glbinding/all/test_v1_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(glbinding REQUIRED CONFIG) -find_package(glfw3 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE glbinding::glbinding glfw) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/glbinding/all/test_v1_package/conanfile.py b/recipes/glbinding/all/test_v1_package/conanfile.py index da42acb6c46c8..67eb137fb4f2d 100644 --- a/recipes/glbinding/all/test_v1_package/conanfile.py +++ b/recipes/glbinding/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/glew/all/CMakeLists.txt b/recipes/glew/all/CMakeLists.txt deleted file mode 100644 index 1da00850fa23c..0000000000000 --- a/recipes/glew/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper C) - -include("conanbuildinfo.cmake") -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder/build/cmake") diff --git a/recipes/glew/all/conandata.yml b/recipes/glew/all/conandata.yml index 8cfd90ad63ca0..c4c27b1a2cf9f 100644 --- a/recipes/glew/all/conandata.yml +++ b/recipes/glew/all/conandata.yml @@ -6,6 +6,14 @@ sources: sha256: "04de91e7e6763039bc11940095cd9c7f880baba82196a7765f727ac05a993c95" url: "https://github.com/nigels-com/glew/releases/download/glew-2.1.0/glew-2.1.0.tgz" patches: + "2.2.0": + - patch_file: "patches/0001-fix-cmake-2.2.0.patch" + patch_description: "Fix CMake: cmake_minimum_required() before project()" + patch_type: conan "2.1.0": - - patch_file: "patches/vs16-release-fix.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-cmake-2.1.0.patch" + patch_description: "Fix CMake: cmake_minimum_required() before project()" + patch_type: conan + - patch_file: "patches/0002-vs16-release-fix.patch" + patch_type: "backport" + patch_source: "https://github.com/nigels-com/glew/commit/4bbe8aa2ab70a6eb847ee5751735422d0ba623cd" diff --git a/recipes/glew/all/conanfile.py b/recipes/glew/all/conanfile.py index c3e2c208bc048..75e5f17da8e37 100644 --- a/recipes/glew/all/conanfile.py +++ b/recipes/glew/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile -from conan.tools import files -from conans import CMake -import functools +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class GlewConan(ConanFile): @@ -26,20 +26,8 @@ class GlewConan(ConanFile): "with_egl": False, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -48,38 +36,49 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("opengl/system") self.requires("glu/system") def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_UTILS"] = False - cmake.definitions["GLEW_EGL"] = self.options.get_safe("with_egl", False) - cmake.configure(build_folder=self._build_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_UTILS"] = False + tc.variables["GLEW_EGL"] = self.options.get_safe("with_egl", False) + tc.generate() def build(self): - files.apply_conandata_patches(self) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "build", "cmake")) cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - files.rmdir(self, f"{self.package_folder}/lib/pkgconfig") - files.rmdir(self, f"{self.package_folder}/lib/cmake") - files.rm(self, "*.pdb", f"{self.package_folder}/lib") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) def package_info(self): glewlib_target_name = "glew" if self.options.shared else "glew_s" diff --git a/recipes/glew/all/patches/0001-fix-cmake-2.1.0.patch b/recipes/glew/all/patches/0001-fix-cmake-2.1.0.patch new file mode 100644 index 0000000000000..d64b6d88a9c4b --- /dev/null +++ b/recipes/glew/all/patches/0001-fix-cmake-2.1.0.patch @@ -0,0 +1,15 @@ +--- a/build/cmake/CMakeLists.txt ++++ b/build/cmake/CMakeLists.txt +@@ -1,10 +1,10 @@ ++cmake_minimum_required (VERSION 2.8.12) ++project (glew C) + if ( NOT DEFINED CMAKE_BUILD_TYPE ) + set( CMAKE_BUILD_TYPE Release CACHE STRING "Build type" ) + endif () + +-project (glew) + +-cmake_minimum_required (VERSION 2.8.12) + + include(GNUInstallDirs) + diff --git a/recipes/glew/all/patches/0001-fix-cmake-2.2.0.patch b/recipes/glew/all/patches/0001-fix-cmake-2.2.0.patch new file mode 100644 index 0000000000000..8373c5364c4dd --- /dev/null +++ b/recipes/glew/all/patches/0001-fix-cmake-2.2.0.patch @@ -0,0 +1,15 @@ +--- a/build/cmake/CMakeLists.txt ++++ b/build/cmake/CMakeLists.txt +@@ -1,10 +1,10 @@ ++cmake_minimum_required (VERSION 2.8.12) ++project (glew C) + if ( NOT DEFINED CMAKE_BUILD_TYPE ) + set( CMAKE_BUILD_TYPE Release CACHE STRING "Build type" ) + endif () + +-project (glew C) + +-cmake_minimum_required (VERSION 2.8.12) + + include(GNUInstallDirs) + diff --git a/recipes/glew/all/patches/vs16-release-fix.patch b/recipes/glew/all/patches/0002-vs16-release-fix.patch similarity index 100% rename from recipes/glew/all/patches/vs16-release-fix.patch rename to recipes/glew/all/patches/0002-vs16-release-fix.patch diff --git a/recipes/glew/all/test_package/CMakeLists.txt b/recipes/glew/all/test_package/CMakeLists.txt index d69e64cd58c7d..f7e367639f538 100644 --- a/recipes/glew/all/test_package/CMakeLists.txt +++ b/recipes/glew/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(GLEW REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} GLEW::GLEW) +target_link_libraries(${PROJECT_NAME} PRIVATE GLEW::GLEW) diff --git a/recipes/glew/all/test_package/conanfile.py b/recipes/glew/all/test_package/conanfile.py index a831367c532bc..0a6bc68712d90 100644 --- a/recipes/glew/all/test_package/conanfile.py +++ b/recipes/glew/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/glew/all/test_v1_package/CMakeLists.txt b/recipes/glew/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..abaffb362cf82 --- /dev/null +++ b/recipes/glew/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(GLEW REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE GLEW::GLEW) diff --git a/recipes/glew/all/test_v1_package/conanfile.py b/recipes/glew/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/glew/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/glfw/all/conandata.yml b/recipes/glfw/all/conandata.yml index f81e146ca342e..43e8790efbe29 100644 --- a/recipes/glfw/all/conandata.yml +++ b/recipes/glfw/all/conandata.yml @@ -1,25 +1,32 @@ sources: "3.3.8": - url: "https://github.com/glfw/glfw/archive/refs/tags/3.3.8.tar.gz" - sha256: "f30f42e05f11e5fc62483e513b0488d5bceeab7d9c5da0ffe2252ad81816c713" + url: "https://github.com/glfw/glfw/releases/download/3.3.8/glfw-3.3.8.zip" + sha256: "4d025083cc4a3dd1f91ab9b9ba4f5807193823e565a5bcf4be202669d9911ea6" "3.3.7": - url: "https://github.com/glfw/glfw/archive/refs/tags/3.3.7.tar.gz" - sha256: "fd21a5f65bcc0fc3c76e0f8865776e852de09ef6fbc3620e09ce96d2b2807e04" + url: "https://github.com/glfw/glfw/releases/download/3.3.7/glfw-3.3.7.zip" + sha256: "4ef0c544a8ace9a6cd0e0aef8250090f89fea1bf96e9fc1d9d6f76386c290c9c" "3.3.6": - url: "https://github.com/glfw/glfw/archive/refs/tags/3.3.6.tar.gz" - sha256: "ed07b90e334dcd39903e6288d90fa1ae0cf2d2119fec516cf743a0a404527c02" + url: "https://github.com/glfw/glfw/releases/download/3.3.6/glfw-3.3.6.zip" + sha256: "45537305d44c0a9f3612d4ec4a48414547cf854bff3ed613078f7ec648a12781" "3.3.5": - url: "https://github.com/glfw/glfw/archive/refs/tags/3.3.5.tar.gz" - sha256: "32fdb8705784adfe3082f97e0d41e7c515963e977b5a14c467a887cf0da827b5" + url: "https://github.com/glfw/glfw/releases/download/3.3.5/glfw-3.3.5.zip" + sha256: "98a8639cfcd4f9ed2748cfa531c217e0364b64884b43e3336c62c58802eaa34f" "3.3.4": - url: "https://github.com/glfw/glfw/archive/3.3.4.tar.gz" - sha256: "cc8ac1d024a0de5fd6f68c4133af77e1918261396319c24fd697775a6bc93b63" + url: "https://github.com/glfw/glfw/releases/download/3.3.4/glfw-3.3.4.zip" + sha256: "bbd2c42c660b725e9755eb417e40b373f0d4c03138c9b2e210d02cd308bd99cd" "3.3.3": - sha256: aa9922b55a464d5bab58fcbe5a619f517d54e3dc122361c116de573670006a7a - url: https://github.com/glfw/glfw/archive/3.3.3.tar.gz + url: "https://github.com/glfw/glfw/releases/download/3.3.3/glfw-3.3.3.zip" + sha256: "723087ad45b40cd333be7d1a2cd5e09a28facb7f3acdb69f3e5613bd20543977" "3.3.2": - sha256: 98768e12e615fbe9f3386f5bbfeb91b5a3b45a8c4c77159cef06b1f6ff749537 - url: https://github.com/glfw/glfw/archive/3.3.2.tar.gz + url: "https://github.com/glfw/glfw/releases/download/3.3.2/glfw-3.3.2.zip" + sha256: "08a33a512f29d7dbf78eab39bd7858576adcc95228c9efe8e4bc5f0f3261efc7" patches: "3.3.2": - - patch_file: "patches/fix-objc-cmake3.19+.patch" + - patch_file: "patches/3.3.2-0001-fix-objc-cmake3.19+.patch" + patch_description: "Fix ObjC handling while using recent CMake versions" + patch_type: "portability" + patch_source: "https://github.com/glfw/glfw/commit/3327050ca66ad34426a82c217c2d60ced61526b7" + - patch_file: "patches/3.3.2-0002-macos-relocatable.patch" + patch_description: "Relocatable shared lib on macOS" + patch_type: "portability" + patch_source: "https://github.com/glfw/glfw/commit/5a15d8a7842fbc4b5260eac2335a6691bca9be4b" diff --git a/recipes/glfw/all/conanfile.py b/recipes/glfw/all/conanfile.py index d6725333c6023..420995ba769e7 100644 --- a/recipes/glfw/all/conanfile.py +++ b/recipes/glfw/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os import textwrap -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class GlfwConan(ConanFile): @@ -31,8 +31,7 @@ class GlfwConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -40,26 +39,20 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("opengl/system") if self.options.vulkan_static: - self.requires("vulkan-loader/1.3.216.0") + self.requires("vulkan-loader/1.3.236.0") if self.settings.os in ["Linux", "FreeBSD"]: self.requires("xorg/system") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -80,16 +73,26 @@ def _patch_sources(self): # don't force PIC replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "POSITION_INDEPENDENT_CODE ON", "") + # don't force static link to libgcc if MinGW + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), + "target_link_libraries(glfw PRIVATE \"-static-libgcc\")", "") + # Allow to link vulkan-loader into shared glfw if self.options.vulkan_static: cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") - replace_in_file(self, cmakelists, - 'message(FATAL_ERROR "You are trying to link the Vulkan loader static library into the GLFW shared library")', - "") - replace_in_file(self, cmakelists, - 'list(APPEND glfw_PKG_DEPS "vulkan")', - ('list(APPEND glfw_PKG_DEPS "vulkan")\n' - 'list(APPEND glfw_LIBRARIES "{}")').format(self.deps_cpp_info["vulkan-loader"].libs[0])) + replace_in_file( + self, + cmakelists, + 'message(FATAL_ERROR "You are trying to link the Vulkan loader static library into the GLFW shared library")', + "", + ) + vulkan_lib = self.dependencies["vulkan-loader"].cpp_info.libs[0] + replace_in_file( + self, + cmakelists, + 'list(APPEND glfw_PKG_DEPS "vulkan")', + f'list(APPEND glfw_PKG_DEPS "vulkan")\nlist(APPEND glfw_LIBRARIES "{vulkan_lib}")', + ) def build(self): self._patch_sources() @@ -111,17 +114,17 @@ def package(self): def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) + """) save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "glfw3") @@ -130,15 +133,19 @@ def package_info(self): libname = "glfw" if self.settings.os == "Windows" or not self.options.shared: libname += "3" - if is_msvc(self) and self.options.shared: + if self.settings.os == "Windows" and self.options.shared: libname += "dll" + self.cpp_info.defines.append("GLFW_DLL") self.cpp_info.libs = [libname] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "pthread", "dl", "rt"]) elif self.settings.os == "Windows": self.cpp_info.system_libs.append("gdi32") elif self.settings.os == "Macos": - self.cpp_info.frameworks.extend(["Cocoa", "IOKit", "CoreFoundation"]) + self.cpp_info.frameworks.extend([ + "AppKit", "Cocoa", "CoreFoundation", "CoreGraphics", + "CoreServices", "Foundation", "IOKit", + ]) # backward support of cmake_find_package, cmake_find_package_multi & pkg_config generators self.cpp_info.filenames["cmake_find_package"] = "glfw3" @@ -148,11 +155,3 @@ def package_info(self): self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] self.cpp_info.names["pkg_config"] = "glfw3" - - # FIXME: shouldn't be necessary. - # It's a workaround to support conan v1 generators - self.cpp_info.requires.append("opengl::opengl") - if self.options.vulkan_static: - self.cpp_info.requires.append("vulkan-loader::vulkan-loader") - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.requires.append("xorg::xorg") diff --git a/recipes/glfw/all/patches/3.3.2-0001-fix-objc-cmake3.19+.patch b/recipes/glfw/all/patches/3.3.2-0001-fix-objc-cmake3.19+.patch new file mode 100644 index 0000000000000..54c1246a85ae3 --- /dev/null +++ b/recipes/glfw/all/patches/3.3.2-0001-fix-objc-cmake3.19+.patch @@ -0,0 +1,11 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -72,7 +72,7 @@ if (_GLFW_X11 OR _GLFW_WAYLAND) + endif() + endif() + +-if (APPLE) ++if ("${CMAKE_VERSION}" VERSION_LESS "3.16" AND APPLE) + # For some reason CMake didn't know about .m until version 3.16 + set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m + cocoa_window.m nsgl_context.m PROPERTIES diff --git a/recipes/glfw/all/patches/3.3.2-0002-macos-relocatable.patch b/recipes/glfw/all/patches/3.3.2-0002-macos-relocatable.patch new file mode 100644 index 0000000000000..82f93cbaed918 --- /dev/null +++ b/recipes/glfw/all/patches/3.3.2-0002-macos-relocatable.patch @@ -0,0 +1,11 @@ +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -160,8 +160,6 @@ if (BUILD_SHARED_LIBS) + # Add -fno-common to work around a bug in Apple's GCC + target_compile_options(glfw PRIVATE "-fno-common") + +- set_target_properties(glfw PROPERTIES +- INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}") + endif() + + if (UNIX) diff --git a/recipes/glfw/all/patches/fix-objc-cmake3.19+.patch b/recipes/glfw/all/patches/fix-objc-cmake3.19+.patch deleted file mode 100644 index c932c8027d74a..0000000000000 --- a/recipes/glfw/all/patches/fix-objc-cmake3.19+.patch +++ /dev/null @@ -1,12 +0,0 @@ -from https://github.com/glfw/glfw/commit/3327050ca66ad34426a82c217c2d60ced61526b7 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -72,7 +72,7 @@ if (_GLFW_X11 OR _GLFW_WAYLAND) - endif() - endif() - --if (APPLE) -+if ("${CMAKE_VERSION}" VERSION_LESS "3.16" AND APPLE) - # For some reason CMake didn't know about .m until version 3.16 - set_source_files_properties(cocoa_init.m cocoa_joystick.m cocoa_monitor.m - cocoa_window.m nsgl_context.m PROPERTIES diff --git a/recipes/glfw/all/test_package/conanfile.py b/recipes/glfw/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/glfw/all/test_package/conanfile.py +++ b/recipes/glfw/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/glfw/all/test_v1_package/CMakeLists.txt b/recipes/glfw/all/test_v1_package/CMakeLists.txt index a361461ee15b8..0d20897301b68 100644 --- a/recipes/glfw/all/test_v1_package/CMakeLists.txt +++ b/recipes/glfw/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(glfw3 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE glfw) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/glfw/all/test_v1_package/conanfile.py b/recipes/glfw/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/glfw/all/test_v1_package/conanfile.py +++ b/recipes/glfw/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/glib/all/conandata.yml b/recipes/glib/all/conandata.yml index 60927f8873709..f4326e0c010b2 100644 --- a/recipes/glib/all/conandata.yml +++ b/recipes/glib/all/conandata.yml @@ -1,32 +1,28 @@ sources: - "2.68.3": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.68.3/glib-2.68.3.tar.gz" - sha256: "465c0727dd5505e998ebb1dae7c38683440dc6d6beffbca6bbf3eaabdb4f6ac7" - "2.69.3": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.69.3/glib-2.69.3.tar.gz" - sha256: "290f05eb5affd1bac142010d6511c7a3de361e5f69addc677cf6b3c92a757b44" - "2.70.4": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.70.4/glib-2.70.4.tar.gz" - sha256: "23461c4e694b465fad32ea677b3abc9306fa8511d12e915aee09b53f362c7fff" - "2.71.3": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.71.3/glib-2.71.3.tar.gz" - sha256: "08e17cf608f5ac3462092bff13828c1c0aab37c5b4827d4e17b948215b4e40ea" - "2.72.1": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.72.1/glib-2.72.1.tar.gz" - sha256: "4a345987a9ee7709417f5a5c6f4eeec2497bc2a913f14c1b9bdc403409d5ffb7" - "2.73.0": - url: "https://gitlab.gnome.org/GNOME/glib/-/archive/2.73.0/glib-2.73.0.tar.gz" - sha256: "3f573319adbdf572d79255e8bae85c7e2902d1aa6177d2646605a00c0a607eca" - "2.73.1": - url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.1.tar.xz" - sha256: "77b21da5bd195a8e5f751206a2acab477636e3d02fe4f3796ede5788255382ae" - "2.73.2": - url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.2.tar.xz" - sha256: "5f3ee36e34f4aaab393c3e3dc46fb01b32f7ead6c88d41d7f20d88a49cdef1d9" + "2.75.3": + url: "https://download.gnome.org/sources/glib/2.75/glib-2.75.3.tar.xz" + sha256: "7c517d0aff456c35a039bce8a8df7a08ce95a8285b09d1849f8865f633f7f871" + "2.75.2": + url: "https://download.gnome.org/sources/glib/2.75/glib-2.75.2.tar.xz" + sha256: "360d6fb75202c0eb0d07f0ab812b19b526f1c05ccc0a8ed7e5d2c988616d343a" + "2.75.1": + url: "https://download.gnome.org/sources/glib/2.75/glib-2.75.1.tar.xz" + sha256: "96fd22355a542cca96c31082f2d09b72cb5a3454b6ea60c1be17c987a18a6b93" + "2.75.0": + url: "https://download.gnome.org/sources/glib/2.75/glib-2.75.0.tar.xz" + sha256: "6dde8e55cc4a2c83d96797120b08bcffb5f645b2e212164ae22d63c40e0e6360" + "2.74.1": + url: "https://download.gnome.org/sources/glib/2.74/glib-2.74.1.tar.xz" + sha256: "0ab981618d1db47845e56417b0d7c123f81a3427b2b9c93f5a46ff5bbb964964" "2.73.3": url: "https://download.gnome.org/sources/glib/2.73/glib-2.73.3.tar.xz" sha256: "df1a2b841667d6b48b2ef6969ebda4328243829f6e45866726f806f90f64eead" + "2.72.4": + url: "https://download.gnome.org/sources/glib/2.72/glib-2.72.4.tar.xz" + sha256: "8848aba518ba2f4217d144307a1d6cb9afcc92b54e5c13ac1f8c4d4608e96f0e" patches: - "2.73.1": - - patch_file: "patches/f2ea67ae441bc6059b43a1051dd0b750fe5f6301.patch" - base_path: "source_subfolder" + "2.73.3": + - patch_file: "patches/0001-2.73.3-clang-static-assert.patch" + patch_type: bugfix + patch_description: fix for clang compilation + patch_source: https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2898 diff --git a/recipes/glib/all/conanfile.py b/recipes/glib/all/conanfile.py index d2ec7ab6cd157..54e3429735b13 100644 --- a/recipes/glib/all/conanfile.py +++ b/recipes/glib/all/conanfile.py @@ -1,26 +1,28 @@ -import functools -import os -import glob -import shutil - from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import cross_building -from conan.tools import files, scm +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain from conan.tools.microsoft import is_msvc -from conans import tools, Meson, VisualStudioBuildEnvironment +from conan.tools.scm import Version +import os +import shutil + -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class GLibConan(ConanFile): name = "glib" - description = "GLib provides the core application building blocks for libraries and applications written in C" - topics = ("glib", "gobject", "gio", "gmodule") + description = ("Low-level core library that forms the basis for projects such as GTK+ and GNOME. " + "It provides data structure handling for C, portability wrappers, and interfaces for such runtime functionality as an event loop, threads, dynamic loading, and an object system.") + topics = "gio", "gmodule", "gnome", "gobject", "gtk" url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.gnome.org/GNOME/glib" - license = "LGPL-2.1" - + license = "LGPL-2.1-or-later" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -38,28 +40,14 @@ class GLibConan(ConanFile): "with_mount": True, "with_selinux": True, } - short_paths = True - generators = "pkg_config" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if scm.Version(self.version) < "2.71.1": - self.options.shared = True if self.settings.os != "Linux": del self.options.with_mount del self.options.with_selinux @@ -68,15 +56,18 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") - self.requires("libffi/3.4.2") + self.requires("zlib/1.2.13") + self.requires("libffi/3.4.3") if self.options.with_pcre: - if scm.Version(self.version) >= "2.73.2": + if Version(self.version) >= "2.73.2": self.requires("pcre2/10.40") else: self.requires("pcre/8.45") @@ -90,91 +81,66 @@ def requirements(self): # for Linux, gettext is provided by libc self.requires("libgettext/0.21") - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.requires("libiconv/1.17") def validate(self): - if hasattr(self, 'settings_build') and cross_building(self, skip_x64_x86=True): - raise ConanInvalidConfiguration("Cross-building not implemented") - if scm.Version(self.version) >= "2.69.0" and not self.options.with_pcre: + if not self.info.options.with_pcre: raise ConanInvalidConfiguration("option glib:with_pcre must be True for glib >= 2.69.0") - if self.settings.os == "Windows" and not self.options.shared and scm.Version(self.version) < "2.71.1": - raise ConanInvalidConfiguration( - "glib < 2.71.1 can not be built as static library on Windows. " - "see https://gitlab.gnome.org/GNOME/glib/-/issues/692" - ) - if scm.Version(self.version) < "2.67.0" and not is_msvc(self) and not self.options.with_elf: - raise ConanInvalidConfiguration("libelf dependency can't be disabled in glib < 2.67.0") def build_requirements(self): - self.build_requires("meson/0.61.2") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("meson/0.64.1") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): - files.get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - @functools.lru_cache(1) - def _configure_meson(self): - meson = Meson(self) - defs = {} - if tools.is_apple_os(self.settings.os): - defs["iconv"] = "external" # https://gitlab.gnome.org/GNOME/glib/issues/1557 - defs["selinux"] = "enabled" if self.options.get_safe("with_selinux") else "disabled" - defs["libmount"] = "enabled" if self.options.get_safe("with_mount") else "disabled" - - if scm.Version(self.version) < "2.69.0": - defs["internal_pcre"] = not self.options.with_pcre - + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + tc = PkgConfigDeps(self) + tc.generate() + tc = MesonToolchain(self) + + if is_apple_os(self) and Version(self.version) < "2.75.1": + tc.project_options["iconv"] = "external" # https://gitlab.gnome.org/GNOME/glib/issues/1557 + tc.project_options["selinux"] = "enabled" if self.options.get_safe("with_selinux") else "disabled" + tc.project_options["libmount"] = "enabled" if self.options.get_safe("with_mount") else "disabled" if self.settings.os == "FreeBSD": - defs["xattr"] = "false" - if scm.Version(self.version) >= "2.67.2": - defs["tests"] = "false" - - if scm.Version(self.version) >= "2.67.0": - defs["libelf"] = "enabled" if self.options.get_safe("with_elf") else "disabled" - - meson.configure( - source_folder=self._source_subfolder, - args=["--wrap-mode=nofallback"], - build_folder=self._build_subfolder, - defs=defs, - ) - return meson + tc.project_options["xattr"] = "false" + tc.project_options["tests"] = "false" + tc.project_options["libelf"] = "enabled" if self.options.get_safe("with_elf") else "disabled" + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if scm.Version(self.version) < "2.67.2": - tools.replace_in_file( - os.path.join(self._source_subfolder, "meson.build"), - "build_tests = not meson.is_cross_build() or (meson.is_cross_build() and meson.has_exe_wrapper())", - "build_tests = false", - ) - tools.replace_in_file( - os.path.join(self._source_subfolder, "meson.build"), + apply_conandata_patches(self) + replace_in_file(self, + os.path.join(self.source_folder, "meson.build"), "subdir('fuzzing')", "#subdir('fuzzing')", ) # https://gitlab.gnome.org/GNOME/glib/-/issues/2152 - if scm.Version(self.version) < "2.73.2": + if Version(self.version) < "2.73.2": for filename in [ - os.path.join(self._source_subfolder, "meson.build"), - os.path.join(self._source_subfolder, "glib", "meson.build"), - os.path.join(self._source_subfolder, "gobject", "meson.build"), - os.path.join(self._source_subfolder, "gio", "meson.build"), + os.path.join(self.source_folder, "meson.build"), + os.path.join(self.source_folder, "glib", "meson.build"), + os.path.join(self.source_folder, "gobject", "meson.build"), + os.path.join(self.source_folder, "gio", "meson.build"), ]: - tools.replace_in_file(filename, "subdir('tests')", "#subdir('tests')") + replace_in_file(self, filename, "subdir('tests')", "#subdir('tests')") if self.settings.os != "Linux": # allow to find gettext - tools.replace_in_file( - os.path.join(self._source_subfolder, "meson.build"), - "libintl = cc.find_library('intl', required : false)" if scm.Version(self.version) < "2.73.1" \ - else "libintl = dependency('intl', required: false)", - "libintl = dependency('libgettext', method : 'pkg-config', required : false)", + replace_in_file(self, + os.path.join(self.source_folder, "meson.build"), + "libintl = cc.find_library('intl', required : false" if Version(self.version) < "2.73.1" \ + else "libintl = dependency('intl', required: false", + "libintl = dependency('libgettext', method : 'pkg-config', required : false", ) - tools.replace_in_file( + replace_in_file(self, os.path.join( - self._source_subfolder, + self.source_folder, "gio", "gdbus-2.0", "codegen", @@ -183,47 +149,29 @@ def _patch_sources(self): "'share'", "'res'", ) - if self.settings.os != "Linux": - tools.replace_in_file( - os.path.join(self._source_subfolder, "meson.build"), - "if cc.has_function('ngettext'", - "if false #cc.has_function('ngettext'", - ) def build(self): self._patch_sources() - with tools.environment_append( - VisualStudioBuildEnvironment(self).vars - ) if is_msvc(self) else tools.no_op(): - meson = self._configure_meson() - meson.build() - - def _fix_library_names(self): - if self.settings.compiler == "Visual Studio": - with tools.chdir(os.path.join(self.package_folder, "lib")): - for filename_old in glob.glob("*.a"): - filename_new = filename_old[3:-2] + ".lib" - self.output.info(f"rename {filename_old} into {filename_new}") - shutil.move(filename_old, filename_new) + meson = Meson(self) + meson.configure() + meson.build() def package(self): - if scm.Version(self.version) < "2.73.0": - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) + if Version(self.version) < "2.73.0": + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) else: - self.copy(pattern="LGPL-2.1-or-later.txt", dst="licenses", src=os.path.join(self._source_subfolder, "LICENSES")) - with tools.environment_append( - VisualStudioBuildEnvironment(self).vars - ) if is_msvc(self) else tools.no_op(): - meson = self._configure_meson() - meson.install() - self._fix_library_names() - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, pattern="LGPL-2.1-or-later.txt", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "LICENSES")) + meson = Meson(self) + meson.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "libexec")) shutil.move( os.path.join(self.package_folder, "share"), os.path.join(self.package_folder, "res"), ) - for pdb_file in glob.glob(os.path.join(self.package_folder, "bin", "*.pdb")): - os.unlink(pdb_file) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) def package_info(self): self.cpp_info.components["glib-2.0"].set_property("pkg_config_name", "glib-2.0") @@ -232,9 +180,11 @@ def package_info(self): os.path.join("include", "glib-2.0"), os.path.join("lib", "glib-2.0", "include") ] + self.cpp_info.components["glib-2.0"].resdirs = ["res"] self.cpp_info.components["gmodule-no-export-2.0"].set_property("pkg_config_name", "gmodule-no-export-2.0") self.cpp_info.components["gmodule-no-export-2.0"].libs = ["gmodule-2.0"] + self.cpp_info.components["gmodule-no-export-2.0"].resdirs = ["res"] self.cpp_info.components["gmodule-no-export-2.0"].requires.append("glib-2.0") self.cpp_info.components["gmodule-export-2.0"].set_property("pkg_config_name", "gmodule-export-2.0") @@ -245,14 +195,17 @@ def package_info(self): self.cpp_info.components["gobject-2.0"].set_property("pkg_config_name", "gobject-2.0") self.cpp_info.components["gobject-2.0"].libs = ["gobject-2.0"] + self.cpp_info.components["gobject-2.0"].resdirs = ["res"] self.cpp_info.components["gobject-2.0"].requires += ["glib-2.0", "libffi::libffi"] self.cpp_info.components["gthread-2.0"].set_property("pkg_config_name", "gthread-2.0") self.cpp_info.components["gthread-2.0"].libs = ["gthread-2.0"] + self.cpp_info.components["gthread-2.0"].resdirs = ["res"] self.cpp_info.components["gthread-2.0"].requires.append("glib-2.0") self.cpp_info.components["gio-2.0"].set_property("pkg_config_name", "gio-2.0") self.cpp_info.components["gio-2.0"].libs = ["gio-2.0"] + self.cpp_info.components["gio-2.0"].resdirs = ["res"] self.cpp_info.components["gio-2.0"].requires += ["glib-2.0", "gobject-2.0", "gmodule-2.0", "zlib::zlib"] self.cpp_info.components["gresource"].set_property("pkg_config_name", "gresource") @@ -270,9 +223,11 @@ def package_info(self): if self.settings.os == "Windows": self.cpp_info.components["glib-2.0"].system_libs += ["ws2_32", "ole32", "shell32", "user32", "advapi32"] self.cpp_info.components["gio-2.0"].system_libs.extend(["iphlpapi", "dnsapi", "shlwapi"]) + self.cpp_info.components["gio-windows-2.0"].set_property("pkg_config_name", "gio-windows-2.0") self.cpp_info.components["gio-windows-2.0"].requires = ["gobject-2.0", "gmodule-no-export-2.0", "gio-2.0"] self.cpp_info.components["gio-windows-2.0"].includedirs = [os.path.join("include", "gio-win32-2.0")] else: + self.cpp_info.components["gio-unix-2.0"].set_property("pkg_config_name", "gio-unix-2.0") self.cpp_info.components["gio-unix-2.0"].requires += ["gobject-2.0", "gio-2.0"] self.cpp_info.components["gio-unix-2.0"].includedirs = [os.path.join("include", "gio-unix-2.0")] @@ -281,11 +236,11 @@ def package_info(self): self.cpp_info.components["glib-2.0"].frameworks += ["Foundation", "CoreServices", "CoreFoundation"] self.cpp_info.components["gio-2.0"].frameworks.append("AppKit") - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.components["glib-2.0"].requires.append("libiconv::libiconv") if self.options.with_pcre: - if scm.Version(self.version) >= "2.73.2": + if Version(self.version) >= "2.73.2": self.cpp_info.components["glib-2.0"].requires.append("pcre2::pcre2") else: self.cpp_info.components["glib-2.0"].requires.append("pcre::pcre") @@ -313,7 +268,8 @@ def package_info(self): 'datadir': '${prefix}/res', 'schemasdir': '${datadir}/glib-2.0/schemas', 'bindir': '${prefix}/bin', - 'giomoduledir': '${libdir}/gio/modules', + # Can't use libdir here as it is libdir1 when using the PkgConfigDeps generator. + 'giomoduledir': '${prefix}/lib/gio/modules', 'gio': '${bindir}/gio', 'gio_querymodules': '${bindir}/gio-querymodules', 'glib_compile_schemas': '${bindir}/glib-compile-schemas', @@ -336,3 +292,19 @@ def package_info(self): self.cpp_info.components["glib-2.0"].set_property( "pkg_config_custom_content", "\n".join(f"{key}={value}" for key, value in pkgconfig_variables.items())) + +def fix_msvc_libname(conanfile, remove_lib_prefix=True): + """remove lib prefix & change extension to .lib""" + from conan.tools.files import rename + import glob + if not is_msvc(conanfile): + return + libdirs = getattr(conanfile.cpp.package, "libdirs") + for libdir in libdirs: + for ext in [".dll.a", ".dll.lib", ".a"]: + full_folder = os.path.join(conanfile.package_folder, libdir) + for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")): + libname = os.path.basename(filepath)[0:-len(ext)] + if remove_lib_prefix and libname[0:3] == "lib": + libname = libname[3:] + rename(conanfile, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib")) diff --git a/recipes/glib/all/patches/0001-2.73.3-clang-static-assert.patch b/recipes/glib/all/patches/0001-2.73.3-clang-static-assert.patch new file mode 100644 index 0000000000000..c46f5e071d71c --- /dev/null +++ b/recipes/glib/all/patches/0001-2.73.3-clang-static-assert.patch @@ -0,0 +1,33 @@ +diff --git a/gio/gio-launch-desktop.c b/gio/gio-launch-desktop.c +index 29bf9d5d4..47717b987 100644 +--- a/gio/gio-launch-desktop.c ++++ b/gio/gio-launch-desktop.c +@@ -39,7 +39,6 @@ + + #if defined(__linux__) && !defined(__BIONIC__) + #include +-#include + #include + #include + #include +@@ -48,6 +47,9 @@ + #include + + #include "gjournal-private.h" ++#define GLIB_COMPILATION ++#include "gmacros.h" /* For G_STATIC_ASSERT define */ ++#undef GLIB_COMPILATION + + /* + * write_all: +@@ -119,8 +121,8 @@ journal_stream_fd (const char *identifier, + /* Arbitrary large size for the sending buffer, from systemd */ + int large_buffer_size = 8 * 1024 * 1024; + +- static_assert (LOG_EMERG == 0, "Linux ABI defines LOG_EMERG"); +- static_assert (LOG_DEBUG == 7, "Linux ABI defines LOG_DEBUG"); ++ G_STATIC_ASSERT (LOG_EMERG == 0 && sizeof "Linux ABI defines LOG_EMERG"); ++ G_STATIC_ASSERT (LOG_DEBUG == 7 && sizeof "Linux ABI defines LOG_DEBUG"); + + fd = socket (AF_UNIX, SOCK_STREAM | SOCK_CLOEXEC, 0); + diff --git a/recipes/glib/all/patches/f2ea67ae441bc6059b43a1051dd0b750fe5f6301.patch b/recipes/glib/all/patches/f2ea67ae441bc6059b43a1051dd0b750fe5f6301.patch deleted file mode 100644 index 0d4711bf3c497..0000000000000 --- a/recipes/glib/all/patches/f2ea67ae441bc6059b43a1051dd0b750fe5f6301.patch +++ /dev/null @@ -1,25 +0,0 @@ -From f2ea67ae441bc6059b43a1051dd0b750fe5f6301 Mon Sep 17 00:00:00 2001 -From: ericLemanissier -Date: Thu, 23 Jun 2022 08:26:21 +0000 -Subject: [PATCH] use gvdb as a subproject - -this fixes the build when using --wrap-mode=nofallback -fix proposed by @eschwartz ---- - meson.build | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/meson.build b/meson.build -index 1234ba064..3da0010af 100644 ---- a/meson.build -+++ b/meson.build -@@ -2042,6 +2042,7 @@ else - endif - - # Import the gvdb sources as a subproject to avoid having the copylib in-tree -+subproject('gvdb') - gvdb_dep = dependency('gvdb') - - libm = cc.find_library('m', required : false) --- -GitLab diff --git a/recipes/glib/all/test_package/CMakeLists.txt b/recipes/glib/all/test_package/CMakeLists.txt index 963dd3465174a..44f2423e0f831 100644 --- a/recipes/glib/all/test_package/CMakeLists.txt +++ b/recipes/glib/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.6) +project(test_package LANGUAGES C) add_executable(${PROJECT_NAME} test_package.c) -if (WIN32) +if (CMAKE_SYSTEM_NAME STREQUAL "Windows") find_package(glib CONFIG REQUIRED) - target_link_libraries(${PROJECT_NAME} glib::glib-2.0 glib::gio-2.0 glib::gmodule-2.0 glib::gobject-2.0 glib::gthread-2.0) + target_link_libraries(${PROJECT_NAME} PRIVATE glib::glib-2.0 glib::gio-2.0 glib::gmodule-2.0 glib::gobject-2.0 glib::gthread-2.0) else() find_package(PkgConfig REQUIRED) pkg_check_modules(glib-2.0 REQUIRED IMPORTED_TARGET glib-2.0) @@ -16,5 +13,5 @@ else() pkg_check_modules(gmodule-2.0 REQUIRED IMPORTED_TARGET gmodule-2.0) pkg_check_modules(gobject-2.0 REQUIRED IMPORTED_TARGET gobject-2.0) pkg_check_modules(gthread-2.0 REQUIRED IMPORTED_TARGET gthread-2.0) - target_link_libraries(${PROJECT_NAME} PkgConfig::glib-2.0 PkgConfig::gio-2.0 PkgConfig::gmodule-2.0 PkgConfig::gobject-2.0 PkgConfig::gthread-2.0) + target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::glib-2.0 PkgConfig::gio-2.0 PkgConfig::gmodule-2.0 PkgConfig::gobject-2.0 PkgConfig::gthread-2.0) endif() diff --git a/recipes/glib/all/test_package/conanfile.py b/recipes/glib/all/test_package/conanfile.py index e0bb16725b050..22973c4baccc5 100644 --- a/recipes/glib/all/test_package/conanfile.py +++ b/recipes/glib/all/test_package/conanfile.py @@ -1,22 +1,55 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.gnu import PkgConfig, PkgConfigDeps import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi", "pkg_config" + test_type = "explicit" - def build(self): - if self.settings.os != "Windows": - with tools.environment_append({'PKG_CONFIG_PATH': "."}): - pkg_config = tools.PkgConfig("gio-2.0") - self.run("%s -h" % pkg_config.variables["gdbus_codegen"], run_environment=True) + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + if self.settings.os != "Windows" and not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + virtual_run_env = VirtualRunEnv(self) + virtual_run_env.generate() + if self.settings.os == "Windows": + deps = CMakeDeps(self) + deps.generate() + else: + # todo Remove the following workaround after https://github.com/conan-io/conan/issues/11962 is fixed. + env = Environment() + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + envvars = env.vars(self) + envvars.save_script("pkg_config") + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() + + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + + if self.settings.os != "Windows": + pkg_config = PkgConfig(self, "gio-2.0", pkg_config_path=self.generators_folder) + gdbus_codegen = pkg_config.variables["gdbus_codegen"] + self.run(f"{gdbus_codegen} -h", env="conanrun") diff --git a/recipes/glib/all/test_package/test_package.c b/recipes/glib/all/test_package/test_package.c index 8257bd8a6d523..c75317a5f7f06 100644 --- a/recipes/glib/all/test_package/test_package.c +++ b/recipes/glib/all/test_package/test_package.c @@ -14,7 +14,7 @@ int main() { GQueue *queue = g_queue_new(); g_queue_free(queue); - g_module_supported(); + printf("glib module supported: %s\n", g_module_supported() ? "true" : "false"); GMutex m; g_mutex_init(&m); diff --git a/recipes/glib/all/test_v1_package/CMakeLists.txt b/recipes/glib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/glib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/glib/all/test_v1_package/conanfile.py b/recipes/glib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ed236807fcf7e --- /dev/null +++ b/recipes/glib/all/test_v1_package/conanfile.py @@ -0,0 +1,27 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi", "pkg_config" + + def build_requirements(self): + if self.settings.os != "Windows": + self.build_requires("pkgconf/1.9.3") + + def build(self): + if self.settings.os != "Windows": + with tools.environment_append({'PKG_CONFIG_PATH': "."}): + pkg_config = tools.PkgConfig("gio-2.0") + self.run(f"{pkg_config.variables['gdbus_codegen']} -h", run_environment=True) + + with tools.environment_append({'PKG_CONFIG_PATH': "."}): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/glib/config.yml b/recipes/glib/config.yml index da93311de5e9b..4c2eeb2e952bd 100644 --- a/recipes/glib/config.yml +++ b/recipes/glib/config.yml @@ -1,19 +1,15 @@ versions: - "2.68.3": + "2.75.3": folder: all - "2.69.3": + "2.75.2": folder: all - "2.70.4": + "2.75.1": folder: all - "2.71.3": + "2.75.0": folder: all - "2.72.1": - folder: all - "2.73.0": - folder: all - "2.73.1": - folder: all - "2.73.2": + "2.74.1": folder: all "2.73.3": folder: all + "2.72.4": + folder: all diff --git a/recipes/glibmm/all/conandata.yml b/recipes/glibmm/all/conandata.yml index 9134c71e80aa3..171a01a50da60 100644 --- a/recipes/glibmm/all/conandata.yml +++ b/recipes/glibmm/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.75.0": + url: "https://download.gnome.org/sources/glibmm/2.75/glibmm-2.75.0.tar.xz" + sha256: "60bb12e66488aa8ce41f0eb2f3612f89f5ddc887e3e4d45498524bf60b266b3d" "2.72.1": url: "https://download.gnome.org/sources/glibmm/2.72/glibmm-2.72.1.tar.xz" sha256: "2a7649a28ab5dc53ac4dabb76c9f61599fbc628923ab6a7dd74bf675d9155cd8" @@ -7,13 +10,24 @@ sources: sha256: "199ace5682d81b15a1d565480b4a950682f2db6402c8aa5dd7217d71edff81d5" patches: + "2.75.0": + - patch_file: "patches/enable_static_libs_2_75_0.patch" + patch_type: portability + patch_description: enable static library build for msvc + - patch_file: "patches/fix_initialization_order_fiasco_2_75_0.patch" + patch_type: bugfix + patch_description: fix initialization order for static library "2.72.1": - patch_file: "patches/enable_static_libs_2_72_1.patch" - base_path: "source_subfolder" + patch_type: portability + patch_description: enable static library build for msvc - patch_file: "patches/fix_initialization_order_fiasco_2_72_1.patch" - base_path: "source_subfolder" + patch_type: bugfix + patch_description: fix initialization order for static library "2.66.4": - patch_file: "patches/enable_static_libs_2_66_4.patch" - base_path: "source_subfolder" + patch_type: portability + patch_description: enable static library build for msvc - patch_file: "patches/fix_initialization_order_fiasco_2_66_4.patch" - base_path: "source_subfolder" + patch_type: bugfix + patch_description: fix initialization order for static library diff --git a/recipes/glibmm/all/conanfile.py b/recipes/glibmm/all/conanfile.py index a29fb2820d60d..ea2efe10f2484 100644 --- a/recipes/glibmm/all/conanfile.py +++ b/recipes/glibmm/all/conanfile.py @@ -3,16 +3,27 @@ import shutil from conan import ConanFile -from conan.tools import ( - build, - files, - microsoft, - scm -) from conan.errors import ConanInvalidConfiguration -from conans import Meson, tools +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import check_min_cppstd +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, + copy, + export_conandata_patches, + get, + replace_in_file, + rename, + rm, + rmdir +) +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class GlibmmConan(ConanFile): @@ -25,14 +36,11 @@ class GlibmmConan(ConanFile): settings = "os", "compiler", "build_type", "arch" options = {"shared": [True, False], "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True} - - generators = "pkg_config" - exports_sources = "patches/**" short_paths = True @property def _abi_version(self): - return "2.68" if scm.Version(self.version) >= "2.68.0" else "2.4" + return "2.68" if Version(self.version) >= "2.68.0" else "2.4" @property def _glibmm_lib(self): @@ -42,130 +50,120 @@ def _glibmm_lib(self): def _giomm_lib(self): return f"giomm-{self._abi_version}" - def validate(self): - if hasattr(self, "settings_build") and build.cross_building(self): - raise ConanInvalidConfiguration("Cross-building not implemented") + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + if self.options.shared: + self.options["glib"].shared = True + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("glib/2.75.2") + if self._abi_version == "2.68": + self.requires("libsigcpp/3.0.7") + else: + self.requires("libsigcpp/2.10.8") + + def package_id(self): + if not self.dependencies["glib"].options.shared: + self.info.requires["glib"].full_package_mode() + def validate(self): if self.settings.compiler.get_safe("cppstd"): if self._abi_version == "2.68": - build.check_min_cppstd(self, 17) + check_min_cppstd(self, 17) else: - build.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) - if self.options.shared and not self.options["glib"].shared: + if self.options.shared and not self.dependencies["glib"].options.shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." ) - if self.options["glib"].shared and microsoft.is_msvc_static_runtime(self): - raise ConanInvalidConfiguration( - "Linking shared glib with the MSVC static runtime is not supported" - ) - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + if self.dependencies["glib"].options.shared and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("Linking shared glib with the MSVC static runtime is not supported") def build_requirements(self): - self.build_requires("meson/0.63.1") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("meson/1.0.0") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") - def requirements(self): - self.requires("glib/2.73.3") + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - if self._abi_version == "2.68": - self.requires("libsigcpp/3.0.7") - else: - self.requires("libsigcpp/2.10.8") + def generate(self): + env = VirtualBuildEnv(self) + env.generate() - def source(self): - files.get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + deps = PkgConfigDeps(self) + deps.generate() + + tc = MesonToolchain(self) + tc.project_options.update({ + "build-examples": "false", + "build-documentation": "false", + "msvc14x-parallel-installable": "false" + }) + tc.generate() def _patch_sources(self): - files.apply_conandata_patches(self) - meson_build = os.path.join(self._source_subfolder, "meson.build") - files.replace_in_file(self, meson_build, "subdir('tests')", "") - if microsoft.is_msvc(self): + apply_conandata_patches(self) + meson_build = os.path.join(self.source_folder, "meson.build") + replace_in_file(self, meson_build, "subdir('tests')", "") + if is_msvc(self): # GLiBMM_GEN_EXTRA_DEFS_STATIC is not defined anywhere and is not # used anywhere except here # when building a static build !defined(GLiBMM_GEN_EXTRA_DEFS_STATIC) # evaluates to 0 if not self.options.shared: - files.replace_in_file(self, - os.path.join(self._source_subfolder, "tools", - "extra_defs_gen", "generate_extra_defs.h"), - "#if defined (_MSC_VER) && !defined (GLIBMM_GEN_EXTRA_DEFS_STATIC)", - "#if 0", - ) + replace_in_file(self, + os.path.join(self.source_folder, "tools", + "extra_defs_gen", "generate_extra_defs.h"), + "#if defined (_MSC_VER) && !defined (GLIBMM_GEN_EXTRA_DEFS_STATIC)", + "#if 0", + ) # when using cpp_std=c++NM the /permissive- flag is added which # attempts enforcing standard conformant c++ code # the problem is that older versions of Windows SDK is not standard # conformant! see: # https://developercommunity.visualstudio.com/t/error-c2760-in-combaseapih-with-windows-sdk-81-and/185399 - files.replace_in_file(self, meson_build, "cpp_std=c++", "cpp_std=vc++") - - def configure(self): - if self.options.shared: - del self.options.fPIC - if self.options.shared: - self.options["glib"].shared = True + replace_in_file(self, meson_build, "cpp_std=c++", "cpp_std=vc++") def build(self): self._patch_sources() - with tools.environment_append(tools.RunEnvironment(self).vars): - meson = self._configure_meson() - meson.build() - - def _configure_meson(self): meson = Meson(self) - defs = { - "build-examples": "false", - "build-documentation": "false", - "msvc14x-parallel-installable": "false", - "default_library": "shared" if self.options.shared else "static", - } - - meson.configure( - defs=defs, - build_folder=self._build_subfolder, - source_folder=self._source_subfolder, - pkg_config_paths=[self.install_folder], - ) - - return meson + meson.configure() + meson.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() + def rename_msvc_static_libs(): + lib_folder = os.path.join(self.package_folder, "lib") + rename(self, os.path.join(lib_folder, f"libglibmm-{self._abi_version}.a"), + os.path.join(lib_folder, f"{self._glibmm_lib}.lib")) + rename(self, os.path.join(lib_folder, f"libgiomm-{self._abi_version}.a"), + os.path.join(lib_folder, f"{self._giomm_lib}.lib")) + rename(self, os.path.join(lib_folder, f"libglibmm_generate_extra_defs-{self._abi_version}.a"), + os.path.join(lib_folder, f"glibmm_generate_extra_defs-{self._abi_version}.lib")) + + meson = Meson(self) meson.install() - if microsoft.is_msvc(self): - files.rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + + if is_msvc(self): + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) if not self.options.shared: - files.rename( - self, - os.path.join(self.package_folder, "lib", f"libglibmm-{self._abi_version}.a"), - os.path.join(self.package_folder, "lib", f"{self._glibmm_lib}.lib") - ) - files.rename( - self, - os.path.join(self.package_folder, "lib", f"libgiomm-{self._abi_version}.a"), - os.path.join(self.package_folder, "lib", f"{self._giomm_lib}.lib") - ) - files.rename( - self, - os.path.join(self.package_folder, "lib", f"libglibmm_generate_extra_defs-{self._abi_version}.a"), - os.path.join(self.package_folder, "lib", f"glibmm_generate_extra_defs-{self._abi_version}.lib"), - ) + rename_msvc_static_libs() for directory in [self._glibmm_lib, self._giomm_lib]: directory_path = os.path.join(self.package_folder, "lib", directory, "include", "*.h") @@ -176,26 +174,18 @@ def package(self): ) for dir_to_remove in ["pkgconfig", self._glibmm_lib, self._giomm_lib]: - files.rmdir(self, os.path.join(self.package_folder, "lib", dir_to_remove)) + rmdir(self, os.path.join(self.package_folder, "lib", dir_to_remove)) + fix_apple_shared_install_name(self) def package_info(self): glibmm_component = f"glibmm-{self._abi_version}" - giomm_component = f"giomm-{self._abi_version}" - self.cpp_info.components[glibmm_component].set_property("pkg_config_name", glibmm_component) self.cpp_info.components[glibmm_component].libs = [glibmm_component] self.cpp_info.components[glibmm_component].includedirs = [os.path.join("include", glibmm_component)] + self.cpp_info.components[glibmm_component].requires = ["glib::gobject-2.0", "libsigcpp::libsigcpp"] - if self._abi_version == "2.68": - self.cpp_info.components[glibmm_component].requires = ["glib::gobject-2.0", "libsigcpp::sigc++"] - else: - self.cpp_info.components[glibmm_component].requires = ["glib::gobject-2.0", "libsigcpp::sigc++-2.0"] - + giomm_component = f"giomm-{self._abi_version}" self.cpp_info.components[giomm_component].set_property("pkg_config_name", giomm_component) self.cpp_info.components[giomm_component].libs = [giomm_component] - self.cpp_info.components[giomm_component].includedirs = [ os.path.join("include", giomm_component)] + self.cpp_info.components[giomm_component].includedirs = [os.path.join("include", giomm_component)] self.cpp_info.components[giomm_component].requires = [glibmm_component, "glib::gio-2.0"] - - def package_id(self): - if not self.options["glib"].shared: - self.info.requires["glib"].full_package_mode() diff --git a/recipes/glibmm/all/patches/enable_static_libs_2_75_0.patch b/recipes/glibmm/all/patches/enable_static_libs_2_75_0.patch new file mode 100644 index 0000000000000..f24c64bb5bd54 --- /dev/null +++ b/recipes/glibmm/all/patches/enable_static_libs_2_75_0.patch @@ -0,0 +1,32 @@ +diff --git a/glib/glibmmconfig.h.meson b/glib/glibmmconfig.h.meson +index ef4753d7..b926720b 100644 +--- a/glib/glibmmconfig.h.meson ++++ b/glib/glibmmconfig.h.meson +@@ -27,7 +27,9 @@ + # if defined(_MSC_VER) + # define GLIBMM_MSC 1 + # define GLIBMM_WIN32 1 +-# define GLIBMM_DLL 1 ++# ifndef GLIBMM_STATIC_LIB ++# define GLIBMM_DLL 1 ++# endif + # elif defined(__CYGWIN__) + # define GLIBMM_CONFIGURE 1 + # elif defined(__MINGW32__) +diff --git a/glib/meson.build b/glib/meson.build +index d16621e9..3eb8bc47 100644 +--- a/glib/meson.build ++++ b/glib/meson.build +@@ -37,12 +37,6 @@ pkg_conf_data.set('MSVC_TOOLSET_VER', msvc14x_toolset_ver) + + library_build_type = get_option('default_library') + +-if cpp_compiler.get_argument_syntax() == 'msvc' +- if library_build_type == 'static' or library_build_type == 'both' +- error('Static builds are not supported by MSVC-style builds') +- endif +-endif +- + if library_build_type == 'static' + pkg_conf_data.set('GLIBMM_STATIC_LIB', 1) + pkg_conf_data.set('GIOMM_STATIC_LIB', 1) diff --git a/recipes/glibmm/all/patches/fix_initialization_order_fiasco_2_75_0.patch b/recipes/glibmm/all/patches/fix_initialization_order_fiasco_2_75_0.patch new file mode 100644 index 0000000000000..6a24ae04d3038 --- /dev/null +++ b/recipes/glibmm/all/patches/fix_initialization_order_fiasco_2_75_0.patch @@ -0,0 +1,84 @@ +diff --git a/glib/glibmm/class.cc b/glib/glibmm/class.cc +index 31f92c61..f5befb2d 100644 +--- a/glib/glibmm/class.cc ++++ b/glib/glibmm/class.cc +@@ -166,7 +166,11 @@ Class::clone_custom_type( + } + + // Initialize the static quark to store/get custom type properties. ++#if GLIB_STATIC_COMPILATION ++GQuark Class::iface_properties_quark = 0; ++#else + GQuark Class::iface_properties_quark = g_quark_from_string("gtkmm_CustomObject_iface_properties"); ++#endif + + // static + void +diff --git a/glib/glibmm/init.cc b/glib/glibmm/init.cc +index 0b34447d..6b70a4c2 100644 +--- a/glib/glibmm/init.cc ++++ b/glib/glibmm/init.cc +@@ -14,12 +14,17 @@ + * License along with this library. If not, see . + */ + ++#include + #include + #include + #include + #include + #include + ++#if GLIB_STATIC_COMPILATION ++#include ++#endif ++ + namespace + { + bool init_to_users_preferred_locale = true; +@@ -45,6 +50,11 @@ void init() + if (is_initialized) + return; + ++#if GLIB_STATIC_COMPILATION ++ Glib::Class::iface_properties_quark = ++ g_quark_from_string("gtkmm_CustomObject_iface_properties"); ++#endif ++ + if (init_to_users_preferred_locale) + { + try +diff --git a/glib/glibmm/property.cc b/glib/glibmm/property.cc +index 56dad849..630b35b1 100644 +--- a/glib/glibmm/property.cc ++++ b/glib/glibmm/property.cc +@@ -89,8 +89,12 @@ struct custom_properties_type + }; + + // The quark used for storing/getting the custom properties of custom types. +-static const GQuark custom_properties_quark = +- g_quark_from_string("gtkmm_CustomObject_custom_properties"); ++static const GQuark& ++custom_properties_quark() ++{ ++ static GQuark custom_properties_quark_ = g_quark_from_string("gtkmm_CustomObject_custom_properties"); ++ return custom_properties_quark_; ++} + + // Delete the custom properties data when an object of a custom type is finalized. + void destroy_notify_obj_custom_props(void* data) +@@ -111,12 +115,12 @@ custom_properties_type* + get_obj_custom_props(GObject* obj) + { + auto obj_custom_props = +- static_cast(g_object_get_qdata(obj, custom_properties_quark)); ++ static_cast(g_object_get_qdata(obj, custom_properties_quark())); + if (!obj_custom_props) + { + obj_custom_props = new custom_properties_type(); + g_object_set_qdata_full( +- obj, custom_properties_quark, obj_custom_props, destroy_notify_obj_custom_props); ++ obj, custom_properties_quark(), obj_custom_props, destroy_notify_obj_custom_props); + } + return obj_custom_props; + } diff --git a/recipes/glibmm/all/test_package/CMakeLists.txt b/recipes/glibmm/all/test_package/CMakeLists.txt index c47425885e86c..e57ebb60abaed 100644 --- a/recipes/glibmm/all/test_package/CMakeLists.txt +++ b/recipes/glibmm/all/test_package/CMakeLists.txt @@ -1,18 +1,15 @@ cmake_minimum_required(VERSION 3.6) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGET) - find_package(glibmm REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) if (TARGET glibmm::glibmm-2.68) set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) - target_link_libraries(${PROJECT_NAME} glibmm::glibmm-2.68 glibmm::giomm-2.68) + target_link_libraries(${PROJECT_NAME} PRIVATE glibmm::glibmm-2.68 glibmm::giomm-2.68) else() set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - target_link_libraries(${PROJECT_NAME} glibmm::glibmm-2.4 glibmm::giomm-2.4) + target_link_libraries(${PROJECT_NAME} PRIVATE glibmm::glibmm-2.4 glibmm::giomm-2.4) endif() diff --git a/recipes/glibmm/all/test_package/conanfile.py b/recipes/glibmm/all/test_package/conanfile.py index 38f4483872d47..05bb1c8f03b5d 100644 --- a/recipes/glibmm/all/test_package/conanfile.py +++ b/recipes/glibmm/all/test_package/conanfile.py @@ -1,10 +1,21 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake +from conan.tools.layout import cmake_layout + import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +23,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/glibmm/all/test_v1_package/CMakeLists.txt b/recipes/glibmm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/glibmm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/glibmm/all/test_v1_package/conanfile.py b/recipes/glibmm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/glibmm/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/glibmm/config.yml b/recipes/glibmm/config.yml index 51960e64ef7eb..6aaa4e9d859bb 100644 --- a/recipes/glibmm/config.yml +++ b/recipes/glibmm/config.yml @@ -1,4 +1,6 @@ versions: + "2.75.0": + folder: "all" "2.72.1": folder: "all" "2.66.4": diff --git a/recipes/glm/all/conandata.yml b/recipes/glm/all/conandata.yml index 125c6b973082e..ea5c8f567b661 100644 --- a/recipes/glm/all/conandata.yml +++ b/recipes/glm/all/conandata.yml @@ -1,19 +1,22 @@ sources: + "cci.20230113": + url: "https://github.com/g-truc/glm/archive/efec5db081e3aad807d0731e172ac597f6a39447.zip" + sha256: "e7a1abc208278cc3f0dba59c5170d83863b3375f98136d588b8beb74825e503c" "cci.20220420": url: "https://github.com/g-truc/glm/archive/cc98465e3508535ba8c7f6208df934c156a018dc.zip" sha256: "06d48e336857777d2d1f7da9ccd59e4b9d79720dbd70886d48837d19cda997bb" "0.9.9.8": - url: "https://github.com/g-truc/glm/archive/0.9.9.8.tar.gz" - sha256: "7d508ab72cb5d43227a3711420f06ff99b0a0cb63ee2f93631b162bfe1fe9592" + url: "https://github.com/g-truc/glm/releases/download/0.9.9.8/glm-0.9.9.8.zip" + sha256: "37e2a3d62ea3322e43593c34bae29f57e3e251ea89f4067506c94043769ade4c" "0.9.9.7": - url: "https://github.com/g-truc/glm/archive/0.9.9.7.tar.gz" - sha256: "2ec9e33a80b548892af64fbd84a947f93f0e725423b1b7bec600f808057a8239" + url: "https://github.com/g-truc/glm/releases/download/0.9.9.7/glm-0.9.9.7.zip" + sha256: "6b79c3d06d9745d1cce3f38c0c15666596f9aefff25ddb74df3af0a02f011ee1" "0.9.9.6": - url: "https://github.com/g-truc/glm/archive/0.9.9.6.tar.gz" - sha256: "30b05f31f5d8528caa9fc8fe8132e5a0444d55b1c39db53fe4db8857654afafc" + url: "https://github.com/g-truc/glm/releases/download/0.9.9.6/glm-0.9.9.6.zip" + sha256: "9db7339c3b8766184419cfe7942d668fecabe9013ccfec8136b39e11718817d0" "0.9.9.5": - url: "https://github.com/g-truc/glm/archive/0.9.9.5.tar.gz" - sha256: "5e33b6131cea6a904339734b015110d4342b7dc02d995164fdb86332d28a5aa4" + url: "https://github.com/g-truc/glm/releases/download/0.9.9.5/glm-0.9.9.5.zip" + sha256: "4fe34860ce69156f63eea6c3d84c91cadfc330353cf275ff394aef4e163cafee" "0.9.5.4": - url: "https://github.com/g-truc/glm/archive/refs/tags/0.9.5.4.tar.gz" - sha256: "39c7ee0db54289f78350c7629ea2531664d71c6a494bbb86db48a86536de9ff2" + url: "https://github.com/g-truc/glm/releases/download/0.9.5.4/glm-0.9.5.4.zip" + sha256: "c25002f109104bb8eb37a7e74c745cbc0a713ec5d9a857050c7878edb5ee246c" diff --git a/recipes/glm/all/conanfile.py b/recipes/glm/all/conanfile.py index 5607f01a9ed01..b86499dcc4c3d 100644 --- a/recipes/glm/all/conanfile.py +++ b/recipes/glm/all/conanfile.py @@ -17,15 +17,14 @@ class GlmConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def package_id(self): - self.info.clear() - def layout(self): basic_layout(self, src_folder="src") + def package_id(self): + self.info.clear() + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def build(self): pass @@ -56,6 +55,4 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "glm") self.cpp_info.set_property("cmake_target_name", "glm::glm") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/glm/all/test_package/conanfile.py b/recipes/glm/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/glm/all/test_package/conanfile.py +++ b/recipes/glm/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/glm/all/test_v1_package/CMakeLists.txt b/recipes/glm/all/test_v1_package/CMakeLists.txt index b00ed742dac15..0d20897301b68 100644 --- a/recipes/glm/all/test_v1_package/CMakeLists.txt +++ b/recipes/glm/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(glm REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE glm::glm) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/glm/config.yml b/recipes/glm/config.yml index 33c1a13ccdf3d..ee1899a79d2af 100644 --- a/recipes/glm/config.yml +++ b/recipes/glm/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20230113": + folder: all "cci.20220420": folder: all "0.9.9.8": diff --git a/recipes/glog/all/CMakeLists.txt b/recipes/glog/all/CMakeLists.txt deleted file mode 100644 index 68bfd75fb1882..0000000000000 --- a/recipes/glog/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/glog/all/conanfile.py b/recipes/glog/all/conanfile.py index 8c7a60b13be70..220a5b6f0d3a2 100644 --- a/recipes/glog/all/conanfile.py +++ b/recipes/glog/all/conanfile.py @@ -1,10 +1,11 @@ from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.54.0" class GlogConan(ConanFile): @@ -12,9 +13,10 @@ class GlogConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/google/glog/" description = "Google logging library" - topics = ("conan", "glog", "logging") + topics = ("logging",) license = "BSD-3-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,8 +34,7 @@ class GlogConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,7 +44,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.with_gflags: self.options["gflags"].shared = self.options.shared @@ -57,19 +58,31 @@ def requirements(self): if self.options.get_safe("with_unwind") or (Version(self.version) < "0.5.0" and self.settings.os in ["Linux", "FreeBSD"]): self.requires("libunwind/1.6.2") + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r"cmake version (\d+\.\d+\.\d+)", output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + def build_requirements(self): - if Version(self.version) >= "0.6.0": - self.build_requires("cmake/3.22.3") + if Version(self.version) >= "0.6.0" and not self._cmake_new_enough("3.16"): + self.tool_requires("cmake/3.25.2") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + tc = VirtualBuildEnv(self) + tc.generate() + tc = CMakeToolchain(self) tc.variables["WITH_GFLAGS"] = self.options.with_gflags tc.variables["WITH_THREADS"] = self.options.with_threads - tc.variables["BUILD_SHARED_LIBS"] = self.options.shared if Version(self.version) >= "0.5.0": tc.variables["WITH_PKGCONFIG"] = True if self.settings.os == "Emscripten": @@ -83,6 +96,9 @@ def generate(self): tc.variables["WITH_GTEST"] = False tc.generate() + tc = CMakeDeps(self) + tc.generate() + def _patch_sources(self): apply_conandata_patches(self) # do not force PIC @@ -90,6 +106,10 @@ def _patch_sources(self): replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set_target_properties (glog PROPERTIES POSITION_INDEPENDENT_CODE ON)", "") + # INFO: avoid "CONAN_LIB::gflags_gflags_nothreads_RELEASE" but the target was not found. + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "determine_gflags_namespace", + "# determine_gflags_namespace") def build(self): self._patch_sources() @@ -98,7 +118,7 @@ def build(self): cmake.build() def package(self): - self.copy("COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) @@ -111,7 +131,7 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "libglog") postfix = "d" if self.settings.build_type == "Debug" else "" self.cpp_info.libs = ["glog" + postfix] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] elif self.settings.os == "Windows": self.cpp_info.system_libs = ["dbghelp"] diff --git a/recipes/glog/all/test_package/CMakeLists.txt b/recipes/glog/all/test_package/CMakeLists.txt index da54003c66306..28603535e29e9 100644 --- a/recipes/glog/all/test_package/CMakeLists.txt +++ b/recipes/glog/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(glog REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} glog::glog) +target_link_libraries(${PROJECT_NAME} PRIVATE glog::glog) diff --git a/recipes/glog/all/test_package/conanfile.py b/recipes/glog/all/test_package/conanfile.py index a9f777f7680ff..8a5bb47f50c4c 100644 --- a/recipes/glog/all/test_package/conanfile.py +++ b/recipes/glog/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/glog/all/test_v1_package/CMakeLists.txt b/recipes/glog/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/glog/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/glog/all/test_v1_package/conanfile.py b/recipes/glog/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2490acfa82ff8 --- /dev/null +++ b/recipes/glog/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/glslang/all/CMakeLists.txt b/recipes/glslang/all/CMakeLists.txt index d98f364825a91..17ed662273267 100644 --- a/recipes/glslang/all/CMakeLists.txt +++ b/recipes/glslang/all/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - # TODO: # - It should be find_package(SPIRV-Tools-opt REQUIRED CONFIG), but it can't be # modeled yet in spirv-tools recipe. @@ -16,4 +13,4 @@ if(ENABLE_OPT) find_package(SPIRV-Tools REQUIRED CONFIG) endif() -add_subdirectory(source_subfolder) +add_subdirectory(src) diff --git a/recipes/glslang/all/conandata.yml b/recipes/glslang/all/conandata.yml index 305ce48378dab..f6333a1a14d01 100644 --- a/recipes/glslang/all/conandata.yml +++ b/recipes/glslang/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.3.236.0": + url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "fb6f323a36efcd98766bb72f598008f73c4c92bce69c79fc98ad2b3cdca0c263" + "1.3.231.1": + url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "df3857f01c1aa9ee1927d2feaaa431406d243958e07791e9aed4cb5ab22a5f2b" + "1.3.224.0": + url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.224.0.tar.gz" + sha256: "c43c6aa149fa1165e01b375b4d95cbc23b4fc72bd9972a89c55dd1eaa8a360ca" "1.3.216.0": url: "https://github.com/KhronosGroup/glslang/archive/refs/tags/sdk-1.3.216.0.tar.gz" sha256: "3f80a926390faedd33e6ed17ec68340abace83913b285174e2dee87156577be5" @@ -21,21 +30,21 @@ sources: url: "https://github.com/KhronosGroup/glslang/archive/8.13.3559.tar.gz" sha256: "c58fdcf7e00943ba10f9ae565b2725ec9d5be7dab7c8e82cac72fcaa83c652ca" patches: + "1.3.236.0": + - patch_file: "patches/1.3.236.0-0001-no-force-glslang-pic.patch" + "1.3.231.1": + - patch_file: "patches/0001-no-force-glslang-pic.patch" + "1.3.224.0": + - patch_file: "patches/0001-no-force-glslang-pic.patch" "1.3.216.0": - patch_file: "patches/0001-no-force-glslang-pic.patch" - base_path: "source_subfolder" "1.3.211.0": - patch_file: "patches/0001-no-force-glslang-pic.patch" - base_path: "source_subfolder" "1.3.204.0": - patch_file: "patches/0001-no-force-glslang-pic.patch" - base_path: "source_subfolder" "11.7.0": - patch_file: "patches/0001-no-force-glslang-pic.patch" - base_path: "source_subfolder" "11.6.0": - patch_file: "patches/0001-no-force-glslang-pic.patch" - base_path: "source_subfolder" "11.5.0": - patch_file: "patches/0001-no-force-glslang-pic.patch" - base_path: "source_subfolder" diff --git a/recipes/glslang/all/conanfile.py b/recipes/glslang/all/conanfile.py index 89dad6a7a9ceb..b5f950bef195e 100644 --- a/recipes/glslang/all/conanfile.py +++ b/recipes/glslang/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class GlslangConan(ConanFile): @@ -34,21 +39,9 @@ class GlslangConan(ConanFile): short_paths = True - generators = "cmake", "cmake_find_package_multi" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -56,7 +49,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") @property def _get_compatible_spirv_tools_version(self): @@ -69,42 +68,71 @@ def _get_compatible_spirv_tools_version(self): def requirements(self): if self.options.enable_optimizer: - self.requires("spirv-tools/{}".format(self._get_compatible_spirv_tools_version)) + self.requires(f"spirv-tools/{self._get_compatible_spirv_tools_version}") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) # see https://github.com/KhronosGroup/glslang/issues/2283 - glslang_version = tools.Version(self.version) - if (self.options.shared and - (self.settings.os == "Windows" or \ - (glslang_version >= "7.0.0" and glslang_version < "11.0.0" and tools.is_apple_os(self.settings.os))) + glslang_version = Version(self.version) + if (self.info.options.shared and + (self.info.settings.os == "Windows" or \ + (glslang_version >= "7.0.0" and glslang_version < "11.0.0" and is_apple_os(self))) ): - raise ConanInvalidConfiguration( - "glslang {} shared library build is broken on {}".format( - self.version, self.settings.os, - ) - ) + raise ConanInvalidConfiguration(f"{self.ref} shared library build is broken on {self.info.settings.os}") - if self.options.enable_optimizer and self.options["spirv-tools"].shared: + if self.info.options.enable_optimizer and self.dependencies["spirv-tools"].options.shared: raise ConanInvalidConfiguration( - "glslang with enable_optimizer requires static spirv-tools, " + f"{self.ref} with enable_optimizer requires static spirv-tools, " "because SPIRV-Tools-opt is not built if shared" ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def build(self): - self._patches_sources() - cmake = self._configure_cmake() - cmake.build() + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_EXTERNAL"] = False + tc.variables["SKIP_GLSLANG_INSTALL"] = False + tc.variables["ENABLE_SPVREMAPPER"] = self.options.spv_remapper + tc.variables["ENABLE_GLSLANG_BINARIES"] = self.options.build_executables + glslang_version = Version(self.version) + if glslang_version < "7.0.0" or glslang_version >= "8.13.3743": + tc.variables["ENABLE_GLSLANG_JS"] = False + tc.variables["ENABLE_GLSLANG_WEBMIN"] = False + tc.variables["ENABLE_GLSLANG_WEBMIN_DEVEL"] = False + else: + tc.variables["ENABLE_GLSLANG_WEB"] = False + tc.variables["ENABLE_GLSLANG_WEB_DEVEL"] = False + tc.variables["ENABLE_EMSCRIPTEN_SINGLE_FILE"] = False + tc.variables["ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE"] = False + tc.variables["ENABLE_HLSL"] = self.options.hlsl + if glslang_version < "7.0.0" or glslang_version >= "8.13.3743": + tc.variables["ENABLE_RTTI"] = True + tc.variables["ENABLE_OPT"] = self.options.enable_optimizer + if self.options.enable_optimizer: + tc.variables["spirv-tools_SOURCE_DIR"] = self.dependencies["spirv-tools"].package_folder.replace("\\", "/") + tc.variables["ENABLE_PCH"] = False + tc.variables["ENABLE_CTEST"] = False + tc.variables["USE_CCACHE"] = False + if (glslang_version < "7.0.0" or glslang_version >= "11.6.0") and self.settings.os == "Windows": + tc.variables["OVERRIDE_MSVCCRT"] = False + if is_apple_os(self): + tc.variables["CMAKE_MACOSX_BUNDLE"] = False + if glslang_version < "1.3.231" or glslang_version >= "7.0.0": + # Generate a relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() - def _patches_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) # Do not force PIC if static (but keep it if shared, because OGLCompiler, OSDependent, # GenericCodeGen and MachineIndependent are still static and linked to glslang shared) if not self.options.shared: @@ -116,103 +144,105 @@ def _patches_sources(self): {"target": "OSDependent", "relpath": os.path.join("glslang", "OSDependent", "Windows","CMakeLists.txt")}, {"target": "HLSL" , "relpath": os.path.join("hlsl", "CMakeLists.txt")}, ] - glslang_version = tools.Version(self.version) + glslang_version = Version(self.version) if glslang_version >= "7.0.0" and glslang_version < "11.0.0": - cmake_files_to_fix.append({"target": "glslang" , "relpath": os.path.join("glslang", "CMakeLists.txt")}) + cmake_files_to_fix.append({"target": "glslang", "relpath": os.path.join("glslang", "CMakeLists.txt")}) else: cmake_files_to_fix.append({"target": "glslang-default-resource-limits", "relpath": os.path.join("StandAlone" , "CMakeLists.txt")}) cmake_files_to_fix.append({"target": "MachineIndependent", "relpath": os.path.join("glslang", "CMakeLists.txt")}) cmake_files_to_fix.append({"target": "GenericCodeGen", "relpath": os.path.join("glslang", "CMakeLists.txt")}) for cmake_file in cmake_files_to_fix: - tools.replace_in_file(os.path.join(self._source_subfolder, cmake_file["relpath"]), + replace_in_file(self, os.path.join(self.source_folder, cmake_file["relpath"]), "set_property(TARGET {} PROPERTY POSITION_INDEPENDENT_CODE ON)".format(cmake_file["target"]), "") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_EXTERNAL"] = False - self._cmake.definitions["SKIP_GLSLANG_INSTALL"] = False - self._cmake.definitions["ENABLE_SPVREMAPPER"] = self.options.spv_remapper - self._cmake.definitions["ENABLE_GLSLANG_BINARIES"] = self.options.build_executables - glslang_version = tools.Version(self.version) - if glslang_version < "7.0.0" or glslang_version >= "8.13.3743": - self._cmake.definitions["ENABLE_GLSLANG_JS"] = False - self._cmake.definitions["ENABLE_GLSLANG_WEBMIN"] = False - self._cmake.definitions["ENABLE_GLSLANG_WEBMIN_DEVEL"] = False - else: - self._cmake.definitions["ENABLE_GLSLANG_WEB"] = False - self._cmake.definitions["ENABLE_GLSLANG_WEB_DEVEL"] = False - self._cmake.definitions["ENABLE_EMSCRIPTEN_SINGLE_FILE"] = False - self._cmake.definitions["ENABLE_EMSCRIPTEN_ENVIRONMENT_NODE"] = False - self._cmake.definitions["ENABLE_HLSL"] = self.options.hlsl - if glslang_version < "7.0.0" or glslang_version >= "8.13.3743": - self._cmake.definitions["ENABLE_RTTI"] = True - self._cmake.definitions["ENABLE_OPT"] = self.options.enable_optimizer - self._cmake.definitions["ENABLE_PCH"] = False - self._cmake.definitions["ENABLE_CTEST"] = False - self._cmake.definitions["USE_CCACHE"] = False - if (glslang_version < "7.0.0" or glslang_version >= "11.6.0") and self.settings.os == "Windows": - self._cmake.definitions["OVERRIDE_MSVCCRT"] = False - if tools.is_apple_os(self.settings.os): - self._cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False - # Generate a relocatable shared lib on Macos - self._cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - # TODO: glslang exports non-namespaced targets but without config file... + self.cpp_info.set_property("cmake_file_name", "glslang") + self.cpp_info.set_property("cmake_target_name", "glslang::glslang-do-not-use") # because glslang-core target is glslang::glslang + lib_suffix = "d" if self.settings.os == "Windows" and self.settings.build_type == "Debug" else "" + + glslang_version = Version(self.version) + has_machineindependent = (glslang_version < "7.0.0" or glslang_version >= "11.0.0") and not self.options.shared + has_genericcodegen = (glslang_version < "7.0.0" or glslang_version >= "11.0.0") and not self.options.shared + has_osdependent = glslang_version < "1.3.231" or glslang_version >= "7.0.0" or not self.options.shared + has_oglcompiler = glslang_version < "1.3.231" or glslang_version >= "7.0.0" or not self.options.shared + # glslang + self.cpp_info.components["glslang-core"].set_property("cmake_target_name", "glslang::glslang") self.cpp_info.components["glslang-core"].names["cmake_find_package"] = "glslang" self.cpp_info.components["glslang-core"].names["cmake_find_package_multi"] = "glslang" - self.cpp_info.components["glslang-core"].libs = ["glslang" + lib_suffix] + self.cpp_info.components["glslang-core"].libs = [f"glslang{lib_suffix}"] + if (glslang_version < "7.0.0" or glslang_version >= "11.0.0") and self.options.shared: + self.cpp_info.components["glslang-core"].defines.append("GLSLANG_IS_SHARED_LIBRARY") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["glslang-core"].system_libs.extend(["m", "pthread"]) - self.cpp_info.components["glslang-core"].requires = ["oglcompiler", "osdependent"] + if has_machineindependent: + self.cpp_info.components["glslang-core"].requires.append("machineindependent") + if has_genericcodegen: + self.cpp_info.components["glslang-core"].requires.append("genericcodegen") + if has_osdependent: + self.cpp_info.components["glslang-core"].requires.append("osdependent") + if has_oglcompiler: + self.cpp_info.components["glslang-core"].requires.append("oglcompiler") + if self.options.hlsl: + self.cpp_info.components["glslang-core"].defines.append("ENABLE_HLSL") + self.cpp_info.components["glslang-core"].requires.append("hlsl") - glslang_version = tools.Version(self.version) - if (glslang_version < "7.0.0" or glslang_version >= "11.0.0"): - if self.options.shared: - self.cpp_info.components["glslang-core"].defines.append("GLSLANG_IS_SHARED_LIBRARY") - else: - # MachineIndependent - self.cpp_info.components["machineindependent"].names["cmake_find_package"] = "MachineIndependent" - self.cpp_info.components["machineindependent"].names["cmake_find_package_multi"] = "MachineIndependent" - self.cpp_info.components["machineindependent"].libs = ["MachineIndependent" + lib_suffix] - self.cpp_info.components["machineindependent"].requires = ["oglcompiler", "osdependent", "genericcodegen"] - self.cpp_info.components["glslang-core"].requires.append("machineindependent") - - # GenericCodeGen - self.cpp_info.components["genericcodegen"].names["cmake_find_package"] = "GenericCodeGen" - self.cpp_info.components["genericcodegen"].names["cmake_find_package_multi"] = "GenericCodeGen" - self.cpp_info.components["genericcodegen"].libs = ["GenericCodeGen" + lib_suffix] - self.cpp_info.components["glslang-core"].requires.append("genericcodegen") - - # OSDependent - self.cpp_info.components["osdependent"].names["cmake_find_package"] = "OSDependent" - self.cpp_info.components["osdependent"].names["cmake_find_package_multi"] = "OSDependent" - self.cpp_info.components["osdependent"].libs = ["OSDependent" + lib_suffix] - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["osdependent"].system_libs.append("pthread") + if has_machineindependent: + # MachineIndependent + self.cpp_info.components["machineindependent"].set_property("cmake_target_name", "glslang::MachineIndependent") + self.cpp_info.components["machineindependent"].names["cmake_find_package"] = "MachineIndependent" + self.cpp_info.components["machineindependent"].names["cmake_find_package_multi"] = "MachineIndependent" + self.cpp_info.components["machineindependent"].libs = [f"MachineIndependent{lib_suffix}"] + if has_genericcodegen: + self.cpp_info.components["machineindependent"].requires.append("genericcodegen") + if has_osdependent: + self.cpp_info.components["machineindependent"].requires.append("osdependent") + if has_oglcompiler: + self.cpp_info.components["machineindependent"].requires.append("oglcompiler") - # OGLCompiler - self.cpp_info.components["oglcompiler"].names["cmake_find_package"] = "OGLCompiler" - self.cpp_info.components["oglcompiler"].names["cmake_find_package_multi"] = "OGLCompiler" - self.cpp_info.components["oglcompiler"].libs = ["OGLCompiler" + lib_suffix] + if has_genericcodegen: + # GenericCodeGen + self.cpp_info.components["genericcodegen"].set_property("cmake_target_name", "glslang::GenericCodeGen") + self.cpp_info.components["genericcodegen"].names["cmake_find_package"] = "GenericCodeGen" + self.cpp_info.components["genericcodegen"].names["cmake_find_package_multi"] = "GenericCodeGen" + self.cpp_info.components["genericcodegen"].libs = [f"GenericCodeGen{lib_suffix}"] + + if has_osdependent: + # OSDependent + self.cpp_info.components["osdependent"].set_property("cmake_target_name", "glslang::OSDependent") + self.cpp_info.components["osdependent"].names["cmake_find_package"] = "OSDependent" + self.cpp_info.components["osdependent"].names["cmake_find_package_multi"] = "OSDependent" + self.cpp_info.components["osdependent"].libs = [f"OSDependent{lib_suffix}"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["osdependent"].system_libs.append("pthread") + + if has_oglcompiler: + # OGLCompiler + self.cpp_info.components["oglcompiler"].set_property("cmake_target_name", "glslang::OGLCompiler") + self.cpp_info.components["oglcompiler"].names["cmake_find_package"] = "OGLCompiler" + self.cpp_info.components["oglcompiler"].names["cmake_find_package_multi"] = "OGLCompiler" + self.cpp_info.components["oglcompiler"].libs = [f"OGLCompiler{lib_suffix}"] # SPIRV + self.cpp_info.components["spirv"].set_property("cmake_target_name", "glslang::SPIRV") self.cpp_info.components["spirv"].names["cmake_find_package"] = "SPIRV" self.cpp_info.components["spirv"].names["cmake_find_package_multi"] = "SPIRV" - self.cpp_info.components["spirv"].libs = ["SPIRV" + lib_suffix] + self.cpp_info.components["spirv"].libs = [f"SPIRV{lib_suffix}"] self.cpp_info.components["spirv"].requires = ["glslang-core"] if self.options.enable_optimizer: self.cpp_info.components["spirv"].requires.append("spirv-tools::spirv-tools-opt") @@ -220,19 +250,17 @@ def package_info(self): # HLSL if self.options.hlsl: + self.cpp_info.components["hlsl"].set_property("cmake_target_name", "glslang::HLSL") self.cpp_info.components["hlsl"].names["cmake_find_package"] = "HLSL" self.cpp_info.components["hlsl"].names["cmake_find_package_multi"] = "HLSL" - self.cpp_info.components["hlsl"].libs = ["HLSL" + lib_suffix] - self.cpp_info.components["glslang-core"].requires.append("hlsl") - self.cpp_info.components["glslang-core"].defines.append("ENABLE_HLSL") + self.cpp_info.components["hlsl"].libs = [f"HLSL{lib_suffix}"] # SPVRemapper if self.options.spv_remapper: + self.cpp_info.components["spvremapper"].set_property("cmake_target_name", "glslang::SPVRemapper") self.cpp_info.components["spvremapper"].names["cmake_find_package"] = "SPVRemapper" self.cpp_info.components["spvremapper"].names["cmake_find_package_multi"] = "SPVRemapper" - self.cpp_info.components["spvremapper"].libs = ["SPVRemapper" + lib_suffix] + self.cpp_info.components["spvremapper"].libs = [f"SPVRemapper{lib_suffix}"] if self.options.build_executables: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/glslang/all/patches/1.3.236.0-0001-no-force-glslang-pic.patch b/recipes/glslang/all/patches/1.3.236.0-0001-no-force-glslang-pic.patch new file mode 100644 index 0000000000000..10a3ace245afd --- /dev/null +++ b/recipes/glslang/all/patches/1.3.236.0-0001-no-force-glslang-pic.patch @@ -0,0 +1,10 @@ +--- a/glslang/CMakeLists.txt ++++ b/glslang/CMakeLists.txt +@@ -169,7 +169,6 @@ set(GLSLANG_HEADERS + add_library(glslang ${LIB_TYPE} ${BISON_GLSLParser_OUTPUT_SOURCE} ${GLSLANG_SOURCES} ${GLSLANG_HEADERS}) + set_target_properties(glslang PROPERTIES + FOLDER glslang +- POSITION_INDEPENDENT_CODE ON + VERSION "${GLSLANG_VERSION}" + SOVERSION "${GLSLANG_VERSION_MAJOR}") + target_link_libraries(glslang PRIVATE OGLCompiler OSDependent MachineIndependent) diff --git a/recipes/glslang/all/test_package/CMakeLists.txt b/recipes/glslang/all/test_package/CMakeLists.txt index 33ae887aa6aea..02d778d679219 100644 --- a/recipes/glslang/all/test_package/CMakeLists.txt +++ b/recipes/glslang/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(glslang REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE glslang::glslang) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/glslang/all/test_package/conanfile.py b/recipes/glslang/all/test_package/conanfile.py index daf9386ce8619..216f67362e0fd 100644 --- a/recipes/glslang/all/test_package/conanfile.py +++ b/recipes/glslang/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,8 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") shader_name = os.path.join(self.source_folder, "test_package.vert") - self.run("glslangValidator \"{}\"".format(shader_name), run_environment=True) + self.run(f"glslangValidator \"{shader_name}\"", env="conanrun") diff --git a/recipes/glslang/all/test_v1_package/CMakeLists.txt b/recipes/glslang/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/glslang/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/glslang/all/test_v1_package/conanfile.py b/recipes/glslang/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d939929a7a456 --- /dev/null +++ b/recipes/glslang/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + shader_name = os.path.join(self.source_folder, os.pardir, "test_package", "test_package.vert") + self.run(f"glslangValidator \"{shader_name}\"", run_environment=True) diff --git a/recipes/glslang/config.yml b/recipes/glslang/config.yml index 0a42721fd10b1..413c4c359d87e 100644 --- a/recipes/glslang/config.yml +++ b/recipes/glslang/config.yml @@ -1,4 +1,10 @@ versions: + "1.3.236.0": + folder: all + "1.3.231.1": + folder: all + "1.3.224.0": + folder: all "1.3.216.0": folder: all "1.3.211.0": diff --git a/recipes/glu/all/conanfile.py b/recipes/glu/all/conanfile.py index e7bf0072386fe..acf6c7e90b2fa 100644 --- a/recipes/glu/all/conanfile.py +++ b/recipes/glu/all/conanfile.py @@ -1,6 +1,8 @@ from conan import ConanFile -from conan.errors import ConanException -from conans import tools +from conan.tools.gnu import PkgConfig +from conan.tools.system import package_manager + +required_conan_version = ">=1.50.0" class SysConfigGLUConan(ConanFile): @@ -11,57 +13,43 @@ class SysConfigGLUConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://cgit.freedesktop.org/mesa/glu/" license = "SGI-B-2.0" - settings = "os" - requires = "opengl/system" + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + pass + + def requirements(self): + self.requires("opengl/system") + + def package_id(self): + self.info.clear() def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_yum or tools.os_info.with_dnf: - packages = ["mesa-libGLU-devel"] - elif tools.os_info.with_apt: - packages = ["libglu1-mesa-dev"] - elif tools.os_info.with_pacman: - packages = ["glu"] - elif tools.os_info.with_zypper: - packages = ["glu-devel"] - else: - self.output.warn("Don't know how to install GLU for your distro") - if tools.os_info.is_freebsd and self.settings.os == "FreeBSD": - packages = ["libGLU"] - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify') - for p in packages: - package_tool.install(update=True, packages=p) + dnf = package_manager.Dnf(self) + dnf.install(["mesa-libGLU-devel"], update=True, check=True) - def _fill_cppinfo_from_pkgconfig(self, name): - pkg_config = tools.PkgConfig(name) - if not pkg_config.provides: - raise ConanException("GLU development files aren't available, giving up") - libs = [lib[2:] for lib in pkg_config.libs_only_l] - lib_dirs = [lib[2:] for lib in pkg_config.libs_only_L] - ldflags = [flag for flag in pkg_config.libs_only_other] - include_dirs = [include[2:] for include in pkg_config.cflags_only_I] - cflags = [flag for flag in pkg_config.cflags_only_other if not flag.startswith("-D")] - defines = [flag[2:] for flag in pkg_config.cflags_only_other if flag.startswith("-D")] + yum = package_manager.Yum(self) + yum.install(["mesa-libGLU-devel"], update=True, check=True) - self.cpp_info.system_libs.extend(libs) - self.cpp_info.libdirs.extend(lib_dirs) - self.cpp_info.sharedlinkflags.extend(ldflags) - self.cpp_info.exelinkflags.extend(ldflags) - self.cpp_info.defines.extend(defines) - self.cpp_info.includedirs.extend(include_dirs) - self.cpp_info.cflags.extend(cflags) - self.cpp_info.cxxflags.extend(cflags) + apt = package_manager.Apt(self) + apt.install(["libglu1-mesa-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["glu"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["glu-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install(["libGLU"], update=True, check=True) def package_info(self): + self.cpp_info.bindirs = [] self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] if self.settings.os == "Windows": - self.cpp_info.system_libs = ["Glu32"] + self.cpp_info.system_libs = ["glu32"] elif self.settings.os in ["Linux", "FreeBSD"]: - self._fill_cppinfo_from_pkgconfig("glu") - - def package_id(self): - self.info.header_only() + pkg_config = PkgConfig(self, 'glu') + pkg_config.fill_cpp_info(self.cpp_info, is_system=self.settings.os != "FreeBSD") diff --git a/recipes/glu/all/test_package/CMakeLists.txt b/recipes/glu/all/test_package/CMakeLists.txt index 34af13462f44f..56f2fb9c24114 100644 --- a/recipes/glu/all/test_package/CMakeLists.txt +++ b/recipes/glu/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(glu REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE glu::glu) diff --git a/recipes/glu/all/test_package/conanfile.py b/recipes/glu/all/test_package/conanfile.py index fdb9f346a1da9..ef5d7042163ec 100644 --- a/recipes/glu/all/test_package/conanfile.py +++ b/recipes/glu/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/glu/all/test_v1_package/CMakeLists.txt b/recipes/glu/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/glu/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/glu/all/test_v1_package/conanfile.py b/recipes/glu/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a500b98343c74 --- /dev/null +++ b/recipes/glu/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/gmp/all/conandata.yml b/recipes/gmp/all/conandata.yml index d97aab0d277f2..9266fcde97cc7 100644 --- a/recipes/gmp/all/conandata.yml +++ b/recipes/gmp/all/conandata.yml @@ -11,18 +11,11 @@ sources: patches: "6.2.1": - patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" - base_path: "" - patch_file: "patches/6.2.x-0001-fix-MSVC-next-prime-error.patch" - base_path: "source_subfolder" "6.2.0": - patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" - base_path: "" - patch_file: "patches/6.2.x-0001-fix-MSVC-next-prime-error.patch" - base_path: "source_subfolder" "6.1.2": - patch_file: "patches/0001-msvc-dumpbin-yasm-wrapper.patch" - base_path: "" - patch_file: "patches/6.1.x-0001-fix-MSVC-next-prime-error.patch" - base_path: "source_subfolder" - patch_file: "patches/6.1.x-0002-fix-MSVC-debug.patch" - base_path: "source_subfolder" diff --git a/recipes/gmp/all/conanfile.py b/recipes/gmp/all/conanfile.py index 5ccdd6563bbde..44f661282ff5d 100644 --- a/recipes/gmp/all/conanfile.py +++ b/recipes/gmp/all/conanfile.py @@ -1,12 +1,16 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import contextlib -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os import stat -required_conan_version = ">=1.36.0" - +required_conan_version = ">=1.56.0" class GmpConan(ConanFile): name = "gmp" @@ -37,25 +41,12 @@ class GmpConan(ConanFile): "enable_cxx": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -65,106 +56,106 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.get_safe("enable_fat"): del self.options.disable_assembly if not self.options.enable_cxx: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - def validate(self): - if self._is_msvc and self.options.shared: - raise ConanInvalidConfiguration("Cannot build a shared library using Visual Studio: some error occurs at link time") + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.options.run_checks # run_checks doesn't affect package's ID + def validate(self): + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration( + f"{self.ref} cannot be built as a shared library using Visual Studio: some error occurs at link time", + ) + def build_requirements(self): - self.build_requires("m4/1.4.19") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - if self._is_msvc: - self.build_requires("yasm/1.3.0") - self.build_requires("automake/1.16.4") + self.tool_requires("m4/1.4.19") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("yasm/1.3.0") # Needed for determining 32-bit word size + self.tool_requires("automake/1.16.5") # Needed for lib-wrapper def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # Relocatable shared lib on macOS & fix permission issue - if tools.is_apple_os(self.settings.os): - configure_file = os.path.join(self._source_subfolder, "configure") - tools.replace_in_file(configure_file, "-install_name \\$rpath/", "-install_name @rpath/") - configure_stats = os.stat(configure_file) - os.chmod(configure_file, configure_stats.st_mode | stat.S_IEXEC) + def generate(self): + env = VirtualBuildEnv(self) + env.generate() - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - configure_args = [ - "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True))), - "--enable-assembly={}".format(yes_no(not self.options.get_safe("disable_assembly", False))), - "--enable-fat={}".format(yes_no(self.options.get_safe("enable_fat", False))), - "--enable-cxx={}".format(yes_no(self.options.enable_cxx)), - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--srcdir={}".format(os.path.join(self.source_folder, self._source_subfolder).replace("\\", "/")), - ] - if self._is_msvc: - configure_args.extend([ + tc.configure_args.extend([ + f'--with-pic={yes_no(self.options.get_safe("fPIC", True))}', + f'--enable-assembly={yes_no(not self.options.get_safe("disable_assembly", False))}', + f'--enable-fat={yes_no(self.options.get_safe("enable_fat", False))}', + f'--enable-cxx={yes_no(self.options.enable_cxx)}', + f'--srcdir={"../src"}', # Use relative path to avoid issues with #include "$srcdir/gmp-h.in" on Windows + ]) + if is_msvc(self): + tc.configure_args.extend([ "ac_cv_c_restrict=restrict", "gmp_cv_asm_label_suffix=:", "lt_cv_sys_global_symbol_pipe=cat", # added to get further in shared MSVC build, but it gets stuck later ]) - if not (self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < 12): - autotools.flags.append("-FS") - autotools.cxx_flags.append("-EHsc") - autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return autotools - - @contextlib.contextmanager - def _build_context(self): - if self._is_msvc: - with tools.vcvars(self): - yasm_machine = { - "x86": "x86", - "x86_64": "amd64", - }[str(self.settings.arch)] - env = { - "CC": "cl -nologo", - "CCAS": "{} -a x86 -m {} -p gas -r raw -f win32 -g null -X gnu".format(os.path.join(self.build_folder, "yasm_wrapper.sh").replace("\\", "/"), yasm_machine), - "CXX": "cl -nologo", - "AR": "{} lib".format(self._user_info_build["automake"].ar_lib.replace("\\", "/")), - "LD": "link -nologo", - "NM": "python {}".format(tools.unix_path(os.path.join(self.build_folder, "dumpbin_nm.py"))), - } - with tools.environment_append(env): - yield - else: - yield + tc.extra_cxxflags.append("-EHsc") + if (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180") or \ + (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12"): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + env = tc.environment() # Environment must be captured *after* setting extra_cflags, etc. to pick up changes + if is_msvc(self): + yasm_wrapper = unix_path(self, os.path.join(self.source_folder, "yasm_wrapper.sh")) + yasm_machine = { + "x86": "x86", + "x86_64": "amd64", + }[str(self.settings.arch)] + ar_wrapper = unix_path(self, self.conf.get("user.automake:lib-wrapper")) + dumpbin_nm = unix_path(self, os.path.join(self.source_folder, "dumpbin_nm.py")) + env.define("CC", "cl -nologo") + env.define("CCAS", f"{yasm_wrapper} -a x86 -m {yasm_machine} -p gas -r raw -f win32 -g null -X gnu") + env.define("CXX", "cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f'{ar_wrapper} "lib -nologo"') + env.define("NM", f"python {dumpbin_nm}") + tc.generate(env) + + def _patch_sources(self): + apply_conandata_patches(self) + # Fix permission issue + if is_apple_os(self): + configure_file = os.path.join(self.source_folder, "configure") + configure_stats = os.stat(configure_file) + os.chmod(configure_file, configure_stats.st_mode | stat.S_IEXEC) def build(self): self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() - # INFO: According to the gmp readme file, make check should not be omitted, but it causes timeouts on the CI server. - if self.options.run_checks: - autotools.make(args=["check"]) + autotools = Autotools(self) + autotools.configure() + autotools.make() + # INFO: According to the gmp readme file, make check should not be omitted, but it causes timeouts on the CI server. + if self.options.run_checks: + autotools.make(target="check") def package(self): - self.copy("COPYINGv2", dst="licenses", src=self._source_subfolder) - self.copy("COPYING.LESSERv3", dst="licenses", src=self._source_subfolder) - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + copy(self, "COPYINGv2", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING.LESSERv3", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): # Workaround to always provide a pkgconfig file depending on all components @@ -176,6 +167,8 @@ def package_info(self): self.cpp_info.components["gmpxx"].set_property("pkg_config_name", "gmpxx") self.cpp_info.components["gmpxx"].libs = ["gmpxx"] self.cpp_info.components["gmpxx"].requires = ["libgmp"] + if self.settings.os != "Windows": + self.cpp_info.components["gmpxx"].system_libs = ["m"] # TODO: to remove in conan v2 once cmake_find_package_* generators removed # GMP doesn't have any official CMake Find nor config file, do not port these names to CMakeDeps diff --git a/recipes/gmp/all/test_package/CMakeLists.txt b/recipes/gmp/all/test_package/CMakeLists.txt index 9f96d523192a5..ba2fbfaf5b1f9 100644 --- a/recipes/gmp/all/test_package/CMakeLists.txt +++ b/recipes/gmp/all/test_package/CMakeLists.txt @@ -1,18 +1,24 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +enable_testing() + +find_package(gmp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE gmp::libgmp) +add_test(NAME ${PROJECT_NAME}_test COMMAND ${PROJECT_NAME}) -if (TEST_PIC) - add_library(${PROJECT_NAME}_shared SHARED test_package.c) - target_link_libraries(${PROJECT_NAME}_shared ${CONAN_LIBS}) +if(TEST_PIC) + set(CMAKE_POSITION_INDEPENDENT_CODE ON) + add_executable(${PROJECT_NAME}_pic test_package.c) + target_link_libraries(${PROJECT_NAME}_pic PRIVATE gmp::libgmp) + add_test(NAME ${PROJECT_NAME}_pic_test COMMAND ${PROJECT_NAME}_pic) endif() -if (ENABLE_CXX) +if(ENABLE_CXX) + enable_language(CXX) add_executable(${PROJECT_NAME}_cpp test_package.cpp) - target_link_libraries(${PROJECT_NAME}_cpp ${CONAN_LIBS}) + target_link_libraries(${PROJECT_NAME}_cpp PRIVATE gmp::gmpxx) + add_test(NAME ${PROJECT_NAME}_cpp_test COMMAND ${PROJECT_NAME}_cpp) endif() diff --git a/recipes/gmp/all/test_package/conanfile.py b/recipes/gmp/all/test_package/conanfile.py index 605e1da44137b..408e5ddb1389c 100644 --- a/recipes/gmp/all/test_package/conanfile.py +++ b/recipes/gmp/all/test_package/conanfile.py @@ -1,22 +1,33 @@ -from conans import ConanFile, CMake, tools -import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import chdir class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_CXX"] = self.dependencies["gmp"].options.enable_cxx + tc.variables["TEST_PIC"] = "fPIC" in self.dependencies["gmp"].options and self.dependencies["gmp"].options.fPIC + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["ENABLE_CXX"] = self.options["gmp"].enable_cxx - cmake.definitions["TEST_PIC"] = "fPIC" in self.options["gmp"] and self.options["gmp"].fPIC cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - if self.options["gmp"].enable_cxx: - bin_path = os.path.join("bin", "test_package_cpp") - self.run(bin_path, run_environment=True) + if not can_run(self): + return + with chdir(self, self.folders.build_folder): + self.run(f"ctest --output-on-failure -C {self.settings.build_type}", env="conanrun") diff --git a/recipes/gmp/all/test_v1_package/CMakeLists.txt b/recipes/gmp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..81f52f58013af --- /dev/null +++ b/recipes/gmp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +if(ENABLE_CXX) + enable_language(CXX) +endif() + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +find_package(gmp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE gmp::GMP) + +if(TEST_PIC) + add_library(${PROJECT_NAME}_shared SHARED ../test_package/test_package.c) + target_link_libraries(${PROJECT_NAME}_shared PRIVATE gmp::GMP) +endif() + +if(ENABLE_CXX) + add_executable(${PROJECT_NAME}_cpp ../test_package/test_package.cpp) + target_link_libraries(${PROJECT_NAME}_cpp PRIVATE gmp::GMPXX) +endif() diff --git a/recipes/gmp/all/test_v1_package/conanfile.py b/recipes/gmp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..716c611a38e8a --- /dev/null +++ b/recipes/gmp/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["ENABLE_CXX"] = self.options["gmp"].enable_cxx + cmake.definitions["TEST_PIC"] = "fPIC" in self.options["gmp"] and self.options["gmp"].fPIC + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + if self.options["gmp"].enable_cxx: + bin_path = os.path.join("bin", "test_package_cpp") + self.run(bin_path, run_environment=True) diff --git a/recipes/gnu-config/all/conanfile.py b/recipes/gnu-config/all/conanfile.py index 2f551028dfad4..58814fbffa9e0 100644 --- a/recipes/gnu-config/all/conanfile.py +++ b/recipes/gnu-config/all/conanfile.py @@ -1,8 +1,10 @@ -from conans import ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.errors import ConanException +from conan.tools.files import copy, get, load, save +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class GnuConfigConan(ConanFile): @@ -12,21 +14,24 @@ class GnuConfigConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" topics = ("gnu", "config", "autotools", "canonical", "host", "build", "target", "triplet") license = "GPL-3.0-or-later", "autoconf-special-exception" + os = "arch", "compiler", "build_type", "arch" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def _extract_license(self): - txt_lines = tools.load(os.path.join(self.source_folder, self._source_subfolder, "config.guess")).splitlines() + txt_lines = load(self, os.path.join(self.source_folder, "config.guess")).splitlines() start_index = None end_index = None for line_i, line in enumerate(txt_lines): @@ -41,14 +46,19 @@ def _extract_license(self): return "\n".join(txt_lines[start_index:end_index]) def package(self): - tools.save(os.path.join(self.package_folder, "licenses", "COPYING"), self._extract_license()) - self.copy("config.guess", src=self._source_subfolder, dst="bin") - self.copy("config.sub", src=self._source_subfolder, dst="bin") + save(self, os.path.join(self.package_folder, "licenses", "COPYING"), self._extract_license()) + copy(self, "config.guess", src=self.source_folder, dst=os.path.join(self.package_folder, "bin")) + copy(self, "config.sub", src=self.source_folder, dst=os.path.join(self.package_folder, "bin")) def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.conf_info.define("user.gnu-config:config_guess", os.path.join(bin_path, "config.guess")) + self.conf_info.define("user.gnu-config:config_sub", os.path.join(bin_path, "config.sub")) + # TODO: to remove in conan v2 self.user_info.CONFIG_GUESS = os.path.join(bin_path, "config.guess") self.user_info.CONFIG_SUB = os.path.join(bin_path, "config.sub") + self.env_info.PATH.append(bin_path) diff --git a/recipes/gnu-config/all/test_package/conanfile.py b/recipes/gnu-config/all/test_package/conanfile.py index dd2dd2675f100..93cb4f77f7eab 100644 --- a/recipes/gnu-config/all/test_package/conanfile.py +++ b/recipes/gnu-config/all/test_package/conanfile.py @@ -1,22 +1,21 @@ -from conans import ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + win_bash = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires(self.tested_reference_str) + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def test(self): - triplet = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) - self.run("config.guess", run_environment=True, win_bash=tools.os_info.is_windows) - try: - self.run("config.sub {}".format(triplet), run_environment=True, win_bash=tools.os_info.is_windows) - except ConanException: - self.output.info("Current configuration is not supported by GNU config.\nIgnoring...") + self.run("config.guess") + self.run("config.sub --version") diff --git a/recipes/gnu-config/all/test_v1_package/conanfile.py b/recipes/gnu-config/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..f98dcb17dfac3 --- /dev/null +++ b/recipes/gnu-config/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +from conans import ConanFile, tools +from conans.errors import ConanException + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def build_requirements(self): + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + def test(self): + self.run("config.guess", run_environment=True, win_bash=tools.os_info.is_windows) + try: + triplet = tools.get_gnu_triplet(str(self.settings.os), str(self.settings.arch), str(self.settings.compiler)) + self.run(f"config.sub {triplet}", run_environment=True, win_bash=tools.os_info.is_windows) + except ConanException: + self.output.info("Current configuration is not supported by GNU config.\nIgnoring...") diff --git a/recipes/gnutls/all/conandata.yml b/recipes/gnutls/all/conandata.yml new file mode 100644 index 0000000000000..ffbcf3dfbc66a --- /dev/null +++ b/recipes/gnutls/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "3.7.8": + url: + - "https://www.gnupg.org/ftp/gcrypt/gnutls/v3.7/gnutls-3.7.8.tar.xz" + - "http://www.ring.gr.jp/pub/net/gnupg/gnutls/v3.7/gnutls-3.7.8.tar.xz" + - "https://www.mirrorservice.org/sites/ftp.gnupg.org/gcrypt/gnutls/v3.7/gnutls-3.7.8.tar.xz" + sha256: "c58ad39af0670efe6a8aee5e3a8b2331a1200418b64b7c51977fb396d4617114" +patches: + "3.7.8": + - patch_description: "Fix Mac OS build when linking to libtasn1" + patch_type: "portability" + patch_source: "https://github.com/xbmc/inputstream.ffmpegdirect/blob/Matrix/depends/common/gnutls/03-undo-libtasn1-cisdigit.patch" + patch_file: "patches/0001-fix-isdigit.patch" diff --git a/recipes/gnutls/all/conanfile.py b/recipes/gnutls/all/conanfile.py new file mode 100644 index 0000000000000..6c54fe7b1a38d --- /dev/null +++ b/recipes/gnutls/all/conanfile.py @@ -0,0 +1,150 @@ +from conan import ConanFile +from conan.tools.microsoft import is_msvc +from conan.tools.files import get, rmdir, rm, copy, export_conandata_patches, apply_conandata_patches +from conan.tools.layout import basic_layout +from conan.tools.gnu import AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps, Autotools +from conan.tools.build import cross_building +from conan.tools.env import VirtualRunEnv +from conan.tools.apple import is_apple_os +from conan.errors import ConanInvalidConfiguration +import os + + +required_conan_version = ">=1.55.0" + + +class GnuTLSConan(ConanFile): + name = "gnutls" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.gnutls.org" + description = "GnuTLS is a secure communications library implementing the SSL, TLS and DTLS protocols" + topics = ("tls", "ssl", "secure communications") + license = ("LGPL-2.1-or-later", "GPL-3-or-later") + settings = "os", "arch", "compiler", "build_type" + options = {"shared": [True, False], + "fPIC": [True, False], + "enable_cxx": [True, False], + "enable_tools": [True, False], + "enable_openssl_compatibility": [True, False], + "with_zlib": [True, False], + "with_zstd": [True, False], + "with_brotli": [True, False],} + default_options = {"shared": False, + "fPIC": True, + "enable_cxx": True, + "enable_tools": True, + "enable_openssl_compatibility": False, + "with_zlib": True, + "with_zstd": True, + "with_brotli": True,} + + def export_sources(self): + export_conandata_patches(self) + + def configure(self): + if self.options.shared: + del self.options.fPIC + if not self.options.enable_cxx: + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("nettle/3.8.1") + self.requires("gmp/6.2.1") + self.requires("libiconv/1.17") + if self.options.with_zlib: + self.requires("zlib/1.2.13") + if self.options.with_zstd: + self.requires("zstd/1.5.2") + if self.options.with_brotli: + self.requires("brotli/1.0.9") + + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} cannot be deployed by Visual Studio.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) + + def generate(self): + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + yes_no = lambda v: "yes" if v else "no" + autotoolstc = AutotoolsToolchain(self) + autotoolstc.configure_args.extend([ + "--disable-tests", + "--disable-doc", + "--disable-guile", + "--disable-libdane", + "--disable-manpages", + "--disable-silent-rules", + "--disable-full-test-suite", + "--disable-maintainer-mode", + "--disable-option-checking", + "--disable-dependency-tracking", + "--disable-heartbeat-support", + "--disable-gtk-doc-html", + "--without-p11-kit", + "--disable-rpath", + "--without-idn", + "--with-included-unistring", + "--with-included-libtasn1", + "--with-libiconv-prefix={}".format(self.dependencies["libiconv"].package_folder), + "--enable-shared={}".format(yes_no(self.options.shared)), + "--enable-static={}".format(yes_no(not self.options.shared)), + "--with-cxx={}".format(yes_no(self.options.enable_cxx)), + "--with-zlib={}".format(yes_no(self.options.with_zlib)), + "--with-brotli={}".format(yes_no(self.options.with_brotli)), + "--with-zstd={}".format(yes_no(self.options.with_zstd)), + "--enable-tools={}".format(yes_no(self.options.enable_tools)), + "--enable-openssl-compatibility={}".format(yes_no(self.options.enable_openssl_compatibility)), + ]) + env = autotoolstc.environment() + if cross_building(self): + # INFO: Undefined symbols for architecture Mac arm64 rpl_malloc and rpl_realloc + env.define("ac_cv_func_malloc_0_nonnull", "yes") + env.define("ac_cv_func_realloc_0_nonnull", "yes") + autotoolstc.generate(env) + autodeps = AutotoolsDeps(self) + autodeps.generate() + pkgdeps = PkgConfigDeps(self) + pkgdeps.generate() + + def build(self): + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.libs = ["gnutls", "gnutlsxx"] if self.options.enable_cxx else ["gnutls"] + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "GnuTLS") + self.cpp_info.set_property("cmake_target_name", "GnuTLS::GnuTLS") + self.cpp_info.set_property("pkg_config_name", "gnutls") + + if is_apple_os(self): + self.cpp_info.frameworks = ["Security", "CoreFoundation"] + elif self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread", "m"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "GnuTLS" + self.cpp_info.names["cmake_find_package_multi"] = "GnuTLS" + if self.options.enable_tools: + bin_path = os.path.join(self.package_folder, "bin") + self.output.info("Appending PATH env var with : {}".format(bin_path)) + self.env_info.PATH.append(bin_path) diff --git a/recipes/gnutls/all/patches/0001-fix-isdigit.patch b/recipes/gnutls/all/patches/0001-fix-isdigit.patch new file mode 100644 index 0000000000000..64c04ca78c4c2 --- /dev/null +++ b/recipes/gnutls/all/patches/0001-fix-isdigit.patch @@ -0,0 +1,149 @@ +diff --git a/lib/minitasn1/decoding.c b/lib/minitasn1/decoding.c +index 378219c..f75baa7 100644 +--- a/lib/minitasn1/decoding.c ++++ b/lib/minitasn1/decoding.c +@@ -32,7 +32,6 @@ + #include + #include + #include +-#include "c-ctype.h" + + #ifdef DEBUG + # define warn() fprintf(stderr, "%s: %d\n", __func__, __LINE__) +@@ -353,7 +352,7 @@ _asn1_get_time_der (unsigned type, const unsigned char *der, int der_len, int *r + p = &der[len_len]; + for (i=0;i<(unsigned)(str_len-1);i++) + { +- if (c_isdigit(p[i]) == 0) ++ if (isdigit(p[i]) == 0) + { + if (type == ASN1_ETYPE_GENERALIZED_TIME) + { +diff --git a/lib/minitasn1/element.c b/lib/minitasn1/element.c +index 550fdb2..58d9243 100644 +--- a/lib/minitasn1/element.c ++++ b/lib/minitasn1/element.c +@@ -30,7 +30,6 @@ + #include "parser_aux.h" + #include + #include "structure.h" +-#include "c-ctype.h" + #include "element.h" + + void +@@ -380,7 +379,7 @@ asn1_write_value (asn1_node node_root, const char *name, + case ASN1_ETYPE_ENUMERATED: + if (len == 0) + { +- if ((c_isdigit (value[0])) || (value[0] == '-')) ++ if ((isdigit (value[0])) || (value[0] == '-')) + { + value_temp = malloc (SIZEOF_UNSIGNED_LONG_INT); + if (value_temp == NULL) +@@ -453,7 +452,7 @@ asn1_write_value (asn1_node node_root, const char *name, + p = node->down; + while (type_field (p->type) != ASN1_ETYPE_DEFAULT) + p = p->right; +- if ((c_isdigit (p->value[0])) || (p->value[0] == '-')) ++ if ((isdigit (p->value[0])) || (p->value[0] == '-')) + { + default_temp = malloc (SIZEOF_UNSIGNED_LONG_INT); + if (default_temp == NULL) +@@ -519,7 +518,7 @@ asn1_write_value (asn1_node node_root, const char *name, + break; + case ASN1_ETYPE_OBJECT_ID: + for (i = 0; i < _asn1_strlen (value); i++) +- if ((!c_isdigit (value[i])) && (value[i] != '.') && (value[i] != '+')) ++ if ((!isdigit (value[i])) && (value[i] != '.') && (value[i] != '+')) + return ASN1_VALUE_NOT_VALID; + if (node->type & CONST_DEFAULT) + { +@@ -540,7 +539,7 @@ asn1_write_value (asn1_node node_root, const char *name, + if (len < 11) + return ASN1_VALUE_NOT_VALID; + for (k = 0; k < 10; k++) +- if (!c_isdigit (value[k])) ++ if (!isdigit (value[k])) + return ASN1_VALUE_NOT_VALID; + switch (len) + { +@@ -549,7 +548,7 @@ asn1_write_value (asn1_node node_root, const char *name, + return ASN1_VALUE_NOT_VALID; + break; + case 13: +- if ((!c_isdigit (value[10])) || (!c_isdigit (value[11])) || ++ if ((!isdigit (value[10])) || (!isdigit (value[11])) || + (value[12] != 'Z')) + return ASN1_VALUE_NOT_VALID; + break; +@@ -557,16 +556,16 @@ asn1_write_value (asn1_node node_root, const char *name, + if ((value[10] != '+') && (value[10] != '-')) + return ASN1_VALUE_NOT_VALID; + for (k = 11; k < 15; k++) +- if (!c_isdigit (value[k])) ++ if (!isdigit (value[k])) + return ASN1_VALUE_NOT_VALID; + break; + case 17: +- if ((!c_isdigit (value[10])) || (!c_isdigit (value[11]))) ++ if ((!isdigit (value[10])) || (!isdigit (value[11]))) + return ASN1_VALUE_NOT_VALID; + if ((value[12] != '+') && (value[12] != '-')) + return ASN1_VALUE_NOT_VALID; + for (k = 13; k < 17; k++) +- if (!c_isdigit (value[k])) ++ if (!isdigit (value[k])) + return ASN1_VALUE_NOT_VALID; + break; + default: +@@ -890,7 +889,7 @@ asn1_read_value_type (asn1_node_const root, const char *name, void *ivalue, + p = node->down; + while (type_field (p->type) != ASN1_ETYPE_DEFAULT) + p = p->right; +- if ((c_isdigit (p->value[0])) || (p->value[0] == '-') ++ if ((isdigit (p->value[0])) || (p->value[0] == '-') + || (p->value[0] == '+')) + { + result = _asn1_convert_integer +diff --git a/lib/minitasn1/int.h b/lib/minitasn1/int.h +index 57f1efd..8e3e2e4 100644 +--- a/lib/minitasn1/int.h ++++ b/lib/minitasn1/int.h +@@ -29,6 +29,7 @@ + #include + #include + #include ++#include + #include + + #ifdef HAVE_SYS_TYPES_H +diff --git a/lib/minitasn1/parser_aux.c b/lib/minitasn1/parser_aux.c +index bb88ab9..c01b3fa 100644 +--- a/lib/minitasn1/parser_aux.c ++++ b/lib/minitasn1/parser_aux.c +@@ -26,7 +26,6 @@ + #include "gstr.h" + #include "structure.h" + #include "element.h" +-#include "c-ctype.h" + + char _asn1_identifierMissing[ASN1_MAX_NAME_SIZE + 1]; /* identifier name not found */ + +@@ -755,7 +754,7 @@ _asn1_expand_object_id (list_type **list, asn1_node node) + p2 = p->down; + if (p2 && (type_field (p2->type) == ASN1_ETYPE_CONSTANT)) + { +- if (p2->value && !c_isdigit (p2->value[0])) ++ if (p2->value && !isdigit (p2->value[0])) + { + _asn1_str_cpy (name2, sizeof (name2), name_root); + _asn1_str_cat (name2, sizeof (name2), "."); +@@ -1067,7 +1066,7 @@ _asn1_check_identifier (asn1_node_const node) + p2 = p->down; + if (p2 && (type_field (p2->type) == ASN1_ETYPE_CONSTANT)) + { +- if (p2->value && !c_isdigit (p2->value[0])) ++ if (p2->value && !isdigit (p2->value[0])) + { + _asn1_str_cpy (name2, sizeof (name2), node->name); + _asn1_str_cat (name2, sizeof (name2), "."); diff --git a/recipes/gnutls/all/test_package/CMakeLists.txt b/recipes/gnutls/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..6d57019b23f0b --- /dev/null +++ b/recipes/gnutls/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(GnuTLS REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE GnuTLS::GnuTLS) diff --git a/recipes/gnutls/all/test_package/conanfile.py b/recipes/gnutls/all/test_package/conanfile.py new file mode 100644 index 0000000000000..c4b7c357ad04a --- /dev/null +++ b/recipes/gnutls/all/test_package/conanfile.py @@ -0,0 +1,27 @@ + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gnutls/all/test_package/test_package.c b/recipes/gnutls/all/test_package/test_package.c new file mode 100644 index 0000000000000..e40be9a5950ff --- /dev/null +++ b/recipes/gnutls/all/test_package/test_package.c @@ -0,0 +1,16 @@ +#include +#include + +int main (void) { + int result = 0; + gnutls_session_t session; + + gnutls_global_init(); + gnutls_global_set_log_level(0); + + gnutls_init(&session, GNUTLS_SERVER); + gnutls_deinit(session); + gnutls_global_deinit(); + + return EXIT_SUCCESS; +} diff --git a/recipes/gnutls/all/test_v1_package/CMakeLists.txt b/recipes/gnutls/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de3b75d9538de --- /dev/null +++ b/recipes/gnutls/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/gnutls/all/test_v1_package/conanfile.py b/recipes/gnutls/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..90eb89e3f2f46 --- /dev/null +++ b/recipes/gnutls/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, CMake, tools + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/gnutls/config.yml b/recipes/gnutls/config.yml new file mode 100644 index 0000000000000..c993c311a349d --- /dev/null +++ b/recipes/gnutls/config.yml @@ -0,0 +1,3 @@ +versions: + "3.7.8": + folder: "all" diff --git a/recipes/godot_headers/all/conandata.yml b/recipes/godot_headers/all/conandata.yml index 7e0f9e32ac8cf..8764611b2ac9a 100644 --- a/recipes/godot_headers/all/conandata.yml +++ b/recipes/godot_headers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.5.1": + url: "https://github.com/godotengine/godot-headers/archive/godot-3.5.1-stable.tar.gz" + sha256: "1c38268031425a4881c0d6d41926a0f1bf5847f05dc24c29332609e318276b6b" "3.4.4": url: "https://github.com/godotengine/godot-headers/archive/godot-3.4.4-stable.tar.gz" sha256: "bb0eac00a4d5b800a4ca2555d11b4a35981bdb730b630e9bd31a0649fa1d6fd7" diff --git a/recipes/godot_headers/all/conanfile.py b/recipes/godot_headers/all/conanfile.py index 49da40f0936eb..0a0d46219f9db 100644 --- a/recipes/godot_headers/all/conanfile.py +++ b/recipes/godot_headers/all/conanfile.py @@ -16,12 +16,12 @@ class GodotHeadersConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def package_id(self): - self.info.clear() - def layout(self): basic_layout(self, src_folder="src") + def package_id(self): + self.info.clear() + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -36,5 +36,5 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] + self.cpp_info.resdirs = ["res"] diff --git a/recipes/godot_headers/all/test_package/conanfile.py b/recipes/godot_headers/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/godot_headers/all/test_package/conanfile.py +++ b/recipes/godot_headers/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/godot_headers/config.yml b/recipes/godot_headers/config.yml index c6a4cef379254..3ded438e58f33 100644 --- a/recipes/godot_headers/config.yml +++ b/recipes/godot_headers/config.yml @@ -1,4 +1,6 @@ versions: + "3.5.1": + folder: all "3.4.4": folder: all "3.4": diff --git a/recipes/googleapis/all/CMakeLists.txt b/recipes/googleapis/all/CMakeLists.txt index 78db768f95305..a66178c44cba0 100644 --- a/recipes/googleapis/all/CMakeLists.txt +++ b/recipes/googleapis/all/CMakeLists.txt @@ -3,9 +3,8 @@ cmake_minimum_required(VERSION 3.20) project(googleapis) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - find_package(Protobuf REQUIRED CONFIG) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +include("${CMAKE_CURRENT_SOURCE_DIR}/generated_targets.cmake") diff --git a/recipes/googleapis/all/conandata.yml b/recipes/googleapis/all/conandata.yml index 719b54343e312..d67e7781b543f 100644 --- a/recipes/googleapis/all/conandata.yml +++ b/recipes/googleapis/all/conandata.yml @@ -7,6 +7,9 @@ # (master branch) https://github.com/grpc/grpc/blob/master/CMakeLists.txt#L347 sources: + "cci.20221108": + url: "https://github.com/googleapis/googleapis/archive/67b2d7c2fb11188776bc398f02c67fccd8187502.zip" + sha256: "cca450c34e3a8adc03364686d44748f362e4a9af6d3ef32b918f2d5483a3025e" "cci.20220711": url: "https://github.com/googleapis/googleapis/archive/220b13e335ea8e0153c84c56a135a19d15384621.zip" sha256: "0a8aac018f49f8595fc0fbfe53f46d73b2fb42661a425746be802302928e6ac2" @@ -19,3 +22,29 @@ sources: "cci.20210730": # Used by grpc 1.46.3 url: "https://github.com/googleapis/googleapis/archive/2f9af297c84c55c8b871ba4495e01ade42476c92.zip" sha256: "c53ef0768e07bd4e2334cdacba8c6672d2252bef307a889f94893652e8e7f3a4" +patches: + "cci.20221108": + - patch_file: "patches/cci.20220711/001-fix-google-api-deps.patch" + patch_description: "Fix incorrect dependency name in BUILD.bazel file" + patch_type: "bugfix" + patch_source: "https://github.com/googleapis/googleapis/commit/5fd35b6a1316570df7f117426ed35af9086e9bda" + "cci.20220711": + - patch_file: "patches/cci.20220711/001-fix-google-api-deps.patch" + patch_description: "Fix incorrect dependency name in BUILD.bazel file" + patch_type: "bugfix" + patch_source: "https://github.com/googleapis/googleapis/commit/5fd35b6a1316570df7f117426ed35af9086e9bda" + "cci.20220531": + - patch_file: "patches/cci.20220531/001-fix-google-api-deps.patch" + patch_description: "Fix incorrect dependency name in BUILD.bazel file" + patch_type: "bugfix" + patch_source: "https://github.com/googleapis/googleapis/commit/5fd35b6a1316570df7f117426ed35af9086e9bda" + "cci.20211122": + - patch_file: "patches/cci.20211122/001-fix-google-api-deps.patch" + patch_description: "Fix incorrect dependency name in BUILD.bazel file" + patch_type: "bugfix" + patch_source: "https://github.com/googleapis/googleapis/commit/5fd35b6a1316570df7f117426ed35af9086e9bda" + "cci.20210730": + - patch_file: "patches/cci.20210730/001-fix-google-api-deps.patch" + patch_description: "Fix incorrect dependency name in BUILD.bazel file" + patch_type: "bugfix" + patch_source: "https://github.com/googleapis/googleapis/commit/5fd35b6a1316570df7f117426ed35af9086e9bda" diff --git a/recipes/googleapis/all/conanfile.py b/recipes/googleapis/all/conanfile.py index ede5acb555a85..47aa18c5eedae 100644 --- a/recipes/googleapis/all/conanfile.py +++ b/recipes/googleapis/all/conanfile.py @@ -2,35 +2,44 @@ import functools import glob from io import StringIO + from conan import ConanFile -from conans import CMake, tools -from conan.tools.files import get, copy -from conans.errors import ConanInvalidConfiguration +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.files import apply_conandata_patches, copy, get, export_conandata_patches, copy +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version + from helpers import parse_proto_libraries +required_conan_version = ">=1.50.0" + class GoogleAPIS(ConanFile): name = "googleapis" + package_type = "library" description = "Public interface definitions of Google APIs" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/googleapis/googleapis" topics = "google", "protos", "api" settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain" options = { - "shared": [True, False], + "shared": [True, False], "fPIC": [True, False] } default_options = { - "shared": False, + "shared": False, "fPIC": True } exports = "helpers.py" short_paths = True def export_sources(self): - self.copy("CMakeLists.txt") + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=os.path.join(self.export_sources_folder, "src")) + export_conandata_patches(self) def source(self): get(self, **self.conan_data["sources"][str(self.version)], destination=self.source_folder, strip_root=True) @@ -39,6 +48,9 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") + def configure(self): if self.options.shared: del self.options.fPIC @@ -46,18 +58,15 @@ def configure(self): def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) <= "5": + check_min_cppstd(self, 11) + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) <= "5": raise ConanInvalidConfiguration("Build with GCC 5 fails") - if self.settings.compiler in ["Visual Studio", "msvc"] and self.options.shared: + if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration("Source code generated from protos is missing some export macro") if self.options.shared and not self.options["protobuf"].shared: raise ConanInvalidConfiguration("If built as shared, protobuf must be shared as well. Please, use `protobuf:shared=True`") - def requirements(self): - self.requires('protobuf/3.21.4') - @property def _cmake_new_enough(self): try: @@ -72,17 +81,14 @@ def _cmake_new_enough(self): else: return True + def requirements(self): + self.requires('protobuf/3.21.4', transitive_headers=True) + def build_requirements(self): self.build_requires('protobuf/3.21.4') # CMake >= 3.20 is required. There is a proto with dots in the name 'k8s.min.proto' and CMake fails to generate project files if not self._cmake_new_enough: - self.build_requires('cmake/3.23.2') - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + self.build_requires('cmake/3.23.5') @functools.lru_cache(1) def _parse_proto_libraries(self): @@ -90,10 +96,10 @@ def _parse_proto_libraries(self): proto_libraries = [] for filename in glob.iglob(os.path.join(self.source_folder, 'google', '**', 'BUILD.bazel'), recursive=True): proto_libraries += parse_proto_libraries(filename, self.source_folder, self.output.error) - + for filename in glob.iglob(os.path.join(self.source_folder, 'grafeas', '**', 'BUILD.bazel'), recursive=True): proto_libraries += parse_proto_libraries(filename, self.source_folder, self.output.error) - + # Validate that all files exist and all dependencies are found all_deps = [f"{it.qname}:{it.name}" for it in proto_libraries] all_deps += ["protobuf::libprotobuf"] @@ -102,13 +108,14 @@ def _parse_proto_libraries(self): # Mark the libraries we need recursively (C++ context) all_dict = {f"{it.qname}:{it.name}": it for it in proto_libraries} + def activate_library(proto_library): proto_library.is_used = True for it_dep in proto_library.deps: if it_dep == "protobuf::libprotobuf": continue activate_library(all_dict[it_dep]) - + for it in filter(lambda u: u.is_used, proto_libraries): activate_library(it) @@ -119,40 +126,78 @@ def deactivate_library(key): # - Inconvenient macro names from usr/include/sys/syslimits.h in some macOS SDKs: GID_MAX # Patched here: https://github.com/protocolbuffers/protobuf/commit/f138d5de2535eb7dd7c8d0ad5eb16d128ab221fd # as of 3.21.4 issue still exist - if tools.Version(self.deps_cpp_info["protobuf"].version) <= "3.21.5" and self.settings.os == "Macos": + if Version(self.dependencies["protobuf"].ref.version) <= "3.21.5" and self.settings.os == "Macos" or \ + self.settings.os == "Android": deactivate_library("//google/storagetransfer/v1:storagetransfer_proto") + deactivate_library("//google/storagetransfer/v1:storagetransfer_cc_proto") # - Inconvenient macro names from /usr/include/math.h : DOMAIN if (self.settings.os == "Linux" and self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++") or \ - self.settings.compiler in ["Visual Studio", "msvc"]: + is_msvc(self): deactivate_library("//google/cloud/channel/v1:channel_proto") deactivate_library("//google/cloud/channel/v1:channel_cc_proto") + # - Inconvenient names for android + if self.settings.os == "Android": + deactivate_library("//google/identity/accesscontextmanager/type:type_proto") + deactivate_library("//google/identity/accesscontextmanager/type:type_cc_proto") + deactivate_library("//google/identity/accesscontextmanager/v1:accesscontextmanager_proto") + deactivate_library("//google/identity/accesscontextmanager/v1:accesscontextmanager_cc_proto") + deactivate_library("//google/devtools/testing/v1:testing_proto") + deactivate_library("//google/devtools/testing/v1:testing_cc_proto") + deactivate_library("//google/devtools/resultstore/v2:resultstore_proto") + deactivate_library("//google/devtools/resultstore/v2:resultstore_cc_proto") + deactivate_library("//google/cloud/talent/v4beta1:talent_proto") + deactivate_library("//google/cloud/talent/v4beta1:talent_cc_proto") + deactivate_library("//google/cloud/talent/v4:talent_proto") + deactivate_library("//google/cloud/talent/v4:talent_cc_proto") + deactivate_library("//google/cloud/asset/v1:asset_proto") + deactivate_library("//google/cloud/asset/v1:asset_cc_proto") return proto_libraries def build(self): + apply_conandata_patches(self) proto_libraries = self._parse_proto_libraries() - with open(os.path.join(self.source_folder, "CMakeLists.txt"), "a", encoding="utf-8") as f: + # Use a separate file to host the generated code, which is generated in full each time. + # This is safe to call multiple times, for example, if you need to invoke `conan build` more than + # once. + with open(os.path.join(self.source_folder, "generated_targets.cmake"), "w", encoding="utf-8") as f: + f.write("# Generated C++ library targets for googleapis\n") + f.write("# DO NOT EDIT - change the generation code in conanfile.py instead\n") for it in filter(lambda u: u.is_used, proto_libraries): f.write(it.cmake_content) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() + _DEPS_FILE = "res/generated_targets.deps" + def package(self): copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) copy(self, pattern="*.proto", src=self.source_folder, dst=os.path.join(self.package_folder, "res")) copy(self, pattern="*.pb.h", src=self.build_folder, dst=os.path.join(self.package_folder, "include")) - + copy(self, pattern="*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) copy(self, pattern="*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) copy(self, pattern="*.so*", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) copy(self, pattern="*.dylib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) copy(self, pattern="*.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + with open(os.path.join(self.package_folder, self._DEPS_FILE), "w", encoding="utf-8") as f: + for lib in filter(lambda u: u.is_used, self._parse_proto_libraries()): + interface = 'LIB' if lib.srcs else 'INTERFACE' + f.write(f"{lib.cmake_target} {interface} {','.join(lib.cmake_deps)}\n") + def package_id(self): self.info.requires["protobuf"].full_package_mode() def package_info(self): - # We are not creating components, we can just collect the libraries - self.cpp_info.libs = tools.collect_libs(self) - if self.settings.os == "Linux": - self.cpp_info.system_libs.extend(["m"]) + with open(os.path.join(self.package_folder, self._DEPS_FILE), "r", encoding="utf-8") as f: + for line in f.read().splitlines(): + (name, libtype, deps) = line.rstrip('\n').split(' ') + self.cpp_info.components[name].requires = deps.split(',') + self.cpp_info.components[name].resdirs = ["res"] + if libtype == 'LIB': + self.cpp_info.components[name].libs = [name] + self.cpp_info.components[name].names["pkg_config"] = name + if self.settings.os == "Linux": + self.cpp_info.components[name].system_libs.extend(["m"]) diff --git a/recipes/googleapis/all/helpers.py b/recipes/googleapis/all/helpers.py index 9f3881f847e6f..bc9910954682a 100644 --- a/recipes/googleapis/all/helpers.py +++ b/recipes/googleapis/all/helpers.py @@ -41,6 +41,16 @@ def cmake_target(self): qname = qname[2:] return f'{qname.replace("/", "_")}_{self.name}' + def shorten_cmake_target(self, cmake_target): + short_name = cmake_target + prefix = "google_" + suffix = "_proto" + if cmake_target.startswith(prefix): + short_name = short_name[len(prefix):] + if short_name.endswith(suffix): + short_name = short_name[:-len(suffix)] + return short_name + @property def cmake_deps(self): def to_cmake_target(item): @@ -48,32 +58,39 @@ def to_cmake_target(item): return item[2:].replace("/", "_").replace(":", "_") return item return [to_cmake_target(it) for it in self.deps] + + @property + def cmake_deps_short(self): + return [self.shorten_cmake_target(dep) for dep in self.cmake_deps] @property def cmake_content(self): - content = f"\n\n# {self.cmake_target}\n" + cmake_target_short = self.shorten_cmake_target(self.cmake_target) + content = f"\n\n# {self.cmake_target} ({cmake_target_short})\n" content += "\n".join([f"#{it}" for it in self.dumps().split('\n')]) content += "\n" if not self.srcs: content += textwrap.dedent(f"""\ - add_library({self.cmake_target} INTERFACE) + add_library({cmake_target_short} INTERFACE) """) else: content += textwrap.dedent(f"""\ - set({self.cmake_target}_PROTOS {" ".join(["${CMAKE_SOURCE_DIR}/"+it for it in self.srcs])}) - add_library({self.cmake_target} ${{{self.cmake_target}_PROTOS}}) - target_include_directories({self.cmake_target} PUBLIC ${{CMAKE_BINARY_DIR}}) - target_compile_features({self.cmake_target} PUBLIC cxx_std_11) + set({cmake_target_short}_PROTOS {" ".join(["${CMAKE_SOURCE_DIR}/"+it for it in self.srcs])}) + add_library({cmake_target_short} ${{{cmake_target_short}_PROTOS}}) + target_include_directories({cmake_target_short} PUBLIC ${{CMAKE_BINARY_DIR}}) + target_compile_features({cmake_target_short} PUBLIC cxx_std_11) + # set project_label to shorten the name of the vcxproj file and cause shorter paths + set_property(TARGET {cmake_target_short} PROPERTY OUTPUT_NAME "{self.cmake_target}") protobuf_generate(LANGUAGE cpp - TARGET {self.cmake_target} - PROTOS ${{{self.cmake_target}_PROTOS}} + TARGET {cmake_target_short} + PROTOS ${{{cmake_target_short}_PROTOS}} IMPORT_DIRS ${{CMAKE_SOURCE_DIR}} ) """) if self.deps: content += textwrap.dedent(f"""\ - target_link_libraries({self.cmake_target} {"PUBLIC" if self.srcs else "INTERFACE"} {" ".join(self.cmake_deps)}) + target_link_libraries({cmake_target_short} {"PUBLIC" if self.srcs else "INTERFACE"} {" ".join(self.cmake_deps_short)}) """) return content diff --git a/recipes/googleapis/all/patches/cci.20210730/001-fix-google-api-deps.patch b/recipes/googleapis/all/patches/cci.20210730/001-fix-google-api-deps.patch new file mode 100644 index 0000000000000..dc65e55e9e148 --- /dev/null +++ b/recipes/googleapis/all/patches/cci.20210730/001-fix-google-api-deps.patch @@ -0,0 +1,19 @@ +diff --git a/google/api/BUILD.bazel b/google/api/BUILD.bazel +index ebb9ba8..7188218 100644 +--- a/google/api/BUILD.bazel ++++ b/google/api/BUILD.bazel +@@ -509,12 +509,12 @@ cc_proto_library( + + cc_proto_library( + name = "monitoring_cc_proto", +- deps = ["monitoring_proto"], ++ deps = [":monitoring_proto"], + ) + + cc_proto_library( + name = "quota_cc_proto", +- deps = ["quota_proto"], ++ deps = [":quota_proto"], + ) + + cc_proto_library( diff --git a/recipes/googleapis/all/patches/cci.20211122/001-fix-google-api-deps.patch b/recipes/googleapis/all/patches/cci.20211122/001-fix-google-api-deps.patch new file mode 100644 index 0000000000000..cd41b738015a0 --- /dev/null +++ b/recipes/googleapis/all/patches/cci.20211122/001-fix-google-api-deps.patch @@ -0,0 +1,19 @@ +diff --git a/google/api/BUILD.bazel b/google/api/BUILD.bazel +index ebb9ba8..7188218 100644 +--- a/google/api/BUILD.bazel ++++ b/google/api/BUILD.bazel +@@ -574,12 +574,12 @@ cc_proto_library( + + cc_proto_library( + name = "monitoring_cc_proto", +- deps = ["monitoring_proto"], ++ deps = [":monitoring_proto"], + ) + + cc_proto_library( + name = "quota_cc_proto", +- deps = ["quota_proto"], ++ deps = [":quota_proto"], + ) + + cc_proto_library( diff --git a/recipes/googleapis/all/patches/cci.20220531/001-fix-google-api-deps.patch b/recipes/googleapis/all/patches/cci.20220531/001-fix-google-api-deps.patch new file mode 100644 index 0000000000000..08060c68c114a --- /dev/null +++ b/recipes/googleapis/all/patches/cci.20220531/001-fix-google-api-deps.patch @@ -0,0 +1,19 @@ +diff --git a/google/api/BUILD.bazel b/google/api/BUILD.bazel +index ebb9ba8..7188218 100644 +--- a/google/api/BUILD.bazel ++++ b/google/api/BUILD.bazel +@@ -578,12 +578,12 @@ cc_proto_library( + + cc_proto_library( + name = "monitoring_cc_proto", +- deps = ["monitoring_proto"], ++ deps = [":monitoring_proto"], + ) + + cc_proto_library( + name = "quota_cc_proto", +- deps = ["quota_proto"], ++ deps = [":quota_proto"], + ) + + cc_proto_library( diff --git a/recipes/googleapis/all/patches/cci.20220711/001-fix-google-api-deps.patch b/recipes/googleapis/all/patches/cci.20220711/001-fix-google-api-deps.patch new file mode 100644 index 0000000000000..42682e4d30899 --- /dev/null +++ b/recipes/googleapis/all/patches/cci.20220711/001-fix-google-api-deps.patch @@ -0,0 +1,19 @@ +diff --git a/google/api/BUILD.bazel b/google/api/BUILD.bazel +index ebb9ba8..7188218 100644 +--- a/google/api/BUILD.bazel ++++ b/google/api/BUILD.bazel +@@ -580,12 +580,12 @@ cc_proto_library( + + cc_proto_library( + name = "monitoring_cc_proto", +- deps = ["monitoring_proto"], ++ deps = [":monitoring_proto"], + ) + + cc_proto_library( + name = "quota_cc_proto", +- deps = ["quota_proto"], ++ deps = [":quota_proto"], + ) + + cc_proto_library( diff --git a/recipes/googleapis/all/test_package/conanfile.py b/recipes/googleapis/all/test_package/conanfile.py index e279a6afcd236..58019cb35dee5 100644 --- a/recipes/googleapis/all/test_package/conanfile.py +++ b/recipes/googleapis/all/test_package/conanfile.py @@ -1,8 +1,7 @@ import os from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain -from conan.tools.build import cross_building as tools_cross_building -from conan.tools.layout import cmake_layout +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain +from conan.tools.build import can_run class TestPackageConan(ConanFile): @@ -25,5 +24,5 @@ def build(self): cmake.build() def test(self): - if not tools_cross_building(self): + if can_run(self): self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/googleapis/all/test_package/test_package.cpp b/recipes/googleapis/all/test_package/test_package.cpp index 32f0b086e3717..3b9a08aef74ea 100644 --- a/recipes/googleapis/all/test_package/test_package.cpp +++ b/recipes/googleapis/all/test_package/test_package.cpp @@ -1,14 +1,13 @@ #include -#include "google/type/color.pb.h" +#include int main() { std::cout << "Conan - test package for googleapis\n"; - google::type::Color c; - c.set_red(255); - c.set_blue(255); + google::bigtable::v2::CheckAndMutateRowRequest request; + request.set_table_name("projects/my-project/instances/my-instance/tables/my-table"); - std::cout << c.DebugString(); + std::cout << request.DebugString(); return 0; } diff --git a/recipes/googleapis/all/test_v1_package/CMakeLists.txt b/recipes/googleapis/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..d1b58c810713b --- /dev/null +++ b/recipes/googleapis/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(googleapis REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE googleapis::googleapis) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/googleapis/all/test_v1_package/conanfile.py b/recipes/googleapis/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/googleapis/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/googleapis/config.yml b/recipes/googleapis/config.yml index 0df9fcd3465bb..6656d26c71a64 100644 --- a/recipes/googleapis/config.yml +++ b/recipes/googleapis/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20221108": + folder: all "cci.20220711": folder: all "cci.20220531": diff --git a/recipes/gperf/all/conandata.yml b/recipes/gperf/all/conandata.yml index abb928a47430d..1ee999c771b91 100644 --- a/recipes/gperf/all/conandata.yml +++ b/recipes/gperf/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "3.1": - patch_file: "patches/0001-remove-register-keyword.patch" - base_path: "source_subfolder" diff --git a/recipes/gperf/all/conanfile.py b/recipes/gperf/all/conanfile.py index 216d9b3fea59d..6527eca9695ee 100644 --- a/recipes/gperf/all/conanfile.py +++ b/recipes/gperf/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from contextlib import contextmanager +from conan import ConanFile +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, check_min_vs, unix_path import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.57.0" class GperfConan(ConanFile): @@ -11,88 +15,81 @@ class GperfConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.gnu.org/software/gperf" description = "GNU gperf is a perfect hash function generator" - topics = ("gperf", "hash-generator", "hash") + topics = ("hash-generator", "hash") settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/*" - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) - @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + self.folders.build = self.folders.source def package_id(self): del self.info.settings.compiler - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - def build_requirements(self): - if self._is_msvc: - self.build_requires("automake/1.16.3") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if self._is_msvc and tools.Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") - self._autotools.configure() - return self._autotools - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - - @contextmanager - def _build_context(self): - with tools.chdir(self._source_subfolder): - if self._is_msvc: - with tools.vcvars(self.settings): - env = { - "CC": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "CXX": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "CFLAGS": "-{}".format(self.settings.compiler.runtime), - "CXXLAGS": "-{}".format(self.settings.compiler.runtime), - "CPPFLAGS": "-D_WIN32_WINNT=_WIN32_WINNT_WIN8", - "LD": "link", - "NM": "dumpbin -symbols", - "STRIP": ":", - "AR": "{} lib".format(tools.unix_path(self._user_info_build["automake"].ar_lib)), - "RANLIB": ":", - } - with tools.environment_append(env): - yield - else: - yield + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + if is_msvc(self) and check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + tc.generate() + + if is_msvc(self): + env = Environment() + compile_wrapper = unix_path(self, os.path.join(self.source_folder, "build-aux", "compile")) + ar_wrapper = unix_path(self, os.path.join(self.source_folder, "build-aux", "ar-lib")) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.append("CPPFLAGS", "-D_WIN32_WINNT=_WIN32_WINNT_WIN8") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + + #Prevent msys2 from performing erroneous path conversions for C++ files + # when invoking cl.exe as this is already handled by the compile wrapper. + env.define("MSYS2_ARG_CONV_EXCL", "-Tp") + env.vars(self).save_script("conanbuild_gperf_msvc") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with self._build_context(): - autotools = self._configure_autotools() + apply_conandata_patches(self) + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.configure() autotools.make() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + with chdir(self, self.source_folder): + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.includedirs = [] - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) + self.cpp_info.libdirs = [] + + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/gperf/all/test_package/conanfile.py b/recipes/gperf/all/test_package/conanfile.py index 5ea7c84d8f6b0..619bde15fb3e9 100644 --- a/recipes/gperf/all/test_package/conanfile.py +++ b/recipes/gperf/all/test_package/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools +from conan import ConanFile class TestPackageConan(ConanFile): - settings = "os", "arch" + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - self.run("gperf --version", run_environment=True) + self.run("gperf --version") diff --git a/recipes/gperf/all/test_v1_package/conanfile.py b/recipes/gperf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..45466856213a3 --- /dev/null +++ b/recipes/gperf/all/test_v1_package/conanfile.py @@ -0,0 +1,9 @@ +from conans import ConanFile, tools + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not tools.cross_building(self): + self.run("gperf --version", run_environment=True) diff --git a/recipes/graphene/all/conandata.yml b/recipes/graphene/all/conandata.yml index b181922a1829a..31d9edff33102 100644 --- a/recipes/graphene/all/conandata.yml +++ b/recipes/graphene/all/conandata.yml @@ -1,13 +1,13 @@ sources: - "1.10.2": - url: "https://github.com/ebassi/graphene/releases/download/1.10.2/graphene-1.10.2.tar.xz" - sha256: "e97de8208f1aac4f913d4fa71ab73a7034e807186feb2abe55876e51c425a7f6" + "1.10.8": + url: "https://github.com/ebassi/graphene/archive/refs/tags/1.10.8.tar.gz" + sha256: "922dc109d2dc5dc56617a29bd716c79dd84db31721a8493a13a5f79109a4a4ed" + "1.10.6": + url: "https://github.com/ebassi/graphene/releases/download/1.10.6/graphene-1.10.6.tar.xz" + sha256: "80ae57723e4608e6875626a88aaa6f56dd25df75024bd16e9d77e718c3560b25" "1.10.4": url: "https://github.com/ebassi/graphene/releases/download/1.10.4/graphene-1.10.4.tar.xz" sha256: "b2a45f230f332478553bd79666eca8df1d1c6dbf208c344ba9f5120592772414" - "1.10.6": - url: "https://github.com/ebassi/graphene/archive/1.10.6.tar.gz" - sha256: "7eba972751d404316a9b59a7c1e0782de263c3cf9dd5ebf1503ba9b8354cc948" - "1.10.8": - url: "https://github.com/ebassi/graphene/archive/1.10.8.tar.gz" - sha256: "922dc109d2dc5dc56617a29bd716c79dd84db31721a8493a13a5f79109a4a4ed" + "1.10.2": + url: "https://github.com/ebassi/graphene/releases/download/1.10.2/graphene-1.10.2.tar.xz" + sha256: "e97de8208f1aac4f913d4fa71ab73a7034e807186feb2abe55876e51c425a7f6" diff --git a/recipes/graphene/all/conanfile.py b/recipes/graphene/all/conanfile.py index 2ee0de15b4bd3..c7a67802da5a5 100644 --- a/recipes/graphene/all/conanfile.py +++ b/recipes/graphene/all/conanfile.py @@ -1,18 +1,27 @@ -from conans import ConanFile, Meson, tools -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.29.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc_static_runtime +from conan.tools.scm import Version -class LibnameConan(ConanFile): +required_conan_version = ">=1.53.0" + + +class GrapheneConan(ConanFile): name = "graphene" description = "A thin layer of graphic data types." topics = ("graphic", "canvas", "types") url = "https://github.com/conan-io/conan-center-index" homepage = "http://ebassi.github.io/graphene/" license = "MIT" - generators = "pkg_config" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,91 +34,109 @@ class LibnameConan(ConanFile): "with_glib": True, } - _source_subfolder = "source_subfolder" - _build_subfolder = "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.compiler == "gcc": - if tools.Version(self.settings.compiler.version) < "5.0": - raise ConanInvalidConfiguration("graphene does not support GCC before 5.0") - - def build_requirements(self): - self.build_requires("meson/0.61.2") - self.build_requires("pkgconf/1.7.4") - - def requirements(self): - if self.options.with_glib: - self.requires("glib/2.73.0") def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if self.options.shared and self.options.with_glib: self.options["glib"].shared = True + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_glib: + self.requires("glib/2.75.2") + def validate(self): - if self.options.shared and self.options.with_glib and not self.options["glib"].shared: - raise ConanInvalidConfiguration( - "Linking a shared library against static glib can cause unexpected behaviour." - ) + if self.settings.compiler == "gcc": + if Version(self.settings.compiler.version) < "5.0": + raise ConanInvalidConfiguration("graphene does not support GCC before 5.0") + + if self.options.with_glib: + glib_is_shared = self.dependencies["glib"].options.shared + if self.options.shared and not glib_is_shared: + raise ConanInvalidConfiguration( + "Linking a shared library against static glib can cause unexpected behaviour." + ) + if glib_is_shared and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration( + "Linking shared glib with the MSVC static runtime is not supported" + ) + + def build_requirements(self): + self.tool_requires("meson/1.0.0") + if not self.conf.get("tools.gnu:pkg_config", default=False): + self.tool_requires("pkgconf/1.9.3") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_meson(self): - meson = Meson(self) - defs = {} - defs["gobject_types"] = "true" if self.options.with_glib else "false" - if tools.Version(self.version) < "1.10.4": - defs["introspection"] = "false" + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + deps = PkgConfigDeps(self) + deps.generate() + + meson = MesonToolchain(self) + meson.project_options.update({ + "tests": "false", + "installed_tests": "false", + "gtk_doc": "false", + }) + meson.project_options["gobject_types"] = "true" if self.options.with_glib else "false" + if Version(self.version) < "1.10.4": + meson.project_options["introspection"] = "false" else: - defs["introspection"] = "disabled" - defs["tests"] = "false" - defs["installed_tests"] = "false" - defs["gtk_doc"] = "false" - args=[] - args.append("--wrap-mode=nofallback") - meson.configure(defs=defs, build_folder=self._build_subfolder, source_folder=self._source_subfolder, pkg_config_paths=[self.install_folder], args=args) - return meson + meson.project_options["introspection"] = "disabled" + meson.generate() def build(self): - with tools.environment_append(tools.RunEnvironment(self).vars): - meson = self._configure_meson() - meson.build() + meson = Meson(self) + meson.configure() + meson.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() - with tools.environment_append({"PKG_CONFIG_PATH": self.install_folder}): - meson.install() - - if self.settings.compiler in ["Visual Studio", "msvc"] and not self.options.shared: - with tools.chdir(os.path.join(self.package_folder, "lib")): - if os.path.isfile("libgraphene-1.0.a"): - tools.rename("libgraphene-1.0.a", "graphene-1.0.lib") - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(self.package_folder, "*.pdb") + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.pdb", self.package_folder, recursive=True) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) def package_info(self): + self.cpp_info.components["graphene-1.0"].set_property("pkg_config_name", "graphene-1.0") self.cpp_info.components["graphene-1.0"].libs = ["graphene-1.0"] self.cpp_info.components["graphene-1.0"].includedirs = [os.path.join("include", "graphene-1.0"), os.path.join("lib", "graphene-1.0", "include")] - self.cpp_info.components["graphene-1.0"].names["pkg_config"] = "graphene-1.0" if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["graphene-1.0"].system_libs = ["m", "pthread"] if self.options.with_glib: self.cpp_info.components["graphene-1.0"].requires = ["glib::gobject-2.0"] if self.options.with_glib: + self.cpp_info.components["graphene-gobject-1.0"].set_property("pkg_config_name","graphene-gobject-1.0") self.cpp_info.components["graphene-gobject-1.0"].includedirs = [os.path.join("include", "graphene-1.0")] - self.cpp_info.components["graphene-gobject-1.0"].names["pkg_config"] = "graphene-gobject-1.0" self.cpp_info.components["graphene-gobject-1.0"].requires = ["graphene-1.0", "glib::gobject-2.0"] - def package_id(self): - if self.options.with_glib: - self.info.requires["glib"].full_package_mode() +def fix_msvc_libname(conanfile, remove_lib_prefix=True): + """remove lib prefix & change extension to .lib in case of cl like compiler""" + from conan.tools.files import rename + import glob + if not conanfile.settings.get_safe("compiler.runtime"): + return + libdirs = getattr(conanfile.cpp.package, "libdirs") + for libdir in libdirs: + for ext in [".dll.a", ".dll.lib", ".a"]: + full_folder = os.path.join(conanfile.package_folder, libdir) + for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")): + libname = os.path.basename(filepath)[0:-len(ext)] + if remove_lib_prefix and libname[0:3] == "lib": + libname = libname[3:] + rename(conanfile, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib")) diff --git a/recipes/graphene/all/test_package/CMakeLists.txt b/recipes/graphene/all/test_package/CMakeLists.txt index 1e14bbe9a2aff..086ffbaad4058 100644 --- a/recipes/graphene/all/test_package/CMakeLists.txt +++ b/recipes/graphene/all/test_package/CMakeLists.txt @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(graphene CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} CONAN_PKG::graphene) +target_link_libraries(${PROJECT_NAME} PRIVATE graphene::graphene) diff --git a/recipes/graphene/all/test_package/conanfile.py b/recipes/graphene/all/test_package/conanfile.py index d4128b0450777..6c64a877f7976 100644 --- a/recipes/graphene/all/test_package/conanfile.py +++ b/recipes/graphene/all/test_package/conanfile.py @@ -1,10 +1,20 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run + class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/graphene/all/test_v1_package/CMakeLists.txt b/recipes/graphene/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/graphene/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/graphene/all/test_v1_package/conanfile.py b/recipes/graphene/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/graphene/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/graphene/config.yml b/recipes/graphene/config.yml index 17c2fa360d757..a08ceb60b7f94 100644 --- a/recipes/graphene/config.yml +++ b/recipes/graphene/config.yml @@ -1,9 +1,9 @@ versions: - "1.10.2": - folder: "all" - "1.10.4": + "1.10.8": folder: "all" "1.10.6": folder: "all" - "1.10.8": + "1.10.4": + folder: "all" + "1.10.2": folder: "all" diff --git a/recipes/greg7mdp-gtl/all/conandata.yml b/recipes/greg7mdp-gtl/all/conandata.yml new file mode 100644 index 0000000000000..03c557a0c1185 --- /dev/null +++ b/recipes/greg7mdp-gtl/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "1.1.5": + url: "https://github.com/greg7mdp/gtl/archive/v1.1.5.tar.gz" + sha256: "2d943d2ccc33c6c662918efc51782dac414354a1458441f16041a98eec164bda" + "1.1.4": + url: "https://github.com/greg7mdp/gtl/archive/v1.1.4.tar.gz" + sha256: "b51b9951d11fb73ed22360a96a3f6c691c15202c3b14c79dcdd498da80b6502d" + "1.1.3": + url: "https://github.com/greg7mdp/gtl/archive/refs/tags/v1.1.3.tar.gz" + sha256: "c667690eeecf37f660d8a61bca1076e845154bc535c44ec0d2404c04c66ae228" + "1.1.2": + url: "https://github.com/greg7mdp/gtl/archive/refs/tags/v1.1.2.tar.gz" + sha256: "22ac9fb43608c7ddccb983096f5dadb036e5d3122d9194cdb42fee67d754c552" diff --git a/recipes/greg7mdp-gtl/all/conanfile.py b/recipes/greg7mdp-gtl/all/conanfile.py new file mode 100644 index 0000000000000..44af92f813395 --- /dev/null +++ b/recipes/greg7mdp-gtl/all/conanfile.py @@ -0,0 +1,74 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.51.3" + + +class Greg7mdpGtlConan(ConanFile): + name = "greg7mdp-gtl" + description = "Greg's Template Library of useful classes." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/greg7mdp/gtl" + topics = ("bitset", "memoize", "containers", "bitvector", "unordered-set", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _minimum_cpp_standard(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "10", + "apple-clang": "10", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.get_safe("compiler.version")) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="*.hpp", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + + self.cpp_info.set_property("cmake_file_name", "gtl") + self.cpp_info.set_property("cmake_target_name", "gtl::gtl") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "gtl" + self.cpp_info.filenames["cmake_find_package_multi"] = "gtl" + self.cpp_info.names["cmake_find_package"] = "gtl" + self.cpp_info.names["cmake_find_package_multi"] = "gtl" diff --git a/recipes/greg7mdp-gtl/all/test_package/CMakeLists.txt b/recipes/greg7mdp-gtl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a2b5f552d2486 --- /dev/null +++ b/recipes/greg7mdp-gtl/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.12) + +project(test_package CXX) + +find_package(gtl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gtl::gtl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/greg7mdp-gtl/all/test_package/conanfile.py b/recipes/greg7mdp-gtl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/greg7mdp-gtl/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/greg7mdp-gtl/all/test_package/test_package.cpp b/recipes/greg7mdp-gtl/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..543ef825d77e7 --- /dev/null +++ b/recipes/greg7mdp-gtl/all/test_package/test_package.cpp @@ -0,0 +1,28 @@ +// this code is referred from README.md of https://github.com/greg7mdp/gtl +#include +#include +#include + +using gtl::flat_hash_map; + +int main() { + // Create an unordered_map of three strings (that map to strings) + flat_hash_map email = + { + { "tom", "tom@gmail.com"}, + { "jeff", "jk@gmail.com"}, + { "jim", "jimg@microsoft.com"} + }; + + // Iterate and print keys and values + for (const auto& n : email) + std::cout << n.first << "'s email is: " << n.second << "\n"; + + // Add a new entry + email["bill"] = "bg@whatever.com"; + + // and print it + std::cout << "bill's email is: " << email["bill"] << "\n"; + + return 0; +} diff --git a/recipes/greg7mdp-gtl/all/test_v1_package/CMakeLists.txt b/recipes/greg7mdp-gtl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7967c88037332 --- /dev/null +++ b/recipes/greg7mdp-gtl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.12) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(gtl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gtl::gtl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/greg7mdp-gtl/all/test_v1_package/conanfile.py b/recipes/greg7mdp-gtl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/greg7mdp-gtl/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/greg7mdp-gtl/config.yml b/recipes/greg7mdp-gtl/config.yml new file mode 100644 index 0000000000000..94e2cbf33f6be --- /dev/null +++ b/recipes/greg7mdp-gtl/config.yml @@ -0,0 +1,9 @@ +versions: + "1.1.5": + folder: all + "1.1.4": + folder: all + "1.1.3": + folder: all + "1.1.2": + folder: all diff --git a/recipes/grpc-proto/all/CMakeLists.txt b/recipes/grpc-proto/all/CMakeLists.txt index 51fa11b5ca0d8..bdbe441b33bae 100644 --- a/recipes/grpc-proto/all/CMakeLists.txt +++ b/recipes/grpc-proto/all/CMakeLists.txt @@ -2,9 +2,6 @@ cmake_minimum_required(VERSION 3.4) project(grpc-proto) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - find_package(Protobuf REQUIRED CONFIG) find_package(googleapis REQUIRED CONFIG) diff --git a/recipes/grpc-proto/all/conanfile.py b/recipes/grpc-proto/all/conanfile.py index aff2e90b78de9..8a95bb545c3ac 100644 --- a/recipes/grpc-proto/all/conanfile.py +++ b/recipes/grpc-proto/all/conanfile.py @@ -1,34 +1,36 @@ import os import functools from conan import ConanFile -from conans import CMake, tools -from conan.tools.files import get, copy -from conans.errors import ConanInvalidConfiguration +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.files import get, collect_libs, copy from helpers import parse_proto_libraries class GRPCProto(ConanFile): name = "grpc-proto" + package_type = "library" description = "gRPC-defined protobufs for peripheral services such as health checking, load balancing, etc" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/grpc/grpc-proto" topics = "google", "protos", "api" settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps" options = { - "shared": [True, False], + "shared": [True, False], "fPIC": [True, False] } default_options = { - "shared": False, + "shared": False, "fPIC": True } exports = "helpers.py" def export_sources(self): - self.copy("CMakeLists.txt") + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def source(self): get(self, **self.conan_data["sources"][str(self.version)], destination=self.source_folder, strip_root=True) @@ -45,30 +47,29 @@ def configure(self): def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) if self.options.shared and (not self.options["protobuf"].shared or not self.options["googleapis"].shared): raise ConanInvalidConfiguration("If built as shared, protobuf and googleapis must be shared as well. Please, use `protobuf:shared=True` and `googleapis:shared=True`") + def generate(self): + tc = CMakeToolchain(self) + googleapis_resdirs = self.dependencies["googleapis"].cpp_info.aggregated_components().resdirs + tc.cache_variables["GOOGLEAPIS_PROTO_DIRS"] = ";".join([p.replace("\\", "/") for p in googleapis_resdirs]) + tc.generate() + def requirements(self): - self.requires('protobuf/3.21.4') - self.requires('googleapis/cci.20220711') + self.requires('protobuf/3.21.4', transitive_headers=True) + self.requires('googleapis/cci.20221108') def build_requirements(self): self.build_requires('protobuf/3.21.4') - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["GOOGLEAPIS_PROTO_DIRS"] = self.dependencies["googleapis"].cpp_info.resdirs[0].replace("\\", "/") - cmake.configure() - return cmake - @functools.lru_cache(1) def _parse_proto_libraries(self): # Generate the libraries to build dynamically proto_libraries = parse_proto_libraries(os.path.join(self.source_folder, 'BUILD.bazel'), self.source_folder, self.output.error) - + # Validate that all files exist and all dependencies are found all_deps = [it.cmake_target for it in proto_libraries] all_deps += ["googleapis::googleapis", "protobuf::libprotobuf"] @@ -94,7 +95,8 @@ def build(self): with open(os.path.join(self.source_folder, "CMakeLists.txt"), "a", encoding="utf-8") as f: for it in filter(lambda u: u.is_used, proto_libraries): f.write(it.cmake_content) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): @@ -113,6 +115,7 @@ def package_id(self): def package_info(self): # We are not creating components, we can just collect the libraries - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) + self.cpp_info.resdirs = ["res"] if self.settings.os == "Linux": self.cpp_info.system_libs.extend(["m"]) diff --git a/recipes/grpc-proto/all/test_package/conanfile.py b/recipes/grpc-proto/all/test_package/conanfile.py index e279a6afcd236..55acff82e3c6d 100644 --- a/recipes/grpc-proto/all/test_package/conanfile.py +++ b/recipes/grpc-proto/all/test_package/conanfile.py @@ -1,8 +1,7 @@ import os from conan import ConanFile -from conan.tools.cmake import CMake, CMakeToolchain -from conan.tools.build import cross_building as tools_cross_building -from conan.tools.layout import cmake_layout +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain class TestPackageConan(ConanFile): @@ -25,5 +24,5 @@ def build(self): cmake.build() def test(self): - if not tools_cross_building(self): + if can_run(self): self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/grpc-proto/all/test_v1_package/CMakeLists.txt b/recipes/grpc-proto/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..02d1682084fb5 --- /dev/null +++ b/recipes/grpc-proto/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_v1_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/grpc-proto/all/test_v1_package/conanfile.py b/recipes/grpc-proto/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..85f1fc3729bb9 --- /dev/null +++ b/recipes/grpc-proto/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/grpc/all/conandata.yml b/recipes/grpc/all/conandata.yml index 84ca1e99ad81e..7dec80ae52456 100644 --- a/recipes/grpc/all/conandata.yml +++ b/recipes/grpc/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.50.1": + url: "https://github.com/grpc/grpc/archive/v1.50.1.tar.gz" + sha256: "fb1ed98eb3555877d55eb2b948caca44bc8601c6704896594de81558639709ef" + "1.50.0": + url: "https://github.com/grpc/grpc/archive/v1.50.0.tar.gz" + sha256: "76900ab068da86378395a8e125b5cc43dfae671e09ff6462ddfef18676e2165a" "1.48.0": url: "https://github.com/grpc/grpc/archive/v1.48.0.tar.gz" sha256: "9b1f348b15a7637f5191e4e673194549384f2eccf01fcef7cc1515864d71b424" @@ -9,6 +15,16 @@ sources: url: "https://github.com/grpc/grpc/archive/refs/tags/v1.46.3.tar.gz" sha256: "d6cbf22cb5007af71b61c6be316a79397469c58c82a942552a62e708bce60964" patches: + "1.50.1": + - patch_file: "patches/v1.50.x/001-disable-cppstd-override.patch" + base_path: "source_subfolder" + - patch_file: "patches/v1.50.x/002-consume-protos-from-requirements.patch" + base_path: "source_subfolder" + "1.50.0": + - patch_file: "patches/v1.50.x/001-disable-cppstd-override.patch" + base_path: "source_subfolder" + - patch_file: "patches/v1.50.x/002-consume-protos-from-requirements.patch" + base_path: "source_subfolder" "1.48.0": - patch_file: "patches/v1.48.x/001-disable-cppstd-override.patch" base_path: "source_subfolder" diff --git a/recipes/grpc/all/conanfile.py b/recipes/grpc/all/conanfile.py index 5c6b96b1c8d43..b6bf2b1a2b355 100644 --- a/recipes/grpc/all/conanfile.py +++ b/recipes/grpc/all/conanfile.py @@ -1,20 +1,24 @@ -import shutil -from conan import tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building, valid_min_cppstd, check_min_cppstd +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rmdir +from conan.tools.microsoft import check_min_vs, is_msvc from conan.tools.scm import Version -from conans import ConanFile, CMake, tools as tools_legacy -from conans.errors import ConanInvalidConfiguration +from conans import CMake import os +import shutil -required_conan_version = ">=1.49.0" +required_conan_version = ">=1.52.0" class grpcConan(ConanFile): name = "grpc" description = "Google's RPC (remote procedure call) library and framework." - topics = ("grpc", "rpc") + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/grpc/grpc" - license = "Apache-2.0" + topics = ("rpc") settings = "os", "arch", "compiler", "build_type" @@ -59,10 +63,6 @@ def _source_subfolder(self): def _build_subfolder(self): return "build_subfolder" - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _grpc_plugin_template(self): return "grpc_plugin_template.cmake.in" @@ -72,10 +72,9 @@ def _cxxstd_required(self): return 14 if Version(self.version) >= "1.47" else 11 def export_sources(self): - self.copy("CMakeLists.txt") - self.copy(os.path.join("cmake", self._grpc_plugin_template)) - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + copy(self, f"cmake/{self._grpc_plugin_template}", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -83,55 +82,61 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass self.options["protobuf"].shared = True self.options["googleapis"].shared = True self.options["grpc-proto"].shared = True + def layout(self): + pass + def requirements(self): - self.requires("abseil/20211102.0") + if is_msvc(self) and Version(self.version) < "1.47": + self.requires("abseil/20211102.0") + else: + self.requires("abseil/20220623.0") self.requires("c-ares/1.18.1") - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") self.requires("re2/20220601") - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") self.requires("protobuf/3.21.4") self.requires("googleapis/cci.20220711") self.requires("grpc-proto/cci.20220627") + def package_id(self): + del self.info.options.secure + self.info.requires["protobuf"].full_package_mode() + def validate(self): - if self._is_msvc: - if self.settings.compiler == "Visual Studio": - vs_ide_version = self.settings.compiler.version - else: - vs_ide_version = tools.microsoft.visual.msvc_version_to_vs_ide_version(self.settings.compiler.version) - if Version(vs_ide_version) < "14": - raise ConanInvalidConfiguration("gRPC can only be built with Visual Studio 2015 or higher.") - - if self.options.shared: - raise ConanInvalidConfiguration("gRPC shared not supported yet with Visual Studio") - - if Version(self.version) >= "1.47" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": - raise ConanInvalidConfiguration("GCC older than 6 is not supported") + check_min_vs(self, "190") + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") - if self.settings.compiler.get_safe("cppstd"): - tools_legacy.check_min_cppstd(self, self._cxxstd_required) + if Version(self.version) >= "1.47" and self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "6": + raise ConanInvalidConfiguration("GCC older than 6 is not supported") - if self.options.shared and (not self.options["protobuf"].shared or not self.options["googleapis"].shared or not self.options["grpc-proto"].shared): - raise ConanInvalidConfiguration("If built as shared, protobuf, googleapis and grpc-proto must be shared as well. Please, use `protobuf:shared=True` and `googleapis:shared=True` and `grpc-proto:shared=True`") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._cxxstd_required) - def package_id(self): - del self.info.options.secure - self.info.requires["protobuf"].full_package_mode() + if self.info.options.shared and \ + (not self.dependencies["protobuf"].options.shared or not self.dependencies["googleapis"].options.shared or not self.dependencies["grpc-proto"].options.shared): + raise ConanInvalidConfiguration( + "If built as shared, protobuf, googleapis and grpc-proto must be shared as well. " + "Please, use `protobuf:shared=True` and `googleapis:shared=True` and `grpc-proto:shared=True`", + ) def build_requirements(self): if hasattr(self, "settings_build"): self.build_requires('protobuf/3.21.4') # when cross compiling we need pre compiled grpc plugins for protoc - if tools.build.cross_building(self): + if cross_building(self): self.build_requires('grpc/{}'.format(self.version)) def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _configure_cmake(self): @@ -171,41 +176,40 @@ def _configure_cmake(self): self._cmake.definitions["gRPC_BUILD_GRPC_RUBY_PLUGIN"] = self.options.ruby_plugin # Consumed targets (abseil) via interface target_compiler_feature can propagate newer standards - if not tools_legacy.valid_min_cppstd(self, self._cxxstd_required): + if not valid_min_cppstd(self, self._cxxstd_required): self._cmake.definitions["CMAKE_CXX_STANDARD"] = self._cxxstd_required - if tools.build.cross_building(self): + if cross_building(self): # otherwise find_package() can't find config files since # conan doesn't populate CMAKE_FIND_ROOT_PATH self._cmake.definitions["CMAKE_FIND_ROOT_PATH_MODE_PACKAGE"] = "BOTH" - if tools_legacy.is_apple_os(self.settings.os): + if is_apple_os(self): # workaround for: install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable self._cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False - if self._is_msvc and Version(self.version) >= "1.48": + if is_msvc(self) and Version(self.version) >= "1.48": self._cmake.definitions["CMAKE_SYSTEM_VERSION"] = "10.0.18362.0" self._cmake.configure(build_folder=self._build_subfolder) return self._cmake def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools_legacy.patch(**patch) + apply_conandata_patches(self) # Clean existing proto files, they will be taken from requirements shutil.rmtree(os.path.join(self._source_subfolder, "src", "proto", "grpc")) if Version(self.version) >= "1.47": # Take googleapis from requirement instead of vendored/hardcoded version - tools_legacy.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), "if (NOT EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/googleapis)", "if (FALSE) # Do not download, it is provided by Conan" ) # We are fine with protobuf::protoc coming from conan generated Find/config file # TODO: to remove when moving to CMakeToolchain (see https://github.com/conan-io/conan/pull/10186) - tools_legacy.replace_in_file(os.path.join(self._source_subfolder, "cmake", "protobuf.cmake"), + replace_in_file(self, os.path.join(self._source_subfolder, "cmake", "protobuf.cmake"), "find_program(_gRPC_PROTOBUF_PROTOC_EXECUTABLE protoc)", "set(_gRPC_PROTOBUF_PROTOC_EXECUTABLE $)" ) @@ -216,12 +220,12 @@ def build(self): cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", src=os.path.join(self.source_folder, self._source_subfolder), dst=os.path.join(self.package_folder, "licenses")) cmake = self._configure_cmake() cmake.install() - tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) - tools.files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # Create one custom module file per executable in order to emulate # CMake executables imported targets of grpc @@ -265,26 +269,25 @@ def _grpc_plugins(self): } def _create_executable_module_file(self, target, executable): + module_abs_path = os.path.join(self.package_folder, self._module_path) + # Copy our CMake module template file to package folder - self.copy(self._grpc_plugin_template, dst=self._module_path, - src=os.path.join(self.source_folder, "cmake")) + copy(self, self._grpc_plugin_template, src=os.path.join(self.source_folder, "cmake"), dst=module_abs_path) # Rename it - dst_file = os.path.join(self.package_folder, self._module_path, - "{}.cmake".format(executable)) - tools.files.rename(self, os.path.join(self.package_folder, self._module_path, self._grpc_plugin_template), - dst_file) + dst_file = os.path.join(module_abs_path, f"{executable}.cmake") + rename(self, os.path.join(module_abs_path, self._grpc_plugin_template), dst_file) # Replace placeholders - tools_legacy.replace_in_file(dst_file, "@target_name@", target) - tools_legacy.replace_in_file(dst_file, "@executable_name@", executable) + replace_in_file(self, dst_file, "@target_name@", target) + replace_in_file(self, dst_file, "@executable_name@", executable) find_program_var = "{}_PROGRAM".format(executable.upper()) - tools_legacy.replace_in_file(dst_file, "@find_program_variable@", find_program_var) + replace_in_file(self, dst_file, "@find_program_variable@", find_program_var) module_folder_depth = len(os.path.normpath(self._module_path).split(os.path.sep)) rel_path = "".join(["../"] * module_folder_depth) - tools_legacy.replace_in_file(dst_file, "@relative_path@", rel_path) + replace_in_file(self, dst_file, "@relative_path@", rel_path) @property def _module_path(self): @@ -308,7 +311,7 @@ def wsock32(): return ["wsock32"] if self.settings.os == "Windows" else [] def corefoundation(): - return ["CoreFoundation"] if tools_legacy.is_apple_os(self.settings.os) else [] + return ["CoreFoundation"] if is_apple_os(self) else [] components = { "address_sorting": { @@ -401,6 +404,7 @@ def corefoundation(): def package_info(self): self.cpp_info.set_property("cmake_file_name", "gRPC") + self.cpp_info.resdirs = ["res"] ssl_roots_file_path = os.path.join(self.package_folder, "res", "grpc", "roots.pem") self.runenv_info.define_path("GRPC_DEFAULT_SSL_ROOTS_FILE_PATH", ssl_roots_file_path) self.env_info.GRPC_DEFAULT_SSL_ROOTS_FILE_PATH = ssl_roots_file_path # remove in conan v2? diff --git a/recipes/grpc/all/patches/v1.50.x/001-disable-cppstd-override.patch b/recipes/grpc/all/patches/v1.50.x/001-disable-cppstd-override.patch new file mode 100644 index 0000000000000..a9339dbcc896b --- /dev/null +++ b/recipes/grpc/all/patches/v1.50.x/001-disable-cppstd-override.patch @@ -0,0 +1,26 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7052846..259fa93 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -227,21 +227,6 @@ if (NOT DEFINED CMAKE_C_STANDARD) + set(CMAKE_C_STANDARD 11) + endif() + +-# Add c++14 flags +-if (NOT DEFINED CMAKE_CXX_STANDARD) +- set(CMAKE_CXX_STANDARD 14) +-else() +- if (CMAKE_CXX_STANDARD LESS 14) +- message(FATAL_ERROR "CMAKE_CXX_STANDARD is less than 14, please specify at least SET(CMAKE_CXX_STANDARD 14)") +- endif() +-endif() +-if (NOT DEFINED CMAKE_CXX_STANDARD_REQUIRED) +- set(CMAKE_CXX_STANDARD_REQUIRED ON) +-endif() +-if (NOT DEFINED CMAKE_CXX_EXTENSIONS) +- set(CMAKE_CXX_EXTENSIONS OFF) +-endif() +- + if (NOT DEFINED CMAKE_POSITION_INDEPENDENT_CODE) + set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) + endif() diff --git a/recipes/grpc/all/patches/v1.50.x/002-consume-protos-from-requirements.patch b/recipes/grpc/all/patches/v1.50.x/002-consume-protos-from-requirements.patch new file mode 100644 index 0000000000000..515291213b267 --- /dev/null +++ b/recipes/grpc/all/patches/v1.50.x/002-consume-protos-from-requirements.patch @@ -0,0 +1,326 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 259fa93..fb05774 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -452,7 +452,7 @@ function(protobuf_generate_grpc_cpp_with_import_path_correction FILE_LOCATION IM + endif() + + # Sets the include path for ProtoBuf files +- set(_protobuf_include_path -I . -I ${_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR}) ++ set(_protobuf_include_path -I . -I ${_gRPC_PROTOBUF_WELLKNOWN_INCLUDE_DIR} -I ${googleapis_RES_DIRS} -I ${grpc-proto_RES_DIRS}) + # The absolute path of the expected place for the input proto file + # For example, health proto has package name grpc.health.v1, it's expected to be: + # ${_gRPC_PROTO_SRCS_DIR}/grpc/health/v1/health.proto +@@ -477,8 +477,6 @@ function(protobuf_generate_grpc_cpp_with_import_path_correction FILE_LOCATION IM + # path. For example, health proto has package name grpc.health.v1, the bash + # equivalent would be: + # cp src/proto/grpc/health/v1/health.proto ${_gRPC_PROTO_SRCS_DIR}/grpc/health/v1 +- file(MAKE_DIRECTORY ${_gRPC_PROTO_SRCS_DIR}/${REL_DIR}) +- file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/${FILE_LOCATION} DESTINATION ${_gRPC_PROTO_SRCS_DIR}/${REL_DIR}) + + #if cross-compiling, find host plugin + if(CMAKE_CROSSCOMPILING) +@@ -491,18 +489,15 @@ function(protobuf_generate_grpc_cpp_with_import_path_correction FILE_LOCATION IM + OUTPUT "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.cc" + "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.grpc.pb.h" + "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}_mock.grpc.pb.h" +- "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.cc" +- "${_gRPC_PROTO_GENS_DIR}/${RELFIL_WE}.pb.h" + COMMAND ${_gRPC_PROTOBUF_PROTOC_EXECUTABLE} + ARGS --grpc_out=generate_mock_code=true:${_gRPC_PROTO_GENS_DIR} +- --cpp_out=${_gRPC_PROTO_GENS_DIR} + --plugin=protoc-gen-grpc=${_gRPC_CPP_PLUGIN} + ${_protobuf_include_path} +- ${REL_FIL} +- DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${FILE_LOCATION} ${ABS_FIL} ${_gRPC_PROTOBUF_PROTOC} ${_gRPC_CPP_PLUGIN} ++ ${FILE_LOCATION} ++ DEPENDS ${_gRPC_PROTOBUF_PROTOC} grpc_cpp_plugin + WORKING_DIRECTORY ${_gRPC_PROTO_SRCS_DIR} +- COMMENT "Running gRPC C++ protocol buffer compiler for ${IMPORT_PATH}" +- VERBATIM) ++ COMMENT "Running gRPC C++ protocol buffer compiler for ${FILE_LOCATION}" ++ ) + endfunction() + + # These options allow users to enable or disable the building of the various +@@ -554,199 +549,28 @@ add_custom_target(tools + DEPENDS tools_c tools_cxx) + + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/channelz/channelz.proto src/proto/grpc/channelz/channelz.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/core/stats.proto src/proto/grpc/core/stats.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/health/v1/health.proto src/proto/grpc/health/v1/health.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/lb/v1/load_balancer.proto src/proto/grpc/lb/v1/load_balancer.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/lookup/v1/rls.proto src/proto/grpc/lookup/v1/rls.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/lookup/v1/rls_config.proto src/proto/grpc/lookup/v1/rls_config.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/reflection/v1alpha/reflection.proto src/proto/grpc/reflection/v1alpha/reflection.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/status/status.proto src/proto/grpc/status/status.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/benchmark_service.proto src/proto/grpc/testing/benchmark_service.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/control.proto src/proto/grpc/testing/control.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/duplicate/echo_duplicate.proto src/proto/grpc/testing/duplicate/echo_duplicate.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/echo.proto src/proto/grpc/testing/echo.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/echo_messages.proto src/proto/grpc/testing/echo_messages.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/empty.proto src/proto/grpc/testing/empty.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/istio_echo.proto src/proto/grpc/testing/istio_echo.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/messages.proto src/proto/grpc/testing/messages.proto ++ grpc/channelz/v1/channelz.proto grpc/channelz/v1/channelz.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/payloads.proto src/proto/grpc/testing/payloads.proto ++ grpc/core/stats.proto grpc/core/stats.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/report_qps_scenario_service.proto src/proto/grpc/testing/report_qps_scenario_service.proto ++ grpc/health/v1/health.proto grpc/health/v1/health.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/simple_messages.proto src/proto/grpc/testing/simple_messages.proto ++ grpc/lb/v1/load_balancer.proto grpc/lb/v1/load_balancer.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/stats.proto src/proto/grpc/testing/stats.proto ++ grpc/lookup/v1/rls.proto grpc/lookup/v1/rls.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/test.proto src/proto/grpc/testing/test.proto ++ grpc/lookup/v1/rls_config.proto grpc/lookup/v1/rls_config.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/worker_service.proto src/proto/grpc/testing/worker_service.proto ++ grpc/reflection/v1alpha/reflection.proto grpc/reflection/v1alpha/reflection.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/ads_for_test.proto src/proto/grpc/testing/xds/ads_for_test.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/cds_for_test.proto src/proto/grpc/testing/xds/cds_for_test.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/eds_for_test.proto src/proto/grpc/testing/xds/eds_for_test.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/lds_rds_for_test.proto src/proto/grpc/testing/xds/lds_rds_for_test.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/lrs_for_test.proto src/proto/grpc/testing/xds/lrs_for_test.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/address.proto src/proto/grpc/testing/xds/v3/address.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/ads.proto src/proto/grpc/testing/xds/v3/ads.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/aggregate_cluster.proto src/proto/grpc/testing/xds/v3/aggregate_cluster.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/base.proto src/proto/grpc/testing/xds/v3/base.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/cluster.proto src/proto/grpc/testing/xds/v3/cluster.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/config_dump.proto src/proto/grpc/testing/xds/v3/config_dump.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/config_source.proto src/proto/grpc/testing/xds/v3/config_source.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/csds.proto src/proto/grpc/testing/xds/v3/csds.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/discovery.proto src/proto/grpc/testing/xds/v3/discovery.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/endpoint.proto src/proto/grpc/testing/xds/v3/endpoint.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/expr.proto src/proto/grpc/testing/xds/v3/expr.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/extension.proto src/proto/grpc/testing/xds/v3/extension.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/fault.proto src/proto/grpc/testing/xds/v3/fault.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/fault_common.proto src/proto/grpc/testing/xds/v3/fault_common.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/http_connection_manager.proto src/proto/grpc/testing/xds/v3/http_connection_manager.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/http_filter_rbac.proto src/proto/grpc/testing/xds/v3/http_filter_rbac.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/listener.proto src/proto/grpc/testing/xds/v3/listener.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/load_report.proto src/proto/grpc/testing/xds/v3/load_report.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/lrs.proto src/proto/grpc/testing/xds/v3/lrs.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/metadata.proto src/proto/grpc/testing/xds/v3/metadata.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/orca_load_report.proto src/proto/grpc/testing/xds/v3/orca_load_report.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/orca_service.proto src/proto/grpc/testing/xds/v3/orca_service.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/outlier_detection.proto src/proto/grpc/testing/xds/v3/outlier_detection.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/path.proto src/proto/grpc/testing/xds/v3/path.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/percent.proto src/proto/grpc/testing/xds/v3/percent.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/protocol.proto src/proto/grpc/testing/xds/v3/protocol.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/range.proto src/proto/grpc/testing/xds/v3/range.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/rbac.proto src/proto/grpc/testing/xds/v3/rbac.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/regex.proto src/proto/grpc/testing/xds/v3/regex.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/ring_hash.proto src/proto/grpc/testing/xds/v3/ring_hash.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/round_robin.proto src/proto/grpc/testing/xds/v3/round_robin.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/route.proto src/proto/grpc/testing/xds/v3/route.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/router.proto src/proto/grpc/testing/xds/v3/router.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/string.proto src/proto/grpc/testing/xds/v3/string.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/tls.proto src/proto/grpc/testing/xds/v3/tls.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/typed_struct.proto src/proto/grpc/testing/xds/v3/typed_struct.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/udpa_typed_struct.proto src/proto/grpc/testing/xds/v3/udpa_typed_struct.proto +-) +-protobuf_generate_grpc_cpp_with_import_path_correction( +- src/proto/grpc/testing/xds/v3/wrr_locality.proto src/proto/grpc/testing/xds/v3/wrr_locality.proto ++ src/proto/grpc/status/status.proto grpc/status/status.proto + ) + protobuf_generate_grpc_cpp_with_import_path_correction( + test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto test/core/event_engine/fuzzing_event_engine/fuzzing_event_engine.proto +@@ -3536,10 +3360,8 @@ endif() + + if(gRPC_BUILD_CODEGEN) + add_library(grpc++_reflection +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.pb.cc +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.cc +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.pb.h +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h ++ ${_gRPC_PROTO_GENS_DIR}/grpc/reflection/v1alpha/reflection.grpc.pb.cc ++ ${_gRPC_PROTO_GENS_DIR}/grpc/reflection/v1alpha/reflection.grpc.pb.h + src/cpp/ext/proto_server_reflection.cc + src/cpp/ext/proto_server_reflection_plugin.cc + ) +@@ -3578,6 +3400,7 @@ target_link_libraries(grpc++_reflection + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc++ ++ grpc-proto::grpc-proto + ) + + foreach(_hdr +@@ -4149,10 +3972,8 @@ endif() + # See https://github.com/grpc/grpc/issues/19473 + if(gRPC_BUILD_CODEGEN AND NOT gRPC_USE_PROTO_LITE) + add_library(grpcpp_channelz +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.pb.cc +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.grpc.pb.cc +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.pb.h +- ${_gRPC_PROTO_GENS_DIR}/src/proto/grpc/channelz/channelz.grpc.pb.h ++ ${_gRPC_PROTO_GENS_DIR}/grpc/channelz/v1/channelz.grpc.pb.cc ++ ${_gRPC_PROTO_GENS_DIR}/grpc/channelz/v1/channelz.grpc.pb.h + src/cpp/server/channelz/channelz_service.cc + src/cpp/server/channelz/channelz_service_plugin.cc + ) +@@ -4191,6 +4012,7 @@ target_link_libraries(grpcpp_channelz + ${_gRPC_PROTOBUF_LIBRARIES} + ${_gRPC_ALLTARGETS_LIBRARIES} + grpc++ ++ grpc-proto::grpc-proto + ) + + foreach(_hdr +diff --git a/src/cpp/ext/proto_server_reflection.h b/src/cpp/ext/proto_server_reflection.h +index a9b5db0..528e75b 100644 +--- a/src/cpp/ext/proto_server_reflection.h ++++ b/src/cpp/ext/proto_server_reflection.h +@@ -29,8 +29,8 @@ + #include + #include + +-#include "src/proto/grpc/reflection/v1alpha/reflection.grpc.pb.h" +-#include "src/proto/grpc/reflection/v1alpha/reflection.pb.h" ++#include "grpc/reflection/v1alpha/reflection.grpc.pb.h" ++#include "grpc/reflection/v1alpha/reflection.pb.h" + + namespace grpc { + +diff --git a/src/cpp/server/channelz/channelz_service.h b/src/cpp/server/channelz/channelz_service.h +index 91936da..0172493 100644 +--- a/src/cpp/server/channelz/channelz_service.h ++++ b/src/cpp/server/channelz/channelz_service.h +@@ -24,8 +24,9 @@ + #include + #include + +-#include "src/proto/grpc/channelz/channelz.grpc.pb.h" +-#include "src/proto/grpc/channelz/channelz.pb.h" ++#include "grpc/channelz/v1/channelz.grpc.pb.h" ++#include "grpc/channelz/v1/channelz.pb.h" ++ + + namespace grpc { + diff --git a/recipes/grpc/config.yml b/recipes/grpc/config.yml index bf40c0d340616..4d7fb36be2c32 100644 --- a/recipes/grpc/config.yml +++ b/recipes/grpc/config.yml @@ -1,4 +1,8 @@ versions: + "1.50.1": + folder: "all" + "1.50.0": + folder: "all" "1.48.0": folder: "all" "1.47.1": diff --git a/recipes/gsl/all/conandata.yml b/recipes/gsl/all/conandata.yml index cedcca6863da1..ae4c67c1283a1 100644 --- a/recipes/gsl/all/conandata.yml +++ b/recipes/gsl/all/conandata.yml @@ -8,11 +8,7 @@ sources: patches: "2.7": - patch_file: "patches/0001-windows-support.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-export-all-gsl_-symbols.patch" - base_path: "source_subfolder" "2.6": - patch_file: "patches/0001-windows-support.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-export-all-gsl_-symbols.patch" - base_path: "source_subfolder" diff --git a/recipes/gsl/all/conanfile.py b/recipes/gsl/all/conanfile.py index 79b4f0611a1f0..a722ffd447fe9 100644 --- a/recipes/gsl/all/conanfile.py +++ b/recipes/gsl/all/conanfile.py @@ -1,10 +1,13 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conan.tools.files import rename -from conan.tools.microsoft import is_msvc -from contextlib import contextmanager +from conan import ConanFile +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" class GslConan(ConanFile): @@ -26,12 +29,6 @@ class GslConan(ConanFile): "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -41,8 +38,7 @@ def _user_info_build(self): return getattr(self, "user_info_build", self.deps_user_info) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -50,94 +46,81 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @contextmanager - def _build_context(self): - if is_msvc(self): - with tools.vcvars(self): - env = { - "CC": "cl -nologo", - "CXX": "cl -nologo", - "LD": "link -nologo", - "AR": "{} lib".format(tools.unix_path(self._user_info_build["automake"].ar_lib)), - } - with tools.environment_append(env): - yield - else: - yield - - def _patch_source(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows, run_environment=True) - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - r"-install_name \$rpath/", - "-install_name @rpath/") + def generate(self): + env = VirtualBuildEnv(self) + env.generate() - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - - self._autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True))) - ] + tc = AutotoolsToolchain(self) if self.settings.os == "Windows": - self._autotools.defines.extend(["HAVE_WIN_IEEE_INTERFACE", "WIN32"]) + tc.extra_defines.extend(["HAVE_WIN_IEEE_INTERFACE", "WIN32"]) if self.options.shared: - self._autotools.defines.append("GSL_DLL") - + tc.extra_defines.append("GSL_DLL") if self.settings.os == "Linux" and "x86" in self.settings.arch: - self._autotools.defines.append("HAVE_GNUX86_IEEE_INTERFACE") - + tc.extra_defines.append("HAVE_GNUX86_IEEE_INTERFACE") + if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") if is_msvc(self): - if self.settings.compiler == "Visual Studio" and \ - tools.Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") - self._autotools.cxx_flags.append("-EHsc") - args.extend([ + tc.configure_args.extend([ "ac_cv_func_memcpy=yes", "ac_cv_func_memmove=yes", "ac_cv_c_c99inline=no", ]) - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + tc.generate() + + if is_msvc(self): + env = Environment() + compile_wrapper = unix_path(self, self._user_info_build["automake"].compile) + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + env.vars(self).save_script("conanbuild_gsl_msvc") def build(self): - self._patch_source() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.autoreconf() + # TODO: use fix_apple_shared_install_name() (requires conan >=1.54.0, see https://github.com/conan-io/conan/pull/12249) + replace_in_file(self, os.path.join(self.source_folder, "configure"), + "-install_name \\$rpath/", + "-install_name @rpath/") + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.remove_files_by_mask(os.path.join(self.package_folder, "include", "gsl"), "*.c") - - os.unlink(os.path.join(self.package_folder, "bin", "gsl-config")) - + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rm(self, "*.c", os.path.join(self.package_folder, "include", "gsl")) + rm(self, "gsl-config", os.path.join(self.package_folder, "bin")) if is_msvc(self) and self.options.shared: pjoin = lambda p: os.path.join(self.package_folder, "lib", p) rename(self, pjoin("gsl.dll.lib"), pjoin("gsl.lib")) @@ -160,10 +143,6 @@ def package_info(self): self.cpp_info.components["libgsl"].system_libs = ["m"] self.cpp_info.components["libgslcblas"].system_libs = ["m"] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment var: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "GSL" self.cpp_info.names["cmake_find_package_multi"] = "GSL" @@ -171,3 +150,4 @@ def package_info(self): self.cpp_info.components["libgsl"].names["cmake_find_package_multi"] = "gsl" self.cpp_info.components["libgslcblas"].names["cmake_find_package"] = "gslcblas" self.cpp_info.components["libgslcblas"].names["cmake_find_package_multi"] = "gslcblas" + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/gsl/all/test_package/CMakeLists.txt b/recipes/gsl/all/test_package/CMakeLists.txt index 3c1eebe82404a..808366bc0e673 100644 --- a/recipes/gsl/all/test_package/CMakeLists.txt +++ b/recipes/gsl/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(GSL CONFIG REQUIRED) +find_package(GSL REQUIRED) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE GSL::gsl) diff --git a/recipes/gsl/all/test_package/conanfile.py b/recipes/gsl/all/test_package/conanfile.py index 4e488b59d24b8..0a6bc68712d90 100644 --- a/recipes/gsl/all/test_package/conanfile.py +++ b/recipes/gsl/all/test_package/conanfile.py @@ -1,23 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class GslTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - self.build_requires("cmake/3.20.1") def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gsl/all/test_v1_package/CMakeLists.txt b/recipes/gsl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/gsl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gsl/all/test_v1_package/conanfile.py b/recipes/gsl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/gsl/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/gsoap/all/conanfile.py b/recipes/gsoap/all/conanfile.py index d2a789ab54f59..49ca4cbe85bbd 100644 --- a/recipes/gsoap/all/conanfile.py +++ b/recipes/gsoap/all/conanfile.py @@ -3,9 +3,10 @@ from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout from conan.tools.env import VirtualBuildEnv from conan.tools.files import copy, get +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.52.0" class GsoapConan(ConanFile): @@ -43,25 +44,24 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") - self.requires("zlib/1.2.12") + self.requires("openssl/1.1.1s") + self.requires("zlib/1.2.13") def build_requirements(self): if cross_building(self, skip_x64_x86=True) and hasattr(self, "settings_build"): - self.tool_requires("gsoap/{}".format(self.version)) + self.tool_requires(f"gsoap/{self.version}") - # TODO: use is_msvc with build profile when possible (see https://github.com/conan-io/conan/issues/11926) - if str(self._settings_build.compiler) in ["Visual Studio", "msvc"]: + if is_msvc(self, build_context=True): self.tool_requires("winflexbison/2.5.24") else: self.tool_requires("bison/3.7.6") self.tool_requires("flex/2.6.4") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -110,7 +110,3 @@ def package_info(self): if self.options.with_c_locale: defines.append("WITH_C_LOCALE") self.cpp_info.defines = defines - - # TODO: remove this block if required_conan_version changed to 1.51.1 or higher - # (see https://github.com/conan-io/conan/pull/11790) - self.cpp_info.requires = ["openssl::openssl", "zlib::zlib"] diff --git a/recipes/gsoap/all/test_package/conanfile.py b/recipes/gsoap/all/test_package/conanfile.py index d31841c913673..b6f1a8aefca6f 100644 --- a/recipes/gsoap/all/test_package/conanfile.py +++ b/recipes/gsoap/all/test_package/conanfile.py @@ -1,11 +1,13 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run, cross_building from conan.tools.cmake import CMake, cmake_layout import os + class TestGsoapConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def layout(self): cmake_layout(self) @@ -18,15 +20,16 @@ def build(self): if not cross_building(self): calc_wsdl = os.path.join(self.source_folder, "calc.wsdl") - self.output.info("Generating code from WSDL '{}'".format(calc_wsdl)) - self.run("wsdl2h -o calc.h {}".format(calc_wsdl), run_environment=True) - self.run("soapcpp2 -j -CL -I{} calc.h".format(os.path.join(self.deps_cpp_info["gsoap"].rootpath, 'bin', 'import')), run_environment=True) + self.output.info(f"Generating code from WSDL '{calc_wsdl}'") + self.run(f"wsdl2h -o calc.h {calc_wsdl}", env="conanrun") + import_dir = os.path.join(self.deps_cpp_info["gsoap"].rootpath, "bin", "import") + self.run(f"soapcpp2 -j -CL -I{import_dir} calc.h", env="conanrun") cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/gsoap/all/test_v1_package/CMakeLists.txt b/recipes/gsoap/all/test_v1_package/CMakeLists.txt index c8dbada9644d8..0d20897301b68 100644 --- a/recipes/gsoap/all/test_v1_package/CMakeLists.txt +++ b/recipes/gsoap/all/test_v1_package/CMakeLists.txt @@ -1,15 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(gsoap REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} - ../test_package/test_package.cpp - ${CMAKE_BINARY_DIR}/soapC.cpp - ${CMAKE_BINARY_DIR}/soapcalcProxy.cpp -) -target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_BINARY_DIR}) -target_link_libraries(${PROJECT_NAME} PRIVATE gsoap::gsoap) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gsoap/all/test_v1_package/conanfile.py b/recipes/gsoap/all/test_v1_package/conanfile.py index d91f7f444edd3..efaa7d687c237 100644 --- a/recipes/gsoap/all/test_v1_package/conanfile.py +++ b/recipes/gsoap/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os @@ -12,9 +11,10 @@ def build(self): if not tools.cross_building(self): calc_wsdl = os.path.join(self.source_folder, os.pardir, "test_package", "calc.wsdl") - self.output.info("Generating code from WSDL '{}'".format(calc_wsdl)) - self.run("wsdl2h -o calc.h {}".format(calc_wsdl), run_environment=True) - self.run("soapcpp2 -j -CL -I{} calc.h".format(os.path.join(self.deps_cpp_info["gsoap"].rootpath, 'bin', 'import')), run_environment=True) + self.output.info(f"Generating code from WSDL '{calc_wsdl}'") + self.run(f"wsdl2h -o calc.h {calc_wsdl}", run_environment=True) + import_dir = os.path.join(self.deps_cpp_info["gsoap"].rootpath, "bin", "import") + self.run(f"soapcpp2 -j -CL -I{import_dir} calc.h", run_environment=True) cmake = CMake(self) cmake.configure() diff --git a/recipes/gtest/all/conandata.yml b/recipes/gtest/all/conandata.yml index d8536e8e3c796..70ff2819b4d9f 100644 --- a/recipes/gtest/all/conandata.yml +++ b/recipes/gtest/all/conandata.yml @@ -1,26 +1,19 @@ sources: + "1.13.0": + url: "https://github.com/google/googletest/archive/refs/tags/v1.13.0.tar.gz" + sha256: "ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363" "1.12.1": url: "https://github.com/google/googletest/archive/release-1.12.1.tar.gz" sha256: "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2" - "1.11.0": - url: "https://github.com/google/googletest/archive/release-1.11.0.tar.gz" - sha256: "b4870bf121ff7795ba20d20bcdd8627b8e088f2d1dab299a031c1034eddc93d5" - "cci.20210126": - url: "https://github.com/google/googletest/archive/273f8cb059a4e7b089731036392422b5ef489791.tar.gz" - sha256: "2937e96827aa44b291d42c4f0ffaa6a7637445822cf873d0fa6a889df84b8628" "1.10.0": url: "https://github.com/google/googletest/archive/release-1.10.0.tar.gz" sha256: "9dc9157a9a1551ec7a7e43daea9a694a0bb5fb8bec81235d8a1e6ef64c716dcb" - "1.8.1": - url: "https://github.com/google/googletest/archive/release-1.8.1.tar.gz" - sha256: "9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c" patches: - "1.11.0": - - patch_file: "patches/gtest-1.11.0.patch" - "cci.20210126": - - patch_file: "patches/gtest-1.10.0.patch" "1.10.0": - patch_file: "patches/gtest-1.10.0.patch" + patch_description: "add CUSTOM_DEBUG_POSTFIX option" + patch_type: "conan" - patch_file: "patches/gtest-1.10.0-override.patch" - "1.8.1": - - patch_file: "patches/gtest-1.8.1.patch" + patch_description: "prevent compiler from complaining while compiling" + patch_type: "bugfix" + patch_source: "https://github.com/google/googletest/pull/2507" diff --git a/recipes/gtest/all/conanfile.py b/recipes/gtest/all/conanfile.py index 922eaa70f7d5c..198ee6fa77ef1 100644 --- a/recipes/gtest/all/conanfile.py +++ b/recipes/gtest/all/conanfile.py @@ -1,14 +1,13 @@ -import os - from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rm, rmdir -from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain -from conan.tools.microsoft import is_msvc, msvc_runtime_flag, check_min_vs +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.microsoft import is_msvc_static_runtime, msvc_runtime_flag from conan.tools.scm import Version +import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class GTestConan(ConanFile): @@ -18,82 +17,75 @@ class GTestConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/google/googletest" topics = ("testing", "google-testing", "unit-test") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "build_gmock": [True, False], "fPIC": [True, False], + "build_gmock": [True, False], "no_main": [True, False], - "debug_postfix": ["ANY"], "hide_symbols": [True, False], + "debug_postfix": ["ANY"], } default_options = { "shared": False, - "build_gmock": True, "fPIC": True, + "build_gmock": True, "no_main": False, - "debug_postfix": "d", "hide_symbols": False, + "debug_postfix": "d", } @property - def _minimum_cpp_standard(self): - if self.version == "1.8.1": - return 98 - else: - return 11 + def _min_cppstd(self): + return "11" if Version(self.version) < "1.13.0" else "14" @property def _minimum_compilers_version(self): - if self.version == "1.8.1": - return { - "Visual Studio": "14" - } - elif self.version == "1.10.0": - return { - "Visual Studio": "14", - "gcc": "4.8.1", - "clang": "3.3", - "apple-clang": "5.0" - } - else: - return { + return { + "11": { "Visual Studio": "14", - "gcc": "5", - "clang": "5", - "apple-clang": "9.1" - } - - @property - def _is_clang_cl(self): - return self.settings.os == "Windows" and self.settings.compiler == "clang" + "msvc": "190", + "gcc": "4.8.1" if Version(self.version) < "1.11.0" else "5", + "clang": "3.3" if Version(self.version) < "1.11.0" else "5", + "apple-clang": "5.0" if Version(self.version) < "1.11.0" else "9.1", + }, + # Sinse 1.13.0, gtest requires C++14 and Google's Foundational C++ Support Policy + # https://github.com/google/oss-policies-info/blob/603a042ce2ee8f165fac46721a651d796ce59cb6/foundational-cxx-support-matrix.md + "14": { + "Visual Studio": "15", + "msvc": "191", + "gcc": "7.3.1", + "clang": "6", + "apple-clang": "12", + }, + }.get(self._min_cppstd, {}) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, patch["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.build_type != "Debug": + if Version(self.version) >= "1.12.0" or self.settings.build_type != "Debug": del self.options.debug_postfix def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def package_id(self): - del self.info.options.no_main + del self.info.options.no_main # Only used to expose more targets def validate(self): - if self.options.shared and (is_msvc(self) or self._is_clang_cl) and "MT" in msvc_runtime_flag(self): - raise ConanInvalidConfiguration( - "gtest:shared=True with compiler=\"Visual Studio\" is not " - "compatible with compiler.runtime=MT/MTd" - ) + if self.options.shared and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("gtest shared is not compatible with static vc runtime") - if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, self._minimum_cpp_standard) + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -101,50 +93,41 @@ def loose_lt_semver(v1, v2): min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] - min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) - if min_version and loose_lt_semver(str(self.settings.compiler.version), min_version): + compiler = self.settings.compiler + min_version = self._minimum_compilers_version.get(str(compiler)) + if min_version and loose_lt_semver(str(compiler.version), min_version): raise ConanInvalidConfiguration( - f"{self.name} requires {self.settings.compiler} {min_version}. The current compiler is {self.settings.compiler} {self.settings.compiler.version}." + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _patch_sources(self): - apply_conandata_patches(self) - # No warnings as errors - internal_utils = os.path.join(self.source_folder, "googletest", - "cmake", "internal_utils.cmake") - replace_in_file(self, internal_utils, "-WX", "") - if self.version == "cci.20210126" or Version(self.version) < "1.12.0": - replace_in_file(self, internal_utils, "-Werror", "") - def generate(self): tc = CMakeToolchain(self) + tc.variables["BUILD_GMOCK"] = bool(self.options.build_gmock) + tc.variables["gtest_hide_internal_symbols"] = bool(self.options.hide_symbols) - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" - - if self.settings.build_type == "Debug": + if self.settings.build_type == "Debug" and Version(self.version) < "1.12.0": tc.cache_variables["CUSTOM_DEBUG_POSTFIX"] = str(self.options.debug_postfix) - if is_msvc(self) or self._is_clang_cl: - tc.cache_variables["gtest_force_shared_crt"] = "MD" in msvc_runtime_flag(self) - - try: - check_min_vs(self, "191") - except ConanInvalidConfiguration: - tc.preprocessor_definitions["GTEST_LANG_CXX11"] = 1 - tc.preprocessor_definitions["GTEST_HAS_TR1_TUPLE"] = 0 - - tc.cache_variables["BUILD_GMOCK"] = bool(self.options.build_gmock) + + if self.settings.compiler.get_safe("runtime"): + tc.variables["gtest_force_shared_crt"] = "MD" in msvc_runtime_flag(self) if self.settings.os == "Windows" and self.settings.compiler == "gcc": - tc.cache_variables["gtest_disable_pthreads"] = True - tc.cache_variables["gtest_hide_internal_symbols"] = bool(self.options.hide_symbols) + tc.variables["gtest_disable_pthreads"] = True + if Version(self.version) < "1.12.0": + # Relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" tc.generate() + def _patch_sources(self): + apply_conandata_patches(self) + # No warnings as errors + internal_utils = os.path.join(self.source_folder, "googletest", "cmake", "internal_utils.cmake") + replace_in_file(self, internal_utils, "-WX", "") + if Version(self.version) < "1.12.0": + replace_in_file(self, internal_utils, "-Werror", "") + def build(self): self._patch_sources() cmake = CMake(self) @@ -161,10 +144,7 @@ def package(self): @property def _postfix(self): - # In 1.12.0, gtest remove debug postfix. - if self.version != "cci.20210126" and Version(self.version) >= "1.12.0": - return "" - return self.options.debug_postfix if self.settings.build_type == "Debug" else "" + return self.options.get_safe("debug_postfix", "") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -182,11 +162,6 @@ def package_info(self): self.cpp_info.components["libgtest"].system_libs.append("regex") if self.options.shared: self.cpp_info.components["libgtest"].defines.append("GTEST_LINKED_AS_SHARED_LIBRARY=1") - if self.version == "1.8.1": - if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "15") or \ - (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler.version) >= "191"): - self.cpp_info.components["libgtest"].defines.append("GTEST_LANG_CXX11=1") - self.cpp_info.components["libgtest"].defines.append("GTEST_HAS_TR1_TUPLE=0") # gtest_main if not self.options.no_main: diff --git a/recipes/gtest/all/patches/gtest-1.11.0.patch b/recipes/gtest/all/patches/gtest-1.11.0.patch deleted file mode 100644 index 11e5c57211784..0000000000000 --- a/recipes/gtest/all/patches/gtest-1.11.0.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake -index 8d8d60a..6ea023a 100644 ---- a/googletest/cmake/internal_utils.cmake -+++ b/googletest/cmake/internal_utils.cmake -@@ -157,7 +157,7 @@ function(cxx_library_with_type name type cxx_flags) - # Generate debug library name with a postfix. - set_target_properties(${name} - PROPERTIES -- DEBUG_POSTFIX "d") -+ DEBUG_POSTFIX "${CUSTOM_DEBUG_POSTFIX}") - # Set the output directory for build artifacts - set_target_properties(${name} - PROPERTIES diff --git a/recipes/gtest/all/patches/gtest-1.8.1.patch b/recipes/gtest/all/patches/gtest-1.8.1.patch deleted file mode 100644 index 838ab42c89f02..0000000000000 --- a/recipes/gtest/all/patches/gtest-1.8.1.patch +++ /dev/null @@ -1,13 +0,0 @@ -diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake -index 8c1f9ba..2203d3c 100644 ---- a/googletest/cmake/internal_utils.cmake -+++ b/googletest/cmake/internal_utils.cmake -@@ -166,7 +166,7 @@ function(cxx_library_with_type name type cxx_flags) - # Generate debug library name with a postfix. - set_target_properties(${name} - PROPERTIES -- DEBUG_POSTFIX "d") -+ DEBUG_POSTFIX "${CUSTOM_DEBUG_POSTFIX}") - if (BUILD_SHARED_LIBS OR type STREQUAL "SHARED") - set_target_properties(${name} - PROPERTIES diff --git a/recipes/gtest/all/test_package/CMakeLists.txt b/recipes/gtest/all/test_package/CMakeLists.txt index ab1f0c0c68d1e..3ca688fabb972 100644 --- a/recipes/gtest/all/test_package/CMakeLists.txt +++ b/recipes/gtest/all/test_package/CMakeLists.txt @@ -1,27 +1,26 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(GTest REQUIRED) -if(WITH_MAIN) - add_executable(${PROJECT_NAME} test_package.cpp) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE GTest::gtest) +if(GTest_VERSION VERSION_LESS "1.13.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) else() - add_executable(${PROJECT_NAME} main.cpp test_package.cpp) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) endif() if(WITH_MAIN) - target_link_libraries(${PROJECT_NAME} GTest::gtest GTest::gtest_main) + target_link_libraries(${PROJECT_NAME} PRIVATE GTest::gtest_main) if(WITH_GMOCK) - target_link_libraries(${PROJECT_NAME} GTest::gmock GTest::gmock_main) + target_link_libraries(${PROJECT_NAME} PRIVATE GTest::gmock_main) endif() else() - target_link_libraries(${PROJECT_NAME} GTest::gtest) - if(WITH_GMOCK) - target_link_libraries(${PROJECT_NAME} GTest::gmock) - endif() + target_sources(${PROJECT_NAME} PRIVATE main.cpp) endif() -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) if(WITH_GMOCK) + target_link_libraries(${PROJECT_NAME} PRIVATE GTest::gmock) target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_GMOCK) endif() diff --git a/recipes/gtest/all/test_package/conanfile.py b/recipes/gtest/all/test_package/conanfile.py index 7e7b3f4ebb387..1bddd2ba2988a 100644 --- a/recipes/gtest/all/test_package/conanfile.py +++ b/recipes/gtest/all/test_package/conanfile.py @@ -2,12 +2,13 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) @@ -20,12 +21,10 @@ def generate(self): with_gmock = bool(self.dependencies[self.tested_reference_str].options.build_gmock) tc.cache_variables['WITH_GMOCK'] = with_gmock - tc.preprocessor_definitions['WITH_GMOCK'] = 1 if with_gmock else 0 - - with_main = not self.dependencies[self.tested_reference_str].options.no_main - tc.cache_variables['WITH_MAIN'] = with_main - tc.preprocessor_definitions['WITH_MAIN'] = 1 if with_main else 0 + if with_gmock: + tc.preprocessor_definitions['WITH_GMOCK'] = 1 + tc.variables['WITH_MAIN'] = not bool(self.dependencies[self.tested_reference_str].options.no_main) tc.generate() def build(self): diff --git a/recipes/gtest/all/test_package/prime_tables.h b/recipes/gtest/all/test_package/prime_tables.h deleted file mode 100644 index 55a3b44efd857..0000000000000 --- a/recipes/gtest/all/test_package/prime_tables.h +++ /dev/null @@ -1,127 +0,0 @@ -// Copyright 2008 Google Inc. -// All Rights Reserved. -// -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following disclaimer -// in the documentation and/or other materials provided with the -// distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived from -// this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -// -// Author: wan@google.com (Zhanyong Wan) -// Author: vladl@google.com (Vlad Losev) - -// This provides interface PrimeTable that determines whether a number is a -// prime and determines a next prime number. This interface is used -// in Google Test samples demonstrating use of parameterized tests. - -#ifndef GTEST_SAMPLES_PRIME_TABLES_H_ -#define GTEST_SAMPLES_PRIME_TABLES_H_ - -#include - -// The prime table interface. -class PrimeTable { - public: - virtual ~PrimeTable() {} - - // Returns true iff n is a prime number. - virtual bool IsPrime(int n) const = 0; - - // Returns the smallest prime number greater than p; or returns -1 - // if the next prime is beyond the capacity of the table. - virtual int GetNextPrime(int p) const = 0; -}; - -// Implementation #1 calculates the primes on-the-fly. -class OnTheFlyPrimeTable : public PrimeTable { - public: - virtual bool IsPrime(int n) const { - if (n <= 1) return false; - - for (int i = 2; i*i <= n; i++) { - // n is divisible by an integer other than 1 and itself. - if ((n % i) == 0) return false; - } - - return true; - } - - virtual int GetNextPrime(int p) const { - for (int n = p + 1; n > 0; n++) { - if (IsPrime(n)) return n; - } - - return -1; - } -}; - -// Implementation #2 pre-calculates the primes and stores the result -// in an array. -class PreCalculatedPrimeTable : public PrimeTable { - public: - // 'max' specifies the maximum number the prime table holds. - explicit PreCalculatedPrimeTable(int max) - : is_prime_size_(max + 1), is_prime_(new bool[max + 1]) { - CalculatePrimesUpTo(max); - } - virtual ~PreCalculatedPrimeTable() { delete[] is_prime_; } - - virtual bool IsPrime(int n) const { - return 0 <= n && n < is_prime_size_ && is_prime_[n]; - } - - virtual int GetNextPrime(int p) const { - for (int n = p + 1; n < is_prime_size_; n++) { - if (is_prime_[n]) return n; - } - - return -1; - } - - private: - void CalculatePrimesUpTo(int max) { - ::std::fill(is_prime_, is_prime_ + is_prime_size_, true); - is_prime_[0] = is_prime_[1] = false; - - // Checks every candidate for prime number (we know that 2 is the only even - // prime). - for (int i = 2; i*i <= max; i += i%2+1) { - if (!is_prime_[i]) continue; - - // Marks all multiples of i (except i itself) as non-prime. - // We are starting here from i-th multiplier, because all smaller - // complex numbers were already marked. - for (int j = i*i; j <= max; j += i) { - is_prime_[j] = false; - } - } - } - - const int is_prime_size_; - bool* const is_prime_; - - // Disables compiler warning "assignment operator could not be generated." - void operator=(const PreCalculatedPrimeTable& rhs); -}; - -#endif // GTEST_SAMPLES_PRIME_TABLES_H_ diff --git a/recipes/gtest/all/test_package/test_package.cpp b/recipes/gtest/all/test_package/test_package.cpp index 4a1f9d2acf990..36d68c62eb3c5 100644 --- a/recipes/gtest/all/test_package/test_package.cpp +++ b/recipes/gtest/all/test_package/test_package.cpp @@ -50,138 +50,3 @@ TEST(SalutationTest, Static) { EXPECT_EQ(string("Hello World!"), Salutation::greet("World")); } - -#if GTEST_HAS_COMBINE -#include "prime_tables.h" - -// Suppose we want to introduce a new, improved implementation of PrimeTable -// which combines speed of PrecalcPrimeTable and versatility of -// OnTheFlyPrimeTable (see prime_tables.h). Inside it instantiates both -// PrecalcPrimeTable and OnTheFlyPrimeTable and uses the one that is more -// appropriate under the circumstances. But in low memory conditions, it can be -// told to instantiate without PrecalcPrimeTable instance at all and use only -// OnTheFlyPrimeTable. -class HybridPrimeTable : public PrimeTable { - public: - HybridPrimeTable(bool force_on_the_fly, int max_precalculated) - : on_the_fly_impl_(new OnTheFlyPrimeTable), - precalc_impl_(force_on_the_fly ? NULL : - new PreCalculatedPrimeTable(max_precalculated)), - max_precalculated_(max_precalculated) {} - virtual ~HybridPrimeTable() { - delete on_the_fly_impl_; - delete precalc_impl_; - } - - virtual bool IsPrime(int n) const { - if (precalc_impl_ != NULL && n < max_precalculated_) - return precalc_impl_->IsPrime(n); - else - return on_the_fly_impl_->IsPrime(n); - } - - virtual int GetNextPrime(int p) const { - int next_prime = -1; - if (precalc_impl_ != NULL && p < max_precalculated_) - next_prime = precalc_impl_->GetNextPrime(p); - - return next_prime != -1 ? next_prime : on_the_fly_impl_->GetNextPrime(p); - } - - private: - OnTheFlyPrimeTable* on_the_fly_impl_; - PreCalculatedPrimeTable* precalc_impl_; - int max_precalculated_; -}; - -using ::testing::TestWithParam; -using ::testing::Bool; -using ::testing::Values; -using ::testing::Combine; - -// To test all code paths for HybridPrimeTable we must test it with numbers -// both within and outside PreCalculatedPrimeTable's capacity and also with -// PreCalculatedPrimeTable disabled. We do this by defining fixture which will -// accept different combinations of parameters for instantiating a -// HybridPrimeTable instance. -class PrimeTableTest : public TestWithParam< ::testing::tuple > { - protected: - virtual void SetUp() { - // This can be written as - // - // bool force_on_the_fly; - // int max_precalculated; - // tie(force_on_the_fly, max_precalculated) = GetParam(); - // - // once the Google C++ Style Guide allows use of ::std::tr1::tie. - // - bool force_on_the_fly = ::testing::get<0>(GetParam()); - int max_precalculated = ::testing::get<1>(GetParam()); - table_ = new HybridPrimeTable(force_on_the_fly, max_precalculated); - } - virtual void TearDown() { - delete table_; - table_ = NULL; - } - HybridPrimeTable* table_; -}; - -TEST_P(PrimeTableTest, ReturnsFalseForNonPrimes) { - // Inside the test body, you can refer to the test parameter by GetParam(). - // In this case, the test parameter is a PrimeTable interface pointer which - // we can use directly. - // Please note that you can also save it in the fixture's SetUp() method - // or constructor and use saved copy in the tests. - - EXPECT_FALSE(table_->IsPrime(-5)); - EXPECT_FALSE(table_->IsPrime(0)); - EXPECT_FALSE(table_->IsPrime(1)); - EXPECT_FALSE(table_->IsPrime(4)); - EXPECT_FALSE(table_->IsPrime(6)); - EXPECT_FALSE(table_->IsPrime(100)); -} - -TEST_P(PrimeTableTest, ReturnsTrueForPrimes) { - EXPECT_TRUE(table_->IsPrime(2)); - EXPECT_TRUE(table_->IsPrime(3)); - EXPECT_TRUE(table_->IsPrime(5)); - EXPECT_TRUE(table_->IsPrime(7)); - EXPECT_TRUE(table_->IsPrime(11)); - EXPECT_TRUE(table_->IsPrime(131)); -} - -TEST_P(PrimeTableTest, CanGetNextPrime) { - EXPECT_EQ(2, table_->GetNextPrime(0)); - EXPECT_EQ(3, table_->GetNextPrime(2)); - EXPECT_EQ(5, table_->GetNextPrime(3)); - EXPECT_EQ(7, table_->GetNextPrime(5)); - EXPECT_EQ(11, table_->GetNextPrime(7)); - EXPECT_EQ(131, table_->GetNextPrime(128)); -} - -// In order to run value-parameterized tests, you need to instantiate them, -// or bind them to a list of values which will be used as test parameters. -// You can instantiate them in a different translation module, or even -// instantiate them several times. -// -// Here, we instantiate our tests with a list of parameters. We must combine -// all variations of the boolean flag suppressing PrecalcPrimeTable and some -// meaningful values for tests. We choose a small value (1), and a value that -// will put some of the tested numbers beyond the capability of the -// PrecalcPrimeTable instance and some inside it (10). Combine will produce all -// possible combinations. -INSTANTIATE_TEST_CASE_P(MeaningfulTestParameters, - PrimeTableTest, - Combine(Bool(), Values(1, 10))); - -#else - -// Google Test may not support Combine() with some compilers. If we -// use conditional compilation to compile out all code referring to -// the gtest_main library, MSVC linker will not link that library at -// all and consequently complain about missing entry point defined in -// that library (fatal error LNK1561: entry point must be -// defined). This dummy test keeps gtest_main linked in. -TEST(DummyTest, CombineIsNotSupportedOnThisPlatform) {} - -#endif // GTEST_HAS_COMBINE diff --git a/recipes/gtest/all/test_v1_package/CMakeLists.txt b/recipes/gtest/all/test_v1_package/CMakeLists.txt index a618c6aa288bb..0d20897301b68 100644 --- a/recipes/gtest/all/test_v1_package/CMakeLists.txt +++ b/recipes/gtest/all/test_v1_package/CMakeLists.txt @@ -1,30 +1,8 @@ -cmake_minimum_required(VERSION 3.1.2) -project(test_package CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(GTest REQUIRED) - -if(WITH_MAIN) - add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -else() - add_executable(${PROJECT_NAME} ../test_package/main.cpp ../test_package/test_package.cpp) -endif() - -if(WITH_MAIN) - target_link_libraries(${PROJECT_NAME} GTest::gtest GTest::gtest_main) - if(WITH_GMOCK) - target_link_libraries(${PROJECT_NAME} GTest::gmock GTest::gmock_main) - endif() -else() - target_link_libraries(${PROJECT_NAME} GTest::gtest) - if(WITH_GMOCK) - target_link_libraries(${PROJECT_NAME} GTest::gmock) - endif() -endif() - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -if(WITH_GMOCK) - target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_GMOCK) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gtest/all/test_v1_package/conanfile.py b/recipes/gtest/all/test_v1_package/conanfile.py index 9d0e714740084..1490f15fbb3c6 100644 --- a/recipes/gtest/all/test_v1_package/conanfile.py +++ b/recipes/gtest/all/test_v1_package/conanfile.py @@ -16,7 +16,6 @@ def build(self): cmake.build() def test(self): - assert os.path.isfile(os.path.join(self.deps_cpp_info["gtest"].rootpath, "licenses", "LICENSE")) if not cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) diff --git a/recipes/gtest/config.yml b/recipes/gtest/config.yml index b5875ece43c69..6df56e900d95a 100644 --- a/recipes/gtest/config.yml +++ b/recipes/gtest/config.yml @@ -1,11 +1,7 @@ versions: - "1.12.1": - folder: all - "1.11.0": + "1.13.0": folder: all - "cci.20210126": + "1.12.1": folder: all "1.10.0": folder: all - "1.8.1": - folder: all diff --git a/recipes/gtk/system/conanfile.py b/recipes/gtk/system/conanfile.py index ef496e60614dd..eaa08c92e96a6 100644 --- a/recipes/gtk/system/conanfile.py +++ b/recipes/gtk/system/conanfile.py @@ -1,5 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.system import package_manager +from conans import tools + +required_conan_version = ">=1.47" class ConanGTK(ConanFile): @@ -8,22 +12,22 @@ class ConanGTK(ConanFile): license = "LGPL-2.1-or-later" homepage = "https://www.gtk.org" description = "A free and open-source cross-platform widget toolkit for creating graphical user interfaces" - settings = "os" + settings = "os", "arch", "compiler", "build_type" options = {"version": [2, 3]} default_options = {"version": 2} topics = ("gui", "widget", "graphical") - def configure(self): + def validate(self): if self.settings.os not in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") - + def package_id(self): self.info.settings.clear() def _fill_cppinfo_from_pkgconfig(self, name): pkg_config = tools.PkgConfig(name) if not pkg_config.provides: - raise ConanException("GTK-{} development files aren't available, give up.".format(self.options.version)) + raise ConanException(f"GTK-{self.options.version} development files aren't available, give up.") libs = [lib[2:] for lib in pkg_config.libs_only_l] lib_dirs = [lib[2:] for lib in pkg_config.libs_only_L] ldflags = [flag for flag in pkg_config.libs_only_other] @@ -41,27 +45,24 @@ def _fill_cppinfo_from_pkgconfig(self, name): self.cpp_info.components[name].cxxflags = cflags def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_apt: - packages = ["libgtk2.0-dev"] if self.options.version == 2 else ["libgtk-3-dev"] - elif tools.os_info.with_yum or tools.os_info.with_dnf: - packages = ["gtk{}-devel".format(self.options.version)] - elif tools.os_info.with_pacman: - packages = ["gtk{}".format(self.options.version)] - elif tools.os_info.with_zypper: - packages = ["gtk{}-devel".format(self.options.version)] - else: - self.output.warn("Do not know how to install 'GTK-{}' for {}." - .format(self.options.version, - tools.os_info.linux_distro)) - if tools.os_info.is_freebsd and self.settings.os == "FreeBSD": - packages = ["gtk{}".format(self.options.version)] - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode="verify") - for p in packages: - package_tool.install(update=True, packages=p) + dnf = package_manager.Dnf(self) + dnf.install([f"gtk{self.options.version}-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install([f"gtk{self.options.version}-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + apt.install(["libgtk2.0-dev"] if self.options.version == 2 else ["libgtk-3-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install([f"gtk{self.options.version}"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install([f"gtk{self.options.version}-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install([f"gtk{self.options.version}"], update=True, check=True) def package_info(self): - for name in ["gtk+-{}.0".format(self.options.version)]: + for name in [f"gtk+-{self.options.version}.0"]: self._fill_cppinfo_from_pkgconfig(name) diff --git a/recipes/gtsam/all/CMakeLists.txt b/recipes/gtsam/all/CMakeLists.txt deleted file mode 100644 index 04c96c99f25c3..0000000000000 --- a/recipes/gtsam/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.15) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/gtsam/all/conandata.yml b/recipes/gtsam/all/conandata.yml index 65a33ee134c24..a7ab46e7ea6fb 100644 --- a/recipes/gtsam/all/conandata.yml +++ b/recipes/gtsam/all/conandata.yml @@ -10,17 +10,41 @@ sources: sha256: "8770a440f1af98c3f0d9d4dffd568de2d4c21b245e7231e987e26bc236aeb5aa" patches: "4.1.1": - - patch_file: "patches/0001-conan-4.1.1.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-macos-rpath-4.1.1.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.1.1-0001-cmake-boost.patch" + patch_description: "Use boost targets" + patch_type: "conan" + - patch_file: "patches/4.1.1-0002-cmake-eigen.patch" + patch_description: "Use Eigen include variable from CMakeDeps" + patch_type: "conan" + - patch_file: "patches/4.1.1-0003-macos-rpath.patch" + patch_description: "Relocatable shared libs on Apple OS" + patch_type: "conan" + - patch_file: "patches/4.0.2-0003-cmake-project.patch" + patch_description: "CMake: move project() after cmake_minimum_required()" + patch_type: "conan" "4.0.3": - - patch_file: "patches/0001-conan-4.0.3.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-macos-rpath-4.0.3.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.0.3-0001-cmake-boost.patch" + patch_description: "Use boost targets" + patch_type: "conan" + - patch_file: "patches/4.0.3-0002-cmake-eigen.patch" + patch_description: "Use Eigen include variable from CMakeDeps" + patch_type: "conan" + - patch_file: "patches/4.0.3-0003-macos-rpath.patch" + patch_description: "Relocatable shared libs on Apple OS" + patch_type: "conan" + - patch_file: "patches/4.0.2-0003-cmake-project.patch" + patch_description: "CMake: move project() after cmake_minimum_required()" + patch_type: "conan" "4.0.2": - - patch_file: "patches/0001-conan-4.0.2.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-macos-rpath-4.0.2.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.0.2-0001-cmake-boost.patch" + patch_description: "Use boost targets" + patch_type: "conan" + - patch_file: "patches/4.0.2-0002-cmake-eigen.patch" + patch_description: "Use Eigen include variable from CMakeDeps" + patch_type: "conan" + - patch_file: "patches/4.0.2-0003-macos-rpath.patch" + patch_description: "Relocatable shared libs on Apple OS" + patch_type: "conan" + - patch_file: "patches/4.0.2-0003-cmake-project.patch" + patch_description: "CMake: move project() after cmake_minimum_required()" + patch_type: "conan" diff --git a/recipes/gtsam/all/conanfile.py b/recipes/gtsam/all/conanfile.py index 09dde9bc58be5..6ed583d1786ac 100644 --- a/recipes/gtsam/all/conanfile.py +++ b/recipes/gtsam/all/conanfile.py @@ -1,10 +1,13 @@ -from conan.tools.microsoft import msvc_runtime_flag, is_msvc -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save +from conan.tools.microsoft import check_min_vs, is_msvc, msvc_runtime_flag +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class GtsamConan(ConanFile): @@ -14,7 +17,7 @@ class GtsamConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = ("GTSAM is a library of C++ classes that implement\ smoothing and mapping (SAM) in robotics and vision") - topics = ("gtsam", "mapping", "smoothing") + topics = ("mapping", "smoothing") settings = "os", "arch", "compiler", "build_type" options = { @@ -66,21 +69,8 @@ class GtsamConan(ConanFile): "install_cppunitlite": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -88,12 +78,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.with_TBB: self.options["onetbb"].tbbmalloc = True + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("boost/1.78.0") + self.requires("boost/1.81.0") self.requires("eigen/3.4.0") if self.options.with_TBB: self.requires("onetbb/2020.3") @@ -103,89 +96,86 @@ def _required_boost_components(self): return ["serialization", "system", "filesystem", "thread", "date_time", "regex", "timer", "chrono"] def validate(self): - miss_boost_required_comp = any(getattr(self.options["boost"], "without_{}".format(boost_comp), True) for boost_comp in self._required_boost_components) - if self.options["boost"].header_only or miss_boost_required_comp: + miss_boost_required_comp = any(self.dependencies["boost"].options.get_safe(f"without_{boost_comp}", True) + for boost_comp in self._required_boost_components) + if self.dependencies["boost"].options.header_only or miss_boost_required_comp: raise ConanInvalidConfiguration( - "{0} requires non header-only boost with these components: {1}".format( - self.name, ", ".join(self._required_boost_components) - ) + f"{self.ref} requires non header-only boost with these components: " + f"{', '.join(self._required_boost_components)}" ) - if self.options.with_TBB and not self.options["onetbb"].tbbmalloc: + if self.options.with_TBB and not self.dependencies["onetbb"].options.tbbmalloc: raise ConanInvalidConfiguration("gtsam with tbb requires onetbb:tbbmalloc=True") - if is_msvc(self) and tools.Version(self.settings.compiler.version) < 15: - raise ConanInvalidConfiguration ("GTSAM requires MSVC >= 15") + check_min_vs(self, "191") - if is_msvc(self) and tools.Version(self.version) >= '4.1' \ - and self.options.shared: - raise ConanInvalidConfiguration("GTSAM does not support shared builds on MSVC. see https://github.com/borglab/gtsam/issues/1087") + if Version(self.version) >= "4.1.0" and is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration( + f"{self.ref} does not support shared builds with MSVC. See https://github.com/borglab/gtsam/issues/1087" + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["GTSAM_USE_QUATERNIONS"] = self.options.use_quaternions + tc.variables["GTSAM_POSE3_EXPMAP"] = self.options.pose3_expmap + tc.variables["GTSAM_ROT3_EXPMAP"] = self.options.rot3_expmap + tc.variables["GTSAM_ENABLE_CONSISTENCY_CHECKS"] = self.options.enable_consistency_checks + tc.variables["GTSAM_WITH_TBB"] = self.options.with_TBB + tc.variables["GTSAM_WITH_EIGEN_MKL"] = self.options.with_eigen_MKL + tc.variables["GTSAM_WITH_EIGEN_MKL_OPENMP"] = self.options.with_eigen_MKL_OPENMP + tc.variables["GTSAM_THROW_CHEIRALITY_EXCEPTION"] = self.options.throw_cheirality_exception + tc.variables["GTSAM_ALLOW_DEPRECATED_SINCE_V4"] = self.options.allow_deprecated_since_V4 + tc.variables["GTSAM_TYPEDEF_POINTS_TO_VECTORS"] = self.options.typedef_points_to_vectors + tc.variables["GTSAM_SUPPORT_NESTED_DISSECTION"] = self.options.support_nested_dissection + tc.variables["GTSAM_TANGENT_PREINTEGRATION"] = self.options.tangent_preintegration + tc.variables["GTSAM_BUILD_WITH_CCACHE"] = False + tc.variables["GTSAM_BUILD_UNSTABLE"] = self.options.build_unstable + tc.variables["GTSAM_DISABLE_NEW_TIMERS"] = self.options.disable_new_timers + tc.variables["GTSAM_BUILD_TYPE_POSTFIXES"] = self.options.build_type_postfixes + tc.variables["GTSAM_BUILD_TESTS"] = False + tc.variables["Boost_USE_STATIC_LIBS"] = not self.dependencies["boost"].options.shared + tc.variables["Boost_NO_SYSTEM_PATHS"] = True + tc.variables["GTSAM_BUILD_DOCS"] = False + tc.variables["GTSAM_BUILD_DOC_HTML"] = False + tc.variables["GTSAM_BUILD_EXAMPLES_ALWAYS"] = False + tc.variables["GTSAM_BUILD_WRAP"] = self.options.build_wrap + tc.variables["GTSAM_BUILD_WITH_MARCH_NATIVE"] = False + tc.variables["GTSAM_WRAP_SERIALIZATION"] = self.options.wrap_serialization + tc.variables["GTSAM_INSTALL_MATLAB_TOOLBOX"] = self.options.install_matlab_toolbox + tc.variables["GTSAM_INSTALL_CYTHON_TOOLBOX"] = self.options.install_cython_toolbox + tc.variables["GTSAM_INSTALL_CPPUNITLITE"] = self.options.install_cppunitlite + tc.variables["GTSAM_INSTALL_GEOGRAPHICLIB"] = False + tc.variables["GTSAM_USE_SYSTEM_EIGEN"] = True + tc.variables["GTSAM_BUILD_TYPE_POSTFIXES"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) + # Honor vc runtime if is_msvc(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "GtsamBuildTypes.cmake"), - "/MD ", - "/{} ".format(msvc_runtime_flag(self))) - tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "GtsamBuildTypes.cmake"), - "/MDd ", - "/{} ".format(msvc_runtime_flag(self))) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared - self._cmake.definitions["GTSAM_USE_QUATERNIONS"] = self.options.use_quaternions - self._cmake.definitions["GTSAM_POSE3_EXPMAP"] = self.options.pose3_expmap - self._cmake.definitions["GTSAM_ROT3_EXPMAP"] = self.options.rot3_expmap - self._cmake.definitions["GTSAM_ENABLE_CONSISTENCY_CHECKS"] = self.options.enable_consistency_checks - self._cmake.definitions["GTSAM_WITH_TBB"] = self.options.with_TBB - self._cmake.definitions["GTSAM_WITH_EIGEN_MKL"] = self.options.with_eigen_MKL - self._cmake.definitions["GTSAM_WITH_EIGEN_MKL_OPENMP"] = self.options.with_eigen_MKL_OPENMP - self._cmake.definitions["GTSAM_THROW_CHEIRALITY_EXCEPTION"] = self.options.throw_cheirality_exception - self._cmake.definitions["GTSAM_ALLOW_DEPRECATED_SINCE_V4"] = self.options.allow_deprecated_since_V4 - self._cmake.definitions["GTSAM_TYPEDEF_POINTS_TO_VECTORS"] = self.options.typedef_points_to_vectors - self._cmake.definitions["GTSAM_SUPPORT_NESTED_DISSECTION"] = self.options.support_nested_dissection - self._cmake.definitions["GTSAM_TANGENT_PREINTEGRATION"] = self.options.tangent_preintegration - self._cmake.definitions["GTSAM_BUILD_UNSTABLE"] = self.options.build_unstable - self._cmake.definitions["GTSAM_DISABLE_NEW_TIMERS"] = self.options.disable_new_timers - self._cmake.definitions["GTSAM_BUILD_TYPE_POSTFIXES"] = self.options.build_type_postfixes - self._cmake.definitions["GTSAM_BUILD_TESTS"] = False - self._cmake.definitions["Boost_USE_STATIC_LIBS"] = not self.options["boost"].shared - self._cmake.definitions["Boost_NO_SYSTEM_PATHS"] = True - self._cmake.definitions["GTSAM_BUILD_DOCS"] = False - self._cmake.definitions["GTSAM_BUILD_DOC_HTML"] = False - self._cmake.definitions["GTSAM_BUILD_EXAMPLES_ALWAYS"] = False - self._cmake.definitions["GTSAM_BUILD_WRAP"] = self.options.build_wrap - self._cmake.definitions["GTSAM_BUILD_WITH_MARCH_NATIVE"] = False - self._cmake.definitions["GTSAM_WRAP_SERIALIZATION"] = self.options.wrap_serialization - self._cmake.definitions["GTSAM_INSTALL_MATLAB_TOOLBOX"] = self.options.install_matlab_toolbox - self._cmake.definitions["GTSAM_INSTALL_CYTHON_TOOLBOX"] = self.options.install_cython_toolbox - self._cmake.definitions["GTSAM_INSTALL_CPPUNITLITE"] = self.options.install_cppunitlite - self._cmake.definitions["GTSAM_INSTALL_GEOGRAPHICLIB"] = False - self._cmake.definitions["GTSAM_USE_SYSTEM_EIGEN"] = True #Set to false to use eigen sources contained in GTSAM - self._cmake.definitions["GTSAM_BUILD_TYPE_POSTFIXES"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + gtsam_build_types_cmake = os.path.join(self.source_folder, "cmake", "GtsamBuildTypes.cmake") + replace_in_file(self, gtsam_build_types_cmake, "/MD ", f"/{msvc_runtime_flag(self)} ") + replace_in_file(self, gtsam_build_types_cmake, "/MDd ", f"/{msvc_runtime_flag(self)} ") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE.BSD", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("LICENSE.BSD", src=self._source_subfolder, dst="licenses") - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "CMake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "CMake")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -198,21 +188,20 @@ def package(self): } ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "GTSAM") @@ -220,19 +209,19 @@ def package_info(self): prefix = "lib" if is_msvc(self) and not self.options.shared else "" self.cpp_info.components["libgtsam"].set_property("cmake_target_name", "gtsam") - self.cpp_info.components["libgtsam"].libs = ["{}gtsam".format(prefix)] - self.cpp_info.components["libgtsam"].requires = ["boost::{}".format(component) for component in self._required_boost_components] + self.cpp_info.components["libgtsam"].libs = [f"{prefix}gtsam"] + self.cpp_info.components["libgtsam"].requires = [f"boost::{component}" for component in self._required_boost_components] self.cpp_info.components["libgtsam"].requires.append("eigen::eigen") if self.options.with_TBB: self.cpp_info.components["libgtsam"].requires.append("onetbb::onetbb") if self.options.support_nested_dissection: self.cpp_info.components["libgtsam"].requires.append("libmetis-gtsam") - if self.settings.os == "Windows" and tools.Version(self.version) >= "4.0.3": + if self.settings.os == "Windows" and Version(self.version) >= "4.0.3": self.cpp_info.components["libgtsam"].system_libs = ["dbghelp"] if self.options.build_unstable: self.cpp_info.components["libgtsam_unstable"].set_property("cmake_target_name", "gtsam_unstable") - self.cpp_info.components["libgtsam_unstable"].libs = ["{}gtsam_unstable".format(prefix)] + self.cpp_info.components["libgtsam_unstable"].libs = [f"{prefix}gtsam_unstable"] self.cpp_info.components["libgtsam_unstable"].requires = ["libgtsam"] if self.options.support_nested_dissection: diff --git a/recipes/gtsam/all/patches/0001-conan-4.0.2.patch b/recipes/gtsam/all/patches/0001-conan-4.0.2.patch deleted file mode 100644 index 67dca2813a277..0000000000000 --- a/recipes/gtsam/all/patches/0001-conan-4.0.2.patch +++ /dev/null @@ -1,132 +0,0 @@ -diff --color -ruN cmake/GtsamPythonWrap.cmake cmake/GtsamPythonWrap.cmake ---- cmake/GtsamPythonWrap.cmake 2019-10-08 00:05:09.000000000 -0300 -+++ cmake/GtsamPythonWrap.cmake 2020-12-01 16:12:54.459435000 -0300 -@@ -69,7 +69,7 @@ - ENDIF(MSVC) - - # Installs the library in the gtsam folder, which is used by setup.py to create the gtsam package -- set(PYTHON_MODULE_DIRECTORY ${CMAKE_SOURCE_DIR}/python/gtsam) -+ set(PYTHON_MODULE_DIRECTORY ${GTSAM_SOURCE_DIR}/python/gtsam) - # Cause the library to be output in the correct directory. - add_custom_command(TARGET ${moduleName}_python - POST_BUILD -diff --color -ruN CMakeLists.txt CMakeLists.txt ---- CMakeLists.txt 2019-10-08 00:05:09.000000000 -0300 -+++ CMakeLists.txt 2020-12-01 16:12:54.459435000 -0300 -@@ -35,7 +35,7 @@ - include(GtsamPrinting) - - # guard against in-source builds --if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) -+if(${GTSAM_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ") - endif() - -@@ -163,13 +163,13 @@ - set(BOOST_FIND_MINIMUM_VERSION 1.43) - set(BOOST_FIND_MINIMUM_COMPONENTS serialization system filesystem thread program_options date_time timer chrono regex) - --find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS}) -+find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS} REQUIRED) - - # Required components --if(NOT Boost_SERIALIZATION_LIBRARY OR NOT Boost_SYSTEM_LIBRARY OR NOT Boost_FILESYSTEM_LIBRARY OR -- NOT Boost_THREAD_LIBRARY OR NOT Boost_DATE_TIME_LIBRARY) -- message(FATAL_ERROR "Missing required Boost components >= v1.43, please install/upgrade Boost or configure your search paths.") --endif() -+#if(NOT Boost_SERIALIZATION_LIBRARY OR NOT Boost_SYSTEM_LIBRARY OR NOT Boost_FILESYSTEM_LIBRARY OR -+# NOT Boost_THREAD_LIBRARY OR NOT Boost_DATE_TIME_LIBRARY) -+# message(FATAL_ERROR "Missing required Boost components >= v1.43, please install/upgrade Boost or configure your search paths.") -+#endif() - - # Allow for not using the timer libraries on boost < 1.48 (GTSAM timing code falls back to old timer library) - option(GTSAM_DISABLE_NEW_TIMERS "Disables using Boost.chrono for timing" OFF) -@@ -179,30 +179,22 @@ - # so we downgraded this to classic filenames-based variables, and manually adding - # the target_include_directories(xxx ${Boost_INCLUDE_DIR}) - set(GTSAM_BOOST_LIBRARIES -- optimized ${Boost_SERIALIZATION_LIBRARY_RELEASE} -- optimized ${Boost_SYSTEM_LIBRARY_RELEASE} -- optimized ${Boost_FILESYSTEM_LIBRARY_RELEASE} -- optimized ${Boost_THREAD_LIBRARY_RELEASE} -- optimized ${Boost_DATE_TIME_LIBRARY_RELEASE} -- optimized ${Boost_REGEX_LIBRARY_RELEASE} -- debug ${Boost_SERIALIZATION_LIBRARY_DEBUG} -- debug ${Boost_SYSTEM_LIBRARY_DEBUG} -- debug ${Boost_FILESYSTEM_LIBRARY_DEBUG} -- debug ${Boost_THREAD_LIBRARY_DEBUG} -- debug ${Boost_DATE_TIME_LIBRARY_DEBUG} -- debug ${Boost_REGEX_LIBRARY_DEBUG} -+ Boost::serialization -+ Boost::system -+ Boost::filesystem -+ Boost::thread -+ Boost::date_time -+ Boost::regex - ) - message(STATUS "GTSAM_BOOST_LIBRARIES: ${GTSAM_BOOST_LIBRARIES}") - if (GTSAM_DISABLE_NEW_TIMERS) - message("WARNING: GTSAM timing instrumentation manually disabled") - list_append_cache(GTSAM_COMPILE_DEFINITIONS_PUBLIC DGTSAM_DISABLE_NEW_TIMERS) - else() -- if(Boost_TIMER_LIBRARY) -+ if(TARGET Boost::timer) - list(APPEND GTSAM_BOOST_LIBRARIES -- optimized ${Boost_TIMER_LIBRARY_RELEASE} -- optimized ${Boost_CHRONO_LIBRARY_RELEASE} -- debug ${Boost_TIMER_LIBRARY_DEBUG} -- debug ${Boost_CHRONO_LIBRARY_DEBUG} -+ Boost::timer -+ Boost::chrono - ) - else() - list(APPEND GTSAM_BOOST_LIBRARIES rt) # When using the header-only boost timer library, need -lrt -@@ -328,7 +320,7 @@ - set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "include/gtsam/3rdparty/Eigen/") - - # The actual include directory (for BUILD cmake target interface): -- set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${CMAKE_SOURCE_DIR}/gtsam/3rdparty/Eigen/") -+ set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${GTSAM_SOURCE_DIR}/gtsam/3rdparty/Eigen/") - endif() - - # Detect Eigen version: -diff --color -ruN gtsam/CMakeLists.txt gtsam/CMakeLists.txt ---- gtsam/CMakeLists.txt 2019-10-08 00:05:09.000000000 -0300 -+++ gtsam/CMakeLists.txt 2020-12-01 16:12:54.459435000 -0300 -@@ -145,18 +145,18 @@ - $ - $ - # main gtsam includes: -- $ -+ $ - $ - # config.h -- $ -+ $ - # unit tests: -- $ -+ $ - ) - if(GTSAM_SUPPORT_NESTED_DISSECTION) - target_include_directories(gtsam BEFORE PUBLIC -- $ -- $ -- $ -+ $ -+ $ -+ $ - $ - ) - endif() -diff --color -ruN wrap/CMakeLists.txt wrap/CMakeLists.txt ---- wrap/CMakeLists.txt 2019-10-08 00:05:09.000000000 -0300 -+++ wrap/CMakeLists.txt 2020-12-01 16:12:54.459435000 -0300 -@@ -20,7 +20,7 @@ - list(REMOVE_ITEM wrap_srcs ${CMAKE_CURRENT_SOURCE_DIR}/wrap.cpp) - add_library(wrap_lib STATIC ${wrap_srcs} ${wrap_headers}) - target_include_directories(wrap_lib PUBLIC -- $ -+ $ - ) - if (NOT GTSAM_WRAP_SERIALIZATION) - target_compile_definitions(wrap_lib PUBLIC -DWRAP_DISABLE_SERIALIZE) diff --git a/recipes/gtsam/all/patches/0001-conan-4.0.3.patch b/recipes/gtsam/all/patches/0001-conan-4.0.3.patch deleted file mode 100644 index 0929203d3dc38..0000000000000 --- a/recipes/gtsam/all/patches/0001-conan-4.0.3.patch +++ /dev/null @@ -1,89 +0,0 @@ -diff --color -ruN cmake/GtsamPythonWrap.cmake cmake/GtsamPythonWrap.cmake ---- cmake/GtsamPythonWrap.cmake 2020-07-22 13:22:57.000000000 -0300 -+++ cmake/GtsamPythonWrap.cmake 2020-12-02 11:28:50.140088741 -0300 -@@ -69,7 +69,7 @@ - ENDIF(MSVC) - - # Installs the library in the gtsam folder, which is used by setup.py to create the gtsam package -- set(PYTHON_MODULE_DIRECTORY ${CMAKE_SOURCE_DIR}/python/gtsam) -+ set(PYTHON_MODULE_DIRECTORY ${GTSAM_SOURCE_DIR}/python/gtsam) - # Cause the library to be output in the correct directory. - add_custom_command(TARGET ${moduleName}_python - POST_BUILD -diff --color -ruN CMakeLists.txt CMakeLists.txt ---- CMakeLists.txt 2020-07-22 13:22:57.000000000 -0300 -+++ CMakeLists.txt 2020-12-02 11:30:42.049922171 -0300 -@@ -36,7 +36,7 @@ - include(GtsamPrinting) - - # guard against in-source builds --if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) -+if(${GTSAM_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) - message(FATAL_ERROR "In-source builds not allowed. Please make a new directory (called a build directory) and run CMake from there. You may need to remove CMakeCache.txt. ") - endif() - -@@ -164,13 +164,13 @@ - set(BOOST_FIND_MINIMUM_VERSION 1.43) - set(BOOST_FIND_MINIMUM_COMPONENTS serialization system filesystem thread program_options date_time timer chrono regex) - --find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS}) -+find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS} REQUIRED) - - # Required components --if(NOT Boost_SERIALIZATION_LIBRARY OR NOT Boost_SYSTEM_LIBRARY OR NOT Boost_FILESYSTEM_LIBRARY OR -- NOT Boost_THREAD_LIBRARY OR NOT Boost_DATE_TIME_LIBRARY) -- message(FATAL_ERROR "Missing required Boost components >= v1.43, please install/upgrade Boost or configure your search paths.") --endif() -+#if(NOT Boost_SERIALIZATION_LIBRARY OR NOT Boost_SYSTEM_LIBRARY OR NOT Boost_FILESYSTEM_LIBRARY OR -+# NOT Boost_THREAD_LIBRARY OR NOT Boost_DATE_TIME_LIBRARY) -+# message(FATAL_ERROR "Missing required Boost components >= v1.43, please install/upgrade Boost or configure your search paths.") -+#endif() - - option(GTSAM_DISABLE_NEW_TIMERS "Disables using Boost.chrono for timing" OFF) - # Allow for not using the timer libraries on boost < 1.48 (GTSAM timing code falls back to old timer library) -@@ -186,7 +186,7 @@ - message("WARNING: GTSAM timing instrumentation manually disabled") - list_append_cache(GTSAM_COMPILE_DEFINITIONS_PUBLIC DGTSAM_DISABLE_NEW_TIMERS) - else() -- if(Boost_TIMER_LIBRARY) -+ if(TARGET Boost::timer) - list(APPEND GTSAM_BOOST_LIBRARIES Boost::timer Boost::chrono) - else() - list(APPEND GTSAM_BOOST_LIBRARIES rt) # When using the header-only boost timer library, need -lrt -@@ -311,7 +311,7 @@ - set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "include/gtsam/3rdparty/Eigen/") - - # The actual include directory (for BUILD cmake target interface): -- set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${CMAKE_SOURCE_DIR}/gtsam/3rdparty/Eigen/") -+ set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${GTSAM_SOURCE_DIR}/gtsam/3rdparty/Eigen/") - endif() - - # Detect Eigen version: -diff --color -ruN gtsam/CMakeLists.txt gtsam/CMakeLists.txt ---- gtsam/CMakeLists.txt 2020-07-22 13:22:57.000000000 -0300 -+++ gtsam/CMakeLists.txt 2020-12-02 11:40:57.040582346 -0300 -@@ -141,18 +141,18 @@ - $ - $ - # main gtsam includes: -- $ -+ $ - $ - # config.h -- $ -+ $ - # unit tests: -- $ -+ $ - ) - if(GTSAM_SUPPORT_NESTED_DISSECTION) - target_include_directories(gtsam BEFORE PUBLIC -- $ -- $ -- $ -+ $ -+ $ -+ $ - $ - ) - endif() diff --git a/recipes/gtsam/all/patches/0002-macos-rpath-4.1.1.patch b/recipes/gtsam/all/patches/0002-macos-rpath-4.1.1.patch deleted file mode 100644 index 84336aaee8564..0000000000000 --- a/recipes/gtsam/all/patches/0002-macos-rpath-4.1.1.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) - # new feature to Cmake Version > 2.8.12 - # Mac ONLY. Define Relative Path on Mac OS - if(NOT DEFINED CMAKE_MACOSX_RPATH) -- set(CMAKE_MACOSX_RPATH 0) - endif() - - # Set the version number for the library -diff --git a/gtsam/3rdparty/metis/libmetis/CMakeLists.txt b/gtsam/3rdparty/metis/libmetis/CMakeLists.txt ---- a/gtsam/3rdparty/metis/libmetis/CMakeLists.txt -+++ b/gtsam/3rdparty/metis/libmetis/CMakeLists.txt -@@ -16,12 +16,6 @@ if(WIN32) - RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/../../../bin") - endif() - --if (APPLE) -- set_target_properties(metis-gtsam PROPERTIES -- INSTALL_NAME_DIR -- "${CMAKE_INSTALL_PREFIX}/lib") -- endif() -- - install(TARGETS metis-gtsam EXPORT GTSAM-exports - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/recipes/gtsam/all/patches/4.0.2-0001-cmake-boost.patch b/recipes/gtsam/all/patches/4.0.2-0001-cmake-boost.patch new file mode 100644 index 0000000000000..d19f34cd53327 --- /dev/null +++ b/recipes/gtsam/all/patches/4.0.2-0001-cmake-boost.patch @@ -0,0 +1,61 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -163,13 +163,13 @@ + set(BOOST_FIND_MINIMUM_VERSION 1.43) + set(BOOST_FIND_MINIMUM_COMPONENTS serialization system filesystem thread program_options date_time timer chrono regex) + +-find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS}) ++find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS} REQUIRED) + + # Required components +-if(NOT Boost_SERIALIZATION_LIBRARY OR NOT Boost_SYSTEM_LIBRARY OR NOT Boost_FILESYSTEM_LIBRARY OR +- NOT Boost_THREAD_LIBRARY OR NOT Boost_DATE_TIME_LIBRARY) +- message(FATAL_ERROR "Missing required Boost components >= v1.43, please install/upgrade Boost or configure your search paths.") +-endif() ++#if(NOT Boost_SERIALIZATION_LIBRARY OR NOT Boost_SYSTEM_LIBRARY OR NOT Boost_FILESYSTEM_LIBRARY OR ++# NOT Boost_THREAD_LIBRARY OR NOT Boost_DATE_TIME_LIBRARY) ++# message(FATAL_ERROR "Missing required Boost components >= v1.43, please install/upgrade Boost or configure your search paths.") ++#endif() + + # Allow for not using the timer libraries on boost < 1.48 (GTSAM timing code falls back to old timer library) + option(GTSAM_DISABLE_NEW_TIMERS "Disables using Boost.chrono for timing" OFF) +@@ -179,30 +179,22 @@ + # so we downgraded this to classic filenames-based variables, and manually adding + # the target_include_directories(xxx ${Boost_INCLUDE_DIR}) + set(GTSAM_BOOST_LIBRARIES +- optimized ${Boost_SERIALIZATION_LIBRARY_RELEASE} +- optimized ${Boost_SYSTEM_LIBRARY_RELEASE} +- optimized ${Boost_FILESYSTEM_LIBRARY_RELEASE} +- optimized ${Boost_THREAD_LIBRARY_RELEASE} +- optimized ${Boost_DATE_TIME_LIBRARY_RELEASE} +- optimized ${Boost_REGEX_LIBRARY_RELEASE} +- debug ${Boost_SERIALIZATION_LIBRARY_DEBUG} +- debug ${Boost_SYSTEM_LIBRARY_DEBUG} +- debug ${Boost_FILESYSTEM_LIBRARY_DEBUG} +- debug ${Boost_THREAD_LIBRARY_DEBUG} +- debug ${Boost_DATE_TIME_LIBRARY_DEBUG} +- debug ${Boost_REGEX_LIBRARY_DEBUG} ++ Boost::serialization ++ Boost::system ++ Boost::filesystem ++ Boost::thread ++ Boost::date_time ++ Boost::regex + ) + message(STATUS "GTSAM_BOOST_LIBRARIES: ${GTSAM_BOOST_LIBRARIES}") + if (GTSAM_DISABLE_NEW_TIMERS) + message("WARNING: GTSAM timing instrumentation manually disabled") + list_append_cache(GTSAM_COMPILE_DEFINITIONS_PUBLIC DGTSAM_DISABLE_NEW_TIMERS) + else() +- if(Boost_TIMER_LIBRARY) ++ if(TARGET Boost::timer) + list(APPEND GTSAM_BOOST_LIBRARIES +- optimized ${Boost_TIMER_LIBRARY_RELEASE} +- optimized ${Boost_CHRONO_LIBRARY_RELEASE} +- debug ${Boost_TIMER_LIBRARY_DEBUG} +- debug ${Boost_CHRONO_LIBRARY_DEBUG} ++ Boost::timer ++ Boost::chrono + ) + else() + list(APPEND GTSAM_BOOST_LIBRARIES rt) # When using the header-only boost timer library, need -lrt diff --git a/recipes/gtsam/all/patches/4.0.2-0002-cmake-eigen.patch b/recipes/gtsam/all/patches/4.0.2-0002-cmake-eigen.patch new file mode 100644 index 0000000000000..21c808ace60fd --- /dev/null +++ b/recipes/gtsam/all/patches/4.0.2-0002-cmake-eigen.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -292,7 +292,7 @@ if(GTSAM_USE_SYSTEM_EIGEN) + find_package(Eigen3 REQUIRED) + + # Use generic Eigen include paths e.g. +- set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${EIGEN3_INCLUDE_DIR}") ++ set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${Eigen3_INCLUDE_DIRS}") + + # check if MKL is also enabled - can have one or the other, but not both! + # Note: Eigen >= v3.2.5 includes our patches +@@ -307,7 +307,7 @@ if(GTSAM_USE_SYSTEM_EIGEN) + endif() + + # The actual include directory (for BUILD cmake target interface): +- set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${EIGEN3_INCLUDE_DIR}") ++ set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${Eigen3_INCLUDE_DIRS}") + else() + # Use bundled Eigen include path. + # Clear any variables set by FindEigen3 diff --git a/recipes/gtsam/all/patches/4.0.2-0003-cmake-project.patch b/recipes/gtsam/all/patches/4.0.2-0003-cmake-project.patch new file mode 100644 index 0000000000000..e6d665e0c60aa --- /dev/null +++ b/recipes/gtsam/all/patches/4.0.2-0003-cmake-project.patch @@ -0,0 +1,9 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ +-project(GTSAM CXX C) + cmake_minimum_required(VERSION 3.0) ++project(GTSAM CXX C) + + # new feature to Cmake Version > 2.8.12 + # Mac ONLY. Define Relative Path on Mac OS diff --git a/recipes/gtsam/all/patches/0002-macos-rpath-4.0.2.patch b/recipes/gtsam/all/patches/4.0.2-0003-macos-rpath.patch similarity index 100% rename from recipes/gtsam/all/patches/0002-macos-rpath-4.0.2.patch rename to recipes/gtsam/all/patches/4.0.2-0003-macos-rpath.patch diff --git a/recipes/gtsam/all/patches/4.0.3-0001-cmake-boost.patch b/recipes/gtsam/all/patches/4.0.3-0001-cmake-boost.patch new file mode 100644 index 0000000000000..ca7acfebb3fa2 --- /dev/null +++ b/recipes/gtsam/all/patches/4.0.3-0001-cmake-boost.patch @@ -0,0 +1,30 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -164,13 +164,13 @@ + set(BOOST_FIND_MINIMUM_VERSION 1.43) + set(BOOST_FIND_MINIMUM_COMPONENTS serialization system filesystem thread program_options date_time timer chrono regex) + +-find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS}) ++find_package(Boost ${BOOST_FIND_MINIMUM_VERSION} COMPONENTS ${BOOST_FIND_MINIMUM_COMPONENTS} REQUIRED) + + # Required components +-if(NOT Boost_SERIALIZATION_LIBRARY OR NOT Boost_SYSTEM_LIBRARY OR NOT Boost_FILESYSTEM_LIBRARY OR +- NOT Boost_THREAD_LIBRARY OR NOT Boost_DATE_TIME_LIBRARY) +- message(FATAL_ERROR "Missing required Boost components >= v1.43, please install/upgrade Boost or configure your search paths.") +-endif() ++#if(NOT Boost_SERIALIZATION_LIBRARY OR NOT Boost_SYSTEM_LIBRARY OR NOT Boost_FILESYSTEM_LIBRARY OR ++# NOT Boost_THREAD_LIBRARY OR NOT Boost_DATE_TIME_LIBRARY) ++# message(FATAL_ERROR "Missing required Boost components >= v1.43, please install/upgrade Boost or configure your search paths.") ++#endif() + + option(GTSAM_DISABLE_NEW_TIMERS "Disables using Boost.chrono for timing" OFF) + # Allow for not using the timer libraries on boost < 1.48 (GTSAM timing code falls back to old timer library) +@@ -186,7 +186,7 @@ + message("WARNING: GTSAM timing instrumentation manually disabled") + list_append_cache(GTSAM_COMPILE_DEFINITIONS_PUBLIC DGTSAM_DISABLE_NEW_TIMERS) + else() +- if(Boost_TIMER_LIBRARY) ++ if(TARGET Boost::timer) + list(APPEND GTSAM_BOOST_LIBRARIES Boost::timer Boost::chrono) + else() + list(APPEND GTSAM_BOOST_LIBRARIES rt) # When using the header-only boost timer library, need -lrt diff --git a/recipes/gtsam/all/patches/4.0.3-0002-cmake-eigen.patch b/recipes/gtsam/all/patches/4.0.3-0002-cmake-eigen.patch new file mode 100644 index 0000000000000..13c0702834d4b --- /dev/null +++ b/recipes/gtsam/all/patches/4.0.3-0002-cmake-eigen.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -283,7 +283,7 @@ if(GTSAM_USE_SYSTEM_EIGEN) + find_package(Eigen3 REQUIRED) + + # Use generic Eigen include paths e.g. +- set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${EIGEN3_INCLUDE_DIR}") ++ set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${Eigen3_INCLUDE_DIRS}") + + # check if MKL is also enabled - can have one or the other, but not both! + # Note: Eigen >= v3.2.5 includes our patches +@@ -298,7 +298,7 @@ if(GTSAM_USE_SYSTEM_EIGEN) + endif() + + # The actual include directory (for BUILD cmake target interface): +- set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${EIGEN3_INCLUDE_DIR}") ++ set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${Eigen3_INCLUDE_DIRS}") + else() + # Use bundled Eigen include path. + # Clear any variables set by FindEigen3 diff --git a/recipes/gtsam/all/patches/0002-macos-rpath-4.0.3.patch b/recipes/gtsam/all/patches/4.0.3-0003-macos-rpath.patch similarity index 100% rename from recipes/gtsam/all/patches/0002-macos-rpath-4.0.3.patch rename to recipes/gtsam/all/patches/4.0.3-0003-macos-rpath.patch diff --git a/recipes/gtsam/all/patches/0001-conan-4.1.1.patch b/recipes/gtsam/all/patches/4.1.1-0001-cmake-boost.patch similarity index 100% rename from recipes/gtsam/all/patches/0001-conan-4.1.1.patch rename to recipes/gtsam/all/patches/4.1.1-0001-cmake-boost.patch diff --git a/recipes/gtsam/all/patches/4.1.1-0002-cmake-eigen.patch b/recipes/gtsam/all/patches/4.1.1-0002-cmake-eigen.patch new file mode 100644 index 0000000000000..61e8f3ee3656f --- /dev/null +++ b/recipes/gtsam/all/patches/4.1.1-0002-cmake-eigen.patch @@ -0,0 +1,20 @@ +--- a/cmake/HandleEigen.cmake ++++ b/cmake/HandleEigen.cmake +@@ -14,7 +14,7 @@ if(GTSAM_USE_SYSTEM_EIGEN) + find_package(Eigen3 REQUIRED) + + # Use generic Eigen include paths e.g. +- set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${EIGEN3_INCLUDE_DIR}") ++ set(GTSAM_EIGEN_INCLUDE_FOR_INSTALL "${Eigen3_INCLUDE_DIRS}") + + # check if MKL is also enabled - can have one or the other, but not both! + # Note: Eigen >= v3.2.5 includes our patches +@@ -29,7 +29,7 @@ if(GTSAM_USE_SYSTEM_EIGEN) + endif() + + # The actual include directory (for BUILD cmake target interface): +- set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${EIGEN3_INCLUDE_DIR}") ++ set(GTSAM_EIGEN_INCLUDE_FOR_BUILD "${Eigen3_INCLUDE_DIRS}") + else() + # Use bundled Eigen include path. + # Clear any variables set by FindEigen3 diff --git a/recipes/gtsam/all/patches/4.1.1-0003-macos-rpath.patch b/recipes/gtsam/all/patches/4.1.1-0003-macos-rpath.patch new file mode 100644 index 0000000000000..1a596c6b0883a --- /dev/null +++ b/recipes/gtsam/all/patches/4.1.1-0003-macos-rpath.patch @@ -0,0 +1,32 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,7 +4,6 @@ cmake_minimum_required(VERSION 3.0) + # new feature to Cmake Version > 2.8.12 + # Mac ONLY. Define Relative Path on Mac OS + if(NOT DEFINED CMAKE_MACOSX_RPATH) +- set(CMAKE_MACOSX_RPATH 0) + endif() + + # Set the version number for the library +--- a/cmake/HandleGlobalBuildFlags.cmake ++++ b/cmake/HandleGlobalBuildFlags.cmake +@@ -20,7 +20,6 @@ endif() + + if (APPLE AND BUILD_SHARED_LIBS) + # Set the default install directory on macOS +- set(CMAKE_INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib") + endif() + + ############################################################################### +--- a/gtsam/3rdparty/metis/libmetis/CMakeLists.txt ++++ b/gtsam/3rdparty/metis/libmetis/CMakeLists.txt +@@ -17,9 +17,6 @@ if(WIN32) + endif() + + if (APPLE) +- set_target_properties(metis-gtsam PROPERTIES +- INSTALL_NAME_DIR +- "${CMAKE_INSTALL_PREFIX}/lib") + endif() + + install(TARGETS metis-gtsam EXPORT GTSAM-exports diff --git a/recipes/gtsam/all/test_package/CMakeLists.txt b/recipes/gtsam/all/test_package/CMakeLists.txt index bac6d84e2319d..3f46187fc1f60 100644 --- a/recipes/gtsam/all/test_package/CMakeLists.txt +++ b/recipes/gtsam/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(GTSAM REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} gtsam) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE gtsam) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/gtsam/all/test_package/conanfile.py b/recipes/gtsam/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/gtsam/all/test_package/conanfile.py +++ b/recipes/gtsam/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gtsam/all/test_v1_package/CMakeLists.txt b/recipes/gtsam/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/gtsam/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gtsam/all/test_v1_package/conanfile.py b/recipes/gtsam/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/gtsam/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/gumbo-parser/all/conandata.yml b/recipes/gumbo-parser/all/conandata.yml index 6f417f3459ec8..5a4bd28857b65 100644 --- a/recipes/gumbo-parser/all/conandata.yml +++ b/recipes/gumbo-parser/all/conandata.yml @@ -1,4 +1,4 @@ sources: "0.10.1": - sha256: 28463053d44a5dfbc4b77bcf49c8cee119338ffa636cc17fc3378421d714efad url: "https://github.com/google/gumbo-parser/archive/v0.10.1.tar.gz" + sha256: "28463053d44a5dfbc4b77bcf49c8cee119338ffa636cc17fc3378421d714efad" diff --git a/recipes/gumbo-parser/all/conanfile.py b/recipes/gumbo-parser/all/conanfile.py index 0e9147b23edd7..579047bc3a0aa 100644 --- a/recipes/gumbo-parser/all/conanfile.py +++ b/recipes/gumbo-parser/all/conanfile.py @@ -1,69 +1,89 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os +required_conan_version = ">=1.53.0" + class GumboParserConan(ConanFile): name = "gumbo-parser" description = "An HTML5 parsing library in pure C99" - topics = ("conan", "parser") + topics = ("parser", "html") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/google/gumbo-parser" license = "Apache-2.0" - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - _autotools = None + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("This recipe does not support Visual Studio") + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration("gumbo-parser recipe does not support Visual Studio yet") def build_requirements(self): - self.build_requires("libtool/2.4.6") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_folder = "gumbo-parser-{0}".format(self.version) - os.rename(extracted_folder, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_autotools(self): - if not self._autotools: - with tools.chdir(self._source_subfolder): - self.run("./autogen.sh", win_bash=tools.os_info.is_windows) - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - args = [] - if self.options.shared: - args.extend(['--disable-static', '--enable-shared']) - else: - args.extend(['--disable-shared', '--enable-static']) - self._autotools.configure(configure_dir=self._source_subfolder, args=args) - return self._autotools + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, 'lib', 'pkgconfig')) - os.unlink(os.path.join(self.package_folder, 'lib', 'libgumbo.la')) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.names["pkg_config"] = "gumbo" + self.cpp_info.set_property("pkg_config_name", "gumbo") self.cpp_info.libs = ["gumbo"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/gumbo-parser/all/test_package/CMakeLists.txt b/recipes/gumbo-parser/all/test_package/CMakeLists.txt index 7b9b613cbb24a..29e92f880421a 100644 --- a/recipes/gumbo-parser/all/test_package/CMakeLists.txt +++ b/recipes/gumbo-parser/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(gumbo-parser REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE gumbo-parser::gumbo-parser) diff --git a/recipes/gumbo-parser/all/test_package/conanfile.py b/recipes/gumbo-parser/all/test_package/conanfile.py index bd7165a553cf4..0a6bc68712d90 100644 --- a/recipes/gumbo-parser/all/test_package/conanfile.py +++ b/recipes/gumbo-parser/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gumbo-parser/all/test_v1_package/CMakeLists.txt b/recipes/gumbo-parser/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/gumbo-parser/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/gumbo-parser/all/test_v1_package/conanfile.py b/recipes/gumbo-parser/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/gumbo-parser/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/gzip-hpp/all/conandata.yml b/recipes/gzip-hpp/all/conandata.yml new file mode 100644 index 0000000000000..dc56977498952 --- /dev/null +++ b/recipes/gzip-hpp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.0": + url: "https://github.com/mapbox/gzip-hpp/archive/refs/tags/v0.1.0.tar.gz" + sha256: "7ce3908cd13f186987820be97083fc5e62a7c6df0877af44b334a92e868eff06" diff --git a/recipes/gzip-hpp/all/conanfile.py b/recipes/gzip-hpp/all/conanfile.py new file mode 100644 index 0000000000000..9401872c82770 --- /dev/null +++ b/recipes/gzip-hpp/all/conanfile.py @@ -0,0 +1,56 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout + +import os + + +required_conan_version = ">=1.52.0" + + +class GzipHppConan(ConanFile): + name = "gzip-hpp" + description = "Gzip header-only C++ library " + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mapbox/gzip-hpp" + topics = ("gzip", "zlib", "compression", "decompression", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 11 + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("zlib/1.2.13", transitive_headers=True) + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, pattern="LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/gzip-hpp/all/test_package/CMakeLists.txt b/recipes/gzip-hpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..84ca7198a323c --- /dev/null +++ b/recipes/gzip-hpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(gzip-hpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gzip-hpp::gzip-hpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/gzip-hpp/all/test_package/conanfile.py b/recipes/gzip-hpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/gzip-hpp/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/gzip-hpp/all/test_package/test_package.cpp b/recipes/gzip-hpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..72042fe701b60 --- /dev/null +++ b/recipes/gzip-hpp/all/test_package/test_package.cpp @@ -0,0 +1,28 @@ +// Include the specific gzip headers your code needs, for example... +#include +#include +#include +#include +#include + +#include + +int main() { + // All function calls must pass in a pointer of an + // immutable character sequence (aka a string in C) and its size + std::string data = "hello"; + const char* pointer = data.data(); + std::size_t size = data.size(); + + // Check if compressed. Can check both gzip and zlib. + bool c = gzip::is_compressed(pointer, size); // false + + // Compress returns a std::string + std::string compressed_data = gzip::compress(pointer, size); + + // Decompress returns a std::string and decodes both zlib and gzip + const char* compressed_pointer = compressed_data.data(); + std::string decompressed_data = gzip::decompress(compressed_pointer, compressed_data.size()); + + return 0; +} diff --git a/recipes/gzip-hpp/all/test_v1_package/CMakeLists.txt b/recipes/gzip-hpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/gzip-hpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/gzip-hpp/all/test_v1_package/conanfile.py b/recipes/gzip-hpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/gzip-hpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/gzip-hpp/config.yml b/recipes/gzip-hpp/config.yml new file mode 100644 index 0000000000000..6c11a439d0bc2 --- /dev/null +++ b/recipes/gzip-hpp/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.0": + folder: all diff --git a/recipes/h3/all/conandata.yml b/recipes/h3/all/conandata.yml index 829bf4afe8a32..39601951d8c9a 100644 --- a/recipes/h3/all/conandata.yml +++ b/recipes/h3/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.1.0": + url: "https://github.com/uber/h3/archive/refs/tags/v4.1.0.tar.gz" + sha256: "ec99f1f5974846bde64f4513cf8d2ea1b8d172d2218ab41803bf6a63532272bc" "3.7.2": url: "https://github.com/uber/h3/archive/refs/tags/v3.7.2.tar.gz" sha256: "803a7fbbeb01f1f65cae9398bda9579a0529e7bafffc6e0e0a6d81a71b305629" @@ -17,11 +20,21 @@ sources: patches: "3.7.2": - patch_file: "patches/fix-cmake-3.7.x.patch" + patch_description: "move project definition to head, set c99 flag" + patch_type: "portability" "3.7.1": - patch_file: "patches/fix-cmake-3.7.x.patch" + patch_description: "move project definition to head, set c99 flag" + patch_type: "portability" "3.7.0": - patch_file: "patches/fix-cmake-3.7.x.patch" + patch_description: "move project definition to head, set c99 flag" + patch_type: "portability" "3.6.4": - patch_file: "patches/fix-cmake-3.6.4.patch" + patch_description: "move project definition to head, set c99 flag" + patch_type: "portability" "3.6.3": - patch_file: "patches/fix-cmake-3.6.3.patch" + patch_description: "move project definition to head, set c99 flag" + patch_type: "portability" diff --git a/recipes/h3/all/conanfile.py b/recipes/h3/all/conanfile.py index ff33c9fa665be..cc4023e57daf9 100644 --- a/recipes/h3/all/conanfile.py +++ b/recipes/h3/all/conanfile.py @@ -1,9 +1,10 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class H3Conan(ConanFile): @@ -38,19 +39,28 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "4.1.0" and not self._cmake_new_enough("3.20"): + self.tool_requires("cmake/3.25.1") + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) diff --git a/recipes/h3/all/test_package/CMakeLists.txt b/recipes/h3/all/test_package/CMakeLists.txt index e307c995d2d4f..f0064105601c7 100644 --- a/recipes/h3/all/test_package/CMakeLists.txt +++ b/recipes/h3/all/test_package/CMakeLists.txt @@ -5,3 +5,7 @@ find_package(h3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE h3::h3) + +if(h3_VERSION VERSION_GREATER_EQUAL "4.0.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE "H3_VERSION_4_LATER") +endif() diff --git a/recipes/h3/all/test_package/test_package.c b/recipes/h3/all/test_package/test_package.c index cdf80d342588f..9fd4729a81173 100644 --- a/recipes/h3/all/test_package/test_package.c +++ b/recipes/h3/all/test_package/test_package.c @@ -23,6 +23,8 @@ #include #include +#ifndef H3_VERSION_4_LATER + int main() { // Get the H3 index of some location and print it. GeoCoord location; @@ -51,3 +53,37 @@ int main() { return 0; } + +#else + +int main() { + // Get the H3 index of some location and print it. + LatLng location; + location.lat = degsToRads(40.689167); + location.lng = degsToRads(-74.044444); + int resolution = 10; + H3Index indexed; + latLngToCell(&location, resolution, &indexed); + printf("The index is: %" PRIx64 "\n", indexed); + + // Get the vertices of the H3 index. + CellBoundary boundary; + cellToBoundary(indexed, &boundary); + // Indexes can have different number of vertices under some cases, + // which is why boundary.numVerts is needed. + int v; + for (v = 0; v < boundary.numVerts; v++) { + printf("Boundary vertex #%d: %lf, %lf\n", v, + radsToDegs(boundary.verts[v].lat), + radsToDegs(boundary.verts[v].lng)); + } + + // Get the center coordinates. + LatLng center; + cellToLatLng(indexed, ¢er); + printf("Center coordinates: %lf, %lf\n", radsToDegs(center.lat), radsToDegs(center.lng)); + + return 0; +} + +#endif diff --git a/recipes/h3/all/test_v1_package/CMakeLists.txt b/recipes/h3/all/test_v1_package/CMakeLists.txt index 6b1eab908222a..de3b75d9538de 100644 --- a/recipes/h3/all/test_v1_package/CMakeLists.txt +++ b/recipes/h3/all/test_v1_package/CMakeLists.txt @@ -4,7 +4,5 @@ project(test_package LANGUAGES C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(h3 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE h3::h3) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/h3/all/test_v1_package/conanfile.py b/recipes/h3/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/h3/all/test_v1_package/conanfile.py +++ b/recipes/h3/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/h3/config.yml b/recipes/h3/config.yml index 27faf2974af92..7a121275170d5 100644 --- a/recipes/h3/config.yml +++ b/recipes/h3/config.yml @@ -1,4 +1,6 @@ versions: + "4.1.0": + folder: all "3.7.2": folder: all "3.7.1": diff --git a/recipes/h5pp/all/conandata.yml b/recipes/h5pp/all/conandata.yml index 2aa0b94704f12..dd08f4511c3dd 100644 --- a/recipes/h5pp/all/conandata.yml +++ b/recipes/h5pp/all/conandata.yml @@ -17,3 +17,6 @@ sources: "1.10.0": sha256: 27a3e42ed02d8d9341229d58a517134753e1ea46dab4c40d01bb309098c32f13 url: https://github.com/DavidAce/h5pp/archive/v1.10.0.tar.gz + "1.11.0": + sha256: 1c4171275eb50a26ed9da8055397f03a726896c4c49ad0380b16dcb13574ecff + url: https://github.com/DavidAce/h5pp/archive/v1.11.0.tar.gz diff --git a/recipes/h5pp/all/conanfile.py b/recipes/h5pp/all/conanfile.py index 7179031345df5..ac11c70a03a29 100644 --- a/recipes/h5pp/all/conanfile.py +++ b/recipes/h5pp/all/conanfile.py @@ -1,10 +1,12 @@ +from conan import ConanFile from conan.tools.microsoft import is_msvc -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan.tools.scm import Version +from conan.tools.files import get +from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.45.0" - +required_conan_version = ">=1.50.0" class H5ppConan(ConanFile): name = "h5pp" @@ -39,7 +41,7 @@ def _compilers_minimum_version(self): } def config_options(self): - if tools.Version(self.version) < "1.10.0": + if Version(self.version) < "1.10.0": # These dependencies are always required before h5pp 1.10.0: # * h5pp < 1.10.0 includes any version of headers indiscriminately (e.g. system headers), # and can't tell if the the corresponding library will be linked. This makes the, @@ -50,32 +52,36 @@ def config_options(self): del self.options.with_spdlog def requirements(self): - self.requires("hdf5/1.12.1") - if tools.Version(self.version) < "1.10.0" or self.options.get_safe('with_eigen'): + if Version(self.version) < "1.10.0": + self.requires("hdf5/1.12.1") + else: + self.requires("hdf5/1.13.1") + + if Version(self.version) < "1.10.0" or self.options.get_safe('with_eigen'): self.requires("eigen/3.4.0") - if tools.Version(self.version) < "1.10.0" or self.options.get_safe('with_spdlog'): - self.requires("spdlog/1.10.0") + if Version(self.version) < "1.10.0" or self.options.get_safe('with_spdlog'): + self.requires("spdlog/1.11.0") def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + check_min_cppstd(self, 17) minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: + if Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration("h5pp requires C++17, which your compiler does not support.") else: self.output.warn("h5pp requires C++17. Your compiler is unknown. Assuming it supports C++17.") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self,**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def package(self): self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - if tools.Version(self.version) < "1.9.0": + if Version(self.version) < "1.9.0": includedir = os.path.join(self._source_subfolder, "h5pp", "include") else: includedir = os.path.join(self._source_subfolder, "include") @@ -89,7 +95,7 @@ def package_info(self): self.cpp_info.components["h5pp_flags"].set_property("cmake_target_name", "h5pp::flags") self.cpp_info.components["h5pp_deps"].requires = ["hdf5::hdf5"] - if tools.Version(self.version) >= "1.10.0": + if Version(self.version) >= "1.10.0": if self.options.with_eigen: self.cpp_info.components["h5pp_deps"].requires.append("eigen::eigen") self.cpp_info.components["h5pp_flags"].defines.append("H5PP_USE_EIGEN3") @@ -101,7 +107,7 @@ def package_info(self): self.cpp_info.components["h5pp_deps"].requires.append("eigen::eigen") self.cpp_info.components["h5pp_deps"].requires.append("spdlog::spdlog") - if (self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "9") or \ + if (self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "9") or \ (self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") in ["libstdc++", "libstdc++11"]): self.cpp_info.components["h5pp_flags"].system_libs = ["stdc++fs"] if is_msvc(self): diff --git a/recipes/h5pp/config.yml b/recipes/h5pp/config.yml index a0e0d5427545b..2a1bf3aae7487 100644 --- a/recipes/h5pp/config.yml +++ b/recipes/h5pp/config.yml @@ -11,3 +11,5 @@ versions: folder: "all" "1.10.0": folder: "all" + "1.11.0": + folder: "all" diff --git a/recipes/hana/all/conanfile.py b/recipes/hana/all/conanfile.py index 246b40e89dc55..9aa79d1435368 100644 --- a/recipes/hana/all/conanfile.py +++ b/recipes/hana/all/conanfile.py @@ -1,5 +1,7 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, save +from conan.tools.build import check_min_cppstd +from conan.errors import ConanInvalidConfiguration import os import textwrap @@ -15,6 +17,7 @@ class HanaConan(ConanFile): topics = ("hana", "metaprogramming", "boost") settings = "compiler" no_copy_source = True + deprecated = "boost" @property def _source_subfolder(self): @@ -31,7 +34,7 @@ def _compilers_minimum_version(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") + check_min_cppstd(self, "14") def lazy_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -45,23 +48,26 @@ def lazy_lt_semver(v1, v2): elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration("{} {} requires C++14, which your compiler does not support.".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} is deprecated of Boost. Please, use boost package.") + def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(**self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) def package(self): self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) self._create_cmake_module_alias_targets( + self, os.path.join(self.package_folder, self._module_file_rel_path), {"hana": "hana::hana"} ) @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(conanfile, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -70,7 +76,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(conanfile, module_file, content) @property def _module_subfolder(self): diff --git a/recipes/harfbuzz/all/CMakeLists.txt b/recipes/harfbuzz/all/CMakeLists.txt deleted file mode 100644 index 35140b6c8cf7e..0000000000000 --- a/recipes/harfbuzz/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(THIRD_PARTY_LIBS ${CONAN_LIBS}) - -add_subdirectory(source_subfolder) diff --git a/recipes/harfbuzz/all/conandata.yml b/recipes/harfbuzz/all/conandata.yml index 3a1c60eee9a92..8ab99e436984b 100644 --- a/recipes/harfbuzz/all/conandata.yml +++ b/recipes/harfbuzz/all/conandata.yml @@ -1,56 +1,33 @@ sources: - "3.0.0": - url: "https://github.com/harfbuzz/harfbuzz/releases/download/3.0.0/harfbuzz-3.0.0.tar.xz" - sha256: "036b0ee118451539783ec7864148bb4106be42a2eb964df4e83e6703ec46f3d9" - "3.1.2": - url: "https://github.com/harfbuzz/harfbuzz/releases/download/3.1.2/harfbuzz-3.1.2.tar.xz" - sha256: "4056b1541dd8bbd8ec29207fe30e568805c0705515632d7fec53a94399bc7945" "3.2.0": url: "https://github.com/harfbuzz/harfbuzz/releases/download/3.2.0/harfbuzz-3.2.0.tar.xz" sha256: "0ada50a1c199bb6f70843ab893c55867743a443b84d087d54df08ad883ebc2cd" - "4.0.1": - url: "https://github.com/harfbuzz/harfbuzz/releases/download/4.0.1/harfbuzz-4.0.1.tar.xz" - sha256: "98f68777272db6cd7a3d5152bac75083cd52a26176d87bc04c8b3929d33bce49" - "4.1.0": - url: "https://github.com/harfbuzz/harfbuzz/archive/4.1.0.tar.gz" - sha256: "0dad9332aa017d216981382cc07a9cf115740990c83b81ce3ea71ad88026d7f1" - "4.2.1": - url: "https://github.com/harfbuzz/harfbuzz/archive/4.2.1.tar.gz" - sha256: "99fcd30e2f4c66d05af3d61ad4cdba2abc2a51ecabb7eb6dc222520a892b50b0" - "4.3.0": - url: "https://github.com/harfbuzz/harfbuzz/archive/4.3.0.tar.gz" - sha256: "32184860ddc0b264ff95010e1c64e596bd746fe4c2e34014a1185340cdddeba6" "4.4.1": url: "https://github.com/harfbuzz/harfbuzz/releases/download/4.4.1/harfbuzz-4.4.1.tar.xz" sha256: "c5bc33ac099b2e52f01d27cde21cee4281b9d5bfec7684135e268512478bc9ee" "5.1.0": url: "https://github.com/harfbuzz/harfbuzz/releases/download/5.1.0/harfbuzz-5.1.0.tar.xz" sha256: "2edb95db668781aaa8d60959d21be2ff80085f31b12053cdd660d9a50ce84f05" + "5.2.0": + url: "https://github.com/harfbuzz/harfbuzz/releases/download/5.2.0/harfbuzz-5.2.0.tar.xz" + sha256: "735a94917b47936575acb4d4fa7e7986522f8a89527e4635721474dee2bc942c" + "5.3.0": + url: "https://github.com/harfbuzz/harfbuzz/archive/5.3.0.tar.gz" + sha256: "94712b8cdae68f0b585ec8e3cd8c5160fdc241218119572236497a62dae770de" + "5.3.1": + url: "https://github.com/harfbuzz/harfbuzz/archive/5.3.1.tar.gz" + sha256: "77c8c903f4539b050a6d3a5be79705c7ccf7b1cb66d68152a651486e261edbd2" + "6.0.0": + url: "https://github.com/harfbuzz/harfbuzz/archive/6.0.0.tar.gz" + sha256: "6d753948587db3c7c3ba8cc4f8e6bf83f5c448d2591a9f7ec306467f3a4fe4fa" patches: - "3.0.0": - - patch_file: "patches/icu-3.0.x.patch" - base_path: "source_subfolder" - "3.1.2": - - patch_file: "patches/icu-3.0.x.patch" - base_path: "source_subfolder" - "3.2.0": - - patch_file: "patches/icu-3.0.x.patch" - base_path: "source_subfolder" - "4.0.1": - - patch_file: "patches/icu-4.0.x.patch" - base_path: "source_subfolder" - "4.1.0": - - patch_file: "patches/icu-4.0.x.patch" - base_path: "source_subfolder" - "4.2.1": - - patch_file: "patches/icu-4.0.x.patch" - base_path: "source_subfolder" - "4.3.0": - - patch_file: "patches/icu-4.0.x.patch" - base_path: "source_subfolder" "4.4.1": - - patch_file: "patches/icu-4.0.x.patch" - base_path: "source_subfolder" + - patch_file: "patches/0000-fix-freetype-lookup-4.4.1.patch" + patch_type: "portability" + patch_description: "fix fretype and icu dependency lookup" + patch_source: "https://github.com/harfbuzz/harfbuzz/pull/3811" "5.1.0": - - patch_file: "patches/icu-5.1.x.patch" - base_path: "source_subfolder" + - patch_file: "patches/0000-fix-freetype-lookup-5.1.0.patch" + patch_type: "portability" + patch_description: "fix fretype and icu dependency lookup" + patch_source: "https://github.com/harfbuzz/harfbuzz/pull/3811" diff --git a/recipes/harfbuzz/all/conanfile.py b/recipes/harfbuzz/all/conanfile.py index 0e6a6219b8375..0a03318be73d3 100644 --- a/recipes/harfbuzz/all/conanfile.py +++ b/recipes/harfbuzz/all/conanfile.py @@ -1,12 +1,27 @@ from conan import ConanFile -from conan.tools import files, microsoft, scm -from conan .errors import ConanInvalidConfiguration -from conans import CMake, tools - -import functools +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +from conan.tools.build import can_run, stdcpp_library +from conan.tools.env import VirtualBuildEnv +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.files import ( + copy, + apply_conandata_patches, + export_conandata_patches, + get, + rename, + rm, + rmdir +) +from conan.tools.microsoft import is_msvc_static_runtime, is_msvc +from conan.tools.scm import Version + +import glob import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class HarfbuzzConan(ConanFile): @@ -16,7 +31,6 @@ class HarfbuzzConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "http://harfbuzz.org" license = "MIT" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -43,20 +57,8 @@ class HarfbuzzConan(ConanFile): short_paths = True - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -68,20 +70,20 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.shared and self.options.with_glib: self.options["glib"].shared = True def validate(self): - if self.options.shared and self.options.with_glib and not self.options["glib"].shared: + if self.info.options.shared and self.info.options.with_glib and not self.dependencies["glib"].options.shared: raise ConanInvalidConfiguration( "Linking a shared library against static glib can cause unexpected behaviour." ) - if scm.Version(self.version) >= "4.4.0": - if self.settings.compiler == "gcc" and scm.Version(self.settings.compiler.version) < "7": + if Version(self.version) >= "4.4.0": + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "7": raise ConanInvalidConfiguration("New versions of harfbuzz require at least gcc 7") - if self.options.with_glib and self.options["glib"].shared and microsoft.is_msvc_static_runtime(self): + if self.info.options.with_glib and self.dependencies["glib"].options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration( "Linking shared glib with the MSVC static runtime is not supported" ) @@ -90,53 +92,93 @@ def requirements(self): if self.options.with_freetype: self.requires("freetype/2.12.1") if self.options.with_icu: - self.requires("icu/71.1") + self.requires("icu/72.1") if self.options.with_glib: - self.requires("glib/2.73.1") + self.requires("glib/2.75.2") + + def layout(self): + basic_layout(self, src_folder="src") + + def generate(self): + def is_enabled(value): + return "enabled" if value else "disabled" + + def meson_backend_and_flags(): + def is_vs_2017(): + version = Version(self.settings.compiler.version) + return version == "15" or version == "191" + + if is_msvc(self) and is_vs_2017() and self.settings.build_type == "Debug": + # Mitigate https://learn.microsoft.com/en-us/cpp/build/reference/zf?view=msvc-170 + return "vs", ["/bigobj"] + return "ninja", [] + + PkgConfigDeps(self).generate() + + backend, cxxflags = meson_backend_and_flags() + tc = MesonToolchain(self, backend=backend) + tc.project_options.update({ + "glib": is_enabled(self.options.with_glib), + "icu": is_enabled(self.options.with_icu), + "freetype": is_enabled(self.options.with_freetype), + "gdi": is_enabled(self.options.get_safe("with_gdi")), + "directwrite": is_enabled(self.options.get_safe("with_directwrite")), + "gobject": is_enabled(can_run(self) and self.options.with_glib), + "introspection": is_enabled(False), + "tests": "disabled", + "docs": "disabled", + "benchmark": "disabled", + "icu_builtin": "false" + }) + tc.cpp_args += cxxflags + tc.generate() + + VirtualBuildEnv(self).generate() def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["HB_HAVE_FREETYPE"] = self.options.with_freetype - cmake.definitions["HB_HAVE_GRAPHITE2"] = False - cmake.definitions["HB_HAVE_GLIB"] = self.options.with_glib - cmake.definitions["HB_HAVE_ICU"] = self.options.with_icu - if tools.is_apple_os(self.settings.os): - cmake.definitions["HB_HAVE_CORETEXT"] = True - elif self.settings.os == "Windows": - cmake.definitions["HB_HAVE_GDI"] = self.options.with_gdi - cmake.definitions["HB_HAVE_UNISCRIBE"] = self.options.with_uniscribe - cmake.definitions["HB_HAVE_DIRECTWRITE"] = self.options.with_directwrite - cmake.definitions["HB_BUILD_UTILS"] = False - cmake.definitions["HB_BUILD_SUBSET"] = self.options.with_subset - cmake.definitions["HB_HAVE_GOBJECT"] = False - cmake.definitions["HB_HAVE_INTROSPECTION"] = False - # fix for MinGW debug build - if self.settings.compiler == "gcc" and self.settings.os == "Windows": - cmake.definitions["CMAKE_C_FLAGS"] = "-Wa,-mbig-obj" - cmake.definitions["CMAKE_CXX_FLAGS"] = "-Wa,-mbig-obj" - - cmake.configure(build_folder=self._build_subfolder) - return cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build_requirements(self): + self.tool_requires("meson/1.0.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + self.tool_requires("glib/2.75.2") def build(self): - files.apply_conandata_patches(self) - cmake = self._configure_cmake() - cmake.build() + apply_conandata_patches(self) + meson = Meson(self) + meson.configure() + meson.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() - cmake.install() - files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + def fix_msvc_libname(remove_lib_prefix=True): + """remove lib prefix & change extension to .lib""" + if not is_msvc(self): + return + libdirs = getattr(self.cpp.package, "libdirs") + for libdir in libdirs: + for ext in [".dll.a", ".dll.lib", ".a"]: + full_folder = os.path.join(self.package_folder, libdir) + for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")): + libname = os.path.basename(filepath)[0:-len(ext)] + if remove_lib_prefix and libname[0:3] == "lib": + libname = libname[3:] + rename(self, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib")) + + meson = Meson(self) + meson.install() + fix_msvc_libname() + fix_apple_shared_install_name(self) + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.names["cmake_find_package"] = "harfbuzz" self.cpp_info.names["cmake_find_package_multi"] = "harfbuzz" + self.cpp_info.set_property("pkg_config_name", "harfbuzz") if self.options.with_icu: self.cpp_info.libs.append("harfbuzz-icu") if self.options.with_subset: @@ -155,10 +197,10 @@ def package_info(self): self.cpp_info.system_libs.append("usp10") if self.options.with_directwrite: self.cpp_info.system_libs.append("dwrite") - if tools.is_apple_os(self.settings.os): - self.cpp_info.frameworks.extend(["CoreFoundation", "CoreGraphics", "CoreText"]) + if is_apple_os(self): + self.cpp_info.frameworks.extend(["CoreFoundation", "CoreGraphics", "CoreText", "ApplicationServices"]) if not self.options.shared: - libcxx = tools.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/harfbuzz/all/patches/0000-fix-freetype-lookup-4.4.1.patch b/recipes/harfbuzz/all/patches/0000-fix-freetype-lookup-4.4.1.patch new file mode 100644 index 0000000000000..708b5d9734b00 --- /dev/null +++ b/recipes/harfbuzz/all/patches/0000-fix-freetype-lookup-4.4.1.patch @@ -0,0 +1,99 @@ +diff --git a/meson.build b/meson.build +index 4a69d6d9e..a82ff598c 100644 +--- a/meson.build ++++ b/meson.build +@@ -21,7 +21,7 @@ pkgmod = import('pkgconfig') + cpp = meson.get_compiler('cpp') + null_dep = dependency('', required: false) + +-if cpp.get_id() == 'msvc' ++if cpp.get_argument_syntax() == 'msvc' + # Ignore several spurious warnings for things HarfBuzz does very commonly. + # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it + # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once +@@ -83,25 +83,39 @@ check_funcs = [ + + m_dep = cpp.find_library('m', required: false) + +-# https://github.com/harfbuzz/harfbuzz/pull/2498 +-freetype_dep = dependency(cpp.get_argument_syntax() == 'msvc' ? 'freetype' : 'freetype2', +- required: get_option('freetype'), +- default_options: ['harfbuzz=disabled']) ++ ++# Try pkgconfig name ++freetype_dep = dependency('freetype2', required: false) ++if not freetype_dep.found() ++ # Try cmake name ++ freetype_dep = dependency('freetype', required: false) ++endif ++if not freetype_dep.found() ++ # Subproject fallback, `allow_fallback: true` means the fallback will be ++ # tried even if the freetype option is set to `auto`. ++ freetype_dep = dependency('freetype2', ++ required: get_option('freetype'), ++ default_options: ['harfbuzz=disabled'], ++ allow_fallback: true) ++endif + + glib_dep = dependency('glib-2.0', required: get_option('glib')) + gobject_dep = dependency('gobject-2.0', required: get_option('gobject')) + graphite2_dep = dependency('graphite2', required: get_option('graphite2')) + graphite_dep = dependency('graphite2', required: get_option('graphite')) + +-if cpp.get_argument_syntax() == 'msvc' ++# Try pkgconfig name ++icu_dep = dependency('icu-uc', required: false) ++if not icu_dep.found() ++ # Try cmake name + icu_dep = dependency('ICU', +- required: get_option('icu'), ++ required: false, + components: 'uc', + method: 'cmake') +-else +- icu_dep = dependency('icu-uc', +- required: get_option('icu'), +- method: 'pkg-config') ++endif ++if not icu_dep.found() ++ # Subproject fallback if icu option is enabled ++ icu_dep = dependency('icu-uc', required: get_option('icu')) + endif + + if icu_dep.found() and icu_dep.type_name() == 'pkgconfig' +@@ -118,7 +132,7 @@ if not get_option('cairo').disabled() + cairo_ft_dep = dependency('cairo-ft', required: false) + + if (not cairo_dep.found() and +- cpp.get_id() == 'msvc' and ++ cpp.get_argument_syntax() == 'msvc' and + cpp.has_header('cairo.h')) + cairo_dep = cpp.find_library('cairo', required: false) + if cairo_dep.found() and cpp.has_function('cairo_ft_font_face_create_for_ft_face', +@@ -198,6 +212,7 @@ if freetype_dep.found() + ['FT_Get_Var_Blend_Coordinates', {'deps': freetype_dep}], + ['FT_Set_Var_Blend_Coordinates', {'deps': freetype_dep}], + ['FT_Done_MM_Var', {'deps': freetype_dep}], ++ ['FT_Get_Transform', {'deps': freetype_dep}], + ] + + if freetype_dep.type_name() == 'internal' +@@ -232,17 +247,12 @@ if host_machine.system() == 'windows' and not get_option('gdi').disabled() + endif + + # DirectWrite (Windows) +-directwrite_dep = null_dep + if host_machine.system() == 'windows' and not get_option('directwrite').disabled() + if get_option('directwrite').enabled() and not cpp.has_header('dwrite_1.h') + error('DirectWrite was enabled explicitly, but required header is missing.') + endif + +- directwrite_dep = cpp.find_library('dwrite', required: get_option('directwrite')) +- +- if directwrite_dep.found() +- conf.set('HAVE_DIRECTWRITE', 1) +- endif ++ conf.set('HAVE_DIRECTWRITE', 1) + endif + + # CoreText (macOS) diff --git a/recipes/harfbuzz/all/patches/0000-fix-freetype-lookup-5.1.0.patch b/recipes/harfbuzz/all/patches/0000-fix-freetype-lookup-5.1.0.patch new file mode 100644 index 0000000000000..f3992bf9530f0 --- /dev/null +++ b/recipes/harfbuzz/all/patches/0000-fix-freetype-lookup-5.1.0.patch @@ -0,0 +1,72 @@ +diff --git a/meson.build b/meson.build +index df4443fb2..b8b143948 100644 +--- a/meson.build ++++ b/meson.build +@@ -21,7 +21,7 @@ pkgmod = import('pkgconfig') + cpp = meson.get_compiler('cpp') + null_dep = dependency('', required: false) + +-if cpp.get_id() == 'msvc' ++if cpp.get_argument_syntax() == 'msvc' + # Ignore several spurious warnings for things HarfBuzz does very commonly. + # If a warning is completely useless and spammy, use '/wdXXXX' to suppress it + # If a warning is harmless but hard to fix, use '/woXXXX' so it's shown once +@@ -83,25 +83,39 @@ check_funcs = [ + + m_dep = cpp.find_library('m', required: false) + +-# https://github.com/harfbuzz/harfbuzz/pull/2498 +-freetype_dep = dependency(cpp.get_argument_syntax() == 'msvc' ? 'freetype' : 'freetype2', +- required: get_option('freetype'), +- default_options: ['harfbuzz=disabled']) ++ ++# Try pkgconfig name ++freetype_dep = dependency('freetype2', required: false) ++if not freetype_dep.found() ++ # Try cmake name ++ freetype_dep = dependency('freetype', required: false) ++endif ++if not freetype_dep.found() ++ # Subproject fallback, `allow_fallback: true` means the fallback will be ++ # tried even if the freetype option is set to `auto`. ++ freetype_dep = dependency('freetype2', ++ required: get_option('freetype'), ++ default_options: ['harfbuzz=disabled'], ++ allow_fallback: true) ++endif + + glib_dep = dependency('glib-2.0', required: get_option('glib')) + gobject_dep = dependency('gobject-2.0', required: get_option('gobject')) + graphite2_dep = dependency('graphite2', required: get_option('graphite2')) + graphite_dep = dependency('graphite2', required: get_option('graphite')) + +-if cpp.get_argument_syntax() == 'msvc' ++# Try pkgconfig name ++icu_dep = dependency('icu-uc', required: false) ++if not icu_dep.found() ++ # Try cmake name + icu_dep = dependency('ICU', +- required: get_option('icu'), ++ required: false, + components: 'uc', + method: 'cmake') +-else +- icu_dep = dependency('icu-uc', +- required: get_option('icu'), +- method: 'pkg-config') ++endif ++if not icu_dep.found() ++ # Subproject fallback if icu option is enabled ++ icu_dep = dependency('icu-uc', required: get_option('icu')) + endif + + if icu_dep.found() and icu_dep.type_name() == 'pkgconfig' +@@ -118,7 +132,7 @@ if not get_option('cairo').disabled() + cairo_ft_dep = dependency('cairo-ft', required: false) + + if (not cairo_dep.found() and +- cpp.get_id() == 'msvc' and ++ cpp.get_argument_syntax() == 'msvc' and + cpp.has_header('cairo.h')) + cairo_dep = cpp.find_library('cairo', required: false) + if cairo_dep.found() and cpp.has_function('cairo_ft_font_face_create_for_ft_face', diff --git a/recipes/harfbuzz/all/patches/icu-3.0.x.patch b/recipes/harfbuzz/all/patches/icu-3.0.x.patch deleted file mode 100644 index 5057e459d5ae6..0000000000000 --- a/recipes/harfbuzz/all/patches/icu-3.0.x.patch +++ /dev/null @@ -1,26 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -245,16 +245,16 @@ if (HB_HAVE_ICU) -- find_package(PkgConfig) -- pkg_check_modules(PC_ICU QUIET icu-uc) -+ # find_package(PkgConfig) -+ # pkg_check_modules(PC_ICU QUIET icu-uc) - -- find_path(ICU_INCLUDE_DIR NAMES unicode/utypes.h HINTS ${PC_ICU_INCLUDE_DIRS} ${PC_ICU_INCLUDEDIR}) -- find_library(ICU_LIBRARY NAMES libicuuc cygicuuc cygicuuc32 icuuc HINTS ${PC_ICU_LIBRARY_DIRS} ${PC_ICU_LIBDIR}) -+ # find_path(ICU_INCLUDE_DIR NAMES unicode/utypes.h HINTS ${PC_ICU_INCLUDE_DIRS} ${PC_ICU_INCLUDEDIR}) -+ # find_library(ICU_LIBRARY NAMES libicuuc cygicuuc cygicuuc32 icuuc HINTS ${PC_ICU_LIBRARY_DIRS} ${PC_ICU_LIBDIR}) - -- include_directories(${ICU_INCLUDE_DIR}) -+ # include_directories(${ICU_INCLUDE_DIR}) - - list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-icu.h) - -- list(APPEND THIRD_PARTY_LIBS ${ICU_LIBRARY}) -+ # list(APPEND THIRD_PARTY_LIBS ${ICU_LIBRARY}) - -- mark_as_advanced(ICU_INCLUDE_DIR ICU_LIBRARY) -+ # mark_as_advanced(ICU_INCLUDE_DIR ICU_LIBRARY) - endif () - - if (APPLE AND HB_HAVE_CORETEXT) diff --git a/recipes/harfbuzz/all/patches/icu-4.0.x.patch b/recipes/harfbuzz/all/patches/icu-4.0.x.patch deleted file mode 100644 index b8e6c1e7b1cf2..0000000000000 --- a/recipes/harfbuzz/all/patches/icu-4.0.x.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt -index 3259ca9..8168bb4 100644 ---- a/a/CMakeLists.txt -+++ b/b/CMakeLists.txt -@@ -246,19 +246,19 @@ if (HB_HAVE_ICU) - add_definitions(-DHAVE_ICU) - - # https://github.com/WebKit/webkit/blob/fdd7733f2f30eab7fe096a9791f98c60f62f49c0/Source/cmake/FindICU.cmake -- find_package(PkgConfig) -- pkg_check_modules(PC_ICU QUIET icu-uc) -+ # find_package(PkgConfig) -+ # pkg_check_modules(PC_ICU QUIET icu-uc) - -- find_path(ICU_INCLUDE_DIR NAMES unicode/utypes.h HINTS ${PC_ICU_INCLUDE_DIRS} ${PC_ICU_INCLUDEDIR}) -- find_library(ICU_LIBRARY NAMES libicuuc cygicuuc cygicuuc32 icuuc HINTS ${PC_ICU_LIBRARY_DIRS} ${PC_ICU_LIBDIR}) -+ # find_path(ICU_INCLUDE_DIR NAMES unicode/utypes.h HINTS ${PC_ICU_INCLUDE_DIRS} ${PC_ICU_INCLUDEDIR}) -+ # find_library(ICU_LIBRARY NAMES libicuuc cygicuuc cygicuuc32 icuuc HINTS ${PC_ICU_LIBRARY_DIRS} ${PC_ICU_LIBDIR}) - -- include_directories(${ICU_INCLUDE_DIR}) -+ # include_directories(${ICU_INCLUDE_DIR}) - - list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-icu.h) - -- list(APPEND THIRD_PARTY_LIBS ${ICU_LIBRARY}) -+ # list(APPEND THIRD_PARTY_LIBS ${ICU_LIBRARY}) - -- mark_as_advanced(ICU_INCLUDE_DIR ICU_LIBRARY) -+ # mark_as_advanced(ICU_INCLUDE_DIR ICU_LIBRARY) - endif () - - if (APPLE AND HB_HAVE_CORETEXT) diff --git a/recipes/harfbuzz/all/patches/icu-5.1.x.patch b/recipes/harfbuzz/all/patches/icu-5.1.x.patch deleted file mode 100644 index 7aa65e28ea032..0000000000000 --- a/recipes/harfbuzz/all/patches/icu-5.1.x.patch +++ /dev/null @@ -1,31 +0,0 @@ -diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt -index 3259ca9..8168bb4 100644 ---- a/a/CMakeLists.txt -+++ b/b/CMakeLists.txt -@@ -247,19 +247,19 @@ if (HB_HAVE_ICU) - add_definitions(-DHAVE_ICU) - - # https://github.com/WebKit/webkit/blob/fdd7733f2f30eab7fe096a9791f98c60f62f49c0/Source/cmake/FindICU.cmake -- find_package(PkgConfig) -- pkg_check_modules(PC_ICU QUIET icu-uc) -+ # find_package(PkgConfig) -+ # pkg_check_modules(PC_ICU QUIET icu-uc) - -- find_path(ICU_INCLUDE_DIR NAMES unicode/utypes.h HINTS ${PC_ICU_INCLUDE_DIRS} ${PC_ICU_INCLUDEDIR}) -- find_library(ICU_LIBRARY NAMES libicuuc cygicuuc cygicuuc32 icuuc HINTS ${PC_ICU_LIBRARY_DIRS} ${PC_ICU_LIBDIR}) -+ # find_path(ICU_INCLUDE_DIR NAMES unicode/utypes.h HINTS ${PC_ICU_INCLUDE_DIRS} ${PC_ICU_INCLUDEDIR}) -+ # find_library(ICU_LIBRARY NAMES libicuuc cygicuuc cygicuuc32 icuuc HINTS ${PC_ICU_LIBRARY_DIRS} ${PC_ICU_LIBDIR}) - -- include_directories(${ICU_INCLUDE_DIR}) -+ # include_directories(${ICU_INCLUDE_DIR}) - - list(APPEND project_headers ${PROJECT_SOURCE_DIR}/src/hb-icu.h) - -- list(APPEND THIRD_PARTY_LIBS ${ICU_LIBRARY}) -+ # list(APPEND THIRD_PARTY_LIBS ${ICU_LIBRARY}) - -- mark_as_advanced(ICU_INCLUDE_DIR ICU_LIBRARY) -+ # mark_as_advanced(ICU_INCLUDE_DIR ICU_LIBRARY) - endif () - - if (APPLE AND HB_HAVE_CORETEXT) diff --git a/recipes/harfbuzz/all/test_package/CMakeLists.txt b/recipes/harfbuzz/all/test_package/CMakeLists.txt index e521ceb1f2ecf..80c151599daee 100644 --- a/recipes/harfbuzz/all/test_package/CMakeLists.txt +++ b/recipes/harfbuzz/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(harfbuzz REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} harfbuzz::harfbuzz) +target_link_libraries(${PROJECT_NAME} PRIVATE harfbuzz::harfbuzz) set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) diff --git a/recipes/harfbuzz/all/test_package/conanfile.py b/recipes/harfbuzz/all/test_package/conanfile.py index 8b8e0e859ad71..e9a060aba448d 100644 --- a/recipes/harfbuzz/all/test_package/conanfile.py +++ b/recipes/harfbuzz/all/test_package/conanfile.py @@ -1,10 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + test_type = "explicit" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,8 +22,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): font = os.path.join(self.source_folder, "example.ttf") - bin_path = os.path.join("bin", "test_package") - self.run("{} {}".format(bin_path, font), run_environment=True) - + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(f"{bin_path} {font}", env="conanrun") diff --git a/recipes/harfbuzz/all/test_v1_package/CMakeLists.txt b/recipes/harfbuzz/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2f6b1a2f7ec79 --- /dev/null +++ b/recipes/harfbuzz/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/harfbuzz/all/test_v1_package/conanfile.py b/recipes/harfbuzz/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a4aa2f28304a1 --- /dev/null +++ b/recipes/harfbuzz/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + font = os.path.join(self.source_folder, "..", "test_package", "example.ttf") + bin_path = os.path.join("bin", "test_package") + self.run(f"{bin_path} {font}", run_environment=True) + diff --git a/recipes/harfbuzz/config.yml b/recipes/harfbuzz/config.yml index 7fd2cded2af9b..3dd17ac25646c 100644 --- a/recipes/harfbuzz/config.yml +++ b/recipes/harfbuzz/config.yml @@ -1,19 +1,15 @@ versions: - "3.0.0": - folder: all - "3.1.2": - folder: all "3.2.0": folder: all - "4.0.1": + "4.4.1": folder: all - "4.1.0": + "5.1.0": folder: all - "4.2.1": + "5.2.0": folder: all - "4.3.0": + "5.3.0": folder: all - "4.4.1": + "5.3.1": folder: all - "5.1.0": + "6.0.0": folder: all diff --git a/recipes/hash-library/all/CMakeLists.txt b/recipes/hash-library/all/CMakeLists.txt index fcb1139946f46..14405c91fb240 100644 --- a/recipes/hash-library/all/CMakeLists.txt +++ b/recipes/hash-library/all/CMakeLists.txt @@ -1,38 +1,37 @@ cmake_minimum_required(VERSION 3.4) -project(hash-library CXX) +project(hash-library LANGUAGES CXX) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_library(${CMAKE_PROJECT_NAME} - source_subfolder/crc32.cpp - source_subfolder/keccak.cpp - source_subfolder/md5.cpp - source_subfolder/sha1.cpp - source_subfolder/sha256.cpp - source_subfolder/sha3.cpp +add_library(hash-library + ${HASH_LIBRARY_SRC_DIR}/crc32.cpp + ${HASH_LIBRARY_SRC_DIR}/keccak.cpp + ${HASH_LIBRARY_SRC_DIR}/md5.cpp + ${HASH_LIBRARY_SRC_DIR}/sha1.cpp + ${HASH_LIBRARY_SRC_DIR}/sha256.cpp + ${HASH_LIBRARY_SRC_DIR}/sha3.cpp ) -target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE source_subfolder) +target_include_directories(hash-library PUBLIC ${HASH_LIBRARY_SRC_DIR}) set(HEADERS - source_subfolder/crc32.h - source_subfolder/hash.h - source_subfolder/hmac.h - source_subfolder/keccak.h - source_subfolder/md5.h - source_subfolder/sha1.h - source_subfolder/sha256.h - source_subfolder/sha3.h + ${HASH_LIBRARY_SRC_DIR}/crc32.h + ${HASH_LIBRARY_SRC_DIR}/hash.h + ${HASH_LIBRARY_SRC_DIR}/hmac.h + ${HASH_LIBRARY_SRC_DIR}/keccak.h + ${HASH_LIBRARY_SRC_DIR}/md5.h + ${HASH_LIBRARY_SRC_DIR}/sha1.h + ${HASH_LIBRARY_SRC_DIR}/sha256.h + ${HASH_LIBRARY_SRC_DIR}/sha3.h ) -set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES +set_target_properties(hash-library PROPERTIES PUBLIC_HEADER "${HEADERS}" + WINDOWS_EXPORT_ALL_SYMBOLS TRUE ) -install(TARGETS ${CMAKE_PROJECT_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib - PUBLIC_HEADER DESTINATION include +include(GNUInstallDirs) +install(TARGETS hash-library + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) diff --git a/recipes/hash-library/all/conandata.yml b/recipes/hash-library/all/conandata.yml index 6c425875fea76..e3155c060c064 100644 --- a/recipes/hash-library/all/conandata.yml +++ b/recipes/hash-library/all/conandata.yml @@ -1,8 +1,7 @@ sources: "8.0": - url: https://github.com/stbrumme/hash-library/archive/hash_library_v8.tar.gz + url: "https://github.com/stbrumme/hash-library/archive/hash_library_v8.tar.gz" sha256: "ddf9d398166e08482af1225aed968ac4c370f99648b5359b0a20c9ed56f7b1c7" patches: "8.0": - patch_file: "patches/001-fix-macos.patch" - base_path: "source_subfolder" diff --git a/recipes/hash-library/all/conanfile.py b/recipes/hash-library/all/conanfile.py index ec0cfab1d3887..83c2d2fdd2b74 100644 --- a/recipes/hash-library/all/conanfile.py +++ b/recipes/hash-library/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class HashLibraryConan(ConanFile): @@ -11,27 +13,20 @@ class HashLibraryConan(ConanFile): topics = ("hash", "digest", "hmac", "checksum", "crc32", "md5", "sha1", "sha2", "sha256", "sha3", "keccak") license = "Zlib" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" + + settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], - "fPIC": [True, False] + "shared": [True, False], + "fPIC": [True, False], } default_options = { - "shared": False, - "fPIC": True + "shared": False, + "fPIC": True, } - generators = "cmake" - exports_sources = ["CMakeLists.txt", "patches/*"] - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,32 +34,30 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["HASH_LIBRARY_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["hash-library"] - - def validate(self): - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("hash-library does not support shared builds on Windows.") diff --git a/recipes/hash-library/all/test_package/CMakeLists.txt b/recipes/hash-library/all/test_package/CMakeLists.txt index 0680bf45d87e9..d020276409c2e 100644 --- a/recipes/hash-library/all/test_package/CMakeLists.txt +++ b/recipes/hash-library/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(hash-library CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} hash-library::hash-library) +target_link_libraries(${PROJECT_NAME} PRIVATE hash-library::hash-library) diff --git a/recipes/hash-library/all/test_package/conanfile.py b/recipes/hash-library/all/test_package/conanfile.py index 1d5e456107c57..6dbd1de388288 100644 --- a/recipes/hash-library/all/test_package/conanfile.py +++ b/recipes/hash-library/all/test_package/conanfile.py @@ -1,11 +1,20 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout class HashLibraryTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/hash-library/all/test_v1_package/CMakeLists.txt b/recipes/hash-library/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/hash-library/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/hash-library/all/test_v1_package/conanfile.py b/recipes/hash-library/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4265550ef4aee --- /dev/null +++ b/recipes/hash-library/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +import os +from conans import ConanFile, tools, CMake + + +class HashLibraryTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/hazelcast-cpp-client/all/CMakeLists.txt b/recipes/hazelcast-cpp-client/all/CMakeLists.txt deleted file mode 100644 index bd4164cb5c1c7..0000000000000 --- a/recipes/hazelcast-cpp-client/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/hazelcast-cpp-client/all/conandata.yml b/recipes/hazelcast-cpp-client/all/conandata.yml index 79239f547f5e4..ef6a536c1dc63 100644 --- a/recipes/hazelcast-cpp-client/all/conandata.yml +++ b/recipes/hazelcast-cpp-client/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.1.0": + url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v5.1.0.tar.gz" + sha256: "de22ddf2c99079ed2385baa554a997b15ae17b039d6d108f68e25e1b3bbf76b6" "5.0.0": url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v5.0.0.tar.gz" sha256: "0df7948bc6f4d219c60f51179355599938cab5b713335c2ea48d1d38be1b69dc" @@ -14,13 +17,12 @@ sources: "4.0.1": url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v4.0.1.zip" sha256: "4b3c6a876ebca2a4dcf23a556d3c3d4da2284e4ce1d2bbdf335df7f86b03fd28" - "4.0.0": - url: "https://github.com/hazelcast/hazelcast-cpp-client/archive/v4.0.0.zip" - sha256: "1bba72aec47951cefb367a99c196fd8989a2d621e527310fee9483313d347d1b" patches: + "5.1.0": + - patch_file: "patches/gcc_11_1_0.patch" + patch_description: "Fix for GCC-111" + patch_type: "portability" "4.1.0": - patch_file: "patches/gcc_4.9_5_fix.patch" - base_path: "source_subfolder" - "4.0.0": - - patch_file: "patches/cmake_install.patch" - base_path: "source_subfolder" + patch_description: "Fix for GCC-495" + patch_type: "portability" diff --git a/recipes/hazelcast-cpp-client/all/conanfile.py b/recipes/hazelcast-cpp-client/all/conanfile.py index af35073b34822..6f3062922937b 100644 --- a/recipes/hazelcast-cpp-client/all/conanfile.py +++ b/recipes/hazelcast-cpp-client/all/conanfile.py @@ -1,16 +1,20 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout +from conan.tools.scm import Version +from conan.tools import files +from conan.tools.build import check_min_cppstd + import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.50.0" class HazelcastCppClient(ConanFile): name = "hazelcast-cpp-client" description = "C++ client library for Hazelcast in-memory database." license = "Apache-2.0" - topics = ("conan", "hazelcast", "client", "database", "cache", "in-memory", "distributed", "computing", "ssl") - homepage = "https://github.com/hazelcast/hazelcast-cpp-client" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake", "cmake_find_package" + homepage = "https://github.com/hazelcast/hazelcast-cpp-client" + topics = ("hazelcast", "client", "database", "cache", "in-memory", "distributed", "computing", "ssl") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,15 +27,9 @@ class HazelcastCppClient(ConanFile): "with_openssl": False } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _cmake_name(self): - return "hazelcastcxx" if tools.Version(self.version) <= "4.0.0" else "hazelcast-cpp-client" + def export_sources(self): + for p in self.conan_data.get("patches", {}).get(self.version, []): + files.copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -40,50 +38,56 @@ def config_options(self): def configure(self): if self.options.shared: del self.options.fPIC - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + + def layout(self): + cmake_layout(self) def requirements(self): - self.requires("boost/1.76.0") + self.requires("boost/1.79.0") if self.options.with_openssl: - self.requires("openssl/1.1.1k") + self.requires("openssl/1.1.1q") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename(self.name + "-" + self.version, self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["WITH_OPENSSL"] = self.options.with_openssl - if tools.Version(self.version) <= "4.0.0": - self._cmake.definitions["BUILD_STATIC_LIB"] = not self.options.shared - self._cmake.definitions["BUILD_SHARED_LIB"] = self.options.shared + files.get(self, + **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + toolchain = CMakeToolchain(self) + toolchain.variables["WITH_OPENSSL"] = self.options.with_openssl + if Version(self.version) <= "4.0.0": + toolchain.variables["BUILD_STATIC_LIB"] = not self.options.shared + toolchain.variables["BUILD_SHARED_LIB"] = self.options.shared else: - self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared - self._cmake.configure() - return self._cmake + toolchain.variables["BUILD_SHARED_LIBS"] = self.options.shared + toolchain.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + files.apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + self.copy("LICENSE", dst="licenses", src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = self._cmake_name - self.cpp_info.filenames["cmake_find_package_multi"] = self._cmake_name - self.cpp_info.names["cmake_find_package"] = self._cmake_name - self.cpp_info.names["cmake_find_package_multi"] = self._cmake_name + self.cpp_info.set_property("cmake_file_name", "hazelcast-cpp-client") + self.cpp_info.set_property("cmake_target_name", "hazelcast-cpp-client::hazelcast-cpp-client") - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["hazelcast-cpp-client"] self.cpp_info.defines = ["BOOST_THREAD_VERSION=5"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/hazelcast-cpp-client/all/patches/gcc_11_1_0.patch b/recipes/hazelcast-cpp-client/all/patches/gcc_11_1_0.patch new file mode 100644 index 0000000000000..c286f1883f21f --- /dev/null +++ b/recipes/hazelcast-cpp-client/all/patches/gcc_11_1_0.patch @@ -0,0 +1,40 @@ +diff --git a/hazelcast/include/hazelcast/client/protocol/ClientMessage.h b/hazelcast/include/hazelcast/client/protocol/ClientMessage.h +index 462ea85b0..f2686506a 100644 +--- a/hazelcast/include/hazelcast/client/protocol/ClientMessage.h ++++ b/hazelcast/include/hazelcast/client/protocol/ClientMessage.h +@@ -190,6 +190,9 @@ struct HAZELCAST_API is_trivial_entry_vector< + */ + class HAZELCAST_API ClientMessage + { ++ template ++ struct default_nullable_decoder; ++ + public: + static constexpr size_t EXPECTED_DATA_BLOCK_SIZE = 1024; + +@@ -974,10 +977,8 @@ public: + } + + template +- boost::optional get_nullable(std::function decoder = +- [](ClientMessage& msg) { +- return msg.get(); +- }) ++ boost::optional get_nullable( ++ std::function decoder = default_nullable_decoder{}) + { + if (next_frame_is_null_frame()) { + // skip next frame with null flag +@@ -1357,6 +1358,12 @@ private: + static const frame_header_type BEGIN_FRAME; + static const frame_header_type END_FRAME; + ++ template ++ struct default_nullable_decoder ++ { ++ T operator()(ClientMessage& msg) const { return msg.get(); } ++ }; ++ + template + void set_primitive_vector(const std::vector& values, + bool is_final = false) diff --git a/recipes/hazelcast-cpp-client/all/test_package/CMakeLists.txt b/recipes/hazelcast-cpp-client/all/test_package/CMakeLists.txt index 22c6e17ef0142..47708a63a3ae9 100644 --- a/recipes/hazelcast-cpp-client/all/test_package/CMakeLists.txt +++ b/recipes/hazelcast-cpp-client/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.10) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(hazelcast-cpp-client REQUIRED CONFIG) -add_executable(test_package test_package.cpp) -target_link_libraries(test_package PUBLIC ${CONAN_LIBS}) -set_property(TARGET test_package PROPERTY CXX_STANDARD 11) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE hazelcast-cpp-client::hazelcast-cpp-client) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/hazelcast-cpp-client/all/test_package/conanfile.py b/recipes/hazelcast-cpp-client/all/test_package/conanfile.py index a91fd0cd063d1..f70d40a28931b 100644 --- a/recipes/hazelcast-cpp-client/all/test_package/conanfile.py +++ b/recipes/hazelcast-cpp-client/all/test_package/conanfile.py @@ -1,10 +1,18 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - class TestPackageHazelcastCppClient(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,5 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/hazelcast-cpp-client/all/test_v1_package/CMakeLists.txt b/recipes/hazelcast-cpp-client/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..87fd6b32ee2e1 --- /dev/null +++ b/recipes/hazelcast-cpp-client/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(hazelcast-cpp-client REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE hazelcast-cpp-client::hazelcast-cpp-client) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/hazelcast-cpp-client/all/test_v1_package/conanfile.py b/recipes/hazelcast-cpp-client/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/hazelcast-cpp-client/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/hazelcast-cpp-client/config.yml b/recipes/hazelcast-cpp-client/config.yml index 6714503007139..6c55bb901999c 100644 --- a/recipes/hazelcast-cpp-client/config.yml +++ b/recipes/hazelcast-cpp-client/config.yml @@ -1,4 +1,6 @@ versions: + "5.1.0": + folder: all "5.0.0": folder: all "4.2.0": @@ -9,5 +11,3 @@ versions: folder: all "4.0.1": folder: all - "4.0.0": - folder: all diff --git a/recipes/hdf5/all/CMakeLists.txt b/recipes/hdf5/all/CMakeLists.txt deleted file mode 100644 index 7bd2be5d08aa8..0000000000000 --- a/recipes/hdf5/all/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.13) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -if (MSVC) - add_compile_options("$<$:/Z7>") - add_link_options("$<$:/DEBUG:NONE>") -endif () - -add_subdirectory("source_subfolder") diff --git a/recipes/hdf5/all/conandata.yml b/recipes/hdf5/all/conandata.yml index d39b52a21d740..dc660f8ec159b 100644 --- a/recipes/hdf5/all/conandata.yml +++ b/recipes/hdf5/all/conandata.yml @@ -1,14 +1,15 @@ sources: + "1.14.0": + url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_14_0.tar.gz" + sha256: "0f2ec13c1bf6e9f506fd03681c83a476d722e7479cad9ce6f8585a26c317d0ad" "1.13.1": url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_13_1.tar.gz" sha256: "92552458f35c7e58128ce1bfc2831abf901cc142ea0fdd2b056311e4452db7bf" "1.12.2": url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_12_2.tar.gz" sha256: "1ca14cadff7bc4b61826eee591da1a330f44c107db66c9510ee95df3b2bc5f78" - "1.12.1": - url: "https://support.hdfgroup.org/ftp/HDF5/releases/hdf5-1.12/hdf5-1.12.1/src/hdf5-1.12.1.tar.gz" - sha256: "79c66ff67e666665369396e9c90b32e238e501f345afd2234186bfb8331081ca" "1.12.0": + # Need 1.12.0 for NetCDF 4.7.4 with byteranges=True url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_12_0.tar.gz" sha256: "c64ffec2539ae6b6041f97952a40b0893c3c0df4d5b1c0177fb8aba567808158" "1.10.6": @@ -21,44 +22,55 @@ sources: url: "https://github.com/HDFGroup/hdf5/archive/hdf5-1_8_21.tar.gz" sha256: "753520e34a576a64809b8e02d9c015d6126f7974f678c7417a60492d835a88f4" patches: + "1.14.0": + - patch_file: "patches/conanize-link-szip-1.14.0+.patch" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" "1.13.1": - patch_file: "patches/conanize-link-szip-1.12.2+.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" "1.12.2": - patch_file: "patches/conanize-link-szip-1.12.2+.patch" - base_path: "source_subfolder" - "1.12.1": - - patch_file: "patches/conanize-link-szip-1.12.1+.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" "1.12.0": - patch_file: "patches/conanize-link-szip-1.10.5+.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" "1.10.6": - patch_file: "patches/fix-missing-function-prototypes-1.10.5+.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fix missing function prototypes" - patch_file: "patches/fix-missing-function-prototypes-1.10.6.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fix missing function prototypes" - patch_file: "patches/conanize-link-szip-1.10.5+.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" "1.10.5": - patch_file: "patches/fix-missing-function-prototypes-1.10.5+.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fix missing function prototypes" - patch_file: "patches/conanize-link-szip-1.10.5+.patch" - base_path: "source_subfolder" - - patch_file: "patches/build-either-static-or-shared-1.10.5.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" - patch_file: "patches/mingw-cmake-size-type-checks-1.10.5.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw cmake size type checks" - patch_file: "patches/mingw-fix-prefix-lib.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw fix prefix lib" - patch_file: "patches/mingw-unused-ellipses.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw unused ellipses" "1.8.21": - patch_file: "patches/conanize-link-szip-1.8.21.patch" - base_path: "source_subfolder" - - patch_file: "patches/build-either-static-or-shared-1.8.21.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fixup target_link_libraries() targets for szip and zlib" - patch_file: "patches/mingw-cmake-size-type-checks-1.8.21.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw cmake size type checks" - patch_file: "patches/mingw-fix-prefix-lib.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw fix prefix lib" diff --git a/recipes/hdf5/all/conanfile.py b/recipes/hdf5/all/conanfile.py index f714094506500..9a0a07fa749fe 100644 --- a/recipes/hdf5/all/conanfile.py +++ b/recipes/hdf5/all/conanfile.py @@ -1,17 +1,21 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools import os import textwrap -required_conan_version = ">=1.43.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import can_run, check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir, save +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class Hdf5Conan(ConanFile): name = "hdf5" description = "HDF5 is a data model, library, and file format for storing and managing data." license = "BSD-3-Clause" - topics = ("hdf5", "hdf", "data") + topics = "hdf", "data" homepage = "https://portal.hdfgroup.org/display/HDF5/HDF5" url = "https://github.com/conan-io/conan-center-index" @@ -38,40 +42,52 @@ class Hdf5Conan(ConanFile): "szip_encoding": False, "parallel": False, } - - generators = "cmake" - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cpp_standard(self): + if Version(self.version) < "1.14.0": + return 98 + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def validate(self): + if not can_run(self): + # While building it runs some executables like H5detect + raise ConanInvalidConfiguration("Current recipe doesn't support cross-building (yet)") + if self.info.options.parallel: + if self.info.options.enable_cxx: + raise ConanInvalidConfiguration("Parallel and C++ options are mutually exclusive") + if self.info.options.get_safe("threadsafe"): # FIXME why can't I define the default valid as False? + raise ConanInvalidConfiguration("Parallel and Threadsafe options are mutually exclusive") + if self.info.options.szip_support == "with_szip" and \ + self.info.options.szip_encoding and \ + not self.dependencies["szip"].options.enable_encoding: + raise ConanInvalidConfiguration("encoding must be enabled in szip dependency (szip:enable_encoding=True)") + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cpp_standard) + def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.enable_cxx: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if self.options.enable_cxx or self.options.hl or (self.settings.os == "Windows" and not self.options.shared): del self.options.threadsafe if not bool(self.options.szip_support): del self.options.szip_encoding + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.szip_support == "with_libaec": self.requires("libaec/1.0.6") elif self.options.szip_support == "with_szip": @@ -79,83 +95,95 @@ def requirements(self): if self.options.parallel: self.requires("openmpi/4.1.0") - def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self, skip_x64_x86=True): - # While building it runs some executables like H5detect - raise ConanInvalidConfiguration("Current recipe doesn't support cross-building (yet)") - if self.options.parallel: - if self.options.enable_cxx: - raise ConanInvalidConfiguration("Parallel and C++ options are mutually exclusive") - if self.options.get_safe("threadsafe", False): - raise ConanInvalidConfiguration("Parallel and Threadsafe options are mutually exclusive") - if self.options.szip_support == "with_szip" and self.options.szip_encoding and \ - not self.options["szip"].enable_encoding: - raise ConanInvalidConfiguration("encoding must be enabled in szip dependency (szip:enable_encoding=True)") + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output) + m = re.search(r"cmake version (\d+\.\d+\.\d+)", output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def _inject_stdlib_flag(self, tc): + if self.settings.os == "Linux" and self.settings.compiler == "clang": + cpp_stdlib = f" -stdlib={self.settings.compiler.libcxx}".rstrip("1") # strip 11 from stdlibc++11 + tc.variables["CMAKE_CXX_FLAGS"] = tc.variables.get("CMAKE_CXX_FLAGS", "") + cpp_stdlib + + return tc + + + def build_requirements(self): + if Version(self.version) >= "1.14.0" and not self._cmake_new_enough("3.18"): + self.tool_requires("cmake/3.25.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def build(self): - self._patch_sources() - cmake = self._configure_cmake() - cmake.build() + def generate(self): + cmakedeps = CMakeDeps(self) + cmakedeps.generate() - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # Do not force PIC - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") + tc = CMakeToolchain(self) + if self.settings.get_safe("compiler.cppstd"): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cpp_standard + if self.settings.get_safe("compiler.libcxx"): + tc = self._inject_stdlib_flag(tc) + if self.options.szip_support == "with_libaec": + tc.variables["USE_LIBAEC"] = True + tc.variables["HDF5_EXTERNALLY_CONFIGURED"] = True + tc.variables["HDF5_EXTERNAL_LIB_PREFIX"] = "" + tc.variables["HDF5_USE_FOLDERS"] = False + tc.variables["HDF5_NO_PACKAGES"] = True + tc.variables["ALLOW_UNSUPPORTED"] = False + if Version(self.version) >= "1.10.6": + tc.variables["ONLY_SHARED_LIBS"] = self.options.shared + tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared + tc.variables["BUILD_STATIC_EXECS"] = False + tc.variables["HDF5_ENABLE_COVERAGE"] = False + tc.variables["HDF5_ENABLE_USING_MEMCHECKER"] = False + if Version(self.version) >= "1.10.0": + tc.variables["HDF5_MEMORY_ALLOC_SANITY_CHECK"] = False + if Version(self.version) >= "1.10.5": + tc.variables["HDF5_ENABLE_PREADWRITE"] = True + tc.variables["HDF5_ENABLE_DEPRECATED_SYMBOLS"] = True + tc.variables["HDF5_BUILD_GENERATORS"] = False + tc.variables["HDF5_ENABLE_TRACE"] = False + if self.settings.build_type == "Debug": + tc.variables["HDF5_ENABLE_INSTRUMENT"] = False # Option? + tc.variables["HDF5_ENABLE_PARALLEL"] = self.options.parallel + tc.variables["HDF5_ENABLE_Z_LIB_SUPPORT"] = self.options.with_zlib + tc.variables["HDF5_ENABLE_SZIP_SUPPORT"] = bool(self.options.szip_support) + tc.variables["HDF5_ENABLE_SZIP_ENCODING"] = self.options.get_safe("szip_encoding", False) + tc.variables["HDF5_PACKAGE_EXTLIBS"] = False + tc.variables["HDF5_ENABLE_THREADSAFE"] = self.options.get_safe("threadsafe", False) + tc.variables["HDF5_ENABLE_DEBUG_APIS"] = False # Option? + tc.variables["BUILD_TESTING"] = False - @functools.lru_cache(1) - def _configure_cmake(self): + # FIXME is there no built-in way of doing the replace? + tc.variables["HDF5_INSTALL_INCLUDE_DIR"] = os.path.join(self.package_folder, "include", "hdf5").replace("\\", "/") + + tc.variables["HDF5_BUILD_TOOLS"] = False + tc.variables["HDF5_BUILD_EXAMPLES"] = False + tc.variables["HDF5_BUILD_HL_LIB"] = self.options.hl + tc.variables["HDF5_BUILD_FORTRAN"] = False + tc.variables["HDF5_BUILD_CPP_LIB"] = self.options.enable_cxx + if Version(self.version) >= "1.10.0": + tc.variables["HDF5_BUILD_JAVA"] = False + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + + def build(self): + apply_conandata_patches(self) + # Do not force PIC + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") cmake = CMake(self) - cmake.definitions["HDF5_EXTERNALLY_CONFIGURED"] = True - cmake.definitions["HDF5_EXTERNAL_LIB_PREFIX"] = "" - cmake.definitions["HDF5_USE_FOLDERS"] = False - cmake.definitions["HDF5_NO_PACKAGES"] = True - cmake.definitions["ALLOW_UNSUPPORTED"] = False - if tools.Version(self.version) >= "1.10.6": - cmake.definitions["ONLY_SHARED_LIBS"] = self.options.shared - cmake.definitions["BUILD_STATIC_EXECS"] = False - cmake.definitions["HDF5_ENABLE_COVERAGE"] = False - cmake.definitions["HDF5_ENABLE_USING_MEMCHECKER"] = False - if tools.Version(self.version) >= "1.10.0": - cmake.definitions["HDF5_MEMORY_ALLOC_SANITY_CHECK"] = False - if tools.Version(self.version) >= "1.10.5": - cmake.definitions["HDF5_ENABLE_PREADWRITE"] = True - cmake.definitions["HDF5_ENABLE_DEPRECATED_SYMBOLS"] = True - cmake.definitions["HDF5_BUILD_GENERATORS"] = False - cmake.definitions["HDF5_ENABLE_TRACE"] = False - if self.settings.build_type == "Debug": - cmake.definitions["HDF5_ENABLE_INSTRUMENT"] = False # Option? - cmake.definitions["HDF5_ENABLE_PARALLEL"] = self.options.parallel - cmake.definitions["HDF5_ENABLE_Z_LIB_SUPPORT"] = self.options.with_zlib - cmake.definitions["HDF5_ENABLE_SZIP_SUPPORT"] = bool(self.options.szip_support) - if bool(self.options.szip_support): - cmake.definitions["CONAN_SZIP_LIBNAME"] = self._get_szip_lib() # this variable is added by conanize-link-szip*.patch - cmake.definitions["HDF5_ENABLE_SZIP_ENCODING"] = self.options.get_safe("szip_encoding", False) - cmake.definitions["HDF5_PACKAGE_EXTLIBS"] = False - cmake.definitions["HDF5_ENABLE_THREADSAFE"] = self.options.get_safe("threadsafe", False) - cmake.definitions["HDF5_ENABLE_DEBUG_APIS"] = False # Option? - cmake.definitions["BUILD_TESTING"] = False - cmake.definitions["HDF5_INSTALL_INCLUDE_DIR"] = os.path.join(self.package_folder, "include", "hdf5") - cmake.definitions["HDF5_BUILD_TOOLS"] = False - cmake.definitions["HDF5_BUILD_EXAMPLES"] = False - cmake.definitions["HDF5_BUILD_HL_LIB"] = self.options.hl - cmake.definitions["HDF5_BUILD_FORTRAN"] = False - cmake.definitions["HDF5_BUILD_CPP_LIB"] = self.options.enable_cxx - if tools.Version(self.version) >= "1.10.0": - cmake.definitions["HDF5_BUILD_JAVA"] = False - - cmake.configure(build_folder=self._build_subfolder) - return cmake - - def _get_szip_lib(self): - return { - "with_libaec": "libaec", - "with_szip": "szip", - }.get(str(self.options.szip_support)) + cmake.configure() + cmake.build() def _components(self): hdf5_requirements = [] @@ -175,8 +203,7 @@ def _components(self): "hdf5_hl_cpp": {"component": "HL_CXX", "alias_target": "hdf5_hl_cpp", "requirements": ["hdf5_c", "hdf5_cpp", "hdf5_hl"]}, } - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets, is_parallel): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -193,26 +220,44 @@ def _create_cmake_module_alias_targets(module_file, targets, is_parallel): set_property(TARGET hdf5::hdf5_hl_cpp PROPERTY INTERFACE_LINK_LIBRARIES HDF5::HL_CXX) endif() """) - content += textwrap.dedent("set(HDF5_IS_PARALLEL {})".format("ON" if is_parallel else "OFF")) - tools.save(module_file, content) + save(self, module_file, content) + + def _create_cmake_module_variables(self, module_file, is_parallel): + content = "set(HDF5_IS_PARALLEL {})".format("ON" if is_parallel else "OFF") + save(self, module_file, content) + + @property + def _module_targets_file_rel_path(self): + return os.path.join("lib", "cmake", + f"conan-official-{self.name}-targets.cmake") @property - def _module_file_rel_path(self): + def _module_variables_file_rel_path(self): return os.path.join("lib", "cmake", - "conan-official-{}-targets.cmake".format(self.name)) + f"conan-official-{self.name}-variables.cmake") def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - os.remove(os.path.join(self.package_folder, "lib", "libhdf5.settings")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "libhdf5.settings", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + # remove extra libs... building 1.8.21 as shared also outputs static libs on Linux. + if self.options.shared: + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + # Mimic the official CMake FindHDF5 targets. HDF5::HDF5 refers to the global target as per conan, # but component targets have a lower case namespace prefix. hdf5::hdf5 refers to the C library only components = self._components() self._create_cmake_module_alias_targets( - os.path.join(self.package_folder, self._module_file_rel_path), - {"hdf5::{}".format(component["alias_target"]): "HDF5::{}".format(component["component"]) for component in components.values()}, + os.path.join(self.package_folder, self._module_targets_file_rel_path), + {f"hdf5::{component['alias_target']}": f"HDF5::{component['component']}" for component in components.values()} + ) + self._create_cmake_module_variables( + os.path.join(self.package_folder, self._module_variables_file_rel_path), self.options.get_safe("parallel", False) ) @@ -231,17 +276,19 @@ def _config_libname(lib): self.cpp_info.components[component_name].set_property("pkg_config_name", alias_target) self.cpp_info.components[component_name].libs = [_config_libname(alias_target)] self.cpp_info.components[component_name].requires = requirements + self.cpp_info.components[component_name].includedirs.append(os.path.join("include", "hdf5")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.components[component_name].names["cmake_find_package"] = component self.cpp_info.components[component_name].names["cmake_find_package_multi"] = component - self.cpp_info.components[component_name].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components[component_name].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.cpp_info.components[component_name].build_modules["cmake_find_package"] = [self._module_targets_file_rel_path, self._module_variables_file_rel_path] + self.cpp_info.components[component_name].build_modules["cmake_find_package_multi"] = [self._module_targets_file_rel_path, self._module_variables_file_rel_path] self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "HDF5") self.cpp_info.set_property("cmake_target_name", "HDF5::HDF5") self.cpp_info.set_property("pkg_config_name", "hdf5-all-do-not-use") # to avoid conflict with hdf5_c component + self.cpp_info.set_property("cmake_build_modules", [self._module_variables_file_rel_path]) components = self._components() add_component("hdf5_c", **components["hdf5_c"]) diff --git a/recipes/hdf5/all/patches/build-either-static-or-shared-1.10.5.patch b/recipes/hdf5/all/patches/build-either-static-or-shared-1.10.5.patch deleted file mode 100644 index 1fd97a9f54aa5..0000000000000 --- a/recipes/hdf5/all/patches/build-either-static-or-shared-1.10.5.patch +++ /dev/null @@ -1,116 +0,0 @@ ---- a/c++/src/CMakeLists.txt -+++ b/c++/src/CMakeLists.txt -@@ -84,6 +84,7 @@ set (CPP_HDRS - ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h - ) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SOURCES} ${CPP_HDRS}) - target_include_directories(${HDF5_CPP_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" -@@ -98,6 +99,7 @@ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF - H5_SET_LIB_OPTIONS (${HDF5_CPP_LIB_TARGET} ${HDF5_CPP_LIB_NAME} STATIC 0) - set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/cpp) - set (install_targets ${HDF5_CPP_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SOURCES} ${CPP_HDRS}) -@@ -135,8 +137,9 @@ install ( - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) -+ endif () - - install ( - TARGETS ---- a/hl/c++/src/CMakeLists.txt -+++ b/hl/c++/src/CMakeLists.txt -@@ -8,6 +8,7 @@ project (HDF5_HL_CPP_SRC CXX) - set (HDF5_HL_CPP_SOURCES ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp) - set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SOURCES}) - target_include_directories(${HDF5_HL_CPP_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" -@@ -19,6 +20,7 @@ set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF - H5_SET_LIB_OPTIONS (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_HL_CPP_LIB_NAME} STATIC 0) - set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES FOLDER libraries/hl) - set (install_targets ${HDF5_HL_CPP_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_HL_CPP_LIBSH_TARGET} SHARED ${HDF5_HL_CPP_SOURCES}) -@@ -55,8 +57,9 @@ install ( - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) -+ endif () - - install ( - TARGETS ---- a/hl/src/CMakeLists.txt -+++ b/hl/src/CMakeLists.txt -@@ -32,6 +32,7 @@ set (HL_PRIVATE_HEADERS - ${HDF5_HL_SRC_SOURCE_DIR}/H5LTparse.h - ) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) - target_include_directories(${HDF5_HL_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" -@@ -43,6 +44,7 @@ H5_SET_LIB_OPTIONS (${HDF5_HL_LIB_TARGET} ${HDF5_HL_LIB_NAME} STATIC 0) - set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES FOLDER libraries/hl) - set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") - set (install_targets ${HDF5_HL_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SOURCES} ${HL_HEADERS} ${HL_PRIVATE_HEADERS}) -@@ -79,8 +81,9 @@ install ( - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) -+ endif () - - install ( - TARGETS ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -1063,6 +1063,7 @@ option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) - set (gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/H5Tinit.c ${HDF5_BINARY_DIR}/H5lib_settings.c) - add_custom_target (gen_${HDF5_LIB_TARGET} ALL DEPENDS ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp1 ${HDF5_GENERATED_SOURCE_DIR}/gen_SRCS.stamp2) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${gen_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS} ${H5_GENERATED_HEADERS}) - target_include_directories(${HDF5_LIB_TARGET} - PRIVATE "${HDF5_SRC_DIR};${HDF5_BINARY_DIR};$<$:${MPI_C_INCLUDE_DIRS}>" -@@ -1088,6 +1089,7 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES FOLDER libraries) - add_dependencies (${HDF5_LIB_TARGET} gen_${HDF5_LIB_TARGET}) - - set (install_targets ${HDF5_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - set (shared_gen_SRCS ${HDF5_GENERATED_SOURCE_DIR}/shared/H5Tinit.c ${HDF5_BINARY_DIR}/shared/H5lib_settings.c) -@@ -1144,8 +1146,9 @@ endif () - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) -+ endif () - - install ( - TARGETS diff --git a/recipes/hdf5/all/patches/build-either-static-or-shared-1.8.21.patch b/recipes/hdf5/all/patches/build-either-static-or-shared-1.8.21.patch deleted file mode 100644 index d7ee7cabd980b..0000000000000 --- a/recipes/hdf5/all/patches/build-either-static-or-shared-1.8.21.patch +++ /dev/null @@ -1,125 +0,0 @@ ---- a/c++/src/CMakeLists.txt -+++ b/c++/src/CMakeLists.txt -@@ -86,6 +86,7 @@ set (CPP_HDRS - ${HDF5_CPP_SRC_SOURCE_DIR}/H5VarLenType.h - ) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_CPP_LIB_TARGET} STATIC ${CPP_SRCS} ${CPP_HDRS}) - TARGET_C_PROPERTIES (${HDF5_CPP_LIB_TARGET} STATIC " " " ") - target_link_libraries (${HDF5_CPP_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) -@@ -96,6 +97,7 @@ set_target_properties (${HDF5_CPP_LIB_TARGET} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - ) - set (install_targets ${HDF5_CPP_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_CPP_LIBSH_TARGET} SHARED ${CPP_SRCS} ${CPP_HDRS}) -@@ -130,8 +132,9 @@ install ( - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} cpplibraries) -+ endif () - - install ( - TARGETS ---- a/hl/c++/src/CMakeLists.txt -+++ b/hl/c++/src/CMakeLists.txt -@@ -10,6 +10,7 @@ INCLUDE_DIRECTORIES (${HDF5_HL_CPP_SRC_SOURCE_DIR}) - set (HDF5_HL_CPP_SRCS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.cpp) - set (HDF5_HL_CPP_HDRS ${HDF5_HL_CPP_SRC_SOURCE_DIR}/H5PacketTable.h) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_HL_CPP_LIB_TARGET} STATIC ${HDF5_HL_CPP_SRCS}) - TARGET_C_PROPERTIES (${HDF5_HL_CPP_LIB_TARGET} STATIC " " " ") - target_link_libraries (${HDF5_HL_CPP_LIB_TARGET} PUBLIC ${HDF5_HL_LIB_TARGET} ${HDF5_LIB_TARGET}) -@@ -20,6 +21,7 @@ set_target_properties (${HDF5_HL_CPP_LIB_TARGET} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - ) - set (install_targets ${HDF5_HL_CPP_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_HL_CPP_LIBSH_TARGET} SHARED ${HDF5_HL_CPP_SRCS}) -@@ -54,8 +56,9 @@ install ( - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_HL_CPP_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hlcpplibraries) -+ endif () - - install ( - TARGETS ---- a/hl/src/CMakeLists.txt -+++ b/hl/src/CMakeLists.txt -@@ -26,6 +26,7 @@ set (HL_HEADERS - ${HDF5_HL_SRC_SOURCE_DIR}/hdf5_hl.h - ) - -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_HL_LIB_TARGET} STATIC ${HL_SRCS} ${HL_HEADERS}) - TARGET_C_PROPERTIES (${HDF5_HL_LIB_TARGET} STATIC " " " ") - target_link_libraries (${HDF5_HL_LIB_TARGET} PUBLIC ${HDF5_LIB_TARGET}) -@@ -36,6 +37,7 @@ set_target_properties (${HDF5_HL_LIB_TARGET} PROPERTIES - ) - set_global_variable (HDF5_LIBRARIES_TO_EXPORT "${HDF5_LIBRARIES_TO_EXPORT};${HDF5_HL_LIB_TARGET}") - set (install_targets ${HDF5_HL_LIB_TARGET}) -+endif () - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_HL_LIBSH_TARGET} SHARED ${HL_SRCS} ${HL_HEADERS}) -@@ -70,8 +72,9 @@ install ( - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_HL_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_HL_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} hllibraries) -+ endif () - - install ( - TARGETS ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -696,6 +696,8 @@ set_source_files_properties (${HDF5_BINARY_DIR}/H5version.h GENERATED) - set (common_SRCS ${common_SRCS} ${HDF5_BINARY_DIR}/H5overflow.h) - set_source_files_properties (${HDF5_BINARY_DIR}/H5overflow.h GENERATED) - -+option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) -+if (NOT BUILD_SHARED_LIBS) - add_library (${HDF5_LIB_TARGET} STATIC ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS}) - TARGET_C_PROPERTIES (${HDF5_LIB_TARGET} STATIC " " " ") - target_link_libraries (${HDF5_LIB_TARGET} PRIVATE ${LINK_LIBS} ${LINK_COMP_LIBS}) -@@ -709,7 +711,6 @@ set_target_properties (${HDF5_LIB_TARGET} PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "$/include>" - ) - --option (HDF5_ENABLE_DEBUG_APIS "Turn on extra debug output in all packages" OFF) - if (HDF5_ENABLE_DEBUG_APIS) - set_target_properties (${HDF5_LIB_TARGET} PROPERTIES - COMPILE_DEFINITIONS -@@ -717,6 +718,7 @@ if (HDF5_ENABLE_DEBUG_APIS) - ) - endif () - set (install_targets ${HDF5_LIB_TARGET}) -+endif() - - if (BUILD_SHARED_LIBS) - add_library (${HDF5_LIBSH_TARGET} SHARED ${common_SRCS} ${H5_PUBLIC_HEADERS} ${H5_PRIVATE_HEADERS}) -@@ -770,8 +772,9 @@ endif () - if (HDF5_EXPORTED_TARGETS) - if (BUILD_SHARED_LIBS) - INSTALL_TARGET_PDB (${HDF5_LIBSH_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) -- endif () -+ else () - INSTALL_TARGET_PDB (${HDF5_LIB_TARGET} ${HDF5_INSTALL_BIN_DIR} libraries) -+ endif () - - install ( - TARGETS diff --git a/recipes/hdf5/all/patches/conanize-link-szip-1.10.5+.patch b/recipes/hdf5/all/patches/conanize-link-szip-1.10.5+.patch index 7bac650915b65..d81778f11d3b3 100644 --- a/recipes/hdf5/all/patches/conanize-link-szip-1.10.5+.patch +++ b/recipes/hdf5/all/patches/conanize-link-szip-1.10.5+.patch @@ -1,45 +1,37 @@ --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake -@@ -99,38 +99,10 @@ endif () - option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) - if (HDF5_ENABLE_SZIP_SUPPORT) - option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF) -- if (NOT SZIP_USE_EXTERNAL) -- find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) -- if (NOT SZIP_FOUND) +@@ -52,10 +52,10 @@ + find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT ZLIB_FOUND) + find_package (ZLIB) # Legacy find +- if (ZLIB_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) +- set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_LIBRARIES}) +- endif () ++ endif () ++ if (ZLIB_FOUND) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) ++ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_LIBRARIES}) + endif () + endif () + if (ZLIB_FOUND) +@@ -102,10 +102,15 @@ + if (NOT SZIP_USE_EXTERNAL) + find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT SZIP_FOUND) - find_package (SZIP) # Legacy find - if (SZIP_FOUND) - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) - set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_LIBRARIES}) -- endif () -- endif () -- endif () -- if (SZIP_FOUND) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) -- set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) -- else () -- if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") -- EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING}) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- message (STATUS "Filter SZIP is built") -- else () -- message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") -- endif () -- endif () -- if (BUILD_SHARED_LIBS) -- set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_SHARED_LIBRARY}) -- endif () -- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) -- INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) -+ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} "CONAN_PKG::${CONAN_SZIP_LIBNAME}") -+ set (H5_HAVE_FILTER_SZIP 1) -+ set (H5_HAVE_SZLIB_H 1) -+ set (H5_HAVE_LIBSZ 1) - message (STATUS "Filter SZIP is ON") - if (H5_HAVE_FILTER_SZIP) - set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DECODE") ++ find_package (szip CONFIG REQUIRED) ++ endif () ++ if (SZIP_FOUND) ++ if (TARGET szip-shared) ++ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} szip-shared) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-shared) ++ else () ++ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} szip-static) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-static) + endif () + endif () + endif () diff --git a/recipes/hdf5/all/patches/conanize-link-szip-1.12.1+.patch b/recipes/hdf5/all/patches/conanize-link-szip-1.12.1+.patch deleted file mode 100644 index fdf084ea5a466..0000000000000 --- a/recipes/hdf5/all/patches/conanize-link-szip-1.12.1+.patch +++ /dev/null @@ -1,51 +0,0 @@ ---- CMakeFilters.cmake 2021-07-01 23:26:37.000000000 +0200 -+++ CMakeFilters2.cmake 2022-02-07 07:25:14.498269403 +0100 -@@ -109,44 +109,10 @@ - option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) - if (HDF5_ENABLE_SZIP_SUPPORT) - option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF) -- if (NOT SZIP_USE_EXTERNAL) -- find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) -- if (NOT SZIP_FOUND) -- find_package (SZIP) # Legacy find -- if (SZIP_FOUND) -- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) -- endif () -- endif () -- endif () -- if (SZIP_FOUND) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) -- set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) -- else () -- if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") -- EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING}) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") -- message (VERBOSE "Filter SZIP is built") -- endif () -- if (USE_LIBAEC) -- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") -- message (VERBOSE "... with library AEC") -- endif () -- set (SZ_PACKAGE_NAME ${LIBAEC_PACKAGE_NAME}) -- else () -- set (SZ_PACKAGE_NAME ${SZIP_PACKAGE_NAME}) -- endif () -- else () -- message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") -- endif () -- endif () -- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) -- INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) -+ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} "CONAN_PKG::${CONAN_SZIP_LIBNAME}") -+ set (H5_HAVE_FILTER_SZIP 1) -+ set (H5_HAVE_SZLIB_H 1) -+ set (H5_HAVE_LIBSZ 1) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Filter SZIP is ON") - endif () diff --git a/recipes/hdf5/all/patches/conanize-link-szip-1.12.2+.patch b/recipes/hdf5/all/patches/conanize-link-szip-1.12.2+.patch index 1da6c95a320ba..1cdae1d205cdc 100644 --- a/recipes/hdf5/all/patches/conanize-link-szip-1.12.2+.patch +++ b/recipes/hdf5/all/patches/conanize-link-szip-1.12.2+.patch @@ -2,63 +2,45 @@ diff --git a/CMakeFilters.cmake b/CMakeFilters.cmake index 725390b31b..085b18051e 100644 --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake -@@ -110,55 +110,10 @@ endif () - option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) - if (HDF5_ENABLE_SZIP_SUPPORT) - option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF) -- if (NOT SZIP_USE_EXTERNAL) -- set(SZIP_FOUND FALSE) -- if (USE_LIBAEC) +@@ -63,9 +62,9 @@ + find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT ZLIB_FOUND) + find_package (ZLIB) # Legacy find +- if (ZLIB_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) +- endif () ++ endif () ++ if (ZLIB_FOUND) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) + endif () + endif () + if (ZLIB_FOUND) +@@ -113,19 +112,21 @@ + if (NOT SZIP_USE_EXTERNAL) + set(SZIP_FOUND FALSE) + if (USE_LIBAEC) - set(libaec_USE_STATIC_LIBS ${USE_LIBAEC_STATIC}) - find_package (libaec 1.0.5 CONFIG) - if (SZIP_FOUND) - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) - endif () -- endif () -- -- if (NOT SZIP_FOUND) -- find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) -- if (NOT SZIP_FOUND) -- find_package (SZIP) # Legacy find ++ find_package (libaec CONFIG REQUIRED) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} libaec::libaec) ++ set (SZIP_FOUND TRUE) + endif () + + if (NOT SZIP_FOUND) + find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT SZIP_FOUND) + find_package (SZIP) # Legacy find - if (SZIP_FOUND) - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) -- endif () -- endif () -- endif () -- endif () -- if (SZIP_FOUND) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) -- set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) -- else () -- if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") -- EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING}) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") -- message (VERBOSE "Filter SZIP is built") -- endif () -- if (USE_LIBAEC) -- if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") -- message (VERBOSE "... with library AEC") -- endif () -- set (SZIP_PACKAGE_NAME ${LIBAEC_PACKAGE_NAME}) -- else () -- set (SZIP_PACKAGE_NAME ${SZIP_PACKAGE_NAME}) -- endif () -- else () -- message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") -- endif () -- endif () -- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) -- INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) -+ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} "CONAN_PKG::${CONAN_SZIP_LIBNAME}") -+ set (H5_HAVE_FILTER_SZIP 1) -+ set (H5_HAVE_SZLIB_H 1) -+ set (H5_HAVE_LIBSZ 1) - if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15.0") - message (VERBOSE "Filter SZIP is ON") - endif () ++ endif () ++ if (SZIP_FOUND) ++ if (TARGET szip-shared) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-shared) ++ else () ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-static) + endif () + endif () + endif () diff --git a/recipes/hdf5/all/patches/conanize-link-szip-1.14.0+.patch b/recipes/hdf5/all/patches/conanize-link-szip-1.14.0+.patch new file mode 100644 index 0000000000000..b7c286ec1ccf2 --- /dev/null +++ b/recipes/hdf5/all/patches/conanize-link-szip-1.14.0+.patch @@ -0,0 +1,45 @@ +diff -u a/CMakeFilters.cmake b/CMakeFilters.cmake +--- a/CMakeFilters.cmake 2023-01-04 22:29:45.875695757 +0100 ++++ b/CMakeFilters.cmake 2023-01-04 22:37:15.356762199 +0100 +@@ -59,9 +59,9 @@ + find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT ZLIB_FOUND) + find_package (ZLIB) # Legacy find +- if (ZLIB_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) +- endif () ++ endif() ++ if (ZLIB_FOUND) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) + endif () + endif () + if (ZLIB_FOUND) +@@ -105,20 +105,20 @@ + if (NOT SZIP_USE_EXTERNAL) + set(SZIP_FOUND FALSE) + if (USE_LIBAEC) +- set(libaec_USE_STATIC_LIBS ${USE_LIBAEC_STATIC}) +- find_package (libaec 1.0.5 CONFIG) +- if (SZIP_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) +- endif () ++ find_package (libaec CONFIG REQUIRED) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) ++ set (SZIP_FOUND TRUE) + endif () + + if (NOT SZIP_FOUND) + find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT SZIP_FOUND) + find_package (SZIP) # Legacy find +- if (SZIP_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) +- endif () ++ endif() ++ if (TARGET szip-shared) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-shared) ++ else () ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-static) + endif () + endif () + endif () diff --git a/recipes/hdf5/all/patches/conanize-link-szip-1.8.21.patch b/recipes/hdf5/all/patches/conanize-link-szip-1.8.21.patch index 0871659d5d234..44cd11379d7b8 100644 --- a/recipes/hdf5/all/patches/conanize-link-szip-1.8.21.patch +++ b/recipes/hdf5/all/patches/conanize-link-szip-1.8.21.patch @@ -1,45 +1,37 @@ --- a/CMakeFilters.cmake +++ b/CMakeFilters.cmake -@@ -91,38 +91,10 @@ endif () - option (HDF5_ENABLE_SZIP_SUPPORT "Use SZip Filter" OFF) - if (HDF5_ENABLE_SZIP_SUPPORT) - option (HDF5_ENABLE_SZIP_ENCODING "Use SZip Encoding" OFF) -- if (NOT SZIP_USE_EXTERNAL) -- find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) -- if (NOT SZIP_FOUND) +@@ -44,10 +44,10 @@ + find_package (ZLIB NAMES ${ZLIB_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT ZLIB_FOUND) + find_package (ZLIB) # Legacy find +- if (ZLIB_FOUND) +- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) +- set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_LIBRARIES}) +- endif () ++ endif () ++ if (ZLIB_FOUND) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${ZLIB_LIBRARIES}) ++ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${ZLIB_LIBRARIES}) + endif () + endif () + if (ZLIB_FOUND) +@@ -94,10 +94,15 @@ + if (NOT SZIP_USE_EXTERNAL) + find_package (SZIP NAMES ${SZIP_PACKAGE_NAME}${HDF_PACKAGE_EXT} COMPONENTS static shared) + if (NOT SZIP_FOUND) - find_package (SZIP) # Legacy find - if (SZIP_FOUND) - set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_LIBRARIES}) - set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_LIBRARIES}) -- endif () -- endif () -- endif () -- if (SZIP_FOUND) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- set (SZIP_INCLUDE_DIR_GEN ${SZIP_INCLUDE_DIR}) -- set (SZIP_INCLUDE_DIRS ${SZIP_INCLUDE_DIRS} ${SZIP_INCLUDE_DIR}) -- else () -- if (HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "GIT" OR HDF5_ALLOW_EXTERNAL_SUPPORT MATCHES "TGZ") -- EXTERNAL_SZIP_LIBRARY (${HDF5_ALLOW_EXTERNAL_SUPPORT} ${HDF5_ENABLE_SZIP_ENCODING}) -- set (H5_HAVE_FILTER_SZIP 1) -- set (H5_HAVE_SZLIB_H 1) -- set (H5_HAVE_LIBSZ 1) -- message (STATUS "Filter SZIP is built") -- else () -- message (FATAL_ERROR "SZIP is Required for SZIP support in HDF5") -- endif () -- endif () -- if (BUILD_SHARED_LIBS) -- set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} ${SZIP_SHARED_LIBRARY}) -- endif () -- set (LINK_COMP_LIBS ${LINK_COMP_LIBS} ${SZIP_STATIC_LIBRARY}) -- INCLUDE_DIRECTORIES (${SZIP_INCLUDE_DIRS}) -+ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} "CONAN_PKG::${CONAN_SZIP_LIBNAME}") -+ set (H5_HAVE_FILTER_SZIP 1) -+ set (H5_HAVE_SZLIB_H 1) -+ set (H5_HAVE_LIBSZ 1) - message (STATUS "Filter SZIP is ON") - if (H5_HAVE_FILTER_SZIP) - set (EXTERNAL_FILTERS "${EXTERNAL_FILTERS} DECODE") ++ find_package (szip CONFIG REQUIRED) ++ endif () ++ if (SZIP_FOUND) ++ if (TARGET szip-shared) ++ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} szip-shared) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-shared) ++ else () ++ set (LINK_COMP_SHARED_LIBS ${LINK_COMP_SHARED_LIBS} szip-static) ++ set (LINK_COMP_LIBS ${LINK_COMP_LIBS} szip-static) + endif () + endif () + endif () diff --git a/recipes/hdf5/all/test_package/CMakeLists.txt b/recipes/hdf5/all/test_package/CMakeLists.txt index 61e2f5929ebe0..f55f0f366b044 100644 --- a/recipes/hdf5/all/test_package/CMakeLists.txt +++ b/recipes/hdf5/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - set(HDF5_COMPONENTS C) if (HDF5_HL) list(APPEND HDF5_COMPONENTS HL) diff --git a/recipes/hdf5/all/test_package/conanfile.py b/recipes/hdf5/all/test_package/conanfile.py index 4d4698a0afd36..63ea739df24e4 100644 --- a/recipes/hdf5/all/test_package/conanfile.py +++ b/recipes/hdf5/all/test_package/conanfile.py @@ -1,21 +1,37 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables.update({ + "HDF5_CXX": self.dependencies["hdf5"].options.enable_cxx, + "HDF5_HL": self.dependencies["hdf5"].options.hl, + }) + if self.dependencies["hdf5"].options.enable_cxx: + tc.variables.update({"CMAKE_CXX_STANDARD": 11}) + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions.update({ - "HDF5_CXX": self.options["hdf5"].enable_cxx, - "HDF5_HL": self.options["hdf5"].hl, - }) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/hdf5/all/test_v1_package/CMakeLists.txt b/recipes/hdf5/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..61e2f5929ebe0 --- /dev/null +++ b/recipes/hdf5/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +set(HDF5_COMPONENTS C) +if (HDF5_HL) + list(APPEND HDF5_COMPONENTS HL) +endif() +if (HDF5_CXX) + list(APPEND HDF5_COMPONENTS CXX) +endif() +find_package(HDF5 COMPONENTS ${HDF5_COMPONENTS}) + +add_executable(${PROJECT_NAME} test_package.c) + +if (TARGET hdf5::hdf5_cpp) + target_compile_definitions(${PROJECT_NAME} PRIVATE CONAN_HDF5_CXX) + target_sources(${PROJECT_NAME} PRIVATE test_package.cpp) + target_link_libraries(${PROJECT_NAME} PRIVATE hdf5::hdf5_cpp) +elseif (HDF5_IS_PARALLEL) + target_compile_definitions(${PROJECT_NAME} PRIVATE CONAN_HDF5_PARALLEL) + target_sources(${PROJECT_NAME} PRIVATE test_parallel.c) + target_link_libraries(${PROJECT_NAME} PRIVATE hdf5::hdf5) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE hdf5::hdf5) +endif() diff --git a/recipes/hdf5/all/test_v1_package/conanfile.py b/recipes/hdf5/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4c36411c06162 --- /dev/null +++ b/recipes/hdf5/all/test_v1_package/conanfile.py @@ -0,0 +1,24 @@ +import os + +from conans import CMake, ConanFile, tools + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.definitions.update({ + "HDF5_CXX": self.options["hdf5"].enable_cxx, + "HDF5_HL": self.options["hdf5"].hl, + }) + if self.options["hdf5"].enable_cxx: + cmake.definitions.update({"CMAKE_CXX_STANDARD": 11}) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/hdf5/all/test_v1_package/test_package.c b/recipes/hdf5/all/test_v1_package/test_package.c new file mode 100644 index 0000000000000..acc23d1bd8c5f --- /dev/null +++ b/recipes/hdf5/all/test_v1_package/test_package.c @@ -0,0 +1,50 @@ +#include "hdf5.h" +#define FILE "dset.h5" + +extern void test_cxx_api(); +extern void test_parallel(); + +void test_c_api() +{ + + hid_t file_id, dataset_id, dataspace_id; /* identifiers */ + hsize_t dims[2]; + herr_t status; + + /* Create a new file using default properties. */ + file_id = H5Fcreate(FILE, H5F_ACC_TRUNC, H5P_DEFAULT, H5P_DEFAULT); + + /* Create the data space for the dataset. */ + dims[0] = 4; + dims[1] = 6; + dataspace_id = H5Screate_simple(2, dims, NULL); + + /* Create the dataset. */ + dataset_id = + H5Dcreate2(file_id, "/dset", H5T_STD_I32BE, dataspace_id, H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + + /* End access to the dataset and release resources used by it. */ + status = H5Dclose(dataset_id); + + /* Terminate access to the data space. */ + status = H5Sclose(dataspace_id); + + /* Close the file. */ + status = H5Fclose(file_id); +} + +int main(int argc, char **argv) +{ + printf("Testing C API\n"); + test_c_api(); + #ifdef CONAN_HDF5_CXX + printf("Testing C++ API\n"); + test_cxx_api(); + #endif + #ifdef CONAN_HDF5_PARALLEL + printf("Testing HDF5 Parallel\n"); + test_parallel(argc, argv); + #endif + + return 0; +} diff --git a/recipes/hdf5/all/test_v1_package/test_package.cpp b/recipes/hdf5/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..ef3ec22b3871e --- /dev/null +++ b/recipes/hdf5/all/test_v1_package/test_package.cpp @@ -0,0 +1,9 @@ +#include + +extern "C" void test_cxx_api() +{ + hsize_t dimensions[] = {4, 6}; + H5::H5File file("dataset.h5", H5F_ACC_TRUNC); + H5::DataSpace dataspace(2, dimensions); + H5::DataSet dataset = file.createDataSet("dataset", H5::PredType::STD_I32BE, dataspace); +} diff --git a/recipes/hdf5/all/test_v1_package/test_parallel.c b/recipes/hdf5/all/test_v1_package/test_parallel.c new file mode 100644 index 0000000000000..557e7c0f80372 --- /dev/null +++ b/recipes/hdf5/all/test_v1_package/test_parallel.c @@ -0,0 +1,99 @@ +/* + * This example writes data to the HDF5 file. + * Number of processes is assumed to be 1 or multiples of 2 (up to 8) + */ + +#include "hdf5.h" +#include "stdlib.h" + +#define H5FILE_NAME "SDS.h5" +#define DATASETNAME "IntArray" +#define NX 8 /* dataset dimensions */ +#define NY 5 +#define RANK 2 + +int test_parallel(int argc, char **argv) +{ + /* + * HDF5 APIs definitions + */ + hid_t file_id, dset_id; /* file and dataset identifiers */ + hid_t filespace; /* file and memory dataspace identifiers */ + hsize_t dimsf[] = {NX, NY}; /* dataset dimensions */ + int *data; /* pointer to data buffer to write */ + hid_t plist_id; /* property list identifier */ + int i; + herr_t status; + + /* + * MPI variables + */ + int mpi_size, mpi_rank; + MPI_Comm comm = MPI_COMM_WORLD; + MPI_Info info = MPI_INFO_NULL; + + /* + * Initialize MPI + */ + MPI_Init(&argc, &argv); + MPI_Comm_size(comm, &mpi_size); + MPI_Comm_rank(comm, &mpi_rank); + + /* + * Initialize data buffer + */ + data = (int *) malloc(sizeof(int)*dimsf[0]*dimsf[1]); + for (i=0; i < dimsf[0]*dimsf[1]; i++) { + data[i] = i; + } + /* + * Set up file access property list with parallel I/O access + */ + plist_id = H5Pcreate(H5P_FILE_ACCESS); + H5Pset_fapl_mpio(plist_id, comm, info); + + /* + * Create a new file collectively and release property list identifier. + */ + file_id = H5Fcreate(H5FILE_NAME, H5F_ACC_TRUNC, H5P_DEFAULT, plist_id); + H5Pclose(plist_id); + + + /* + * Create the dataspace for the dataset. + */ + filespace = H5Screate_simple(RANK, dimsf, NULL); + + /* + * Create the dataset with default properties and close filespace. + */ + dset_id = H5Dcreate(file_id, DATASETNAME, H5T_NATIVE_INT, filespace, + H5P_DEFAULT, H5P_DEFAULT, H5P_DEFAULT); + /* + * Create property list for collective dataset write. + */ + plist_id = H5Pcreate(H5P_DATASET_XFER); + H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_COLLECTIVE); + + /* + * To write dataset independently use + * + * H5Pset_dxpl_mpio(plist_id, H5FD_MPIO_INDEPENDENT); + */ + + status = H5Dwrite(dset_id, H5T_NATIVE_INT, H5S_ALL, H5S_ALL, + plist_id, data); + free(data); + + /* + * Close/release resources. + */ + H5Dclose(dset_id); + H5Sclose(filespace); + H5Pclose(plist_id); + H5Fclose(file_id); + + MPI_Finalize(); + + return 0; +} diff --git a/recipes/hdf5/config.yml b/recipes/hdf5/config.yml index 354b7315d78c1..6c8040e06da05 100644 --- a/recipes/hdf5/config.yml +++ b/recipes/hdf5/config.yml @@ -1,10 +1,10 @@ versions: + "1.14.0": + folder: all "1.13.1": folder: all "1.12.2": folder: all - "1.12.1": - folder: all "1.12.0": folder: all "1.10.6": diff --git a/recipes/hdrhistogram-c/all/CMakeLists.txt b/recipes/hdrhistogram-c/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/hdrhistogram-c/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/hdrhistogram-c/all/conandata.yml b/recipes/hdrhistogram-c/all/conandata.yml index 41b43fd72aa14..ed9d533f37715 100644 --- a/recipes/hdrhistogram-c/all/conandata.yml +++ b/recipes/hdrhistogram-c/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.11.6": + url: "https://github.com/HdrHistogram/HdrHistogram_c/archive/0.11.6.tar.gz" + sha256: "b9bb6425d9b0ac5424f6d2286a1295900edab0170d1f50767decb00196785de3" "0.11.1": url: "https://github.com/HdrHistogram/HdrHistogram_c/archive/0.11.1.tar.gz" sha256: "8550071d4ae5c8229448f9b68469d6d42c620cd25111b49c696d00185e5f8329" @@ -8,4 +11,3 @@ sources: patches: "0.11.0": - patch_file: "patches/cmake-install.patch" - base_path: "source_subfolder" diff --git a/recipes/hdrhistogram-c/all/conanfile.py b/recipes/hdrhistogram-c/all/conanfile.py index 5d9f68b60c0e1..3fcbc5c0722dd 100644 --- a/recipes/hdrhistogram-c/all/conanfile.py +++ b/recipes/hdrhistogram-c/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class HdrhistogramcConan(ConanFile): @@ -22,17 +25,8 @@ class HdrhistogramcConan(ConanFile): "shared": False, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -40,53 +34,59 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["HDR_HISTOGRAM_BUILD_PROGRAMS"] = False - self._cmake.definitions["HDR_HISTOGRAM_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["HDR_HISTOGRAM_INSTALL_SHARED"] = self.options.shared - self._cmake.definitions["HDR_HISTOGRAM_BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["HDR_HISTOGRAM_INSTALL_STATIC"] = not self.options.shared - self._cmake.definitions["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["HDR_HISTOGRAM_BUILD_PROGRAMS"] = False + tc.variables["HDR_HISTOGRAM_BUILD_SHARED"] = self.options.shared + tc.variables["HDR_HISTOGRAM_INSTALL_SHARED"] = self.options.shared + tc.variables["HDR_HISTOGRAM_BUILD_STATIC"] = not self.options.shared + tc.variables["HDR_HISTOGRAM_INSTALL_STATIC"] = not self.options.shared + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = self.options.shared + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy("COPYING.txt", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "COPYING.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): target = "hdr_histogram" if self.options.shared else "hdr_histogram_static" self.cpp_info.set_property("cmake_file_name", "hdr_histogram") - self.cpp_info.set_property("cmake_target_name", "hdr_histogram::{}".format(target)) + self.cpp_info.set_property("cmake_target_name", f"hdr_histogram::{target}") + if Version(self.version) >= "0.11.6": + self.cpp_info.set_property("pkg_config_name", "hdr_histogram") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["hdr_histrogram"].libs = tools.collect_libs(self) + self.cpp_info.components["hdr_histrogram"].libs = collect_libs(self) self.cpp_info.components["hdr_histrogram"].includedirs.append(os.path.join("include", "hdr")) if not self.options.shared: if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["hdr_histrogram"].system_libs = ["m", "rt"] + self.cpp_info.components["hdr_histrogram"].system_libs = ["m", "rt", "pthread"] elif self.settings.os == "Windows": self.cpp_info.components["hdr_histrogram"].system_libs = ["ws2_32"] @@ -95,5 +95,5 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "hdr_histogram" self.cpp_info.components["hdr_histrogram"].names["cmake_find_package"] = target self.cpp_info.components["hdr_histrogram"].names["cmake_find_package_multi"] = target - self.cpp_info.components["hdr_histrogram"].set_property("cmake_target_name", "hdr_histogram::{}".format(target)) + self.cpp_info.components["hdr_histrogram"].set_property("cmake_target_name", f"hdr_histogram::{target}") self.cpp_info.components["hdr_histrogram"].requires = ["zlib::zlib"] diff --git a/recipes/hdrhistogram-c/all/test_package/CMakeLists.txt b/recipes/hdrhistogram-c/all/test_package/CMakeLists.txt index 749b53ae5c99a..43cecb9cf0752 100644 --- a/recipes/hdrhistogram-c/all/test_package/CMakeLists.txt +++ b/recipes/hdrhistogram-c/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(hdr_histogram REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) if(TARGET hdr_histogram::hdr_histogram_static) - target_link_libraries(${PROJECT_NAME} hdr_histogram::hdr_histogram_static) + target_link_libraries(${PROJECT_NAME} PRIVATE hdr_histogram::hdr_histogram_static) else() - target_link_libraries(${PROJECT_NAME} hdr_histogram::hdr_histogram) + target_link_libraries(${PROJECT_NAME} PRIVATE hdr_histogram::hdr_histogram) endif() diff --git a/recipes/hdrhistogram-c/all/test_package/conanfile.py b/recipes/hdrhistogram-c/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/hdrhistogram-c/all/test_package/conanfile.py +++ b/recipes/hdrhistogram-c/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/hdrhistogram-c/all/test_v1_package/CMakeLists.txt b/recipes/hdrhistogram-c/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/hdrhistogram-c/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/hdrhistogram-c/all/test_v1_package/conanfile.py b/recipes/hdrhistogram-c/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/hdrhistogram-c/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/hdrhistogram-c/config.yml b/recipes/hdrhistogram-c/config.yml index f69c5e8ad6e99..7e06391938f78 100644 --- a/recipes/hdrhistogram-c/config.yml +++ b/recipes/hdrhistogram-c/config.yml @@ -1,4 +1,6 @@ versions: + "0.11.6": + folder: all "0.11.1": folder: all "0.11.0": diff --git a/recipes/heatshrink/all/CMakeLists.txt b/recipes/heatshrink/all/CMakeLists.txt index db34d3f8eddec..e739fade74253 100644 --- a/recipes/heatshrink/all/CMakeLists.txt +++ b/recipes/heatshrink/all/CMakeLists.txt @@ -1,34 +1,27 @@ -cmake_minimum_required(VERSION 3.4) -project(heatshrink C) +cmake_minimum_required(VERSION 3.8) +project(heatshrink LANGUAGES C) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() - -if (WIN32) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -SET(SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder") - -SET (CMAKE_C_STANDARD 99) -LIST(APPEND SRC_HEATSHRINK - "${SOURCE_DIR}/heatshrink_decoder.c" - "${SOURCE_DIR}/heatshrink_encoder.c") - -include_directories(${SOURCE_DIR}) - -add_library(heatshrink ${SRC_HEATSHRINK}) +add_library(heatshrink + ${HEATSHRINK_SRC_DIR}/heatshrink_decoder.c + ${HEATSHRINK_SRC_DIR}/heatshrink_encoder.c +) +target_include_directories(heatshrink PUBLIC ${HEATSHRINK_SRC_DIR}) +set_target_properties(heatshrink PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) +target_compile_features(heatshrink PRIVATE c_std_99) +include(GNUInstallDirs) install( FILES - ${SOURCE_DIR}/heatshrink_common.h - ${SOURCE_DIR}/heatshrink_config.h - ${SOURCE_DIR}/heatshrink_decoder.h - ${SOURCE_DIR}/heatshrink_encoder.h + ${HEATSHRINK_SRC_DIR}/heatshrink_common.h + ${HEATSHRINK_SRC_DIR}/heatshrink_config.h + ${HEATSHRINK_SRC_DIR}/heatshrink_decoder.h + ${HEATSHRINK_SRC_DIR}/heatshrink_encoder.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) -install(TARGETS ${PROJECT_NAME} - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install( + TARGETS heatshrink + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) diff --git a/recipes/heatshrink/all/conanfile.py b/recipes/heatshrink/all/conanfile.py index f75bad8beebef..06cb55ed511e8 100644 --- a/recipes/heatshrink/all/conanfile.py +++ b/recipes/heatshrink/all/conanfile.py @@ -1,8 +1,10 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file import os -from conans import ConanFile, CMake, tools +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.36.0" class HeatshrinkConan(ConanFile): name = "heatshrink" @@ -11,9 +13,8 @@ class HeatshrinkConan(ConanFile): description = "data compression library for embedded/real-time systems" topics = ("compression", "embedded", "realtime") homepage = "https://github.com/atomicobject/heatshrink" - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - exports_sources = "CMakeLists.txt" + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [False, True], "fPIC": [True, False], @@ -29,9 +30,7 @@ class HeatshrinkConan(ConanFile): "use_index": True, } - @property - def _source_subfolder(self): - return "source_subfolder" + exports_sources = "CMakeLists.txt" def config_options(self): if self.settings.os == "Windows": @@ -39,44 +38,47 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["HEATSHRINK_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def _patch_sources(self): - config_file = os.path.join(self._source_subfolder, "heatshrink_config.h") + config_file = os.path.join(self.source_folder, "heatshrink_config.h") if not self.options.dynamic_alloc: - tools.replace_in_file(config_file, + replace_in_file(self, config_file, "#define HEATSHRINK_DYNAMIC_ALLOC 1", "#define HEATSHRINK_DYNAMIC_ALLOC 0") if self.options.debug_log: - tools.replace_in_file(config_file, + replace_in_file(self, config_file, "#define HEATSHRINK_DEBUGGING_LOGS 0", "#define HEATSHRINK_DEBUGGING_LOGS 1") if not self.options.use_index: - tools.replace_in_file(config_file, + replace_in_file(self, config_file, "#define HEATSHRINK_USE_INDEX 1", "#define HEATSHRINK_USE_INDEX 0") - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", "licenses", self._source_subfolder) - - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["heatshrink"] - diff --git a/recipes/heatshrink/all/test_package/CMakeLists.txt b/recipes/heatshrink/all/test_package/CMakeLists.txt index b80e254a1e600..ac68508859a4c 100644 --- a/recipes/heatshrink/all/test_package/CMakeLists.txt +++ b/recipes/heatshrink/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(heatshrink CONFIG REQUIRED) +find_package(heatshrink REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} heatshrink::heatshrink) +target_link_libraries(${PROJECT_NAME} PRIVATE heatshrink::heatshrink) diff --git a/recipes/heatshrink/all/test_package/conanfile.py b/recipes/heatshrink/all/test_package/conanfile.py index 67d4e3220cee1..0a6bc68712d90 100644 --- a/recipes/heatshrink/all/test_package/conanfile.py +++ b/recipes/heatshrink/all/test_package/conanfile.py @@ -1,9 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class DawHeaderLibrariesTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/heatshrink/all/test_v1_package/CMakeLists.txt b/recipes/heatshrink/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/heatshrink/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/heatshrink/all/test_v1_package/conanfile.py b/recipes/heatshrink/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/heatshrink/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/hedley/all/conanfile.py b/recipes/hedley/all/conanfile.py index 8ae886f4acb6b..835a13a80a59b 100644 --- a/recipes/hedley/all/conanfile.py +++ b/recipes/hedley/all/conanfile.py @@ -1,6 +1,9 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -import glob + +required_conan_version = ">=1.50.0" class HedleyConan(ConanFile): @@ -9,22 +12,27 @@ class HedleyConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://nemequ.github.io/hedley/" description = "A C/C++ header to help move #ifdefs out of your code" - topics = ("header", 'header-only', 'preprocessor', "#ifdef", "cross-platform") + topics = ("header", "header-only", "preprocessor", "#ifdef", "cross-platform") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob(self.name + "-*/")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - include_folder = self._source_subfolder - self.copy(pattern="*.h", dst="include", src=include_folder) - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/hedley/all/test_package/CMakeLists.txt b/recipes/hedley/all/test_package/CMakeLists.txt index d4fdee1a8a79c..6cccdaf4798b6 100644 --- a/recipes/hedley/all/test_package/CMakeLists.txt +++ b/recipes/hedley/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(hedley REQUIRED CONFIG) -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE hedley::hedley) diff --git a/recipes/hedley/all/test_package/conanfile.py b/recipes/hedley/all/test_package/conanfile.py index b3f8b8942bc21..0a6bc68712d90 100644 --- a/recipes/hedley/all/test_package/conanfile.py +++ b/recipes/hedley/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/hedley/all/test_package/example.cpp b/recipes/hedley/all/test_package/test_package.cpp similarity index 100% rename from recipes/hedley/all/test_package/example.cpp rename to recipes/hedley/all/test_package/test_package.cpp diff --git a/recipes/hedley/all/test_v1_package/CMakeLists.txt b/recipes/hedley/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/hedley/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/hedley/all/test_v1_package/conanfile.py b/recipes/hedley/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/hedley/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/hidapi/all/conandata.yml b/recipes/hidapi/all/conandata.yml index 51d6d194c4062..eac49619f91bb 100644 --- a/recipes/hidapi/all/conandata.yml +++ b/recipes/hidapi/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.13.1": + url: "https://github.com/libusb/hidapi/archive/hidapi-0.13.1.tar.gz" + sha256: "476a2c9a4dc7d1fc97dd223b84338dbea3809a84caea2dcd887d9778725490e3" "0.12.0": url: "https://github.com/libusb/hidapi/archive/hidapi-0.12.0.tar.gz" sha256: "28ec1451f0527ad40c1a4c92547966ffef96813528c8b184a665f03ecbb508bc" @@ -9,5 +12,5 @@ sources: url: "https://github.com/libusb/hidapi/archive/hidapi-0.11.0.tar.gz" sha256: "391d8e52f2d6a5cf76e2b0c079cfefe25497ba1d4659131297081fc0cd744632" "0.10.1": - url: "https://github.com/libusb/hidapi/archive/refs/tags/hidapi-0.10.1.tar.gz" + url: "https://github.com/libusb/hidapi/archive/hidapi-0.10.1.tar.gz" sha256: "f71dd8a1f46979c17ee521bc2117573872bbf040f8a4750e492271fc141f2644" diff --git a/recipes/hidapi/all/conanfile.py b/recipes/hidapi/all/conanfile.py index eaf53fb9ab72b..a4b59d357e36b 100644 --- a/recipes/hidapi/all/conanfile.py +++ b/recipes/hidapi/all/conanfile.py @@ -1,9 +1,15 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain +from conan.tools.scm import Version import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.54.0" class HidapiConan(ConanFile): @@ -25,87 +31,108 @@ class HidapiConan(ConanFile): "shared": False, } - generators = "pkg_config" - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self._is_msvc: + if is_msvc(self): self.options.shared = True def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.settings.os in ["Linux", "FreeBSD"]: - self.requires("libusb/1.0.24") + self.requires("libusb/1.0.26") def validate(self): - if self._is_msvc and not self.options.shared: + if is_msvc(self) and not self.options.shared: raise ConanInvalidConfiguration("Static libraries for Visual Studio are currently not available") def build_requirements(self): - if not self._is_msvc: - self.build_requires("libtool/2.4.6") + if not is_msvc(self): + self.tool_requires("libtool/2.4.7") + if self.settings.os in ["Linux", "FreeBSD"] and not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() + deps = PkgConfigDeps(self) + deps.generate() def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "configure.ac"), - "AC_CONFIG_MACRO_DIR", "dnl AC_CONFIG_MACRO_DIR") - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + replace_in_file(self, os.path.join(self.source_folder, "configure.ac"), + "AC_CONFIG_MACRO_DIR", "dnl AC_CONFIG_MACRO_DIR") def build(self): self._patch_sources() - if self._is_msvc: - self._build_msvc() + if is_msvc(self): + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + replace_in_file( + self, os.path.join(self.source_folder, "windows", "hidapi.vcxproj"), + "true", + "", + ) + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file( + self, os.path.join(self.source_folder, "windows", "hidapi.vcxproj"), + "", + f"", + ) + + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(self.source_folder, "windows", "hidapi.sln"), targets=["hidapi"]) else: - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # relocatable shared lib on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() - def _build_msvc(self): - msbuild = MSBuild(self) - msbuild.build(os.path.join(self._source_subfolder, "windows", "hidapi.sln"), - platforms={"x86": "Win32"}) - def package(self): - self.copy("LICENSE*", src=self._source_subfolder, dst="licenses") - if self.settings.os == "Windows": - self.copy(os.path.join("hidapi", "*.h"), dst="include", src=self._source_subfolder) - self.copy("*hidapi.lib", dst="lib", keep_path=False) - self.copy("*.dll", dst="bin", keep_path=False) + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + copy(self, os.path.join("hidapi", "*.h"), src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + output_folder = os.path.join(self.source_folder, "windows") + copy(self, "*hidapi.lib", src=output_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: @@ -120,4 +147,6 @@ def package_info(self): else: self.cpp_info.libs = ["hidapi"] if self.settings.os == "Macos": - self.cpp_info.frameworks.extend(["IOKit", "CoreFoundation", "Appkit"]) + self.cpp_info.frameworks.extend(["IOKit", "CoreFoundation", "AppKit"]) + if Version(self.version) == "0.10.1" and self.settings.os == "Windows": + self.cpp_info.system_libs = ["setupapi"] diff --git a/recipes/hidapi/all/test_package/CMakeLists.txt b/recipes/hidapi/all/test_package/CMakeLists.txt index be3a6a4e6aaa6..51fe04d5b6cce 100644 --- a/recipes/hidapi/all/test_package/CMakeLists.txt +++ b/recipes/hidapi/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(hidapi CONFIG REQUIRED) +find_package(hidapi REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} hidapi::hidapi) +target_link_libraries(${PROJECT_NAME} PRIVATE hidapi::hidapi) diff --git a/recipes/hidapi/all/test_package/conanfile.py b/recipes/hidapi/all/test_package/conanfile.py index 8d1ff488f0374..98ab55852ad56 100644 --- a/recipes/hidapi/all/test_package/conanfile.py +++ b/recipes/hidapi/all/test_package/conanfile.py @@ -1,19 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class HidapiTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/hidapi/all/test_v1_package/CMakeLists.txt b/recipes/hidapi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/hidapi/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/hidapi/all/test_v1_package/conanfile.py b/recipes/hidapi/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/hidapi/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/hidapi/config.yml b/recipes/hidapi/config.yml index 8ed4b3c67fc09..902a32ea98919 100644 --- a/recipes/hidapi/config.yml +++ b/recipes/hidapi/config.yml @@ -1,4 +1,6 @@ versions: + "0.13.1": + folder: all "0.12.0": folder: all "0.11.2": diff --git a/recipes/highfive/all/CMakeLists.txt b/recipes/highfive/all/CMakeLists.txt deleted file mode 100644 index 4d393c7a86c09..0000000000000 --- a/recipes/highfive/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory("source_subfolder") diff --git a/recipes/highfive/all/conandata.yml b/recipes/highfive/all/conandata.yml index ffa1bf1cb2884..22d7539389bd7 100644 --- a/recipes/highfive/all/conandata.yml +++ b/recipes/highfive/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.6.2": + url: "https://github.com/BlueBrain/HighFive/archive/refs/tags/v2.6.2.tar.gz" + sha256: "ab51b9fbb49e877dd1aa7b53b4b26875f41e4e0b8ee0fc2f1d735e0d1e43d708" + "2.5.1": + url: "https://github.com/BlueBrain/HighFive/archive/refs/tags/v2.5.1.tar.gz" + sha256: "1ba05aa31cdeda03d013094eebc10f932783e4e071e253e9eaa8889120f241c7" "2.4.1": url: "https://github.com/BlueBrain/HighFive/archive/refs/tags/v2.4.1.tar.gz" sha256: "6826471ef5c645ebf947d29574b302991525a8a8ff1ef687aba7311d9a0ea36f" diff --git a/recipes/highfive/all/conanfile.py b/recipes/highfive/all/conanfile.py index 7328169f3ba4c..c7a09023dd38c 100644 --- a/recipes/highfive/all/conanfile.py +++ b/recipes/highfive/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import CMake, ConanFile, tools -import os.path +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir, save +import os +import textwrap -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" class HighFiveConan(ConanFile): @@ -11,8 +15,7 @@ class HighFiveConan(ConanFile): topics = ("hdf5", "hdf", "data") homepage = "https://github.com/BlueBrain/HighFive" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt"] - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" options = { "with_boost": [True, False], @@ -24,75 +27,101 @@ class HighFiveConan(ConanFile): "with_boost": True, "with_eigen": True, "with_xtensor": True, - "with_opencv": True, + "with_opencv": False, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("hdf5/1.12.0") + self.requires("hdf5/1.14.0") if self.options.with_boost: - self.requires("boost/1.77.0") + self.requires("boost/1.81.0") if self.options.with_eigen: self.requires("eigen/3.4.0") if self.options.with_xtensor: - self.requires("xtensor/0.23.10") + self.requires("xtensor/0.24.2") if self.options.with_opencv: - self.requires("opencv/4.5.3") + self.requires("opencv/4.5.5") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def build(self): - tools.replace_in_file( - os.path.join(self._source_subfolder, "CMake", "HighFiveTargetDeps.cmake"), + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_BOOST"] = self.options.with_boost + tc.variables["USE_EIGEN"] = self.options.with_eigen + tc.variables["USE_XTENSOR"] = self.options.with_xtensor + tc.variables["USE_OPENCV"] = self.options.with_opencv + tc.variables["HIGHFIVE_UNIT_TESTS"] = False + tc.variables["HIGHFIVE_EXAMPLES"] = False + tc.variables["HIGHFIVE_BUILD_DOCS"] = False + tc.variables["HIGHFIVE_USE_INSTALL_DEPS"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + replace_in_file( + self, + os.path.join(self.source_folder, "CMake", "HighFiveTargetDeps.cmake"), "find_package(Eigen3 NO_MODULE)", "find_package(Eigen3 REQUIRED)", ) - tools.replace_in_file( - os.path.join(self._source_subfolder, "CMake", "HighFiveTargetDeps.cmake"), + replace_in_file( + self, + os.path.join(self.source_folder, "CMake", "HighFiveTargetDeps.cmake"), "EIGEN3_INCLUDE_DIRS", "Eigen3_INCLUDE_DIRS", ) - cmake = self._configure_cmake() + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USE_BOOST"] = self.options.with_boost - self._cmake.definitions["USE_EIGEN"] = self.options.with_eigen - self._cmake.definitions["USE_XTENSOR"] = self.options.with_xtensor - self._cmake.definitions["USE_OPENCV"] = self.options.with_opencv - self._cmake.definitions["HIGHFIVE_UNIT_TESTS"] = False - self._cmake.definitions["HIGHFIVE_EXAMPLES"] = False - self._cmake.definitions["HIGHFIVE_BUILD_DOCS"] = False - self._cmake.definitions["HIGHFIVE_USE_INSTALL_DEPS"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def package_id(self): - self.info.header_only() - def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) + + # TODO: to remove in conan v2 once legacy generators removed + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {"HighFive": "HighFive::HighFive"}, + ) + + def _create_cmake_module_alias_targets(self, module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent(f"""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): - self.cpp_info.names["cmake_find_package"] = "HighFive" - self.cpp_info.names["cmake_find_package_multi"] = "HighFive" + self.cpp_info.set_property("cmake_file_name", "HighFive") + self.cpp_info.set_property("cmake_target_name", "HighFive") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] self.cpp_info.requires = ["hdf5::hdf5"] if self.options.with_boost: self.cpp_info.requires.append("boost::headers") @@ -102,3 +131,9 @@ def package_info(self): self.cpp_info.requires.append("xtensor::xtensor") if self.options.with_opencv: self.cpp_info.requires.append("opencv::opencv") + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.names["cmake_find_package"] = "HighFive" + self.cpp_info.names["cmake_find_package_multi"] = "HighFive" + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/highfive/all/test_package/CMakeLists.txt b/recipes/highfive/all/test_package/CMakeLists.txt index 49b6d7a88fe87..9094d8eb2cd6d 100644 --- a/recipes/highfive/all/test_package/CMakeLists.txt +++ b/recipes/highfive/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.1) - +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 11) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) -find_package(HighFive 2.3 REQUIRED) +find_package(HighFive REQUIRED CONFIG) add_executable(test_package test_package.cpp) -target_link_libraries(test_package HighFive::HighFive) +target_link_libraries(test_package PRIVATE HighFive) +target_compile_features(test_package PRIVATE cxx_std_11) diff --git a/recipes/highfive/all/test_package/conanfile.py b/recipes/highfive/all/test_package/conanfile.py index 817752e58b49a..0a6bc68712d90 100644 --- a/recipes/highfive/all/test_package/conanfile.py +++ b/recipes/highfive/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import CMake, ConanFile, tools -import os.path +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os -class HighFiveTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/highfive/all/test_v1_package/CMakeLists.txt b/recipes/highfive/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..671f071b8ed9f --- /dev/null +++ b/recipes/highfive/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(HighFive REQUIRED CONFIG) + +add_executable(test_package ../test_package/test_package.cpp) +target_link_libraries(test_package PRIVATE HighFive) +target_compile_features(test_package PRIVATE cxx_std_11) diff --git a/recipes/highfive/all/test_v1_package/conanfile.py b/recipes/highfive/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4453fcd822f20 --- /dev/null +++ b/recipes/highfive/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import CMake, ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/highfive/config.yml b/recipes/highfive/config.yml index 76fc6c1b1397d..68e95d416e0fd 100644 --- a/recipes/highfive/config.yml +++ b/recipes/highfive/config.yml @@ -1,4 +1,8 @@ versions: + "2.6.2": + folder: all + "2.5.1": + folder: all "2.4.1": folder: all "2.3.1": diff --git a/recipes/highs/all/conandata.yml b/recipes/highs/all/conandata.yml new file mode 100644 index 0000000000000..03938c9f3bdf9 --- /dev/null +++ b/recipes/highs/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "1.4.2": + url: "https://github.com/ERGO-Code/HiGHS/archive/refs/tags/v1.4.2.tar.gz" + sha256: "29330e284491143cd53a547c23178221df46423679a98f6684251e65cc384d2b" +patches: + "1.4.2": + - patch_file: "patches/0001-missing-includes-msvc15-1.4.2.patch" + patch_description: "Add missing includes for std::tolower and std::max in MSVC15" + patch_type: portability + patch_source: "https://github.com/ERGO-Code/HiGHS/pull/1152" diff --git a/recipes/highs/all/conanfile.py b/recipes/highs/all/conanfile.py new file mode 100644 index 0000000000000..0873a3aeb59f0 --- /dev/null +++ b/recipes/highs/all/conanfile.py @@ -0,0 +1,88 @@ +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc +from os.path import join + +required_conan_version = ">=1.53.0" + + +class HiGHSConan(ConanFile): + name = "highs" + description = "high performance serial and parallel solver for large scale sparse linear optimization problems" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.highs.dev/" + topics = ("simplex", "interior point", "solver", "linear", "programming") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def validate(self): + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared on Visual Studio and msvc.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def requirements(self): + self.requires("zlib/1.2.13") + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SHARED"] = self.options.shared + tc.variables["BUILD_TESTING"] = False + tc.variables["PYTHON"] = False + tc.variables["FORTRAN"] = False + tc.variables["CSHARP"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build(target="libhighs") + + def package(self): + copy(self, pattern="LICENSE", src=self.source_folder, dst=join(self.package_folder, "licenses")) + copy(self, pattern="*.h", src=join(self.source_folder, "src"), dst=join(self.package_folder, "include")) + copy(self, pattern="HConfig.h", src=self.build_folder, dst=join(self.package_folder, "include")) + if self.options.shared: + copy(self, pattern="*.so*", src=join(self.build_folder, "lib"), dst=join(self.package_folder, "lib")) + copy(self, pattern="*.dylib*", src=join(self.build_folder, "lib"), dst=join(self.package_folder, "lib")) + else: + copy(self, pattern="*.a", src=join(self.build_folder, "lib"), dst=join(self.package_folder, "lib")) + copy(self, pattern="*.lib", src=join(self.build_folder, "lib"), dst=join(self.package_folder, "lib"), keep_path=False) + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.libs = collect_libs(self) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("pthread") + if is_msvc(self): + self.cpp_info.defines.append("_ITERATOR_DEBUG_LEVEL=0") diff --git a/recipes/highs/all/patches/0001-missing-includes-msvc15-1.4.2.patch b/recipes/highs/all/patches/0001-missing-includes-msvc15-1.4.2.patch new file mode 100644 index 0000000000000..83c7f865fb734 --- /dev/null +++ b/recipes/highs/all/patches/0001-missing-includes-msvc15-1.4.2.patch @@ -0,0 +1,48 @@ +diff --git a/extern/filereaderlp/reader.cpp b/extern/filereaderlp/reader.cpp +index 86151120..71f6747a 100644 +--- a/extern/filereaderlp/reader.cpp ++++ b/extern/filereaderlp/reader.cpp +@@ -2,6 +2,7 @@ + + #include "builder.hpp" + ++#include + #include + #include + #include +diff --git a/src/lp_data/HighsOptions.cpp b/src/lp_data/HighsOptions.cpp +index 903a7c71..6e66e78e 100644 +--- a/src/lp_data/HighsOptions.cpp ++++ b/src/lp_data/HighsOptions.cpp +@@ -17,6 +17,7 @@ + + #include + #include ++#include + + // void setLogOptions(); + +diff --git a/src/presolve/ICrash.cpp b/src/presolve/ICrash.cpp +index 12a6fc3f..e7bf86a4 100644 +--- a/src/presolve/ICrash.cpp ++++ b/src/presolve/ICrash.cpp +@@ -14,6 +14,7 @@ + #include "presolve/ICrash.h" + + #include ++#include + #include + #include + #include +diff --git a/src/util/HighsTimer.h b/src/util/HighsTimer.h +index 6f1d3047..cabef8c4 100644 +--- a/src/util/HighsTimer.h ++++ b/src/util/HighsTimer.h +@@ -16,6 +16,7 @@ + #ifndef UTIL_HIGHSTIMER_H_ + #define UTIL_HIGHSTIMER_H_ + ++#include + #include + #include + #include diff --git a/recipes/highs/all/test_package/CMakeLists.txt b/recipes/highs/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d953c847e1679 --- /dev/null +++ b/recipes/highs/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) +set(CMAKE_CXX_STANDARD 11) + +find_package(highs REQUIRED CONFIG) +add_executable(${PROJECT_NAME} main.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE highs::highs) diff --git a/recipes/highs/all/test_package/conanfile.py b/recipes/highs/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8a5bb47f50c4c --- /dev/null +++ b/recipes/highs/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/highs/all/test_package/main.cpp b/recipes/highs/all/test_package/main.cpp new file mode 100644 index 0000000000000..e4dc6f7ec78d9 --- /dev/null +++ b/recipes/highs/all/test_package/main.cpp @@ -0,0 +1,164 @@ +// HiGHS is designed to solve linear optimization problems of the form +// +// Min (1/2)x^TQx + c^Tx + d subject to L <= Ax <= U; l <= x <= u +// +// where A is a matrix with m rows and n columns, and Q is either zero +// or positive definite. If Q is zero, HiGHS can determine the optimal +// integer-valued solution. +// +// The scalar n is num_col_ +// The scalar m is num_row_ +// +// The vector c is col_cost_ +// The scalar d is offset_ +// The vector l is col_lower_ +// The vector u is col_upper_ +// The vector L is row_lower_ +// The vector U is row_upper_ +// +// The matrix A is represented in packed vector form, either +// row-wise or column-wise: only its nonzeros are stored +// +// * The number of nonzeros in A is num_nz +// +// * The indices of the nonnzeros in the vectors of A are stored in a_index +// +// * The values of the nonnzeros in the vectors of A are stored in a_value +// +// * The position in a_index/a_value of the index/value of the first +// nonzero in each vector is stored in a_start +// +// Note that a_start[0] must be zero +// +// The matrix Q is represented in packed column form +// +// * The dimension of Q is dim_ +// +// * The number of nonzeros in Q is hessian_num_nz +// +// * The indices of the nonnzeros in the vectors of A are stored in q_index +// +// * The values of the nonnzeros in the vectors of A are stored in q_value +// +// * The position in q_index/q_value of the index/value of the first +// nonzero in each column is stored in q_start +// +// Note +// +// * By default, Q is zero. This is indicated by dim_ being initialised to zero. +// +// * q_start[0] must be zero +// +#include "Highs.h" +#include + +using std::cout; +using std::endl; + +int main() { + // Create and populate a HighsModel instance for the LP + // + // Min f = x_0 + x_1 + 3 + // s.t. x_1 <= 7 + // 5 <= x_0 + 2x_1 <= 15 + // 6 <= 3x_0 + 2x_1 + // 0 <= x_0 <= 4; 1 <= x_1 + // + // Although the first constraint could be expressed as an upper + // bound on x_1, it serves to illustrate a non-trivial packed + // column-wise matrix. + // + HighsModel model; + model.lp_.num_col_ = 2; + model.lp_.num_row_ = 3; + model.lp_.sense_ = ObjSense::kMinimize; + model.lp_.offset_ = 3; + model.lp_.col_cost_ = {1.0, 1.0}; + model.lp_.col_lower_ = {0.0, 1.0}; + model.lp_.col_upper_ = {4.0, 1.0e30}; + model.lp_.row_lower_ = {-1.0e30, 5.0, 6.0}; + model.lp_.row_upper_ = {7.0, 15.0, 1.0e30}; + // + // Here the orientation of the matrix is column-wise + model.lp_.a_matrix_.format_ = MatrixFormat::kColwise; + // a_start_ has num_col_1 entries, and the last entry is the number + // of nonzeros in A, allowing the number of nonzeros in the last + // column to be defined + model.lp_.a_matrix_.start_ = {0, 2, 5}; + model.lp_.a_matrix_.index_ = {1, 2, 0, 1, 2}; + model.lp_.a_matrix_.value_ = {1.0, 3.0, 1.0, 2.0, 2.0}; + // + // Create a Highs instance + Highs highs; + HighsStatus return_status; + // + // Pass the model to HiGHS + return_status = highs.passModel(model); + assert(return_status==HighsStatus::kOk); + // + // Get a const reference to the LP data in HiGHS + const HighsLp& lp = highs.getLp(); + // + // Solve the model + return_status = highs.run(); + assert(return_status==HighsStatus::kOk); + // + // Get the model status + const HighsModelStatus& model_status = highs.getModelStatus(); + assert(model_status==HighsModelStatus::kOptimal); + cout << "Model status: " << highs.modelStatusToString(model_status) << endl; + // + // Get the solution information + const HighsInfo& info = highs.getInfo(); + cout << "Simplex iteration count: " << info.simplex_iteration_count << endl; + cout << "Objective function value: " << info.objective_function_value << endl; + cout << "Primal solution status: " << highs.solutionStatusToString(info.primal_solution_status) << endl; + cout << "Dual solution status: " << highs.solutionStatusToString(info.dual_solution_status) << endl; + cout << "Basis: " << highs.basisValidityToString(info.basis_validity) << endl; + const bool has_values = info.primal_solution_status; + const bool has_duals = info.dual_solution_status; + const bool has_basis = info.basis_validity; + // + // Get the solution values and basis + const HighsSolution& solution = highs.getSolution(); + const HighsBasis& basis = highs.getBasis(); + // + // Report the primal and solution values and basis + for (int col=0; col < lp.num_col_; col++) { + cout << "Column " << col; + if (has_values) cout << "; value = " << solution.col_value[col]; + if (has_duals) cout << "; dual = " << solution.col_dual[col]; + if (has_basis) cout << "; status: " << highs.basisStatusToString(basis.col_status[col]); + cout << endl; + } + for (int row=0; row < lp.num_row_; row++) { + cout << "Row " << row; + if (has_values) cout << "; value = " << solution.row_value[row]; + if (has_duals) cout << "; dual = " << solution.row_dual[row]; + if (has_basis) cout << "; status: " << highs.basisStatusToString(basis.row_status[row]); + cout << endl; + } + + // Now indicate that all the variables must take integer values + model.lp_.integrality_.resize(lp.num_col_); + for (int col=0; col < lp.num_col_; col++) + model.lp_.integrality_[col] = HighsVarType::kInteger; + + highs.passModel(model); + // Solve the model + return_status = highs.run(); + assert(return_status==HighsStatus::kOk); + // Report the primal solution values + for (int col=0; col < lp.num_col_; col++) { + cout << "Column " << col; + if (info.primal_solution_status) cout << "; value = " << solution.col_value[col]; + cout << endl; + } + for (int row=0; row < lp.num_row_; row++) { + cout << "Row " << row; + if (info.primal_solution_status) cout << "; value = " << solution.row_value[row]; + cout << endl; + } + + return 0; +} diff --git a/recipes/highs/all/test_v1_package/CMakeLists.txt b/recipes/highs/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..36b48f96d1078 --- /dev/null +++ b/recipes/highs/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) +set(CMAKE_CXX_STANDARD 11) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/highs/all/test_v1_package/conanfile.py b/recipes/highs/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/highs/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/highs/config.yml b/recipes/highs/config.yml new file mode 100644 index 0000000000000..ba127d382373b --- /dev/null +++ b/recipes/highs/config.yml @@ -0,0 +1,3 @@ +versions: + "1.4.2": + folder: all diff --git a/recipes/highway/all/CMakeLists.txt b/recipes/highway/all/CMakeLists.txt deleted file mode 100644 index 07ec7f05275cb..0000000000000 --- a/recipes/highway/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/highway/all/conandata.yml b/recipes/highway/all/conandata.yml index 143cf0ab290eb..ae12819eb44d8 100644 --- a/recipes/highway/all/conandata.yml +++ b/recipes/highway/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.0.3": + url: "https://github.com/google/highway/archive/1.0.3.tar.gz" + sha256: "566fc77315878473d9a6bd815f7de78c73734acdcb745c3dde8579560ac5440e" + "1.0.2": + url: "https://github.com/google/highway/archive/1.0.2.tar.gz" + sha256: "e8ef71236ac0d97f12d553ec1ffc5b6375d57b5f0b860c7447dd69b6ed1072db" + "1.0.1": + url: "https://github.com/google/highway/archive/1.0.1.tar.gz" + sha256: "7ca6af7dc2e3e054de9e17b9dfd88609a7fd202812b1c216f43cc41647c97311" "1.0.0": url: "https://github.com/google/highway/archive/1.0.0.tar.gz" sha256: "ab4f5f864932268356f9f6aa86f612fa4430a7db3c8de0391076750197e876b8" @@ -17,7 +26,9 @@ sources: patches: "0.16.0": - patch_file: "patches/0.16.0-0001-fix-sys-random-h.patch" - base_path: "source_subfolder" + patch_description: "fix including sys/random.h on several environments" + patch_type: "portability" "0.11.1": - patch_file: "patches/0.11.1-0001-remove-contrib.patch" - base_path: "source_subfolder" + patch_description: "remove contrib sources" + patch_type: "portability" diff --git a/recipes/highway/all/conanfile.py b/recipes/highway/all/conanfile.py index 2772a3559d563..b77f950fd33e1 100644 --- a/recipes/highway/all/conanfile.py +++ b/recipes/highway/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.scm import Version import os -import functools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" + class HighwayConan(ConanFile): name = "highway" @@ -22,11 +26,6 @@ class HighwayConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _minimum_cpp_standard(self): @@ -36,81 +35,84 @@ def _minimum_cpp_standard(self): def _minimum_compilers_version(self): return { "Visual Studio": "16", + "msvc": "192", "gcc": "8", "clang": "7", } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if tools.Version(self.version) < "0.16.0": + if Version(self.version) < "0.16.0": del self.options.shared elif self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) - minimum_version = self._minimum_compilers_version.get( - str(self.settings.compiler)) - if not minimum_version: - self.output.warn( - "{} recipe lacks information about the {} compiler support." - .format(self.name, self.settings.compiler)) - elif tools.Version(self.settings.compiler.version) < minimum_version: + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._minimum_compilers_version.get(str(self.info.settings.compiler)) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - "{} requires a {} version >= {}" - .format(self.name, self.settings.compiler, - self.settings.compiler.version)) + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["HWY_ENABLE_EXAMPLES"] = False + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # Honor fPIC option - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakelists, - "set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)", "") - tools.replace_in_file(cmakelists, - "set_property(TARGET hwy PROPERTY " - "POSITION_INDEPENDENT_CODE ON)", "") - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = False - cmake.definitions["HWY_ENABLE_EXAMPLES"] = False - cmake.configure() - return cmake + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)", "") + replace_in_file(self, cmakelists, + "set_property(TARGET hwy PROPERTY POSITION_INDEPENDENT_CODE ON)", + "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.names["pkg_config"] = "libhwy" - - self.cpp_info.libs = ["hwy"] - if tools.Version(self.version) >= "0.12.1": - self.cpp_info.libs.append("hwy_contrib") - if tools.Version(self.version) >= "0.15.0": - self.cpp_info.libs.append("hwy_test") - if tools.Version(self.version) >= "0.16.0": - self.cpp_info.defines.append("HWY_SHARED_DEFINE" if self.options.shared else "HWY_STATIC_DEFINE") + self.cpp_info.components["hwy"].set_property("pkg_config_name", "libhwy") + self.cpp_info.components["hwy"].libs = ["hwy"] + if Version(self.version) >= "0.16.0": + self.cpp_info.components["hwy"].defines.append( + "HWY_SHARED_DEFINE" if self.options.shared else "HWY_STATIC_DEFINE" + ) + if Version(self.version) >= "0.12.1": + self.cpp_info.components["hwy_contrib"].set_property("pkg_config_name", "libhwy-contrib") + self.cpp_info.components["hwy_contrib"].libs = ["hwy_contrib"] + self.cpp_info.components["hwy_contrib"].requires = ["hwy"] + if Version(self.version) >= "0.15.0": + self.cpp_info.components["hwy_test"].set_property("pkg_config_name", "libhwy-test") + self.cpp_info.components["hwy_test"].libs = ["hwy_test"] + self.cpp_info.components["hwy_test"].requires = ["hwy"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/highway/all/test_package/CMakeLists.txt b/recipes/highway/all/test_package/CMakeLists.txt index bc7732ea3ac58..06e1e8678e6bd 100644 --- a/recipes/highway/all/test_package/CMakeLists.txt +++ b/recipes/highway/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(highway REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} highway::highway) +target_link_libraries(${PROJECT_NAME} PRIVATE highway::highway) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/highway/all/test_package/conanfile.py b/recipes/highway/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/highway/all/test_package/conanfile.py +++ b/recipes/highway/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/highway/all/test_v1_package/CMakeLists.txt b/recipes/highway/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/highway/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/highway/all/test_v1_package/conanfile.py b/recipes/highway/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/highway/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/highway/config.yml b/recipes/highway/config.yml index db7479c93d942..08286722329d4 100644 --- a/recipes/highway/config.yml +++ b/recipes/highway/config.yml @@ -1,4 +1,10 @@ versions: + "1.0.3": + folder: all + "1.0.2": + folder: all + "1.0.1": + folder: all "1.0.0": folder: all "0.17.0": diff --git a/recipes/hiredis/all/CMakeLists.txt b/recipes/hiredis/all/CMakeLists.txt deleted file mode 100644 index c921d02a0d877..0000000000000 --- a/recipes/hiredis/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/hiredis/all/conandata.yml b/recipes/hiredis/all/conandata.yml index 8b8b073d7f542..2063383701218 100644 --- a/recipes/hiredis/all/conandata.yml +++ b/recipes/hiredis/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.0": + url: "https://github.com/redis/hiredis/archive/v1.1.0.tar.gz" + sha256: "fe6d21741ec7f3fc9df409d921f47dfc73a4d8ff64f4ac6f1d95f951bf7f53d6" "1.0.2": url: "https://github.com/redis/hiredis/archive/v1.0.2.tar.gz" sha256: "e0ab696e2f07deb4252dda45b703d09854e53b9703c7d52182ce5a22616c3819" @@ -6,11 +9,21 @@ sources: url: "https://github.com/redis/hiredis/archive/v1.0.0.tar.gz" sha256: "2a0b5fe5119ec973a0c1966bfc4bd7ed39dbce1cb6d749064af9121fe971936f" patches: + "1.1.0": + - patch_file: "patches/0001-fix-cmake-1.1.0.patch" + patch_description: "divide static/shared build, fix openssl link name" + patch_type: "conan" + - patch_file: "patches/0002-fix-aix.patch" + patch_description: "support AIX build" + patch_type: "portability" "1.0.2": - - patch_file: "patches/fix-cmake.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-aix.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-cmake-1.0.0.patch" + patch_description: "enable static/shared build, fix openssl link name" + patch_type: "conan" + - patch_file: "patches/0002-fix-aix.patch" + patch_description: "support AIX build" + patch_type: "portability" "1.0.0": - - patch_file: "patches/fix-cmake.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-cmake-1.0.0.patch" + patch_description: "enable static/shared build, fix openssl link name" + patch_type: "conan" diff --git a/recipes/hiredis/all/conanfile.py b/recipes/hiredis/all/conanfile.py index 78e734d78b42b..f2c8517046b99 100644 --- a/recipes/hiredis/all/conanfile.py +++ b/recipes/hiredis/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, replace_in_file +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class HiredisConan(ConanFile): @@ -24,21 +28,8 @@ class HiredisConan(ConanFile): "with_ssl": False, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -46,50 +37,70 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_ssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_SSL"] = self.options.with_ssl + tc.variables["DISABLE_TESTS"] = True + tc.variables["ENABLE_EXAMPLES"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_SSL"] = self.options.with_ssl - self._cmake.definitions["DISABLE_TESTS"] = True - self._cmake.definitions["ENABLE_EXAMPLES"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "build")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "hiredis") + suffix = "" + if Version(self.version) >= "1.1.0": + if is_msvc(self) and not self.options.shared: + suffix += "_static" + if self.settings.build_type == "Debug": + suffix += "d" + # hiredis self.cpp_info.components["hiredislib"].set_property("cmake_target_name", "hiredis::hiredis") self.cpp_info.components["hiredislib"].set_property("pkg_config_name", "hiredis") self.cpp_info.components["hiredislib"].names["cmake_find_package"] = "hiredis" self.cpp_info.components["hiredislib"].names["cmake_find_package_multi"] = "hiredis" - self.cpp_info.components["hiredislib"].libs = ["hiredis"] + self.cpp_info.components["hiredislib"].libs = [f"hiredis{suffix}"] if self.settings.os == "Windows": self.cpp_info.components["hiredislib"].system_libs = ["ws2_32"] # hiredis_ssl @@ -98,7 +109,7 @@ def package_info(self): self.cpp_info.components["hiredis_ssl"].set_property("pkg_config_name", "hiredis_ssl") self.cpp_info.components["hiredis_ssl"].names["cmake_find_package"] = "hiredis_ssl" self.cpp_info.components["hiredis_ssl"].names["cmake_find_package_multi"] = "hiredis_ssl" - self.cpp_info.components["hiredis_ssl"].libs = ["hiredis_ssl"] + self.cpp_info.components["hiredis_ssl"].libs = [f"hiredis_ssl{suffix}"] self.cpp_info.components["hiredis_ssl"].requires = ["openssl::ssl"] if self.settings.os == "Windows": self.cpp_info.components["hiredis_ssl"].requires.append("hiredislib") diff --git a/recipes/hiredis/all/patches/0001-fix-cmake-1.0.0.patch b/recipes/hiredis/all/patches/0001-fix-cmake-1.0.0.patch new file mode 100644 index 0000000000000..630a4c0250233 --- /dev/null +++ b/recipes/hiredis/all/patches/0001-fix-cmake-1.0.0.patch @@ -0,0 +1,40 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,6 +1,6 @@ +-CMAKE_MINIMUM_REQUIRED(VERSION 3.4.0) +-INCLUDE(GNUInstallDirs) ++CMAKE_MINIMUM_REQUIRED(VERSION 3.8) + PROJECT(hiredis) ++INCLUDE(GNUInstallDirs) + + OPTION(ENABLE_SSL "Build hiredis_ssl for SSL support" OFF) + OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF) +@@ -40,7 +40,8 @@ IF(WIN32) + ADD_COMPILE_DEFINITIONS(_CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN) + ENDIF() + +-ADD_LIBRARY(hiredis SHARED ${hiredis_sources}) ++ADD_LIBRARY(hiredis ${hiredis_sources}) ++target_compile_features(hiredis PUBLIC c_std_99) + + SET_TARGET_PROPERTIES(hiredis + PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE +@@ -97,7 +98,7 @@ IF(ENABLE_SSL) + FIND_PACKAGE(OpenSSL REQUIRED) + SET(hiredis_ssl_sources + ssl.c) +- ADD_LIBRARY(hiredis_ssl SHARED ++ ADD_LIBRARY(hiredis_ssl + ${hiredis_ssl_sources}) + + IF (APPLE) +@@ -109,8 +110,7 @@ IF(ENABLE_SSL) + WINDOWS_EXPORT_ALL_SYMBOLS TRUE + VERSION "${HIREDIS_SONAME}") + +- TARGET_INCLUDE_DIRECTORIES(hiredis_ssl PRIVATE "${OPENSSL_INCLUDE_DIR}") +- TARGET_LINK_LIBRARIES(hiredis_ssl PRIVATE ${OPENSSL_LIBRARIES}) ++ TARGET_LINK_LIBRARIES(hiredis_ssl PRIVATE OpenSSL::SSL) + IF (WIN32 OR MINGW) + TARGET_LINK_LIBRARIES(hiredis_ssl PRIVATE hiredis) + ENDIF() diff --git a/recipes/hiredis/all/patches/0001-fix-cmake-1.1.0.patch b/recipes/hiredis/all/patches/0001-fix-cmake-1.1.0.patch new file mode 100644 index 0000000000000..02e57dfa04bfa --- /dev/null +++ b/recipes/hiredis/all/patches/0001-fix-cmake-1.1.0.patch @@ -0,0 +1,219 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3d52d0c..59f9e7a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,9 +1,5 @@ + CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0) + +-OPTION(ENABLE_SSL "Build hiredis_ssl for SSL support" OFF) +-OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF) +-OPTION(ENABLE_SSL_TESTS "Should we test SSL connections" OFF) +-OPTION(ENABLE_ASYNC_TESTS "Should we run all asynchronous API tests" OFF) + + MACRO(getVersionBit name) + SET(VERSION_REGEX "^#define ${name} (.+)$") +@@ -22,6 +18,11 @@ MESSAGE("Detected version: ${VERSION}") + PROJECT(hiredis LANGUAGES "C" VERSION "${VERSION}") + INCLUDE(GNUInstallDirs) + ++OPTION(ENABLE_SSL "Build hiredis_ssl for SSL support" OFF) ++OPTION(DISABLE_TESTS "If tests should be compiled or not" OFF) ++OPTION(ENABLE_SSL_TESTS "Should we test SSL connections" OFF) ++OPTION(ENABLE_ASYNC_TESTS "Should we run all asynchronous API tests" OFF) ++ + # Hiredis requires C99 + SET(CMAKE_C_STANDARD 99) + SET(CMAKE_POSITION_INDEPENDENT_CODE ON) +@@ -44,36 +45,45 @@ IF(WIN32) + ADD_DEFINITIONS(-D_CRT_SECURE_NO_WARNINGS -DWIN32_LEAN_AND_MEAN) + ENDIF() + +-ADD_LIBRARY(hiredis SHARED ${hiredis_sources}) +-ADD_LIBRARY(hiredis_static STATIC ${hiredis_sources}) +-ADD_LIBRARY(hiredis::hiredis ALIAS hiredis) +-ADD_LIBRARY(hiredis::hiredis_static ALIAS hiredis_static) ++if(BUILD_SHARED_LIBS) ++ ADD_LIBRARY(hiredis SHARED ${hiredis_sources}) ++ ADD_LIBRARY(hiredis::hiredis ALIAS hiredis) ++ SET_TARGET_PROPERTIES(hiredis ++ PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE ++ VERSION "${HIREDIS_SONAME}") + +-IF(NOT MSVC) +- SET_TARGET_PROPERTIES(hiredis_static +- PROPERTIES OUTPUT_NAME hiredis) +-ENDIF() ++ IF(WIN32 OR MINGW) ++ TARGET_LINK_LIBRARIES(hiredis PUBLIC ws2_32 crypt32) ++ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") ++ TARGET_LINK_LIBRARIES(hiredis PUBLIC m) ++ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS") ++ TARGET_LINK_LIBRARIES(hiredis PUBLIC socket) ++ ENDIF() + +-SET_TARGET_PROPERTIES(hiredis +- PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE +- VERSION "${HIREDIS_SONAME}") +-IF(MSVC) +- SET_TARGET_PROPERTIES(hiredis_static +- PROPERTIES COMPILE_FLAGS /Z7) +-ENDIF() +-IF(WIN32 OR MINGW) +- TARGET_LINK_LIBRARIES(hiredis PUBLIC ws2_32 crypt32) +- TARGET_LINK_LIBRARIES(hiredis_static PUBLIC ws2_32 crypt32) +-ELSEIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") +- TARGET_LINK_LIBRARIES(hiredis PUBLIC m) +- TARGET_LINK_LIBRARIES(hiredis_static PUBLIC m) +-ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS") +- TARGET_LINK_LIBRARIES(hiredis PUBLIC socket) +- TARGET_LINK_LIBRARIES(hiredis_static PUBLIC socket) +-ENDIF() ++ TARGET_INCLUDE_DIRECTORIES(hiredis PUBLIC $ $) ++else() ++ ADD_LIBRARY(hiredis_static STATIC ${hiredis_sources}) ++ ADD_LIBRARY(hiredis::hiredis_static ALIAS hiredis_static) ++ ++ IF(NOT MSVC) ++ SET_TARGET_PROPERTIES(hiredis_static ++ PROPERTIES OUTPUT_NAME hiredis) ++ ENDIF() ++ IF(MSVC) ++ SET_TARGET_PROPERTIES(hiredis_static ++ PROPERTIES COMPILE_FLAGS /Z7) ++ ENDIF() + +-TARGET_INCLUDE_DIRECTORIES(hiredis PUBLIC $ $) +-TARGET_INCLUDE_DIRECTORIES(hiredis_static PUBLIC $ $) ++ IF(WIN32 OR MINGW) ++ TARGET_LINK_LIBRARIES(hiredis_static PUBLIC ws2_32 crypt32) ++ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") ++ TARGET_LINK_LIBRARIES(hiredis_static PUBLIC m) ++ ELSEIF(CMAKE_SYSTEM_NAME MATCHES "SunOS") ++ TARGET_LINK_LIBRARIES(hiredis_static PUBLIC socket) ++ ENDIF() ++ ++ TARGET_INCLUDE_DIRECTORIES(hiredis_static PUBLIC $ $) ++endif() + + CONFIGURE_FILE(hiredis.pc.in hiredis.pc @ONLY) + +@@ -103,13 +113,21 @@ set(CPACK_RPM_PACKAGE_AUTOREQPROV ON) + + include(CPack) + +-INSTALL(TARGETS hiredis hiredis_static +- EXPORT hiredis-targets +- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++if(BUILD_SHARED_LIBS) ++ INSTALL(TARGETS hiredis ++ EXPORT hiredis-targets ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++else() ++ INSTALL(TARGETS hiredis_static ++ EXPORT hiredis-targets ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++endif() + +-if (MSVC) ++if (0) + INSTALL(FILES $ + DESTINATION ${CMAKE_INSTALL_BINDIR} + CONFIGURATIONS Debug RelWithDebInfo) +@@ -161,45 +179,57 @@ IF(ENABLE_SSL) + FIND_PACKAGE(OpenSSL REQUIRED) + SET(hiredis_ssl_sources + ssl.c) +- ADD_LIBRARY(hiredis_ssl SHARED +- ${hiredis_ssl_sources}) +- ADD_LIBRARY(hiredis_ssl_static STATIC +- ${hiredis_ssl_sources}) +- IF(NOT MSVC) +- SET_TARGET_PROPERTIES(hiredis_ssl_static +- PROPERTIES OUTPUT_NAME hiredis_ssl) +- ENDIF() +- +- IF (APPLE) +- SET_PROPERTY(TARGET hiredis_ssl PROPERTY LINK_FLAGS "-Wl,-undefined -Wl,dynamic_lookup") +- ENDIF() + +- SET_TARGET_PROPERTIES(hiredis_ssl +- PROPERTIES +- WINDOWS_EXPORT_ALL_SYMBOLS TRUE +- VERSION "${HIREDIS_SONAME}") +- IF(MSVC) +- SET_TARGET_PROPERTIES(hiredis_ssl_static +- PROPERTIES COMPILE_FLAGS /Z7) +- ENDIF() +- +- TARGET_INCLUDE_DIRECTORIES(hiredis_ssl PRIVATE "${OPENSSL_INCLUDE_DIR}") +- TARGET_INCLUDE_DIRECTORIES(hiredis_ssl_static PRIVATE "${OPENSSL_INCLUDE_DIR}") ++ if(BUILD_SHARED_LIBS) ++ ADD_LIBRARY(hiredis_ssl SHARED ++ ${hiredis_ssl_sources}) ++ IF (APPLE) ++ SET_PROPERTY(TARGET hiredis_ssl PROPERTY LINK_FLAGS "-Wl,-undefined -Wl,dynamic_lookup") ++ ENDIF() ++ SET_TARGET_PROPERTIES(hiredis_ssl ++ PROPERTIES ++ WINDOWS_EXPORT_ALL_SYMBOLS TRUE ++ VERSION "${HIREDIS_SONAME}") ++ TARGET_INCLUDE_DIRECTORIES(hiredis_ssl PRIVATE "${OPENSSL_INCLUDE_DIR}") ++ TARGET_LINK_LIBRARIES(hiredis_ssl PRIVATE OpenSSL::SSL) ++ ++ IF (WIN32 OR MINGW) ++ TARGET_LINK_LIBRARIES(hiredis_ssl PRIVATE hiredis) ++ ENDIF() ++ else() ++ ADD_LIBRARY(hiredis_ssl_static STATIC ++ ${hiredis_ssl_sources}) ++ IF(NOT MSVC) ++ SET_TARGET_PROPERTIES(hiredis_ssl_static ++ PROPERTIES OUTPUT_NAME hiredis_ssl) ++ ENDIF() ++ IF(MSVC) ++ SET_TARGET_PROPERTIES(hiredis_ssl_static ++ PROPERTIES COMPILE_FLAGS /Z7) ++ ENDIF() ++ TARGET_INCLUDE_DIRECTORIES(hiredis_ssl_static PRIVATE "${OPENSSL_INCLUDE_DIR}") ++ IF (WIN32 OR MINGW) ++ TARGET_LINK_LIBRARIES(hiredis_ssl_static PUBLIC hiredis_static) ++ ENDIF() ++ endif() + +- TARGET_LINK_LIBRARIES(hiredis_ssl PRIVATE ${OPENSSL_LIBRARIES}) +- IF (WIN32 OR MINGW) +- TARGET_LINK_LIBRARIES(hiredis_ssl PRIVATE hiredis) +- TARGET_LINK_LIBRARIES(hiredis_ssl_static PUBLIC hiredis_static) +- ENDIF() + CONFIGURE_FILE(hiredis_ssl.pc.in hiredis_ssl.pc @ONLY) + +- INSTALL(TARGETS hiredis_ssl hiredis_ssl_static +- EXPORT hiredis_ssl-targets +- RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +- LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ if(BUILD_SHARED_LIBS) ++ INSTALL(TARGETS hiredis_ssl ++ EXPORT hiredis_ssl-targets ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ else() ++ INSTALL(TARGETS hiredis_ssl_static ++ EXPORT hiredis_ssl-targets ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ endif() + +- if (MSVC) ++ if (0) + INSTALL(FILES $ + DESTINATION ${CMAKE_INSTALL_BINDIR} + CONFIGURATIONS Debug RelWithDebInfo) diff --git a/recipes/hiredis/all/patches/fix-aix.patch b/recipes/hiredis/all/patches/0002-fix-aix.patch similarity index 100% rename from recipes/hiredis/all/patches/fix-aix.patch rename to recipes/hiredis/all/patches/0002-fix-aix.patch diff --git a/recipes/hiredis/all/patches/fix-cmake.patch b/recipes/hiredis/all/patches/fix-cmake.patch deleted file mode 100644 index 7e792575ef6d4..0000000000000 --- a/recipes/hiredis/all/patches/fix-cmake.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -39,8 +39,8 @@ SET(hiredis_sources ${hiredis_sources}) - IF(WIN32) - ADD_COMPILE_DEFINITIONS(_CRT_SECURE_NO_WARNINGS WIN32_LEAN_AND_MEAN) - ENDIF() -- --ADD_LIBRARY(hiredis SHARED ${hiredis_sources}) -+SET(CMAKE_C_STANDARD 99) -+ADD_LIBRARY(hiredis ${hiredis_sources}) - - SET_TARGET_PROPERTIES(hiredis - PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE -@@ -97,7 +97,7 @@ IF(ENABLE_SSL) - FIND_PACKAGE(OpenSSL REQUIRED) - SET(hiredis_ssl_sources - ssl.c) -- ADD_LIBRARY(hiredis_ssl SHARED -+ ADD_LIBRARY(hiredis_ssl - ${hiredis_ssl_sources}) - - IF (APPLE) -@@ -109,8 +109,7 @@ IF(ENABLE_SSL) - WINDOWS_EXPORT_ALL_SYMBOLS TRUE - VERSION "${HIREDIS_SONAME}") - -- TARGET_INCLUDE_DIRECTORIES(hiredis_ssl PRIVATE "${OPENSSL_INCLUDE_DIR}") -- TARGET_LINK_LIBRARIES(hiredis_ssl PRIVATE ${OPENSSL_LIBRARIES}) -+ TARGET_LINK_LIBRARIES(hiredis_ssl PRIVATE OpenSSL::SSL) - IF (WIN32 OR MINGW) - TARGET_LINK_LIBRARIES(hiredis_ssl PRIVATE hiredis) - ENDIF() diff --git a/recipes/hiredis/all/test_package/CMakeLists.txt b/recipes/hiredis/all/test_package/CMakeLists.txt index dec692e0271d4..49e1f3d74c74e 100644 --- a/recipes/hiredis/all/test_package/CMakeLists.txt +++ b/recipes/hiredis/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(hiredis REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} hiredis::hiredis) +target_link_libraries(${PROJECT_NAME} PRIVATE hiredis::hiredis) diff --git a/recipes/hiredis/all/test_package/conanfile.py b/recipes/hiredis/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/hiredis/all/test_package/conanfile.py +++ b/recipes/hiredis/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/hiredis/all/test_v1_package/CMakeLists.txt b/recipes/hiredis/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..d1ea1807c4774 --- /dev/null +++ b/recipes/hiredis/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(hiredis REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE hiredis::hiredis) diff --git a/recipes/hiredis/all/test_v1_package/conanfile.py b/recipes/hiredis/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/hiredis/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/hiredis/config.yml b/recipes/hiredis/config.yml index 3e11e326f177b..b06a4f7517eb0 100644 --- a/recipes/hiredis/config.yml +++ b/recipes/hiredis/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.0": + folder: all "1.0.2": folder: all "1.0.0": diff --git a/recipes/hlslpp/all/conandata.yml b/recipes/hlslpp/all/conandata.yml index 9962d3d912437..41a6668e87c71 100644 --- a/recipes/hlslpp/all/conandata.yml +++ b/recipes/hlslpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.2": + url: "https://github.com/redorav/hlslpp/archive/refs/tags/3.2.2.tar.gz" + sha256: "f8fae38e6f02920f24344a86397f03b2a7a1fe18bbcb77f4c39bc33978c4a058" "3.2": url: "https://github.com/redorav/hlslpp/archive/3.2.tar.gz" sha256: "23ab0b7f392c518185157e9b1e099eac0a560f4932cebbdf8ccb4a533a0d0336" diff --git a/recipes/hlslpp/all/conanfile.py b/recipes/hlslpp/all/conanfile.py index 875e16e21920d..d8ccb3fef6db2 100644 --- a/recipes/hlslpp/all/conanfile.py +++ b/recipes/hlslpp/all/conanfile.py @@ -10,13 +10,16 @@ class HlslppConan(ConanFile): name = "hlslpp" description = "Header-only Math library using hlsl syntax with SSE/NEON support" - topics = ("hlslpp", "hlsl", "math", "shader", "vector", "matrix", "quaternion") + topics = ("hlsl", "math", "shader", "vector", "matrix", "quaternion") license = "MIT" homepage = "https://github.com/redorav/hlslpp" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" no_copy_source = True + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): self.info.clear() @@ -24,9 +27,6 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - def layout(self): - basic_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -40,6 +40,4 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/hlslpp/all/test_package/conanfile.py b/recipes/hlslpp/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/hlslpp/all/test_package/conanfile.py +++ b/recipes/hlslpp/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/hlslpp/all/test_v1_package/CMakeLists.txt b/recipes/hlslpp/all/test_v1_package/CMakeLists.txt index 3b23e4e379ffb..0d20897301b68 100644 --- a/recipes/hlslpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/hlslpp/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(hlslpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE hlslpp::hlslpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/hlslpp/config.yml b/recipes/hlslpp/config.yml index b8a3a571e7b7d..199b902f23539 100644 --- a/recipes/hlslpp/config.yml +++ b/recipes/hlslpp/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.2": + folder: all "3.2": folder: all "3.1": diff --git a/recipes/homog2d/all/conandata.yml b/recipes/homog2d/all/conandata.yml new file mode 100644 index 0000000000000..c744269df86d0 --- /dev/null +++ b/recipes/homog2d/all/conandata.yml @@ -0,0 +1,17 @@ +sources: + "2.9": + url: "https://github.com/skramm/homog2d/archive/refs/tags/v2.9.tar.gz" + sha256: "7784237154fd0c1beea5b1ed4349e910ce86ad463d21f4f21019f553834c1dad" + +patches: + "2.9": + - patch_file: "patches/0001-include-array.patch" + patch_description: "include array to solve compilation error on appale-clang" + patch_type: "portability" + - patch_file: "patches/0002-pretty_function-for-msvc.patch" + patch_description: "use __FUNCSIG__ instead of __PRETTY_FUNCTION__ on MSVC" + patch_type: "portability" + - patch_file: "patches/0003-support-msvc.patch" + patch_description: "fix msvc compilation error" + patch_type: "portability" + patch_source: "https://github.com/skramm/homog2d/issues/2" diff --git a/recipes/homog2d/all/conanfile.py b/recipes/homog2d/all/conanfile.py new file mode 100644 index 0000000000000..389de93f97426 --- /dev/null +++ b/recipes/homog2d/all/conanfile.py @@ -0,0 +1,73 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc, check_min_vs +import os + + +required_conan_version = ">=1.52.0" + + +class Homog2dConan(ConanFile): + name = "homog2d" + description = "C++ 2D geometry library, handles points, lines, polylines, planar transformations(and other primitives), using homogeneous coordinates." + license = "MPL-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/skramm/homog2d" + topics = ("computational-geometry", "homography", "2d-geometric", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + "clang": "5", + "apple-clang": "5.1", + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + apply_conandata_patches(self) + + def package(self): + copy(self, pattern="LICENCE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="homog2d.hpp", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/homog2d/all/patches/0001-include-array.patch b/recipes/homog2d/all/patches/0001-include-array.patch new file mode 100644 index 0000000000000..0e50c1abf4225 --- /dev/null +++ b/recipes/homog2d/all/patches/0001-include-array.patch @@ -0,0 +1,12 @@ +diff --git a/homog2d.hpp b/homog2d.hpp +index 64191fb..f30d150 100644 +--- a/homog2d.hpp ++++ b/homog2d.hpp +@@ -30,6 +30,7 @@ See https://github.com/skramm/homog2d + #include + #include + #include ++#include + #include + #include + #include diff --git a/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch b/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch new file mode 100644 index 0000000000000..5b68d2eeb13ec --- /dev/null +++ b/recipes/homog2d/all/patches/0002-pretty_function-for-msvc.patch @@ -0,0 +1,33 @@ +diff --git a/homog2d.hpp b/homog2d.hpp +index f30d150..d82d7e5 100644 +--- a/homog2d.hpp ++++ b/homog2d.hpp +@@ -115,12 +115,18 @@ See https://github.com/skramm/homog2d + #define HOMOG2D_BIND_Y y + #endif + ++#ifdef _MSC_VER ++ #define HOMOG2D_PRETTY_FUNCTION __FUNCSIG__ ++#else ++ #define HOMOG2D_PRETTY_FUNCTION __PRETTY_FUNCTION__ ++#endif ++ + /// Error throw wrapper macro + #define HOMOG2D_THROW_ERROR_1( msg ) \ + { \ + std::ostringstream oss; \ + oss << "homog2d: line " << __LINE__ << ", function:" << __FUNCTION__ << "(): " \ +- << msg << "\n -full function name: " << __PRETTY_FUNCTION__ \ ++ << msg << "\n -full function name: " << HOMOG2D_PRETTY_FUNCTION \ + << "\n -Error count=" << ++errorCount(); \ + throw std::runtime_error( oss.str() ); \ + } +@@ -130,7 +136,7 @@ See https://github.com/skramm/homog2d + { \ + std::ostringstream oss; \ + oss << "homog2d: line " << __LINE__ << ", function:" << func << "(): " \ +- << msg << "\n -full function name: " << __PRETTY_FUNCTION__ \ ++ << msg << "\n -full function name: " << HOMOG2D_PRETTY_FUNCTION \ + << "\n -Error count=" << ++errorCount(); \ + throw std::runtime_error( oss.str() ); \ + } diff --git a/recipes/homog2d/all/patches/0003-support-msvc.patch b/recipes/homog2d/all/patches/0003-support-msvc.patch new file mode 100644 index 0000000000000..5897903f1959f --- /dev/null +++ b/recipes/homog2d/all/patches/0003-support-msvc.patch @@ -0,0 +1,22 @@ +diff --git a/homog2d.hpp b/homog2d.hpp +index 77f6841..ab8646b 100644 +--- a/homog2d.hpp ++++ b/homog2d.hpp +@@ -729,12 +729,11 @@ auto + operator << ( std::ostream&, const h2d::base::LPBase& ) + -> std::ostream&; + } +-/* +-template +-auto +-operator << ( std::ostream&, const h2d::Point2d_& ) +--> std::ostream&; +-*/ ++ ++// forward declaration, related to https://github.com/skramm/homog2d/issues/2 ++template ++Line2d_ ++operator * ( const Homogr_&, const Line2d_& ); + + namespace detail { + diff --git a/recipes/homog2d/all/test_package/CMakeLists.txt b/recipes/homog2d/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5abd7206722e3 --- /dev/null +++ b/recipes/homog2d/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(homog2d REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE homog2d::homog2d) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/homog2d/all/test_package/conanfile.py b/recipes/homog2d/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/homog2d/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/homog2d/all/test_package/test_package.cpp b/recipes/homog2d/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..bb7225471a2b4 --- /dev/null +++ b/recipes/homog2d/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include + +#include "homog2d.hpp" +using namespace h2d; + +int main() { + Line2d l1( Point2d(10,10) ); // a line passing through (0,0) and (10,10) + Line2d l2( Point2d(0,10), Point2d(10,0) ); // a line passing through (0,10) and (10,0) + auto pt = l1 * l2; // intersection point (5,5) + Homogr H(2,3); // a translation matrix + std::cout << H * pt; // prints [7,8] + + return 0; +} diff --git a/recipes/homog2d/all/test_v1_package/CMakeLists.txt b/recipes/homog2d/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/homog2d/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/homog2d/all/test_v1_package/conanfile.py b/recipes/homog2d/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/homog2d/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/homog2d/config.yml b/recipes/homog2d/config.yml new file mode 100644 index 0000000000000..15e714af2f48e --- /dev/null +++ b/recipes/homog2d/config.yml @@ -0,0 +1,3 @@ +versions: + "2.9": + folder: all diff --git a/recipes/http_parser/all/conanfile.py b/recipes/http_parser/all/conanfile.py index e764d7f53939c..70717a99f0379 100644 --- a/recipes/http_parser/all/conanfile.py +++ b/recipes/http_parser/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class HttpParserConan(ConanFile): @@ -24,30 +24,24 @@ class HttpParserConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/http_parser/all/test_v1_package/conanfile.py b/recipes/http_parser/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/http_parser/all/test_v1_package/conanfile.py +++ b/recipes/http_parser/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/hyperscan/all/CMakeLists.txt b/recipes/hyperscan/all/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c35..0000000000000 --- a/recipes/hyperscan/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/hyperscan/all/conandata.yml b/recipes/hyperscan/all/conandata.yml index a03650d07b3ae..b46d4ac06c616 100644 --- a/recipes/hyperscan/all/conandata.yml +++ b/recipes/hyperscan/all/conandata.yml @@ -4,5 +4,9 @@ sources: sha256: "e51aba39af47e3901062852e5004d127fa7763b5dbbc16bcca4265243ffa106f" patches: "5.4.0": - - patch_file: "patches/fix-cmake.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "modify cmake files to build with conan" + patch_type: "conan" + - patch_file: "patches/0002-use-ue2-make_unique.patch" + patch_description: "add ue2:: prefix to make_unique for name collision" + patch_type: "portability" diff --git a/recipes/hyperscan/all/conanfile.py b/recipes/hyperscan/all/conanfile.py index f3eb36131b29f..5e30dac82fb95 100644 --- a/recipes/hyperscan/all/conanfile.py +++ b/recipes/hyperscan/all/conanfile.py @@ -1,23 +1,22 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration - +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" + class HyperscanConan(ConanFile): name = "hyperscan" + description = "High-performance regular expression matching library" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.hyperscan.io" - description = "High-performance regular expression matching library" topics = ("regex", "regular expressions") - settings = "os", "compiler", "build_type", "arch" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake", "cmake_find_package" - - _cmake = None - + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -26,9 +25,8 @@ class HyperscanConan(ConanFile): "build_avx512": [True, False], "fat_runtime": [True, False], "build_chimera": [True, False], - "dump_support": [True, False, "auto"] + "dump_support": [True, False, "auto"], } - default_options = { "shared": False, "fPIC": True, @@ -37,103 +35,90 @@ class HyperscanConan(ConanFile): "build_avx512": False, "fat_runtime": False, "build_chimera": False, - "dump_support": "auto" + "dump_support": "auto", } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("hyperscan-{0}".format(self.version), self._source_subfolder) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC - def build_requirements(self): - self.build_requires("ragel/6.10"); + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.79.0"); + self.requires("boost/1.81.0") if self.options.build_chimera: self.requires("pcre/8.45") def validate(self): - tools.check_min_cppstd(self, "11") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + if self.options.shared and self.options.build_chimera: + raise ConanInvalidConfiguration("Chimera build requires static building") if self.settings.arch not in ["x86", "x86_64"]: raise ConanInvalidConfiguration("Hyperscan only support x86 architecture") - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + def build_requirements(self): + self.tool_requires("ragel/6.10") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self); + def generate(self): + VirtualBuildEnv(self).generate() + + tc = CMakeToolchain(self) if self.options.optimise != "auto": - self._cmake.definitions["OPTIMISE"] = self.options.optimise + tc.variables["OPTIMISE"] = self.options.optimise if self.options.debug_output != "auto": - self._cmake.definitions["DEBUG_OUTPUT"] = self.options.debug_output - self._cmake.definitions["BUILD_AVX512"] = self.options.build_avx512 - self._cmake.definitions["FAT_RUNTIME"] = self.options.fat_runtime - self._cmake.definitions["BUILD_CHIMERA"] = self.options.build_chimera + tc.variables["DEBUG_OUTPUT"] = self.options.debug_output + tc.variables["BUILD_AVX512"] = self.options.build_avx512 + tc.variables["FAT_RUNTIME"] = self.options.fat_runtime + tc.variables["BUILD_CHIMERA"] = self.options.build_chimera if self.options.dump_support != "auto": - self._cmake.definitions["DUMP_SUPPORT"] = self.options.dump_support - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def configure(self): - if self.options.shared: - del self.options.fPIC + tc.variables["DUMP_SUPPORT"] = self.options.dump_support + tc.generate() - if self.options.shared and self.options.build_chimera: - raise ConanInvalidConfiguration("Chimera build requires static building") + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "hyperscan" - self.cpp_info.names["cmake_find_package_multi"] = "hyperscan" - + self.cpp_info.components["hs"].set_property("pkg_config_name", "libhs") self.cpp_info.components["hs"].libs = ["hs"] self.cpp_info.components["hs"].requires = ["boost::headers"] - self.cpp_info.components["hs"].names["cmake_find_package"] = "hs" - self.cpp_info.components["hs"].names["cmake_find_package_multi"] = "hs" - self.cpp_info.components["hs"].set_property("cmake_target_name", "hyperscan::hs") - self.cpp_info.components["hs"].set_property("pkg_config_name", "libhs") - self.cpp_info.components["hs_runtime"].libs = ["hs_runtime"] - self.cpp_info.components["hs_runtime"].names["cmake_find_package"] = "hs_runtime" - self.cpp_info.components["hs_runtime"].names["cmake_find_package_multi"] = "hs_runtime" - self.cpp_info.components["hs_runtime"].set_property("cmake_target_name", "hyperscan::hs_runtime") - self.cpp_info.components["hs_runtime"].set_property("pkg_config_name", "libhs_runtime") - if self.options.build_chimera: + self.cpp_info.components["chimera"].set_property("pkg_config_name", "libch") self.cpp_info.components["chimera"].libs = ["chimera"] self.cpp_info.components["chimera"].requires = ["pcre::libpcre", "hs"] - self.cpp_info.components["chimera"].names["cmake_find_package"] = "chimera" - self.cpp_info.components["chimera"].names["cmake_find_package_multi"] = "chimera" - self.cpp_info.components["chimera"].set_property("cmake_target_name", "hyperscan::chimera") - self.cpp_info.components["chimera"].set_property("pkg_config_name", "libchimera") - - if not self.options.shared: if self.settings.os in ["Linux", "FreeBSD"]: @@ -142,4 +127,3 @@ def package_info(self): if self.options.build_chimera: self.cpp_info.components["chimera"].system_libs = ["m"] - diff --git a/recipes/hyperscan/all/patches/0001-fix-cmake.patch b/recipes/hyperscan/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..872966c197543 --- /dev/null +++ b/recipes/hyperscan/all/patches/0001-fix-cmake.patch @@ -0,0 +1,327 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8bc6077..0fbed25 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,7 @@ set (HS_MINOR_VERSION 4) + set (HS_PATCH_VERSION 0) + set (HS_VERSION ${HS_MAJOR_VERSION}.${HS_MINOR_VERSION}.${HS_PATCH_VERSION}) + +-set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) ++list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") + include(CheckCCompilerFlag) + include(CheckCXXCompilerFlag) + include(CheckCXXSymbolExists) +@@ -17,8 +17,8 @@ INCLUDE (CheckLibraryExists) + INCLUDE (CheckSymbolExists) + include (CMakeDependentOption) + include (GNUInstallDirs) +-include (${CMAKE_MODULE_PATH}/platform.cmake) +-include (${CMAKE_MODULE_PATH}/ragel.cmake) ++include (platform) ++include (ragel) + + find_package(PkgConfig QUIET) + +@@ -69,7 +69,7 @@ include_directories(${PROJECT_SOURCE_DIR}/src) + include_directories(${PROJECT_BINARY_DIR}) + include_directories(SYSTEM include) + +-include (${CMAKE_MODULE_PATH}/boost.cmake) ++include (boost) + + # -- make this work? set(python_ADDITIONAL_VERSIONS 2.7 2.6) + find_package(PythonInterp) +@@ -84,7 +84,7 @@ endif() + # allow for reproducible builds - python for portability + if (DEFINED ENV{SOURCE_DATE_EPOCH}) + execute_process( +- COMMAND "${PYTHON}" "${CMAKE_MODULE_PATH}/formatdate.py" "$ENV{SOURCE_DATE_EPOCH}" ++ COMMAND "${PYTHON}" "${PROJECT_SOURCE_DIR}/cmake/formatdate.py" "$ENV{SOURCE_DATE_EPOCH}" + OUTPUT_VARIABLE BUILD_DATE + OUTPUT_STRIP_TRAILING_WHITESPACE) + else () +@@ -326,7 +326,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux") + message (STATUS "Building the fat runtime requires the Unix Makefiles generator, or Ninja with CMake v3.0 or higher") + set (FAT_RUNTIME_REQUISITES FALSE) + else() +- include (${CMAKE_MODULE_PATH}/attrib.cmake) ++ include (attrib) + if (NOT HAS_C_ATTR_IFUNC) + message(STATUS "Compiler does not support ifunc attribute, cannot build fat runtime") + set (FAT_RUNTIME_REQUISITES FALSE) +@@ -337,7 +337,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux") + CMAKE_DEPENDENT_OPTION(FAT_RUNTIME "Build a library that supports multiple microarchitectures" ${RELEASE_BUILD} "FAT_RUNTIME_REQUISITES" OFF) + endif () + +-include (${CMAKE_MODULE_PATH}/arch.cmake) ++include (arch) + + # testing a builtin takes a little more work + CHECK_C_SOURCE_COMPILES("void *aa_test(void *x) { return __builtin_assume_aligned(x, 16);}\nint main(void) { return 0; }" HAVE_CC_BUILTIN_ASSUME_ALIGNED) +@@ -463,7 +463,7 @@ else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + endif() + +-add_subdirectory(util) ++# add_subdirectory(util) + add_subdirectory(doc/dev-reference) + + if (NOT WIN32) +@@ -472,7 +472,7 @@ if (NOT WIN32) + set(PCRE_REQUIRED_MAJOR_VERSION 8) + set(PCRE_REQUIRED_MINOR_VERSION 41) + set(PCRE_REQUIRED_VERSION ${PCRE_REQUIRED_MAJOR_VERSION}.${PCRE_REQUIRED_MINOR_VERSION}) +-include (${CMAKE_MODULE_PATH}/pcre.cmake) ++include (pcre) + if (NOT CORRECT_PCRE_VERSION) + message(STATUS "PCRE ${PCRE_REQUIRED_VERSION} or above not found") + endif() +@@ -482,17 +482,19 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS) + set(BUILD_CHIMERA TRUE) + endif() + ++if(0) + add_subdirectory(unit) +-if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt) ++if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt) + add_subdirectory(tools) + endif() +-if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) ++endif() ++if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) + add_subdirectory(chimera) + endif() + endif() + + # do substitutions +-configure_file(${CMAKE_MODULE_PATH}/config.h.in ${PROJECT_BINARY_DIR}/config.h) ++configure_file(${PROJECT_SOURCE_DIR}/cmake/config.h.in ${PROJECT_BINARY_DIR}/config.h) + configure_file(src/hs_version.h.in ${PROJECT_BINARY_DIR}/hs_version.h) + + if (NOT WIN32) +@@ -505,7 +507,7 @@ if (NOT WIN32) + endforeach() + + configure_file(libhs.pc.in libhs.pc @ONLY) # only replace @ quoted vars +- install(FILES ${CMAKE_BINARY_DIR}/libhs.pc ++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libhs.pc + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + endif() + +@@ -524,7 +526,7 @@ if (WIN32) + set(PCRE_REQUIRED_MAJOR_VERSION 8) + set(PCRE_REQUIRED_MINOR_VERSION 41) + set(PCRE_REQUIRED_VERSION ${PCRE_REQUIRED_MAJOR_VERSION}.${PCRE_REQUIRED_MINOR_VERSION}) +-include (${CMAKE_MODULE_PATH}/pcre.cmake) ++include (pcre) + if (NOT CORRECT_PCRE_VERSION) + message(STATUS "PCRE ${PCRE_REQUIRED_VERSION} or above not found") + endif() +@@ -534,11 +536,13 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS) + set(BUILD_CHIMERA TRUE) + endif() + ++if(0) + add_subdirectory(unit) +-if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt) ++if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt) + add_subdirectory(tools) + endif() +-if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) ++endif() ++if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) + add_subdirectory(chimera) + endif() + endif() +@@ -548,14 +552,14 @@ set(RAGEL_C_FLAGS "-Wno-unused") + endif() + + set_source_files_properties( +- ${CMAKE_BINARY_DIR}/src/parser/Parser.cpp ++ ${CMAKE_CURRENT_BINARY_DIR}/src/parser/Parser.cpp + PROPERTIES + COMPILE_FLAGS "${RAGEL_C_FLAGS}") + + ragelmaker(src/parser/Parser.rl) + + set_source_files_properties( +- ${CMAKE_BINARY_DIR}/src/parser/control_verbs.cpp ++ ${CMAKE_CURRENT_BINARY_DIR}/src/parser/control_verbs.cpp + PROPERTIES + COMPILE_FLAGS "${RAGEL_C_FLAGS}") + +@@ -1216,28 +1220,28 @@ else (FAT_RUNTIME) + list(APPEND RUNTIME_LIBS $) + set_target_properties(hs_exec_core2 PROPERTIES + COMPILE_FLAGS "-march=core2" +- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} core2 ${CMAKE_MODULE_PATH}/keep.syms.in" ++ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} core2 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" + ) + + add_library(hs_exec_corei7 OBJECT ${hs_exec_SRCS}) + list(APPEND RUNTIME_LIBS $) + set_target_properties(hs_exec_corei7 PROPERTIES + COMPILE_FLAGS "-march=corei7" +- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} corei7 ${CMAKE_MODULE_PATH}/keep.syms.in" ++ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} corei7 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" + ) + + add_library(hs_exec_avx2 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS}) + list(APPEND RUNTIME_LIBS $) + set_target_properties(hs_exec_avx2 PROPERTIES + COMPILE_FLAGS "-march=core-avx2" +- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${CMAKE_MODULE_PATH}/keep.syms.in" ++ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" + ) + if (BUILD_AVX512) + add_library(hs_exec_avx512 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS}) + list(APPEND RUNTIME_LIBS $) + set_target_properties(hs_exec_avx512 PROPERTIES + COMPILE_FLAGS "${SKYLAKE_FLAG}" +- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512 ${CMAKE_MODULE_PATH}/keep.syms.in" ++ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" + ) + endif (BUILD_AVX512) + if (BUILD_AVX512VBMI) +@@ -1245,7 +1249,7 @@ else (FAT_RUNTIME) + list(APPEND RUNTIME_LIBS $) + set_target_properties(hs_exec_avx512vbmi PROPERTIES + COMPILE_FLAGS "${ICELAKE_FLAG}" +- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512vbmi ${CMAKE_MODULE_PATH}/keep.syms.in" ++ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512vbmi ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" + ) + endif (BUILD_AVX512VBMI) + +@@ -1280,21 +1284,21 @@ else (FAT_RUNTIME) + set_target_properties(hs_exec_shared_core2 PROPERTIES + COMPILE_FLAGS "-march=core2" + POSITION_INDEPENDENT_CODE TRUE +- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} core2 ${CMAKE_MODULE_PATH}/keep.syms.in" ++ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} core2 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" + ) + add_library(hs_exec_shared_corei7 OBJECT ${hs_exec_SRCS}) + list(APPEND RUNTIME_SHLIBS $) + set_target_properties(hs_exec_shared_corei7 PROPERTIES + COMPILE_FLAGS "-march=corei7" + POSITION_INDEPENDENT_CODE TRUE +- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} corei7 ${CMAKE_MODULE_PATH}/keep.syms.in" ++ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} corei7 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" + ) + add_library(hs_exec_shared_avx2 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS}) + list(APPEND RUNTIME_SHLIBS $) + set_target_properties(hs_exec_shared_avx2 PROPERTIES + COMPILE_FLAGS "-march=core-avx2" + POSITION_INDEPENDENT_CODE TRUE +- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${CMAKE_MODULE_PATH}/keep.syms.in" ++ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" + ) + + if (BUILD_AVX512) +@@ -1303,7 +1307,7 @@ else (FAT_RUNTIME) + set_target_properties(hs_exec_shared_avx512 PROPERTIES + COMPILE_FLAGS "${SKYLAKE_FLAG}" + POSITION_INDEPENDENT_CODE TRUE +- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512 ${CMAKE_MODULE_PATH}/keep.syms.in" ++ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" + ) + endif (BUILD_AVX512) + if (BUILD_AVX512VBMI) +@@ -1312,7 +1316,7 @@ else (FAT_RUNTIME) + set_target_properties(hs_exec_shared_avx512vbmi PROPERTIES + COMPILE_FLAGS "${ICELAKE_FLAG}" + POSITION_INDEPENDENT_CODE TRUE +- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512vbmi ${CMAKE_MODULE_PATH}/keep.syms.in" ++ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512vbmi ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" + ) + endif (BUILD_AVX512VBMI) + add_library(hs_exec_common_shared OBJECT +diff --git a/chimera/CMakeLists.txt b/chimera/CMakeLists.txt +index 1cd66a3..ebb3b49 100644 +--- a/chimera/CMakeLists.txt ++++ b/chimera/CMakeLists.txt +@@ -44,6 +44,6 @@ if (NOT WIN32) + set(PRIVATE_LIBS "${PRIVATE_LIBS} -L${LIBDIR} -lpcre") + + configure_file(libch.pc.in libch.pc @ONLY) # only replace @ quoted vars +- install(FILES ${CMAKE_BINARY_DIR}/chimera/libch.pc ++ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libch.pc + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + endif() +diff --git a/chimera/ch_database.h b/chimera/ch_database.h +index 28bde86..d757c82 100644 +--- a/chimera/ch_database.h ++++ b/chimera/ch_database.h +@@ -38,7 +38,7 @@ extern "C" + { + #endif + +-#define PCRE_STATIC ++/* #define PCRE_STATIC */ + #include + + #include "ch_compile.h" // for CH_MODE_ flags +diff --git a/cmake/pcre.cmake b/cmake/pcre.cmake +index e0acda5..c3cbbc7 100644 +--- a/cmake/pcre.cmake ++++ b/cmake/pcre.cmake +@@ -1,4 +1,5 @@ + # first look in pcre-$version or pcre subdirs ++ + if (PCRE_SOURCE) + # either provided on cmdline or we've seen it already + set (PCRE_BUILD_SOURCE TRUE) +@@ -50,14 +51,10 @@ if (PCRE_BUILD_SOURCE) + set(PCRE_INCLUDE_DIRS ${PCRE_SOURCE} ${PROJECT_BINARY_DIR}/pcre) + set(PCRE_LDFLAGS -L"${LIBDIR}" -lpcre) + else () +- # pkgconf should save us +- find_package(PkgConfig) +- pkg_check_modules(PCRE libpcre>=${PCRE_REQUIRED_VERSION}) +- if (PCRE_FOUND) ++ # conan should save us ++ find_package(pcre) ++ if(pcre_FOUND AND (pcre_VERSION VERSION_GREATER_EQUAL PCRE_REQUIRED_VERSION)) + set(CORRECT_PCRE_VERSION TRUE) +- message(STATUS "PCRE version ${PCRE_REQUIRED_VERSION} or above") +- else () +- message(STATUS "PCRE version ${PCRE_REQUIRED_VERSION} or above not found") +- return () +- endif () ++ set(PCRE_LDFLAGS "pcre::pcre") ++ endif() + endif (PCRE_BUILD_SOURCE) +diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt +index 6ca3fd8..378afd0 100644 +--- a/tools/CMakeLists.txt ++++ b/tools/CMakeLists.txt +@@ -1,3 +1,7 @@ ++ ++# Tools are not installed ++return () ++ + find_package(Threads) + + # remove some warnings +diff --git a/tools/hsbench/CMakeLists.txt b/tools/hsbench/CMakeLists.txt +index bbceda4..18545d0 100644 +--- a/tools/hsbench/CMakeLists.txt ++++ b/tools/hsbench/CMakeLists.txt +@@ -1,4 +1,4 @@ +-include (${CMAKE_MODULE_PATH}/sqlite3.cmake) ++include (sqlite3) + if (NOT SQLITE3_FOUND) + message(STATUS "sqlite3 not found, not building hsbench") + return() +diff --git a/tools/hscollider/CMakeLists.txt b/tools/hscollider/CMakeLists.txt +index a4d71b2..f733479 100644 +--- a/tools/hscollider/CMakeLists.txt ++++ b/tools/hscollider/CMakeLists.txt +@@ -5,7 +5,7 @@ endif() + + include_directories(${PCRE_INCLUDE_DIRS}) + +-include(${CMAKE_MODULE_PATH}/backtrace.cmake) ++include(backtrace) + + # we need static libs - too much deep magic for shared libs + if (NOT BUILD_STATIC_LIBS) diff --git a/recipes/hyperscan/all/patches/0002-use-ue2-make_unique.patch b/recipes/hyperscan/all/patches/0002-use-ue2-make_unique.patch new file mode 100644 index 0000000000000..9d4f5ee294490 --- /dev/null +++ b/recipes/hyperscan/all/patches/0002-use-ue2-make_unique.patch @@ -0,0 +1,875 @@ +diff --git a/src/nfa/castlecompile.cpp b/src/nfa/castlecompile.cpp +index 5884ebb..1af6cd2 100644 +--- a/src/nfa/castlecompile.cpp ++++ b/src/nfa/castlecompile.cpp +@@ -281,7 +281,7 @@ vector> checkExclusion(u32 &streamStateSize, + size_t total = 0; + while (lower < trigSize) { + vector vertices; +- unique_ptr cg = make_unique(); ++ unique_ptr cg = ue2::make_unique(); + + vector> min_reset_dist; + size_t upper = min(lower + CLIQUE_GRAPH_MAX_SIZE, trigSize); +diff --git a/src/nfagraph/ng_equivalence.cpp b/src/nfagraph/ng_equivalence.cpp +index a42a0ac..9b1f072 100644 +--- a/src/nfagraph/ng_equivalence.cpp ++++ b/src/nfagraph/ng_equivalence.cpp +@@ -269,7 +269,7 @@ vector> getVertexInfos(const NGHolder &g) { + vertex_map.resize(num_verts); + + for (auto v : vertices_range(g)) { +- infos.push_back(make_unique(v, g)); ++ infos.push_back(ue2::make_unique(v, g)); + vertex_map[g[v].index] = infos.back().get(); + } + +@@ -516,7 +516,7 @@ void mergeClass(vector> &infos, NGHolder &g, + g[new_v].reports.clear(); /* populated as we pull in succs */ + + // store this vertex in our global vertex list +- infos.push_back(make_unique(new_v, g)); ++ infos.push_back(ue2::make_unique(new_v, g)); + VertexInfo *new_vertex_info = infos.back().get(); + + NFAVertex new_v_eod = NGHolder::null_vertex(); +@@ -525,7 +525,7 @@ void mergeClass(vector> &infos, NGHolder &g, + if (require_separate_eod_vertex(cur_class_vertices, g)) { + new_v_eod = clone_vertex(g, old_v); + g[new_v_eod].reports.clear(); +- infos.push_back(make_unique(new_v_eod, g)); ++ infos.push_back(ue2::make_unique(new_v_eod, g)); + new_vertex_info_eod = infos.back().get(); + } + +diff --git a/src/nfagraph/ng_violet.cpp b/src/nfagraph/ng_violet.cpp +index 78d7308..2807f2b 100644 +--- a/src/nfagraph/ng_violet.cpp ++++ b/src/nfagraph/ng_violet.cpp +@@ -375,7 +375,7 @@ void getSimpleRoseLiterals(const NGHolder &g, bool seeking_anchored, + + DEBUG_PRINTF("candidate is a candidate\n"); + scores[v] = score; +- lit_info[v] = make_unique(v, s, anchored); ++ lit_info[v] = ue2::make_unique(v, s, anchored); + } + + /* try to filter out cases where appending some characters produces worse +@@ -531,7 +531,7 @@ void getRegionRoseLiterals(const NGHolder &g, bool seeking_anchored, + } + + DEBUG_PRINTF("candidate is a candidate\n"); +- lits->push_back(make_unique(vv, s, anchored)); ++ lits->push_back(ue2::make_unique(vv, s, anchored)); + } + } + +@@ -1835,7 +1835,7 @@ static + unique_ptr make_chain(u32 count) { + assert(count); + +- auto rv = make_unique(NFA_INFIX); ++ auto rv = ue2::make_unique(NFA_INFIX); + + NGHolder &h = *rv; + +diff --git a/src/rose/rose_build_add.cpp b/src/rose/rose_build_add.cpp +index aa043fa..f680dbb 100644 +--- a/src/rose/rose_build_add.cpp ++++ b/src/rose/rose_build_add.cpp +@@ -1802,7 +1802,7 @@ bool RoseBuildImpl::addOutfix(const NGHolder &h, const raw_som_dfa &haig) { + + bool RoseBuildImpl::addOutfix(const raw_puff &rp) { + if (!mpv_outfix) { +- mpv_outfix = make_unique(MpvProto()); ++ mpv_outfix = ue2::make_unique(MpvProto()); + } + + auto *mpv = mpv_outfix->mpv(); +@@ -1827,7 +1827,7 @@ bool RoseBuildImpl::addOutfix(const raw_puff &rp) { + bool RoseBuildImpl::addChainTail(const raw_puff &rp, u32 *queue_out, + u32 *event_out) { + if (!mpv_outfix) { +- mpv_outfix = make_unique(MpvProto()); ++ mpv_outfix = ue2::make_unique(MpvProto()); + } + + auto *mpv = mpv_outfix->mpv(); +diff --git a/src/rose/rose_build_anchored.cpp b/src/rose/rose_build_anchored.cpp +index 8ea07c9..1f918bb 100644 +--- a/src/rose/rose_build_anchored.cpp ++++ b/src/rose/rose_build_anchored.cpp +@@ -249,7 +249,7 @@ unique_ptr populate_holder(const simple_anchored_info &sai, + const flat_set &exit_ids) { + DEBUG_PRINTF("populating holder for ^.{%u,%u}%s\n", sai.min_bound, + sai.max_bound, dumpString(sai.literal).c_str()); +- auto h_ptr = make_unique(); ++ auto h_ptr = ue2::make_unique(); + NGHolder &h = *h_ptr; + auto ends = addDotsToGraph(h, h.start, sai.min_bound, sai.max_bound, + CharReach::dot()); +diff --git a/src/rose/rose_build_exclusive.cpp b/src/rose/rose_build_exclusive.cpp +index 6a5a710..966c908 100644 +--- a/src/rose/rose_build_exclusive.cpp ++++ b/src/rose/rose_build_exclusive.cpp +@@ -280,7 +280,7 @@ void findCliques(const map> &exclusiveGroups, + } + // Construct the exclusivity graph + map vertex_map; +- unique_ptr cg = make_unique(); ++ unique_ptr cg = ue2::make_unique(); + + // Add vertices representing infixes/suffixes + for (const auto &e : exclusiveGroups) { +diff --git a/src/rose/rose_build_program.cpp b/src/rose/rose_build_program.cpp +index 96c95db..81d605b 100644 +--- a/src/rose/rose_build_program.cpp ++++ b/src/rose/rose_build_program.cpp +@@ -95,7 +95,7 @@ OffsetMap makeOffsetMap(const RoseProgram &program, u32 *total_len) { + } + + RoseProgram::RoseProgram() { +- prog.push_back(make_unique()); ++ prog.push_back(ue2::make_unique()); + } + + RoseProgram::~RoseProgram() = default; +@@ -297,28 +297,28 @@ void addEnginesEodProgram(u32 eodNfaIterOffset, RoseProgram &program) { + } + + RoseProgram block; +- block.add_before_end(make_unique(eodNfaIterOffset)); ++ block.add_before_end(ue2::make_unique(eodNfaIterOffset)); + program.add_block(move(block)); + } + + void addSuffixesEodProgram(RoseProgram &program) { + RoseProgram block; +- block.add_before_end(make_unique()); ++ block.add_before_end(ue2::make_unique()); + program.add_block(move(block)); + } + + void addMatcherEodProgram(RoseProgram &program) { + RoseProgram block; +- block.add_before_end(make_unique()); ++ block.add_before_end(ue2::make_unique()); + program.add_block(move(block)); + } + + void addFlushCombinationProgram(RoseProgram &program) { +- program.add_before_end(make_unique()); ++ program.add_before_end(ue2::make_unique()); + } + + void addLastFlushCombinationProgram(RoseProgram &program) { +- program.add_before_end(make_unique()); ++ program.add_before_end(ue2::make_unique()); + } + + static +@@ -342,11 +342,11 @@ void makeRoleCheckLeftfix(const RoseBuildImpl &build, + + unique_ptr ri; + if (is_prefix) { +- ri = make_unique(lni.queue, build.g[v].left.lag, ++ ri = ue2::make_unique(lni.queue, build.g[v].left.lag, + build.g[v].left.leftfix_report, + end_inst); + } else { +- ri = make_unique(lni.queue, build.g[v].left.lag, ++ ri = ue2::make_unique(lni.queue, build.g[v].left.lag, + build.g[v].left.leftfix_report, + end_inst); + } +@@ -384,7 +384,7 @@ void makeAnchoredLiteralDelay(const RoseBuildImpl &build, + u32 anch_id = prog_build.anchored_programs.at(lit_id); + + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(groups, anch_id, end_inst); ++ auto ri = ue2::make_unique(groups, anch_id, end_inst); + program.add_before_end(move(ri)); + } + +@@ -393,7 +393,7 @@ void makeDedupe(const ReportManager &rm, const Report &report, + RoseProgram &program) { + const auto *end_inst = program.end_instruction(); + auto ri = +- make_unique(report.quashSom, rm.getDkey(report), ++ ue2::make_unique(report.quashSom, rm.getDkey(report), + report.offsetAdjust, end_inst); + program.add_before_end(move(ri)); + } +@@ -402,7 +402,7 @@ static + void makeDedupeSom(const ReportManager &rm, const Report &report, + RoseProgram &program) { + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(report.quashSom, ++ auto ri = ue2::make_unique(report.quashSom, + rm.getDkey(report), + report.offsetAdjust, end_inst); + program.add_before_end(move(ri)); +@@ -428,7 +428,7 @@ void makeCatchup(const ReportManager &rm, bool needs_catchup, + return; + } + +- program.add_before_end(make_unique()); ++ program.add_before_end(ue2::make_unique()); + } + + static +@@ -511,12 +511,12 @@ void addLogicalSetRequired(const Report &report, ReportManager &rm, + return; + } + // set matching status of current lkey +- auto risl = make_unique(report.lkey, ++ auto risl = ue2::make_unique(report.lkey, + report.offsetAdjust); + program.add_before_end(move(risl)); + // set current lkey's corresponding ckeys active, pending to check + for (auto ckey : rm.getRelateCKeys(report.lkey)) { +- auto risc = make_unique(ckey); ++ auto risc = ue2::make_unique(ckey); + program.add_before_end(move(risc)); + } + } +@@ -532,7 +532,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + + // Handle min/max offset checks. + if (report.minOffset > 0 || report.maxOffset < MAX_OFFSET) { +- auto ri = make_unique(report.minOffset, ++ auto ri = ue2::make_unique(report.minOffset, + report.maxOffset, end_inst); + report_block.add_before_end(move(ri)); + } +@@ -540,7 +540,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + // If this report has an exhaustion key, we can check it in the program + // rather than waiting until we're in the callback adaptor. + if (report.ekey != INVALID_EKEY) { +- auto ri = make_unique(report.ekey, end_inst); ++ auto ri = ue2::make_unique(report.ekey, end_inst); + report_block.add_before_end(move(ri)); + } + +@@ -548,7 +548,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + // calculated. + if (isExternalSomReport(report) && + report.type != EXTERNAL_CALLBACK_SOM_PASS) { +- auto ri = make_unique(); ++ auto ri = ue2::make_unique(); + writeSomOperation(report, &ri->som); + report_block.add_before_end(move(ri)); + } +@@ -556,13 +556,13 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + // Min length constraint. + if (report.minLength > 0) { + assert(build.hasSom); +- auto ri = make_unique( ++ auto ri = ue2::make_unique( + report.offsetAdjust, report.minLength, end_inst); + report_block.add_before_end(move(ri)); + } + + if (report.quashSom) { +- report_block.add_before_end(make_unique()); ++ report_block.add_before_end(ue2::make_unique()); + } + + switch (report.type) { +@@ -578,7 +578,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + if (needs_dedupe) { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.quashSom, build.rm.getDkey(report), + report.onmatch, report.offsetAdjust, end_inst)); + } else { +@@ -587,7 +587,7 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + } else { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust)); + } + } +@@ -597,28 +597,28 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + } + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust, report.ekey)); + } else { + report_block.add_before_end( +- make_unique(report.ekey)); ++ ue2::make_unique(report.ekey)); + } + } + } else { // has_som + makeDedupeSom(build.rm, report, report_block); + if (report.ekey == INVALID_EKEY) { + if (!report.quiet) { +- report_block.add_before_end(make_unique( ++ report_block.add_before_end(ue2::make_unique( + report.onmatch, report.offsetAdjust)); + } + } else { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust, report.ekey)); + } else { + report_block.add_before_end( +- make_unique(report.ekey)); ++ ue2::make_unique(report.ekey)); + } + } + } +@@ -639,17 +639,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + addFlushCombinationProgram(report_block); + } + if (has_som) { +- auto ri = make_unique(); ++ auto ri = ue2::make_unique(); + writeSomOperation(report, &ri->som); + report_block.add_before_end(move(ri)); + } else { +- auto ri = make_unique(); ++ auto ri = ue2::make_unique(); + writeSomOperation(report, &ri->som); + report_block.add_before_end(move(ri)); + } + break; + case INTERNAL_ROSE_CHAIN: { +- report_block.add_before_end(make_unique( ++ report_block.add_before_end(ue2::make_unique( + report.onmatch, report.topSquashDistance)); + break; + } +@@ -663,17 +663,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + makeDedupeSom(build.rm, report, report_block); + if (report.ekey == INVALID_EKEY) { + if (!report.quiet) { +- report_block.add_before_end(make_unique( ++ report_block.add_before_end(ue2::make_unique( + report.onmatch, report.offsetAdjust)); + } + } else { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust, report.ekey)); + } else { + report_block.add_before_end( +- make_unique(report.ekey)); ++ ue2::make_unique(report.ekey)); + } + } + addLogicalSetRequired(report, build.rm, report_block); +@@ -685,17 +685,17 @@ void makeReport(const RoseBuildImpl &build, const ReportID id, + makeDedupeSom(build.rm, report, report_block); + if (report.ekey == INVALID_EKEY) { + if (!report.quiet) { +- report_block.add_before_end(make_unique( ++ report_block.add_before_end(ue2::make_unique( + report.onmatch, report.offsetAdjust)); + } + } else { + if (!report.quiet) { + report_block.add_before_end( +- make_unique( ++ ue2::make_unique( + report.onmatch, report.offsetAdjust, report.ekey)); + } else { + report_block.add_before_end( +- make_unique(report.ekey)); ++ ue2::make_unique(report.ekey)); + } + } + addLogicalSetRequired(report, build.rm, report_block); +@@ -722,11 +722,11 @@ void makeRoleReports(const RoseBuildImpl &build, + assert(contains(leftfix_info, v)); + const left_build_info &lni = leftfix_info.at(v); + program.add_before_end( +- make_unique(lni.queue, g[v].left.lag)); ++ ue2::make_unique(lni.queue, g[v].left.lag)); + report_som = true; + } else if (g[v].som_adjust) { + program.add_before_end( +- make_unique(g[v].som_adjust)); ++ ue2::make_unique(g[v].som_adjust)); + report_som = true; + } + +@@ -748,7 +748,7 @@ void makeRoleSetState(const unordered_map &roleStateIndices, + if (it == end(roleStateIndices)) { + return; + } +- program.add_before_end(make_unique(it->second)); ++ program.add_before_end(ue2::make_unique(it->second)); + } + + static +@@ -772,7 +772,7 @@ void makePushDelayedInstructions(const RoseLiteralMap &literals, + }); + + for (const auto &ri : delay_instructions) { +- program.add_before_end(make_unique(ri)); ++ program.add_before_end(ue2::make_unique(ri)); + } + } + +@@ -801,10 +801,10 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit, + const auto *end_inst = program.end_instruction(); + unique_ptr ri; + if (lit.s.any_nocase()) { +- ri = make_unique(lit.s.get_string(), ++ ri = ue2::make_unique(lit.s.get_string(), + end_inst); + } else { +- ri = make_unique(lit.s.get_string(), ++ ri = ue2::make_unique(lit.s.get_string(), + end_inst); + } + program.add_before_end(move(ri)); +@@ -820,10 +820,10 @@ void makeCheckLiteralInstruction(const rose_literal_id &lit, + const auto *end_inst = program.end_instruction(); + unique_ptr ri; + if (lit.s.any_nocase()) { +- ri = make_unique(lit.s.get_string(), ++ ri = ue2::make_unique(lit.s.get_string(), + end_inst); + } else { +- ri = make_unique(lit.s.get_string(), end_inst); ++ ri = ue2::make_unique(lit.s.get_string(), end_inst); + } + program.add_before_end(move(ri)); + } +@@ -840,7 +840,7 @@ void makeRoleCheckNotHandled(ProgramBuild &prog_build, RoseVertex v, + } + + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(handled_key, end_inst); ++ auto ri = ue2::make_unique(handled_key, end_inst); + program.add_before_end(move(ri)); + } + +@@ -889,7 +889,7 @@ void makeRoleCheckBounds(const RoseBuildImpl &build, RoseVertex v, + + const auto *end_inst = program.end_instruction(); + program.add_before_end( +- make_unique(min_bound, max_bound, end_inst)); ++ ue2::make_unique(min_bound, max_bound, end_inst)); + } + + static +@@ -924,7 +924,7 @@ void makeRoleGroups(const RoseGraph &g, ProgramBuild &prog_build, + return; + } + +- program.add_before_end(make_unique(groups)); ++ program.add_before_end(ue2::make_unique(groups)); + } + + static +@@ -968,7 +968,7 @@ bool makeRoleByte(const vector &look, RoseProgram &program) { + s32 checkbyte_offset = verify_s32(entry.offset); + DEBUG_PRINTF("CHECK BYTE offset=%d\n", checkbyte_offset); + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(andmask_u8, cmpmask_u8, flip, ++ auto ri = ue2::make_unique(andmask_u8, cmpmask_u8, flip, + checkbyte_offset, end_inst); + program.add_before_end(move(ri)); + return true; +@@ -1000,7 +1000,7 @@ bool makeRoleMask(const vector &look, RoseProgram &program) { + DEBUG_PRINTF("CHECK MASK and_mask=%llx cmp_mask=%llx\n", + and_mask, cmp_mask); + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(and_mask, cmp_mask, neg_mask, ++ auto ri = ue2::make_unique(and_mask, cmp_mask, neg_mask, + base_offset, end_inst); + program.add_before_end(move(ri)); + return true; +@@ -1055,7 +1055,7 @@ bool makeRoleMask32(const vector &look, + DEBUG_PRINTF("base_offset %d\n", base_offset); + + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(and_mask, cmp_mask, neg_mask, ++ auto ri = ue2::make_unique(and_mask, cmp_mask, neg_mask, + base_offset, end_inst); + program.add_before_end(move(ri)); + return true; +@@ -1098,7 +1098,7 @@ bool makeRoleMask64(const vector &look, + DEBUG_PRINTF("base_offset %d\n", base_offset); + + const auto *end_inst = program.end_instruction(); +- auto ri = make_unique(and_mask, cmp_mask, neg_mask, ++ auto ri = ue2::make_unique(and_mask, cmp_mask, neg_mask, + base_offset, end_inst); + program.add_before_end(move(ri)); + return true; +@@ -1235,7 +1235,7 @@ makeCheckShufti16x8(u32 offset_range, u8 bucket_idx, + copy(hi_mask.begin(), hi_mask.begin() + 16, nib_mask.begin() + 16); + copy(bucket_select_mask.begin(), bucket_select_mask.begin() + 16, + bucket_select_mask_16.begin()); +- return make_unique ++ return ue2::make_unique + (nib_mask, bucket_select_mask_16, + neg_mask & 0xffff, base_offset, end_inst); + } +@@ -1255,7 +1255,7 @@ makeCheckShufti32x8(u32 offset_range, u8 bucket_idx, + array lo_mask_16; + copy(hi_mask.begin(), hi_mask.begin() + 16, hi_mask_16.begin()); + copy(lo_mask.begin(), lo_mask.begin() + 16, lo_mask_16.begin()); +- return make_unique ++ return ue2::make_unique + (hi_mask_16, lo_mask_16, bucket_select_mask, + neg_mask, base_offset, end_inst); + } +@@ -1277,7 +1277,7 @@ makeCheckShufti16x16(u32 offset_range, u8 bucket_idx, + bucket_select_mask_32.begin()); + copy(bucket_select_mask_hi.begin(), bucket_select_mask_hi.begin() + 16, + bucket_select_mask_32.begin() + 16); +- return make_unique ++ return ue2::make_unique + (hi_mask, lo_mask, bucket_select_mask_32, + neg_mask & 0xffff, base_offset, end_inst); + } +@@ -1294,7 +1294,7 @@ makeCheckShufti32x16(u32 offset_range, u8 bucket_idx, + return nullptr; + } + +- return make_unique ++ return ue2::make_unique + (hi_mask, lo_mask, bucket_select_mask_hi, + bucket_select_mask_lo, neg_mask, base_offset, end_inst); + } +@@ -1321,7 +1321,7 @@ makeCheckShufti64x8(u32 offset_range, u8 bucket_idx, + copy(lo_mask.begin(), lo_mask.begin() + 16, lo_mask_64.begin() + 32); + copy(lo_mask.begin(), lo_mask.begin() + 16, lo_mask_64.begin() + 48); + +- return make_unique ++ return ue2::make_unique + (hi_mask_64, lo_mask_64, bucket_select_mask, + neg_mask, base_offset, end_inst); + } +@@ -1361,7 +1361,7 @@ makeCheckShufti64x16(u32 offset_range, u8 bucket_idx, + copy(lo_mask.begin() + 16, lo_mask.begin() + 32, lo_mask_2.begin() + 32); + copy(lo_mask.begin() + 16, lo_mask.begin() + 32, lo_mask_2.begin() + 48); + +- return make_unique ++ return ue2::make_unique + (hi_mask_1, hi_mask_2, lo_mask_1, lo_mask_2, bucket_select_mask_hi, + bucket_select_mask_lo, neg_mask, base_offset, end_inst); + } +@@ -1486,7 +1486,7 @@ void makeLookaroundInstruction(const vector &look, + if (look.size() == 1) { + s8 offset = look.begin()->offset; + const CharReach &reach = look.begin()->reach; +- auto ri = make_unique(offset, reach, ++ auto ri = ue2::make_unique(offset, reach, + program.end_instruction()); + program.add_before_end(move(ri)); + return; +@@ -1508,7 +1508,7 @@ void makeLookaroundInstruction(const vector &look, + return; + } + +- auto ri = make_unique(look, ++ auto ri = ue2::make_unique(look, + program.end_instruction()); + program.add_before_end(move(ri)); + } +@@ -1584,7 +1584,7 @@ void makeCheckLitEarlyInstruction(const RoseBuildImpl &build, u32 lit_id, + + DEBUG_PRINTF("adding lit early check, min_offset=%u\n", min_offset); + const auto *end = prog.end_instruction(); +- prog.add_before_end(make_unique(min_offset, end)); ++ prog.add_before_end(ue2::make_unique(min_offset, end)); + } + + static +@@ -1595,7 +1595,7 @@ void makeGroupCheckInstruction(const RoseBuildImpl &build, u32 lit_id, + if (!info.group_mask) { + return; + } +- prog.add_before_end(make_unique(info.group_mask)); ++ prog.add_before_end(ue2::make_unique(info.group_mask)); + } + + static +@@ -1762,7 +1762,7 @@ bool makeRoleMultipathShufti(const vector> &multi_look, + copy(begin(lo_mask), begin(lo_mask) + 16, nib_mask.begin()); + copy(begin(hi_mask), begin(hi_mask) + 16, nib_mask.begin() + 16); + +- auto ri = make_unique ++ auto ri = ue2::make_unique + (nib_mask, bucket_select_lo, data_select_mask, hi_bits_mask, + lo_bits_mask, neg_mask, base_offset, last_start, end_inst); + program.add_before_end(move(ri)); +@@ -1771,20 +1771,20 @@ bool makeRoleMultipathShufti(const vector> &multi_look, + assert(!(hi_bits_mask & ~0xffffffffULL)); + assert(!(lo_bits_mask & ~0xffffffffULL)); + if (bit_index <= 8) { +- auto ri = make_unique ++ auto ri = ue2::make_unique + (hi_mask, lo_mask, bucket_select_lo, data_select_mask, + hi_bits_mask, lo_bits_mask, neg_mask, base_offset, + last_start, end_inst); + program.add_before_end(move(ri)); + } else { +- auto ri = make_unique ++ auto ri = ue2::make_unique + (hi_mask, lo_mask, bucket_select_hi, bucket_select_lo, + data_select_mask, hi_bits_mask, lo_bits_mask, neg_mask, + base_offset, last_start, end_inst); + program.add_before_end(move(ri)); + } + } else { +- auto ri = make_unique ++ auto ri = ue2::make_unique + (hi_mask, lo_mask, bucket_select_lo, data_select_mask, + hi_bits_mask, lo_bits_mask, neg_mask, base_offset, + last_start, end_inst); +@@ -1856,7 +1856,7 @@ void makeRoleMultipathLookaround(const vector> &multi_look, + ordered_look.emplace_back(multi_entry); + } + +- auto ri = make_unique(move(ordered_look), ++ auto ri = ue2::make_unique(move(ordered_look), + last_start, start_mask, + program.end_instruction()); + program.add_before_end(move(ri)); +@@ -1932,7 +1932,7 @@ void makeRoleSuffix(const RoseBuildImpl &build, + event = MQE_TOP; + } + +- prog.add_before_end(make_unique(queue, event)); ++ prog.add_before_end(ue2::make_unique(queue, event)); + } + + static +@@ -1945,7 +1945,7 @@ void addInfixTriggerInstructions(vector triggers, + }); + for (const auto &ti : triggers) { + prog.add_before_end( +- make_unique(ti.cancel, ti.queue, ti.event)); ++ ue2::make_unique(ti.cancel, ti.queue, ti.event)); + } + } + +@@ -2039,7 +2039,7 @@ static + void addCheckOnlyEodInstruction(RoseProgram &prog) { + DEBUG_PRINTF("only at eod\n"); + const auto *end_inst = prog.end_instruction(); +- prog.add_before_end(make_unique(end_inst)); ++ prog.add_before_end(ue2::make_unique(end_inst)); + } + + static +@@ -2164,7 +2164,7 @@ void makeGroupSquashInstruction(const RoseBuildImpl &build, u32 lit_id, + DEBUG_PRINTF("squashes 0x%llx\n", info.group_mask); + assert(info.group_mask); + /* Note: group_mask is negated. */ +- prog.add_before_end(make_unique(~info.group_mask)); ++ prog.add_before_end(ue2::make_unique(~info.group_mask)); + } + + namespace { +@@ -2209,7 +2209,7 @@ RoseProgram assembleProgramBlocks(vector &&blocks_in) { + * only set if a state has been. */ + if (!prog.empty() && reads_work_done_flag(block)) { + RoseProgram clear_block; +- clear_block.add_before_end(make_unique()); ++ clear_block.add_before_end(ue2::make_unique()); + prog.add_block(move(clear_block)); + } + +@@ -2369,7 +2369,7 @@ void makeCatchupMpv(const ReportManager &rm, bool needs_mpv_catchup, + return; + } + +- program.add_before_end(make_unique()); ++ program.add_before_end(ue2::make_unique()); + } + + RoseProgram makeReportProgram(const RoseBuildImpl &build, +@@ -2402,7 +2402,7 @@ RoseProgram makeBoundaryProgram(const RoseBuildImpl &build, + void addIncludedJumpProgram(RoseProgram &program, u32 child_offset, + u8 squash) { + RoseProgram block; +- block.add_before_end(make_unique(child_offset, ++ block.add_before_end(ue2::make_unique(child_offset, + squash)); + program.add_block(move(block)); + } +@@ -2413,7 +2413,7 @@ void addPredBlockSingle(u32 pred_state, RoseProgram &pred_block, + // Prepend an instruction to check the pred state is on. + const auto *end_inst = pred_block.end_instruction(); + pred_block.insert(begin(pred_block), +- make_unique(pred_state, end_inst)); ++ ue2::make_unique(pred_state, end_inst)); + program.add_block(move(pred_block)); + } + +@@ -2428,7 +2428,7 @@ void addPredBlocksAny(map &pred_blocks, u32 num_states, + } + + const RoseInstruction *end_inst = sparse_program.end_instruction(); +- auto ri = make_unique(num_states, keys, end_inst); ++ auto ri = ue2::make_unique(num_states, keys, end_inst); + sparse_program.add_before_end(move(ri)); + + RoseProgram &block = pred_blocks.begin()->second; +@@ -2451,14 +2451,14 @@ void addPredBlocksMulti(map &pred_blocks, + vector> jump_table; + + // BEGIN instruction. +- auto ri_begin = make_unique(num_states, end_inst); ++ auto ri_begin = ue2::make_unique(num_states, end_inst); + RoseInstrSparseIterBegin *begin_inst = ri_begin.get(); + sparse_program.add_before_end(move(ri_begin)); + + // NEXT instructions, one per pred program. + u32 prev_key = pred_blocks.begin()->first; + for (auto it = next(begin(pred_blocks)); it != end(pred_blocks); ++it) { +- auto ri = make_unique(prev_key, begin_inst, ++ auto ri = ue2::make_unique(prev_key, begin_inst, + end_inst); + sparse_program.add_before_end(move(ri)); + prev_key = it->first; +@@ -2539,7 +2539,7 @@ void applyFinalSpecialisation(RoseProgram &program) { + auto it = next(program.rbegin()); + if (auto *ri = dynamic_cast(it->get())) { + DEBUG_PRINTF("replacing REPORT with FINAL_REPORT\n"); +- program.replace(it, make_unique( ++ program.replace(it, ue2::make_unique( + ri->onmatch, ri->offset_adjust)); + } + } +diff --git a/src/rose/rose_in_util.cpp b/src/rose/rose_in_util.cpp +index 9fe47c2..6fa56d1 100644 +--- a/src/rose/rose_in_util.cpp ++++ b/src/rose/rose_in_util.cpp +@@ -93,7 +93,7 @@ private: + + unique_ptr cloneRoseGraph(const RoseInGraph &ig) { + assert(hasCorrectlyNumberedVertices(ig)); +- unique_ptr out = make_unique(); ++ unique_ptr out = ue2::make_unique(); + + unordered_map> graph_map; + unordered_map> haig_map; +diff --git a/src/smallwrite/smallwrite_build.cpp b/src/smallwrite/smallwrite_build.cpp +index 4eb4801..6acdf3c 100644 +--- a/src/smallwrite/smallwrite_build.cpp ++++ b/src/smallwrite/smallwrite_build.cpp +@@ -680,7 +680,7 @@ unique_ptr buildDfa(LitTrie &trie, bool nocase) { + // Construct DFA states in BFS order. + const auto state_ids = makeStateMap(trie, ordering); + +- auto rdfa = make_unique(NFA_OUTFIX); ++ auto rdfa = ue2::make_unique(NFA_OUTFIX); + + // Calculate alphabet. + array unalpha; +diff --git a/tools/hsbench/main.cpp b/tools/hsbench/main.cpp +index 1c91813..4ec793e 100644 +--- a/tools/hsbench/main.cpp ++++ b/tools/hsbench/main.cpp +@@ -1038,7 +1038,7 @@ void runBenchmark(const Engine &db, + int HS_CDECL main(int argc, char *argv[]) { + unique_ptr grey; + #if !defined(RELEASE_BUILD) +- grey = make_unique(); ++ grey = ue2::make_unique(); + #endif + setlocale(LC_ALL, ""); // use the user's locale + +diff --git a/tools/hscheck/main.cpp b/tools/hscheck/main.cpp +index 197087b..bdecab8 100644 +--- a/tools/hscheck/main.cpp ++++ b/tools/hscheck/main.cpp +@@ -664,7 +664,7 @@ int HS_CDECL main(int argc, char **argv) { + num_of_threads = max(1u, std::thread::hardware_concurrency()); + + #if !defined(RELEASE_BUILD) +- g_grey = make_unique(); ++ g_grey = ue2::make_unique(); + #endif + processArgs(argc, argv, g_grey); + +diff --git a/tools/hscollider/GraphTruth.cpp b/tools/hscollider/GraphTruth.cpp +index 0b67b11..e43beb1 100644 +--- a/tools/hscollider/GraphTruth.cpp ++++ b/tools/hscollider/GraphTruth.cpp +@@ -134,7 +134,7 @@ void CNGInfo::compile() { + auto pl = ue2::make_unique(); + pl->parseLogicalCombination(id, re.c_str(), ~0U, 0, ~0ULL); + pl->logicalKeyRenumber(); +- cng = make_unique(move(pl)); ++ cng = ue2::make_unique(move(pl)); + return; + } + +@@ -193,7 +193,7 @@ void CNGInfo::compile() { + } + } + +- cng = make_unique(move(g), move(rm)); ++ cng = ue2::make_unique(move(g), move(rm)); + } catch (CompileError &e) { + throw NGCompileFailure(e.reason); + } catch (NGUnsupportedFailure &e) { +@@ -257,7 +257,7 @@ unique_ptr GraphTruth::preprocess(unsigned id, + } + } + +- auto cngi = make_unique(id, m_expr); ++ auto cngi = ue2::make_unique(id, m_expr); + cngi->utf8 = hs_flags & HS_FLAG_UTF8; + cngi->highlander = highlander; + cngi->prefilter = prefilter; +diff --git a/tools/hscollider/GroundTruth.cpp b/tools/hscollider/GroundTruth.cpp +index a267306..d9293dc 100644 +--- a/tools/hscollider/GroundTruth.cpp ++++ b/tools/hscollider/GroundTruth.cpp +@@ -331,7 +331,7 @@ GroundTruth::compile(unsigned id, bool no_callouts) { + int errloc = 0; + int errcode = 0; + +- unique_ptr compiled = make_unique(); ++ unique_ptr compiled = ue2::make_unique(); + compiled->utf8 = flags & PCRE_UTF8; + compiled->highlander = highlander; + compiled->prefilter = prefilter; +diff --git a/tools/hscollider/main.cpp b/tools/hscollider/main.cpp +index afa6ef5..c85526e 100644 +--- a/tools/hscollider/main.cpp ++++ b/tools/hscollider/main.cpp +@@ -1606,7 +1606,7 @@ void generateTests(CorporaSource &corpora_src, const ExpressionMap &exprMap, + max_generator_queue_len); + vector> generators; + for (size_t i = 0; i < numGeneratorThreads; i++) { +- auto c = make_unique(i, testq, corpq, corpora_src); ++ auto c = ue2::make_unique(i, testq, corpq, corpora_src); + c->start(); + generators.push_back(move(c)); + } +diff --git a/util/ng_corpus_generator.cpp b/util/ng_corpus_generator.cpp +index e5e8e06..2e0080a 100644 +--- a/util/ng_corpus_generator.cpp ++++ b/util/ng_corpus_generator.cpp +@@ -200,7 +200,7 @@ void findPaths(const NGHolder &g, CorpusProperties &cProps, + if (boost::next(ai) == ae) { + new_path = std::move(p); + } else { +- new_path = make_unique(*p); ++ new_path = ue2::make_unique(*p); + } + + new_path->push_back(v); diff --git a/recipes/hyperscan/all/patches/fix-cmake.patch b/recipes/hyperscan/all/patches/fix-cmake.patch deleted file mode 100644 index 0905e34e5bc47..0000000000000 --- a/recipes/hyperscan/all/patches/fix-cmake.patch +++ /dev/null @@ -1,312 +0,0 @@ -diff --git CMakeLists.txt CMakeLists.txt -index 8bc6077..579a7b4 100644 ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -6,7 +6,7 @@ set (HS_MINOR_VERSION 4) - set (HS_PATCH_VERSION 0) - set (HS_VERSION ${HS_MAJOR_VERSION}.${HS_MINOR_VERSION}.${HS_PATCH_VERSION}) - --set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) -+list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") - include(CheckCCompilerFlag) - include(CheckCXXCompilerFlag) - include(CheckCXXSymbolExists) -@@ -17,8 +17,8 @@ INCLUDE (CheckLibraryExists) - INCLUDE (CheckSymbolExists) - include (CMakeDependentOption) - include (GNUInstallDirs) --include (${CMAKE_MODULE_PATH}/platform.cmake) --include (${CMAKE_MODULE_PATH}/ragel.cmake) -+include (platform) -+include (ragel) - - find_package(PkgConfig QUIET) - -@@ -69,7 +69,7 @@ include_directories(${PROJECT_SOURCE_DIR}/src) - include_directories(${PROJECT_BINARY_DIR}) - include_directories(SYSTEM include) - --include (${CMAKE_MODULE_PATH}/boost.cmake) -+include (boost) - - # -- make this work? set(python_ADDITIONAL_VERSIONS 2.7 2.6) - find_package(PythonInterp) -@@ -84,7 +84,7 @@ endif() - # allow for reproducible builds - python for portability - if (DEFINED ENV{SOURCE_DATE_EPOCH}) - execute_process( -- COMMAND "${PYTHON}" "${CMAKE_MODULE_PATH}/formatdate.py" "$ENV{SOURCE_DATE_EPOCH}" -+ COMMAND "${PYTHON}" "${PROJECT_SOURCE_DIR}/cmake/formatdate.py" "$ENV{SOURCE_DATE_EPOCH}" - OUTPUT_VARIABLE BUILD_DATE - OUTPUT_STRIP_TRAILING_WHITESPACE) - else () -@@ -326,7 +326,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux") - message (STATUS "Building the fat runtime requires the Unix Makefiles generator, or Ninja with CMake v3.0 or higher") - set (FAT_RUNTIME_REQUISITES FALSE) - else() -- include (${CMAKE_MODULE_PATH}/attrib.cmake) -+ include (attrib) - if (NOT HAS_C_ATTR_IFUNC) - message(STATUS "Compiler does not support ifunc attribute, cannot build fat runtime") - set (FAT_RUNTIME_REQUISITES FALSE) -@@ -337,7 +337,7 @@ if (CMAKE_SYSTEM_NAME MATCHES "Linux") - CMAKE_DEPENDENT_OPTION(FAT_RUNTIME "Build a library that supports multiple microarchitectures" ${RELEASE_BUILD} "FAT_RUNTIME_REQUISITES" OFF) - endif () - --include (${CMAKE_MODULE_PATH}/arch.cmake) -+include (arch) - - # testing a builtin takes a little more work - CHECK_C_SOURCE_COMPILES("void *aa_test(void *x) { return __builtin_assume_aligned(x, 16);}\nint main(void) { return 0; }" HAVE_CC_BUILTIN_ASSUME_ALIGNED) -@@ -472,7 +472,7 @@ if (NOT WIN32) - set(PCRE_REQUIRED_MAJOR_VERSION 8) - set(PCRE_REQUIRED_MINOR_VERSION 41) - set(PCRE_REQUIRED_VERSION ${PCRE_REQUIRED_MAJOR_VERSION}.${PCRE_REQUIRED_MINOR_VERSION}) --include (${CMAKE_MODULE_PATH}/pcre.cmake) -+include (pcre) - if (NOT CORRECT_PCRE_VERSION) - message(STATUS "PCRE ${PCRE_REQUIRED_VERSION} or above not found") - endif() -@@ -483,16 +483,16 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS) - endif() - - add_subdirectory(unit) --if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt) -+if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt) - add_subdirectory(tools) - endif() --if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) -+if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) - add_subdirectory(chimera) - endif() - endif() - - # do substitutions --configure_file(${CMAKE_MODULE_PATH}/config.h.in ${PROJECT_BINARY_DIR}/config.h) -+configure_file(${PROJECT_SOURCE_DIR}/cmake/config.h.in ${PROJECT_BINARY_DIR}/config.h) - configure_file(src/hs_version.h.in ${PROJECT_BINARY_DIR}/hs_version.h) - - if (NOT WIN32) -@@ -505,7 +505,7 @@ if (NOT WIN32) - endforeach() - - configure_file(libhs.pc.in libhs.pc @ONLY) # only replace @ quoted vars -- install(FILES ${CMAKE_BINARY_DIR}/libhs.pc -+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libhs.pc - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - endif() - -@@ -524,7 +524,7 @@ if (WIN32) - set(PCRE_REQUIRED_MAJOR_VERSION 8) - set(PCRE_REQUIRED_MINOR_VERSION 41) - set(PCRE_REQUIRED_VERSION ${PCRE_REQUIRED_MAJOR_VERSION}.${PCRE_REQUIRED_MINOR_VERSION}) --include (${CMAKE_MODULE_PATH}/pcre.cmake) -+include (pcre) - if (NOT CORRECT_PCRE_VERSION) - message(STATUS "PCRE ${PCRE_REQUIRED_VERSION} or above not found") - endif() -@@ -535,10 +535,10 @@ if (CORRECT_PCRE_VERSION AND PCRE_BUILD_SOURCE AND BUILD_STATIC_LIBS) - endif() - - add_subdirectory(unit) --if (EXISTS ${CMAKE_SOURCE_DIR}/tools/CMakeLists.txt) -+if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tools/CMakeLists.txt) - add_subdirectory(tools) - endif() --if (EXISTS ${CMAKE_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) -+if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/chimera/CMakeLists.txt AND BUILD_CHIMERA) - add_subdirectory(chimera) - endif() - endif() -@@ -548,14 +548,14 @@ set(RAGEL_C_FLAGS "-Wno-unused") - endif() - - set_source_files_properties( -- ${CMAKE_BINARY_DIR}/src/parser/Parser.cpp -+ ${CMAKE_CURRENT_BINARY_DIR}/src/parser/Parser.cpp - PROPERTIES - COMPILE_FLAGS "${RAGEL_C_FLAGS}") - - ragelmaker(src/parser/Parser.rl) - - set_source_files_properties( -- ${CMAKE_BINARY_DIR}/src/parser/control_verbs.cpp -+ ${CMAKE_CURRENT_BINARY_DIR}/src/parser/control_verbs.cpp - PROPERTIES - COMPILE_FLAGS "${RAGEL_C_FLAGS}") - -@@ -1216,28 +1216,28 @@ else (FAT_RUNTIME) - list(APPEND RUNTIME_LIBS $) - set_target_properties(hs_exec_core2 PROPERTIES - COMPILE_FLAGS "-march=core2" -- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} core2 ${CMAKE_MODULE_PATH}/keep.syms.in" -+ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} core2 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" - ) - - add_library(hs_exec_corei7 OBJECT ${hs_exec_SRCS}) - list(APPEND RUNTIME_LIBS $) - set_target_properties(hs_exec_corei7 PROPERTIES - COMPILE_FLAGS "-march=corei7" -- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} corei7 ${CMAKE_MODULE_PATH}/keep.syms.in" -+ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} corei7 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" - ) - - add_library(hs_exec_avx2 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS}) - list(APPEND RUNTIME_LIBS $) - set_target_properties(hs_exec_avx2 PROPERTIES - COMPILE_FLAGS "-march=core-avx2" -- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${CMAKE_MODULE_PATH}/keep.syms.in" -+ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" - ) - if (BUILD_AVX512) - add_library(hs_exec_avx512 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS}) - list(APPEND RUNTIME_LIBS $) - set_target_properties(hs_exec_avx512 PROPERTIES - COMPILE_FLAGS "${SKYLAKE_FLAG}" -- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512 ${CMAKE_MODULE_PATH}/keep.syms.in" -+ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" - ) - endif (BUILD_AVX512) - if (BUILD_AVX512VBMI) -@@ -1245,7 +1245,7 @@ else (FAT_RUNTIME) - list(APPEND RUNTIME_LIBS $) - set_target_properties(hs_exec_avx512vbmi PROPERTIES - COMPILE_FLAGS "${ICELAKE_FLAG}" -- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512vbmi ${CMAKE_MODULE_PATH}/keep.syms.in" -+ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512vbmi ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" - ) - endif (BUILD_AVX512VBMI) - -@@ -1280,21 +1280,21 @@ else (FAT_RUNTIME) - set_target_properties(hs_exec_shared_core2 PROPERTIES - COMPILE_FLAGS "-march=core2" - POSITION_INDEPENDENT_CODE TRUE -- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} core2 ${CMAKE_MODULE_PATH}/keep.syms.in" -+ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} core2 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" - ) - add_library(hs_exec_shared_corei7 OBJECT ${hs_exec_SRCS}) - list(APPEND RUNTIME_SHLIBS $) - set_target_properties(hs_exec_shared_corei7 PROPERTIES - COMPILE_FLAGS "-march=corei7" - POSITION_INDEPENDENT_CODE TRUE -- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} corei7 ${CMAKE_MODULE_PATH}/keep.syms.in" -+ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} corei7 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" - ) - add_library(hs_exec_shared_avx2 OBJECT ${hs_exec_SRCS} ${hs_exec_avx2_SRCS}) - list(APPEND RUNTIME_SHLIBS $) - set_target_properties(hs_exec_shared_avx2 PROPERTIES - COMPILE_FLAGS "-march=core-avx2" - POSITION_INDEPENDENT_CODE TRUE -- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${CMAKE_MODULE_PATH}/keep.syms.in" -+ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx2 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" - ) - - if (BUILD_AVX512) -@@ -1303,7 +1303,7 @@ else (FAT_RUNTIME) - set_target_properties(hs_exec_shared_avx512 PROPERTIES - COMPILE_FLAGS "${SKYLAKE_FLAG}" - POSITION_INDEPENDENT_CODE TRUE -- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512 ${CMAKE_MODULE_PATH}/keep.syms.in" -+ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512 ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" - ) - endif (BUILD_AVX512) - if (BUILD_AVX512VBMI) -@@ -1312,7 +1312,7 @@ else (FAT_RUNTIME) - set_target_properties(hs_exec_shared_avx512vbmi PROPERTIES - COMPILE_FLAGS "${ICELAKE_FLAG}" - POSITION_INDEPENDENT_CODE TRUE -- RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512vbmi ${CMAKE_MODULE_PATH}/keep.syms.in" -+ RULE_LAUNCH_COMPILE "${BUILD_WRAPPER} avx512vbmi ${PROJECT_SOURCE_DIR}/cmake/keep.syms.in" - ) - endif (BUILD_AVX512VBMI) - add_library(hs_exec_common_shared OBJECT -diff --git chimera/CMakeLists.txt chimera/CMakeLists.txt -index 1cd66a3..ebb3b49 100644 ---- chimera/CMakeLists.txt -+++ chimera/CMakeLists.txt -@@ -44,6 +44,6 @@ if (NOT WIN32) - set(PRIVATE_LIBS "${PRIVATE_LIBS} -L${LIBDIR} -lpcre") - - configure_file(libch.pc.in libch.pc @ONLY) # only replace @ quoted vars -- install(FILES ${CMAKE_BINARY_DIR}/chimera/libch.pc -+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libch.pc - DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") - endif() -diff --git chimera/ch_database.h chimera/ch_database.h -index 28bde86..d757c82 100644 ---- chimera/ch_database.h -+++ chimera/ch_database.h -@@ -38,7 +38,7 @@ extern "C" - { - #endif - --#define PCRE_STATIC -+/* #define PCRE_STATIC */ - #include - - #include "ch_compile.h" // for CH_MODE_ flags -diff --git cmake/pcre.cmake cmake/pcre.cmake -index e0acda5..c68601f 100644 ---- cmake/pcre.cmake -+++ cmake/pcre.cmake -@@ -1,4 +1,5 @@ - # first look in pcre-$version or pcre subdirs -+ - if (PCRE_SOURCE) - # either provided on cmdline or we've seen it already - set (PCRE_BUILD_SOURCE TRUE) -@@ -50,14 +51,10 @@ if (PCRE_BUILD_SOURCE) - set(PCRE_INCLUDE_DIRS ${PCRE_SOURCE} ${PROJECT_BINARY_DIR}/pcre) - set(PCRE_LDFLAGS -L"${LIBDIR}" -lpcre) - else () -- # pkgconf should save us -- find_package(PkgConfig) -- pkg_check_modules(PCRE libpcre>=${PCRE_REQUIRED_VERSION}) -- if (PCRE_FOUND) -+ # conan should save us -+ find_package(PCRE) -+ if(PCRE_FOUND AND (PCRE_VERSION VERSION_GREATER_EQUAL PCRE_REQUIRED_VERSION)) - set(CORRECT_PCRE_VERSION TRUE) -- message(STATUS "PCRE version ${PCRE_REQUIRED_VERSION} or above") -- else () -- message(STATUS "PCRE version ${PCRE_REQUIRED_VERSION} or above not found") -- return () -- endif () -+ set(PCRE_LDFLAGS "PCRE::libpcre") -+ endif() - endif (PCRE_BUILD_SOURCE) -diff --git tools/CMakeLists.txt tools/CMakeLists.txt -index 6ca3fd8..378afd0 100644 ---- tools/CMakeLists.txt -+++ tools/CMakeLists.txt -@@ -1,3 +1,7 @@ -+ -+# Tools are not installed -+return () -+ - find_package(Threads) - - # remove some warnings -diff --git tools/hsbench/CMakeLists.txt tools/hsbench/CMakeLists.txt -index bbceda4..18545d0 100644 ---- tools/hsbench/CMakeLists.txt -+++ tools/hsbench/CMakeLists.txt -@@ -1,4 +1,4 @@ --include (${CMAKE_MODULE_PATH}/sqlite3.cmake) -+include (sqlite3) - if (NOT SQLITE3_FOUND) - message(STATUS "sqlite3 not found, not building hsbench") - return() -diff --git tools/hscollider/CMakeLists.txt tools/hscollider/CMakeLists.txt -index a4d71b2..f733479 100644 ---- tools/hscollider/CMakeLists.txt -+++ tools/hscollider/CMakeLists.txt -@@ -5,7 +5,7 @@ endif() - - include_directories(${PCRE_INCLUDE_DIRS}) - --include(${CMAKE_MODULE_PATH}/backtrace.cmake) -+include(backtrace) - - # we need static libs - too much deep magic for shared libs - if (NOT BUILD_STATIC_LIBS) diff --git a/recipes/hyperscan/all/test_package/CMakeLists.txt b/recipes/hyperscan/all/test_package/CMakeLists.txt index 0e579ae32cbad..8cfec33c7dfff 100644 --- a/recipes/hyperscan/all/test_package/CMakeLists.txt +++ b/recipes/hyperscan/all/test_package/CMakeLists.txt @@ -1,16 +1,15 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(hyperscan COMPONENTS hs REQUIRED) + add_executable(hs_example hs_example.cpp) target_link_libraries(hs_example PRIVATE hyperscan::hs) +target_compile_features(hs_example PRIVATE cxx_std_11) if(BUILD_CHIMERA) find_package(hyperscan COMPONENTS chimera REQUIRED) add_executable(ch_example ch_example.cpp) target_link_libraries(ch_example PRIVATE hyperscan::chimera) + target_compile_features(ch_example PRIVATE cxx_std_11) endif() - diff --git a/recipes/hyperscan/all/test_package/conanfile.py b/recipes/hyperscan/all/test_package/conanfile.py index 5ce555b9552f0..f5c91753bcba3 100644 --- a/recipes/hyperscan/all/test_package/conanfile.py +++ b/recipes/hyperscan/all/test_package/conanfile.py @@ -1,25 +1,35 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -from conans import ConanFile, CMake, tools -from conan.tools.build import cross_building +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" -class HyperscanTestConan(ConanFile): - settings = "os", "build_type", "arch", "compiler" - generators = "cmake", "cmake_find_package" + def layout(self): + cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_CHIMERA"] = self.dependencies["hyperscan"].options.build_chimera + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["BUILD_CHIMERA"] = self.options["hyperscan"].build_chimera cmake.configure() cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "hs_example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "hs_example") + self.run(bin_path, env="conanrun") if self.options["hyperscan"].build_chimera: - bin_path = os.path.join("bin", "ch_example") - self.run(bin_path, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindirs[0], "ch_example") + self.run(bin_path, env="conanrun") diff --git a/recipes/hyperscan/all/test_v1_package/CMakeLists.txt b/recipes/hyperscan/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/hyperscan/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/hyperscan/all/test_v1_package/conanfile.py b/recipes/hyperscan/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..cb26b3fe15590 --- /dev/null +++ b/recipes/hyperscan/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["BUILD_CHIMERA"] = self.options["hyperscan"].build_chimera + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "hs_example") + self.run(bin_path, run_environment=True) + + if self.options["hyperscan"].build_chimera: + bin_path = os.path.join("bin", "ch_example") + self.run(bin_path, run_environment=True) diff --git a/recipes/icu/all/conandata.yml b/recipes/icu/all/conandata.yml index 2949d758c3d68..552662991ba50 100644 --- a/recipes/icu/all/conandata.yml +++ b/recipes/icu/all/conandata.yml @@ -1,45 +1,32 @@ sources: - "64.2": - url: "https://github.com/unicode-org/icu/releases/download/release-64-2/icu4c-64_2-src.tgz" - sha256: "627d5d8478e6d96fc8c90fed4851239079a561a6a8b9e48b0892f24e82d31d6c" - "65.1": - url: "https://github.com/unicode-org/icu/releases/download/release-65-1/icu4c-65_1-src.tgz" - sha256: "53e37466b3d6d6d01ead029e3567d873a43a5d1c668ed2278e253b683136d948" - "66.1": - url: "https://github.com/unicode-org/icu/releases/download/release-66-1/icu4c-66_1-src.tgz" - sha256: "52a3f2209ab95559c1cf0a14f24338001f389615bf00e2585ef3dbc43ecf0a2e" - "67.1": - url: "https://github.com/unicode-org/icu/releases/download/release-67-1/icu4c-67_1-src.tgz" - sha256: "94a80cd6f251a53bd2a997f6f1b5ac6653fe791dfab66e1eb0227740fb86d5dc" - "68.2": - url: "https://github.com/unicode-org/icu/releases/download/release-68-2/icu4c-68_2-src.tgz" - sha256: "c79193dee3907a2199b8296a93b52c5cb74332c26f3d167269487680d479d625" - "69.1": - url: "https://github.com/unicode-org/icu/releases/download/release-69-1/icu4c-69_1-src.tgz" - sha256: "4cba7b7acd1d3c42c44bb0c14be6637098c7faf2b330ce876bc5f3b915d09745" - "70.1": - url: "https://github.com/unicode-org/icu/releases/download/release-70-1/icu4c-70_1-src.tgz" - sha256: "8d205428c17bf13bb535300669ed28b338a157b1c01ae66d31d0d3e2d47c3fd5" + "72.1": + url: "https://github.com/unicode-org/icu/releases/download/release-72-1/icu4c-72_1-src.tgz" + sha256: "a2d2d38217092a7ed56635e34467f92f976b370e20182ad325edea6681a71d68" "71.1": url: "https://github.com/unicode-org/icu/releases/download/release-71-1/icu4c-71_1-src.tgz" sha256: "67a7e6e51f61faf1306b6935333e13b2c48abd8da6d2f46ce6adca24b1e21ebf" -patches: - "67.1": - - patch_file: "patches/6aba9344a18f4f32e8070ee53b79495630901c26.patch" - base_path: "source_subfolder" - - patch_file: "patches/0001-67.1-fix-mingw.patch" - base_path: "source_subfolder" - "68.2": - - patch_file: "patches/0001-67.1-fix-mingw.patch" - base_path: "source_subfolder" - "69.1": - - patch_file: "patches/0001-69.1-fix-mingw.patch" - base_path: "source_subfolder" "70.1": + url: "https://github.com/unicode-org/icu/releases/download/release-70-1/icu4c-70_1-src.tgz" + sha256: "8d205428c17bf13bb535300669ed28b338a157b1c01ae66d31d0d3e2d47c3fd5" + "69.1": + url: "https://github.com/unicode-org/icu/releases/download/release-69-1/icu4c-69_1-src.tgz" + sha256: "4cba7b7acd1d3c42c44bb0c14be6637098c7faf2b330ce876bc5f3b915d09745" + "68.2": + url: "https://github.com/unicode-org/icu/releases/download/release-68-2/icu4c-68_2-src.tgz" + sha256: "c79193dee3907a2199b8296a93b52c5cb74332c26f3d167269487680d479d625" +patches: + "72.1": - patch_file: "patches/0001-69.1-fix-mingw.patch" - base_path: "source_subfolder" "71.1": - patch_file: "patches/0001-69.1-fix-mingw.patch" - base_path: "source_subfolder" - patch_file: "patches/0001-71.1-fix-undef-strict-ansi.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-71.1-fix-emscripten.patch" + patch_description: "Add config file for wasm-emscripten platform" + patch_type: "portability" + patch_source: "https://gerrit.libreoffice.org/c/core/+/111130/9/external/icu/icu4c-emscripten-cross.patch.1" + "70.1": + - patch_file: "patches/0001-69.1-fix-mingw.patch" + "69.1": + - patch_file: "patches/0001-69.1-fix-mingw.patch" + "68.2": + - patch_file: "patches/0001-67.1-fix-mingw.patch" diff --git a/recipes/icu/all/conanfile.py b/recipes/icu/all/conanfile.py index fbc9a101e3599..5b2773ee2d710 100644 --- a/recipes/icu/all/conanfile.py +++ b/recipes/icu/all/conanfile.py @@ -1,14 +1,23 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration import glob +import hashlib import os import shutil -required_conan_version = ">=1.43.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building, stdcpp_library +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, rename, replace_in_file, rm, rmdir, save +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path +from conan.tools.scm import Version +required_conan_version = ">=1.57.0" -class ICUBase(ConanFile): + +class ICUConan(ConanFile): name = "icu" homepage = "http://site.icu-project.org" license = "ICU" @@ -22,10 +31,8 @@ class ICUBase(ConanFile): "shared": [True, False], "fPIC": [True, False], "data_packaging": ["files", "archive", "library", "static"], - "with_unit_tests": [True, False], - "silent": [True, False], "with_dyload": [True, False], - "dat_package_file": "ANY", + "dat_package_file": [None, "ANY"], "with_icuio": [True, False], "with_extras": [True, False], } @@ -33,39 +40,26 @@ class ICUBase(ConanFile): "shared": False, "fPIC": True, "data_packaging": "archive", - "with_unit_tests": False, - "silent": True, "with_dyload": True, "dat_package_file": None, "with_icuio": True, "with_extras": False, } - _env_build = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - - @property - def _is_mingw(self): - return self.settings.os == "Windows" and self.settings.compiler == "gcc" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property - def _make_tool(self): - return "make" if self.settings.os != "FreeBSD" else "gmake" + def _enable_icu_tools(self): + return self.settings.os not in ["iOS", "tvOS", "watchOS", "Emscripten"] @property - def _enable_icu_tools(self): - return self.settings.os not in ["iOS", "tvOS", "watchOS"] + def _with_unit_tests(self): + return not self.conf.get("tools.build:skip_test", default=True, check_type=bool) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -74,236 +68,211 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def validate(self): + if self.options.dat_package_file: + if not os.path.exists(self.options.dat_package_file): + raise ConanInvalidConfiguration("Non-existent dat_package_file specified") + + def layout(self): + basic_layout(self, src_folder="src") + + @staticmethod + def _sha256sum(file_path): + m = hashlib.sha256() + with open(file_path, "rb") as fh: + for data in iter(lambda: fh.read(8192), b""): + m.update(data) + return m.hexdigest() def package_id(self): - del self.info.options.with_unit_tests # ICU unit testing shouldn't affect the package's ID - del self.info.options.silent # Verbosity doesn't affect package's ID if self.info.options.dat_package_file: - dat_package_file_sha256 = tools.sha256sum(str(self.info.options.dat_package_file)) - self.info.options.dat_package_file = dat_package_file_sha256 - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + self.info.options.dat_package_file = self._sha256sum(str(self.info.options.dat_package_file)) def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") - if tools.cross_building(self, skip_x64_x86=True) and hasattr(self, 'settings_build'): - self.build_requires("icu/{}".format(self.version)) + if cross_building(self) and hasattr(self, "settings_build"): + self.tool_requires(str(self.ref)) def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def build(self): - self._patch_sources() + def generate(self): + env = VirtualBuildEnv(self) + env.generate() - if self.options.dat_package_file: - dat_package_file = glob.glob(os.path.join(self.source_folder, self._source_subfolder, "source", "data", "in", "*.dat")) - if dat_package_file: - shutil.copy(str(self.options.dat_package_file), dat_package_file[0]) + tc = AutotoolsToolchain(self) + if check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + if not self.options.shared: + tc.extra_defines.append("U_STATIC_IMPLEMENTATION") + if is_apple_os(self): + tc.extra_defines.append("_DARWIN_C_SOURCE") + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + "--datarootdir=${prefix}/lib", # do not use share + f"--enable-release={yes_no(self.settings.build_type != 'Debug')}", + f"--enable-debug={yes_no(self.settings.build_type == 'Debug')}", + f"--enable-dyload={yes_no(self.options.with_dyload)}", + f"--enable-extras={yes_no(self.options.with_extras)}", + f"--enable-icuio={yes_no(self.options.with_icuio)}", + "--disable-layoutex", + "--disable-layout", + f"--enable-tools={yes_no(self._enable_icu_tools)}", + f"--enable-tests={yes_no(self._with_unit_tests)}", + "--disable-samples", + ]) + if cross_building(self): + base_path = unix_path(self, self.dependencies.build["icu"].package_folder) + tc.configure_args.append(f"--with-cross-build={base_path}") + if self.settings.os in ["iOS", "tvOS", "watchOS"]: + # ICU build scripts interpret all Apple platforms as 'darwin'. + # Since this can coincide with the `build` triple, we need to tweak + # the build triple to avoid the collision and ensure the scripts + # know we are cross-building. + host_triplet = f"{str(self.settings.arch)}-apple-darwin" + build_triplet = f"{str(self._settings_build.arch)}-apple" + tc.update_configure_args({"--host": host_triplet, + "--build": build_triplet}) + else: + arch64 = ["x86_64", "sparcv9", "ppc64", "ppc64le", "armv8", "armv8.3", "mips64"] + bits = "64" if self.settings.arch in arch64 else "32" + tc.configure_args.append(f"--with-library-bits={bits}") + if self.settings.os != "Windows": + # http://userguide.icu-project.org/icudata + # This is the only directly supported behavior on Windows builds. + tc.configure_args.append(f"--with-data-packaging={self.options.data_packaging}") + tc.generate() - env_build = self._configure_autotools() - build_dir = os.path.join(self.build_folder, self._source_subfolder, "build") - os.mkdir(build_dir) - build_env = env_build.vars - if self._is_msvc: - build_env.update({'CC': 'cl', 'CXX': 'cl'}) - with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): - with tools.environment_append(build_env): - with tools.chdir(build_dir): - # workaround for https://unicode-org.atlassian.net/browse/ICU-20531 - os.makedirs(os.path.join("data", "out", "tmp")) - # workaround for "No rule to make target 'out/tmp/dirs.timestamp'" - tools.save(os.path.join("data", "out", "tmp", "dirs.timestamp"), "") - - self.run(self._build_config_cmd, win_bash=tools.os_info.is_windows) - command = "{make} {silent} -j {cpu_count}".format(make=self._make_tool, - silent=self._silent, - cpu_count=tools.cpu_count()) - self.run(command, win_bash=tools.os_info.is_windows) - if self.options.with_unit_tests: - command = "{make} {silent} check".format(make=self._make_tool, - silent=self._silent) - self.run(command, win_bash=tools.os_info.is_windows) + if is_msvc(self): + env = Environment() + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + if cross_building(self): + env.define("icu_cv_host_frag", "mh-msys-msvc") + env.vars(self).save_script("conanbuild_icu_msvc") def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - if tools.os_info.is_windows: + apply_conandata_patches(self) + + if not self._with_unit_tests: + # Prevent any call to python during configuration, it's only needed for unit tests + replace_in_file( + self, + os.path.join(self.source_folder, "source", "configure"), + "if test -z \"$PYTHON\"", + "if true", + ) + + if self._settings_build.os == "Windows": # https://unicode-org.atlassian.net/projects/ICU/issues/ICU-20545 - srcdir = os.path.join(self.build_folder, self._source_subfolder, "source") - makeconv_cpp = os.path.join(srcdir, "tools", "makeconv", "makeconv.cpp") - tools.replace_in_file(makeconv_cpp, - "pathBuf.appendPathPart(arg, localError);", - "pathBuf.append(\"/\", localError); pathBuf.append(arg, localError);") + makeconv_cpp = os.path.join(self.source_folder, "source", "tools", "makeconv", "makeconv.cpp") + replace_in_file(self, makeconv_cpp, + "pathBuf.appendPathPart(arg, localError);", + "pathBuf.append(\"/\", localError); pathBuf.append(arg, localError);") # relocatable shared libs on macOS - mh_darwin = os.path.join(self._source_subfolder, "source", "config", "mh-darwin") - tools.replace_in_file(mh_darwin, "-install_name $(libdir)/$(notdir", "-install_name @rpath/$(notdir") - tools.replace_in_file( + mh_darwin = os.path.join(self.source_folder, "source", "config", "mh-darwin") + replace_in_file(self, mh_darwin, "-install_name $(libdir)/$(notdir", "-install_name @rpath/$(notdir") + replace_in_file(self, mh_darwin, "-install_name $(notdir $(MIDDLE_SO_TARGET)) $(PKGDATA_TRAILING_SPACE)", "-install_name @rpath/$(notdir $(MIDDLE_SO_TARGET))", ) - def _configure_autotools(self): - if self._env_build: - return self._env_build - self._env_build = AutoToolsBuildEnvironment(self) - if self._is_msvc: - self._env_build.flags.append("-FS") - if not self.options.shared: - self._env_build.defines.append("U_STATIC_IMPLEMENTATION") - if tools.is_apple_os(self.settings.os): - self._env_build.defines.append("_DARWIN_C_SOURCE") - if "msys2" in self.deps_user_info: - self._env_build.vars["PYTHON"] = tools.unix_path(os.path.join(self.deps_env_info["msys2"].MSYS_BIN, "python"), tools.MSYS2) - return self._env_build + # workaround for https://unicode-org.atlassian.net/browse/ICU-20531 + mkdir(self, os.path.join(self.build_folder, "data", "out", "tmp")) - @property - def _build_config_cmd(self): - prefix = self.package_folder.replace("\\", "/") - arch64 = ['x86_64', 'sparcv9', 'ppc64', 'ppc64le', 'armv8', 'armv8.3', 'mips64'] - bits = "64" if self.settings.arch in arch64 else "32" - args = ["--prefix={0}".format(prefix), - "--disable-samples", - "--disable-layout", - "--disable-layoutex"] + # workaround for "No rule to make target 'out/tmp/dirs.timestamp'" + save(self, os.path.join(self.build_folder, "data", "out", "tmp", "dirs.timestamp"), "") - if not self.options.with_dyload: - args += ["--disable-dyload"] - - if not self._enable_icu_tools: - args.append("--disable-tools") - - if not self.options.with_icuio: - args.append("--disable-icuio") + def build(self): + self._patch_sources() - if not self.options.with_extras: - args.append("--disable-extras") + if self.options.dat_package_file: + dat_package_file = glob.glob(os.path.join(self.source_folder, "source", "data", "in", "*.dat")) + if dat_package_file: + shutil.copy(str(self.options.dat_package_file), dat_package_file[0]) - env_build = self._configure_autotools() - if tools.cross_building(self, skip_x64_x86=True): - if self.settings.os in ["iOS", "tvOS", "watchOS"]: - args.append("--host={}".format(tools.get_gnu_triplet("Macos", str(self.settings.arch)))) - elif env_build.host: - args.append("--host={}".format(env_build.host)) - bin_path = self.deps_env_info["icu"].PATH[0].replace("\\", "/") - base_path, _ = bin_path.rsplit('/', 1) - args.append("--with-cross-build={}".format(base_path)) - else: - args.append("--with-library-bits={0}".format(bits),) - - if self.settings.os != "Windows": - # http://userguide.icu-project.org/icudata - # This is the only directly supported behavior on Windows builds. - args.append("--with-data-packaging={0}".format(self.options.data_packaging)) - - datadir = os.path.join(self.package_folder, "lib") - datadir = datadir.replace("\\", "/") if tools.os_info.is_windows else datadir - args.append("--datarootdir=%s" % datadir) # do not use share - bindir = os.path.join(self.package_folder, "bin") - bindir = bindir.replace("\\", "/") if tools.os_info.is_windows else bindir - args.append("--sbindir=%s" % bindir) - libdir = os.path.join(self.package_folder, "lib") - libdir = libdir.replace("\\", "/") if tools.os_info.is_windows else libdir - args.append("--libdir=%s" % libdir) - - if self._is_mingw: - mingw_chost = "i686-w64-mingw32" if self.settings.arch == "x86" else "x86_64-w64-mingw32" - args.extend(["--build={0}".format(mingw_chost), - "--host={0}".format(mingw_chost)]) - - if self.settings.build_type == "Debug": - args.extend(["--disable-release", "--enable-debug"]) - if self.options.shared: - args.extend(["--disable-static", "--enable-shared"]) - else: - args.extend(["--enable-static", "--disable-shared"]) - if not self.options.with_unit_tests: - args.append("--disable-tests") - return "../source/configure %s" % " ".join(args) + autotools = Autotools(self) + autotools.configure(build_script_folder=os.path.join(self.source_folder, "source")) + autotools.make() + if self._with_unit_tests: + autotools.make(target="check") @property - def _silent(self): - return "--silent" if self.options.silent else "VERBOSE=1" - - def package(self): - self.copy("LICENSE", dst="licenses", src=os.path.join(self.source_folder, self._source_subfolder)) - - env_build = self._configure_autotools() - build_dir = os.path.join(self.build_folder, self._source_subfolder, "build") - with tools.vcvars(self.settings) if self._is_msvc else tools.no_op(): - with tools.environment_append(env_build.vars): - with tools.chdir(build_dir): - command = "{make} {silent} install".format(make=self._make_tool, - silent=self._silent) - self.run(command, win_bash=tools.os_info.is_windows) - - for dll in glob.glob(os.path.join(self.package_folder, "lib", "*.dll")): - shutil.move(dll, os.path.join(self.package_folder, "bin")) - - if self.settings.os != "Windows" and self.options.data_packaging in ["files", "archive"]: - tools.mkdir(os.path.join(self.package_folder, "res")) - shutil.move(self._data_path, os.path.join(self.package_folder, "res")) - - # Copy some files required for cross-compiling - self.copy("icucross.mk", src=os.path.join(build_dir, "config"), dst="config") - self.copy("icucross.inc", src=os.path.join(build_dir, "config"), dst="config") - - tools.rmdir(os.path.join(self.package_folder, "lib", "icu")) - tools.rmdir(os.path.join(self.package_folder, "lib", "man")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + def _data_filename(self): + vtag = Version(self.version).major + return f"icudt{vtag}l.dat" @property def _data_path(self): data_dir_name = "icu" if self.settings.os == "Windows" and self.settings.build_type == "Debug": data_dir_name += "d" - data_dir = os.path.join(self.package_folder, "lib", data_dir_name, self.version) + data_dir = os.path.join(self.package_folder, "lib", data_dir_name, str(self.version)) return os.path.join(data_dir, self._data_filename) - @property - def _data_filename(self): - vtag = self.version.split(".")[0] - return "icudt{}l.dat".format(vtag) + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + + dll_files = glob.glob(os.path.join(self.package_folder, "lib", "*.dll")) + if dll_files: + bin_dir = os.path.join(self.package_folder, "bin") + mkdir(self, bin_dir) + for dll in dll_files: + dll_name = os.path.basename(dll) + rm(self, dll_name, bin_dir) + rename(self, src=dll, dst=os.path.join(bin_dir, dll_name)) + + if self.settings.os != "Windows" and self.options.data_packaging in ["files", "archive"]: + mkdir(self, os.path.join(self.package_folder, "res")) + rename(self, src=self._data_path, dst=os.path.join(self.package_folder, "res", self._data_filename)) + + # Copy some files required for cross-compiling + config_dir = os.path.join(self.package_folder, "config") + copy(self, "icucross.mk", src=os.path.join(self.build_folder, "config"), dst=config_dir) + copy(self, "icucross.inc", src=os.path.join(self.build_folder, "config"), dst=config_dir) + + rmdir(self, os.path.join(self.package_folder, "lib", "icu")) + rmdir(self, os.path.join(self.package_folder, "lib", "man")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "ICU") - self.cpp_info.names["cmake_find_package"] = "ICU" - self.cpp_info.names["cmake_find_package_multi"] = "ICU" + prefix = "s" if self.settings.os == "Windows" and not self.options.shared else "" + suffix = "d" if self.settings.os == "Windows" and self.settings.build_type == "Debug" else "" # icudata self.cpp_info.components["icu-data"].set_property("cmake_target_name", "ICU::data") - self.cpp_info.components["icu-data"].names["cmake_find_package"] = "data" - self.cpp_info.components["icu-data"].names["cmake_find_package_multi"] = "data" - self.cpp_info.components["icu-data"].libs = [self._lib_name("icudt" if self.settings.os == "Windows" else "icudata")] + icudata_libname = "icudt" if self.settings.os == "Windows" else "icudata" + self.cpp_info.components["icu-data"].libs = [f"{prefix}{icudata_libname}{suffix}"] if not self.options.shared: self.cpp_info.components["icu-data"].defines.append("U_STATIC_IMPLEMENTATION") - - # icu uses c++, so add the c++ runtime - if tools.stdcpp_library(self): - self.cpp_info.components["icu-data"].system_libs.append(tools.stdcpp_library(self)) + # icu uses c++, so add the c++ runtime + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.components["icu-data"].system_libs.append(libcxx) # Alias of data CMake component self.cpp_info.components["icu-data-alias"].set_property("cmake_target_name", "ICU::dt") - self.cpp_info.components["icu-data-alias"].names["cmake_find_package"] = "dt" - self.cpp_info.components["icu-data-alias"].names["cmake_find_package_multi"] = "dt" self.cpp_info.components["icu-data-alias"].requires = ["icu-data"] # icuuc self.cpp_info.components["icu-uc"].set_property("cmake_target_name", "ICU::uc") self.cpp_info.components["icu-uc"].set_property("pkg_config_name", "icu-uc") - self.cpp_info.components["icu-uc"].names["cmake_find_package"] = "uc" - self.cpp_info.components["icu-uc"].names["cmake_find_package_multi"] = "uc" - self.cpp_info.components["icu-uc"].libs = [self._lib_name("icuuc")] + self.cpp_info.components["icu-uc"].libs = [f"{prefix}icuuc{suffix}"] self.cpp_info.components["icu-uc"].requires = ["icu-data"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["icu-uc"].system_libs = ["m", "pthread"] @@ -315,64 +284,65 @@ def package_info(self): # icui18n self.cpp_info.components["icu-i18n"].set_property("cmake_target_name", "ICU::i18n") self.cpp_info.components["icu-i18n"].set_property("pkg_config_name", "icu-i18n") - self.cpp_info.components["icu-i18n"].names["cmake_find_package"] = "i18n" - self.cpp_info.components["icu-i18n"].names["cmake_find_package_multi"] = "i18n" - self.cpp_info.components["icu-i18n"].libs = [self._lib_name("icuin" if self.settings.os == "Windows" else "icui18n")] + icui18n_libname = "icuin" if self.settings.os == "Windows" else "icui18n" + self.cpp_info.components["icu-i18n"].libs = [f"{prefix}{icui18n_libname}{suffix}"] self.cpp_info.components["icu-i18n"].requires = ["icu-uc"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["icu-i18n"].system_libs = ["m"] # Alias of i18n CMake component self.cpp_info.components["icu-i18n-alias"].set_property("cmake_target_name", "ICU::in") - self.cpp_info.components["icu-i18n-alias"].names["cmake_find_package"] = "in" - self.cpp_info.components["icu-i18n-alias"].names["cmake_find_package_multi"] = "in" self.cpp_info.components["icu-i18n-alias"].requires = ["icu-i18n"] # icuio if self.options.with_icuio: self.cpp_info.components["icu-io"].set_property("cmake_target_name", "ICU::io") self.cpp_info.components["icu-io"].set_property("pkg_config_name", "icu-io") - self.cpp_info.components["icu-io"].names["cmake_find_package"] = "io" - self.cpp_info.components["icu-io"].names["cmake_find_package_multi"] = "io" - self.cpp_info.components["icu-io"].libs = [self._lib_name("icuio")] + self.cpp_info.components["icu-io"].libs = [f"{prefix}icuio{suffix}"] self.cpp_info.components["icu-io"].requires = ["icu-i18n", "icu-uc"] if self.settings.os != "Windows" and self.options.data_packaging in ["files", "archive"]: + self.cpp_info.components["icu-data"].resdirs = ["res"] data_path = os.path.join(self.package_folder, "res", self._data_filename).replace("\\", "/") - self.output.info("Prepending to ICU_DATA runtime environment variable: {}".format(data_path)) self.runenv_info.prepend_path("ICU_DATA", data_path) if self._enable_icu_tools or self.options.with_extras: self.buildenv_info.prepend_path("ICU_DATA", data_path) - # TODO: to remove after conan v2, it allows to not break consumers still relying on virtualenv generator - self.env_info.ICU_DATA.append(data_path) if self._enable_icu_tools: # icutu self.cpp_info.components["icu-tu"].set_property("cmake_target_name", "ICU::tu") - self.cpp_info.components["icu-tu"].names["cmake_find_package"] = "tu" - self.cpp_info.components["icu-tu"].names["cmake_find_package_multi"] = "tu" - self.cpp_info.components["icu-tu"].libs = [self._lib_name("icutu")] + self.cpp_info.components["icu-tu"].libs = [f"{prefix}icutu{suffix}"] self.cpp_info.components["icu-tu"].requires = ["icu-i18n", "icu-uc"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["icu-tu"].system_libs = ["pthread"] # icutest self.cpp_info.components["icu-test"].set_property("cmake_target_name", "ICU::test") - self.cpp_info.components["icu-test"].names["cmake_find_package"] = "test" - self.cpp_info.components["icu-test"].names["cmake_find_package_multi"] = "test" - self.cpp_info.components["icu-test"].libs = [self._lib_name("icutest")] + self.cpp_info.components["icu-test"].libs = [f"{prefix}icutest{suffix}"] self.cpp_info.components["icu-test"].requires = ["icu-tu", "icu-uc"] + # TODO: to remove after conan v2 + self.cpp_info.names["cmake_find_package"] = "ICU" + self.cpp_info.names["cmake_find_package_multi"] = "ICU" + self.cpp_info.components["icu-data"].names["cmake_find_package"] = "data" + self.cpp_info.components["icu-data"].names["cmake_find_package_multi"] = "data" + self.cpp_info.components["icu-data-alias"].names["cmake_find_package"] = "dt" + self.cpp_info.components["icu-data-alias"].names["cmake_find_package_multi"] = "dt" + self.cpp_info.components["icu-uc"].names["cmake_find_package"] = "uc" + self.cpp_info.components["icu-uc"].names["cmake_find_package_multi"] = "uc" + self.cpp_info.components["icu-i18n"].names["cmake_find_package"] = "i18n" + self.cpp_info.components["icu-i18n"].names["cmake_find_package_multi"] = "i18n" + self.cpp_info.components["icu-i18n-alias"].names["cmake_find_package"] = "in" + self.cpp_info.components["icu-i18n-alias"].names["cmake_find_package_multi"] = "in" + if self.options.with_icuio: + self.cpp_info.components["icu-io"].names["cmake_find_package"] = "io" + self.cpp_info.components["icu-io"].names["cmake_find_package_multi"] = "io" + if self.settings.os != "Windows" and self.options.data_packaging in ["files", "archive"]: + self.env_info.ICU_DATA.append(data_path) + if self._enable_icu_tools: + self.cpp_info.components["icu-tu"].names["cmake_find_package"] = "tu" + self.cpp_info.components["icu-tu"].names["cmake_find_package_multi"] = "tu" + self.cpp_info.components["icu-test"].names["cmake_find_package"] = "test" + self.cpp_info.components["icu-test"].names["cmake_find_package_multi"] = "test" if self._enable_icu_tools or self.options.with_extras: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - - def _lib_name(self, lib): - name = lib - if self.settings.os == "Windows": - if not self.options.shared: - name = "s" + name - if self.settings.build_type == "Debug": - name += "d" - return name + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/icu/all/patches/0001-71.1-fix-emscripten.patch b/recipes/icu/all/patches/0001-71.1-fix-emscripten.patch new file mode 100644 index 0000000000000..5693ab70111d5 --- /dev/null +++ b/recipes/icu/all/patches/0001-71.1-fix-emscripten.patch @@ -0,0 +1,117 @@ +diff --git a/source/acinclude.m4 b/source/acinclude.m4 +index 507f41f..2980ef1 100644 +--- a/source/acinclude.m4 ++++ b/source/acinclude.m4 +@@ -84,6 +84,7 @@ x86_64-*-cygwin) + *-dec-osf*) icu_cv_host_frag=mh-alpha-osf ;; + *-*-nto*) icu_cv_host_frag=mh-qnx ;; + *-ncr-*) icu_cv_host_frag=mh-mpras ;; ++wasm*-*-emscripten*) icu_cv_host_frag=mh-emscripten ;; + *) icu_cv_host_frag=mh-unknown ;; + esac + ] +diff --git a/source/config/mh-emscripten b/source/config/mh-emscripten +new file mode 100644 +index 0000000..ee2b90b +--- /dev/null ++++ b/source/config/mh-emscripten +@@ -0,0 +1,86 @@ ++## Emscripten-specific setup ++## Copyright (c) 1999-2013, International Business Machines Corporation and ++## others. All Rights Reserved. ++## Commands to generate dependency files ++GEN_DEPS.c= $(CC) -E -MM $(DEFS) $(CPPFLAGS) ++GEN_DEPS.cc= $(CXX) -E -MM $(DEFS) $(CPPFLAGS) $(CXXFLAGS) ++ ++## Flags for position independent code ++SHAREDLIBCFLAGS = -fPIC ++SHAREDLIBCXXFLAGS = -fPIC ++SHAREDLIBCPPFLAGS = -DPIC ++ ++## Additional flags when building libraries and with threads ++THREADSCPPFLAGS = -D_REENTRANT ++LIBCPPFLAGS = ++ ++## Compiler switch to embed a runtime search path ++LD_RPATH= -Wl,-zorigin,-rpath,'$$'ORIGIN ++LD_RPATH_PRE = -Wl,-rpath, ++ ++## Force RPATH=$ORIGIN to locate own dependencies w/o need for LD_LIBRARY_PATH: ++ENABLE_RPATH=YES ++RPATHLDFLAGS=${LD_RPATH_PRE}'$$ORIGIN' ++ ++## These are the library specific LDFLAGS ++#LDFLAGSICUDT=-nodefaultlibs -nostdlib ++# Debian change: linking icudata as data only causes too many problems. ++LDFLAGSICUDT= ++ ++## Compiler switch to embed a library name ++# The initial tab in the next line is to prevent icu-config from reading it. ++ LD_SONAME = -Wl,-soname -Wl,$(notdir $(MIDDLE_SO_TARGET)) ++#SH# # We can't depend on MIDDLE_SO_TARGET being set. ++#SH# LD_SONAME= ++ ++## Shared library options ++LD_SOOPTIONS= -Wl,-Bsymbolic-functions ++ ++## Shared object suffix ++SO = so ++## Non-shared intermediate object suffix ++STATIC_O = o ++ ++## Compilation rules ++# WASM needs -pthread for atomics support ++%.$(STATIC_O): $(srcdir)/%.c ++ $(call SILENT_COMPILE,$(strip $(COMPILE.c) $(STATICCPPFLAGS) $(STATICCFLAGS)) -pthread -o $@ $<) ++ ++%.$(STATIC_O): $(srcdir)/%.cpp ++ $(call SILENT_COMPILE,$(strip $(COMPILE.cc) $(STATICCPPFLAGS) $(STATICCXXFLAGS)) -pthread -o $@ $<) ++ ++ ++## Dependency rules ++%.d: $(srcdir)/%.c ++ $(call ICU_MSG,(deps)) $< ++ @$(SHELL) -ec '$(GEN_DEPS.c) $< \ ++ | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \ ++ [ -s $@ ] || rm -f $@' ++ ++%.d: $(srcdir)/%.cpp ++ $(call ICU_MSG,(deps)) $< ++ @$(SHELL) -ec '$(GEN_DEPS.cc) $< \ ++ | sed '\''s%\($*\)\.o[ :]*%\1.o $@ : %g'\'' > $@; \ ++ [ -s $@ ] || rm -f $@' ++ ++## Versioned libraries rules ++ ++%.$(SO).$(SO_TARGET_VERSION_MAJOR): %.$(SO).$(SO_TARGET_VERSION) ++ $(RM) $@ && ln -s ${ -Date: Thu, 25 Nov 2021 23:25:17 +0100 -Subject: [PATCH 1/2] Different export headers for shared and static lib - ---- - iir/Common.h | 8 +++++++- - 1 file changed, 7 insertions(+), 1 deletion(-) - -diff --git a/iir/Common.h b/iir/Common.h -index 71c24d6..8d66155 100644 ---- a/iir/Common.h -+++ b/iir/Common.h -@@ -46,8 +46,14 @@ - - // This exports the classes/structures to the windows DLL - #ifdef _WIN32 --#define DllExport __declspec( dllexport ) - #define _CRT_SECURE_NO_WARNINGS -+#ifdef iir_EXPORTS -+#define DllExport __declspec( dllexport ) -+#elif iir_SHARED -+#define DllExport __declspec( dllimport ) -+#else -+#define DllExport -+#endif - #else - #define DllExport - #endif --- -2.25.1 - diff --git a/recipes/iir1/all/patches/1.9.0-0001-no-export-static-win.patch b/recipes/iir1/all/patches/1.9.0-0001-no-export-static-win.patch new file mode 100644 index 0000000000000..d704a63ab7b58 --- /dev/null +++ b/recipes/iir1/all/patches/1.9.0-0001-no-export-static-win.patch @@ -0,0 +1,14 @@ +--- a/iir/Common.h ++++ b/iir/Common.h +@@ -46,7 +46,11 @@ + + // This exports the classes/structures to the windows DLL + #ifdef _WIN32 ++#ifdef iir_EXPORTS + #define DllExport __declspec( dllexport ) ++#else ++#define DllExport ++#endif + #define _CRT_SECURE_NO_WARNINGS + #else + #define DllExport diff --git a/recipes/iir1/all/patches/0002-Add-runtime-export-to-install.patch b/recipes/iir1/all/patches/1.9.0-0002-Add-runtime-export-to-install.patch similarity index 100% rename from recipes/iir1/all/patches/0002-Add-runtime-export-to-install.patch rename to recipes/iir1/all/patches/1.9.0-0002-Add-runtime-export-to-install.patch diff --git a/recipes/iir1/all/patches/1.9.0-0003-disable-test-demo.patch b/recipes/iir1/all/patches/1.9.0-0003-disable-test-demo.patch new file mode 100644 index 0000000000000..18bc682ab4948 --- /dev/null +++ b/recipes/iir1/all/patches/1.9.0-0003-disable-test-demo.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,9 +12,6 @@ cmake_policy(SET CMP0048 NEW) # set VERSION in project() + cmake_policy(SET CMP0042 NEW) # enable MACOSX_RPATH by default + + include(GNUInstallDirs) +-add_subdirectory(test) +-add_subdirectory(demo) +-enable_testing () + + if (MSVC) + add_compile_options(/W4) diff --git a/recipes/iir1/all/test_package/CMakeLists.txt b/recipes/iir1/all/test_package/CMakeLists.txt index 0b931fcced812..bfb108d7d9198 100644 --- a/recipes/iir1/all/test_package/CMakeLists.txt +++ b/recipes/iir1/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(iir REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - if(TARGET iir::iir) target_link_libraries(${PROJECT_NAME} PRIVATE iir::iir) else() target_link_libraries(${PROJECT_NAME} PRIVATE iir::iir_static) endif() +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/iir1/all/test_package/conanfile.py b/recipes/iir1/all/test_package/conanfile.py index 9e186c01878a1..0a6bc68712d90 100644 --- a/recipes/iir1/all/test_package/conanfile.py +++ b/recipes/iir1/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/iir1/all/test_package/test_package.cpp b/recipes/iir1/all/test_package/test_package.cpp index 5e09ad6b47811..3746899f046a0 100644 --- a/recipes/iir1/all/test_package/test_package.cpp +++ b/recipes/iir1/all/test_package/test_package.cpp @@ -9,4 +9,3 @@ int main() return 0; } - diff --git a/recipes/iir1/all/test_v1_package/CMakeLists.txt b/recipes/iir1/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/iir1/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/iir1/all/test_v1_package/conanfile.py b/recipes/iir1/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/iir1/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/iir1/config.yml b/recipes/iir1/config.yml index ea8e29b620756..8e492271b1dfd 100644 --- a/recipes/iir1/config.yml +++ b/recipes/iir1/config.yml @@ -1,5 +1,5 @@ versions: - "1.9.0": - folder: "all" "1.9.1": folder: "all" + "1.9.0": + folder: "all" diff --git a/recipes/imake/all/conandata.yml b/recipes/imake/all/conandata.yml index b60e9f5b7c62c..e9b2090bb9e33 100644 --- a/recipes/imake/all/conandata.yml +++ b/recipes/imake/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "1.0.8": - patch_file: "patches/0001-reproducible-behavior.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-msvc-debug-build_type.patch" - base_path: "source_subfolder" diff --git a/recipes/imake/all/conanfile.py b/recipes/imake/all/conanfile.py index f5048e50d11a2..5e4171b55257f 100644 --- a/recipes/imake/all/conanfile.py +++ b/recipes/imake/all/conanfile.py @@ -1,17 +1,23 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -import contextlib +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import get, copy, rmdir, export_conandata_patches, apply_conandata_patches +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path, check_min_vs import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class ImakeConan(ConanFile): name = "imake" description = "Obsolete C preprocessor interface to the make utility" - topics = ("conan", "imake", "xmkmf", "preprocessor", "build", "system") + topics = ("xmkmf", "preprocessor", "build", "system") license = "MIT" homepage = "https://gitlab.freedesktop.org/xorg/util/imake" url = "https://github.com/conan-io/conan-center-index" + + package_type = "application" settings = "os", "arch", "compiler", "build_type" options = { "ccmakedep": [True, False], @@ -34,70 +40,55 @@ class ImakeConan(ConanFile): "xmkmf": True, } - exports_sources = "patches/*" - generators = "pkg_config" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def requirements(self): - self.requires("xorg-proto/2021.4") + self.requires("xorg-proto/2022.2") def build_requirements(self): - self.build_requires("automake/1.16.3") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("automake/1.16.5") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") if self._settings_build.os == "Windows": - self.build_requires("msys2/cci.latest") + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def package_id(self): del self.info.settings.compiler def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def export_sources(self): + export_conandata_patches(self) + + def generate(self): + venv = VirtualBuildEnv(self) + venv.generate() + + tc = AutotoolsToolchain(self) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "CXX": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "CPP": "{} cl -E".format(tools.unix_path(self._user_info_build["automake"].compile)), - } - with tools.environment_append(env): - yield - else: - yield - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") - self._autotools.libs = [] if self.settings.os == "Windows": - self._autotools.defines.append("WIN32") - if self.settings.compiler == "Visual Studio": - self._autotools.defines.extend([ + tc.extra_defines.append("WIN32") + if is_msvc(self): + tc.extra_defines.extend([ "_CRT_SECURE_NO_WARNINGS", "CROSSCOMPILE_CPP", ]) - self._autotools.flags.append("-FS") + if check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + yes_no = lambda v: "yes" if v else "no" conf_args = [ "--enable-ccmakedep={}".format(yes_no(self.options.ccmakedep)), @@ -109,32 +100,41 @@ def _configure_autotools(self): "--enable-revpath={}".format(yes_no(self.options.revpath)), "--enable-xmkmf={}".format(yes_no(self.options.xmkmf)), ] - - # FIXME: RAWCPP (ac_cv_path_RAWCPP) is not compatible with MSVC preprocessor. It needs to be cpp. - if tools.get_env("CPP"): + if "CPP" in os.environ: conf_args.extend([ - "--with-script-preproc-cmd={}".format(tools.get_env("CPP")), + "--with-script-preproc-cmd={}".format(os.environ["CPP"]), ]) - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + + env = tc.environment() + if is_msvc(self): + compile_wrapper = unix_path(self, self.conf.get('user.automake:compile-wrapper')) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("CPP", f"{compile_wrapper} cl -E") + # We may be able to use AutotoolsDeps, however there are outstanding + # issues with path conversions: https://github.com/conan-io/conan/issues/12784 + xorg_proto_include = unix_path(self, self.dependencies['xorg-proto'].cpp_info.aggregated_components().includedirs[0]) + env.append("CFLAGS", f"-I{xorg_proto_include}") + tc.generate(env) + + pkgconf = PkgConfigDeps(self) + pkgconf.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # tools.replace_in_file(os.path.join(self._source_subfolder, "")) - with self._build_context(): - autotools = self._configure_autotools() - autotools.make(args=["V=1"]) + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() + autotools.make(args=["V=1"]) def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libdirs = [] + self.cpp_info.includedirs = [] bin_path = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bin_path)) diff --git a/recipes/imake/all/test_package/conanfile.py b/recipes/imake/all/test_package/conanfile.py index 99bf0a8a9c2d8..4251d2cffa421 100644 --- a/recipes/imake/all/test_package/conanfile.py +++ b/recipes/imake/all/test_package/conanfile.py @@ -1,44 +1,45 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -import contextlib -import os -import shutil +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.files import copy +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, VCVars +from conan.tools.gnu import Autotools, AutotoolsToolchain -required_conan_version = ">=1.36.0" + +required_conan_version = ">=1.54.0" class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" - exports_sources = "Imakefile", "Imake.tmpl" + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - if not tools.get_env("CONAN_MAKE_PROGRAM"): - self.build_requires("make/4.2.1") - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "cl -nologo", - } - with tools.environment_append(env): - yield - else: - yield + if not self.conf.get("tools.gnu:make_program", check_type=str): + self.tool_requires("make/4.3") + + def layout(self): + basic_layout(self) + + def generate(self): + tc = AutotoolsToolchain(self) + + env = tc.environment() + if is_msvc(self): + env.define("CC", "cl -nologo") + ms = VCVars(self) + ms.generate(scope="run") + tc.generate(env) def build(self): - for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), os.path.join(self.build_folder, src)) - if not tools.cross_building(self): - with self._build_context(): - self.run("imake", run_environment=True) + if can_run(self): + copy(self, "Imake*", self.source_folder, self.build_folder) + self.run("imake", env="conanrun") + autotools = Autotools(self) + autotools.make() def test(self): - if not tools.cross_building(self): - autotools = AutoToolsBuildEnvironment(self) - autotools.make() + # test is successful if we can invoke make in the build step + pass diff --git a/recipes/imake/all/test_v1_package/Imake.tmpl b/recipes/imake/all/test_v1_package/Imake.tmpl new file mode 100644 index 0000000000000..3b7cb31780b8f --- /dev/null +++ b/recipes/imake/all/test_v1_package/Imake.tmpl @@ -0,0 +1,2 @@ +default: + @echo "IMAKE_TEMPLATE:" IMAKE_TEMPLATE diff --git a/recipes/imake/all/test_v1_package/Imakefile b/recipes/imake/all/test_v1_package/Imakefile new file mode 100644 index 0000000000000..8a9b031f63620 --- /dev/null +++ b/recipes/imake/all/test_v1_package/Imakefile @@ -0,0 +1 @@ +# Imakefile diff --git a/recipes/imake/all/test_v1_package/conanfile.py b/recipes/imake/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..99bf0a8a9c2d8 --- /dev/null +++ b/recipes/imake/all/test_v1_package/conanfile.py @@ -0,0 +1,44 @@ +from conans import AutoToolsBuildEnvironment, ConanFile, tools +import contextlib +import os +import shutil + +required_conan_version = ">=1.36.0" + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + exports_sources = "Imakefile", "Imake.tmpl" + + def build_requirements(self): + if not tools.get_env("CONAN_MAKE_PROGRAM"): + self.build_requires("make/4.2.1") + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + @contextlib.contextmanager + def _build_context(self): + if self.settings.compiler == "Visual Studio": + with tools.vcvars(self): + env = { + "CC": "cl -nologo", + } + with tools.environment_append(env): + yield + else: + yield + + def build(self): + for src in self.exports_sources: + shutil.copy(os.path.join(self.source_folder, src), os.path.join(self.build_folder, src)) + if not tools.cross_building(self): + with self._build_context(): + self.run("imake", run_environment=True) + + def test(self): + if not tools.cross_building(self): + autotools = AutoToolsBuildEnvironment(self) + autotools.make() diff --git a/recipes/imath/all/conandata.yml b/recipes/imath/all/conandata.yml index 406c04912aa65..c74e535dae312 100644 --- a/recipes/imath/all/conandata.yml +++ b/recipes/imath/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.1.6": + url: "https://github.com/AcademySoftwareFoundation/Imath/archive/v3.1.6.tar.gz" + sha256: "ea5592230f5ab917bea3ceab266cf38eb4aa4a523078d46eac0f5a89c52304db" "3.1.5": url: "https://github.com/AcademySoftwareFoundation/Imath/archive/refs/tags/v3.1.5.tar.gz" sha256: "1e9c7c94797cf7b7e61908aed1f80a331088cc7d8873318f70376e4aed5f25fb" diff --git a/recipes/imath/all/conanfile.py b/recipes/imath/all/conanfile.py index 283ef1037345d..79c783b58dc0a 100644 --- a/recipes/imath/all/conanfile.py +++ b/recipes/imath/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.files import collect_libs, copy, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class ImathConan(ConanFile): @@ -18,6 +18,7 @@ class ImathConan(ConanFile): homepage = "https://github.com/AcademySoftwareFoundation/Imath" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,18 +35,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/imath/all/test_package/conanfile.py b/recipes/imath/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/imath/all/test_package/conanfile.py +++ b/recipes/imath/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/imath/all/test_v1_package/CMakeLists.txt b/recipes/imath/all/test_v1_package/CMakeLists.txt index 1094e6d0adf29..0d20897301b68 100644 --- a/recipes/imath/all/test_v1_package/CMakeLists.txt +++ b/recipes/imath/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Imath REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Imath::Imath) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/imath/config.yml b/recipes/imath/config.yml index 93cee5ea459a0..566850eaffa71 100644 --- a/recipes/imath/config.yml +++ b/recipes/imath/config.yml @@ -1,4 +1,6 @@ versions: + "3.1.6": + folder: all "3.1.5": folder: all "3.1.4": diff --git a/recipes/imgui/all/CMakeLists.txt b/recipes/imgui/all/CMakeLists.txt index 4c944657b79ec..8c9bf128442ff 100644 --- a/recipes/imgui/all/CMakeLists.txt +++ b/recipes/imgui/all/CMakeLists.txt @@ -1,18 +1,12 @@ -cmake_minimum_required(VERSION 3.4) -project(imgui CXX) +cmake_minimum_required(VERSION 3.8) +project(imgui LANGUAGES CXX) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -set(CMAKE_CXX_STANDARD 11) - -set(SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) -set(MISC_DIR ${SOURCE_DIR}/misc) +set(MISC_DIR ${IMGUI_SRC_DIR}/misc) set(EXTRA_FONTS_DIR ${MISC_DIR}/fonts) set(IMGUI_EXPORT_HEADERS imgui_export_headers.h) -file(GLOB SOURCE_FILES ${SOURCE_DIR}/*.cpp) -file(GLOB HEADER_FILES ${SOURCE_DIR}/*.h) +file(GLOB SOURCE_FILES ${IMGUI_SRC_DIR}/*.cpp) +file(GLOB HEADER_FILES ${IMGUI_SRC_DIR}/*.h) file(GLOB EXTRA_FONTS_FILES ${EXTRA_FONTS_DIR}/*.ttf) if (MSVC) file(GLOB EXTRA_NATVIS_FILES ${MISC_DIR}/natvis/*.natvis) @@ -33,10 +27,11 @@ generate_export_header(${PROJECT_NAME} EXPORT_FILE_NAME ${IMGUI_EXPORT_HEADERS} ) target_include_directories(${PROJECT_NAME} PUBLIC - $ + $ $ $ ) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) include(GNUInstallDirs) diff --git a/recipes/imgui/all/conandata.yml b/recipes/imgui/all/conandata.yml index 161d4f1a18e49..d03383440b7f7 100644 --- a/recipes/imgui/all/conandata.yml +++ b/recipes/imgui/all/conandata.yml @@ -1,23 +1,32 @@ sources: - "1.85": - url: "https://github.com/ocornut/imgui/archive/v1.85.tar.gz" - sha256: "7ed49d1f4573004fa725a70642aaddd3e06bb57fcfe1c1a49ac6574a3e895a77" - "1.86": - url: "https://github.com/ocornut/imgui/archive/v1.86.tar.gz" - sha256: "6ba6ae8425a19bc52c5e067702c48b70e4403cd339cba02073a462730a63e825" - "1.87": - url: "https://github.com/ocornut/imgui/archive/v1.87.tar.gz" - sha256: "b54ceb35bda38766e36b87c25edf7a1cd8fd2cb8c485b245aedca6fb85645a20" + "1.89.2": + url: "https://github.com/ocornut/imgui/archive/v1.89.2.tar.gz" + sha256: "e110beffda505e6954feb7b13541d35a7c12a176b9723290c853684713df6a67" + "1.89.1": + url: "https://github.com/ocornut/imgui/archive/v1.89.1.tar.gz" + sha256: "6d02a0079514d869e4b5f8f590f9060259385fcddd93a07ef21298b6a9610cbd" "1.88": url: "https://github.com/ocornut/imgui/archive/v1.88.tar.gz" sha256: "9f14c788aee15b777051e48f868c5d4d959bd679fc5050e3d2a29de80d8fd32e" + "1.87": + url: "https://github.com/ocornut/imgui/archive/v1.87.tar.gz" + sha256: "b54ceb35bda38766e36b87c25edf7a1cd8fd2cb8c485b245aedca6fb85645a20" + "1.86": + url: "https://github.com/ocornut/imgui/archive/v1.86.tar.gz" + sha256: "6ba6ae8425a19bc52c5e067702c48b70e4403cd339cba02073a462730a63e825" + "1.85": + url: "https://github.com/ocornut/imgui/archive/v1.85.tar.gz" + sha256: "7ed49d1f4573004fa725a70642aaddd3e06bb57fcfe1c1a49ac6574a3e895a77" # These versions belong to the docking branch in ImGUI repository. This branch is declared stable and production ready, and # it is synced with `master` regularly. These versions are taken from that branch using the commit where `master` was synced # after a regular release - "cci.20220207+1.87.docking": - url: "https://github.com/ocornut/imgui/archive/1ee252772ae9c0a971d06257bb5c89f628fa696a.tar.gz" - sha256: "c50e263660e1deb6e85b10a0382bf8a6fc861645e44b7012bd32da5460829ae0" + "cci.20230105+1.89.2.docking": + url: "https://github.com/ocornut/imgui/archive/d822c65317ba881798bed8fce9ffba267d27dada.zip" + sha256: "0d2c09ae4c450d4c74f62e66667809752c9d11438354fc331ed9da5d5e850071" "cci.20220621+1.88.docking": url: "https://github.com/ocornut/imgui/archive/9cd9c2eff99877a3f10a7f9c2a3a5b9c15ea36c6.tar.gz" sha256: "61fb1ce5d48089bce1b4f92e9320fd234b2ce960f35f965b313c4842b3c8e440" + "cci.20220207+1.87.docking": + url: "https://github.com/ocornut/imgui/archive/1ee252772ae9c0a971d06257bb5c89f628fa696a.tar.gz" + sha256: "c50e263660e1deb6e85b10a0382bf8a6fc861645e44b7012bd32da5460829ae0" diff --git a/recipes/imgui/all/conanfile.py b/recipes/imgui/all/conanfile.py index ce6065c4f8805..8fc402938d64d 100644 --- a/recipes/imgui/all/conanfile.py +++ b/recipes/imgui/all/conanfile.py @@ -1,18 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, replace_in_file +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os import re -import functools - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class IMGUIConan(ConanFile): name = "imgui" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/ocornut/imgui" description = "Bloat-free Immediate Mode Graphical User interface for C++ with minimal dependencies" - topics = "gui", "graphical", "bloat-free" license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ocornut/imgui" + topics = ("gui", "graphical", "bloat-free") settings = "os", "arch", "compiler", "build_type" options = { @@ -24,12 +25,8 @@ class IMGUIConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -37,49 +34,53 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["IMGUI_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def _patch_sources(self): # Ensure we take into account export_headers - tools.replace_in_file( - os.path.join(self._source_subfolder, "imgui.h"), + replace_in_file(self, + os.path.join(self.source_folder, "imgui.h"), "#ifdef IMGUI_USER_CONFIG", "#include \"imgui_export_headers.h\"\n\n#ifdef IMGUI_USER_CONFIG" ) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) m = re.match(r'cci\.\d{8}\+(?P\d+\.\d+)\.docking', str(self.version)) - version = tools.Version(m.group('version')) if m else tools.Version(self.version) + version = Version(m.group('version')) if m else Version(self.version) backends_folder = os.path.join( - self._source_subfolder, + self.source_folder, "backends" if version >= "1.80" else "examples" ) - self.copy(pattern="imgui_impl_*", - dst=os.path.join("res", "bindings"), - src=backends_folder) - cmake = self._configure_cmake() + copy(self, pattern="imgui_impl_*", + dst=os.path.join(self.package_folder, "res", "bindings"), + src=backends_folder) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["imgui"] if self.settings.os == "Linux": self.cpp_info.system_libs.append("m") + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("imm32") self.cpp_info.srcdirs = [os.path.join("res", "bindings")] bin_path = os.path.join(self.package_folder, "bin") diff --git a/recipes/imgui/all/test_package/CMakeLists.txt b/recipes/imgui/all/test_package/CMakeLists.txt index 149dce3c5ea95..3e9ea943d420e 100644 --- a/recipes/imgui/all/test_package/CMakeLists.txt +++ b/recipes/imgui/all/test_package/CMakeLists.txt @@ -1,16 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(imgui REQUIRED) - -set(CMAKE_CXX_STANDARD 11) +find_package(imgui REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} imgui::imgui) +target_link_libraries(${PROJECT_NAME} PRIVATE imgui::imgui) if (DOCKING) target_compile_definitions(${PROJECT_NAME} PRIVATE -DDOCKING) endif() target_compile_definitions(${PROJECT_NAME} PUBLIC "IMGUI_USER_CONFIG=\"${CMAKE_CURRENT_SOURCE_DIR}/my_imgui_config.h\"") +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/imgui/all/test_package/conanfile.py b/recipes/imgui/all/test_package/conanfile.py index 4d96fd6e47c6d..a9fb96656f203 100644 --- a/recipes/imgui/all/test_package/conanfile.py +++ b/recipes/imgui/all/test_package/conanfile.py @@ -1,21 +1,26 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) + def layout(self): + cmake_layout(self) + def build(self): cmake = CMake(self) - cmake.definitions["DOCKING"] = 'docking' in self.tested_reference_str cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/imgui/all/test_v1_package/CMakeLists.txt b/recipes/imgui/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/imgui/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/imgui/all/test_v1_package/conanfile.py b/recipes/imgui/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/imgui/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/imgui/config.yml b/recipes/imgui/config.yml index b7d57d4025d66..197f6df1cc123 100644 --- a/recipes/imgui/config.yml +++ b/recipes/imgui/config.yml @@ -1,17 +1,23 @@ versions: - "1.85": + "1.89.2": folder: all - "1.86": + "1.89.1": + folder: all + "1.88": folder: all "1.87": folder: all - "1.88": + "1.86": + folder: all + "1.85": folder: all # These versions belong to the docking branch in ImGUI repository. This branch is declared stable and production ready, and # it is synced with `master` regularly. These versions are taken from that branch using the commit where `master` was synced # after a regular release - "cci.20220207+1.87.docking": + "cci.20230105+1.89.2.docking": folder: all "cci.20220621+1.88.docking": folder: all + "cci.20220207+1.87.docking": + folder: all diff --git a/recipes/immer/all/conandata.yml b/recipes/immer/all/conandata.yml index ddeee2641190b..811b858690dba 100644 --- a/recipes/immer/all/conandata.yml +++ b/recipes/immer/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.8.0": + url: "https://github.com/arximboldi/immer/archive/v0.8.0.tar.gz" + sha256: "4ed9e86a525f293e0ba053107b937d88b032674ec6e5db958816f2e412677fde" "0.7.0": url: "https://github.com/arximboldi/immer/archive/v0.7.0.tar.gz" sha256: "cf67ab428aa3610eb0f72d0ea936c15cce3f91df26ee143ab783acd053507fe4" diff --git a/recipes/immer/config.yml b/recipes/immer/config.yml index d4f601d9832b3..9e53a8732b403 100644 --- a/recipes/immer/config.yml +++ b/recipes/immer/config.yml @@ -1,4 +1,6 @@ versions: + "0.8.0": + folder: all "0.7.0": folder: all "0.6.2": diff --git a/recipes/implot/all/conandata.yml b/recipes/implot/all/conandata.yml index 34e2b204e07d9..21af4dfe87312 100644 --- a/recipes/implot/all/conandata.yml +++ b/recipes/implot/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.14": + url: "https://github.com/epezent/implot/archive/v0.14.tar.gz" + sha256: "1613af3e6554c0a74de20c6e60e9bce5ce35c2d4f9e1aa5ff963f7fe2d48af88" "0.13": url: "https://github.com/epezent/implot/archive/v0.13.tar.gz" sha256: "acc8b012b6761c9b7ce1599a35fd861ac6dafb01368b1e938c90a3f654bd7589" diff --git a/recipes/implot/config.yml b/recipes/implot/config.yml index 7c7562b414e8f..d62abd0d999a8 100644 --- a/recipes/implot/config.yml +++ b/recipes/implot/config.yml @@ -1,4 +1,6 @@ versions: + "0.14": + folder: "all" "0.13": folder: "all" "0.12": diff --git a/recipes/imutils-cpp/all/conandata.yml b/recipes/imutils-cpp/all/conandata.yml new file mode 100644 index 0000000000000..32d51c439957b --- /dev/null +++ b/recipes/imutils-cpp/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.0.1": + url: "https://github.com/thedevmanek/imutils-cpp/archive/refs/tags/v1.0.1.tar.gz" + sha256: "de79dce695a20550de1c383f74bf034ade22686f1197308ec612a1fb05fcf67a" +patches: + "1.0.1": + - patch_file: "patches/1.0.1-0001-fix-cmake.patch" + - patch_file: "patches/1.0.1-0002-unuse-bits_stdcpp_h.patch" + - patch_file: "patches/1.0.1-0003-fix-path-cast.patch" diff --git a/recipes/imutils-cpp/all/conanfile.py b/recipes/imutils-cpp/all/conanfile.py new file mode 100644 index 0000000000000..d577073c8baef --- /dev/null +++ b/recipes/imutils-cpp/all/conanfile.py @@ -0,0 +1,106 @@ +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake, cmake_layout +from conan.tools import files +from conan.tools import scm +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches +from conan.tools.build import check_min_cppstd + +import os + +required_conan_version = ">=1.50.0" + +class ImutilsCppConan(ConanFile): + name = "imutils-cpp" + description = "This is a cpp version of popular python computer vision library imutils." + license = "Apache-2.0" + topics = ("opencv", "imutils", "computer vision", ) + homepage = "https://github.com/thedevmanek/imutils-cpp" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _minimum_cpp_standard(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "9", + "Visual Studio": "15.7", + "msvc": "19.14", + "clang": "12", + "apple-clang": "10.14", + } + + def export_sources(self): + for p in self.conan_data.get("patches", {}).get(self.version, []): + files.copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires("opencv/4.5.5") + self.requires("libcurl/7.84.0") + self.requires("openssl/1.1.1q") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and scm.Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") + + def source(self): + files.get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + toolchain = CMakeToolchain(self) + toolchain.cache_variables["CMAKE_CXX_STANDARD"] = self._minimum_cpp_standard + toolchain.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + files.copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + files.rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.libs = ["imutils_cpp"] + + self.cpp_info.set_property("cmake_file_name", "imutils_cpp") + self.cpp_info.set_property("cmake_target_name", "imutils_cpp::imutils_cpp") + + self.cpp_info.requires.append("opencv::opencv") + self.cpp_info.requires.append("libcurl::libcurl") + + # TODO: Remove after Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "imutils_cpp" + self.cpp_info.names["cmake_find_package_multi"] = "imutils_cpp" diff --git a/recipes/imutils-cpp/all/patches/1.0.1-0001-fix-cmake.patch b/recipes/imutils-cpp/all/patches/1.0.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..66ed5cd60c766 --- /dev/null +++ b/recipes/imutils-cpp/all/patches/1.0.1-0001-fix-cmake.patch @@ -0,0 +1,43 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7418a34..82b1777 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,13 +1,26 @@ + cmake_minimum_required(VERSION 3.9) + project(imutils_cpp VERSION 1.0.1 DESCRIPTION "imutils_cpp A series of convenience functions to make basic image processing functions such as translation, rotation, resizing and skeletonization easier with OpenCV ") ++set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + find_package(OpenCV REQUIRED) ++find_package(CURL REQUIRED) + include(GNUInstallDirs) +-add_library(imutils_cpp SHARED STATIC src/text.cpp include/imutils/text.h src/paths.cpp include/imutils/paths.h src/perspective.cpp include/imutils/perspective.h src/convenience.cpp include/imutils/convenience.h) +-set_target_properties(imutils_cpp PROPERTIES VERSION ${PROJECT_VERSION}) ++add_library(imutils_cpp src/text.cpp src/paths.cpp src/perspective.cpp src/convenience.cpp) ++set(IMUTILS_HEADERS include/imutils/text.h include/imutils/paths.h include/imutils/perspective.h include/imutils/convenience.h) ++set_target_properties(imutils_cpp PROPERTIES ++ VERSION ${PROJECT_VERSION} ++ PUBLIC_HEADER "${IMUTILS_HEADERS}" ++) + target_include_directories(imutils_cpp PRIVATE include) + target_include_directories(imutils_cpp PRIVATE src) + include(GNUInstallDirs) + install(TARGETS imutils_cpp + ${PROJECT_NAME} +- DESTINATION lib/${PROJECT_NAME}) +-target_link_libraries(imutils_cpp ${OpenCV_LIBS} curl) ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/imutils ++) ++target_link_libraries(imutils_cpp opencv::opencv CURL::libcurl) ++if (MSVC) ++ target_compile_options(imutils_cpp PRIVATE "/permissive-") ++endif() +diff --git b/build/.cmake/api/v1/query/client-vscode/query.json b/build/.cmake/api/v1/query/client-vscode/query.json +new file mode 100644 +index 0000000..82bb964 +--- /dev/null ++++ b/build/.cmake/api/v1/query/client-vscode/query.json +@@ -0,0 +1 @@ ++{"requests":[{"kind":"cache","version":2},{"kind":"codemodel","version":2},{"kind":"toolchains","version":1},{"kind":"cmakeFiles","version":1}]} +\ No newline at end of file diff --git a/recipes/imutils-cpp/all/patches/1.0.1-0002-unuse-bits_stdcpp_h.patch b/recipes/imutils-cpp/all/patches/1.0.1-0002-unuse-bits_stdcpp_h.patch new file mode 100644 index 0000000000000..2b2214447761b --- /dev/null +++ b/recipes/imutils-cpp/all/patches/1.0.1-0002-unuse-bits_stdcpp_h.patch @@ -0,0 +1,49 @@ +diff --git a/include/imutils/paths.h b/include/imutils/paths.h +index 29bc503..56b78e5 100644 +--- a/include/imutils/paths.h ++++ b/include/imutils/paths.h +@@ -5,7 +5,8 @@ + #define PATH_H + + #include "filesystem" +-#include "bits/stdc++.h" ++#include ++#include + /** @file paths.h **/ + /***************************************************************************//** + *@class Path +@@ -39,4 +40,4 @@ public: + std::vector + listFiles(std::string basePath, std::vector validExts = {}, std::string contains = "" + ); +-}; +\ No newline at end of file ++}; +diff --git a/src/paths.cpp b/src/paths.cpp +index 380be73..d0bc7f5 100644 +--- a/src/paths.cpp ++++ b/src/paths.cpp +@@ -2,7 +2,9 @@ + // Created by jonsnow on 07/02/22. + // + #include "filesystem" +-#include "bits/stdc++.h" ++#include ++#include ++#include + #include "../include/imutils/paths.h" + + namespace fs = std::filesystem; +diff --git a/src/text.cpp b/src/text.cpp +index 73bec10..6336964 100644 +--- a/src/text.cpp ++++ b/src/text.cpp +@@ -1,5 +1,7 @@ + #include "string" +-#include "bits/stdc++.h" ++#include ++#include ++#include + #include "opencv2/core.hpp" + #include "opencv2/imgproc.hpp" + diff --git a/recipes/imutils-cpp/all/patches/1.0.1-0003-fix-path-cast.patch b/recipes/imutils-cpp/all/patches/1.0.1-0003-fix-path-cast.patch new file mode 100644 index 0000000000000..7658e09e6bedd --- /dev/null +++ b/recipes/imutils-cpp/all/patches/1.0.1-0003-fix-path-cast.patch @@ -0,0 +1,22 @@ +diff --git a/src/paths.cpp b/src/paths.cpp +index d0bc7f5..d39ffb6 100644 +--- a/src/paths.cpp ++++ b/src/paths.cpp +@@ -19,14 +19,14 @@ std::vector Path::listFiles(std::string basePath, std::vector filesDirs; + for (const auto &dirEntry: fs::recursive_directory_iterator(basePath)) { + std::filesystem::path file = dirEntry.path(); +- if (contains != "" and ((std::string) file.filename()).find(contains) == std::string::npos) { ++ if (contains != "" and file.filename().string().find(contains) == std::string::npos) { + continue; + } + if (validExts.empty()) { +- filesDirs.push_back(dirEntry.path()); ++ filesDirs.push_back(dirEntry.path().string()); + } else { + if (std::find(validExts.begin(), validExts.end(), file.extension()) != validExts.end()){ +- filesDirs.push_back(dirEntry.path()); ++ filesDirs.push_back(dirEntry.path().string()); + + } + diff --git a/recipes/imutils-cpp/all/test_package/CMakeLists.txt b/recipes/imutils-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7dc0936c26b56 --- /dev/null +++ b/recipes/imutils-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +find_package(imutils_cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE imutils_cpp::imutils_cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/imutils-cpp/all/test_package/conanfile.py b/recipes/imutils-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..c7933801f1176 --- /dev/null +++ b/recipes/imutils-cpp/all/test_package/conanfile.py @@ -0,0 +1,22 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/imutils-cpp/all/test_package/test_package.cpp b/recipes/imutils-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..42bfe878da9e8 --- /dev/null +++ b/recipes/imutils-cpp/all/test_package/test_package.cpp @@ -0,0 +1,10 @@ +#include + +#include + +int main() { + cv::Mat image1 = cv::Mat::eye(256, 256, CV_8UC3); + cv::Mat image2 = Convenience::translate(image1, 5.0, 3.0); + + return 0; +} diff --git a/recipes/imutils-cpp/all/test_v1_package/CMakeLists.txt b/recipes/imutils-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..529de77d0cf37 --- /dev/null +++ b/recipes/imutils-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(imutils_cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE imutils_cpp::imutils_cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/imutils-cpp/all/test_v1_package/conanfile.py b/recipes/imutils-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2490acfa82ff8 --- /dev/null +++ b/recipes/imutils-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/imutils-cpp/config.yml b/recipes/imutils-cpp/config.yml new file mode 100644 index 0000000000000..715e55357a17b --- /dev/null +++ b/recipes/imutils-cpp/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.1": + folder: all diff --git a/recipes/indicators/all/conandata.yml b/recipes/indicators/all/conandata.yml index 3b571273f51e6..792bebf8a5f19 100644 --- a/recipes/indicators/all/conandata.yml +++ b/recipes/indicators/all/conandata.yml @@ -8,4 +8,3 @@ sources: "2.2": url: "https://github.com/p-ranav/indicators/archive/v2.2.tar.gz" sha256: "b768f1b7ca64a413503f72d5460cc617c1458c17fb7a8c0ee503d753e1f20d03" - diff --git a/recipes/indicators/all/conanfile.py b/recipes/indicators/all/conanfile.py index 8981baf41e1d7..b036d160966a5 100644 --- a/recipes/indicators/all/conanfile.py +++ b/recipes/indicators/all/conanfile.py @@ -1,7 +1,13 @@ import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +required_conan_version = ">=1.53.0" class IndicatorsConan(ConanFile): name = "indicators" @@ -9,37 +15,36 @@ class IndicatorsConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "Activity Indicators for Modern C++" license = "MIT" - settings = "compiler", "os" - topics = ("conan", "indicators", "activity", "indicator", "loading", "spinner", "animation", "progress") + settings = "os", "arch", "compiler", "build_type" + topics = ("indicators", "activity", "indicator", "loading", "spinner", "animation", "progress") no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") - def configure(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - - if tools.Version(self.version) < "2.0" and self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration( - "indicators < 2.0 can't be used by {0} {1}".format( - self.settings.compiler, - self.settings.compiler.version + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + + if Version(self.version) < "2.0": + if is_msvc(self) or (self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5"): + raise ConanInvalidConfiguration( + "indicators < 2.0 can't be used by {0} {1}".format( + self.settings.compiler, + self.settings.compiler.version + ) ) - ) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("{}-{}".format(self.name, self.version), self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - self.copy(pattern="*.h", src=os.path.join(self._source_subfolder, "include"), dst="include") - self.copy(pattern="*.hpp", src=os.path.join(self._source_subfolder, "include"), dst="include") - - def package_id(self): - self.info.header_only() + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, pattern="*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): if self.settings.os == "Linux": diff --git a/recipes/inih/all/conanfile.py b/recipes/inih/all/conanfile.py index 10b7f92326704..d2890dd500498 100644 --- a/recipes/inih/all/conanfile.py +++ b/recipes/inih/all/conanfile.py @@ -8,17 +8,18 @@ from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.49.0" +required_conan_version = ">=1.53.0" class InihConan(ConanFile): name = "inih" description = "Simple .INI file parser in C, good for embedded systems " license = "BSD-3-Clause" - topics = ("inih", "ini", "configuration", "parser") + topics = ("ini", "configuration", "parser") homepage = "https://github.com/benhoyt/inih" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,42 +36,31 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.info.options.shared and is_msvc(self): + if self.options.shared and is_msvc(self): raise ConanInvalidConfiguration("Shared inih is not supported with msvc") def build_requirements(self): - self.tool_requires("meson/0.63.1") - - def layout(self): - basic_layout(self, src_folder="src") + self.tool_requires("meson/1.0.0") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + env = VirtualBuildEnv(self) + env.generate() tc = MesonToolchain(self) tc.project_options["distro_install"] = True tc.project_options["with_INIReader"] = True - # TODO: fixed in conan 1.51.0? - tc.project_options["bindir"] = "bin" - tc.project_options["libdir"] = "lib" tc.generate() - env = VirtualBuildEnv(self) - env.generate(scope="build") - def build(self): meson = Meson(self) meson.configure() @@ -95,10 +85,10 @@ def package_info(self): self.cpp_info.components["inireader"].requires = ["libinih"] def fix_msvc_libname(conanfile, remove_lib_prefix=True): - """remove lib prefix & change extension to .lib""" + """remove lib prefix & change extension to .lib in case of cl like compiler""" from conan.tools.files import rename import glob - if not is_msvc(conanfile): + if not conanfile.settings.get_safe("compiler.runtime"): return libdirs = getattr(conanfile.cpp.package, "libdirs") for libdir in libdirs: diff --git a/recipes/inih/all/test_package/conanfile.py b/recipes/inih/all/test_package/conanfile.py index 43b19d1f08b9a..8dd087fd1cbd1 100644 --- a/recipes/inih/all/test_package/conanfile.py +++ b/recipes/inih/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os import textwrap @@ -8,20 +8,21 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): with open("test.ini", "w") as fn: fn.write(textwrap.dedent("""\ [protocol] diff --git a/recipes/inih/all/test_v1_package/CMakeLists.txt b/recipes/inih/all/test_v1_package/CMakeLists.txt index 65b2e905e1b37..0d20897301b68 100644 --- a/recipes/inih/all/test_v1_package/CMakeLists.txt +++ b/recipes/inih/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(inih REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE inih::inih) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/inih/all/test_v1_package/conanfile.py b/recipes/inih/all/test_v1_package/conanfile.py index 3394a39caa745..5e82a4d078b63 100644 --- a/recipes/inih/all/test_v1_package/conanfile.py +++ b/recipes/inih/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os import textwrap diff --git a/recipes/inja/all/conandata.yml b/recipes/inja/all/conandata.yml index 31e508b43a016..c930e439e86ca 100644 --- a/recipes/inja/all/conandata.yml +++ b/recipes/inja/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.4.0": + url: "https://github.com/pantor/inja/archive/v3.4.0.tar.gz" + sha256: "7155f944553ca6064b26e88e6cae8b71f8be764832c9c7c6d5998e0d5fd60c55" "3.3.0": url: "https://github.com/pantor/inja/archive/v3.3.0.tar.gz" sha256: "e628d994762dcdaa9a97f63a9b8b73d9af51af0ffa5acea6bdbba0aceaf8ee25" diff --git a/recipes/inja/all/conanfile.py b/recipes/inja/all/conanfile.py index ef0c873020773..e211c74ba199b 100644 --- a/recipes/inja/all/conanfile.py +++ b/recipes/inja/all/conanfile.py @@ -1,7 +1,9 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.files import copy, get from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os required_conan_version = ">=1.50.0" @@ -17,6 +19,22 @@ class InjaConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True + @property + def _min_cppstd(self): + return 11 if Version(self.version) < "3.4.0" else 17 + + @property + def _compilers_minimum_version(self): + if self._min_cppstd == 11: + return {} + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } + def requirements(self): self.requires("nlohmann_json/3.11.2") @@ -25,7 +43,12 @@ def package_id(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - check_min_cppstd(self, 11) + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def layout(self): basic_layout(self, src_folder="src") diff --git a/recipes/inja/all/test_package/CMakeLists.txt b/recipes/inja/all/test_package/CMakeLists.txt index e938e7d47ed20..493c014fdc1c8 100644 --- a/recipes/inja/all/test_package/CMakeLists.txt +++ b/recipes/inja/all/test_package/CMakeLists.txt @@ -5,4 +5,8 @@ find_package(inja REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE pantor::inja) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if(inja_VERSION VERSION_LESS "3.4.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/inja/all/test_v1_package/CMakeLists.txt b/recipes/inja/all/test_v1_package/CMakeLists.txt index 91d516c3ec515..b4b25bff2f0cd 100644 --- a/recipes/inja/all/test_v1_package/CMakeLists.txt +++ b/recipes/inja/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(inja REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE pantor::inja) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/inja/config.yml b/recipes/inja/config.yml index 8b57847852970..05a145a493718 100644 --- a/recipes/inja/config.yml +++ b/recipes/inja/config.yml @@ -1,4 +1,6 @@ versions: + "3.4.0": + folder: all "3.3.0": folder: all "3.2.0": diff --git a/recipes/innoextract/all/CMakeLists.txt b/recipes/innoextract/all/CMakeLists.txt deleted file mode 100644 index 70869870556c6..0000000000000 --- a/recipes/innoextract/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATH) - -add_subdirectory("source_subfolder") diff --git a/recipes/innoextract/all/conandata.yml b/recipes/innoextract/all/conandata.yml index 93262a96d6979..a280c970476d1 100644 --- a/recipes/innoextract/all/conandata.yml +++ b/recipes/innoextract/all/conandata.yml @@ -7,6 +7,4 @@ sources: patches: "1.9.0": - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-remove-custom-cmake-find-modules.patch" - base_path: "source_subfolder" diff --git a/recipes/innoextract/all/conanfile.py b/recipes/innoextract/all/conanfile.py index 2d0098f3d9b93..c21ccf578684a 100644 --- a/recipes/innoextract/all/conanfile.py +++ b/recipes/innoextract/all/conanfile.py @@ -1,70 +1,71 @@ +from conan import ConanFile +from conan.tools.files import get, rmdir, copy, apply_conandata_patches, export_conandata_patches +from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain +from conan.tools.env import VirtualBuildEnv import os -import functools -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.33.0" + +required_conan_version = ">=1.52.0" class InnoextractConan(ConanFile): name = "innoextract" description = "Extract contents of Inno Setup installers" - license = "innoextract License" + license = "LicenseRef-LICENSE" topics = ("inno-setup", "decompression") - homepage = "https://constexpr.org/innoextract/" + homepage = "https://constexpr.org/innoextract" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/*"] - requires = ( - "boost/1.78.0", - "xz_utils/5.2.5", - "libiconv/1.16" - ) - generators = "cmake", "cmake_find_package" settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + def requirements(self): + self.requires("boost/1.80.0") + self.requires("xz_utils/5.2.5") + self.requires("libiconv/1.17") - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - os.remove(os.path.join(self._source_subfolder, 'cmake', 'FindLZMA.cmake')) - os.remove(os.path.join(self._source_subfolder, 'cmake', 'Findiconv.cmake')) - cmake = self._configure_cmake() - cmake.build() + def package_id(self): + del self.info.settings.compiler + self.info.requires.clear() - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True, + destination=self.source_folder) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) # Turn off static library detection, which is on by default on Windows. # This keeps the CMakeLists.txt from trying to detect static Boost # libraries and use Boost components for zlib and BZip2. Getting the # libraries via Conan does the correct thing without other assistance. - cmake.definitions["USE_STATIC_LIBS"] = False - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["USE_STATIC_LIBS"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + os.remove(os.path.join(self.source_folder, 'cmake', 'FindLZMA.cmake')) + os.remove(os.path.join(self.source_folder, 'cmake', 'Findiconv.cmake')) + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - - def package_id(self): - del self.info.settings.compiler - self.info.requires.clear() + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}" - .format(bindir)) + self.output.info(f"Appending PATH environment variable: {bindir}") self.env_info.PATH.append(bindir) diff --git a/recipes/innoextract/all/patches/0001-cmake-fix-module.patch b/recipes/innoextract/all/patches/0001-cmake-fix-module.patch index 6c34cbad3eda2..2997e1cb0a3a5 100644 --- a/recipes/innoextract/all/patches/0001-cmake-fix-module.patch +++ b/recipes/innoextract/all/patches/0001-cmake-fix-module.patch @@ -3,11 +3,11 @@ index dbb64f1..a8a67e8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -105,7 +105,7 @@ endif() - + include(CheckSymbolExists) - + -set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") # For custom cmake modules -+list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") # For custom cmake modules ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") # For custom cmake modules include(BuildType) include(CompileCheck) include(CreateSourceGroups) diff --git a/recipes/innoextract/all/test_package/conanfile.py b/recipes/innoextract/all/test_package/conanfile.py index dc77b21f20519..6a4e652eac543 100644 --- a/recipes/innoextract/all/test_package/conanfile.py +++ b/recipes/innoextract/all/test_package/conanfile.py @@ -1,19 +1,14 @@ -from six import StringIO -from conans import ConanFile, tools - +from conan import ConanFile +from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "arch", "build_type", "compiler" + generators = "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - output = StringIO() - self.run("innoextract --version", output=output, - run_environment=True) - output_str = str(output.getvalue()) - self.output.info("Installed version: {}".format(output_str)) - require_version = str(self.deps_cpp_info["innoextract"].version) - require_version = ".".join(require_version.split(".")[:2]) - self.output.info("Expected version: {}".format(require_version)) - assert_innoextract_version = "innoextract %s" % require_version - assert(assert_innoextract_version in output_str) + if can_run(self): + self.run("innoextract --version", env="conanrun") diff --git a/recipes/innoextract/all/test_v1_package/conanfile.py b/recipes/innoextract/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..dc77b21f20519 --- /dev/null +++ b/recipes/innoextract/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from six import StringIO +from conans import ConanFile, tools + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "build_type", "compiler" + + def test(self): + if not tools.cross_building(self): + output = StringIO() + self.run("innoextract --version", output=output, + run_environment=True) + output_str = str(output.getvalue()) + self.output.info("Installed version: {}".format(output_str)) + require_version = str(self.deps_cpp_info["innoextract"].version) + require_version = ".".join(require_version.split(".")[:2]) + self.output.info("Expected version: {}".format(require_version)) + assert_innoextract_version = "innoextract %s" % require_version + assert(assert_innoextract_version in output_str) diff --git a/recipes/irrxml/all/conanfile.py b/recipes/irrxml/all/conanfile.py index e07a0f1dba815..3cde0e710bef6 100644 --- a/recipes/irrxml/all/conanfile.py +++ b/recipes/irrxml/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, load, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, save import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class IrrXMLConan(ConanFile): @@ -14,6 +14,7 @@ class IrrXMLConan(ConanFile): description = "irrXML is a simple and fast open source xml parser for C++" topics = ("xml", "xml-parser", "parser", "xml-reader") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,8 +27,7 @@ class IrrXMLConan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,14 +35,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/irrxml/all/test_package/conanfile.py b/recipes/irrxml/all/test_package/conanfile.py index f21acc4ed5535..6ae908895e238 100644 --- a/recipes/irrxml/all/test_package/conanfile.py +++ b/recipes/irrxml/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,20 +7,21 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") xml_path = os.path.join(self.source_folder, "config.xml") self.run(f"{bin_path} {xml_path}", env="conanrun") diff --git a/recipes/irrxml/all/test_v1_package/CMakeLists.txt b/recipes/irrxml/all/test_v1_package/CMakeLists.txt index e26819dcc3af3..0d20897301b68 100644 --- a/recipes/irrxml/all/test_v1_package/CMakeLists.txt +++ b/recipes/irrxml/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(irrxml REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE irrxml::irrxml) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/iso8601lib/all/conandata.yml b/recipes/iso8601lib/all/conandata.yml new file mode 100644 index 0000000000000..8eea2b2330999 --- /dev/null +++ b/recipes/iso8601lib/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20230123": + url: "https://github.com/TimSC/iso8601lib/archive/7a0cd0ff1bffd3f7a436e25860f5b461f4c35dc6.zip" + sha256: "2d6363eda2ec958bd7da735ca9520d658df11666326e96f20f278db565b9af73" diff --git a/recipes/iso8601lib/all/conanfile.py b/recipes/iso8601lib/all/conanfile.py new file mode 100644 index 0000000000000..76c226dbda05f --- /dev/null +++ b/recipes/iso8601lib/all/conanfile.py @@ -0,0 +1,63 @@ +from conan import ConanFile +from conan.tools.files import get, copy, collect_libs +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.53.0" + + +class Iso8601LibConan(ConanFile): + name = "iso8601lib" + description = "Parsing a subset of ISO 8601 datetimes, dates and times in C." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/TimSC/iso8601lib" + topics = ("iso8601", "date", "time", "timezone") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + # To install relocatable shared libs on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = collect_libs(self) + + self.cpp_info.defines.append("ISO8601LIB_EXPORT") diff --git a/recipes/iso8601lib/all/test_package/CMakeLists.txt b/recipes/iso8601lib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..1b48f1b1d59ba --- /dev/null +++ b/recipes/iso8601lib/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(iso8601lib REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE iso8601lib::iso8601lib) diff --git a/recipes/iso8601lib/all/test_package/conanfile.py b/recipes/iso8601lib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/iso8601lib/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/iso8601lib/all/test_package/test_package.cpp b/recipes/iso8601lib/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..65ca7d176e2f7 --- /dev/null +++ b/recipes/iso8601lib/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include +#include +#include +#include "iso8601.h" + +int main(void) +{ + const char* dateTime = "1997-07-16T19:20:30.45+01:00"; + + struct tm isoDateTime; + int timezoneOffsetMin; + if (ParseIso8601Datetime(dateTime, &isoDateTime, &timezoneOffsetMin)) + { + std::cout << "Year: " << isoDateTime.tm_year + 1900 << "\n"; + std::cout << "Month: " << isoDateTime.tm_mon + 1 << "\n"; + std::cout << "Day: " << isoDateTime.tm_mday << "\n"; + std::cout << "Hour: " << isoDateTime.tm_hour << "\n"; + std::cout << "Minute: " << isoDateTime.tm_min << "\n"; + std::cout << "Second: " << isoDateTime.tm_sec << "\n"; + std::cout << "Timezone offset: " << timezoneOffsetMin << "\n"; + } + else + { + std::cout << "Could not parse datetime " << dateTime << "\n"; + } + return EXIT_SUCCESS; +} diff --git a/recipes/iso8601lib/all/test_v1_package/CMakeLists.txt b/recipes/iso8601lib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/iso8601lib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/iso8601lib/all/test_v1_package/conanfile.py b/recipes/iso8601lib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/iso8601lib/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/iso8601lib/config.yml b/recipes/iso8601lib/config.yml new file mode 100644 index 0000000000000..0d07bd41f0619 --- /dev/null +++ b/recipes/iso8601lib/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20230123": + folder: all diff --git a/recipes/itlib/all/conandata.yml b/recipes/itlib/all/conandata.yml index e8fc93708b1a0..57fdc47852061 100644 --- a/recipes/itlib/all/conandata.yml +++ b/recipes/itlib/all/conandata.yml @@ -1,16 +1,28 @@ sources: + "1.8.3": + url: "https://github.com/iboB/itlib/archive/v1.8.3.tar.gz" + sha256: "2323e2abf5827651097c563a19d8f82c7fd222a8740ff3421681da967b59277e" + "1.8.2": + url: "https://github.com/iboB/itlib/archive/v1.8.2.tar.gz" + sha256: "2b4d206ed0de31a4e6042fada0aa7cee54c95220d98666381f0402046e95304f" + "1.8.1": + url: "https://github.com/iboB/itlib/archive/v1.8.1.tar.gz" + sha256: "7a8619073d0bbd5a5cea0ee9bb1b3b749348cbab1d12e4e0c234215f26388aef" + "1.8.0": + url: "https://github.com/iboB/itlib/archive/v1.8.0.tar.gz" + sha256: "70b6493b0cc3a720ffd48e98e3f009e8d94003380800bf07e61f167e813a9add" + "1.7.0": + url: "https://github.com/iboB/itlib/archive/v1.7.0.tar.gz" + sha256: "9a27138cfa8554eb69436bb1afacfafc5a3888b6e05f9124b2d20da7ab55b723" + "1.6.3": + url: "https://github.com/iboB/itlib/archive/v1.6.3.tar.gz" + sha256: "d2e320d9218269c421407d6df819ca0bfae3ea5bc897b341b9babaedc0b7103f" "1.5.2": url: "https://github.com/iboB/itlib/archive/v1.5.2.tar.gz" sha256: "9ebff09fcdc873d2b01d8a2d0de2a7d7bd11844ef632f80ec5041f78bdc6ddec" - "1.5.1": - url: "https://github.com/iboB/itlib/archive/v1.5.1.tar.gz" - sha256: "70f3c3cd5b3d4baf440bf19848936882e50c06924ca319d0bf91763ae3a65570" - "1.5.0": - url: "https://github.com/iboB/itlib/archive/refs/tags/v1.5.0.tar.gz" - sha256: "940589080fb486e19d7cf8e79665bac017a55f1c8b8fa4fb889a77f80645f289" "1.4.5": - url: "https://github.com/iboB/itlib/archive/refs/tags/v1.4.5.tar.gz" + url: "https://github.com/iboB/itlib/archive/v1.4.5.tar.gz" sha256: "f1d3533014433316475b6196cd2b1890bb42db1ae3059616538788712e1a33aa" "1.3.0": - url: "https://github.com/iboB/itlib/archive/refs/tags/v1.3.0.tar.gz" + url: "https://github.com/iboB/itlib/archive/v1.3.0.tar.gz" sha256: "d3af2ea3cf0dae63fe1e186af79562e584bfb86bf02f358cab9675662fb9b5ef" diff --git a/recipes/itlib/all/conanfile.py b/recipes/itlib/all/conanfile.py index 473e855ca1d97..380dddde85d07 100644 --- a/recipes/itlib/all/conanfile.py +++ b/recipes/itlib/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, tools -import os +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout -required_conan_version = ">=1.33.0" +import os +required_conan_version = ">=1.50.0" class ItlibConan(ConanFile): name = "itlib" @@ -10,25 +13,31 @@ class ItlibConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/iboB/itlib" - topics = ("itlib", "template", "flatmatp", "static-vector") + topics = ("template", "flatmatp", "static-vector") settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) + copy(self, pattern="*.hpp", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/itlib/all/test_package/CMakeLists.txt b/recipes/itlib/all/test_package/CMakeLists.txt index bde691eb7fb62..11bad027c5a7e 100644 --- a/recipes/itlib/all/test_package/CMakeLists.txt +++ b/recipes/itlib/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.4) -project(test_package) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) -find_package(itlib CONFIG REQUIRED) +find_package(itlib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} itlib::itlib) +target_link_libraries(${PROJECT_NAME} PRIVATE itlib::itlib) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/itlib/all/test_package/conanfile.py b/recipes/itlib/all/test_package/conanfile.py index daa9e1d1f76cc..a9fb96656f203 100644 --- a/recipes/itlib/all/test_package/conanfile.py +++ b/recipes/itlib/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools - -class ItlibTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/itlib/all/test_v1_package/CMakeLists.txt b/recipes/itlib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..bc541ea90b512 --- /dev/null +++ b/recipes/itlib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/itlib/all/test_v1_package/conanfile.py b/recipes/itlib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/itlib/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/itlib/config.yml b/recipes/itlib/config.yml index 8eb3518219bd8..ba98606eb939d 100644 --- a/recipes/itlib/config.yml +++ b/recipes/itlib/config.yml @@ -1,9 +1,17 @@ versions: - "1.5.2": + "1.8.3": + folder: all + "1.8.2": + folder: all + "1.8.1": folder: all - "1.5.1": + "1.8.0": folder: all - "1.5.0": + "1.7.0": + folder: all + "1.6.3": + folder: all + "1.5.2": folder: all "1.4.5": folder: all diff --git a/recipes/ixwebsocket/all/CMakeLists.txt b/recipes/ixwebsocket/all/CMakeLists.txt deleted file mode 100644 index 16d33ed296f4b..0000000000000 --- a/recipes/ixwebsocket/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory("source_subfolder") diff --git a/recipes/ixwebsocket/all/conandata.yml b/recipes/ixwebsocket/all/conandata.yml index d9b4c849f8b9a..f9b0b0853afce 100644 --- a/recipes/ixwebsocket/all/conandata.yml +++ b/recipes/ixwebsocket/all/conandata.yml @@ -1,28 +1,28 @@ sources: - "7.9.2": - url: "https://github.com/machinezone/IXWebSocket/archive/v7.9.2.zip" - sha256: "B5224C1DEC64E25933F2DC547C278265A1B335C4516F1B11FAC81F0AC99B747E" - "9.1.9": - url: "https://github.com/machinezone/IXWebSocket/archive/v9.1.9.zip" - sha256: "dd83b4855882b538ca9782b42e80be4ebf96f978974e2615def673fb9d58c33b" - "9.6.4": - url: "https://github.com/machinezone/IXWebSocket/archive/v9.6.4.zip" - sha256: "b249b3bd0323f5b9aa4808852266f17073afd9f1f3a89815205a39604230f0ea" - "10.2.5": - url: "https://github.com/machinezone/IXWebSocket/archive/v10.2.5.tar.gz" - sha256: "5db57c7327dc0764151038dc71d9ae7d9859fe3f1c182f35b4e2dfec43a5224e" - "10.4.0": - url: "https://github.com/machinezone/IXWebSocket/archive/v10.4.0.tar.gz" - sha256: "5bdeef08a66d3c143e7fd8b02820ed5ee5c7848e4fa043132cbeef4ea18cd326" - "11.0.4": - url: "https://github.com/machinezone/IXWebSocket/archive/v11.0.4.tar.gz" - sha256: "deebfa04bd6bd930b2f7c0daba8674c8e8bc273a3d735b1877b1f4bb2c0e8596" - "11.0.9": - url: "https://github.com/machinezone/IXWebSocket/archive/v11.0.9.tar.gz" - sha256: "bb355b54add3de14fa645ac9c16c49d1cd8324fdeea959a64071ca9aec64da7e" - "11.2.4": - url: "https://github.com/machinezone/IXWebSocket/archive/refs/tags/v11.2.4.tar.gz" - sha256: "e9d4bfc6192c5390f43a9e0534ef7e3a2821bc062a1ff8c94f80884df3b412a9" "11.4.3": url: "https://github.com/machinezone/IXWebSocket/archive/refs/tags/v11.4.3.tar.gz" sha256: "aa2d02c9c71339943cc61eb4efeb2ffc3a5a0011128a67027b9251b7d8a6e0ac" + "11.2.4": + url: "https://github.com/machinezone/IXWebSocket/archive/refs/tags/v11.2.4.tar.gz" + sha256: "e9d4bfc6192c5390f43a9e0534ef7e3a2821bc062a1ff8c94f80884df3b412a9" + "11.0.9": + url: "https://github.com/machinezone/IXWebSocket/archive/v11.0.9.tar.gz" + sha256: "bb355b54add3de14fa645ac9c16c49d1cd8324fdeea959a64071ca9aec64da7e" + "11.0.4": + url: "https://github.com/machinezone/IXWebSocket/archive/v11.0.4.tar.gz" + sha256: "deebfa04bd6bd930b2f7c0daba8674c8e8bc273a3d735b1877b1f4bb2c0e8596" + "10.4.0": + url: "https://github.com/machinezone/IXWebSocket/archive/v10.4.0.tar.gz" + sha256: "5bdeef08a66d3c143e7fd8b02820ed5ee5c7848e4fa043132cbeef4ea18cd326" + "10.2.5": + url: "https://github.com/machinezone/IXWebSocket/archive/v10.2.5.tar.gz" + sha256: "5db57c7327dc0764151038dc71d9ae7d9859fe3f1c182f35b4e2dfec43a5224e" + "9.6.4": + url: "https://github.com/machinezone/IXWebSocket/archive/v9.6.4.zip" + sha256: "b249b3bd0323f5b9aa4808852266f17073afd9f1f3a89815205a39604230f0ea" + "9.1.9": + url: "https://github.com/machinezone/IXWebSocket/archive/v9.1.9.zip" + sha256: "dd83b4855882b538ca9782b42e80be4ebf96f978974e2615def673fb9d58c33b" + "7.9.2": + url: "https://github.com/machinezone/IXWebSocket/archive/v7.9.2.zip" + sha256: "b5224c1dec64e25933f2dc547c278265a1b335c4516f1b11fac81f0ac99b747e" diff --git a/recipes/ixwebsocket/all/conanfile.py b/recipes/ixwebsocket/all/conanfile.py index 305f58f0e6970..c627577a9f00e 100644 --- a/recipes/ixwebsocket/all/conanfile.py +++ b/recipes/ixwebsocket/all/conanfile.py @@ -1,56 +1,64 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import collect_libs, copy, get, replace_in_file, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class IXWebSocketConan(ConanFile): name = "ixwebsocket" description = "IXWebSocket is a C++ library for WebSocket client and server development" - topics = ("conan", "IXWebSocket", "socket", "websocket") + topics = ("socket", "websocket") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/machinezone/IXWebSocket" license = "BSD-3-Clause" - exports_sources = ["CMakeLists.txt"] - settings = "os", "compiler", "build_type", "arch" - short_paths = True - generators = "cmake", "cmake_find_package" + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "tls": ["mbedtls", "openssl", "applessl", False], - "with_zlib": [True, False] + "with_zlib": [True, False], } default_options = { "shared": False, "fPIC": True, "tls": "mbedtls", - "with_zlib": True + "with_zlib": True, } - _cmake = None + short_paths = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + # After version 11.0.8, IXWebSocket is fully compatible with C++ 11. + # https://github.com/machinezone/IXWebSocket/commit/ee5a2eb46ee0e109415dc02b0db85a9c76256090 + return "14" if Version(self.version) < "11.0.8" else "11" def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) < "10.1.5": + if Version(self.version) < "10.1.5": # zlib is always required before 10.1.5 del self.options.with_zlib def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.get_safe("with_zlib", True): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.tls == "openssl": - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") elif self.options.tls == "mbedtls": self.requires("mbedtls/2.25.0") @@ -58,7 +66,7 @@ def requirements(self): def _can_use_openssl(self): if self.settings.os == "Windows": # Future: support for OpenSSL on Windows was introduced in 7.9.3. Earlier versions force MbedTLS - return tools.Version(self.version) >= "7.9.3" + return Version(self.version) >= "7.9.3" # The others do, by default, support OpenSSL and MbedTLS. Non-standard operating systems might # be a challenge. # Older versions doesn't support OpenSSL on Mac, but those are unlikely to be built now. @@ -66,80 +74,74 @@ def _can_use_openssl(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - # After version 11.0.8, IXWebSocket is fully compatible with C++ 11. https://github.com/machinezone/IXWebSocket/commit/ee5a2eb46ee0e109415dc02b0db85a9c76256090 - tools.check_min_cppstd(self, 14 if tools.Version(self.version) < "11.0.8" else 11) - if self.options.tls == "applessl" and not tools.is_apple_os(self.settings.os): + check_min_cppstd(self, self._min_cppstd) + if self.options.tls == "applessl" and not is_apple_os(self): raise ConanInvalidConfiguration("Can only use Apple SSL on Apple.") elif not self._can_use_openssl and self.options.tls == "openssl": - raise ConanInvalidConfiguration("This version doesn't support OpenSSL with Windows; use v7.9.3 or newer for this to be valid") + raise ConanInvalidConfiguration(f"{self.ref} doesn't support OpenSSL with Windows; use v7.9.3 or newer for this to be valid") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_TLS"] = bool(self.options.tls) + tc.variables["USE_MBED_TLS"] = self.options.tls == "mbedtls" + tc.variables["USE_OPEN_SSL"] = self.options.tls == "openssl" + # Apple configures itself if USE_TLS True, and USE_MBED_TLS + USE_OPEN_SSL False + if Version(self.version) >= "10.1.5": + tc.variables["USE_ZLIB"] = self.options.with_zlib + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - # Use Find modules generated by conan - tools.replace_in_file(cmakelists, - "set(CMAKE_MODULE_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}\")", - "list(APPEND CMAKE_MODULE_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/CMake\")") - # Use CMake variables from FindMbedTLS.cmake generated by conan - tools.replace_in_file(cmakelists, "MBEDTLS_INCLUDE_DIRS", "MbedTLS_INCLUDE_DIRS") - tools.replace_in_file(cmakelists, "MBEDTLS_LIBRARIES", "MbedTLS_LIBRARIES") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + # Use CMake variables from MbedTLSConfig.cmake generated by conan + replace_in_file(self, cmakelists, "${MBEDTLS_INCLUDE_DIRS}", "${MbedTLS_INCLUDE_DIRS}") + replace_in_file(self, cmakelists, "${MBEDTLS_LIBRARIES}", "MbedTLS::mbedtls") # Do not force PIC - if tools.Version(self.version) >= "9.5.7": - tools.replace_in_file(cmakelists, "set(CMAKE_POSITION_INDEPENDENT_CODE ON)", "") + if Version(self.version) >= "9.5.7": + replace_in_file(self, cmakelists, "set(CMAKE_POSITION_INDEPENDENT_CODE ON)", "") # Allow shared - if tools.Version(self.version) < "11.1.4": - tools.replace_in_file(cmakelists, "add_library( ixwebsocket STATIC", "add_library( ixwebsocket") - if tools.Version(self.version) < "9.8.5": - tools.replace_in_file(cmakelists, + if Version(self.version) < "11.1.4": + replace_in_file(self, cmakelists, "add_library( ixwebsocket STATIC", "add_library( ixwebsocket") + if Version(self.version) < "9.8.5": + replace_in_file(self, cmakelists, "ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib", "ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin") - elif tools.Version(self.version) < "11.4.3": - tools.replace_in_file(cmakelists, + elif Version(self.version) < "11.4.3": + replace_in_file(self, cmakelists, "ARCHIVE DESTINATION lib", "ARCHIVE DESTINATION lib LIBRARY DESTINATION lib RUNTIME DESTINATION bin") else: - tools.replace_in_file(cmakelists, + replace_in_file(self, cmakelists, "ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}", "ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION bin") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USE_TLS"] = bool(self.options.tls) - self._cmake.definitions["USE_MBED_TLS"] = self.options.tls == "mbedtls" - self._cmake.definitions["USE_OPEN_SSL"] = self.options.tls == "openssl" - # Apple configures itself if USE_TLS True, and USE_MBED_TLS + USE_OPEN_SSL False - if tools.Version(self.version) >= "10.1.5": - self._cmake.definitions["USE_ZLIB"] = self.options.with_zlib - - self._cmake.configure() - return self._cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "ixwebsocket" - self.cpp_info.names["cmake_find_package_multi"] = "ixwebsocket" - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.set_property("cmake_file_name", "ixwebsocket") + self.cpp_info.set_property("cmake_target_name", "ixwebsocket::ixwebsocket") + self.cpp_info.libs = collect_libs(self) if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["wsock32", "ws2_32", "shlwapi"]) if bool(self.options.tls): - self.cpp_info.system_libs.append("Crypt32") - elif self.settings.os == "Linux": - self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("crypt32") + elif self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) if self.options.get_safe("with_zlib", False): self.cpp_info.defines.append("IXWEBSOCKET_USE_ZLIB") if self.options.tls == "mbedtls": diff --git a/recipes/ixwebsocket/all/test_package/CMakeLists.txt b/recipes/ixwebsocket/all/test_package/CMakeLists.txt index 6fd352781dd04..ba3bcd0a31277 100644 --- a/recipes/ixwebsocket/all/test_package/CMakeLists.txt +++ b/recipes/ixwebsocket/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(ixwebsocket REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ixwebsocket::ixwebsocket) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14 CXX_STANDARD_REQUIRED ON) +target_link_libraries(${PROJECT_NAME} PRIVATE ixwebsocket::ixwebsocket) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/ixwebsocket/all/test_package/conanfile.py b/recipes/ixwebsocket/all/test_package/conanfile.py index 96bb69f0d8374..0a6bc68712d90 100644 --- a/recipes/ixwebsocket/all/test_package/conanfile.py +++ b/recipes/ixwebsocket/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ixwebsocket/all/test_package/test_package.cpp b/recipes/ixwebsocket/all/test_package/test_package.cpp index 7b4d4df5e4d1a..b23d596cddbdd 100644 --- a/recipes/ixwebsocket/all/test_package/test_package.cpp +++ b/recipes/ixwebsocket/all/test_package/test_package.cpp @@ -4,16 +4,15 @@ int main() { std::string url = "https://github.com"; std::string protocol, host, path, query; - int port; + int port; bool res = ix::UrlParser::parse(url, protocol, host, path, query, port); - std::cout + std::cout << "URL parse result: \n" << "Protocol: " << protocol - << "\nHost: " << host + << "\nHost: " << host << "\nPath: " << path << "\nQuery: " << query << "\nPort: " << port << std::endl; - } diff --git a/recipes/ixwebsocket/all/test_v1_package/CMakeLists.txt b/recipes/ixwebsocket/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/ixwebsocket/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/ixwebsocket/all/test_v1_package/conanfile.py b/recipes/ixwebsocket/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/ixwebsocket/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/ixwebsocket/config.yml b/recipes/ixwebsocket/config.yml index f77cd923f6b12..c72c054440963 100644 --- a/recipes/ixwebsocket/config.yml +++ b/recipes/ixwebsocket/config.yml @@ -1,19 +1,19 @@ versions: - "7.9.2": + "11.4.3": folder: all - "9.1.9": + "11.2.4": folder: all - "9.6.4": + "11.0.9": folder: all - "10.2.5": + "11.0.4": folder: all "10.4.0": folder: all - "11.0.4": + "10.2.5": folder: all - "11.0.9": + "9.6.4": folder: all - "11.2.4": + "9.1.9": folder: all - "11.4.3": + "7.9.2": folder: all diff --git a/recipes/jansson/all/conandata.yml b/recipes/jansson/all/conandata.yml index ab2972ecb77c5..35410003207e3 100644 --- a/recipes/jansson/all/conandata.yml +++ b/recipes/jansson/all/conandata.yml @@ -1,10 +1,10 @@ sources: "2.14": - url: "https://github.com/akheron/jansson/archive/v2.14.tar.gz" - sha256: "c739578bf6b764aa0752db9a2fdadcfe921c78f1228c7ec0bb47fa804c55d17b" + url: "https://github.com/akheron/jansson/releases/download/v2.14/jansson-2.14.tar.bz2" + sha256: "fba956f27c6ae56ce6dfd52fbf9d20254aad42821f74fa52f83957625294afb9" "2.13.1": - url: "https://github.com/akheron/jansson/archive/v2.13.1.tar.gz" - sha256: "f22901582138e3203959c9257cf83eba9929ac41d7be4a42557213a22ebcc7a0" + url: "https://github.com/akheron/jansson/releases/download/v2.13.1/jansson-2.13.1.tar.bz2" + sha256: "ee90a0f879d2b7b7159124ff22b937a2a9a8c36d3bb65d1da7dd3f04370a10bd" "2.12": - url: "https://github.com/akheron/jansson/archive/v2.12.tar.gz" - sha256: "76260d30e9bbd0ef392798525e8cd7fe59a6450c54ca6135672e3cd6a1642941" + url: "https://github.com/akheron/jansson/releases/download/v2.12/jansson-2.12.tar.bz2" + sha256: "645d72cc5dbebd4df608d33988e55aa42a7661039e19a379fcbe5c79d1aee1d2" diff --git a/recipes/jansson/all/conanfile.py b/recipes/jansson/all/conanfile.py index 9249c72709455..32444b958cc2e 100644 --- a/recipes/jansson/all/conanfile.py +++ b/recipes/jansson/all/conanfile.py @@ -4,17 +4,18 @@ from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class JanssonConan(ConanFile): name = "jansson" description = "C library for encoding, decoding and manipulating JSON data" - topics = ("jansson", "json", "encoding", "decoding", "manipulation") + topics = ("json", "encoding", "decoding", "manipulation") url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.digip.org/jansson/" license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,22 +36,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/jansson/all/test_package/conanfile.py b/recipes/jansson/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/jansson/all/test_package/conanfile.py +++ b/recipes/jansson/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/jansson/all/test_v1_package/CMakeLists.txt b/recipes/jansson/all/test_v1_package/CMakeLists.txt index 6dd0429552b1c..0d20897301b68 100644 --- a/recipes/jansson/all/test_v1_package/CMakeLists.txt +++ b/recipes/jansson/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(jansson REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE jansson::jansson) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/jasper/all/CMakeLists.txt b/recipes/jasper/all/CMakeLists.txt deleted file mode 100644 index daed229fb32e0..0000000000000 --- a/recipes/jasper/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_MODULE_PATH ${CONAN_CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/source_subfolder/build/cmake/modules ${CMAKE_MODULE_PATH}) - -add_subdirectory(source_subfolder) diff --git a/recipes/jasper/all/conandata.yml b/recipes/jasper/all/conandata.yml index 6867be2627152..249c9d8054efc 100644 --- a/recipes/jasper/all/conandata.yml +++ b/recipes/jasper/all/conandata.yml @@ -1,47 +1,41 @@ sources: + "4.0.0": + url: "https://github.com/jasper-software/jasper/releases/download/version-4.0.0/jasper-4.0.0.tar.gz" + sha256: "39514e1b53a5333fcff817e19565371f016ea536c36fd2d13a9c4d8da8f0be0c" + "3.0.6": + url: "https://github.com/jasper-software/jasper/releases/download/version-3.0.6/jasper-3.0.6.tar.gz" + sha256: "169be004d91f6940c649a4f854ada2755d4f35f62b0555ce9e1219c778cffc09" "2.0.33": - url: "https://github.com/jasper-software/jasper/archive/refs/tags/version-2.0.33.tar.gz" - sha256: "38b8f74565ee9e7fec44657e69adb5c9b2a966ca5947ced5717cde18a7d2eca6" - "2.0.32": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.32.tar.gz" - sha256: "a3583a06698a6d6106f2fc413aa42d65d86bedf9a988d60e5cfa38bf72bc64b9" - "2.0.28": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.28.tar.gz" - sha256: "6b4e5f682be0ab1a5acb0eeb6bf41d6ce17a658bb8e2dbda95de40100939cc88" - "2.0.27": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.27.tar.gz" - sha256: "df41bd015a9dd0cc2a2e696f8ca5cbfb633323ca9429621f7fa801778681f2dd" - "2.0.26": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.26.tar.gz" - sha256: "a82a119e85b7d1f448e61309777fa5f79053a9adca4a2b5bfe44be5439fb8fea" - "2.0.25": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.25.tar.gz" - sha256: "f5bc48e2884bcabd2aca1737baff4ca962ec665b6eb673966ced1f7adea07edb" - "2.0.24": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.24.tar.gz" - sha256: "d2d28e115968d38499163cf8086179503668ce0d71b90dd33855b3de96a1ca1d" - "2.0.23": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.23.tar.gz" - sha256: "20facc904bd9d38c20e0c090b1be3ae02ae5b2703b803013be2ecad586a18927" - "2.0.22": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.22.tar.gz" - sha256: "afc4166bff29b8a0dc46ed5e8d6a208d7976fccfd0b1146e3400c8b2948794a2" - "2.0.21": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.21.tar.gz" - sha256: "2482def06dfaa33b8d93cbe992a29723309f3c2b6e75674423a52fc82be10418" - "2.0.19": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.19.tar.gz" - sha256: "b9d16162a088617ada36450f2374d72165377cb64b33ed197c200bcfb73ec76c" - "2.0.16": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.16.tar.gz" - sha256: "f1d8b90f231184d99968f361884e2054a1714fdbbd9944ba1ae4ebdcc9bbfdb1" - "2.0.14": - url: "https://github.com/jasper-software/jasper/archive/version-2.0.14.tar.gz" - sha256: "85266eea728f8b14365db9eaf1edc7be4c348704e562bb05095b9a077cf1a97b" + url: "https://github.com/jasper-software/jasper/releases/download/version-2.0.33/jasper-2.0.33.tar.gz" + sha256: "28d28290cc2eaf70c8756d391ed8bcc8ab809a895b9a67ea6e89da23a611801a" patches: - "2.0.16": - - patch_file: "patches/fix-exported-symbols.patch" - base_path: "source_subfolder" - "2.0.14": - - patch_file: "patches/fix-exported-symbols.patch" - base_path: "source_subfolder" + "4.0.0": + - patch_file: "patches/4.0.0-0001-skip-rpath.patch" + patch_description: "Do not enforce rpath configuration" + patch_source: "https://github.com/jasper-software/jasper/pull/347" + patch_type: "conan" + - patch_file: "patches/4.0.0-0002-find-libjpeg.patch" + patch_description: "check_c_source_compilers does not work with conan gens. See https://github.com/conan-io/conan/issues/12180" + patch_type: "conan" + - patch_file: "patches/4.0.0-0003-deterministic-libname.patch" + patch_description: "No generator dependent libname" + patch_type: "conan" + "3.0.6": + - patch_file: "patches/3.0.6-0001-skip-rpath.patch" + patch_description: "Do not enforce rpath configuration" + patch_source: "https://github.com/jasper-software/jasper/pull/347" + patch_type: "conan" + - patch_file: "patches/3.0.6-0002-find-libjpeg.patch" + patch_description: "check_c_source_compilers does not work with conan gens. See https://github.com/conan-io/conan/issues/12180" + patch_type: "conan" + - patch_file: "patches/3.0.6-0003-deterministic-libname.patch" + patch_description: "No generator dependent libname" + patch_type: "conan" + "2.0.33": + - patch_file: "patches/2.0.33-0001-skip-rpath.patch" + patch_description: "Do not enforce rpath configuration" + patch_source: "https://github.com/jasper-software/jasper/pull/347" + patch_type: "conan" + - patch_file: "patches/2.0.33-0002-find-libjpeg.patch" + patch_description: "check_c_source_compilers does not work with conan gens. See https://github.com/conan-io/conan/issues/12180" + patch_type: "conan" diff --git a/recipes/jasper/all/conanfile.py b/recipes/jasper/all/conanfile.py index 239b07850fe8f..9893cd476a58f 100644 --- a/recipes/jasper/all/conanfile.py +++ b/recipes/jasper/all/conanfile.py @@ -1,23 +1,27 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, save +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class JasperConan(ConanFile): name = "jasper" - license = "JasPer License Version 2.0" + license = "JasPer-2.0" homepage = "https://jasper-software.github.io/jasper" url = "https://github.com/conan-io/conan-center-index" - topics = ("jasper", "tool-kit", "coding") + topics = ("toolkit", "coding", "jpeg", "images") description = "JasPer Image Processing/Coding Tool Kit" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_libjpeg": ["libjpeg", "libjpeg-turbo"], + "with_libjpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], } default_options = { "shared": False, @@ -25,92 +29,85 @@ class JasperConan(ConanFile): "with_libjpeg": "libjpeg", } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - if self.options.with_libjpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.2") - elif self.options.with_libjpeg == "libjpeg": - self.requires("libjpeg/9d") + if self.options.with_libjpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.with_libjpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_libjpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["JAS_ENABLE_DOC"] = False - self._cmake.definitions["JAS_ENABLE_PROGRAMS"] = False - self._cmake.definitions["JAS_ENABLE_SHARED"] = self.options.shared - self._cmake.definitions["JAS_LIBJPEG_REQUIRED"] = "REQUIRED" - self._cmake.definitions["JAS_ENABLE_OPENGL"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # Clean rpath in installed shared lib - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - cmds_to_remove = [ - "set(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_PREFIX}/lib\")", - "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", - "set(CMAKE_INSTALL_RPATH\n \"${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}\")", - ] - for cmd_to_remove in cmds_to_remove: - tools.replace_in_file(cmakelists, cmd_to_remove, "") + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) >= "4.0.0": + tc.variables["JAS_ENABLE_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["JAS_ENABLE_DOC"] = False + tc.variables["JAS_ENABLE_LATEX"] = False + tc.variables["JAS_ENABLE_PROGRAMS"] = False + tc.variables["JAS_ENABLE_SHARED"] = self.options.shared + tc.variables["JAS_LIBJPEG_REQUIRED"] = "REQUIRED" + tc.variables["JAS_ENABLE_LIBJPEG"] = bool(self.options.with_libjpeg) + if Version(self.version) >= "3.0.0": + tc.variables["JAS_ENABLE_LIBHEIF"] = False + tc.variables["JAS_ENABLE_OPENGL"] = False + + if cross_building(self): + tc.cache_variables["JAS_CROSSCOMPILING"] = True + tc.cache_variables["JAS_STDC_VERSION"] = "199901L" + + # TODO: Remove after fixing https://github.com/conan-io/conan-center-index/issues/13159 + # C3I workaround to force CMake to choose the highest version of + # the windows SDK available in the system + if is_msvc(self) and not self.conf.get("tools.cmake.cmaketoolchain:system_version"): + tc.variables["CMAKE_SYSTEM_VERSION"] = "10.0" + + tc.generate() + + cmakedeps = CMakeDeps(self) + cmakedeps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "COPYRIGHT*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self.settings.os == "Windows": for dll_prefix in ["concrt", "msvcp", "vcruntime"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), - "{}*.dll".format(dll_prefix)) - self._create_cmake_module_variables( - os.path.join(self.package_folder, self._module_file_rel_path) - ) - - @staticmethod - def _create_cmake_module_variables(module_file): + rm(self, f"{dll_prefix}*.dll", os.path.join(self.package_folder, "bin")) + self._create_cmake_module_variables(os.path.join(self.package_folder, self._module_file_rel_path)) + + # FIXME: Missing CMake alias variables. See https://github.com/conan-io/conan/issues/7691 + def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ - if(DEFINED Jasper_FOUND) - set(JASPER_FOUND ${Jasper_FOUND}) - endif() + set(JASPER_FOUND TRUE) if(DEFINED Jasper_INCLUDE_DIR) set(JASPER_INCLUDE_DIR ${Jasper_INCLUDE_DIR}) endif() @@ -121,11 +118,11 @@ def _create_cmake_module_variables(module_file): set(JASPER_VERSION_STRING ${Jasper_VERSION}) endif() """) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -133,11 +130,18 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "Jasper::Jasper") self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) self.cpp_info.set_property("pkg_config_name", "jasper") - + self.cpp_info.libs = ["jasper"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) + self.cpp_info.requires = [] + if self.options.with_libjpeg == "libjpeg": + self.cpp_info.requires.append("libjpeg::libjpeg") + elif self.options.with_libjpeg == "libjpeg-turbo": + self.cpp_info.requires.append("libjpeg-turbo::jpeg") + elif self.options.with_libjpeg == "mozjpeg": + self.cpp_info.requires.append("mozjpeg::libjpeg") + + # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "Jasper" self.cpp_info.names["cmake_find_package_multi"] = "Jasper" self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] - - self.cpp_info.libs = ["jasper"] - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") diff --git a/recipes/jasper/all/patches/2.0.33-0001-skip-rpath.patch b/recipes/jasper/all/patches/2.0.33-0001-skip-rpath.patch new file mode 100644 index 0000000000000..eb9d47cbbb014 --- /dev/null +++ b/recipes/jasper/all/patches/2.0.33-0001-skip-rpath.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 230d88c..79081c2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -298,19 +298,15 @@ if (JAS_ENABLE_SHARED) + # (but later on when installing) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH +- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # The RPATH to be used when installing, but only if it's not a + # system directory + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + if("${isSystemDir}" STREQUAL "-1") +- set(CMAKE_INSTALL_RPATH +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + endif("${isSystemDir}" STREQUAL "-1") + + endif() diff --git a/recipes/jasper/all/patches/2.0.33-0002-find-libjpeg.patch b/recipes/jasper/all/patches/2.0.33-0002-find-libjpeg.patch new file mode 100644 index 0000000000000..e95e029549359 --- /dev/null +++ b/recipes/jasper/all/patches/2.0.33-0002-find-libjpeg.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 79081c2..38b6238 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -244,12 +244,7 @@ if (JAS_ENABLE_LIBJPEG AND JPEG_FOUND) + # (e.g., stdio.h and stdint.h). So, we cannot reliably use + # check_include_file here. + set(CMAKE_REQUIRED_INCLUDES ${JPEG_INCLUDE_DIR}) +- check_c_source_compiles(" +- #include +- #include +- #include +- int main() {} +- " JAS_HAVE_JPEGLIB_H) ++ set(JAS_HAVE_JPEGLIB_H 1) + if(JAS_HAVE_JPEGLIB_H) + set(JAS_HAVE_LIBJPEG 1) + include_directories(${JPEG_INCLUDE_DIR}) diff --git a/recipes/jasper/all/patches/3.0.6-0001-skip-rpath.patch b/recipes/jasper/all/patches/3.0.6-0001-skip-rpath.patch new file mode 100644 index 0000000000000..959d169bd49ad --- /dev/null +++ b/recipes/jasper/all/patches/3.0.6-0001-skip-rpath.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5cf594c..a0d253d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -740,19 +740,15 @@ if(JAS_ENABLE_SHARED) + # (but later on when installing) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH +- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # The RPATH to be used when installing, but only if it's not a + # system directory + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + if(isSystemDir EQUAL -1) +- set(CMAKE_INSTALL_RPATH +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + endif() + endif() + diff --git a/recipes/jasper/all/patches/3.0.6-0002-find-libjpeg.patch b/recipes/jasper/all/patches/3.0.6-0002-find-libjpeg.patch new file mode 100644 index 0000000000000..47a8350d738d4 --- /dev/null +++ b/recipes/jasper/all/patches/3.0.6-0002-find-libjpeg.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a0d253d..19518af 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -680,12 +680,7 @@ if(JAS_ENABLE_LIBJPEG) + # (e.g., stdio.h and stdint.h). So, we cannot reliably use + # check_include_file here. + jas_get_includes_from_targets(CMAKE_REQUIRED_INCLUDES JPEG::JPEG) +- check_c_source_compiles(" +- #include +- #include +- #include +- int main() {} +- " JAS_HAVE_JPEGLIB_H) ++ set(JAS_HAVE_JPEGLIB_H 1) + if(JAS_HAVE_JPEGLIB_H) + set(JAS_HAVE_LIBJPEG 1) + set(JAS_LIBJPEG_TARGET JPEG::JPEG) diff --git a/recipes/jasper/all/patches/3.0.6-0003-deterministic-libname.patch b/recipes/jasper/all/patches/3.0.6-0003-deterministic-libname.patch new file mode 100644 index 0000000000000..567ff16e021a4 --- /dev/null +++ b/recipes/jasper/all/patches/3.0.6-0003-deterministic-libname.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -254,7 +254,7 @@ endif() + # If a multiconfiguration generator is used, ensure that various output + # files are not placed in subdirectories (such as Debug and Release) + # as this will cause the CTest test suite to fail. +-if(JAS_MULTICONFIGURATION_GENERATOR) ++if(0) + if(CMAKE_CONFIGURATION_TYPES) + set(CMAKE_DEBUG_POSTFIX d) + endif() diff --git a/recipes/jasper/all/patches/4.0.0-0001-skip-rpath.patch b/recipes/jasper/all/patches/4.0.0-0001-skip-rpath.patch new file mode 100644 index 0000000000000..4be85edcc1149 --- /dev/null +++ b/recipes/jasper/all/patches/4.0.0-0001-skip-rpath.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -793,19 +793,15 @@ if(JAS_ENABLE_SHARED) + # (but later on when installing) + set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) + +- set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") + + # add the automatically determined parts of the RPATH + # which point to directories outside the build tree to the install RPATH +- set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + # The RPATH to be used when installing, but only if it's not a + # system directory + list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES + "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) + if(isSystemDir EQUAL -1) +- set(CMAKE_INSTALL_RPATH +- "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") + endif() + endif() + diff --git a/recipes/jasper/all/patches/4.0.0-0002-find-libjpeg.patch b/recipes/jasper/all/patches/4.0.0-0002-find-libjpeg.patch new file mode 100644 index 0000000000000..b98de65fb7adf --- /dev/null +++ b/recipes/jasper/all/patches/4.0.0-0002-find-libjpeg.patch @@ -0,0 +1,16 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -731,12 +731,7 @@ if(JAS_ENABLE_LIBJPEG) + # (e.g., stdio.h and stdint.h). So, we cannot reliably use + # check_include_file here. + jas_get_includes_from_targets(CMAKE_REQUIRED_INCLUDES JPEG::JPEG) +- check_c_source_compiles(" +- #include +- #include +- #include +- int main() {} +- " JAS_HAVE_JPEGLIB_H) ++ set(JAS_HAVE_JPEGLIB_H 1) + if(JAS_HAVE_JPEGLIB_H) + set(JAS_HAVE_LIBJPEG 1) + set(JAS_LIBJPEG_TARGET JPEG::JPEG) diff --git a/recipes/jasper/all/patches/4.0.0-0003-deterministic-libname.patch b/recipes/jasper/all/patches/4.0.0-0003-deterministic-libname.patch new file mode 100644 index 0000000000000..d2b29d21cbd98 --- /dev/null +++ b/recipes/jasper/all/patches/4.0.0-0003-deterministic-libname.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -262,7 +262,7 @@ endif() + # If a multiconfiguration generator is used, ensure that various output + # files are not placed in subdirectories (such as Debug and Release) + # as this will cause the CTest test suite to fail. +-if(JAS_MULTICONFIGURATION_GENERATOR) ++if(0) + if(CMAKE_CONFIGURATION_TYPES) + set(CMAKE_DEBUG_POSTFIX d) + endif() diff --git a/recipes/jasper/all/patches/fix-exported-symbols.patch b/recipes/jasper/all/patches/fix-exported-symbols.patch deleted file mode 100644 index 9db2d08488cee..0000000000000 --- a/recipes/jasper/all/patches/fix-exported-symbols.patch +++ /dev/null @@ -1,163 +0,0 @@ ---- a/src/libjasper/include/jasper/jas_cm.h -+++ b/src/libjasper/include/jasper/jas_cm.h -@@ -237,13 +237,13 @@ int jas_cm_prof_setattr(jas_cm_prof_t *prof, jas_cm_attrname_t name, void *val); - void *jas_cm_prof_getattr(jas_cm_prof_t *prof, jas_cm_attrname_t name); - #endif - --jas_cmxform_t *jas_cmxform_create(jas_cmprof_t *inprof, jas_cmprof_t *outprof, -+JAS_DLLEXPORT jas_cmxform_t *jas_cmxform_create(jas_cmprof_t *inprof, jas_cmprof_t *outprof, - jas_cmprof_t *proofprof, int op, int intent, int optimize); - --void jas_cmxform_destroy(jas_cmxform_t *xform); -+JAS_DLLEXPORT void jas_cmxform_destroy(jas_cmxform_t *xform); - - /* Apply a transform to data. */ --int jas_cmxform_apply(jas_cmxform_t *xform, jas_cmpixmap_t *in, -+JAS_DLLEXPORT int jas_cmxform_apply(jas_cmxform_t *xform, jas_cmpixmap_t *in, - jas_cmpixmap_t *out); - - int jas_cxform_optimize(jas_cmxform_t *xform, int optimize); ---- a/src/libjasper/include/jasper/jas_debug.h -+++ b/src/libjasper/include/jasper/jas_debug.h -@@ -107,10 +107,10 @@ JAS_DLLEXPORT int jas_setdbglevel(int dbglevel); - JAS_DLLEXPORT int jas_eprintf(const char *fmt, ...); - - /* Dump memory to a stream. */ --int jas_memdump(FILE *out, void *data, size_t len); -+JAS_DLLEXPORT int jas_memdump(FILE *out, void *data, size_t len); - - /* Warn about use of deprecated functionality. */ --void jas_deprecated(const char *s); -+JAS_DLLEXPORT void jas_deprecated(const char *s); - - /* Convert to a string literal */ - #define JAS_STRINGIFY(x) #x ---- a/src/libjasper/include/jasper/jas_icc.h -+++ b/src/libjasper/include/jasper/jas_icc.h -@@ -395,10 +395,10 @@ JAS_DLLEXPORT jas_iccattrval_t *jas_iccattrval_create(jas_iccuint32_t type); - - JAS_DLLEXPORT void jas_iccattrtab_dump(jas_iccattrtab_t *attrtab, FILE *out); - --extern jas_uchar jas_iccprofdata_srgb[]; --extern int jas_iccprofdata_srgblen; --extern jas_uchar jas_iccprofdata_sgray[]; --extern int jas_iccprofdata_sgraylen; -+JAS_DLLEXPORT extern jas_uchar jas_iccprofdata_srgb[]; -+JAS_DLLEXPORT extern int jas_iccprofdata_srgblen; -+JAS_DLLEXPORT extern jas_uchar jas_iccprofdata_sgray[]; -+JAS_DLLEXPORT extern int jas_iccprofdata_sgraylen; - JAS_DLLEXPORT jas_iccprof_t *jas_iccprof_createfrombuf(jas_uchar *buf, int len); - JAS_DLLEXPORT jas_iccprof_t *jas_iccprof_createfromclrspc(int clrspc); - ---- a/src/libjasper/include/jasper/jas_image.h -+++ b/src/libjasper/include/jasper/jas_image.h -@@ -492,21 +492,21 @@ JAS_DLLEXPORT int jas_image_getfmt(jas_stream_t *in); - - - #define jas_image_cmprof(image) ((image)->cmprof_) --int jas_image_ishomosamp(jas_image_t *image); --int jas_image_sampcmpt(jas_image_t *image, int cmptno, int newcmptno, -+JAS_DLLEXPORT int jas_image_ishomosamp(jas_image_t *image); -+JAS_DLLEXPORT int jas_image_sampcmpt(jas_image_t *image, int cmptno, int newcmptno, - jas_image_coord_t ho, jas_image_coord_t vo, jas_image_coord_t hs, - jas_image_coord_t vs, int sgnd, int prec); --int jas_image_writecmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, -+JAS_DLLEXPORT int jas_image_writecmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, - jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, - long *buf); --int jas_image_readcmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, -+JAS_DLLEXPORT int jas_image_readcmpt2(jas_image_t *image, int cmptno, jas_image_coord_t x, - jas_image_coord_t y, jas_image_coord_t width, jas_image_coord_t height, - long *buf); - - #define jas_image_setcmprof(image, cmprof) ((image)->cmprof_ = cmprof) - JAS_DLLEXPORT jas_image_t *jas_image_chclrspc(jas_image_t *image, jas_cmprof_t *outprof, - int intent); --void jas_image_dump(jas_image_t *image, FILE *out); -+JAS_DLLEXPORT void jas_image_dump(jas_image_t *image, FILE *out); - - /******************************************************************************\ - * Image format-dependent operations. -@@ -514,58 +514,58 @@ void jas_image_dump(jas_image_t *image, FILE *out); - - #if !defined(EXCLUDE_JPG_SUPPORT) - /* Format-dependent operations for JPG support. */ --jas_image_t *jpg_decode(jas_stream_t *in, const char *optstr); --int jpg_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int jpg_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *jpg_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int jpg_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int jpg_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_MIF_SUPPORT) - /* Format-dependent operations for MIF support. */ --jas_image_t *mif_decode(jas_stream_t *in, const char *optstr); --int mif_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int mif_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *mif_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int mif_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int mif_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_PNM_SUPPORT) - /* Format-dependent operations for PNM support. */ --jas_image_t *pnm_decode(jas_stream_t *in, const char *optstr); --int pnm_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int pnm_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *pnm_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int pnm_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int pnm_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_RAS_SUPPORT) - /* Format-dependent operations for Sun Rasterfile support. */ --jas_image_t *ras_decode(jas_stream_t *in, const char *optstr); --int ras_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int ras_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *ras_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int ras_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int ras_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_BMP_SUPPORT) - /* Format-dependent operations for BMP support. */ --jas_image_t *bmp_decode(jas_stream_t *in, const char *optstr); --int bmp_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int bmp_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *bmp_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int bmp_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int bmp_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_JP2_SUPPORT) - /* Format-dependent operations for JP2 support. */ --jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr); --int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int jp2_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *jp2_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int jp2_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int jp2_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_JPC_SUPPORT) - /* Format-dependent operations for JPEG-2000 code stream support. */ --jas_image_t *jpc_decode(jas_stream_t *in, const char *optstr); --int jpc_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int jpc_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *jpc_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int jpc_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int jpc_validate(jas_stream_t *in); - #endif - - #if !defined(EXCLUDE_PGX_SUPPORT) - /* Format-dependent operations for PGX support. */ --jas_image_t *pgx_decode(jas_stream_t *in, const char *optstr); --int pgx_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); --int pgx_validate(jas_stream_t *in); -+JAS_DLLEXPORT jas_image_t *pgx_decode(jas_stream_t *in, const char *optstr); -+JAS_DLLEXPORT int pgx_encode(jas_image_t *image, jas_stream_t *out, const char *optstr); -+JAS_DLLEXPORT int pgx_validate(jas_stream_t *in); - #endif - - #ifdef __cplusplus diff --git a/recipes/jasper/all/test_package/CMakeLists.txt b/recipes/jasper/all/test_package/CMakeLists.txt index bee826cf5aec0..54cd6e29fc23c 100644 --- a/recipes/jasper/all/test_package/CMakeLists.txt +++ b/recipes/jasper/all/test_package/CMakeLists.txt @@ -1,16 +1,21 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(Jasper REQUIRED) -message("JASPER_FOUND: ${JASPER_FOUND}") -message("JASPER_INCLUDE_DIR: ${JASPER_INCLUDE_DIR}") -message("JASPER_LIBRARIES: ${JASPER_LIBRARIES}") -message("JASPER_VERSION_STRING: ${JASPER_VERSION_STRING}") +set(_custom_vars + JASPER_FOUND + JASPER_INCLUDE_DIR + JASPER_LIBRARIES + JASPER_VERSION_STRING +) +foreach(_custom_var ${_custom_vars}) +if(DEFINED _custom_var) + message(STATUS "${_custom_var}: ${${_custom_var}}") +else() + message(FATAL_ERROR "${_custom_var} not defined") +endif() +endforeach() add_executable(${PROJECT_NAME} test_package.c) -target_include_directories(${PROJECT_NAME} PRIVATE ${JASPER_INCLUDE_DIR}) -target_link_libraries(${PROJECT_NAME} ${JASPER_LIBRARIES}) +target_link_libraries(${PROJECT_NAME} PRIVATE Jasper::Jasper) diff --git a/recipes/jasper/all/test_package/conanfile.py b/recipes/jasper/all/test_package/conanfile.py index 3da371b660e0a..e845ae751a301 100644 --- a/recipes/jasper/all/test_package/conanfile.py +++ b/recipes/jasper/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jasper/all/test_v1_package/CMakeLists.txt b/recipes/jasper/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2f6b1a2f7ec79 --- /dev/null +++ b/recipes/jasper/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/jasper/all/test_v1_package/conanfile.py b/recipes/jasper/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/jasper/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/jasper/config.yml b/recipes/jasper/config.yml index 61123bdc2e508..4a60a36eef3ae 100644 --- a/recipes/jasper/config.yml +++ b/recipes/jasper/config.yml @@ -1,27 +1,7 @@ versions: - "2.0.33": - folder: all - "2.0.32": - folder: all - "2.0.28": - folder: all - "2.0.27": - folder: all - "2.0.26": - folder: all - "2.0.25": + "4.0.0": folder: all - "2.0.24": + "3.0.6": folder: all - "2.0.23": - folder: all - "2.0.22": - folder: all - "2.0.21": - folder: all - "2.0.19": - folder: all - "2.0.16": - folder: all - "2.0.14": + "2.0.33": folder: all diff --git a/recipes/jbig/all/conanfile.py b/recipes/jbig/all/conanfile.py index b98051851c45f..7e4815f880d7d 100644 --- a/recipes/jbig/all/conanfile.py +++ b/recipes/jbig/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class JBigConan(ConanFile): @@ -29,8 +29,7 @@ class JBigConan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,22 +37,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -77,7 +69,6 @@ def package_info(self): if self.options.shared and is_msvc(self): self.cpp_info.defines = ["_JBIGDLL_"] + # TODO: to remove in conan v2 if self.options.build_executables: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/jbig/all/test_package/conanfile.py b/recipes/jbig/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/jbig/all/test_package/conanfile.py +++ b/recipes/jbig/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/jbig/all/test_v1_package/CMakeLists.txt b/recipes/jbig/all/test_v1_package/CMakeLists.txt index bffb62846421c..0d20897301b68 100644 --- a/recipes/jbig/all/test_v1_package/CMakeLists.txt +++ b/recipes/jbig/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(jbig REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE jbig::jbig) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/jbig/all/test_v1_package/conanfile.py b/recipes/jbig/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/jbig/all/test_v1_package/conanfile.py +++ b/recipes/jbig/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/jeaiii-itoa/all/conandata.yml b/recipes/jeaiii-itoa/all/conandata.yml new file mode 100644 index 0000000000000..4d3c9e2b824e9 --- /dev/null +++ b/recipes/jeaiii-itoa/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20220602": + url: "https://github.com/jeaiii/itoa/archive/84f25b835c8bbcf69eb97802216f8095bf94ef13.tar.gz" + sha256: "a116159f9b49922124b1c87f9989a7a8592f582904d98a3d6398e9013eca3f0f" diff --git a/recipes/jeaiii-itoa/all/conanfile.py b/recipes/jeaiii-itoa/all/conanfile.py new file mode 100644 index 0000000000000..e7cabf3b1a327 --- /dev/null +++ b/recipes/jeaiii-itoa/all/conanfile.py @@ -0,0 +1,54 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout +from conan.tools.files import get, copy +import os + + +required_conan_version = ">=1.50.0" + + +class ItoaConan(ConanFile): + name = "jeaiii-itoa" + description = "Fast integer to ascii / integer to string conversion" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/jeaiii/itoa/" + topics = ("string-conversion", "itona", "integer-conversion",) + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _minimum_cpp_standard(self): + return 17 + + def export_sources(self): + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + + def package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/jeaiii-itoa/all/test_package/CMakeLists.txt b/recipes/jeaiii-itoa/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d27bc00b65615 --- /dev/null +++ b/recipes/jeaiii-itoa/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(jeaiii-itoa REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE jeaiii-itoa::jeaiii-itoa) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/jeaiii-itoa/all/test_package/conanfile.py b/recipes/jeaiii-itoa/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/jeaiii-itoa/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jeaiii-itoa/all/test_package/test_package.cpp b/recipes/jeaiii-itoa/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..144466c23b699 --- /dev/null +++ b/recipes/jeaiii-itoa/all/test_package/test_package.cpp @@ -0,0 +1,26 @@ +#include + +#include "itoa/jeaiii_to_text.h" + +template +void itoa(T n, char* b) { + *jeaiii::to_text_from_integer(b, n) = '\0'; +} + +template +void show(T n) { + char text[32]; + itoa(n, text); + std::cout << text << "\n"; +} + +int main(void) { + show(-1); + show(1 << 31); + show(0x7fffffff); + show(-0x7fffffff - 1); + show(17999999999999999999ULL); + show(-5999999999999999999LL); + + return 0; +} diff --git a/recipes/jeaiii-itoa/all/test_v1_package/CMakeLists.txt b/recipes/jeaiii-itoa/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..f35b931b51133 --- /dev/null +++ b/recipes/jeaiii-itoa/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(jeaiii-itoa REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE jeaiii-itoa::jeaiii-itoa) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/jeaiii-itoa/all/test_v1_package/conanfile.py b/recipes/jeaiii-itoa/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/jeaiii-itoa/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/jeaiii-itoa/config.yml b/recipes/jeaiii-itoa/config.yml new file mode 100644 index 0000000000000..68b626ef915e2 --- /dev/null +++ b/recipes/jeaiii-itoa/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20220602": + folder: all diff --git a/recipes/jemalloc/all/conandata.yml b/recipes/jemalloc/all/conandata.yml index f1812081247f8..01ec764057557 100644 --- a/recipes/jemalloc/all/conandata.yml +++ b/recipes/jemalloc/all/conandata.yml @@ -1,9 +1,11 @@ sources: + "5.3.0": + url: "https://github.com/jemalloc/jemalloc/releases/download/5.3.0/jemalloc-5.3.0.tar.bz2" + sha256: "2db82d1e7119df3e71b7640219b6dfe84789bc0537983c3b7ac4f7189aecfeaa" "5.2.1": url: "https://github.com/jemalloc/jemalloc/releases/download/5.2.1/jemalloc-5.2.1.tar.bz2" sha256: "34330e5ce276099e2e8950d9335db5a875689a4c6a56751ef3b1d8c537f887f6" patches: "5.2.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-clang12-dont-declare-system-functions-as-nothrow.patch" + - patch_file: "patches/0001-clang12-dont-declare-system-functions-as-nothrow.patch" diff --git a/recipes/jemalloc/all/conanfile.py b/recipes/jemalloc/all/conanfile.py index fecc2916a3e25..03cf37de219b0 100644 --- a/recipes/jemalloc/all/conanfile.py +++ b/recipes/jemalloc/all/conanfile.py @@ -1,11 +1,15 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, MSBuild, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conans import AutoToolsBuildEnvironment, MSBuild +from conan.errors import ConanInvalidConfiguration +from conan.tools.scm import Version +from conans import tools as tools_legacy +from conan.tools.files import apply_conandata_patches, get, rename, replace_in_file +from conan.tools.layout import basic_layout import os import shutil import string -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.51.3" class JemallocConan(ConanFile): name = "jemalloc" @@ -49,10 +53,6 @@ class JemallocConan(ConanFile): _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -68,7 +68,7 @@ def validate(self): if self.options.enable_cxx and \ self.settings.compiler.get_safe("libcxx") == "libc++" and \ self.settings.compiler == "clang" and \ - tools.Version(self.settings.compiler.version) < "10": + Version(self.settings.compiler.version) < "10": raise ConanInvalidConfiguration("clang and libc++ version {} (< 10) is missing a mutex implementation".format(self.settings.compiler.version)) if self.settings.compiler == "Visual Studio" and \ self.options.shared and \ @@ -81,20 +81,24 @@ def validate(self): raise ConanInvalidConfiguration("Only Release and Debug build_types are supported") if self.settings.compiler == "Visual Studio" and self.settings.arch not in ("x86_64", "x86"): raise ConanInvalidConfiguration("Unsupported arch") - if self.settings.compiler == "clang" and tools.Version(self.settings.compiler.version) <= "3.9": + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) <= "3.9": raise ConanInvalidConfiguration("Unsupported compiler version") + if self.settings.os == "Macos" and self.settings.arch not in ("x86_64", "x86"): + raise ConanInvalidConfiguration("Unsupported arch") + + def layout(self): + basic_layout(self, src_folder="src") @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): self.build_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @property def _autotools_args(self): @@ -122,8 +126,8 @@ def _autotools_args(self): def _configure_autotools(self): if self._autotools: return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.configure(args=self._autotools_args, configure_dir=self._source_subfolder) + self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools_legacy.os_info.is_windows) + self._autotools.configure(args=self._autotools_args, configure_dir=self.source_folder) return self._autotools @property @@ -135,32 +139,32 @@ def _msvc_build_type(self): def _patch_sources(self): if self.settings.os == "Windows": - makefile_in = os.path.join(self._source_subfolder, "Makefile.in") - tools.replace_in_file(makefile_in, + makefile_in = os.path.join(self.source_folder, "Makefile.in") + replace_in_file(self, makefile_in, "DSO_LDFLAGS = @DSO_LDFLAGS@", - "DSO_LDFLAGS = @DSO_LDFLAGS@ -Wl,--out-implib,lib/libjemalloc.a") - tools.replace_in_file(makefile_in, + "DSO_LDFLAGS = @DSO_LDFLAGS@ -Wl,--out-implib,lib/libjemalloc.a", strict=False) + replace_in_file(self, makefile_in, "\t$(INSTALL) -d $(LIBDIR)\n" "\t$(INSTALL) -m 755 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) $(LIBDIR)", "\t$(INSTALL) -d $(BINDIR)\n" "\t$(INSTALL) -d $(LIBDIR)\n" "\t$(INSTALL) -m 755 $(objroot)lib/$(LIBJEMALLOC).$(SOREV) $(BINDIR)\n" - "\t$(INSTALL) -m 644 $(objroot)lib/libjemalloc.a $(LIBDIR)") + "\t$(INSTALL) -m 644 $(objroot)lib/libjemalloc.a $(LIBDIR)", strict=False) + + apply_conandata_patches(self) - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) def build(self): self._patch_sources() if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): - with tools.environment_append({"CC": "cl", "CXX": "cl"}) if self.settings.compiler == "Visual Studio" else tools.no_op(): - with tools.chdir(self._source_subfolder): + with tools_legacy.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools_legacy.no_op(): + with tools_legacy.environment_append({"CC": "cl", "CXX": "cl"}) if self.settings.compiler == "Visual Studio" else tools_legacy.no_op(): + with tools_legacy.chdir(self.source_folder): # Do not use AutoToolsBuildEnvironment because we want to run configure as ./configure - self.run("./configure {}".format(" ".join(self._autotools_args)), win_bash=tools.os_info.is_windows) + self.run("./configure {}".format(" ".join(self._autotools_args)), win_bash=tools_legacy.os_info.is_windows) msbuild = MSBuild(self) # Do not use the 2015 solution: unresolved external symbols: test_hooks_libc_hook and test_hooks_arena_new_hook - sln_file = os.path.join(self._source_subfolder, "msvc", "jemalloc_vc2017.sln") + sln_file = os.path.join(self.source_folder, "msvc", "jemalloc_vc2017.sln") msbuild.build(sln_file, targets=["jemalloc"], build_type=self._msvc_build_type) else: autotools = self._configure_autotools() @@ -174,7 +178,7 @@ def _library_name(self): if self.settings.build_type == "Debug": libname += "d" else: - toolset = tools.msvs_toolset(self.settings) + toolset = tools_legacy.msvs_toolset(self.settings) toolset_number = "".join(c for c in toolset if c in string.digits) libname += "-vc{}-{}".format(toolset_number, self._msvc_build_type) else: @@ -187,16 +191,16 @@ def _library_name(self): return libname def package(self): - self.copy(pattern="COPYING", src=self._source_subfolder, dst="licenses") + self.copy(pattern="COPYING", src=self.source_folder, dst="licenses") if self.settings.compiler == "Visual Studio": arch_subdir = { "x86_64": "x64", "x86": "x86", }[str(self.settings.arch)] - self.copy("*.lib", src=os.path.join(self._source_subfolder, "msvc", arch_subdir, self._msvc_build_type), dst=os.path.join(self.package_folder, "lib")) - self.copy("*.dll", src=os.path.join(self._source_subfolder, "msvc", arch_subdir, self._msvc_build_type), dst=os.path.join(self.package_folder, "bin")) - self.copy("jemalloc.h", src=os.path.join(self._source_subfolder, "include", "jemalloc"), dst=os.path.join(self.package_folder, "include", "jemalloc"), keep_path=True) - shutil.copytree(os.path.join(self._source_subfolder, "include", "msvc_compat"), + self.copy("*.lib", src=os.path.join(self.source_folder, "msvc", arch_subdir, self._msvc_build_type), dst=os.path.join(self.package_folder, "lib")) + self.copy("*.dll", src=os.path.join(self.source_folder, "msvc", arch_subdir, self._msvc_build_type), dst=os.path.join(self.package_folder, "bin")) + self.copy("jemalloc.h", src=os.path.join(self.source_folder, "include", "jemalloc"), dst=os.path.join(self.package_folder, "include", "jemalloc"), keep_path=True) + shutil.copytree(os.path.join(self.source_folder, "include", "msvc_compat"), os.path.join(self.package_folder, "include", "msvc_compat")) else: autotools = self._configure_autotools() @@ -204,7 +208,7 @@ def package(self): autotools.make(target="install_lib_shared" if self.options.shared else "install_lib_static") autotools.make(target="install_include") if self.settings.os == "Windows" and self.settings.compiler == "gcc": - tools.rename(os.path.join(self.package_folder, "lib", "{}.lib".format(self._library_name)), + rename(self, os.path.join(self.package_folder, "lib", "{}.lib".format(self._library_name)), os.path.join(self.package_folder, "lib", "lib{}.a".format(self._library_name))) if not self.options.shared: os.unlink(os.path.join(self.package_folder, "lib", "jemalloc.lib")) diff --git a/recipes/jemalloc/config.yml b/recipes/jemalloc/config.yml index 7be9a7ca5a898..28cb9a5ecdcdf 100644 --- a/recipes/jemalloc/config.yml +++ b/recipes/jemalloc/config.yml @@ -1,3 +1,5 @@ versions: "5.2.1": folder: all + "5.3.0": + folder: all diff --git a/recipes/jfalcou-eve/all/conandata.yml b/recipes/jfalcou-eve/all/conandata.yml index 1968e85720cbe..05a5aeff2b5fd 100644 --- a/recipes/jfalcou-eve/all/conandata.yml +++ b/recipes/jfalcou-eve/all/conandata.yml @@ -5,3 +5,9 @@ sources: "v2022.03.0": url: "https://github.com/jfalcou/eve/archive/refs/tags/v2022.03.0.tar.gz" sha256: "8bf9faea516806e7dd468e778dcedc81c51f0b2c6a70b9c75987ce12bb759911" + "v2022.09.0": + url: "https://github.com/jfalcou/eve/archive/refs/tags/v2022.09.0.tar.gz" + sha256: "53a4e1944a1080c67380a6d7f4fb42998f1c1db35e2370e02d7853c3ac1e0a33" + "v2022.09.1": + url: "https://github.com/jfalcou/eve/archive/refs/tags/v2022.09.1.tar.gz" + sha256: "d8d3ae55f0ca2690f8a22883eaaa8251275b76702da0267e8e1725b22c51e978" diff --git a/recipes/jfalcou-eve/all/conanfile.py b/recipes/jfalcou-eve/all/conanfile.py index 552f767f67158..6761b154e37b6 100644 --- a/recipes/jfalcou-eve/all/conanfile.py +++ b/recipes/jfalcou-eve/all/conanfile.py @@ -1,25 +1,29 @@ -from conan import ConanFile, tools +from conan import ConanFile +from conan.tools import files +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy from conan.tools.scm import Version -from conans.errors import ConanInvalidConfiguration +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration +import os + + +required_conan_version = ">=1.51.3" -required_conan_version = ">=1.33.0" class JfalcouEveConan(ConanFile): name = "jfalcou-eve" description = ("Expressive Velocity Engine - reimplementation of the old " "Boost.SIMD on C++20" ) - homepage = "https://github.com/jfalcou/eve" - topics = ("c++", "simd") - license = "MIT" + homepage = "https://jfalcou.github.io/eve/" + topics = ("cpp", "simd") + license = ("MIT", "BSL-1.0") url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" @property def _min_cppstd(self): @@ -29,17 +33,26 @@ def _min_cppstd(self): def _compilers_minimum_version(self): return {"gcc": "11", "Visual Studio": "16.9", + "msvc": "1928", "clang": "13", - "apple-clang": "13", - } + "apple-clang": "14"} + + def configure(self): + version = Version(self.version.strip("v")) + if version.major < 2022 or (version.major == 2022 and version.minor < 9): + self.license = "MIT" + else: + self.license = "BSL-1.0" + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.build.check_min_cppstd(self, self._min_cppstd) - if self.settings.compiler == "Visual Studio": + # FIXME: Need to use self.info.settings for header-only + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + if is_msvc(self): raise ConanInvalidConfiguration("EVE does not support MSVC yet (https://github.com/jfalcou/eve/issues/1022).") - if self.settings.compiler == "apple-clang": - raise ConanInvalidConfiguration("EVE does not support apple Clang due to an incomplete libcpp.") def lazy_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] @@ -49,21 +62,22 @@ def lazy_lt_semver(v1, v2): minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if not minimum_version: - self.output.warn("{} {} requires C++20. Your compiler is unknown. Assuming it supports C++20.".format(self.name, self.version)) + self.output.warn(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("{} {} requires C++20, which your compiler does not support.".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.files.get(self, **self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + files.get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) def package(self): - self.copy(pattern="include/*", src=self._source_subfolder) - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) + copy(self, pattern="*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) def package_info(self): self.cpp_info.names["cmake_find_package"] = "eve" self.cpp_info.names["cmake_find_package_multi"] = "eve" + self.cpp_info.set_property("cmake_file_name", "eve") + self.cpp_info.set_property("cmake_target_name", "eve::eve") diff --git a/recipes/jfalcou-eve/all/test_package/CMakeLists.txt b/recipes/jfalcou-eve/all/test_package/CMakeLists.txt index 7a2c52ebe962c..07df5491f5a34 100644 --- a/recipes/jfalcou-eve/all/test_package/CMakeLists.txt +++ b/recipes/jfalcou-eve/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ cmake_minimum_required(VERSION 3.12) -project(test_package) +project(test_package CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - -find_package(eve REQUIRED) +find_package(eve REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} eve::eve) -# FIXME: recipe should transitively sets proper minimum cxx standard. -# See https://github.com/conan-io/conan/issues/7772 about revising cxx std model. -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20) +target_link_libraries(${PROJECT_NAME} PRIVATE eve::eve) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/jfalcou-eve/all/test_package/conanfile.py b/recipes/jfalcou-eve/all/test_package/conanfile.py index 2872870378fc1..a9fb96656f203 100644 --- a/recipes/jfalcou-eve/all/test_package/conanfile.py +++ b/recipes/jfalcou-eve/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -class JfalcouEveConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jfalcou-eve/all/test_v1_package/CMakeLists.txt b/recipes/jfalcou-eve/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7e31b52213165 --- /dev/null +++ b/recipes/jfalcou-eve/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(eve REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE eve::eve) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/jfalcou-eve/all/test_v1_package/conanfile.py b/recipes/jfalcou-eve/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..daab8195118f1 --- /dev/null +++ b/recipes/jfalcou-eve/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + + +class JfalcouEveConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/jfalcou-eve/config.yml b/recipes/jfalcou-eve/config.yml index 0190125da41b4..5db2eb32f0264 100644 --- a/recipes/jfalcou-eve/config.yml +++ b/recipes/jfalcou-eve/config.yml @@ -3,3 +3,7 @@ versions: folder: all "v2022.03.0": folder: all + "v2022.09.0": + folder: all + "v2022.09.1": + folder: all diff --git a/recipes/joltphysics/all/conandata.yml b/recipes/joltphysics/all/conandata.yml new file mode 100644 index 0000000000000..7c5580239b9ad --- /dev/null +++ b/recipes/joltphysics/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "2.0.1": + url: "https://github.com/jrouwe/JoltPhysics/archive/refs/tags/v2.0.1.tar.gz" + sha256: "96ae2e8691c4802e56bf2587da30f2cc86b8abe82a78bc2398065bd87dd718af" +patches: + "2.0.1": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "Fix CMakeLists: no warnings as errors, allow shared, add install target, and add profile & debug_renderer options" + patch_type: "conan" diff --git a/recipes/joltphysics/all/conanfile.py b/recipes/joltphysics/all/conanfile.py new file mode 100644 index 0000000000000..875b57e559f57 --- /dev/null +++ b/recipes/joltphysics/all/conanfile.py @@ -0,0 +1,160 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +import os + +required_conan_version = ">=1.53.0" + + +class JoltPhysicsConan(ConanFile): + name = "joltphysics" + description = ( + "A multi core friendly rigid body physics and collision detection " + "library, written in C++, suitable for games and VR applications." + ) + license = "MIT" + topics = ("physics", "simulation", "physics-engine", "physics-simulation", "rigid-body", "game", "collision") + homepage = "https://github.com/jrouwe/JoltPhysics" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "simd": ["sse", "sse41", "sse42", "avx", "avx2", "avx512"], + "debug_renderer": [True, False], + "profile": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "simd": "sse42", + "debug_renderer": False, + "profile": False, + } + + @property + def _min_cppstd(self): + return "17" + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "9.2", # due to https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81429 + "clang": "5", + "apple-clang": "12", + } + + @property + def _has_sse41(self): + return self.options.get_safe("simd") in ("sse41", "sse42", "avx", "avx2", "avx512") + + @property + def _has_sse42(self): + return self.options.get_safe("simd") in ("sse42", "avx", "avx2", "avx512") + + @property + def _has_avx(self): + return self.options.get_safe("simd") in ("avx", "avx2", "avx512") + + @property + def _has_avx2(self): + return self.options.get_safe("simd") in ("avx2", "avx512") + + @property + def _has_avx512(self): + return self.options.get_safe("simd") == "avx512" + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if self.settings.arch not in ("x86", "x86_64"): + del self.options.simd + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.info.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported with Visual Studio") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TARGET_UNIT_TESTS"] = False + tc.variables["TARGET_HELLO_WORLD"] = False + tc.variables["TARGET_PERFORMANCE_TEST"] = False + tc.variables["TARGET_SAMPLES"] = False + tc.variables["TARGET_VIEWER"] = False + tc.variables["GENERATE_DEBUG_SYMBOLS"] = False + tc.variables["TARGET_UNIT_TESTS"] = False + tc.variables["USE_SSE4_1"] = self._has_sse41 + tc.variables["USE_SSE4_2"] = self._has_sse42 + tc.variables["USE_AVX"] = self._has_avx + tc.variables["USE_AVX2"] = self._has_avx2 + tc.variables["USE_AVX512"] = self._has_avx512 + if is_msvc(self): + tc.variables["USE_STATIC_MSVC_RUNTIME_LIBRARY"] = is_msvc_static_runtime(self) + tc.variables["JPH_DEBUG_RENDERER"] = self.options.debug_renderer + tc.variables["JPH_PROFILE_ENABLED"] = self.options.profile + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "Build")) + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["Jolt"] + if self._has_sse41: + self.cpp_info.defines.append("JPH_USE_SSE4_1") + if self._has_sse42: + self.cpp_info.defines.append("JPH_USE_SSE4_2") + if self._has_avx: + self.cpp_info.defines.append("JPH_USE_AVX") + if self._has_avx2: + self.cpp_info.defines.append("JPH_USE_AVX2") + if self._has_avx512: + self.cpp_info.defines.append("JPH_USE_AVX512") + if self.options.debug_renderer: + self.cpp_info.defines.append("JPH_DEBUG_RENDERER") + if self.options.profile: + self.cpp_info.defines.append("JPH_PROFILE_ENABLED") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) diff --git a/recipes/joltphysics/all/patches/0001-fix-cmake.patch b/recipes/joltphysics/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..2be9454d8f5f9 --- /dev/null +++ b/recipes/joltphysics/all/patches/0001-fix-cmake.patch @@ -0,0 +1,90 @@ +--- a/Build/CMakeLists.txt ++++ b/Build/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.16 FATAL_ERROR) ++cmake_minimum_required(VERSION 3.15) + + project(JoltPhysics CXX) + +@@ -32,11 +32,6 @@ include(CMakeDependentOption) + # Windows Store only supports the DLL version + cmake_dependent_option(USE_STATIC_MSVC_RUNTIME_LIBRARY "Use the static MSVC runtime library" ON "MSVC;NOT WINDOWS_STORE" OFF) + +-if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") +- set(CMAKE_CONFIGURATION_TYPES "Debug;Release;Distribution") +-elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang") +- set(CMAKE_CONFIGURATION_TYPES "Debug;Release;ReleaseASAN;ReleaseUBSAN;ReleaseCoverage;Distribution") +-endif() + + if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore") AND NOT MINGW) + # Fill in the path to the asan libraries +@@ -53,7 +48,7 @@ if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUA + endif() + + # Set general compiler flags +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /std:c++17 /Zc:__cplusplus /Gm- /Wall /WX /MP /nologo /diagnostics:classic /FC /fp:except- /Zc:inline /Zi") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:__cplusplus /Gm- /Wall /MP /nologo /diagnostics:classic /FC /fp:except- /Zc:inline /Zi") + + # Remove any existing compiler flag that enables RTTI + string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) +@@ -76,8 +71,6 @@ if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUA + + if (NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM64") AND NOT ("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "ARM")) + # On ARM, whole program optimization triggers an internal compiler error during code gen, so we don't turn it on +- set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /GL") +- set(CMAKE_CXX_FLAGS_DISTRIBUTION "${CMAKE_CXX_FLAGS_DISTRIBUTION} /GL") + endif() + + # Set linker flags +@@ -118,7 +111,6 @@ if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUA + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /DJPH_FLOATING_POINT_EXCEPTIONS_ENABLED") # Clang turns Float2 into a vector sometimes causing floating point exceptions + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /DJPH_FLOATING_POINT_EXCEPTIONS_ENABLED") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "/INCREMENTAL:NO /LTCG:incremental /OPT:ICF /OPT:REF") +- set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "/LTCG") + elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /showFilenames") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Qunused-arguments") # Clang emits warnings about unused arguments such as /MP and /GL +@@ -153,7 +145,7 @@ if (("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUA + endif() + elseif ("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Darwin" OR "${CMAKE_SYSTEM_NAME}" STREQUAL "iOS" OR MINGW OR EMSCRIPTEN) + # Set general compiler flags +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -std=c++17 -I. -Wall -Werror") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -I. -Wall") + + if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") + # Somehow -Wcomment doesn't want to be turned off from code and we need this because Doxygen MathJax uses it +--- a/Jolt/Jolt.cmake ++++ b/Jolt/Jolt.cmake +@@ -410,12 +410,26 @@ endif() + source_group(TREE ${JOLT_PHYSICS_ROOT} FILES ${JOLT_PHYSICS_SRC_FILES}) + + # Create Jolt lib +-add_library(Jolt STATIC ${JOLT_PHYSICS_SRC_FILES}) ++add_library(Jolt ${JOLT_PHYSICS_SRC_FILES}) ++target_compile_features(Jolt PUBLIC cxx_std_17) ++include(GNUInstallDirs) ++install( ++ TARGETS Jolt ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++) ++install(DIRECTORY ${JOLT_PHYSICS_ROOT} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} FILES_MATCHING REGEX "(.*).(h|inl)$") ++if(JPH_DEBUG_RENDERER) ++ target_compile_definitions(Jolt PUBLIC JPH_DEBUG_RENDERER) ++endif() ++if(JPH_PROFILE_ENABLED) ++ target_compile_definitions(Jolt PUBLIC JPH_PROFILE_ENABLED) ++endif() + target_include_directories(Jolt PUBLIC ${PHYSICS_REPO_ROOT}) +-target_precompile_headers(Jolt PRIVATE ${JOLT_PHYSICS_ROOT}/Jolt.h) +-target_compile_definitions(Jolt PUBLIC "$<$:_DEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>") +-target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>") ++target_compile_definitions(Jolt PUBLIC "$<$:_DEBUG>") ++target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG>") + target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG>") +-target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG;JPH_PROFILE_ENABLED;JPH_DISABLE_TEMP_ALLOCATOR;JPH_DISABLE_CUSTOM_ALLOCATOR;JPH_DEBUG_RENDERER>") +-target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG;JPH_PROFILE_ENABLED;JPH_DEBUG_RENDERER>") ++target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG;JPH_DISABLE_TEMP_ALLOCATOR;JPH_DISABLE_CUSTOM_ALLOCATOR>") ++target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG>") + target_compile_definitions(Jolt PUBLIC "$<$:NDEBUG>") diff --git a/recipes/joltphysics/all/test_package/CMakeLists.txt b/recipes/joltphysics/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0b69831ca4aa0 --- /dev/null +++ b/recipes/joltphysics/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(joltphysics REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE joltphysics::joltphysics) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/joltphysics/all/test_package/conanfile.py b/recipes/joltphysics/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/joltphysics/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/joltphysics/all/test_package/test_package.cpp b/recipes/joltphysics/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..73d3685c494f5 --- /dev/null +++ b/recipes/joltphysics/all/test_package/test_package.cpp @@ -0,0 +1,51 @@ +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +static void TraceImpl(const char *inFMT, ...) +{ + va_list list; + va_start(list, inFMT); + char buffer[1024]; + std::vsnprintf(buffer, sizeof(buffer), inFMT, list); + va_end(list); + + std::cout << buffer << std::endl; +} + +#ifdef JPH_ENABLE_ASSERTS +static bool AssertFailedImpl(const char *inExpression, const char *inMessage, const char *inFile, JPH::uint inLine) +{ + std::cout << inFile << ":" << inLine << ": (" << inExpression << ") " << (inMessage != nullptr? inMessage : "") << std::endl; + return true; +}; +#endif + +int main() +{ + JPH::RegisterDefaultAllocator(); + + JPH::Trace = TraceImpl; +#ifdef JPH_ENABLE_ASSERTS + JPH::AssertFailed = AssertFailedImpl; +#endif + + JPH::Factory::sInstance = new JPH::Factory(); + + JPH::RegisterTypes(); + + JPH::TempAllocatorImpl temp_allocator(10 * 1024 * 1024); + JPH::JobSystemThreadPool job_system(JPH::cMaxPhysicsJobs, JPH::cMaxPhysicsBarriers, std::thread::hardware_concurrency() - 1); + + delete JPH::Factory::sInstance; + JPH::Factory::sInstance = nullptr; + + return 0; +} diff --git a/recipes/joltphysics/all/test_v1_package/CMakeLists.txt b/recipes/joltphysics/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/joltphysics/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/joltphysics/all/test_v1_package/conanfile.py b/recipes/joltphysics/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/joltphysics/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/joltphysics/config.yml b/recipes/joltphysics/config.yml new file mode 100644 index 0000000000000..bb7eb85dfac49 --- /dev/null +++ b/recipes/joltphysics/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0.1": + folder: all diff --git a/recipes/jom/all/conanfile.py b/recipes/jom/all/conanfile.py index df5ddcdd86ee8..e94e1344b85ef 100644 --- a/recipes/jom/all/conanfile.py +++ b/recipes/jom/all/conanfile.py @@ -1,29 +1,47 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import copy, download, get +from conan.errors import ConanInvalidConfiguration import os +required_conan_version = ">=1.47.0" class JomInstallerConan(ConanFile): name = "jom" description = "jom is a clone of nmake to support the execution of multiple independent commands in parallel" url = "https://github.com/conan-io/conan-center-index" homepage = "http://wiki.qt.io/Jom" - license = "GPL-3.0" - topics = ("conan", "jom", "build", "makefile", "make") + license = "GPL-3.0-only" + topics = ("build", "make", "makefile", "nmake") + settings = "os", "arch", "compiler", "build_type" - settings = "os" + def layout(self): + pass - def configure(self): - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("Only Windows supported") + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type + + def validate(self): + if self.info.settings.os != "Windows": + raise ConanInvalidConfiguration(f"{self.ref} only supports Windows") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - tools.download('https://code.qt.io/cgit/qt-labs/jom.git/plain/LICENSE.GPL?h=v%s' % self.version, filename='LICENSE.GPL') + pass + + def build(self): + get(self, **self.conan_data["sources"][self.version]) + download(self, f"https://code.qt.io/cgit/qt-labs/jom.git/plain/LICENSE.GPL?h=v{self.version}", filename="LICENSE.GPL") def package(self): - self.copy("LICENSE.GPL", dst= 'licenses', src='') - self.copy("*.exe", dst="bin", src="") - + copy(self, "LICENSE.GPL", self.build_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*.exe", self.build_folder, os.path.join(self.package_folder, "bin")) + def package_info(self): - self.env_info.path.append(os.path.join(self.package_folder, "bin")) + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] + + # TODO: Legacy, to be removed on Conan 2.0 + bin_folder = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bin_folder) diff --git a/recipes/jom/all/test_package/conanfile.py b/recipes/jom/all/test_package/conanfile.py index f7976d712ed83..7762b725dc75e 100644 --- a/recipes/jom/all/test_package/conanfile.py +++ b/recipes/jom/all/test_package/conanfile.py @@ -1,8 +1,18 @@ -from conans import ConanFile +from conan import ConanFile +from conan.tools.build import can_run class TestPackageConan(ConanFile): - settings = "os" + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" - def test(self): - self.run("jom /VERSION") + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def build(self): + pass + + def test(self): + if can_run(self): + self.run("jom /VERSION") diff --git a/recipes/jom/all/test_v1_package/conanfile.py b/recipes/jom/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..524a49a286047 --- /dev/null +++ b/recipes/jom/all/test_v1_package/conanfile.py @@ -0,0 +1,13 @@ +from conans import ConanFile +from conan.tools.build import can_run + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def build(self): + pass + + def test(self): + if can_run(self): + self.run("jom /VERSION", run_environment=True) diff --git a/recipes/jpeg-compressor/all/CMakeLists.txt b/recipes/jpeg-compressor/all/CMakeLists.txt index 0e47d5a0562dd..dfd323b394ceb 100644 --- a/recipes/jpeg-compressor/all/CMakeLists.txt +++ b/recipes/jpeg-compressor/all/CMakeLists.txt @@ -1,33 +1,25 @@ -cmake_minimum_required(VERSION 3.4) -project(jpeg-compressor) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(JPEGCOMPRESSOR_SOURCE_SUBFOLDER "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder") - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) +cmake_minimum_required(VERSION 3.8) +project(jpeg-compressor LANGUAGES CXX) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -# jgpd lib - -set(JPGD_SRC_LIST ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpgd.cpp) -set(JPGD_HDR_LIST ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpgd.h ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpgd_idct.h) -add_library(jpgd ${JPGD_SRC_LIST} ${JPGD_HDR_LIST}) -target_include_directories(jpgd PUBLIC ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}) - -install(TARGETS jpgd) -install(FILES ${JPGD_HDR_LIST} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) - -# jgpe lib - -set(JPGE_SRC_LIST ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpge.cpp) -set(JPGE_HDR_LIST ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpge.h ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}/jpge.h) -add_library(jpge ${JPGE_SRC_LIST} ${JPGE_HDR_LIST}) -target_include_directories(jpge PUBLIC ${JPEGCOMPRESSOR_SOURCE_SUBFOLDER}) - -install(TARGETS jpge) -install(FILES ${JPGE_HDR_LIST} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +# jpgd lib +set(JPGD_HDR_LIST ${JPEGCOMPRESSOR_SRC_DIR}/jpgd.h ${JPEGCOMPRESSOR_SRC_DIR}/jpgd_idct.h) +add_library(jpgd ${JPEGCOMPRESSOR_SRC_DIR}/jpgd.cpp) +target_include_directories(jpgd PUBLIC ${JPEGCOMPRESSOR_SRC_DIR}) +target_compile_features(jpgd PRIVATE cxx_std_11) + +# jpge lib +set(JPGE_HDR_LIST ${JPEGCOMPRESSOR_SRC_DIR}/jpge.h ${JPEGCOMPRESSOR_SRC_DIR}/jpge.h) +add_library(jpge ${JPEGCOMPRESSOR_SRC_DIR}/jpge.cpp) +target_include_directories(jpge PUBLIC ${JPEGCOMPRESSOR_SRC_DIR}) +target_compile_features(jpge PRIVATE cxx_std_11) + +include(GNUInstallDirs) +install( + TARGETS jpgd jpge + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install(FILES ${JPGD_HDR_LIST} ${JPGE_HDR_LIST} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/jpeg-compressor/all/conandata.yml b/recipes/jpeg-compressor/all/conandata.yml index cbbfa966a7ab4..5118d6cb5cb15 100644 --- a/recipes/jpeg-compressor/all/conandata.yml +++ b/recipes/jpeg-compressor/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "cci.20200507": - patch_file: "patches/pr-18-remove-include-malloc.patch" - base_path: "source_subfolder" diff --git a/recipes/jpeg-compressor/all/conanfile.py b/recipes/jpeg-compressor/all/conanfile.py index 14f61cf565274..da12e25b8e6e5 100644 --- a/recipes/jpeg-compressor/all/conanfile.py +++ b/recipes/jpeg-compressor/all/conanfile.py @@ -1,19 +1,23 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, save +from conan.tools.microsoft import is_msvc_static_runtime import os -import glob -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.53.0" class JpegCompressorConan(ConanFile): name = "jpeg-compressor" description = "C++ JPEG compression/fuzzed low-RAM JPEG decompression codec with Public Domain or Apache 2.0 license" homepage = "https://github.com/richgel999/jpeg-compressor" - topics = ("conan", "jpeg", "image", "compression", "decompression") + topics = ("jpeg", "image", "compression", "decompression") url = "https://github.com/conan-io/conan-center-index" license = "Unlicense", "Apache-2.0", "MIT" + settings = "os", "arch", "compiler", "build_type" - generators = "cmake" - exports_sources = ["CMakeLists.txt", "patches/*"] options = { "shared": [True, False], "fPIC": [True, False], @@ -23,15 +27,9 @@ class JpegCompressorConan(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,30 +37,34 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - if self.settings.compiler == "Visual Studio" and "MT" in self.settings.compiler.runtime: - raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if self.info.options.shared and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob(self.name + "-*/")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["JPEGCOMPRESSOR_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def _extract_license(self): - with open(os.path.join(self._source_subfolder, "jpge.cpp")) as f: + with open(os.path.join(self.source_folder, "jpge.cpp")) as f: content_lines = f.readlines() license_content = [] for i in range(4, 20): @@ -70,10 +72,9 @@ def _extract_license(self): return "\n".join(license_content) def package(self): - cmake = self._configure_cmake() + save(self, os.path.join(self.package_folder, "licenses", "LICENCE.txt"), self._extract_license()) + cmake = CMake(self) cmake.install() - self._extract_license() - tools.save(os.path.join(self.package_folder, "licenses", "LICENCE.txt"), self._extract_license()) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["jpgd", "jpge"] diff --git a/recipes/jpeg-compressor/all/test_package/CMakeLists.txt b/recipes/jpeg-compressor/all/test_package/CMakeLists.txt index 33ae887aa6aea..25752a9cef844 100644 --- a/recipes/jpeg-compressor/all/test_package/CMakeLists.txt +++ b/recipes/jpeg-compressor/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(jpeg-compressor REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE jpeg-compressor::jpeg-compressor) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/jpeg-compressor/all/test_package/conanfile.py b/recipes/jpeg-compressor/all/test_package/conanfile.py index 89b0e07ae49fe..ea70607af0172 100644 --- a/recipes/jpeg-compressor/all/test_package/conanfile.py +++ b/recipes/jpeg-compressor/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") img_path = os.path.join(self.source_folder, "testimg.jpg") - bin_path = os.path.join("bin", "test_package") - self.run("{} {}".format(bin_path, img_path), run_environment=True) + self.run(f"{bin_path} {img_path}", env="conanrun") diff --git a/recipes/jpeg-compressor/all/test_v1_package/CMakeLists.txt b/recipes/jpeg-compressor/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/jpeg-compressor/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/jpeg-compressor/all/test_v1_package/conanfile.py b/recipes/jpeg-compressor/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ff285a92f9ca9 --- /dev/null +++ b/recipes/jpeg-compressor/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_path = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_path}", run_environment=True) diff --git a/recipes/jsmn/all/conandata.yml b/recipes/jsmn/all/conandata.yml new file mode 100644 index 0000000000000..4e1b9613351b7 --- /dev/null +++ b/recipes/jsmn/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1.0": + url: "https://github.com/zserge/jsmn/archive/refs/tags/v1.1.0.tar.gz" + sha256: "5f0913a10657fe7ec8d5794ccf00a01000e3e1f2f1e1f143c34a0f7b47edcb38" diff --git a/recipes/jsmn/all/conanfile.py b/recipes/jsmn/all/conanfile.py new file mode 100644 index 0000000000000..80c11f45949cb --- /dev/null +++ b/recipes/jsmn/all/conanfile.py @@ -0,0 +1,41 @@ +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" + + +class JsmnConan(ConanFile): + name = "jsmn" + description = ( + "jsmn (pronounced like 'jasmine') is a minimalistic JSON parser in C. " + "It can be easily integrated into resource-limited or embedded projects." + ) + license = "MIT" + topics = ("json", "parser") + homepage = "https://github.com/zserge/jsmn" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "jsmn.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/jsmn/all/test_package/CMakeLists.txt b/recipes/jsmn/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..1b2a676ec01f1 --- /dev/null +++ b/recipes/jsmn/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(jsmn REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE jsmn::jsmn) diff --git a/recipes/jsmn/all/test_package/conanfile.py b/recipes/jsmn/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/jsmn/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jsmn/all/test_package/test_package.c b/recipes/jsmn/all/test_package/test_package.c new file mode 100644 index 0000000000000..20c6bc254fdfa --- /dev/null +++ b/recipes/jsmn/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#define JSMN_STATIC +#include + +int main() { + jsmn_parser parser; + jsmn_init(&parser); + return 0; +} diff --git a/recipes/jsmn/all/test_v1_package/CMakeLists.txt b/recipes/jsmn/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/jsmn/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/jsmn/all/test_v1_package/conanfile.py b/recipes/jsmn/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/jsmn/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/jsmn/config.yml b/recipes/jsmn/config.yml new file mode 100644 index 0000000000000..b5c0d3cb2d409 --- /dev/null +++ b/recipes/jsmn/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.0": + folder: all diff --git a/recipes/json-c/all/conandata.yml b/recipes/json-c/all/conandata.yml index 74d4966619292..7ed706059e17c 100644 --- a/recipes/json-c/all/conandata.yml +++ b/recipes/json-c/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.16": + url: "https://github.com/json-c/json-c/archive/json-c-0.16-20220414.tar.gz" + sha256: "3ecaeedffd99a60b1262819f9e60d7d983844073abc74e495cb822b251904185" "0.15": url: "https://github.com/json-c/json-c/archive/json-c-0.15-20200726.tar.gz" sha256: "4ba9a090a42cf1e12b84c64e4464bb6fb893666841d5843cc5bef90774028882" diff --git a/recipes/json-c/all/conanfile.py b/recipes/json-c/all/conanfile.py index bfb818b66b269..7bdf4d8251e6d 100644 --- a/recipes/json-c/all/conanfile.py +++ b/recipes/json-c/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class JSONCConan(ConanFile): @@ -31,15 +31,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/json-c/all/test_package/conanfile.py b/recipes/json-c/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/json-c/all/test_package/conanfile.py +++ b/recipes/json-c/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/json-c/all/test_v1_package/CMakeLists.txt b/recipes/json-c/all/test_v1_package/CMakeLists.txt index 79b7a884c2d75..0d20897301b68 100644 --- a/recipes/json-c/all/test_v1_package/CMakeLists.txt +++ b/recipes/json-c/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(json-c REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE json-c::json-c) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/json-c/all/test_v1_package/conanfile.py b/recipes/json-c/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/json-c/all/test_v1_package/conanfile.py +++ b/recipes/json-c/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/json-c/config.yml b/recipes/json-c/config.yml index 5a2bea1374656..1e4023fe84046 100644 --- a/recipes/json-c/config.yml +++ b/recipes/json-c/config.yml @@ -1,4 +1,6 @@ versions: + "0.16": + folder: all "0.15": folder: all "0.14": diff --git a/recipes/json-schema-validator/all/CMakeLists.txt b/recipes/json-schema-validator/all/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/json-schema-validator/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/json-schema-validator/all/conandata.yml b/recipes/json-schema-validator/all/conandata.yml index bc8c3e5a5532c..122476811e03f 100644 --- a/recipes/json-schema-validator/all/conandata.yml +++ b/recipes/json-schema-validator/all/conandata.yml @@ -1,7 +1,24 @@ sources: + "2.2.0": + url: "https://github.com/pboettch/json-schema-validator/archive/refs/tags/2.2.0.tar.gz" + sha256: "03897867bd757ecac1db7545babf0c6c128859655b496582a9cea4809c2260aa" "2.1.0": url: "https://github.com/pboettch/json-schema-validator/archive/refs/tags/2.1.0.tar.gz" sha256: "83f61d8112f485e0d3f1e72d51610ba3924b179926a8376aef3c038770faf202" "2.0.0": url: "https://github.com/pboettch/json-schema-validator/archive/refs/tags/2.0.0.tar.gz" sha256: "ca8e4ca5a88c49ea52b5f5c2a08a293dbf02b2fc66cb8c09d4cce5810ee98b57" +patches: + "2.2.0": + - patch_file: "patches/2.2.0-signed-char.patch" + patch_type: "portability" + patch_description: "Fix for PowerPC and ARM" + patch_source: "https://github.com/pboettch/json-schema-validator/pull/242" + "2.1.0": + - patch_file: "patches/2.1.0-cmake_minimum_version.patch" + patch_type: "conan" + patch_description: "CMake: cmake_minimum_version() before project()" + "2.0.0": + - patch_file: "patches/2.0.0-cmake_minimum_version.patch" + patch_type: "conan" + patch_description: "CMake: cmake_minimum_version() before project()" diff --git a/recipes/json-schema-validator/all/conanfile.py b/recipes/json-schema-validator/all/conanfile.py index 74b9d6d113d3a..c9901f8fafff9 100644 --- a/recipes/json-schema-validator/all/conanfile.py +++ b/recipes/json-schema-validator/all/conanfile.py @@ -1,9 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools import build, files, microsoft, scm +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class JsonSchemaValidatorConan(ConanFile): @@ -26,17 +28,9 @@ class JsonSchemaValidatorConan(ConanFile): } short_paths = True - generators = "cmake", "cmake_find_package" - exports_sources = ["CMakeLists.txt"] - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + files.export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,17 +38,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - self.requires("nlohmann_json/3.10.5") + self.requires("nlohmann_json/3.11.2", transitive_headers=True) def validate(self): - version = tools.Version(self.version) + version = scm.Version(self.version) min_vs_version = "16" if version < "2.1.0" else "14" - min_cppstd = "17" if self.settings.compiler == "Visual Studio" and version < "2.1.0" else "11" - if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, min_cppstd) + min_cppstd = "17" if microsoft.is_msvc(self) and version < "2.1.0" else "11" + if self.info.settings.get_safe("compiler.cppstd"): + build.check_min_cppstd(self, min_cppstd) min_vs_version = "15" if version < "2.1.0" else "14" compilers = { @@ -62,43 +56,49 @@ def validate(self): "gcc": "5" if version < "2.1.0" else "4.9", "clang": "4", "apple-clang": "9"} - min_version = compilers.get(str(self.settings.compiler)) + min_version = compilers.get(str(self.info.settings.compiler)) if not min_version: - self.output.warn("{} recipe lacks information about the {} compiler support.".format( - self.name, self.settings.compiler)) + self.output.warn(f"{self.name} recipe lacks information about the {self.info.settings.compiler} compiler support.") else: - if tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration("{} requires c++{} support. The current compiler {} {} does not support it.".format( - self.name, min_cppstd, self.settings.compiler, self.settings.compiler.version)) + if scm.Version(self.info.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration(f"{self.name} requires c++{min_cppstd} support. The current compiler {self.info.settings.compiler} {self.info.settings.compiler.version} does not support it.") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_EXAMPLES"] = False - if tools.Version(self.version) < "2.1.0": - self._cmake.definitions["NLOHMANN_JSON_DIR"] = ";".join(self.deps_cpp_info["nlohmann_json"].include_paths) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + files.get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if scm.Version(self.version) < "2.2.0": + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_EXAMPLES"] = False + else: + tc.variables["JSON_VALIDATOR_BUILD_TESTS"] = False + tc.variables["JSON_VALIDATOR_BUILD_EXAMPLES"] = False + if scm.Version(self.version) < "2.1.0": + tc.variables["NLOHMANN_JSON_DIR"] = ";".join(self.deps_cpp_info["nlohmann_json"].include_paths).replace("\\", "/") + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + files.apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + files.copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - if tools.Version(self.version) < "2.1.0": - self.copy("json-schema.hpp", - dst=os.path.join("include", "nlohmann"), - src=os.path.join(self._source_subfolder, "src")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + if scm.Version(self.version) < "2.1.0": + files.copy(self, "json-schema.hpp", + dst=os.path.join(self.package_folder, "include", "nlohmann"), + src=os.path.join(self.source_folder, "src")) + files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -106,8 +106,7 @@ def package(self): {"nlohmann_json_schema_validator": "nlohmann_json_schema_validator::nlohmann_json_schema_validator"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -116,16 +115,19 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + files.save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "nlohmann_json_schema_validator") self.cpp_info.set_property("cmake_target_name", "nlohmann_json_schema_validator") - self.cpp_info.libs = ["json-schema-validator" if tools.Version(self.version) < "2.1.0" else "nlohmann_json_schema_validator"] + self.cpp_info.libs = ["json-schema-validator" if scm.Version(self.version) < "2.1.0" else "nlohmann_json_schema_validator"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "nlohmann_json_schema_validator" diff --git a/recipes/json-schema-validator/all/patches/2.0.0-cmake_minimum_version.patch b/recipes/json-schema-validator/all/patches/2.0.0-cmake_minimum_version.patch new file mode 100644 index 0000000000000..511a6d5522051 --- /dev/null +++ b/recipes/json-schema-validator/all/patches/2.0.0-cmake_minimum_version.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt 2019-04-02 10:39:55.000000000 -0000 ++++ b/CMakeLists.txt 2022-11-07 17:09:53.295000000 -0000 +@@ -1,10 +1,10 @@ ++cmake_minimum_required(VERSION 3.2) ++ + project(json-schema-validator + LANGUAGES CXX) + + set(PROJECT_VERSION 2.0.0) + +-cmake_minimum_required(VERSION 3.2) +- + option(BUILD_TESTS "Build tests" ON) + option(BUILD_EXAMPLES "Build examples" ON) + diff --git a/recipes/json-schema-validator/all/patches/2.1.0-cmake_minimum_version.patch b/recipes/json-schema-validator/all/patches/2.1.0-cmake_minimum_version.patch new file mode 100644 index 0000000000000..7936e2adcfe40 --- /dev/null +++ b/recipes/json-schema-validator/all/patches/2.1.0-cmake_minimum_version.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt 2020-05-15 09:04:12.000000000 -0000 ++++ b/CMakeLists.txt 2022-11-07 16:57:29.655000000 -0000 +@@ -1,10 +1,10 @@ ++cmake_minimum_required(VERSION 3.2) ++ + project(nlohmann_json_schema_validator + LANGUAGES CXX) + + set(PROJECT_VERSION 2.1.0) + +-cmake_minimum_required(VERSION 3.2) +- + option(BUILD_TESTS "Build tests" ON) + option(BUILD_EXAMPLES "Build examples" ON) + diff --git a/recipes/json-schema-validator/all/patches/2.2.0-signed-char.patch b/recipes/json-schema-validator/all/patches/2.2.0-signed-char.patch new file mode 100644 index 0000000000000..ffea4bf7ef2e7 --- /dev/null +++ b/recipes/json-schema-validator/all/patches/2.2.0-signed-char.patch @@ -0,0 +1,64 @@ +From 3918616faf989fcf4a9206a34e3b87c23642a96a Mon Sep 17 00:00:00 2001 +From: Robert Joslyn +Date: Wed, 30 Nov 2022 13:07:29 -0800 +Subject: [PATCH] Fix assumed signed char + +The code assumes that char is signed, but whether char is signed or +unsigned is implementation defined. On some architectures like PowerPC, +GCC treats char as unsigned resulting in compile errors: + + smtp-address-validator.cpp:213:1: error: narrowing conversion of '-32' from 'int' to 'char' [-Wnarrowing] + +Fix this by specifying signed char. +--- + src/smtp-address-validator.cpp | 16 ++++++++-------- + 1 file changed, 8 insertions(+), 8 deletions(-) + +diff --git a/src/smtp-address-validator.cpp b/src/smtp-address-validator.cpp +index a63ead0..3903b51 100644 +--- a/src/smtp-address-validator.cpp ++++ b/src/smtp-address-validator.cpp +@@ -63,7 +63,7 @@ static const short _address_key_offsets[] = { + 1363, 1365, 1367, 1368, 1370, 1388, 0 + }; + +-static const char _address_trans_keys[] = { ++static const signed char _address_trans_keys[] = { + -32, -19, -16, -12, 34, 45, 61, 63, + -62, -33, -31, -17, -15, -13, 33, 39, + 42, 43, 47, 57, 65, 90, 94, 126, +@@ -711,7 +711,7 @@ bool is_address(const char* p, const char* pe) + { + int _klen; + unsigned int _trans = 0; +- const char * _keys; ++ const signed char * _keys; + const signed char * _acts; + unsigned int _nacts; + _resume: {} +@@ -728,9 +728,9 @@ bool is_address(const char* p, const char* pe) + + _klen = (int)_address_single_lengths[cs]; + if ( _klen > 0 ) { +- const char *_lower = _keys; +- const char *_upper = _keys + _klen - 1; +- const char *_mid; ++ const signed char *_lower = _keys; ++ const signed char *_upper = _keys + _klen - 1; ++ const signed char *_mid; + while ( 1 ) { + if ( _upper < _lower ) { + _keys += _klen; +@@ -752,9 +752,9 @@ bool is_address(const char* p, const char* pe) + + _klen = (int)_address_range_lengths[cs]; + if ( _klen > 0 ) { +- const char *_lower = _keys; +- const char *_upper = _keys + (_klen<<1) - 2; +- const char *_mid; ++ const signed char *_lower = _keys; ++ const signed char *_upper = _keys + (_klen<<1) - 2; ++ const signed char *_mid; + while ( 1 ) { + if ( _upper < _lower ) { + _trans += (unsigned int)_klen; diff --git a/recipes/json-schema-validator/all/test_package/CMakeLists.txt b/recipes/json-schema-validator/all/test_package/CMakeLists.txt index 7bbdbdbf9d199..c2d764c121782 100644 --- a/recipes/json-schema-validator/all/test_package/CMakeLists.txt +++ b/recipes/json-schema-validator/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(nlohmann_json_schema_validator CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) target_link_libraries(${PROJECT_NAME} nlohmann_json_schema_validator) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/json-schema-validator/all/test_package/conanfile.py b/recipes/json-schema-validator/all/test_package/conanfile.py index 38f4483872d47..e845ae751a301 100644 --- a/recipes/json-schema-validator/all/test_package/conanfile.py +++ b/recipes/json-schema-validator/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/json-schema-validator/all/test_v1_package/CMakeLists.txt b/recipes/json-schema-validator/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/json-schema-validator/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/json-schema-validator/all/test_v1_package/conanfile.py b/recipes/json-schema-validator/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/json-schema-validator/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/json-schema-validator/config.yml b/recipes/json-schema-validator/config.yml index 2d136f3fe768d..ddf20dd4ca819 100644 --- a/recipes/json-schema-validator/config.yml +++ b/recipes/json-schema-validator/config.yml @@ -1,4 +1,6 @@ versions: + "2.2.0": + folder: all "2.1.0": folder: all "2.0.0": diff --git a/recipes/json_dto/all/conanfile.py b/recipes/json_dto/all/conanfile.py index ee89f2d2edf51..44aa1adf3256a 100644 --- a/recipes/json_dto/all/conanfile.py +++ b/recipes/json_dto/all/conanfile.py @@ -1,11 +1,16 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" -class JsondtoConan(ConanFile): + +class PackageConan(ConanFile): name = "json_dto" license = "BSD-3-Clause" homepage = "https://github.com/Stiffstream/json_dto" @@ -16,51 +21,53 @@ class JsondtoConan(ConanFile): no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" - - def requirements(self): - self.requires("rapidjson/1.1.0") + def _min_cppstd(self): + return 14 - def validate(self): - minimal_cpp_standard = "14" - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { + @property + def _compilers_minimum_version(self): + return { "gcc": "5", "clang": "4", "apple-clang": "8", - "Visual Studio": "15" + "Visual Studio": "14", + "msvc": "190", } - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - elif tools.Version(self.settings.compiler.version) < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - if self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) >= "11": - raise ConanInvalidConfiguration(f"{self.name} requires apple-clang less then version 11") + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("rapidjson/1.1.0", transitive_headers=True) def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = CMake(self) - cmake.definitions["JSON_DTO_INSTALL"] = True - cmake.definitions["JSON_DTO_FIND_DEPS"] = False - cmake.configure(source_folder=os.path.join(self._source_subfolder, "dev", "json_dto")) - cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib")) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include", "json_dto"), + src=os.path.join(self.source_folder, "dev", "json_dto"), + ) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "json-dto") self.cpp_info.set_property("cmake_target_name", "json-dto::json-dto") self.cpp_info.names["cmake_find_package"] = "json-dto" diff --git a/recipes/json_dto/all/test_package/example.cpp b/recipes/json_dto/all/test_package/example.cpp index 166e1da61969e..959a2eed78a41 100644 --- a/recipes/json_dto/all/test_package/example.cpp +++ b/recipes/json_dto/all/test_package/example.cpp @@ -3,6 +3,7 @@ #include #include +#include // Message. struct message_t diff --git a/recipes/jsoncpp/all/conanfile.py b/recipes/jsoncpp/all/conanfile.py index 6d95ad8382a50..1354ccb9d1943 100644 --- a/recipes/jsoncpp/all/conanfile.py +++ b/recipes/jsoncpp/all/conanfile.py @@ -1,11 +1,12 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, save from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class JsoncppConan(ConanFile): @@ -16,7 +17,7 @@ class JsoncppConan(ConanFile): topics = ("json", "parser", "config") description = "A C++ library for interacting with JSON." - settings = "os", "compiler", "arch", "build_type" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -27,8 +28,7 @@ class JsoncppConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -36,14 +36,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -62,14 +61,16 @@ def generate(self): if jsoncpp_version < "1.9.0": # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + # No opt-out of ccache + if Version(self.version) < "1.9.3": + tc.cache_variables["CCACHE_FOUND"] = "" + else: + tc.cache_variables["CCACHE_EXECUTABLE"] = "" tc.generate() def _patch_sources(self): apply_conandata_patches(self) - replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), - "${jsoncpp_SOURCE_DIR}", - "${JSONCPP_SOURCE_DIR}") - if self.settings.compiler == "Visual Studio" and self.settings.compiler.version == "11": + if is_msvc(self) and str(self.settings.compiler.version) in ("11", "170"): replace_in_file(self, os.path.join(self.source_folder, "include", "json", "value.h"), "explicit operator bool()", "operator bool()") @@ -84,9 +85,12 @@ def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() + + # TODO: to remove in conan v2 once legacy generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), { + "JsonCpp::JsonCpp": "jsoncpp::jsoncpp", # alias target since 1.9.5 "jsoncpp_lib": "jsoncpp::jsoncpp", # imported target for shared lib, but also static between 1.9.0 & 1.9.3 "jsoncpp_static": "jsoncpp::jsoncpp", # imported target for static lib if >= 1.9.4 "jsoncpp_lib_static": "jsoncpp::jsoncpp", # imported target for static lib if < 1.9.0 @@ -110,13 +114,18 @@ def _module_file_rel_path(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "jsoncpp") - self.cpp_info.set_property("cmake_target_name", "jsoncpp_lib") - if not self.options.shared: - self.cpp_info.set_property("cmake_target_aliases", ["jsoncpp_static", "jsoncpp_lib_static"]) + self.cpp_info.set_property("cmake_target_name", "JsonCpp::JsonCpp") + self.cpp_info.set_property( + "cmake_target_aliases", + ["jsoncpp_lib"] if self.options.shared else ["jsoncpp_lib", "jsoncpp_static", "jsoncpp_lib_static"], + ) self.cpp_info.set_property("pkg_config_name", "jsoncpp") self.cpp_info.libs = ["jsoncpp"] if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("JSON_DLL") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/jsoncpp/all/test_package/CMakeLists.txt b/recipes/jsoncpp/all/test_package/CMakeLists.txt index 64f408fab6718..3a610a43f2758 100644 --- a/recipes/jsoncpp/all/test_package/CMakeLists.txt +++ b/recipes/jsoncpp/all/test_package/CMakeLists.txt @@ -4,9 +4,5 @@ project(test_package LANGUAGES CXX) find_package(jsoncpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -if(JSONCPP_SHARED) - target_link_libraries(${PROJECT_NAME} PRIVATE jsoncpp_lib) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE jsoncpp_static) -endif() +target_link_libraries(${PROJECT_NAME} PRIVATE JsonCpp::JsonCpp) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/jsoncpp/all/test_package/conanfile.py b/recipes/jsoncpp/all/test_package/conanfile.py index a54e689784373..0a6bc68712d90 100644 --- a/recipes/jsoncpp/all/test_package/conanfile.py +++ b/recipes/jsoncpp/all/test_package/conanfile.py @@ -1,23 +1,19 @@ from conan import ConanFile -from conan.tools.build import cross_building -from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def layout(self): cmake_layout(self) - def generate(self): - tc = CMakeToolchain(self) - tc.variables["JSONCPP_SHARED"] = self.dependencies["jsoncpp"].options.shared - tc.generate() + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -25,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/jsoncpp/all/test_v1_package/CMakeLists.txt b/recipes/jsoncpp/all/test_v1_package/CMakeLists.txt index 4b404af582ffc..0d20897301b68 100644 --- a/recipes/jsoncpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/jsoncpp/all/test_v1_package/CMakeLists.txt @@ -1,15 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(jsoncpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -if(JSONCPP_SHARED) - target_link_libraries(${PROJECT_NAME} PRIVATE jsoncpp_lib) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE jsoncpp_static) -endif() -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/jsoncpp/all/test_v1_package/conanfile.py b/recipes/jsoncpp/all/test_v1_package/conanfile.py index 0afd3cd1b201f..38f4483872d47 100644 --- a/recipes/jsoncpp/all/test_v1_package/conanfile.py +++ b/recipes/jsoncpp/all/test_v1_package/conanfile.py @@ -8,7 +8,6 @@ class TestPackageConan(ConanFile): def build(self): cmake = CMake(self) - cmake.definitions["JSONCPP_SHARED"] = self.options["jsoncpp"].shared cmake.configure() cmake.build() diff --git a/recipes/jsonnet/all/conandata.yml b/recipes/jsonnet/all/conandata.yml index 107abd3b3d824..af6fab5053143 100644 --- a/recipes/jsonnet/all/conandata.yml +++ b/recipes/jsonnet/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.19.1": + url: "https://github.com/google/jsonnet/archive/v0.19.1.tar.gz" + sha256: "f5a20f2dc98fdebd5d42a45365f52fa59a7e6b174e43970fea4f9718a914e887" "0.18.0": url: "https://github.com/google/jsonnet/archive/v0.18.0.tar.gz" sha256: "85c240c4740f0c788c4d49f9c9c0942f5a2d1c2ae58b2c71068107bc80a3ced4" @@ -6,6 +9,11 @@ sources: url: "https://github.com/google/jsonnet/archive/v0.17.0.tar.gz" sha256: "076b52edf888c01097010ad4299e3b2e7a72b60a41abbc65af364af1ed3c8dbe" patches: + "0.19.1": + - patch_file: "patches/0.18.0/0001-fix-nlohmann-include.patch" + base_path: "source_subfolder" + - patch_file: "patches/0.18.0/0002-cmake-fixes.patch" + base_path: "source_subfolder" "0.18.0": - patch_file: "patches/0.18.0/0001-fix-nlohmann-include.patch" base_path: "source_subfolder" diff --git a/recipes/jsonnet/config.yml b/recipes/jsonnet/config.yml index 5bf98d20ca9eb..d98d76db4349a 100644 --- a/recipes/jsonnet/config.yml +++ b/recipes/jsonnet/config.yml @@ -1,4 +1,6 @@ versions: + "0.19.1": + folder: all "0.18.0": folder: all "0.17.0": diff --git a/recipes/jthread-lite/all/conanfile.py b/recipes/jthread-lite/all/conanfile.py index e2825dbb4ec6b..efd2ef2fde6ab 100644 --- a/recipes/jthread-lite/all/conanfile.py +++ b/recipes/jthread-lite/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class JthreadLiteConan(ConanFile): @@ -14,24 +17,32 @@ class JthreadLiteConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "jthread-lite") self.cpp_info.set_property("cmake_target_name", "nonstd::jthread-lite") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] # TODO: back to global scope once cmake_find_package* generators removed if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["jthreadlite"].system_libs = ["pthread"] @@ -44,3 +55,5 @@ def package_info(self): self.cpp_info.components["jthreadlite"].names["cmake_find_package"] = "jthread-lite" self.cpp_info.components["jthreadlite"].names["cmake_find_package_multi"] = "jthread-lite" self.cpp_info.components["jthreadlite"].set_property("cmake_target_name", "nonstd::jthread-lite") + self.cpp_info.components["jthreadlite"].bindirs = [] + self.cpp_info.components["jthreadlite"].libdirs = [] diff --git a/recipes/jthread-lite/all/test_package/CMakeLists.txt b/recipes/jthread-lite/all/test_package/CMakeLists.txt index 31be5ad0681db..4310ed8c6ce1f 100644 --- a/recipes/jthread-lite/all/test_package/CMakeLists.txt +++ b/recipes/jthread-lite/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(jthread-lite REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} nonstd::jthread-lite) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE nonstd::jthread-lite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/jthread-lite/all/test_package/conanfile.py b/recipes/jthread-lite/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/jthread-lite/all/test_package/conanfile.py +++ b/recipes/jthread-lite/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jthread-lite/all/test_v1_package/CMakeLists.txt b/recipes/jthread-lite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/jthread-lite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/jthread-lite/all/test_v1_package/conanfile.py b/recipes/jthread-lite/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/jthread-lite/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/jungle/all/conandata.yml b/recipes/jungle/all/conandata.yml index 66bd8466456e1..bd27aef1a8932 100644 --- a/recipes/jungle/all/conandata.yml +++ b/recipes/jungle/all/conandata.yml @@ -2,6 +2,9 @@ sources: "cci.20220801": url: "https://github.com/eBay/Jungle/archive/f41b7123489f1bc942a6b76dc54485391485cd27.tar.gz" sha256: 8667a114bcef661b2a93e627a68b0584931f182dc8b96693ce6901d903584ab8 + "cci.20221201": + url: "https://github.com/eBay/Jungle/archive/289105763172418eeb37fbeeb6d2fe2a58834715.tar.gz" + sha256: df07fff42e2c4087d96e617d8d976c2856b9dfcef95a0a7255004ed272ca2361 patches: "cci.20220801": - patch_file: "patches/0001-cmake-alterations.patch" @@ -19,3 +22,19 @@ patches: patch_type: "portability" base_path: "source_subfolder" sha256: "3ca66676f89e2425255eeb15bf18a77ae21c4f383124013bd6d1cb660cbc1544" + "cci.20221201": + - patch_file: "patches/0004-cmake-alterations-cci.20221201.patch" + patch_description: "CMake dependency discovery outside subtree." + patch_type: "conan" + base_path: "source_subfolder" + sha256: "a7111a290e145717ae0cbdace9866db69c70782731c8568a806f8579e30759eb" + - patch_file: "patches/0002-forestdb-path.patch" + patch_description: "Update include macros for ForestDB headers." + patch_type: "conan" + base_path: "source_subfolder" + sha256: "84ec45a312c52e2fa8cb7ab615aaa11088f24dcb4e4b880340b46c2763900d6b" + - patch_file: "patches/0003-stdatomic.patch" + patch_description: "Include std::atomic from all compilers." + patch_type: "portability" + base_path: "source_subfolder" + sha256: "3ca66676f89e2425255eeb15bf18a77ae21c4f383124013bd6d1cb660cbc1544" diff --git a/recipes/jungle/all/patches/0004-cmake-alterations-cci.20221201.patch b/recipes/jungle/all/patches/0004-cmake-alterations-cci.20221201.patch new file mode 100644 index 0000000000000..ae047df397a10 --- /dev/null +++ b/recipes/jungle/all/patches/0004-cmake-alterations-cci.20221201.patch @@ -0,0 +1,48 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -106,7 +106,8 @@ if (LOGGER_NO_BACKTRACE GREATER 0) + message(STATUS "---- NO BACKTRACE BY LOGGER ----") + endif() + +-file(COPY ${CMAKE_SOURCE_DIR}/scripts/runtests.sh ++find_package(forestdb REQUIRED) ++file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/scripts/runtests.sh + DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + + # === CUSTOM LOGGER === +@@ -193,16 +194,16 @@ set(JUNGLE_DEPS + ${LIBDL}) + + add_library(static_lib ${JUNGLE_CORE}) +-target_link_libraries(static_lib ${JUNGLE_DEPS}) ++target_link_libraries(static_lib forestdb::forestdb) + set_target_properties(static_lib PROPERTIES OUTPUT_NAME jungle + CLEAN_DIRECT_OUTPUT 1) + if (DETACH_LOGGER GREATER 0) + add_dependencies(static_lib simplelogger_lib) + endif () + +-add_subdirectory("${PROJECT_SOURCE_DIR}/examples") +-add_subdirectory("${PROJECT_SOURCE_DIR}/tests") +-add_subdirectory("${PROJECT_SOURCE_DIR}/tools") ++#add_subdirectory("${PROJECT_SOURCE_DIR}/examples") ++#add_subdirectory("${PROJECT_SOURCE_DIR}/tests") ++#add_subdirectory("${PROJECT_SOURCE_DIR}/tools") + + if (CODE_COVERAGE GREATER 0) + SETUP_TARGET_FOR_COVERAGE( +--- a/tests/CMakeLists.txt ++++ b/tests/CMakeLists.txt +@@ -5,10 +5,7 @@ set(STRESS_TEST_DIR ${TEST_DIR}/stress) + + set(JUNGLE_TEST_DEPS + static_lib +- ${LIBSIMPLELOGGER} +- ${FDB_LIB_DIR}/libforestdb.a +- ${LIBSNAPPY} +- ${LIBDL}) ++ forestdb:forestdb) + + set(FILEOPS_TEST ${TEST_DIR}/unit/fileops_test.cc) + add_executable(fileops_test ${FILEOPS_TEST}) + diff --git a/recipes/jungle/config.yml b/recipes/jungle/config.yml index 2499184dd3f4b..f95f42a22df32 100644 --- a/recipes/jungle/config.yml +++ b/recipes/jungle/config.yml @@ -1,3 +1,5 @@ versions: "cci.20220801": folder: all + "cci.20221201": + folder: all diff --git a/recipes/jwt-cpp/all/conandata.yml b/recipes/jwt-cpp/all/conandata.yml index 46e564e445665..bf093248fb260 100644 --- a/recipes/jwt-cpp/all/conandata.yml +++ b/recipes/jwt-cpp/all/conandata.yml @@ -6,27 +6,32 @@ sources: url: "https://github.com/Thalhammer/jwt-cpp/archive/v0.5.1.tar.gz" sha256: "d8f5ffb361824630b3b6f4aad26c730c915081071040c232ac57947d6177ef4f" "0.5.0": - url: https://github.com/Thalhammer/jwt-cpp/archive/v0.5.0.tar.gz - sha256: 079a273f070dd11213e301712319a65881e51ab81535cc436d5313191df852a2 + url: "https://github.com/Thalhammer/jwt-cpp/archive/v0.5.0.tar.gz" + sha256: "079a273f070dd11213e301712319a65881e51ab81535cc436d5313191df852a2" "0.4.0": - url: https://github.com/Thalhammer/jwt-cpp/archive/v0.4.0.tar.gz - sha256: f0dcc7b0e8bef8f9c3f434e7121f9941145042c9fe3055a5bdd709085a4f2be4 + url: "https://github.com/Thalhammer/jwt-cpp/archive/v0.4.0.tar.gz" + sha256: "f0dcc7b0e8bef8f9c3f434e7121f9941145042c9fe3055a5bdd709085a4f2be4" "0.3.1": - url: https://github.com/Thalhammer/jwt-cpp/archive/v0.3.1.tar.gz - sha256: 399345e81883f2959df658cd945de39548ddfefdab2acf7b23ee07b9e9a02938 + url: "https://github.com/Thalhammer/jwt-cpp/archive/v0.3.1.tar.gz" + sha256: "399345e81883f2959df658cd945de39548ddfefdab2acf7b23ee07b9e9a02938" patches: "0.6.0": - - patch_file: patches/0005-fix-picojson-header-location-for-conan.patch - base_path: source_subfolder + - patch_file: "patches/0005-fix-picojson-header-location-for-conan.patch" + patch_description: "Remove picojson namespace from its include" + patch_type: "conan" "0.5.1": - - patch_file: patches/0004-fix-picojson-header-location-for-conan.patch - base_path: source_subfolder + - patch_file: "patches/0004-fix-picojson-header-location-for-conan.patch" + patch_description: "Remove picojson namespace from its include" + patch_type: "conan" "0.5.0": - - patch_file: patches/0004-fix-picojson-header-location-for-conan.patch - base_path: source_subfolder + - patch_file: "patches/0004-fix-picojson-header-location-for-conan.patch" + patch_description: "Remove picojson namespace from its include" + patch_type: "conan" "0.4.0": - - patch_file: patches/0003-fix-picojson-header-location-for-conan.patch - base_path: source_subfolder + - patch_file: "patches/0003-fix-picojson-header-location-for-conan.patch" + patch_description: "Remove picojson namespace from its include" + patch_type: "conan" "0.3.1": - - patch_file: patches/0002-fix-openssl-change-version.patch - base_path: source_subfolder + - patch_file: "patches/0002-fix-openssl-change-version.patch" + patch_description: "Remove picojson namespace from its include" + patch_type: "conan" diff --git a/recipes/jwt-cpp/all/conanfile.py b/recipes/jwt-cpp/all/conanfile.py index 8e46b33c84079..75e913785ea24 100644 --- a/recipes/jwt-cpp/all/conanfile.py +++ b/recipes/jwt-cpp/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.scm import Version +from conan.tools.files import get, copy, apply_conandata_patches, export_conandata_patches +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class JwtCppConan(ConanFile): name = "jwt-cpp" @@ -9,39 +12,39 @@ class JwtCppConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Thalhammer/jwt-cpp" description = "A C++ JSON Web Token library for encoding/decoding" - topics = ("jwt-cpp", "json", "jwt", "jws", "jwe", "jwk", "jwks", "jose", "header-only") + topics = ("json", "jwt", "jws", "jwe", "jwk", "jwks", "jose", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _supports_generic_json(self): - return tools.Version(self.version) >= "0.5.0" + return Version(self.version) >= "0.5.0" def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def requirements(self): - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if not self._supports_generic_json: self.requires("picojson/1.3.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def layout(self): + basic_layout(self, src_folder="src") + + def build(self): + apply_conandata_patches(self) def package(self): - header_dir = os.path.join(self._source_subfolder, "include") - self.copy(pattern="jwt-cpp/**.h", dst="include", src=header_dir, keep_path=True) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + header_dir = os.path.join(self.source_folder, "include", "jwt-cpp") + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include", "jwt-cpp"), src=header_dir, keep_path=True) + copy(self, "LICENSE", dst=os.path.join(self.package_folder,"licenses"), src=self.source_folder) def package_id(self): - self.info.header_only() + self.info.clear() def package_info(self): self.cpp_info.set_property("cmake_file_name", "jwt-cpp") @@ -50,3 +53,11 @@ def package_info(self): # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "jwt-cpp" self.cpp_info.names["cmake_find_package_multi"] = "jwt-cpp" + + if self._supports_generic_json: + self.cpp_info.defines.append("JWT_DISABLE_PICOJSON") + + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/jwt-cpp/all/test_package/CMakeLists.txt b/recipes/jwt-cpp/all/test_package/CMakeLists.txt index 38de6e5ebf0d9..020cb1aab4c7d 100644 --- a/recipes/jwt-cpp/all/test_package/CMakeLists.txt +++ b/recipes/jwt-cpp/all/test_package/CMakeLists.txt @@ -1,12 +1,17 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +find_package(jwt-cpp REQUIRED CONFIG) +find_package(picojson REQUIRED CONFIG) -find_package(jwt-cpp REQUIRED) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE jwt-cpp::jwt-cpp picojson::picojson) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -add_executable(example example.cpp) -set_property(TARGET example PROPERTY CXX_STANDARD 11) +if (jwt-cpp_VERSION VERSION_GREATER 0.4.0) + target_compile_definitions(${PROJECT_NAME} PRIVATE JSON_TRAITS_NEEDED) +endif() -target_link_libraries(example jwt-cpp::jwt-cpp CONAN_PKG::picojson) +if (jwt-cpp_VERSION VERSION_GREATER_EQUAL 0.6.0) + target_compile_definitions(${PROJECT_NAME} PRIVATE HAS_DEFAULT_TRAITS) +endif() diff --git a/recipes/jwt-cpp/all/test_package/conanfile.py b/recipes/jwt-cpp/all/test_package/conanfile.py index 97d34e6c6cd09..8c80e56ec63d3 100644 --- a/recipes/jwt-cpp/all/test_package/conanfile.py +++ b/recipes/jwt-cpp/all/test_package/conanfile.py @@ -1,20 +1,27 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class JsonCppTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def requirements(self): + self.requires(self.tested_reference_str) self.requires("picojson/1.3.0") + def layout(self): + cmake_layout(self) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/jwt-cpp/all/test_package/example.cpp b/recipes/jwt-cpp/all/test_package/example.cpp deleted file mode 100644 index d7082b8a374a1..0000000000000 --- a/recipes/jwt-cpp/all/test_package/example.cpp +++ /dev/null @@ -1,20 +0,0 @@ -#include -#include - -int main() { - auto token = jwt::create() - .set_issuer("auth0") - .set_issued_at(std::chrono::system_clock::now()) - .set_expires_at(std::chrono::system_clock::now() + std::chrono::seconds{3600}) - .sign(jwt::algorithm::hs256{"secret"}); - - auto decoded = jwt::decode(token); - for(auto& e : decoded.get_payload_claims()) - std::cout << e.first << " = " << e.second.to_json() << std::endl; - - auto verifier = jwt::verify() - .allow_algorithm(jwt::algorithm::hs256{"secret"}) - .with_issuer("auth0"); - - verifier.verify(decoded); -} diff --git a/recipes/jwt-cpp/all/test_package/test_package.cpp b/recipes/jwt-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a7af84c85dc7c --- /dev/null +++ b/recipes/jwt-cpp/all/test_package/test_package.cpp @@ -0,0 +1,29 @@ +#include + +#ifdef JSON_TRAITS_NEEDED + #ifndef HAS_DEFAULT_TRAITS + #include "traits/defaults.h" + #else + #include + #endif +#endif + +#include + +int main() { + auto token = jwt::create() + .set_issuer("auth0") + .set_issued_at(std::chrono::system_clock::now()) + .set_expires_at(std::chrono::system_clock::now() + std::chrono::seconds{3600}) + .sign(jwt::algorithm::hs256{"secret"}); + + auto decoded = jwt::decode(token); + for(auto& e : decoded.get_payload_claims()) + std::cout << e.first << " = " << e.second.to_json() << std::endl; + + auto verifier = jwt::verify() + .allow_algorithm(jwt::algorithm::hs256{"secret"}) + .with_issuer("auth0"); + + verifier.verify(decoded); +} diff --git a/recipes/jwt-cpp/all/test_package/traits/defaults.h b/recipes/jwt-cpp/all/test_package/traits/defaults.h new file mode 100644 index 0000000000000..7ec119bedd233 --- /dev/null +++ b/recipes/jwt-cpp/all/test_package/traits/defaults.h @@ -0,0 +1,58 @@ +#ifndef JWT_CPP_KAZUHO_PICOJSON_DEFAULTS_H +#define JWT_CPP_KAZUHO_PICOJSON_DEFAULTS_H + +#include "traits.h" + +namespace jwt { + /** + * \brief a class to store a generic [picojson](https://github.com/kazuho/picojson) value as claim + * + * This type is the specialization of the \ref basic_claim class which + * uses the standard template types. + */ + using claim = basic_claim; + + /** + * Create a verifier using the default clock + * \return verifier instance + */ + inline verifier verify() { + return verify(default_clock{}); + } + + /** + * Return a builder instance to create a new token + */ + inline builder create() { return builder(); } + +#ifndef JWT_DISABLE_BASE64 + /** + * Decode a token + * \param token Token to decode + * \return Decoded token + * \throw std::invalid_argument Token is not in correct format + * \throw std::runtime_error Base64 decoding failed or invalid json + */ + inline decoded_jwt decode(const std::string& token) { + return decoded_jwt(token); + } +#endif + + /** + * Decode a token + * \tparam Decode is callabled, taking a string_type and returns a string_type. + * It should ensure the padding of the input and then base64url decode and + * return the results. + * \param token Token to decode + * \param decode The token to parse + * \return Decoded token + * \throw std::invalid_argument Token is not in correct format + * \throw std::runtime_error Base64 decoding failed or invalid json + */ + template + decoded_jwt decode(const std::string& token, Decode decode) { + return decoded_jwt(token, decode); + } +} // namespace jwt + +#endif // JWT_CPP_KAZUHO_PICOJSON_DEFAULTS_H diff --git a/recipes/jwt-cpp/all/test_package/traits/traits.h b/recipes/jwt-cpp/all/test_package/traits/traits.h new file mode 100644 index 0000000000000..099f0dc26ce34 --- /dev/null +++ b/recipes/jwt-cpp/all/test_package/traits/traits.h @@ -0,0 +1,76 @@ +#ifndef JWT_CPP_PICOJSON_TRAITS_H +#define JWT_CPP_PICOJSON_TRAITS_H + +#ifndef PICOJSON_USE_INT64 +#define PICOJSON_USE_INT64 +#endif +#include + +#ifndef JWT_DISABLE_PICOJSON +#define JWT_DISABLE_PICOJSON +#endif +#include "jwt-cpp/jwt.h" + +namespace jwt { + namespace traits { + struct kazuho_picojson { + using value_type = picojson::value; + using object_type = picojson::object; + using array_type = picojson::array; + using string_type = std::string; + using number_type = double; + using integer_type = int64_t; + using boolean_type = bool; + + static json::type get_type(const picojson::value& val) { + using json::type; + if (val.is()) return type::boolean; + if (val.is()) return type::integer; + if (val.is()) return type::number; + if (val.is()) return type::string; + if (val.is()) return type::array; + if (val.is()) return type::object; + + throw std::logic_error("invalid type"); + } + + static picojson::object as_object(const picojson::value& val) { + if (!val.is()) throw std::bad_cast(); + return val.get(); + } + + static std::string as_string(const picojson::value& val) { + if (!val.is()) throw std::bad_cast(); + return val.get(); + } + + static picojson::array as_array(const picojson::value& val) { + if (!val.is()) throw std::bad_cast(); + return val.get(); + } + + static int64_t as_int(const picojson::value& val) { + if (!val.is()) throw std::bad_cast(); + return val.get(); + } + + static bool as_bool(const picojson::value& val) { + if (!val.is()) throw std::bad_cast(); + return val.get(); + } + + static double as_number(const picojson::value& val) { + if (!val.is()) throw std::bad_cast(); + return val.get(); + } + + static bool parse(picojson::value& val, const std::string& str) { + return picojson::parse(val, str).empty(); + } + + static std::string serialize(const picojson::value& val) { return val.serialize(); } + }; + } // namespace traits +} // namespace jwt + +#endif diff --git a/recipes/jwt-cpp/all/test_v1_package/CMakeLists.txt b/recipes/jwt-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..d58f9a64ba28e --- /dev/null +++ b/recipes/jwt-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(jwt-cpp REQUIRED CONFIG) +find_package(picojson REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE jwt-cpp::jwt-cpp picojson::picojson) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +if (jwt-cpp_VERSION VERSION_GREATER 0.4.0) + target_compile_definitions(${PROJECT_NAME} PRIVATE JSON_TRAITS_NEEDED) +endif() + +if (jwt-cpp_VERSION VERSION_GREATER_EQUAL 0.6.0) + target_compile_definitions(${PROJECT_NAME} PRIVATE HAS_DEFAULT_TRAITS) +endif() diff --git a/recipes/jwt-cpp/all/test_v1_package/conanfile.py b/recipes/jwt-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3f782b39bbd4f --- /dev/null +++ b/recipes/jwt-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def requirements(self): + self.requires("picojson/1.3.0") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/jxrlib/all/CMakeLists.txt b/recipes/jxrlib/all/CMakeLists.txt index a5327c20bf0d3..f4e654c29be7f 100644 --- a/recipes/jxrlib/all/CMakeLists.txt +++ b/recipes/jxrlib/all/CMakeLists.txt @@ -1,16 +1,13 @@ -cmake_minimum_required(VERSION 2.8.12) -project(jxrlib C) +cmake_minimum_required(VERSION 3.1) +project(jxrlib LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(JPEGXR_FOLDER ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) +include(GNUInstallDirs) +include(TestBigEndian) if(NOT MSVC) add_definitions(-D__ANSI__) endif() -include(TestBigEndian) test_big_endian(ISBIGENDIAN) if(ISBIGENDIAN) set(DEF_ENDIAN _BIG__ENDIAN_) @@ -80,8 +77,6 @@ install(TARGETS jxrglue LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) - - install(FILES ${JPEGXR_FOLDER}/jxrgluelib/JXRGlue.h ${JPEGXR_FOLDER}/jxrgluelib/JXRMeta.h diff --git a/recipes/jxrlib/all/conandata.yml b/recipes/jxrlib/all/conandata.yml index bf3b5c5345ec6..478aec5f4b6b6 100644 --- a/recipes/jxrlib/all/conandata.yml +++ b/recipes/jxrlib/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "cci.20170615": - patch_file: patches/0001-missing-declarations.patch - base_path: source_subfolder diff --git a/recipes/jxrlib/all/conanfile.py b/recipes/jxrlib/all/conanfile.py index 8d37497c03a35..d4c71b54de455 100644 --- a/recipes/jxrlib/all/conanfile.py +++ b/recipes/jxrlib/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class JxrlibConan(ConanFile): @@ -10,9 +14,8 @@ class JxrlibConan(ConanFile): homepage = "https://jxrlib.codeplex.com/" url = "https://github.com/conan-io/conan-center-index" license = "BSD-2-Clause" - topics = ("conan", "jxr", "jpeg", "xr") - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" + topics = ("jxr", "jpeg", "xr") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,15 +26,9 @@ class JxrlibConan(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,44 +36,54 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler == "Visual Studio" and self.options.shared: - raise ConanInvalidConfiguration("jxrlib shared not supported by Visual Studio") + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_dir=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["JPEGXR_FOLDER"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libjxr") self.cpp_info.libs = ["jxrglue", "jpegxr"] - - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - if self.settings.os != "Windows": + if not is_msvc(self): self.cpp_info.defines.append("__ANSI__") - self.cpp_info.names["pkg_config"] = "libjxr" + # TODO: to remove in conan v2, and do not port this to CMakeDeps, it was a mistake self.cpp_info.names["cmake_find_package"] = "JXR" self.cpp_info.names["cmake_find_package_multi"] = "JXR" diff --git a/recipes/jxrlib/all/test_package/CMakeLists.txt b/recipes/jxrlib/all/test_package/CMakeLists.txt index 7b9b613cbb24a..e7689f4130d27 100644 --- a/recipes/jxrlib/all/test_package/CMakeLists.txt +++ b/recipes/jxrlib/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(jxrlib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE jxrlib::jxrlib) diff --git a/recipes/jxrlib/all/test_package/conanfile.py b/recipes/jxrlib/all/test_package/conanfile.py index d7ad3be43e392..b8d2e695e4b3a 100644 --- a/recipes/jxrlib/all/test_package/conanfile.py +++ b/recipes/jxrlib/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") img_path = os.path.join(self.source_folder, "test.jxr") - self.run("{0} {1}".format(bin_path, img_path), run_environment=True) + self.run(f"{bin_path} {img_path}", env="conanrun") diff --git a/recipes/jxrlib/all/test_v1_package/CMakeLists.txt b/recipes/jxrlib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..eb386b8f18cc0 --- /dev/null +++ b/recipes/jxrlib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(JXR REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE JXR::JXR) diff --git a/recipes/jxrlib/all/test_v1_package/conanfile.py b/recipes/jxrlib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ffd0b1c74921b --- /dev/null +++ b/recipes/jxrlib/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_path = os.path.join(self.source_folder, os.pardir, "test_package", "test.jxr") + self.run(f"{bin_path} {img_path}", run_environment=True) diff --git a/recipes/kaitai_struct_cpp_stl_runtime/all/CMakeLists.txt b/recipes/kaitai_struct_cpp_stl_runtime/all/CMakeLists.txt deleted file mode 100644 index fb2d4252387cd..0000000000000 --- a/recipes/kaitai_struct_cpp_stl_runtime/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.3) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/kaitai_struct_cpp_stl_runtime/all/conandata.yml b/recipes/kaitai_struct_cpp_stl_runtime/all/conandata.yml index 47a6f881a3206..1a2d17950129d 100644 --- a/recipes/kaitai_struct_cpp_stl_runtime/all/conandata.yml +++ b/recipes/kaitai_struct_cpp_stl_runtime/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "0.10": + url: "https://github.com/kaitai-io/kaitai_struct_cpp_stl_runtime/archive/refs/tags/0.10.tar.gz" + sha256: "9a7d382b2acbbe6498ecca23fc7b6b98cbcc418af83fb569f94395f29712171c" "cci.20210701": url: "https://github.com/kaitai-io/kaitai_struct_cpp_stl_runtime/archive/cb09b3a84c7e905c6a3fecfe9617cf864d9af781.zip" sha256: "058c01828692bf193cb862372651c572fcc43babbf2d664674409511b9f54e5b" +patches: + "0.10": + - patch_file: "patches/0001-cmake-minimum-required.patch" + patch_description: "declare cmake_minimum_required first" + patch_type: "portability" + "cci.20210701": + - patch_file: "patches/0001-cmake-minimum-required.patch" + patch_description: "declare cmake_minimum_required first" + patch_type: "portability" diff --git a/recipes/kaitai_struct_cpp_stl_runtime/all/conanfile.py b/recipes/kaitai_struct_cpp_stl_runtime/all/conanfile.py index 4c031d48459e1..4940a6da6e857 100644 --- a/recipes/kaitai_struct_cpp_stl_runtime/all/conanfile.py +++ b/recipes/kaitai_struct_cpp_stl_runtime/all/conanfile.py @@ -1,68 +1,64 @@ +from conan import ConanFile +from conan.tools.files import get, copy, export_conandata_patches, apply_conandata_patches +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -from conans import ConanFile, CMake, tools - +required_conan_version = ">=1.53.0" class KaitaiStructCppStlRuntimeConan(ConanFile): name = "kaitai_struct_cpp_stl_runtime" + description = "kaitai struct c++ runtime library" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://kaitai.io/" - description = "kaitai struct c++ runtime library" - topics = ("parsers", "streams", "dsl") - settings = "os", "compiler", "build_type", "arch" - exports_sources = "CMakeLists.txt" - generators = "cmake" + topics = ("parsers", "streams", "dsl", "kaitai struct") + settings = "os", "arch", "compiler", "build_type" options = { "with_zlib": [True, False], - "with_iconv": [True, False] + "with_iconv": [True, False], } default_options = { "with_zlib": False, - "with_iconv": False + "with_iconv": False, } short_paths = True - _cmake = None + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.11") + self.requires("zlib/1.2.13") if self.options.with_iconv: - self.requires("libiconv/1.16") - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + self.requires("libiconv/1.17") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def build(self): - cmake = self._configure_cmake() - cmake.build() - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): + tc = CMakeToolchain(self) if self.options.with_iconv: - self._cmake.definitions["STRING_ENCODING_TYPE"] = "ICONV" + tc.variables["STRING_ENCODING_TYPE"] = "ICONV" else: - self._cmake.definitions["STRING_ENCODING_TYPE"] = "NONE" + tc.variables["STRING_ENCODING_TYPE"] = "NONE" + tc.generate() - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["kaitai_struct_cpp_stl_runtime"] diff --git a/recipes/kaitai_struct_cpp_stl_runtime/all/patches/0001-cmake-minimum-required.patch b/recipes/kaitai_struct_cpp_stl_runtime/all/patches/0001-cmake-minimum-required.patch new file mode 100644 index 0000000000000..d2ea72d0b994f --- /dev/null +++ b/recipes/kaitai_struct_cpp_stl_runtime/all/patches/0001-cmake-minimum-required.patch @@ -0,0 +1,11 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7f72825..fa3d4e4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ +-project (kaitai_struct_cpp_stl_runtime CXX) + cmake_minimum_required (VERSION 3.3) ++project (kaitai_struct_cpp_stl_runtime CXX) + + set (CMAKE_INCLUDE_CURRENT_DIR ON) + diff --git a/recipes/kaitai_struct_cpp_stl_runtime/all/test_package/CMakeLists.txt b/recipes/kaitai_struct_cpp_stl_runtime/all/test_package/CMakeLists.txt index 58f25efbaa92e..330bfac9e2511 100644 --- a/recipes/kaitai_struct_cpp_stl_runtime/all/test_package/CMakeLists.txt +++ b/recipes/kaitai_struct_cpp_stl_runtime/all/test_package/CMakeLists.txt @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(test_package test_package.cpp) -target_link_libraries(test_package ${CONAN_LIBS}) +find_package(kaitai_struct_cpp_stl_runtime REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE kaitai_struct_cpp_stl_runtime::kaitai_struct_cpp_stl_runtime) diff --git a/recipes/kaitai_struct_cpp_stl_runtime/all/test_package/conanfile.py b/recipes/kaitai_struct_cpp_stl_runtime/all/test_package/conanfile.py index bd7165a553cf4..a9fb96656f203 100644 --- a/recipes/kaitai_struct_cpp_stl_runtime/all/test_package/conanfile.py +++ b/recipes/kaitai_struct_cpp_stl_runtime/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/kaitai_struct_cpp_stl_runtime/all/test_v1_package/CMakeLists.txt b/recipes/kaitai_struct_cpp_stl_runtime/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/kaitai_struct_cpp_stl_runtime/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/kaitai_struct_cpp_stl_runtime/all/test_v1_package/conanfile.py b/recipes/kaitai_struct_cpp_stl_runtime/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/kaitai_struct_cpp_stl_runtime/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/kaitai_struct_cpp_stl_runtime/config.yml b/recipes/kaitai_struct_cpp_stl_runtime/config.yml index 596c3149dc59d..25aabe969604c 100644 --- a/recipes/kaitai_struct_cpp_stl_runtime/config.yml +++ b/recipes/kaitai_struct_cpp_stl_runtime/config.yml @@ -1,3 +1,5 @@ versions: + "0.10": + folder: all "cci.20210701": folder: all diff --git a/recipes/khrplatform/all/conanfile.py b/recipes/khrplatform/all/conanfile.py index 4cdbbcb701767..4125f97c39bdb 100644 --- a/recipes/khrplatform/all/conanfile.py +++ b/recipes/khrplatform/all/conanfile.py @@ -1,9 +1,10 @@ +from conan import ConanFile +from conan.tools.files import copy, download, load, save +from conan.tools.layout import basic_layout import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +required_conan_version = ">=1.50.0" -required_conan_version = ">=1.37.0" class KhrplatformConan(ConanFile): name = "khrplatform" @@ -12,20 +13,31 @@ class KhrplatformConan(ConanFile): homepage = "https://www.khronos.org/registry/EGL/" description = "Khronos EGL platform interfaces" topics = ("opengl", "gl", "egl", "khr", "khronos") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + def source(self): - tools.download(filename="khrplatform.h", **self.conan_data["sources"][self.version]) + download(self, filename="khrplatform.h", **self.conan_data["sources"][self.version]) - def package(self): - self.copy(pattern="khrplatform.h", dst=os.path.join("include", "KHR")) - license_data = tools.load(os.path.join(self.source_folder, "khrplatform.h")) + def build(self): + pass + + def _extract_license(self): + license_data = load(self, os.path.join(self.source_folder, "khrplatform.h")) begin = license_data.find("/*") + len("/*") end = license_data.find("*/") - license_data = license_data[begin:end] - license_data = license_data.replace("**", "") - tools.save("LICENSE", license_data) - self.copy("LICENSE", dst="licenses") + return license_data[begin:end].replace("**", "") - def package_id(self): - self.info.header_only() + def package(self): + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + copy(self, "khrplatform.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include", "KHR")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/khrplatform/all/test_package/CMakeLists.txt b/recipes/khrplatform/all/test_package/CMakeLists.txt index 5e3eb0ca6b326..34fae3a337730 100644 --- a/recipes/khrplatform/all/test_package/CMakeLists.txt +++ b/recipes/khrplatform/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package LANGUAGES C) find_package(khrplatform REQUIRED CONFIG) diff --git a/recipes/khrplatform/all/test_package/conanfile.py b/recipes/khrplatform/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/khrplatform/all/test_package/conanfile.py +++ b/recipes/khrplatform/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/khrplatform/all/test_v1_package/CMakeLists.txt b/recipes/khrplatform/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/khrplatform/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/khrplatform/all/test_v1_package/conanfile.py b/recipes/khrplatform/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/khrplatform/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/kissfft/all/conanfile.py b/recipes/kissfft/all/conanfile.py index 203d563a1ced5..b88b580065423 100644 --- a/recipes/kissfft/all/conanfile.py +++ b/recipes/kissfft/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class KissfftConan(ConanFile): @@ -14,6 +14,7 @@ class KissfftConan(ConanFile): description = "a Fast Fourier Transform (FFT) library that tries to Keep it Simple, Stupid" topics = ("fft", "kiss", "frequency-domain", "fast-fourier-transform") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,22 +37,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/kissfft/all/test_package/conanfile.py b/recipes/kissfft/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/kissfft/all/test_package/conanfile.py +++ b/recipes/kissfft/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/kissfft/all/test_v1_package/CMakeLists.txt b/recipes/kissfft/all/test_v1_package/CMakeLists.txt index 8aafff4327842..0d20897301b68 100644 --- a/recipes/kissfft/all/test_v1_package/CMakeLists.txt +++ b/recipes/kissfft/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(kissfft REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE kissfft::kissfft) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/kmod/all/conandata.yml b/recipes/kmod/all/conandata.yml index adea0f2044a1e..cc817fbafc1ad 100644 --- a/recipes/kmod/all/conandata.yml +++ b/recipes/kmod/all/conandata.yml @@ -1,7 +1,7 @@ sources: "30": - url: "https://github.com/kmod-project/kmod/archive/v30.tar.gz" - sha256: "1fa3974abd80b992d61324bcc04fa65ea96cfe2e9e1150f48394833030c4b583" + url: "https://kernel.org/pub/linux/utils/kernel/kmod/kmod-30.tar.xz" + sha256: "f897dd72698dc6ac1ef03255cd0a5734ad932318e4adbaebc7338ef2f5202f9f" "29": - sha256: "a49aaf9c4914cd1abd9eea43d86b5a2fd07d898935e088965e6d18793610f2e7" - url: "https://github.com/kmod-project/kmod/archive/refs/tags/v29.tar.gz" + url: "https://kernel.org/pub/linux/utils/kernel/kmod/kmod-29.tar.xz" + sha256: "0b80eea7aa184ac6fd20cafa2a1fdf290ffecc70869a797079e2cc5c6225a52a" diff --git a/recipes/kmod/all/conanfile.py b/recipes/kmod/all/conanfile.py index fdd7d170d6a03..3a99be647857e 100644 --- a/recipes/kmod/all/conanfile.py +++ b/recipes/kmod/all/conanfile.py @@ -1,18 +1,19 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.env import VirtualBuildEnv -from conan.tools.files import copy, get, rm, rmdir, save +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, rm, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class KModConan(ConanFile): name = "kmod" description = "linux kernel module handling library" - topics = ("kmod", "libkmod", "linux", "kernel", "module") + topics = ("libkmod", "linux", "kernel", "module") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/kmod-project/kmod" license = "LGPL-2.1-only" @@ -37,40 +38,40 @@ class KModConan(ConanFile): } def configure(self): - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_zstd: - self.requires("zstd/1.5.2") + self.requires("zstd/1.5.4") if self.options.with_xz: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.0") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_openssl: - self.requires("openssl/3.0.5") + self.requires("openssl/3.0.7") def validate(self): if self.settings.os != "Linux": raise ConanInvalidConfiguration("kmod is Linux-only!") def build_requirements(self): - self.tool_requires("libtool/2.4.7") - self.tool_requires("pkgconf/1.7.4") - - def layout(self): - basic_layout(self, src_folder="src") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + yes_no = lambda v: "yes" if v else "no" tc = AutotoolsToolchain(self) tc.configure_args.append("--with-zstd=%s" % yes_no(self.options.with_zstd)) @@ -90,14 +91,9 @@ def generate(self): tc.generate() tc = AutotoolsDeps(self) tc.generate() - # inject tools_require env vars in build context - ms = VirtualBuildEnv(self) - ms.generate(scope="build") def build(self): - save(self, os.path.join(self.source_folder, "libkmod", "docs", "gtk-doc.make"), "") autotools = Autotools(self) - autotools.autoreconf() autotools.configure() autotools.make() diff --git a/recipes/kmod/all/test_package/conanfile.py b/recipes/kmod/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/kmod/all/test_package/conanfile.py +++ b/recipes/kmod/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/kmod/all/test_v1_package/CMakeLists.txt b/recipes/kmod/all/test_v1_package/CMakeLists.txt index 3a46a61e7f5e8..0d20897301b68 100644 --- a/recipes/kmod/all/test_v1_package/CMakeLists.txt +++ b/recipes/kmod/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(kmod REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE kmod::kmod) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/kmod/all/test_v1_package/conanfile.py b/recipes/kmod/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/kmod/all/test_v1_package/conanfile.py +++ b/recipes/kmod/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/kplot/all/CMakeLists.txt b/recipes/kplot/all/CMakeLists.txt new file mode 100644 index 0000000000000..632b160c48691 --- /dev/null +++ b/recipes/kplot/all/CMakeLists.txt @@ -0,0 +1,64 @@ +cmake_minimum_required(VERSION 3.8) +project(kplot LANGUAGES C) + +find_package(cairo REQUIRED CONFIG) + +set(kplot_src + ${KPLOT_SRC_DIR}/colours.c + ${KPLOT_SRC_DIR}/array.c + ${KPLOT_SRC_DIR}/border.c + ${KPLOT_SRC_DIR}/bucket.c + ${KPLOT_SRC_DIR}/buffer.c + ${KPLOT_SRC_DIR}/draw.c + ${KPLOT_SRC_DIR}/grid.c + ${KPLOT_SRC_DIR}/hist.c + ${KPLOT_SRC_DIR}/label.c + ${KPLOT_SRC_DIR}/kdata.c + ${KPLOT_SRC_DIR}/kplot.c + ${KPLOT_SRC_DIR}/margin.c + ${KPLOT_SRC_DIR}/mean.c + ${KPLOT_SRC_DIR}/plotctx.c + ${KPLOT_SRC_DIR}/reallocarray.c + ${KPLOT_SRC_DIR}/stddev.c + ${KPLOT_SRC_DIR}/tic.c + ${KPLOT_SRC_DIR}/vector.c +) + +set(kplot_inc + ${KPLOT_SRC_DIR}/compat.h + ${KPLOT_SRC_DIR}/extern.h + ${KPLOT_SRC_DIR}/kplot.h +) + +include_directories(KPLOT_SRC_DIR) + +try_run(HAVE_reallocarray COMPIE_reallocarray ${CMAKE_BINARY_DIR} ${KPLOT_SRC_DIR}/test-reallocarray.c) + +file(READ "${KPLOT_SRC_DIR}/compat.pre.h" COMPAT_CONTENTS) +file(WRITE "${KPLOT_SRC_DIR}/compat.h" "${COMPAT_CONTENTS}") +if (${COMPIE_reallocarray} AND NOT ${HAVE_reallocarray}) + file(APPEND "${KPLOT_SRC_DIR}/compat.h" "#define HAVE_REALLOCARRAY") +endif() +file(READ "${KPLOT_SRC_DIR}/compat.post.h" COMPAT_CONTENTS) +file(APPEND "${KPLOT_SRC_DIR}/compat.h" "${COMPAT_CONTENTS}") + +add_library(kplot ${kplot_src}) + +target_compile_features(kplot PRIVATE c_std_99) +set_target_properties(kplot PROPERTIES + PUBLIC_HEADER "${kplot_inc}" + WINDOWS_EXPORT_ALL_SYMBOLS ON + C_EXTENSIONS OFF +) +target_compile_features(kplot PRIVATE c_std_99) +target_link_libraries(kplot PRIVATE cairo::cairo) + +include(GNUInstallDirs) + +install( + TARGETS kplot + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) diff --git a/recipes/kplot/all/conandata.yml b/recipes/kplot/all/conandata.yml new file mode 100644 index 0000000000000..d0e63f3ee2c14 --- /dev/null +++ b/recipes/kplot/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.1.15": + url: "https://github.com/kristapsdz/kplot/archive/refs/tags/VERSION_0_1_15.tar.gz" + sha256: "602ebaac9b67dc7c7e84d8112df887c95ba0a1c4ed71fbab6671f8c5ecf4ba2a" diff --git a/recipes/kplot/all/conanfile.py b/recipes/kplot/all/conanfile.py new file mode 100644 index 0000000000000..47e24a0f5cdf8 --- /dev/null +++ b/recipes/kplot/all/conanfile.py @@ -0,0 +1,73 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.53.0" + +class KplotConan(ConanFile): + name = "kplot" + description = "open source Cairo plotting library" + license = "ISC" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/kristapsdz/kplot/" + topics = ("plot", "cairo", "chart") # no "conan" and project name in topics + settings = "os", "arch", "compiler", "build_type" # even for header only + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + # for plain C projects only + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} can not be built on Visual Studio and msvc.") + + def requirements(self): + self.requires("cairo/1.17.4") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["KPLOT_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() + + def package(self): + copy(self, pattern="LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["kplot"] diff --git a/recipes/kplot/all/test_package/CMakeLists.txt b/recipes/kplot/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e61521b15e2af --- /dev/null +++ b/recipes/kplot/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(kplot REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE kplot::kplot) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/kplot/all/test_package/conanfile.py b/recipes/kplot/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/kplot/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/kplot/all/test_package/test_package.c b/recipes/kplot/all/test_package/test_package.c new file mode 100644 index 0000000000000..2bc672875372a --- /dev/null +++ b/recipes/kplot/all/test_package/test_package.c @@ -0,0 +1,14 @@ +#include +#include + +#include "cairo.h" +#include "kplot.h" + +int main() { + struct kpair points1[50]; + struct kdata* d1 = kdata_array_alloc(points1, 50); + + kdata_destroy(d1); + + return 0; +} diff --git a/recipes/kplot/all/test_v1_package/CMakeLists.txt b/recipes/kplot/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/kplot/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/kplot/all/test_v1_package/conanfile.py b/recipes/kplot/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/kplot/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/kplot/config.yml b/recipes/kplot/config.yml new file mode 100644 index 0000000000000..d90a2c03c7832 --- /dev/null +++ b/recipes/kplot/config.yml @@ -0,0 +1,3 @@ +versions: + "0.1.15": + folder: all diff --git a/recipes/kuba-zip/all/conandata.yml b/recipes/kuba-zip/all/conandata.yml index 021dff1a66b54..687b00ee7e238 100644 --- a/recipes/kuba-zip/all/conandata.yml +++ b/recipes/kuba-zip/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.2.6": + url: "https://github.com/kuba--/zip/archive/v0.2.6.tar.gz" + sha256: "6a00e10dc5242f614f76f1bd1d814726a41ee6e3856ef3caf7c73de0b63acf0b" + "0.2.5": + url: "https://github.com/kuba--/zip/archive/v0.2.5.tar.gz" + sha256: "e052f6cbe6713f69f8caec61214fda4e5ae5150d1fcba02c9e79f1a05d939305" "0.2.4": url: "https://github.com/kuba--/zip/archive/v0.2.4.tar.gz" sha256: "a3dd762129d58c7ca7a6462f509d29388dbdb25bec559cb4dc03f75523d69cf2" diff --git a/recipes/kuba-zip/config.yml b/recipes/kuba-zip/config.yml index 76385b4eb8a75..7244cf3b53ff7 100644 --- a/recipes/kuba-zip/config.yml +++ b/recipes/kuba-zip/config.yml @@ -1,4 +1,8 @@ versions: + "0.2.6": + folder: "all" + "0.2.5": + folder: "all" "0.2.4": folder: "all" "0.2.3": diff --git a/recipes/laszip/all/conandata.yml b/recipes/laszip/all/conandata.yml index 4f7409d4b12f0..ec975a7f08b7b 100644 --- a/recipes/laszip/all/conandata.yml +++ b/recipes/laszip/all/conandata.yml @@ -1,7 +1,7 @@ sources: "3.4.3": - url: "https://github.com/LASzip/LASzip/archive/3.4.3.tar.gz" - sha256: "862715affa00609b78b4f469ab5529fee659c597efd40b5006b4305dd56c22d3" + url: "https://github.com/LASzip/LASzip/releases/download/3.4.3/laszip-src-3.4.3.tar.bz2" + sha256: "5775eb0b97de1b77514d47534cc65c6cfb5bebdd8aed0e47a23af8e75b7ea887" patches: "3.4.3": - patch_file: "patches/0001-no-build-laszip-api.patch" diff --git a/recipes/laszip/all/conanfile.py b/recipes/laszip/all/conanfile.py index 0550e96992ca8..a88e4d8aa5712 100644 --- a/recipes/laszip/all/conanfile.py +++ b/recipes/laszip/all/conanfile.py @@ -1,21 +1,22 @@ from conan import ConanFile +from conan.tools.build import stdcpp_library from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get from conan.tools.scm import Version -from conans import tools as tools_legacy import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.54.0" class LaszipConan(ConanFile): name = "laszip" description = "C++ library for lossless LiDAR compression." license = "LGPL-2.1" - topics = ("laszip", "las", "laz", "lidar", "compression", "decompression") + topics = ("las", "laz", "lidar", "compression", "decompression") homepage = "https://github.com/LASzip/LASzip" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,8 +28,7 @@ class LaszipConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -36,14 +36,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -69,6 +68,6 @@ def package_info(self): else: if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/laszip/all/test_package/conanfile.py b/recipes/laszip/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/laszip/all/test_package/conanfile.py +++ b/recipes/laszip/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/laszip/all/test_v1_package/CMakeLists.txt b/recipes/laszip/all/test_v1_package/CMakeLists.txt index 399dd5e75aa15..0d20897301b68 100644 --- a/recipes/laszip/all/test_v1_package/CMakeLists.txt +++ b/recipes/laszip/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(laszip REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE laszip::laszip) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/lcms/all/conandata.yml b/recipes/lcms/all/conandata.yml index 001dd1633b7af..5dfb1d726c592 100644 --- a/recipes/lcms/all/conandata.yml +++ b/recipes/lcms/all/conandata.yml @@ -1,16 +1,16 @@ sources: + "2.14": + url: "https://github.com/mm2/Little-CMS/releases/download/lcms2.14/lcms2-2.14.tar.gz" + sha256: "28474ea6f6591c4d4cee972123587001a4e6e353412a41b3e9e82219818d5740" "2.13.1": - url: "https://github.com/mm2/Little-CMS/archive/refs/tags/lcms2.13.1.tar.gz" - sha256: "6f84c942ecde1b4852b5a051894502ac8c98d010acb3400dec958c6db1bc94ef" - "2.12": - url: "https://github.com/mm2/Little-CMS/archive/2.12.tar.gz" - sha256: "e501f1482fc424550ef3abbf86bf1c66090e1661249e89552d39ed5bf935df66" - "2.11": - url: "https://github.com/mm2/Little-CMS/archive/2.11.tar.gz" - sha256: "478c9c3938d7a91b1171de4616f8b04308a8676d73eadc19505b7ace41327f28" - "2.10": - url: "https://github.com/mm2/Little-CMS/archive/lcms2.10.tar.gz" - sha256: "f7529f90f0a9c7529c561a2c681043c10f2d30b78e6728fb44132828f89b666a" - "2.9": - url: "https://github.com/mm2/Little-CMS/archive/lcms2.9.tar.gz" - sha256: "8e23a09dc81af856db37941a4ea26acdf6a45b0281ec5b7ee94b5a4e9f7afbf7" + url: "https://github.com/mm2/Little-CMS/releases/download/lcms2.13.1/lcms2-2.13.1.tar.gz" + sha256: "d473e796e7b27c5af01bd6d1552d42b45b43457e7182ce9903f38bb748203b88" +patches: + "2.14": + - patch_file: "patches/2.13.1-0001-fix-msvc-import-lib.patch" + patch_description: "Fix msvc import lib" + patch_type: "portability" + "2.13.1": + - patch_file: "patches/2.13.1-0001-fix-msvc-import-lib.patch" + patch_description: "Fix msvc import lib" + patch_type: "portability" diff --git a/recipes/lcms/all/conanfile.py b/recipes/lcms/all/conanfile.py index e73dd6770d2e0..a0de3a3a66bf7 100644 --- a/recipes/lcms/all/conanfile.py +++ b/recipes/lcms/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.scm import Version import os -import re -import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class LcmsConan(ConanFile): @@ -12,7 +16,7 @@ class LcmsConan(ConanFile): description = "A free, open source, CMM engine." license = "MIT" homepage = "https://github.com/mm2/Little-CMS" - topics = ("lcms", "cmm", "icc", "cmm-engine") + topics = ("littlecms", "little-cms", "cmm", "icc", "cmm-engine", "color-management-engine") settings = "os", "arch", "compiler", "build_type" options = { @@ -24,23 +28,8 @@ class LcmsConan(ConanFile): "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -48,118 +37,70 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if not self._is_msvc: - self.build_requires("gnu-config/cci.20201022") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("meson/1.0.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) + tc.generate() def _patch_sources(self): - compiler_version = tools.Version(self.settings.compiler.version) - if (self.settings.compiler == "Visual Studio" and compiler_version >= "14") or \ - str(self.settings.compiler) == "msvc": + apply_conandata_patches(self) + compiler_version = Version(self.settings.compiler.version) + if (str(self.settings.compiler) == "Visual Studio" and compiler_version >= "14") or \ + (str(self.settings.compiler) == "msvc" and compiler_version >= "190"): # since VS2015 vsnprintf is built-in - path = os.path.join(self._source_subfolder, "src", "lcms2_internal.h") - tools.replace_in_file(path, "# define vsnprintf _vsnprintf", "") - if (self.settings.compiler == "Visual Studio" and compiler_version >= "16") or \ - (str(self.settings.compiler) == "msvc" and compiler_version >= "192"): - # since VS2019, don't need to specify the WindowsTargetPlatformVersion - path = os.path.join(self._source_subfolder, "Projects", "VC2015", "lcms2_static", "lcms2_static.vcxproj") - tools.replace_in_file(path, "8.1", "") - if self.settings.os == "Android" and self._settings_build.os == "Windows": - # remove escape for quotation marks, to make ndk on windows happy - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "s/[ `~#$^&*(){}\\\\|;'\\\''\"<>?]/\\\\&/g", - "s/[ `~#$^&*(){}\\\\|;<>?]/\\\\&/g") - - def _build_visual_studio(self): - if tools.Version(self.version) <= "2.11": - vc_sln_subdir = "VC2013" - else: - vc_sln_subdir = "VC2015" - with tools.chdir(os.path.join(self._source_subfolder, "Projects", vc_sln_subdir )): - target = "lcms2_DLL" if self.options.shared else "lcms2_static" - if self.settings.compiler == "Visual Studio" and \ - tools.Version(self.settings.compiler.version) <= "12": - upgrade_project = False - else: - upgrade_project = True - # Enable LTO when CFLAGS contains -GL - if any(re.finditer("(^| )[/-]GL($| )", tools.get_env("CFLAGS", ""))): - lto = "true" - else: - lto = "false" - properties = { - "WholeProgramOptimization": lto, - } - # run build - msbuild = MSBuild(self) - msbuild.build("lcms2.sln", targets=[target], platforms={"x86": "Win32"}, - upgrade_project=upgrade_project, properties=properties) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--without-tiff", - "--without-jpeg", - ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + path = os.path.join(self.source_folder, "src", "lcms2_internal.h") + replace_in_file(self, path, "# define vsnprintf _vsnprintf", "") def build(self): self._patch_sources() - if self._is_msvc: - self._build_visual_studio() - else: - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - autotools = self._configure_autotools() - autotools.make() + meson = Meson(self) + meson.configure() + meson.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self.copy(pattern="*.h", src=os.path.join(self._source_subfolder, "include"), dst="include", keep_path=True) - if self.options.shared: - self.copy(pattern="*.lib", src=os.path.join(self._source_subfolder, "bin"), dst="lib", keep_path=False) - self.copy(pattern="*.dll", src=os.path.join(self._source_subfolder, "bin"), dst="bin", keep_path=False) - else: - self.copy(pattern="*.lib", src=os.path.join(self._source_subfolder, "Lib", "MS"), dst="lib", - keep_path=False) - else: - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - # remove utilities - if self.settings.os == "Windows" and self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*[!.dll]") - else: - tools.rmdir(os.path.join(self.package_folder, "bin")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "lcms2") - suffix = "_static" if self._is_msvc and not self.options.shared else "" - self.cpp_info.libs = ["lcms2{}".format(suffix)] - if self._is_msvc and self.options.shared: + self.cpp_info.libs = ["lcms2"] + if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("CMS_DLL") if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs.append("m") - - self.cpp_info.names["pkg_config"] = "lcms2" + self.cpp_info.system_libs.extend(["m", "pthread"]) + +def fix_msvc_libname(conanfile, remove_lib_prefix=True): + """remove lib prefix & change extension to .lib""" + from conan.tools.files import rename + from conan.tools.microsoft import is_msvc + import glob + if not is_msvc(conanfile): + return + libdirs = getattr(conanfile.cpp.package, "libdirs") + for libdir in libdirs: + for ext in [".dll.a", ".dll.lib", ".a"]: + full_folder = os.path.join(conanfile.package_folder, libdir) + for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")): + libname = os.path.basename(filepath)[0:-len(ext)] + if remove_lib_prefix and libname[0:3] == "lib": + libname = libname[3:] + rename(conanfile, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib")) diff --git a/recipes/lcms/all/patches/2.13.1-0001-fix-msvc-import-lib.patch b/recipes/lcms/all/patches/2.13.1-0001-fix-msvc-import-lib.patch new file mode 100644 index 0000000000000..6200fe4cf44ee --- /dev/null +++ b/recipes/lcms/all/patches/2.13.1-0001-fix-msvc-import-lib.patch @@ -0,0 +1,10 @@ +--- a/meson.build ++++ b/meson.build +@@ -73,7 +73,6 @@ liblcms2_lib = library('lcms2', lcms2_srcs, + dependencies: deps, + c_args: cargs, + version: library_version, +- vs_module_defs: 'src/lcms2.def', + install: true, + ) + diff --git a/recipes/lcms/all/test_package/CMakeLists.txt b/recipes/lcms/all/test_package/CMakeLists.txt index 7b9b613cbb24a..c0d476f344024 100644 --- a/recipes/lcms/all/test_package/CMakeLists.txt +++ b/recipes/lcms/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(lcms REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE lcms::lcms) diff --git a/recipes/lcms/all/test_package/conanfile.py b/recipes/lcms/all/test_package/conanfile.py index d4128b0450777..98ab55852ad56 100644 --- a/recipes/lcms/all/test_package/conanfile.py +++ b/recipes/lcms/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lcms/all/test_v1_package/CMakeLists.txt b/recipes/lcms/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/lcms/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/lcms/all/test_v1_package/conanfile.py b/recipes/lcms/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/lcms/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/lcms/config.yml b/recipes/lcms/config.yml index 788637aaa677b..8a6c0dd7e6e99 100644 --- a/recipes/lcms/config.yml +++ b/recipes/lcms/config.yml @@ -1,11 +1,5 @@ versions: - "2.13.1": - folder: all - "2.12": - folder: all - "2.11": + "2.14": folder: all - "2.10": - folder: all - "2.9": + "2.13.1": folder: all diff --git a/recipes/lely-core/all/conandata.yml b/recipes/lely-core/all/conandata.yml new file mode 100644 index 0000000000000..cc7e4931e5ec2 --- /dev/null +++ b/recipes/lely-core/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.3.2": + url: "https://gitlab.com/lely_industries/lely-core/-/archive/v2.3.2/lely-core-v2.3.2.tar.gz" + sha256: "c37eb6f004ad1a1ec1f891e31a09b72f588da361fa92888e8edfcf215a1d707a" diff --git a/recipes/lely-core/all/conanfile.py b/recipes/lely-core/all/conanfile.py new file mode 100644 index 0000000000000..f57056df76197 --- /dev/null +++ b/recipes/lely-core/all/conanfile.py @@ -0,0 +1,241 @@ +import os + +from conan import ConanFile +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.layout import basic_layout +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.files import ( + export_conandata_patches, + apply_conandata_patches, + get, + copy, + rmdir, + rm, +) +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.53.0" + + +class LelyConan(ConanFile): + name = "lely-core" + + # Optional metadata + license = "Apache-2.0" + homepage = "https://gitlab.com/lely_industries/lely-core/" + url = "https://github.com/conan-io/conan-center-index" + description = "The Lely core libraries are a collection of C and C++ libraries and tools, providing high-performance I/O and sensor/actuator control for robotics and IoT applications. The libraries are cross-platform and have few dependencies. They can be even be used on bare-metal microcontrollers with as little as 32 kB RAM." + topics = ("canopen",) + + # Binary configuration + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "rt": [True, False], + "threads": [True, False], + "ecss-compliance": [True, False], + "errno": [True, False], + "malloc": [True, False], + "stdio": [True, False], + "cxx": [True, False], + "daemon": [True, False], + "diag": [True, False], + "canfd": [True, False], + "dcf": [True, False], + "dcf-restore": [True, False], + "obj-default": [True, False], + "obj-file": [True, False], + "obj-limits": [True, False], + "obj-name": [True, False], + "obj-upload": [True, False], + "sdev": [True, False], + "csdo": [True, False], + "rpdo": [True, False], + "tpdo": [True, False], + "mpdo": [True, False], + "sync": [True, False], + "time": [True, False], + "emcy": [True, False], + "lss": [True, False], + "wtm": [True, False], + "master": [True, False], + "ng": [True, False], + "nmt-boot": [True, False], + "nmt-cfg": [True, False], + "gw": [True, False], + "gw-txt": [True, False], + "coapp-master": [True, False], + "coapp-slave": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "rt": True, + "threads": True, + "ecss-compliance": False, + "errno": True, + "malloc": True, + "stdio": True, + "cxx": True, + "daemon": True, + "diag": True, + "canfd": True, + "dcf": True, + "dcf-restore": True, + "obj-default": True, + "obj-file": True, + "obj-limits": True, + "obj-name": True, + "obj-upload": True, + "sdev": True, + "csdo": True, + "rpdo": True, + "tpdo": True, + "mpdo": True, + "sync": True, + "time": True, + "emcy": True, + "lss": True, + "wtm": True, + "master": True, + "ng": True, + "nmt-boot": True, + "nmt-cfg": True, + "gw": True, + "gw-txt": True, + "coapp-master": True, + "coapp-slave": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration( + f"{self.ref} is only compatible with Linux. " + "Windows requires proprietary software from https://www.ixxat.com/technical-support/support/windows-driver-software " + "hence support for it will be skipped for now " + ) + if self.settings.compiler != "gcc": + raise ConanInvalidConfiguration( + f"{self.ref} can only be compiled with GCC currently" + ) + + def source(self): + get( + self, + **self.conan_data["sources"][self.version], + destination=self.source_folder, + strip_root=True, + ) + + def layout(self): + basic_layout(self, src_folder="src") + + def generate(self): + at_toolchain = AutotoolsToolchain(self) + at_toolchain.configure_args += [ + "--disable-cython", + "--disable-python", + "--disable-tools", + "--disable-dependency-tracking", + "--disable-maintainer-mode", + ] + if self.options.get_safe("ecss-compliance"): + at_toolchain.configure_args.append("--enable-ecss-compliance") + + disable_options = { + "threads", + "rt", + "errno", + "malloc", + "stdio", + "cxx", + "daemon", + "diag", + "canfd", + "dcf", + "dcf-restore", + "obj-default", + "obj-file", + "obj-limits", + "obj-name", + "obj-upload", + "sdev", + "csdo", + "rpdo", + "tpdo", + "mpdo", + "sync", + "time", + "emcy", + "lss", + "wtm", + "master", + "ng", + "nmt-boot", + "nmt-cfg", + "gw", + "gw-txt", + "coapp-master", + "coapp-slave", + } + for option in disable_options: + if not self.options.get_safe(option): + at_toolchain.configure_args.append(f"--disable-{option}") + + at_toolchain.generate() + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def build(self): + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() + + def package(self): + autotools = Autotools(self) + autotools.install() + fix_apple_shared_install_name(self) + + copy( + self, + "LICENSE", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + + def package_info(self): + components = { + "can": {"requires": ["libc", "util"]}, + "co": {"requires": ["libc", "util", "can"]}, + "coapp": {"requires": ["libc", "io2", "co"]}, + "ev": {"requires": ["libc", "util"]}, + "io2": {"requires": ["libc", "util", "can", "ev"]}, + "libc": { + "requires": [], + "system_libs": ["pthread"] if self.options.threads else [], + }, + "tap": {"requires": ["libc"]}, + "util": {"requires": ["libc"], "system_libs": ["m"]}, + } + for component, dependencies in components.items(): + self.cpp_info.components[component].libs = [f"lely-{component}"] + self.cpp_info.components[component].requires = dependencies.get( + "requires", [] + ) + self.cpp_info.components[component].system_libs = dependencies.get( + "system_libs", [] + ) diff --git a/recipes/lely-core/all/test_package/CMakeLists.txt b/recipes/lely-core/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c8be0aec2f07e --- /dev/null +++ b/recipes/lely-core/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.2) +project(test_package) + +find_package(lely-core REQUIRED) + +add_executable("${PROJECT_NAME}" test_package.cpp) +target_link_libraries("${PROJECT_NAME}" PRIVATE lely-core::lely-core) +target_compile_features("${PROJECT_NAME}" PRIVATE cxx_std_11) diff --git a/recipes/lely-core/all/test_package/conanfile.py b/recipes/lely-core/all/test_package/conanfile.py new file mode 100644 index 0000000000000..1276db634e491 --- /dev/null +++ b/recipes/lely-core/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake + +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lely-core/all/test_package/test_package.cpp b/recipes/lely-core/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..70748728b4af4 --- /dev/null +++ b/recipes/lely-core/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include +#include +#include + +using namespace lely; + +int main() { + io::IoGuard io_guard{}; + io::Context context{}; + io::Poll poll{context}; + + ev::Loop loop{poll.get_poll()}; + + loop.run(); +} diff --git a/recipes/lely-core/all/test_v1_package/CMakeLists.txt b/recipes/lely-core/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..ce0ee43ce03ba --- /dev/null +++ b/recipes/lely-core/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.2) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory("${CMAKE_SOURCE_DIR}/../test_package" "${CMAKE_BINARY_DIR}/test_package") diff --git a/recipes/lely-core/all/test_v1_package/conanfile.py b/recipes/lely-core/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0245c9a8028a3 --- /dev/null +++ b/recipes/lely-core/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/lely-core/config.yml b/recipes/lely-core/config.yml new file mode 100644 index 0000000000000..aee8de619ec30 --- /dev/null +++ b/recipes/lely-core/config.yml @@ -0,0 +1,3 @@ +versions: + "2.3.2": + folder: all diff --git a/recipes/leptonica/all/CMakeLists.txt b/recipes/leptonica/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/leptonica/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/leptonica/all/conandata.yml b/recipes/leptonica/all/conandata.yml index 8f3c853016fab..2902df5b0c405 100644 --- a/recipes/leptonica/all/conandata.yml +++ b/recipes/leptonica/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.83.0": + url: "https://github.com/DanBloomberg/leptonica/archive/1.83.0.tar.gz" + sha256: "14cf531c2219a1414e8e3c51a3caa5cf021a52e782c4a6561bf64d0ef2119282" "1.82.0": url: "https://github.com/DanBloomberg/leptonica/archive/1.82.0.tar.gz" sha256: "40fa9ac1e815b91e0fa73f0737e60c9eec433a95fa123f95f2573dd3127dd669" @@ -17,4 +20,6 @@ sources: patches: "1.78.0": - patch_file: "patches/fix-find-modules-variables.patch" - base_path: "source_subfolder" + patch_description: "CMake: robust handling of dependencies" + patch_type: "portability" + patch_source: "https://github.com/DanBloomberg/leptonica/pull/456" diff --git a/recipes/leptonica/all/conanfile.py b/recipes/leptonica/all/conanfile.py index 7f5894cd0595f..4de3febf23529 100644 --- a/recipes/leptonica/all/conanfile.py +++ b/recipes/leptonica/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rmdir, save +from conan.tools.gnu import PkgConfigDeps +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LeptonicaConan(ConanFile): @@ -20,7 +26,7 @@ class LeptonicaConan(ConanFile): "fPIC": [True, False], "with_zlib": [True, False], "with_gif": [True, False], - "with_jpeg": [True, False], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo"], "with_png": [True, False], "with_tiff": [True, False], "with_openjpeg": [True, False], @@ -31,160 +37,191 @@ class LeptonicaConan(ConanFile): "fPIC": True, "with_zlib": True, "with_gif": True, - "with_jpeg": True, + "with_jpeg": "libjpeg", "with_png": True, "with_tiff": True, "with_openjpeg": True, "with_webp": True, } - generators = "cmake", "cmake_find_package", "pkg_config" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): + if self.options.with_tiff: + self.options["libtiff"].jpeg = self.options.with_jpeg if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_gif: self.requires("giflib/5.2.1") - if self.options.with_jpeg: - self.requires("libjpeg/9d") + if self.options.with_jpeg == "libjpeg": + self.requires("libjpeg/9e") + if self.options.with_jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_tiff: - self.requires("libtiff/4.3.0") + self.requires("libtiff/4.4.0") if self.options.with_openjpeg: - self.requires("openjpeg/2.4.0") + self.requires("openjpeg/2.5.0") if self.options.with_webp: - self.requires("libwebp/1.2.2") + self.requires("libwebp/1.2.4") + + def validate(self): + libtiff = self.dependencies["libtiff"] + if libtiff.options.jpeg != self.info.options.with_jpeg: + raise ConanInvalidConfiguration(f"{self.ref} requires option value {self.name}:with_jpeg equal to libtiff:jpeg.") def build_requirements(self): if self.options.with_webp or self.options.with_openjpeg: - self.build_requires("pkgconf/1.7.4") + self.tool_requires("pkgconf/1.9.3") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) < "1.79.0": + tc.variables["STATIC"] = not self.options.shared + tc.variables["BUILD_PROG"] = False + tc.variables["SW_BUILD"] = False + if Version(self.version) >= "1.83.0": + tc.variables["LIBWEBP_SUPPORT"] = self.options.with_webp + tc.variables["OPENJPEG_SUPPORT"] = self.options.with_openjpeg + tc.generate() + deps = CMakeDeps(self) + deps.generate() + if self.options.with_webp or self.options.with_openjpeg: + pc = PkgConfigDeps(self) + pc.generate() + env = VirtualBuildEnv(self) + env.generate() + # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) + env = Environment() + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + env.vars(self).save_script("conanbuildenv_pkg_config_path") - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - cmakelists_src = os.path.join(self._source_subfolder, "src", "CMakeLists.txt") - cmake_configure = os.path.join(self._source_subfolder, "cmake", "Configure.cmake") + def _patch_sources(self): + apply_conandata_patches(self) - # Fix installation - tools.replace_in_file(cmakelists_src, "${CMAKE_BINARY_DIR}", "${PROJECT_BINARY_DIR}") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + cmakelists_src = os.path.join(self.source_folder, "src", "CMakeLists.txt") + cmake_configure = os.path.join(self.source_folder, "cmake", "Configure.cmake") # Honor options and inject dependencies definitions # TODO: submit a patch upstream ## zlib - tools.replace_in_file(cmakelists_src, "${ZLIB_LIBRARIES}", "ZLIB::ZLIB") + replace_in_file(self, cmakelists_src, "${ZLIB_LIBRARIES}", "ZLIB::ZLIB") if not self.options.with_zlib: - tools.replace_in_file(cmakelists_src, "if (ZLIB_LIBRARIES)", "if(0)") - tools.replace_in_file(cmake_configure, "if (ZLIB_FOUND)", "if(0)") + replace_in_file(self, cmakelists_src, "if (ZLIB_LIBRARIES)", "if(0)") + replace_in_file(self, cmake_configure, "if (ZLIB_FOUND)", "if(0)") ## giflib - tools.replace_in_file(cmakelists_src, "${GIF_LIBRARIES}", "GIF::GIF") + replace_in_file(self, cmakelists_src, "${GIF_LIBRARIES}", "GIF::GIF") if not self.options.with_gif: - tools.replace_in_file(cmakelists_src, "if (GIF_LIBRARIES)", "if(0)") - tools.replace_in_file(cmake_configure, "if (GIF_FOUND)", "if(0)") + replace_in_file(self, cmakelists_src, "if (GIF_LIBRARIES)", "if(0)") + if Version(self.version) >= "1.83.0": + replace_in_file(self, cmake_configure, "if(GIF_FOUND)", "if(0)") + else: + replace_in_file(self, cmake_configure, "if (GIF_FOUND)", "if(0)") ## libjpeg - tools.replace_in_file(cmakelists_src, "${JPEG_LIBRARIES}", "JPEG::JPEG") + replace_in_file(self, cmakelists_src, "${JPEG_LIBRARIES}", "JPEG::JPEG") if not self.options.with_jpeg: - tools.replace_in_file(cmakelists_src, "if (JPEG_LIBRARIES)", "if(0)") - tools.replace_in_file(cmake_configure, "if (JPEG_FOUND)", "if(0)") + replace_in_file(self, cmakelists_src, "if (JPEG_LIBRARIES)", "if(0)") + if Version(self.version) >= "1.83.0": + replace_in_file(self, cmake_configure, "if(JPEG_FOUND)", "if(0)") + else: + replace_in_file(self, cmake_configure, "if (JPEG_FOUND)", "if(0)") ## libpng - tools.replace_in_file(cmakelists_src, "${PNG_LIBRARIES}", "PNG::PNG") + replace_in_file(self, cmakelists_src, "${PNG_LIBRARIES}", "PNG::PNG") if not self.options.with_png: - tools.replace_in_file(cmakelists_src, "if (PNG_LIBRARIES)", "if(0)") - tools.replace_in_file(cmake_configure, "if (PNG_FOUND)", "if(0)") + replace_in_file(self, cmakelists_src, "if (PNG_LIBRARIES)", "if(0)") + if Version(self.version) >= "1.83.0": + replace_in_file(self, cmake_configure, "if(PNG_FOUND)", "if(0)") + else: + replace_in_file(self, cmake_configure, "if (PNG_FOUND)", "if(0)") ## libtiff - tools.replace_in_file(cmakelists_src, "${TIFF_LIBRARIES}", "TIFF::TIFF") + replace_in_file(self, cmakelists_src, "${TIFF_LIBRARIES}", "TIFF::TIFF") if not self.options.with_tiff: - tools.replace_in_file(cmakelists_src, "if (TIFF_LIBRARIES)", "if(0)") - tools.replace_in_file(cmake_configure, "if (TIFF_FOUND)", "if(0)") + replace_in_file(self, cmakelists_src, "if (TIFF_LIBRARIES)", "if(0)") + if Version(self.version) >= "1.83.0": + replace_in_file(self, cmake_configure, "if(TIFF_FOUND)", "if(0)") + else: + replace_in_file(self, cmake_configure, "if (TIFF_FOUND)", "if(0)") ## We have to be more aggressive with dependencies found with pkgconfig ## Injection of libdirs is ensured by conan_basic_setup() ## openjpeg - tools.replace_in_file(cmakelists, "if(NOT JP2K)", "if(0)") - tools.replace_in_file(cmakelists_src, - "if (JP2K_FOUND)", - "if (JP2K_FOUND)\n" - "target_compile_definitions(leptonica PRIVATE ${JP2K_CFLAGS_OTHER})") - if not self.options.with_openjpeg: - tools.replace_in_file(cmakelists_src, "if (JP2K_FOUND)", "if(0)") - tools.replace_in_file(cmake_configure, "if (JP2K_FOUND)", "if(0)") + replace_in_file(self, cmakelists_src, "${JP2K_LIBRARIES}", "openjp2") + if Version(self.version) < "1.83.0": + # pkgconfig is prefered to CMake. Disable pkgconfig so only CMake is used + if Version(self.version) <= "1.78.0": + replace_in_file(self, cmakelists, "pkg_check_modules(JP2K libopenjp2)", "") + else: + replace_in_file(self, cmakelists, "pkg_check_modules(JP2K libopenjp2>=2.0 QUIET)", "") + # versions below 1.83.0 do not have an option toggle + replace_in_file(self, cmakelists, "if(NOT JP2K)", "if(0)") + if not self.options.with_openjpeg: + replace_in_file(self, cmakelists_src, "if (JP2K_FOUND)", "if(0)") + replace_in_file(self, cmake_configure, "if (JP2K_FOUND)", "if(0)") + else: + replace_in_file(self, cmakelists, "set(JP2K_INCLUDE_DIRS ${OPENJPEG_INCLUDE_DIRS})", "set(JP2K_INCLUDE_DIRS ${OpenJPEG_INCLUDE_DIRS})") + if not self.options.with_openjpeg: + replace_in_file(self, cmake_configure, "if(JP2K_FOUND)", "if(0)") + ## libwebp - tools.replace_in_file(cmakelists, "if(NOT WEBP)", "if(0)") - tools.replace_in_file(cmakelists_src, + if Version(self.version) < "1.83.0": + # versions below 1.83.0 do not have an option toggle + replace_in_file(self, cmakelists, "if(NOT WEBP)", "if(0)") + if Version(self.version) >= "1.79.0": + replace_in_file(self, cmakelists, "if(NOT WEBPMUX)", "if(0)") + if not self.options.with_webp: + replace_in_file(self, cmakelists_src, "if (WEBP_FOUND)", "if(0)") + replace_in_file(self, cmake_configure, "if (WEBP_FOUND)", "if(0)") + replace_in_file(self, cmakelists_src, "if (WEBP_FOUND)", "if (WEBP_FOUND)\n" + "target_link_directories(leptonica PRIVATE ${WEBP_LIBRARY_DIRS} ${WEBPMUX_LIBRARY_DIRS})\n" "target_compile_definitions(leptonica PRIVATE ${WEBP_CFLAGS_OTHER} ${WEBPMUX_CFLAGS_OTHER})") - tools.replace_in_file(cmakelists_src, "${WEBP_LIBRARIES}", "${WEBP_LIBRARIES} ${WEBPMUX_LIBRARIES}") - if tools.Version(self.version) >= "1.79.0": - tools.replace_in_file(cmakelists, "if(NOT WEBPMUX)", "if(0)") - if not self.options.with_webp: - tools.replace_in_file(cmakelists_src, "if (WEBP_FOUND)", "if(0)") - tools.replace_in_file(cmake_configure, "if (WEBP_FOUND)", "if(0)") + replace_in_file(self, cmakelists_src, "${WEBP_LIBRARIES}", "${WEBP_LIBRARIES} ${WEBPMUX_LIBRARIES}") # Remove detection of fmemopen() on macOS < 10.13 # CheckFunctionExists will find it in the link library. # There's no error because it's not including the header with the # deprecation macros. if self.settings.os == "Macos" and self.settings.os.version: - if tools.Version(self.settings.os.version) < "10.13": - tools.replace_in_file(cmake_configure, + if Version(self.settings.os.version) < "10.13": + replace_in_file(self, cmake_configure, "set(functions_list\n " "fmemopen\n fstatat\n)", "set(functions_list\n " "fstatat\n)") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - if tools.Version(self.version) < "1.79.0": - self._cmake.definitions["STATIC"] = not self.options.shared - self._cmake.definitions["BUILD_PROG"] = False - self._cmake.definitions["SW_BUILD"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - self.copy(pattern="leptonica-license.txt", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) # since 1.81.0 - tools.rmdir(os.path.join(self.package_folder, "cmake")) + copy(self, "leptonica-license.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # since 1.81.0 + rmdir(self, os.path.join(self.package_folder, "cmake")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self._create_cmake_module_alias_targets( @@ -192,27 +229,26 @@ def package(self): {"leptonica": "Leptonica::Leptonica"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "Leptonica") self.cpp_info.set_property("cmake_target_name", "leptonica") self.cpp_info.set_property("pkg_config_name", "lept") - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] self.cpp_info.includedirs.append(os.path.join("include", "leptonica")) diff --git a/recipes/leptonica/all/test_package/CMakeLists.txt b/recipes/leptonica/all/test_package/CMakeLists.txt index 4b216b1756f75..b498b89f556d8 100644 --- a/recipes/leptonica/all/test_package/CMakeLists.txt +++ b/recipes/leptonica/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(Leptonica REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} leptonica) +target_link_libraries(${PROJECT_NAME} PRIVATE leptonica) diff --git a/recipes/leptonica/all/test_package/conanfile.py b/recipes/leptonica/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/leptonica/all/test_package/conanfile.py +++ b/recipes/leptonica/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/leptonica/all/test_v1_package/CMakeLists.txt b/recipes/leptonica/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..f86c2a9f99016 --- /dev/null +++ b/recipes/leptonica/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Leptonica REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE leptonica) diff --git a/recipes/leptonica/all/test_v1_package/conanfile.py b/recipes/leptonica/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/leptonica/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/leptonica/config.yml b/recipes/leptonica/config.yml index eb5d4ef99b906..36297367918ec 100644 --- a/recipes/leptonica/config.yml +++ b/recipes/leptonica/config.yml @@ -1,4 +1,6 @@ versions: + "1.83.0": + folder: all "1.82.0": folder: all "1.81.0": diff --git a/recipes/lerc/all/conandata.yml b/recipes/lerc/all/conandata.yml index 810e73a43618a..f1d58df7a46b7 100644 --- a/recipes/lerc/all/conandata.yml +++ b/recipes/lerc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.0.0": + url: "https://github.com/Esri/lerc/archive/refs/tags/v4.0.0.tar.gz" + sha256: "91431c2b16d0e3de6cbaea188603359f87caed08259a645fd5a3805784ee30a0" "2.2": url: "https://github.com/Esri/lerc/archive/v2.2.tar.gz" sha256: "abc0c5c149144d39a8b351ff5a9a5940c0f66ba908ecf717d58f8f71065d11fe" @@ -6,7 +9,15 @@ sources: url: "https://github.com/Esri/lerc/archive/v2.1.tar.gz" sha256: "7c48de40cd5f09319de4b39c417ff4eec4ad4b6aa5d6144f6ffa9b10d18ec94e" patches: + "4.0.0": + - patch_file: "patches/4.0.0-include-algorithm.patch" + patch_description: "include algorithm header for std::min/max" + patch_type: "portability" "2.2": - - patch_file: "patches/add-CMakeLists-and-static.patch" + - patch_file: "patches/2.1-add-CMakeLists-and-static.patch" + patch_description: "create CMakeLists.txt, redefine LERCDLL_API for static build" + patch_type: "conan" "2.1": - - patch_file: "patches/add-CMakeLists-and-static.patch" + - patch_file: "patches/2.1-add-CMakeLists-and-static.patch" + patch_description: "create CMakeLists.txt, redefine LERCDLL_API for static build" + patch_type: "conan" diff --git a/recipes/lerc/all/conanfile.py b/recipes/lerc/all/conanfile.py index fcd97bd3e1eae..367095e05fd6b 100644 --- a/recipes/lerc/all/conanfile.py +++ b/recipes/lerc/all/conanfile.py @@ -1,20 +1,20 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class LercConan(ConanFile): name = "lerc" description = "C++ library for limited Error Raster Compression." license = "Apache-2.0" - topics = ("lerc", "lerclib", "compression", "decompression", "image", "raster") - homepage = "https://github.com/Esri/lerc" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/Esri/lerc" + topics = ("lerc", "lerclib", "compression", "decompression", "image", "raster") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,9 +25,12 @@ class LercConan(ConanFile): "fPIC": True, } + @property + def _min_cppstd(self): + return 11 + def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,11 +38,11 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + check_min_cppstd(self, self._min_cppstd) def layout(self): cmake_layout(self, src_folder="src") @@ -50,6 +53,7 @@ def source(self): def generate(self): tc = CMakeToolchain(self) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): @@ -63,7 +67,15 @@ def package(self): cmake = CMake(self) cmake.install() + if Version(self.version) >= "3.0": + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + def package_info(self): - self.cpp_info.libs = ["LercLib"] + self.cpp_info.libs = ["LercLib" if Version(self.version) < "4.0.0" else "Lerc"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") + + if Version(self.version) >= "3.0": + self.cpp_info.set_property("pkg_config_name", "Lerc") + if not self.options.shared: + self.cpp_info.defines = ["LERC_STATIC"] diff --git a/recipes/lerc/all/patches/add-CMakeLists-and-static.patch b/recipes/lerc/all/patches/2.1-add-CMakeLists-and-static.patch similarity index 100% rename from recipes/lerc/all/patches/add-CMakeLists-and-static.patch rename to recipes/lerc/all/patches/2.1-add-CMakeLists-and-static.patch diff --git a/recipes/lerc/all/patches/4.0.0-include-algorithm.patch b/recipes/lerc/all/patches/4.0.0-include-algorithm.patch new file mode 100644 index 0000000000000..dea8f0292de5d --- /dev/null +++ b/recipes/lerc/all/patches/4.0.0-include-algorithm.patch @@ -0,0 +1,24 @@ +diff --git a/src/LercLib/fpl_EsriHuffman.cpp b/src/LercLib/fpl_EsriHuffman.cpp +index b72bd44..2f6ae7f 100644 +--- a/src/LercLib/fpl_EsriHuffman.cpp ++++ b/src/LercLib/fpl_EsriHuffman.cpp +@@ -28,6 +28,7 @@ Original coding 2021 Yuriy Yakimenko + #include + #include + #include ++#include + + USING_NAMESPACE_LERC + +diff --git a/src/LercLib/fpl_Lerc2Ext.cpp b/src/LercLib/fpl_Lerc2Ext.cpp +index b07104c..df184f5 100644 +--- a/src/LercLib/fpl_Lerc2Ext.cpp ++++ b/src/LercLib/fpl_Lerc2Ext.cpp +@@ -28,6 +28,7 @@ Original coding 2021 Yuriy Yakimenko + #include + #include + #include ++#include + + USING_NAMESPACE_LERC + diff --git a/recipes/lerc/all/test_package/CMakeLists.txt b/recipes/lerc/all/test_package/CMakeLists.txt index 60f3d04c6e3a0..50d07b3052d3e 100644 --- a/recipes/lerc/all/test_package/CMakeLists.txt +++ b/recipes/lerc/all/test_package/CMakeLists.txt @@ -1,7 +1,12 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) find_package(lerc REQUIRED CONFIG) add_executable(test_package test_package.cpp) target_link_libraries(test_package PRIVATE lerc::lerc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +if(lerc_VERSION VERSION_GREATER_EQUAL "3.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE -DLERC_VER3_LATER) +endif() diff --git a/recipes/lerc/all/test_package/test_package.cpp b/recipes/lerc/all/test_package/test_package.cpp index 5af4b7da62cfe..c399abcf8d219 100644 --- a/recipes/lerc/all/test_package/test_package.cpp +++ b/recipes/lerc/all/test_package/test_package.cpp @@ -55,7 +55,10 @@ void sample1() { lerc_status hr = lerc_computeCompressedSize(reinterpret_cast(&zImg[0]), // raw image data, row by row, band by band static_cast(dt_float), 1, w, h, 1, - &maskByteImg[0], // can give nullptr if all pixels are valid +#ifdef LERC_VER3_LATER + 1, +#endif + maskByteImg.data(), // can give nullptr if all pixels are valid maxZError, // max coding error per pixel, or precision &numBytesNeeded); // size of outgoing Lerc blob @@ -67,7 +70,10 @@ void sample1() { hr = lerc_encode(reinterpret_cast(&zImg[0]), // raw image data, row by row, band by band static_cast(dt_float), 1, w, h, 1, - &maskByteImg[0], // can give nullptr if all pixels are valid +#ifdef LERC_VER3_LATER + 1, +#endif + maskByteImg.data(), // can give nullptr if all pixels are valid maxZError, // max coding error per pixel, or precision &pLercBlob[0], // buffer to write to, function will fail if buffer too small numBytesBlob, // buffer size @@ -98,7 +104,11 @@ void sample1() { std::vector maskByteImg3(w * h); +#ifdef LERC_VER3_LATER + hr = lerc_decode(&pLercBlob[0], numBytesBlob, 1, maskByteImg3.data(), 1, w, h, 1, static_cast(dt_float), reinterpret_cast(&zImg3[0])); +#else hr = lerc_decode(&pLercBlob[0], numBytesBlob, &maskByteImg3[0], 1, w, h, 1, static_cast(dt_float), reinterpret_cast(&zImg3[0])); +#endif if (hr) std::cout << "lerc_decode(...) failed" << std::endl; @@ -124,88 +134,7 @@ void sample1() { std::cout << "max z error per pixel = " << maxDelta << std::endl; } -void sample2() { - const int h = 713; - const int w = 257; - - std::vector byteImg(3 * w * h); - - for (int k = 0, i = 0; i < h; i++) - for (int j = 0; j < w; j++, k++) - for (int m = 0; m < 3; m++) - byteImg[k * 3 + m] = std::rand() % 30; - - - // encode - - uint32 numBytesNeeded = 0; - uint32 numBytesWritten = 0; - - lerc_status hr = lerc_computeCompressedSize(reinterpret_cast(&byteImg[0]), // raw image data: nDim values per pixel, row by row, band by band - static_cast(dt_uchar), 3, w, h, 1, - 0, // can give nullptr if all pixels are valid - 0, // max coding error per pixel - &numBytesNeeded); // size of outgoing Lerc blob - - if (hr) - std::cout << "lerc_computeCompressedSize(...) failed" << std::endl; - - uint32 numBytesBlob = numBytesNeeded; - std::vector pLercBlob(numBytesBlob); - - hr = lerc_encode(reinterpret_cast(&byteImg[0]), // raw image data: nDim values per pixel, row by row, band by band - static_cast(dt_uchar), 3, w, h, 1, - 0, // can give nullptr if all pixels are valid - 0, // max coding error per pixel - &pLercBlob[0], // buffer to write to, function will fail if buffer too small - numBytesBlob, // buffer size - &numBytesWritten); // num bytes written to buffer - - if (hr) - std::cout << "lerc_encode(...) failed" << std::endl; - - double ratio = 3 * w * h / static_cast(numBytesBlob); - std::cout << "sample 2 compression ratio = " << ratio << std::endl; - - // decode - - uint32 infoArr[10]; - double dataRangeArr[3]; - hr = lerc_getBlobInfo(&pLercBlob[0], numBytesBlob, infoArr, dataRangeArr, 10, 3); - if (hr) - std::cout << "lerc_getBlobInfo(...) failed" << std::endl; - - BlobInfo_Print(infoArr); - - if (!BlobInfo_Equal(infoArr, 3, w, h, 1, static_cast(dt_uchar))) - std::cout << "got wrong lerc info" << std::endl; - - // new data storage - std::vector byteImg3(3 * w * h); - - hr = lerc_decode(&pLercBlob[0], numBytesBlob, 0, 3, w, h, 1, static_cast(dt_uchar), reinterpret_cast(&byteImg3[0])); - if (hr) - std::cout << "lerc_decode(...) failed" << std::endl; - - // compare to orig - - double maxDelta = 0; - for (int k = 0, i = 0; i < h; i++) - for (int j = 0; j < w; j++, k++) - for (int m = 0; m < 3; m++) - { - double delta = std::abs(byteImg3[k * 3 + m] - byteImg[k * 3 + m]); - if (delta > maxDelta) - maxDelta = delta; - } - - std::cout << "max z error per pixel = " << maxDelta << std::endl; -} - int main() { sample1(); - std::cout << std::endl; - sample2(); - std::cout << std::endl; return 0; } diff --git a/recipes/lerc/all/test_v1_package/CMakeLists.txt b/recipes/lerc/all/test_v1_package/CMakeLists.txt index 2f75279de7b90..925ecbe19e448 100644 --- a/recipes/lerc/all/test_v1_package/CMakeLists.txt +++ b/recipes/lerc/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(lerc REQUIRED CONFIG) - -add_executable(test_package ../test_package/test_package.cpp) -target_link_libraries(test_package PRIVATE lerc::lerc) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/lerc/config.yml b/recipes/lerc/config.yml index 96c0b5a4124cb..6bcfdf0332e1f 100644 --- a/recipes/lerc/config.yml +++ b/recipes/lerc/config.yml @@ -1,4 +1,6 @@ versions: + "4.0.0": + folder: all "2.2": folder: all "2.1": diff --git a/recipes/leveldb/all/CMakeLists.txt b/recipes/leveldb/all/CMakeLists.txt deleted file mode 100644 index 5927671e52e95..0000000000000 --- a/recipes/leveldb/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.9) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/leveldb/all/conandata.yml b/recipes/leveldb/all/conandata.yml index 9cd0c9e32caf4..904735bb768f7 100644 --- a/recipes/leveldb/all/conandata.yml +++ b/recipes/leveldb/all/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "1.23": - patch_file: "patches/check_library_exists.1.23.patch" - base_path: "source_subfolder" "1.22": - patch_file: "patches/check_library_exists.1.22.patch" - base_path: "source_subfolder" diff --git a/recipes/leveldb/all/conanfile.py b/recipes/leveldb/all/conanfile.py index c7441605c206c..7aefd15a7bf6f 100644 --- a/recipes/leveldb/all/conanfile.py +++ b/recipes/leveldb/all/conanfile.py @@ -1,8 +1,10 @@ -from conans import CMake, ConanFile, tools -import functools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class LevelDBCppConan(ConanFile): @@ -30,16 +32,8 @@ class LevelDBCppConan(ConanFile): "with_crc32c": True, } - generators = "cmake", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -47,46 +41,52 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - # FIXME: tcmalloc is also conditionally included in leveldb, but - # there is no "official" conan package yet; when that is available, we - # can add similar with options for those + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): + # FIXME: tcmalloc is also conditionally included in leveldb, but + # there is no "official" conan package yet; when that is available, we + # can add similar with options for those if self.options.with_snappy: self.requires("snappy/1.1.9") if self.options.with_crc32c: self.requires("crc32c/1.1.2") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LEVELDB_BUILD_TESTS"] = False + tc.variables["LEVELDB_BUILD_BENCHMARKS"] = False + tc.variables["HAVE_SNAPPY"] = self.options.with_snappy + tc.variables["HAVE_CRC32C"] = self.options.with_crc32c + tc.generate() + deps = CMakeDeps(self) + deps.generate() - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): + apply_conandata_patches(self) cmake = CMake(self) - cmake.definitions["LEVELDB_BUILD_TESTS"] = False - cmake.definitions["LEVELDB_BUILD_BENCHMARKS"] = False - cmake.definitions["HAVE_SNAPPY"] = self.options.with_snappy - cmake.definitions["HAVE_CRC32C"] = self.options.with_crc32c cmake.configure() - return cmake - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "leveldb") diff --git a/recipes/leveldb/all/test_package/CMakeLists.txt b/recipes/leveldb/all/test_package/CMakeLists.txt index b172f9a98e165..c55600d5161fd 100644 --- a/recipes/leveldb/all/test_package/CMakeLists.txt +++ b/recipes/leveldb/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(leveldb REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} leveldb::leveldb) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE leveldb::leveldb) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/leveldb/all/test_package/conanfile.py b/recipes/leveldb/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/leveldb/all/test_package/conanfile.py +++ b/recipes/leveldb/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/leveldb/all/test_v1_package/CMakeLists.txt b/recipes/leveldb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..add355dae7008 --- /dev/null +++ b/recipes/leveldb/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(leveldb REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE leveldb::leveldb) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/leveldb/all/test_v1_package/conanfile.py b/recipes/leveldb/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/leveldb/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libaec/all/CMakeLists.txt b/recipes/libaec/all/CMakeLists.txt deleted file mode 100644 index 28b6788808412..0000000000000 --- a/recipes/libaec/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) - -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") - diff --git a/recipes/libaec/all/conandata.yml b/recipes/libaec/all/conandata.yml index 81bd3833b2814..f02aae783d14c 100644 --- a/recipes/libaec/all/conandata.yml +++ b/recipes/libaec/all/conandata.yml @@ -8,9 +8,15 @@ sources: patches: "1.0.4": - patch_file: "patches/1.0.4-0001-Fix-static-library-builds.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fix static library builds" - patch_file: "patches/1.0.4-0002-fix-install-ios.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fix install iOS" "1.0.6": - patch_file: "patches/1.0.6-0001-fix-library-builds.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Fix library builds" + - patch_file: "patches/1.0.6-0002-fix-cmake-build-with-ninja.patch" + patch_type: "conan" + patch_description: "Ninja needs 'aec' binary to be put in a separate folder to an imaginary 'aec' object output" diff --git a/recipes/libaec/all/conanfile.py b/recipes/libaec/all/conanfile.py index 5f628637c580f..e624f9f76f9b5 100644 --- a/recipes/libaec/all/conanfile.py +++ b/recipes/libaec/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class LibaecConan(ConanFile): @@ -11,7 +15,7 @@ class LibaecConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.dkrz.de/k202009/libaec" description = "Adaptive Entropy Coding library" - topics = ("dsp", "libaec", "encoding", "decoding",) + topics = "dsp", "encoding", "decoding" settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], @@ -21,25 +25,9 @@ class LibaecConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -47,14 +35,26 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if tools.Version(self.version) >= "1.0.6" and self._is_msvc: + if Version(self.version) >= "1.0.6" and is_msvc(self): # libaec/1.0.6 uses "restrict" keyword which seems to be supported since Visual Studio 16. - if tools.Version(self.settings.compiler.version) < "16": + if Version(self.settings.compiler.version) < "16": raise ConanInvalidConfiguration("{} does not support Visual Studio {}".format(self.name, self.settings.compiler.version)) # In libaec/1.0.6, fail to build aec_client command with debug and shared settings in Visual Studio. # Temporary, this recipe doesn't support these settings. @@ -62,50 +62,45 @@ def validate(self): raise ConanInvalidConfiguration("{} does not support debug and shared build in Visual Studio(currently)".format(self.name)) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) < "1.0.6": - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "add_subdirectory(tests)", "") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + if Version(self.version) < "1.0.6": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "add_subdirectory(tests)", "") + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - if tools.Version(self.version) < "1.0.6": - self.copy(pattern="Copyright.txt", dst="licenses", src=self._source_subfolder) + if Version(self.version) < "1.0.6": + copy(self, pattern="Copyright.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) else: - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) def package_info(self): aec_name = "aec" - if self.settings.os == "Windows" and tools.Version(self.version) >= "1.0.6" and not self.options.shared: + if self.settings.os == "Windows" and Version(self.version) >= "1.0.6" and not self.options.shared: aec_name = "aec_static" szip_name = "sz" if self.settings.os == "Windows": - if tools.Version(self.version) >= "1.0.6": + if Version(self.version) >= "1.0.6": szip_name = "szip" if self.options.shared else "szip_static" elif self.options.shared: szip_name = "szip" - self.cpp_info.libs = [aec_name, szip_name,] + self.cpp_info.libs = [szip_name, aec_name] bin_path = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bin_path)) self.env_info.PATH.append(bin_path) diff --git a/recipes/libaec/all/patches/1.0.6-0002-fix-cmake-build-with-ninja.patch b/recipes/libaec/all/patches/1.0.6-0002-fix-cmake-build-with-ninja.patch new file mode 100644 index 0000000000000..b3782f6654ad3 --- /dev/null +++ b/recipes/libaec/all/patches/1.0.6-0002-fix-cmake-build-with-ninja.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt 2021-09-17 19:28:01.000000000 +0800 ++++ b/CMakeLists.txt 2022-11-04 07:43:58.413439439 +0800 +@@ -12,6 +12,8 @@ + include(TestBigEndian) + test_big_endian(WORDS_BIGENDIAN) + ++set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin) ++ + # Check for __builtin_clzll for faster decoding + include(CheckCSourceCompiles) + check_c_source_compiles( diff --git a/recipes/libaec/all/test_package/CMakeLists.txt b/recipes/libaec/all/test_package/CMakeLists.txt index 39f956e39b59c..f87e0b5ca8eb9 100644 --- a/recipes/libaec/all/test_package/CMakeLists.txt +++ b/recipes/libaec/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1.3) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(libaec CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/libaec/all/test_package/conanfile.py b/recipes/libaec/all/test_package/conanfile.py index b07f7e5f677ac..75526b1d02b79 100644 --- a/recipes/libaec/all/test_package/conanfile.py +++ b/recipes/libaec/all/test_package/conanfile.py @@ -1,19 +1,33 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + if Version(self.dependencies["libaec"].ref.version) >= "1.0.6": + tc.variables["CMAKE_C_STANDARD"] = "11" + tc.generate() def build(self): cmake = CMake(self) - if tools.Version(self.deps_cpp_info["libaec"].version) >= "1.0.6": - cmake.definitions["CMAKE_C_STANDARD"] = "11" cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libaec/all/test_v1_package/CMakeLists.txt b/recipes/libaec/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..454ad5fbc6eba --- /dev/null +++ b/recipes/libaec/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1.3) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(libaec CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} libaec::libaec) diff --git a/recipes/libaec/all/test_v1_package/conanfile.py b/recipes/libaec/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b07f7e5f677ac --- /dev/null +++ b/recipes/libaec/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + if tools.Version(self.deps_cpp_info["libaec"].version) >= "1.0.6": + cmake.definitions["CMAKE_C_STANDARD"] = "11" + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libaio/all/conandata.yml b/recipes/libaio/all/conandata.yml new file mode 100644 index 0000000000000..e5229e2bd9bde --- /dev/null +++ b/recipes/libaio/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.3.113": + url: "https://pagure.io/libaio/archive/libaio-0.3.113/libaio-libaio-0.3.113.tar.gz" + sha256: "716c7059703247344eb066b54ecbc3ca2134f0103307192e6c2b7dab5f9528ab" diff --git a/recipes/libaio/all/conanfile.py b/recipes/libaio/all/conanfile.py new file mode 100644 index 0000000000000..1c6d39e998e82 --- /dev/null +++ b/recipes/libaio/all/conanfile.py @@ -0,0 +1,77 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.env import VirtualRunEnv +from conan.tools.files import copy, get, chdir, rm +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.53.0" + +class LibaioConan(ConanFile): + name = "libaio" + description = "libaio provides the Linux-native API for async I/O." + license = "LGPL-2.1-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://pagure.io/libaio" + topics = ("asynchronous", "aio", "async") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + @property + def _user_info_build(self): + return getattr(self, "user_info_build", self.deps_user_info) + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if self.info.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} is not supported on {self.info.settings.os}.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + tc.generate() + + def build(self): + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.make(target="all") + + def package(self): + copy(self, pattern="COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.make(target="install", args=["prefix=" + self.package_folder]) + + if self.options.shared: + rm(self, "libaio.a", os.path.join(self.package_folder, "lib")) + else: + rm(self, "libaio.so*", os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.libs = ["aio"] diff --git a/recipes/libaio/all/test_package/CMakeLists.txt b/recipes/libaio/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4515d52910142 --- /dev/null +++ b/recipes/libaio/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libaio REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libaio::libaio) diff --git a/recipes/libaio/all/test_package/conanfile.py b/recipes/libaio/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/libaio/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libaio/all/test_package/test_package.c b/recipes/libaio/all/test_package/test_package.c new file mode 100644 index 0000000000000..e8a44ee3d19dd --- /dev/null +++ b/recipes/libaio/all/test_package/test_package.c @@ -0,0 +1,93 @@ +#include +#include +#include +#include +#include +#include +#include + +#define FATAL(...)\ + do {\ + fprintf(stderr, __VA_ARGS__);\ + fprintf(stderr, "\n");\ + assert(0);\ + exit(-1);\ + } while (0) + +static const void handle_error(int err) { +#define DECL_ERR(X) case -X: FATAL("Error "#X"\n"); break; + switch (err) { + DECL_ERR(EFAULT); + DECL_ERR(EINVAL); + DECL_ERR(ENOSYS); + DECL_ERR(EAGAIN); + }; + if (err < 0) FATAL("Unknown error"); +#undef DECL_ERR +} + +#define IO_RUN(F, ...)\ + do {\ + int err = F(__VA_ARGS__);\ + handle_error(err);\ + } while (0) + +#define MB(X) (X * 1024 * 1024) +#define SZ MB(50) + +static const int maxEvents = 10; +char *dst = NULL; // data we are reading +char *src = NULL; // data we are writing +int fd = -1; // file to open + +void check(io_context_t ctx, struct iocb *iocb, long res, long res2) { + size_t i; + if (res2 || res != SZ) FATAL("Error in async IO"); + for (i = 0; i < SZ; ++i) + if (dst[i] != src[i]) FATAL("Error in async copy"); + printf("DONE\n"); + fflush(stdout); +} + +int main (int argc, char *argv[]) { + size_t i; + /* Create a file and fill it with random crap */ + FILE *file = fopen("crap.dat", "wb"); + if (file == NULL) FATAL("Unable to create crap.dat"); + src = (char*)malloc(sizeof(char) * SZ); + for (i = 0; i < SZ; ++i) src[i] = rand(); + size_t nr = fwrite(src, SZ, 1, file); + if (nr != 1) FATAL("Unable to fill crap.dat"); + fclose(file); + + /* Prepare the file to read */ + int fd = open("crap.dat", O_NONBLOCK, 0); + if (fd < 0) FATAL("Error opening file"); + dst = (char*)malloc(sizeof(char) * SZ); + + /* Now use *real* asynchronous IO to read back the file */ + io_context_t ctx; + memset(&ctx, 0, sizeof(ctx)); + IO_RUN (io_queue_init, maxEvents, &ctx); + + /* This is the read job we asynchronously run */ + struct iocb *job = (struct iocb*)malloc(sizeof(struct iocb) * 1); + io_prep_pread(job, fd, dst, SZ, 0); + io_set_callback(job, check); + + /* Issue it now */ + IO_RUN (io_submit, ctx, 1, &job); + + /* Wait for it */ + struct io_event evt; + IO_RUN (io_getevents, ctx, 1, 1, &evt, NULL); + check(ctx, evt.obj, evt.res, evt.res2); + + close(fd); + + free(src); + free(dst); + free(job); + io_destroy(ctx); + return 0; +} diff --git a/recipes/libaio/all/test_v1_package/CMakeLists.txt b/recipes/libaio/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libaio/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libaio/all/test_v1_package/conanfile.py b/recipes/libaio/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/libaio/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libaio/config.yml b/recipes/libaio/config.yml new file mode 100644 index 0000000000000..88b2313b77c9b --- /dev/null +++ b/recipes/libaio/config.yml @@ -0,0 +1,3 @@ +versions: + "0.3.113": + folder: all diff --git a/recipes/libalsa/all/conanfile.py b/recipes/libalsa/all/conanfile.py index cac0714be412f..8c3046d892f5a 100644 --- a/recipes/libalsa/all/conanfile.py +++ b/recipes/libalsa/all/conanfile.py @@ -1,24 +1,24 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, chdir, copy, get, rm, rmdir +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rm, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain from conan.tools.layout import basic_layout -from conan.tools.microsoft import unix_path +from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class LibalsaConan(ConanFile): name = "libalsa" - license = "LGPL-2.1" + license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/alsa-project/alsa-lib" - topics = ("libalsa", "alsa", "sound", "audio", "midi") + topics = ("alsa", "sound", "audio", "midi") description = "Library of ALSA: The Advanced Linux Sound Architecture, that provides audio " \ "and MIDI functionality to the Linux operating system" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,36 +32,31 @@ class LibalsaConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): if self.settings.os != "Linux": - raise ConanInvalidConfiguration("Only Linux supported") + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): self.tool_requires("libtool/2.4.7") - def layout(self): - basic_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" tc.configure_args.extend([ @@ -70,22 +65,29 @@ def generate(self): "--datadir=${prefix}/res", ]) tc.generate() - env = VirtualBuildEnv(self) - env.generate() def build(self): apply_conandata_patches(self) - with chdir(self, self.source_folder): - autotools = Autotools(self) + autotools = Autotools(self) + if Version(self.version) > "1.2.4": autotools.autoreconf() autotools.configure() autotools.make() + else: + with chdir(self, self.source_folder): + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - with chdir(self, self.source_folder): + if Version(self.version) > "1.2.4": autotools = Autotools(self) autotools.install() + else: + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rm(self, "*.la", os.path.join(self.package_folder, "lib")) @@ -95,6 +97,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "ALSA::ALSA") self.cpp_info.set_property("pkg_config_name", "alsa") self.cpp_info.libs = ["asound"] + self.cpp_info.resdirs = ["res"] self.cpp_info.system_libs = ["dl", "m", "rt", "pthread"] alsa_config_dir = os.path.join(self.package_folder, "res", "alsa") self.runenv_info.define_path("ALSA_CONFIG_DIR", alsa_config_dir) diff --git a/recipes/libalsa/all/test_package/conanfile.py b/recipes/libalsa/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/libalsa/all/test_package/conanfile.py +++ b/recipes/libalsa/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/libalsa/all/test_package/test_package.c b/recipes/libalsa/all/test_package/test_package.c index 532921eec833c..5fe270f6f4fcc 100644 --- a/recipes/libalsa/all/test_package/test_package.c +++ b/recipes/libalsa/all/test_package/test_package.c @@ -1,895 +1,8 @@ - -/* - * This small demo sends a simple sinusoidal wave to your speakers. - */ #include -#include -#include -#include -#include -#include -#include "alsa/asoundlib.h" -#include -#include - - -static time_t get_current_time() -{ - struct timeval tv; - - gettimeofday(&tv, NULL); - - return tv.tv_sec; -} - -static time_t start_time; - -static int is_playing() -{ - return (get_current_time() - start_time) < 5; -} - -static char *device = "plughw:0,0"; /* playback device */ -static snd_pcm_format_t format = SND_PCM_FORMAT_S16; /* sample format */ -static unsigned int rate = 44100; /* stream rate */ -static unsigned int channels = 1; /* count of channels */ -static unsigned int buffer_time = 500000; /* ring buffer length in us */ -static unsigned int period_time = 100000; /* period time in us */ -static double freq = 440; /* sinusoidal wave frequency in Hz */ -static int verbose = 0; /* verbose flag */ -static int resample = 1; /* enable alsa-lib resampling */ -static int period_event = 0; /* produce poll event after each period */ -static snd_pcm_sframes_t buffer_size; -static snd_pcm_sframes_t period_size; -static snd_output_t *output = NULL; -static void generate_sine(const snd_pcm_channel_area_t *areas, - snd_pcm_uframes_t offset, - int count, double *_phase) -{ - static double max_phase = 2. * M_PI; - double phase = *_phase; - double step = max_phase*freq/(double)rate; - unsigned char *samples[channels]; - int steps[channels]; - unsigned int chn; - int format_bits = snd_pcm_format_width(format); - unsigned int maxval = (1 << (format_bits - 1)) - 1; - int bps = format_bits / 8; /* bytes per sample */ - int phys_bps = snd_pcm_format_physical_width(format) / 8; - int big_endian = snd_pcm_format_big_endian(format) == 1; - int to_unsigned = snd_pcm_format_unsigned(format) == 1; - int is_float = (format == SND_PCM_FORMAT_FLOAT_LE || - format == SND_PCM_FORMAT_FLOAT_BE); - /* verify and prepare the contents of areas */ - for (chn = 0; chn < channels; chn++) { - if ((areas[chn].first % 8) != 0) { - printf("areas[%i].first == %i, aborting...\n", chn, areas[chn].first); - exit(EXIT_FAILURE); - } - samples[chn] = /*(signed short *)*/(((unsigned char *)areas[chn].addr) + (areas[chn].first / 8)); - if ((areas[chn].step % 16) != 0) { - printf("areas[%i].step == %i, aborting...\n", chn, areas[chn].step); - exit(EXIT_FAILURE); - } - steps[chn] = areas[chn].step / 8; - samples[chn] += offset * steps[chn]; - } - /* fill the channel areas */ - while (count-- > 0) { - union { - float f; - int i; - } fval; - int res, i; - if (is_float) { - fval.f = sin(phase); - res = fval.i; - } else - res = sin(phase) * maxval; - if (to_unsigned) - res ^= 1U << (format_bits - 1); - for (chn = 0; chn < channels; chn++) { - /* Generate data in native endian format */ - if (big_endian) { - for (i = 0; i < bps; i++) - *(samples[chn] + phys_bps - 1 - i) = (res >> i * 8) & 0xff; - } else { - for (i = 0; i < bps; i++) - *(samples[chn] + i) = (res >> i * 8) & 0xff; - } - samples[chn] += steps[chn]; - } - phase += step; - if (phase >= max_phase) - phase -= max_phase; - } - *_phase = phase; -} -static int set_hwparams(snd_pcm_t *handle, - snd_pcm_hw_params_t *params, - snd_pcm_access_t access) -{ - unsigned int rrate; - snd_pcm_uframes_t size; - int err, dir; - /* choose all parameters */ - err = snd_pcm_hw_params_any(handle, params); - if (err < 0) { - printf("Broken configuration for playback: no configurations available: %s\n", snd_strerror(err)); - return err; - } - /* set hardware resampling */ - err = snd_pcm_hw_params_set_rate_resample(handle, params, resample); - if (err < 0) { - printf("Resampling setup failed for playback: %s\n", snd_strerror(err)); - return err; - } - /* set the interleaved read/write format */ - err = snd_pcm_hw_params_set_access(handle, params, access); - if (err < 0) { - printf("Access type not available for playback: %s\n", snd_strerror(err)); - return err; - } - /* set the sample format */ - err = snd_pcm_hw_params_set_format(handle, params, format); - if (err < 0) { - printf("Sample format not available for playback: %s\n", snd_strerror(err)); - return err; - } - /* set the count of channels */ - err = snd_pcm_hw_params_set_channels(handle, params, channels); - if (err < 0) { - printf("Channels count (%i) not available for playbacks: %s\n", channels, snd_strerror(err)); - return err; - } - /* set the stream rate */ - rrate = rate; - err = snd_pcm_hw_params_set_rate_near(handle, params, &rrate, 0); - if (err < 0) { - printf("Rate %iHz not available for playback: %s\n", rate, snd_strerror(err)); - return err; - } - if (rrate != rate) { - printf("Rate doesn't match (requested %iHz, get %iHz)\n", rate, err); - return -EINVAL; - } - /* set the buffer time */ - err = snd_pcm_hw_params_set_buffer_time_near(handle, params, &buffer_time, &dir); - if (err < 0) { - printf("Unable to set buffer time %i for playback: %s\n", buffer_time, snd_strerror(err)); - return err; - } - err = snd_pcm_hw_params_get_buffer_size(params, &size); - if (err < 0) { - printf("Unable to get buffer size for playback: %s\n", snd_strerror(err)); - return err; - } - buffer_size = size; - /* set the period time */ - err = snd_pcm_hw_params_set_period_time_near(handle, params, &period_time, &dir); - if (err < 0) { - printf("Unable to set period time %i for playback: %s\n", period_time, snd_strerror(err)); - return err; - } - err = snd_pcm_hw_params_get_period_size(params, &size, &dir); - if (err < 0) { - printf("Unable to get period size for playback: %s\n", snd_strerror(err)); - return err; - } - period_size = size; - /* write the parameters to device */ - err = snd_pcm_hw_params(handle, params); - if (err < 0) { - printf("Unable to set hw params for playback: %s\n", snd_strerror(err)); - return err; - } - return 0; -} -static int set_swparams(snd_pcm_t *handle, snd_pcm_sw_params_t *swparams) -{ - int err; - /* get the current swparams */ - err = snd_pcm_sw_params_current(handle, swparams); - if (err < 0) { - printf("Unable to determine current swparams for playback: %s\n", snd_strerror(err)); - return err; - } - /* start the transfer when the buffer is almost full: */ - /* (buffer_size / avail_min) * avail_min */ - err = snd_pcm_sw_params_set_start_threshold(handle, swparams, (buffer_size / period_size) * period_size); - if (err < 0) { - printf("Unable to set start threshold mode for playback: %s\n", snd_strerror(err)); - return err; - } - /* allow the transfer when at least period_size samples can be processed */ - /* or disable this mechanism when period event is enabled (aka interrupt like style processing) */ - err = snd_pcm_sw_params_set_avail_min(handle, swparams, period_event ? buffer_size : period_size); - if (err < 0) { - printf("Unable to set avail min for playback: %s\n", snd_strerror(err)); - return err; - } - /* enable period events when requested */ - if (period_event) { - err = snd_pcm_sw_params_set_period_event(handle, swparams, 1); - if (err < 0) { - printf("Unable to set period event: %s\n", snd_strerror(err)); - return err; - } - } - /* write the parameters to the playback device */ - err = snd_pcm_sw_params(handle, swparams); - if (err < 0) { - printf("Unable to set sw params for playback: %s\n", snd_strerror(err)); - return err; - } - return 0; -} -/* - * Underrun and suspend recovery - */ - -static int xrun_recovery(snd_pcm_t *handle, int err) -{ - if (verbose) - printf("stream recovery\n"); - if (err == -EPIPE) { /* under-run */ - err = snd_pcm_prepare(handle); - if (err < 0) - printf("Can't recovery from underrun, prepare failed: %s\n", snd_strerror(err)); - return 0; - } else if (err == -ESTRPIPE) { - while ((err = snd_pcm_resume(handle)) == -EAGAIN) - sleep(1); /* wait until the suspend flag is released */ - if (err < 0) { - err = snd_pcm_prepare(handle); - if (err < 0) - printf("Can't recovery from suspend, prepare failed: %s\n", snd_strerror(err)); - } - return 0; - } - return err; -} -/* - * Transfer method - write only - */ -static int write_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) -{ - double phase = 0; - signed short *ptr; - int err, cptr; - while (is_playing()) { - generate_sine(areas, 0, period_size, &phase); - ptr = samples; - cptr = period_size; - while (cptr > 0) { - err = snd_pcm_writei(handle, ptr, cptr); - if (err == -EAGAIN) - continue; - if (err < 0) { - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - break; /* skip one period */ - } - ptr += err * channels; - cptr -= err; - } - } -} - -/* - * Transfer method - write and wait for room in buffer using poll - */ -static int wait_for_poll(snd_pcm_t *handle, struct pollfd *ufds, unsigned int count) -{ - unsigned short revents; - while (is_playing()) { - poll(ufds, count, -1); - snd_pcm_poll_descriptors_revents(handle, ufds, count, &revents); - if (revents & POLLERR) - return -EIO; - if (revents & POLLOUT) - return 0; - } -} -static int write_and_poll_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) -{ - struct pollfd *ufds; - double phase = 0; - signed short *ptr; - int err, count, cptr, init; - count = snd_pcm_poll_descriptors_count (handle); - if (count <= 0) { - printf("Invalid poll descriptors count\n"); - return count; - } - ufds = malloc(sizeof(struct pollfd) * count); - if (ufds == NULL) { - printf("No enough memory\n"); - return -ENOMEM; - } - if ((err = snd_pcm_poll_descriptors(handle, ufds, count)) < 0) { - printf("Unable to obtain poll descriptors for playback: %s\n", snd_strerror(err)); - return err; - } - init = 1; - while (is_playing()) { - if (!init) { - err = wait_for_poll(handle, ufds, count); - if (err < 0) { - if (snd_pcm_state(handle) == SND_PCM_STATE_XRUN || - snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED) { - err = snd_pcm_state(handle) == SND_PCM_STATE_XRUN ? -EPIPE : -ESTRPIPE; - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - init = 1; - } else { - printf("Wait for poll failed\n"); - return err; - } - } - } - generate_sine(areas, 0, period_size, &phase); - ptr = samples; - cptr = period_size; - while (cptr > 0) { - err = snd_pcm_writei(handle, ptr, cptr); - if (err < 0) { - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - init = 1; - break; /* skip one period */ - } - if (snd_pcm_state(handle) == SND_PCM_STATE_RUNNING) - init = 0; - ptr += err * channels; - cptr -= err; - if (cptr == 0) - break; - /* it is possible, that the initial buffer cannot store */ - /* all data from the last period, so wait awhile */ - err = wait_for_poll(handle, ufds, count); - if (err < 0) { - if (snd_pcm_state(handle) == SND_PCM_STATE_XRUN || - snd_pcm_state(handle) == SND_PCM_STATE_SUSPENDED) { - err = snd_pcm_state(handle) == SND_PCM_STATE_XRUN ? -EPIPE : -ESTRPIPE; - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - init = 1; - } else { - printf("Wait for poll failed\n"); - return err; - } - } - } - } -} -/* - * Transfer method - asynchronous notification - */ -struct async_private_data { - signed short *samples; - snd_pcm_channel_area_t *areas; - double phase; -}; -static void async_callback(snd_async_handler_t *ahandler) -{ - snd_pcm_t *handle = snd_async_handler_get_pcm(ahandler); - struct async_private_data *data = snd_async_handler_get_callback_private(ahandler); - signed short *samples = data->samples; - snd_pcm_channel_area_t *areas = data->areas; - snd_pcm_sframes_t avail; - int err; - - avail = snd_pcm_avail_update(handle); - while (avail >= period_size) { - generate_sine(areas, 0, period_size, &data->phase); - err = snd_pcm_writei(handle, samples, period_size); - if (err < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - if (err != period_size) { - printf("Write error: written %i expected %li\n", err, period_size); - exit(EXIT_FAILURE); - } - avail = snd_pcm_avail_update(handle); - } -} -static int async_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) -{ - struct async_private_data data; - snd_async_handler_t *ahandler; - int err, count; - data.samples = samples; - data.areas = areas; - data.phase = 0; - err = snd_async_add_pcm_handler(&ahandler, handle, async_callback, &data); - if (err < 0) { - printf("Unable to register async handler\n"); - exit(EXIT_FAILURE); - } - for (count = 0; count < 2; count++) { - generate_sine(areas, 0, period_size, &data.phase); - err = snd_pcm_writei(handle, samples, period_size); - if (err < 0) { - printf("Initial write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - if (err != period_size) { - printf("Initial write error: written %i expected %li\n", err, period_size); - exit(EXIT_FAILURE); - } - } - if (snd_pcm_state(handle) == SND_PCM_STATE_PREPARED) { - err = snd_pcm_start(handle); - if (err < 0) { - printf("Start error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } - /* because all other work is done in the signal handler, - suspend the process */ - while (is_playing()) { - sleep(1); - } -} -/* - * Transfer method - asynchronous notification + direct write - */ -static void async_direct_callback(snd_async_handler_t *ahandler) -{ - snd_pcm_t *handle = snd_async_handler_get_pcm(ahandler); - struct async_private_data *data = snd_async_handler_get_callback_private(ahandler); - const snd_pcm_channel_area_t *my_areas; - snd_pcm_uframes_t offset, frames, size; - snd_pcm_sframes_t avail, commitres; - snd_pcm_state_t state; - int first = 0, err; - - while (is_playing()) { - state = snd_pcm_state(handle); - if (state == SND_PCM_STATE_XRUN) { - err = xrun_recovery(handle, -EPIPE); - if (err < 0) { - printf("XRUN recovery failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } else if (state == SND_PCM_STATE_SUSPENDED) { - err = xrun_recovery(handle, -ESTRPIPE); - if (err < 0) { - printf("SUSPEND recovery failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } - avail = snd_pcm_avail_update(handle); - if (avail < 0) { - err = xrun_recovery(handle, avail); - if (err < 0) { - printf("avail update failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - continue; - } - if (avail < period_size) { - if (first) { - first = 0; - err = snd_pcm_start(handle); - if (err < 0) { - printf("Start error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } else { - break; - } - continue; - } - size = period_size; - while (size > 0) { - frames = size; - err = snd_pcm_mmap_begin(handle, &my_areas, &offset, &frames); - if (err < 0) { - if ((err = xrun_recovery(handle, err)) < 0) { - printf("MMAP begin avail error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - generate_sine(my_areas, offset, frames, &data->phase); - commitres = snd_pcm_mmap_commit(handle, offset, frames); - if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) { - if ((err = xrun_recovery(handle, commitres >= 0 ? -EPIPE : commitres)) < 0) { - printf("MMAP commit error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - size -= frames; - } - } -} -static int async_direct_loop(snd_pcm_t *handle, - signed short *samples ATTRIBUTE_UNUSED, - snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED) -{ - struct async_private_data data; - snd_async_handler_t *ahandler; - const snd_pcm_channel_area_t *my_areas; - snd_pcm_uframes_t offset, frames, size; - snd_pcm_sframes_t commitres; - int err, count; - data.samples = NULL; /* we do not require the global sample area for direct write */ - data.areas = NULL; /* we do not require the global areas for direct write */ - data.phase = 0; - err = snd_async_add_pcm_handler(&ahandler, handle, async_direct_callback, &data); - if (err < 0) { - printf("Unable to register async handler\n"); - exit(EXIT_FAILURE); - } - for (count = 0; count < 2; count++) { - size = period_size; - while (size > 0) { - frames = size; - err = snd_pcm_mmap_begin(handle, &my_areas, &offset, &frames); - if (err < 0) { - if ((err = xrun_recovery(handle, err)) < 0) { - printf("MMAP begin avail error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } - generate_sine(my_areas, offset, frames, &data.phase); - commitres = snd_pcm_mmap_commit(handle, offset, frames); - if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) { - if ((err = xrun_recovery(handle, commitres >= 0 ? -EPIPE : commitres)) < 0) { - printf("MMAP commit error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } - size -= frames; - } - } - err = snd_pcm_start(handle); - if (err < 0) { - printf("Start error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - /* because all other work is done in the signal handler, - suspend the process */ - while (is_playing()) { - sleep(1); - } -} -/* - * Transfer method - direct write only - */ -static int direct_loop(snd_pcm_t *handle, - signed short *samples ATTRIBUTE_UNUSED, - snd_pcm_channel_area_t *areas ATTRIBUTE_UNUSED) -{ - double phase = 0; - const snd_pcm_channel_area_t *my_areas; - snd_pcm_uframes_t offset, frames, size; - snd_pcm_sframes_t avail, commitres; - snd_pcm_state_t state; - int err, first = 1; - while (is_playing()) { - state = snd_pcm_state(handle); - if (state == SND_PCM_STATE_XRUN) { - err = xrun_recovery(handle, -EPIPE); - if (err < 0) { - printf("XRUN recovery failed: %s\n", snd_strerror(err)); - return err; - } - first = 1; - } else if (state == SND_PCM_STATE_SUSPENDED) { - err = xrun_recovery(handle, -ESTRPIPE); - if (err < 0) { - printf("SUSPEND recovery failed: %s\n", snd_strerror(err)); - return err; - } - } - avail = snd_pcm_avail_update(handle); - if (avail < 0) { - err = xrun_recovery(handle, avail); - if (err < 0) { - printf("avail update failed: %s\n", snd_strerror(err)); - return err; - } - first = 1; - continue; - } - if (avail < period_size) { - if (first) { - first = 0; - err = snd_pcm_start(handle); - if (err < 0) { - printf("Start error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - } else { - err = snd_pcm_wait(handle, -1); - if (err < 0) { - if ((err = xrun_recovery(handle, err)) < 0) { - printf("snd_pcm_wait error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - } - continue; - } - size = period_size; - while (size > 0) { - frames = size; - err = snd_pcm_mmap_begin(handle, &my_areas, &offset, &frames); - if (err < 0) { - if ((err = xrun_recovery(handle, err)) < 0) { - printf("MMAP begin avail error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - generate_sine(my_areas, offset, frames, &phase); - commitres = snd_pcm_mmap_commit(handle, offset, frames); - if (commitres < 0 || (snd_pcm_uframes_t)commitres != frames) { - if ((err = xrun_recovery(handle, commitres >= 0 ? -EPIPE : commitres)) < 0) { - printf("MMAP commit error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - first = 1; - } - size -= frames; - } - } -} - -/* - * Transfer method - direct write only using mmap_write functions - */ -static int direct_write_loop(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas) -{ - double phase = 0; - signed short *ptr; - int err, cptr; - while (is_playing()) { - generate_sine(areas, 0, period_size, &phase); - ptr = samples; - cptr = period_size; - while (cptr > 0) { - err = snd_pcm_mmap_writei(handle, ptr, cptr); - if (err == -EAGAIN) - continue; - if (err < 0) { - if (xrun_recovery(handle, err) < 0) { - printf("Write error: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - break; /* skip one period */ - } - ptr += err * channels; - cptr -= err; - } - } -} +#include -/* - * - */ -struct transfer_method { - const char *name; - snd_pcm_access_t access; - int (*transfer_loop)(snd_pcm_t *handle, - signed short *samples, - snd_pcm_channel_area_t *areas); -}; -static struct transfer_method transfer_methods[] = { - { "write", SND_PCM_ACCESS_RW_INTERLEAVED, write_loop }, - { "write_and_poll", SND_PCM_ACCESS_RW_INTERLEAVED, write_and_poll_loop }, - { "async", SND_PCM_ACCESS_RW_INTERLEAVED, async_loop }, - { "async_direct", SND_PCM_ACCESS_MMAP_INTERLEAVED, async_direct_loop }, - { "direct_interleaved", SND_PCM_ACCESS_MMAP_INTERLEAVED, direct_loop }, - { "direct_noninterleaved", SND_PCM_ACCESS_MMAP_NONINTERLEAVED, direct_loop }, - { "direct_write", SND_PCM_ACCESS_MMAP_INTERLEAVED, direct_write_loop }, - { NULL, SND_PCM_ACCESS_RW_INTERLEAVED, NULL } -}; -static void help(void) -{ - int k; - printf( -"Usage: pcm [OPTION]... [FILE]...\n" -"-h,--help help\n" -"-D,--device playback device\n" -"-r,--rate stream rate in Hz\n" -"-c,--channels count of channels in stream\n" -"-f,--frequency sine wave frequency in Hz\n" -"-b,--buffer ring buffer size in us\n" -"-p,--period period size in us\n" -"-m,--method transfer method\n" -"-o,--format sample format\n" -"-v,--verbose show the PCM setup parameters\n" -"-n,--noresample do not resample\n" -"-e,--pevent enable poll event after each period\n" -"\n"); - printf("Recognized sample formats are:"); - for (k = 0; k < SND_PCM_FORMAT_LAST; ++k) { - const char *s = snd_pcm_format_name(k); - if (s) - printf(" %s", s); - } - printf("\n"); - printf("Recognized transfer methods are:"); - for (k = 0; transfer_methods[k].name; k++) - printf(" %s", transfer_methods[k].name); - printf("\n"); -} -int main(int argc, char *argv[]) +int main() { - struct option long_option[] = - { - {"help", 0, NULL, 'h'}, - {"device", 1, NULL, 'D'}, - {"rate", 1, NULL, 'r'}, - {"channels", 1, NULL, 'c'}, - {"frequency", 1, NULL, 'f'}, - {"buffer", 1, NULL, 'b'}, - {"period", 1, NULL, 'p'}, - {"method", 1, NULL, 'm'}, - {"format", 1, NULL, 'o'}, - {"verbose", 1, NULL, 'v'}, - {"noresample", 1, NULL, 'n'}, - {"pevent", 1, NULL, 'e'}, - {NULL, 0, NULL, 0}, - }; - snd_pcm_t *handle; - int err, morehelp; - snd_pcm_hw_params_t *hwparams; - snd_pcm_sw_params_t *swparams; - int method = 0; - signed short *samples; - unsigned int chn; - snd_pcm_channel_area_t *areas; - snd_pcm_hw_params_alloca(&hwparams); - snd_pcm_sw_params_alloca(&swparams); - morehelp = 0; - start_time = get_current_time(); - - while (1) { - int c; - if ((c = getopt_long(argc, argv, "hD:r:c:f:b:p:m:o:vne", long_option, NULL)) < 0) - break; - switch (c) { - case 'h': - morehelp++; - break; - case 'D': - device = strdup(optarg); - break; - case 'r': - rate = atoi(optarg); - rate = rate < 4000 ? 4000 : rate; - rate = rate > 196000 ? 196000 : rate; - break; - case 'c': - channels = atoi(optarg); - channels = channels < 1 ? 1 : channels; - channels = channels > 1024 ? 1024 : channels; - break; - case 'f': - freq = atoi(optarg); - freq = freq < 50 ? 50 : freq; - freq = freq > 5000 ? 5000 : freq; - break; - case 'b': - buffer_time = atoi(optarg); - buffer_time = buffer_time < 1000 ? 1000 : buffer_time; - buffer_time = buffer_time > 1000000 ? 1000000 : buffer_time; - break; - case 'p': - period_time = atoi(optarg); - period_time = period_time < 1000 ? 1000 : period_time; - period_time = period_time > 1000000 ? 1000000 : period_time; - break; - case 'm': - for (method = 0; transfer_methods[method].name; method++) - if (!strcasecmp(transfer_methods[method].name, optarg)) - break; - if (transfer_methods[method].name == NULL) - method = 0; - break; - case 'o': - for (format = 0; format < SND_PCM_FORMAT_LAST; format++) { - const char *format_name = snd_pcm_format_name(format); - if (format_name) - if (!strcasecmp(format_name, optarg)) - break; - } - if (format == SND_PCM_FORMAT_LAST) - format = SND_PCM_FORMAT_S16; - if (!snd_pcm_format_linear(format) && - !(format == SND_PCM_FORMAT_FLOAT_LE || - format == SND_PCM_FORMAT_FLOAT_BE)) { - printf("Invalid (non-linear/float) format %s\n", - optarg); - return 1; - } - break; - case 'v': - verbose = 1; - break; - case 'n': - resample = 0; - break; - case 'e': - period_event = 1; - break; - } - } - if (morehelp) { - help(); - return 0; - } - err = snd_output_stdio_attach(&output, stdout, 0); - if (err < 0) { - printf("Output failed: %s\n", snd_strerror(err)); - return 0; - } - printf("Playback device is %s\n", device); - printf("Stream parameters are %iHz, %s, %i channels\n", rate, snd_pcm_format_name(format), channels); - printf("Sine wave rate is %.4fHz\n", freq); - printf("Using transfer method: %s\n", transfer_methods[method].name); - if ((err = snd_pcm_open(&handle, device, SND_PCM_STREAM_PLAYBACK, 0)) < 0) { - printf("Playback open error: %s\n", snd_strerror(err)); - return 0; - } - - if ((err = set_hwparams(handle, hwparams, transfer_methods[method].access)) < 0) { - printf("Setting of hwparams failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - if ((err = set_swparams(handle, swparams)) < 0) { - printf("Setting of swparams failed: %s\n", snd_strerror(err)); - exit(EXIT_FAILURE); - } - if (verbose > 0) - snd_pcm_dump(handle, output); - samples = malloc((period_size * channels * snd_pcm_format_physical_width(format)) / 8); - if (samples == NULL) { - printf("No enough memory\n"); - exit(EXIT_FAILURE); - } - - areas = calloc(channels, sizeof(snd_pcm_channel_area_t)); - if (areas == NULL) { - printf("No enough memory\n"); - exit(EXIT_FAILURE); - } - for (chn = 0; chn < channels; chn++) { - areas[chn].addr = samples; - areas[chn].first = chn * snd_pcm_format_physical_width(format); - areas[chn].step = channels * snd_pcm_format_physical_width(format); - } - err = transfer_methods[method].transfer_loop(handle, samples, areas); - if (err < 0) - printf("Transfer failed: %s\n", snd_strerror(err)); - free(areas); - free(samples); - snd_pcm_close(handle); - return 0; + printf("libalsa version %s\n", snd_asoundlib_version()); + return 0; } diff --git a/recipes/libalsa/all/test_v1_package/CMakeLists.txt b/recipes/libalsa/all/test_v1_package/CMakeLists.txt index 690e8d6667c90..925ecbe19e448 100644 --- a/recipes/libalsa/all/test_v1_package/CMakeLists.txt +++ b/recipes/libalsa/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(ALSA REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE ALSA::ALSA) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libaom-av1/all/conandata.yml b/recipes/libaom-av1/all/conandata.yml index a658972bada52..8a6a9a41576b7 100644 --- a/recipes/libaom-av1/all/conandata.yml +++ b/recipes/libaom-av1/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.5.0": + url: "https://storage.googleapis.com/aom-releases/libaom-3.5.0.tar.gz" + sha256: "d37dbee372e2430a7efde813984ae6d78bdf1fc4080ebe32457c9115408b0738" "3.4.0": url: "https://storage.googleapis.com/aom-releases/libaom-3.4.0.tar.gz" sha256: "bd754b58c3fa69f3ffd29da77de591bd9c26970e3b18537951336d6c0252e354" @@ -15,13 +18,27 @@ sources: url: "https://storage.googleapis.com/aom-releases/libaom-2.0.1.tar.gz" sha256: "a0cff299621e2ef885aba219c498fa39a7d9a7ddf47585a118fd66c64ad1b312" patches: + "3.5.0": + - patch_file: "patches/0001-3.5.0-fix-install.patch" + patch_type: conan + patch_description: Install just aom library without aom_static. "3.4.0": - patch_file: "patches/0001-3.4.0-fix-install.patch" + patch_type: conan + patch_description: Install just aom library without aom_static. "3.3.0": - patch_file: "patches/0001-3.3.0-fix-install.patch" + patch_type: conan + patch_description: Install just aom library without aom_static. "3.1.2": - patch_file: "patches/0001-3.1.1-fix-install.patch" + patch_type: conan + patch_description: Install just aom library without aom_static. "3.1.1": - patch_file: "patches/0001-3.1.1-fix-install.patch" + patch_type: conan + patch_description: Install just aom library without aom_static. "2.0.1": - patch_file: "patches/0001-2.0.1-fix-install.patch" + patch_type: conan + patch_description: Install just aom library without aom_static. diff --git a/recipes/libaom-av1/all/conanfile.py b/recipes/libaom-av1/all/conanfile.py index e7216a0f083aa..714ea1c7238dd 100644 --- a/recipes/libaom-av1/all/conanfile.py +++ b/recipes/libaom-av1/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class LibaomAv1Conan(ConanFile): @@ -16,6 +16,7 @@ class LibaomAv1Conan(ConanFile): homepage = "https://aomedia.googlesource.com/aom" license = "BSD-2-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,8 +34,7 @@ def _settings_build(self): return getattr(self, "settings_build", self.settings) def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,15 +44,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def build_requirements(self): if self.options.get_safe("assembly", False): @@ -64,10 +58,11 @@ def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=Version(self.version) >= "3.3.0") + get(self, **self.conan_data["sources"][self.version], strip_root=Version(self.version) >= "3.3.0") def generate(self): + env = VirtualBuildEnv(self) + env.generate() tc = CMakeToolchain(self) tc.variables["ENABLE_EXAMPLES"] = False tc.variables["ENABLE_TESTS"] = False @@ -84,8 +79,6 @@ def generate(self): # Requires C99 or higher tc.variables["CMAKE_C_STANDARD"] = "99" tc.generate() - env = VirtualBuildEnv(self) - env.generate() def build(self): apply_conandata_patches(self) diff --git a/recipes/libaom-av1/all/patches/0001-3.5.0-fix-install.patch b/recipes/libaom-av1/all/patches/0001-3.5.0-fix-install.patch new file mode 100644 index 0000000000000..cdf8395c587c8 --- /dev/null +++ b/recipes/libaom-av1/all/patches/0001-3.5.0-fix-install.patch @@ -0,0 +1,21 @@ +--- a/build/cmake/aom_install.cmake ++++ b/build/cmake/aom_install.cmake +@@ -27,7 +27,7 @@ endif() + # Note: aom.pc generation uses GNUInstallDirs: + # https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html + macro(setup_aom_install_targets) +- if(NOT XCODE) ++ if(1) + include("GNUInstallDirs") + set(AOM_PKG_CONFIG_FILE "${AOM_CONFIG_DIR}/aom.pc") + +@@ -78,7 +78,8 @@ macro(setup_aom_install_targets) + endif() + + if(BUILD_SHARED_LIBS) +- set(AOM_INSTALL_LIBS aom aom_static) ++ set_target_properties(aom_static PROPERTIES OUTPUT_NAME aom_static) ++ set(AOM_INSTALL_LIBS aom) + else() + set(AOM_INSTALL_LIBS aom) + endif() diff --git a/recipes/libaom-av1/all/test_package/conanfile.py b/recipes/libaom-av1/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/libaom-av1/all/test_package/conanfile.py +++ b/recipes/libaom-av1/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/libaom-av1/all/test_v1_package/CMakeLists.txt b/recipes/libaom-av1/all/test_v1_package/CMakeLists.txt index 0041c8b205193..0d20897301b68 100644 --- a/recipes/libaom-av1/all/test_v1_package/CMakeLists.txt +++ b/recipes/libaom-av1/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libaom-av1 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libaom-av1::libaom-av1) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libaom-av1/config.yml b/recipes/libaom-av1/config.yml index e66c6b859cddf..63fbe232d5922 100644 --- a/recipes/libaom-av1/config.yml +++ b/recipes/libaom-av1/config.yml @@ -1,4 +1,6 @@ versions: + "3.5.0": + folder: all "3.4.0": folder: all "3.3.0": diff --git a/recipes/libarchive/all/CMakeLists.txt b/recipes/libarchive/all/CMakeLists.txt deleted file mode 100644 index 7977872ad7cd0..0000000000000 --- a/recipes/libarchive/all/CMakeLists.txt +++ /dev/null @@ -1,14 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(CMAKE_CROSSCOMPILING) - if(WIN32 AND NOT CYGWIN) - set(ZLIB_WINAPI_EXITCODE "0") - set(ZLIB_WINAPI_EXITCODE__TRYRUN_OUTPUT "") - endif() -endif() - -add_subdirectory("source_subfolder") diff --git a/recipes/libarchive/all/conandata.yml b/recipes/libarchive/all/conandata.yml index 8ad5c2d93e17c..9a164839a427b 100644 --- a/recipes/libarchive/all/conandata.yml +++ b/recipes/libarchive/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.6.2": + url: "https://github.com/libarchive/libarchive/releases/download/v3.6.2/libarchive-3.6.2.tar.xz" + sha256: "9e2c1b80d5fbe59b61308fdfab6c79b5021d7ff4ff2489fb12daf0a96a83551d" "3.6.1": url: "https://github.com/libarchive/libarchive/releases/download/v3.6.1/libarchive-3.6.1.tar.xz" sha256: "5a411aceb978f43e626f0c2d1812ddd8807b645ed892453acabd532376c148e6" @@ -18,12 +21,64 @@ sources: url: "https://github.com/libarchive/libarchive/releases/download/v3.4.0/libarchive-3.4.0.tar.gz" sha256: "8643d50ed40c759f5412a3af4e353cffbce4fdf3b5cf321cb72cacf06b2d825e" patches: + "3.6.2": + - patch_file: "patches/0001-3.6.2-zlib-winapi.patch" + patch_description: "Remove broken ZLIB WINAPI check" + patch_type: "portability" + - patch_file: "patches/0003-3.6.2-cmake.patch" + patch_description: "Make CMake build-system compatible with Conan" + patch_type: "conan" + - patch_file: "patches/0005-3.6.2-try-compile-cmakedeps.patch" + patch_description: "Patch try_compile check to work with imported CMake targets from Conan packages" + patch_type: "conan" "3.6.1": - - patch_file: "patches/android_compile.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-3.6.0-zlib-winapi.patch" + patch_description: "Remove broken ZLIB WINAPI check" + patch_type: "portability" + - patch_file: "patches/0003-3.6.0-cmake.patch" + patch_description: "Make CMake build-system compatible with Conan" + patch_type: "conan" + - patch_file: "patches/0004-3.6.0-android.patch" + patch_description: "Add missing include directory for Android" + patch_type: "portability" "3.6.0": - - patch_file: "patches/android_compile.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-3.6.0-zlib-winapi.patch" + patch_description: "Remove broken ZLIB WINAPI check" + patch_type: "portability" + - patch_file: "patches/0003-3.6.0-cmake.patch" + patch_description: "Make CMake cooperate with Conan" + patch_type: "conan" + - patch_file: "patches/0004-3.6.0-android.patch" + patch_description: "Add missing include directory for Android" + patch_type: "portability" + "3.5.2": + - patch_file: "patches/0001-3.4.3-zlib-winapi.patch" + patch_description: "Remove broken ZLIB WINAPI check" + patch_type: "portability" + - patch_file: "patches/0003-3.5.2-cmake.patch" + patch_description: "Make CMake cooperate with Conan" + patch_type: "conan" + "3.5.1": + - patch_file: "patches/0001-3.4.3-zlib-winapi.patch" + patch_description: "Remove broken ZLIB WINAPI check" + patch_type: "portability" + - patch_file: "patches/0003-3.4.3-cmake.patch" + patch_description: "Make CMake cooperate with Conan" + patch_type: "conan" + "3.4.3": + - patch_file: "patches/0001-3.4.3-zlib-winapi.patch" + patch_description: "Remove broken ZLIB WINAPI check" + patch_type: "portability" + - patch_file: "patches/0003-3.4.3-cmake.patch" + patch_description: "Make CMake cooperate with Conan" + patch_type: "conan" "3.4.0": - - patch_file: "patches/msvc-no-we4061.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-3.4.0-zlib-winapi.patch" + patch_description: "Remove broken ZLIB WINAPI check" + patch_type: "portability" + - patch_file: "patches/0002-3.4.0-msvc-no-we4061.patch" + patch_description: "Remove MSVC compiler warning e4061" + patch_type: "portability" + - patch_file: "patches/0003-3.4.0-cmake.patch" + patch_description: "Make CMake cooperate with Conan" + patch_type: "conan" diff --git a/recipes/libarchive/all/conanfile.py b/recipes/libarchive/all/conanfile.py index 8635f5452d2cb..b5ea492609f90 100644 --- a/recipes/libarchive/all/conanfile.py +++ b/recipes/libarchive/all/conanfile.py @@ -1,18 +1,21 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout, CMakeDeps, CMakeToolchain +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibarchiveConan(ConanFile): name = "libarchive" description = "Multi-format archive and compression library" - topics = ("libarchive", "tar", "data-compressor", "file-compression") + topics = "archive", "compression", "tar", "data-compressor", "file-compression" url = "https://github.com/conan-io/conan-center-index" homepage = "https://libarchive.org" license = "BSD-2-Clause" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -57,169 +60,114 @@ class LibarchiveConan(ConanFile): "with_xattr": False, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) < "3.4.2": + if Version(self.version) < "3.4.2": del self.options.with_mbedtls def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_bzip2: self.requires("bzip2/1.0.8") if self.options.with_libxml2: - self.requires("libxml2/2.9.14") + self.requires("libxml2/2.10.3") if self.options.with_expat: - self.requires("expat/2.4.8") + self.requires("expat/2.5.0") if self.options.with_iconv: self.requires("libiconv/1.17") if self.options.with_pcreposix: self.requires("pcre/8.45") if self.options.with_nettle: - self.requires("nettle/3.6") + self.requires("nettle/3.8.1") if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/3.0.7") if self.options.with_libb2: self.requires("libb2/20190723") if self.options.with_lz4: - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.with_lzo: self.requires("lzo/2.10") if self.options.with_lzma: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.0") if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.get_safe("with_mbedtls"): self.requires("mbedtls/3.2.1") def validate(self): - if self.settings.os != "Windows" and self.options.with_cng: + if self.info.settings.os != "Windows" and self.info.options.with_cng: # TODO: add cng when available in CCI raise ConanInvalidConfiguration("cng recipe not yet available in CCI.") - if self.options.with_expat and self.options.with_libxml2: + if self.info.options.with_expat and self.info.options.with_libxml2: raise ConanInvalidConfiguration("libxml2 and expat options are exclusive. They cannot be used together as XML engine") + def layout(self): + cmake_layout(self, src_folder="src") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def generate(self): + cmake_deps = CMakeDeps(self) + cmake_deps.generate() + tc = CMakeToolchain(self) # turn off deps to avoid picking up them accidentally - self._cmake.definitions["ENABLE_NETTLE"] = self.options.with_nettle - self._cmake.definitions["ENABLE_OPENSSL"] = self.options.with_openssl - self._cmake.definitions["ENABLE_LIBB2"] = self.options.with_libb2 - self._cmake.definitions["ENABLE_LZ4"] = self.options.with_lz4 - self._cmake.definitions["ENABLE_LZO"] = self.options.with_lzo - self._cmake.definitions["ENABLE_LZMA"] = self.options.with_lzma - self._cmake.definitions["ENABLE_ZSTD"] = self.options.with_zstd - self._cmake.definitions["ENABLE_ZLIB"] = self.options.with_zlib - self._cmake.definitions["ENABLE_BZip2"] = self.options.with_bzip2 + tc.variables["ENABLE_NETTLE"] = self.options.with_nettle + tc.variables["ENABLE_OPENSSL"] = self.options.with_openssl + tc.variables["ENABLE_LIBB2"] = self.options.with_libb2 + tc.variables["ENABLE_LZ4"] = self.options.with_lz4 + tc.variables["ENABLE_LZO"] = self.options.with_lzo + tc.variables["ENABLE_LZMA"] = self.options.with_lzma + tc.variables["ENABLE_ZSTD"] = self.options.with_zstd + tc.variables["ENABLE_ZLIB"] = self.options.with_zlib + tc.variables["ENABLE_BZip2"] = self.options.with_bzip2 # requires LibXml2 cmake name - self._cmake.definitions["ENABLE_LIBXML2"] = self.options.with_libxml2 - self._cmake.definitions["ENABLE_ICONV"] = self.options.with_iconv - self._cmake.definitions["ENABLE_EXPAT"] = self.options.with_expat - self._cmake.definitions["ENABLE_PCREPOSIX"] = self.options.with_pcreposix + tc.variables["ENABLE_LIBXML2"] = self.options.with_libxml2 + tc.variables["ENABLE_ICONV"] = self.options.with_iconv + tc.variables["ENABLE_EXPAT"] = self.options.with_expat + tc.variables["ENABLE_PCREPOSIX"] = self.options.with_pcreposix if self.options.with_pcreposix: - self._cmake.definitions["POSIX_REGEX_LIB"] = "LIBPCREPOSIX" - self._cmake.definitions["ENABLE_LibGCC"] = False - self._cmake.definitions["ENABLE_CNG"] = self.options.with_cng + tc.variables["POSIX_REGEX_LIB"] = "LIBPCREPOSIX" + tc.variables["ENABLE_LibGCC"] = False + tc.variables["ENABLE_CNG"] = self.options.with_cng # turn off features - self._cmake.definitions["ENABLE_ACL"] = self.options.with_acl + tc.variables["ENABLE_ACL"] = self.options.with_acl # turn off components - self._cmake.definitions["ENABLE_TAR"] = False - self._cmake.definitions["ENABLE_CPIO"] = False - self._cmake.definitions["ENABLE_CAT"] = False - self._cmake.definitions["ENABLE_TEST"] = False + tc.variables["ENABLE_TAR"] = False + tc.variables["ENABLE_CPIO"] = False + tc.variables["ENABLE_CAT"] = False + tc.variables["ENABLE_TEST"] = False # too strict check - self._cmake.definitions["ENABLE_WERROR"] = False - if tools.Version(self.version) >= "3.4.2": - self._cmake.definitions["ENABLE_MBEDTLS"] = self.options.with_mbedtls - self._cmake.definitions["ENABLE_XATTR"] = self.options.with_xattr - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - cmakelists_path = os.path.join(self._source_subfolder, "CMakeLists.txt") - - # it can possibly override CMAKE_MODULE_PATH provided by generator - tools.replace_in_file(cmakelists_path, - "SET(CMAKE_MODULE_PATH", - "LIST(APPEND CMAKE_MODULE_PATH") - # allow openssl on macOS - if self.options.with_openssl: - tools.replace_in_file(cmakelists_path, - "IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES \"Darwin\")", - "IF(ENABLE_OPENSSL)") - # wrong lzma cmake var name - if self.options.with_lzma: - tools.replace_in_file(cmakelists_path, "LIBLZMA_INCLUDE_DIR", "LIBLZMA_INCLUDE_DIRS") - # add possible names for lz4 library - if not self.options.shared: - tools.replace_in_file(cmakelists_path, - "FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4)", - "FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4 lz4_static liblz4_static)") - - # Exclude static/shared targets from build - if self.options.shared: - tools.save(os.path.join(self._source_subfolder, "libarchive", "CMakeLists.txt"), - "set_target_properties(archive_static PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)", - append=True) - else: - tools.save(os.path.join(self._source_subfolder, "libarchive", "CMakeLists.txt"), - "set_target_properties(archive PROPERTIES EXCLUDE_FROM_ALL 1 EXCLUDE_FROM_DEFAULT_BUILD 1)", - append=True) - - # Exclude static/shared targets from install - if self.options.shared: - tools.replace_in_file(os.path.join(self._source_subfolder, "libarchive", "CMakeLists.txt"), - "INSTALL(TARGETS archive archive_static", - "INSTALL(TARGETS archive") - else: - tools.replace_in_file(os.path.join(self._source_subfolder, "libarchive", "CMakeLists.txt"), - "INSTALL(TARGETS archive archive_static", - "INSTALL(TARGETS archive_static") + tc.variables["ENABLE_WERROR"] = False + if Version(self.version) >= "3.4.2": + tc.variables["ENABLE_MBEDTLS"] = self.options.with_mbedtls + tc.variables["ENABLE_XATTR"] = self.options.with_xattr + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -230,8 +178,8 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "LibArchive" self.cpp_info.names["cmake_find_package_multi"] = "LibArchive" - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os == "Windows" and self.options.with_cng: self.cpp_info.system_libs.append("bcrypt") - if str(self.settings.compiler) in ["Visual Studio", "msvc"] and not self.options.shared: + if is_msvc(self) and not self.options.shared: self.cpp_info.defines = ["LIBARCHIVE_STATIC"] diff --git a/recipes/libarchive/all/patches/0001-3.4.0-zlib-winapi.patch b/recipes/libarchive/all/patches/0001-3.4.0-zlib-winapi.patch new file mode 100644 index 0000000000000..5acce6e86c2cd --- /dev/null +++ b/recipes/libarchive/all/patches/0001-3.4.0-zlib-winapi.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4fd93d04..922efd15 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -415,14 +415,7 @@ IF(ZLIB_FOUND) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) + IF(WIN32 AND NOT CYGWIN) +- # +- # Test if ZLIB_WINAPI macro is needed to use. +- # +- TRY_MACRO_FOR_LIBRARY( +- "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" +- RUNS +- "#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" +- ZLIB_WINAPI) ++ set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) + ADD_DEFINITIONS(-DZLIB_WINAPI) + ELSE(ZLIB_WINAPI) diff --git a/recipes/libarchive/all/patches/0001-3.4.3-zlib-winapi.patch b/recipes/libarchive/all/patches/0001-3.4.3-zlib-winapi.patch new file mode 100644 index 0000000000000..b0d70de9dec3b --- /dev/null +++ b/recipes/libarchive/all/patches/0001-3.4.3-zlib-winapi.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6b00410c..e0359b51 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -420,14 +420,7 @@ IF(ZLIB_FOUND) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) + IF(WIN32 AND NOT CYGWIN) +- # +- # Test if ZLIB_WINAPI macro is needed to use. +- # +- TRY_MACRO_FOR_LIBRARY( +- "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" +- RUNS +- "#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" +- ZLIB_WINAPI) ++ set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) + ADD_DEFINITIONS(-DZLIB_WINAPI) + ELSE(ZLIB_WINAPI) diff --git a/recipes/libarchive/all/patches/0001-3.6.0-zlib-winapi.patch b/recipes/libarchive/all/patches/0001-3.6.0-zlib-winapi.patch new file mode 100644 index 0000000000000..dceed2848f701 --- /dev/null +++ b/recipes/libarchive/all/patches/0001-3.6.0-zlib-winapi.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7a0d300a..646e5ce7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -426,14 +426,7 @@ IF(ZLIB_FOUND) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) + IF(WIN32 AND NOT CYGWIN) +- # +- # Test if ZLIB_WINAPI macro is needed to use. +- # +- TRY_MACRO_FOR_LIBRARY( +- "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" +- RUNS +- "#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" +- ZLIB_WINAPI) ++ set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) + ADD_DEFINITIONS(-DZLIB_WINAPI) + ELSE(ZLIB_WINAPI) diff --git a/recipes/libarchive/all/patches/0001-3.6.2-zlib-winapi.patch b/recipes/libarchive/all/patches/0001-3.6.2-zlib-winapi.patch new file mode 100644 index 0000000000000..62dd3ef819875 --- /dev/null +++ b/recipes/libarchive/all/patches/0001-3.6.2-zlib-winapi.patch @@ -0,0 +1,20 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 713e3bc..2315da5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -430,14 +430,7 @@ IF(ZLIB_FOUND) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) + LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) + IF(WIN32 AND NOT CYGWIN) +- # +- # Test if ZLIB_WINAPI macro is needed to use. +- # +- TRY_MACRO_FOR_LIBRARY( +- "${ZLIB_INCLUDE_DIR}" "${ZLIB_LIBRARIES}" +- RUNS +- "#include \nint main() {uLong f = zlibCompileFlags(); return (f&(1U<<10))?0:-1; }" +- ZLIB_WINAPI) ++ set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) + ADD_DEFINITIONS(-DZLIB_WINAPI) + ELSE(ZLIB_WINAPI) diff --git a/recipes/libarchive/all/patches/0002-3.4.0-msvc-no-we4061.patch b/recipes/libarchive/all/patches/0002-3.4.0-msvc-no-we4061.patch new file mode 100644 index 0000000000000..ff6f218ef3e36 --- /dev/null +++ b/recipes/libarchive/all/patches/0002-3.4.0-msvc-no-we4061.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 922efd15..4ffd0930 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -157,7 +157,6 @@ IF (MSVC) + # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" + # Enable level 4 C4061: The enumerate has no associated handler in a switch + # statement. +- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4061") + # Enable level 4 C4254: A larger bit field was assigned to a smaller bit + # field. + SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4254") diff --git a/recipes/libarchive/all/patches/0003-3.4.0-cmake.patch b/recipes/libarchive/all/patches/0003-3.4.0-cmake.patch new file mode 100644 index 0000000000000..7b724f1fba164 --- /dev/null +++ b/recipes/libarchive/all/patches/0003-3.4.0-cmake.patch @@ -0,0 +1,101 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4ffd0930..01e8592c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,7 @@ endif() + # + PROJECT(libarchive C) + # +-SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") + if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) + endif() +@@ -412,7 +412,7 @@ IF(ZLIB_FOUND) + SET(HAVE_LIBZ 1) + SET(HAVE_ZLIB_H 1) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) +- LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) ++ LIST(APPEND ADDITIONAL_LIBS ZLIB::ZLIB) + IF(WIN32 AND NOT CYGWIN) + set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) +@@ -474,7 +474,7 @@ IF(LIBLZMA_FOUND) + SET(HAVE_LIBLZMA 1) + SET(HAVE_LZMA_H 1) + CMAKE_PUSH_CHECK_STATE() +- SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR}) ++ SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIRS}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES}) + INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS}) + LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES}) +@@ -491,7 +491,7 @@ IF(LIBLZMA_FOUND) + ELSE(LIBLZMA_FOUND) + # LZMA not found and will not be used. + ENDIF(LIBLZMA_FOUND) +-MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR) ++MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIRS) + MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY) + + # +@@ -561,7 +561,7 @@ IF(ENABLE_LZ4) + ENDIF (LZ4_INCLUDE_DIR) + + FIND_PATH(LZ4_INCLUDE_DIR lz4.h) +- FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4) ++ FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4 lz4_static liblz4_static) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR) + ELSE(ENABLE_LZ4) +@@ -757,7 +757,7 @@ ENDIF(ENABLE_NETTLE) + # Find OpenSSL + # (Except on Mac, where OpenSSL is deprecated.) + # +-IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") ++IF(ENABLE_OPENSSL) + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(HAVE_LIBCRYPTO 1) +diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt +index ec775bb4..8ef2d620 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -235,11 +235,15 @@ ELSEIF(ARCHIVE_ACL_SUNOS) + ENDIF() + + # Libarchive is a shared library ++if (BUILD_SHARED_LIBS) ++ + ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .) + TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) + SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) + ++else() ++ + # archive_static is a static library + ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS}) +@@ -249,13 +253,21 @@ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS + IF(NOT WIN32 OR CYGWIN) + SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) + ENDIF(NOT WIN32 OR CYGWIN) ++endif() + + IF(ENABLE_INSTALL) + # How to install the libraries +- INSTALL(TARGETS archive archive_static ++ if (BUILD_SHARED_LIBS) ++ INSTALL(TARGETS archive ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ else() ++ INSTALL(TARGETS archive_static + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) ++ endif() + INSTALL_MAN(${libarchive_MANS}) + INSTALL(FILES ${include_HEADERS} DESTINATION include) + ENDIF() diff --git a/recipes/libarchive/all/patches/0003-3.4.3-cmake.patch b/recipes/libarchive/all/patches/0003-3.4.3-cmake.patch new file mode 100644 index 0000000000000..5c46b58290b77 --- /dev/null +++ b/recipes/libarchive/all/patches/0003-3.4.3-cmake.patch @@ -0,0 +1,101 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6013d9e6..125b1cb3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,7 @@ endif() + # + PROJECT(libarchive C) + # +-SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") + if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) + endif() +@@ -418,7 +418,7 @@ IF(ZLIB_FOUND) + SET(HAVE_LIBZ 1) + SET(HAVE_ZLIB_H 1) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) +- LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) ++ LIST(APPEND ADDITIONAL_LIBS ZLIB::ZLIB) + IF(WIN32 AND NOT CYGWIN) + set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) +@@ -480,7 +480,7 @@ IF(LIBLZMA_FOUND) + SET(HAVE_LIBLZMA 1) + SET(HAVE_LZMA_H 1) + CMAKE_PUSH_CHECK_STATE() +- SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR}) ++ SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIRS}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES}) + INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS}) + LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES}) +@@ -497,7 +497,7 @@ IF(LIBLZMA_FOUND) + ELSE(LIBLZMA_FOUND) + # LZMA not found and will not be used. + ENDIF(LIBLZMA_FOUND) +-MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR) ++MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIRS) + MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY) + + # +@@ -567,7 +567,7 @@ IF(ENABLE_LZ4) + ENDIF (LZ4_INCLUDE_DIR) + + FIND_PATH(LZ4_INCLUDE_DIR lz4.h) +- FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4) ++ FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4 lz4_static liblz4_static) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR) + ELSE(ENABLE_LZ4) +@@ -783,7 +783,7 @@ ENDIF(ENABLE_NETTLE) + # Find OpenSSL + # (Except on Mac, where OpenSSL is deprecated.) + # +-IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") ++IF(ENABLE_OPENSSL) + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(HAVE_LIBCRYPTO 1) +diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt +index 9389bbc9..76e0b5c7 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -236,11 +236,15 @@ ELSEIF(ARCHIVE_ACL_SUNOS) + ENDIF() + + # Libarchive is a shared library ++if (BUILD_SHARED_LIBS) ++ + ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .) + TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) + SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) + ++else() ++ + # archive_static is a static library + ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS}) +@@ -250,13 +254,21 @@ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS + IF(NOT WIN32 OR CYGWIN) + SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) + ENDIF(NOT WIN32 OR CYGWIN) ++endif() + + IF(ENABLE_INSTALL) + # How to install the libraries +- INSTALL(TARGETS archive archive_static ++ if (BUILD_SHARED_LIBS) ++ INSTALL(TARGETS archive ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ else() ++ INSTALL(TARGETS archive_static + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) ++ endif() + INSTALL_MAN(${libarchive_MANS}) + INSTALL(FILES ${include_HEADERS} DESTINATION include) + ENDIF() diff --git a/recipes/libarchive/all/patches/0003-3.5.2-cmake.patch b/recipes/libarchive/all/patches/0003-3.5.2-cmake.patch new file mode 100644 index 0000000000000..5584b5f1606bc --- /dev/null +++ b/recipes/libarchive/all/patches/0003-3.5.2-cmake.patch @@ -0,0 +1,101 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e0359b51..3927a742 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,7 @@ endif() + # + PROJECT(libarchive C) + # +-SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") + if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) + endif() +@@ -418,7 +418,7 @@ IF(ZLIB_FOUND) + SET(HAVE_LIBZ 1) + SET(HAVE_ZLIB_H 1) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) +- LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) ++ LIST(APPEND ADDITIONAL_LIBS ZLIB::ZLIB) + IF(WIN32 AND NOT CYGWIN) + set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) +@@ -480,7 +480,7 @@ IF(LIBLZMA_FOUND) + SET(HAVE_LIBLZMA 1) + SET(HAVE_LZMA_H 1) + CMAKE_PUSH_CHECK_STATE() +- SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR}) ++ SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIRS}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES}) + INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS}) + LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES}) +@@ -497,7 +497,7 @@ IF(LIBLZMA_FOUND) + ELSE(LIBLZMA_FOUND) + # LZMA not found and will not be used. + ENDIF(LIBLZMA_FOUND) +-MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR) ++MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIRS) + MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY) + + # +@@ -567,7 +567,7 @@ IF(ENABLE_LZ4) + ENDIF (LZ4_INCLUDE_DIR) + + FIND_PATH(LZ4_INCLUDE_DIR lz4.h) +- FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4) ++ FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4 lz4_static liblz4_static) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR) + ELSE(ENABLE_LZ4) +@@ -783,7 +783,7 @@ ENDIF(ENABLE_NETTLE) + # Find OpenSSL + # (Except on Mac, where OpenSSL is deprecated.) + # +-IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") ++IF(ENABLE_OPENSSL) + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(HAVE_LIBCRYPTO 1) +diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt +index e1d76a51..792b26b3 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -238,11 +238,15 @@ ELSEIF(ARCHIVE_ACL_SUNOS) + ENDIF() + + # Libarchive is a shared library ++if (BUILD_SHARED_LIBS) ++ + ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .) + TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) + SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) + ++else() ++ + # archive_static is a static library + ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS}) +@@ -252,13 +256,21 @@ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS + IF(NOT WIN32 OR CYGWIN) + SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) + ENDIF(NOT WIN32 OR CYGWIN) ++endif() + + IF(ENABLE_INSTALL) + # How to install the libraries +- INSTALL(TARGETS archive archive_static ++ if (BUILD_SHARED_LIBS) ++ INSTALL(TARGETS archive ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ else() ++ INSTALL(TARGETS archive_static + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) ++ endif() + INSTALL_MAN(${libarchive_MANS}) + INSTALL(FILES ${include_HEADERS} DESTINATION include) + ENDIF() diff --git a/recipes/libarchive/all/patches/0003-3.6.0-cmake.patch b/recipes/libarchive/all/patches/0003-3.6.0-cmake.patch new file mode 100644 index 0000000000000..436c8194e3e4d --- /dev/null +++ b/recipes/libarchive/all/patches/0003-3.6.0-cmake.patch @@ -0,0 +1,112 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 646e5ce7..9bca273f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,7 +9,7 @@ endif() + # + PROJECT(libarchive C) + # +-SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") + if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) + endif() +@@ -424,7 +424,7 @@ IF(ZLIB_FOUND) + SET(HAVE_LIBZ 1) + SET(HAVE_ZLIB_H 1) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) +- LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) ++ LIST(APPEND ADDITIONAL_LIBS ZLIB::ZLIB) + IF(WIN32 AND NOT CYGWIN) + set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) +@@ -486,7 +486,7 @@ IF(LIBLZMA_FOUND) + SET(HAVE_LIBLZMA 1) + SET(HAVE_LZMA_H 1) + CMAKE_PUSH_CHECK_STATE() +- SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR}) ++ SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIRS}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES}) + INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS}) + LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES}) +@@ -503,7 +503,7 @@ IF(LIBLZMA_FOUND) + ELSE(LIBLZMA_FOUND) + # LZMA not found and will not be used. + ENDIF(LIBLZMA_FOUND) +-MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR) ++MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIRS) + MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY) + + # +@@ -573,7 +573,7 @@ IF(ENABLE_LZ4) + ENDIF (LZ4_INCLUDE_DIR) + + FIND_PATH(LZ4_INCLUDE_DIR lz4.h) +- FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4) ++ FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4 lz4_static liblz4_static) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR) + ELSE(ENABLE_LZ4) +@@ -790,7 +790,7 @@ ENDIF(ENABLE_NETTLE) + # Find OpenSSL + # (Except on Mac, where OpenSSL is deprecated.) + # +-IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") ++IF(ENABLE_OPENSSL) + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(HAVE_LIBCRYPTO 1) +diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt +index e1d76a51..713c6496 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -5,6 +5,10 @@ + # + ############################################ + ++if (ANDROID) ++ include_directories(${PROJECT_SOURCE_DIR}/contrib/android/include) ++endif() ++ + # Public headers + SET(include_HEADERS + archive.h +@@ -238,11 +242,15 @@ ELSEIF(ARCHIVE_ACL_SUNOS) + ENDIF() + + # Libarchive is a shared library ++if (BUILD_SHARED_LIBS) ++ + ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .) + TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) + SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) + ++else() ++ + # archive_static is a static library + ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS}) +@@ -252,13 +260,21 @@ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS + IF(NOT WIN32 OR CYGWIN) + SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) + ENDIF(NOT WIN32 OR CYGWIN) ++endif() + + IF(ENABLE_INSTALL) + # How to install the libraries +- INSTALL(TARGETS archive archive_static ++ if (BUILD_SHARED_LIBS) ++ INSTALL(TARGETS archive ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ else() ++ INSTALL(TARGETS archive_static + RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib) ++ endif() + INSTALL_MAN(${libarchive_MANS}) + INSTALL(FILES ${include_HEADERS} DESTINATION include) + ENDIF() diff --git a/recipes/libarchive/all/patches/0003-3.6.2-cmake.patch b/recipes/libarchive/all/patches/0003-3.6.2-cmake.patch new file mode 100644 index 0000000000000..80d49396aac87 --- /dev/null +++ b/recipes/libarchive/all/patches/0003-3.6.2-cmake.patch @@ -0,0 +1,103 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2315da5..1d8de96 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,7 +9,7 @@ endif() + # + PROJECT(libarchive C) + # +-SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build/cmake") + if(NOT CMAKE_RUNTIME_OUTPUT_DIRECTORY) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${libarchive_BINARY_DIR}/bin) + endif() +@@ -428,7 +428,7 @@ IF(ZLIB_FOUND) + SET(HAVE_LIBZ 1) + SET(HAVE_ZLIB_H 1) + INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR}) +- LIST(APPEND ADDITIONAL_LIBS ${ZLIB_LIBRARIES}) ++ LIST(APPEND ADDITIONAL_LIBS ZLIB::ZLIB) + IF(WIN32 AND NOT CYGWIN) + set(ZLIB_WINAPI yes) + IF(ZLIB_WINAPI) +@@ -490,7 +490,7 @@ IF(LIBLZMA_FOUND) + SET(HAVE_LIBLZMA 1) + SET(HAVE_LZMA_H 1) + CMAKE_PUSH_CHECK_STATE() +- SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIR}) ++ SET(CMAKE_REQUIRED_INCLUDES ${LIBLZMA_INCLUDE_DIRS}) + SET(CMAKE_REQUIRED_LIBRARIES ${LIBLZMA_LIBRARIES}) + INCLUDE_DIRECTORIES(${LIBLZMA_INCLUDE_DIRS}) + LIST(APPEND ADDITIONAL_LIBS ${LIBLZMA_LIBRARIES}) +@@ -507,7 +507,7 @@ IF(LIBLZMA_FOUND) + ELSE(LIBLZMA_FOUND) + # LZMA not found and will not be used. + ENDIF(LIBLZMA_FOUND) +-MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIR) ++MARK_AS_ADVANCED(CLEAR LIBLZMA_INCLUDE_DIRS) + MARK_AS_ADVANCED(CLEAR LIBLZMA_LIBRARY) + + # +@@ -577,7 +577,7 @@ IF(ENABLE_LZ4) + ENDIF (LZ4_INCLUDE_DIR) + + FIND_PATH(LZ4_INCLUDE_DIR lz4.h) +- FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4) ++ FIND_LIBRARY(LZ4_LIBRARY NAMES lz4 liblz4 lz4_static liblz4_static) + INCLUDE(FindPackageHandleStandardArgs) + FIND_PACKAGE_HANDLE_STANDARD_ARGS(LZ4 DEFAULT_MSG LZ4_LIBRARY LZ4_INCLUDE_DIR) + ELSE(ENABLE_LZ4) +@@ -799,7 +799,7 @@ ENDIF(ENABLE_NETTLE) + # Find OpenSSL + # (Except on Mac, where OpenSSL is deprecated.) + # +-IF(ENABLE_OPENSSL AND NOT CMAKE_SYSTEM_NAME MATCHES "Darwin") ++IF(ENABLE_OPENSSL) + FIND_PACKAGE(OpenSSL) + IF(OPENSSL_FOUND) + SET(HAVE_LIBCRYPTO 1) +diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt +index ff7ade0..1438819 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -243,11 +243,14 @@ ELSEIF(ARCHIVE_ACL_SUNOS) + ENDIF() + + # Libarchive is a shared library ++if (BUILD_SHARED_LIBS) + ADD_LIBRARY(archive SHARED ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_INCLUDE_DIRECTORIES(archive PUBLIC .) + TARGET_LINK_LIBRARIES(archive ${ADDITIONAL_LIBS}) + SET_TARGET_PROPERTIES(archive PROPERTIES SOVERSION ${SOVERSION}) + ++else() ++ + # archive_static is a static library + ADD_LIBRARY(archive_static STATIC ${libarchive_SOURCES} ${include_HEADERS}) + TARGET_LINK_LIBRARIES(archive_static ${ADDITIONAL_LIBS}) +@@ -257,13 +260,21 @@ SET_TARGET_PROPERTIES(archive_static PROPERTIES COMPILE_DEFINITIONS + IF(NOT WIN32 OR CYGWIN) + SET_TARGET_PROPERTIES(archive_static PROPERTIES OUTPUT_NAME archive) + ENDIF(NOT WIN32 OR CYGWIN) ++endif() + + IF(ENABLE_INSTALL) + # How to install the libraries +- INSTALL(TARGETS archive archive_static +- RUNTIME DESTINATION bin +- LIBRARY DESTINATION lib +- ARCHIVE DESTINATION lib) ++ if (BUILD_SHARED_LIBS) ++ INSTALL(TARGETS archive ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ else() ++ INSTALL(TARGETS archive_static ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) ++ endif() + INSTALL_MAN(${libarchive_MANS}) + INSTALL(FILES ${include_HEADERS} DESTINATION include) + ENDIF() diff --git a/recipes/libarchive/all/patches/0004-3.6.0-android.patch b/recipes/libarchive/all/patches/0004-3.6.0-android.patch new file mode 100644 index 0000000000000..c4c91d3ecb18a --- /dev/null +++ b/recipes/libarchive/all/patches/0004-3.6.0-android.patch @@ -0,0 +1,15 @@ +diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt +index 792b26b3..713c6496 100644 +--- a/libarchive/CMakeLists.txt ++++ b/libarchive/CMakeLists.txt +@@ -5,6 +5,10 @@ + # + ############################################ + ++if (ANDROID) ++ include_directories(${PROJECT_SOURCE_DIR}/contrib/android/include) ++endif() ++ + # Public headers + SET(include_HEADERS + archive.h diff --git a/recipes/libarchive/all/patches/0005-3.6.2-try-compile-cmakedeps.patch b/recipes/libarchive/all/patches/0005-3.6.2-try-compile-cmakedeps.patch new file mode 100644 index 0000000000000..4bca48088c19b --- /dev/null +++ b/recipes/libarchive/all/patches/0005-3.6.2-try-compile-cmakedeps.patch @@ -0,0 +1,31 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1d8de96f..d54975b7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -829,6 +829,8 @@ ENDIF(NOT OPENSSL_FOUND) + # + MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + FOREACH(ALGORITHM ${ALGORITHMS}) ++ include(CMakePushCheckState) ++ cmake_push_check_state() + IF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) + STRING(TOLOWER "${ALGORITHM}" lower_algorithm) + STRING(TOUPPER "${ALGORITHM}" algorithm) +@@ -849,8 +851,7 @@ MACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + IF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + SET(TRY_CRYPTO_REQUIRED_INCLUDES + "${TRY_CRYPTO_REQUIRED_INCLUDES};${OPENSSL_INCLUDE_DIR}") +- SET(TRY_CRYPTO_REQUIRED_LIBS +- "-DLINK_LIBRARIES:STRING=${OPENSSL_LIBRARIES}") ++ set(CMAKE_REQUIRED_LIBRARIES ${OPENSSL_LIBRARIES}) + ELSEIF("${IMPLEMENTATION}" MATCHES "^MBEDTLS$" AND MBEDTLS_FOUND) + SET(TRY_CRYPTO_REQUIRED_INCLUDES + "${TRY_CRYPTO_REQUIRED_INCLUDES};${MBEDTLS_INCLUDE_DIRS}") +@@ -927,6 +928,7 @@ main(int argc, char **argv) + ENDIF ("${IMPLEMENTATION}" MATCHES "^OPENSSL$" AND OPENSSL_FOUND) + ENDIF (ARCHIVE_CRYPTO_${ALGORITHM}_${IMPLEMENTATION}) + ENDIF(NOT ARCHIVE_CRYPTO_${ALGORITHM}) ++ cmake_pop_check_state() + ENDFOREACH(ALGORITHM ${ALGORITHMS}) + ENDMACRO(CHECK_CRYPTO ALGORITHMS IMPLEMENTATION) + diff --git a/recipes/libarchive/all/patches/android_compile.patch b/recipes/libarchive/all/patches/android_compile.patch deleted file mode 100644 index ef6d9755afab8..0000000000000 --- a/recipes/libarchive/all/patches/android_compile.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/libarchive/CMakeLists.txt b/libarchive/CMakeLists.txt -index e1d76a5..e4a83e7 100644 ---- a/libarchive/CMakeLists.txt -+++ b/libarchive/CMakeLists.txt -@@ -5,6 +5,10 @@ - # - ############################################ - -+if (ANDROID) -+ include_directories(${PROJECT_SOURCE_DIR}/contrib/android/include) -+endif() -+ - # Public headers - SET(include_HEADERS - archive.h diff --git a/recipes/libarchive/all/patches/msvc-no-we4061.patch b/recipes/libarchive/all/patches/msvc-no-we4061.patch deleted file mode 100644 index 196cebcfb9baa..0000000000000 --- a/recipes/libarchive/all/patches/msvc-no-we4061.patch +++ /dev/null @@ -1,10 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -157,7 +157,6 @@ IF (MSVC) - # This is added into CMAKE_C_FLAGS when CMAKE_BUILD_TYPE is "Debug" - # Enable level 4 C4061: The enumerate has no associated handler in a switch - # statement. -- SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4061") - # Enable level 4 C4254: A larger bit field was assigned to a smaller bit - # field. - SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /we4254") diff --git a/recipes/libarchive/all/test_package/CMakeLists.txt b/recipes/libarchive/all/test_package/CMakeLists.txt index 9002911767a28..925a2be0857c5 100644 --- a/recipes/libarchive/all/test_package/CMakeLists.txt +++ b/recipes/libarchive/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(LibArchive REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} LibArchive::LibArchive) +target_link_libraries(${PROJECT_NAME} PRIVATE LibArchive::LibArchive) diff --git a/recipes/libarchive/all/test_package/conanfile.py b/recipes/libarchive/all/test_package/conanfile.py index 19e6a0c06e3d8..a9fb96656f203 100644 --- a/recipes/libarchive/all/test_package/conanfile.py +++ b/recipes/libarchive/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libarchive/all/test_v1_package/CMakeLists.txt b/recipes/libarchive/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libarchive/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libarchive/all/test_v1_package/conanfile.py b/recipes/libarchive/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/libarchive/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libarchive/config.yml b/recipes/libarchive/config.yml index 5e7bb50cad34c..2cfb62acf5228 100644 --- a/recipes/libarchive/config.yml +++ b/recipes/libarchive/config.yml @@ -1,4 +1,6 @@ versions: + "3.6.2": + folder: all "3.6.1": folder: all "3.6.0": diff --git a/recipes/libatomic_ops/all/conandata.yml b/recipes/libatomic_ops/all/conandata.yml index db7a433eb252e..59db3060423da 100644 --- a/recipes/libatomic_ops/all/conandata.yml +++ b/recipes/libatomic_ops/all/conandata.yml @@ -1,10 +1,10 @@ sources: - "7.6.10": - url: "https://github.com/ivmai/libatomic_ops/releases/download/v7.6.10/libatomic_ops-7.6.10.tar.gz" - sha256: "587edf60817f56daf1e1ab38a4b3c729b8e846ff67b4f62a6157183708f099af" - "7.6.12": - url: "https://github.com/ivmai/libatomic_ops/releases/download/v7.6.12/libatomic_ops-7.6.12.tar.gz" - sha256: "f0ab566e25fce08b560e1feab6a3db01db4a38e5bc687804334ef3920c549f3e" "7.6.14": url: "https://github.com/ivmai/libatomic_ops/releases/download/v7.6.14/libatomic_ops-7.6.14.tar.gz" sha256: "390f244d424714735b7050d056567615b3b8f29008a663c262fb548f1802d292" +patches: + "7.6.14": + - patch_file: "patches/enable-cmake-7_6_14.patch" + patch_description: "Support build with CMake" + patch_source: "https://github.com/ivmai/libatomic_ops/blob/044573903530c4a8e8318e20a830d4a0531b2035/CMakeLists.txt" + patch_type: "backport" diff --git a/recipes/libatomic_ops/all/conanfile.py b/recipes/libatomic_ops/all/conanfile.py index c9d7c9b91e05b..8bdc55215ddd6 100644 --- a/recipes/libatomic_ops/all/conanfile.py +++ b/recipes/libatomic_ops/all/conanfile.py @@ -1,12 +1,13 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -import contextlib +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, get, rmdir, export_conandata_patches import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" -class Libatomic_opsConan(ConanFile): + +class Atomic_opsConan(ConanFile): name = "libatomic_ops" homepage = "https://github.com/ivmai/libatomic_ops" description = "The atomic_ops project (Atomic memory update operations portable implementation)" @@ -15,6 +16,11 @@ class Libatomic_opsConan(ConanFile): license = "GPL-2.0-or-later" settings = "os", "compiler", "build_type", "arch" + _cmake_options_defaults = ( + ("assertions", False,), + ("atomic_intrinsics", True,), + ) + options = { "shared": [True, False], "fPIC": [True, False], @@ -23,88 +29,78 @@ class Libatomic_opsConan(ConanFile): "shared": False, "fPIC": True, } + for option, default in _cmake_options_defaults: + options[option] = [True, False] + default_options[option] = default - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass - def build_requirements(self): - self.build_requires("gnu-config/cci.20201022") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if self.settings.compiler == "Visual Studio": - self._autotools.flags.append("-FS") - yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo", - "LD": "link"}): - yield - else: - yield - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", None) or self.deps_user_info + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + for option, _ in self._cmake_options_defaults: + tc.variables["enable_{}".format(option)] = self.options.get_safe(option) + tc.variables["install_headers"] = True + tc.variables["build_tests"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - if self.settings.compiler == "Visual Studio" and self.options.shared: - for lib in ["atomic_ops_gpl", "atomic_ops"]: - tools.rename(os.path.join(self.package_folder, "lib", "{}.dll.lib".format(lib)), - os.path.join(self.package_folder, "lib", "{}.lib".format(lib))) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.names["pkg_config"] = "atomic_ops" - self.cpp_info.libs = ["atomic_ops_gpl", "atomic_ops"] + self.cpp_info.set_property("cmake_file_name", "Atomic_ops") + self.cpp_info.set_property("cmake_target_name", "Atomic_ops::atomic_ops_gpl") # workaround to not define an unofficial target + + # TODO: Remove on Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "Atomic_ops" + self.cpp_info.names["cmake_find_package_multi"] = "Atomic_ops" + + self.cpp_info.components["atomic_ops"].set_property("cmake_target_name", "Atomic_ops::atomic_ops") + self.cpp_info.components["atomic_ops"].set_property("pkg_config_name", "atomic_ops") + self.cpp_info.components["atomic_ops"].libs = ["atomic_ops"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["atomic_ops"].system_libs = ["pthread"] + + self.cpp_info.components["atomic_ops_gpl"].set_property("cmake_target_name", "Atomic_ops::atomic_ops_gpl") + self.cpp_info.components["atomic_ops_gpl"].libs = ["atomic_ops_gpl"] + self.cpp_info.components["atomic_ops_gpl"].requires = ["atomic_ops"] diff --git a/recipes/libatomic_ops/all/patches/enable-cmake-7_6_14.patch b/recipes/libatomic_ops/all/patches/enable-cmake-7_6_14.patch new file mode 100644 index 0000000000000..15470fd99352f --- /dev/null +++ b/recipes/libatomic_ops/all/patches/enable-cmake-7_6_14.patch @@ -0,0 +1,730 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..8b26697 +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,341 @@ ++# ++# Copyright (c) 2021-2022 Ivan Maidanski ++## ++# Permission is hereby granted, free of charge, to any person obtaining a copy ++# of this software and associated documentation files (the "Software"), to deal ++# in the Software without restriction, including without limitation the rights ++# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell ++# copies of the Software, and to permit persons to whom the Software is ++# furnished to do so, subject to the following conditions: ++# ++# The above copyright notice and this permission notice shall be included in ++# all copies or substantial portions of the Software. ++# ++# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR ++# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, ++# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE ++# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER ++# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, ++# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE ++# SOFTWARE. ++## ++ ++cmake_minimum_required(VERSION 3.1) ++ ++set(PACKAGE_VERSION 7.6.14) ++# Version must match that in AC_INIT of configure.ac and that in README. ++# Version must conform to: [0-9]+[.][0-9]+[.][0-9]+ ++ ++# Info (current:revision:age) for the Libtool versioning system. ++# These values should match those in src/Makefile.am. ++set(LIBATOMIC_OPS_VER_INFO 2:1:1) ++set(LIBATOMIC_OPS_GPL_VER_INFO 2:3:1) ++ ++project(libatomic_ops C) ++ ++if (POLICY CMP0057) ++ # Required for CheckLinkerFlag, at least. ++ cmake_policy(SET CMP0057 NEW) ++endif() ++ ++include(CheckCCompilerFlag) ++include(CheckFunctionExists) ++include(CMakePackageConfigHelpers) ++include(CTest) ++include(GNUInstallDirs) ++ ++if (NOT (${CMAKE_VERSION} VERSION_LESS "3.18.0")) ++ include(CheckLinkerFlag) ++endif() ++ ++# Customize the build by passing "-D=ON|OFF" in the command line. ++option(BUILD_SHARED_LIBS "Build shared libraries" OFF) ++option(build_tests "Build tests" OFF) ++option(enable_assertions "Enable assertion checking" OFF) ++option(enable_werror "Treat warnings as errors" OFF) ++option(enable_atomic_intrinsics "Use GCC atomic intrinsics" ON) ++option(enable_docs "Build and install documentation" ON) ++option(install_headers "Install header and pkg-config metadata files" ON) ++ ++# Override the default build type to RelWithDebInfo (this instructs cmake to ++# pass -O2 -g -DNDEBUG options to the compiler). ++if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) ++ set(CMAKE_BUILD_TYPE "RelWithDebInfo" CACHE ++ STRING "Choose the type of build." FORCE) ++ set_property(CACHE CMAKE_BUILD_TYPE PROPERTY ++ STRINGS "Debug" "Release" "RelWithDebInfo" "MinSizeRel") ++endif() ++ ++# Convert VER_INFO values to [SO]VERSION ones. ++if (BUILD_SHARED_LIBS) ++ # atomic_ops: ++ string(REGEX REPLACE "(.+):.+:.+" "\\1" ao_cur ${LIBATOMIC_OPS_VER_INFO}) ++ string(REGEX REPLACE ".+:(.+):.+" "\\1" ao_rev ${LIBATOMIC_OPS_VER_INFO}) ++ string(REGEX REPLACE ".+:.+:(.+)$" "\\1" ao_age ${LIBATOMIC_OPS_VER_INFO}) ++ math(EXPR AO_SOVERSION "${ao_cur} - ${ao_age}") ++ set(AO_VERSION_PROP "${AO_SOVERSION}.${ao_age}.${ao_rev}") ++ message(STATUS "AO_VERSION_PROP = ${AO_VERSION_PROP}") ++ # atomic_ops_gpl: ++ string(REGEX REPLACE "(.+):.+:.+" "\\1" ao_gpl_cur ++ ${LIBATOMIC_OPS_GPL_VER_INFO}) ++ string(REGEX REPLACE ".+:(.+):.+" "\\1" ao_gpl_rev ++ ${LIBATOMIC_OPS_GPL_VER_INFO}) ++ string(REGEX REPLACE ".+:.+:(.+)$" "\\1" ao_gpl_age ++ ${LIBATOMIC_OPS_GPL_VER_INFO}) ++ math(EXPR AO_GPL_SOVERSION "${ao_gpl_cur} - ${ao_gpl_age}") ++ set(AO_GPL_VERSION_PROP "${AO_GPL_SOVERSION}.${ao_gpl_age}.${ao_gpl_rev}") ++ message(STATUS "AO_GPL_VERSION_PROP = ${AO_GPL_VERSION_PROP}") ++endif(BUILD_SHARED_LIBS) ++ ++# Output all warnings. ++if (MSVC) ++ # All warnings but ignoring "conditional expression is constant" ones. ++ add_compile_options(/W4 /wd4127) ++else() ++ add_compile_options(-Wall -Wextra) ++endif() ++ ++find_package(Threads REQUIRED) ++message(STATUS "Thread library: ${CMAKE_THREAD_LIBS_INIT}") ++include_directories(${Threads_INCLUDE_DIR}) ++set(THREADDLLIBS_LIST ${CMAKE_THREAD_LIBS_INIT}) ++ ++if (CMAKE_USE_PTHREADS_INIT) ++ # Required define if using POSIX threads. ++ add_compile_options(-D_REENTRANT) ++else() ++ # No pthreads library available. ++ add_compile_options(-DAO_NO_PTHREADS) ++endif() ++ ++if (enable_assertions) ++ # In case NDEBUG macro is defined e.g. by cmake -DCMAKE_BUILD_TYPE=Release. ++ add_compile_options(-UNDEBUG) ++else() ++ # Define to disable assertion checking. ++ add_compile_options(-DNDEBUG) ++endif() ++ ++if (NOT enable_atomic_intrinsics) ++ # Define to avoid GCC atomic intrinsics even if available. ++ add_compile_options(-DAO_DISABLE_GCC_ATOMICS) ++endif() ++ ++# AO API symbols export control. ++if (BUILD_SHARED_LIBS) ++ add_compile_options(-DAO_DLL) ++endif() ++ ++if (enable_werror) ++ if (MSVC) ++ add_compile_options(/WX) ++ else() ++ add_compile_options(-Werror) ++ endif() ++endif(enable_werror) ++ ++# Extra user-defined flags to pass to the C compiler. ++if (DEFINED CFLAGS_EXTRA) ++ separate_arguments(CFLAGS_EXTRA_LIST UNIX_COMMAND "${CFLAGS_EXTRA}") ++ add_compile_options(${CFLAGS_EXTRA_LIST}) ++endif() ++ ++set(SRC src/atomic_ops.c) ++ ++if (CMAKE_C_COMPILER_ID STREQUAL "SunPro") ++ # SunCC compiler on SunOS (Solaris). ++ set(SRC ${SRC} src/atomic_ops_sysdeps.S) ++endif() ++ ++add_library(atomic_ops ${SRC}) ++target_link_libraries(atomic_ops PRIVATE ${THREADDLLIBS_LIST}) ++target_include_directories(atomic_ops ++ PUBLIC "$" ++ INTERFACE "$") ++ ++set(AO_GPL_SRC src/atomic_ops_malloc.c src/atomic_ops_stack.c) ++add_library(atomic_ops_gpl ${AO_GPL_SRC}) ++check_function_exists(mmap HAVE_MMAP) ++if (HAVE_MMAP) ++ target_compile_definitions(atomic_ops_gpl PRIVATE HAVE_MMAP) ++endif() ++target_link_libraries(atomic_ops_gpl PRIVATE atomic_ops) ++target_include_directories(atomic_ops_gpl ++ PUBLIC "$" ++ INTERFACE "$") ++if (BUILD_SHARED_LIBS) ++ set_property(TARGET atomic_ops_gpl PROPERTY VERSION ${AO_GPL_VERSION_PROP}) ++ set_property(TARGET atomic_ops_gpl PROPERTY SOVERSION ${AO_GPL_SOVERSION}) ++endif() ++install(TARGETS atomic_ops_gpl EXPORT Atomic_opsTargets ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") ++ ++if (BUILD_SHARED_LIBS) ++ if (${CMAKE_VERSION} VERSION_LESS "3.18.0") ++ set(WL_NO_UNDEFINED_OPT "-Wl,--no-undefined") ++ check_c_compiler_flag(${WL_NO_UNDEFINED_OPT} HAVE_FLAG_WL_NO_UNDEFINED) ++ else() ++ set(WL_NO_UNDEFINED_OPT "LINKER:--no-undefined") ++ check_linker_flag(C "${WL_NO_UNDEFINED_OPT}" HAVE_FLAG_WL_NO_UNDEFINED) ++ endif() ++ if (HAVE_FLAG_WL_NO_UNDEFINED) ++ # Declare that the libraries do not refer to external symbols. ++ if (${CMAKE_VERSION} VERSION_LESS "3.13.0") ++ target_link_libraries(atomic_ops PRIVATE ${WL_NO_UNDEFINED_OPT}) ++ target_link_libraries(atomic_ops_gpl PRIVATE ${WL_NO_UNDEFINED_OPT}) ++ else() ++ target_link_options(atomic_ops PRIVATE ${WL_NO_UNDEFINED_OPT}) ++ target_link_options(atomic_ops_gpl PRIVATE ${WL_NO_UNDEFINED_OPT}) ++ endif() ++ endif(HAVE_FLAG_WL_NO_UNDEFINED) ++ set_property(TARGET atomic_ops PROPERTY VERSION ${AO_VERSION_PROP}) ++ set_property(TARGET atomic_ops PROPERTY SOVERSION ${AO_SOVERSION}) ++endif(BUILD_SHARED_LIBS) ++ ++install(TARGETS atomic_ops EXPORT Atomic_opsTargets ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") ++ ++if (install_headers) ++ install(FILES src/atomic_ops.h ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") ++ install(FILES src/atomic_ops_malloc.h ++ src/atomic_ops_stack.h ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") ++ ++ install(FILES src/atomic_ops/ao_version.h ++ src/atomic_ops/generalize-arithm.h ++ src/atomic_ops/generalize-small.h ++ src/atomic_ops/generalize.h ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/atomic_ops") ++ ++ install(FILES src/atomic_ops/sysdeps/all_acquire_release_volatile.h ++ src/atomic_ops/sysdeps/all_aligned_atomic_load_store.h ++ src/atomic_ops/sysdeps/all_atomic_load_store.h ++ src/atomic_ops/sysdeps/all_atomic_only_load.h ++ src/atomic_ops/sysdeps/ao_t_is_int.h ++ src/atomic_ops/sysdeps/emul_cas.h ++ src/atomic_ops/sysdeps/generic_pthread.h ++ src/atomic_ops/sysdeps/ordered.h ++ src/atomic_ops/sysdeps/ordered_except_wr.h ++ src/atomic_ops/sysdeps/read_ordered.h ++ src/atomic_ops/sysdeps/standard_ao_double_t.h ++ src/atomic_ops/sysdeps/test_and_set_t_is_ao_t.h ++ src/atomic_ops/sysdeps/test_and_set_t_is_char.h ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/atomic_ops/sysdeps") ++ ++ install(FILES src/atomic_ops/sysdeps/armcc/arm_v6.h ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/atomic_ops/sysdeps/armcc") ++ install(FILES src/atomic_ops/sysdeps/gcc/aarch64.h ++ src/atomic_ops/sysdeps/gcc/alpha.h ++ src/atomic_ops/sysdeps/gcc/arm.h ++ src/atomic_ops/sysdeps/gcc/avr32.h ++ src/atomic_ops/sysdeps/gcc/cris.h ++ src/atomic_ops/sysdeps/gcc/generic-arithm.h ++ src/atomic_ops/sysdeps/gcc/generic-small.h ++ src/atomic_ops/sysdeps/gcc/generic.h ++ src/atomic_ops/sysdeps/gcc/hexagon.h ++ src/atomic_ops/sysdeps/gcc/hppa.h ++ src/atomic_ops/sysdeps/gcc/ia64.h ++ src/atomic_ops/sysdeps/gcc/m68k.h ++ src/atomic_ops/sysdeps/gcc/mips.h ++ src/atomic_ops/sysdeps/gcc/powerpc.h ++ src/atomic_ops/sysdeps/gcc/riscv.h ++ src/atomic_ops/sysdeps/gcc/s390.h ++ src/atomic_ops/sysdeps/gcc/sh.h ++ src/atomic_ops/sysdeps/gcc/sparc.h ++ src/atomic_ops/sysdeps/gcc/tile.h ++ src/atomic_ops/sysdeps/gcc/x86.h ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/atomic_ops/sysdeps/gcc") ++ ++ install(FILES src/atomic_ops/sysdeps/hpc/hppa.h ++ src/atomic_ops/sysdeps/hpc/ia64.h ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/atomic_ops/sysdeps/hpc") ++ install(FILES src/atomic_ops/sysdeps/ibmc/powerpc.h ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/atomic_ops/sysdeps/ibmc") ++ install(FILES src/atomic_ops/sysdeps/icc/ia64.h ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/atomic_ops/sysdeps/icc") ++ ++ install(FILES src/atomic_ops/sysdeps/loadstore/acquire_release_volatile.h ++ src/atomic_ops/sysdeps/loadstore/atomic_load.h ++ src/atomic_ops/sysdeps/loadstore/atomic_store.h ++ src/atomic_ops/sysdeps/loadstore/char_acquire_release_volatile.h ++ src/atomic_ops/sysdeps/loadstore/char_atomic_load.h ++ src/atomic_ops/sysdeps/loadstore/char_atomic_store.h ++ src/atomic_ops/sysdeps/loadstore/double_atomic_load_store.h ++ src/atomic_ops/sysdeps/loadstore/int_acquire_release_volatile.h ++ src/atomic_ops/sysdeps/loadstore/int_atomic_load.h ++ src/atomic_ops/sysdeps/loadstore/int_atomic_store.h ++ src/atomic_ops/sysdeps/loadstore/ordered_loads_only.h ++ src/atomic_ops/sysdeps/loadstore/ordered_stores_only.h ++ src/atomic_ops/sysdeps/loadstore/short_acquire_release_volatile.h ++ src/atomic_ops/sysdeps/loadstore/short_atomic_load.h ++ src/atomic_ops/sysdeps/loadstore/short_atomic_store.h ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/atomic_ops/sysdeps/loadstore") ++ ++ install(FILES src/atomic_ops/sysdeps/msftc/arm.h ++ src/atomic_ops/sysdeps/msftc/common32_defs.h ++ src/atomic_ops/sysdeps/msftc/x86.h ++ src/atomic_ops/sysdeps/msftc/x86_64.h ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/atomic_ops/sysdeps/msftc") ++ install(FILES src/atomic_ops/sysdeps/sunc/sparc.h ++ src/atomic_ops/sysdeps/sunc/x86.h ++ DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/atomic_ops/sysdeps/sunc") ++ ++ # Provide pkg-config metadata. ++ set(prefix "${CMAKE_INSTALL_PREFIX}") ++ set(exec_prefix \${prefix}) ++ set(includedir "${CMAKE_INSTALL_FULL_INCLUDEDIR}") ++ set(libdir "${CMAKE_INSTALL_FULL_LIBDIR}") ++ string(REPLACE ";" " " THREADDLLIBS "${THREADDLLIBS_LIST}") ++ # PACKAGE_VERSION is defined above. ++ configure_file(pkgconfig/atomic_ops.pc.in pkgconfig/atomic_ops.pc @ONLY) ++ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/pkgconfig/atomic_ops.pc" ++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") ++endif(install_headers) ++ ++if (build_tests) ++ add_executable(test_stack tests/test_stack.c) ++ target_link_libraries(test_stack ++ PRIVATE atomic_ops atomic_ops_gpl ${THREADDLLIBS_LIST}) ++ add_test(NAME test_stack COMMAND test_stack) ++ ++ add_executable(test_malloc tests/test_malloc.c) ++ target_link_libraries(test_malloc ++ PRIVATE atomic_ops atomic_ops_gpl ${THREADDLLIBS_LIST}) ++ add_test(NAME test_malloc COMMAND test_malloc) ++endif(build_tests) ++ ++if (enable_docs) ++ install(FILES AUTHORS doc/LICENSING.txt README.md ++ doc/README_details.txt doc/README_win32.txt ++ DESTINATION "${CMAKE_INSTALL_DOCDIR}") ++ install(FILES COPYING doc/README_malloc.txt doc/README_stack.txt ++ DESTINATION "${CMAKE_INSTALL_DOCDIR}") ++endif(enable_docs) ++ ++# CMake config/targets files. ++install(EXPORT Atomic_opsTargets FILE Atomic_opsTargets.cmake ++ NAMESPACE Atomic_ops:: ++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/atomic_ops") ++ ++configure_package_config_file("${CMAKE_CURRENT_SOURCE_DIR}/Config.cmake.in" ++ "${CMAKE_CURRENT_BINARY_DIR}/Atomic_opsConfig.cmake" ++ INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/atomic_ops" ++ NO_SET_AND_CHECK_MACRO) ++ ++write_basic_package_version_file( ++ "${CMAKE_CURRENT_BINARY_DIR}/Atomic_opsConfigVersion.cmake" ++ VERSION "${PACKAGE_VERSION}" COMPATIBILITY AnyNewerVersion) ++ ++install(FILES "${CMAKE_CURRENT_BINARY_DIR}/Atomic_opsConfig.cmake" ++ "${CMAKE_CURRENT_BINARY_DIR}/Atomic_opsConfigVersion.cmake" ++ DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/atomic_ops") ++ ++export(EXPORT Atomic_opsTargets ++ FILE "${CMAKE_CURRENT_BINARY_DIR}/Atomic_opsTargets.cmake") +diff --git a/Config.cmake.in b/Config.cmake.in +new file mode 100644 +index 0000000..034b456 +--- /dev/null ++++ b/Config.cmake.in +@@ -0,0 +1,5 @@ ++# The Atomic_ops CMake configuration file. ++ ++@PACKAGE_INIT@ ++include("${CMAKE_CURRENT_LIST_DIR}/Atomic_opsTargets.cmake") ++check_required_components(libatomic_ops) +diff --git a/configure.ac b/configure.ac +index ccf3230..eec3863 100644 +--- a/configure.ac ++++ b/configure.ac +@@ -234,6 +234,12 @@ else + fi + AC_SUBST(THREADDLLIBS) + ++# AO API symbols export control. ++# Compile with AO_DLL defined unless building static libraries. ++if test x$enable_shared = xyes -a x$enable_static = xno; then ++ CFLAGS="-DAO_DLL $CFLAGS" ++fi ++ + AM_CONDITIONAL(ENABLE_SHARED, test x$enable_shared = xyes) + AM_CONDITIONAL(HAVE_PTHREAD_H, test x$have_pthreads = xtrue) + AM_CONDITIONAL(NEED_ASM, test x$need_asm = xtrue) +diff --git a/src/atomic_ops.c b/src/atomic_ops.c +index 5e6577f..1e5f3c9 100644 +--- a/src/atomic_ops.c ++++ b/src/atomic_ops.c +@@ -51,6 +51,10 @@ + # define _GNU_SOURCE 1 + #endif + ++#ifndef AO_BUILD ++# define AO_BUILD ++#endif ++ + #undef AO_REQUIRE_CAS + #include "atomic_ops.h" /* Without cas emulation! */ + +@@ -83,6 +87,8 @@ + + /* Lock for pthreads-based implementation. */ + #ifndef AO_NO_PTHREADS ++ AO_API pthread_mutex_t AO_pt_lock; ++ + pthread_mutex_t AO_pt_lock = PTHREAD_MUTEX_INITIALIZER; + #endif + +@@ -109,7 +115,7 @@ static AO_TS_t AO_locks[AO_HASH_SIZE] = { + AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, AO_TS_INITIALIZER, + }; + +-void AO_pause(int); /* defined below */ ++AO_API void AO_pause(int); /* defined below */ + + static void lock_ool(volatile AO_TS_t *l) + { +@@ -156,8 +162,8 @@ AO_INLINE void unlock(volatile AO_TS_t *l) + } + #endif /* !AO_USE_NO_SIGNALS */ + +-AO_t AO_fetch_compare_and_swap_emulation(volatile AO_t *addr, AO_t old_val, +- AO_t new_val) ++AO_API AO_t AO_fetch_compare_and_swap_emulation(volatile AO_t *addr, ++ AO_t old_val, AO_t new_val) + { + AO_TS_t *my_lock = AO_locks + AO_HASH(addr); + AO_t fetched_val; +@@ -177,9 +183,10 @@ AO_t AO_fetch_compare_and_swap_emulation(volatile AO_t *addr, AO_t old_val, + return fetched_val; + } + +-int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr, +- AO_t old_val1, AO_t old_val2, +- AO_t new_val1, AO_t new_val2) ++AO_API int ++AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr, ++ AO_t old_val1, AO_t old_val2, ++ AO_t new_val1, AO_t new_val2) + { + AO_TS_t *my_lock = AO_locks + AO_HASH(addr); + int result; +@@ -204,7 +211,7 @@ int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr, + return result; + } + +-void AO_store_full_emulation(volatile AO_t *addr, AO_t val) ++AO_API void AO_store_full_emulation(volatile AO_t *addr, AO_t val) + { + AO_TS_t *my_lock = AO_locks + AO_HASH(addr); + lock(my_lock); +@@ -237,7 +244,7 @@ static void AO_spin(int n) + AO_store(&spin_dummy, j); + } + +-void AO_pause(int n) ++AO_API void AO_pause(int n) + { + if (n < 12) + AO_spin(n); +diff --git a/src/atomic_ops.h b/src/atomic_ops.h +index 92d1f4a..1f996fe 100644 +--- a/src/atomic_ops.h ++++ b/src/atomic_ops.h +@@ -235,6 +235,30 @@ + # define AO_ALIGNOF_SUPPORTED 1 + #endif + ++#if defined(AO_DLL) && !defined(AO_API) ++# ifdef AO_BUILD ++# if defined(__CEGCC__) || (defined(__MINGW32__) && !defined(__cplusplus)) ++# define AO_API __declspec(dllexport) ++# elif defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CYGWIN__) \ ++ || defined(__DMC__) || defined(__MINGW32__) || defined(__WATCOMC__) ++# define AO_API extern __declspec(dllexport) ++# endif ++# else ++# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(__CEGCC__) \ ++ || defined(__CYGWIN__) || defined(__DMC__) ++# define AO_API __declspec(dllimport) ++# elif defined(__MINGW32_DELAY_LOAD__) ++# define AO_API __declspec(dllexport) ++# elif defined(__MINGW32__) || defined(__WATCOMC__) ++# define AO_API extern __declspec(dllimport) ++# endif ++# endif ++#endif /* AO_DLL */ ++ ++#ifndef AO_API ++# define AO_API extern ++#endif ++ + #ifdef AO_ALIGNOF_SUPPORTED + # define AO_ASSERT_ADDR_ALIGNED(addr) \ + assert(((size_t)(addr) & (__alignof__(*(addr)) - 1)) == 0) +diff --git a/src/atomic_ops/sysdeps/emul_cas.h b/src/atomic_ops/sysdeps/emul_cas.h +index e52f75a..c322a5b 100644 +--- a/src/atomic_ops/sysdeps/emul_cas.h ++++ b/src/atomic_ops/sysdeps/emul_cas.h +@@ -47,14 +47,15 @@ + extern "C" { + #endif + +-AO_t AO_fetch_compare_and_swap_emulation(volatile AO_t *addr, AO_t old_val, +- AO_t new_val); ++AO_API AO_t AO_fetch_compare_and_swap_emulation(volatile AO_t *addr, ++ AO_t old_val, AO_t new_val); + +-int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr, +- AO_t old_val1, AO_t old_val2, +- AO_t new_val1, AO_t new_val2); ++AO_API int ++AO_compare_double_and_swap_double_emulation(volatile AO_double_t *addr, ++ AO_t old_val1, AO_t old_val2, ++ AO_t new_val1, AO_t new_val2); + +-void AO_store_full_emulation(volatile AO_t *addr, AO_t val); ++AO_API void AO_store_full_emulation(volatile AO_t *addr, AO_t val); + + #ifndef AO_HAVE_fetch_compare_and_swap_full + # define AO_fetch_compare_and_swap_full(addr, old, newval) \ +diff --git a/src/atomic_ops/sysdeps/generic_pthread.h b/src/atomic_ops/sysdeps/generic_pthread.h +index 854cb77..724b148 100644 +--- a/src/atomic_ops/sysdeps/generic_pthread.h ++++ b/src/atomic_ops/sysdeps/generic_pthread.h +@@ -39,7 +39,7 @@ + + /* We define only the full barrier variants, and count on the */ + /* generalization section below to fill in the rest. */ +-extern pthread_mutex_t AO_pt_lock; ++AO_API pthread_mutex_t AO_pt_lock; + + #ifdef __cplusplus + } /* extern "C" */ +diff --git a/src/atomic_ops_malloc.c b/src/atomic_ops_malloc.c +index adced80..19f49b2 100644 +--- a/src/atomic_ops_malloc.c ++++ b/src/atomic_ops_malloc.c +@@ -19,6 +19,10 @@ + # undef HAVE_MMAP + #endif + ++#ifndef AO_BUILD ++# define AO_BUILD ++#endif ++ + #define AO_REQUIRE_CAS + #include "atomic_ops_malloc.h" + +@@ -116,7 +120,7 @@ static volatile AO_t initial_heap_ptr = (AO_t)AO_initial_heap; + + static volatile AO_t mmap_enabled = 0; + +-void ++AO_API void + AO_malloc_enable_mmap(void) + { + # if defined(__sun) +@@ -200,7 +204,7 @@ AO_free_large(char * p) + + #else /* No MMAP */ + +-void ++AO_API void + AO_malloc_enable_mmap(void) + { + } +@@ -319,7 +323,7 @@ static unsigned msb(size_t s) + return result; + } + +-AO_ATTR_MALLOC AO_ATTR_ALLOC_SIZE(1) ++AO_API AO_ATTR_MALLOC AO_ATTR_ALLOC_SIZE(1) + void * + AO_malloc(size_t sz) + { +@@ -349,7 +353,7 @@ AO_malloc(size_t sz) + return result + 1; + } + +-void ++AO_API void + AO_free(void *p) + { + AO_t *base; +diff --git a/src/atomic_ops_malloc.h b/src/atomic_ops_malloc.h +index f9ed900..efd8880 100644 +--- a/src/atomic_ops_malloc.h ++++ b/src/atomic_ops_malloc.h +@@ -66,13 +66,13 @@ + # endif + #endif + +-void AO_free(void *); ++AO_API void AO_free(void *); + +-AO_ATTR_MALLOC AO_ATTR_ALLOC_SIZE(1) ++AO_API AO_ATTR_MALLOC AO_ATTR_ALLOC_SIZE(1) + void * AO_malloc(size_t); + + /* Allow use of mmap to grow the heap. No-op on some platforms. */ +-void AO_malloc_enable_mmap(void); ++AO_API void AO_malloc_enable_mmap(void); + + #ifdef __cplusplus + } /* extern "C" */ +diff --git a/src/atomic_ops_stack.c b/src/atomic_ops_stack.c +index c31c7bf..a5ac859 100644 +--- a/src/atomic_ops_stack.c ++++ b/src/atomic_ops_stack.c +@@ -19,6 +19,10 @@ + #include + #include + ++#ifndef AO_BUILD ++# define AO_BUILD ++#endif ++ + #define AO_REQUIRE_CAS + #include "atomic_ops_stack.h" + +@@ -36,7 +40,7 @@ + + #ifdef AO_USE_ALMOST_LOCK_FREE + +- void AO_pause(int); /* defined in atomic_ops.c */ ++ AO_API void AO_pause(int); /* defined in atomic_ops.c */ + + /* LIFO linked lists based on compare-and-swap. We need to avoid */ + /* the case of a node deletion and reinsertion while I'm deleting */ +@@ -58,8 +62,8 @@ + /* to be inserted. */ + /* Both list headers and link fields contain "perturbed" pointers, i.e. */ + /* pointers with extra bits "or"ed into the low order bits. */ +-void AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x, +- AO_stack_aux *a) ++AO_API void AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x, ++ AO_stack_aux *a) + { + AO_t x_bits = (AO_t)x; + AO_t next; +@@ -139,8 +143,8 @@ void AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x, + # define AO_load_next AO_load + #endif + +-AO_t * +-AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux * a) ++AO_API AO_t *AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, ++ AO_stack_aux *a) + { + unsigned i; + int j = 0; +@@ -254,7 +258,7 @@ AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux * a) + volatile /* non-static */ AO_t AO_noop_sink; + #endif + +-void AO_stack_push_release(AO_stack_t *list, AO_t *element) ++AO_API void AO_stack_push_release(AO_stack_t *list, AO_t *element) + { + AO_t next; + +@@ -273,7 +277,7 @@ void AO_stack_push_release(AO_stack_t *list, AO_t *element) + # endif + } + +-AO_t *AO_stack_pop_acquire(AO_stack_t *list) ++AO_API AO_t *AO_stack_pop_acquire(AO_stack_t *list) + { + # if defined(__clang__) && !AO_CLANG_PREREQ(3, 5) + AO_t *volatile cptr; +@@ -307,7 +311,7 @@ AO_t *AO_stack_pop_acquire(AO_stack_t *list) + /* We have a wide CAS, but only does an AO_t-wide comparison. */ + /* We can't use the Treiber optimization, since we only check */ + /* for an unchanged version number, not an unchanged pointer. */ +-void AO_stack_push_release(AO_stack_t *list, AO_t *element) ++AO_API void AO_stack_push_release(AO_stack_t *list, AO_t *element) + { + AO_t version; + +@@ -323,7 +327,7 @@ void AO_stack_push_release(AO_stack_t *list, AO_t *element) + version+1, (AO_t) element)); + } + +-AO_t *AO_stack_pop_acquire(AO_stack_t *list) ++AO_API AO_t *AO_stack_pop_acquire(AO_stack_t *list) + { + AO_t *cptr; + AO_t next; +diff --git a/src/atomic_ops_stack.h b/src/atomic_ops_stack.h +index e03c186..4053071 100644 +--- a/src/atomic_ops_stack.h ++++ b/src/atomic_ops_stack.h +@@ -141,11 +141,11 @@ typedef struct AO__stack_aux { + /* The following two routines should not normally be used directly. */ + /* We make them visible here for the rare cases in which it makes sense */ + /* to share the AO_stack_aux between stacks. */ +-void ++AO_API void + AO_stack_push_explicit_aux_release(volatile AO_t *list, AO_t *x, + AO_stack_aux *); + +-AO_t * ++AO_API AO_t * + AO_stack_pop_explicit_aux_acquire(volatile AO_t *list, AO_stack_aux *); + + /* And now AO_stack_t for the real interface: */ +@@ -213,9 +213,9 @@ AO_INLINE void AO_stack_init(AO_stack_t *list) + #define AO_REAL_HEAD_PTR(x) (AO_t *)((x).AO_val2) + #define AO_REAL_NEXT_PTR(x) (AO_t *)(x) + +-void AO_stack_push_release(AO_stack_t *list, AO_t *new_element); ++AO_API void AO_stack_push_release(AO_stack_t *list, AO_t *new_element); + #define AO_HAVE_stack_push_release +-AO_t * AO_stack_pop_acquire(AO_stack_t *list); ++AO_API AO_t *AO_stack_pop_acquire(AO_stack_t *list); + #define AO_HAVE_stack_pop_acquire + + #endif /* Wide CAS case */ +diff --git a/tests/test_atomic.c b/tests/test_atomic.c +index a301ced..a905308 100644 +--- a/tests/test_atomic.c ++++ b/tests/test_atomic.c +@@ -192,11 +192,12 @@ int test_and_set_test(void) + extern "C" { + # endif + +- void AO_store_full_emulation(volatile AO_t *addr, AO_t val); +- AO_t AO_fetch_compare_and_swap_emulation(volatile AO_t *addr, AO_t old_val, +- AO_t new_val); ++ AO_API void AO_store_full_emulation(volatile AO_t *addr, AO_t val); ++ AO_API AO_t AO_fetch_compare_and_swap_emulation(volatile AO_t *addr, ++ AO_t old_val, AO_t new_val); + # ifdef AO_HAVE_double_t +- int AO_compare_double_and_swap_double_emulation(volatile AO_double_t *, ++ AO_API int ++ AO_compare_double_and_swap_double_emulation(volatile AO_double_t *, + AO_t old_val1, AO_t old_val2, + AO_t new_val1, AO_t new_val2); + # endif diff --git a/recipes/libatomic_ops/all/test_package/CMakeLists.txt b/recipes/libatomic_ops/all/test_package/CMakeLists.txt index 7b9b613cbb24a..2f1810f818b79 100644 --- a/recipes/libatomic_ops/all/test_package/CMakeLists.txt +++ b/recipes/libatomic_ops/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(Atomic_ops CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE Atomic_ops::atomic_ops Atomic_ops::atomic_ops_gpl) diff --git a/recipes/libatomic_ops/all/test_package/conanfile.py b/recipes/libatomic_ops/all/test_package/conanfile.py index 3695635f5e0f5..fde7967ed16f1 100644 --- a/recipes/libatomic_ops/all/test_package/conanfile.py +++ b/recipes/libatomic_ops/all/test_package/conanfile.py @@ -1,10 +1,19 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,5 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin","test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/libatomic_ops/all/test_v1_package/CMakeLists.txt b/recipes/libatomic_ops/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..c7f2e8e2e3a34 --- /dev/null +++ b/recipes/libatomic_ops/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(Atomic_ops CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE Atomic_ops::atomic_ops Atomic_ops::atomic_ops_gpl) diff --git a/recipes/libatomic_ops/all/test_v1_package/conanfile.py b/recipes/libatomic_ops/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/libatomic_ops/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libatomic_ops/config.yml b/recipes/libatomic_ops/config.yml index 5e2c476125265..c989c79eb8c41 100644 --- a/recipes/libatomic_ops/config.yml +++ b/recipes/libatomic_ops/config.yml @@ -1,7 +1,3 @@ versions: - "7.6.10": - folder: all - "7.6.12": - folder: all "7.6.14": folder: all diff --git a/recipes/libavif/all/CMakeLists.txt b/recipes/libavif/all/CMakeLists.txt deleted file mode 100644 index 079f85b3af328..0000000000000 --- a/recipes/libavif/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(libavif_wrapper C) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libavif/all/conandata.yml b/recipes/libavif/all/conandata.yml index 13ca37eae538b..1889bd2ede18f 100644 --- a/recipes/libavif/all/conandata.yml +++ b/recipes/libavif/all/conandata.yml @@ -1,10 +1,20 @@ sources: + "0.11.1": + url: "https://github.com/AOMediaCodec/libavif/archive/refs/tags/v0.11.1.tar.gz" + sha256: "0eb49965562a0e5e5de58389650d434cff32af84c34185b6c9b7b2fccae06d4e" "0.9.3": + url: "https://github.com/AOMediaCodec/libavif/archive/refs/tags/v0.9.3.tar.gz" sha256: "bcd9a1f57f982a9615eb7e2faf87236dc88eb1d0c886f3471c7440ead605060d" - url: https://github.com/AOMediaCodec/libavif/archive/refs/tags/v0.9.3.tar.gz patches: + "0.11.1": + - patch_file: patches/0.11.1-0001-disable-developer-only-codepaths.patch + patch_description: "disable compiler options for develop" + patch_type: "portability" "0.9.3": - - patch_file: patches/0001-disable-developer-only-codepaths.patch - base_path: source_subfolder - - patch_file: patches/0002-fix-libyuv-version-handling.patch - base_path: source_subfolder + - patch_file: patches/0.9.3-0001-disable-developer-only-codepaths.patch + patch_description: "disable compiler options for develop" + patch_type: "portability" + - patch_file: patches/0.9.3-0002-fix-libyuv-version-handling.patch + patch_description: "support libyuv API modification" + patch_type: "backport" + patch_source: "https://github.com/AOMediaCodec/libavif/issues/781" diff --git a/recipes/libavif/all/conanfile.py b/recipes/libavif/all/conanfile.py index 27390af71e2ba..dc46d0267dd99 100644 --- a/recipes/libavif/all/conanfile.py +++ b/recipes/libavif/all/conanfile.py @@ -1,19 +1,19 @@ -import functools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save import os import textwrap -from conans import ConanFile, CMake, tools - -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibAVIFConan(ConanFile): name = "libavif" description = "Library for encoding and decoding .avif files" + license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/AOMediaCodec/libavif" - topics = "avif" - license = "BSD-2-Clause" + topics = ("avif") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,8 +25,9 @@ class LibAVIFConan(ConanFile): "fPIC": True, "with_decoder": "dav1d", } - generators = "cmake", "cmake_find_package_multi" - exports_sources = "CMakeLists.txt", "patches/*" + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -34,53 +35,66 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") @property def _has_dav1d(self): return self.options.with_decoder == "dav1d" def requirements(self): - self.requires("libaom-av1/3.1.2") - self.requires("libyuv/cci.20201106") + self.requires("libaom-av1/3.5.0") + self.requires("libyuv/1854") if self._has_dav1d: - self.requires("dav1d/0.9.1") - - @property - def _source_subfolder(self): - return "source_subfolder" + self.requires("dav1d/1.0.0") def source(self): - root = self._source_subfolder - get_args = self.conan_data["sources"][self.version] - tools.get(**get_args, destination=root, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["AVIF_ENABLE_WERROR"] = False + tc.variables["AVIF_CODEC_AOM"] = True + tc.variables["AVIF_CODEC_DAV1D"] = self.options.with_decoder == "dav1d" + tc.variables["AVIF_CODEC_AOM_DECODE"] = self.options.with_decoder == "aom" + tc.variables["LIBYUV_VERSION"] = self.dependencies["libyuv"].ref.version + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "find_package(libyuv QUIET)", "find_package(libyuv REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "${LIBYUV_LIBRARY}", "libyuv::libyuv") + replace_in_file(self, cmakelists, "find_package(dav1d REQUIRED)", "find_package(dav1d REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "${DAV1D_LIBRARY}", "dav1d::dav1d") + replace_in_file(self, cmakelists, "find_package(aom REQUIRED)", "find_package(libaom-av1 REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "${AOM_LIBRARIES}", "libaom-av1::libaom-av1") - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): + self._patch_sources() cmake = CMake(self) - cmake.definitions["AVIF_CODEC_AOM"] = True - if self._has_dav1d: - cmake.definitions["AVIF_CODEC_DAV1D"] = True - cmake.definitions["AVIF_CODEC_AOM_DECODE"] = False cmake.configure() - return cmake - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - self._configure_cmake().build() + cmake.build() @property def _alias_path(self): return os.path.join("lib", "conan-official-avif-targets.cmake") def package(self): - self.copy("LICENSE", "licenses", self._source_subfolder) - self._configure_cmake().install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # TODO: remove in conan v2 alias = os.path.join(self.package_folder, self._alias_path) @@ -93,7 +107,7 @@ def package(self): ) endif() """) - tools.save(alias, content) + save(self, alias, content) def package_info(self): self.cpp_info.requires = ["libyuv::libyuv", "libaom-av1::libaom-av1"] @@ -103,21 +117,21 @@ def package_info(self): self.cpp_info.libs = ["avif"] if self.options.shared: self.cpp_info.defines = ["AVIF_DLL"] - if self.settings.os != "Windows": - self.cpp_info.system_libs = ["pthread", "m"] - if self.settings.os == "Linux" and self._has_dav1d: + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["pthread", "m"]) + if self._has_dav1d: self.cpp_info.system_libs.append("dl") self.cpp_info.set_property("cmake_file_name", "libavif") self.cpp_info.set_property("cmake_target_name", "avif") + self.cpp_info.set_property("pkg_config_name", "libavif") # TODO: remove in conan v2 self.cpp_info.names["cmake_find_package"] = "avif" self.cpp_info.names["cmake_find_package_multi"] = "avif" self.cpp_info.filenames["cmake_find_package"] = "libavif" self.cpp_info.filenames["cmake_find_package_multi"] = "libavif" - self.cpp_info.build_modules["cmake"] = [self._alias_path] self.cpp_info.build_modules["cmake_find_package"] = [self._alias_path] self.cpp_info.build_modules["cmake_find_package_multi"] = \ [self._alias_path] - self.cpp_info.builddirs = ["lib"] + diff --git a/recipes/libavif/all/patches/0.11.1-0001-disable-developer-only-codepaths.patch b/recipes/libavif/all/patches/0.11.1-0001-disable-developer-only-codepaths.patch new file mode 100644 index 0000000000000..b6e2a81df709c --- /dev/null +++ b/recipes/libavif/all/patches/0.11.1-0001-disable-developer-only-codepaths.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6d9431c..0f3a1b3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -64,11 +64,13 @@ if(AVIF_LOCAL_LIBGAV1) + enable_language(CXX) + endif() + ++if(0) + if(APPLE) + set(XCRUN xcrun) + else() + set(XCRUN) + endif() ++endif() + + # --------------------------------------------------------------------------------------- + # This insanity is for people embedding libavif or making fully static or Windows builds. +@@ -141,6 +143,7 @@ if(AVIF_LOCAL_LIBSHARPYUV) + endif() + # --------------------------------------------------------------------------------------- + ++if(0) + # Enable all warnings + include(CheckCCompilerFlag) + if(CMAKE_C_COMPILER_ID MATCHES "Clang") +@@ -189,6 +192,7 @@ if(AVIF_ENABLE_COVERAGE) + message(WARNING "libavif: Ignoring request for coverage (AVIF_ENABLE_COVERAGE); only clang is currently supported.") + endif() + endif() ++endif() + + set(AVIF_SRCS + src/alpha.c diff --git a/recipes/libavif/all/patches/0001-disable-developer-only-codepaths.patch b/recipes/libavif/all/patches/0.9.3-0001-disable-developer-only-codepaths.patch similarity index 100% rename from recipes/libavif/all/patches/0001-disable-developer-only-codepaths.patch rename to recipes/libavif/all/patches/0.9.3-0001-disable-developer-only-codepaths.patch diff --git a/recipes/libavif/all/patches/0002-fix-libyuv-version-handling.patch b/recipes/libavif/all/patches/0.9.3-0002-fix-libyuv-version-handling.patch similarity index 100% rename from recipes/libavif/all/patches/0002-fix-libyuv-version-handling.patch rename to recipes/libavif/all/patches/0.9.3-0002-fix-libyuv-version-handling.patch diff --git a/recipes/libavif/all/test_package/CMakeLists.txt b/recipes/libavif/all/test_package/CMakeLists.txt index 403b265b00020..b46c3a250bddb 100644 --- a/recipes/libavif/all/test_package/CMakeLists.txt +++ b/recipes/libavif/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS KEEP_RPATHS) +project(test_package LANGUAGES C) find_package(libavif REQUIRED CONFIG) diff --git a/recipes/libavif/all/test_package/conanfile.py b/recipes/libavif/all/test_package/conanfile.py index ec80e0c5cc134..0a6bc68712d90 100644 --- a/recipes/libavif/all/test_package/conanfile.py +++ b/recipes/libavif/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): - settings = ("os", "compiler", "build_type", "arch") - generators = ("cmake", "cmake_find_package_multi") + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libavif/all/test_v1_package/CMakeLists.txt b/recipes/libavif/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libavif/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libavif/all/test_v1_package/conanfile.py b/recipes/libavif/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libavif/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libavif/config.yml b/recipes/libavif/config.yml index 5e19b05d9fa39..f3e6d6038f1fa 100644 --- a/recipes/libavif/config.yml +++ b/recipes/libavif/config.yml @@ -1,3 +1,5 @@ versions: + "0.11.1": + folder: all "0.9.3": folder: all diff --git a/recipes/libavrocpp/all/CMakeLists.txt b/recipes/libavrocpp/all/CMakeLists.txt deleted file mode 100644 index 596a2f6f95b12..0000000000000 --- a/recipes/libavrocpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder/lang/c++) diff --git a/recipes/libavrocpp/all/conandata.yml b/recipes/libavrocpp/all/conandata.yml index 5f1e3ccbae499..4db9766f42d9f 100644 --- a/recipes/libavrocpp/all/conandata.yml +++ b/recipes/libavrocpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.11.1": + url: "https://github.com/apache/avro/archive/release-1.11.1.tar.gz" + sha256: "599f96bb405f72a35154b2477caa6254d723bb4e3f6a0e54e9ae540664321752" "1.11.0": url: "https://github.com/apache/avro/archive/release-1.11.0.tar.gz" sha256: "c205140e7936d552286ba7131122a34e522d66f601ee912f272109d801f89773" @@ -9,30 +12,59 @@ sources: url: "https://github.com/apache/avro/archive/release-1.10.1.tar.gz" sha256: "8fd1f850ce37e60835e6d8335c0027a959aaa316773da8a9660f7d33a66ac142" patches: + "1.11.1": + - patch_file: "patches/0001-add-iterator-include-1-11-0.patch" + patch_description: "include iterator" + patch_type: "portability" + - patch_file: "patches/0002-disable-tests-1-11-1.patch" + patch_description: "disable tests" + patch_type: "conan" + - patch_file: "patches/0003-allow-static-boost-linkage-1-11-0.patch" + patch_description: "remove boost linkage definitions" + patch_type: "conan" + - patch_file: "patches/0004-fix-windows-shared-installation-1-11-1.patch" + patch_description: "fix runtime installation path" + patch_type: "portability" + - patch_file: "patches/0005-fix-breaking-include-1-11-1.patch" + patch_description: "move impl/json/jsonDom.h to api/json" + patch_type: "backport" + patch_source: "https://issues.apache.org/jira/browse/AVRO-3601" "1.11.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-add-iterator-include-1-11-0.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-disable-tests-1-11-0.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-allow-static-boost-linkage-1-11-0.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-fix-windows-shared-installation-1-11-0.patch" + - patch_file: "patches/0001-add-iterator-include-1-11-0.patch" + patch_description: "include iterator" + patch_type: "portability" + - patch_file: "patches/0002-disable-tests-1-11-0.patch" + patch_description: "disable tests" + patch_type: "conan" + - patch_file: "patches/0003-allow-static-boost-linkage-1-11-0.patch" + patch_description: "remove boost linkage definitions" + patch_type: "conan" + - patch_file: "patches/0004-fix-windows-shared-installation-1-11-0.patch" + patch_description: "fix runtime installation path" + patch_type: "portability" "1.10.2": - - base_path: "source_subfolder" - patch_file: "patches/0001-add-iterator-include.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-disable-tests-1-10-2.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-allow-static-boost-linkage.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-fix-windows-shared-installation-1-10-2.patch" + - patch_file: "patches/0001-add-iterator-include.patch" + patch_description: "include iterator" + patch_type: "portability" + - patch_file: "patches/0002-disable-tests-1-10-2.patch" + patch_description: "disable tests" + patch_type: "conan" + - patch_file: "patches/0003-allow-static-boost-linkage.patch" + patch_description: "remove boost linkage definitions" + patch_type: "conan" + - patch_file: "patches/0004-fix-windows-shared-installation-1-10-2.patch" + patch_description: "fix runtime installation path" + patch_type: "portability" "1.10.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-add-iterator-include.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-disable-tests-1-10-1.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-allow-static-boost-linkage.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-fix-windows-shared-installation-1-10-1.patch" + - patch_file: "patches/0001-add-iterator-include.patch" + patch_description: "include iterator" + patch_type: "portability" + - patch_file: "patches/0002-disable-tests-1-10-1.patch" + patch_description: "disable tests" + patch_type: "conan" + - patch_file: "patches/0003-allow-static-boost-linkage.patch" + patch_description: "remove boost linkage definitions" + patch_type: "conan" + - patch_file: "patches/0004-fix-windows-shared-installation-1-10-1.patch" + patch_description: "fix runtime installation path" + patch_type: "portability" diff --git a/recipes/libavrocpp/all/conanfile.py b/recipes/libavrocpp/all/conanfile.py index 9056fdb84fb51..d9c7f619040a6 100644 --- a/recipes/libavrocpp/all/conanfile.py +++ b/recipes/libavrocpp/all/conanfile.py @@ -1,41 +1,36 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -import functools -from conans import ConanFile, CMake, tools +required_conan_version = ">=1.54.0" -required_conan_version = ">=1.33.0" class LibavrocppConan(ConanFile): name = "libavrocpp" + description = "Avro is a data serialization system." license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" - description = "Avro is a data serialization system." homepage = "https://avro.apache.org/" - topics = ("serialization", "deserialization") - generators = "cmake", "cmake_find_package" + topics = ("serialization", "deserialization","avro") settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], + "shared": [True, False], "fPIC": [True, False] } default_options = { - "shared": False, + "shared": False, "fPIC": True } short_paths = True @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,54 +38,67 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "11") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.78.0") + self.requires("boost/1.81.0") self.requires("snappy/1.1.9") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.replace_in_file( - os.path.join(os.path.join(self._source_subfolder, "lang", "c++"), "CMakeLists.txt"), - "${SNAPPY_LIBRARIES}", "${Snappy_LIBRARIES}" + apply_conandata_patches(self) + cmakelists = os.path.join(self.source_folder, "lang", "c++", "CMakeLists.txt") + # Fix discovery & link to Snappy + replace_in_file(self, cmakelists, "SNAPPY_FOUND", "Snappy_FOUND") + replace_in_file(self, cmakelists, "${SNAPPY_LIBRARIES}", "Snappy::snappy") + replace_in_file( + self, cmakelists, + "target_include_directories(avrocpp_s PRIVATE ${SNAPPY_INCLUDE_DIR})", + "target_link_libraries(avrocpp_s PRIVATE Snappy::snappy)", ) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["SNAPPY_ROOT_DIR"] = self.deps_cpp_info["snappy"].rootpath.replace("\\", "/") - cmake.configure() - return cmake + # Install either static or shared + target = "avrocpp" if self.options.shared else "avrocpp_s" + replace_in_file(self, cmakelists, "install (TARGETS avrocpp avrocpp_s" , f"install (TARGETS {target}") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "lang", "c++")) cmake.build() def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - self.copy("NOTICE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="NOTICE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() if self.settings.os == "Windows": for dll_pattern_to_remove in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: - tools.remove_files_by_mask(self.package_folder, dll_pattern_to_remove) + rm(self, dll_pattern_to_remove, os.path.join(self.package_folder, "bin")) def package_info(self): - # FIXME: avro does not install under a CMake namespace https://github.com/apache/avro/blob/351f589913b9691322966fb77fe72269a0a2ec82/lang/c%2B%2B/CMakeLists.txt#L193 - target = "avrocpp" if self.options.shared else "avrocpp_s" - self.cpp_info.components[target].libs = [target] - self.cpp_info.components[target].requires = ["boost::boost", "snappy::snappy"] + self.cpp_info.libs = ["avrocpp" if self.options.shared else "avrocpp_s"] if self.options.shared: - self.cpp_info.components[target].defines.append("AVRO_DYN_LINK") + self.cpp_info.defines.append("AVRO_DYN_LINK") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.requires = [ + "boost::headers", "boost::filesystem", "boost::iostreams", "boost::program_options", + "boost::regex", "boost::system", "snappy::snappy", + ] diff --git a/recipes/libavrocpp/all/patches/0002-disable-tests-1-11-1.patch b/recipes/libavrocpp/all/patches/0002-disable-tests-1-11-1.patch new file mode 100644 index 0000000000000..a1505a597e4da --- /dev/null +++ b/recipes/libavrocpp/all/patches/0002-disable-tests-1-11-1.patch @@ -0,0 +1,30 @@ +diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt +index 6098613..c27fab7 100644 +--- a/lang/c++/CMakeLists.txt ++++ b/lang/c++/CMakeLists.txt +@@ -171,10 +171,6 @@ target_link_libraries (avrogencpp avrocpp_s ${Boost_LIBRARIES} ${SNAPPY_LIBRARIE + enable_testing() + + macro (unittest name) +- add_executable (${name} test/${name}.cc) +- target_link_libraries (${name} avrocpp ${Boost_LIBRARIES} ${SNAPPY_LIBRARIES}) +- add_test (NAME ${name} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} +- COMMAND ${CMAKE_CURRENT_BINARY_DIR}/${name}) + endmacro (unittest) + + unittest (buffertest) +@@ -190,14 +186,6 @@ unittest (AvrogencppTests) + unittest (CompilerTests) + unittest (AvrogencppTestReservedWords) + +-add_dependencies (AvrogencppTestReservedWords cpp_reserved_words_hh) +- +-add_dependencies (AvrogencppTests bigrecord_hh bigrecord_r_hh bigrecord2_hh +- tweet_hh +- union_array_union_hh union_map_union_hh union_conflict_hh +- recursive_hh reuse_hh circulardep_hh tree1_hh tree2_hh crossref_hh +- primitivetypes_hh empty_record_hh) +- + include (InstallRequiredSystemLibraries) + + set (CPACK_PACKAGE_FILE_NAME "avrocpp-${AVRO_VERSION_MAJOR}") diff --git a/recipes/libavrocpp/all/patches/0004-fix-windows-shared-installation-1-11-1.patch b/recipes/libavrocpp/all/patches/0004-fix-windows-shared-installation-1-11-1.patch new file mode 100644 index 0000000000000..842c3ca3ec866 --- /dev/null +++ b/recipes/libavrocpp/all/patches/0004-fix-windows-shared-installation-1-11-1.patch @@ -0,0 +1,13 @@ +diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt +index 5ceb045..e19b5a9 100644 +--- a/lang/c++/CMakeLists.txt ++++ b/lang/c++/CMakeLists.txt +@@ -190,7 +190,7 @@ include (CPack) + install (TARGETS avrocpp avrocpp_s + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib +- RUNTIME DESTINATION lib) ++ RUNTIME DESTINATION bin) + + install (TARGETS avrogencpp RUNTIME DESTINATION bin) + diff --git a/recipes/libavrocpp/all/patches/0005-fix-breaking-include-1-11-1.patch b/recipes/libavrocpp/all/patches/0005-fix-breaking-include-1-11-1.patch new file mode 100644 index 0000000000000..778bdf6bbbdab --- /dev/null +++ b/recipes/libavrocpp/all/patches/0005-fix-breaking-include-1-11-1.patch @@ -0,0 +1,473 @@ +diff --git a/lang/c++/CMakeLists.txt b/lang/c++/CMakeLists.txt +index e19b5a9..0249c37 100644 +--- a/lang/c++/CMakeLists.txt ++++ b/lang/c++/CMakeLists.txt +@@ -106,7 +106,7 @@ set (AVRO_SOURCE_FILES + impl/json/JsonIO.cc + impl/json/JsonDom.cc + impl/Resolver.cc impl/Validator.cc +- impl/CustomFields.cc ++ impl/CustomAttributes.cc + ) + + add_library (avrocpp SHARED ${AVRO_SOURCE_FILES}) +diff --git b/lang/c++/api/CustomAttributes.hh b/lang/c++/api/CustomAttributes.hh +new file mode 100644 +index 0000000..2bd572c +--- /dev/null ++++ b/lang/c++/api/CustomAttributes.hh +@@ -0,0 +1,55 @@ ++/* ++ * Licensed to the Apache Software Foundation (ASF) under one ++ * or more contributor license agreements. See the NOTICE file ++ * distributed with this work for additional information ++ * regarding copyright ownership. The ASF licenses this file ++ * to you under the Apache License, Version 2.0 (the ++ * "License"); you may not use this file except in compliance ++ * with the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++ ++#ifndef avro_CustomAttributes_hh__ ++#define avro_CustomAttributes_hh__ ++ ++#include ++#include ++#include ++#include "Config.hh" ++ ++namespace avro { ++ ++// CustomAttributes class stores avro custom attributes. ++// Each attribute is represented by a unique name and value. ++// User is supposed to create CustomAttributes object and then add it to Schema. ++class AVRO_DECL CustomAttributes { ++ public: ++ // Retrieves the custom attribute json entity for that attributeName, returns an ++ // null if the attribute doesn't exist. ++ std::string getAttribute(const std::string &name) const; ++ ++ // Adds a custom attribute. If the attribute already exists, throw an exception. ++ void addAttribute(const std::string &name, const std::string &value); ++ ++ // Provides a way to iterate over the custom attributes or check attribute size. ++ const std::map &attributes() const { ++ return attributes_; ++ } ++ ++ // Prints the attribute value for the specific attribute. ++ void printJson(std::ostream& os, const std::string &name) const; ++ ++ private: ++ std::map attributes_; ++}; ++ ++} // namespace avro ++ ++#endif +diff --git a/lang/c++/api/CustomFields.hh a/lang/c++/api/CustomFields.hh +deleted file mode 100644 +index 01468ff..0000000 +--- a/lang/c++/api/CustomFields.hh ++++ /dev/null +@@ -1,55 +0,0 @@ +-/* +- * Licensed to the Apache Software Foundation (ASF) under one +- * or more contributor license agreements. See the NOTICE file +- * distributed with this work for additional information +- * regarding copyright ownership. The ASF licenses this file +- * to you under the Apache License, Version 2.0 (the +- * "License"); you may not use this file except in compliance +- * with the License. You may obtain a copy of the License at +- * +- * http://www.apache.org/licenses/LICENSE-2.0 +- * +- * Unless required by applicable law or agreed to in writing, software +- * distributed under the License is distributed on an "AS IS" BASIS, +- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- * See the License for the specific language governing permissions and +- * limitations under the License. +- */ +- +-#ifndef avro_CustomFields_hh__ +-#define avro_CustomFields_hh__ +- +-#include +- +-#include "../impl/json/JsonDom.hh" +- +-namespace avro { +- +-// CustomFields class stores avro custom attributes. +-// Each field is represented by a unique name and value. +-// User is supposed to create CustomFields object and then add it to Schema. +-class AVRO_DECL CustomFields { +- public: +- // Retrieves the custom field json entity for that fieldName, returns an +- // null Entity if the field doesn't exist. +- json::Entity getField(const std::string &fieldName) const; +- +- // Adds a custom field. If the field already exists, throw an exception. +- void addField(const std::string &fieldName, const json::Entity &fieldValue); +- void addField(const std::string &fieldName, const std::string &fieldValue); +- +- // Provides a way to iterate over the custom fields or check field size. +- const std::map &fields() const { +- return fields_; +- } +- +- // Prints the json string for the specific field. +- void printJson(std::ostream& os, const std::string &fieldName) const; +- +- private: +- std::map fields_; +-}; +- +-} // namespace avro +- +-#endif +diff --git a/lang/c++/api/Node.hh b/lang/c++/api/Node.hh +index c9af126..3f5fe5b 100644 +--- a/lang/c++/api/Node.hh ++++ b/lang/c++/api/Node.hh +@@ -26,7 +26,7 @@ + #include + #include + +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + #include "Exception.hh" + #include "LogicalType.hh" + #include "SchemaResolution.hh" +@@ -154,7 +154,7 @@ public: + } + virtual size_t fixedSize() const = 0; + +- void addCustomAttributesForField(const CustomFields& customAttributes) { ++ void addCustomAttributesForField(const CustomAttributes& customAttributes) { + checkLock(); + doAddCustomAttribute(customAttributes); + } +@@ -191,7 +191,7 @@ protected: + virtual void doAddLeaf(const NodePtr &newLeaf) = 0; + virtual void doAddName(const std::string &name) = 0; + virtual void doSetFixedSize(size_t size) = 0; +- virtual void doAddCustomAttribute(const CustomFields& customFields) = 0; ++ virtual void doAddCustomAttribute(const CustomAttributes& customAttributes) = 0; + + private: + const Type type_; +diff --git a/lang/c++/api/NodeImpl.hh b/lang/c++/api/NodeImpl.hh +index 62e62eb..bf0e352 100644 +--- a/lang/c++/api/NodeImpl.hh ++++ b/lang/c++/api/NodeImpl.hh +@@ -32,7 +32,7 @@ + + #include "Node.hh" + #include "NodeConcepts.hh" +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + + namespace avro { + +@@ -160,8 +160,8 @@ protected: + + void setLeafToSymbolic(size_t index, const NodePtr &node) override; + +- void doAddCustomAttribute(const CustomFields &customfields) override { +- customAttributes_.add(customfields); ++ void doAddCustomAttribute(const CustomAttributes &customAttributes) override { ++ customAttributes_.add(customAttributes); + } + + SchemaResolution furtherResolution(const Node &reader) const { +@@ -223,8 +223,8 @@ using MultiLeaves = concepts::MultiAttribute; + + using NoLeafNames = concepts::NoAttribute; + using LeafNames = concepts::MultiAttribute; +-using MultiAttributes = concepts::MultiAttribute; +-using NoAttributes = concepts::NoAttribute; ++using MultiAttributes = concepts::MultiAttribute; ++using NoAttributes = concepts::NoAttribute; + + using NoSize = concepts::NoAttribute; + using HasSize = concepts::SingleAttribute; +diff --git a/lang/c++/api/Schema.hh b/lang/c++/api/Schema.hh +index fa50481..b0d1e39 100644 +--- a/lang/c++/api/Schema.hh ++++ b/lang/c++/api/Schema.hh +@@ -21,7 +21,7 @@ + + #include "Config.hh" + #include "NodeImpl.hh" +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + #include + + /// \file +@@ -103,7 +103,7 @@ public: + void addField(const std::string &name, const Schema &fieldSchema); + // Add a field with custom attributes + void addField(const std::string &name, const Schema &fieldSchema, +- const CustomFields &customFields); ++ const CustomAttributes &customFields); + + std::string getDoc() const; + void setDoc(const std::string &); +diff --git a/lang/c++/impl/Compiler.cc b/lang/c++/impl/Compiler.cc +index 014229e..383798c 100644 +--- a/lang/c++/impl/Compiler.cc ++++ b/lang/c++/impl/Compiler.cc +@@ -21,7 +21,7 @@ + #include + + #include "Compiler.hh" +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + #include "NodeConcepts.hh" + #include "Schema.hh" + #include "Stream.hh" +@@ -149,8 +149,8 @@ struct Field { + const string name; + const NodePtr schema; + const GenericDatum defaultValue; +- const CustomFields customFields; +- Field(string n, NodePtr v, GenericDatum dv, const CustomFields& cf) : name(std::move(n)), schema(std::move(v)), defaultValue(std::move(dv)), customFields(std::move(cf)) {} ++ const CustomAttributes customAttributes; ++ Field(string n, NodePtr v, GenericDatum dv, const CustomAttributes& ca) : name(std::move(n)), schema(std::move(v)), defaultValue(std::move(dv)), customAttributes(std::move(ca)) {} + }; + + static void assertType(const Entity &e, EntityType et) { +@@ -268,14 +268,14 @@ static const std::unordered_set& getKnownFields() { + return kKnownFields; + } + +-static void getCustomAttributes(const Object& m, CustomFields &customAttributes) ++static void getCustomAttributes(const Object& m, CustomAttributes &customAttributes) + { + // Don't add known fields on primitive type and fixed type into custom + // fields. + const std::unordered_set& kKnownFields = getKnownFields(); + for (const auto &entry : m) { + if (kKnownFields.find(entry.first) == kKnownFields.end()) { +- customAttributes.addField(entry.first, entry.second); ++ customAttributes.addAttribute(entry.first, entry.second.stringValue()); + } + } + } +@@ -291,7 +291,7 @@ static Field makeField(const Entity &e, SymbolTable &st, const string &ns) { + } + GenericDatum d = (it2 == m.end()) ? GenericDatum() : makeGenericDatum(node, it2->second, st); + // Get custom attributes +- CustomFields customAttributes; ++ CustomAttributes customAttributes; + getCustomAttributes(m, customAttributes); + + return Field(n, node, d, customAttributes); +@@ -304,7 +304,7 @@ static NodePtr makeRecordNode(const Entity &e, const Name &name, + const Array &v = getArrayField(e, m, "fields"); + concepts::MultiAttribute fieldNames; + concepts::MultiAttribute fieldValues; +- concepts::MultiAttribute customAttributes; ++ concepts::MultiAttribute customAttributes; + vector defaultValues; + + for (const auto &it : v) { +@@ -312,7 +312,7 @@ static NodePtr makeRecordNode(const Entity &e, const Name &name, + fieldNames.add(f.name); + fieldValues.add(f.schema); + defaultValues.push_back(f.defaultValue); +- customAttributes.add(f.customFields); ++ customAttributes.add(f.customAttributes); + } + NodeRecord *node; + if (doc == nullptr) { +diff --git b/lang/c++/impl/CustomAttributes.cc b/lang/c++/impl/CustomAttributes.cc +new file mode 100644 +index 0000000..bb56438 +--- /dev/null ++++ b/lang/c++/impl/CustomAttributes.cc +@@ -0,0 +1,51 @@ ++ ++/** ++ * Licensed to the Apache Software Foundation (ASF) under one ++ * or more contributor license agreements. See the NOTICE file ++ * distributed with this work for additional information ++ * regarding copyright ownership. The ASF licenses this file ++ * to you under the Apache License, Version 2.0 (the ++ * "License"); you may not use this file except in compliance ++ * with the License. You may obtain a copy of the License at ++ * ++ * http://www.apache.org/licenses/LICENSE-2.0 ++ * ++ * Unless required by applicable law or agreed to in writing, software ++ * distributed under the License is distributed on an "AS IS" BASIS, ++ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ++ * See the License for the specific language governing permissions and ++ * limitations under the License. ++ */ ++#include "CustomAttributes.hh" ++#include ++#include ++#include "Exception.hh" ++ ++namespace avro { ++ ++std::string CustomAttributes::getAttribute(const std::string &name) const { ++ std::map::const_iterator iter = ++ attributes_.find(name); ++ if (iter == attributes_.end()) { ++ return NULL; ++ } ++ return iter->second; ++} ++ ++void CustomAttributes::addAttribute(const std::string& name, ++ const std::string& value) { ++ auto iter_and_find = ++ attributes_.insert(std::pair(name, value)); ++ if (!iter_and_find.second) { ++ throw Exception(name + " already exists and cannot be added"); ++ } ++} ++ ++void CustomAttributes::printJson(std::ostream& os, ++ const std::string& name) const { ++ if (attributes().find(name) == attributes().end()) { ++ throw Exception(name + " doesn't exist"); ++ } ++ os << "\"" << name << "\": \"" << attributes().at(name) << "\""; ++} ++} // namespace avro +diff --git a/lang/c++/impl/CustomFields.cc a/lang/c++/impl/CustomFields.cc +deleted file mode 100644 +index 04541da..0000000 +--- a/lang/c++/impl/CustomFields.cc ++++ /dev/null +@@ -1,59 +0,0 @@ +- +-/** +- * Licensed to the Apache Software Foundation (ASF) under one +- * or more contributor license agreements. See the NOTICE file +- * distributed with this work for additional information +- * regarding copyright ownership. The ASF licenses this file +- * to you under the Apache License, Version 2.0 (the +- * "License"); you may not use this file except in compliance +- * with the License. You may obtain a copy of the License at +- * +- * http://www.apache.org/licenses/LICENSE-2.0 +- * +- * Unless required by applicable law or agreed to in writing, software +- * distributed under the License is distributed on an "AS IS" BASIS, +- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +- * See the License for the specific language governing permissions and +- * limitations under the License. +- */ +-#include "CustomFields.hh" +-#include +-#include +-#include "Exception.hh" +- +-namespace avro { +- +-using json::Entity; +- +-Entity CustomFields::getField(const std::string &fieldName) const { +- std::map::const_iterator iter = +- fields_.find(fieldName); +- if (iter == fields_.end()) { +- return Entity(); +- } +- return iter->second; +-} +- +-void CustomFields::addField(const std::string& fieldName, +- const std::string& fieldValue) { +- addField(fieldName, +- json::Entity(std::make_shared(fieldValue))); +-} +- +-void CustomFields::addField(const std::string& fieldName, +- const Entity& fieldValue) { +- auto iter_and_find = +- fields_.insert(std::pair(fieldName, fieldValue)); +- if (!iter_and_find.second) { +- throw Exception(fieldName + " already exists and cannot be added"); +- } +-} +- +-void CustomFields::printJson(std::ostream& os, +- const std::string& fieldName) const { +- if (fields_.find(fieldName) == fields_.end()) { +- throw Exception(fieldName + " doesn't exist"); +- } +- os << "\"" << fieldName << "\": " << fields_.at(fieldName).toString(); +-} +-} // namespace avro +diff --git a/lang/c++/impl/NodeImpl.cc b/lang/c++/impl/NodeImpl.cc +index 37c8555..5549c68 100644 +--- a/lang/c++/impl/NodeImpl.cc ++++ b/lang/c++/impl/NodeImpl.cc +@@ -83,13 +83,13 @@ std::ostream &operator<<(std::ostream &os, indent x) { + return os; + } + +-void printCustomFields(const CustomFields& customFields, int depth, ++void printCustomAttributes(const CustomAttributes& customAttributes, int depth, + std::ostream &os) { +- std::map::const_iterator iter = +- customFields.fields().begin(); +- while (iter != customFields.fields().end()) { ++ std::map::const_iterator iter = ++ customAttributes.attributes().begin(); ++ while (iter != customAttributes.attributes().end()) { + os << ",\n" << indent(depth); +- customFields.printJson(os, iter->first); ++ customAttributes.printJson(os, iter->first); + ++iter; + } + } +@@ -287,7 +287,7 @@ void NodeRecord::printJson(std::ostream &os, size_t depth) const { + } + } + if(customAttributes_.size() == fields) { +- printCustomFields(customAttributes_.get(i), depth, os); ++ printCustomAttributes(customAttributes_.get(i), depth, os); + } + os << '\n'; + os << indent(--depth) << '}'; +diff --git a/lang/c++/impl/Schema.cc b/lang/c++/impl/Schema.cc +index fa90d34..3315f25 100644 +--- a/lang/c++/impl/Schema.cc ++++ b/lang/c++/impl/Schema.cc +@@ -19,7 +19,7 @@ + #include + + #include "Schema.hh" +-#include "CustomFields.hh" ++#include "CustomAttributes.hh" + + namespace avro { + +@@ -28,11 +28,11 @@ RecordSchema::RecordSchema(const std::string &name) : Schema(new NodeRecord) { + } + + void RecordSchema::addField(const std::string &name, const Schema &fieldSchema) { +- const CustomFields emptyCustomField; +- addField(name, fieldSchema, emptyCustomField); ++ const CustomAttributes emptyCustomAttribute; ++ addField(name, fieldSchema, emptyCustomAttribute); + } + +-void RecordSchema::addField(const std::string &name, const Schema &fieldSchema, const CustomFields &customFields) { ++void RecordSchema::addField(const std::string &name, const Schema &fieldSchema, const CustomAttributes &customFields) { + // add the name first. it will throw if the name is a duplicate, preventing + // the leaf from being added + node_->addName(name); diff --git a/recipes/libavrocpp/all/test_package/CMakeLists.txt b/recipes/libavrocpp/all/test_package/CMakeLists.txt index 68d787b464e8d..d86e652771773 100644 --- a/recipes/libavrocpp/all/test_package/CMakeLists.txt +++ b/recipes/libavrocpp/all/test_package/CMakeLists.txt @@ -1,16 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(libavrocpp REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - -if(TARGET libavrocpp::avrocpp) - target_link_libraries(${PROJECT_NAME} libavrocpp::avrocpp) -else() - target_link_libraries(${PROJECT_NAME} libavrocpp::avrocpp_s) -endif() +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libavrocpp::libavrocpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libavrocpp/all/test_package/conanfile.py b/recipes/libavrocpp/all/test_package/conanfile.py index 75634e62bcb66..e845ae751a301 100644 --- a/recipes/libavrocpp/all/test_package/conanfile.py +++ b/recipes/libavrocpp/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libavrocpp/all/test_v1_package/CMakeLists.txt b/recipes/libavrocpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libavrocpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libavrocpp/all/test_v1_package/conanfile.py b/recipes/libavrocpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/libavrocpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libavrocpp/config.yml b/recipes/libavrocpp/config.yml index ed319d069e486..9fcb2d236146c 100644 --- a/recipes/libavrocpp/config.yml +++ b/recipes/libavrocpp/config.yml @@ -1,4 +1,6 @@ versions: + 1.11.1: + folder: all 1.11.0: folder: all 1.10.2: diff --git a/recipes/libbacktrace/all/conandata.yml b/recipes/libbacktrace/all/conandata.yml index 1357c342647ac..56d79ce7402eb 100644 --- a/recipes/libbacktrace/all/conandata.yml +++ b/recipes/libbacktrace/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "cci.20210118": - patch_file: "patches/0001-pointer-arithmetic.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-msvc-unistd-alternative.patch" - base_path: "source_subfolder" diff --git a/recipes/libbacktrace/all/conanfile.py b/recipes/libbacktrace/all/conanfile.py index 33119b46895be..2fa71b8e36228 100644 --- a/recipes/libbacktrace/all/conanfile.py +++ b/recipes/libbacktrace/all/conanfile.py @@ -1,11 +1,14 @@ -from conan.tools.files import rename -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import contextlib -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class LibbacktraceConan(ConanFile): @@ -15,6 +18,7 @@ class LibbacktraceConan(ConanFile): homepage = "https://github.com/ianlancetaylor/libbacktrace" license = "BSD-3-Clause" topics = ("backtrace", "stack-trace") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,21 +29,12 @@ class LibbacktraceConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -47,82 +42,67 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self._is_msvc and self.options.shared: + check_min_vs(self, "180") + if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration("libbacktrace shared is not supported with Visual Studio") def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - if self._is_msvc: - self.build_requires("automake/1.16.4") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("automake/1.16.5") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - - @contextlib.contextmanager - def _build_context(self): - if self._is_msvc: - with tools.vcvars(self): - env = { - "CC": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "CXX": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "LD": "{} link -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "AR": "{} lib".format(tools.unix_path(self._user_info_build["automake"].ar_lib)), - } - with tools.environment_append(env): - yield - else: - yield - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - if (self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) >= "12") or \ - str(self.settings.compiler) == "msvc": - autotools.flags.append("-FS") - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - autotools.configure(args=args, configure_dir=self._source_subfolder) - return autotools - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # relocatable shared lib on macOS - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "-install_name \\$rpath/", - "-install_name @rpath/") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + if is_msvc(self): + # https://github.com/conan-io/conan/issues/6514 + tc.extra_cflags.append("-FS") + env = tc.environment() + if is_msvc(self): + compile_wrapper = unix_path(self, self.conf.get("user.automake:compile-wrapper")) + ar_wrapper = unix_path(self, self.conf.get("user.automake:lib-wrapper")) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + tc.generate(env) def build(self): - self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() lib_folder = os.path.join(self.package_folder, "lib") - if self._is_msvc: + rm(self, "*.la", lib_folder) + fix_apple_shared_install_name(self) + if is_msvc(self): rename(self, os.path.join(lib_folder, "libbacktrace.lib"), os.path.join(lib_folder, "backtrace.lib")) - tools.remove_files_by_mask(lib_folder, "*.la") def package_info(self): self.cpp_info.libs = ["backtrace"] diff --git a/recipes/libbacktrace/all/test_package/CMakeLists.txt b/recipes/libbacktrace/all/test_package/CMakeLists.txt index 5d15b4b693da0..81b50a3407418 100644 --- a/recipes/libbacktrace/all/test_package/CMakeLists.txt +++ b/recipes/libbacktrace/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libbacktrace REQUIRED CONFIG) add_executable(test_package test_package.c) -target_link_libraries(test_package libbacktrace::libbacktrace) +target_link_libraries(test_package PRIVATE libbacktrace::libbacktrace) diff --git a/recipes/libbacktrace/all/test_package/conanfile.py b/recipes/libbacktrace/all/test_package/conanfile.py index 5c8041d4e1827..0a6bc68712d90 100644 --- a/recipes/libbacktrace/all/test_package/conanfile.py +++ b/recipes/libbacktrace/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libbacktrace/all/test_v1_package/CMakeLists.txt b/recipes/libbacktrace/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libbacktrace/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libbacktrace/all/test_v1_package/conanfile.py b/recipes/libbacktrace/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e0a85886fc12c --- /dev/null +++ b/recipes/libbacktrace/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import CMake, ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libbigwig/all/conandata.yml b/recipes/libbigwig/all/conandata.yml new file mode 100644 index 0000000000000..e1b88454d66c1 --- /dev/null +++ b/recipes/libbigwig/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.4.7": + sha256: 8e057797011d93fa00e756600898af4fe6ca2d48959236efc9f296abe94916d9 + url: https://github.com/dpryan79/libBigWig/archive/refs/tags/0.4.7.tar.gz diff --git a/recipes/libbigwig/all/conanfile.py b/recipes/libbigwig/all/conanfile.py new file mode 100644 index 0000000000000..7caf0f129e795 --- /dev/null +++ b/recipes/libbigwig/all/conanfile.py @@ -0,0 +1,104 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import collect_libs, get, copy +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.50.0" + + +class LibBigWigConan(ConanFile): + name = "libbigwig" + description = "A C library for handling bigWig files" + topics = ("bioinformatics", "bigwig", "bigbed") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/dpryan79/libBigWig" + license = "MIT" + settings = "arch", "build_type", "compiler", "os" + + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_curl": [True, False], + "with_zlibng": [True, False] + } + + default_options = { + "shared": False, + "fPIC": True, + "with_curl": False, + "with_zlibng": False + } + + def configure(self): + if self.options.shared: + del self.options.fPIC + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_curl: + self.requires("libcurl/7.85.0") + if self.options.with_zlibng: + self.requires("zlib-ng/2.0.6") + else: + self.requires("zlib/1.2.12") + + def validate(self): + if self.info.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} is not supported on Windows.") + + if self.info.options.with_zlibng: + zlib_ng = self.dependencies["zlib-ng"] + if not zlib_ng.options.zlib_compat: + raise ConanInvalidConfiguration(f"{self.ref} requires the dependency option zlib-ng:zlib_compat=True") + + if self.options.with_curl: + libcurl = self.dependencies["libcurl"] + if libcurl.options.with_imap or libcurl.options.with_pop3 or libcurl.options.with_smtp: + raise ConanInvalidConfiguration(f"{self.ref} requires libcurl using the follow options: -o libcurl:with_imap=False -o libcurl:with_pop3=False -o libcurl:with_smtp=False") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_TESTING"] = False + tc.variables["WITH_CURL"] = self.options.with_curl + tc.variables["WITH_ZLIBNG"] = self.options.with_zlibng + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" # honor BUILD_SHARED_LIBS + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["BigWig"] + self.cpp_info.system_libs = ["m"] + self.cpp_info.set_property("cmake_file_name", "BigWig") + self.cpp_info.set_property("cmake_target_name", "BigWig::BigWig") + + if not self.options.with_curl: + self.cpp_info.defines = ["NOCURL"] + + # TODO: Remove in Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "BigWig" + self.cpp_info.names["cmake_find_package_multi"] = "BigWig" diff --git a/recipes/libbigwig/all/test_package/CMakeLists.txt b/recipes/libbigwig/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..7a790b50c498a --- /dev/null +++ b/recipes/libbigwig/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package C) + +find_package(BigWig REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE BigWig::BigWig) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_11) diff --git a/recipes/libbigwig/all/test_package/conanfile.py b/recipes/libbigwig/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8a6b7483b895d --- /dev/null +++ b/recipes/libbigwig/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +import os +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run + + +class TestPackageConan(ConanFile): + settings = "arch", "build_type", "compiler", "os" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libbigwig/all/test_package/test_package.c b/recipes/libbigwig/all/test_package/test_package.c new file mode 100644 index 0000000000000..7bf2175d15e63 --- /dev/null +++ b/recipes/libbigwig/all/test_package/test_package.c @@ -0,0 +1,15 @@ +#include +#include "libbigwig/bigWig.h" + + +int main(void) { + bigWigFile_t *fp = NULL; + + bwInit(1<<17); + fp = bwOpen("test_package.bw", NULL, "w"); + bwCreateHdr(fp, 10); + bwClose(fp); + bwCleanup(); + + return EXIT_SUCCESS; +} diff --git a/recipes/libbigwig/all/test_v1_package/CMakeLists.txt b/recipes/libbigwig/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0ef441c1d3786 --- /dev/null +++ b/recipes/libbigwig/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(BigWig REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE BigWig::BigWig) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_11) diff --git a/recipes/libbigwig/all/test_v1_package/conanfile.py b/recipes/libbigwig/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..fe504f17122b3 --- /dev/null +++ b/recipes/libbigwig/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +import os + +from conans import ConanFile, CMake +from conan.tools.build import cross_building + + +class TestPackageConan(ConanFile): + settings = "arch", "build_type", "compiler", "os" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libbigwig/config.yml b/recipes/libbigwig/config.yml new file mode 100644 index 0000000000000..0435ca37310c1 --- /dev/null +++ b/recipes/libbigwig/config.yml @@ -0,0 +1,3 @@ +versions: + "0.4.7": + folder: all diff --git a/recipes/libbpf/all/conandata.yml b/recipes/libbpf/all/conandata.yml index 80547c38b8b06..dced81ebf510c 100644 --- a/recipes/libbpf/all/conandata.yml +++ b/recipes/libbpf/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.7.0": + url: "https://github.com/libbpf/libbpf/archive/refs/tags/v0.7.0.tar.gz" + sha256: "5083588ce5a3a620e395ee1e596af77b4ec5771ffc71cff2af49dfee38c06361" "0.5.0": url: "https://github.com/libbpf/libbpf/archive/v0.5.0.tar.gz" sha256: "d5b27980ceab9a80b6f28d3e67b51cea526fda49bd13151ba966e33548feb4f4" diff --git a/recipes/libbpf/all/conanfile.py b/recipes/libbpf/all/conanfile.py index 0141cfa6106e4..fcb6be22798a8 100644 --- a/recipes/libbpf/all/conanfile.py +++ b/recipes/libbpf/all/conanfile.py @@ -1,89 +1,91 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, rm, rmdir, chdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.54.0" class LibbpfConan(ConanFile): name = "libbpf" description = "eBPF helper library" + license = "LGPL-2.1-only", "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/libbpf/libbpf" - license = "LGPL-2.1", "BSD-2-Clause" - topics = ("bpf", "ebpf", "libbpf", "berkeley-packet-filter") - generators = "pkg_config" + topics = ("berkeley-packet-filter", "bpf", "ebpf", "network", "tracing") settings = "os", "arch", "compiler", "build_type" - - _autotools = None - options = { "shared": [True, False], "fPIC": [True, False] } - default_options = { "shared": False, "fPIC": True } - @property - def _source_subfolder(self): - return "source_subfolder" + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC - def build_requirements(self): - self.build_requires("make/4.2.1") + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("linux-headers-generic/5.13.9") + self.requires("linux-headers-generic/5.14.9") self.requires("libelf/0.8.13") - self.requires("zlib/1.2.11") + self.requires("zlib/1.2.13") + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} is only available on Linux") - def _configure_autotools(self): - make_args = [ - "--directory={}".format("src"), + def build_requirements(self): + self.tool_requires("make/4.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.make_args.extend([ "PREFIX={}".format(""), "DESTDIR={}".format(self.package_folder), "LIBSUBDIR={}".format("lib"), - ] + ]) if not self.options.shared: - make_args.append("BUILD_STATIC_ONLY={}".format(1)) - - if self._autotools: - return self._autotools, make_args - self._autotools = AutoToolsBuildEnvironment(self) - return self._autotools, make_args - - def validate(self): - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("This library is only available on Linux") + tc.configure_args.append("BUILD_STATIC_ONLY={}".format(1)) + tc.generate() - def configure(self): - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + pkgdeps = PkgConfigDeps(self) + pkgdeps.generate() - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + autotoolsdeps = AutotoolsDeps(self) + autotoolsdeps.generate() def build(self): - with tools.chdir(self._source_subfolder): - autotools, make_args = self._configure_autotools() - autotools.make(args=make_args) + with chdir(self, os.path.join(self.source_folder, "src")): + autotools = Autotools(self) + autotools.make() def package(self): - with tools.chdir(self._source_subfolder): - autotools, make_args = self._configure_autotools() - autotools.install(args=make_args) + copy(self, pattern="LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + with chdir(self, os.path.join(self.source_folder, "src")): + autotools = Autotools(self) + autotools.install() if self.options.shared: - os.remove(os.path.join(self.package_folder, "lib", "libbpf.a")) + rm(self, "libbpf.a", os.path.join(self.package_folder, "lib")) + else: + rm(self, "libbpf.so*", os.path.join(self.package_folder, "lib")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("LICENSE.BSD-2-Clause", dst="licenses", src=self._source_subfolder) - self.copy("LICENSE.LGPL-2.1", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.names["pkg_config"] = "libbpf" diff --git a/recipes/libbpf/all/test_package/CMakeLists.txt b/recipes/libbpf/all/test_package/CMakeLists.txt index 4c2c4b5007ecb..1edce78120390 100644 --- a/recipes/libbpf/all/test_package/CMakeLists.txt +++ b/recipes/libbpf/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(LibbpfTest C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libbpf REQUIRED CONFIG) -add_executable(example example.c) -target_link_libraries(example ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libbpf::libbpf) diff --git a/recipes/libbpf/all/test_package/conanfile.py b/recipes/libbpf/all/test_package/conanfile.py index 65d3351bbbfc6..b9d7f11e89dcd 100644 --- a/recipes/libbpf/all/test_package/conanfile.py +++ b/recipes/libbpf/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class LibbpfTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libbpf/all/test_package/example.c b/recipes/libbpf/all/test_package/test_package.c similarity index 100% rename from recipes/libbpf/all/test_package/example.c rename to recipes/libbpf/all/test_package/test_package.c diff --git a/recipes/libbpf/all/test_v1_package/CMakeLists.txt b/recipes/libbpf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/libbpf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libbpf/all/test_v1_package/conanfile.py b/recipes/libbpf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/libbpf/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libbpf/config.yml b/recipes/libbpf/config.yml index d13fcfd021b7b..4383f9baf5229 100644 --- a/recipes/libbpf/config.yml +++ b/recipes/libbpf/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.0": + folder: all "0.5.0": folder: all "0.4.0": diff --git a/recipes/libcap/all/conandata.yml b/recipes/libcap/all/conandata.yml index 847c16afd3b78..1539a34e13bec 100644 --- a/recipes/libcap/all/conandata.yml +++ b/recipes/libcap/all/conandata.yml @@ -1,51 +1,92 @@ sources: - "2.45": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.45.tar.xz" - sha256: "d66639f765c0e10557666b00f519caf0bd07a95f867dddaee131cd284fac3286" - "2.46": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.46.tar.xz" - sha256: "4ed3d11413fa6c9667e49f819808fbb581cd8864b839f87d7c2a02c70f21d8b4" - "2.48": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.48.tar.xz" - sha256: "4de9590ee09a87c282d558737ffb5b6175ccbfd26d580add10df44d0f047f6c2" - "2.50": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.50.tar.xz" - sha256: "47a57b8bd238b84c93c921a9b4ff82337551dbcb0cca071316aadf3e23b19261" - "2.57": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.57.tar.xz" - sha256: "750221e347689e779a0ce2b22746ee9987d229712da934acb81b2d280684b7ab" - "2.58": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.58.tar.xz" - sha256: "41399a7d77497d348d20475dc9b2046f53e6b9755bf858ec78cc235101a11d4b" - "2.62": - url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.62.tar.xz" - sha256: "190c5baac9bee06a129eae20d3e827de62f664fe3507f0bf6c50a9a59fbd83a2" + "2.66": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.66.tar.xz" + sha256: "15c40ededb3003d70a283fe587a36b7d19c8b3b554e33f86129c059a4bb466b2" "2.65": url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.65.tar.xz" sha256: "73e350020cc31fe15360879d19384ffa3395a825f065fcf6bda3a5cdf965bebd" - -patches: - "2.45": - - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" - - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" - "2.46": - - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" - - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" - "2.48": - - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" - - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" - "2.50": - - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" - - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + "2.62": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.62.tar.xz" + sha256: "190c5baac9bee06a129eae20d3e827de62f664fe3507f0bf6c50a9a59fbd83a2" + "2.58": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.58.tar.xz" + sha256: "41399a7d77497d348d20475dc9b2046f53e6b9755bf858ec78cc235101a11d4b" "2.57": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.57.tar.xz" + sha256: "750221e347689e779a0ce2b22746ee9987d229712da934acb81b2d280684b7ab" + "2.50": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.50.tar.xz" + sha256: "47a57b8bd238b84c93c921a9b4ff82337551dbcb0cca071316aadf3e23b19261" + "2.48": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.48.tar.xz" + sha256: "4de9590ee09a87c282d558737ffb5b6175ccbfd26d580add10df44d0f047f6c2" + "2.46": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.46.tar.xz" + sha256: "4ed3d11413fa6c9667e49f819808fbb581cd8864b839f87d7c2a02c70f21d8b4" + "2.45": + url: "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-2.45.tar.xz" + sha256: "d66639f765c0e10557666b00f519caf0bd07a95f867dddaee131cd284fac3286" +patches: + "2.66": - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" - "2.58": + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" + "2.65": - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" "2.62": - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" - "2.65": + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" + "2.58": - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" + "2.57": + - patch_file: "patches/2.57/0001-libcap-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" + - patch_file: "patches/2.57/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" + "2.50": + - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" + - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" + "2.48": + - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" + - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" + "2.46": + - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" + - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" + "2.45": + - patch_file: "patches/2.45/0001-Make.Rules-Remove-hardcoded-fPIC.patch" + patch_description: "allow to configure fPIC option from conan recipe" + patch_type: "conan" + - patch_file: "patches/2.45/0002-Make.Rules-Make-compile-tools-configurable.patch" + patch_description: "allow to override compiler via environment variables" + patch_type: "conan" diff --git a/recipes/libcap/all/conanfile.py b/recipes/libcap/all/conanfile.py index 735fde82a0243..082e994b020bb 100644 --- a/recipes/libcap/all/conanfile.py +++ b/recipes/libcap/all/conanfile.py @@ -3,11 +3,12 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import cross_building -from conan.tools.files import apply_conandata_patches, copy, chdir, get, rmdir -from conan.tools.layout import basic_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, chdir, export_conandata_patches, get, rmdir from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class LibcapConan(ConanFile): @@ -17,8 +18,8 @@ class LibcapConan(ConanFile): homepage = "https://git.kernel.org/pub/scm/libs/libcap/libcap.git" description = "This is a library for getting and setting POSIX.1e" \ " (formerly POSIX 6) draft 15 capabilities" - topics = ("libcap", "capabilities") - settings = "os", "compiler", "build_type", "arch" + topics = ("capabilities") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -29,26 +30,22 @@ class LibcapConan(ConanFile): "fPIC": True, "psx_syscals": False, } - exports_sources = "patches/**" + + def export_sources(self): + export_conandata_patches(self) def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass - - def validate(self): - if self.info.settings.os != "Linux": - raise ConanInvalidConfiguration("Only Linux supported") + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): - basic_layout(self, src_folder="source") + basic_layout(self, src_folder="src") + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.name} only supports Linux") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) @@ -63,9 +60,11 @@ def generate(self): env.define("prefix", "/") env.define("lib", "lib") - if cross_building(self) and not env.vars(self).get("BUILD_CC"): - native_cc = "cc" - self.output.info("Using native compiler '{}'".format(native_cc)) + if cross_building(self): + native_cc = env.vars(self).get("CC", VirtualBuildEnv(self).vars().get("CC")) + if not native_cc: + native_cc = "cc" + self.output.info(f"Using native compiler '{native_cc}'") env.define("BUILD_CC", native_cc) tc.generate(env) @@ -74,15 +73,14 @@ def build(self): apply_conandata_patches(self) autotools = Autotools(self) - with chdir(self, os.path.join(self.source_folder, self.name)): + with chdir(self, os.path.join(self.source_folder, "libcap")): autotools.make() def package(self): - copy(self, "License", self.source_folder, - os.path.join(self.package_folder, "licenses"), keep_path=False) + copy(self, "License", self.source_folder, os.path.join(self.package_folder, "licenses")) autotools = Autotools(self) - with chdir(self, os.path.join(self.source_folder, self.name)): + with chdir(self, os.path.join(self.source_folder, "libcap")): autotools.make(target="install-common-cap") install_cap = ("install-shared-cap" if self.options.shared else "install-static-cap") @@ -97,15 +95,12 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.components["cap"].set_property("pkg_config_name", - "libcap") - self.cpp_info.components["cap"].names["pkg_config"] = "libcap" + self.cpp_info.components["cap"].set_property("pkg_config_name", "libcap") self.cpp_info.components["cap"].libs = ["cap"] if self.options.psx_syscals: - self.cpp_info.components["psx"].set_property("pkg_config_name", - "libpsx") - self.cpp_info.components["psx"].names["pkg_config"] = "libpsx" + self.cpp_info.components["psx"].set_property("pkg_config_name", "libpsx") self.cpp_info.components["psx"].libs = ["psx"] self.cpp_info.components["psx"].system_libs = ["pthread"] - self.cpp_info.components["psx"].exelinkflags = [ - "-Wl,-wrap,pthread_create"] + self.cpp_info.components["psx"].exelinkflags = ["-Wl,-wrap,pthread_create"] + # trick to avoid conflicts with cap component + self.cpp_info.set_property("pkg_config_name", "libcap-do-not-use") diff --git a/recipes/libcap/all/test_package/CMakeLists.txt b/recipes/libcap/all/test_package/CMakeLists.txt index 1e5f193ffe669..9cf6b90066410 100644 --- a/recipes/libcap/all/test_package/CMakeLists.txt +++ b/recipes/libcap/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.15) -project(PackageTest LANGUAGES C) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) find_package(PkgConfig REQUIRED) pkg_check_modules(CAP REQUIRED IMPORTED_TARGET libcap) -add_executable(example example.c) -target_link_libraries(example PRIVATE PkgConfig::CAP) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::CAP) diff --git a/recipes/libcap/all/test_package/conanfile.py b/recipes/libcap/all/test_package/conanfile.py index 2e57d4c1e4055..000b95ab28ae5 100644 --- a/recipes/libcap/all/test_package/conanfile.py +++ b/recipes/libcap/all/test_package/conanfile.py @@ -2,32 +2,22 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake -from conan.tools.env import Environment -from conan.tools.cmake import cmake_layout +from conan.tools.cmake import CMake, cmake_layout -required_conan_version = ">=1.38.0" - -class LibcapTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "CMakeToolchain", "PkgConfigDeps", "VirtualBuildEnv" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "PkgConfigDeps", "VirtualBuildEnv", "VirtualRunEnv" test_type = "explicit" + def layout(self): + cmake_layout(self) + def requirements(self): self.requires(self.tested_reference_str) def build_requirements(self): - self.tool_requires("pkgconf/1.7.4") - - def layout(self): - cmake_layout(self) - - def generate(self): - env = Environment() - env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) - envvars = env.vars(self) - envvars.save_script("pkg_config") + self.tool_requires("pkgconf/1.9.3") def build(self): cmake = CMake(self) @@ -36,5 +26,5 @@ def build(self): def test(self): if can_run(self): - bin_path = os.path.join(self.cpp.build.bindirs[0], "example") + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/libcap/all/test_package/example.c b/recipes/libcap/all/test_package/test_package.c similarity index 100% rename from recipes/libcap/all/test_package/example.c rename to recipes/libcap/all/test_package/test_package.c diff --git a/recipes/libcap/all/test_v1_package/CMakeLists.txt b/recipes/libcap/all/test_v1_package/CMakeLists.txt index 2b3baa53f3347..925ecbe19e448 100644 --- a/recipes/libcap/all/test_v1_package/CMakeLists.txt +++ b/recipes/libcap/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -find_package(PkgConfig REQUIRED) -pkg_check_modules(CAP REQUIRED IMPORTED_TARGET libcap) - -add_executable(example ../test_package/example.c) -target_link_libraries(example PRIVATE PkgConfig::CAP) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libcap/all/test_v1_package/conanfile.py b/recipes/libcap/all/test_v1_package/conanfile.py index f90b4e8b52f6e..f480305272e38 100644 --- a/recipes/libcap/all/test_v1_package/conanfile.py +++ b/recipes/libcap/all/test_v1_package/conanfile.py @@ -1,16 +1,15 @@ import os -from conan import ConanFile -from conan.tools.build import cross_building +from conans import ConanFile, tools from conans import CMake -class LibcapTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" generators = "cmake", "pkg_config" def build_requirements(self): - self.tool_requires("pkgconf/1.7.4") + self.build_requires("pkgconf/1.9.3") def build(self): cmake = CMake(self) @@ -18,6 +17,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "example") + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) diff --git a/recipes/libcap/config.yml b/recipes/libcap/config.yml index ee4c4ae443408..6cf43a9b4e1c5 100644 --- a/recipes/libcap/config.yml +++ b/recipes/libcap/config.yml @@ -1,17 +1,19 @@ versions: - "2.45": + "2.66": folder: all - "2.46": + "2.65": folder: all - "2.48": + "2.62": folder: all - "2.50": + "2.58": folder: all "2.57": folder: all - "2.58": + "2.50": folder: all - "2.62": + "2.48": folder: all - "2.65": + "2.46": + folder: all + "2.45": folder: all diff --git a/recipes/libcbor/all/CMakeLists.txt b/recipes/libcbor/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/libcbor/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/libcbor/all/conandata.yml b/recipes/libcbor/all/conandata.yml index 7c6b25d9cbead..a14b76e6d87db 100644 --- a/recipes/libcbor/all/conandata.yml +++ b/recipes/libcbor/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.10.1": + url: "https://github.com/PJK/libcbor/archive/v0.10.1.tar.gz" + sha256: "e8fa0a726b18861c24428561c80b3c95aca95f468df4e2f3e3ac618be12d3047" + "0.10.0": + url: "https://github.com/PJK/libcbor/archive/v0.10.0.tar.gz" + sha256: "4f79c6a9e587aaf877f1c4e74a842a599f2b56b5afb6bf59e51bc643b4f69ba0" "0.9.0": url: "https://github.com/PJK/libcbor/archive/v0.9.0.tar.gz" sha256: "da81e4f9333e0086d4e2745183c7052f04ecc4dbcffcf910029df24f103c15d1" @@ -8,10 +14,12 @@ sources: patches: "0.9.0": - patch_file: "patches/0.7.0/002_fix_cmake_module_path.patch" - base_path: "source_subfolder" + patch_description: "fix cmake module path" + patch_type: "portability" "0.7.0": - patch_file: "patches/0.7.0/001_fix_shared_build.patch" - base_path: "source_subfolder" + patch_description: "fix shared build compilation error" + patch_type: "conan" - patch_file: "patches/0.7.0/002_fix_cmake_module_path.patch" - base_path: "source_subfolder" - + patch_description: "fix cmake module path" + patch_type: "portability" diff --git a/recipes/libcbor/all/conanfile.py b/recipes/libcbor/all/conanfile.py index 762b9db3b026c..2dcedcee9a1fc 100644 --- a/recipes/libcbor/all/conanfile.py +++ b/recipes/libcbor/all/conanfile.py @@ -1,14 +1,17 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -from conans import CMake, ConanFile, tools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" + class LibCborStackConan(ConanFile): name = "libcbor" license = "MIT" homepage = "https://github.com/PJK/libcbor" url = "https://github.com/conan-io/conan-center-index" - description = """CBOR protocol implementation for C""" + description = "CBOR protocol implementation for C" topics = ("cbor", "serialization", "messaging") settings = "os", "arch", "compiler", "build_type" options = { @@ -16,7 +19,7 @@ class LibCborStackConan(ConanFile): "fPIC": [True, False], "custom_alloc": [True, False], "pretty_printer": [True, False], - "buffer_growth_factor": "ANY", + "buffer_growth_factor": ["ANY"], } default_options = { "shared": False, @@ -25,22 +28,9 @@ class LibCborStackConan(ConanFile): "pretty_printer": True, "buffer_growth_factor": 2, } - generators = "cmake" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -48,40 +38,42 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def layout(self): + cmake_layout(self, src_folder="src") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["WITH_EXAMPLES"] = False - self._cmake.definitions["SANITIZE"] = False - self._cmake.definitions["CBOR_CUSTOM_ALLOC"] = self.options.custom_alloc - self._cmake.definitions["CBOR_PRETTY_PRINTER"] = self.options.pretty_printer - self._cmake.definitions["CBOR_BUFFER_GROWTH"] = self.options.buffer_growth_factor + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_EXAMPLES"] = False + tc.variables["SANITIZE"] = False + tc.variables["CBOR_CUSTOM_ALLOC"] = self.options.custom_alloc + tc.variables["CBOR_PRETTY_PRINTER"] = self.options.pretty_printer + tc.variables["CBOR_BUFFER_GROWTH"] = self.options.buffer_growth_factor + # Relocatable shared libs on macOS + tc.variables["CMAKE_MACOSX_RPATH"] = True + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.set_property("pkg_config_name", "libcbor") + self.cpp_info.libs = ["cbor"] if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] diff --git a/recipes/libcbor/all/test_package/CMakeLists.txt b/recipes/libcbor/all/test_package/CMakeLists.txt index a6963e83df399..94fca8fa66406 100644 --- a/recipes/libcbor/all/test_package/CMakeLists.txt +++ b/recipes/libcbor/all/test_package/CMakeLists.txt @@ -1,10 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(libcbor REQUIRED CONFIG) -find_package(libcbor CONFIG REQUIRED) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libcbor::libcbor) -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} libcbor::libcbor) +if(libcbor_VERSION VERSION_GREATER_EQUAL "0.10.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE -DLIBCBOR_DEPRECATE_CUSTOM_ALLOC) +endif() diff --git a/recipes/libcbor/all/test_package/conanfile.py b/recipes/libcbor/all/test_package/conanfile.py index 6e4647a442772..0a6bc68712d90 100644 --- a/recipes/libcbor/all/test_package/conanfile.py +++ b/recipes/libcbor/all/test_package/conanfile.py @@ -1,9 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class TestConan(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - bin_path = self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libcbor/all/test_package/test_package.c b/recipes/libcbor/all/test_package/test_package.c new file mode 100644 index 0000000000000..63def1fbfb9b0 --- /dev/null +++ b/recipes/libcbor/all/test_package/test_package.c @@ -0,0 +1,20 @@ +#include +#include + +int main(int argc, char *argv[]) { + printf("Hello from libcbor %s\n", CBOR_VERSION); +#ifndef LIBCBOR_DEPRECATE_CUSTOM_ALLOC + printf("Custom allocation support: %s\n", CBOR_CUSTOM_ALLOC ? "yes" : "no"); +#endif + printf("Pretty-printer support: %s\n", CBOR_PRETTY_PRINTER ? "yes" : "no"); + printf("Buffer growth factor: %f\n", (float)CBOR_BUFFER_GROWTH); + cbor_item_t *array = cbor_new_definite_array(4); + cbor_array_push(array, cbor_move(cbor_build_uint8(4))); + cbor_array_push(array, cbor_move(cbor_build_uint8(3))); + cbor_array_push(array, cbor_move(cbor_build_uint8(1))); + cbor_array_push(array, cbor_move(cbor_build_uint8(2))); + + cbor_describe(array, stdout); + fflush(stdout); + /* Preallocate the map structure */ +} diff --git a/recipes/libcbor/all/test_package/test_package.cpp b/recipes/libcbor/all/test_package/test_package.cpp deleted file mode 100644 index aeae930f3bd7b..0000000000000 --- a/recipes/libcbor/all/test_package/test_package.cpp +++ /dev/null @@ -1,18 +0,0 @@ -#include -#include - -int main(int argc, char *argv[]) { - printf("Hello from libcbor %s\n", CBOR_VERSION); - printf("Custom allocation support: %s\n", CBOR_CUSTOM_ALLOC ? "yes" : "no"); - printf("Pretty-printer support: %s\n", CBOR_PRETTY_PRINTER ? "yes" : "no"); - printf("Buffer growth factor: %f\n", (float)CBOR_BUFFER_GROWTH); - cbor_item_t *array = cbor_new_definite_array(4); - cbor_array_push(array, cbor_move(cbor_build_uint8(4))); - cbor_array_push(array, cbor_move(cbor_build_uint8(3))); - cbor_array_push(array, cbor_move(cbor_build_uint8(1))); - cbor_array_push(array, cbor_move(cbor_build_uint8(2))); - - cbor_describe(array, stdout); - fflush(stdout); - /* Preallocate the map structure */ -} diff --git a/recipes/libcbor/all/test_v1_package/CMakeLists.txt b/recipes/libcbor/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libcbor/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libcbor/all/test_v1_package/conanfile.py b/recipes/libcbor/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libcbor/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libcbor/config.yml b/recipes/libcbor/config.yml index 13ed819d2e45c..ec48c82691067 100644 --- a/recipes/libcbor/config.yml +++ b/recipes/libcbor/config.yml @@ -1,5 +1,8 @@ ---- versions: + "0.10.1": + folder: "all" + "0.10.0": + folder: "all" "0.9.0": folder: "all" "0.7.0": diff --git a/recipes/libccd/all/conanfile.py b/recipes/libccd/all/conanfile.py index 17228a62767e4..16be5e2915439 100644 --- a/recipes/libccd/all/conanfile.py +++ b/recipes/libccd/all/conanfile.py @@ -4,17 +4,18 @@ import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class LibccdConan(ConanFile): name = "libccd" description = "Library for collision detection between two convex shapes." license = "BSD-3-Clause" - topics = ("libccd", "collision", "3d") + topics = ("collision", "3d") homepage = "https://github.com/danfis/libccd" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,30 +34,21 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) tc.variables["BUILD_DOCUMENTATION"] = False tc.variables["ENABLE_DOUBLE_PRECISION"] = self.options.enable_double_precision tc.variables["CCD_HIDE_ALL_SYMBOLS"] = not self.options.shared - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): @@ -79,17 +71,17 @@ def package(self): def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) + """) save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "ccd") diff --git a/recipes/libccd/all/test_package/conanfile.py b/recipes/libccd/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/libccd/all/test_package/conanfile.py +++ b/recipes/libccd/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/libccd/all/test_v1_package/CMakeLists.txt b/recipes/libccd/all/test_v1_package/CMakeLists.txt index e9d8dfb4f9d7b..0d20897301b68 100644 --- a/recipes/libccd/all/test_v1_package/CMakeLists.txt +++ b/recipes/libccd/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(ccd REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE ccd) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libccd/all/test_v1_package/conanfile.py b/recipes/libccd/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/libccd/all/test_v1_package/conanfile.py +++ b/recipes/libccd/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/libconfig/all/CMakeLists.txt b/recipes/libconfig/all/CMakeLists.txt deleted file mode 100644 index f5b1181a54917..0000000000000 --- a/recipes/libconfig/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - -if(APPLE) - add_definitions("-DHAVE_XLOCALE_H") -endif() - -add_subdirectory("source_subfolder") diff --git a/recipes/libconfig/all/conandata.yml b/recipes/libconfig/all/conandata.yml index 8a0714513ae2a..9da3354cf812a 100644 --- a/recipes/libconfig/all/conandata.yml +++ b/recipes/libconfig/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.7.3": + url: "https://github.com/hyperrealm/libconfig/archive/refs/tags/v1.7.3.tar.gz" + sha256: "68757e37c567fd026330c8a8449aa5f9cac08a642f213f2687186b903bd7e94e" "1.7.2": url: "https://github.com/hyperrealm/libconfig/archive/refs/tags/v1.7.2.tar.gz" sha256: "f67ac44099916ae260a6c9e290a90809e7d782d96cdd462cac656ebc5b685726" diff --git a/recipes/libconfig/all/conanfile.py b/recipes/libconfig/all/conanfile.py index fd2a346c68b7a..7cdaef7bf5f57 100644 --- a/recipes/libconfig/all/conanfile.py +++ b/recipes/libconfig/all/conanfile.py @@ -1,77 +1,93 @@ +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout + import os -from conans import ConanFile, CMake, tools +required_conan_version = ">=1.53.0" class LibconfigConan(ConanFile): name = "libconfig" - license = "LGPL-2.1" + description = "C/C++ library for processing configuration files" + license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://hyperrealm.github.io/libconfig/" - description = "C/C++ library for processing configuration files" - topics = ("conan", "conf", "config", "cfg", "configuration") + topics = ("conf", "config", "cfg", "configuration") settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], - "fPIC": [True, False]} - default_options = {"shared": False, - "fPIC": True} - exports_sources = ["CMakeLists.txt"] - generators = "cmake", - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") - def _configure_cmake(self): - if self._cmake: - return self._cmake - cmake = CMake(self) - cmake.definitions['BUILD_EXAMPLES'] = False - cmake.definitions['BUILD_TESTS'] = False - cmake.configure(build_folder=self._build_subfolder) - self._cmake = cmake - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables['BUILD_EXAMPLES'] = False + tc.variables['BUILD_TESTS'] = False + if is_apple_os(self): + tc.preprocessor_definitions["HAVE_XLOCALE_H"] = 1 + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def build(self): - # https://github.com/hyperrealm/libconfig/issues/119 - tools.replace_in_file(os.path.join(self._source_subfolder, "lib", "CMakeLists.txt"), "_STDLIB_H", "") - cmake = self._configure_cmake() + if Version(self.version) == "1.7.2": + # https://github.com/hyperrealm/libconfig/issues/119 + replace_in_file(self, + os.path.join(self.source_folder, "lib", "CMakeLists.txt"), + "_STDLIB_H", + "") + if Version(self.version) == "1.7.3": + replace_in_file(self, + os.path.join(self.source_folder, "lib", "CMakeLists.txt"), + "target_compile_definitions(${libname}++ PUBLIC LIBCONFIGXX_STATIC)", + "target_compile_definitions(${libname}++ PUBLIC LIBCONFIG_STATIC LIBCONFIGXX_STATIC)") + + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.components["libconfig_"].names["cmake_find_package"] = "libconfig" - self.cpp_info.components["libconfig_"].names["cmake_find_package_multi"] = "libconfig" - self.cpp_info.components["libconfig_"].names["pkg_config"] = "libconfig" - self.cpp_info.components["libconfig_"].libs = ["libconfig"] + prefix = "lib" if Version(self.version) < "1.7.3" or self.settings.os == "Windows" else "" - self.cpp_info.components["libconfig++"].names["cmake_find_package"] = "libconfig++" - self.cpp_info.components["libconfig++"].names["cmake_find_package_multi"] = "libconfig++" - self.cpp_info.components["libconfig++"].names["pkg_config"] = "libconfig++" - self.cpp_info.components["libconfig++"].libs = ["libconfig++"] + self.cpp_info.components["libconfig_"].set_property("cmake_file_name", "libconfig") + self.cpp_info.components["libconfig_"].set_property("cmake_target_name", "libconfig::libconfig") + self.cpp_info.components["libconfig_"].set_property("pkg_config_name", "libconfig") + self.cpp_info.components["libconfig_"].libs = [f"{prefix}config"] + + self.cpp_info.components["libconfig++"].set_property("cmake_file_name", "libconfig") + self.cpp_info.components["libconfig++"].set_property("cmake_target_name", "libconfig::libconfig++") + self.cpp_info.components["libconfig++"].set_property("pkg_config_name", "libconfig++") + self.cpp_info.components["libconfig++"].libs = [f"{prefix}config++"] + self.cpp_info.components["libconfig++"].requires = ["libconfig_"] if not self.options.shared: self.cpp_info.components["libconfig_"].defines.append("LIBCONFIG_STATIC") @@ -79,3 +95,12 @@ def package_info(self): if self.settings.os == "Windows": self.cpp_info.components["libconfig_"].system_libs.append("shlwapi") self.cpp_info.components["libconfig++"].system_libs.append("shlwapi") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.components["libconfig_"].names["cmake_find_package"] = "libconfig" + self.cpp_info.components["libconfig_"].names["cmake_find_package_multi"] = "libconfig" + self.cpp_info.components["libconfig_"].names["pkg_config"] = "libconfig" + + self.cpp_info.components["libconfig++"].names["cmake_find_package"] = "libconfig++" + self.cpp_info.components["libconfig++"].names["cmake_find_package_multi"] = "libconfig++" + self.cpp_info.components["libconfig++"].names["pkg_config"] = "libconfig++" diff --git a/recipes/libconfig/all/test_package/CMakeLists.txt b/recipes/libconfig/all/test_package/CMakeLists.txt index f295fcfbb4267..d094678d52a36 100644 --- a/recipes/libconfig/all/test_package/CMakeLists.txt +++ b/recipes/libconfig/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package LANGUAGES C CXX) find_package(libconfig REQUIRED CONFIG) diff --git a/recipes/libconfig/all/test_package/conanfile.py b/recipes/libconfig/all/test_package/conanfile.py index e6dec44fc9ce6..8e52f315e8745 100644 --- a/recipes/libconfig/all/test_package/conanfile.py +++ b/recipes/libconfig/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,8 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - bin_path = os.path.join("bin", "test_package++") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + bin_path_pp = os.path.join(self.cpp.build.bindirs[0], "test_package++") + self.run(bin_path_pp, env="conanrun") diff --git a/recipes/libconfig/all/test_v1_package/CMakeLists.txt b/recipes/libconfig/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libconfig/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libconfig/all/test_v1_package/conanfile.py b/recipes/libconfig/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8ba7c272305b9 --- /dev/null +++ b/recipes/libconfig/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + bin_path_pp = os.path.join("bin", "test_package++") + self.run(bin_path_pp, run_environment=True) diff --git a/recipes/libconfig/config.yml b/recipes/libconfig/config.yml index 38df7481b41ef..4f945b4c70677 100644 --- a/recipes/libconfig/config.yml +++ b/recipes/libconfig/config.yml @@ -1,3 +1,5 @@ versions: + "1.7.3": + folder: "all" "1.7.2": folder: "all" diff --git a/recipes/libconfuse/all/conandata.yml b/recipes/libconfuse/all/conandata.yml index c803311329f9b..d999ffda52886 100644 --- a/recipes/libconfuse/all/conandata.yml +++ b/recipes/libconfuse/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "3.2.2": - url: "https://github.com/martinh/libconfuse/releases/download/v3.2.2/confuse-3.2.2.tar.gz" - sha256: "71316b55592f8d0c98924242c98dbfa6252153a8b6e7d89e57fe6923934d77d0" "3.3": url: "https://github.com/martinh/libconfuse/releases/download/v3.3/confuse-3.3.tar.gz" sha256: "3a59ded20bc652eaa8e6261ab46f7e483bc13dad79263c15af42ecbb329707b8" + "3.2.2": + url: "https://github.com/martinh/libconfuse/releases/download/v3.2.2/confuse-3.2.2.tar.gz" + sha256: "71316b55592f8d0c98924242c98dbfa6252153a8b6e7d89e57fe6923934d77d0" diff --git a/recipes/libconfuse/all/conanfile.py b/recipes/libconfuse/all/conanfile.py index 3faf9e8275a06..6b372d54a5173 100644 --- a/recipes/libconfuse/all/conanfile.py +++ b/recipes/libconfuse/all/conanfile.py @@ -1,14 +1,20 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -import contextlib +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import copy, get, rename, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibConfuseConan(ConanFile): name = "libconfuse" description = "Small configuration file parser library for C" - topics = ("conan", "libconfuse", "configuration", "parser") + topics = ("configuration", "parser") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/martinh/libconfuse" license = "ISC" @@ -22,12 +28,6 @@ class LibConfuseConan(ConanFile): "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -38,70 +38,67 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") - conf_args = [] - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) - else: - conf_args.extend(["--disable-shared", "--enable-static"]) - self._autotools.configure(configure_dir=self._source_subfolder, args=conf_args) - return self._autotools - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - with tools.environment_append({"CC": "cl -nologo", - "CXX": "cl -nologo", - "LD": "link"}): - yield - else: - yield + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + tc.generate() + + if is_msvc(self): + env = Environment() + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + env.define("LD", "link -nologo") + env.vars(self).save_script("conanbuild_libconfuse_msvc") def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.in"), + replace_in_file(self, os.path.join(self.source_folder, "Makefile.in"), "SUBDIRS = m4 po src $(EXAMPLES) tests doc", "SUBDIRS = m4 src") if not self.options.shared: - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "confuse.h"), + replace_in_file(self, os.path.join(self.source_folder, "src", "confuse.h"), "__declspec (dllimport)", "") def build(self): self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - - os.unlink(os.path.join(self.package_folder, "lib", "libconfuse.la")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - if self.settings.compiler == "Visual Studio" and self.options.shared: - tools.rename(os.path.join(self.package_folder, "lib", "confuse.dll.lib"), + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + if is_msvc(self) and self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "confuse.dll.lib"), os.path.join(self.package_folder, "lib", "confuse.lib")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.names["pkg_config"] = "libconfuse" + self.cpp_info.set_property("pkg_config_name", "libconfuse") self.cpp_info.libs = ["confuse"] diff --git a/recipes/libconfuse/all/test_package/CMakeLists.txt b/recipes/libconfuse/all/test_package/CMakeLists.txt index 7b9b613cbb24a..c98d1db7c151d 100644 --- a/recipes/libconfuse/all/test_package/CMakeLists.txt +++ b/recipes/libconfuse/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libconfuse REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libconfuse::libconfuse) diff --git a/recipes/libconfuse/all/test_package/conanfile.py b/recipes/libconfuse/all/test_package/conanfile.py index 7771e7c3f2555..f7963cc87b0ba 100644 --- a/recipes/libconfuse/all/test_package/conanfile.py +++ b/recipes/libconfuse/all/test_package/conanfile.py @@ -1,11 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout from io import StringIO import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,11 +22,11 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") config_path = os.path.join(self.source_folder, "hello.conf") output = StringIO() - self.run("{} {}".format(bin_path, config_path), run_environment=True, output=output) + self.run(f"{bin_path} {config_path}", env="conanrun", output=output) text = output.getvalue() print(text) assert "Neighbour" in text diff --git a/recipes/libconfuse/all/test_v1_package/CMakeLists.txt b/recipes/libconfuse/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libconfuse/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libconfuse/all/test_v1_package/conanfile.py b/recipes/libconfuse/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6f8d199faef5a --- /dev/null +++ b/recipes/libconfuse/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +from conans import ConanFile, CMake, tools +from io import StringIO +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + config_path = os.path.join(self.source_folder, os.pardir, "test_package", "hello.conf") + output = StringIO() + self.run(f"{bin_path} {config_path}", run_environment=True, output=output) + text = output.getvalue() + print(text) + assert "Neighbour" in text diff --git a/recipes/libconfuse/config.yml b/recipes/libconfuse/config.yml index 4854c14488209..ed8415be53cb7 100644 --- a/recipes/libconfuse/config.yml +++ b/recipes/libconfuse/config.yml @@ -1,5 +1,5 @@ versions: - "3.2.2": - folder: all "3.3": folder: all + "3.2.2": + folder: all diff --git a/recipes/libcorrect/all/CMakeLists.txt b/recipes/libcorrect/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/libcorrect/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libcorrect/all/conandata.yml b/recipes/libcorrect/all/conandata.yml index 373b501c11a6c..bbabb165203bc 100644 --- a/recipes/libcorrect/all/conandata.yml +++ b/recipes/libcorrect/all/conandata.yml @@ -2,10 +2,7 @@ sources: "20181010": url: "https://github.com/quiet/libcorrect/archive/f5a28c74fba7a99736fe49d3a5243eca29517ae9.tar.gz" sha256: 5a4305aabe6c7d5b58f6677c41c54ad5e8d9003f7a5998f7344d93534e4c5760 - patches: "20181010": - patch_file: "patches/0001-Support-CMake-BUILD_SHARED_LIBS.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-Export-symbols-for-windows.patch" - base_path: "source_subfolder" diff --git a/recipes/libcorrect/all/conanfile.py b/recipes/libcorrect/all/conanfile.py index 0aba3323c9390..a2cd26c5b3b8e 100644 --- a/recipes/libcorrect/all/conanfile.py +++ b/recipes/libcorrect/all/conanfile.py @@ -1,17 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" -class LibaecConan(ConanFile): +class LibcorrectConan(ConanFile): name = "libcorrect" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/quiet/libcorrect" description = "C library for Convolutional codes and Reed-Solomon" - topics = ("conan", "dsp", "libaec", "encoding", "decoding") - settings = "os", "compiler", "build_type", "arch" + topics = ("fec", "reed-solomon", "viterbi", "convolutional") + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -21,17 +24,8 @@ class LibaecConan(ConanFile): "fPIC": True, } - generators = "cmake" - exports_sources = ["CMakeLists.txt", "patches/*"] - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,40 +33,52 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def layout(self): + cmake_layout(self, src_folder="src") - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "-fPIC", "") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "-fsanitize=address", "") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + # Relocatable shared lib on Macos + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "-fPIC", "") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "-fsanitize=address", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["correct"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/libcorrect/all/test_package/CMakeLists.txt b/recipes/libcorrect/all/test_package/CMakeLists.txt index aae00b641388d..37ccc2fe5dfaa 100644 --- a/recipes/libcorrect/all/test_package/CMakeLists.txt +++ b/recipes/libcorrect/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1.3) -project(test_package) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libcorrect REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libcorrect::libcorrect) diff --git a/recipes/libcorrect/all/test_package/conanfile.py b/recipes/libcorrect/all/test_package/conanfile.py index bd7165a553cf4..0a6bc68712d90 100644 --- a/recipes/libcorrect/all/test_package/conanfile.py +++ b/recipes/libcorrect/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libcorrect/all/test_v1_package/CMakeLists.txt b/recipes/libcorrect/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..37041d4cb4431 --- /dev/null +++ b/recipes/libcorrect/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(libcorrect REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libcorrect::libcorrect) diff --git a/recipes/libcorrect/all/test_v1_package/conanfile.py b/recipes/libcorrect/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libcorrect/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libcurl/all/CMakeLists.txt b/recipes/libcurl/all/CMakeLists.txt deleted file mode 100644 index 8658c4251a78c..0000000000000 --- a/recipes/libcurl/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.0) - -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libcurl/all/conandata.yml b/recipes/libcurl/all/conandata.yml index 2c6a9a1d3ae59..5fb0b0c8d8687 100644 --- a/recipes/libcurl/all/conandata.yml +++ b/recipes/libcurl/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "7.87.0": + url: "https://curl.se/download/curl-7.87.0.tar.gz" + sha256: "8a063d664d1c23d35526b87a2bf15514962ffdd8ef7fd40519191b3c23e39548" + "7.86.0": + url: "https://curl.se/download/curl-7.86.0.tar.gz" + sha256: "3dfdd39ba95e18847965cd3051ea6d22586609d9011d91df7bc5521288987a82" + "7.85.0": + url: "https://curl.se/download/curl-7.85.0.tar.gz" + sha256: "78a06f918bd5fde3c4573ef4f9806f56372b32ec1829c9ec474799eeee641c27" "7.84.0": url: "https://curl.se/download/curl-7.84.0.tar.gz" sha256: "3c6893d38d054d4e378267166858698899e9d87258e8ff1419d020c395384535" @@ -26,4 +35,5 @@ sources: patches: "7.79.0": - patch_file: "patches/004-no-checksrc.patch" - base_path: "source_subfolder" + patch_description: "don't run checksrc" + patch_type: "conan" diff --git a/recipes/libcurl/all/conanfile.py b/recipes/libcurl/all/conanfile.py index 5d90d94f7a857..4647e37a78150 100644 --- a/recipes/libcurl/all/conanfile.py +++ b/recipes/libcurl/all/conanfile.py @@ -1,17 +1,19 @@ -import glob -import os -import re -import functools -from conans import ConanFile, AutoToolsBuildEnvironment, CMake, tools +from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, download, export_conandata_patches, get, load, replace_in_file, rm, rmdir, save +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path from conan.tools.scm import Version -from conan.tools.files import replace_in_file, rmdir, chdir, get, download, save, load, apply_conandata_patches -from conan.tools.apple import is_apple_os +import os +import re -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.54.0" class LibcurlConan(ConanFile): @@ -45,6 +47,7 @@ class LibcurlConan(ConanFile): "with_libssh2": [True, False], "with_libidn": [True, False], "with_librtmp": [True, False], + "with_libgsasl": [True, False], "with_libmetalink": [True, False], "with_libpsl": [True, False], "with_largemaxwritesize": [True, False], @@ -65,8 +68,8 @@ class LibcurlConan(ConanFile): "with_symbol_hiding": [True, False], "with_unix_sockets": [True, False], "with_verbose_strings": [True, False], - "with_ca_bundle": "ANY", - "with_ca_path": "ANY", + "with_ca_bundle": [False, "auto", "ANY"], + "with_ca_path": [False, "auto", "ANY"], } default_options = { "shared": False, @@ -89,6 +92,7 @@ class LibcurlConan(ConanFile): "with_libssh2": False, "with_libidn": False, "with_librtmp": False, + "with_libgsasl": False, "with_libmetalink": False, "with_libpsl": False, "with_largemaxwritesize": False, @@ -109,136 +113,136 @@ class LibcurlConan(ConanFile): "with_symbol_hiding": False, "with_unix_sockets": True, "with_verbose_strings": True, - "with_ca_bundle": None, - "with_ca_path": None, + "with_ca_bundle": "auto", + "with_ca_path": "auto", } - generators = "cmake", "cmake_find_package_multi", "pkg_config", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" @property def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" - @property - def _is_win_x_android(self): - return self.settings.os == "Android" and tools.os_info.is_windows - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @property - def _is_using_cmake_build(self): - return is_msvc(self) or self._is_win_x_android + def _is_win_x_android(self): + return self.settings.os == "Android" and self._settings_build.os == "Windows" @property - def _has_zstd_option(self): - return Version(self.version) >= "7.72.0" + def _is_using_cmake_build(self): + return is_msvc(self) or self._is_win_x_android @property def _has_metalink_option(self): # Support for metalink was removed in version 7.78.0 https://github.com/curl/curl/pull/7176 return Version(self.version) < "7.78.0" and not self._is_using_cmake_build + @property + def _has_with_libpsl_option(self): + return not (self._is_using_cmake_build and Version(self.version) < "7.84.0") + def export_sources(self): - self.copy("CMakeLists.txt") - self.copy("lib_Makefile_add.am") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "lib_Makefile_add.am", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): - if Version(self.version) < "7.10.4": - self.license = "MIT" if self.settings.os == "Windows": del self.options.fPIC - if not self._has_zstd_option: - del self.options.with_zstd if not self._has_metalink_option: del self.options.with_libmetalink + if not self._has_with_libpsl_option: + del self.options.with_libpsl + if self._is_using_cmake_build: + del self.options.with_libgsasl + + # Before 7.86.0, enabling unix sockets configure option would fail on windows + # It was fixed with this PR: https://github.com/curl/curl/pull/9688 + if self._is_mingw and Version(self.version) < "7.86.0": + del self.options.with_unix_sockets + # Default options self.options.with_ssl = "darwinssl" if is_apple_os(self) else "openssl" def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - # These options are not used in CMake build yet + def layout(self): if self._is_using_cmake_build: - if Version(self.version) < "7.75.0": - del self.options.with_libidn - del self.options.with_libpsl + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_ssl == "openssl": - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") elif self.options.with_ssl == "wolfssl": - self.requires("wolfssl/5.3.0") + self.requires("wolfssl/5.5.1") if self.options.with_nghttp2: - self.requires("libnghttp2/1.47.0") + self.requires("libnghttp2/1.51.0") if self.options.with_libssh2: self.requires("libssh2/1.10.0") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_brotli: self.requires("brotli/1.0.9") - if self.options.get_safe("with_zstd"): + if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.with_c_ares: self.requires("c-ares/1.18.1") + if self.options.get_safe("with_libpsl"): + self.requires("libpsl/0.21.1") def validate(self): if self.options.with_ssl == "schannel" and self.settings.os != "Windows": raise ConanInvalidConfiguration("schannel only suppported on Windows.") if self.options.with_ssl == "darwinssl" and not is_apple_os(self): raise ConanInvalidConfiguration("darwinssl only suppported on Apple like OS (Macos, iOS, watchOS or tvOS).") - if self.options.with_ssl == "wolfssl" and self._is_using_cmake_build and Version(self.version) < "7.70.0": - raise ConanInvalidConfiguration("Before 7.70.0, libcurl has no wolfssl support for Visual Studio or \"Windows to Android cross compilation\"") if self.options.with_ssl == "openssl": - if self.options.with_ntlm and self.options["openssl"].no_des: + openssl = self.dependencies["openssl"] + if self.options.with_ntlm and openssl.options.no_des: raise ConanInvalidConfiguration("option with_ntlm=True requires openssl:no_des=False") def build_requirements(self): if self._is_using_cmake_build: if self._is_win_x_android: - self.tool_requires("ninja/1.11.0") + self.tool_requires("ninja/1.11.1") else: - self.tool_requires("libtool/2.4.6") - self.tool_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.tool_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - download(self, "https://curl.haxx.se/ca/cacert.pem", "cacert.pem", verify=True) - - # TODO: remove imports once rpath of shared libs of libcurl dependencies fixed on macOS - def imports(self): - # Copy shared libraries for dependencies to fix DYLD_LIBRARY_PATH problems - # - # Configure script creates conftest that cannot execute without shared openssl binaries. - # Ways to solve the problem: - # 1. set *LD_LIBRARY_PATH (works with Linux with RunEnvironment - # but does not work on OS X 10.11 with SIP) - # 2. copying dylib's to the build directory (fortunately works on OS X) - if self.settings.os == "Macos": - self.copy("*.dylib*", dst=self._source_subfolder, keep_path=False) + destination=self.source_folder, strip_root=True) + download(self, "https://curl.se/ca/cacert-2023-01-10.pem", "cacert.pem", verify=True, sha256="fb1ecd641d0a02c01bc9036d513cb658bbda62a75e246bedbc01764560a639f0") + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if self._is_using_cmake_build: + self._generate_with_cmake() + else: + self._generate_with_autotools() def build(self): self._patch_sources() if self._is_using_cmake_build: - self._build_with_cmake() + cmake = CMake(self) + cmake.configure() + cmake.build() else: - self._build_with_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def _patch_sources(self): apply_conandata_patches(self) @@ -248,7 +252,7 @@ def _patch_sources(self): def _patch_misc_files(self): if self.options.with_largemaxwritesize: - replace_in_file(self, os.path.join(self._source_subfolder, "include", "curl", "curl.h"), + replace_in_file(self, os.path.join(self.source_folder, "include", "curl", "curl.h"), "define CURL_MAX_WRITE_SIZE 16384", "define CURL_MAX_WRITE_SIZE 10485760") @@ -256,7 +260,7 @@ def _patch_misc_files(self): # for additional info, see this comment https://github.com/conan-io/conan-center-index/pull/1008#discussion_r386122685 if self.settings.compiler == "apple-clang" and self.settings.compiler.version == "9.1": if self.options.with_ssl == "darwinssl": - replace_in_file(self, os.path.join(self._source_subfolder, "lib", "vtls", "sectransp.c"), + replace_in_file(self, os.path.join(self.source_folder, "lib", "vtls", "sectransp.c"), "#define CURL_BUILD_MAC_10_13 MAC_OS_X_VERSION_MAX_ALLOWED >= 101300", "#define CURL_BUILD_MAC_10_13 0") @@ -267,68 +271,86 @@ def _patch_autotools(self): # Disable curl tool for these reasons: # - link errors if mingw shared or iOS/tvOS/watchOS # - it makes recipe consistent with CMake build where we don't build curl tool - top_makefile = os.path.join(self._source_subfolder, "Makefile.am") + top_makefile = os.path.join(self.source_folder, "Makefile.am") replace_in_file(self, top_makefile, "SUBDIRS = lib src", "SUBDIRS = lib") replace_in_file(self, top_makefile, "include src/Makefile.inc", "") - if self._is_mingw: - # patch for zlib naming in mingw - if self.options.with_zlib: - configure_ac = os.path.join(self._source_subfolder, "configure.ac") - zlib_name = self.deps_cpp_info["zlib"].libs[0] - replace_in_file(self, configure_ac, - "AC_CHECK_LIB(z,", - "AC_CHECK_LIB({},".format(zlib_name)) - replace_in_file(self, configure_ac, - "-lz ", - "-l{} ".format(zlib_name)) - - if self.options.shared: - # patch for shared mingw build - lib_makefile = os.path.join(self._source_subfolder, "lib", "Makefile.am") - replace_in_file(self, lib_makefile, - "noinst_LTLIBRARIES = libcurlu.la", - "") - replace_in_file(self, lib_makefile, - "noinst_LTLIBRARIES =", - "") - replace_in_file(self, lib_makefile, - "lib_LTLIBRARIES = libcurl.la", - "noinst_LTLIBRARIES = libcurl.la") - # add directives to build dll - # used only for native mingw-make - if not cross_building(self): - added_content = load(self, "lib_Makefile_add.am") - save(self, lib_makefile, added_content, append=True) + # zlib naming is not always very consistent + if self.options.with_zlib: + configure_ac = os.path.join(self.source_folder, "configure.ac") + zlib_name = self.dependencies["zlib"].cpp_info.aggregated_components().libs[0] + replace_in_file(self, configure_ac, + "AC_CHECK_LIB(z,", + f"AC_CHECK_LIB({zlib_name},") + replace_in_file(self, configure_ac, + "-lz ", + f"-l{zlib_name} ") + + if self._is_mingw and self.options.shared: + # patch for shared mingw build + lib_makefile = os.path.join(self.source_folder, "lib", "Makefile.am") + replace_in_file(self, lib_makefile, + "noinst_LTLIBRARIES = libcurlu.la", + "") + replace_in_file(self, lib_makefile, + "noinst_LTLIBRARIES =", + "") + replace_in_file(self, lib_makefile, + "lib_LTLIBRARIES = libcurl.la", + "noinst_LTLIBRARIES = libcurl.la") + # add directives to build dll + # used only for native mingw-make + if not cross_building(self): + # The patch file is located in the base src folder + added_content = load(self, os.path.join(self.folders.base_source, "lib_Makefile_add.am")) + save(self, lib_makefile, added_content, append=True) def _patch_cmake(self): if not self._is_using_cmake_build: return - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - # Custom findZstd.cmake file relies on pkg-config file, make sure that it's consumed on all platforms - if self._has_zstd_option: - replace_in_file(self, os.path.join(self._source_subfolder, "CMake", "FindZstd.cmake"), - "if(UNIX)", "if(TRUE)") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") # TODO: check this patch, it's suspicious replace_in_file(self, cmakelists, "include(CurlSymbolHiding)", "") + # brotli + replace_in_file(self, cmakelists, "find_package(Brotli QUIET)", "find_package(brotli REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "if(BROTLI_FOUND)", "if(brotli_FOUND)") + replace_in_file(self, cmakelists, "${BROTLI_LIBRARIES}", "brotli::brotli") + replace_in_file(self, cmakelists, "${BROTLI_INCLUDE_DIRS}", "${brotli_INCLUDE_DIRS}") + + # zstd + # Use upstream FindZstd.cmake because check_symbol_exists() is called + # afterwards and it would fail with zstd_LIBRARIES generated by CMakeDeps + replace_in_file(self, cmakelists, "find_package(Zstd REQUIRED)", "find_package(Zstd REQUIRED MODULE)") + replace_in_file(self, os.path.join(self.source_folder, "CMake", "FindZstd.cmake"), "if(UNIX)", "if(0)") + + # c-ares + replace_in_file(self, cmakelists, "find_package(CARES REQUIRED)", "find_package(c-ares REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "${CARES_LIBRARY}", "c-ares::cares") + + # libpsl + if self._has_with_libpsl_option: + replace_in_file(self, cmakelists, "find_package(LibPSL)", "find_package(libpsl REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "if(LIBPSL_FOUND)", "if(libpsl_FOUND)") + replace_in_file(self, cmakelists, "${LIBPSL_LIBRARY}", "libpsl::libpsl") + replace_in_file(self, cmakelists, "${LIBPSL_INCLUDE_DIR}", "${libpsl_INCLUDE_DIRS}") + + # libssh2 + replace_in_file(self, cmakelists, "find_package(LibSSH2)", "find_package(Libssh2 REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "if(LIBSSH2_FOUND)", "if(Libssh2_FOUND)") + replace_in_file(self, cmakelists, "${LIBSSH2_LIBRARY}", "Libssh2::libssh2") + replace_in_file(self, cmakelists, "${LIBSSH2_INCLUDE_DIR}", "${Libssh2_INCLUDE_DIRS}") + # libnghttp2 - replace_in_file(self, - cmakelists, - "find_package(NGHTTP2 REQUIRED)", - "find_package(libnghttp2 REQUIRED)", - ) - replace_in_file(self, - cmakelists, - "include_directories(${NGHTTP2_INCLUDE_DIRS})", - "", - ) - replace_in_file(self, - cmakelists, - "list(APPEND CURL_LIBS ${NGHTTP2_LIBRARIES})", - "list(APPEND CURL_LIBS libnghttp2::nghttp2)", - ) + replace_in_file(self, cmakelists, "find_package(NGHTTP2 REQUIRED)", "find_package(libnghttp2 REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "${NGHTTP2_INCLUDE_DIRS}", "${libnghttp2_INCLUDE_DIRS}") + replace_in_file(self, cmakelists, "${NGHTTP2_LIBRARIES}", "libnghttp2::nghttp2") + + # wolfssl + replace_in_file(self, cmakelists, "find_package(WolfSSL REQUIRED)", "find_package(wolfssl REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "${WolfSSL_LIBRARIES}", "${wolfssl_LIBRARIES}") + replace_in_file(self, cmakelists, "${WolfSSL_INCLUDE_DIRS}", "${wolfssl_INCLUDE_DIRS}") # INTERFACE_LIBRARY (generated by the cmake_find_package generator) targets doesn't have the LOCATION property. # So skipp the LOCATION check in the CMakeLists.txt @@ -344,111 +366,152 @@ def _patch_cmake(self): get_target_property(_lib "${_libname}" LOCATION)""", ) - def _get_configure_command_args(self): - yes_no = lambda v: "yes" if v else "no" - params = [ - "--with-libidn2={}".format(yes_no(self.options.with_libidn)), - "--with-librtmp={}".format(yes_no(self.options.with_librtmp)), - "--with-libpsl={}".format(yes_no(self.options.with_libpsl)), - "--with-schannel={}".format(yes_no(self.options.with_ssl == "schannel")), - "--with-secure-transport={}".format(yes_no(self.options.with_ssl == "darwinssl")), - "--with-brotli={}".format(yes_no(self.options.with_brotli)), - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-dict={}".format(yes_no(self.options.with_dict)), - "--enable-file={}".format(yes_no(self.options.with_file)), - "--enable-ftp={}".format(yes_no(self.options.with_ftp)), - "--enable-gopher={}".format(yes_no(self.options.with_gopher)), - "--enable-http={}".format(yes_no(self.options.with_http)), - "--enable-imap={}".format(yes_no(self.options.with_imap)), - "--enable-ldap={}".format(yes_no(self.options.with_ldap)), - "--enable-mqtt={}".format(yes_no(self.options.with_mqtt)), - "--enable-pop3={}".format(yes_no(self.options.with_pop3)), - "--enable-rtsp={}".format(yes_no(self.options.with_rtsp)), - "--enable-smb={}".format(yes_no(self.options.with_smb)), - "--enable-smtp={}".format(yes_no(self.options.with_smtp)), - "--enable-telnet={}".format(yes_no(self.options.with_telnet)), - "--enable-tftp={}".format(yes_no(self.options.with_tftp)), - "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), - "--enable-ares={}".format(yes_no(self.options.with_c_ares)), - "--enable-threaded-resolver={}".format(yes_no(self.options.with_threaded_resolver)), - "--enable-cookies={}".format(yes_no(self.options.with_cookies)), - "--enable-ipv6={}".format(yes_no(self.options.with_ipv6)), - "--enable-manual={}".format(yes_no(self.options.with_docs)), - "--enable-verbose={}".format(yes_no(self.options.with_verbose_debug)), - "--enable-symbol-hiding={}".format(yes_no(self.options.with_symbol_hiding)), - "--enable-unix-sockets={}".format(yes_no(self.options.with_unix_sockets)), - ] + def _yes_no(self, value): + return "yes" if value else "no" + + def _generate_with_autotools(self): + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + f"--with-libidn2={self._yes_no(self.options.with_libidn)}", + f"--with-librtmp={self._yes_no(self.options.with_librtmp)}", + f"--with-libpsl={self._yes_no(self.options.with_libpsl)}", + f"--with-libgsasl={self._yes_no(self.options.with_libgsasl)}", + f"--with-schannel={self._yes_no(self.options.with_ssl == 'schannel')}", + f"--with-secure-transport={self._yes_no(self.options.with_ssl == 'darwinssl')}", + f"--with-brotli={self._yes_no(self.options.with_brotli)}", + f"--enable-shared={self._yes_no(self.options.shared)}", + f"--enable-static={self._yes_no(not self.options.shared)}", + f"--enable-dict={self._yes_no(self.options.with_dict)}", + f"--enable-file={self._yes_no(self.options.with_file)}", + f"--enable-ftp={self._yes_no(self.options.with_ftp)}", + f"--enable-gopher={self._yes_no(self.options.with_gopher)}", + f"--enable-http={self._yes_no(self.options.with_http)}", + f"--enable-imap={self._yes_no(self.options.with_imap)}", + f"--enable-ldap={self._yes_no(self.options.with_ldap)}", + f"--enable-mqtt={self._yes_no(self.options.with_mqtt)}", + f"--enable-pop3={self._yes_no(self.options.with_pop3)}", + f"--enable-rtsp={self._yes_no(self.options.with_rtsp)}", + f"--enable-smb={self._yes_no(self.options.with_smb)}", + f"--enable-smtp={self._yes_no(self.options.with_smtp)}", + f"--enable-telnet={self._yes_no(self.options.with_telnet)}", + f"--enable-tftp={self._yes_no(self.options.with_tftp)}", + f"--enable-debug={self._yes_no(self.settings.build_type == 'Debug')}", + f"--enable-ares={self._yes_no(self.options.with_c_ares)}", + f"--enable-threaded-resolver={self._yes_no(self.options.with_threaded_resolver)}", + f"--enable-cookies={self._yes_no(self.options.with_cookies)}", + f"--enable-ipv6={self._yes_no(self.options.with_ipv6)}", + f"--enable-manual={self._yes_no(self.options.with_docs)}", + f"--enable-verbose={self._yes_no(self.options.with_verbose_debug)}", + f"--enable-symbol-hiding={self._yes_no(self.options.with_symbol_hiding)}", + f"--enable-unix-sockets={self._yes_no(self.options.get_safe('with_unix_sockets'))}", + f"--with-zstd={self._yes_no(self.options.with_zstd)}", + ]) + + # Since 7.77.0, disabling TLS must be explicitly requested otherwise it fails + if Version(self.version) >= "7.77.0" and not self.options.with_ssl: + tc.configure_args.append("--without-ssl") + + openssl_option = "ssl" if Version(self.version) < "7.77.0" else "openssl" if self.options.with_ssl == "openssl": - params.append("--with-ssl={}".format(tools.unix_path(self.deps_cpp_info["openssl"].rootpath))) + path = unix_path(self, self.dependencies["openssl"].package_folder) + tc.configure_args.append(f"--with-{openssl_option}={path}") else: - params.append("--without-ssl") + tc.configure_args.append(f"--without-{openssl_option}") + if self.options.with_ssl == "wolfssl": - params.append("--with-wolfssl={}".format(tools.unix_path(self.deps_cpp_info["wolfssl"].rootpath))) + path = unix_path(self, self.dependencies["wolfssl"].package_folder) + tc.configure_args.append(f"--with-wolfssl={path}") else: - params.append("--without-wolfssl") + tc.configure_args.append("--without-wolfssl") if self.options.with_libssh2: - params.append("--with-libssh2={}".format(tools.unix_path(self.deps_cpp_info["libssh2"].rootpath))) + path = unix_path(self, self.dependencies["libssh2"].package_folder) + tc.configure_args.append(f"--with-libssh2={path}") else: - params.append("--without-libssh2") + tc.configure_args.append("--without-libssh2") if self.options.with_nghttp2: - params.append("--with-nghttp2={}".format(tools.unix_path(self.deps_cpp_info["libnghttp2"].rootpath))) + path = unix_path(self, self.dependencies["libnghttp2"].package_folder) + tc.configure_args.append(f"--with-nghttp2={path}") else: - params.append("--without-nghttp2") + tc.configure_args.append("--without-nghttp2") if self.options.with_zlib: - params.append("--with-zlib={}".format(tools.unix_path(self.deps_cpp_info["zlib"].rootpath))) + path = unix_path(self, self.dependencies["zlib"].package_folder) + tc.configure_args.append(f"--with-zlib={path}") else: - params.append("--without-zlib") - - if self._has_zstd_option: - params.append("--with-zstd={}".format(yes_no(self.options.with_zstd))) + tc.configure_args.append("--without-zlib") if self._has_metalink_option: - params.append("--with-libmetalink={}".format(yes_no(self.options.with_libmetalink))) + tc.configure_args.append(f"--with-libmetalink={self._yes_no(self.options.with_libmetalink)}") if not self.options.with_proxy: - params.append("--disable-proxy") + tc.configure_args.append("--disable-proxy") if not self.options.with_rtsp: - params.append("--disable-rtsp") + tc.configure_args.append("--disable-rtsp") if not self.options.with_crypto_auth: - params.append("--disable-crypto-auth") # also disables NTLM in versions of curl prior to 7.78.0 + tc.configure_args.append("--disable-crypto-auth") # also disables NTLM in versions of curl prior to 7.78.0 # ntlm will default to enabled if any SSL options are enabled if not self.options.with_ntlm: if Version(self.version) <= "7.77.0": - params.append("--disable-crypto-auth") + tc.configure_args.append("--disable-crypto-auth") else: - params.append("--disable-ntlm") + tc.configure_args.append("--disable-ntlm") if not self.options.with_ntlm_wb: - params.append("--disable-ntlm-wb") + tc.configure_args.append("--disable-ntlm-wb") - if self.options.with_ca_bundle == False: - params.append("--without-ca-bundle") - elif self.options.with_ca_bundle: - params.append("--with-ca-bundle=" + str(self.options.with_ca_bundle)) + if not self.options.with_ca_bundle: + tc.configure_args.append("--without-ca-bundle") + elif self.options.with_ca_bundle != "auto": + tc.configure_args.append(f"--with-ca-bundle={str(self.options.with_ca_bundle)}") - if self.options.with_ca_path == False: - params.append('--without-ca-path') - elif self.options.with_ca_path: - params.append("--with-ca-path=" + str(self.options.with_ca_path)) + if not self.options.with_ca_path: + tc.configure_args.append("--without-ca-path") + elif self.options.with_ca_path != "auto": + tc.configure_args.append(f"--with-ca-path={str(self.options.with_ca_path)}") # Cross building flags if cross_building(self): if self.settings.os == "Linux" and "arm" in self.settings.arch: - params.append("--host=%s" % self._get_linux_arm_host()) + tc.configure_args.append(f"--host={self._get_linux_arm_host()}") elif self.settings.os == "iOS": - params.append("--enable-threaded-resolver") - params.append("--disable-verbose") + tc.configure_args.append("--enable-threaded-resolver") + tc.configure_args.append("--disable-verbose") elif self.settings.os == "Android": pass # this just works, conan is great! - return params + env = tc.environment() + + # tweaks for mingw + if self._is_mingw: + rcflags = "-O COFF" + if self.settings.arch == "x86": + rcflags += " --target=pe-i386" + elif self.settings.arch == "x86_64": + rcflags += " --target=pe-x86-64" + tc.extra_defines.append("_AMD64_") + env.define("RCFLAGS", rcflags) + + if self.settings.os != "Windows": + tc.fpic = self.options.get_safe("fPIC", True) + + + if cross_building(self) and is_apple_os(self): + tc.extra_defines.extend(['HAVE_SOCKET', 'HAVE_FCNTL_O_NONBLOCK']) + + tc.generate(env) + tc = PkgConfigDeps(self) + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() def _get_linux_arm_host(self): arch = None @@ -472,150 +535,91 @@ def _arm_version(self, arch): version = int(match.group(1)) return version - def _build_with_autotools(self): - with chdir(self, self._source_subfolder): - # autoreconf - self.run("{} -fiv".format(tools.get_env("AUTORECONF") or "autoreconf"), win_bash=tools.os_info.is_windows, run_environment=True) - - # fix generated autotools files to have relocatable binaries - if is_apple_os(self): - replace_in_file(self, "configure", "-install_name \\$rpath/", "-install_name @rpath/") - - self.run("chmod +x configure") - - # run configure with *LD_LIBRARY_PATH env vars it allows to pick up shared openssl - with tools.run_environment(self): - autotools, autotools_vars = self._configure_autotools() - autotools.make(vars=autotools_vars) - - def _configure_autotools_vars(self): - autotools_vars = {} - # tweaks for mingw - if self._is_mingw: - autotools_vars["RCFLAGS"] = "-O COFF" - if self.settings.arch == "x86": - autotools_vars["RCFLAGS"] += " --target=pe-i386" - else: - autotools_vars["RCFLAGS"] += " --target=pe-x86-64" - return autotools_vars - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - - if self.settings.os != "Windows": - autotools.fpic = self.options.get_safe("fPIC", True) - - autotools_vars = self._configure_autotools_vars() - - # tweaks for mingw - if self._is_mingw: - autotools.defines.append("_AMD64_") - - if cross_building(self) and is_apple_os(self): - autotools.defines.extend(['HAVE_SOCKET', 'HAVE_FCNTL_O_NONBLOCK']) - - configure_args = self._get_configure_command_args() - - if self.settings.os == "iOS" and self.settings.arch == "x86_64": - # please do not autodetect --build for the iOS simulator, thanks! - autotools.configure(vars=autotools_vars, args=configure_args, build=False) - else: - autotools.configure(vars=autotools_vars, args=configure_args) - - return autotools, autotools_vars - - @functools.lru_cache(1) - def _configure_cmake(self): + def _generate_with_cmake(self): if self._is_win_x_android: - cmake = CMake(self, generator="Ninja") + tc = CMakeToolchain(self, generator="Ninja") else: - cmake = CMake(self) - cmake.definitions["BUILD_TESTING"] = False - cmake.definitions["BUILD_CURL_EXE"] = False - cmake.definitions["CURL_DISABLE_LDAP"] = not self.options.with_ldap - cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared - cmake.definitions["CURL_STATICLIB"] = not self.options.shared - cmake.definitions["CMAKE_DEBUG_POSTFIX"] = "" + tc = CMakeToolchain(self) + tc.variables["ENABLE_UNICODE"] = True + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_CURL_EXE"] = False + tc.variables["CURL_DISABLE_LDAP"] = not self.options.with_ldap + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["CURL_STATICLIB"] = not self.options.shared + tc.variables["CMAKE_DEBUG_POSTFIX"] = "" if Version(self.version) >= "7.81.0": - cmake.definitions["CURL_USE_SCHANNEL"] = self.options.with_ssl == "schannel" - elif Version(self.version) >= "7.72.0": - cmake.definitions["CMAKE_USE_SCHANNEL"] = self.options.with_ssl == "schannel" + tc.variables["CURL_USE_SCHANNEL"] = self.options.with_ssl == "schannel" else: - cmake.definitions["CMAKE_USE_WINSSL"] = self.options.with_ssl == "schannel" + tc.variables["CMAKE_USE_SCHANNEL"] = self.options.with_ssl == "schannel" if Version(self.version) >= "7.81.0": - cmake.definitions["CURL_USE_OPENSSL"] = self.options.with_ssl == "openssl" + tc.variables["CURL_USE_OPENSSL"] = self.options.with_ssl == "openssl" else: - cmake.definitions["CMAKE_USE_OPENSSL"] = self.options.with_ssl == "openssl" + tc.variables["CMAKE_USE_OPENSSL"] = self.options.with_ssl == "openssl" if Version(self.version) >= "7.81.0": - cmake.definitions["CURL_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl" - elif Version(self.version) >= "7.70.0": - cmake.definitions["CMAKE_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl" - cmake.definitions["USE_NGHTTP2"] = self.options.with_nghttp2 - cmake.definitions["CURL_ZLIB"] = self.options.with_zlib - cmake.definitions["CURL_BROTLI"] = self.options.with_brotli - if self._has_zstd_option: - cmake.definitions["CURL_ZSTD"] = self.options.with_zstd + tc.variables["CURL_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl" + else: + tc.variables["CMAKE_USE_WOLFSSL"] = self.options.with_ssl == "wolfssl" + tc.variables["USE_NGHTTP2"] = self.options.with_nghttp2 + tc.variables["CURL_ZLIB"] = self.options.with_zlib + tc.variables["CURL_BROTLI"] = self.options.with_brotli + tc.variables["CURL_ZSTD"] = self.options.with_zstd + if self._has_with_libpsl_option: + tc.variables["CURL_USE_LIBPSL"] = self.options.with_libpsl if Version(self.version) >= "7.81.0": - cmake.definitions["CURL_USE_LIBSSH2"] = self.options.with_libssh2 + tc.variables["CURL_USE_LIBSSH2"] = self.options.with_libssh2 else: - cmake.definitions["CMAKE_USE_LIBSSH2"] = self.options.with_libssh2 - cmake.definitions["ENABLE_ARES"] = self.options.with_c_ares + tc.variables["CMAKE_USE_LIBSSH2"] = self.options.with_libssh2 + tc.variables["ENABLE_ARES"] = self.options.with_c_ares if not self.options.with_c_ares: - cmake.definitions["ENABLE_THREADED_RESOLVER"] = self.options.with_threaded_resolver - cmake.definitions["CURL_DISABLE_PROXY"] = not self.options.with_proxy - cmake.definitions["USE_LIBRTMP"] = self.options.with_librtmp - if Version(self.version) >= "7.75.0": - cmake.definitions["USE_LIBIDN2"] = self.options.with_libidn - cmake.definitions["CURL_DISABLE_RTSP"] = not self.options.with_rtsp - cmake.definitions["CURL_DISABLE_CRYPTO_AUTH"] = not self.options.with_crypto_auth - cmake.definitions["CURL_DISABLE_VERBOSE_STRINGS"] = not self.options.with_verbose_strings + tc.variables["ENABLE_THREADED_RESOLVER"] = self.options.with_threaded_resolver + tc.variables["CURL_DISABLE_PROXY"] = not self.options.with_proxy + tc.variables["USE_LIBRTMP"] = self.options.with_librtmp + tc.variables["USE_LIBIDN2"] = self.options.with_libidn + tc.variables["CURL_DISABLE_RTSP"] = not self.options.with_rtsp + tc.variables["CURL_DISABLE_CRYPTO_AUTH"] = not self.options.with_crypto_auth + tc.variables["CURL_DISABLE_VERBOSE_STRINGS"] = not self.options.with_verbose_strings # Also disables NTLM_WB if set to false if not self.options.with_ntlm: if Version(self.version) <= "7.77.0": - cmake.definitions["CURL_DISABLE_CRYPTO_AUTH"] = True + tc.variables["CURL_DISABLE_CRYPTO_AUTH"] = True else: - cmake.definitions["CURL_DISABLE_NTLM"] = True - cmake.definitions["NTLM_WB_ENABLED"] = self.options.with_ntlm_wb + tc.variables["CURL_DISABLE_NTLM"] = True + tc.variables["NTLM_WB_ENABLED"] = self.options.with_ntlm_wb - if self.options.with_ca_bundle == False: - cmake.definitions['CURL_CA_BUNDLE'] = 'none' - elif self.options.with_ca_bundle: - cmake.definitions['CURL_CA_BUNDLE'] = self.options.with_ca_bundle + if self.options.with_ca_bundle: + tc.cache_variables["CURL_CA_BUNDLE"] = str(self.options.with_ca_bundle) + else: + tc.cache_variables["CURL_CA_BUNDLE"] = "none" - if self.options.with_ca_path == False: - cmake.definitions['CURL_CA_PATH'] = 'none' - elif self.options.with_ca_path: - cmake.definitions['CURL_CA_PATH'] = self.options.with_ca_path + if self.options.with_ca_path: + tc.cache_variables["CURL_CA_PATH"] = str(self.options.with_ca_path) + else: + tc.cache_variables["CURL_CA_PATH"] = "none" - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.generate() - def _build_with_cmake(self): - cmake = self._configure_cmake() - cmake.build() + deps = CMakeDeps(self) + deps.generate() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - self.copy("cacert.pem", dst="res") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "cacert.pem", src=self.source_folder, dst=os.path.join(self.package_folder, "res")) if self._is_using_cmake_build: - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) else: - with tools.run_environment(self): - with chdir(self, self._source_subfolder): - autotools, autotools_vars = self._configure_autotools() - autotools.install(vars=autotools_vars) + autotools = Autotools(self) + autotools.install() rmdir(self, os.path.join(self.package_folder, "share")) - for la_file in glob.glob(os.path.join(self.package_folder, "lib", "*.la")): - os.remove(la_file) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) if self._is_mingw and self.options.shared: # Handle only mingw libs - self.copy(pattern="*.dll", dst="bin", keep_path=False) - self.copy(pattern="*.dll.a", dst="lib", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) + copy(self, pattern="*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, pattern="*.dll.a", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, pattern="*.lib", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + fix_apple_shared_install_name(self) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): @@ -624,6 +628,7 @@ def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("pkg_config_name", "libcurl") + self.cpp_info.components["curl"].resdirs = ["res"] if is_msvc(self): self.cpp_info.components["curl"].libs = ["libcurl_imp"] if self.options.shared else ["libcurl"] else: @@ -644,12 +649,14 @@ def package_info(self): if self.options.with_ssl == "schannel": self.cpp_info.components["curl"].system_libs.append("crypt32") elif is_apple_os(self): + if Version(self.version) >= "7.78.0" or self.options.with_ssl == "darwinssl": + self.cpp_info.components["curl"].frameworks.append("CoreFoundation") if Version(self.version) >= "7.77.0": self.cpp_info.components["curl"].frameworks.append("SystemConfiguration") if self.options.with_ldap: self.cpp_info.components["curl"].system_libs.append("ldap") if self.options.with_ssl == "darwinssl": - self.cpp_info.components["curl"].frameworks.extend(["CoreFoundation", "Security"]) + self.cpp_info.components["curl"].frameworks.append("Security") if self._is_mingw: # provide pthread for dependent packages @@ -672,10 +679,12 @@ def package_info(self): self.cpp_info.components["curl"].requires.append("zlib::zlib") if self.options.with_brotli: self.cpp_info.components["curl"].requires.append("brotli::brotli") - if self.options.get_safe("with_zstd"): + if self.options.with_zstd: self.cpp_info.components["curl"].requires.append("zstd::zstd") if self.options.with_c_ares: self.cpp_info.components["curl"].requires.append("c-ares::c-ares") + if self.options.get_safe("with_libpsl"): + self.cpp_info.components["curl"].requires.append("libpsl::libpsl") # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "CURL" diff --git a/recipes/libcurl/all/test_package/CMakeLists.txt b/recipes/libcurl/all/test_package/CMakeLists.txt index c1a339c384346..a36a89aea9b2b 100644 --- a/recipes/libcurl/all/test_package/CMakeLists.txt +++ b/recipes/libcurl/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(CURL REQUIRED) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/libcurl/all/test_package/conanfile.py b/recipes/libcurl/all/test_package/conanfile.py index 6221e377a7254..b0f5c0aed58a5 100644 --- a/recipes/libcurl/all/test_package/conanfile.py +++ b/recipes/libcurl/all/test_package/conanfile.py @@ -1,22 +1,21 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os import subprocess import re class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" - - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -25,14 +24,11 @@ def build(self): @property def _test_executable(self): - if self.settings.os == "Windows": - return os.path.join("bin", "test_package.exe") - else: - return os.path.join("bin", "test_package") + return os.path.join(self.cpp.build.bindirs[0], "test_package") def test(self): - if not cross_building(self): - self.run(self._test_executable, run_environment=True) + if can_run(self): + self.run(self._test_executable, env="conanrun") else: # We will dump information for the generated executable if self.settings.os in ["Android", "iOS"]: @@ -42,15 +38,15 @@ def test(self): output = subprocess.check_output(["file", self._test_executable]).decode() if self.settings.os == "Macos" and self.settings.arch == "armv8": - assert "Mach-O 64-bit executable arm64" in output, "Not found in output: {}".format(output) + assert "Mach-O 64-bit executable arm64" in output, f"Not found in output: {output}" elif self.settings.os == "Linux": if self.settings.arch == "armv8_32": - assert re.search(r"Machine:\s+ARM", output), "Not found in output: {}".format(output) + assert re.search(r"Machine:\s+ARM", output), f"Not found in output: {output}" elif "armv8" in self.settings.arch: - assert re.search(r"Machine:\s+AArch64", output), "Not found in output: {}".format(output) + assert re.search(r"Machine:\s+AArch64", output), f"Not found in output: {output}" elif "arm" in self.settings.arch: - assert re.search(r"Machine:\s+ARM", output), "Not found in output: {}".format(output) + assert re.search(r"Machine:\s+ARM", output), f"Not found in output: {output}" elif self.settings.os == "Windows": # FIXME: It satisfies not only MinGW - assert re.search(r"PE32.*executable.*Windows", output), "Not found in output: {}".format(output) + assert re.search(r"PE32.*executable.*Windows", output), f"Not found in output: {output}" diff --git a/recipes/libcurl/all/test_package/test_package.c b/recipes/libcurl/all/test_package/test_package.c index ed7ab4e3952c6..309b36d2e45f9 100644 --- a/recipes/libcurl/all/test_package/test_package.c +++ b/recipes/libcurl/all/test_package/test_package.c @@ -23,7 +23,7 @@ int main(void) /* provide a buffer to store errors in */ curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, errbuf); - /* always cleanup */ + /* always cleanup */ curl_easy_cleanup(curl); printf("Succeed\n"); } else { diff --git a/recipes/libcurl/all/test_v1_package/CMakeLists.txt b/recipes/libcurl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..87b6e499b5d8e --- /dev/null +++ b/recipes/libcurl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(CURL REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} CURL::libcurl) diff --git a/recipes/libcurl/all/test_v1_package/conanfile.py b/recipes/libcurl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7ebb558a2d5e3 --- /dev/null +++ b/recipes/libcurl/all/test_v1_package/conanfile.py @@ -0,0 +1,43 @@ +from conans import ConanFile, CMake, tools +import os +import subprocess +import re + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + @property + def _test_executable(self): + return os.path.join("bin", "test_package") + + def test(self): + if not tools.cross_building(self): + self.run(self._test_executable, run_environment=True) + else: + # We will dump information for the generated executable + if self.settings.os in ["Android", "iOS"]: + # FIXME: Check output for these hosts + return + + output = subprocess.check_output(["file", self._test_executable]).decode() + + if self.settings.os == "Macos" and self.settings.arch == "armv8": + assert "Mach-O 64-bit executable arm64" in output, f"Not found in output: {output}" + + elif self.settings.os == "Linux": + if self.settings.arch == "armv8_32": + assert re.search(r"Machine:\s+ARM", output), f"Not found in output: {output}" + elif "armv8" in self.settings.arch: + assert re.search(r"Machine:\s+AArch64", output), f"Not found in output: {output}" + elif "arm" in self.settings.arch: + assert re.search(r"Machine:\s+ARM", output), f"Not found in output: {output}" + + elif self.settings.os == "Windows": # FIXME: It satisfies not only MinGW + assert re.search(r"PE32.*executable.*Windows", output), f"Not found in output: {output}" diff --git a/recipes/libcurl/config.yml b/recipes/libcurl/config.yml index 55377e18201ce..5bb005da00271 100644 --- a/recipes/libcurl/config.yml +++ b/recipes/libcurl/config.yml @@ -1,4 +1,10 @@ versions: + "7.87.0": + folder: all + "7.86.0": + folder: all + "7.85.0": + folder: all "7.84.0": folder: all "7.83.1": diff --git a/recipes/libdaemon/all/conanfile.py b/recipes/libdaemon/all/conanfile.py index 50c4b454d51c2..92f0ca045e87d 100644 --- a/recipes/libdaemon/all/conanfile.py +++ b/recipes/libdaemon/all/conanfile.py @@ -1,9 +1,16 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" + class LibDaemonConan(ConanFile): name = "libdaemon" @@ -12,82 +19,82 @@ class LibDaemonConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "http://0pointer.de/lennart/projects/libdaemon/" license = "LGPL-2.1-or-later" - settings = "os", "arch", "compiler", "build_type" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "fPIC": [True, False] + "fPIC": [True, False], } default_options = { "shared": False, - "fPIC": True + "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): raise ConanInvalidConfiguration("Visual Studio not supported") def build_requirements(self): - self.build_requires("gnu-config/cci.20201022") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("gnu-config/cci.20210814") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--disable-examples", - ] - if tools.cross_building(self): - args.append("ac_cv_func_setpgrp_void=yes") - self._autotools.configure(configure_dir=self._source_subfolder, args=args) - return self._autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-examples") + if cross_building(self): + tc.configure_args.append("ac_cv_func_setpgrp_void=yes") + tc.generate() + + def _patch_sources(self): + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) def build(self): - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - autotools = self._configure_autotools() + self._patch_sources() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - autotools = self._configure_autotools() - autotools.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "share")) - + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) + def package_info(self): - self.cpp_info.names["pkg_config"] = "libdaemon" + self.cpp_info.set_property("pkg_config_name", "libdaemon") self.cpp_info.libs = ["daemon"] diff --git a/recipes/libdaemon/all/test_package/CMakeLists.txt b/recipes/libdaemon/all/test_package/CMakeLists.txt index 34af13462f44f..23288e5f6af93 100644 --- a/recipes/libdaemon/all/test_package/CMakeLists.txt +++ b/recipes/libdaemon/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libdaemon REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libdaemon::libdaemon) diff --git a/recipes/libdaemon/all/test_package/conanfile.py b/recipes/libdaemon/all/test_package/conanfile.py index 951b258757964..c46f4c5ac93f7 100644 --- a/recipes/libdaemon/all/test_package/conanfile.py +++ b/recipes/libdaemon/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - self.run(bin_path + " -k", run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + self.run(f"{bin_path} -k", env="conanrun") diff --git a/recipes/libdaemon/all/test_v1_package/CMakeLists.txt b/recipes/libdaemon/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libdaemon/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libdaemon/all/test_v1_package/conanfile.py b/recipes/libdaemon/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..93fc246e84e20 --- /dev/null +++ b/recipes/libdaemon/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + self.run(f"{bin_path} -k", run_environment=True) diff --git a/recipes/libdc1394/all/conanfile.py b/recipes/libdc1394/all/conanfile.py index 70313aabec6d8..f52cb3b808339 100644 --- a/recipes/libdc1394/all/conanfile.py +++ b/recipes/libdc1394/all/conanfile.py @@ -1,28 +1,33 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import chdir, copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class Libdc1394Conan(ConanFile): name = "libdc1394" license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" - homepage = 'https://damien.douxchamps.net/ieee1394/libdc1394/' + homepage = "https://damien.douxchamps.net/ieee1394/libdc1394/" description = "libdc1394 provides a complete high level API to control IEEE 1394 based cameras" - topics = ("conan", "ieee1394", "camera", "iidc", "dcam") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - - generators = "pkg_config" - _env_build = None - - @property - def _source_subfolder(self): - return "source_subfolder" + topics = ("ieee1394", "camera", "iidc", "dcam") + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -30,65 +35,69 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("libusb/1.0.24") + self.requires("libusb/1.0.26") def validate(self): - if self.settings.os == "Windows": + if self.info.settings.os == "Windows": raise ConanInvalidConfiguration("Windows is not supported yet in this recipe") - if self.settings.compiler == "clang": + if self.info.settings.compiler == "clang": raise ConanInvalidConfiguration("Clang doesn't support VLA") def build_requirements(self): - self.build_requires("gnu-config/cci.20201022") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("gnu-config/cci.20210814") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", None) or self.deps_user_info - - def _configure_autotools(self): - if not self._env_build: - self._env_build = AutoToolsBuildEnvironment(self) - if self.options.shared: - args = ["--disable-static", "--enable-shared"] - else: - args = ["--disable-shared", "--enable-static"] - args.extend(["--disable-examples"]) - self._env_build.configure(args=args) - return self._env_build + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-examples") + tc.generate() + deps = PkgConfigDeps(self) + deps.generate() + + def _patch_sources(self): + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) def build(self): - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - with tools.chdir(self._source_subfolder): - env_build = self._configure_autotools() - env_build.make() + self._patch_sources() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - with tools.chdir(self._source_subfolder): - env_build = self._configure_autotools() - env_build.install() - - self.copy(pattern="COPYING", src=self._source_subfolder, dst="licenses") - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.names["pkg_config"] = "libdc1394-{}".format(tools.Version(self.version).major) + self.cpp_info.set_property("pkg_config_name", f"libdc1394-{Version(self.version).major}") self.cpp_info.libs = ["dc1394"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): self.cpp_info.frameworks.extend(["CoreFoundation", "CoreServices", "IOKit"]) diff --git a/recipes/libdc1394/all/test_package/CMakeLists.txt b/recipes/libdc1394/all/test_package/CMakeLists.txt index 40d74d212ef72..97fa5a2906309 100644 --- a/recipes/libdc1394/all/test_package/CMakeLists.txt +++ b/recipes/libdc1394/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libdc1394 REQUIRED CONFIG) -add_executable(example test_package.c) -target_link_libraries(example ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libdc1394::libdc1394) diff --git a/recipes/libdc1394/all/test_package/conanfile.py b/recipes/libdc1394/all/test_package/conanfile.py index c1297fa185e7a..0a6bc68712d90 100644 --- a/recipes/libdc1394/all/test_package/conanfile.py +++ b/recipes/libdc1394/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" -class Libdc1394TestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdc1394/all/test_v1_package/CMakeLists.txt b/recipes/libdc1394/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libdc1394/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libdc1394/all/test_v1_package/conanfile.py b/recipes/libdc1394/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libdc1394/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libde265/all/conandata.yml b/recipes/libde265/all/conandata.yml index ea045a30196d1..41fa34ac17f80 100644 --- a/recipes/libde265/all/conandata.yml +++ b/recipes/libde265/all/conandata.yml @@ -1,8 +1,13 @@ sources: + "1.0.9": + url: "https://github.com/strukturag/libde265/releases/download/v1.0.9/libde265-1.0.9.tar.gz" + sha256: "29bc6b64bf658d81a4446a3f98e0e4636fd4fd3d971b072d440cef987d5439de" "1.0.8": - url: "https://github.com/strukturag/libde265/archive/v1.0.8.tar.gz" - sha256: "c5ab61185f283f46388c700c43dc08606b0e260cd53f06b967ec0ad7a809ff11" + url: "https://github.com/strukturag/libde265/releases/download/v1.0.8/libde265-1.0.8.tar.gz" + sha256: "24c791dd334fa521762320ff54f0febfd3c09fc978880a8c5fbc40a88f21d905" patches: + "1.0.9": + - patch_file: "patches/0002-fix-out-of-source-build.patch" "1.0.8": - patch_file: "patches/0001-optional-sdl.patch" - patch_file: "patches/0002-fix-out-of-source-build.patch" diff --git a/recipes/libde265/all/conanfile.py b/recipes/libde265/all/conanfile.py index d6051d473a9ba..0df8a034f43d3 100644 --- a/recipes/libde265/all/conanfile.py +++ b/recipes/libde265/all/conanfile.py @@ -1,19 +1,18 @@ from conan import ConanFile -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, stdcpp_library from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir, save -from conans import tools as tools_legacy +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class Libde265Conan(ConanFile): name = "libde265" description = "Open h.265 video codec implementation." license = "LGPL-3.0-or-later" - topics = ("libde265", "codec", "video", "h.265") + topics = ("codec", "video", "h.265") homepage = "https://github.com/strukturag/libde265" url = "https://github.com/conan-io/conan-center-index" @@ -30,8 +29,7 @@ class Libde265Conan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -41,26 +39,23 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) tc.variables["ENABLE_SDL"] = False tc.variables["DISABLE_SSE"] = not self.options.get_safe("sse", False) - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def _patch_sources(self): @@ -89,17 +84,17 @@ def package(self): def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) + """) save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "libde265") @@ -112,14 +107,11 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m", "pthread"] if not self.options.shared: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.system_libs.append(libcxx) - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/libde265/all/test_package/conanfile.py b/recipes/libde265/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/libde265/all/test_package/conanfile.py +++ b/recipes/libde265/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/libde265/all/test_v1_package/CMakeLists.txt b/recipes/libde265/all/test_v1_package/CMakeLists.txt index 8cdef54586d33..0d20897301b68 100644 --- a/recipes/libde265/all/test_v1_package/CMakeLists.txt +++ b/recipes/libde265/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libde265 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE libde265) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libde265/all/test_v1_package/conanfile.py b/recipes/libde265/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/libde265/all/test_v1_package/conanfile.py +++ b/recipes/libde265/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/libde265/config.yml b/recipes/libde265/config.yml index 28e3ee22ca8ac..1c656ce0b375f 100644 --- a/recipes/libde265/config.yml +++ b/recipes/libde265/config.yml @@ -1,3 +1,5 @@ versions: + "1.0.9": + folder: all "1.0.8": folder: all diff --git a/recipes/libdeflate/all/conandata.yml b/recipes/libdeflate/all/conandata.yml index 3cde5f3099a8c..a4d8bdf0c97fa 100644 --- a/recipes/libdeflate/all/conandata.yml +++ b/recipes/libdeflate/all/conandata.yml @@ -1,32 +1,7 @@ sources: - "1.12": - url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.12.tar.gz" - sha256: "ba89fb167a5ab6bbdfa6ee3b1a71636e8140fa8471cce8a311697584948e4d06" - "1.10": - url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.10.tar.gz" - sha256: "5c1f75c285cd87202226f4de49985dcb75732f527eefba2b3ddd70a8865f2533" - "1.9": - url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.9.tar.gz" - sha256: "a537ab6125c226b874c02b166488b326aece954930260dbf682d88fc339137e3" - "1.8": - url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.8.tar.gz" - sha256: "50711ad4e9d3862f8dfb11b97eb53631a86ee3ce49c0e68ec2b6d059a9662f61" - "1.7": - url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.7.tar.gz" - sha256: "a5e6a0a9ab69f40f0f59332106532ca76918977a974e7004977a9498e3f11350" -patches: - "1.12": - - patch_file: "patches/1.12-0001-fix-makefiles.patch" - base_path: "source_subfolder" - "1.10": - - patch_file: "patches/1.9-0001-fix-makefiles.patch" - base_path: "source_subfolder" - "1.9": - - patch_file: "patches/1.9-0001-fix-makefiles.patch" - base_path: "source_subfolder" - "1.8": - - patch_file: "patches/1.7-0001-fix-makefiles.patch" - base_path: "source_subfolder" - "1.7": - - patch_file: "patches/1.7-0001-fix-makefiles.patch" - base_path: "source_subfolder" + "1.17": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.17.tar.gz" + sha256: "fa4615af671513fa2a53dc2e7a89ff502792e2bdfc046869ef35160fcc373763" + "1.15": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.15.tar.gz" + sha256: "58b95040df7383dc0413defb700d9893c194732474283cc4c8f144b00a68154b" diff --git a/recipes/libdeflate/all/conanfile.py b/recipes/libdeflate/all/conanfile.py index 2added39f9f2e..0dfcbb1a51a82 100644 --- a/recipes/libdeflate/all/conanfile.py +++ b/recipes/libdeflate/all/conanfile.py @@ -1,8 +1,9 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment, tools -from conan.tools.microsoft import is_msvc +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import collect_libs, copy, get, rmdir import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibdeflateConan(ConanFile): @@ -11,7 +12,7 @@ class LibdeflateConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ebiggers/libdeflate" - topics = ("libdeflate", "compression", "decompression", "deflate", "zlib", "gzip") + topics = ("compression", "decompression", "deflate", "zlib", "gzip") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,91 +23,55 @@ class LibdeflateConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_clangcl(self): - return self.settings.compiler == "clang" and self.settings.os == "Windows" - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def build_requirements(self): - if self._settings_build.os == "Windows" and not is_msvc(self) and \ - not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _build_msvc(self): - with tools.chdir(self._source_subfolder): - with tools.vcvars(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - target = "libdeflate.dll" if self.options.shared else "libdeflatestatic.lib" - self.run("nmake /f Makefile.msc {}".format(target)) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _build_make(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with tools.chdir(self._source_subfolder): - autotools.make() + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBDEFLATE_BUILD_STATIC_LIB"] = not self.options.shared + tc.variables["LIBDEFLATE_BUILD_SHARED_LIB"] = self.options.shared + tc.variables["LIBDEFLATE_BUILD_GZIP"] = False + tc.variables["LIBDEFLATE_BUILD_TESTS"] = False + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if is_msvc(self) or self._is_clangcl: - self._build_msvc() - else: - self._build_make() - - def _package_windows(self): - self.copy("libdeflate.h", dst="include", src=self._source_subfolder) - if self.options.shared: - self.copy("*deflate.lib", dst="lib", src=self._source_subfolder) - self.copy("*deflate.dll", dst="bin", src=self._source_subfolder) - else: - self.copy("*deflatestatic.lib", dst="lib", src=self._source_subfolder) - - def _package_make(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with tools.chdir(self._source_subfolder): - autotools.install(args=["PREFIX={}".format(self.package_folder)]) - tools.rmdir(os.path.join(self.package_folder, "bin")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask( - os.path.join(self.package_folder, "lib"), - "*.a" if self.options.shared else "*.[so|dylib]*", - ) + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - if self.settings.os == "Windows": - self._package_windows() - else: - self._package_make() + copy(self, "COPYING", self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "libdeflate") + target_suffix = "" if self.options.shared else "_static" + self.cpp_info.set_property("cmake_target_name", f"libdeflate::libdeflate{target_suffix}") self.cpp_info.set_property("pkg_config_name", "libdeflate") - prefix = "lib" if self.settings.os == "Windows" else "" - suffix = "static" if self.settings.os == "Windows" and not self.options.shared else "" - self.cpp_info.libs = ["{0}deflate{1}".format(prefix, suffix)] + # TODO: back to global scope in conan v2 + self.cpp_info.components["_libdeflate"].libs = collect_libs(self) if self.settings.os == "Windows" and self.options.shared: - self.cpp_info.defines = ["LIBDEFLATE_DLL"] + self.cpp_info.components["_libdeflate"].defines.append("LIBDEFLATE_DLL") + + # TODO: to remove in conan v2 + self.cpp_info.components["_libdeflate"].names["cmake_find_package"] = f"libdeflate{target_suffix}" + self.cpp_info.components["_libdeflate"].names["cmake_find_package_multi"] = f"libdeflate{target_suffix}" + self.cpp_info.components["_libdeflate"].set_property("cmake_target_name", f"libdeflate::libdeflate{target_suffix}") + self.cpp_info.components["_libdeflate"].set_property("pkg_config_name", "libdeflate") diff --git a/recipes/libdeflate/all/test_package/CMakeLists.txt b/recipes/libdeflate/all/test_package/CMakeLists.txt index dcdf023d7a103..267cdbc24f8b8 100644 --- a/recipes/libdeflate/all/test_package/CMakeLists.txt +++ b/recipes/libdeflate/all/test_package/CMakeLists.txt @@ -1,10 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libdeflate REQUIRED CONFIG) -add_executable(test_package test_package.c) -target_link_libraries(test_package libdeflate::libdeflate) +add_executable(${PROJECT_NAME} test_package.c) +if(TARGET libdeflate::libdeflate_static) + target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate_static) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate) +endif() diff --git a/recipes/libdeflate/all/test_package/conanfile.py b/recipes/libdeflate/all/test_package/conanfile.py index 697dfef261b53..e845ae751a301 100644 --- a/recipes/libdeflate/all/test_package/conanfile.py +++ b/recipes/libdeflate/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdeflate/all/test_v1_package/CMakeLists.txt b/recipes/libdeflate/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libdeflate/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libdeflate/all/test_v1_package/conanfile.py b/recipes/libdeflate/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libdeflate/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libdeflate/config.yml b/recipes/libdeflate/config.yml index df147b016e77b..297f2db78fab2 100644 --- a/recipes/libdeflate/config.yml +++ b/recipes/libdeflate/config.yml @@ -1,11 +1,17 @@ versions: + "1.17": + folder: "all" + "1.15": + folder: "all" + "1.14": + folder: "pre_1.15" "1.12": - folder: all + folder: "pre_1.15" "1.10": - folder: all + folder: "pre_1.15" "1.9": - folder: all + folder: "pre_1.15" "1.8": - folder: all + folder: "pre_1.15" "1.7": - folder: all + folder: "pre_1.15" diff --git a/recipes/libdeflate/pre_1.15/conandata.yml b/recipes/libdeflate/pre_1.15/conandata.yml new file mode 100644 index 0000000000000..a438f626651c7 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/conandata.yml @@ -0,0 +1,44 @@ +sources: + "1.14": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.14.tar.gz" + sha256: "89e7df898c37c3427b0f39aadcf733731321a278771d20fc553f92da8d4808ac" + "1.12": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.12.tar.gz" + sha256: "ba89fb167a5ab6bbdfa6ee3b1a71636e8140fa8471cce8a311697584948e4d06" + "1.10": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.10.tar.gz" + sha256: "5c1f75c285cd87202226f4de49985dcb75732f527eefba2b3ddd70a8865f2533" + "1.9": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.9.tar.gz" + sha256: "a537ab6125c226b874c02b166488b326aece954930260dbf682d88fc339137e3" + "1.8": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.8.tar.gz" + sha256: "50711ad4e9d3862f8dfb11b97eb53631a86ee3ce49c0e68ec2b6d059a9662f61" + "1.7": + url: "https://github.com/ebiggers/libdeflate/archive/refs/tags/v1.7.tar.gz" + sha256: "a5e6a0a9ab69f40f0f59332106532ca76918977a974e7004977a9498e3f11350" +patches: + "1.14": + - patch_file: "patches/1.14-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.12": + - patch_file: "patches/1.12-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.10": + - patch_file: "patches/1.9-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.9": + - patch_file: "patches/1.9-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.8": + - patch_file: "patches/1.7-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" + "1.7": + - patch_file: "patches/1.7-0001-fix-makefiles.patch" + patch_description: "disable optimization and apply compiler settings on conan recipe" + patch_type: "conan" diff --git a/recipes/libdeflate/pre_1.15/conanfile.py b/recipes/libdeflate/pre_1.15/conanfile.py new file mode 100644 index 0000000000000..568462eb96cdb --- /dev/null +++ b/recipes/libdeflate/pre_1.15/conanfile.py @@ -0,0 +1,119 @@ +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path, NMakeToolchain +import os + +required_conan_version = ">=1.55.0" + + +class LibdeflateConan(ConanFile): + name = "libdeflate" + description = "Heavily optimized library for DEFLATE/zlib/gzip compression and decompression." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ebiggers/libdeflate" + topics = ("compression", "decompression", "deflate", "zlib", "gzip") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _is_clangcl(self): + return self.settings.compiler == "clang" and self.settings.os == "Windows" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") + + def build_requirements(self): + if self._settings_build.os == "Windows" and not (is_msvc(self) or self._is_clangcl): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self) or self._is_clangcl: + tc = NMakeToolchain(self) + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() + + def _build_nmake(self): + with chdir(self, self.source_folder): + target = "libdeflate.dll" if self.options.shared else "libdeflatestatic.lib" + self.run(f"nmake /f Makefile.msc {target}") + + def _build_make(self): + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.make() + + def build(self): + apply_conandata_patches(self) + if is_msvc(self) or self._is_clangcl: + self._build_nmake() + else: + self._build_make() + + def _package_windows(self): + copy(self, "libdeflate.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + if self.options.shared: + copy(self, "*deflate.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder) + copy(self, "*deflate.dll", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder) + else: + copy(self, "*deflatestatic.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder) + + def _package_make(self): + autotools = Autotools(self) + with chdir(self, self.source_folder): + # Note: not actually an autotools project, is a Makefile project. + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}", "PREFIX=/"]) + rmdir(self, os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.a" if self.options.shared else "*.[so|dylib]*", os.path.join(self.package_folder, "lib") ) + + def package(self): + copy(self, "COPYING", self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if self.settings.os == "Windows": + self._package_windows() + else: + self._package_make() + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libdeflate") + prefix = "lib" if self.settings.os == "Windows" else "" + suffix = "static" if self.settings.os == "Windows" and not self.options.shared else "" + self.cpp_info.libs = [f"{prefix}deflate{suffix}"] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.defines = ["LIBDEFLATE_DLL"] diff --git a/recipes/libdeflate/all/patches/1.12-0001-fix-makefiles.patch b/recipes/libdeflate/pre_1.15/patches/1.12-0001-fix-makefiles.patch similarity index 100% rename from recipes/libdeflate/all/patches/1.12-0001-fix-makefiles.patch rename to recipes/libdeflate/pre_1.15/patches/1.12-0001-fix-makefiles.patch diff --git a/recipes/libdeflate/pre_1.15/patches/1.14-0001-fix-makefiles.patch b/recipes/libdeflate/pre_1.15/patches/1.14-0001-fix-makefiles.patch new file mode 100644 index 0000000000000..6f2656728ddc6 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/patches/1.14-0001-fix-makefiles.patch @@ -0,0 +1,40 @@ +diff --git a/Makefile b/Makefile +index a08c945..36876b5 100644 +--- a/Makefile ++++ b/Makefile +@@ -54,7 +54,7 @@ cc-option = $(shell if $(CC) $(1) -c -x c /dev/null -o /dev/null \ + 1>&2 2>/dev/null; then echo $(1); fi) + + override CFLAGS := \ +- -O2 -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \ ++ -fomit-frame-pointer -std=c99 -I. -Wall -Wundef \ + $(call cc-option,-Wdeclaration-after-statement) \ + $(call cc-option,-Wimplicit-fallthrough) \ + $(call cc-option,-Wmissing-prototypes) \ +@@ -120,7 +120,7 @@ else ifneq ($(findstring -darwin,$(TARGET_MACHINE)),) + SHARED_LIB := libdeflate.$(SOVERSION).dylib + SHARED_LIB_SYMLINK := libdeflate.dylib + SHARED_LIB_CFLAGS := -fPIC +- SHARED_LIB_LDFLAGS := -install_name $(LIBDIR)/$(SHARED_LIB) ++ SHARED_LIB_LDFLAGS := -install_name @rpath/$(SHARED_LIB) + + # Compiling for Android? + else ifneq ($(findstring -android,$(TARGET_MACHINE)),) +diff --git a/Makefile.msc b/Makefile.msc +index 1449618..a61c034 100644 +--- a/Makefile.msc ++++ b/Makefile.msc +@@ -7,11 +7,10 @@ + + .SUFFIXES: .c .obj .dllobj + +-CC = cl ++CC = $(CC) + LD = link + AR = lib +-CFLAGS = /MD /O2 -I. +-LDFLAGS = ++CFLAGS = /nologo $(CFLAGS) -I. + + STATIC_LIB = libdeflatestatic.lib + SHARED_LIB = libdeflate.dll diff --git a/recipes/libdeflate/all/patches/1.7-0001-fix-makefiles.patch b/recipes/libdeflate/pre_1.15/patches/1.7-0001-fix-makefiles.patch similarity index 100% rename from recipes/libdeflate/all/patches/1.7-0001-fix-makefiles.patch rename to recipes/libdeflate/pre_1.15/patches/1.7-0001-fix-makefiles.patch diff --git a/recipes/libdeflate/all/patches/1.9-0001-fix-makefiles.patch b/recipes/libdeflate/pre_1.15/patches/1.9-0001-fix-makefiles.patch similarity index 100% rename from recipes/libdeflate/all/patches/1.9-0001-fix-makefiles.patch rename to recipes/libdeflate/pre_1.15/patches/1.9-0001-fix-makefiles.patch diff --git a/recipes/libdeflate/pre_1.15/test_package/CMakeLists.txt b/recipes/libdeflate/pre_1.15/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4fdc2b4814ab3 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +find_package(libdeflate REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libdeflate::libdeflate) diff --git a/recipes/libdeflate/pre_1.15/test_package/conanfile.py b/recipes/libdeflate/pre_1.15/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdeflate/pre_1.15/test_package/test_package.c b/recipes/libdeflate/pre_1.15/test_package/test_package.c new file mode 100644 index 0000000000000..9fe99b840f34d --- /dev/null +++ b/recipes/libdeflate/pre_1.15/test_package/test_package.c @@ -0,0 +1,8 @@ +#include + +int main () { + struct libdeflate_compressor *c; + c = libdeflate_alloc_compressor(12); + libdeflate_free_compressor(c); + return 0; +} diff --git a/recipes/libdeflate/pre_1.15/test_v1_package/CMakeLists.txt b/recipes/libdeflate/pre_1.15/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libdeflate/pre_1.15/test_v1_package/conanfile.py b/recipes/libdeflate/pre_1.15/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libdeflate/pre_1.15/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libdisasm/all/conandata.yml b/recipes/libdisasm/all/conandata.yml index af19664fa2f0b..971ffe003e8b2 100644 --- a/recipes/libdisasm/all/conandata.yml +++ b/recipes/libdisasm/all/conandata.yml @@ -5,8 +5,5 @@ sources: patches: "0.23": - patch_file: "patches/0001-fix-size-of-void.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-only-build-libdisasm-by-default.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-libdisasm-no-undefined.patch" - base_path: "source_subfolder" diff --git a/recipes/libdisasm/all/conanfile.py b/recipes/libdisasm/all/conanfile.py index c57e0ca3e165d..8de1232946b5d 100644 --- a/recipes/libdisasm/all/conanfile.py +++ b/recipes/libdisasm/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os -import contextlib -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibdisasmConan(ConanFile): @@ -10,11 +16,10 @@ class LibdisasmConan(ConanFile): description = "The libdisasm library provides basic disassembly of Intel x86 instructions from a binary stream." homepage = "http://bastard.sourceforge.net/libdisasm.html" url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "libdisasm", "disassembler", "x86", "asm") + topics = ("disassembler", "x86", "asm") license = "MIT" + settings = "os", "arch", "compiler", "build_type" - generators = "cmake" - exports_sources = "patches/**" options = { "fPIC": [True, False], "shared": [True, False], @@ -24,12 +29,6 @@ class LibdisasmConan(ConanFile): "shared": False, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -38,90 +37,79 @@ def _settings_build(self): def _user_info_build(self): return getattr(self, "user_info_build", self.deps_user_info) + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextlib.contextmanager - def _build_context(self): - env = {} - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env.update({ - "CC": "cl -nologo", - "CXX": "cl -nologo", - "CPP": "cl -E -nologo", - "AR": "{} lib".format(self._user_info_build["automake"].ar_lib.replace("\\", "/")), - "LD": "link -nologo", - "NM": "dumpbin -symbols", - "STRIP": ":", - "RANLIB": ":", - }) - with tools.environment_append(env): - yield - else: - yield - - def _configure_autotools(self): - if self._autotools: - return self._autotools - yes_no = lambda v: "yes" if v else "no" - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") - - conf_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + env = tc.environment() + if is_msvc(self): + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + env.define("CPP", "cl -E -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} lib") + env.define("NM", "dumpbin -symbols") + env.define("STRIP", ":") + env.define("RANLIB", ":") + tc.generate(env) def build(self): - for patch in self.conan_data["patches"].get(self.version, []): - tools.patch(**patch) - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True, win_bash=tools.os_info.is_windows) - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() - if self.settings.os != "Windows": - autotools.make(args=["-C", "x86dis"]) + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() + if self.settings.os != "Windows": + autotools.make(args=["-C", "x86dis"]) def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - if self.settings.os != "Windows": - autotools.install(args=["-C", "x86dis"]) - - os.unlink(os.path.join(self.package_folder, "lib", "libdisasm.la")) - if self.settings.compiler == "Visual Studio" and self.options.shared: + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + if self.settings.os != "Windows": + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}", "-C", "x86dis"]) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) + if is_msvc(self) and self.options.shared: dlllib = os.path.join(self.package_folder, "lib", "disasm.dll.lib") if os.path.exists(dlllib): - tools.rename(dlllib, os.path.join(self.package_folder, "lib", "disasm.lib")) + rename(self, dlllib, os.path.join(self.package_folder, "lib", "disasm.lib")) def package_info(self): self.cpp_info.libs = ["disasm"] if self.settings.os != "Windows": - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/libdisasm/all/test_package/CMakeLists.txt b/recipes/libdisasm/all/test_package/CMakeLists.txt index 34af13462f44f..d243e526c276c 100644 --- a/recipes/libdisasm/all/test_package/CMakeLists.txt +++ b/recipes/libdisasm/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libdisasm REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libdisasm::libdisasm) diff --git a/recipes/libdisasm/all/test_package/conanfile.py b/recipes/libdisasm/all/test_package/conanfile.py index bf8fb9b249e77..0a8e988d43472 100644 --- a/recipes/libdisasm/all/test_package/conanfile.py +++ b/recipes/libdisasm/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,9 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") if self.settings.os != "Windows": - self.run("x86dis -h", run_environment=True) + self.run("x86dis -h", env="conanrun") diff --git a/recipes/libdisasm/all/test_v1_package/CMakeLists.txt b/recipes/libdisasm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libdisasm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libdisasm/all/test_v1_package/conanfile.py b/recipes/libdisasm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1381fb8880ef2 --- /dev/null +++ b/recipes/libdisasm/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + + if self.settings.os != "Windows": + self.run("x86dis -h", run_environment=True) diff --git a/recipes/libdmtx/all/conandata.yml b/recipes/libdmtx/all/conandata.yml new file mode 100644 index 0000000000000..bf0c94a4bc46b --- /dev/null +++ b/recipes/libdmtx/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "0.7.7": + url: "https://github.com/dmtx/libdmtx/archive/refs/tags/v0.7.7.tar.gz" + sha256: "7aa62adcefdd6e24bdabeb82b3ce41a8d35f4a0c95ab0c4438206aecafd6e1a1" +patches: + "0.7.7": + - patch_file: "patches/0001-0.7.7-fix-version.patch" + patch_description: "update version in CMakeLists.txt" + patch_type: "conan" + - patch_file: "patches/0002-0.7.7-add-install.patch" + patch_description: "add install command to CMakeLists.txt" + patch_type: "conan" diff --git a/recipes/libdmtx/all/conanfile.py b/recipes/libdmtx/all/conanfile.py new file mode 100644 index 0000000000000..3f81f847317dd --- /dev/null +++ b/recipes/libdmtx/all/conanfile.py @@ -0,0 +1,86 @@ +from conan import ConanFile +from conan.tools.files import ( + apply_conandata_patches, + export_conandata_patches, + get, + copy, +) +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class libdmtxConan(ConanFile): + name = "libdmtx" + description = ( + "software library that enables programs to read" + "and write Data Matrix barcodes of the modern ECC200 variety" + ) + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/dmtx/libdmtx" + topics = ("data matrix", "ECC200", "barcode") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get( + self, + **self.conan_data["sources"][self.version], + destination=self.source_folder, + strip_root=True + ) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["dmtx"] + + self.cpp_info.set_property("pkg_config_name", "libdmtx") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/libdmtx/all/patches/0001-0.7.7-fix-version.patch b/recipes/libdmtx/all/patches/0001-0.7.7-fix-version.patch new file mode 100644 index 0000000000000..1e9681706bf43 --- /dev/null +++ b/recipes/libdmtx/all/patches/0001-0.7.7-fix-version.patch @@ -0,0 +1,11 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 6420a81..a98e68f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ + cmake_minimum_required(VERSION 3.0) +-project(DMTX VERSION 0.7.5 LANGUAGES C) ++project(DMTX VERSION 0.7.7 LANGUAGES C) + + # DMTX library + option(DMTX_SHARED "Build DMTX as shared library" ${BUILD_SHARED_LIBS}) diff --git a/recipes/libdmtx/all/patches/0002-0.7.7-add-install.patch b/recipes/libdmtx/all/patches/0002-0.7.7-add-install.patch new file mode 100644 index 0000000000000..3e2bff94dbde1 --- /dev/null +++ b/recipes/libdmtx/all/patches/0002-0.7.7-add-install.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a98e68f..0531d40 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -19,6 +19,9 @@ else() + target_link_libraries(dmtx PUBLIC -lm) + endif() + ++set_target_properties(dmtx PROPERTIES PUBLIC_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/dmtx.h") ++install(TARGETS dmtx LIBRARY ARCHIVE RUNTIME PUBLIC_HEADER) ++ + # Add tests if DMTX is the main project + if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) + include(CTest) diff --git a/recipes/libdmtx/all/test_package/CMakeLists.txt b/recipes/libdmtx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..bfac09c051b74 --- /dev/null +++ b/recipes/libdmtx/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package C) + +find_package(libdmtx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libdmtx::libdmtx) diff --git a/recipes/libdmtx/all/test_package/conanfile.py b/recipes/libdmtx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/libdmtx/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdmtx/all/test_package/test_package.c b/recipes/libdmtx/all/test_package/test_package.c new file mode 100644 index 0000000000000..76e0814c2514e --- /dev/null +++ b/recipes/libdmtx/all/test_package/test_package.c @@ -0,0 +1,100 @@ +#include +#include +#include +#include +#include +#include + +int +main(int argc, char *argv[]) +{ + size_t width, height, bytesPerPixel; + unsigned char str[] = "30Q324343430794image, DmtxPropWidth); + height = dmtxImageGetProp(enc->image, DmtxPropHeight); + bytesPerPixel = dmtxImageGetProp(enc->image, DmtxPropBytesPerPixel); + + pxl = (unsigned char *)malloc(width * height * bytesPerPixel); + assert(pxl != NULL); + memcpy(pxl, enc->image->pxl, width * height * bytesPerPixel); + + dmtxEncodeDestroy(&enc); + + fprintf(stdout, "width: \"%zd\"\n", width); + fprintf(stdout, "height: \"%zd\"\n", height); + fprintf(stdout, "bpp: \"%zd\"\n", bytesPerPixel); + + for (int i=0; iarraySize : \"%zd\"\n", msg->arraySize ); + fprintf(stdout, "msg->codeSize : \"%zd\"\n", msg->codeSize ); + fprintf(stdout, "msg->outputSize: \"%zd\"\n", msg->outputSize); + int oned = sqrt(msg->arraySize); + for (int i=0; iarraySize; i++){ + fprintf(stdout, " %c.", msg->array[i]); + if (i%oned==oned-1){ + fprintf(stdout, "\n"); + } + } + fprintf(stdout, "\n\n"); + for (int j=0; jcodeSize; j++){ + fprintf(stdout, " %c.", msg->code[j]); + } + fprintf(stdout, "\n\n"); + for (int k=0; koutputSize; k++){ + fprintf(stdout, " %c.", msg->output[k]); + } + fprintf(stdout, "\n\n"); + + if(msg != NULL) { + fputs("output: \"", stdout); + fwrite(msg->output, sizeof(unsigned char), msg->outputIdx, stdout); + fputs("\"\n", stdout); + dmtxMessageDestroy(&msg); + } + dmtxRegionDestroy(®); + } + + dmtxDecodeDestroy(&dec); + dmtxImageDestroy(&img); + free(pxl); + + fprintf(stdout, "%d\n", getSizeIdxFromSymbolDimension(12, 12)); + + exit(0); +} diff --git a/recipes/libdmtx/all/test_v1_package/CMakeLists.txt b/recipes/libdmtx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de3b75d9538de --- /dev/null +++ b/recipes/libdmtx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libdmtx/all/test_v1_package/conanfile.py b/recipes/libdmtx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/libdmtx/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libdmtx/config.yml b/recipes/libdmtx/config.yml new file mode 100644 index 0000000000000..356debf98276f --- /dev/null +++ b/recipes/libdmtx/config.yml @@ -0,0 +1,3 @@ +versions: + "0.7.7": + folder: all diff --git a/recipes/libdrm/all/conandata.yml b/recipes/libdrm/all/conandata.yml index 385cbe1979841..c664ae449755d 100644 --- a/recipes/libdrm/all/conandata.yml +++ b/recipes/libdrm/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.4.114": + url: "https://dri.freedesktop.org/libdrm/libdrm-2.4.114.tar.xz" + sha256: "3049cf843a47d12e5eeefbc3be3496d782fa09f42346bf0b7defe3d1e598d026" "2.4.109": url: "https://dri.freedesktop.org/libdrm/libdrm-2.4.109.tar.xz" sha256: "629352e08c1fe84862ca046598d8a08ce14d26ab25ee1f4704f993d074cb7f26" diff --git a/recipes/libdrm/all/conanfile.py b/recipes/libdrm/all/conanfile.py index cbc5ff81fd540..aad89cccd5bf6 100644 --- a/recipes/libdrm/all/conanfile.py +++ b/recipes/libdrm/all/conanfile.py @@ -1,8 +1,11 @@ import os import re -from conans import ConanFile, Meson, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, load, mkdir, rmdir, save +from conan.tools.scm import Version +from conans import Meson class LibdrmConan(ConanFile): @@ -63,11 +66,13 @@ def _build_subfolder(self): return "build_subfolder" def build_requirements(self): - self.build_requires("meson/0.59.0") + self.build_requires("meson/0.64.1") def config_options(self): if self.settings.os == 'Windows': del self.options.fPIC + if Version(self.version) >= "2.4.111": + del self.options.libkms def configure(self): del self.settings.compiler.libcxx @@ -86,19 +91,28 @@ def validate(self): raise ConanInvalidConfiguration("libdrm supports only Linux or FreeBSD") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def _configure_meson(self): meson = Meson(self) defs={ - "cairo-tests" : "false", + "cairo-tests" : "disabled" if Version(self.version) >= "2.4.113" else "false", "install-test-programs": "false" } - for o in ["libkms", "intel", "radeon", "amdgpu","nouveau", "vmwgfx", "omap", "exynos", - "freedreno", "tegra", "vc4", "etnaviv", "valgrind", "freedreno-kgsl", "udev"]: - defs[o] = "true" if getattr(self.options, o) else "false" + if Version(self.version) < "2.4.111": + defs["libkms"] = "true" if self.options.libkms else "false" + + defs["freedreno-kgsl"] = "true" if getattr(self.options, "freedreno-kgsl") else "false" + defs["udev"] = "true" if self.options.udev else "false" + + for o in ["intel", "radeon", "amdgpu","nouveau", "vmwgfx", "omap", "exynos", + "freedreno", "tegra", "vc4", "etnaviv", "valgrind"]: + if Version(self.version) >= "2.4.113": + defs[o] = "enabled" if getattr(self.options, o) else "disabled" + else: + defs[o] = "true" if getattr(self.options, o) else "false" defs["datadir"] = os.path.join(self.package_folder, "res") defs["mandir"] = os.path.join(self.package_folder, "res", "man") @@ -116,12 +130,12 @@ def build(self): def package(self): meson = self._configure_meson() meson.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.mkdir(os.path.join(self.package_folder, "licenses")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + mkdir(self, os.path.join(self.package_folder, "licenses")) # Extract the License/s from the header to a file - tmp = tools.load(os.path.join(self._source_subfolder, "include", "drm", "drm.h")) + tmp = load(self, os.path.join(self._source_subfolder, "include", "drm", "drm.h")) license_contents = re.search("\*\/.*(\/\*(\*(?!\/)|[^*])*\*\/)", tmp, re.DOTALL)[1] - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) def package_info(self): self.cpp_info.components["libdrm_libdrm"].libs = ["drm"] @@ -130,11 +144,12 @@ def package_info(self): if self.settings.os == "Linux": self.cpp_info.components["libdrm_libdrm"].requires = ["linux-headers-generic::linux-headers-generic"] - if self.options.libkms: - self.cpp_info.components["libdrm_libkms"].libs = ["kms"] - self.cpp_info.components["libdrm_libkms"].includedirs.append(os.path.join('include', 'libkms')) - self.cpp_info.components["libdrm_libkms"].requires = ["libdrm_libdrm"] - self.cpp_info.components["libdrm_libkms"].set_property("pkg_config_name", "libkms") + if Version(self.version) < "2.4.111": + if self.options.libkms: + self.cpp_info.components["libdrm_libkms"].libs = ["kms"] + self.cpp_info.components["libdrm_libkms"].includedirs.append(os.path.join('include', 'libkms')) + self.cpp_info.components["libdrm_libkms"].requires = ["libdrm_libdrm"] + self.cpp_info.components["libdrm_libkms"].set_property("pkg_config_name", "libkms") if self.options.vc4: self.cpp_info.components["libdrm_vc4"].requires = ["libdrm_libdrm"] diff --git a/recipes/libdrm/config.yml b/recipes/libdrm/config.yml index 4beea198f8d48..90fca8a547e3e 100644 --- a/recipes/libdrm/config.yml +++ b/recipes/libdrm/config.yml @@ -1,3 +1,5 @@ versions: + "2.4.114": + folder: all "2.4.109": folder: all diff --git a/recipes/libdwarf/all/CMakeLists.txt b/recipes/libdwarf/all/CMakeLists.txt deleted file mode 100644 index d1aa8859c14ba..0000000000000 --- a/recipes/libdwarf/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4.3) -project(conan_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -if (WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif(WIN32 AND BUILD_SHARED_LIBS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libdwarf/all/conandata.yml b/recipes/libdwarf/all/conandata.yml index bd28324dab35b..75d6fc5547c89 100644 --- a/recipes/libdwarf/all/conandata.yml +++ b/recipes/libdwarf/all/conandata.yml @@ -1,8 +1,19 @@ sources: + "0.5.0": + url: "https://www.prevanders.net/libdwarf-0.5.0.tar.xz" + sha256: "11fa822c60317fa00e1a01a2ac9e8388f6693e8662ab72d352c5f50c7e0112a9" "20191104": url: "https://www.prevanders.net/libdwarf-20191104.tar.gz" sha256: "45f50a966314421b7dab525859853616df6c9680f0ccf2f44b030c505236eaba" patches: + "0.5.0": + - patch_file: "patches/0.5.0-0001-fix-cmake.patch" + patch_description: "use cci package, remove lib64/bin64 install folders" + patch_type: "conan" + - patch_file: "patches/0.5.0-0001-fix-DW_API.patch" + patch_description: "fix DW_API definition" + patch_type: "portability" "20191104": - - base_path: "source_subfolder" - patch_file: "patches/0001-patch.patch" + - patch_file: "patches/20191104-0001-patch.patch" + patch_description: "use cci package, remove lib64/bin64 install folders" + patch_type: "conan" diff --git a/recipes/libdwarf/all/conanfile.py b/recipes/libdwarf/all/conanfile.py index f752998831935..2858942538e33 100644 --- a/recipes/libdwarf/all/conanfile.py +++ b/recipes/libdwarf/all/conanfile.py @@ -1,42 +1,33 @@ -from conans import ConanFile, CMake, tools -import functools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, rename +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.53.0" class LibdwarfConan(ConanFile): name = "libdwarf" description = "A library and a set of command-line tools for reading and writing DWARF2" - topics = ("libdwarf", "dwarf2", "debugging", "dwarf") + license = ("LGPL-2.1-only", "BSD-2-Clause-Views") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.prevanders.net/dwarf.html" - license = "LGPL-2.1" + topics = ("debug", "dwarf", "dwarf2", "elf") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], + "with_dwarfgen": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_dwarfgen": False, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,41 +35,72 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + if not self.options.with_dwarfgen: + self.license = "LGPL-2.1-only" + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("libelf/0.8.13") - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_NON_SHARED"] = not self.options.shared - cmake.definitions["BUILD_SHARED"] = self.options.shared - cmake.definitions["BUILD_DWARFGEN"] = False - cmake.definitions["BUILD_DWARFEXAMPLE"] = False - if tools.cross_building(self): - cmake.definitions["HAVE_UNUSED_ATTRIBUTE_EXITCODE"] = "0" - cmake.definitions["HAVE_UNUSED_ATTRIBUTE_EXITCODE__TRYRUN_OUTPUT"] = "" - cmake.configure(build_folder=self._build_subfolder) - return cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["BUILD_NON_SHARED"] = not self.options.shared + tc.variables["BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_DWARFGEN"] = self.options.with_dwarfgen + tc.variables["BUILD_DWARFEXAMPLE"] = False + if cross_building(self): + tc.variables["HAVE_UNUSED_ATTRIBUTE_EXITCODE"] = "0" + tc.variables["HAVE_UNUSED_ATTRIBUTE_EXITCODE__TRYRUN_OUTPUT"] = "" + tc.generate() + + dpes = CMakeDeps(self) + dpes.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=os.path.join(self._source_subfolder, "libdwarf")) - cmake = self._configure_cmake() + if self.version == "20191104": + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "libdwarf")) + rename(self, os.path.join(self.package_folder, "licenses", "COPYING"), os.path.join(self.package_folder, "licenses", "COPYING-libdwarf")) + if self.options.with_dwarfgen: + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "dwarfgen")) + rename(self, os.path.join(self.package_folder, "licenses", "COPYING"), os.path.join(self.package_folder, "licenses", "COPYING-dwarfgen")) + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + else: + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "src", "lib", "libdwarf")) + rename(self, os.path.join(self.package_folder, "licenses", "COPYING"), os.path.join(self.package_folder, "licenses", "COPYING-libdwarf")) + if self.options.with_dwarfgen: + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=os.path.join(self.source_folder, "src", "bin", "dwarfgen")) + rename(self, os.path.join(self.package_folder, "licenses", "COPYING"), os.path.join(self.package_folder, "licenses", "COPYING-dwarfgen")) + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libs = ["dwarf"] + + if self.options.with_dwarfgen: + bindir = os.path.join(self.package_folder, "bin") + self.output.info(f'Appending PATH environment variable: {bindir}') + self.env_info.PATH.append(bindir) + + if self.version != "20191104": + self.cpp_info.libs.append = ["dwarfp"] diff --git a/recipes/libdwarf/all/patches/0.5.0-0001-fix-DW_API.patch b/recipes/libdwarf/all/patches/0.5.0-0001-fix-DW_API.patch new file mode 100644 index 0000000000000..09c3ab0c030c1 --- /dev/null +++ b/recipes/libdwarf/all/patches/0.5.0-0001-fix-DW_API.patch @@ -0,0 +1,13 @@ +diff --git a/src/lib/libdwarf/libdwarf.h b/src/lib/libdwarf/libdwarf.h +index 9a59eb1..fa5e68e 100644 +--- a/src/lib/libdwarf/libdwarf.h ++++ b/src/lib/libdwarf/libdwarf.h +@@ -50,7 +50,7 @@ + #undef DW_API + #endif /* DW_API */ + +-#if defined(_WIN32) || defined(__CYGWIN__) ++#if defined(LIBDWARF_SHARED) && (defined(_WIN32) || defined(__CYGWIN__)) + # ifdef LIBDWARF_BUILD + # define DW_API __declspec(dllexport) + # else /* !LIBDWARF_BUILD */ diff --git a/recipes/libdwarf/all/patches/0.5.0-0001-fix-cmake.patch b/recipes/libdwarf/all/patches/0.5.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..fce5a0373f748 --- /dev/null +++ b/recipes/libdwarf/all/patches/0.5.0-0001-fix-cmake.patch @@ -0,0 +1,105 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4f58f43..69e0238 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -129,6 +129,7 @@ check_include_file( "libelf/libelf.h" HAVE_LIBELF_LIBELF_H) + + ### cmake provides no way to guarantee uint32_t present. + ### configure does guarantee that. ++find_package(libelf REQUIRED) + if(HAVE_STDINT_H) + check_c_source_compiles(" + #include +@@ -192,7 +193,8 @@ elseif(HAVE_LIBELF_LIBELF_H) + endif() + + if (HAVE_LIBELF_H OR HAVE_LIBELF_LIBELF_H) +- set (CMAKE_REQUIRED_LIBRARIES elf) ++ set (CMAKE_REQUIRED_LIBRARIES libelf::libelf) ++ set (CMAKE_REQUIRED_DEFINITIONS -D__LIBELF64=1) + message(STATUS "libelf header ${PLAIN_JUST_LIBELF} checking for elf64_getehdr") + check_symbol_exists( elf64_getehdr ${PLAIN_JUST_LIBELF} HAVE_ELF64_GETEHDR) + message(STATUS "libelf header ${PLAIN_JUST_LIBELF} checking for elf64_getshdr") +@@ -216,6 +218,9 @@ if (DWARF_WITH_LIBELF) + message(STATUS "checking using elf header ... ${HAVE_LOCATION_OF_LIBELFHEADER}") + message(STATUS "checking using libelf header ... ${JUST_LIBELF}") + ++set (CMAKE_REQUIRED_LIBRARIES libelf::libelf) ++set (CMAKE_REQUIRED_DEFINITIONS -D__LIBELF64=1) ++ + check_c_source_compiles(" + #include ${HAVE_LOCATION_OF_LIBELFHEADER} + int main() +@@ -361,7 +366,6 @@ message(STATUS "Building api tests ... ${DOTESTS}") + ### end what was configure.cmake + + # This references cmake/FindLibElf.cmake. See cmake documentation. +-find_package(LibElf REQUIRED) + list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBELF_INCLUDE_DIRS}) + + configure_file(cmake/config.h.cmake config.h) +@@ -384,7 +388,6 @@ if(BUILD_SHARED) + endif() + + add_subdirectory(src/lib/libdwarf) +-add_subdirectory(src/bin/dwarfdump) + + if ( BUILD_DWARFEXAMPLE ) + add_subdirectory(src/bin/dwarfexample) +diff --git a/src/bin/dwarfdump/CMakeLists.txt b/src/bin/dwarfdump/CMakeLists.txt +index f6f5376..22c5977 100644 +--- a/src/bin/dwarfdump/CMakeLists.txt ++++ b/src/bin/dwarfdump/CMakeLists.txt +@@ -65,7 +65,7 @@ target_compile_options(dwarfdump PRIVATE ${DW_FWALL}) + + target_link_libraries(dwarfdump PRIVATE ${dwarf-target} ${DW_FZLIB} ${DW_FZSTD} ) + +-if(${CMAKE_SIZEOF_VOID_P} EQUAL 8) ++if(0) + set(SUFFIX 64) + endif() + set(LIBDIR lib${SUFFIX}) +diff --git a/src/bin/dwarfgen/CMakeLists.txt b/src/bin/dwarfgen/CMakeLists.txt +index 5c2c192..fc3428e 100644 +--- a/src/bin/dwarfgen/CMakeLists.txt ++++ b/src/bin/dwarfgen/CMakeLists.txt +@@ -28,7 +28,7 @@ target_include_directories(dwarfgen PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/../../lib/libdwarfp) + + target_link_libraries(dwarfgen PRIVATE ${dwarfp-target} +- ${dwarf-target} ${DW_FZLIB}) ++ ${dwarf-target} ${DW_FZLIB} libelf::libelf) + + set(SUFFIX $<$:64>) + set(LIBDIR lib${SUFFIX}) +diff --git a/src/lib/libdwarf/CMakeLists.txt b/src/lib/libdwarf/CMakeLists.txt +index 0b7d578..62b67da 100644 +--- a/src/lib/libdwarf/CMakeLists.txt ++++ b/src/lib/libdwarf/CMakeLists.txt +@@ -67,7 +67,7 @@ set_source_group(CONFIGURATION_FILES "Configuration Files" + + list(LENGTH DWARF_TARGETS targetCount) + math(EXPR targetCount "${targetCount} - 1") +-list(APPEND DWARF_LIBS ${LIBELF_LIBRARIES}) ++list(APPEND DWARF_LIBS ${libelf_LIBRARIES}) + if (DW_FZLIB) + list(APPEND DWARF_LIBS z) + endif() +@@ -85,13 +85,15 @@ foreach(i RANGE ${targetCount}) + ${LIBELF_INCLUDE_DIRS}) + target_compile_options(${target} PRIVATE -DLIBDWARF_BUILD + ${DW_FWALL}) +- msvc_posix(${target}) ++ if(BUILD_SHARED) ++ target_compile_definitions(${target} PRIVATE LIBDWARF_SHARED) ++ endif() ++ msvc_posix(${target}) + + target_link_libraries(${target} PUBLIC ${LIBELF_LIBRARIES} ${DW_FZLIB} ${DW_FZSTD} ) + + set_target_properties(${target} PROPERTIES OUTPUT_NAME dwarf) + +- set(SUFFIX $<$:64>) + set(LIBDIR lib${SUFFIX}) + set(BINDIR bin${SUFFIX}) + diff --git a/recipes/libdwarf/all/patches/0001-patch.patch b/recipes/libdwarf/all/patches/0001-patch.patch deleted file mode 100644 index 3d54fb379c00e..0000000000000 --- a/recipes/libdwarf/all/patches/0001-patch.patch +++ /dev/null @@ -1,206 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2607e56..b88f0f8 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -73,9 +73,9 @@ check_include_file( "unistd.h" HAVE_UNISTD_H ) - check_include_file( "sgidefs.h" HAVE_SGIDEFS_H ) - check_include_file( "stdafx.h" HAVE_STDAFX_H ) - check_include_file( "Windows.h" HAVE_WINDOWS_H ) --check_include_file( "elf.h" HAVE_ELF_H ) --check_include_file( "libelf.h" HAVE_LIBELF_H ) --check_include_file( "libelf/libelf.h" HAVE_LIBELF_LIBELF_H) -+set(HAVE_ELF_H FALSE) -+set(HAVE_LIBELF_H TRUE) -+set(HAVE_LIBELF_LIBELF_H FALSE) - check_include_file( "alloca.h" HAVE_ALLOCA_H ) - check_include_file( "elfaccess.h" HAVE_ELFACCESS_H) - check_include_file( "sys/elf_386.h" HAVE_SYS_ELF_386_H ) -@@ -146,12 +146,14 @@ elseif(HAVE_LIBELF_LIBELF_H) - endif() - - if (HAVE_LIBELF_H OR HAVE_LIBELF_LIBELF_H) -- set (CMAKE_REQUIRED_LIBRARIES elf) -+ set (CMAKE_REQUIRED_LIBRARIES CONAN_PKG::libelf) -+ set (CMAKE_REQUIRED_DEFINITIONS -D__LIBELF64=1) - message(STATUS "libelf header ${PLAIN_JUST_LIBELF} checking for elf64_getehdr") - check_symbol_exists( elf64_getehdr ${PLAIN_JUST_LIBELF} HAVE_ELF64_GETEHDR) - message(STATUS "libelf header ${PLAIN_JUST_LIBELF} checking for elf64_getshdr") - check_symbol_exists( elf64_getshdr ${PLAIN_JUST_LIBELF} HAVE_ELF64_GETSHDR) - set (CMAKE_REQUIRED_LIBRARIES) -+ set (CMAKE_REQUIRED_DEFINITIONS) - endif() - - option(DWARF_WITH_LIBELF "Use libelf (default is YES)" TRUE) -@@ -166,6 +168,10 @@ if (DWARF_WITH_LIBELF) - message(STATUS "checking using HAVE_ELF_H ... ${HAVE_ELF_H}") - message(STATUS "checking using elf header ... ${HAVE_LOCATION_OF_LIBELFHEADER}") - message(STATUS "checking using libelf header ... ${JUST_LIBELF}") -+ -+ set (CMAKE_REQUIRED_LIBRARIES CONAN_PKG::libelf) -+ set (CMAKE_REQUIRED_DEFINITIONS -D__LIBELF64=1) -+ - check_c_source_compiles(" - #include ${HAVE_LOCATION_OF_LIBELFHEADER} - int main() -@@ -202,7 +208,7 @@ if (DWARF_WITH_LIBELF) - # to set HAVE_LIBELF_OFF64_OK at present. - check_c_source_compiles(" - #define _GNU_SOURCE 1 -- #include ${JUST_LIBELF} -+ #include <${JUST_LIBELF}> - int main() - { - off64_t p; p = 0; -@@ -210,7 +216,7 @@ if (DWARF_WITH_LIBELF) - }" HAVE_LIBELF_OFF64_OK) - - check_c_source_compiles(" -- #include ${JUST_LIBELF} -+ #include <${JUST_LIBELF}> - /* This must be at global scope */ - struct _Elf; - typedef struct _Elf Elf; -@@ -220,6 +226,10 @@ if (DWARF_WITH_LIBELF) - int i = 12; - return 0; - }" HAVE_STRUCT_UNDERSCORE_ELF) -+ -+ set (CMAKE_REQUIRED_LIBRARIES) -+ set (CMAKE_REQUIRED_DEFINITIONS) -+ - endif() - message(STATUS "Assuming struct Elf for the default libdwarf.h") - # Because cmake treats ; in an interesting way attempting -@@ -381,7 +391,7 @@ message(STATUS "Checking producer generates only 32bit... ${HAVE_STRICT_DWARF2_3 - find_package(LibElf REQUIRED) - list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBELF_INCLUDE_DIRS}) - --configure_file(config.h.in.cmake config.h) -+configure_file(${CMAKE_SOURCE_DIR}/source_subfolder/config.h.in.cmake ${CMAKE_BINARY_DIR}/config.h) - - if(BUILD_NON_SHARED) - set(DWARF_TARGETS dwarf-static) -@@ -395,7 +405,6 @@ if(BUILD_SHARED) - endif() - - add_subdirectory(libdwarf) --add_subdirectory(dwarfdump) - if ( BUILD_DWARFGEN ) - if ( DWARF_WITH_LIBELF ) - add_subdirectory(dwarfgen) -diff --git a/dwarfdump/CMakeLists.txt b/dwarfdump/CMakeLists.txt -index b94f6c8..e688ea0 100644 ---- a/dwarfdump/CMakeLists.txt -+++ b/dwarfdump/CMakeLists.txt -@@ -28,7 +28,7 @@ set_source_group(HEADERS "Header Files" - print_reloc.h print_reloc_decls.h section_bitmaps.h uri.h) - - set_source_group(CONFIGURATION_FILES "Configuration Files" -- ${CMAKE_SOURCE_DIR}/config.h.in.cmake -+ ${CMAKE_SOURCE_DIR}/source_subfolder/config.h.in.cmake - ${CMAKE_BINARY_DIR}/config.h) - - add_executable(dwarfdump ${SOURCES} ${HEADERS} ${CONFIGURATION_FILES}) -@@ -180,10 +180,10 @@ set(LIBDIR lib${SUFFIX}) - set(BINDIR bin${SUFFIX}) - - install(TARGETS dwarfdump DESTINATION -- RUNTIME DESTINATION ${BINDIR} -- LIBRARY DESTINATION ${LIBDIR} -- ARCHIVE DESTINATION ${LIBDIR}) -+ RUNTIME DESTINATION bin -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib) - --install(FILES dwarfdump.conf DESTINATION ${LIBDIR}) -+install(FILES dwarfdump.conf DESTINATION res) - - install(FILES dwarfdump.1 DESTINATION share/man/man1) -diff --git a/dwarfexample/CMakeLists.txt b/dwarfexample/CMakeLists.txt -index 8104691..7c6cd7e 100644 ---- a/dwarfexample/CMakeLists.txt -+++ b/dwarfexample/CMakeLists.txt -@@ -1,7 +1,7 @@ - set_source_group(SIMPLE_READER_SOURCES "Source Files" simplereader.c) - - set_source_group(CONFIGURATION_FILES "Configuration Files" -- ${CMAKE_SOURCE_DIR}/config.h.in.cmake -+ ${CMAKE_SOURCE_DIR}/source_subfolder/config.h.in.cmake - ${CMAKE_BINARY_DIR}/config.h) - - add_executable(simplereader -diff --git a/dwarfgen/CMakeLists.txt b/dwarfgen/CMakeLists.txt -index 488b820..bcc92b4 100644 ---- a/dwarfgen/CMakeLists.txt -+++ b/dwarfgen/CMakeLists.txt -@@ -11,7 +11,7 @@ set_source_group(HEADERS "Header Files" createirepfrombinary.h - strtabdata.h ../libdwarf/dwgetopt.h) - - set_source_group(CONFIGURATION_FILES "Configuration Files" -- ${CMAKE_SOURCE_DIR}/config.h.in.cmake -+ ${CMAKE_SOURCE_DIR}/source_subfolder/config.h.in.cmake - ${CMAKE_BINARY_DIR}/config.h) - - add_executable(dwarfgen ${SOURCES} ${HEADERS} ${CONFIGURATION_FILES}) -@@ -27,9 +27,9 @@ set(LIBDIR lib${SUFFIX}) - set(BINDIR bin${SUFFIX}) - - install(TARGETS dwarfgen DESTINATION -- RUNTIME DESTINATION ${BINDIR} -- LIBRARY DESTINATION ${LIBDIR} -- ARCHIVE DESTINATION ${LIBDIR}) -+ RUNTIME DESTINATION bin -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib) - - #install(FILES dwarfgen.conf DESTINATION lib) - -diff --git a/libdwarf/CMakeLists.txt b/libdwarf/CMakeLists.txt -index c610522..c0872c0 100644 ---- a/libdwarf/CMakeLists.txt -+++ b/libdwarf/CMakeLists.txt -@@ -67,7 +67,7 @@ pro_reloc.h pro_reloc_stream.h pro_reloc_symbolic.h - pro_section.h pro_types.h pro_util.h) - - set_source_group(CONFIGURATION_FILES "Configuration Files" -- ${CMAKE_SOURCE_DIR}/config.h.in.cmake -+ ${CMAKE_SOURCE_DIR}/source_subfolder/config.h.in.cmake - ${CMAKE_BINARY_DIR}/config.h) - - -@@ -81,12 +81,9 @@ foreach(i RANGE ${targetCount}) - ${GENNAMES_OUTPUT} ${CONFIGURATION_FILES}) - - set_folder(${target} libdwarf) -- target_include_directories(${target} PUBLIC -- ${LIBELF_INCLUDE_DIRS}) -- target_compile_options(${target} PRIVATE ${DW_FWALL}) - msvc_posix(${target}) - -- target_link_libraries(${target} PUBLIC ${LIBELF_LIBRARIES}) -+ conan_target_link_libraries(${target}) - - set_target_properties(${target} PROPERTIES OUTPUT_NAME dwarf) - -@@ -95,15 +92,14 @@ foreach(i RANGE ${targetCount}) - set(BINDIR bin${SUFFIX}) - - install(TARGETS ${target} -- RUNTIME DESTINATION ${BINDIR} -- LIBRARY DESTINATION ${LIBDIR} -- ARCHIVE DESTINATION ${LIBDIR}) -+ RUNTIME DESTINATION bin -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib) - endforeach() - --if(UNIX AND BUILD_SHARED) -- target_link_libraries(dwarf-shared PUBLIC z) --endif() -- -+install(FILES ${CMAKE_BINARY_DIR}/source_subfolder/libdwarf/libdwarf.h DESTINATION include) -+install(FILES dwarf.h DESTINATION include) -+ - if (DO_TESTING) - set_source_group(TESTLEB "Source Files" dwarf_leb_test.c - dwarf_leb.c pro_encode_nm.c ) diff --git a/recipes/libdwarf/all/patches/20191104-0001-patch.patch b/recipes/libdwarf/all/patches/20191104-0001-patch.patch new file mode 100644 index 0000000000000..aadcac9dfe8fd --- /dev/null +++ b/recipes/libdwarf/all/patches/20191104-0001-patch.patch @@ -0,0 +1,178 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2607e56..3ca4ac5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -73,9 +73,9 @@ check_include_file( "unistd.h" HAVE_UNISTD_H ) + check_include_file( "sgidefs.h" HAVE_SGIDEFS_H ) + check_include_file( "stdafx.h" HAVE_STDAFX_H ) + check_include_file( "Windows.h" HAVE_WINDOWS_H ) +-check_include_file( "elf.h" HAVE_ELF_H ) +-check_include_file( "libelf.h" HAVE_LIBELF_H ) +-check_include_file( "libelf/libelf.h" HAVE_LIBELF_LIBELF_H) ++set(HAVE_ELF_H FALSE) ++set(HAVE_LIBELF_H FALSE) ++set(HAVE_LIBELF_LIBELF_H TRUE) + check_include_file( "alloca.h" HAVE_ALLOCA_H ) + check_include_file( "elfaccess.h" HAVE_ELFACCESS_H) + check_include_file( "sys/elf_386.h" HAVE_SYS_ELF_386_H ) +@@ -128,6 +128,8 @@ endif() + # It's not really setting the location of libelfheader, + # it is really # either elf.h, or if that is missing + # it is assuming elf.h data is in the supplied libelf. ++find_package(libelf REQUIRED CONFIG) ++find_package(ZLIB REQUIRED CONFIG) + + if(HAVE_ELF_H) + set(HAVE_LOCATION_OF_LIBELFHEADER "") +@@ -146,12 +148,13 @@ elseif(HAVE_LIBELF_LIBELF_H) + endif() + + if (HAVE_LIBELF_H OR HAVE_LIBELF_LIBELF_H) +- set (CMAKE_REQUIRED_LIBRARIES elf) ++ set (CMAKE_REQUIRED_DEFINITIONS -D__LIBELF64=1) + message(STATUS "libelf header ${PLAIN_JUST_LIBELF} checking for elf64_getehdr") + check_symbol_exists( elf64_getehdr ${PLAIN_JUST_LIBELF} HAVE_ELF64_GETEHDR) + message(STATUS "libelf header ${PLAIN_JUST_LIBELF} checking for elf64_getshdr") + check_symbol_exists( elf64_getshdr ${PLAIN_JUST_LIBELF} HAVE_ELF64_GETSHDR) + set (CMAKE_REQUIRED_LIBRARIES) ++ set (CMAKE_REQUIRED_DEFINITIONS) + endif() + + option(DWARF_WITH_LIBELF "Use libelf (default is YES)" TRUE) +@@ -166,6 +169,9 @@ if (DWARF_WITH_LIBELF) + message(STATUS "checking using HAVE_ELF_H ... ${HAVE_ELF_H}") + message(STATUS "checking using elf header ... ${HAVE_LOCATION_OF_LIBELFHEADER}") + message(STATUS "checking using libelf header ... ${JUST_LIBELF}") ++ ++ set (CMAKE_REQUIRED_DEFINITIONS -D__LIBELF64=1) ++ + check_c_source_compiles(" + #include ${HAVE_LOCATION_OF_LIBELFHEADER} + int main() +@@ -202,7 +208,7 @@ if (DWARF_WITH_LIBELF) + # to set HAVE_LIBELF_OFF64_OK at present. + check_c_source_compiles(" + #define _GNU_SOURCE 1 +- #include ${JUST_LIBELF} ++ #include <${JUST_LIBELF}> + int main() + { + off64_t p; p = 0; +@@ -210,7 +216,7 @@ if (DWARF_WITH_LIBELF) + }" HAVE_LIBELF_OFF64_OK) + + check_c_source_compiles(" +- #include ${JUST_LIBELF} ++ #include <${JUST_LIBELF}> + /* This must be at global scope */ + struct _Elf; + typedef struct _Elf Elf; +@@ -220,6 +226,10 @@ if (DWARF_WITH_LIBELF) + int i = 12; + return 0; + }" HAVE_STRUCT_UNDERSCORE_ELF) ++ ++ set (CMAKE_REQUIRED_LIBRARIES) ++ set (CMAKE_REQUIRED_DEFINITIONS) ++ + endif() + message(STATUS "Assuming struct Elf for the default libdwarf.h") + # Because cmake treats ; in an interesting way attempting +@@ -378,10 +388,9 @@ message(STATUS "Checking producer generates only 32bit... ${HAVE_STRICT_DWARF2_3 + + + # This references cmake/FindLibElf.cmake. See cmake documentation. +-find_package(LibElf REQUIRED) + list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBELF_INCLUDE_DIRS}) + +-configure_file(config.h.in.cmake config.h) ++configure_file(${CMAKE_SOURCE_DIR}/config.h.in.cmake ${CMAKE_BINARY_DIR}/config.h) + + if(BUILD_NON_SHARED) + set(DWARF_TARGETS dwarf-static) +@@ -395,7 +404,6 @@ if(BUILD_SHARED) + endif() + + add_subdirectory(libdwarf) +-add_subdirectory(dwarfdump) + if ( BUILD_DWARFGEN ) + if ( DWARF_WITH_LIBELF ) + add_subdirectory(dwarfgen) +diff --git a/dwarfdump/CMakeLists.txt b/dwarfdump/CMakeLists.txt +index b94f6c8..6bdb57f 100644 +--- a/dwarfdump/CMakeLists.txt ++++ b/dwarfdump/CMakeLists.txt +@@ -31,7 +31,7 @@ set_source_group(CONFIGURATION_FILES "Configuration Files" + ${CMAKE_SOURCE_DIR}/config.h.in.cmake + ${CMAKE_BINARY_DIR}/config.h) + +-add_executable(dwarfdump ${SOURCES} ${HEADERS} ${CONFIGURATION_FILES}) ++add_executable(dwarfdump ${SOURCES} ${HEADERS} ${CONFIGURATION_FILES} ${libelf_LIBRARIES}) + + set_folder(dwarfdump dwarfdump) + +diff --git a/dwarfgen/CMakeLists.txt b/dwarfgen/CMakeLists.txt +index 488b820..5bde9eb 100644 +--- a/dwarfgen/CMakeLists.txt ++++ b/dwarfgen/CMakeLists.txt +@@ -20,16 +20,16 @@ set_folder(dwarfgen dwarfgen) + + target_compile_options(dwarfgen PRIVATE ${DW_FWALLXX}) + +-target_link_libraries(dwarfgen PRIVATE ${dwarf-target} ${DW_FZLIB}) ++target_link_libraries(dwarfgen PRIVATE ${dwarf-target} ${DW_FZLIB} ${libelf_LIBRARIES}) + + set(SUFFIX $<$:64>) + set(LIBDIR lib${SUFFIX}) + set(BINDIR bin${SUFFIX}) + + install(TARGETS dwarfgen DESTINATION +- RUNTIME DESTINATION ${BINDIR} +- LIBRARY DESTINATION ${LIBDIR} +- ARCHIVE DESTINATION ${LIBDIR}) ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + + #install(FILES dwarfgen.conf DESTINATION lib) + +diff --git a/libdwarf/CMakeLists.txt b/libdwarf/CMakeLists.txt +index c610522..3a69533 100644 +--- a/libdwarf/CMakeLists.txt ++++ b/libdwarf/CMakeLists.txt +@@ -81,12 +81,9 @@ foreach(i RANGE ${targetCount}) + ${GENNAMES_OUTPUT} ${CONFIGURATION_FILES}) + + set_folder(${target} libdwarf) +- target_include_directories(${target} PUBLIC +- ${LIBELF_INCLUDE_DIRS}) +- target_compile_options(${target} PRIVATE ${DW_FWALL}) + msvc_posix(${target}) + +- target_link_libraries(${target} PUBLIC ${LIBELF_LIBRARIES}) ++ target_link_libraries(${target} PUBLIC ${libelf_LIBRARIES} ${ZLIB_LIBRARIES}) + + set_target_properties(${target} PROPERTIES OUTPUT_NAME dwarf) + +@@ -95,15 +92,14 @@ foreach(i RANGE ${targetCount}) + set(BINDIR bin${SUFFIX}) + + install(TARGETS ${target} +- RUNTIME DESTINATION ${BINDIR} +- LIBRARY DESTINATION ${LIBDIR} +- ARCHIVE DESTINATION ${LIBDIR}) ++ RUNTIME DESTINATION bin ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + endforeach() + +-if(UNIX AND BUILD_SHARED) +- target_link_libraries(dwarf-shared PUBLIC z) +-endif() +- ++install(FILES ${CMAKE_BINARY_DIR}/libdwarf/libdwarf.h DESTINATION include) ++install(FILES dwarf.h DESTINATION include) ++ + if (DO_TESTING) + set_source_group(TESTLEB "Source Files" dwarf_leb_test.c + dwarf_leb.c pro_encode_nm.c ) diff --git a/recipes/libdwarf/all/test_package/CMakeLists.txt b/recipes/libdwarf/all/test_package/CMakeLists.txt index d46ff25d16814..a2fbbf0a474e1 100644 --- a/recipes/libdwarf/all/test_package/CMakeLists.txt +++ b/recipes/libdwarf/all/test_package/CMakeLists.txt @@ -1,10 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(libdwarf REQUIRED CONFIG) +find_package(libdwarf REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libdwarf::libdwarf) +target_link_libraries(${PROJECT_NAME} PRIVATE libdwarf::libdwarf) + +if(NOT libdwarf_VERSION MATCHES "^[0-9]*$") + target_compile_definitions(${PROJECT_NAME} PRIVATE "LIBDWARF_NEW_STRUCTURE") +endif() diff --git a/recipes/libdwarf/all/test_package/conanfile.py b/recipes/libdwarf/all/test_package/conanfile.py index 38f4483872d47..a9fbb7f543162 100644 --- a/recipes/libdwarf/all/test_package/conanfile.py +++ b/recipes/libdwarf/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdwarf/all/test_package/test_package.c b/recipes/libdwarf/all/test_package/test_package.c index f5db544bfce23..33cfec6d8bf91 100644 --- a/recipes/libdwarf/all/test_package/test_package.c +++ b/recipes/libdwarf/all/test_package/test_package.c @@ -3,8 +3,12 @@ #include #include -#include "dwarf.h" -#include "libdwarf.h" +#ifndef LIBDWARF_NEW_STRUCTURE + #include "dwarf.h" + #include "libdwarf.h" +#else + #include "libdwarf/libdwarf.h" +#endif void example1(Dwarf_Die somedie) { Dwarf_Debug dbg = 0; diff --git a/recipes/libdwarf/all/test_v1_package/CMakeLists.txt b/recipes/libdwarf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/libdwarf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libdwarf/all/test_v1_package/conanfile.py b/recipes/libdwarf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/libdwarf/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libdwarf/config.yml b/recipes/libdwarf/config.yml index 54b583a51e0bd..aa4d403dacd89 100644 --- a/recipes/libdwarf/config.yml +++ b/recipes/libdwarf/config.yml @@ -1,3 +1,5 @@ versions: + "0.5.0": + folder: all "20191104": folder: all diff --git a/recipes/libdxfrw/all/CMakeLists.txt b/recipes/libdxfrw/all/CMakeLists.txt deleted file mode 100644 index d17aaff199b4a..0000000000000 --- a/recipes/libdxfrw/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libdxfrw/all/conandata.yml b/recipes/libdxfrw/all/conandata.yml index 56e52bb33b694..163bfa884b042 100644 --- a/recipes/libdxfrw/all/conandata.yml +++ b/recipes/libdxfrw/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.2.0": + url: "https://github.com/LibreCAD/libdxfrw/archive/refs/tags/LC2.2.0.tar.gz" + sha256: "b56535f8c234bb119b94e11b2436651531869ba0171bb10166b007588e97d69f" "1.0.1": url: "https://github.com/LibreCAD/libdxfrw/archive/1.0.1.tar.gz" sha256: "eea1021b296cb9ba4cab4417106e41d53a8fadfffe2cd108efe46afb04e2ec34" diff --git a/recipes/libdxfrw/all/conanfile.py b/recipes/libdxfrw/all/conanfile.py index 7f1e177de05d8..22166b390cae7 100644 --- a/recipes/libdxfrw/all/conanfile.py +++ b/recipes/libdxfrw/all/conanfile.py @@ -1,62 +1,80 @@ +from conan import ConanFile +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -from conans import ConanFile, CMake, tools +required_conan_version = ">=1.53.0" class LibdxfrwConan(ConanFile): name = "libdxfrw" + description = "C++ library to read/write DXF and read DWG files" license = "GPL-2.0-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/LibreCAD/libdxfrw" - description = "C++ library to read/write DXF and read DWG files" topics = ("dxf", "dwg", "cad") - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - exports_sources = "CMakeLists.txt" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "fPIC": [True, False] + "fPIC": [True, False], } default_options = { "shared": False, - "fPIC": True + "fPIC": True, } - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_folder = self.name + "-" + self.version - os.rename(extracted_folder, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBDXFRW_BUILD_DOC"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + if Version(self.version) >= "2.2.0": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "-Werror", "") + + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) self.cpp_info.libs = ["dxfrw"] + + self.cpp_info.set_property("pkg_config_name", "libdxfrw") + if self.settings.os == "Linux": self.cpp_info.system_libs = ["m"] + + bin_path = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH env var: {bin_path}") + self.env_info.PATH.append(bin_path) diff --git a/recipes/libdxfrw/all/test_package/CMakeLists.txt b/recipes/libdxfrw/all/test_package/CMakeLists.txt index 6aab347eddf53..3fefb4e7b7d8a 100644 --- a/recipes/libdxfrw/all/test_package/CMakeLists.txt +++ b/recipes/libdxfrw/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libdxfrw REQUIRED CONFIG) -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) -set_property(TARGET example PROPERTY CXX_STANDARD 11) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libdxfrw::libdxfrw) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libdxfrw/all/test_package/conanfile.py b/recipes/libdxfrw/all/test_package/conanfile.py index 44bb963d9da9a..a9fb96656f203 100644 --- a/recipes/libdxfrw/all/test_package/conanfile.py +++ b/recipes/libdxfrw/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class LibdxfrwTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "example"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libdxfrw/all/test_package/example.cpp b/recipes/libdxfrw/all/test_package/test_package.cpp similarity index 100% rename from recipes/libdxfrw/all/test_package/example.cpp rename to recipes/libdxfrw/all/test_package/test_package.cpp diff --git a/recipes/libdxfrw/all/test_v1_package/CMakeLists.txt b/recipes/libdxfrw/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libdxfrw/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libdxfrw/all/test_v1_package/conanfile.py b/recipes/libdxfrw/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/libdxfrw/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libdxfrw/config.yml b/recipes/libdxfrw/config.yml index 715e55357a17b..a9f4753aaca71 100644 --- a/recipes/libdxfrw/config.yml +++ b/recipes/libdxfrw/config.yml @@ -1,3 +1,5 @@ versions: + "2.2.0": + folder: all "1.0.1": folder: all diff --git a/recipes/libe57format/all/CMakeLists.txt b/recipes/libe57format/all/CMakeLists.txt deleted file mode 100644 index 9719e759ff2b5..0000000000000 --- a/recipes/libe57format/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/libe57format/all/conandata.yml b/recipes/libe57format/all/conandata.yml index 2431f660af552..857bfbb53a2a6 100644 --- a/recipes/libe57format/all/conandata.yml +++ b/recipes/libe57format/all/conandata.yml @@ -2,7 +2,12 @@ sources: "2.2.0": sha256: "19df04af07925bf43e1793534b0c77cb1346a2bee7746859d2fe1714a24f1c7d" url: "https://github.com/asmaloney/libE57Format/archive/refs/tags/v2.2.0.tar.gz" + "2.3.0": + sha256: "124cc8f7dda84e8686ff2bcffc524ee4677eba3183631ec847a5f4a6ea60b254" + url: "https://github.com/asmaloney/libE57Format/archive/refs/tags/v2.3.0.tar.gz" patches: "2.2.0": - - patch_file: "patches/fix-pic.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-pic.patch" + - patch_file: "patches/0002-missing-include.patch" + "2.3.0": + - patch_file: "patches/2.3.0-0001-fix-pic.patch" diff --git a/recipes/libe57format/all/conanfile.py b/recipes/libe57format/all/conanfile.py index 0fbd3acb1699a..479e129d3bbf3 100644 --- a/recipes/libe57format/all/conanfile.py +++ b/recipes/libe57format/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class LibE57FormatConan(ConanFile): @@ -13,7 +16,7 @@ class LibE57FormatConan(ConanFile): description = "Library for reading & writing the E57 file format" topics = ("e57", "io", "point-cloud") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -23,21 +26,8 @@ class LibE57FormatConan(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,66 +35,72 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("xerces-c/3.2.3") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, "11") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USING_STATIC_XERCES"] = not self.options["xerces-c"].shared - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USING_STATIC_XERCES"] = not self.dependencies["xerces-c"].options.shared + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"E57Format": "E57Format::E57Format"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "e57format") self.cpp_info.set_property("cmake_target_name", "E57Format") suffix = "-d" if self.settings.build_type == "Debug" else "" - self.cpp_info.libs = ["E57Format{}".format(suffix)] - if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") + self.cpp_info.libs = [f"E57Format{suffix}"] + if self.settings.os in ["Linux", "FreeBSD"] and not self.options.shared: + self.cpp_info.system_libs.extend(["m", "pthread"]) # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "e57format" diff --git a/recipes/libe57format/all/patches/fix-pic.patch b/recipes/libe57format/all/patches/0001-fix-pic.patch similarity index 100% rename from recipes/libe57format/all/patches/fix-pic.patch rename to recipes/libe57format/all/patches/0001-fix-pic.patch diff --git a/recipes/libe57format/all/patches/0002-missing-include.patch b/recipes/libe57format/all/patches/0002-missing-include.patch new file mode 100644 index 0000000000000..50253b05d6c2a --- /dev/null +++ b/recipes/libe57format/all/patches/0002-missing-include.patch @@ -0,0 +1,11 @@ +--- a/src/E57XmlParser.cpp ++++ b/src/E57XmlParser.cpp +@@ -42,6 +42,8 @@ + #include "StringNodeImpl.h" + #include "VectorNodeImpl.h" + ++#include ++ + using namespace e57; + using namespace XERCES_CPP_NAMESPACE; + diff --git a/recipes/libe57format/all/patches/2.3.0-0001-fix-pic.patch b/recipes/libe57format/all/patches/2.3.0-0001-fix-pic.patch new file mode 100644 index 0000000000000..a2ecc0de60e33 --- /dev/null +++ b/recipes/libe57format/all/patches/2.3.0-0001-fix-pic.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -127,7 +127,6 @@ + CXX_STANDARD_REQUIRED YES + CXX_EXTENSIONS NO + DEBUG_POSTFIX "-d" +- POSITION_INDEPENDENT_CODE ON + ) + + # Target definitions diff --git a/recipes/libe57format/all/test_package/CMakeLists.txt b/recipes/libe57format/all/test_package/CMakeLists.txt index 2b2a28ed1bc7f..b8de16fa4046c 100644 --- a/recipes/libe57format/all/test_package/CMakeLists.txt +++ b/recipes/libe57format/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(e57format REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - -find_package(e57format REQUIRED CONFIG) target_link_libraries(${PROJECT_NAME} PRIVATE E57Format) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libe57format/all/test_package/conanfile.py b/recipes/libe57format/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/libe57format/all/test_package/conanfile.py +++ b/recipes/libe57format/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libe57format/all/test_v1_package/CMakeLists.txt b/recipes/libe57format/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2bf6344a5bafd --- /dev/null +++ b/recipes/libe57format/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(e57format REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE E57Format) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libe57format/all/test_v1_package/conanfile.py b/recipes/libe57format/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libe57format/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libe57format/config.yml b/recipes/libe57format/config.yml index 1979b3114ab95..137671316c059 100644 --- a/recipes/libe57format/config.yml +++ b/recipes/libe57format/config.yml @@ -1,3 +1,5 @@ versions: "2.2.0": folder: all + "2.3.0": + folder: all diff --git a/recipes/libelf/all/CMakeLists.txt b/recipes/libelf/all/CMakeLists.txt index e3e916bf47bb7..272a6d59618a2 100644 --- a/recipes/libelf/all/CMakeLists.txt +++ b/recipes/libelf/all/CMakeLists.txt @@ -1,33 +1,31 @@ cmake_minimum_required(VERSION 3.4) -project(elf C) +project(elf LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(EXISTS "${PROJECT_SOURCE_DIR}/source_subfolder/lib/sys_elf.h.w32") - file(RENAME "${PROJECT_SOURCE_DIR}/source_subfolder/lib/sys_elf.h.w32" "${PROJECT_SOURCE_DIR}/source_subfolder/lib/sys_elf.h") - file(RENAME "${PROJECT_SOURCE_DIR}/source_subfolder/lib/config.h.w32" "${PROJECT_SOURCE_DIR}/source_subfolder/config.h") +if(EXISTS "${LIBELF_SRC_DIR}/lib/sys_elf.h.w32") + file(RENAME "${LIBELF_SRC_DIR}/lib/sys_elf.h.w32" "${LIBELF_SRC_DIR}/lib/sys_elf.h") + file(RENAME "${LIBELF_SRC_DIR}/lib/config.h.w32" "${LIBELF_SRC_DIR}/config.h") endif() -file(GLOB_RECURSE SOURCES "source_subfolder/lib/*.c") -file(GLOB_RECURSE HEADERS "source_subfolder/lib/*.h") +file(GLOB_RECURSE SOURCES "${LIBELF_SRC_DIR}/lib/*.c") +file(GLOB_RECURSE HEADERS "${LIBELF_SRC_DIR}/lib/*.h") add_library(${PROJECT_NAME} ${SOURCES}) -set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${HEADERS}") -target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC "source_subfolder/lib") +set_target_properties(${PROJECT_NAME} PROPERTIES + PUBLIC_HEADER "${HEADERS}" + WINDOWS_EXPORT_ALL_SYMBOLS TRUE +) +target_include_directories(${PROJECT_NAME} SYSTEM PUBLIC "${LIBELF_SRC_DIR}/lib") target_compile_definitions(${PROJECT_NAME} PUBLIC HAVE_MEMCMP=1 HAVE_MEMCPY=1 HAVE_MEMMOVE=1) -if(MSVC AND BUILD_SHARED_LIBS) - set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) -endif() +include(GNUInstallDirs) install(TARGETS ${PROJECT_NAME} - ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib - RUNTIME DESTINATION bin - PUBLIC_HEADER DESTINATION include/libelf + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libelf ) -install(FILES "source_subfolder/lib/libelf.h" DESTINATION include) -install(FILES "source_subfolder/lib/gelf.h" DESTINATION include) -install(FILES "source_subfolder/lib/nlist.h" DESTINATION include) +install(FILES "${LIBELF_SRC_DIR}/lib/libelf.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(FILES "${LIBELF_SRC_DIR}/lib/gelf.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(FILES "${LIBELF_SRC_DIR}/lib/nlist.h" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/libelf/all/conanfile.py b/recipes/libelf/all/conanfile.py index ef3129a271c50..ef53cb9bcc6e2 100644 --- a/recipes/libelf/all/conanfile.py +++ b/recipes/libelf/all/conanfile.py @@ -1,11 +1,15 @@ from conan import ConanFile -from conan.tools import files from conan.errors import ConanInvalidConfiguration -from conans import AutoToolsBuildEnvironment, CMake, tools +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import unix_path import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" + class LibelfConan(ConanFile): name = "libelf" @@ -14,22 +18,23 @@ class LibelfConan(ConanFile): homepage = "https://directory.fsf.org/wiki/Libelf" license = "LGPL-2.0" topics = ("elf", "fsf", "libelf", "object-file") - exports_sources = "CMakeLists.txt" - generators = "cmake" - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - _autotools = None - _cmake = None + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } - @property - def _source_subfolder(self): - return "source_subfolder" + exports_sources = "CMakeLists.txt" @property - def _build_subfolder(self): - return "build_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def config_options(self): if self.settings.os == "Windows": @@ -37,9 +42,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + if self.settings.os == "Windows": + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def validate(self): if self.options.shared and self.settings.os not in ["Linux", "FreeBSD", "Windows"]: @@ -47,82 +58,68 @@ def validate(self): def build_requirements(self): if self.settings.os != "Windows": - self.build_requires("autoconf/2.71") - self.build_requires("gnu-config/cci.20210814") + self.tool_requires("autoconf/2.71") + self.tool_requires("gnu-config/cci.20210814") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - files.get(self, **self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _build_cmake(self): - cmake = self._configure_cmake() - cmake.build() - - def _package_cmake(self): - cmake = self._configure_cmake() - cmake.install() - - def _configure_autotools(self): - if self._autotools: - return self._autotools - with files.chdir(self, self._source_subfolder): - self.run("autoreconf -fiv", run_environment=True) - args = ["--enable-shared={}".format("yes" if self.options.shared else "no")] - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.configure(configure_dir=self._source_subfolder, args=args) - return self._autotools - - def _build_autotools(self): - autotools = self._configure_autotools() - autotools.make() - - def _package_autotools(self): - autotools = self._configure_autotools() - autotools.install() - files.rmdir(self, os.path.join(self.package_folder, "share")) - files.rmdir(self, os.path.join(self.package_folder, "lib", "locale")) - if self.settings.os in ["Linux", "FreeBSD"] and self.options.shared: - os.remove(os.path.join(self.package_folder, "lib", "libelf.a")) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @property - def _user_info_build(self): - # If using the experimental feature with different context for host and - # build, the 'user_info' attributes of the 'build_requires' packages - # will be located into the 'user_info_build' object. In other cases they - # will be located into the 'deps_user_info' object. - return getattr(self, "user_info_build", None) or self.deps_user_info + def generate(self): + if self.settings.os == "Windows": + tc = CMakeToolchain(self) + tc.variables["LIBELF_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + # it's required, libelf doesnt seem to understand DESTDIR + f"--prefix={unix_path(self, self.package_folder)}", + ]) + tc.generate() def build(self): if self.settings.os == "Windows": - self._build_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() else: - files.replace_in_file(self, os.path.join(self._source_subfolder, "lib", "Makefile.in"), + replace_in_file(self, os.path.join(self.source_folder, "lib", "Makefile.in"), "$(LINK_SHLIB)", "$(LINK_SHLIB) $(LDFLAGS)") # libelf sources contains really outdated 'config.sub' and # 'config.guess' files. It not allows to build libelf for armv8 arch. - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - self._build_autotools() + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="COPYING.LIB", dst="licenses", src=self._source_subfolder) + copy(self, "COPYING.LIB", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if self.settings.os == "Windows": - self._package_cmake() + cmake = CMake(self) + cmake.install() else: - self._package_autotools() - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "lib", "locale")) + if self.options.shared: + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) self.cpp_info.set_property("pkg_config_name", "libelf") - self.cpp_info.includedirs = [os.path.join("include", "libelf"), "include"] + self.cpp_info.libs = ["elf"] + self.cpp_info.includedirs.append(os.path.join("include", "libelf")) diff --git a/recipes/libelf/all/test_package/CMakeLists.txt b/recipes/libelf/all/test_package/CMakeLists.txt index 839dea5c1b963..715677f6fc466 100644 --- a/recipes/libelf/all/test_package/CMakeLists.txt +++ b/recipes/libelf/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libelf REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libelf::libelf) +target_link_libraries(${PROJECT_NAME} PRIVATE libelf::libelf) diff --git a/recipes/libelf/all/test_package/conanfile.py b/recipes/libelf/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/libelf/all/test_package/conanfile.py +++ b/recipes/libelf/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libelf/all/test_v1_package/CMakeLists.txt b/recipes/libelf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libelf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libelf/all/test_v1_package/conanfile.py b/recipes/libelf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libelf/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libev/all/CMakeLists.txt b/recipes/libev/all/CMakeLists.txt new file mode 100644 index 0000000000000..e3473fd877dd1 --- /dev/null +++ b/recipes/libev/all/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 3.14) +project(ev C) + +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + +set(EV_PUBLIC_HEADERS + "${EV_SRC_DIR}/ev.h" + "${EV_SRC_DIR}/config.h") +add_library(ev "${EV_SRC_DIR}/ev.c") +target_link_libraries(ev PUBLIC ws2_32) +target_compile_definitions(ev PRIVATE HAVE_CONFIG_H=1) +target_include_directories(ev PUBLIC ${EV_SRC_DIR}) + +set_target_properties(ev PROPERTIES PUBLIC_HEADER "${EV_PUBLIC_HEADERS}") +include(GNUInstallDirs) + +install(TARGETS ev + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) diff --git a/recipes/libev/all/conanfile.py b/recipes/libev/all/conanfile.py index d3af4e084a874..7e2f35fce7815 100644 --- a/recipes/libev/all/conanfile.py +++ b/recipes/libev/all/conanfile.py @@ -1,15 +1,21 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibevConan(ConanFile): name = "libev" description = "A full-featured and high-performance event loop that is loosely modelled after libevent" - topics = ("event", "libev", "event-loop", "periodic-timer", "notify") + topics = ("event", "event-loop", "periodic-timer", "notify") url = "https://github.com/conan-io/conan-center-index" homepage = "http://software.schmorp.de/pkg/libev.html" license = ["BSD-2-Clause", "GPL-2.0-or-later"] @@ -24,74 +30,76 @@ class LibevConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, dst=self.export_sources_folder) + copy(self, "config.h", self.recipe_folder, self.export_sources_folder) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self._is_msvc: - raise ConanInvalidConfiguration("libev is not supported by Visual Studio") - if self.settings.os == "Windows" and self.options.shared: + if self.info.settings.os == "Windows" and self.info.options.shared: # libtool: error: can't build i686-pc-mingw32 shared library unless -no-undefined is specified - raise ConanInvalidConfiguration("libev can't be built as shared on Windows") + raise ConanInvalidConfiguration(f"{self.ref} can't be built as shared on Windows") def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows" and not is_msvc(self): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - # relocatable shared lib on macOS - tools.replace_in_file( - os.path.join(self._source_subfolder, "configure"), - "-install_name \\$rpath/", - "-install_name @rpath/", - ) - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - autotools.configure(args=args, configure_dir=self._source_subfolder) - return autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + if is_msvc(self): + tc = CMakeToolchain(self) + tc.variables["EV_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - self._patch_sources() - autotools = self._configure_autotools() - autotools.make() + if is_msvc(self): + base_folder = os.path.join(self.source_folder, os.pardir) + copy(self, "config.h", src=base_folder, dst=self.source_folder) + cmake = CMake(self) + cmake.configure(build_script_folder=base_folder) + cmake.build() + else: + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - autotools = self._configure_autotools() - autotools.install() - - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + cmake = CMake(self) + cmake.install() + else: + autotools = Autotools(self) + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["ev"] diff --git a/recipes/libev/all/config.h b/recipes/libev/all/config.h new file mode 100644 index 0000000000000..083271233c6a7 --- /dev/null +++ b/recipes/libev/all/config.h @@ -0,0 +1,128 @@ +/* config.h.in. Generated from configure.ac by autoheader. */ + +/* Define to 1 if you have the `clock_gettime' function. */ +#undef HAVE_CLOCK_GETTIME + +/* Define to 1 to use the syscall interface for clock_gettime */ +#undef HAVE_CLOCK_SYSCALL + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define to 1 if you have the `epoll_ctl' function. */ +#undef HAVE_EPOLL_CTL + +/* Define to 1 if you have the `eventfd' function. */ +#undef HAVE_EVENTFD + +/* Define to 1 if the floor function is available */ +#undef HAVE_FLOOR + +/* Define to 1 if you have the `inotify_init' function. */ +#undef HAVE_INOTIFY_INIT + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define to 1 if you have the `kqueue' function. */ +#undef HAVE_KQUEUE + +/* Define to 1 if you have the `rt' library (-lrt). */ +#undef HAVE_LIBRT + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `nanosleep' function. */ +#undef HAVE_NANOSLEEP + +/* Define to 1 if you have the `poll' function. */ +#undef HAVE_POLL + +/* Define to 1 if you have the header file. */ +#undef HAVE_POLL_H + +/* Define to 1 if you have the `port_create' function. */ +#undef HAVE_PORT_CREATE + +/* Define to 1 if you have the header file. */ +#undef HAVE_PORT_H + +/* Define to 1 if you have the `select' function. */ +#undef HAVE_SELECT + +/* Define to 1 if you have the `signalfd' function. */ +#undef HAVE_SIGNALFD + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EPOLL_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EVENTFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_EVENT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_INOTIFY_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SELECT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_SIGNALFD_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Version number of package */ +#undef VERSION + +#define HAVE_SELECT 1 +#define HAVE_SYS_SELECT_H 1 diff --git a/recipes/libev/all/test_package/CMakeLists.txt b/recipes/libev/all/test_package/CMakeLists.txt index d45d0fcc3e9b6..ace0979b2a703 100644 --- a/recipes/libev/all/test_package/CMakeLists.txt +++ b/recipes/libev/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libev REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libev::libev) +target_link_libraries(${PROJECT_NAME} PRIVATE libev::libev) diff --git a/recipes/libev/all/test_package/conanfile.py b/recipes/libev/all/test_package/conanfile.py index 697dfef261b53..0a6bc68712d90 100644 --- a/recipes/libev/all/test_package/conanfile.py +++ b/recipes/libev/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libev/all/test_v1_package/CMakeLists.txt b/recipes/libev/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libev/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libev/all/test_v1_package/conanfile.py b/recipes/libev/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libev/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libevent/all/CMakeLists.txt b/recipes/libevent/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/libevent/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libevent/all/conandata.yml b/recipes/libevent/all/conandata.yml index 3b0833457f7a3..f2a195cfe79c1 100644 --- a/recipes/libevent/all/conandata.yml +++ b/recipes/libevent/all/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "2.1.12": - patch_file: patches/fix-cmake-2.1.12.patch - base_path: source_subfolder "2.1.11": - patch_file: patches/fix-cmake-2.1.11.patch - base_path: source_subfolder diff --git a/recipes/libevent/all/conanfile.py b/recipes/libevent/all/conanfile.py index 4f7372e490bb7..8ae1637de9bc1 100644 --- a/recipes/libevent/all/conanfile.py +++ b/recipes/libevent/all/conanfile.py @@ -1,9 +1,10 @@ -from conan.tools.microsoft import msvc_runtime_flag, is_msvc -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os -import functools -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.52.0" class LibeventConan(ConanFile): @@ -28,22 +29,8 @@ class LibeventConan(ConanFile): "disable_threads": False, } - generators = "cmake", "cmake_find_package" - short_paths = True - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,57 +38,69 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if self.options.with_openssl: + tc.variables["OPENSSL_ROOT_DIR"] = self.dependencies["openssl"].package_folder.replace("\\", "/") + tc.cache_variables["EVENT__LIBRARY_TYPE"] = "SHARED" if self.options.shared else "STATIC" + tc.variables["EVENT__DISABLE_DEBUG_MODE"] = self.settings.build_type == "Release" + tc.variables["EVENT__DISABLE_OPENSSL"] = not self.options.with_openssl + tc.variables["EVENT__DISABLE_THREAD_SUPPORT"] = self.options.disable_threads + tc.variables["EVENT__DISABLE_BENCHMARK"] = True + tc.variables["EVENT__DISABLE_TESTS"] = True + tc.variables["EVENT__DISABLE_REGRESS"] = True + tc.variables["EVENT__DISABLE_SAMPLES"] = True + # libevent uses static runtime (MT) for static builds by default + if is_msvc(self): + tc.variables["EVENT__MSVC_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # relocatable shared libs on macOS - tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "AddEventLibrary.cmake"), + replace_in_file(self, os.path.join(self.source_folder, "cmake", "AddEventLibrary.cmake"), "INSTALL_NAME_DIR \"${CMAKE_INSTALL_PREFIX}/lib\"", "") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - if self.options.with_openssl: - cmake.definitions["OPENSSL_ROOT_DIR"] = self.deps_cpp_info["openssl"].rootpath - cmake.definitions["EVENT__LIBRARY_TYPE"] = "SHARED" if self.options.shared else "STATIC" - cmake.definitions["EVENT__DISABLE_DEBUG_MODE"] = self.settings.build_type == "Release" - cmake.definitions["EVENT__DISABLE_OPENSSL"] = not self.options.with_openssl - cmake.definitions["EVENT__DISABLE_THREAD_SUPPORT"] = self.options.disable_threads - cmake.definitions["EVENT__DISABLE_BENCHMARK"] = True - cmake.definitions["EVENT__DISABLE_TESTS"] = True - cmake.definitions["EVENT__DISABLE_REGRESS"] = True - cmake.definitions["EVENT__DISABLE_SAMPLES"] = True - # libevent uses static runtime (MT) for static builds by default - if is_msvc(self): - cmake.definitions["EVENT__MSVC_STATIC_RUNTIME"] = "MT" in msvc_runtime_flag(self) - - cmake.configure(build_folder=self._build_subfolder) - return cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Libevent") diff --git a/recipes/libevent/all/test_package/CMakeLists.txt b/recipes/libevent/all/test_package/CMakeLists.txt index 1cc4000b58485..dc7570c75d1b5 100644 --- a/recipes/libevent/all/test_package/CMakeLists.txt +++ b/recipes/libevent/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(Libevent REQUIRED core CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libevent::core) +target_link_libraries(${PROJECT_NAME} PRIVATE libevent::core) diff --git a/recipes/libevent/all/test_package/conanfile.py b/recipes/libevent/all/test_package/conanfile.py index ab912e4e61df1..0a6bc68712d90 100644 --- a/recipes/libevent/all/test_package/conanfile.py +++ b/recipes/libevent/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libevent/all/test_v1_package/CMakeLists.txt b/recipes/libevent/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a8d5eec5dd24d --- /dev/null +++ b/recipes/libevent/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Libevent REQUIRED core CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libevent::core) diff --git a/recipes/libevent/all/test_v1_package/conanfile.py b/recipes/libevent/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libevent/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libexif/all/conandata.yml b/recipes/libexif/all/conandata.yml index b80594e248418..ae774e1c9a024 100644 --- a/recipes/libexif/all/conandata.yml +++ b/recipes/libexif/all/conandata.yml @@ -1,8 +1,12 @@ sources: + "0.6.24": + url: "https://github.com/libexif/libexif/releases/download/v0.6.23/libexif-0.6.23.tar.gz" + sha256: "9271cf58cb46b00f9e2e9b968c7d81c008a69e5457f7d1a50dbf1786eac61b52" "0.6.23": url: "https://github.com/libexif/libexif/releases/download/v0.6.23/libexif-0.6.23.tar.gz" sha256: "9271cf58cb46b00f9e2e9b968c7d81c008a69e5457f7d1a50dbf1786eac61b52" patches: + "0.6.24": + - patch_file: patches/replace_ssize_t_windows.diff "0.6.23": - patch_file: patches/replace_ssize_t_windows.diff - base_path: source_subfolder diff --git a/recipes/libexif/all/conanfile.py b/recipes/libexif/all/conanfile.py index 5c818871ce0c1..8b251e32d1238 100644 --- a/recipes/libexif/all/conanfile.py +++ b/recipes/libexif/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -import contextlib +from conan import ConanFile +from conan.tools.layout import basic_layout +from conan.tools.files import get, copy, rename, rmdir, rm, export_conandata_patches, apply_conandata_patches +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.env import VirtualBuildEnv +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class LibexifConan(ConanFile): @@ -12,7 +17,6 @@ class LibexifConan(ConanFile): license = "LGPL-2.1" description = "libexif is a library for parsing, editing, and saving EXIF data." topics = ("exif", "metadata", "parse", "edit") - exports_sources = "patches/*" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,29 +26,20 @@ class LibexifConan(ConanFile): "shared": False, "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "cl -nologo", - "AR": "lib", - "LD": "link -nologo", - } - with tools.environment_append(env): - yield - else: - yield + @property + def _user_info_build(self): + return getattr(self, "user_info_build", self.deps_user_info) + + def layout(self): + basic_layout(self, src_folder="src") + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -57,56 +52,64 @@ def configure(self): del self.settings.compiler.cppstd def build_requirements(self): - self.build_requires("gettext/0.21") - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + self.tool_requires("gettext/0.21") + self.tool_requires("libtool/2.4.6") + if self._settings_build.os == "Windows": + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + self.tool_requires("msys2/cci.latest") + self.win_bash = True def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") - self._autotools.libs = [] - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - args = [ + tc.configure_args.extend([ "--enable-shared={}".format(yes_no(self.options.shared)), "--enable-static={}".format(yes_no(not self.options.shared)), "--disable-docs", "--disable-nls", "--disable-rpath", - ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + ]) + if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + + # env vars + env = tc.environment() + if is_msvc(self): + compile_wrapper = unix_path(self, self._user_info_build["automake"].compile).replace("\\", "/") + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib).replace("\\", "/") + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("AR", f"{ar_wrapper} lib") + env.define("LD", f"{compile_wrapper} link -nologo") + + tc.generate(env) + + env = VirtualBuildEnv(self) + env.generate() def build(self): - self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - if self.settings.compiler == "Visual Studio" and self.options.shared: - tools.rename(os.path.join(self.package_folder, "lib", "exif.dll.lib"), + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + if is_msvc(self) and self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "exif.dll.lib"), os.path.join(self.package_folder, "lib", "exif.lib")) - tools.remove_files_by_mask(self.package_folder, "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libs = ["exif"] self.cpp_info.names["pkg_config"] = "libexif" + self.cpp_info.set_property("pkg_config_name", "libexif") if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["m"] diff --git a/recipes/libexif/config.yml b/recipes/libexif/config.yml index e252661bf796f..d4a99779aab91 100644 --- a/recipes/libexif/config.yml +++ b/recipes/libexif/config.yml @@ -1,3 +1,5 @@ versions: + "0.6.24": + folder: all "0.6.23": folder: all diff --git a/recipes/libfdk_aac/all/CMakeLists.txt b/recipes/libfdk_aac/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/libfdk_aac/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libfdk_aac/all/conandata.yml b/recipes/libfdk_aac/all/conandata.yml index ce7031c0bb8bc..130e5570f8cdf 100644 --- a/recipes/libfdk_aac/all/conandata.yml +++ b/recipes/libfdk_aac/all/conandata.yml @@ -1,10 +1,10 @@ sources: "2.0.2": - url: "https://github.com/mstorsjo/fdk-aac/archive/refs/tags/v2.0.2.tar.gz" - sha256: "7812b4f0cf66acda0d0fe4302545339517e702af7674dd04e5fe22a5ade16a90" + url: "https://sourceforge.net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.0.2.tar.gz" + sha256: "c9e8630cf9d433f3cead74906a1520d2223f89bcd3fa9254861017440b8eb22f" "2.0.1": - url: "https://github.com/mstorsjo/fdk-aac/archive/v2.0.1.tar.gz" - sha256: "a4142815d8d52d0e798212a5adea54ecf42bcd4eec8092b37a8cb615ace91dc6" + url: "https://sourceforge.net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.0.1.tar.gz" + sha256: "840133aa9412153894af03b27b03dde1188772442c316a4ce2a24ed70093f271" "2.0.0": - url: "https://github.com/mstorsjo/fdk-aac/archive/v2.0.0.tar.gz" - sha256: "6e6c7921713788e31df655911e1d42620b057180b00bf16874f5d630e1d5b9a2" + url: "https://sourceforge.net/projects/opencore-amr/files/fdk-aac/fdk-aac-2.0.0.tar.gz" + sha256: "f7d6e60f978ff1db952f7d5c3e96751816f5aef238ecf1d876972697b85fd96c" diff --git a/recipes/libfdk_aac/all/conanfile.py b/recipes/libfdk_aac/all/conanfile.py index 46645046e433e..5907c10a61c22 100644 --- a/recipes/libfdk_aac/all/conanfile.py +++ b/recipes/libfdk_aac/all/conanfile.py @@ -1,9 +1,15 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, CMake, VisualStudioBuildEnvironment, tools -import contextlib -import functools +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import chdir, copy, get, rename, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, NMakeToolchain +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.55.0" class LibFDKAACConan(ConanFile): @@ -12,7 +18,7 @@ class LibFDKAACConan(ConanFile): description = "A standalone library of the Fraunhofer FDK AAC code from Android" license = "https://github.com/mstorsjo/fdk-aac/blob/master/NOTICE" homepage = "https://sourceforge.net/projects/opencore-amr/" - topics = ("libfdk_aac", "multimedia", "audio", "fraunhofer", "aac", "decoder", "encoding", "decoding") + topics = ("multimedia", "audio", "fraunhofer", "aac", "decoder", "encoding", "decoding") settings = "os", "arch", "compiler", "build_type" options = { @@ -24,24 +30,13 @@ class LibFDKAACConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @property def _use_cmake(self): - return tools.Version(self.version) >= "2.0.2" + return Version(self.version) >= "2.0.2" def config_options(self): if self.settings.os == "Windows": @@ -49,108 +44,99 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + if self._use_cmake: + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def build_requirements(self): - if not self._use_cmake and not self._is_msvc: - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not self._use_cmake and not is_msvc(self): + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_PROGRAMS"] = False - cmake.definitions["FDK_AAC_INSTALL_CMAKE_CONFIG_MODULE"] = False - cmake.definitions["FDK_AAC_INSTALL_PKGCONFIG_MODULE"] = False - cmake.configure() - return cmake - - @contextlib.contextmanager - def _msvc_build_environment(self): - with tools.chdir(self._source_subfolder): - with tools.vcvars(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - yield - - def _build_vs(self): - with self._msvc_build_environment(): - # Rely on flags injected by conan - tools.replace_in_file("Makefile.vc", - "CFLAGS = /nologo /W3 /Ox /MT", - "CFLAGS = /nologo") - tools.replace_in_file("Makefile.vc", - "MKDIR_FLAGS = -p", - "MKDIR_FLAGS =") - # Build either shared or static, and don't build utility (it always depends on static lib) - tools.replace_in_file("Makefile.vc", "copy $(PROGS) $(bindir)", "") - tools.replace_in_file("Makefile.vc", "copy $(LIB_DEF) $(libdir)", "") - if self.options.shared: - tools.replace_in_file("Makefile.vc", - "all: $(LIB_DEF) $(STATIC_LIB) $(SHARED_LIB) $(IMP_LIB) $(PROGS)", - "all: $(LIB_DEF) $(SHARED_LIB) $(IMP_LIB)") - tools.replace_in_file("Makefile.vc", "copy $(STATIC_LIB) $(libdir)", "") - else: - tools.replace_in_file("Makefile.vc", - "all: $(LIB_DEF) $(STATIC_LIB) $(SHARED_LIB) $(IMP_LIB) $(PROGS)", - "all: $(STATIC_LIB)") - tools.replace_in_file("Makefile.vc", "copy $(IMP_LIB) $(libdir)", "") - tools.replace_in_file("Makefile.vc", "copy $(SHARED_LIB) $(bindir)", "") - self.run("nmake -f Makefile.vc") - - def _build_autotools(self): - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # relocatable shared lib on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - if self.settings.os == "Android" and tools.os_info.is_windows: - # remove escape for quotation marks, to make ndk on windows happy - tools.replace_in_file("configure", - "s/[ `~#$^&*(){}\\\\|;'\\\''\"<>?]/\\\\&/g", "s/[ `~#$^&*(){}\\\\|;<>?]/\\\\&/g") - autotools = self._configure_autotools() - autotools.make() - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - autotools.configure(args=args, configure_dir=self._source_subfolder) - return autotools + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if self._use_cmake: + tc = CMakeToolchain(self) + tc.variables["BUILD_PROGRAMS"] = False + tc.variables["FDK_AAC_INSTALL_CMAKE_CONFIG_MODULE"] = False + tc.variables["FDK_AAC_INSTALL_PKGCONFIG_MODULE"] = False + tc.generate() + elif is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.generate() def build(self): if self._use_cmake: - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() - elif self._is_msvc: - self._build_vs() + elif is_msvc(self): + makefile_vc = os.path.join(self.source_folder, "Makefile.vc") + replace_in_file(self, makefile_vc, "CFLAGS = /nologo /W3 /Ox /MT", "CFLAGS = /nologo") + replace_in_file(self, makefile_vc, "MKDIR_FLAGS = -p", "MKDIR_FLAGS =") + # Build either shared or static, and don't build utility (it always depends on static lib) + replace_in_file(self, makefile_vc, "copy $(PROGS) $(bindir)", "") + replace_in_file(self, makefile_vc, "copy $(LIB_DEF) $(libdir)", "") + if self.options.shared: + replace_in_file( + self, makefile_vc, + "all: $(LIB_DEF) $(STATIC_LIB) $(SHARED_LIB) $(IMP_LIB) $(PROGS)", + "all: $(LIB_DEF) $(SHARED_LIB) $(IMP_LIB)", + ) + replace_in_file(self, makefile_vc, "copy $(STATIC_LIB) $(libdir)", "") + else: + replace_in_file( + self, makefile_vc, + "all: $(LIB_DEF) $(STATIC_LIB) $(SHARED_LIB) $(IMP_LIB) $(PROGS)", + "all: $(STATIC_LIB)", + ) + replace_in_file(self, makefile_vc, "copy $(IMP_LIB) $(libdir)", "") + replace_in_file(self, makefile_vc, "copy $(SHARED_LIB) $(bindir)", "") + with chdir(self, self.source_folder): + self.run("nmake -f Makefile.vc") else: - self._build_autotools() + autotools = Autotools(self) + autotools.autoreconf() + if self.settings.os == "Android" and self._settings_build.os == "Windows": + # remove escape for quotation marks, to make ndk on windows happy + replace_in_file( + self, os.path.join(self.source_folder, "configure"), + "s/[ `~#$^&*(){}\\\\|;'\\\''\"<>?]/\\\\&/g", "s/[ `~#$^&*(){}\\\\|;<>?]/\\\\&/g", + ) + autotools.configure() + autotools.make() def package(self): - self.copy(pattern="NOTICE", src=self._source_subfolder, dst="licenses") + copy(self, "NOTICE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if self._use_cmake: - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - elif self._is_msvc: - with self._msvc_build_environment(): - self.run("nmake -f Makefile.vc prefix=\"{}\" install".format(self.package_folder)) + elif is_msvc(self): + with chdir(self, self.source_folder): + self.run(f"nmake -f Makefile.vc prefix=\"{self.package_folder}\" install") if self.options.shared: - tools.rename(os.path.join(self.package_folder, "lib", "fdk-aac.dll.lib"), + rename(self, os.path.join(self.package_folder, "lib", "fdk-aac.dll.lib"), os.path.join(self.package_folder, "lib", "fdk-aac.lib")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("cmake_file_name", "fdk-aac") @@ -167,7 +153,6 @@ def package_info(self): self.cpp_info.filenames["cmake_find_package_multi"] = "fdk-aac" self.cpp_info.names["cmake_find_package"] = "FDK-AAC" self.cpp_info.names["cmake_find_package_multi"] = "FDK-AAC" - self.cpp_info.names["pkg_config"] = "fdk-aac" self.cpp_info.components["fdk-aac"].names["cmake_find_package"] = "fdk-aac" self.cpp_info.components["fdk-aac"].names["cmake_find_package_multi"] = "fdk-aac" self.cpp_info.components["fdk-aac"].set_property("cmake_target_name", "FDK-AAC::fdk-aac") diff --git a/recipes/libfdk_aac/all/test_package/CMakeLists.txt b/recipes/libfdk_aac/all/test_package/CMakeLists.txt index da66a6c3ba41f..609976265e86c 100644 --- a/recipes/libfdk_aac/all/test_package/CMakeLists.txt +++ b/recipes/libfdk_aac/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(fdk-aac REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} FDK-AAC::fdk-aac) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE FDK-AAC::fdk-aac) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/libfdk_aac/all/test_package/conanfile.py b/recipes/libfdk_aac/all/test_package/conanfile.py index 0b5a595cef5e0..0a6bc68712d90 100644 --- a/recipes/libfdk_aac/all/test_package/conanfile.py +++ b/recipes/libfdk_aac/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libfdk_aac/all/test_v1_package/CMakeLists.txt b/recipes/libfdk_aac/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libfdk_aac/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libfdk_aac/all/test_v1_package/conanfile.py b/recipes/libfdk_aac/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libfdk_aac/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libffi/all/conandata.yml b/recipes/libffi/all/conandata.yml index d6c753d210634..869663acc18e9 100644 --- a/recipes/libffi/all/conandata.yml +++ b/recipes/libffi/all/conandata.yml @@ -1,42 +1,26 @@ sources: + "3.4.3": + url: "https://github.com/libffi/libffi/releases/download/v3.4.3/libffi-3.4.3.tar.gz" + sha256: "4416dd92b6ae8fcb5b10421e711c4d3cb31203d77521a77d85d0102311e6c3b8" "3.4.2": url: "https://github.com/libffi/libffi/releases/download/v3.4.2/libffi-3.4.2.tar.gz" sha256: "540fb721619a6aba3bdeef7d940d8e9e0e6d2c193595bc243241b77ff9e93620" "3.3": url: "https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz" sha256: "72fba7922703ddfa7a028d513ac15a85c8d54c8d67f55fa5a4802885dc652056" - "3.2.1": - url: "https://sourceware.org/pub/libffi/libffi-3.2.1.tar.gz" - sha256: "d06ebb8e1d9a22d19e38d63fdb83954253f39bedc5d46232a05645685722ca37" patches: + "3.4.3": + - patch_file: "patches/0002-3.4.3-fix-libtool-path.patch" + - patch_file: "patches/0004-3.3-fix-complex-type-msvc.patch" + - patch_file: "patches/0005-3.4.3-do-not-install-libraries-to-arch-dependent-directories.patch" + - patch_file: "patches/0006-3.4.3-library-no-version-suffix.patch" "3.4.2": - - base_path: "source_subfolder" - patch_file: "patches/0002-3.4.2-fix-libtool-path.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-3.3-fix-complex-type-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/0005-3.4.2-do-not-install-libraries-to-arch-dependent-directories.patch" - - base_path: "source_subfolder" - patch_file: "patches/0006-3.4.2-library-no-version-suffix.patch" + - patch_file: "patches/0002-3.4.2-fix-libtool-path.patch" + - patch_file: "patches/0004-3.3-fix-complex-type-msvc.patch" + - patch_file: "patches/0005-3.4.2-do-not-install-libraries-to-arch-dependent-directories.patch" + - patch_file: "patches/0006-3.4.2-library-no-version-suffix.patch" "3.3": - - base_path: "source_subfolder" - patch_file: "patches/0002-3.3-fix-libtool-path.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-3.3-fix-complex-type-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/0005-3.3-do-not-install-libraries-to-arch-dependent-directories.patch" - - base_path: "source_subfolder" - patch_file: "patches/0006-3.3-library-no-version-suffix.patch" - "3.2.1": - - base_path: "source_subfolder" - patch_file: "patches/0001-3.2.1-add-support-windows-dll.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-3.2.1-fix-libtool-path.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-3.2.1-fix-win64-assembly.patch" - - base_path: "source_subfolder" - patch_file: "patches/0004-3.2.1-fix-complex-type-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/0005-3.2.1-do-not-install-libraries-to-arch-dependent-directories.patch" - - base_path: "source_subfolder" - patch_file: "patches/0006-3.2.1-library-no-version-suffix.patch" + - patch_file: "patches/0002-3.3-fix-libtool-path.patch" + - patch_file: "patches/0004-3.3-fix-complex-type-msvc.patch" + - patch_file: "patches/0005-3.3-do-not-install-libraries-to-arch-dependent-directories.patch" + - patch_file: "patches/0006-3.3-library-no-version-suffix.patch" diff --git a/recipes/libffi/all/conanfile.py b/recipes/libffi/all/conanfile.py index 0c3c43ae18843..65dffe00621e4 100644 --- a/recipes/libffi/all/conanfile.py +++ b/recipes/libffi/all/conanfile.py @@ -1,20 +1,25 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, tools, AutoToolsBuildEnvironment -import contextlib +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc, is_msvc_static_runtime, msvc_runtime_flag, unix_path +from conan.tools.scm import Version +import glob import os import shutil -required_conan_version = ">=1.36" +required_conan_version = ">=1.57.0" class LibffiConan(ConanFile): name = "libffi" description = "A portable, high level programming interface to various calling conventions" - topics = ("libffi", "runtime", "foreign-function-interface", "runtime-library") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://sourceware.org/libffi/" - license = "MIT" - + topics = ("runtime", "foreign-function-interface", "runtime-library") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,27 +30,13 @@ class LibffiConan(ConanFile): "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): + # TODO: Remove for Conan v2 return getattr(self, "settings_build", self.settings) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,133 +44,130 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - self.build_requires("gnu-config/cci.20201022") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("automake/1.16.5") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # Generate rpath friendly shared lib on macOS - configure_path = os.path.join(self._source_subfolder, "configure") - tools.replace_in_file(configure_path, "-install_name \\$rpath/", "-install_name @rpath/") - - if tools.Version(self.version) < "3.3": - if self.settings.compiler == "clang" and tools.Version(str(self.settings.compiler.version)) >= 7.0: - # https://android.googlesource.com/platform/external/libffi/+/ca22c3cb49a8cca299828c5ffad6fcfa76fdfa77 - sysv_s_src = os.path.join(self._source_subfolder, "src", "arm", "sysv.S") - tools.replace_in_file(sysv_s_src, "fldmiad", "vldmia") - tools.replace_in_file(sysv_s_src, "fstmiad", "vstmia") - tools.replace_in_file(sysv_s_src, "fstmfdd\tsp!,", "vpush") + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() - # https://android.googlesource.com/platform/external/libffi/+/7748bd0e4a8f7d7c67b2867a3afdd92420e95a9f - tools.replace_in_file(sysv_s_src, "stmeqia", "stmiaeq") - - @contextlib.contextmanager - def _build_context(self): - extra_env_vars = {} - if tools.os_info.is_windows and (self._is_msvc or self.settings.compiler == "clang") : - msvcc = tools.unix_path(os.path.join(self.source_folder, self._source_subfolder, "msvcc.sh")) - msvcc_args = [] - if self._is_msvc: - if self.settings.arch == "x86_64": - msvcc_args.append("-m64") - elif self.settings.arch == "x86": - msvcc_args.append("-m32") - elif self.settings.compiler == "clang": - msvcc_args.append("-clang-cl") - - if msvcc_args: - msvcc = "{} {}".format(msvcc, " ".join(msvcc_args)) - extra_env_vars.update(tools.vcvars_dict(self.settings)) - extra_env_vars.update({ - "INSTALL": tools.unix_path(os.path.join(self.source_folder, self._source_subfolder, "install-sh")), - "LIBTOOL": tools.unix_path(os.path.join(self.source_folder, self._source_subfolder, "ltmain.sh")), - "CC": msvcc, - "CXX": msvcc, - "LD": "link", - "CPP": "cl -nologo -EP", - "CXXCPP": "cl -nologo -EP", - }) - with tools.environment_append(extra_env_vars): - yield - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) yes_no = lambda v: "yes" if v else "no" - config_args = [ - "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - self._autotools.defines.append("FFI_BUILDING") + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + f"--enable-debug={yes_no(self.settings.build_type == 'Debug')}", + "--enable-builddir=no", + "--enable-docs=no", + ]) + + if self._settings_build.compiler == "apple-clang": + tc.configure_args.append("--disable-multi-os-directory") + + tc.extra_defines.append("FFI_BUILDING") if self.options.shared: - self._autotools.defines.append("FFI_BUILDING_DLL") - if self._is_msvc: - if "MT" in msvc_runtime_flag(self): - self._autotools.defines.append("USE_STATIC_RTL") - if "d" in msvc_runtime_flag(self): - self._autotools.defines.append("USE_DEBUG_RTL") - build = None - host = None - if self._is_msvc: + tc.extra_defines.append("FFI_BUILDING_DLL") + + env = tc.environment() + if self._settings_build.os == "Windows" and (is_msvc(self) or self.settings.compiler == "clang"): build = "{}-{}-{}".format( "x86_64" if self._settings_build.arch == "x86_64" else "i686", - "pc" if self._settings_build.arch == "x86" else "w64", - "cygwin") + "pc" if self._settings_build.arch == "x86" else "win64", + "mingw64") host = "{}-{}-{}".format( "x86_64" if self.settings.arch == "x86_64" else "i686", - "pc" if self.settings.arch == "x86" else "w64", - "cygwin") - else: - if self._autotools.host and "x86-" in self._autotools.host: - self._autotools.host = self._autotools.host.replace("x86", "i686") - self._autotools.configure(args=config_args, configure_dir=self._source_subfolder, build=build, host=host) - return self._autotools + "pc" if self.settings.arch == "x86" else "win64", + "mingw64") + tc.update_configure_args({ + "--build": build, + "--host": host + }) + + if is_msvc(self) and check_min_vs(self, "180", raise_invalid=False): + # https://github.com/conan-io/conan/issues/6514 + tc.extra_cflags.append("-FS") + + if is_msvc_static_runtime(self): + tc.extra_defines.append("USE_STATIC_RTL") + if "d" in msvc_runtime_flag(self): + tc.extra_defines.append("USE_DEBUG_RTL") + + architecture_flag = "" + if is_msvc(self): + if self.settings.arch == "x86_64": + architecture_flag = "-m64" + elif self.settings.arch == "x86": + architecture_flag = "-m32" + elif self.settings.compiler == "clang": + architecture_flag = "-clang-cl" + + compile_wrapper = unix_path(self, os.path.join(self.source_folder, "msvcc.sh")) + if architecture_flag: + compile_wrapper = f"{compile_wrapper} {architecture_flag}" + + ar_wrapper = unix_path(self, self.dependencies.build["automake"].conf_info.get("user.automake:lib-wrapper")) + env.define("CC", f"{compile_wrapper}") + env.define("CXX", f"{compile_wrapper}") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + env.define("CXXCPP", "cl -nologo -EP") + env.define("CPP", "cl -nologo -EP") + env.define("LIBTOOL", unix_path(self, os.path.join(self.source_folder, "ltmain.sh"))) + env.define("INSTALL", unix_path(self, os.path.join(self.source_folder, "install-sh"))) + tc.generate(env=env) + + def _patch_source(self): + apply_conandata_patches(self) + + if Version(self.version) < "3.3": + if self.settings.compiler == "clang" and Version(str(self.settings.compiler.version)) >= 7.0: + # https://android.googlesource.com/platform/external/libffi/+/ca22c3cb49a8cca299828c5ffad6fcfa76fdfa77 + sysv_s_src = os.path.join(self.source_folder, "src", "arm", "sysv.S") + replace_in_file(self, sysv_s_src, "fldmiad", "vldmia") + replace_in_file(self, sysv_s_src, "fstmiad", "vstmia") + replace_in_file(self, sysv_s_src, "fstmfdd\tsp!,", "vpush") + + # https://android.googlesource.com/platform/external/libffi/+/7748bd0e4a8f7d7c67b2867a3afdd92420e95a9f + replace_in_file(self, sysv_s_src, "stmeqia", "stmiaeq") def build(self): - self._patch_sources() - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() - if tools.get_env("CONAN_RUN_TESTS", False): - autotools.make(target="check") + self._patch_source() + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - if self._is_msvc: - if self.options.shared: - self.copy("libffi.dll", src=".libs", dst="bin") - self.copy("libffi.lib", src=".libs", dst="lib") - self.copy("*.h", src="include", dst="include") - else: - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + autotools = Autotools(self) + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) # Need to specify the `DESTDIR` as a Unix path, aware of the subsystem + fix_apple_shared_install_name(self) + mkdir(self, os.path.join(self.package_folder, "bin")) + for dll in glob.glob(os.path.join(self.package_folder, "lib", "*.dll")): + shutil.move(dll, os.path.join(self.package_folder, "bin")) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + rm(self, "*.la", os.path.join(self.package_folder, "lib"), recursive=True) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.libs = ["{}ffi".format("lib" if is_msvc(self) else "")] self.cpp_info.set_property("pkg_config_name", "libffi") - self.cpp_info.libs = ["{}ffi".format("lib" if self._is_msvc else "")] if not self.options.shared: self.cpp_info.defines = ["FFI_BUILDING"] - diff --git a/recipes/libffi/all/patches/0001-3.2.1-add-support-windows-dll.patch b/recipes/libffi/all/patches/0001-3.2.1-add-support-windows-dll.patch deleted file mode 100644 index 91b34fdcb090a..0000000000000 --- a/recipes/libffi/all/patches/0001-3.2.1-add-support-windows-dll.patch +++ /dev/null @@ -1,163 +0,0 @@ ---- include/ffi.h.in -+++ include/ffi.h.in -@@ -66,6 +66,18 @@ - - #include - -+#if defined _MSC_VER -+# if defined FFI_BUILDING_DLL /* Building libffi.DLL with msvcc.sh */ -+# define FFI_EXTERN __declspec(dllexport) -+# elif !defined FFI_BUILDING /* Importing libffi.DLL */ -+# define FFI_EXTERN __declspec(dllimport) -+# else -+# define FFI_EXTERN extern -+# endif -+#else -+# define FFI_EXTERN extern -+#endif -+ - #ifndef LIBFFI_ASM - - #if defined(_MSC_VER) && !defined(__clang__) -@@ -166,20 +180,6 @@ - #error "long size not supported" - #endif - --/* Need minimal decorations for DLLs to works on Windows. */ --/* GCC has autoimport and autoexport. Rely on Libtool to */ --/* help MSVC export from a DLL, but always declare data */ --/* to be imported for MSVC clients. This costs an extra */ --/* indirection for MSVC clients using the static version */ --/* of the library, but don't worry about that. Besides, */ --/* as a workaround, they can define FFI_BUILDING if they */ --/* *know* they are going to link with the static library. */ --#if defined _MSC_VER && !defined FFI_BUILDING --#define FFI_EXTERN extern __declspec(dllimport) --#else --#define FFI_EXTERN extern --#endif -- - /* These are defined in types.c */ - FFI_EXTERN ffi_type ffi_type_void; - FFI_EXTERN ffi_type ffi_type_uint8; -@@ -237,7 +237,7 @@ - #endif - - /* Used internally, but overridden by some architectures */ --ffi_status ffi_prep_cif_core(ffi_cif *cif, -+FFI_EXTERN ffi_status ffi_prep_cif_core(ffi_cif *cif, - ffi_abi abi, - unsigned int isvariadic, - unsigned int nfixedargs, -@@ -282,27 +282,27 @@ - #endif - - --void ffi_raw_call (ffi_cif *cif, -+FFI_EXTERN void ffi_raw_call (ffi_cif *cif, - void (*fn)(void), - void *rvalue, - ffi_raw *avalue); - --void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); --void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); --size_t ffi_raw_size (ffi_cif *cif); -+FFI_EXTERN void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); -+FFI_EXTERN void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); -+FFI_EXTERN size_t ffi_raw_size (ffi_cif *cif); - - /* This is analogous to the raw API, except it uses Java parameter */ - /* packing, even on 64-bit machines. I.e. on 64-bit machines */ - /* longs and doubles are followed by an empty 64-bit word. */ - --void ffi_java_raw_call (ffi_cif *cif, -+FFI_EXTERN void ffi_java_raw_call (ffi_cif *cif, - void (*fn)(void), - void *rvalue, - ffi_java_raw *avalue); - --void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); --void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); --size_t ffi_java_raw_size (ffi_cif *cif); -+FFI_EXTERN void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); -+FFI_EXTERN void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); -+FFI_EXTERN size_t ffi_java_raw_size (ffi_cif *cif); - - /* ---- Definitions for closures ----------------------------------------- */ - -@@ -330,16 +330,16 @@ - # endif - #endif - --void *ffi_closure_alloc (size_t size, void **code); --void ffi_closure_free (void *); -+FFI_EXTERN void *ffi_closure_alloc (size_t size, void **code); -+FFI_EXTERN void ffi_closure_free (void *); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_closure (ffi_closure*, - ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*), - void *user_data); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_closure_loc (ffi_closure*, - ffi_cif *, - void (*fun)(ffi_cif*,void*,void**,void*), -@@ -400,26 +400,26 @@ - - } ffi_java_raw_closure; - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_raw_closure (ffi_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_raw_closure_loc (ffi_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_raw*,void*), - void *user_data, - void *codeloc); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_java_raw_closure (ffi_java_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), - void *user_data); - --ffi_status -+FFI_EXTERN ffi_status - ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, - ffi_cif *cif, - void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), -@@ -430,20 +430,20 @@ - - /* ---- Public interface definition -------------------------------------- */ - --ffi_status ffi_prep_cif(ffi_cif *cif, -+FFI_EXTERN ffi_status ffi_prep_cif(ffi_cif *cif, - ffi_abi abi, - unsigned int nargs, - ffi_type *rtype, - ffi_type **atypes); - --ffi_status ffi_prep_cif_var(ffi_cif *cif, -+FFI_EXTERN ffi_status ffi_prep_cif_var(ffi_cif *cif, - ffi_abi abi, - unsigned int nfixedargs, - unsigned int ntotalargs, - ffi_type *rtype, - ffi_type **atypes); - --void ffi_call(ffi_cif *cif, -+FFI_EXTERN void ffi_call(ffi_cif *cif, - void (*fn)(void), - void *rvalue, - void **avalue); diff --git a/recipes/libffi/all/patches/0002-3.2.1-fix-libtool-path.patch b/recipes/libffi/all/patches/0002-3.2.1-fix-libtool-path.patch deleted file mode 100644 index a09551d110a1e..0000000000000 --- a/recipes/libffi/all/patches/0002-3.2.1-fix-libtool-path.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- configure -+++ configure -@@ -8796,7 +8796,7 @@ - LIBTOOL_DEPS="$ltmain" - - # Always use our own libtool. --LIBTOOL='$(SHELL) $(top_builddir)/libtool' -+LIBTOOL='$(SHELL) $(top_builddir)/libtool.sh' - - - -@@ -8889,7 +8889,7 @@ - esac - - # Global variables: --ofile=libtool -+ofile=libtool.sh - can_build_shared=yes - - # All known linkers require a `.a' archive for static linking (except MSVC, diff --git a/recipes/libffi/all/patches/0002-3.4.3-fix-libtool-path.patch b/recipes/libffi/all/patches/0002-3.4.3-fix-libtool-path.patch new file mode 100644 index 0000000000000..f7d0c10680b69 --- /dev/null +++ b/recipes/libffi/all/patches/0002-3.4.3-fix-libtool-path.patch @@ -0,0 +1,20 @@ +--- configure ++++ configure +@@ -9940,7 +9940,7 @@ + LIBTOOL_DEPS=$ltmain + + # Always use our own libtool. +-LIBTOOL='$(SHELL) $(top_builddir)/libtool' ++LIBTOOL='$(SHELL) $(top_builddir)/libtool.sh' + + + +@@ -10032,7 +10032,7 @@ + esac + + # Global variables: +-ofile=libtool ++ofile=libtool.sh + can_build_shared=yes + + # All known linkers require a '.a' archive for static linking (except MSVC and diff --git a/recipes/libffi/all/patches/0003-3.2.1-fix-win64-assembly.patch b/recipes/libffi/all/patches/0003-3.2.1-fix-win64-assembly.patch deleted file mode 100644 index 622ab2065a477..0000000000000 --- a/recipes/libffi/all/patches/0003-3.2.1-fix-win64-assembly.patch +++ /dev/null @@ -1,92 +0,0 @@ ---- src/x86/win64.S -+++ src/x86/win64.S -@@ -170,7 +170,7 @@ - mov rcx, QWORD PTR RVALUE[rbp] - movzx rax, ax - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_sint16$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT16 -@@ -179,7 +179,7 @@ - mov rcx, QWORD PTR RVALUE[rbp] - movsx rax, ax - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_uint32$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT32 -@@ -188,7 +188,7 @@ - mov rcx, QWORD PTR RVALUE[rbp] - mov eax, eax - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_sint32$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT32 -@@ -197,7 +197,7 @@ - mov rcx, QWORD PTR RVALUE[rbp] - cdqe - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_float$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_FLOAT -@@ -205,7 +205,7 @@ - - mov rax, QWORD PTR RVALUE[rbp] - movss DWORD PTR [rax], xmm0 -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_double$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_DOUBLE -@@ -213,7 +213,7 @@ - - mov rax, QWORD PTR RVALUE[rbp] - movlpd QWORD PTR [rax], xmm0 -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_uint64$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT64 -@@ -221,7 +221,7 @@ - - mov rcx, QWORD PTR RVALUE[rbp] - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_sint64$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT64 -@@ -229,7 +229,7 @@ - - mov rcx, QWORD PTR RVALUE[rbp] - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_pointer$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_POINTER -@@ -237,7 +237,7 @@ - - mov rcx, QWORD PTR RVALUE[rbp] - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_int$: - cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_INT -@@ -246,7 +246,7 @@ - mov rcx, QWORD PTR RVALUE[rbp] - cdqe - mov QWORD PTR [rcx], rax -- jmp SHORT ret_void$ -+ jmp ret_void$ - - ret_void$: - xor rax, rax diff --git a/recipes/libffi/all/patches/0004-3.2.1-fix-complex-type-msvc.patch b/recipes/libffi/all/patches/0004-3.2.1-fix-complex-type-msvc.patch deleted file mode 100644 index 2b35695041bac..0000000000000 --- a/recipes/libffi/all/patches/0004-3.2.1-fix-complex-type-msvc.patch +++ /dev/null @@ -1,55 +0,0 @@ ---- src/types.c -+++ src/types.c -@@ -31,6 +31,8 @@ - #include - #include - -+#include -+ - /* Type definitions */ - - #define FFI_TYPEDEF(name, type, id, maybe_const)\ -@@ -44,16 +46,16 @@ - id, NULL \ - } - --#define FFI_COMPLEX_TYPEDEF(name, type, maybe_const) \ -+#define FFI_COMPLEX_TYPEDEF(name, complex_type, maybe_const) \ - static ffi_type *ffi_elements_complex_##name [2] = { \ - (ffi_type *)(&ffi_type_##name), NULL \ - }; \ - struct struct_align_complex_##name { \ - char c; \ -- _Complex type x; \ -+ complex_type x; \ - }; \ - maybe_const ffi_type ffi_type_complex_##name = { \ -- sizeof(_Complex type), \ -+ sizeof(complex_type), \ - offsetof(struct struct_align_complex_##name, x), \ - FFI_TYPE_COMPLEX, \ - (ffi_type **)ffi_elements_complex_##name \ -@@ -97,10 +99,20 @@ - FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE, FFI_LDBL_CONST); - #endif - -+#ifdef _MSC_VER -+# define FLOAT_COMPLEX _C_float_complex -+# define DOUBLE_COMPLEX _C_double_complex -+# define LDOUBLE_COMPLEX _C_ldouble_complex -+#else -+# define FLOAT_COMPLEX float _Complex -+# define DOUBLE_COMPLEX double _Complex -+# define LDOUBLE_COMPLEX long double _Complex -+#endif -+ - #ifdef FFI_TARGET_HAS_COMPLEX_TYPE --FFI_COMPLEX_TYPEDEF(float, float, const); --FFI_COMPLEX_TYPEDEF(double, double, const); -+FFI_COMPLEX_TYPEDEF(float, FLOAT_COMPLEX, const); -+FFI_COMPLEX_TYPEDEF(double, DOUBLE_COMPLEX, const); - #if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE --FFI_COMPLEX_TYPEDEF(longdouble, long double, FFI_LDBL_CONST); -+FFI_COMPLEX_TYPEDEF(longdouble, LDOUBLE_COMPLEX, FFI_LDBL_CONST); - #endif - #endif diff --git a/recipes/libffi/all/patches/0005-3.2.1-do-not-install-libraries-to-arch-dependent-directories.patch b/recipes/libffi/all/patches/0005-3.2.1-do-not-install-libraries-to-arch-dependent-directories.patch deleted file mode 100644 index 4abeffb876872..0000000000000 --- a/recipes/libffi/all/patches/0005-3.2.1-do-not-install-libraries-to-arch-dependent-directories.patch +++ /dev/null @@ -1,32 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -600,7 +600,7 @@ - target_os = @target_os@ - target_vendor = @target_vendor@ - toolexecdir = @toolexecdir@ --toolexeclibdir = @toolexeclibdir@ -+toolexeclibdir = @libdir@ - top_build_prefix = @top_build_prefix@ - top_builddir = @top_builddir@ - top_srcdir = @top_srcdir@ - ---- include/Makefile.in -+++ include/Makefile.in -@@ -307,15 +307,15 @@ - target_os = @target_os@ - target_vendor = @target_vendor@ - toolexecdir = @toolexecdir@ --toolexeclibdir = @toolexeclibdir@ -+toolexeclibdir = @libdir@ - top_build_prefix = @top_build_prefix@ - top_builddir = @top_builddir@ - top_srcdir = @top_srcdir@ - AUTOMAKE_OPTIONS = foreign - DISTCLEANFILES = ffitarget.h - EXTRA_DIST = ffi.h.in ffi_common.h --includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include -+includesdir = @includedir@ - nodist_includes_HEADERS = ffi.h ffitarget.h - all: all-am - - .SUFFIXES: diff --git a/recipes/libffi/all/patches/0005-3.4.3-do-not-install-libraries-to-arch-dependent-directories.patch b/recipes/libffi/all/patches/0005-3.4.3-do-not-install-libraries-to-arch-dependent-directories.patch new file mode 100644 index 0000000000000..e82abf24a4fb1 --- /dev/null +++ b/recipes/libffi/all/patches/0005-3.4.3-do-not-install-libraries-to-arch-dependent-directories.patch @@ -0,0 +1,11 @@ +--- Makefile.in ++++ Makefile.in +@@ -520,7 +520,7 @@ + target_vendor = @target_vendor@ + tmake_file = @tmake_file@ + toolexecdir = @toolexecdir@ +-toolexeclibdir = @toolexeclibdir@ ++toolexeclibdir = @libdir@ + top_build_prefix = @top_build_prefix@ + top_builddir = @top_builddir@ + top_srcdir = @top_srcdir@ diff --git a/recipes/libffi/all/patches/0006-3.2.1-library-no-version-suffix.patch b/recipes/libffi/all/patches/0006-3.2.1-library-no-version-suffix.patch deleted file mode 100644 index 915977c19a4ff..0000000000000 --- a/recipes/libffi/all/patches/0006-3.2.1-library-no-version-suffix.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- Makefile.in -+++ Makefile.in -@@ -723,7 +723,7 @@ - nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) - LTLDFLAGS = $(shell $(SHELL) $(top_srcdir)/libtool-ldflags $(LDFLAGS)) - AM_CFLAGS = $(am__append_41) --libffi_la_LDFLAGS = -no-undefined -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) -+libffi_la_LDFLAGS = -no-undefined -avoid-version $(LTLDFLAGS) $(AM_LTLDFLAGS) - AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src - AM_CCASFLAGS = $(AM_CPPFLAGS) - all: fficonfig.h diff --git a/recipes/libffi/all/patches/0006-3.4.3-library-no-version-suffix.patch b/recipes/libffi/all/patches/0006-3.4.3-library-no-version-suffix.patch new file mode 100644 index 0000000000000..0ad4d29b1c4ce --- /dev/null +++ b/recipes/libffi/all/patches/0006-3.4.3-library-no-version-suffix.patch @@ -0,0 +1,11 @@ +--- Makefile.in ++++ Makefile.in +@@ -615,7 +615,7 @@ + @LIBFFI_BUILD_VERSIONED_SHLIB_FALSE@libffi_version_dep = + @LIBFFI_BUILD_VERSIONED_SHLIB_GNU_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map + @LIBFFI_BUILD_VERSIONED_SHLIB_SUN_TRUE@@LIBFFI_BUILD_VERSIONED_SHLIB_TRUE@libffi_version_dep = libffi.map-sun +-libffi_version_info = -version-info `grep -v '^\#' $(srcdir)/libtool-version` ++libffi_version_info = -avoid-version + libffi_la_LDFLAGS = -no-undefined $(libffi_version_info) $(libffi_version_script) $(LTLDFLAGS) $(AM_LTLDFLAGS) + libffi_la_DEPENDENCIES = $(libffi_la_LIBADD) $(libffi_version_dep) + AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src diff --git a/recipes/libffi/all/test_package/CMakeLists.txt b/recipes/libffi/all/test_package/CMakeLists.txt index abdb4e55993d7..80fe7087b6f9f 100644 --- a/recipes/libffi/all/test_package/CMakeLists.txt +++ b/recipes/libffi/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() -if(CONAN_SETTINGS_COMPILER_RUNTIME MATCHES ".*d") - add_compile_definitions(DISABLE_FFI_CALL) -endif() +project(test_package LANGUAGES C) + +find_package(libffi REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libffi::libffi) diff --git a/recipes/libffi/all/test_package/conanfile.py b/recipes/libffi/all/test_package/conanfile.py index d4128b0450777..2d636399fa711 100644 --- a/recipes/libffi/all/test_package/conanfile.py +++ b/recipes/libffi/all/test_package/conanfile.py @@ -1,10 +1,30 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain +from conan.tools.env import VirtualRunEnv +from conan.tools.microsoft import msvc_runtime_flag import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + cmake_deps = CMakeDeps(self) + cmake_deps.generate() + tc = CMakeToolchain(self) + if "d" in msvc_runtime_flag(self): + tc.preprocessor_definitions["DISABLE_FFI_CALL"] = 1 + tc.generate() + virtual_run_env = VirtualRunEnv(self) + virtual_run_env.generate() def build(self): cmake = CMake(self) @@ -12,6 +32,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libffi/all/test_v1_package/CMakeLists.txt b/recipes/libffi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..5b6f863b5bbc1 --- /dev/null +++ b/recipes/libffi/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup() +if(CONAN_SETTINGS_COMPILER_RUNTIME MATCHES ".*d") + add_compile_definitions(DISABLE_FFI_CALL) +endif() + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/libstudxml/all/test_package/conanfile.py b/recipes/libffi/all/test_v1_package/conanfile.py similarity index 100% rename from recipes/libstudxml/all/test_package/conanfile.py rename to recipes/libffi/all/test_v1_package/conanfile.py diff --git a/recipes/libffi/config.yml b/recipes/libffi/config.yml index c745eb3efbca6..7f562b85ed6ac 100644 --- a/recipes/libffi/config.yml +++ b/recipes/libffi/config.yml @@ -1,7 +1,7 @@ versions: + "3.4.3": + folder: "all" "3.4.2": folder: "all" "3.3": folder: "all" - "3.2.1": - folder: "all" diff --git a/recipes/libftdi/1.x/CMakeLists.txt b/recipes/libftdi/1.x/CMakeLists.txt deleted file mode 100644 index f4e5078f42228..0000000000000 --- a/recipes/libftdi/1.x/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) -add_subdirectory(source_subfolder) diff --git a/recipes/libftdi/1.x/conandata.yml b/recipes/libftdi/1.x/conandata.yml index db04076175670..3548dde53d918 100644 --- a/recipes/libftdi/1.x/conandata.yml +++ b/recipes/libftdi/1.x/conandata.yml @@ -5,5 +5,5 @@ sources: patches: "1.5": - patch_file: "patches/0001-cmake-targets.patch" - base_path: "source_subfolder" - + patch_description: "Fix cmake targets and call project after cmake_minimum_required." + patch_type: "conan" diff --git a/recipes/libftdi/1.x/conanfile.py b/recipes/libftdi/1.x/conanfile.py index 951dbaa4f8b8a..16c0bb3e46d34 100644 --- a/recipes/libftdi/1.x/conanfile.py +++ b/recipes/libftdi/1.x/conanfile.py @@ -1,103 +1,111 @@ import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, rmdir, export_conandata_patches +from conan.tools.files import apply_conandata_patches, copy +from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration +required_conan_version = ">=1.53.0" class LibFtdiConan(ConanFile): name = "libftdi" description = "A library to talk to FTDI chips" license = "LGPL-2.0-only", "GPLv2-or-later" - topics = ("conan", "libftdi1") + topics = "ftdi" homepage = "https://www.intra2net.com/en/developer/libftdi/" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake", "cmake_find_package", "pkg_config" settings = "os", "arch", "compiler", "build_type" options = { - "shared" : [True, False], + "shared" : [True, False], "fPIC" : [True, False], "enable_cpp_wrapper" : [True, False], "build_eeprom_tool" : [True, False], "use_streaming" : [True, False], } default_options = { - "shared": False, + "shared": False, "fPIC": True, "enable_cpp_wrapper": True, "build_eeprom_tool" : False, "use_streaming" : True, } - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "libftdi1-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + strip_root=True) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.options.use_streaming = False + def layout(self): + cmake_layout(self, src_folder="src") + def configure(self): if self.options.shared: - del self.options.fPIC - - def _configure_cmake(self): - if self._cmake: - return self._cmake + self.options.rm_safe("fPIC") + self.license = ("LGPL-2.1-only", "GPL-2.0-only") if self.options.build_eeprom_tool or self.options.enable_cpp_wrapper else ("LGPL-2.1-only") - self._cmake = CMake(self) - options = { - "BUILD_TESTS": False, - "EXAMPLES": False, - "FTDI_EEPROM": self.options.build_eeprom_tool, - "FTDIPP" : self.options.enable_cpp_wrapper, - "STATICLIBS": not self.options.shared, - "ENABLE_STREAMING": self.options.use_streaming, - } - self._cmake.definitions.update(options) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + tc.variables["EXAMPLES"] = False + tc.variables["FTDI_EEPROM"] = self.options.build_eeprom_tool + tc.variables["FTDIPP"] = self.options.enable_cpp_wrapper + tc.variables["ENABLE_STREAMING"] = self.options.use_streaming + tc.variables["LIB_SUFFIX"] = "" + tc.generate() + tc = CMakeDeps(self) + tc.generate() def requirements(self): - self.requires("libusb/1.0.24") - self.requires("boost/1.75.0") + self.requires("libusb/1.0.26") + if self.options.enable_cpp_wrapper: + self.requires("boost/1.80.0") def validate(self): - if self.settings.compiler == "Visual Studio" and self.options.use_streaming: + if is_msvc(self) and self.options.use_streaming: raise ConanInvalidConfiguration("VS doesn't not compile with enabled option use_streaming") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING.LIB", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + if self.options.build_eeprom_tool or self.options.enable_cpp_wrapper: + copy(self, "COPYING.GPL", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - lib_folder = os.path.join(self.package_folder, "lib",) - tools.rmdir(os.path.join(lib_folder, "cmake")) - tools.rmdir(os.path.join(lib_folder, "pkgconfig")) + lib_folder = os.path.join(self.package_folder, "lib") + rmdir(self, os.path.join(lib_folder, "cmake")) + rmdir(self, os.path.join(lib_folder, "pkgconfig")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "LibFTDI1" - self.cpp_info.names["cmake_find_package_multi"] = "LibFTDI1" - self.cpp_info.names["pkgconfig"] = "libftdi1" + # Remove "self.cpp_info.filenames.." statements in Conan V2 + self.cpp_info.filenames['cmake_find_package'] = "LibFTDI1" + self.cpp_info.filenames['cmake_find_package_multi'] = "LibFTDI1" - self.cpp_info.components["ftdi"].names["pkg_config"] = "libftdi1" + self.cpp_info.set_property("cmake_file_name", "LibFTDI1") + self.cpp_info.components["ftdi"].set_property("pkg_config_name", "libftdi1") self.cpp_info.components["ftdi"].libs = ["ftdi1"] self.cpp_info.components["ftdi"].requires = ["libusb::libusb"] self.cpp_info.components["ftdi"].includedirs.append(os.path.join("include", "libftdi1")) + self.cpp_info.components["ftdi"].names["pkg_config"] = "libftdi1" - self.cpp_info.components["ftdipp"].names["pkg_config"] = "libftdi1pp" - self.cpp_info.components["ftdipp"].libs = ["ftdipp1"] - self.cpp_info.components["ftdipp"].requires = ["ftdi", "boost::headers"] - self.cpp_info.components["ftdipp"].includedirs.append(os.path.join("include", "libftdipp1")) + if self.options.enable_cpp_wrapper: + self.cpp_info.components["ftdipp"].set_property("pkg_config_name", "libftdipp1") + self.cpp_info.components["ftdipp"].libs = ["ftdipp1"] + self.cpp_info.components["ftdipp"].requires = ["ftdi", "boost::headers"] + self.cpp_info.components["ftdipp"].names["pkg_config"] = "libftdipp1" + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["ftdipp"].system_libs.append("m") diff --git a/recipes/libftdi/1.x/patches/0001-cmake-targets.patch b/recipes/libftdi/1.x/patches/0001-cmake-targets.patch index 751ff4099d9f0..9ca28ffd1fc5e 100644 --- a/recipes/libftdi/1.x/patches/0001-cmake-targets.patch +++ b/recipes/libftdi/1.x/patches/0001-cmake-targets.patch @@ -4,7 +4,9 @@ index 5aecafc..abb133f 100644 +++ b/CMakeLists.txt @@ -1,36 +1,54 @@ -# Project - project(libftdi1 C) +-project(libftdi1 C) ++cmake_minimum_required(VERSION 3.15 FATAL_ERROR) ++project(libftdi1) + set(MAJOR_VERSION 1) set(MINOR_VERSION 5) @@ -21,7 +23,6 @@ index 5aecafc..abb133f 100644 set(CMAKE_COLOR_MAKEFILE ON) -cmake_minimum_required(VERSION 2.6 FATAL_ERROR) + -+cmake_minimum_required(VERSION 3.0 FATAL_ERROR) +if(POLICY CMP0057) + cmake_policy(SET CMP0057 NEW) +endif() diff --git a/recipes/libftdi/1.x/test_package/CMakeLists.txt b/recipes/libftdi/1.x/test_package/CMakeLists.txt index 9664d7d8fd845..efdfd6bd92c12 100644 --- a/recipes/libftdi/1.x/test_package/CMakeLists.txt +++ b/recipes/libftdi/1.x/test_package/CMakeLists.txt @@ -1,13 +1,11 @@ -cmake_minimum_required(VERSION 3.10) +cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() find_package(LibFTDI1 REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(test_package - PRIVATE LibFTDI1::ftdipp) +target_link_libraries(${PROJECT_NAME} + PRIVATE libftdi::ftdipp) diff --git a/recipes/libftdi/1.x/test_package/conanfile.py b/recipes/libftdi/1.x/test_package/conanfile.py index b64dc73188853..39f848c25cab4 100644 --- a/recipes/libftdi/1.x/test_package/conanfile.py +++ b/recipes/libftdi/1.x/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libftdi/1.x/test_v1_package/CMakeLists.txt b/recipes/libftdi/1.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..eb26d0c1b0943 --- /dev/null +++ b/recipes/libftdi/1.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package) + + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) + diff --git a/recipes/libftdi/1.x/test_v1_package/conanfile.py b/recipes/libftdi/1.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..90c431a11ee68 --- /dev/null +++ b/recipes/libftdi/1.x/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libfuse/2.x.x/conanfile.py b/recipes/libfuse/2.x.x/conanfile.py index ed76dcad2ac58..9859979728600 100644 --- a/recipes/libfuse/2.x.x/conanfile.py +++ b/recipes/libfuse/2.x.x/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" + class LibfuseConan(ConanFile): name = "libfuse" @@ -20,59 +24,51 @@ class LibfuseConan(ConanFile): "shared": False, "fPIC": True, } - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - def validate(self): - if self.settings.os not in ("Linux", "FreeBSD"): - raise ConanInvalidConfiguration("libfuse supports only Linux and FreeBSD") def configure(self): if self.options.shared: del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if self.info.settings.os not in ("Linux", "FreeBSD"): + raise ConanInvalidConfiguration("libfuse supports only Linux and FreeBSD") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ "--enable-lib", "--disable-util", - ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + ]) + tc.generate() def build(self): - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("COPYING*", dst="licenses", src=self._source_subfolder) - autotools = self._configure_autotools() + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) autotools.install() - tools.remove_files_by_mask(self.package_folder, "*.la") + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) # remove ulockmgr stuff lib and header file - tools.remove_files_by_mask(self.package_folder, "*ulockmgr*") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - + rm(self, "*ulockmgr*", self.package_folder, recursive=True) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "fuse") self.cpp_info.libs = ["fuse"] self.cpp_info.includedirs = [os.path.join("include", "fuse")] - self.cpp_info.names["pkg_config"] = "fuse" self.cpp_info.system_libs = ["pthread"] # libfuse requires this define to compile successfully self.cpp_info.defines = ["_FILE_OFFSET_BITS=64"] diff --git a/recipes/libfuse/2.x.x/test_package/CMakeLists.txt b/recipes/libfuse/2.x.x/test_package/CMakeLists.txt index ad120ae7c5ff1..701d331873021 100644 --- a/recipes/libfuse/2.x.x/test_package/CMakeLists.txt +++ b/recipes/libfuse/2.x.x/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(libfuse REQUIRED CONFIG) -find_package(libfuse REQUIRED) - -add_executable(${CMAKE_PROJECT_NAME} test_package.c) -target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libfuse::libfuse) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libfuse::libfuse) target_compile_definitions(${PROJECT_NAME} PRIVATE FUSE_USE_VERSION=29) diff --git a/recipes/libfuse/2.x.x/test_package/conanfile.py b/recipes/libfuse/2.x.x/test_package/conanfile.py index 0156618e96bf6..0a6bc68712d90 100644 --- a/recipes/libfuse/2.x.x/test_package/conanfile.py +++ b/recipes/libfuse/2.x.x/test_package/conanfile.py @@ -1,12 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -required_conan_version = ">=1.33.0" - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -14,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libfuse/2.x.x/test_v1_package/CMakeLists.txt b/recipes/libfuse/2.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libfuse/2.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libfuse/2.x.x/test_v1_package/conanfile.py b/recipes/libfuse/2.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libfuse/2.x.x/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libfuse/all/conanfile.py b/recipes/libfuse/all/conanfile.py index 731888583b51a..d9c14cd333993 100644 --- a/recipes/libfuse/all/conanfile.py +++ b/recipes/libfuse/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, tools, Meson -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rmdir +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" + class LibfuseConan(ConanFile): name = "libfuse" @@ -20,60 +25,52 @@ class LibfuseConan(ConanFile): "shared": False, "fPIC": True, } - generators = "pkg_config" - - _meson = None - @property - def _build_subfolder(self): - return "build_subfolder" + def configure(self): + if self.options.shared: + del self.options.fPIC + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.settings.os not in ("Linux", "FreeBSD"): + if self.info.settings.os not in ("Linux", "FreeBSD"): raise ConanInvalidConfiguration("libfuse supports only Linux and FreeBSD") - def configure(self): - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - def build_requirements(self): - self.build_requires("pkgconf/1.7.4") - self.build_requires("meson/0.59.2") + self.tool_requires("meson/0.64.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_meson(self): - if self._meson: - return self._meson - self._meson = Meson(self) - self._meson.options["examples"] = False - self._meson.options["utils"] = False - self._meson.options["tests"] = False - self._meson.options["useroot"] = False - self._meson.configure(source_folder=self._source_subfolder, build_folder=self._build_subfolder) - return self._meson + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) + tc.project_options["examples"] = False + tc.project_options["utils"] = False + tc.project_options["tests"] = False + tc.project_options["useroot"] = False + tc.generate() def build(self): - meson = self._configure_meson() + meson = Meson(self) + meson.configure() meson.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + meson = Meson(self) meson.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "fuse3") self.cpp_info.libs = ["fuse3"] self.cpp_info.includedirs = [os.path.join("include", "fuse3")] - self.cpp_info.names["pkg_config"] = "fuse3" self.cpp_info.system_libs = ["pthread"] if self.settings.os == "Linux": self.cpp_info.system_libs.extend(["dl", "rt"]) diff --git a/recipes/libfuse/all/test_package/CMakeLists.txt b/recipes/libfuse/all/test_package/CMakeLists.txt index aa2284254f956..c8bc174f2164d 100644 --- a/recipes/libfuse/all/test_package/CMakeLists.txt +++ b/recipes/libfuse/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(libfuse REQUIRED CONFIG) -find_package(libfuse REQUIRED) - -add_executable(${CMAKE_PROJECT_NAME} test_package.c) -target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libfuse::libfuse) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libfuse::libfuse) target_compile_definitions(${PROJECT_NAME} PRIVATE FUSE_USE_VERSION=34) diff --git a/recipes/libfuse/all/test_package/conanfile.py b/recipes/libfuse/all/test_package/conanfile.py index 0156618e96bf6..0a6bc68712d90 100644 --- a/recipes/libfuse/all/test_package/conanfile.py +++ b/recipes/libfuse/all/test_package/conanfile.py @@ -1,12 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -required_conan_version = ">=1.33.0" - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -14,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libfuse/all/test_v1_package/CMakeLists.txt b/recipes/libfuse/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libfuse/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libfuse/all/test_v1_package/conanfile.py b/recipes/libfuse/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libfuse/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libgcrypt/all/conanfile.py b/recipes/libgcrypt/all/conanfile.py index e758bd35a6027..7ebc509dad85e 100644 --- a/recipes/libgcrypt/all/conanfile.py +++ b/recipes/libgcrypt/all/conanfile.py @@ -1,15 +1,21 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.env import VirtualRunEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout import os -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" + class LibgcryptConan(ConanFile): name = "libgcrypt" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.gnupg.org/download/index.html#libgcrypt" description = "Libgcrypt is a general purpose cryptographic library originally based on code from GnuPG" - topics = ("libgcrypt", "gcrypt", "gnupg", "gpg", "crypto", "cryptography") + topics = ("gcrypt", "gnupg", "gpg", "crypto", "cryptography") license = "LGPL-2.1-or-later" settings = "os", "arch", "compiler", "build_type" options = { @@ -21,63 +27,58 @@ class LibgcryptConan(ConanFile): "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd if self.options.shared: del self.options.fPIC + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("libcap/2.65") + self.requires("libgpg-error/1.36") def validate(self): - if self.settings.os != "Linux": + if self.info.settings.os != "Linux": raise ConanInvalidConfiguration("This recipe only support Linux. You can contribute Windows and/or Macos support.") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def requirements(self): - self.requires("libgpg-error/1.36") - self.requires("libcap/2.50") + def generate(self): + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") - def _configure(self): - if self._autotools: - return self._autotools - args = ["--disable-doc"] - args.append("--with-libgpg-error-prefix={}".format(self.deps_cpp_info["libgpg-error"].rootpath)) - if self.options.get_safe("fPIC", True): - args.append("--with-pic") - if self.options.shared: - args.extend(["--disable-static", "--enable-shared"]) - else: - args.extend(["--disable-shared", "--enable-static"]) + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + "--disable-doc", + f"--with-libgpg-error-prefix={self.dependencies['libgpg-error'].package_folder}", + ]) + tc.generate() - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + deps = AutotoolsDeps(self) + deps.generate() def build(self): - env_build = self._configure() - env_build.make() + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - env_build = self._configure() - env_build.install() - self.copy(pattern="COPYING*", dst="licenses", src=self._source_subfolder) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rm(self, "*la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libs = ["gcrypt"] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var with : {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - self.cpp_info.names["pkg_config"] = "gcrypt" if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] + + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/libgcrypt/all/test_package/CMakeLists.txt b/recipes/libgcrypt/all/test_package/CMakeLists.txt index db0b2fa444a2f..1a3fbb3bbed04 100644 --- a/recipes/libgcrypt/all/test_package/CMakeLists.txt +++ b/recipes/libgcrypt/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -find_library(CAP_LIBRARY NAMES libcap.a libcap.so) +find_package(libgcrypt REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libgcrypt::libgcrypt) diff --git a/recipes/libgcrypt/all/test_package/conanfile.py b/recipes/libgcrypt/all/test_package/conanfile.py index fc4fe1905b49a..0a6bc68712d90 100644 --- a/recipes/libgcrypt/all/test_package/conanfile.py +++ b/recipes/libgcrypt/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libgcrypt/all/test_v1_package/CMakeLists.txt b/recipes/libgcrypt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libgcrypt/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libgcrypt/all/test_v1_package/conanfile.py b/recipes/libgcrypt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libgcrypt/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libgd/all/CMakeLists.txt b/recipes/libgd/all/CMakeLists.txt deleted file mode 100644 index 088ba36390ce8..0000000000000 --- a/recipes/libgd/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -set(CMAKE_C_STANDARD 99) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libgd/all/conandata.yml b/recipes/libgd/all/conandata.yml index 775ee73a32dbb..e4acad43d15b2 100644 --- a/recipes/libgd/all/conandata.yml +++ b/recipes/libgd/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.3": + url: "https://github.com/libgd/libgd/archive/gd-2.3.3.tar.gz" + sha256: "24429f9d0dbe0f865aaa4b1a63558242396ba9134e6cfd32ca5e486a84483350" "2.3.2": url: "https://github.com/libgd/libgd/archive/gd-2.3.2.tar.gz" sha256: "dcc22244d775f469bee21dce1ea42552adbb72ba0cc423f9fa6a64601b3a1893" @@ -12,29 +15,47 @@ sources: url: "https://github.com/libgd/libgd/releases/download/gd-2.2.5/libgd-2.2.5.tar.gz" sha256: "a66111c9b4a04e818e9e2a37d7ae8d4aae0939a100a36b0ffb52c706a09074b5" patches: + "2.3.3": + - patch_file: "patches/2.3.3-qualify-nondll.patch" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "portability" + - patch_file: "patches/2.3.x-png-msvc.patch" + patch_description: "support png on msvc" + patch_type: "portability" "2.3.2": - patch_file: "patches/remove-unistd-h.patch" - base_path: "source_subfolder" + patch_description: "remove unistd.h to fix build error" + patch_type: "portability" - patch_file: "patches/2.3.2-qualify-nondll.patch" - base_path: "source_subfolder" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "portability" - patch_file: "patches/2.3.x-png-msvc.patch" - base_path: "source_subfolder" + patch_description: "support png on msvc" + patch_type: "portability" "2.3.1": - patch_file: "patches/remove-unistd-h.patch" - base_path: "source_subfolder" + patch_description: "remove unistd.h to fix build error" + patch_type: "portability" - patch_file: "patches/qualify-nondll.patch" - base_path: "source_subfolder" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "portability" - patch_file: "patches/2.3.x-png-msvc.patch" - base_path: "source_subfolder" + patch_description: "support png on msvc" + patch_type: "portability" "2.3.0": - patch_file: "patches/remove-unistd-h.patch" - base_path: "source_subfolder" + patch_description: "remove unistd.h to fix build error" + patch_type: "portability" - patch_file: "patches/qualify-nondll.patch" - base_path: "source_subfolder" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "portability" - patch_file: "patches/2.3.x-png-msvc.patch" - base_path: "source_subfolder" + patch_description: "support png on msvc" + patch_type: "conan" "2.2.5": - patch_file: "patches/2.2.5-msvc-static-lib.patch" - base_path: "source_subfolder" + patch_description: "support static build on msvc" + patch_type: "conan" - patch_file: "patches/2.2.5-qualify-nondll.patch" - base_path: "source_subfolder" + patch_description: "use BGD_NONDLL instead NONDLL" + patch_type: "conan" diff --git a/recipes/libgd/all/conanfile.py b/recipes/libgd/all/conanfile.py index b26dbdb4a3014..169f9e3ba1f8c 100644 --- a/recipes/libgd/all/conanfile.py +++ b/recipes/libgd/all/conanfile.py @@ -1,21 +1,20 @@ from conan import ConanFile from conan.tools.microsoft import is_msvc -from conans import CMake -from conan.tools.files import get, patch, replace_in_file, rmdir, collect_libs +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, replace_in_file from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.47.0" - +required_conan_version = ">=1.53.0" class LibgdConan(ConanFile): name = "libgd" + description = ("GD is an open source code library for the dynamic" + "creation of images by programmers.") license = "BSD-like" url = "https://github.com/conan-io/conan-center-index" - description = ("GD is an open source code library for the dynamic " - "creation of images by programmers.") - topics = ("images", "graphics") homepage = "https://libgd.github.io" + topics = ("images", "graphics") settings = "os", "arch", "compiler", "build_type" options = { @@ -35,17 +34,8 @@ class LibgdConan(ConanFile): "with_freetype": False, } - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,77 +43,87 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if is_msvc(self): self.requires("getopt-for-visual-studio/20200201") if self.options.with_jpeg: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") if self.options.with_tiff: self.requires("libtiff/4.4.0") if self.options.with_freetype: self.requires("freetype/2.12.1") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_C_STANDARD"] = "99" + tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared + if Version(self.version) >= "2.3.0": + tc.variables["ENABLE_GD_FORMATS"] = True + tc.variables["ENABLE_PNG"] = self.options.with_png + tc.variables["ENABLE_LIQ"] = False + tc.variables["ENABLE_JPEG"] = self.options.with_jpeg + tc.variables["ENABLE_TIFF"] = self.options.with_tiff + tc.variables["ENABLE_ICONV"] = False + tc.variables["ENABLE_XPM"] = False + tc.variables["ENABLE_FREETYPE"] = self.options.with_freetype + tc.variables["ENABLE_FONTCONFIG"] = False + tc.variables["ENABLE_WEBP"] = False + if Version(self.version) >= "2.3.2": + tc.variables["ENABLE_HEIF"] = False + tc.variables["ENABLE_AVIF"] = False + if Version(self.version) >= "2.3.0": + tc.variables["ENABLE_RAQM"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch(self): - for patch_file in self.conan_data.get("patches", {}).get(self.version, []): - patch(self, **patch_file) - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") + apply_conandata_patches(self) + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") replace_in_file(self, cmakelists, "${CMAKE_SOURCE_DIR}", "${CMAKE_CURRENT_SOURCE_DIR}") replace_in_file(self, cmakelists, "SET(CMAKE_MODULE_PATH \"${GD_SOURCE_DIR}/cmake/modules\")", "LIST(APPEND CMAKE_MODULE_PATH \"${GD_SOURCE_DIR}/cmake/modules\")") - replace_in_file(self, os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "RUNTIME DESTINATION bin", "RUNTIME DESTINATION bin BUNDLE DESTINATION bin") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_STATIC_LIBS"] = not self.options.shared - if Version(self.version) >= "2.3.0": - self._cmake.definitions["ENABLE_GD_FORMATS"] = True - self._cmake.definitions["ENABLE_PNG"] = self.options.with_png - self._cmake.definitions["ENABLE_LIQ"] = False - self._cmake.definitions["ENABLE_JPEG"] = self.options.with_jpeg - self._cmake.definitions["ENABLE_TIFF"] = self.options.with_tiff - self._cmake.definitions["ENABLE_ICONV"] = False - self._cmake.definitions["ENABLE_XPM"] = False - self._cmake.definitions["ENABLE_FREETYPE"] = self.options.with_freetype - self._cmake.definitions["ENABLE_FONTCONFIG"] = False - self._cmake.definitions["ENABLE_WEBP"] = False - if Version(self.version) >= "2.3.2": - self._cmake.definitions["ENABLE_HEIF"] = False - self._cmake.definitions["ENABLE_AVIF"] = False - if Version(self.version) >= "2.3.0": - self._cmake.definitions["ENABLE_RAQM"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def build(self): self._patch() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.names["pkg_config"]= "gdlib" - self.cpp_info.libs = collect_libs(self) + prefix_libs = "lib" if self.settings.os == "Windows" else "" + suffix_libs = "_static" if self.settings.os == "Windows" and not self.options.shared else "" + self.cpp_info.libs = [f"{prefix_libs}gd{suffix_libs}"] + self.cpp_info.set_property("pkg_config_name", "gdlib") + if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.defines.append("BGD_NONDLL") self.cpp_info.defines.append("BGDWIN32") @@ -133,3 +133,6 @@ def package_info(self): bin_path = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bin_path)) self.env_info.PATH.append(bin_path) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["pkg_config"]= "gdlib" diff --git a/recipes/libgd/all/patches/2.3.3-qualify-nondll.patch b/recipes/libgd/all/patches/2.3.3-qualify-nondll.patch new file mode 100644 index 0000000000000..8dfcac14807e1 --- /dev/null +++ b/recipes/libgd/all/patches/2.3.3-qualify-nondll.patch @@ -0,0 +1,26 @@ +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index 3839bc7..3b271a8 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -86,7 +86,7 @@ if (WIN32 AND NOT MINGW AND NOT MSYS) + # SET_TARGET_PROPERTIES(${GD_LIB} PROPERTIES LINK_FLAGS "/NODEFAULTLIB:msvcrt.lib") + + if (BUILD_STATIC_LIBS) +- SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS NONDLL=1) ++ SET_PROPERTY(TARGET ${GD_LIB_STATIC} APPEND PROPERTY COMPILE_DEFINITIONS BGD_NONDLL=1) + endif() + + ENDIF(WIN32 AND NOT MINGW AND NOT MSYS) +diff --git a/src/gd.h b/src/gd.h +index 3056039..e3635ab 100644 +--- a/src/gd.h ++++ b/src/gd.h +@@ -47,7 +47,7 @@ extern "C" { + /* http://gcc.gnu.org/wiki/Visibility */ + #if defined(_WIN32) || defined(CYGWIN) || defined(_WIN32_WCE) + # ifdef BGDWIN32 +-# ifdef NONDLL ++# ifdef BGD_NONDLL + # define BGD_EXPORT_DATA_PROT + # else + # ifdef __GNUC__ diff --git a/recipes/libgd/all/test_package/CMakeLists.txt b/recipes/libgd/all/test_package/CMakeLists.txt index e4f67d2408b0a..bc37e91faebeb 100644 --- a/recipes/libgd/all/test_package/CMakeLists.txt +++ b/recipes/libgd/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(libgd CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE libgd::libgd) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/libgd/all/test_package/conanfile.py b/recipes/libgd/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/libgd/all/test_package/conanfile.py +++ b/recipes/libgd/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libgd/all/test_v1_package/CMakeLists.txt b/recipes/libgd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libgd/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libgd/all/test_v1_package/conanfile.py b/recipes/libgd/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/libgd/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libgd/config.yml b/recipes/libgd/config.yml index 73437bcaccb05..5343c7968ac52 100644 --- a/recipes/libgd/config.yml +++ b/recipes/libgd/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.3": + folder: all "2.3.2": folder: all "2.3.1": diff --git a/recipes/libgeotiff/all/CMakeLists.txt b/recipes/libgeotiff/all/CMakeLists.txt deleted file mode 100644 index 7c172c37ee83f..0000000000000 --- a/recipes/libgeotiff/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory("source_subfolder/libgeotiff") diff --git a/recipes/libgeotiff/all/conandata.yml b/recipes/libgeotiff/all/conandata.yml index 90701559cd6eb..d67cfa6fff858 100644 --- a/recipes/libgeotiff/all/conandata.yml +++ b/recipes/libgeotiff/all/conandata.yml @@ -1,26 +1,22 @@ sources: "1.7.1": - url: "https://github.com/OSGeo/libgeotiff/archive/refs/tags/1.7.1.tar.gz" - sha256: "09a0cae5352030011b994a60237743a1327ab95ce482318d45bf9fcb5e5f76b5" + url: "https://github.com/OSGeo/libgeotiff/releases/download/1.7.1/libgeotiff-1.7.1.tar.gz" + sha256: "05ab1347aaa471fc97347d8d4269ff0c00f30fa666d956baba37948ec87e55d6" "1.7.0": - url: "https://github.com/OSGeo/libgeotiff/archive/refs/tags/1.7.0.tar.gz" - sha256: "4d5a4d309f9b3032501ad85ea8b921461761a76d9881b415246770a6bddcaf54" + url: "https://github.com/OSGeo/libgeotiff/releases/download/1.7.0/libgeotiff-1.7.0.tar.gz" + sha256: "fc304d8839ca5947cfbeb63adb9d1aa47acef38fc6d6689e622926e672a99a7e" "1.6.0": - url: "https://github.com/OSGeo/libgeotiff/archive/1.6.0.tar.gz" - sha256: "312c52687b56893067b35a47442f0d5a670995bd1dddecbe0dc09d6e60fec1d7" + url: "https://github.com/OSGeo/libgeotiff/releases/download/1.6.0/libgeotiff-1.6.0.tar.gz" + sha256: "9311017e5284cffb86f2c7b7a9df1fb5ebcdc61c30468fb2e6bca36e4272ebca" "1.5.1": - url: "https://github.com/OSGeo/libgeotiff/archive/1.5.1.tar.gz" - sha256: "fb04491572afb25ffe60239fdfdcfa2c64e6cf644cad9b0b922b10115ccbd488" + url: "https://github.com/OSGeo/libgeotiff/releases/download/1.5.1/libgeotiff-1.5.1.tar.gz" + sha256: "f9e99733c170d11052f562bcd2c7cb4de53ed405f7acdde4f16195cd3ead612c" patches: "1.7.1": - patch_file: "patches/fix-cmake-1.7.1.patch" - base_path: "source_subfolder" "1.7.0": - patch_file: "patches/fix-cmake-1.6.0.patch" - base_path: "source_subfolder" "1.6.0": - patch_file: "patches/fix-cmake-1.6.0.patch" - base_path: "source_subfolder" "1.5.1": - patch_file: "patches/fix-cmake-1.5.1.patch" - base_path: "source_subfolder" diff --git a/recipes/libgeotiff/all/conanfile.py b/recipes/libgeotiff/all/conanfile.py index 4aa86a357d19f..dd7258309aa60 100644 --- a/recipes/libgeotiff/all/conanfile.py +++ b/recipes/libgeotiff/all/conanfile.py @@ -1,8 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibgeotiffConan(ConanFile): @@ -10,7 +12,7 @@ class LibgeotiffConan(ConanFile): description = "Libgeotiff is an open source library normally hosted on top " \ "of libtiff for reading, and writing GeoTIFF information tags." license = ["MIT", "BSD-3-Clause"] - topics = ("libgeotiff", "geotiff", "tiff") + topics = ("geotiff", "tiff") homepage = "https://github.com/OSGeo/libgeotiff" url = "https://github.com/conan-io/conan-center-index" @@ -24,21 +26,8 @@ class LibgeotiffConan(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -46,40 +35,41 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libtiff/4.3.0") - self.requires("proj/9.0.0") + self.requires("libtiff/4.4.0") + self.requires("proj/9.1.1") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_UTILITIES"] = False + tc.variables["WITH_TOWGS84"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["WITH_UTILITIES"] = False - self._cmake.definitions["WITH_TOWGS84"] = True - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("LICENSE", dst="licenses", src=os.path.join(self._source_subfolder, "libgeotiff")) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "doc")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "doc")) + rmdir(self, os.path.join(self.package_folder, "share")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_vars_file) ) @@ -88,12 +78,9 @@ def package(self): {"geotiff_library": "geotiff::geotiff"} ) - @staticmethod - def _create_cmake_module_variables(module_file): + def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ - if(DEFINED GeoTIFF_FOUND) - set(GEOTIFF_FOUND ${GeoTIFF_FOUND}) - endif() + set(GEOTIFF_FOUND ${GeoTIFF_FOUND}) if(DEFINED GeoTIFF_INCLUDE_DIR) set(GEOTIFF_INCLUDE_DIR ${GeoTIFF_INCLUDE_DIR}) endif() @@ -101,31 +88,26 @@ def _create_cmake_module_variables(module_file): set(GEOTIFF_LIBRARIES ${GeoTIFF_LIBRARIES}) endif() """) - tools.save(module_file, content) + save(self, module_file, content) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) - - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake") + """) + save(self, module_file, content) @property def _module_vars_file(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") @property def _module_target_file(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -139,6 +121,6 @@ def package_info(self): self.cpp_info.build_modules["cmake_find_package"] = [self._module_vars_file] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_target_file] - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/libgeotiff/all/patches/fix-cmake-1.5.1.patch b/recipes/libgeotiff/all/patches/fix-cmake-1.5.1.patch index 5d2a8ea72f189..ad58c3306c406 100644 --- a/recipes/libgeotiff/all/patches/fix-cmake-1.5.1.patch +++ b/recipes/libgeotiff/all/patches/fix-cmake-1.5.1.patch @@ -1,11 +1,18 @@ ---- a/libgeotiff/CMakeLists.txt -+++ b/libgeotiff/CMakeLists.txt -@@ -12,7 +12,7 @@ SET(GEOTIFF_LIBRARY_TARGET geotiff_library) +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,6 +5,7 @@ + # Author: Mateusz Loskot + # + ############################################################################### ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1) + PROJECT(GeoTIFF) + + SET(GEOTIFF_LIB_NAME geotiff) +@@ -12,7 +13,6 @@ SET(GEOTIFF_LIBRARY_TARGET geotiff_library) ############################################################################## # CMake settings -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) -+CMAKE_MINIMUM_REQUIRED(VERSION 3.1) SET(CMAKE_COLOR_MAKEFILE ON) diff --git a/recipes/libgeotiff/all/patches/fix-cmake-1.6.0.patch b/recipes/libgeotiff/all/patches/fix-cmake-1.6.0.patch index a092afa4a9f9b..b6dc6db8f9dce 100644 --- a/recipes/libgeotiff/all/patches/fix-cmake-1.6.0.patch +++ b/recipes/libgeotiff/all/patches/fix-cmake-1.6.0.patch @@ -1,11 +1,18 @@ ---- a/libgeotiff/CMakeLists.txt -+++ b/libgeotiff/CMakeLists.txt -@@ -12,7 +12,7 @@ SET(GEOTIFF_LIBRARY_TARGET geotiff_library) +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,6 +5,7 @@ + # Author: Mateusz Loskot + # + ############################################################################### ++CMAKE_MINIMUM_REQUIRED(VERSION 3.1) + PROJECT(GeoTIFF) + + SET(GEOTIFF_LIB_NAME geotiff) +@@ -12,7 +13,6 @@ SET(GEOTIFF_LIBRARY_TARGET geotiff_library) ############################################################################## # CMake settings -CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0) -+CMAKE_MINIMUM_REQUIRED(VERSION 3.1) SET(CMAKE_COLOR_MAKEFILE ON) diff --git a/recipes/libgeotiff/all/patches/fix-cmake-1.7.1.patch b/recipes/libgeotiff/all/patches/fix-cmake-1.7.1.patch index 14eb43b8c9d7d..4922575766992 100644 --- a/recipes/libgeotiff/all/patches/fix-cmake-1.7.1.patch +++ b/recipes/libgeotiff/all/patches/fix-cmake-1.7.1.patch @@ -1,5 +1,21 @@ ---- a/libgeotiff/CMakeLists.txt -+++ b/libgeotiff/CMakeLists.txt +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,6 +5,7 @@ + # Author: Mateusz Loskot + # + ############################################################################### ++CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0) + PROJECT(GeoTIFF) + + SET(GEOTIFF_LIB_NAME geotiff) +@@ -12,7 +13,6 @@ SET(GEOTIFF_LIBRARY_TARGET geotiff_library) + + ############################################################################## + # CMake settings +-CMAKE_MINIMUM_REQUIRED(VERSION 3.0.0) + + SET(CMAKE_COLOR_MAKEFILE ON) + @@ -88,7 +88,7 @@ IF(WIN32) ENDIF() diff --git a/recipes/libgeotiff/all/test_package/CMakeLists.txt b/recipes/libgeotiff/all/test_package/CMakeLists.txt index 111200b74c106..6f7f6667348cb 100644 --- a/recipes/libgeotiff/all/test_package/CMakeLists.txt +++ b/recipes/libgeotiff/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(geotiff REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} geotiff_library) +target_link_libraries(${PROJECT_NAME} PRIVATE geotiff_library) diff --git a/recipes/libgeotiff/all/test_package/conanfile.py b/recipes/libgeotiff/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/libgeotiff/all/test_package/conanfile.py +++ b/recipes/libgeotiff/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libgeotiff/all/test_v1_package/CMakeLists.txt b/recipes/libgeotiff/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libgeotiff/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libgeotiff/all/test_v1_package/conanfile.py b/recipes/libgeotiff/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libgeotiff/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libgettext/all/conandata.yml b/recipes/libgettext/all/conandata.yml index 86839026bb5b9..6024e755af9d8 100644 --- a/recipes/libgettext/all/conandata.yml +++ b/recipes/libgettext/all/conandata.yml @@ -3,16 +3,20 @@ sources: url: "https://ftp.gnu.org/pub/gnu/gettext/gettext-0.21.tar.gz" sha256: "c77d0da3102aec9c07f43671e60611ebff89a996ef159497ce8e59d075786b12" "0.20.1": - sha256: "66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47f5c" + sha256: "66415634c6e8c3fa8b71362879ec7575e27da43da562c798a8a2f223e6e47f5c" url: "https://ftp.gnu.org/pub/gnu/gettext/gettext-0.20.1.tar.gz" patches: "0.21": - patch_file: "patches/0002-memmove-is-intrinsic-function-on-MSVC.patch" - base_path: "source_subfolder" + patch_description: "memmove is intrinsic function on MSVC" + patch_type: "portability" "0.20.1": - patch_file: "patches/0001-build-Fix-build-errors-with-MSVC.patch" - base_path: "source_subfolder" + patch_description: "Fix build errors with MSVC" + patch_type: "portability" - patch_file: "patches/0002-memmove-is-intrinsic-function-on-MSVC.patch" - base_path: "source_subfolder" + patch_description: "memmove is intrinsic function on MSVC" + patch_type: "portability" - patch_file: "patches/0003-Reported-by-Gabor-Z.-Papp-gzp-papp.hu.patch" - base_path: "source_subfolder" + patch_description: "fix preloadable libintl for static build" + patch_type: "portability" diff --git a/recipes/libgettext/all/conanfile.py b/recipes/libgettext/all/conanfile.py index b2a6e4d5e5675..e480512d27ccf 100644 --- a/recipes/libgettext/all/conanfile.py +++ b/recipes/libgettext/all/conanfile.py @@ -1,7 +1,22 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment, tools import os -required_conan_version = ">=1.43.0" +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv, Environment +from conan.tools.files import ( + apply_conandata_patches, + copy, + export_conandata_patches, + get, + rename +) +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" class GetTextConan(ConanFile): @@ -12,54 +27,45 @@ class GetTextConan(ConanFile): homepage = "https://www.gnu.org/software/gettext" license = "GPL-3.0-or-later" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "threads": ["posix", "solaris", "pth", "windows", "disabled", "auto"], + "threads": ["posix", "solaris", "pth", "windows", "disabled"], } default_options = { "shared": False, "fPIC": True, - "threads": "auto", + # Handle default value for `threads` in `config_options` method } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _is_clang_cl(self): - return str(self.settings.compiler) in ["clang"] and str(self.settings.os) in ["Windows"] + return self.settings.os == "Windows" and self.settings.compiler == "clang" and \ + self.settings.compiler.get_safe("runtime") @property def _gettext_folder(self): return "gettext-tools" - @property - def _make_args(self): - return ["-C", "intl"] - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): - if self.settings.os == 'Windows': - del self.options.fPIC + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + self.options.threads = {"Solaris": "solaris", "Windows": "windows"}.get(str(self.settings.os), "posix") def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - if(self.options.threads == "auto"): - self.options.threads = { "Solaris": "solaris", "Windows": "windows" }.get(str(self.settings.os), "posix") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("libiconv/1.17") @@ -68,96 +74,154 @@ def requirements(self): def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - if self._is_msvc or self._is_clang_cl: - self.build_requires("automake/1.16.5") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self) or self._is_clang_cl: + self.tool_requires("automake/1.16.5") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + + if not cross_building(self): + VirtualRunEnv(self).generate(scope="build") + + tc = AutotoolsToolchain(self) + tc.configure_args += [ + "HELP2MAN=/bin/true", + "EMACS=no", + "--disable-nls", + "--disable-dependency-tracking", + "--enable-relocatable", + "--disable-c++", + "--disable-java", + "--disable-csharp", + "--disable-libasprintf", + "--disable-curses", + "--disable-threads" if self.options.threads == "disabled" else ("--enable-threads=" + str(self.options.threads)), + f"--with-libiconv-prefix={unix_path(self, self.dependencies['libiconv'].package_folder)}", + ] + if is_msvc(self) or self._is_clang_cl: + target = None + if self.settings.arch == "x86_64": + target = "x86_64-w64-mingw32" + elif self.settings.arch == "x86": + target = "i686-w64-mingw32" + + if target is not None: + tc.configure_args += [f"--host={target}", f"--build={target}"] + + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags += ["-FS"] + tc.make_args += ["-C", "intl"] + env = tc.environment() + if is_msvc(self) or self._is_clang_cl: + def programs(): + rc = None + if self.settings.arch == "x86_64": + rc = "windres --target=pe-x86-64" + elif self.settings.arch == "x86": + rc = "windres --target=pe-i386" + if self._is_clang_cl: + return os.environ.get("CC", "clang-cl"), os.environ.get("AR", "llvm-lib"), os.environ.get("LD", "lld-link"), rc + if is_msvc(self): + return "cl -nologo", "lib", "link", rc + + compile_wrapper = unix_path(self, self.conf.get("user.automake:compile-wrapper", check_type=str)) + ar_wrapper = unix_path(self, self.conf.get("user.automake:lib-wrapper", check_type=str)) + cc, ar, link, rc = programs() + env.define("CC", f"{compile_wrapper} {cc}") + env.define("CXX", f"{compile_wrapper} {cc}") + env.define("LD", link) + env.define("AR", f"{ar_wrapper} {ar}") + env.define("NM", "dumpbin -symbols") + env.define("RANLIB", ":") + env.define("STRIP", ":") + if rc is not None: + env.define("RC", rc) + env.define("WINDRES", rc) + tc.generate(env) + + if is_msvc(self) or self._is_clang_cl: + # Custom AutotoolsDeps for cl like compilers + # workaround for https://github.com/conan-io/conan/issues/12784 + includedirs = [] + defines = [] + libs = [] + libdirs = [] + linkflags = [] + cxxflags = [] + cflags = [] + for dependency in self.dependencies.values(): + deps_cpp_info = dependency.cpp_info.aggregated_components() + includedirs.extend(deps_cpp_info.includedirs) + defines.extend(deps_cpp_info.defines) + libs.extend(deps_cpp_info.libs + deps_cpp_info.system_libs) + libdirs.extend(deps_cpp_info.libdirs) + linkflags.extend(deps_cpp_info.sharedlinkflags + deps_cpp_info.exelinkflags) + cxxflags.extend(deps_cpp_info.cxxflags) + cflags.extend(deps_cpp_info.cflags) + + env = Environment() + env.append("CPPFLAGS", [f"-I{unix_path(self, p)}" for p in includedirs] + [f"-D{d}" for d in defines]) + env.append("_LINK_", [lib if lib.endswith(".lib") else f"{lib}.lib" for lib in libs]) + env.append("LDFLAGS", [f"-L{unix_path(self, p)}" for p in libdirs] + linkflags) + env.append("CXXFLAGS", cxxflags) + env.append("CFLAGS", cflags) + env.vars(self).save_script("conanautotoolsdeps_cl_workaround") + else: + deps = AutotoolsDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - libiconv_prefix = self.deps_cpp_info["libiconv"].rootpath - libiconv_prefix = tools.unix_path(libiconv_prefix) if tools.os_info.is_windows else libiconv_prefix - args = ["HELP2MAN=/bin/true", - "EMACS=no", - "--disable-nls", - "--disable-dependency-tracking", - "--enable-relocatable", - "--disable-c++", - "--disable-java", - "--disable-csharp", - "--disable-libasprintf", - "--disable-curses", - "--disable-threads" if self.options.threads == "disabled" else ("--enable-threads=" + str(self.options.threads)), - "--with-libiconv-prefix=%s" % libiconv_prefix] - build = None - host = None - rc = None - if self.options.shared: - args.extend(["--disable-static", "--enable-shared"]) - else: - args.extend(["--disable-shared", "--enable-static"]) - if self._is_msvc or self._is_clang_cl: - # INSTALL.windows: Native binaries, built using the MS Visual C/C++ tool chain. - build = False - if self.settings.arch == "x86": - host = "i686-w64-mingw32" - rc = "windres --target=pe-i386" - elif self.settings.arch == "x86_64": - host = "x86_64-w64-mingw32" - rc = "windres --target=pe-x86-64" - cl = "cl" if self._is_msvc else os.environ.get("CC", 'clang-cl') - lib = "lib" if self._is_msvc else os.environ.get('AR', "llvm-lib") - link = "link" if self._is_msvc else os.environ.get("LD", "lld-link") - args.extend(["CC=%s %s -nologo" % (tools.unix_path(self._user_info_build["automake"].compile), cl), - "LD=%s" % link, - "NM=dumpbin -symbols", - "STRIP=:", - "AR=%s %s" % (tools.unix_path(self._user_info_build["automake"].ar_lib), lib), - "RANLIB=:"]) - if rc: - args.extend(['RC=%s' % rc, 'WINDRES=%s' % rc]) - with tools.vcvars(self.settings) if (self._is_msvc or self._is_clang_cl) else tools.no_op(): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if (self._is_msvc or self._is_clang_cl) else tools.no_op(): - with tools.chdir(os.path.join(self._source_subfolder, self._gettext_folder)): - env_build = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if self._is_msvc: - if not (self.settings.compiler == "Visual Studio" and - tools.Version(self.settings.compiler.version) < "12"): - env_build.flags.append("-FS") - env_build.configure(args=args, build=build, host=host) - env_build.make(self._make_args) + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure("gettext-tools") + autotools.make() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*gnuintl*.dll", dst="bin", src=self._source_subfolder, keep_path=False) - self.copy(pattern="*gnuintl*.lib", dst="lib", src=self._source_subfolder, keep_path=False) - self.copy(pattern="*gnuintl*.a", dst="lib", src=self._source_subfolder, keep_path=False) - self.copy(pattern="*gnuintl*.so*", dst="lib", src=self._source_subfolder, keep_path=False, symlinks=True) - self.copy(pattern="*gnuintl*.dylib", dst="lib", src=self._source_subfolder, keep_path=False, symlinks=True) - self.copy(pattern="*libgnuintl.h", dst="include", src=self._source_subfolder, keep_path=False) - tools.rename(os.path.join(self.package_folder, "include", "libgnuintl.h"), - os.path.join(self.package_folder, "include", "libintl.h")) - if (self._is_msvc or self._is_clang_cl) and self.options.shared: - tools.rename(os.path.join(self.package_folder, "lib", "gnuintl.dll.lib"), - os.path.join(self.package_folder, "lib", "gnuintl.lib")) + dest_lib_dir = os.path.join(self.package_folder, "lib") + dest_runtime_dir = os.path.join(self.package_folder, "bin") + dest_include_dir = os.path.join(self.package_folder, "include") + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "*gnuintl*.dll", self.build_folder, dest_runtime_dir, keep_path=False) + copy(self, "*gnuintl*.lib", self.build_folder, dest_lib_dir, keep_path=False) + copy(self, "*gnuintl*.a", self.build_folder, dest_lib_dir, keep_path=False) + copy(self, "*gnuintl*.so*", self.build_folder, dest_lib_dir, keep_path=False) + copy(self, "*gnuintl*.dylib", self.build_folder, dest_lib_dir, keep_path=False) + copy(self, "*libgnuintl.h", self.build_folder, dest_include_dir, keep_path=False) + rename(self, os.path.join(dest_include_dir, "libgnuintl.h"), os.path.join(dest_include_dir, "libintl.h")) + fix_msvc_libname(self) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "Intl") self.cpp_info.set_property("cmake_target_name", "Intl::Intl") self.cpp_info.libs = ["gnuintl"] - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.frameworks.append("CoreFoundation") self.cpp_info.names["cmake_find_package"] = "Intl" self.cpp_info.names["cmake_find_package_multi"] = "Intl" + +def fix_msvc_libname(conanfile, remove_lib_prefix=True): + """remove lib prefix & change extension to .lib in case of cl like compiler""" + if not conanfile.settings.get_safe("compiler.runtime"): + return + from conan.tools.files import rename + import glob + libdirs = getattr(conanfile.cpp.package, "libdirs") + for libdir in libdirs: + for ext in [".dll.a", ".dll.lib", ".a"]: + full_folder = os.path.join(conanfile.package_folder, libdir) + for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")): + libname = os.path.basename(filepath)[0:-len(ext)] + if remove_lib_prefix and libname[0:3] == "lib": + libname = libname[3:] + rename(conanfile, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib")) diff --git a/recipes/libgettext/all/test_package/CMakeLists.txt b/recipes/libgettext/all/test_package/CMakeLists.txt index 348ca8fff26b0..1ef1f4a228330 100644 --- a/recipes/libgettext/all/test_package/CMakeLists.txt +++ b/recipes/libgettext/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(Intl REQUIRED) +find_package(Intl CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} Intl::Intl) +target_link_libraries(${PROJECT_NAME} PRIVATE Intl::Intl) diff --git a/recipes/libgettext/all/test_package/conanfile.py b/recipes/libgettext/all/test_package/conanfile.py index 5a4859c2e9524..b9667f823f2c1 100644 --- a/recipes/libgettext/all/test_package/conanfile.py +++ b/recipes/libgettext/all/test_package/conanfile.py @@ -1,11 +1,31 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.env import Environment, VirtualRunEnv +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, rename + import os -import shutil class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + CMakeDeps(self).generate() + CMakeToolchain(self).generate() + for locale, lang in [("en", "en_US"), ("ru", "ru_RU"), ("es", "es_ES")]: + env = Environment() + env.define("LANG", lang) + env.vars(self, scope=f"run_{locale}").save_script(f"locale_{locale}") + + VirtualRunEnv(self).generate(scope=f"run_{locale}") def build(self): cmake = CMake(self) @@ -15,13 +35,15 @@ def build(self): directory = os.path.join(self.source_folder, locale, "LC_MESSAGES") if not os.path.isdir(directory): os.makedirs(directory) - shutil.copy(os.path.join(self.source_folder, "po", locale, "conan.mo.workaround_git_ignore"), - os.path.join(self.source_folder, locale, "LC_MESSAGES", "conan.mo")) + po_folder = os.path.join(self.source_folder, "po", locale) + dest_folder = os.path.join(self.source_folder, locale, "LC_MESSAGES") + copy(self, "conan.mo.workaround_git_ignore", po_folder, dest_folder) + mo_file = os.path.join(dest_folder, "conan.mo") + if not os.path.exists(mo_file): + rename(self, os.path.join(dest_folder, "conan.mo.workaround_git_ignore"), mo_file) def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - for locale in ["en_US", "ru_RU", "es_ES"]: - with tools.environment_append({"LANG": locale}): - self.run("%s %s" % (bin_path, os.path.abspath(self.source_folder)), run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + for locale in ["en", "ru", "es"]: + self.run(f"{bin_path} {os.path.abspath(self.source_folder)}", env=f"conanrun_{locale}") diff --git a/recipes/libgettext/all/test_v1_package/CMakeLists.txt b/recipes/libgettext/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..f9bddeec6f96a --- /dev/null +++ b/recipes/libgettext/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Intl CONFIG REQUIRED) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libgettext/all/test_v1_package/conanfile.py b/recipes/libgettext/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..36bfb4bd5c2c9 --- /dev/null +++ b/recipes/libgettext/all/test_v1_package/conanfile.py @@ -0,0 +1,31 @@ +from conans import ConanFile, CMake, tools +from conan.tools.files import copy, rename +import os +import shutil + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + for locale in ["en", "ru", "es"]: + directory = os.path.join(self.source_folder, locale, "LC_MESSAGES") + if not os.path.isdir(directory): + os.makedirs(directory) + po_folder = os.path.join(self.source_folder, "..", "test_package", "po", locale) + dest_folder = os.path.join(self.source_folder, locale, "LC_MESSAGES") + copy(self, "conan.mo.workaround_git_ignore", po_folder, dest_folder) + mo_file = os.path.join(dest_folder, "conan.mo") + if not os.path.exists(mo_file): + rename(self, os.path.join(dest_folder, "conan.mo.workaround_git_ignore"), mo_file) + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + for locale in ["en_US", "ru_RU", "es_ES"]: + with tools.environment_append({"LANG": locale}): + self.run(f"{bin_path} {os.path.abspath(self.source_folder)}", run_environment=True) diff --git a/recipes/libglvnd/all/conandata.yml b/recipes/libglvnd/all/conandata.yml index 77ef903a0a94d..930441157c427 100644 --- a/recipes/libglvnd/all/conandata.yml +++ b/recipes/libglvnd/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.5.0": + url: "https://gitlab.freedesktop.org/glvnd/libglvnd/-/archive/v1.5.0/libglvnd-v1.5.0.tar.gz" + sha256: "8c246d573bdaabbab32874befa79c8b92b12c05d3eb4bbefbe62afa630842793" "1.4.0": url: "https://gitlab.freedesktop.org/glvnd/libglvnd/uploads/ca5bf4295beb39bb324f692c481ac8a1/libglvnd-1.4.0.tar.gz" sha256: "c4a884503d2412dc1fa209613aa8a77193aeb7065b823fe1775dc8b6f3e45211" diff --git a/recipes/libglvnd/all/conanfile.py b/recipes/libglvnd/all/conanfile.py index 920477bf7faff..7d1919c184d04 100644 --- a/recipes/libglvnd/all/conanfile.py +++ b/recipes/libglvnd/all/conanfile.py @@ -61,15 +61,15 @@ def requirements(self): if self.options.x11: self.requires("xorg/system") if self.options.glx: - self.requires("xorg-proto/2021.4") + self.requires("xorg-proto/2022.2") def validate(self): if self.settings.os not in ['Linux', 'FreeBSD']: raise ConanInvalidConfiguration("libglvnd is only compatible with Linux and FreeBSD") def build_requirements(self): - self.build_requires("meson/0.62.2") - self.build_requires("pkgconf/1.7.4") + self.build_requires("meson/0.63.2") + self.build_requires("pkgconf/1.9.3") def layout(self): basic_layout(self) diff --git a/recipes/libglvnd/config.yml b/recipes/libglvnd/config.yml index eed35319fcea1..bd6887e2cfe66 100644 --- a/recipes/libglvnd/config.yml +++ b/recipes/libglvnd/config.yml @@ -1,3 +1,5 @@ versions: + "1.5.0": + folder: "all" "1.4.0": folder: "all" diff --git a/recipes/libharu/all/CMakeLists.txt b/recipes/libharu/all/CMakeLists.txt deleted file mode 100644 index 8315062fd31ee..0000000000000 --- a/recipes/libharu/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper C) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libharu/all/conandata.yml b/recipes/libharu/all/conandata.yml index cf40383d113bd..29a286d695d61 100644 --- a/recipes/libharu/all/conandata.yml +++ b/recipes/libharu/all/conandata.yml @@ -1,12 +1,18 @@ sources: + "2.4.3": + url: "https://github.com/libharu/libharu/archive/refs/tags/v2.4.3.tar.gz" + sha256: "a2c3ae4261504a0fda25b09e7babe5df02b21803dd1308fdf105588f7589d255" "2.3.0": url: "https://github.com/libharu/libharu/archive/RELEASE_2_3_0.tar.gz" sha256: "8f9e68cc5d5f7d53d1bc61a1ed876add1faf4f91070dbc360d8b259f46d9a4d2" patches: "2.3.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-allow-cmake-subproject.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-linux-add-m-system-library.patch" - - base_path: "source_subfolder" - patch_file: "patches/0003-rename-tiff-symbols.patch" + - patch_file: "patches/0001-allow-cmake-subproject.patch" + patch_type: "conan" + patch_description: "Allow cmake subproject" + - patch_file: "patches/0002-linux-add-m-system-library.patch" + patch_type: "conan" + patch_description: "Linux: add m system library" + - patch_file: "patches/0003-rename-tiff-symbols.patch" + patch_type: "conan" + patch_description: "Rename TIFF symbols" diff --git a/recipes/libharu/all/conanfile.py b/recipes/libharu/all/conanfile.py index 95a64d326a0a9..fc6fd0d3335fc 100644 --- a/recipes/libharu/all/conanfile.py +++ b/recipes/libharu/all/conanfile.py @@ -1,17 +1,21 @@ +from conan import ConanFile from conan.tools.microsoft import is_msvc -from conans import CMake, ConanFile, tools -import functools +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, load, save +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os import re -required_conan_version = ">=1.45.0" + +required_conan_version = ">=1.53.0" + class LibharuConan(ConanFile): name = "libharu" description = "Haru is a free, cross platform, open-sourced software library for generating PDF." - topics = ("libharu", "pdf", "generate", "generator") - license = "ZLIB" + topics = "pdf", "generate", "generator" + license = "Zlib" homepage = "http://libharu.org/" url = "https://github.com/conan-io/conan-center-index" @@ -25,20 +29,8 @@ class LibharuConan(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -46,54 +38,66 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + # src_folder must use the same source folder name the project + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") - self.requires("libpng/1.6.37") + self.requires("zlib/1.2.13") + self.requires("libpng/1.6.39") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["LIBHPDF_SHARED"] = self.options.shared - cmake.definitions["LIBHPDF_STATIC"] = not self.options.shared - # To install relocatable shared lib on Macos - cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - cmake.configure(build_folder=self._build_subfolder) - return cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBHPDF_SHARED"] = self.options.shared + tc.variables["LIBHPDF_STATIC"] = not self.options.shared + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() - def _extract_license(self): - readme = tools.load(os.path.join(self._source_subfolder, "README")) + def _v230_extract_license(self): + readme = load(save, os.path.join(self.source_folder, "README")) match = next(re.finditer("\n[^\n]*license[^\n]*\n", readme, flags=re.I | re.A)) return readme[match.span()[1]:].strip("*").strip() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - for fn in ("CHANGES", "INSTALL", "README"): - os.unlink(os.path.join(self.package_folder, fn)) - tools.rmdir(os.path.join(self.package_folder, "if")) - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + if Version(self.version) == "2.3.0": + rm(self, "CHANGES", os.path.join(self.package_folder)) + rm(self, "INSTALL", os.path.join(self.package_folder)) + rm(self, "README", os.path.join(self.package_folder)) + + rmdir(self, os.path.join(self.package_folder, "if")) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._v230_extract_license()) + else: + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - libprefix = "lib" if is_msvc(self) else "" - libsuffix = "{}{}".format( - "" if self.options.shared else "s", - "d" if is_msvc(self) and self.settings.build_type == "Debug" else "", - ) + libprefix = "" + libsuffix = "" + if Version(self.version) == "2.3.0": + libprefix = "lib" if is_msvc(self) else "" + libsuffix = "{}{}".format( + "" if self.options.shared else "s", + "d" if is_msvc(self) and self.settings.build_type == "Debug" else "", + ) self.cpp_info.libs = [f"{libprefix}hpdf{libsuffix}"] if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines = ["HPDF_DLL"] diff --git a/recipes/libharu/all/patches/0001-allow-cmake-subproject.patch b/recipes/libharu/all/patches/0001-allow-cmake-subproject.patch index 38b588f111044..2f042378b59fd 100644 --- a/recipes/libharu/all/patches/0001-allow-cmake-subproject.patch +++ b/recipes/libharu/all/patches/0001-allow-cmake-subproject.patch @@ -1,15 +1,25 @@ --- CMakeLists.txt +++ CMakeLists.txt -@@ -35,7 +35,7 @@ - cmake_minimum_required(VERSION 2.4.8 FATAL_ERROR) +@@ -1,3 +1,5 @@ ++cmake_minimum_required(VERSION 3.10) ++ + # CMakeLists.txt + # + # Copyright (C) 2008 Werner Smekal +@@ -31,11 +33,8 @@ + set(LIBHPDF_DESCRIPTION "libHaru is a free, cross platform, open source library for generating PDF files.") + set(LIBHPDF_PACKAGE_NAME "libHaru-${LIBHPDF_VERSION}-${COMPILER_LABEL}") +-# we want cmake version 2.4.8 at least +-cmake_minimum_required(VERSION 2.4.8 FATAL_ERROR) +- # Location where the haru cmake build system first looks for cmake modules -set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) +list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules) # set library name, msvc does not append 'lib' automatically if(MSVC) -@@ -110,7 +110,7 @@ endif(PNG_FOUND) +@@ -110,7 +109,7 @@ if(MSVC_VERSION GREATER 1399) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_SECURE_NO_DEPRECATE) endif(MSVC_VERSION GREATER 1399) @@ -18,7 +28,7 @@ # these are options -@@ -149,16 +149,16 @@ endif (NOT ZLIB_FOUND) +@@ -149,16 +148,16 @@ # create hpdf_config.h configure_file( @@ -40,7 +50,7 @@ ) endif(DEVPAK) # ======================================================================= -@@ -203,7 +203,7 @@ set( +@@ -203,7 +202,7 @@ include/hpdf_pdfa.h include/hpdf_3dmeasure.h include/hpdf_exdata.h @@ -49,7 +59,7 @@ ) # install header files -@@ -215,7 +215,7 @@ if(NOT DEVPAK) +@@ -215,7 +214,7 @@ install(DIRECTORY if DESTINATION .) endif(NOT DEVPAK) if(DEVPAK) diff --git a/recipes/libharu/all/patches/0002-linux-add-m-system-library.patch b/recipes/libharu/all/patches/0002-linux-add-m-system-library.patch index 1ee940b47a2f6..d4baac11198b8 100644 --- a/recipes/libharu/all/patches/0002-linux-add-m-system-library.patch +++ b/recipes/libharu/all/patches/0002-linux-add-m-system-library.patch @@ -1,6 +1,15 @@ --- src/CMakeLists.txt +++ src/CMakeLists.txt -@@ -97,4 +97,7 @@ if(LIBHPDF_SHARED) +@@ -87,7 +88,7 @@ + endif(LIBHPDF_STATIC) + if(LIBHPDF_SHARED) + add_library(${LIBHPDF_NAME} SHARED ${LIBHPDF_SRCS}) +- target_link_libraries(${LIBHPDF_NAME} ${ADDITIONAL_LIBRARIES}) ++ target_link_libraries(${LIBHPDF_NAME} PUBLIC ${ADDITIONAL_LIBRARIES}) + if(WIN32 AND NOT CYGWIN) + set_target_properties(${LIBHPDF_NAME} PROPERTIES DEFINE_SYMBOL HPDF_DLL_MAKE) + endif(WIN32 AND NOT CYGWIN) +@@ -97,4 +98,7 @@ LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) diff --git a/recipes/libharu/all/test_package/CMakeLists.txt b/recipes/libharu/all/test_package/CMakeLists.txt index 5fc8daf89329e..b0aef7cdad89b 100644 --- a/recipes/libharu/all/test_package/CMakeLists.txt +++ b/recipes/libharu/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +project(test_package C) find_package(libharu REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libharu::libharu) +target_link_libraries(${PROJECT_NAME} PRIVATE libharu::libharu) diff --git a/recipes/libharu/all/test_package/conanfile.py b/recipes/libharu/all/test_package/conanfile.py index 4651d31d881e8..470ed63c2164f 100644 --- a/recipes/libharu/all/test_package/conanfile.py +++ b/recipes/libharu/all/test_package/conanfile.py @@ -1,11 +1,21 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +from conan.errors import ConanException import os +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,8 +23,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") if not os.path.isfile("test.pdf"): raise ConanException("test did not create test.pdf") diff --git a/recipes/libharu/all/test_v1_package/CMakeLists.txt b/recipes/libharu/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libharu/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libharu/all/test_v1_package/conanfile.py b/recipes/libharu/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4651d31d881e8 --- /dev/null +++ b/recipes/libharu/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanException +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + if not os.path.isfile("test.pdf"): + raise ConanException("test did not create test.pdf") diff --git a/recipes/libharu/config.yml b/recipes/libharu/config.yml index 33ababb05e322..39ca57fe00f3b 100644 --- a/recipes/libharu/config.yml +++ b/recipes/libharu/config.yml @@ -1,3 +1,5 @@ versions: + "2.4.3": + folder: "all" "2.3.0": folder: "all" diff --git a/recipes/libheif/all/conanfile.py b/recipes/libheif/all/conanfile.py index d70912d7df209..55d521d49ca38 100644 --- a/recipes/libheif/all/conanfile.py +++ b/recipes/libheif/all/conanfile.py @@ -1,22 +1,21 @@ from conan import ConanFile -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, stdcpp_library from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir -from conan.tools.scm import Version -from conans import tools as tools_legacy +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class LibheifConan(ConanFile): name = "libheif" description = "libheif is an HEIF and AVIF file format decoder and encoder." - topics = ("libheif", "heif", "codec", "video") + topics = ("heif", "codec", "video") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/strukturag/libheif" license = ("LGPL-3.0-only", "GPL-3.0-or-later", "MIT") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,8 +35,7 @@ class LibheifConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,28 +43,27 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_libde265: - self.requires("libde265/1.0.8") + self.requires("libde265/1.0.9") if self.options.with_x265: self.requires("libx265/3.4") if self.options.with_libaomav1: - self.requires("libaom-av1/3.3.0") + self.requires("libaom-av1/3.5.0") if self.options.with_dav1d: self.requires("dav1d/1.0.0") def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -76,9 +73,6 @@ def generate(self): tc.variables["WITH_RAV1E"] = False tc.variables["WITH_DAV1D"] = self.options.with_dav1d tc.variables["WITH_EXAMPLES"] = False - if Version(self.version) < "1.11.0": - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() deps = CMakeDeps(self) deps.generate() @@ -107,7 +101,7 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["heif"].system_libs.extend(["m", "pthread"]) if not self.options.shared: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.components["heif"].system_libs.append(libcxx) diff --git a/recipes/libheif/all/test_package/conanfile.py b/recipes/libheif/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/libheif/all/test_package/conanfile.py +++ b/recipes/libheif/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/libheif/all/test_v1_package/CMakeLists.txt b/recipes/libheif/all/test_v1_package/CMakeLists.txt index 02d32b85a6658..0d20897301b68 100644 --- a/recipes/libheif/all/test_v1_package/CMakeLists.txt +++ b/recipes/libheif/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libheif REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE libheif::heif) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libhydrogen/all/conandata.yml b/recipes/libhydrogen/all/conandata.yml new file mode 100644 index 0000000000000..23536a9b5f306 --- /dev/null +++ b/recipes/libhydrogen/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "cci.20221115": + url: "https://github.com/jedisct1/libhydrogen/archive/580da280c59f72ca67e56333f5122f8ef040c74d.tar.gz" + sha256: "cf52deeb31f83302acfc784e9dab4b93e9c13e77aad3f629cf0761d30cae7e72" +patches: + "cci.20221115": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "CMake: Use C99 or higher, avoid to inject arch specific flags, fix dll install & don't build tests" + patch_type: "portability" diff --git a/recipes/libhydrogen/all/conanfile.py b/recipes/libhydrogen/all/conanfile.py new file mode 100644 index 0000000000000..5b5dc91e28942 --- /dev/null +++ b/recipes/libhydrogen/all/conanfile.py @@ -0,0 +1,71 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +import os + +required_conan_version = ">=1.53.0" + + +class LibhydrogenConan(ConanFile): + name = "libhydrogen" + description = "A lightweight, secure, easy-to-use crypto library suitable for constrained environments." + license = "ISC" + topics = ("cryptography", "crypto", "gimli") + homepage = "https://github.com/jedisct1/libhydrogen" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "hydrogen") + self.cpp_info.set_property("cmake_target_name", "hydrogen::hydrogen") + self.cpp_info.libs = ["hydrogen"] + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "hydrogen" + self.cpp_info.names["cmake_find_package_multi"] = "hydrogen" diff --git a/recipes/libhydrogen/all/patches/0001-fix-cmake.patch b/recipes/libhydrogen/all/patches/0001-fix-cmake.patch new file mode 100644 index 0000000000000..6fb76a8526ead --- /dev/null +++ b/recipes/libhydrogen/all/patches/0001-fix-cmake.patch @@ -0,0 +1,46 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.1) ++cmake_minimum_required(VERSION 3.8) + + project(hydrogen LANGUAGES C) + +@@ -39,6 +39,7 @@ set(arduino_files "library.properties") + + # Compile options + ++if(0) + get_setting(target_arch STRING "Target system architecture (fed to the compiler's -march=XXX).") + if(NOT target_arch AND NOT CMAKE_CROSSCOMPILING) + set(target_arch native) +@@ -84,6 +85,7 @@ set(compile_options + # unsigned" + /wd4310 # * suppress warning "cast truncates constant value" + >) ++endif() + + # Prefix project files with the project root + +@@ -106,6 +108,7 @@ set(targets_export_name "${PROJECT_NAME}-targets") + + install(TARGETS "${PROJECT_NAME}" + EXPORT "${targets_export_name}" ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}") + +@@ -134,6 +137,8 @@ install(FILES "${config_file}" DESTINATION "${install_config_dir}") + + export(EXPORT "${targets_export_name}" FILE "${targets_export_file}" NAMESPACE "${PROJECT_NAME}::") + ++target_compile_features(${PROJECT_NAME} PUBLIC c_std_99) ++if(0) + export(PACKAGE "${PROJECT_NAME}") + + # Tests +@@ -191,3 +196,4 @@ add_custom_command(OUTPUT "${arduino_package_file}" + VERBATIM) + + add_custom_target("${PROJECT_NAME}-arduino-package" DEPENDS "${arduino_package_file}" VERBATIM) ++endif() diff --git a/recipes/libhydrogen/all/test_package/CMakeLists.txt b/recipes/libhydrogen/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2090c80502872 --- /dev/null +++ b/recipes/libhydrogen/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(hydrogen REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE hydrogen::hydrogen) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/libhydrogen/all/test_package/conanfile.py b/recipes/libhydrogen/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/libhydrogen/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libhydrogen/all/test_package/test_package.c b/recipes/libhydrogen/all/test_package/test_package.c new file mode 100644 index 0000000000000..2fc97802ccc3e --- /dev/null +++ b/recipes/libhydrogen/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include +#include + +int main() +{ + printf("%lu\n", (unsigned long)hydro_random_u32()); + return 0; +} diff --git a/recipes/libhydrogen/all/test_v1_package/CMakeLists.txt b/recipes/libhydrogen/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libhydrogen/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libhydrogen/all/test_v1_package/conanfile.py b/recipes/libhydrogen/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libhydrogen/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libhydrogen/config.yml b/recipes/libhydrogen/config.yml new file mode 100644 index 0000000000000..7bdf816a5ffbd --- /dev/null +++ b/recipes/libhydrogen/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20221115": + folder: all diff --git a/recipes/libiberty/all/conandata.yml b/recipes/libiberty/all/conandata.yml index 45b4e09c87240..b3c320fd46551 100644 --- a/recipes/libiberty/all/conandata.yml +++ b/recipes/libiberty/all/conandata.yml @@ -1,4 +1,4 @@ sources: "9.1.0": - sha256: be303f7a8292982a35381489f5a9178603cbe9a4715ee4fa4a815d6bcd2b658d - url: https://ftp.gnu.org/pub/gnu/gcc/gcc-9.1.0/gcc-9.1.0.tar.gz + url: "https://ftp.gnu.org/pub/gnu/gcc/gcc-9.1.0/gcc-9.1.0.tar.gz" + sha256: "be303f7a8292982a35381489f5a9178603cbe9a4715ee4fa4a815d6bcd2b658d" diff --git a/recipes/libiberty/all/conanfile.py b/recipes/libiberty/all/conanfile.py index 3454090fe5df7..3d6300e66678c 100644 --- a/recipes/libiberty/all/conanfile.py +++ b/recipes/libiberty/all/conanfile.py @@ -1,16 +1,18 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, rename, rmdir +from conan.tools.layout import basic_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.microsoft import is_msvc, unix_path import os - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibibertyConan(ConanFile): name = "libiberty" - version = "9.1.0" description = "A collection of subroutines used by various GNU programs" - topics = ("conan", "libiberty", "gnu", "gnu-collection") + topics = ("gnu", "gnu-collection") url = "https://github.com/conan-io/conan-center-index" homepage = "https://gcc.gnu.org/onlinedocs/libiberty" license = "LGPL-2.1" @@ -22,59 +24,65 @@ class LibibertyConan(ConanFile): "fPIC": True, } - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property def _libiberty_folder(self): - return os.path.join(self._source_subfolder, self.name) + return os.path.join(self.source_folder, "libiberty") def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if self.settings.compiler == "Visual Studio": + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if is_msvc(self): raise ConanInvalidConfiguration("libiberty can not be built by Visual Studio.") - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + + def build_requirements(self): + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - tools.rmdir(os.path.join(self._source_subfolder, "gcc")) - tools.rmdir(os.path.join(self._source_subfolder, "libstdc++-v3")) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - conf_args = [ - "--enable-install-libiberty", - ] - self._autotools.configure(args=conf_args, configure_dir=self._libiberty_folder) - return self._autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + rmdir(self, os.path.join(self.source_folder, "gcc")) + rmdir(self, os.path.join(self.source_folder, "libstdc++-v3")) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.append("--enable-install-libiberty") + tc.generate() def build(self): - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure(build_script_folder=self._libiberty_folder) autotools.make() def package(self): - self.copy(pattern="COPYING.LIB", src=self._libiberty_folder, dst="licenses") - autotools = self._configure_autotools() - autotools.install() + copy(self, "COPYING.LIB", src=self._libiberty_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) self._package_xx(32) self._package_xx(64) def _package_xx(self, arch): - lib_arch_dir = os.path.join(self.package_folder, "lib{}".format(arch)) + lib_arch_dir = os.path.join(self.package_folder, f"lib{arch}") if os.path.exists(lib_arch_dir): libdir = os.path.join(self.package_folder, "lib") - tools.rmdir(libdir) - tools.rename(lib_arch_dir, libdir) + rmdir(self, libdir) + rename(self, lib_arch_dir, libdir) def package_info(self): self.cpp_info.libs = ["iberty"] diff --git a/recipes/libiberty/all/test_package/CMakeLists.txt b/recipes/libiberty/all/test_package/CMakeLists.txt index 34af13462f44f..c618a0e2a663b 100644 --- a/recipes/libiberty/all/test_package/CMakeLists.txt +++ b/recipes/libiberty/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libiberty REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libiberty::libiberty) diff --git a/recipes/libiberty/all/test_package/conanfile.py b/recipes/libiberty/all/test_package/conanfile.py index bd7165a553cf4..98ab55852ad56 100644 --- a/recipes/libiberty/all/test_package/conanfile.py +++ b/recipes/libiberty/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libiberty/all/test_v1_package/CMakeLists.txt b/recipes/libiberty/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libiberty/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libiberty/all/test_v1_package/conanfile.py b/recipes/libiberty/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libiberty/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libiconv/all/conandata.yml b/recipes/libiconv/all/conandata.yml index c04401d66daca..445cf39835a93 100644 --- a/recipes/libiconv/all/conandata.yml +++ b/recipes/libiconv/all/conandata.yml @@ -11,4 +11,3 @@ sources: patches: "1.16": - patch_file: "patches/0001-libcharset-fix-linkage.patch" - base_path: "source_subfolder" diff --git a/recipes/libiconv/all/conanfile.py b/recipes/libiconv/all/conanfile.py index 4aa83c5f8ef6c..544fb2b4ab962 100644 --- a/recipes/libiconv/all/conanfile.py +++ b/recipes/libiconv/all/conanfile.py @@ -1,20 +1,34 @@ -from conan.tools.files import rename -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conan.tools.microsoft import is_msvc -from contextlib import contextmanager +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, + copy, + export_conandata_patches, + get, + rename, + rm, + rmdir +) +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os -import functools -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.54.0" class LibiconvConan(ConanFile): name = "libiconv" description = "Convert text to and from Unicode" - license = "LGPL-2.1" + license = ("LGPL-2.0-or-later", "LGPL-2.1-or-later") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.gnu.org/software/libiconv/" topics = ("iconv", "text", "encoding", "locale", "unicode", "conversion") + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,20 +40,20 @@ class LibiconvConan(ConanFile): } @property - def _source_subfolder(self): - return "source_subfolder" + def _is_clang_cl(self): + return self.settings.compiler == "clang" and self.settings.os == "Windows" and \ + self.settings.compiler.get_safe("runtime") @property - def _use_winbash(self): - return tools.os_info.is_windows and (self.settings.compiler == "gcc" or tools.cross_building(self)) + def _msvc_tools(self): + return ("clang-cl", "llvm-lib", "lld-link") if self._is_clang_cl else ("cl", "lib", "link") @property - def _is_clang_cl(self): - return self.settings.compiler == "clang" and self.settings.os == "Windows" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -47,123 +61,89 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + if Version(self.version) >= "1.17": + self.license = "LGPL-2.1-or-later" + else: + self.license = "LGPL-2.0-or-later" - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows": + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + self.win_bash = True def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - @contextmanager - def _build_context(self): - env_vars = {} - if is_msvc(self) or self._is_clang_cl: - cc = "cl" if is_msvc(self) else os.environ.get("CC", "clang-cl") - cxx = "cl" if is_msvc(self) else os.environ.get("CXX", "clang-cl") - lib = "lib" if is_msvc(self) else os.environ.get("AR", "llvm-lib") - build_aux_path = os.path.join(self.build_folder, self._source_subfolder, "build-aux") - lt_compile = tools.unix_path(os.path.join(build_aux_path, "compile")) - lt_ar = tools.unix_path(os.path.join(build_aux_path, "ar-lib")) - env_vars.update({ - "CC": "{} {} -nologo".format(lt_compile, cc), - "CXX": "{} {} -nologo".format(lt_compile, cxx), - "LD": "link", - "STRIP": ":", - "AR": "{} {}".format(lt_ar, lib), - "RANLIB": ":", - "NM": "dumpbin -symbols" - }) - env_vars["win32_target"] = "_WIN32_WINNT_VISTA" - - if not tools.cross_building(self) or is_msvc(self) or self._is_clang_cl: - rc = None - if self.settings.arch == "x86": - rc = "windres --target=pe-i386" - elif self.settings.arch == "x86_64": - rc = "windres --target=pe-x86-64" - if rc: - env_vars["RC"] = rc - env_vars["WINDRES"] = rc - if self._use_winbash: - env_vars["RANLIB"] = ":" - - with tools.vcvars(self.settings) if (is_msvc(self) or self._is_clang_cl) else tools.no_op(): - with tools.chdir(self._source_subfolder): - with tools.environment_append(env_vars): - yield - - @functools.lru_cache(1) - def _configure_autotools(self): - host = None - build = None + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + msvc_version = {"Visual Studio": "12", "msvc": "180"} + if is_msvc(self) and Version(self.settings.compiler.version) >= msvc_version[str(self.settings.compiler)]: + # https://github.com/conan-io/conan/issues/6514 + tc.extra_cflags.append("-FS") + if cross_building(self) and is_msvc(self): + triplet_arch_windows = {"x86_64": "x86_64", "x86": "i686", "armv8": "aarch64"} + # ICU doesn't like GNU triplet of conan for msvc (see https://github.com/conan-io/conan/issues/12546) + host_arch = triplet_arch_windows.get(str(self.settings.arch)) + build_arch = triplet_arch_windows.get(str(self._settings_build.arch)) + + if host_arch and build_arch: + host = f"{host_arch}-w64-mingw32" + build = f"{build_arch}-w64-mingw32" + tc.configure_args.extend([ + f"--host={host}", + f"--build={build}", + ]) + env = tc.environment() if is_msvc(self) or self._is_clang_cl: - build = False - if self.settings.arch == "x86": - host = "i686-w64-mingw32" - elif self.settings.arch == "x86_64": - host = "x86_64-w64-mingw32" - - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - - configure_args = [] - if self.options.shared: - configure_args.extend(["--disable-static", "--enable-shared"]) - else: - configure_args.extend(["--enable-static", "--disable-shared"]) - - if (self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) >= "12") or \ - self.settings.compiler == "msvc": - autotools.flags.append("-FS") - - autotools.configure(args=configure_args, host=host, build=build) - return autotools - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # relocatable shared libs on macOS - for configure in ["configure", os.path.join("libcharset", "configure")]: - tools.replace_in_file(os.path.join(self._source_subfolder, configure), - "-install_name \\$rpath/", "-install_name @rpath/") + cc, lib, link = self._msvc_tools + build_aux_path = os.path.join(self.source_folder, "build-aux") + lt_compile = unix_path(self, os.path.join(build_aux_path, "compile")) + lt_ar = unix_path(self, os.path.join(build_aux_path, "ar-lib")) + env.define("CC", f"{lt_compile} {cc} -nologo") + env.define("CXX", f"{lt_compile} {cc} -nologo") + env.define("LD", link) + env.define("STRIP", ":") + env.define("AR", f"{lt_ar} {lib}") + env.define("RANLIB", ":") + env.define("NM", "dumpbin -symbols") + env.define("win32_target", "_WIN32_WINNT_VISTA") + tc.generate(env) def build(self): - self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING.LIB", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "share")) - + copy(self, "COPYING.LIB", self.source_folder, os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) if (is_msvc(self) or self._is_clang_cl) and self.options.shared: for import_lib in ["iconv", "charset"]: - rename(self, os.path.join(self.package_folder, "lib", "{}.dll.lib".format(import_lib)), - os.path.join(self.package_folder, "lib", "{}.lib".format(import_lib))) + rename(self, os.path.join(self.package_folder, "lib", f"{import_lib}.dll.lib"), + os.path.join(self.package_folder, "lib", f"{import_lib}.lib")) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "Iconv") self.cpp_info.set_property("cmake_target_name", "Iconv::Iconv") + self.cpp_info.libs = ["iconv", "charset"] + # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "Iconv" self.cpp_info.names["cmake_find_package_multi"] = "Iconv" - - self.cpp_info.libs = ["iconv", "charset"] - - binpath = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment var: {}".format(binpath)) - self.env_info.path.append(binpath) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/libiconv/all/test_package/CMakeLists.txt b/recipes/libiconv/all/test_package/CMakeLists.txt index 18f2a726df141..64fa90dede848 100644 --- a/recipes/libiconv/all/test_package/CMakeLists.txt +++ b/recipes/libiconv/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(Iconv REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} Iconv::Iconv) +target_link_libraries(${PROJECT_NAME} PRIVATE Iconv::Iconv) diff --git a/recipes/libiconv/all/test_package/conanfile.py b/recipes/libiconv/all/test_package/conanfile.py index 715ff0b981f7c..12a4269e5efa4 100644 --- a/recipes/libiconv/all/test_package/conanfile.py +++ b/recipes/libiconv/all/test_package/conanfile.py @@ -1,19 +1,20 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -21,5 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libiconv/all/test_v1_package/CMakeLists.txt b/recipes/libiconv/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libiconv/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libiconv/all/test_v1_package/conanfile.py b/recipes/libiconv/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a831367c532bc --- /dev/null +++ b/recipes/libiconv/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/libinterpolate/all/conandata.yml b/recipes/libinterpolate/all/conandata.yml new file mode 100644 index 0000000000000..04998351d32b8 --- /dev/null +++ b/recipes/libinterpolate/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + "2.6.2": + url: + - "https://github.com/CD3/libInterpolate/archive/refs/tags/2.6.2.tar.gz" + sha256: "42f40c9b77fda6e0c52ed39b522458456e89fb4981d63f812aa158c6f4be8ab0" diff --git a/recipes/libinterpolate/all/conanfile.py b/recipes/libinterpolate/all/conanfile.py new file mode 100644 index 0000000000000..62e7baa6e4ea4 --- /dev/null +++ b/recipes/libinterpolate/all/conanfile.py @@ -0,0 +1,101 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.52.0" + + +class PackageConan(ConanFile): + name = "libinterpolate" + description = "A C++ interpolation library with a simple interface that supports multiple interpolation methods." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/CD3/libInterpolate" + topics = ("math", "spline", "interpolation", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15", + "msvc": "19.0", + "gcc": "7", + "clang": "4", + "apple-clang": "10", + } + + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("boost/1.80.0", transitive_headers=True) + self.requires("eigen/3.3.7", transitive_headers=True) + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration("libInterpolate currently only supports Linux. Upstream PR's are welcome (https://github.com/CD3/libInterpolate/issues/14).") + + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False + ) + if ( + minimum_version + and Version(self.settings.compiler.version) < minimum_version + ): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + pass + + def package(self): + copy( + self, + pattern="LICENSE.md", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src"), + ) + + def package_id(self): + self.info.clear() + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "libInterpolate") + self.cpp_info.set_property( + "cmake_target_name", "libInterpolate::Interpolate" + ) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "libInterpolate" + self.cpp_info.filenames["cmake_find_package_multi"] = "libInterpolate" + self.cpp_info.names["cmake_find_package"] = "libInterpolate" + self.cpp_info.names["cmake_find_package_multi"] = "libInterpolate" + self.cpp_info.components["Interpolate"].names["cmake_find_package"] = "Interpolate" + self.cpp_info.components["Interpolate"].names["cmake_find_package_multi"] = "Interpolate" + self.cpp_info.components["Interpolate"].requires = ["eigen::eigen","boost::boost"] diff --git a/recipes/libinterpolate/all/test_package/CMakeLists.txt b/recipes/libinterpolate/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..05a0c0e049e56 --- /dev/null +++ b/recipes/libinterpolate/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(libInterpolate REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libInterpolate::Interpolate) diff --git a/recipes/libinterpolate/all/test_package/conanfile.py b/recipes/libinterpolate/all/test_package/conanfile.py new file mode 100644 index 0000000000000..48499fa0989d9 --- /dev/null +++ b/recipes/libinterpolate/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libinterpolate/all/test_package/test_package.cpp b/recipes/libinterpolate/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c42798ca5d0d0 --- /dev/null +++ b/recipes/libinterpolate/all/test_package/test_package.cpp @@ -0,0 +1,21 @@ +#include +#include + +#include + +int main(void) +{ + std::vector x(2), y(2); + + x[0] = 0; + x[1] = 1; + y[0] = 10; + y[1] = 20; + + _1D::LinearInterpolator interp; + interp.setData(x, y); + + std::cout << "f(0.5) = " << interp(0.5) << std::endl; + + return EXIT_SUCCESS; +} diff --git a/recipes/libinterpolate/all/test_v1_package/CMakeLists.txt b/recipes/libinterpolate/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b5b37b01b534c --- /dev/null +++ b/recipes/libinterpolate/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) + diff --git a/recipes/libinterpolate/all/test_v1_package/conanfile.py b/recipes/libinterpolate/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/libinterpolate/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libinterpolate/config.yml b/recipes/libinterpolate/config.yml new file mode 100644 index 0000000000000..8296a371553be --- /dev/null +++ b/recipes/libinterpolate/config.yml @@ -0,0 +1,3 @@ +versions: + "2.6.2": + folder: all diff --git a/recipes/libjpeg-turbo/all/CMakeLists.txt b/recipes/libjpeg-turbo/all/CMakeLists.txt deleted file mode 100644 index 09495a3ab6e92..0000000000000 --- a/recipes/libjpeg-turbo/all/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -cmake_minimum_required(VERSION 3.1) - -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(NO_OUTPUT_DIRS) - -if(NOT CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CONAN_LIBJPEG_SYSTEM_PROCESSOR}) -endif() - - -add_subdirectory("source_subfolder") diff --git a/recipes/libjpeg-turbo/all/conandata.yml b/recipes/libjpeg-turbo/all/conandata.yml index 60485970620b8..1821235633f65 100644 --- a/recipes/libjpeg-turbo/all/conandata.yml +++ b/recipes/libjpeg-turbo/all/conandata.yml @@ -1,30 +1,25 @@ sources: + "2.1.5": + url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.5/libjpeg-turbo-2.1.5.tar.gz" + sha256: "bc12bc9dce55300c6bf4342bc233bcc26bd38bf289eedf147360d731c668ddaf" "2.1.4": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.4.tar.gz" - sha256: "a78b05c0d8427a90eb5b4eb08af25309770c8379592bb0b8a863373128e6143f" + url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.4/libjpeg-turbo-2.1.4.tar.gz" + sha256: "d3ed26a1131a13686dfca4935e520eb7c90ae76fbc45d98bb50a8dc86230342b" "2.1.3": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.3.tar.gz" - sha256: "dbda0c685942aa3ea908496592491e5ec8160d2cf1ec9d5fd5470e50768e7859" + url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.3/libjpeg-turbo-2.1.3.tar.gz" + sha256: "467b310903832b033fe56cd37720d1b73a6a3bd0171dbf6ff0b620385f4f76d0" "2.1.2": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.2.tar.gz" - sha256: "e7fdc8a255c45bc8fbd9aa11c1a49c23092fcd7379296aeaeb14d3343a3d1bed" + url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.2/libjpeg-turbo-2.1.2.tar.gz" + sha256: "09b96cb8cbff9ea556a9c2d173485fd19488844d55276ed4f42240e1e2073ce5" "2.1.1": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.1.tar.gz" - sha256: "20e9cd3e5f517950dfb7a300ad344543d88719c254407ffb5ad88d891bf701c4" + url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.1/libjpeg-turbo-2.1.1.tar.gz" + sha256: "b76aaedefb71ba882cbad4e9275b30c2ae493e3195be0a099425b5c6b99bd510" "2.1.0": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.1.0.tar.gz" - sha256: "d6b7790927d658108dfd3bee2f0c66a2924c51ee7f9dc930f62c452f4a638c52" + url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.1.0/libjpeg-turbo-2.1.0.tar.gz" + sha256: "bef89803e506f27715c5627b1e3219c95b80fc31465d4452de2a909d382e4444" "2.0.6": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.6.tar.gz" - sha256: "005aee2fcdca252cee42271f7f90574dda64ca6505d9f8b86ae61abc2b426371" + url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.0.6/libjpeg-turbo-2.0.6.tar.gz" + sha256: "d74b92ac33b0e3657123ddcf6728788c90dc84dcb6a52013d758af3c4af481bb" "2.0.5": - url: "https://github.com/libjpeg-turbo/libjpeg-turbo/archive/2.0.5.tar.gz" - sha256: "b3090cd37b5a8b3e4dbd30a1311b3989a894e5d3c668f14cbc6739d77c9402b7" - -patches: - "2.1.4": - - patch_file: "patches/2.1.3-0001-fix-cmake.patch" - base_path: "source_subfolder" - "2.1.3": - - patch_file: "patches/2.1.3-0001-fix-cmake.patch" - base_path: "source_subfolder" + url: "https://sourceforge.net/projects/libjpeg-turbo/files/2.0.5/libjpeg-turbo-2.0.5.tar.gz" + sha256: "16f8f6f2715b3a38ab562a84357c793dd56ae9899ce130563c72cd93d8357b5d" diff --git a/recipes/libjpeg-turbo/all/conanfile.py b/recipes/libjpeg-turbo/all/conanfile.py index 2ad62b1340bf7..afc30df36cff2 100644 --- a/recipes/libjpeg-turbo/all/conanfile.py +++ b/recipes/libjpeg-turbo/all/conanfile.py @@ -1,10 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, replace_in_file, rm, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -import functools -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" class LibjpegTurboConan(ConanFile): @@ -42,26 +45,16 @@ class LibjpegTurboConan(ConanFile): "java": False, "enable12bit": False, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if self.options.enable12bit: del self.options.java @@ -74,13 +67,23 @@ def configure(self): if self.options.libjpeg8_compatibility: del self.options.mem_src_dst + def layout(self): + cmake_layout(self, src_folder="src") + def validate(self): if self.options.enable12bit and (self.options.libjpeg7_compatibility or self.options.libjpeg8_compatibility): raise ConanInvalidConfiguration("12-bit samples is not allowed with libjpeg v7/v8 API/ABI") - if self.options.get_safe("java", False) and not self.options.shared: + if self.options.get_safe("java") and not self.options.shared: raise ConanInvalidConfiguration("java wrapper requires shared libjpeg-turbo") - if is_msvc(self) and self.options.shared and str(self.settings.compiler.runtime).startswith("MT"): - raise ConanInvalidConfiguration("shared libjpeg-turbo can't be built with MT or MTd") + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration(f"{self.ref} shared can't be built with static vc runtime") + + def build_requirements(self): + if self.options.get_safe("SIMD") and self.settings.arch in ["x86", "x86_64"]: + self.tool_requires("nasm/2.15.05") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _is_arithmetic_encoding_enabled(self): @@ -92,91 +95,80 @@ def _is_arithmetic_decoding_enabled(self): return self.options.get_safe("arithmetic_decoder", False) or \ self.options.libjpeg7_compatibility or self.options.libjpeg8_compatibility - def build_requirements(self): - if self.options.get_safe("SIMD") and self.settings.arch in ["x86", "x86_64"]: - self.build_requires("nasm/2.14") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self, set_cmake_flags=True) - cmake.definitions["ENABLE_STATIC"] = not self.options.shared - cmake.definitions["ENABLE_SHARED"] = self.options.shared - cmake.definitions["WITH_SIMD"] = self.options.get_safe("SIMD", False) - cmake.definitions["WITH_ARITH_ENC"] = self._is_arithmetic_encoding_enabled - cmake.definitions["WITH_ARITH_DEC"] = self._is_arithmetic_decoding_enabled - cmake.definitions["WITH_JPEG7"] = self.options.libjpeg7_compatibility - cmake.definitions["WITH_JPEG8"] = self.options.libjpeg8_compatibility - cmake.definitions["WITH_MEM_SRCDST"] = self.options.get_safe("mem_src_dst", False) - cmake.definitions["WITH_TURBOJPEG"] = self.options.get_safe("turbojpeg", False) - cmake.definitions["WITH_JAVA"] = self.options.get_safe("java", False) - cmake.definitions["WITH_12BIT"] = self.options.enable12bit + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = CMakeToolchain(self) + tc.variables["ENABLE_STATIC"] = not self.options.shared + tc.variables["ENABLE_SHARED"] = self.options.shared + tc.variables["WITH_SIMD"] = self.options.get_safe("SIMD", False) + tc.variables["WITH_ARITH_ENC"] = self._is_arithmetic_encoding_enabled + tc.variables["WITH_ARITH_DEC"] = self._is_arithmetic_decoding_enabled + tc.variables["WITH_JPEG7"] = self.options.libjpeg7_compatibility + tc.variables["WITH_JPEG8"] = self.options.libjpeg8_compatibility + tc.variables["WITH_MEM_SRCDST"] = self.options.get_safe("mem_src_dst", False) + tc.variables["WITH_TURBOJPEG"] = self.options.get_safe("turbojpeg", False) + tc.variables["WITH_JAVA"] = self.options.get_safe("java", False) + tc.variables["WITH_12BIT"] = self.options.enable12bit if is_msvc(self): - cmake.definitions["WITH_CRT_DLL"] = True # avoid replacing /MD by /MT in compiler flags - - if tools.Version(self.version) <= "2.1.0": - cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False # avoid configuration error if building for iOS/tvOS/watchOS - - if tools.cross_building(self): - # TODO: too specific and error prone, should be delegated to a conan helper function - cmake_system_processor = { - "armv8": "aarch64", - "armv8.3": "aarch64", - }.get(str(self.settings.arch), str(self.settings.arch)) - cmake.definitions["CONAN_LIBJPEG_SYSTEM_PROCESSOR"] = cmake_system_processor - - cmake.configure() - return cmake + tc.variables["WITH_CRT_DLL"] = True # avoid replacing /MD by /MT in compiler flags + if Version(self.version) <= "2.1.0": + tc.variables["CMAKE_MACOSX_BUNDLE"] = False # avoid configuration error if building for iOS/tvOS/watchOS + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # use standard GNUInstallDirs.cmake - custom one is broken - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "include(cmakescripts/GNUInstallDirs.cmake)", "include(GNUInstallDirs)") # do not override /MT by /MD if shared - tools.replace_in_file(os.path.join(self._source_subfolder, "sharedlib", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "sharedlib", "CMakeLists.txt"), """string(REGEX REPLACE "/MT" "/MD" ${var} "${${var}}")""", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.md", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() # remove unneeded directories - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "doc")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "doc")) # remove binaries and pdb files for pattern_to_remove in ["cjpeg*", "djpeg*", "jpegtran*", "tjbench*", "wrjpgcom*", "rdjpgcom*", "*.pdb"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), pattern_to_remove) + rm(self, pattern_to_remove, os.path.join(self.package_folder, "bin")) def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_module_file_name", "JPEG") self.cpp_info.set_property("cmake_file_name", "libjpeg-turbo") cmake_target_suffix = "-static" if not self.options.shared else "" lib_suffix = "-static" if is_msvc(self) and not self.options.shared else "" - self.cpp_info.components["jpeg"].set_property("cmake_target_name", "libjpeg-turbo::jpeg{}".format(cmake_target_suffix)) + self.cpp_info.components["jpeg"].set_property("cmake_module_target_name", "JPEG::JPEG") + self.cpp_info.components["jpeg"].set_property("cmake_target_name", f"libjpeg-turbo::jpeg{cmake_target_suffix}") self.cpp_info.components["jpeg"].set_property("pkg_config_name", "libjpeg") - self.cpp_info.components["jpeg"].names["cmake_find_package"] = "jpeg" + cmake_target_suffix - self.cpp_info.components["jpeg"].names["cmake_find_package_multi"] = "jpeg" + cmake_target_suffix - self.cpp_info.components["jpeg"].libs = ["jpeg" + lib_suffix] + self.cpp_info.components["jpeg"].libs = [f"jpeg{lib_suffix}"] if self.options.get_safe("turbojpeg"): - self.cpp_info.components["turbojpeg"].set_property("cmake_target_name", "libjpeg-turbo::turbojpeg{}".format(cmake_target_suffix)) + self.cpp_info.components["turbojpeg"].set_property("cmake_target_name", f"libjpeg-turbo::turbojpeg{cmake_target_suffix}") self.cpp_info.components["turbojpeg"].set_property("pkg_config_name", "libturbojpeg") - self.cpp_info.components["turbojpeg"].names["cmake_find_package"] = "turbojpeg" + cmake_target_suffix - self.cpp_info.components["turbojpeg"].names["cmake_find_package_multi"] = "turbojpeg" + cmake_target_suffix - self.cpp_info.components["turbojpeg"].libs = ["turbojpeg" + lib_suffix] + self.cpp_info.components["turbojpeg"].libs = [f"turbojpeg{lib_suffix}"] + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "JPEG" + self.cpp_info.names["cmake_find_package_multi"] = "libjpeg-turbo" + self.cpp_info.components["jpeg"].names["cmake_find_package"] = "JPEG" + self.cpp_info.components["jpeg"].names["cmake_find_package_multi"] = f"jpeg{cmake_target_suffix}" + if self.options.get_safe("turbojpeg"): + self.cpp_info.components["turbojpeg"].names["cmake_find_package"] = f"turbojpeg{cmake_target_suffix}" + self.cpp_info.components["turbojpeg"].names["cmake_find_package_multi"] = f"turbojpeg{cmake_target_suffix}" diff --git a/recipes/libjpeg-turbo/all/patches/2.1.3-0001-fix-cmake.patch b/recipes/libjpeg-turbo/all/patches/2.1.3-0001-fix-cmake.patch deleted file mode 100644 index cd50a4ec1f210..0000000000000 --- a/recipes/libjpeg-turbo/all/patches/2.1.3-0001-fix-cmake.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 1198ece..cea737c 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -606,7 +606,7 @@ if(WITH_TURBOJPEG) - set(TJMAPFILE ${CMAKE_CURRENT_SOURCE_DIR}/turbojpeg-mapfile.jni) - endif() - if(MSVC) -- configure_file(${CMAKE_SOURCE_DIR}/win/turbojpeg.rc.in -+ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/win/turbojpeg.rc.in - ${CMAKE_BINARY_DIR}/win/turbojpeg.rc) - set(TURBOJPEG_SOURCES ${TURBOJPEG_SOURCES} - ${CMAKE_BINARY_DIR}/win/turbojpeg.rc) -diff --git a/sharedlib/CMakeLists.txt b/sharedlib/CMakeLists.txt -index aea0b9d..612be16 100644 ---- a/sharedlib/CMakeLists.txt -+++ b/sharedlib/CMakeLists.txt -@@ -36,7 +36,7 @@ if(WIN32) - endif() - endif() - if(MSVC) -- configure_file(${CMAKE_SOURCE_DIR}/win/jpeg.rc.in -+ configure_file(../win/jpeg.rc.in - ${CMAKE_BINARY_DIR}/win/jpeg.rc) - set(JPEG_SRCS ${JPEG_SRCS} ${CMAKE_BINARY_DIR}/win/jpeg.rc) - endif() diff --git a/recipes/libjpeg-turbo/all/test_package/CMakeLists.txt b/recipes/libjpeg-turbo/all/test_package/CMakeLists.txt index df694d56d4d0e..8715b08bc7f76 100644 --- a/recipes/libjpeg-turbo/all/test_package/CMakeLists.txt +++ b/recipes/libjpeg-turbo/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(libjpeg-turbo REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) if(TARGET libjpeg-turbo::jpeg) - target_link_libraries(${PROJECT_NAME} PRIVATE libjpeg-turbo::jpeg) + target_link_libraries(${PROJECT_NAME} PRIVATE libjpeg-turbo::jpeg) else() - target_link_libraries(${PROJECT_NAME} PRIVATE libjpeg-turbo::jpeg-static) + target_link_libraries(${PROJECT_NAME} PRIVATE libjpeg-turbo::jpeg-static) endif() -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/libjpeg-turbo/all/test_package/conanfile.py b/recipes/libjpeg-turbo/all/test_package/conanfile.py index d5c6b828b775b..fb5d85902cc52 100644 --- a/recipes/libjpeg-turbo/all/test_package/conanfile.py +++ b/recipes/libjpeg-turbo/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") img_name = os.path.join(self.source_folder, "testimg.jpg") - bin_path = os.path.join("bin", "test_package") - self.run('%s %s' % (bin_path, img_name), run_environment=True) + self.run(f"{bin_path} {img_name}", env="conanrun") diff --git a/recipes/libjpeg-turbo/all/test_package_module/CMakeLists.txt b/recipes/libjpeg-turbo/all/test_package_module/CMakeLists.txt new file mode 100644 index 0000000000000..b78c6fc513d77 --- /dev/null +++ b/recipes/libjpeg-turbo/all/test_package_module/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(JPEG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE JPEG::JPEG) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/libjpeg-turbo/all/test_package_module/conanfile.py b/recipes/libjpeg-turbo/all/test_package_module/conanfile.py new file mode 100644 index 0000000000000..fd19bb1425057 --- /dev/null +++ b/recipes/libjpeg-turbo/all/test_package_module/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", env="conanrun") diff --git a/recipes/libjpeg-turbo/all/test_v1_package/CMakeLists.txt b/recipes/libjpeg-turbo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libjpeg-turbo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libjpeg-turbo/all/test_v1_package/conanfile.py b/recipes/libjpeg-turbo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a2b04c499e0ac --- /dev/null +++ b/recipes/libjpeg-turbo/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", run_environment=True) diff --git a/recipes/libjpeg-turbo/all/test_v1_package_module/CMakeLists.txt b/recipes/libjpeg-turbo/all/test_v1_package_module/CMakeLists.txt new file mode 100644 index 0000000000000..27f7a57e7a0b3 --- /dev/null +++ b/recipes/libjpeg-turbo/all/test_v1_package_module/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package_module + ${CMAKE_CURRENT_BINARY_DIR}/test_package_module) diff --git a/recipes/libjpeg-turbo/all/test_v1_package_module/conanfile.py b/recipes/libjpeg-turbo/all/test_v1_package_module/conanfile.py new file mode 100644 index 0000000000000..b6600e428515c --- /dev/null +++ b/recipes/libjpeg-turbo/all/test_v1_package_module/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", run_environment=True) diff --git a/recipes/libjpeg-turbo/config.yml b/recipes/libjpeg-turbo/config.yml index 8b2c022f29e5c..cdfe1237074c7 100644 --- a/recipes/libjpeg-turbo/config.yml +++ b/recipes/libjpeg-turbo/config.yml @@ -1,4 +1,6 @@ versions: + "2.1.5": + folder: all "2.1.4": folder: all "2.1.3": diff --git a/recipes/libjpeg/all/conandata.yml b/recipes/libjpeg/all/conandata.yml index a44bc5bf6378b..b147d8fb1dd7d 100644 --- a/recipes/libjpeg/all/conandata.yml +++ b/recipes/libjpeg/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "9e": + url: "http://ijg.org/files/jpegsrc.v9e.tar.gz" + sha256: "4077d6a6a75aeb01884f708919d25934c93305e49f7e3f36db9129320e6f4f3d" "9d": url: "http://ijg.org/files/jpegsrc.v9d.tar.gz" sha256: "2303a6acfb6cc533e0e86e8a9d29f7e6079e118b9de3f96e07a71a11c082fa6a" @@ -6,9 +9,15 @@ sources: url: "http://ijg.org/files/jpegsrc.v9c.tar.gz" sha256: "682aee469c3ca857c4c38c37a6edadbfca4b04d42e56613b11590ec6aa4a278d" patches: + "9e": + - patch_file: "patches/0001-9e-libjpeg-add-msvc-dll-support.patch" + patch_description: "Add support to generate DLL on Windows" + patch_type: "portability" "9d": - patch_file: "patches/0001-libjpeg-add-msvc-dll-support.patch" - base_path: "source_subfolder" + patch_description: "Add support to generate DLL on Windows" + patch_type: "portability" "9c": - patch_file: "patches/0001-libjpeg-add-msvc-dll-support.patch" - base_path: "source_subfolder" + patch_description: "Add support to generate DLL on Windows" + patch_type: "portability" diff --git a/recipes/libjpeg/all/conanfile.py b/recipes/libjpeg/all/conanfile.py index d44c2e6847f4e..dd93ec3f8004c 100644 --- a/recipes/libjpeg/all/conanfile.py +++ b/recipes/libjpeg/all/conanfile.py @@ -1,9 +1,16 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, load, replace_in_file, rm, rmdir, save +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, NMakeToolchain import os import re import shutil -required_conan_version = ">=1.43.0" + +required_conan_version = ">=1.55.0" class LibjpegConan(ConanFile): @@ -24,24 +31,17 @@ class LibjpegConan(ConanFile): "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _is_clang_cl(self): + return self.settings.os == "Windows" and self.settings.compiler == "clang" @property - def _is_clang_cl(self): - return self.settings.os == 'Windows' and self.settings.compiler == 'clang' + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def export_sources(self): - self.copy("Win32.Mak") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "Win32.Mak", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -49,130 +49,127 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if self._settings_build.os == "Windows" and not (self._is_msvc or self. _is_clang_cl) and \ - not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows" and not (is_msvc(self) or self. _is_clang_cl): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self) or self._is_clang_cl: + # clean environment variables that might affect on the build (e.g. if set by Jenkins) + env = Environment() + env.define("PROFILE", None) + env.define("TUNE", None) + env.define("NODEBUG", None) + env.vars(self).save_script("conanbuildenv_nmake_unset_env") + tc = NMakeToolchain(self) + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.extra_defines.append("LIBJPEG_BUILDING") + tc.generate() def _build_nmake(self): - shutil.copy("Win32.Mak", os.path.join(self._source_subfolder, "Win32.Mak")) - tools.replace_in_file(os.path.join(self._source_subfolder, "Win32.Mak"), - "\nccommon = -c ", - "\nccommon = -c -DLIBJPEG_BUILDING {}".format("" if self.options.shared else "-DLIBJPEG_STATIC ")) - # clean environment variables that might affect on the build (e.g. if set by Jenkins) - with tools.chdir(self._source_subfolder), tools.environment_append({"PROFILE": None, "TUNE": None, "NODEBUG": None}): + copy(self, "Win32.Mak", src=os.path.join(self.source_folder, os.pardir), dst=self.source_folder) + with chdir(self, self.source_folder): + # export symbols if shared + replace_in_file( + self, + "Win32.Mak", + "\nccommon = -c ", + "\nccommon = -c -DLIBJPEG_BUILDING {}".format("" if self.options.shared else "-DLIBJPEG_STATIC "), + ) shutil.copy("jconfig.vc", "jconfig.h") make_args = [ - "nodebug=1" if self.settings.build_type != 'Debug' else "", + "nodebug=1" if self.settings.build_type != "Debug" else "", ] if self._is_clang_cl: - cl = os.environ.get('CC', 'clang-cl') - link = os.environ.get('LD', 'lld-link') - lib = os.environ.get('AR', 'llvm-lib') - rc = os.environ.get('RC', 'llvm-rc') - tools.replace_in_file('Win32.Mak', 'cc = cl', 'cc = %s' % cl) - tools.replace_in_file('Win32.Mak', 'link = link', 'link = %s' % link) - tools.replace_in_file('Win32.Mak', 'implib = lib', 'implib = %s' % lib) - tools.replace_in_file('Win32.Mak', 'rc = Rc', 'rc = %s' % rc) + compilers_from_conf = self.conf.get("tools.build:compiler_executables", default={}, check_type=dict) + buildenv_vars = VirtualBuildEnv(self).vars() + cl = compilers_from_conf.get("c", buildenv_vars.get("CC", "clang-cl")) + link = buildenv_vars.get("LD", "lld-link") + lib = buildenv_vars.get("AR", "llvm-lib") + rc = compilers_from_conf.get("rc", buildenv_vars.get("RC", "llvm-rc")) + replace_in_file(self, "Win32.Mak", "cc = cl", f"cc = {cl}") + replace_in_file(self, "Win32.Mak", "link = link", f"link = {link}") + replace_in_file(self, "Win32.Mak", "implib = lib", f"implib = {lib}") + replace_in_file(self, "Win32.Mak", "rc = Rc", f"rc = {rc}") # set flags directly in makefile.vc # cflags are critical for the library. ldflags and ldlibs are only for binaries - if self.settings.compiler.runtime in ["MD", "MDd"]: - tools.replace_in_file("makefile.vc", "(cvars)", "(cvarsdll)") - tools.replace_in_file("makefile.vc", "(conlibs)", "(conlibsdll)") + if is_msvc_static_runtime(self): + replace_in_file(self, "makefile.vc", "(cvars)", "(cvarsmt)") + replace_in_file(self, "makefile.vc", "(conlibs)", "(conlibsmt)") else: - tools.replace_in_file("makefile.vc", "(cvars)", "(cvarsmt)") - tools.replace_in_file("makefile.vc", "(conlibs)", "(conlibsmt)") - target = "{}/libjpeg.lib".format( "shared" if self.options.shared else "static" ) - with tools.vcvars(self.settings): - self.run("nmake -f makefile.vc {} {}".format(" ".join(make_args), target)) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.defines.append("LIBJPEG_BUILDING") - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - self._autotools.configure(configure_dir=self._source_subfolder, args=args) - return self._autotools - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # Fix rpath in LC_ID_DYLIB of installed shared libs on macOS - if tools.is_apple_os(self.settings.os): - tools.replace_in_file( - os.path.join(self._source_subfolder, "configure"), - "-install_name \\$rpath/", - "-install_name @rpath/", - ) + replace_in_file(self, "makefile.vc", "(cvars)", "(cvarsdll)") + replace_in_file(self, "makefile.vc", "(conlibs)", "(conlibsdll)") + target = "{}/libjpeg.lib".format("shared" if self.options.shared else "static") + self.run("nmake -f makefile.vc {} {}".format(" ".join(make_args), target)) def build(self): - self._patch_sources() - if self._is_msvc or self._is_clang_cl: + apply_conandata_patches(self) + if is_msvc(self) or self._is_clang_cl: self._build_nmake() else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("README", src=self._source_subfolder, dst="licenses", ignore_case=True, keep_path=False) - if (self._is_msvc or self._is_clang_cl): + copy(self, "README", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self) or self._is_clang_cl: for filename in ["jpeglib.h", "jerror.h", "jconfig.h", "jmorecfg.h"]: - self.copy(pattern=filename, dst="include", src=self._source_subfolder, keep_path=False) + copy(self, filename, src=self.source_folder, dst=os.path.join(self.package_folder, "include"), keep_path=False) - self.copy(pattern="*.lib", dst="lib", src=self._source_subfolder, keep_path=False) + copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) if self.options.shared: - self.copy(pattern="*.dll", dst="bin", src=self._source_subfolder, keep_path=False) + copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() if self.settings.os == "Windows" and self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*[!.dll]") + rm(self, "*[!.dll]", os.path.join(self.package_folder, "bin")) else: - tools.rmdir(os.path.join(self.package_folder, "bin")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "bin")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) for fn in ("jpegint.h", "transupp.h",): - self.copy(fn, src=self._source_subfolder, dst="include") + copy(self, fn, src=self.source_folder, dst=os.path.join(self.package_folder, "include")) for fn in ("jinclude.h", "transupp.c",): - self.copy(fn, src=self._source_subfolder, dst="res") + copy(self, fn, src=self.source_folder, dst=os.path.join(self.package_folder, "res")) # Remove export decorations of transupp symbols for relpath in os.path.join("include", "transupp.h"), os.path.join("res", "transupp.c"): path = os.path.join(self.package_folder, relpath) - tools.save(path, re.subn(r"(?:EXTERN|GLOBAL)\(([^)]+)\)", r"\1", tools.load(path))[0]) + save(self, path, re.subn(r"(?:EXTERN|GLOBAL)\(([^)]+)\)", r"\1", load(self, path))[0]) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "JPEG") self.cpp_info.set_property("cmake_target_name", "JPEG::JPEG") self.cpp_info.set_property("pkg_config_name", "libjpeg") + prefix = "lib" if is_msvc(self) or self._is_clang_cl else "" + self.cpp_info.libs = [f"{prefix}jpeg"] + self.cpp_info.resdirs = ["res"] + if not self.options.shared: + self.cpp_info.defines.append("LIBJPEG_STATIC") + # TODO: to remove in conan v2 once legacy generators removed self.cpp_info.names["cmake_find_package"] = "JPEG" self.cpp_info.names["cmake_find_package_multi"] = "JPEG" - - if (self._is_msvc or self._is_clang_cl): - self.cpp_info.libs = ["libjpeg"] - else: - self.cpp_info.libs = ["jpeg"] - if not self.options.shared: - self.cpp_info.defines.append("LIBJPEG_STATIC") diff --git a/recipes/libjpeg/all/patches/0001-9e-libjpeg-add-msvc-dll-support.patch b/recipes/libjpeg/all/patches/0001-9e-libjpeg-add-msvc-dll-support.patch new file mode 100644 index 0000000000000..c3f634ab1ed84 --- /dev/null +++ b/recipes/libjpeg/all/patches/0001-9e-libjpeg-add-msvc-dll-support.patch @@ -0,0 +1,92 @@ +--- jmorecfg.h ++++ jmorecfg.h +@@ -238,14 +238,26 @@ + * or code profilers that require it. + */ + ++#if defined(_MSC_VER) ++#if defined(LIBJPEG_STATIC) ++#define LIBJPEG_EXPORTS ++#elif !defined(LIBJPEG_BUILDING) ++#define LIBJPEG_EXPORTS __declspec(dllimport) ++#else ++#define LIBJPEG_EXPORTS __declspec(dllexport) ++#endif ++#else ++#define LIBJPEG_EXPORTS ++#endif ++ + /* a function called through method pointers: */ + #define METHODDEF(type) static type + /* a function used only in its module: */ + #define LOCAL(type) static type + /* a function referenced thru EXTERNs: */ +-#define GLOBAL(type) type ++#define GLOBAL(type) LIBJPEG_EXPORTS type + /* a reference to a GLOBAL function: */ +-#define EXTERN(type) extern type ++#define EXTERN(type) extern GLOBAL(type) + + + /* This macro is used to declare a "method", that is, a function pointer. + +--- makefile.vc ++++ makefile.vc +@@ -30,6 +30,7 @@ + # miscellaneous OS-dependent stuff + # file deletion command + RM= del ++MKDIR=mkdir + + # End of configurable options. + +@@ -108,20 +109,30 @@ + $(cc) $(CFLAGS) $*.c + + +-all: libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe ++all: shared/libjpeg.lib static/libjpeg.lib cjpeg.exe djpeg.exe jpegtran.exe rdjpgcom.exe wrjpgcom.exe + +-libjpeg.lib: $(LIBOBJECTS) +- $(RM) libjpeg.lib +- lib -out:libjpeg.lib $(LIBOBJECTS) ++shared: ++ $(MKDIR) shared ++ ++static: ++ $(MKDIR) static ++ ++static/libjpeg.lib: $(LIBOBJECTS) static ++ $(RM) static\libjpeg.lib ++ lib -out:static/libjpeg.lib $(LIBOBJECTS) ++ ++shared/libjpeg.lib shared/libjpeg-9.dll: $(LIBOBJECTS) shared ++ $(RM) shared\libjpeg.lib shared\libjpeg-9.dll ++ link -DLL -out:shared/libjpeg-9.dll -implib:shared/libjpeg.lib $(LIBOBJECTS) + +-cjpeg.exe: $(COBJECTS) libjpeg.lib +- $(link) $(LDFLAGS) -out:cjpeg.exe $(COBJECTS) libjpeg.lib $(LDLIBS) ++cjpeg.exe: $(COBJECTS) static/libjpeg.lib ++ $(link) $(LDFLAGS) -out:cjpeg.exe $(COBJECTS) static/libjpeg.lib $(LDLIBS) + +-djpeg.exe: $(DOBJECTS) libjpeg.lib +- $(link) $(LDFLAGS) -out:djpeg.exe $(DOBJECTS) libjpeg.lib $(LDLIBS) ++djpeg.exe: $(DOBJECTS) static/libjpeg.lib ++ $(link) $(LDFLAGS) -out:djpeg.exe $(DOBJECTS) static/libjpeg.lib $(LDLIBS) + +-jpegtran.exe: $(TROBJECTS) libjpeg.lib +- $(link) $(LDFLAGS) -out:jpegtran.exe $(TROBJECTS) libjpeg.lib $(LDLIBS) ++jpegtran.exe: $(TROBJECTS) static/libjpeg.lib ++ $(link) $(LDFLAGS) -out:jpegtran.exe $(TROBJECTS) static/libjpeg.lib $(LDLIBS) + + rdjpgcom.exe: rdjpgcom.obj + $(link) $(LDFLAGS) -out:rdjpgcom.exe rdjpgcom.obj $(LDLIBS) +@@ -131,7 +142,7 @@ + + + clean: +- $(RM) *.obj *.exe libjpeg.lib ++ $(RM) *.obj *.exe static\libjpeg.lib shared\libjpeg.lib shared\libjpeg-9.dll + $(RM) testout* + + setup-vc6: diff --git a/recipes/libjpeg/all/test_package/CMakeLists.txt b/recipes/libjpeg/all/test_package/CMakeLists.txt index 6bbc5e332c193..7885c9011ac59 100644 --- a/recipes/libjpeg/all/test_package/CMakeLists.txt +++ b/recipes/libjpeg/all/test_package/CMakeLists.txt @@ -1,19 +1,20 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -if(MSVC) - add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_WARNINGS) -endif() - -find_package(JPEG REQUIRED) +find_package(JPEG REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} JPEG::JPEG) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE JPEG::JPEG) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) +if (MSVC) + target_compile_definitions(${PROJECT_NAME} PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) +endif() -add_executable(test_transupp test_transupp.c "${CONAN_LIBJPEG_ROOT}/res/transupp.c") -target_link_libraries(test_transupp JPEG::JPEG) -set_property(TARGET test_transupp PROPERTY C_STANDARD 99) +if(BUILD_TRANSUPP) + add_executable(test_transupp test_transupp.c ${LIBJPEG_RES_DIR}/transupp.c) + target_link_libraries(test_transupp PRIVATE JPEG::JPEG) + target_compile_features(test_transupp PRIVATE c_std_99) + if (MSVC) + target_compile_definitions(test_transupp PRIVATE _CRT_SECURE_NO_WARNINGS _CRT_NONSTDC_NO_WARNINGS) + endif() +endif() diff --git a/recipes/libjpeg/all/test_package/conanfile.py b/recipes/libjpeg/all/test_package/conanfile.py index 5d40f08406b63..0243933ba22dd 100644 --- a/recipes/libjpeg/all/test_package/conanfile.py +++ b/recipes/libjpeg/all/test_package/conanfile.py @@ -1,25 +1,32 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" @property - def _test_transupp(self): + def _build_transupp(self): # transupp+libjpeg makes use of stdio of the C library. This cannot be used when using a dll libjpeg, built with a static c library. - return not (self.options["libjpeg"].shared and self.settings.compiler == "Visual Studio" and "MT" in self.settings.compiler.runtime) - - def build_requirements(self): - if hasattr(self, "settings_build") and tools.cross_building(self) and \ - self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + return not (self.dependencies["libjpeg"].options.shared and is_msvc(self) and is_msvc_static_runtime(self)) + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TRANSUPP"] = self._build_transupp + if self._build_transupp: + tc.variables["LIBJPEG_RES_DIR"] = self.dependencies["libjpeg"].cpp_info.resdirs[0].replace("\\", "/") + tc.generate() def build(self): cmake = CMake(self) @@ -27,10 +34,11 @@ def build(self): cmake.build() def test(self): - if tools.cross_building(self): - return - img_name = os.path.join(self.source_folder, "testimg.jpg") - out_img = os.path.join(self.build_folder, "outimg.jpg") - self.run("%s %s" % (os.path.join("bin", "test_package"), img_name), run_environment=True) - if self._test_transupp: - self.run("%s %s %s" % (os.path.join("bin", "test_transupp"), img_name, out_img), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + img_name = os.path.join(self.source_folder, "testimg.jpg") + self.run(f"{bin_path} {img_name}", env="conanrun") + test_transupp_path = os.path.join(self.cpp.build.bindirs[0], "test_transupp") + if os.path.exists(test_transupp_path): + out_img = os.path.join(self.build_folder, "outimg.jpg") + self.run(f"{test_transupp_path} {img_name} {out_img}", env="conanrun") diff --git a/recipes/libjpeg/all/test_v1_package/CMakeLists.txt b/recipes/libjpeg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..961b416af6b07 --- /dev/null +++ b/recipes/libjpeg/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libjpeg/all/test_v1_package/conanfile.py b/recipes/libjpeg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..803919e9ca672 --- /dev/null +++ b/recipes/libjpeg/all/test_v1_package/conanfile.py @@ -0,0 +1,31 @@ +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package", "cmake_find_package_multi" + + @property + def _test_transupp(self): + # transupp+libjpeg makes use of stdio of the C library. This cannot be used when using a dll libjpeg, built with a static c library. + return not (self.options["libjpeg"].shared and is_msvc(self) and is_msvc_static_runtime(self)) + + def build(self): + cmake = CMake(self) + cmake.definitions["BUILD_TRANSUPP"] = self._test_transupp + if self._test_transupp: + cmake.definitions["LIBJPEG_RES_DIR"] = os.path.join(self.deps_cpp_info["libjpeg"].rootpath, "res").replace("\\", "/") + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", run_environment=True) + if self._test_transupp: + test_transupp_path = os.path.join("bin", "test_transupp") + out_img = os.path.join(self.build_folder, "outimg.jpg") + self.run(f"{test_transupp_path} {img_name} {out_img}", run_environment=True) diff --git a/recipes/libjpeg/config.yml b/recipes/libjpeg/config.yml index 2c707deb1831f..6c44911f307cd 100644 --- a/recipes/libjpeg/config.yml +++ b/recipes/libjpeg/config.yml @@ -1,4 +1,6 @@ versions: + "9e": + folder: all "9d": folder: all "9c": diff --git a/recipes/libltc/all/conandata.yml b/recipes/libltc/all/conandata.yml index aac3e2964fcab..c5fe4d5f5d812 100644 --- a/recipes/libltc/all/conandata.yml +++ b/recipes/libltc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.2": + url: "https://github.com/x42/libltc/releases/download/v1.3.2/libltc-1.3.2.tar.gz" + sha256: "0a6d42cd6c21e925a27fa560dc45ac80057d275f23342102825909c02d3b1249" "1.3.1": url: "https://github.com/x42/libltc/releases/download/v1.3.1/libltc-1.3.1.tar.gz" sha256: "50e63eb3b767151bc0159a3cc5d426d03a42fd69029bc9b3b7c346555f4b709c" diff --git a/recipes/libltc/config.yml b/recipes/libltc/config.yml index 71bf3f0e1bada..27e13c88ce850 100644 --- a/recipes/libltc/config.yml +++ b/recipes/libltc/config.yml @@ -1,3 +1,5 @@ versions: + "1.3.2": + folder: "all" "1.3.1": folder: "all" diff --git a/recipes/libmaxminddb/all/conandata.yml b/recipes/libmaxminddb/all/conandata.yml index e3c0f80605ee6..83c876364326d 100644 --- a/recipes/libmaxminddb/all/conandata.yml +++ b/recipes/libmaxminddb/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.7.1": + url: "https://github.com/maxmind/libmaxminddb/releases/download/1.7.1/libmaxminddb-1.7.1.tar.gz" + sha256: "e8414f0dedcecbc1f6c31cb65cd81650952ab0677a4d8c49cab603b3b8fb083e" "1.6.0": url: "https://github.com/maxmind/libmaxminddb/releases/download/1.6.0/libmaxminddb-1.6.0.tar.gz" sha256: "7620ac187c591ce21bcd7bf352376a3c56a933e684558a1f6bef4bd4f3f98267" diff --git a/recipes/libmaxminddb/all/conanfile.py b/recipes/libmaxminddb/all/conanfile.py index b892fd003142a..7afd56f70e087 100644 --- a/recipes/libmaxminddb/all/conanfile.py +++ b/recipes/libmaxminddb/all/conanfile.py @@ -1,19 +1,17 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get, rmdir import os -required_conan_version = ">=1.50.0" - +required_conan_version = ">=1.52.0" class LibmaxminddbConan(ConanFile): name = "libmaxminddb" + description = "C library for the MaxMind DB file format" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "http://maxmind.github.io/libmaxminddb/" - description = "C library for the MaxMind DB file format" topics = ("maxmind", "geoip") - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,8 +23,7 @@ class LibmaxminddbConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -34,7 +31,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass try: del self.settings.compiler.libcxx except Exception: @@ -69,6 +69,7 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "maxminddb") diff --git a/recipes/libmaxminddb/config.yml b/recipes/libmaxminddb/config.yml index 225152169dbd8..9efd2189b76e9 100644 --- a/recipes/libmaxminddb/config.yml +++ b/recipes/libmaxminddb/config.yml @@ -1,3 +1,5 @@ versions: + "1.7.1": + folder: all "1.6.0": folder: all diff --git a/recipes/libmetalink/all/conanfile.py b/recipes/libmetalink/all/conanfile.py index 63100da25eaeb..26b6f8a3d9655 100644 --- a/recipes/libmetalink/all/conanfile.py +++ b/recipes/libmetalink/all/conanfile.py @@ -1,10 +1,14 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class LibmetalinkConan(ConanFile): @@ -14,7 +18,7 @@ class LibmetalinkConan(ConanFile): "It supports both Metalink version 3 and Metalink version 4 (RFC 5854)." ) license = "MIT" - topics = ("libmetalink", "metalink", "xml") + topics = ("metalink", "xml") homepage = "https://launchpad.net/libmetalink" url = "https://github.com/conan-io/conan-center-index" @@ -30,96 +34,85 @@ class LibmetalinkConan(ConanFile): "xml_backend": "expat", } - generators = "pkg_config" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.xml_backend == "expat": - self.requires("expat/2.4.6") - if self.options.xml_backend == "libxml2": - self.requires("libxml2/2.9.12") + self.requires("expat/2.4.9") + elif self.options.xml_backend == "libxml2": + self.requires("libxml2/2.9.14") def validate(self): - if self._is_msvc: - raise ConanInvalidConfiguration("libmetalink does not support Visual Studio yet") + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support Visual Studio yet") def build_requirements(self): - self.build_requires("gnu-config/cci.20201022") - self.build_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("gnu-config/cci.20210814") + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _patch_sources(self): - # Support more configurations - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - # Relocatable shared lib for Apple platforms - tools.replace_in_file( - os.path.join(self._source_subfolder, "configure"), - "-install_name \\$rpath/", - "-install_name @rpath/", - ) - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-shared={}".format(yes_no(self.options.shared)), - "--with-libexpat={}".format(yes_no(self.options.xml_backend == "expat")), - "--with-libxml2={}".format(yes_no(self.options.xml_backend == "libxml2")), + tc.configure_args.extend([ + f"--with-libexpat={yes_no(self.options.xml_backend == 'expat')}", + f"--with-libxml2={yes_no(self.options.xml_backend == 'libxml2')}", "ac_cv_func_malloc_0_nonnull=yes", - ] - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + ]) + tc.generate() + + deps = PkgConfigDeps(self) + deps.generate() + + def _patch_sources(self): + # Support more configurations + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) def build(self): self._patch_sources() - with tools.run_environment(self): - autotools = self._configure_autotools() - autotools.make() + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - with tools.run_environment(self): - autotools = self._configure_autotools() - autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libmetalink") diff --git a/recipes/libmetalink/all/test_package/CMakeLists.txt b/recipes/libmetalink/all/test_package/CMakeLists.txt index 51d13967bfde8..3327ee2e69390 100644 --- a/recipes/libmetalink/all/test_package/CMakeLists.txt +++ b/recipes/libmetalink/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libmetalink REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libmetalink::libmetalink) +target_link_libraries(${PROJECT_NAME} PRIVATE libmetalink::libmetalink) diff --git a/recipes/libmetalink/all/test_package/conanfile.py b/recipes/libmetalink/all/test_package/conanfile.py index 697dfef261b53..0a6bc68712d90 100644 --- a/recipes/libmetalink/all/test_package/conanfile.py +++ b/recipes/libmetalink/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmetalink/all/test_v1_package/CMakeLists.txt b/recipes/libmetalink/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libmetalink/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmetalink/all/test_v1_package/conanfile.py b/recipes/libmetalink/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libmetalink/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libmicrohttpd/all/conandata.yml b/recipes/libmicrohttpd/all/conandata.yml new file mode 100644 index 0000000000000..ead353a01eb87 --- /dev/null +++ b/recipes/libmicrohttpd/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "0.9.75": + url: "https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.75.tar.gz" + sha256: "9278907a6f571b391aab9644fd646a5108ed97311ec66f6359cebbedb0a4e3bb" +patches: + "0.9.75": + - patch_file: "patches/0.9.75-0001-allow-release-with-debug-runtime.patch" + patch_description: "Allow to build Release with Debug runtime" + patch_type: "conan" diff --git a/recipes/libmicrohttpd/all/conanfile.py b/recipes/libmicrohttpd/all/conanfile.py new file mode 100644 index 0000000000000..82ca43a61b7ad --- /dev/null +++ b/recipes/libmicrohttpd/all/conanfile.py @@ -0,0 +1,192 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain +import os + +required_conan_version = ">=1.54.0" + + +class LibmicrohttpdConan(ConanFile): + name = "libmicrohttpd" + description = "A small C library that is supposed to make it easy to run an HTTP server" + homepage = "https://www.gnu.org/software/libmicrohttpd/" + topics = ("httpd", "server", "service") + license = "LGPL-2.1" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_https": [True, False], + "with_error_messages": [True, False], + "with_postprocessor": [True, False], + "with_digest_authentification": [True, False], + "epoll": [True, False], + "with_zlib": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_https": False, # FIXME: should be True, but gnutls is not yet available in cci + "with_error_messages": True, + "with_postprocessor": True, + "with_digest_authentification": True, + "epoll": True, + "with_zlib": True, + } + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + if self.settings.os != "Linux": + del self.options.epoll + if is_msvc(self): + del self.options.with_https + del self.options.with_error_messages + del self.options.with_postprocessor + del self.options.with_digest_authentification + del self.options.with_zlib + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + if self.options.get_safe("with_zlib"): + self.requires("zlib/1.2.13") + + def validate(self): + if is_msvc(self) and self.settings.arch not in ("x86", "x86_64"): + raise ConanInvalidConfiguration("Unsupported architecture (only x86 and x86_64 are supported)") + if self.options.get_safe("with_https"): + raise ConanInvalidConfiguration("gnutls is not (yet) available in cci") + + def build_requirements(self): + if self._settings_build.os == "Windows" and not is_msvc(self): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msvc_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() + else: + VirtualBuildEnv(self).generate() + if not cross_building(self): + VirtualRunEnv(self).generate(scope="build") + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--enable-shared={yes_no(self.options.shared)}", + f"--enable-static={yes_no(not self.options.shared)}", + f"--enable-https={yes_no(self.options.with_https)}", + f"--enable-messages={yes_no(self.options.with_error_messages)}", + f"--enable-postprocessor={yes_no(self.options.with_postprocessor)}", + f"--enable-dauth={yes_no(self.options.with_digest_authentification)}", + f"--enable-epoll={yes_no(self.options.get_safe('epoll'))}", + "--disable-doc", + "--disable-examples", + "--disable-curl", + ]) + tc.generate() + AutotoolsDeps(self).generate() + + @property + def _msvc_configuration(self): + prefix = "Debug" if self.settings.build_type == "Debug" else "Release" + suffix = "dll" if self.options.shared else "static" + return f"{prefix}-{suffix}" + + @property + def _msvc_sln_folder(self): + # TODO: use VS-Any-Version folder once https://github.com/conan-io/conan/pull/12817 available in conan client + return os.path.join(self.source_folder, "w32", "VS2022") + + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + vcxproj_file = os.path.join(self._msvc_sln_folder, "libmicrohttpd.vcxproj") + replace_in_file( + self, vcxproj_file, + "true", + "", + ) + toolset = MSBuildToolchain(self).toolset + replace_in_file( + self, vcxproj_file, + "v143", + f"{toolset}", + ) + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file( + self, vcxproj_file, + "", + f"", + ) + #============================== + + msbuild = MSBuild(self) + msbuild.build_type = self._msvc_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(sln=os.path.join(self._msvc_sln_folder, "libmicrohttpd.sln"), targets=["libmicrohttpd"]) + else: + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + output_dir = os.path.join(self._msvc_sln_folder, "Output") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.h", src=output_dir, dst=os.path.join(self.package_folder, "include"), keep_path=False) + else: + autotools = Autotools(self) + autotools.install() + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libmicrohttps") + libname = "microhttpd" + if is_msvc(self): + libname = "libmicrohttpd" + if self.options.shared: + libname += "-dll" + if self.settings.build_type == "Debug": + libname += "_d" + self.cpp_info.libs = [libname] + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.system_libs = ["pthread"] + elif self.settings.os == "Windows": + if self.options.shared: + self.cpp_info.defines.append("MHD_W32DLL") + self.cpp_info.system_libs = ["ws2_32"] diff --git a/recipes/libmicrohttpd/all/patches/0.9.75-0001-allow-release-with-debug-runtime.patch b/recipes/libmicrohttpd/all/patches/0.9.75-0001-allow-release-with-debug-runtime.patch new file mode 100644 index 0000000000000..1f25b932b8a7a --- /dev/null +++ b/recipes/libmicrohttpd/all/patches/0.9.75-0001-allow-release-with-debug-runtime.patch @@ -0,0 +1,11 @@ +--- src/microhttpd/mhd_assert.h ++++ src/microhttpd/mhd_assert.h +@@ -35,7 +35,7 @@ + #define NDEBUG 1 /* Use NDEBUG by default */ + #endif /* !_DEBUG && !NDEBUG */ + #if defined(_DEBUG) && defined(NDEBUG) +-#error Both _DEBUG and NDEBUG are defined ++//#error Both _DEBUG and NDEBUG are defined + #endif /* _DEBUG && NDEBUG */ + #ifdef NDEBUG + # define mhd_assert(ignore) ((void) 0) diff --git a/recipes/libmicrohttpd/all/test_package/CMakeLists.txt b/recipes/libmicrohttpd/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..534adba0c584f --- /dev/null +++ b/recipes/libmicrohttpd/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libmicrohttpd REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libmicrohttpd::libmicrohttpd) diff --git a/recipes/libmicrohttpd/all/test_package/conanfile.py b/recipes/libmicrohttpd/all/test_package/conanfile.py new file mode 100644 index 0000000000000..98ab55852ad56 --- /dev/null +++ b/recipes/libmicrohttpd/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmicrohttpd/all/test_package/test_package.c b/recipes/libmicrohttpd/all/test_package/test_package.c new file mode 100644 index 0000000000000..cb40829c7a43b --- /dev/null +++ b/recipes/libmicrohttpd/all/test_package/test_package.c @@ -0,0 +1,74 @@ +#include +#include +#include +#include + +#define PORT 8888 +#define PAGE \ + "" \ + "" \ + "libmicrohttpd demo" \ + "" \ + "" \ + "libmicrohttpd demo" \ + "" \ + "" + +static enum MHD_Result ahc_echo(void * cls, + struct MHD_Connection *connection, + const char *url, + const char *method, + const char *version, + const char *upload_data, + long unsigned int *upload_data_size, + void **con_cls) { + struct MHD_Response *response; + int ret; + + if (strcmp(method, "GET") != 0) { + /** + * unexpected method + */ + return MHD_NO; + } + if (*con_cls == NULL) { + /** + * The first time only the headers are valid, + * do not respond in the first round. + * But accept the connection. + */ + *con_cls = connection; + return MHD_YES; + } + if (*upload_data_size != 0) { + /** + * upload data in a GET!? + */ + return MHD_NO; + } + response = MHD_create_response_from_buffer(strlen(PAGE), (void*)PAGE, MHD_RESPMEM_PERSISTENT); + ret = MHD_queue_response(connection, MHD_HTTP_OK, response); + MHD_destroy_response(response); + return ret; +} + +int main(int argc, char *argv[]) { + struct MHD_Daemon *daemon; + + // Don't open a port and do not block so CI isn't interrupted. +#if 0 + daemon = MHD_start_daemon(MHD_USE_INTERNAL_POLLING_THREAD, + PORT, NULL, NULL, + &ahc_echo, NULL, MHD_OPTION_END); + if (daemon == NULL) { + return 1; + } + + (void)getchar(); +#else + daemon = NULL; +#endif + + MHD_stop_daemon(daemon); + return 0; +} diff --git a/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt b/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libmicrohttpd/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmicrohttpd/all/test_v1_package/conanfile.py b/recipes/libmicrohttpd/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libmicrohttpd/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libmicrohttpd/config.yml b/recipes/libmicrohttpd/config.yml new file mode 100644 index 0000000000000..48e6a23d34df6 --- /dev/null +++ b/recipes/libmicrohttpd/config.yml @@ -0,0 +1,3 @@ +versions: + "0.9.75": + folder: all diff --git a/recipes/libmodbus/all/conandata.yml b/recipes/libmodbus/all/conandata.yml index 53ef0226d6976..176711066e07f 100644 --- a/recipes/libmodbus/all/conandata.yml +++ b/recipes/libmodbus/all/conandata.yml @@ -1,8 +1,12 @@ sources: + "3.1.8": + url: "https://github.com/stephane/libmodbus/releases/download/v3.1.8/libmodbus-3.1.8.tar.gz" + sha256: "b122f2bc29f749702a22c0a760a7ca2182d541f5fa26bf25e3431f907b606f3c" "3.1.6": url: "https://libmodbus.org/releases/libmodbus-3.1.6.tar.gz" sha256: "d7d9fa94a16edb094e5fdf5d87ae17a0dc3f3e3d687fead81835d9572cf87c16" patches: + "3.1.8": + - patch_file: "patches/3.1.8-0001-msvc-fixes.patch" "3.1.6": - - patch_file: "patches/0001-msvc-fixes.patch" - base_path: "source_subfolder" + - patch_file: "patches/3.1.6-0001-msvc-fixes.patch" diff --git a/recipes/libmodbus/all/conanfile.py b/recipes/libmodbus/all/conanfile.py index a5a6aadf80901..6ec4cc6934e03 100644 --- a/recipes/libmodbus/all/conanfile.py +++ b/recipes/libmodbus/all/conanfile.py @@ -1,18 +1,25 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from contextlib import contextmanager +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" + +required_conan_version = ">=1.52.0" class LibmodbusConan(ConanFile): name = "libmodbus" description = "libmodbus is a free software library to send/receive data according to the Modbus protocol" homepage = "https://libmodbus.org/" - topics = ("conan", "libmodbus", "modbus", "protocol", "industry", "automation") + topics = ("modbus", "protocol", "industry", "automation") license = "LGPL-2.1" url = "https://github.com/conan-io/conan-center-index" - exports_sources = "patches/**" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,15 +30,16 @@ class LibmodbusConan(ConanFile): "fPIC": True, } - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property - def _settings_build(self): - return self.settings_build if hasattr(self, "settings_build") else self.settings + def _user_info_build(self): + return getattr(self, "user_info_build", self.deps_user_info) + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,85 +47,90 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if self.settings.compiler == "Visual Studio": - self.build_requires("automake/1.16.3") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("automake/1.16.5") + if self._settings_build.os == "Windows": + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + self.tool_requires("msys2/cci.latest") + self.win_bash = True def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - conf_args = [ - "--disable-tests", - "--without-documentation", - "--prefix={}".format(tools.unix_path(self.package_folder)), - ] - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) - else: - conf_args.extend(["--enable-static", "--disable-shared"]) - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) >= "12": - if self.settings.build_type in ("Debug", "RelWithDebInfo"): - self._autotools.flags.append("-FS") - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools - - @contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - env = { - "CC": "cl -nologo", - "CXX": "cl -nologo", - "LD": "link -nologo", - "AR": "{} \"lib -nologo -verbose\"".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)), - "RANLIB": ":", - "STRING": ":", - "NM": "dumpbin -symbols"} - with tools.environment_append(env): - yield - else: - yield + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + if Version(self.version) < "3.1.8": + tc.configure_args.append("--without-documentation") + tc.configure_args.append("--disable-tests") + if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + tc.generate() + + if is_msvc(self): + env = Environment() + compile_wrapper = unix_path(self, os.path.join(self.source_folder, "build-aux", "compile")) + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("LD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + env.vars(self).save_script("conanbuild_libmodbus_msvc") def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if not self.options.shared: for decl in ("__declspec(dllexport)", "__declspec(dllimport)"): - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "modbus.h"), decl, "") + replace_in_file(self, os.path.join(self.source_folder, "src", "modbus.h"), decl, "") def build(self): self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING*", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - - os.unlink(os.path.join(self.package_folder, "lib", "libmodbus.la")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - if self.settings.compiler == "Visual Studio" and self.options.shared: - tools.rename(os.path.join(self.package_folder, "lib", "modbus.dll.lib"), - os.path.join(self.package_folder, "lib", "modbus.lib")) + copy(self, pattern="COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # see https://github.com/conan-io/conan/issues/12006 + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) + if is_msvc(self) and self.options.shared: + rename(self, + os.path.join(self.package_folder, "lib", "modbus.dll.lib"), + os.path.join(self.package_folder, "lib", "modbus.lib")) def package_info(self): - self.cpp_info.names["pkg_config"] = "libmodbus" - self.cpp_info.includedirs.append(os.path.join("include", "modbus")) + self.cpp_info.set_property("pkg_config_name", "libmodbus") self.cpp_info.libs = ["modbus"] + self.cpp_info.includedirs.append(os.path.join("include", "modbus")) if self.settings.os == "Windows" and not self.options.shared: - self.cpp_info.system_libs = ["wsock32"] + self.cpp_info.system_libs = ["ws2_32"] diff --git a/recipes/libmodbus/all/patches/0001-msvc-fixes.patch b/recipes/libmodbus/all/patches/0001-msvc-fixes.patch deleted file mode 100644 index ef34b4f272cf0..0000000000000 --- a/recipes/libmodbus/all/patches/0001-msvc-fixes.patch +++ /dev/null @@ -1,23 +0,0 @@ ---- src/Makefile.in -+++ src/Makefile.in -@@ -327,7 +327,7 @@ - localstatedir = @localstatedir@ - mandir = @mandir@ - mkdir_p = @mkdir_p@ --my_CFLAGS = @my_CFLAGS@ -+my_CFLAGS = - oldincludedir = @oldincludedir@ - pdfdir = @pdfdir@ - prefix = @prefix@ -diff -ur source_original/source_subfolder/src/modbus-private.h source/source_subfolder/src/modbus-private.h ---- src/modbus-private.h -+++ src/modbus-private.h -@@ -13,7 +13,7 @@ - #else - # include "stdint.h" - # include --typedef int ssize_t; -+//typedef int ssize_t; - #endif - #include - #include diff --git a/recipes/libmodbus/all/patches/3.1.6-0001-msvc-fixes.patch b/recipes/libmodbus/all/patches/3.1.6-0001-msvc-fixes.patch new file mode 100644 index 0000000000000..de64a8e50f76f --- /dev/null +++ b/recipes/libmodbus/all/patches/3.1.6-0001-msvc-fixes.patch @@ -0,0 +1,22 @@ +--- src/Makefile.in ++++ src/Makefile.in +@@ -327,7 +327,7 @@ + localstatedir = @localstatedir@ + mandir = @mandir@ + mkdir_p = @mkdir_p@ +-my_CFLAGS = @my_CFLAGS@ ++my_CFLAGS = + oldincludedir = @oldincludedir@ + pdfdir = @pdfdir@ + prefix = @prefix@ +--- src/modbus-private.h ++++ src/modbus-private.h +@@ -13,7 +13,7 @@ + #else + # include "stdint.h" + # include +-typedef int ssize_t; ++//typedef int ssize_t; + #endif + #include + #include diff --git a/recipes/libmodbus/all/patches/3.1.8-0001-msvc-fixes.patch b/recipes/libmodbus/all/patches/3.1.8-0001-msvc-fixes.patch new file mode 100644 index 0000000000000..376a6b3f1ea82 --- /dev/null +++ b/recipes/libmodbus/all/patches/3.1.8-0001-msvc-fixes.patch @@ -0,0 +1,22 @@ +--- src/Makefile.in ++++ src/Makefile.in +@@ -326,7 +326,7 @@ + localstatedir = @localstatedir@ + mandir = @mandir@ + mkdir_p = @mkdir_p@ +-my_CFLAGS = @my_CFLAGS@ ++my_CFLAGS = + oldincludedir = @oldincludedir@ + pdfdir = @pdfdir@ + prefix = @prefix@ +--- src/modbus-private.h ++++ src/modbus-private.h +@@ -13,7 +13,7 @@ + #else + # include "stdint.h" + # include +-typedef int ssize_t; ++//typedef int ssize_t; + #endif + #include + #include diff --git a/recipes/libmodbus/all/test_package/CMakeLists.txt b/recipes/libmodbus/all/test_package/CMakeLists.txt index 2869c07a9f766..589d598cde656 100644 --- a/recipes/libmodbus/all/test_package/CMakeLists.txt +++ b/recipes/libmodbus/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libmodbus REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libmodbus::libmodbus) diff --git a/recipes/libmodbus/all/test_package/conanfile.py b/recipes/libmodbus/all/test_package/conanfile.py index 43ee017a2330f..49ea0c6cecc47 100644 --- a/recipes/libmodbus/all/test_package/conanfile.py +++ b/recipes/libmodbus/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package"), run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmodbus/all/test_package/test_package.c b/recipes/libmodbus/all/test_package/test_package.c index bedad43c44404..e9bd9b1a77ac6 100644 --- a/recipes/libmodbus/all/test_package/test_package.c +++ b/recipes/libmodbus/all/test_package/test_package.c @@ -1,4 +1,4 @@ -#include +#include #include #include diff --git a/recipes/libmodbus/all/test_v1_package/CMakeLists.txt b/recipes/libmodbus/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..d03cbd8daf516 --- /dev/null +++ b/recipes/libmodbus/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(libmodbus CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libmodbus::libmodbus) diff --git a/recipes/libmodbus/all/test_v1_package/conanfile.py b/recipes/libmodbus/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a691174f8ed16 --- /dev/null +++ b/recipes/libmodbus/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + diff --git a/recipes/libmodbus/config.yml b/recipes/libmodbus/config.yml index 150202a06b911..49c098a9b7d41 100644 --- a/recipes/libmodbus/config.yml +++ b/recipes/libmodbus/config.yml @@ -1,3 +1,5 @@ versions: + "3.1.8": + folder: all "3.1.6": folder: all diff --git a/recipes/libmount/all/conanfile.py b/recipes/libmount/all/conanfile.py index 702eea4036f89..301b7a46d28de 100644 --- a/recipes/libmount/all/conanfile.py +++ b/recipes/libmount/all/conanfile.py @@ -1,62 +1,77 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.53.0" + class LibmountConan(ConanFile): name = "libmount" - description = "The libmount library is used to parse /etc/fstab, /etc/mtab and /proc/self/mountinfo files, manage the mtab file, evaluate mount options, etc" - topics = ("conan", "mount", "libmount", "linux", "util-linux") + description = ( + "The libmount library is used to parse /etc/fstab, /etc/mtab and " + "/proc/self/mountinfo files, manage the mtab file, evaluate mount options, etc" + ) + topics = ("mount", "linux", "util-linux") url = "https://github.com/conan-io/conan-center-index" homepage = "https://git.kernel.org/pub/scm/utils/util-linux/util-linux.git" license = "GPL-2.0-or-later" + settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - _source_subfolder = "source_subfolder" - _autotools = None + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def configure(self): if self.options.shared: del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("only Linux is supported") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if self.info.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "util-linux-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _configure_autotools(self): - if not self._autotools: - args = ["--disable-all-programs", "--enable-libmount", "--enable-libblkid"] - if self.options.shared: - args.extend(["--disable-static", "--enable-shared"]) - else: - args.extend(["--disable-shared", "--enable-static"]) - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.configure(args=args) - return self._autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + "--disable-all-programs", + "--enable-libmount", + "--enable-libblkid", + ]) + tc.generate() def build(self): - with tools.chdir(self._source_subfolder): - env_build = self._configure_autotools() - env_build.make() + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - with tools.chdir(self._source_subfolder): - env_build = self._configure_autotools() - env_build.install() - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "sbin")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - os.remove(os.path.join(self.package_folder, "lib", "libblkid.la")) - os.remove(os.path.join(self.package_folder, "lib", "libmount.la")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "sbin")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "usr")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.libs = ["mount", "blkid"] + self.cpp_info.system_libs = ["rt"] self.cpp_info.includedirs.append(os.path.join("include", "libmount")) self.cpp_info.set_property("pkg_config_name", "mount") diff --git a/recipes/libmount/all/test_package/CMakeLists.txt b/recipes/libmount/all/test_package/CMakeLists.txt index 07c73ca721730..79b7610d1fb9b 100644 --- a/recipes/libmount/all/test_package/CMakeLists.txt +++ b/recipes/libmount/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libmount REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libmount::libmount) diff --git a/recipes/libmount/all/test_package/conanfile.py b/recipes/libmount/all/test_package/conanfile.py index bd7165a553cf4..0a6bc68712d90 100644 --- a/recipes/libmount/all/test_package/conanfile.py +++ b/recipes/libmount/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmount/all/test_package/test_package.c b/recipes/libmount/all/test_package/test_package.c new file mode 100644 index 0000000000000..d4e4d653742e8 --- /dev/null +++ b/recipes/libmount/all/test_package/test_package.c @@ -0,0 +1,16 @@ +#include + +#include +#include + +int main() +{ + struct libmnt_context *ctx = mnt_new_context(); + if (!ctx) { + printf("failed to initialize libmount\n"); + return EXIT_FAILURE; + } + printf("path to fstab: %s", mnt_get_fstab_path()); + mnt_free_context(ctx); + return EXIT_SUCCESS; +} diff --git a/recipes/libmount/all/test_package/test_package.cpp b/recipes/libmount/all/test_package/test_package.cpp deleted file mode 100644 index ffaa9287dac66..0000000000000 --- a/recipes/libmount/all/test_package/test_package.cpp +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include -#include - -int main() -{ - struct libmnt_context *ctx = mnt_new_context(); - if (!ctx) { - std::cerr << "failed to initialize libmount\n"; - return EXIT_FAILURE; - } - std::cout << "path to fstab: " << mnt_get_fstab_path() << std::endl; - mnt_free_context(ctx); - return EXIT_SUCCESS; -} diff --git a/recipes/libmount/all/test_v1_package/CMakeLists.txt b/recipes/libmount/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libmount/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmount/all/test_v1_package/conanfile.py b/recipes/libmount/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libmount/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libmp3lame/all/conandata.yml b/recipes/libmp3lame/all/conandata.yml index 7e4efc5251ea5..ccb693b07c678 100644 --- a/recipes/libmp3lame/all/conandata.yml +++ b/recipes/libmp3lame/all/conandata.yml @@ -5,8 +5,13 @@ sources: patches: "3.100": - patch_file: "patches/6410.patch" - base_path: "source_subfolder" + patch_type: "backport" + patch_description: "bug tracker item #487: v3.100 breaks Windows compatibility" + patch_source: "https://sourceforge.net/p/lame/svn/commit_browser -- [r6410]" - patch_file: "patches/6416.patch" - base_path: "source_subfolder" + patch_type: "backport" + patch_description: "lame patches ticket #75: Fix for completing svn-r6410" + patch_source: "https://sourceforge.net/p/lame/svn/commit_browser -- [r6410]" - patch_file: "patches/android.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Add __ANDROID__ test to one bit" diff --git a/recipes/libmp3lame/all/conanfile.py b/recipes/libmp3lame/all/conanfile.py index 3728a80aeffaf..d8a366c7eb019 100644 --- a/recipes/libmp3lame/all/conanfile.py +++ b/recipes/libmp3lame/all/conanfile.py @@ -1,11 +1,14 @@ -from conan.tools.files import rename -from conans import ConanFile, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment, tools -from contextlib import contextmanager -import functools +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, NMakeToolchain import os import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.55.0" class LibMP3LameConan(ConanFile): @@ -13,7 +16,7 @@ class LibMP3LameConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "LAME is a high quality MPEG Audio Layer III (MP3) encoder licensed under the LGPL." homepage = "http://lame.sourceforge.net" - topics = ("libmp3lame", "multimedia", "audio", "mp3", "decoder", "encoding", "decoding") + topics = "multimedia", "audio", "mp3", "decoder", "encoding", "decoding" license = "LGPL-2.0" settings = "os", "arch", "compiler", "build_type" @@ -26,29 +29,16 @@ class LibMP3LameConan(ConanFile): "fPIC": True, } - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _is_clang_cl(self): return str(self.settings.compiler) in ["clang"] and str(self.settings.os) in ['Windows'] - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -56,112 +46,105 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if not self._is_msvc and not self._is_clang_cl: - self.build_requires("gnu-config/cci.20201022") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not is_msvc(self) and not self._is_clang_cl: + self.tool_requires("gnu-config/cci.20210814") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _apply_patch(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.replace_in_file(os.path.join(self._source_subfolder, "include", "libmp3lame.sym"), "lame_init_old\n", "") + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @contextmanager - def _msvc_build_environment(self): - with tools.chdir(self._source_subfolder): - with tools.vcvars(self.settings): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - yield + def generate(self): + if is_msvc(self) or self._is_clang_cl: + tc = NMakeToolchain(self) + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-frontend") + if self.settings.compiler == "clang" and self.settings.arch in ["x86", "x86_64"]: + tc.extra_cxxflags.extend(["-mmmx", "-msse"]) + tc.generate() def _build_vs(self): - with self._msvc_build_environment(): - shutil.copy("configMS.h", "config.h") + with chdir(self, self.source_folder): + shutil.copy2("configMS.h", "config.h") # Honor vc runtime - tools.replace_in_file("Makefile.MSVC", "CC_OPTS = $(CC_OPTS) /MT", "") + replace_in_file(self, "Makefile.MSVC", "CC_OPTS = $(CC_OPTS) /MT", "") # Do not hardcode LTO - tools.replace_in_file("Makefile.MSVC", " /GL", "") - tools.replace_in_file("Makefile.MSVC", " /LTCG", "") - tools.replace_in_file("Makefile.MSVC", "ADDL_OBJ = bufferoverflowU.lib", "") + replace_in_file(self, "Makefile.MSVC", " /GL", "") + replace_in_file(self, "Makefile.MSVC", " /LTCG", "") + replace_in_file(self, "Makefile.MSVC", "ADDL_OBJ = bufferoverflowU.lib", "") command = "nmake -f Makefile.MSVC comp=msvc" if self._is_clang_cl: - cl = os.environ.get('CC', "clang-cl") - link = os.environ.get("LD", 'lld-link') - tools.replace_in_file('Makefile.MSVC', 'CC = cl', 'CC = %s' % cl) - tools.replace_in_file('Makefile.MSVC', 'LN = link', 'LN = %s' % link) + compilers_from_conf = self.conf.get("tools.build:compiler_executables", default={}, check_type=dict) + buildenv_vars = VirtualBuildEnv(self).vars() + cl = compilers_from_conf.get("c", buildenv_vars.get("CC", "clang-cl")) + link = buildenv_vars.get("LD", "lld-link") + replace_in_file(self, "Makefile.MSVC", "CC = cl", f"CC = {cl}") + replace_in_file(self, "Makefile.MSVC", "LN = link", f"LN = {link}") # what is /GAy? MSDN doesn't know it # clang-cl: error: no such file or directory: '/GAy' # https://docs.microsoft.com/en-us/cpp/build/reference/ga-optimize-for-windows-application?view=msvc-170 - tools.replace_in_file('Makefile.MSVC', '/GAy', '/GA') + replace_in_file(self, "Makefile.MSVC", "/GAy", "/GA") if self.settings.arch == "x86_64": - tools.replace_in_file("Makefile.MSVC", "MACHINE = /machine:I386", "MACHINE =/machine:X64") + replace_in_file(self, "Makefile.MSVC", "MACHINE = /machine:I386", "MACHINE =/machine:X64") command += " MSVCVER=Win64 asm=yes" elif self.settings.arch == "armv8": - tools.replace_in_file("Makefile.MSVC", "MACHINE = /machine:I386", "MACHINE =/machine:ARM64") + replace_in_file(self, "Makefile.MSVC", "MACHINE = /machine:I386", "MACHINE =/machine:ARM64") command += " MSVCVER=Win64" else: command += " asm=yes" command += " libmp3lame.dll" if self.options.shared else " libmp3lame-static.lib" self.run(command) - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--disable-frontend", - ] - if self.settings.build_type == "Debug": - args.append("--enable-debug") - if self.settings.compiler == "clang" and self.settings.arch in ["x86", "x86_64"]: - autotools.flags.extend(["-mmmx", "-msse"]) - autotools.configure(args=args, configure_dir=self._source_subfolder) - return autotools - def _build_autotools(self): - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), - "-install_name \\$rpath/", - "-install_name @rpath/") - autotools = self._configure_autotools() + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) + autotools = Autotools(self) + autotools.configure() autotools.make() def build(self): - self._apply_patch() - if self._is_msvc or self._is_clang_cl: + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "include", "libmp3lame.sym"), "lame_init_old\n", "") + + if is_msvc(self) or self._is_clang_cl: self._build_vs() else: self._build_autotools() def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - if self._is_msvc or self._is_clang_cl: - self.copy(pattern="*.h", src=os.path.join(self._source_subfolder, "include"), dst=os.path.join("include", "lame")) + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder,"licenses")) + if is_msvc(self) or self._is_clang_cl: + copy(self, pattern="*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder,"include", "lame")) name = "libmp3lame.lib" if self.options.shared else "libmp3lame-static.lib" - self.copy(name, src=os.path.join(self._source_subfolder, "output"), dst="lib") + copy(self, name, src=os.path.join(self.source_folder, "output"), dst=os.path.join(self.package_folder,"lib")) if self.options.shared: - self.copy(pattern="*.dll", src=os.path.join(self._source_subfolder, "output"), dst="bin") + copy(self, pattern="*.dll", src=os.path.join(self.source_folder, "output"), dst=os.path.join(self.package_folder,"bin")) rename(self, os.path.join(self.package_folder, "lib", name), os.path.join(self.package_folder, "lib", "mp3lame.lib")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["mp3lame"] diff --git a/recipes/libmp3lame/all/test_package/CMakeLists.txt b/recipes/libmp3lame/all/test_package/CMakeLists.txt index a59f5d862ad46..c1f711f1d8871 100644 --- a/recipes/libmp3lame/all/test_package/CMakeLists.txt +++ b/recipes/libmp3lame/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libmp3lame REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libmp3lame::libmp3lame) +target_link_libraries(${PROJECT_NAME} PRIVATE libmp3lame::libmp3lame) diff --git a/recipes/libmp3lame/all/test_package/conanfile.py b/recipes/libmp3lame/all/test_package/conanfile.py index 697dfef261b53..e845ae751a301 100644 --- a/recipes/libmp3lame/all/test_package/conanfile.py +++ b/recipes/libmp3lame/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmp3lame/all/test_v1_package/CMakeLists.txt b/recipes/libmp3lame/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libmp3lame/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libmp3lame/all/test_v1_package/conanfile.py b/recipes/libmp3lame/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libmp3lame/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libmysqlclient/all/CMakeLists.txt b/recipes/libmysqlclient/all/CMakeLists.txt deleted file mode 100644 index b8a3a9f77e058..0000000000000 --- a/recipes/libmysqlclient/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(../conanbuildinfo.cmake) -conan_basic_setup(NO_OUTPUT_DIRS KEEP_RPATHS) - -include("CMakeListsOriginal.txt") diff --git a/recipes/libmysqlclient/all/conandata.yml b/recipes/libmysqlclient/all/conandata.yml index 05070aeb8765e..e1366afca3907 100644 --- a/recipes/libmysqlclient/all/conandata.yml +++ b/recipes/libmysqlclient/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "8.0.31": + url: "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.31.tar.gz" + sha256: "67bb8cba75b28e95c7f7948563f01fb84528fcbb1a35dba839d4ce44fe019baa" + "8.0.30": + url: "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.30.tar.gz" + sha256: "c988d5c6ba9a56692a6cd6e9813465b5fc9368ed4b461df97059a2fc160c8b84" "8.0.29": url: - "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.29.tar.gz" @@ -7,22 +13,23 @@ sources: "8.0.25": url: "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.25.tar.gz" sha256: "c16aa9cf621bc028efba2bb11f3c36a323b125fa0d108ff92fab60e46309206e" - "8.0.17": - url: "https://dev.mysql.com/get/Downloads/MySQL-8.0/mysql-8.0.17.tar.gz" - sha256: "c6e3f38199a77bfd8a4925ca00b252d3b6159b90e4980c7232f1c58d6ca759d6" patches: + "8.0.31": + - patch_file: "patches/0006-fix-cpp20-build-8.0.29.patch" + patch_description: "Fix C++20 compilation" + patch_type: "portability" + "8.0.30": + - patch_file: "patches/0006-fix-cpp20-build-8.0.29.patch" + patch_description: "Fix C++20 compilation" + patch_type: "portability" "8.0.29": - patch_file: "patches/0006-fix-cpp20-build-8.0.29.patch" - base_path: "source_subfolder" + patch_description: "Fix C++20 compilation" + patch_type: "portability" "8.0.25": - patch_file: "patches/0004-fix-805-cpp17-build.patch" - base_path: "source_subfolder" + patch_description: "Fix C++17 compilation" + patch_type: "portability" - patch_file: "patches/0005-fix-macos-12.0.x-version-detection.patch" - base_path: "source_subfolder" - "8.0.17": - - patch_file: "patches/0001-find-cmake.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-dont-install-static-libraries+fix-mysql-config.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-msvc-install-no-pdb.patch" - base_path: "source_subfolder" + patch_description: "Fix macOS 12.0 version detection" + patch_type: "bugfix" diff --git a/recipes/libmysqlclient/all/conanfile.py b/recipes/libmysqlclient/all/conanfile.py index 70917c76136fb..87f93d9807f95 100644 --- a/recipes/libmysqlclient/all/conanfile.py +++ b/recipes/libmysqlclient/all/conanfile.py @@ -1,12 +1,16 @@ -from conan.tools.microsoft import is_msvc, msvc_runtime_flag -from conan.tools.files import rename -from conan.tools.build import cross_building -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building, stdcpp_library +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.env import VirtualRunEnv, VirtualBuildEnv +from conan.tools.files import rename, get, apply_conandata_patches, replace_in_file, rmdir, rm, export_conandata_patches, copy, mkdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.55.0" class LibMysqlClientCConan(ConanFile): @@ -21,43 +25,26 @@ class LibMysqlClientCConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "with_ssl": [True, False], - "with_zlib": [True, False], } default_options = { "shared": False, "fPIC": True, - "with_ssl": True, - "with_zlib": True, } + package_type = "library" short_paths = True - generators = "cmake", "pkg_config" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _with_zstd(self): - return tools.Version(self.version) > "8.0.17" - - @property - def _with_lz4(self): - return tools.Version(self.version) > "8.0.17" @property def _compilers_minimum_version(self): return { - "Visual Studio": "16" if tools.Version(self.version) > "8.0.17" else "15", - "gcc": "7" if tools.Version(self.version) >= "8.0.27" else "5.3", + "Visual Studio": "16", + "msvc": "192", + "gcc": "7" if Version(self.version) >= "8.0.27" else "5.3", "clang": "6", } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -65,17 +52,16 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - if self.options.with_ssl: - self.requires("openssl/1.1.1q") - if self.options.with_zlib: - self.requires("zlib/1.2.12") - if self._with_zstd: - self.requires("zstd/1.5.2") - if self._with_lz4: - self.requires("lz4/1.9.3") + self.requires("openssl/1.1.1t") + self.requires("zlib/1.2.13") + self.requires("zstd/1.5.4") + self.requires("lz4/1.9.4") if self.settings.os == "FreeBSD": self.requires("libunwind/1.6.2") @@ -88,177 +74,190 @@ def loose_lt_semver(v1, v2): minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("{} {} requires {} {} or newer".format( - self.name, self.version, self.settings.compiler, minimum_version, - )) + raise ConanInvalidConfiguration(f"{self.name} {self.version} requires {self.settings.compiler} {minimum_version} or newer") if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): - raise ConanInvalidConfiguration("Cross compilation not yet supported by the recipe. contributions are welcome.") - - # FIXME: patch libmysqlclient 8.0.17 to support apple-clang >= 12? - # current errors: - # error: expected unqualified-id MYSQL_VERSION_MAJOR=8 - # error: no member named 'ptrdiff_t' in the global namespace - if self.version == "8.0.17" and self.settings.compiler == "apple-clang" and \ - tools.Version(self.settings.compiler.version) >= "12.0": - raise ConanInvalidConfiguration("libmysqlclient 8.0.17 doesn't support apple-clang >= 12.0") + raise ConanInvalidConfiguration("Cross compilation not yet supported by the recipe. Contributions are welcomed.") - # mysql>=8.0.17 doesn't support shared library on MacOS. + # Sice 8.0.17 this doesn't support shared library on MacOS. # https://github.com/mysql/mysql-server/blob/mysql-8.0.17/cmake/libutils.cmake#L333-L335 - if tools.Version(self.version) >= "8.0.17" and self.settings.compiler == "apple-clang" and \ - self.options.shared: - raise ConanInvalidConfiguration("{}/{} doesn't support shared library".format( self.name, self.version)) + if self.settings.compiler == "apple-clang" and self.options.shared: + raise ConanInvalidConfiguration(f"{self.name}/{self.version} doesn't support shared library") # mysql < 8.0.29 uses `requires` in source code. It is the reserved keyword in C++20. # https://github.com/mysql/mysql-server/blob/mysql-8.0.0/include/mysql/components/services/dynamic_loader.h#L270 - if self.settings.compiler.get_safe("cppstd") == "20" and tools.Version(self.version) < "8.0.29": - raise ConanInvalidConfiguration("{}/{} doesn't support C++20".format(self.name, self.version)) + if self.settings.compiler.get_safe("cppstd") == "20" and Version(self.version) < "8.0.29": + raise ConanInvalidConfiguration(f"{self.name}/{self.version} doesn't support C++20") + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False def build_requirements(self): - if tools.Version(self.version) >= "8.0.25" and tools.is_apple_os(self.settings.os): + if is_apple_os(self) and not self._cmake_new_enough("3.18"): # CMake 3.18 or higher is required if Apple, but CI of CCI may run CMake 3.15 - self.build_requires("cmake/3.22.5") - if self.settings.os == "FreeBSD": - self.build_requires("pkgconf/1.7.4") + self.tool_requires("cmake/3.24.3") + if self.settings.os == "FreeBSD" and not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _patch_files(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def _patch_sources(self): + apply_conandata_patches(self) libs_to_remove = ["icu", "libevent", "re2", "rapidjson", "protobuf", "libedit"] - if not self._with_lz4: - libs_to_remove.append("lz4") for lib in libs_to_remove: - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "MYSQL_CHECK_%s()\n" % lib.upper(), - "", - strict=False) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "INCLUDE(%s)\n" % lib, - "", - strict=False) - tools.rmdir(os.path.join(self._source_subfolder, "extra")) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + f"MYSQL_CHECK_{lib.upper()}()\n", + "", + strict=False) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + f"INCLUDE({lib})\n", + "", + strict=False) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + f"WARN_MISSING_SYSTEM_{lib.upper()}({lib.upper()}_WARN_GIVEN)", + f"# WARN_MISSING_SYSTEM_{lib.upper()}({lib.upper()}_WARN_GIVEN)", + strict=False) + + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + f"SET({lib.upper()}_WARN_GIVEN)", + f"# SET({lib.upper()}_WARN_GIVEN)", + strict=False) + + rmdir(self, os.path.join(self.source_folder, "extra")) for folder in ["client", "man", "mysql-test", "libbinlogstandalone"]: - tools.rmdir(os.path.join(self._source_subfolder, folder)) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "ADD_SUBDIRECTORY(%s)\n" % folder, - "", - strict=False) - tools.rmdir(os.path.join(self._source_subfolder, "storage", "ndb")) + rmdir(self, os.path.join(self.source_folder, folder)) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + f"ADD_SUBDIRECTORY({folder})\n", + "", + strict=False) + rmdir(self, os.path.join(self.source_folder, "storage", "ndb")) for t in ["INCLUDE(cmake/boost.cmake)\n", "MYSQL_CHECK_EDITLINE()\n"]: - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - t, - "", - strict=False) - if self._with_zstd: - tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "zstd.cmake"), - "NAMES zstd", - "NAMES zstd %s" % self.deps_cpp_info["zstd"].libs[0]) - - tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "ssl.cmake"), - "NAMES ssl", - "NAMES ssl %s" % self.deps_cpp_info["openssl"].components["ssl"].libs[0]) - - tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "ssl.cmake"), - "NAMES crypto", - "NAMES crypto %s" % self.deps_cpp_info["openssl"].components["crypto"].libs[0]) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + t, + "", + strict=False) + + # Upstream does not actually load lz4 directories for system, force it to + replace_in_file(self, os.path.join(self.source_folder, "libbinlogevents", "CMakeLists.txt"), + "INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libbinlogevents/include)", + "MY_INCLUDE_SYSTEM_DIRECTORIES(LZ4)\nINCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libbinlogevents/include)") + + replace_in_file(self, os.path.join(self.source_folder, "cmake", "zstd.cmake"), + "NAMES zstd", + f"NAMES zstd {self.dependencies['zstd'].cpp_info.components['zstdlib'].libs[0]}") + + replace_in_file(self, os.path.join(self.source_folder, "cmake", "ssl.cmake"), + "NAMES ssl", + f"NAMES ssl {self.dependencies['openssl'].cpp_info.components['ssl'].libs[0]}") + + replace_in_file(self, os.path.join(self.source_folder, "cmake", "ssl.cmake"), + "NAMES crypto", + f"NAMES crypto {self.dependencies['openssl'].cpp_info.components['crypto'].libs[0]}") + + replace_in_file(self, os.path.join(self.source_folder, "cmake", "ssl.cmake"), + "IF(NOT OPENSSL_APPLINK_C)\n", + "IF(FALSE AND NOT OPENSSL_APPLINK_C)\n", + strict=False) # Do not copy shared libs of dependencies to package folder - deps_shared = ["SSL"] - if tools.Version(self.version) > "8.0.17": - deps_shared.extend(["KERBEROS", "SASL", "LDAP", "PROTOBUF", "CURL"]) + deps_shared = ["SSL", "KERBEROS", "SASL", "LDAP", "PROTOBUF", "CURL"] for dep in deps_shared: - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "MYSQL_CHECK_{}_DLLS()".format(dep), - "") - - sources_cmake = os.path.join(self._source_subfolder, "CMakeLists.txt") - sources_cmake_orig = os.path.join(self._source_subfolder, "CMakeListsOriginal.txt") - rename(self, sources_cmake, sources_cmake_orig) - rename(self, "CMakeLists.txt", sources_cmake) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + f"MYSQL_CHECK_{dep}_DLLS()", + "") + if self.settings.os == "Macos": - tools.replace_in_file(os.path.join(self._source_subfolder, "libmysql", "CMakeLists.txt"), - "COMMAND %s" % ("$" if tools.Version(self.version) < "8.0.25" else "libmysql_api_test"), - "COMMAND DYLD_LIBRARY_PATH=%s %s" %(os.path.join(self.build_folder, "library_output_directory"), os.path.join(self.build_folder, "runtime_output_directory", "libmysql_api_test"))) - tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "install_macros.cmake"), - " INSTALL_DEBUG_SYMBOLS(", - " # INSTALL_DEBUG_SYMBOLS(") - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["DISABLE_SHARED"] = not self.options.shared - cmake.definitions["STACK_DIRECTION"] = "-1" # stack grows downwards, on very few platforms stack grows upwards - cmake.definitions["WITHOUT_SERVER"] = True - cmake.definitions["WITH_UNIT_TESTS"] = False - cmake.definitions["ENABLED_PROFILING"] = False - cmake.definitions["MYSQL_MAINTAINER_MODE"] = False - cmake.definitions["WIX_DIR"] = False - if self._with_lz4: - cmake.definitions["WITH_LZ4"] = "system" - - if self._with_zstd: - cmake.definitions["WITH_ZSTD"] = "system" - cmake.definitions["ZSTD_INCLUDE_DIR"] = self.deps_cpp_info["zstd"].include_paths[0] + replace_in_file(self, os.path.join(self.source_folder, "libmysql", "CMakeLists.txt"), + f"COMMAND {'libmysql_api_test'}", + f"COMMAND DYLD_LIBRARY_PATH={os.path.join(self.build_folder, 'library_output_directory')} {os.path.join(self.build_folder, 'runtime_output_directory', 'libmysql_api_test')}") + replace_in_file(self, os.path.join(self.source_folder, "cmake", "install_macros.cmake"), + " INSTALL_DEBUG_SYMBOLS(", + " # INSTALL_DEBUG_SYMBOLS(") + + def generate(self): + vbenv = VirtualBuildEnv(self) + vbenv.generate() + + if not cross_building(self): + vrenv = VirtualRunEnv(self) + vrenv.generate(scope="build") + + tc = CMakeToolchain(self) + # Not used anywhere in the CMakeLists + tc.cache_variables["DISABLE_SHARED"] = not self.options.shared + tc.cache_variables["STACK_DIRECTION"] = "-1" # stack grows downwards, on very few platforms stack grows upwards + tc.cache_variables["WITHOUT_SERVER"] = True + tc.cache_variables["WITH_UNIT_TESTS"] = False + tc.cache_variables["ENABLED_PROFILING"] = False + tc.cache_variables["MYSQL_MAINTAINER_MODE"] = False + tc.cache_variables["WIX_DIR"] = False + + tc.cache_variables["WITH_LZ4"] = "system" + + tc.cache_variables["WITH_ZSTD"] = "system" + tc.cache_variables["ZSTD_INCLUDE_DIR"] = self.dependencies["zstd"].cpp_info.aggregated_components().includedirs[0].replace("\\", "/") if is_msvc(self): - cmake.definitions["WINDOWS_RUNTIME_MD"] = "MD" in msvc_runtime_flag(self) + tc.cache_variables["WINDOWS_RUNTIME_MD"] = not is_msvc_static_runtime(self) - if self.options.with_ssl: - cmake.definitions["WITH_SSL"] = self.deps_cpp_info["openssl"].rootpath + tc.cache_variables["WITH_SSL"] = self.dependencies["openssl"].package_folder.replace("\\", "/") - if self.options.with_zlib: - cmake.definitions["WITH_ZLIB"] = "system" - cmake.configure(source_dir=self._source_subfolder) - return cmake + tc.cache_variables["WITH_ZLIB"] = "system" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + if self.settings.os == "FreeBSD": + deps = PkgConfigDeps(self) + deps.generate() def build(self): - self._patch_files() - cmake = self._configure_cmake() - with tools.run_environment(self): - cmake.build() + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - cmake = self._configure_cmake() - with tools.run_environment(self): - cmake.install() - os.mkdir(os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + mkdir(self, os.path.join(self.package_folder, "licenses")) rename(self, os.path.join(self.package_folder, "LICENSE"), os.path.join(self.package_folder, "licenses", "LICENSE")) - os.remove(os.path.join(self.package_folder, "README")) - tools.remove_files_by_mask(self.package_folder, "*.pdb") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "docs")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rm(self, "README", self.package_folder) + rm(self, "*.pdb", self.package_folder, recursive=True) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "docs")) + rmdir(self, os.path.join(self.package_folder, "share")) if self.settings.os == "Windows" and self.options.shared: - self.copy("*.dll", "bin", keep_path=False) + copy(self, "*.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) if self.options.shared: - tools.remove_files_by_mask(self.package_folder, "*.a") + rm(self, "*.a", self.package_folder, recursive=True) else: - tools.remove_files_by_mask(self.package_folder, "*.dll") - tools.remove_files_by_mask(self.package_folder, "*.dylib") - tools.remove_files_by_mask(self.package_folder, "*.so*") + rm(self, "*.dll", self.package_folder, recursive=True) + rm(self, "*.dylib", self.package_folder, recursive=True) + rm(self, "*.so*", self.package_folder, recursive=True) def package_info(self): self.cpp_info.set_property("pkg_config_name", "mysqlclient") - self.cpp_info.names["pkg_config"] = "mysqlclient" self.cpp_info.libs = ["libmysql" if self.settings.os == "Windows" and self.options.shared else "mysqlclient"] if not self.options.shared: - stdcpp_library = tools.stdcpp_library(self) - if stdcpp_library: - self.cpp_info.system_libs.append(stdcpp_library) + stdcpplib = stdcpp_library(self) + if stdcpplib: + self.cpp_info.system_libs.append(stdcpplib) if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") - if self.settings.os in ["Linux", "FreeBSD"]: - if tools.Version(self.version) >= "8.0.25": - self.cpp_info.system_libs.append("resolv") + self.cpp_info.system_libs.extend(["m", "resolv"]) if self.settings.os == "Windows": - if tools.Version(self.version) >= "8.0.25": - self.cpp_info.system_libs.append("dnsapi") - self.cpp_info.system_libs.append("secur32") + self.cpp_info.system_libs.extend(["dnsapi", "secur32"]) # TODO: There is no official FindMySQL.cmake, but it's a common Find files in many projects # do we want to support it in CMakeDeps? diff --git a/recipes/libmysqlclient/all/test_package/CMakeLists.txt b/recipes/libmysqlclient/all/test_package/CMakeLists.txt index 7b9b613cbb24a..9151a7e370ad9 100644 --- a/recipes/libmysqlclient/all/test_package/CMakeLists.txt +++ b/recipes/libmysqlclient/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libmysqlclient REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libmysqlclient::libmysqlclient) diff --git a/recipes/libmysqlclient/all/test_package/conanfile.py b/recipes/libmysqlclient/all/test_package/conanfile.py index 6cbf041d5d1b8..98ab55852ad56 100644 --- a/recipes/libmysqlclient/all/test_package/conanfile.py +++ b/recipes/libmysqlclient/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libmysqlclient/all/test_v1_package/CMakeLists.txt b/recipes/libmysqlclient/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8d83bec304914 --- /dev/null +++ b/recipes/libmysqlclient/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(MySQL REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE MySQL::MySQL) diff --git a/recipes/libmysqlclient/all/test_v1_package/conanfile.py b/recipes/libmysqlclient/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2490acfa82ff8 --- /dev/null +++ b/recipes/libmysqlclient/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libmysqlclient/config.yml b/recipes/libmysqlclient/config.yml index eaba5db3fd9ef..c29f27b07fdd2 100644 --- a/recipes/libmysqlclient/config.yml +++ b/recipes/libmysqlclient/config.yml @@ -1,7 +1,9 @@ versions: + "8.0.31": + folder: all + "8.0.30": + folder: all "8.0.29": folder: all "8.0.25": folder: all - "8.0.17": - folder: all diff --git a/recipes/libnet/all/conanfile.py b/recipes/libnet/all/conanfile.py index 45b0701c8bbf7..94be83e79e721 100644 --- a/recipes/libnet/all/conanfile.py +++ b/recipes/libnet/all/conanfile.py @@ -1,15 +1,21 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanException, ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibnetConan(ConanFile): name = "libnet" - description = "Libnet is an API to help with the construction and injection of network packets." - topics = ("conan", "libnet", "network") + topics = ("network") url = "https://github.com/conan-io/conan-center-index" homepage = "http://libnet.sourceforge.net/" license = ["BSD-2-Clause"] @@ -23,65 +29,77 @@ class LibnetConan(ConanFile): "fPIC": True, } - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd if self.options.shared: - del self.options.fPIC - if self.settings.compiler == "Visual Studio": + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if is_msvc(self): raise ConanInvalidConfiguration("libnet is not supported by Visual Studio") if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("libnet can't be built as shared on Windows") - def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - def _configure_autotools(self): - if self._autotools: - return self._autotools + def build_requirements(self): + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") - self._autotools = AutoToolsBuildEnvironment(self) - - args = [] - if self.options.shared: - args.extend(["--disable-static", "--enable-shared"]) - else: - args.extend(["--disable-shared", "--enable-static"]) - args.append("--disable-doxygen-doc") - - self._autotools.configure(configure_dir=self._source_subfolder, args=args) - - return self._autotools + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-doxygen-doc") + if cross_building(self): + if self.settings.os == "Linux": + link_layer = "linux" + elif self.settings.os == "Windows": + link_layer = "win32" + elif is_apple_os(self): + link_layer = "bpf" + else: + raise ConanException( + f"link-layer unknown for {self.settings.os}, feel free to contribute to libnet recipe", + ) + tc.configure_args.append(f"--with-link-layer={link_layer}") + tc.generate() def build(self): - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - - autotools = self._configure_autotools() - autotools.install() - - tools.rmdir(os.path.join(self.package_folder, "share")) - os.unlink(os.path.join(self.package_folder, "lib", "libnet.la")) - os.unlink(os.path.join(self.package_folder, "lib", "pkgconfig", "libnet.pc")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libnet") self.cpp_info.libs = ["net"] - self.cpp_info.names["pkg_config"] = "libnet" - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") elif self.settings.os == "Windows": self.cpp_info.system_libs.append("ws2_32") diff --git a/recipes/libnet/all/test_package/CMakeLists.txt b/recipes/libnet/all/test_package/CMakeLists.txt index 34af13462f44f..24a3da7a29419 100644 --- a/recipes/libnet/all/test_package/CMakeLists.txt +++ b/recipes/libnet/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libnet REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libnet::libnet) diff --git a/recipes/libnet/all/test_package/conanfile.py b/recipes/libnet/all/test_package/conanfile.py index 4903f1a7e8fa0..0a6bc68712d90 100644 --- a/recipes/libnet/all/test_package/conanfile.py +++ b/recipes/libnet/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libnet/all/test_v1_package/CMakeLists.txt b/recipes/libnet/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libnet/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libnet/all/test_v1_package/conanfile.py b/recipes/libnet/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libnet/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libnfs/all/CMakeLists.txt b/recipes/libnfs/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/libnfs/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libnfs/all/conandata.yml b/recipes/libnfs/all/conandata.yml index f90726ee0c38c..5c9b795165455 100644 --- a/recipes/libnfs/all/conandata.yml +++ b/recipes/libnfs/all/conandata.yml @@ -4,7 +4,7 @@ sources: sha256: "7ef445410b42f36b9bad426608b53ccb9ccca4101e545c383f564c11db672ca8" patches: "5.0.1": - # bug about install target in 5.0.1. It is already fixed in upstream. - # https://github.com/sahlberg/libnfs/pull/377 - - base_path: "source_subfolder" - patch_file: "patches/5.0.1-0001-remove-exports.patch" + - patch_file: "patches/5.0.1-0001-remove-exports.patch" + patch_description: "Fix installation" + patch_type: "conan" + patch_source: "https://github.com/sahlberg/libnfs/pull/377" diff --git a/recipes/libnfs/all/conanfile.py b/recipes/libnfs/all/conanfile.py index 070e7fa6dfbb8..3b943c080be1a 100644 --- a/recipes/libnfs/all/conanfile.py +++ b/recipes/libnfs/all/conanfile.py @@ -1,9 +1,10 @@ -from conans import CMake, tools from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -import functools -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" + class LibnfsConan(ConanFile): name = "libnfs" @@ -21,16 +22,9 @@ class LibnfsConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,36 +32,40 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENCE*.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENCE*.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "libnfs") + self.cpp_info.set_property("cmake_target_name", "libnfs::libnfs") + self.cpp_info.set_property("pkg_config_name", "libnfs") self.cpp_info.libs = ["nfs"] if self.settings.os == "Windows": self.cpp_info.system_libs.append("ws2_32") - if self.options.shared: - self.cpp_info.defines.append("libnfs_EXPORTS") diff --git a/recipes/libnfs/all/test_package/CMakeLists.txt b/recipes/libnfs/all/test_package/CMakeLists.txt index 71e416178a7a4..c693f64cb2e4c 100644 --- a/recipes/libnfs/all/test_package/CMakeLists.txt +++ b/recipes/libnfs/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(libnfs CONFIG REQUIRED) +find_package(libnfs REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libnfs::libnfs) +target_link_libraries(${PROJECT_NAME} PRIVATE libnfs::libnfs) diff --git a/recipes/libnfs/all/test_package/conanfile.py b/recipes/libnfs/all/test_package/conanfile.py index a8c92dea63335..0a6bc68712d90 100644 --- a/recipes/libnfs/all/test_package/conanfile.py +++ b/recipes/libnfs/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libnfs/all/test_v1_package/CMakeLists.txt b/recipes/libnfs/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libnfs/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libnfs/all/test_v1_package/conanfile.py b/recipes/libnfs/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libnfs/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libnghttp2/all/CMakeLists.txt b/recipes/libnghttp2/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/libnghttp2/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libnghttp2/all/conandata.yml b/recipes/libnghttp2/all/conandata.yml index 39d70e2302947..4d6d7d71575c2 100644 --- a/recipes/libnghttp2/all/conandata.yml +++ b/recipes/libnghttp2/all/conandata.yml @@ -1,68 +1,69 @@ sources: + "1.51.0": + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.51.0/nghttp2-1.51.0.tar.xz" + sha256: "66aa76d97c143f42295405a31413e5e7d157968dad9f957bb4b015b598882e6b" + "1.50.0": + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.50.0/nghttp2-1.50.0.tar.xz" + sha256: "af24007e34c18c782393a1dc3685f8fd5b50283e90a9191d25488eb50aa2c825" + "1.49.0": + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.49.0/nghttp2-1.49.0.tar.xz" + sha256: "b0cfd492bbf0b131c472e8f6501c9f4ee82b51b68130f47b278c0b7c9848a66e" "1.48.0": - url: "https://github.com/nghttp2/nghttp2/archive/v1.48.0.tar.gz" - sha256: "946a8fa490548b67fc6074553cb225279cc6404bae96cf74551f2ad4453be637" + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.48.0/nghttp2-1.48.0.tar.xz" + sha256: "47d8f30ee4f1bc621566d10362ca1b3ac83a335c63da7144947c806772d016e4" "1.47.0": - url: "https://github.com/nghttp2/nghttp2/archive/v1.47.0.tar.gz" - sha256: "db98735b30f1586edf3212ada57f85feaceff483a1c0f1c1c8285abcf37e3444" + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.47.0/nghttp2-1.47.0.tar.xz" + sha256: "68271951324554c34501b85190f22f2221056db69f493afc3bbac8e7be21e7cc" "1.46.0": - url: "https://github.com/nghttp2/nghttp2/archive/v1.46.0.tar.gz" - sha256: "0875a638d319cd28b06dcc410e6dc2add1a52f7cab6f62b26025c448f8ae8f43" + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.46.0/nghttp2-1.46.0.tar.xz" + sha256: "1a68cc4a5732afb735baf50aaac3cb3a6771e49f744bd5db6c49ab5042f12a43" "1.45.1": - url: "https://github.com/nghttp2/nghttp2/archive/v1.45.1.tar.gz" - sha256: "6289eed7e83988428c6b24e46ada52a37fab82f20d4afa257b5627267c2a141b" + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.45.1/nghttp2-1.45.1.tar.xz" + sha256: "abdc4addccadbc7d89abe27c4d6427d78e57d139f69c1f45749227393c68bf79" "1.43.0": - url: "https://github.com/nghttp2/nghttp2/archive/v1.43.0.tar.gz" - sha256: "f4a9be08d22f5ad9b4bf36c491f1be58e54dc35a1592eaf4e3f79567e4894d0c" + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.43.0/nghttp2-1.43.0.tar.xz" + sha256: "f7d54fa6f8aed29f695ca44612136fa2359013547394d5dffeffca9e01a26b0f" "1.42.0": - url: "https://github.com/nghttp2/nghttp2/releases/download/v1.42.0/nghttp2-1.42.0.tar.bz2" - sha256: "10473848c2636fa9de6b469b04d0a0336cf8268486f7a6bde7cb2d0634736624" + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.42.0/nghttp2-1.42.0.tar.xz" + sha256: "c5a7f09020f31247d0d1609078a75efadeccb7e5b86fc2e4389189b1b431fe63" "1.40.0": - url: "https://github.com/nghttp2/nghttp2/releases/download/v1.40.0/nghttp2-1.40.0.tar.bz2" - sha256: "82758e13727945f2408d0612762e4655180b039f058d5ff40d055fa1497bd94f" + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.40.0/nghttp2-1.40.0.tar.xz" + sha256: "09fc43d428ff237138733c737b29fb1a7e49d49de06d2edbed3bc4cdcee69073" "1.39.2": - url: "https://github.com/nghttp2/nghttp2/releases/download/v1.39.2/nghttp2-1.39.2.tar.bz2" - sha256: "92a23e4522328c8565028ee0c7270e74add7990614fd1148f2a79d873bc2a1d0" + url: "https://github.com/nghttp2/nghttp2/releases/download/v1.39.2/nghttp2-1.39.2.tar.xz" + sha256: "a2d216450abd2beaf4e200c168957968e89d602ca4119338b9d7ab059fd4ce8b" patches: + "1.49.0": + - patch_file: "patches/fix-findJemalloc.cmake" + - patch_file: "patches/fix-findLibevent.cmake" "1.48.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.47.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.46.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.45.1": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.43.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.42.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" "1.40.0": - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" + - patch_file: "patches/1.40.0-remove-static-suffix.patch" + patch_type: "backport" + patch_source: https://github.com/curl/curl/pull/7515#issuecomment-890320856 + patch_description: >- + Fix the breaking change that was introduced in 1.40.0 and made optional + in 1.40.1 "1.39.2": - patch_file: "patches/fix-addNghttp2IncludesPathCMake.patch" - base_path: "source_subfolder" - patch_file: "patches/fix-findJemalloc.cmake" - base_path: "source_subfolder" - patch_file: "patches/fix-findLibevent.cmake" - base_path: "source_subfolder" diff --git a/recipes/libnghttp2/all/conanfile.py b/recipes/libnghttp2/all/conanfile.py index 0029f5d21561e..24b9362fec615 100644 --- a/recipes/libnghttp2/all/conanfile.py +++ b/recipes/libnghttp2/all/conanfile.py @@ -1,9 +1,15 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, save, replace_in_file, rmdir, copy +from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.36.0" + +required_conan_version = ">=1.53.0" class Nghttp2Conan(ConanFile): @@ -13,7 +19,6 @@ class Nghttp2Conan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://nghttp2.org" license = "MIT" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,20 +37,8 @@ class Nghttp2Conan(ConanFile): "with_asio": False, } - generators = "cmake", "cmake_find_package", "pkg_config" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,79 +46,76 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not (self.options.with_app or self.options.with_hpack or self.options.with_asio): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if not self.options.with_app: del self.options.with_jemalloc + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.with_app or self.options.with_asio: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.with_app: self.requires("c-ares/1.18.1") self.requires("libev/4.33") self.requires("libevent/2.1.12") - self.requires("libxml2/2.9.14") - self.requires("zlib/1.2.12") + self.requires("libxml2/2.10.3") + self.requires("zlib/1.2.13") if self.options.with_jemalloc: - self.requires("jemalloc/5.2.1") + self.requires("jemalloc/5.3.0") if self.options.with_hpack: self.requires("jansson/2.14") if self.options.with_asio: - self.requires("boost/1.79.0") + self.requires("boost/1.81.0") def validate(self): - if self.options.with_asio and self._is_msvc: + if self.options.with_asio and is_msvc(self): raise ConanInvalidConfiguration("Build with asio and MSVC is not supported yet, see upstream bug #589") - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "6": - raise ConanInvalidConfiguration("gcc >= 6.0 required") + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "6": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >= 6.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["ENABLE_SHARED_LIB"] = self.options.shared - cmake.definitions["ENABLE_STATIC_LIB"] = not self.options.shared - cmake.definitions["ENABLE_HPACK_TOOLS"] = self.options.with_hpack - cmake.definitions["ENABLE_APP"] = self.options.with_app - cmake.definitions["ENABLE_EXAMPLES"] = False - cmake.definitions["ENABLE_PYTHON_BINDINGS"] = False - cmake.definitions["ENABLE_FAILMALLOC"] = False + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_SHARED_LIB"] = self.options.shared + tc.variables["ENABLE_STATIC_LIB"] = not self.options.shared + tc.variables["ENABLE_HPACK_TOOLS"] = self.options.with_hpack + tc.variables["ENABLE_APP"] = self.options.with_app + tc.variables["ENABLE_EXAMPLES"] = False + tc.variables["ENABLE_PYTHON_BINDINGS"] = False + tc.variables["ENABLE_FAILMALLOC"] = False # disable unneeded auto-picked dependencies - cmake.definitions["WITH_LIBXML2"] = False - cmake.definitions["WITH_JEMALLOC"] = self.options.get_safe("with_jemalloc", False) - cmake.definitions["WITH_SPDYLAY"] = False - - cmake.definitions["ENABLE_ASIO_LIB"] = self.options.with_asio - - if tools.Version(self.version) >= "1.42.0": - # backward-incompatible change in 1.42.0 - cmake.definitions["STATIC_LIB_SUFFIX"] = "_static" - - if tools.is_apple_os(self.settings.os): + tc.variables["WITH_LIBXML2"] = False + tc.variables["WITH_JEMALLOC"] = self.options.get_safe("with_jemalloc", False) + tc.variables["WITH_SPDYLAY"] = False + tc.variables["ENABLE_ASIO_LIB"] = self.options.with_asio + if is_apple_os(self): # workaround for: install TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable - cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False + tc.cache_variables["CMAKE_MACOSX_BUNDLE"] = False + tc.generate() - cmake.configure() - return cmake + tc = CMakeDeps(self) + tc.generate() + tc = PkgConfigDeps(self) + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if not self.options.shared: # easier to patch here rather than have patch 'nghttp_static_include_directories' for each version - tools.save(os.path.join(self._source_subfolder, "lib", "CMakeLists.txt"), + save(self, os.path.join(self.source_folder, "lib", "CMakeLists.txt"), "target_include_directories(nghttp2_static INTERFACE\n" "${CMAKE_CURRENT_BINARY_DIR}/includes\n" "${CMAKE_CURRENT_SOURCE_DIR}/includes)\n", append=True) target_libnghttp2 = "nghttp2" if self.options.shared else "nghttp2_static" - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "\n" "link_libraries(\n" " nghttp2\n", @@ -133,36 +123,36 @@ def _patch_sources(self): "link_libraries(\n" " {} ${{CONAN_LIBS}}\n".format(target_libnghttp2)) if not self.options.shared: - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "\n" " add_library(nghttp2_asio SHARED\n", "\n" " add_library(nghttp2_asio\n") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "\n" " target_link_libraries(nghttp2_asio\n" " nghttp2\n", "\n" " target_link_libraries(nghttp2_asio\n" - " {}\n".format(target_libnghttp2)) + f" {target_libnghttp2}\n") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.components["nghttp2"].set_property("pkg_config_name", "libnghttp2") - suffix = "_static" if tools.Version(self.version) > "1.39.2" and not self.options.shared else "" - self.cpp_info.components["nghttp2"].libs = [f"nghttp2{suffix}"] - if self._is_msvc and not self.options.shared: + self.cpp_info.components["nghttp2"].libs = ["nghttp2"] + if is_msvc(self) and not self.options.shared: self.cpp_info.components["nghttp2"].defines.append("NGHTTP2_STATICLIB") if self.options.with_asio: @@ -184,9 +174,7 @@ def package_info(self): self.cpp_info.components["nghttp2_hpack"].requires = ["jansson::jansson"] if self.options.with_app or self.options.with_hpack: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) # trick for internal conan usage to pick up in downsteam pc files the pc file including all libs components self.cpp_info.set_property("pkg_config_name", "libnghttp2_asio" if self.options.with_asio else "libnghttp2") diff --git a/recipes/libnghttp2/all/patches/1.40.0-remove-static-suffix.patch b/recipes/libnghttp2/all/patches/1.40.0-remove-static-suffix.patch new file mode 100644 index 0000000000000..b769d5a577c38 --- /dev/null +++ b/recipes/libnghttp2/all/patches/1.40.0-remove-static-suffix.patch @@ -0,0 +1,11 @@ +--- lib/CMakeLists.txt.orig 2022-12-23 11:01:09.000000000 +0200 ++++ lib/CMakeLists.txt 2022-12-23 11:01:22.000000000 +0200 +@@ -62,7 +62,7 @@ if(HAVE_CUNIT OR ENABLE_STATIC_LIB) + set_target_properties(nghttp2_static PROPERTIES + COMPILE_FLAGS "${WARNCFLAGS}" + VERSION ${LT_VERSION} SOVERSION ${LT_SOVERSION} +- ARCHIVE_OUTPUT_NAME nghttp2_static ++ ARCHIVE_OUTPUT_NAME nghttp2 + ) + target_compile_definitions(nghttp2_static PUBLIC "-DNGHTTP2_STATICLIB") + if(ENABLE_STATIC_LIB) diff --git a/recipes/libnghttp2/all/test_package/CMakeLists.txt b/recipes/libnghttp2/all/test_package/CMakeLists.txt index db17f433a0df2..eb7f9cd8b9769 100644 --- a/recipes/libnghttp2/all/test_package/CMakeLists.txt +++ b/recipes/libnghttp2/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) find_package(libnghttp2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} libnghttp2::libnghttp2) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE libnghttp2::libnghttp2) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/libnghttp2/all/test_package/conanfile.py b/recipes/libnghttp2/all/test_package/conanfile.py index 697dfef261b53..a9fb96656f203 100644 --- a/recipes/libnghttp2/all/test_package/conanfile.py +++ b/recipes/libnghttp2/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libnghttp2/all/test_v1_package/CMakeLists.txt b/recipes/libnghttp2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a7596ce0a8b97 --- /dev/null +++ b/recipes/libnghttp2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ ${CMAKE_CURRENT_BINARY_DIR}/binary_dir/) diff --git a/recipes/libnghttp2/all/test_v1_package/conanfile.py b/recipes/libnghttp2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libnghttp2/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libnghttp2/config.yml b/recipes/libnghttp2/config.yml index c71f989fb8ec4..486aa86ed0090 100644 --- a/recipes/libnghttp2/config.yml +++ b/recipes/libnghttp2/config.yml @@ -1,4 +1,10 @@ versions: + "1.51.0": + folder: all + "1.50.0": + folder: all + "1.49.0": + folder: all "1.48.0": folder: all "1.47.0": diff --git a/recipes/libnoise/all/conanfile.py b/recipes/libnoise/all/conanfile.py index 41c252698e767..f1ad2b518e534 100644 --- a/recipes/libnoise/all/conanfile.py +++ b/recipes/libnoise/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class LibnoiseConan(ConanFile): @@ -15,10 +15,11 @@ class LibnoiseConan(ConanFile): "multifractal, etc.) and combinations of those techniques." ) license = "LGPL-2.1-or-later" - topics = ("libnoise", "graphics", "noise-generator") + topics = ("graphics", "noise-generator") homepage = "http://libnoise.sourceforge.net" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -37,13 +38,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder) + get(self, **self.conan_data["sources"][self.version]) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/libnoise/all/test_package/conanfile.py b/recipes/libnoise/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/libnoise/all/test_package/conanfile.py +++ b/recipes/libnoise/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/libnoise/all/test_v1_package/CMakeLists.txt b/recipes/libnoise/all/test_v1_package/CMakeLists.txt index 469ae9866ac83..0d20897301b68 100644 --- a/recipes/libnoise/all/test_v1_package/CMakeLists.txt +++ b/recipes/libnoise/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libnoise REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE libnoise::libnoise) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libnoise/all/test_v1_package/conanfile.py b/recipes/libnoise/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/libnoise/all/test_v1_package/conanfile.py +++ b/recipes/libnoise/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/libnuma/all/conandata.yml b/recipes/libnuma/all/conandata.yml index 7c99925f01ad9..0c573279e69f1 100644 --- a/recipes/libnuma/all/conandata.yml +++ b/recipes/libnuma/all/conandata.yml @@ -3,6 +3,5 @@ sources: url: "https://github.com/numactl/numactl/releases/download/v2.0.14/numactl-2.0.14.tar.gz" sha256: "826bd148c1b6231e1284e42a4db510207747484b112aee25ed6b1078756bcff6" patches: - "2.0.14": + "2.0.14": - patch_file: "patches/symver.patch" - base_path: "source_subfolder" diff --git a/recipes/libnuma/all/conanfile.py b/recipes/libnuma/all/conanfile.py index 3912d21fbcf80..3234c3cbc8e68 100644 --- a/recipes/libnuma/all/conanfile.py +++ b/recipes/libnuma/all/conanfile.py @@ -1,17 +1,21 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout import os -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +required_conan_version = ">=1.53.0" -required_conan_version = ">=1.29.1" class LibnumaConan(ConanFile): name = "libnuma" description = "NUMA support for Linux." license = "LGPL-2.1-or-later" - topics = ("conan", "numa") + topics = ("numa") homepage = "https://github.com/numactl/numactl" url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,60 +25,47 @@ class LibnumaConan(ConanFile): "shared": False, "fPIC": True, } - exports_sources = "patches/**" - - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def configure(self): - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("{} is only supported on Linux".format(self.name)) - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd if self.options.shared: del self.options.fPIC + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def _patch_sources(self): - for patch in self.conan_data.get("patches",{}).get(self.version, []): - tools.patch(**patch) - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("numactl-" + self.version, self._source_subfolder) + def layout(self): + basic_layout(self, src_folder="src") - def _configure_autotools(self): - if self._autotools: - return self._autotools + def validate(self): + if self.info.settings.os != "Linux": + raise ConanInvalidConfiguration("libnuma is only supported on Linux") - self._autotools = AutoToolsBuildEnvironment(self) - - args = [] - if self.options.shared: - args.extend(["--disable-static", "--enable-shared"]) - else: - args.extend(["--disable-shared", "--enable-static"]) + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - self._patch_sources() - autotools = self._configure_autotools() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("LICENSE.LGPL2.1", dst="licenses", src=self._source_subfolder) - autotools = self._configure_autotools() + copy(self, "LICENSE.LGPL2.1", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "bin")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "numa") self.cpp_info.libs = ["numa"] - self.cpp_info.names["pkg_config"] = "numa" self.cpp_info.system_libs = ["dl", "pthread"] diff --git a/recipes/libnuma/all/test_package/CMakeLists.txt b/recipes/libnuma/all/test_package/CMakeLists.txt index 34af13462f44f..4a335520f487b 100644 --- a/recipes/libnuma/all/test_package/CMakeLists.txt +++ b/recipes/libnuma/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libnuma REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libnuma::libnuma) diff --git a/recipes/libnuma/all/test_package/conanfile.py b/recipes/libnuma/all/test_package/conanfile.py index 1df900244a291..0a6bc68712d90 100644 --- a/recipes/libnuma/all/test_package/conanfile.py +++ b/recipes/libnuma/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libnuma/all/test_v1_package/CMakeLists.txt b/recipes/libnuma/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libnuma/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libnuma/all/test_v1_package/conanfile.py b/recipes/libnuma/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libnuma/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libpcap/all/CMakeLists.txt b/recipes/libpcap/all/CMakeLists.txt deleted file mode 100644 index 1632809b71a7a..0000000000000 --- a/recipes/libpcap/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libpcap/all/conanfile.py b/recipes/libpcap/all/conanfile.py index be545689c190c..b2ff6d95b30ce 100644 --- a/recipes/libpcap/all/conanfile.py +++ b/recipes/libpcap/all/conanfile.py @@ -1,11 +1,19 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import AutoToolsBuildEnvironment, tools, ConanFile, CMake -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import chdir, copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import glob import os import shutil -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class LibPcapConan(ConanFile): @@ -21,33 +29,18 @@ class LibPcapConan(ConanFile): "shared": [True, False], "fPIC": [True, False], "enable_libusb": [True, False], - "enable_universal": [True, False, "deprecated"], } default_options = { "shared": False, "fPIC": True, "enable_libusb": False, - "enable_universal": "deprecated", } - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - _autotools = None - # TODO: Add dbus-glib when available # TODO: Add libnl-genl when available # TODO: Add libbluetooth when available # TODO: Add libibverbs when available - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -60,98 +53,93 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.options.enable_universal != "deprecated": - self.output.warn("enable_universal is a deprecated option. Do not use.") + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + if self.settings.os == "Windows": + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def requirements(self): if self.options.get_safe("enable_libusb"): - self.requires("libusb/1.0.24") + self.requires("libusb/1.0.26") def validate(self): - if tools.Version(self.version) < "1.10.0" and self.settings.os == "Macos" and self.options.shared: - raise ConanInvalidConfiguration("libpcap {} can not be built as shared on OSX.".format(self.version)) - if hasattr(self, "settings_build") and tools.cross_building(self) and \ - self.options.shared and tools.is_apple_os(self.settings.os): + if Version(self.version) < "1.10.0" and self.settings.os == "Macos" and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared on OSX.") + if hasattr(self, "settings_build") and cross_building(self) and \ + self.options.shared and is_apple_os(self): raise ConanInvalidConfiguration("cross-build of libpcap shared is broken on Apple") - if tools.Version(self.version) < "1.10.1" and self.settings.os == "Windows" and not self.options.shared: - raise ConanInvalidConfiguration("libpcap can not be built static on Windows below version 1.10.1.") - - def package_id(self): - del self.info.options.enable_universal + if Version(self.version) < "1.10.1" and self.settings.os == "Windows" and not self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built static on Windows") def build_requirements(self): - if self._settings_build.os == "Windows": - self.build_requires("winflexbison/2.5.24") + if is_msvc(self, build_context=True): + self.tool_requires("winflexbison/2.5.24") else: - self.build_requires("bison/3.7.6") - self.build_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - configure_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-usb={}".format(yes_no(self.options.get_safe("enable_libusb"))), - "--disable-universal", - "--without-libnl", - "--disable-bluetooth", - "--disable-packet-ring", - "--disable-dbus", - "--disable-rdma", - ] - if tools.cross_building(self): - target_os = "linux" if self.settings.os == "Linux" else "null" - configure_args.append("--with-pcap=%s" % target_os) - elif "arm" in self.settings.arch and self.settings.os == "Linux": - configure_args.append("--host=arm-linux") - self._autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - # Relocatable shared lib on macOS - tools.replace_in_file("Makefile", "-install_name $(libdir)/", "-install_name @rpath/") - return self._autotools - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - if not self.options.shared: - self._cmake.definitions["ENABLE_REMOTE"] = False - if self._is_msvc: - self._cmake.definitions["USE_STATIC_RT"] = "MT" in msvc_runtime_flag(self) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + + if self.settings.os == "Windows": + tc = CMakeToolchain(self) + if not self.options.shared: + tc.variables["ENABLE_REMOTE"] = False + if is_msvc(self): + tc.variables["USE_STATIC_RT"] = is_msvc_static_runtime(self) + else: + # Don't force -static-libgcc for MinGW, because conan users expect + # to inject this compilation flag themselves + tc.variables["USE_STATIC_RT"] = False + tc.generate() else: - # Don't force -static-libgcc for MinGW, because conan users expect - # to inject this compilation flag themselves - self._cmake.definitions["USE_STATIC_RT"] = False - self._cmake.configure() - return self._cmake + if not cross_building(self): + VirtualRunEnv(self).generate(scope="build") + + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--enable-usb={yes_no(self.options.get_safe('enable_libusb'))}", + "--disable-universal", + "--without-libnl", + "--disable-bluetooth", + "--disable-packet-ring", + "--disable-dbus", + "--disable-rdma", + ]) + if cross_building(self): + target_os = "linux" if self.settings.os == "Linux" else "null" + tc.configure_args.append(f"--with-pcap={target_os}") + elif "arm" in self.settings.arch and self.settings.os == "Linux": + tc.configure_args.append("--host=arm-linux") + tc.generate() + + AutotoolsDeps(self).generate() def build(self): if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if self.settings.os == "Windows": - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") - if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "pcap_static.lib") def flatten_filetree(folder): for file in glob.glob(folder + "/**/*"): @@ -160,24 +148,27 @@ def flatten_filetree(folder): os.rmdir(subdir) # libpcap installs into a subfolder like x64 or amd64 - with tools.chdir(self.package_folder): + with chdir(self, self.package_folder): flatten_filetree("bin") flatten_filetree("lib") + + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + if self.options.shared: + rm(self, "pcap_static.lib", os.path.join(self.package_folder, "lib")) + rm(self, "libpcap.a", os.path.join(self.package_folder, "lib")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.a") + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libpcap") suffix = "_static" if self.settings.os == "Windows" and not self.options.shared else "" - self.cpp_info.libs = ["pcap{}".format(suffix)] + self.cpp_info.libs = [f"pcap{suffix}"] if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] - - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) diff --git a/recipes/libpcap/all/test_package/CMakeLists.txt b/recipes/libpcap/all/test_package/CMakeLists.txt index f77be2959f6fc..647522630d58c 100644 --- a/recipes/libpcap/all/test_package/CMakeLists.txt +++ b/recipes/libpcap/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libpcap REQUIRED CONFIG) add_executable(test_package test_package.c) -target_link_libraries(test_package libpcap::libpcap) +target_link_libraries(test_package PRIVATE libpcap::libpcap) diff --git a/recipes/libpcap/all/test_package/conanfile.py b/recipes/libpcap/all/test_package/conanfile.py index 38f4483872d47..98ab55852ad56 100644 --- a/recipes/libpcap/all/test_package/conanfile.py +++ b/recipes/libpcap/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libpcap/all/test_v1_package/CMakeLists.txt b/recipes/libpcap/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libpcap/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libpcap/all/test_v1_package/conanfile.py b/recipes/libpcap/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libpcap/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libpciaccess/all/conandata.yml b/recipes/libpciaccess/all/conandata.yml index a9f6a4bea0057..223034d0c456a 100644 --- a/recipes/libpciaccess/all/conandata.yml +++ b/recipes/libpciaccess/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.17": + url: "https://www.x.org/archive//individual/lib/libpciaccess-0.17.tar.xz" + sha256: "74283ba3c974913029e7a547496a29145b07ec51732bbb5b5c58d5025ad95b73" "0.16": - url: "https://gitlab.freedesktop.org/xorg/lib/libpciaccess/-/archive/libpciaccess-0.16/libpciaccess-libpciaccess-0.16.tar.gz" - sha256: "983b31ab586e3f2da810bd6bcbbcf9d643f8968d2280c6e573fec95b556e971f" + url: "https://www.x.org/archive//individual/lib/libpciaccess-0.16.tar.gz" + sha256: "84413553994aef0070cf420050aa5c0a51b1956b404920e21b81e96db6a61a27" diff --git a/recipes/libpciaccess/all/test_v1_package/conanfile.py b/recipes/libpciaccess/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/libpciaccess/all/test_v1_package/conanfile.py +++ b/recipes/libpciaccess/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/libpciaccess/config.yml b/recipes/libpciaccess/config.yml index 95828182e346d..5b9c678c9d392 100644 --- a/recipes/libpciaccess/config.yml +++ b/recipes/libpciaccess/config.yml @@ -1,3 +1,5 @@ versions: + "0.17": + folder: all "0.16": folder: all diff --git a/recipes/libpfm4/all/conandata.yml b/recipes/libpfm4/all/conandata.yml new file mode 100644 index 0000000000000..ccfa567e2963b --- /dev/null +++ b/recipes/libpfm4/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "4.12.0": + url: "https://versaweb.dl.sourceforge.net/project/perfmon2/libpfm4/libpfm-4.12.0.tar.gz" + sha256: "4b0c1f53f39a61525b69bebf532c68040c1b984d7544a8ae0844b13cd91e1ee4" diff --git a/recipes/libpfm4/all/conanfile.py b/recipes/libpfm4/all/conanfile.py new file mode 100644 index 0000000000000..89894d3e1796e --- /dev/null +++ b/recipes/libpfm4/all/conanfile.py @@ -0,0 +1,95 @@ +from conan import ConanFile +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.files import get, rmdir, copy, replace_in_file +from conan.errors import ConanInvalidConfiguration +import os + + +class Libpfm4Conan(ConanFile): + name = "libpfm4" + license = "MIT" + homepage = "http://perfmon2.sourceforge.net" + url = "https://github.com/conan-io/conan-center-index" + description = ("A helper library to program the performance monitoring events") + topics = ("perf", "pmu", "benchmark", "microbenchmark") + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} + + def validate(self): + # The library doesn't really make much sense without perf_events API + # and currently does not compile on modern Mac OS X && Windows + if self.settings.os != "Linux": + raise ConanInvalidConfiguration("This library is Linux only") + + def config_options(self): + # and currently does not compile on modern Mac OS X && Windows + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + + def layout(self): + basic_layout(self) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() + + def _patch_sources(self): + if not self.options.shared: + # honor fPIC option + replace_in_file(self, os.path.join(self.source_folder, "rules.mk"), "-fPIC", "") + replace_in_file(self, os.path.join(self.source_folder, "rules.mk"), "-DPIC", "") + + def build(self): + self._patch_sources() + args = [ + 'DBG=', + 'CONFIG_PFMLIB_SHARED={}'.format("y" if self.options.shared else "n"), + f'-C {self.source_folder}' + ] + autotools = Autotools(self) + autotools.make(args=args) + + def package(self): + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + args = [ + 'DBG=', + 'LDCONFIG=true', + 'CONFIG_PFMLIB_SHARED={}'.format("y" if self.options.shared else "n"), + f'DESTDIR={self.package_folder}{os.sep}', + f'INCDIR=include{os.sep}', + f'LIBDIR=lib{os.sep}', + f'-C {self.source_folder}' + ] + # due to bug, Mac install phase fails with config shared + if self.settings.os == 'Macos': + args.append('CONFIG_PFMLIB_SHARED=n') + + copy(self, "err.h", dst=os.path.join(self.package_folder, "include", "perfmon"), src=os.path.join(self.source_folder, "include", "perfmon")) + autotools = Autotools(self) + autotools.install(args=args) + rmdir(self, os.path.join(self.package_folder, "usr")) + + def package_info(self): + self.cpp_info.libs = ["pfm"] + if self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.system_libs = ["pthread", "m"] diff --git a/recipes/libpfm4/all/test_package/CMakeLists.txt b/recipes/libpfm4/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c93d1fbd7ce51 --- /dev/null +++ b/recipes/libpfm4/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +find_package(libpfm4 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libpfm4::libpfm4) diff --git a/recipes/libpfm4/all/test_package/conanfile.py b/recipes/libpfm4/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/libpfm4/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libpfm4/all/test_package/test_package.c b/recipes/libpfm4/all/test_package/test_package.c new file mode 100644 index 0000000000000..22dc57834a15e --- /dev/null +++ b/recipes/libpfm4/all/test_package/test_package.c @@ -0,0 +1,16 @@ +#include +#include +#include +#include + + +int main(void) { + int version = 0; + + pfm_initialize(); + version = pfm_get_version(); + printf("PFM VERSION: %d\n", version); + pfm_terminate(); + + return EXIT_SUCCESS; +} diff --git a/recipes/libpfm4/all/test_v1_package/CMakeLists.txt b/recipes/libpfm4/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..92ff6b140a2cc --- /dev/null +++ b/recipes/libpfm4/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(libpfm4 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libpfm4::libpfm4) diff --git a/recipes/libpfm4/all/test_v1_package/conanfile.py b/recipes/libpfm4/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2490acfa82ff8 --- /dev/null +++ b/recipes/libpfm4/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libpfm4/config.yml b/recipes/libpfm4/config.yml new file mode 100644 index 0000000000000..b06c46e0f08f9 --- /dev/null +++ b/recipes/libpfm4/config.yml @@ -0,0 +1,3 @@ +versions: + "4.12.0": + folder: all diff --git a/recipes/libpng/all/CMakeLists.txt b/recipes/libpng/all/CMakeLists.txt deleted file mode 100644 index 0aeaf02f84c88..0000000000000 --- a/recipes/libpng/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(NOT CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CONAN_LIBPNG_SYSTEM_PROCESSOR}) -endif() - -add_subdirectory("source_subfolder") diff --git a/recipes/libpng/all/conandata.yml b/recipes/libpng/all/conandata.yml index f76e631ded6c4..e10462996e48c 100644 --- a/recipes/libpng/all/conandata.yml +++ b/recipes/libpng/all/conandata.yml @@ -1,20 +1,24 @@ sources: + "1.6.39": + url: "https://sourceforge.net/projects/libpng/files/libpng16/1.6.39/libpng-1.6.39.tar.xz" + sha256: "1f4696ce70b4ee5f85f1e1623dc1229b210029fa4b7aee573df3e2ba7b036937" + "1.6.38": + url: "https://sourceforge.net/projects/libpng/files/libpng16/1.6.38/libpng-1.6.38.tar.xz" + sha256: "b3683e8b8111ebf6f1ac004ebb6b0c975cd310ec469d98364388e9cedbfa68be" "1.6.37": - url: "https://github.com/glennrp/libpng/archive/v1.6.37.tar.gz" - sha256: "ca74a0dace179a8422187671aee97dd3892b53e168627145271cad5b5ac81307" - "1.5.2": - url: "https://github.com/glennrp/libpng/archive/v1.5.2.tar.gz" - sha256: "6b27e93ff12993fc76c6c7bee4f4be49eac71984af55f0dee45ab2b70fa090e7" + url: "https://sourceforge.net/projects/libpng/files/libpng16/1.6.37/libpng-1.6.37.tar.xz" + sha256: "505e70834d35383537b6491e7ae8641f1a4bed1876dbfe361201fc80868d88ca" + "1.5.30": + url: "https://sourceforge.net/projects/libpng/files/libpng15/1.5.30/libpng-1.5.30.tar.xz" + sha256: "7d76275fad2ede4b7d87c5fd46e6f488d2a16b5a69dc968ffa840ab39ba756ed" patches: "1.6.37": - - patch_file: "patches/CMakeLists-zlib.patch" - base_path: "source_subfolder" - "1.5.2": - - patch_file: "patches/CMakeLists-symlink.patch" - patch_description: "Fix symlink macro call for Linux debug builds. Previously it was attempting to symlink libpng to libpng15 that did not exist in debug builds." - patch_type: "portability" - base_path: "source_subfolder" - - patch_file: "patches/CMakeLists-ext-zlib.patch" - patch_description: "Update ZLib include and library paths for conan to provide lib. Remove Zlib dll definition." - patch_type: "backport" - base_path: "source_subfolder" + - patch_file: "patches/0001-1.6.37-cmakefile-zlib.patch" + patch_description: "Update ZLib include and library paths for conan to provide\ + \ lib. Remove Zlib dll definition." + patch_type: "conan" + "1.5.30": + - patch_file: "patches/0001-1.5.30-cmakefile-zlib.patch" + patch_description: "Update ZLib include and library paths for conan to provide\ + \ lib. Remove Zlib dll definition." + patch_type: "conan" diff --git a/recipes/libpng/all/conanfile.py b/recipes/libpng/all/conanfile.py index 7ef447e90217c..b784be0decdb9 100644 --- a/recipes/libpng/all/conanfile.py +++ b/recipes/libpng/all/conanfile.py @@ -1,11 +1,13 @@ -import os -from conans import CMake, tools from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.microsoft import is_msvc from conan.tools.scm import Version -from conan.tools.files import apply_conandata_patches, get, rm, rmdir, replace_in_file -from conan.tools.build.cross_building import cross_building +import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.53.0" class LibpngConan(ConanFile): @@ -14,7 +16,7 @@ class LibpngConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.libpng.org" license = "libpng-2.0" - topics = ("png", "libpng") + topics = ("png", "graphics", "image") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,7 +25,7 @@ class LibpngConan(ConanFile): "msa": [True, False], "sse": [True, False], "vsx": [True, False], - "api_prefix": "ANY", + "api_prefix": ["ANY"], } default_options = { "shared": False, @@ -35,17 +37,6 @@ class LibpngConan(ConanFile): "api_prefix": "", } - generators = ["cmake", "cmake_find_package"] - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _has_neon_support(self): return "arm" in self.settings.arch @@ -63,9 +54,7 @@ def _has_vsx_support(self): return "ppc" in self.settings.arch def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -81,37 +70,22 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") + + def validate(self): + if Version(self.version) < "1.6" and self.settings.arch == "armv8" and is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.ref} currently does not building for {self.settings.os} {self.settings.arch}. Contributions are welcomed") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch(self): - if Version(self.version) > "1.5.2": - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - "find_library(M_LIBRARY m)", - "set(M_LIBRARY m)") - - if tools.os_info.is_windows: - if self._is_msvc: - if Version(self.version) <= "1.5.2": - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - 'set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)', - 'set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME})') - else: - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - 'OUTPUT_NAME "${PNG_LIB_NAME}_static', - 'OUTPUT_NAME "${PNG_LIB_NAME}') - else: - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), - 'COMMAND "${CMAKE_COMMAND}" -E copy_if_different $ $/${DEST_FILE}', - 'COMMAND "${CMAKE_COMMAND}" -E copy_if_different $/$ $/${DEST_FILE}') + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _neon_msa_sse_vsx_mapping(self): @@ -121,48 +95,61 @@ def _neon_msa_sse_vsx_mapping(self): "check": "check", } - @property - def _libpng_cmake_system_processor(self): - # FIXME: too specific and error prone, should be delegated to a conan helper function - # It should satisfy libpng CMakeLists specifically, do not use it naively in an other recipe - if "mips" in self.settings.arch: - return "mipsel" - if "ppc" in self.settings.arch: - return "powerpc" - return str(self.settings.arch) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["PNG_TESTS"] = False - self._cmake.definitions["PNG_SHARED"] = self.options.shared - self._cmake.definitions["PNG_STATIC"] = not self.options.shared - self._cmake.definitions["PNG_DEBUG"] = self.settings.build_type == "Debug" - self._cmake.definitions["PNG_PREFIX"] = self.options.api_prefix - self._cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False # prevents configure error on shared iOS/tvOS/watchOS - if cross_building(self): - self._cmake.definitions["CONAN_LIBPNG_SYSTEM_PROCESSOR"] = self._libpng_cmake_system_processor + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PNG_TESTS"] = False + tc.variables["PNG_SHARED"] = self.options.shared + tc.variables["PNG_STATIC"] = not self.options.shared + tc.variables["PNG_DEBUG"] = self.settings.build_type == "Debug" + tc.variables["PNG_PREFIX"] = self.options.api_prefix if self._has_neon_support: - self._cmake.definitions["PNG_ARM_NEON"] = self._neon_msa_sse_vsx_mapping[str(self.options.neon)] + tc.variables["PNG_ARM_NEON"] = self._neon_msa_sse_vsx_mapping[str(self.options.neon)] if self._has_msa_support: - self._cmake.definitions["PNG_MIPS_MSA"] = self._neon_msa_sse_vsx_mapping[str(self.options.msa)] + tc.variables["PNG_MIPS_MSA"] = self._neon_msa_sse_vsx_mapping[str(self.options.msa)] if self._has_sse_support: - self._cmake.definitions["PNG_INTEL_SSE"] = self._neon_msa_sse_vsx_mapping[str(self.options.sse)] + tc.variables["PNG_INTEL_SSE"] = self._neon_msa_sse_vsx_mapping[str(self.options.sse)] if self._has_vsx_support: - self._cmake.definitions["PNG_POWERPC_VSX"] = self._neon_msa_sse_vsx_mapping[str(self.options.vsx)] - self._cmake.configure() - return self._cmake + tc.variables["PNG_POWERPC_VSX"] = self._neon_msa_sse_vsx_mapping[str(self.options.vsx)] + if Version(self.version) >= "1.6.38": + tc.variables["PNG_EXECUTABLES"] = False - def build(self): + tc.cache_variables["CMAKE_MACOSX_BUNDLE"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def _patch_sources(self): apply_conandata_patches(self) - self._patch() - cmake = self._configure_cmake() + if self.settings.os == "Windows": + if Version(self.version) <= "1.5.2": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + 'set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME}_static)', + 'set(PNG_LIB_NAME_STATIC ${PNG_LIB_NAME})') + else: + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + 'OUTPUT_NAME "${PNG_LIB_NAME}_static', + 'OUTPUT_NAME "${PNG_LIB_NAME}') + if not is_msvc(self): + if Version(self.version) < "1.6.38": + src_text = 'COMMAND "${CMAKE_COMMAND}" -E copy_if_different $ $/${DEST_FILE}' + else: + src_text = '''COMMAND "${CMAKE_COMMAND}" + -E copy_if_different + $ + $/${DEST_FILE}''' + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + src_text, + 'COMMAND "${CMAKE_COMMAND}" -E copy_if_different $/$ $/${DEST_FILE}') + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses", ignore_case=True, keep_path=False) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() if self.options.shared: rm(self, "*[!.dll]", os.path.join(self.package_folder, "bin")) @@ -173,19 +160,21 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + major_min_version = f"{Version(self.version).major}{Version(self.version).minor}" + self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "PNG") self.cpp_info.set_property("cmake_target_name", "PNG::PNG") - self.cpp_info.set_property("pkg_config_name", "libpng") # TODO: we should also create libpng16.pc file - - self.cpp_info.names["cmake_find_package"] = "PNG" - self.cpp_info.names["cmake_find_package_multi"] = "PNG" - - prefix = "lib" if self._is_msvc else "" - major_min_version = f"{Version(self.version).major}{Version(self.version).minor}" - suffix = major_min_version if self._is_msvc else "" - suffix += "d" if self._is_msvc and self.settings.build_type == "Debug" else "" + self.cpp_info.set_property("pkg_config_name", "libpng") + self.cpp_info.set_property("pkg_config_aliases", [f"libpng{major_min_version}"]) + prefix = "lib" if is_msvc(self) else "" + suffix = major_min_version if self.settings.os == "Windows" else "" + suffix += "d" if self.settings.os == "Windows" and self.settings.build_type == "Debug" else "" self.cpp_info.libs = [f"{prefix}png{suffix}"] if self.settings.os in ["Linux", "Android", "FreeBSD", "SunOS", "AIX"]: self.cpp_info.system_libs.append("m") + + # TODO: Remove after Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "PNG" + self.cpp_info.names["cmake_find_package_multi"] = "PNG" diff --git a/recipes/libpng/all/patches/0001-1.5.30-cmakefile-zlib.patch b/recipes/libpng/all/patches/0001-1.5.30-cmakefile-zlib.patch new file mode 100644 index 0000000000000..d78bd326e5e4c --- /dev/null +++ b/recipes/libpng/all/patches/0001-1.5.30-cmakefile-zlib.patch @@ -0,0 +1,49 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b861195..8e3d2ca 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -41,7 +41,7 @@ set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) + + # needed packages + find_package(ZLIB REQUIRED) +-include_directories(${ZLIB_INCLUDE_DIR}) ++include_directories(${ZLIB_INCLUDE_DIRS}) + + if(NOT WIN32) + find_library(M_LIBRARY +@@ -312,7 +312,7 @@ if(PNG_DEBUG) + endif() + + # NOW BUILD OUR TARGET +-include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR}) ++include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIRS}) + + unset(PNG_LIB_TARGETS) + +@@ -326,7 +326,7 @@ if(PNG_SHARED) + set_target_properties(png PROPERTIES PREFIX "lib") + set_target_properties(png PROPERTIES IMPORT_PREFIX "lib") + endif() +- target_link_libraries(png ${ZLIB_LIBRARY} ${M_LIBRARY}) ++ target_link_libraries(png ${ZLIB_LIBRARIES} ${M_LIBRARY}) + + if(UNIX AND AWK) + if(HAVE_LD_VERSION_SCRIPT) +@@ -361,7 +361,7 @@ if(PNG_STATIC) + # msvc does not append 'lib' - do it here to have consistent name + set_target_properties(png_static PROPERTIES PREFIX "lib") + endif() +- target_link_libraries(png_static ${ZLIB_LIBRARY} ${M_LIBRARY}) ++ target_link_libraries(png_static ${ZLIB_LIBRARIES} ${M_LIBRARY}) + endif() + + if(PNG_FRAMEWORK) +@@ -378,7 +378,7 @@ if(PNG_FRAMEWORK) + XCODE_ATTRIBUTE_INSTALL_PATH "@rpath" + PUBLIC_HEADER "${libpng_public_hdrs}" + OUTPUT_NAME png) +- target_link_libraries(png_framework ${ZLIB_LIBRARY} ${M_LIBRARY}) ++ target_link_libraries(png_framework ${ZLIB_LIBRARIES} ${M_LIBRARY}) + endif() + + if(NOT PNG_LIB_TARGETS) diff --git a/recipes/libpng/all/patches/CMakeLists-zlib.patch b/recipes/libpng/all/patches/0001-1.6.37-cmakefile-zlib.patch similarity index 100% rename from recipes/libpng/all/patches/CMakeLists-zlib.patch rename to recipes/libpng/all/patches/0001-1.6.37-cmakefile-zlib.patch diff --git a/recipes/libpng/all/patches/CMakeLists-ext-zlib.patch b/recipes/libpng/all/patches/CMakeLists-ext-zlib.patch deleted file mode 100644 index 2f5247bac91ef..0000000000000 --- a/recipes/libpng/all/patches/CMakeLists-ext-zlib.patch +++ /dev/null @@ -1,53 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8f2b7e8b4..9cc8ece16 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -39,7 +39,7 @@ set(PNGLIB_VERSION ${PNGLIB_MAJOR}.${PNGLIB_MINOR}.${PNGLIB_RELEASE}) - - # needed packages - find_package(ZLIB REQUIRED) --include_directories(${ZLIB_INCLUDE_DIR}) -+include_directories(${ZLIB_INCLUDE_DIRS}) - - if(NOT WIN32) - find_library(M_LIBRARY -@@ -155,12 +155,6 @@ if(MSVC) - add_definitions(-DPNG_NO_MODULEDEF -D_CRT_SECURE_NO_DEPRECATE) - endif(MSVC) - --if(PNG_SHARED OR NOT MSVC) -- #if building msvc static this has NOT to be defined -- add_definitions(-DZLIB_DLL) --endif() -- -- - if(PNG_CONSOLE_IO_SUPPORTED) - add_definitions(-DPNG_CONSOLE_IO_SUPPORTED) - endif() -@@ -182,7 +176,7 @@ if(NOT M_LIBRARY AND NOT WIN32) - endif() - - # NOW BUILD OUR TARGET --include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIR}) -+include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${ZLIB_INCLUDE_DIRS}) - - if(PNG_SHARED) - add_library(${PNG_LIB_NAME} SHARED ${libpng_sources}) -@@ -191,7 +185,7 @@ if(PNG_SHARED) - set_target_properties(${PNG_LIB_NAME} PROPERTIES PREFIX "lib") - set_target_properties(${PNG_LIB_NAME} PROPERTIES IMPORT_PREFIX "lib") - endif() -- target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARY} ${M_LIBRARY}) -+ target_link_libraries(${PNG_LIB_NAME} ${ZLIB_LIBRARIES} ${M_LIBRARY}) - endif() - - if(PNG_STATIC) -@@ -202,7 +196,7 @@ if(PNG_STATIC) - # msvc does not append 'lib' - do it here to have consistent name - set_target_properties(${PNG_LIB_NAME_STATIC} PROPERTIES PREFIX "lib") - endif() -- target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARY} ${M_LIBRARY}) -+ target_link_libraries(${PNG_LIB_NAME_STATIC} ${ZLIB_LIBRARIES} ${M_LIBRARY}) - endif() - - diff --git a/recipes/libpng/all/patches/CMakeLists-symlink.patch b/recipes/libpng/all/patches/CMakeLists-symlink.patch deleted file mode 100644 index 5fb66b3052596..0000000000000 --- a/recipes/libpng/all/patches/CMakeLists-symlink.patch +++ /dev/null @@ -1,90 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 8f2b7e8b4..503aa0149 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -298,33 +298,32 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - -+ get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME} LOCATION_${CMAKE_BUILD_TYPE}) -+ get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME) - # Create a symlink for libpng.dll.a => libpng15.dll.a on Cygwin - if(CYGWIN) - _png_generate_symlink_code(PNG_SHARED_IMPLIB_INSTALL_CODE -- ${PNGLIB_NAME}${CMAKE_IMPORT_LIBRARY_SUFFIX} -- libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}) -+ ${BUILD_TARGET_FILE} -+ libpng${CMAKE_IMPORT_LIBRARY_SUFFIX}) - install(CODE ${PNG_SHARED_IMPLIB_INSTALL_CODE}) -- install(FILES -- ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} -- DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_IMPORT_LIBRARY_SUFFIX} -+ DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - - if(NOT WIN32) - IF(CMAKE_LIBRARY_OUTPUT_DIRECTORY) - _png_generate_symlink_code(PNG_SHARED_INSTALL_CODE -- ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} -- ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}) -- install(CODE ${PNG_SHARED_INSTALL_CODE}) -- install(FILES -- ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} -+ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${BUILD_TARGET_FILE} -+ ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX}) -+ install(CODE ${PNG_SHARED_INSTALL_CODE}) -+ install(FILES ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) - ELSE(CMAKE_LIBRARY_OUTPUT_DIRECTORY) - _png_generate_symlink_code(PNG_SHARED_INSTALL_CODE -- ${PNGLIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} -- libpng${CMAKE_SHARED_LIBRARY_SUFFIX}) -+ ${BUILD_TARGET_FILE} -+ libpng${CMAKE_SHARED_LIBRARY_SUFFIX}) - install(CODE ${PNG_SHARED_INSTALL_CODE}) -- install(FILES -- ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} -+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_SHARED_LIBRARY_SUFFIX} - DESTINATION ${CMAKE_INSTALL_LIBDIR}) - ENDIF(CMAKE_LIBRARY_OUTPUT_DIRECTORY) - endif() -@@ -332,26 +331,27 @@ if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) - - if(PNG_STATIC) - install(TARGETS ${PNG_LIB_NAME_STATIC} -- ${PNG_EXPORT_RULE} -+ ${PNG_EXPORT_RULE} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ -+ get_target_property(BUILD_TARGET_LOCATION ${PNG_LIB_NAME_STATIC} LOCATION_${CMAKE_BUILD_TYPE}) -+ get_filename_component(BUILD_TARGET_FILE ${BUILD_TARGET_LOCATION} NAME) - if(NOT WIN32 OR CYGWIN) - IF(CMAKE_ARCHIVE_OUTPUT_DIRECTORY) - _png_generate_symlink_code(PNG_STATIC_INSTALL_CODE --${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} -- ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}) -+ ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/${BUILD_TARGET_FILE} -+ ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX}) - install(CODE ${PNG_STATIC_INSTALL_CODE}) -- install(FILES -- ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} -- DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} -+ DESTINATION ${CMAKE_INSTALL_LIBDIR}) - ELSE(CMAKE_ARCHIVE_OUTPUT_DIRECTORY) - _png_generate_symlink_code(PNG_STATIC_INSTALL_CODE -- ${PNGLIB_NAME}${CMAKE_STATIC_LIBRARY_SUFFIX} -- libpng${CMAKE_STATIC_LIBRARY_SUFFIX}) -+ ${BUILD_TARGET_FILE} -+ libpng${CMAKE_STATIC_LIBRARY_SUFFIX}) - install(CODE ${PNG_STATIC_INSTALL_CODE}) -- install(FILES -- ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} -- DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libpng${CMAKE_STATIC_LIBRARY_SUFFIX} -+ DESTINATION ${CMAKE_INSTALL_LIBDIR}) - ENDIF(CMAKE_ARCHIVE_OUTPUT_DIRECTORY) - endif() - endif() diff --git a/recipes/libpng/all/test_package/CMakeLists.txt b/recipes/libpng/all/test_package/CMakeLists.txt index aec951b3486ef..59e144e90a535 100644 --- a/recipes/libpng/all/test_package/CMakeLists.txt +++ b/recipes/libpng/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(PNG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PNG::PNG) +target_link_libraries(${PROJECT_NAME} PRIVATE PNG::PNG) diff --git a/recipes/libpng/all/test_package/conanfile.py b/recipes/libpng/all/test_package/conanfile.py index 5a3015b3b56a9..0a6bc68712d90 100644 --- a/recipes/libpng/all/test_package/conanfile.py +++ b/recipes/libpng/all/test_package/conanfile.py @@ -1,12 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -import re -import subprocess class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -14,15 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - if "arm" in self.settings.arch and not tools.os_info.is_macos: - self.test_arm() - else: - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - - def test_arm(self): - file_ext = "so" if self.options["libpng"].shared else "a" - lib_path = os.path.join(self.deps_cpp_info["libpng"].libdirs[0], "libpng.%s" % file_ext) - output = subprocess.check_output(["readelf", "-h", lib_path]).decode() - assert re.search(r"Machine:\s+ARM", output) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libpng/all/test_package/test_package.c b/recipes/libpng/all/test_package/test_package.c index f91843e1fe3f2..1f4c2a28428ab 100644 --- a/recipes/libpng/all/test_package/test_package.c +++ b/recipes/libpng/all/test_package/test_package.c @@ -1,14 +1,16 @@ #include #include +#include #include "png.h" -#include "zlib.h" -int main(void) -{ - fprintf(stderr, " Compiled with libpng %s; using libpng %s.\n", - PNG_LIBPNG_VER_STRING, png_libpng_ver); - fprintf(stderr, " Compiled with zlib %s; using zlib %s.\n", - ZLIB_VERSION, zlib_version); - return 0; +int main(void) { + png_structp png_ptr; + png_infop info_ptr; + + fprintf(stderr, " Compiled with libpng %s; using libpng %s.\n", PNG_LIBPNG_VER_STRING, png_libpng_ver); + png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + info_ptr = png_create_info_struct(png_ptr); + + return EXIT_SUCCESS; } diff --git a/recipes/libpng/all/test_v1_package/CMakeLists.txt b/recipes/libpng/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libpng/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libpng/all/test_v1_package/conanfile.py b/recipes/libpng/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/libpng/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libpng/config.yml b/recipes/libpng/config.yml index 48f07e0fd148c..feabbd00c1919 100644 --- a/recipes/libpng/config.yml +++ b/recipes/libpng/config.yml @@ -1,5 +1,9 @@ versions: + "1.6.39": + folder: all + "1.6.38": + folder: all "1.6.37": folder: all - "1.5.2": + "1.5.30": folder: all diff --git a/recipes/libpq/all/conandata.yml b/recipes/libpq/all/conandata.yml index c963d2f1693a5..6fdf2d404b3db 100644 --- a/recipes/libpq/all/conandata.yml +++ b/recipes/libpq/all/conandata.yml @@ -1,31 +1,19 @@ sources: + "14.5": + url: "https://ftp.postgresql.org/pub/source/v14.5/postgresql-14.5.tar.bz2" + sha256: "d4f72cb5fb857c9a9f75ec8cf091a1771272802f2178f0b2e65b7b6ff64f4a30" "14.2": url: "https://ftp.postgresql.org/pub/source/v14.2/postgresql-14.2.tar.bz2" sha256: "2cf78b2e468912f8101d695db5340cf313c2e9f68a612fb71427524e8c9a977a" "13.6": url: "https://ftp.postgresql.org/pub/source/v13.6/postgresql-13.6.tar.gz" sha256: "42dcde620b627d35bf51dfc2c1d0f7f25f44d3dbedd81cc459da2d2c9e859059" - "13.4": - url: "https://ftp.postgresql.org/pub/source/v13.4/postgresql-13.4.tar.gz" - sha256: "59d7bc523e78570c549876fed297ec3e46dd307e90f5b1d22f49181191cf203e" - "13.3": - url: "https://ftp.postgresql.org/pub/source/v13.3/postgresql-13.3.tar.gz" - sha256: "0b54a8a68dbfaf5dcddd89eb3922740143df50fbea02fefda8de743d8af99516" - "13.2": - url: "https://ftp.postgresql.org/pub/source/v13.2/postgresql-13.2.tar.gz" - sha256: "3386a40736332aceb055c7c9012ecc665188536d874d967fcc5a33e7992f8080" "12.10": url: "https://ftp.postgresql.org/pub/source/v12.10/postgresql-12.10.tar.gz" sha256: "987e008699d52d5de4bae0580416f6c75aa28016b11543c42f5fbde5efbdfb56" - "12.2": - url: "https://ftp.postgresql.org/pub/source/v12.2/postgresql-12.2.tar.gz" - sha256: "8808449444ee9b086054a6dcfbfb98029e4f8022372c2edf3de5b6d8f417c8e4" "11.15": url: "https://ftp.postgresql.org/pub/source/v11.15/postgresql-11.15.tar.gz" sha256: "5f6ef2add1acb93d69012a55c3f276b91f4f0c91aa9a91243d9c5737ed5b5541" - "11.9": - url: "https://ftp.postgresql.org/pub/source/v11.9/postgresql-11.9.tar.gz" - sha256: "e98a8649814e2fa632a5d86bfb91f1ad570d47b108bc5c0d0d854803282abb03" "10.20": url: "https://ftp.postgresql.org/pub/source/v10.20/postgresql-10.20.tar.gz" sha256: "403bdad47101f7c0a15824627dd0fa0ad4abf1fa26d2bde77dea8921da25a48e" @@ -33,6 +21,31 @@ sources: url: "https://ftp.postgresql.org/pub/source/v9.6.24/postgresql-9.6.24.tar.gz" sha256: "52947ecc119846eace5164399d173576c0d4a47ec116ae58a46a8fd0c576c7c3" patches: - "13.3": - - patch_file: "patches/13.3/001-Remove-thread-safety-check.patch" - base_path: "source_subfolder" + "14.5": + - patch_file: "patches/14.5/002-mingw-build-static-libraries.patch" + patch_description: "port MinGW: Enable building static libraries in MinGW." + patch_type: "portability" + "14.2": + - patch_file: "patches/14.2/002-mingw-build-static-libraries.patch" + patch_description: "port MinGW: Enable building static libraries in MinGW." + patch_type: "portability" + "13.6": + - patch_file: "patches/13.6/002-mingw-build-static-libraries.patch" + patch_description: "port MinGW: Enable building static libraries in MinGW." + patch_type: "portability" + "12.10": + - patch_file: "patches/12.10/002-mingw-build-static-libraries.patch" + patch_description: "port MinGW: Enable building static libraries in MinGW." + patch_type: "portability" + "11.15": + - patch_file: "patches/11.15/002-mingw-build-static-libraries.patch" + patch_description: "port MinGW: Enable building static libraries in MinGW." + patch_type: "portability" + "10.20": + - patch_file: "patches/10.20/002-mingw-build-static-libraries.patch" + patch_description: "port MinGW: Enable building static libraries in MinGW." + patch_type: "portability" + "9.6.24": + - patch_file: "patches/9.6.24/002-mingw-build-static-libraries.patch" + patch_description: "port MinGW: Enable building static libraries in MinGW." + patch_type: "portability" diff --git a/recipes/libpq/all/conanfile.py b/recipes/libpq/all/conanfile.py index bedadf84e5a0c..68b3ec7fee8cf 100644 --- a/recipes/libpq/all/conanfile.py +++ b/recipes/libpq/all/conanfile.py @@ -1,9 +1,16 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import os +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, unix_path, VCVars +from conan.tools.scm import Version import glob +import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class LibpqConan(ConanFile): @@ -28,16 +35,6 @@ class LibpqConan(ConanFile): "disable_rpath": False, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _is_clang8_x86(self): return self.settings.os == "Linux" and \ @@ -50,209 +47,201 @@ def _settings_build(self): return getattr(self, "settings_build", self.settings) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC - del self.options.disable_rpath + self.options.rm_safe("fPIC") + self.options.rm_safe("disable_rpath") def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1q") - - def validate(self): - if self.settings.os == "Windows" and self.settings.compiler == "gcc" and self.options.shared: - raise ConanInvalidConfiguration("static mingw build is not possible") + self.requires("openssl/1.1.1s") def build_requirements(self): - if self._is_msvc: - self.build_requires("strawberryperl/5.30.0.1") - elif self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("strawberryperl/5.32.1.1") + elif self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) - - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - args = ['--without-readline'] - args.append('--without-zlib') - args.append('--with-openssl' if self.options.with_openssl else '--without-openssl') - if tools.cross_building(self) and not self.options.with_openssl: - args.append("--disable-strong-random") - if tools.cross_building(self, skip_x64_x86=True): - args.append("USE_DEV_URANDOM=1") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if is_msvc(self): + vcvars = VCVars(self) + vcvars.generate() + config = "DEBUG" if self.settings.build_type == "Debug" else "RELEASE" + env = Environment() + env.define("CONFIG", config) + env.vars(self).save_script("conanbuild_msvc") + else: + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + tc.configure_args.append('--without-readline') + tc.configure_args.append('--without-zlib') + tc.configure_args.append('--with-openssl' if self.options.with_openssl else '--without-openssl') + if cross_building(self) and not self.options.with_openssl: + tc.configure_args.append("--disable-strong-random") + if cross_building(self, skip_x64_x86=True): + tc.configure_args.append("USE_DEV_URANDOM=1") if self.settings.os != "Windows" and self.options.disable_rpath: - args.append('--disable-rpath') + tc.configure_args.append('--disable-rpath') if self._is_clang8_x86: - self._autotools.flags.append("-msse2") - with tools.chdir(self._source_subfolder): - self._autotools.configure(args=args) - return self._autotools - - @property - def _make_args(self): - args = [] - if self.settings.os == "Windows": - args.append("MAKE_DLL={}".format(str(self.options.shared).lower())) - return args - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + tc.extra_cflags.append("-msse2") + tc.make_args.append(f"DESTDIR={unix_path(self, self.package_folder)}") + if self.settings.os == "Windows": + tc.make_args.append("MAKE_DLL={}".format(str(self.options.shared).lower())) + tc.generate() + AutotoolsDeps(self).generate() - if self._is_msvc: + def _patch_sources(self): + if is_msvc(self): # https://www.postgresql.org/docs/8.3/install-win32-libpq.html # https://github.com/postgres/postgres/blob/master/src/tools/msvc/README if not self.options.shared: - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "tools", "msvc", "MKvcbuild.pm"), + replace_in_file(self,os.path.join(self.source_folder, "src", "tools", "msvc", "MKvcbuild.pm"), "$libpq = $solution->AddProject('libpq', 'dll', 'interfaces',", "$libpq = $solution->AddProject('libpq', 'lib', 'interfaces',") - system_libs = ", ".join(["'{}.lib'".format(lib) for lib in self.deps_cpp_info.system_libs]) - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "tools", "msvc", "Project.pm"), + host_deps = [dep for _, dep in self.dependencies.host.items()] + system_libs = [] + for dep in host_deps: + system_libs.extend(dep.cpp_info.aggregated_components().system_libs) + + linked_system_libs = ", ".join(["'{}.lib'".format(lib) for lib in system_libs]) + replace_in_file(self,os.path.join(self.source_folder, "src", "tools", "msvc", "Project.pm"), "libraries => [],", - "libraries => [{}],".format(system_libs)) - if self.settings.compiler == "Visual Studio": - runtime = { - "MT": "MultiThreaded", - "MTd": "MultiThreadedDebug", - "MD": "MultiThreadedDLL", - "MDd": "MultiThreadedDebugDLL", - }.get(str(self.settings.compiler.runtime)) - else: - runtime = "MultiThreaded{}{}".format( - "Debug" if self.settings.compiler.runtime_type == "Debug" else "", - "DLL" if self.settings.compiler.runtime == "dynamic" else "", - ) - msbuild_project_pm = os.path.join(self._source_subfolder, "src", "tools", "msvc", "MSBuildProject.pm") - tools.replace_in_file(msbuild_project_pm, "", """ + "libraries => [{}],".format(linked_system_libs)) + runtime = { + "MT": "MultiThreaded", + "MTd": "MultiThreadedDebug", + "MD": "MultiThreadedDLL", + "MDd": "MultiThreadedDebugDLL", + }.get(msvc_runtime_flag(self)) + msbuild_project_pm = os.path.join(self.source_folder, "src", "tools", "msvc", "MSBuildProject.pm") + replace_in_file(self,msbuild_project_pm, "", """ $targetmachine """) - tools.replace_in_file(msbuild_project_pm, "'MultiThreadedDebugDLL'", "'%s'" % runtime) - tools.replace_in_file(msbuild_project_pm, "'MultiThreadedDLL'", "'%s'" % runtime) - config_default_pl = os.path.join(self._source_subfolder, "src", "tools", "msvc", "config_default.pl") - solution_pm = os.path.join(self._source_subfolder, "src", "tools", "msvc", "Solution.pm") + replace_in_file(self,msbuild_project_pm, "'MultiThreadedDebugDLL'", "'%s'" % runtime) + replace_in_file(self,msbuild_project_pm, "'MultiThreadedDLL'", "'%s'" % runtime) + config_default_pl = os.path.join(self.source_folder, "src", "tools", "msvc", "config_default.pl") + solution_pm = os.path.join(self.source_folder, "src", "tools", "msvc", "Solution.pm") if self.options.with_openssl: - for ssl in ["VC\libssl32", "VC\libssl64", "libssl"]: - tools.replace_in_file(solution_pm, + openssl = self.dependencies["openssl"] + for ssl in ["VC\\libssl32", "VC\\libssl64", "libssl"]: + replace_in_file(self,solution_pm, "%s.lib" % ssl, - "%s.lib" % self.deps_cpp_info["openssl"].libs[0]) - for crypto in ["VC\libcrypto32", "VC\libcrypto64", "libcrypto"]: - tools.replace_in_file(solution_pm, + "%s.lib" % openssl.cpp_info.components["ssl"].libs[0]) + for crypto in ["VC\\libcrypto32", "VC\\libcrypto64", "libcrypto"]: + replace_in_file(self,solution_pm, "%s.lib" % crypto, - "%s.lib" % self.deps_cpp_info["openssl"].libs[1]) - tools.replace_in_file(config_default_pl, + "%s.lib" % openssl.cpp_info.components["crypto"].libs[0]) + replace_in_file(self,config_default_pl, "openssl => undef", - "openssl => '%s'" % self.deps_cpp_info["openssl"].rootpath.replace("\\", "/")) - with tools.vcvars(self.settings): - config = "DEBUG" if self.settings.build_type == "Debug" else "RELEASE" - with tools.environment_append({"CONFIG": config}): - with tools.chdir(os.path.join(self._source_subfolder, "src", "tools", "msvc")): - self.run("perl build.pl libpq") - if not self.options.shared: - self.run("perl build.pl libpgport") + "openssl => '%s'" % openssl.package_folder.replace("\\", "/")) + elif self.settings.os == "Windows": + if self.settings.get_safe("compiler.threads") == "posix": + # Use MinGW pthread library + replace_in_file(self, os.path.join(self.source_folder, "src", "interfaces", "libpq", "Makefile"), + "ifeq ($(enable_thread_safety), yes)\nOBJS += pthread-win32.o\nendif", + "") + + def build(self): + apply_conandata_patches(self) + self._patch_sources() + if is_msvc(self): + with chdir(self, os.path.join(self.source_folder, "src", "tools", "msvc")): + self.run("perl build.pl libpq") + if not self.options.shared: + self.run("perl build.pl libpgport") else: - # relocatable shared lib on macOS - tools.replace_in_file( - os.path.join(self._source_subfolder, "src", "Makefile.shlib"), - "-install_name '$(libdir)/", - "-install_name '@rpath/", - ) - # avoid SIP issues on macOS when dependencies are shared - if tools.is_apple_os(self.settings.os): - libpaths = ":".join(self.deps_cpp_info.lib_paths) - tools.replace_in_file( - os.path.join(self._source_subfolder, "configure"), - "#! /bin/sh\n", - "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n".format(libpaths), - ) - autotools = self._configure_autotools() - with tools.chdir(os.path.join(self._source_subfolder, "src", "backend")): - autotools.make(args=self._make_args, target="generated-headers") - with tools.chdir(os.path.join(self._source_subfolder, "src", "common")): - autotools.make(args=self._make_args) - if tools.Version(self.version) >= "12": - with tools.chdir(os.path.join(self._source_subfolder, "src", "port")): - autotools.make(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "include")): - autotools.make(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "interfaces", "libpq")): - autotools.make(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "bin", "pg_config")): - autotools.make(args=self._make_args) + autotools = Autotools(self) + with chdir(self, os.path.join(self.source_folder)): + autotools.configure() + with chdir(self, os.path.join(self.source_folder, "src", "backend")): + autotools.make(target="generated-headers") + with chdir(self, os.path.join(self.source_folder, "src", "common")): + autotools.make() + with chdir(self, os.path.join(self.source_folder, "src", "include")): + autotools.make() + with chdir(self, os.path.join(self.source_folder, "src", "interfaces", "libpq")): + autotools.make() + if Version(self.version) >= 12: + with chdir(self, os.path.join(self.source_folder, "src", "port")): + autotools.make() + with chdir(self, os.path.join(self.source_folder, "src", "bin", "pg_config")): + autotools.make() def _remove_unused_libraries_from_package(self): + bin_folder = os.path.join(self.package_folder, "bin") + lib_folder = os.path.join(self.package_folder, "lib") + rm(self, "*.dll", lib_folder) if self.options.shared: - if self.settings.os == "Windows": - globs = [] - else: - globs = [os.path.join(self.package_folder, "lib", "*.a")] + for lib in glob.glob(os.path.join(lib_folder, "*.a")): + if not (self.settings.os == "Windows" and os.path.basename(lib) == "libpq.dll.a"): + os.remove(lib) else: - globs = [ - os.path.join(self.package_folder, "lib", "libpq.so*"), - os.path.join(self.package_folder, "bin", "*.dll"), - os.path.join(self.package_folder, "lib", "libpq*.dylib") - ] - if self.settings.os == "Windows": - os.unlink(os.path.join(self.package_folder, "lib", "libpq.dll")) - for globi in globs: - for file in glob.glob(globi): - os.remove(file) + rm(self, "*.dll", bin_folder) + rm(self, "*.dll.a", lib_folder) + rm(self, "*.so*", lib_folder) + rm(self, "*.dylib", lib_folder) def package(self): - self.copy(pattern="COPYRIGHT", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - self.copy("*postgres_ext.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*pg_config.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*pg_config_ext.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*libpq-fe.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*libpq-events.h", src=self._source_subfolder, dst="include", keep_path=False) - self.copy("*.h", src=os.path.join(self._source_subfolder, "src", "include", "libpq"), dst=os.path.join("include", "libpq"), keep_path=False) - self.copy("*genbki.h", src=self._source_subfolder, dst=os.path.join("include", "catalog"), keep_path=False) - self.copy("*pg_type.h", src=self._source_subfolder, dst=os.path.join("include", "catalog"), keep_path=False) + copy(self, "COPYRIGHT", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + copy(self, pattern="*postgres_ext.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*pg_config.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*pg_config_ext.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*libpq-fe.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*libpq-events.h", dst=os.path.join(self.package_folder, "include"), src=self.source_folder, keep_path=False) + copy(self, pattern="*.h", src=os.path.join(self.source_folder, "src", "include", "libpq"), + dst=os.path.join(self.package_folder, "include", "libpq"), + keep_path=False) + copy(self, pattern="*genbki.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include", "catalog"), keep_path=False) + copy(self, pattern="*pg_type.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include", "catalog"), keep_path=False) if self.options.shared: - self.copy("**/libpq.dll", src=self._source_subfolder, dst="bin", keep_path=False) - self.copy("**/libpq.lib", src=self._source_subfolder, dst="lib", keep_path=False) + copy(self, pattern="**/libpq.dll", dst=os.path.join(self.package_folder, "bin"), src=self.source_folder, keep_path=False) + copy(self, pattern="**/libpq.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False) else: - self.copy("*.lib", src=self._source_subfolder, dst="lib", keep_path=False) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.source_folder, keep_path=False) else: - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows)#self._configure_autotools() - with tools.chdir(os.path.join(self._source_subfolder, "src", "common")): - autotools.install(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "include")): - autotools.install(args=self._make_args) - with tools.chdir(os.path.join(self._source_subfolder, "src", "interfaces", "libpq")): - autotools.install(args=self._make_args) - if tools.Version(self.version) >= "12": - with tools.chdir(os.path.join(self._source_subfolder, "src", "port")): - autotools.install(args=self._make_args) - - with tools.chdir(os.path.join(self._source_subfolder, "src", "bin", "pg_config")): - autotools.install(args=self._make_args) - + autotools = Autotools(self) + with chdir(self, os.path.join(self.source_folder, "src", "common")): + autotools.install() + with chdir(self, os.path.join(self.source_folder, "src", "include")): + autotools.install() + with chdir(self, os.path.join(self.source_folder, "src", "interfaces", "libpq")): + autotools.install() + if Version(self.version) >= 12: + with chdir(self, os.path.join(self.source_folder, "src", "port")): + autotools.install() + with chdir(self, os.path.join(self.source_folder, "src", "bin", "pg_config")): + autotools.install() + copy(self, "*.h", src=os.path.join(self.build_folder, "src", "include", "catalog"), + dst=os.path.join(self.package_folder, "include", "catalog")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "include", "postgresql", "server")) self._remove_unused_libraries_from_package() - - tools.rmdir(os.path.join(self.package_folder, "include", "postgresql", "server")) - self.copy(pattern="*.h", dst=os.path.join("include", "catalog"), src=os.path.join(self._source_subfolder, "src", "include", "catalog")) - self.copy(pattern="*.h", dst=os.path.join("include", "catalog"), src=os.path.join(self._source_subfolder, "src", "backend", "catalog")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - - def _construct_library_name(self, name): - if self._is_msvc: - return "lib{}".format(name) - return name + fix_apple_shared_install_name(self) + copy(self, "*.h", src=os.path.join(self.build_folder, "src", "backend", "catalog"), + dst=os.path.join(self.package_folder, "include", "catalog")) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -260,35 +249,34 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "PostgreSQL::PostgreSQL") self.cpp_info.set_property("pkg_config_name", "libpq") - self.cpp_info.names["cmake_find_package"] = "PostgreSQL" - self.cpp_info.names["cmake_find_package_multi"] = "PostgreSQL" - self.env_info.PostgreSQL_ROOT = self.package_folder - self.cpp_info.components["pq"].libs = [self._construct_library_name("pq")] + self.cpp_info.components["pq"].libs = [f"{'lib' if is_msvc(self) else ''}pq"] if self.options.with_openssl: self.cpp_info.components["pq"].requires.append("openssl::openssl") if not self.options.shared: - if self._is_msvc: - if tools.Version(self.version) < "12": - self.cpp_info.components["pgport"].libs = ["libpgport"] - self.cpp_info.components["pq"].requires.extend(["pgport"]) - else: + if is_msvc(self): + self.cpp_info.components["pgport"].libs = ["libpgport"] + self.cpp_info.components["pq"].requires.append("pgport") + if Version(self.version) >= "12": self.cpp_info.components["pgcommon"].libs = ["libpgcommon"] - self.cpp_info.components["pgport"].libs = ["libpgport"] - self.cpp_info.components["pq"].requires.extend(["pgport", "pgcommon"]) + self.cpp_info.components["pq"].requires.append("pgcommon") else: - if tools.Version(self.version) < "12": - self.cpp_info.components["pgcommon"].libs = ["pgcommon"] - self.cpp_info.components["pq"].requires.extend(["pgcommon"]) - else: - self.cpp_info.components["pgcommon"].libs = ["pgcommon", "pgcommon_shlib"] + self.cpp_info.components["pgcommon"].libs = ["pgcommon"] + self.cpp_info.components["pq"].requires.append("pgcommon") + if Version(self.version) >= "12": + self.cpp_info.components["pgcommon"].libs.append("pgcommon_shlib") self.cpp_info.components["pgport"].libs = ["pgport", "pgport_shlib"] - self.cpp_info.components["pq"].requires.extend(["pgport", "pgcommon"]) + if self.settings.os == "Windows": + self.cpp_info.components["pgport"].system_libs = ["ws2_32"] + self.cpp_info.components["pgcommon"].requires.append("pgport") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["pq"].system_libs = ["pthread"] elif self.settings.os == "Windows": self.cpp_info.components["pq"].system_libs = ["ws2_32", "secur32", "advapi32", "shell32", "crypt32", "wldap32"] + + self.cpp_info.names["cmake_find_package"] = "PostgreSQL" + self.cpp_info.names["cmake_find_package_multi"] = "PostgreSQL" diff --git a/recipes/libpq/all/patches/10.20/002-mingw-build-static-libraries.patch b/recipes/libpq/all/patches/10.20/002-mingw-build-static-libraries.patch new file mode 100644 index 0000000000000..bfa322133c73c --- /dev/null +++ b/recipes/libpq/all/patches/10.20/002-mingw-build-static-libraries.patch @@ -0,0 +1,39 @@ +--- a/src/Makefile.shlib ++++ b/src/Makefile.shlib +@@ -371,7 +371,10 @@ else + # Win32 case + + # See notes in src/backend/parser/Makefile about the following two rules +-$(stlib): $(shlib) ++$(stlib): $(OBJS) | $(SHLIB_PREREQS) ++ rm -f $@ ++ $(LINK.static) $@ $^ ++ $(RANLIB) $@ + touch $@ + + # XXX A backend that loads a module linked with libgcc_s_dw2-1.dll will exit +@@ -384,12 +387,12 @@ $(stlib): $(shlib) + # Else we just use --export-all-symbols. + ifeq (,$(SHLIB_EXPORTS)) + $(shlib): $(OBJS) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=lib$(NAME).dll.a + else + DLL_DEFFILE = lib$(NAME)dll.def + + $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=lib$(NAME).dll.a + endif + + endif # PORTNAME == cygwin +@@ -484,6 +487,9 @@ endif # not aix + ifneq (,$(findstring $(PORTNAME),win32 cygwin)) + $(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)' + endif ++ifneq (,$(findstring $(PORTNAME),win32)) ++ $(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/lib$(NAME).dll.a' ++endif + else # no soname + $(INSTALL_SHLIB) $< '$(DESTDIR)$(pkglibdir)/$(shlib)' + endif diff --git a/recipes/libpq/all/patches/11.15/002-mingw-build-static-libraries.patch b/recipes/libpq/all/patches/11.15/002-mingw-build-static-libraries.patch new file mode 100644 index 0000000000000..bfa322133c73c --- /dev/null +++ b/recipes/libpq/all/patches/11.15/002-mingw-build-static-libraries.patch @@ -0,0 +1,39 @@ +--- a/src/Makefile.shlib ++++ b/src/Makefile.shlib +@@ -371,7 +371,10 @@ else + # Win32 case + + # See notes in src/backend/parser/Makefile about the following two rules +-$(stlib): $(shlib) ++$(stlib): $(OBJS) | $(SHLIB_PREREQS) ++ rm -f $@ ++ $(LINK.static) $@ $^ ++ $(RANLIB) $@ + touch $@ + + # XXX A backend that loads a module linked with libgcc_s_dw2-1.dll will exit +@@ -384,12 +387,12 @@ $(stlib): $(shlib) + # Else we just use --export-all-symbols. + ifeq (,$(SHLIB_EXPORTS)) + $(shlib): $(OBJS) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=lib$(NAME).dll.a + else + DLL_DEFFILE = lib$(NAME)dll.def + + $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=lib$(NAME).dll.a + endif + + endif # PORTNAME == cygwin +@@ -484,6 +487,9 @@ endif # not aix + ifneq (,$(findstring $(PORTNAME),win32 cygwin)) + $(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)' + endif ++ifneq (,$(findstring $(PORTNAME),win32)) ++ $(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/lib$(NAME).dll.a' ++endif + else # no soname + $(INSTALL_SHLIB) $< '$(DESTDIR)$(pkglibdir)/$(shlib)' + endif diff --git a/recipes/libpq/all/patches/12.10/002-mingw-build-static-libraries.patch b/recipes/libpq/all/patches/12.10/002-mingw-build-static-libraries.patch new file mode 100644 index 0000000000000..ee5dfabdf330e --- /dev/null +++ b/recipes/libpq/all/patches/12.10/002-mingw-build-static-libraries.patch @@ -0,0 +1,39 @@ +--- a/src/Makefile.shlib ++++ b/src/Makefile.shlib +@@ -370,7 +370,10 @@ else + # Win32 case + + # See notes in src/backend/parser/Makefile about the following two rules +-$(stlib): $(shlib) ++$(stlib): $(OBJS) | $(SHLIB_PREREQS) ++ rm -f $@ ++ $(LINK.static) $@ $^ ++ $(RANLIB) $@ + touch $@ + + # XXX A backend that loads a module linked with libgcc_s_dw2-1.dll will exit +@@ -383,12 +386,12 @@ $(stlib): $(shlib) + # Else we just use --export-all-symbols. + ifeq (,$(SHLIB_EXPORTS)) + $(shlib): $(OBJS) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=lib$(NAME).dll.a + else + DLL_DEFFILE = lib$(NAME)dll.def + + $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=lib$(NAME).dll.a + endif + + endif # PORTNAME == cygwin +@@ -483,6 +486,9 @@ endif # not aix + ifneq (,$(findstring $(PORTNAME),win32 cygwin)) + $(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)' + endif ++ifneq (,$(findstring $(PORTNAME),win32)) ++ $(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/lib$(NAME).dll.a' ++endif + else # no soname + $(INSTALL_SHLIB) $< '$(DESTDIR)$(pkglibdir)/$(shlib)' + endif diff --git a/recipes/libpq/all/patches/13.6/002-mingw-build-static-libraries.patch b/recipes/libpq/all/patches/13.6/002-mingw-build-static-libraries.patch new file mode 100644 index 0000000000000..ce58850706373 --- /dev/null +++ b/recipes/libpq/all/patches/13.6/002-mingw-build-static-libraries.patch @@ -0,0 +1,39 @@ +--- a/src/Makefile.shlib ++++ b/src/Makefile.shlib +@@ -358,7 +358,10 @@ else + # Win32 case + + # See notes in src/backend/parser/Makefile about the following two rules +-$(stlib): $(shlib) ++$(stlib): $(OBJS) | $(SHLIB_PREREQS) ++ rm -f $@ ++ $(LINK.static) $@ $^ ++ $(RANLIB) $@ + touch $@ + + # XXX A backend that loads a module linked with libgcc_s_dw2-1.dll will exit +@@ -371,12 +374,12 @@ $(stlib): $(shlib) + # Else we just use --export-all-symbols. + ifeq (,$(SHLIB_EXPORTS)) + $(shlib): $(OBJS) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=lib$(NAME).dll.a + else + DLL_DEFFILE = lib$(NAME)dll.def + + $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=lib$(NAME).dll.a + + UC_NAME = $(shell echo $(NAME) | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') + +@@ -452,6 +455,9 @@ endif # not aix + ifneq (,$(findstring $(PORTNAME),win32 cygwin)) + $(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)' + endif ++ifneq (,$(findstring $(PORTNAME),win32)) ++ $(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/lib$(NAME).dll.a' ++endif + else # no soname + $(INSTALL_SHLIB) $< '$(DESTDIR)$(pkglibdir)/$(shlib)' + endif diff --git a/recipes/libpq/all/patches/14.2/002-mingw-build-static-libraries.patch b/recipes/libpq/all/patches/14.2/002-mingw-build-static-libraries.patch new file mode 100644 index 0000000000000..ce58850706373 --- /dev/null +++ b/recipes/libpq/all/patches/14.2/002-mingw-build-static-libraries.patch @@ -0,0 +1,39 @@ +--- a/src/Makefile.shlib ++++ b/src/Makefile.shlib +@@ -358,7 +358,10 @@ else + # Win32 case + + # See notes in src/backend/parser/Makefile about the following two rules +-$(stlib): $(shlib) ++$(stlib): $(OBJS) | $(SHLIB_PREREQS) ++ rm -f $@ ++ $(LINK.static) $@ $^ ++ $(RANLIB) $@ + touch $@ + + # XXX A backend that loads a module linked with libgcc_s_dw2-1.dll will exit +@@ -371,12 +374,12 @@ $(stlib): $(shlib) + # Else we just use --export-all-symbols. + ifeq (,$(SHLIB_EXPORTS)) + $(shlib): $(OBJS) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=lib$(NAME).dll.a + else + DLL_DEFFILE = lib$(NAME)dll.def + + $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=lib$(NAME).dll.a + + UC_NAME = $(shell echo $(NAME) | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') + +@@ -452,6 +455,9 @@ endif # not aix + ifneq (,$(findstring $(PORTNAME),win32 cygwin)) + $(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)' + endif ++ifneq (,$(findstring $(PORTNAME),win32)) ++ $(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/lib$(NAME).dll.a' ++endif + else # no soname + $(INSTALL_SHLIB) $< '$(DESTDIR)$(pkglibdir)/$(shlib)' + endif diff --git a/recipes/libpq/all/patches/14.5/002-mingw-build-static-libraries.patch b/recipes/libpq/all/patches/14.5/002-mingw-build-static-libraries.patch new file mode 100644 index 0000000000000..ce58850706373 --- /dev/null +++ b/recipes/libpq/all/patches/14.5/002-mingw-build-static-libraries.patch @@ -0,0 +1,39 @@ +--- a/src/Makefile.shlib ++++ b/src/Makefile.shlib +@@ -358,7 +358,10 @@ else + # Win32 case + + # See notes in src/backend/parser/Makefile about the following two rules +-$(stlib): $(shlib) ++$(stlib): $(OBJS) | $(SHLIB_PREREQS) ++ rm -f $@ ++ $(LINK.static) $@ $^ ++ $(RANLIB) $@ + touch $@ + + # XXX A backend that loads a module linked with libgcc_s_dw2-1.dll will exit +@@ -371,12 +374,12 @@ $(stlib): $(shlib) + # Else we just use --export-all-symbols. + ifeq (,$(SHLIB_EXPORTS)) + $(shlib): $(OBJS) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=lib$(NAME).dll.a + else + DLL_DEFFILE = lib$(NAME)dll.def + + $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=lib$(NAME).dll.a + + UC_NAME = $(shell echo $(NAME) | tr 'abcdefghijklmnopqrstuvwxyz' 'ABCDEFGHIJKLMNOPQRSTUVWXYZ') + +@@ -452,6 +455,9 @@ endif # not aix + ifneq (,$(findstring $(PORTNAME),win32 cygwin)) + $(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)' + endif ++ifneq (,$(findstring $(PORTNAME),win32)) ++ $(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/lib$(NAME).dll.a' ++endif + else # no soname + $(INSTALL_SHLIB) $< '$(DESTDIR)$(pkglibdir)/$(shlib)' + endif diff --git a/recipes/libpq/all/patches/9.6.24/002-mingw-build-static-libraries.patch b/recipes/libpq/all/patches/9.6.24/002-mingw-build-static-libraries.patch new file mode 100644 index 0000000000000..c81e02bd78f53 --- /dev/null +++ b/recipes/libpq/all/patches/9.6.24/002-mingw-build-static-libraries.patch @@ -0,0 +1,39 @@ +--- a/src/Makefile.shlib ++++ b/src/Makefile.shlib +@@ -384,7 +384,10 @@ else + # Win32 case + + # See notes in src/backend/parser/Makefile about the following two rules +-$(stlib): $(shlib) ++$(stlib): $(OBJS) | $(SHLIB_PREREQS) ++ rm -f $@ ++ $(LINK.static) $@ $^ ++ $(RANLIB) $@ + touch $@ + + # XXX A backend that loads a module linked with libgcc_s_dw2-1.dll will exit +@@ -397,12 +400,12 @@ $(stlib): $(shlib) + # Else we just use --export-all-symbols. + ifeq (,$(SHLIB_EXPORTS)) + $(shlib): $(OBJS) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--export-all-symbols -Wl,--out-implib=lib$(NAME).dll.a + else + DLL_DEFFILE = lib$(NAME)dll.def + + $(shlib): $(OBJS) $(DLL_DEFFILE) | $(SHLIB_PREREQS) +- $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=$(stlib) ++ $(CC) $(CFLAGS) -shared -static-libgcc -o $@ $(OBJS) $(DLL_DEFFILE) $(LDFLAGS) $(LDFLAGS_SL) $(SHLIB_LINK) $(LIBS) -Wl,--out-implib=lib$(NAME).dll.a + endif + + endif # PORTNAME == cygwin +@@ -505,6 +508,9 @@ endif # not aix + ifneq (,$(findstring $(PORTNAME),win32 cygwin)) + $(INSTALL_SHLIB) $< '$(DESTDIR)$(bindir)/$(shlib)' + endif ++ifneq (,$(findstring $(PORTNAME),win32)) ++ $(INSTALL_SHLIB) $< '$(DESTDIR)$(libdir)/lib$(NAME).dll.a' ++endif + else # no soname + $(INSTALL_SHLIB) $< '$(DESTDIR)$(pkglibdir)/$(shlib)' + endif diff --git a/recipes/libpq/all/test_package/CMakeLists.txt b/recipes/libpq/all/test_package/CMakeLists.txt index 537d802359b5d..db0dafd7c0984 100644 --- a/recipes/libpq/all/test_package/CMakeLists.txt +++ b/recipes/libpq/all/test_package/CMakeLists.txt @@ -1,10 +1,6 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - +project(test_package LANGUAGES C) find_package(PostgreSQL REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PostgreSQL::PostgreSQL) +target_link_libraries(${PROJECT_NAME} PRIVATE PostgreSQL::PostgreSQL) diff --git a/recipes/libpq/all/test_package/conanfile.py b/recipes/libpq/all/test_package/conanfile.py index 8a563eaeb2264..e845ae751a301 100644 --- a/recipes/libpq/all/test_package/conanfile.py +++ b/recipes/libpq/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libpq/all/test_package/test_package.c b/recipes/libpq/all/test_package/test_package.c index 24f73efe6fc7c..4214d8be7e3ac 100644 --- a/recipes/libpq/all/test_package/test_package.c +++ b/recipes/libpq/all/test_package/test_package.c @@ -11,7 +11,7 @@ int main() { conn = PQconnectdb("dbname = postgres"); PQstatus(conn); - + PQfinish(conn); return EXIT_SUCCESS; } diff --git a/recipes/libpq/all/test_v1_package/CMakeLists.txt b/recipes/libpq/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de3b75d9538de --- /dev/null +++ b/recipes/libpq/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libpq/all/test_v1_package/conanfile.py b/recipes/libpq/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5f9efeb33878b --- /dev/null +++ b/recipes/libpq/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libpq/config.yml b/recipes/libpq/config.yml index 3c16a63a04d1d..a2b649a937afd 100644 --- a/recipes/libpq/config.yml +++ b/recipes/libpq/config.yml @@ -1,22 +1,14 @@ versions: + "14.5": + folder: all "14.2": folder: all "13.6": folder: all - "13.4": - folder: all - "13.3": - folder: all - "13.2": - folder: all "12.10": folder: all - "12.2": - folder: all "11.15": folder: all - "11.9": - folder: all "10.20": folder: all "9.6.24": diff --git a/recipes/libpqxx/all/CMakeLists.txt b/recipes/libpqxx/all/CMakeLists.txt deleted file mode 100644 index 9079100af539d..0000000000000 --- a/recipes/libpqxx/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libpqxx/all/conandata.yml b/recipes/libpqxx/all/conandata.yml index 10b3906f5acf4..2c06aed5e9bb9 100644 --- a/recipes/libpqxx/all/conandata.yml +++ b/recipes/libpqxx/all/conandata.yml @@ -1,206 +1,75 @@ sources: - "7.0.1": - url: "https://github.com/jtv/libpqxx/archive/7.0.1.tar.gz" - sha256: "8c607ea4142223823ec400a3ff8f9561e8674e5888243cb7c6a610bf548ae0f0" - "7.0.2": - url: "https://github.com/jtv/libpqxx/archive/7.0.2.tar.gz" - sha256: "0e99df348623f2adaee5c79405279fb0e0182b9f4aebedb6bf007d982ab90dff" - "7.0.3": - url: "https://github.com/jtv/libpqxx/archive/7.0.3.tar.gz" - sha256: "7e28ad68cf6563246d97ccdeba5996dd71316c589f39b253f2cb2fbac0c2f7ef" - "7.0.4": - url: "https://github.com/jtv/libpqxx/archive/7.0.4.tar.gz" - sha256: "b56b441eb49755b39f0ba194b81047f7596540ee23c1caa8aa1b963f1bded9f5" - "7.0.5": - url: "https://github.com/jtv/libpqxx/archive/7.0.5.tar.gz" - sha256: "64f60d26a1ebc56fa356b9e3f18bd5b0f2ffbb0f123165ab1a5389ce0a9eeb1e" - "7.0.6": - url: "https://github.com/jtv/libpqxx/archive/7.0.6.tar.gz" - sha256: "8905377a387dfcc950fc03cc3a6c0e02825065207f20f563f0bd2a5ddfdd3bcc" - "7.0.7": - url: "https://github.com/jtv/libpqxx/archive/7.0.7.tar.gz" - sha256: "856fffb76141a236df608a86aa7d63b04f82816c9bbf80d33189705a0b2682eb" - "7.1.1": - url: "https://github.com/jtv/libpqxx/archive/7.1.1.tar.gz" - sha256: "cdf1efdc77de20e65f3affa0d4d9f819891669feb159eff8893696bf7692c00d" - "7.1.2": - url: "https://github.com/jtv/libpqxx/archive/7.1.2.tar.gz" - sha256: "3af7b4cfd572c67275ad24fea31bcf9d9f365ec16a1b7e90d4bde930936707f3" - "7.2.0": - url: "https://github.com/jtv/libpqxx/archive/7.2.0.tar.gz" - sha256: "c482a31c5d08402bc9e8df8291bed3555640ea80b3cb354fca958b1b469870dd" - "7.2.1": - url: "https://github.com/jtv/libpqxx/archive/7.2.1.tar.gz" - sha256: "3fd8318d2e421483495bf1a8ea1365fce4105934e9600ca87be0dff470d8c8dc" - "7.3.0": - url: "https://github.com/jtv/libpqxx/archive/7.3.0.tar.gz" - sha256: "55563821727310828cd79737732ca7e14a49dbbaa86bdce7c5829d440dafde59" - "7.3.1": - url: "https://github.com/jtv/libpqxx/archive/7.3.1.tar.gz" - sha256: "c794e7e5c4f1ef078463ecafe747a6508a0272d83b32a8cdcfb84bb37218a78b" - "7.3.2": - url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.3.2.tar.gz" - sha256: "493991345de5cbddfed8836917a333add2cd00ecbfd21b1acbc9345ce784225f" - "7.4.0": - url: "https://github.com/jtv/libpqxx/archive/7.4.0.tar.gz" - sha256: "930e95d0c709905f9d842081cd33b5226f5803ed1fc6ef5b6e3b131ddaeddecb" - "7.4.1": - url: "https://github.com/jtv/libpqxx/archive/7.4.1.tar.gz" - sha256: "73b2f0a0af786d6039291b60250bee577bc7ea7c10b7550ec37da448940848b7" - "7.4.2": - url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.4.2.tar.gz" - sha256: "325d50c51a417e890f7d71805f90a8d7949dce659f721b0f15d7f91bf954091d" - "7.5.0": - url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.5.0.tar.gz" - sha256: "62744ddba939880675f1e76275c98c1653f60b0e725f013299f4a437351bf2b0" - "7.5.1": - url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.5.1.tar.gz" - sha256: "16a3a4097a6772a9824ba584dbe5a1feee163ab954b94497358fe591eb236e3d" - "7.5.2": - url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.5.2.tar.gz" - sha256: "62e140667fb1bc9b61fa01cbf46f8ff73236eba6f3f7fbcf98108ce6bbc18dcd" - "7.5.3": - url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.5.3.tar.gz" - sha256: "4229ed9205e484a4bafb10edd6ce75b98c12d63c082a98baada0c01766d218e0" - "7.6.0": - url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.6.0.tar.gz" - sha256: "8194ce4eff3fee5325963ccc28d3542cfaa54ba1400833d0df6948de3573c118" - "7.6.1": - url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.6.1.tar.gz" - sha256: "7f4ad37fce20e8c9a61387cd5d6f85cf264f2bc9c0e6b27e8d5751a5429f87d0" - "7.7.0": - url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.7.0.tar.gz" - sha256: "2d99de960aa3016915bc69326b369fcee04425e57fbe9dad48dd3fa6203879fb" - "7.7.2": - url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.7.2.tar.gz" - sha256: "4b7a0b67cbd75d1c31e1e8a07c942ffbe9eec4e32c29b15d71cc225dc737e243" - "7.7.3": - url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.7.3.tar.gz" - sha256: "11e147bbe2d3024d68d29b38eab5d75899dbb6131e421a2dbf9f88bac9bf4b0d" "7.7.4": url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.7.4.tar.gz" sha256: "65b0a06fffd565a19edacedada1dcfa0c1ecd782cead0ee067b19e2464875c36" -patches: - "7.0.1": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-missing-limits-include.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-not-declared-dumb_stringstream-7.0.1_to_7.0.5.patch" - base_path: "source_subfolder" - "7.0.2": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-missing-limits-include.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-not-declared-dumb_stringstream-7.0.1_to_7.0.5.patch" - base_path: "source_subfolder" - "7.0.3": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-missing-limits-include.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-not-declared-dumb_stringstream-7.0.1_to_7.0.5.patch" - base_path: "source_subfolder" - "7.0.4": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-missing-limits-include.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-not-declared-dumb_stringstream-7.0.1_to_7.0.5.patch" - base_path: "source_subfolder" - "7.0.5": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-not-declared-dumb_stringstream-7.0.1_to_7.0.5.patch" - base_path: "source_subfolder" - "7.0.6": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-not-declared-dumb_stringstream-7.0.6_to_7.0.7.patch" - base_path: "source_subfolder" - "7.0.7": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-not-declared-dumb_stringstream-7.0.6_to_7.0.7.patch" - base_path: "source_subfolder" - "7.1.1": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-not-declared-dumb_stringstream-7.1.1.patch" - base_path: "source_subfolder" - "7.1.2": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - "7.2.0": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - "7.2.1": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - "7.3.0": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - "7.3.1": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-msvc-compilation-7.3.1.patch" - base_path: "source_subfolder" - "7.3.2": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-msvc-compilation-7.3.1.patch" - base_path: "source_subfolder" - "7.4.0": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-apple-clang-compilation-7.4.0.patch" - base_path: "source_subfolder" - "7.4.1": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" + "7.7.3": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.7.3.tar.gz" + sha256: "11e147bbe2d3024d68d29b38eab5d75899dbb6131e421a2dbf9f88bac9bf4b0d" + "7.7.2": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.7.2.tar.gz" + sha256: "4b7a0b67cbd75d1c31e1e8a07c942ffbe9eec4e32c29b15d71cc225dc737e243" + "7.7.0": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.7.0.tar.gz" + sha256: "2d99de960aa3016915bc69326b369fcee04425e57fbe9dad48dd3fa6203879fb" + "7.6.1": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.6.1.tar.gz" + sha256: "7f4ad37fce20e8c9a61387cd5d6f85cf264f2bc9c0e6b27e8d5751a5429f87d0" + "7.6.0": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.6.0.tar.gz" + sha256: "8194ce4eff3fee5325963ccc28d3542cfaa54ba1400833d0df6948de3573c118" + "7.5.3": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.5.3.tar.gz" + sha256: "4229ed9205e484a4bafb10edd6ce75b98c12d63c082a98baada0c01766d218e0" "7.4.2": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.4.2.tar.gz" + sha256: "325d50c51a417e890f7d71805f90a8d7949dce659f721b0f15d7f91bf954091d" + "7.3.2": + url: "https://github.com/jtv/libpqxx/archive/refs/tags/7.3.2.tar.gz" + sha256: "493991345de5cbddfed8836917a333add2cd00ecbfd21b1acbc9345ce784225f" + "7.2.1": + url: "https://github.com/jtv/libpqxx/archive/7.2.1.tar.gz" + sha256: "3fd8318d2e421483495bf1a8ea1365fce4105934e9600ca87be0dff470d8c8dc" + "7.1.2": + url: "https://github.com/jtv/libpqxx/archive/7.1.2.tar.gz" + sha256: "3af7b4cfd572c67275ad24fea31bcf9d9f365ec16a1b7e90d4bde930936707f3" + "7.0.7": + url: "https://github.com/jtv/libpqxx/archive/7.0.7.tar.gz" + sha256: "856fffb76141a236df608a86aa7d63b04f82816c9bbf80d33189705a0b2682eb" + "6.4.8": + url: "https://github.com/jtv/libpqxx/archive/6.4.8.tar.gz" + sha256: "3f7aba951822e01f1b9f9f353702954773323dd9f9dc376ffb57cb6bbd9a7a2f" +patches: + "7.7.4": - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - "7.5.0": - - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - "7.5.1": + "7.7.3": - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - "7.5.2": + "7.7.2": - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - "7.5.3": + - patch_file: "patches/fix-install-library-symlink-7.7.2.patch" + "7.7.0": - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - "7.6.0": + - patch_file: "patches/fix-clang-compilation-7.7.0.patch" + "7.6.1": - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - patch_file: "patches/fix-inline-constexpr-local-variable-problem-7.6.0.patch" - base_path: "source_subfolder" - patch_file: "patches/fix-remove-unlikely-annotation-before-return-7.6.0_to_7.6.1.patch" - base_path: "source_subfolder" - "7.6.1": + "7.6.0": - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - patch_file: "patches/fix-inline-constexpr-local-variable-problem-7.6.0.patch" - base_path: "source_subfolder" - patch_file: "patches/fix-remove-unlikely-annotation-before-return-7.6.0_to_7.6.1.patch" - base_path: "source_subfolder" - "7.7.0": + "7.5.3": - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-clang-compilation-7.7.0.patch" - base_path: "source_subfolder" - "7.7.2": + "7.4.2": - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - - patch_file: "patches/fix-install-library-symlink-7.7.2.patch" - base_path: "source_subfolder" - "7.7.3": + "7.3.2": - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" - "7.7.4": + - patch_file: "patches/fix-msvc-compilation-7.3.1.patch" + "7.2.1": + - patch_file: "patches/0001-cmake-fix-module.patch" + "7.1.2": - patch_file: "patches/0001-cmake-fix-module.patch" - base_path: "source_subfolder" + "7.0.7": + - patch_file: "patches/0001-cmake-fix-module.patch" + - patch_file: "patches/fix-not-declared-dumb_stringstream-7.0.6_to_7.0.7.patch" + "6.4.8": + - patch_file: "patches/0001-cmake-fix-module-6.4.8.patch" diff --git a/recipes/libpqxx/all/conanfile.py b/recipes/libpqxx/all/conanfile.py index bb256b4fcf3c5..ef9bfe326bc0a 100644 --- a/recipes/libpqxx/all/conanfile.py +++ b/recipes/libpqxx/all/conanfile.py @@ -1,18 +1,21 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.microsoft import check_min_vs, is_msvc, msvc_runtime_flag +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class LibpqxxConan(ConanFile): name = "libpqxx" description = "The official C++ client API for PostgreSQL" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/jtv/libpqxx" - license = "BSD-3-Clause" topics = ("libpqxx", "postgres", "postgresql", "database", "db") settings = "os", "arch", "compiler", "build_type" @@ -25,24 +28,31 @@ class LibpqxxConan(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package" - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 if Version(self.version) < "7.0" else "17" @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + if Version(self.version) < "7.0": + return { + "gcc": "7", + "clang": "6", + "apple-clang": "10" + } + else: + return { + "gcc": "7" if Version(self.version) < "7.5.0" else "8", + "clang": "6", + "apple-clang": "10" + } @property def _mac_os_minimum_required_version(self): return "10.15" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -50,77 +60,70 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libpq/14.2") + self.requires("libpq/14.5") def validate(self): - if self.options.shared and msvc_runtime_flag(self) == "MTd": - raise ConanInvalidConfiguration( - "{} recipes does not support build shared library with MTd runtime." - .format(self.name,)) - - compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version) - - lib_version = tools.Version(self.version) - lib_version_7_6_0_or_later = lib_version >= "7.6.0" - minimum_compiler_version = { - "Visual Studio": "16" if lib_version_7_6_0_or_later else "15", - "msvc": "192" if lib_version_7_6_0_or_later else "191", - "gcc": "8" if lib_version >= "7.5.0" else "7", - "clang": "6", - "apple-clang": "10" - } - - minimum_cpp_standard = 17 - - if compiler in minimum_compiler_version and \ - compiler_version < minimum_compiler_version[compiler]: - raise ConanInvalidConfiguration("{} requires a compiler that supports" - " at least C++{}. {} {} is not" - " supported." - .format(self.name, minimum_cpp_standard, compiler, compiler_version)) - - if self.settings.os == "Macos": + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + if Version(self.version) < "7.0": + check_min_vs(self, 190) + elif Version(self.version) < "7.6": + check_min_vs(self, 191) + else: + check_min_vs(self, 192) + + if is_msvc(self) and self.options.shared and msvc_runtime_flag(self) == "MTd": + raise ConanInvalidConfiguration(f"{self.ref} recipes does not support build shared library with MTd runtime.") + + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + if is_apple_os(self): os_version = self.settings.get_safe("os.version") - if os_version and tools.Version(os_version) < self._mac_os_minimum_required_version: + if os_version and Version(os_version) < self._mac_os_minimum_required_version: raise ConanInvalidConfiguration( "Macos Mojave (10.14) and earlier cannot to be built because C++ standard library too old.") - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, minimum_cpp_standard) - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_DOC"] = False - cmake.definitions["BUILD_TEST"] = False + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_DOC"] = False + tc.variables["BUILD_TEST"] = False # Set `-mmacosx-version-min` to enable C++17 standard library support. - cmake.definitions["CMAKE_OSX_DEPLOYMENT_TARGET"] = self._mac_os_minimum_required_version - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["CMAKE_OSX_DEPLOYMENT_TARGET"] = self._mac_os_minimum_required_version + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "libpqxx") @@ -131,6 +134,8 @@ def package_info(self): self.cpp_info.components["pqxx"].libs = ["pqxx"] if self.settings.os == "Windows": self.cpp_info.components["pqxx"].system_libs = ["wsock32", "ws2_32"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.components["pqxx"].set_property("cmake_target_name", "libpqxx::pqxx") diff --git a/recipes/libpqxx/all/patches/0001-cmake-fix-module-6.4.8.patch b/recipes/libpqxx/all/patches/0001-cmake-fix-module-6.4.8.patch new file mode 100644 index 0000000000000..5d0c9b14d2933 --- /dev/null +++ b/recipes/libpqxx/all/patches/0001-cmake-fix-module-6.4.8.patch @@ -0,0 +1,14 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 86ffa24..e35824b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -10,7 +10,8 @@ if(NOT "${CMAKE_CXX_STANDARD}") + endif() + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) +-set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) ++list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) ++ + + if(NOT SKIP_BUILD_TEST) + option(BUILD_TEST "Build all test cases" ON) diff --git a/recipes/libpqxx/all/test_package/CMakeLists.txt b/recipes/libpqxx/all/test_package/CMakeLists.txt index 62daf80d31651..e27c585fd702f 100644 --- a/recipes/libpqxx/all/test_package/CMakeLists.txt +++ b/recipes/libpqxx/all/test_package/CMakeLists.txt @@ -3,13 +3,15 @@ cmake_minimum_required(VERSION 3.8) # Set `-mmacosx-version-min` to enable C++17 standard library support. set(CMAKE_OSX_DEPLOYMENT_TARGET "10.15" CACHE STRING "Minimum OS X deployment version") -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(libpqxx REQUIRED CONFIG) + add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} libpqxx::pqxx) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +target_link_libraries(${PROJECT_NAME} PRIVATE libpqxx::pqxx) +if(libpqxx_VERSION VERSION_LESS "7.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/libpqxx/all/test_package/conanfile.py b/recipes/libpqxx/all/test_package/conanfile.py index 38f4483872d47..a9fbb7f543162 100644 --- a/recipes/libpqxx/all/test_package/conanfile.py +++ b/recipes/libpqxx/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libpqxx/all/test_v1_package/CMakeLists.txt b/recipes/libpqxx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libpqxx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libpqxx/all/test_v1_package/conanfile.py b/recipes/libpqxx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/libpqxx/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libpqxx/config.yml b/recipes/libpqxx/config.yml index f43dce2dba572..386cd99b2403f 100644 --- a/recipes/libpqxx/config.yml +++ b/recipes/libpqxx/config.yml @@ -1,55 +1,27 @@ versions: - "7.0.1": - folder: all - "7.0.2": - folder: all - "7.0.3": - folder: all - "7.0.4": - folder: all - "7.0.5": - folder: all - "7.0.6": - folder: all - "7.0.7": - folder: all - "7.1.1": - folder: all - "7.1.2": - folder: all - "7.2.0": - folder: all - "7.2.1": - folder: all - "7.3.0": - folder: all - "7.3.1": - folder: all - "7.3.2": - folder: all - "7.4.0": + "7.7.4": folder: all - "7.4.1": + "7.7.3": folder: all - "7.4.2": + "7.7.2": folder: all - "7.5.0": + "7.7.0": folder: all - "7.5.1": + "7.6.1": folder: all - "7.5.2": + "7.6.0": folder: all "7.5.3": folder: all - "7.6.0": + "7.4.2": folder: all - "7.6.1": + "7.3.2": folder: all - "7.7.0": + "7.2.1": folder: all - "7.7.2": + "7.1.2": folder: all - "7.7.3": + "7.0.7": folder: all - "7.7.4": + "6.4.8": folder: all diff --git a/recipes/libraw/all/CMakeLists.txt b/recipes/libraw/all/CMakeLists.txt index 2022d590fa2a2..1aba64dbf532a 100644 --- a/recipes/libraw/all/CMakeLists.txt +++ b/recipes/libraw/all/CMakeLists.txt @@ -1,20 +1,24 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) +project(LibRaw LANGUAGES CXX) -project(LibRaw) +file(GLOB_RECURSE headers "${LIBRAW_SRC_DIR}/libraw/*.h") -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) -file(GLOB_RECURSE headers "source_subfolder/libraw/*.h") +if(RAW_LIB_VERSION_STRING VERSION_LESS 0.21) + set(libraw_LIB_SRCS ${LIBRAW_SRC_DIR}/internal/dcraw_common.cpp + ${LIBRAW_SRC_DIR}/internal/dcraw_fileio.cpp + ${LIBRAW_SRC_DIR}/internal/demosaic_packs.cpp + ${LIBRAW_SRC_DIR}/src/libraw_cxx.cpp + ${LIBRAW_SRC_DIR}/src/libraw_c_api.cpp + ${LIBRAW_SRC_DIR}/src/libraw_datastream.cpp + ) +else() + file(GLOB_RECURSE libraw_LIB_SRCS CONFIGURE_DEPENDS "${LIBRAW_SRC_DIR}/src/*.cpp") -set(sources - "source_subfolder/src/libraw_c_api.cpp" - "source_subfolder/src/libraw_cxx.cpp" - "source_subfolder/src/libraw_datastream.cpp" - "source_subfolder/internal/dcraw_common.cpp" - "source_subfolder/internal/dcraw_fileio.cpp" - "source_subfolder/internal/demosaic_packs.cpp" -) + # Exclude placeholder (stub) implementations + file(GLOB_RECURSE exclude_libraw_LIB_SRCS CONFIGURE_DEPENDS "${LIBRAW_SRC_DIR}/src/*_ph.cpp") + list(REMOVE_ITEM libraw_LIB_SRCS ${exclude_libraw_LIB_SRCS}) +endif() if(WIN32) add_definitions(-DWIN32) @@ -26,32 +30,41 @@ if(WIN32) endif() endif() -if (TARGET CONAN_PKG::libjpeg OR TARGET CONAN_PKG::libjpeg-turbo) +find_package(JPEG CONFIG) +find_package(libjpeg-turbo CONFIG) +find_package(lcms CONFIG) +find_package(Jasper CONFIG) + +if (TARGET JPEG::JPEG OR TARGET libjpeg-turbo::jpeg OR TARGET libjpeg-turbo::jpeg_static) add_definitions(-DUSE_JPEG -DUSE_JPEG8) endif () -if (TARGET CONAN_PKG::lcms) +if (TARGET lcms::lcms) add_definitions(-DUSE_LCMS2) endif () -if (TARGET CONAN_PKG::jasper) +if (TARGET Jasper::Jasper) add_definitions(-DUSE_JASPER) endif () -add_library(raw ${headers} ${sources}) -set_property(TARGET raw PROPERTY CXX_STANDARD 11) -target_include_directories(raw PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/") +add_library(raw ${headers} ${libraw_LIB_SRCS}) +target_compile_features(raw PRIVATE cxx_std_11) +target_include_directories(raw PUBLIC "${LIBRAW_SRC_DIR}") +set_target_properties(raw PROPERTIES LINKER_LANGUAGE CXX) target_compile_options(raw PUBLIC $<$:/W0>) -if (TARGET CONAN_PKG::libjpeg) - target_link_libraries(raw PUBLIC CONAN_PKG::libjpeg) +if (TARGET JPEG::JPEG) + target_link_libraries(raw PUBLIC JPEG::JPEG) +endif () +if (TARGET libjpeg-turbo::jpeg) + target_link_libraries(raw PUBLIC libjpeg-turbo::jpeg) endif () -if (TARGET CONAN_PKG::libjpeg-turbo) - target_link_libraries(raw PUBLIC CONAN_PKG::libjpeg-turbo) +if (TARGET libjpeg-turbo::jpeg_static) + target_link_libraries(raw PUBLIC libjpeg-turbo::jpeg_static) endif () -if (TARGET CONAN_PKG::lcms) - target_link_libraries(raw PUBLIC CONAN_PKG::lcms) +if (TARGET lcms::lcms) + target_link_libraries(raw PUBLIC lcms::lcms) endif () -if (TARGET CONAN_PKG::jasper) - target_link_libraries(raw PUBLIC CONAN_PKG::jasper) +if (TARGET Jasper::Jasper) + target_link_libraries(raw PUBLIC Jasper::Jasper) endif () -install(DIRECTORY "source_subfolder/libraw" DESTINATION include) +install(DIRECTORY "${LIBRAW_SRC_DIR}/libraw" DESTINATION include) install(TARGETS raw ARCHIVE DESTINATION lib RUNTIME DESTINATION bin LIBRARY DESTINATION lib) diff --git a/recipes/libraw/all/conandata.yml b/recipes/libraw/all/conandata.yml index 47981769832c6..2293cc11d33ee 100644 --- a/recipes/libraw/all/conandata.yml +++ b/recipes/libraw/all/conandata.yml @@ -1,10 +1,13 @@ sources: - "0.19.5": - url: "https://github.com/LibRaw/LibRaw/archive/0.19.5.tar.gz" - sha256: "9a2a40418e4fb0ab908f6d384ff6f9075f4431f8e3d79a0e44e5a6ea9e75abdc" - "0.20.0": - url: "https://github.com/LibRaw/LibRaw/archive/0.20.0.tar.gz" - sha256: "f38cd2620d5adc32d2c9f51cd0dc66d72c75671f1c81dfd13d30c45c6be80d40" + "0.21.1": + url: "https://github.com/LibRaw/LibRaw/archive/0.21.1.tar.gz" + sha256: "b63d7ffa43463f74afcc02f9083048c231349b41cc9255dec0840cf8a67b52e0" "0.20.2": url: "https://github.com/LibRaw/LibRaw/archive/0.20.2.tar.gz" sha256: "02df7d403b34602b769bb38e5bf7d4258e075eeefbe980b6832e6e1491989d60" + "0.20.0": + url: "https://github.com/LibRaw/LibRaw/archive/0.20.0.tar.gz" + sha256: "f38cd2620d5adc32d2c9f51cd0dc66d72c75671f1c81dfd13d30c45c6be80d40" + "0.19.5": + url: "https://github.com/LibRaw/LibRaw/archive/0.19.5.tar.gz" + sha256: "9a2a40418e4fb0ab908f6d384ff6f9075f4431f8e3d79a0e44e5a6ea9e75abdc" diff --git a/recipes/libraw/all/conanfile.py b/recipes/libraw/all/conanfile.py index 47b1f62f9d69b..e68c86171e78e 100644 --- a/recipes/libraw/all/conanfile.py +++ b/recipes/libraw/all/conanfile.py @@ -1,17 +1,19 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.tools.files import get, copy, collect_libs +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os +required_conan_version = ">=1.53.0" + class LibRawConan(ConanFile): name = "libraw" description = "LibRaw is a library for reading RAW files obtained from digital photo cameras (CRW/CR2, NEF, RAF, DNG, and others)." - topics = ["image", "photography", "raw"] + license = "CDDL-1.0", "LGPL-2.1-only" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.libraw.org/" - license = "CDDL-1.0/LGPL-2.1-only" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + topics = ["image", "photography", "raw"] settings = "os", "arch", "compiler", "build_type" - options = { "shared": [True, False], "fPIC": [True, False], @@ -26,12 +28,11 @@ class LibRawConan(ConanFile): "with_lcms": True, "with_jasper": True } - - _cmake = None + exports_sources = ["CMakeLists.txt"] @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 def config_options(self): if self.settings.os == "Windows": @@ -39,51 +40,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): # TODO: RawSpeed dependency (-DUSE_RAWSPEED) # TODO: DNG SDK dependency (-DUSE_DNGSDK) if self.options.with_jpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.1") + self.requires("libjpeg-turbo/2.1.4") if self.options.with_lcms: - self.requires("lcms/2.12") + self.requires("lcms/2.14") if self.options.with_jasper: - self.requires("jasper/2.0.33") + self.requires("jasper/4.0.0") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("LibRaw-" + self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RAW_LIB_VERSION_STRING"] = self.version + tc.variables["LIBRAW_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="COPYRIGHT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - - self.copy("LICENSE.*", src=self._source_subfolder, dst="licenses") def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os == "Windows": self.cpp_info.defines.append("WIN32") + self.cpp_info.system_libs.append("ws2_32") if not self.options.shared: self.cpp_info.defines.append("LIBRAW_NODLL") diff --git a/recipes/libraw/all/test_package/CMakeLists.txt b/recipes/libraw/all/test_package/CMakeLists.txt index 33ae887aa6aea..a201657a76080 100644 --- a/recipes/libraw/all/test_package/CMakeLists.txt +++ b/recipes/libraw/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libraw REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE libraw::libraw) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libraw/all/test_package/conanfile.py b/recipes/libraw/all/test_package/conanfile.py index 4903f1a7e8fa0..a9fb96656f203 100644 --- a/recipes/libraw/all/test_package/conanfile.py +++ b/recipes/libraw/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libraw/all/test_v1_package/CMakeLists.txt b/recipes/libraw/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libraw/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libraw/all/test_v1_package/conanfile.py b/recipes/libraw/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/libraw/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libraw/config.yml b/recipes/libraw/config.yml index 07ec3840f78d8..35c98427b7408 100644 --- a/recipes/libraw/config.yml +++ b/recipes/libraw/config.yml @@ -1,7 +1,9 @@ versions: - "0.19.5": + "0.21.1": + folder: all + "0.20.2": folder: all "0.20.0": folder: all - "0.20.2": + "0.19.5": folder: all diff --git a/recipes/librdkafka/all/conandata.yml b/recipes/librdkafka/all/conandata.yml index 9bb10a3ea1457..79827450beb2c 100644 --- a/recipes/librdkafka/all/conandata.yml +++ b/recipes/librdkafka/all/conandata.yml @@ -1,12 +1,15 @@ sources: + "2.0.2": + url: "https://github.com/edenhill/librdkafka/archive/v2.0.2.tar.gz" + sha256: "f321bcb1e015a34114c83cf1aa7b99ee260236aab096b85c003170c90a47ca9d" "1.9.2": - url: "https://github.com/edenhill/librdkafka/archive/refs/tags/v1.9.2.tar.gz" + url: "https://github.com/edenhill/librdkafka/archive/v1.9.2.tar.gz" sha256: "3fba157a9f80a0889c982acdd44608be8a46142270a389008b22d921be1198ad" "1.9.1": - url: "https://github.com/edenhill/librdkafka/archive/refs/tags/v1.9.1.tar.gz" + url: "https://github.com/edenhill/librdkafka/archive/v1.9.1.tar.gz" sha256: "3a54cf375218977b7af4716ed9738378e37fe400a6c5ddb9d622354ca31fdc79" "1.8.2": - url: "https://github.com/edenhill/librdkafka/archive/refs/tags/v1.8.2.tar.gz" + url: "https://github.com/edenhill/librdkafka/archive/v1.8.2.tar.gz" sha256: "6a747d293a7a4613bd2897e28e8791476fbe1ae7361f2530a876e0fd483482a6" "1.8.0": url: "https://github.com/edenhill/librdkafka/archive/v1.8.0.tar.gz" @@ -24,27 +27,66 @@ sources: url: "https://github.com/edenhill/librdkafka/archive/v1.5.3.tar.gz" sha256: "2105ca01fef5beca10c9f010bc50342b15d5ce6b73b2489b012e6d09a008b7bf" patches: + "2.0.2": + - patch_file: patches/0001-Change-library-names-1-9-1.patch + patch_description: "find_package conan packages" + patch_type: "conan" + - patch_file: patches/0002-Change-library-targets-and-result-variables-2-0-2.patch + patch_description: "refer conan package names" + patch_type: "conan" "1.9.2": - patch_file: patches/0001-Change-library-names-1-9-1.patch + patch_description: "find_package conan packages" + patch_type: "conan" - patch_file: patches/0002-Change-library-targets-and-result-variables-1-9-1.patch + patch_description: "refer conan package names" + patch_type: "conan" "1.9.1": - patch_file: patches/0001-Change-library-names-1-9-1.patch + patch_description: "find_package conan packages" + patch_type: "conan" - patch_file: patches/0002-Change-library-targets-and-result-variables-1-9-1.patch + patch_description: "refer conan package names" + patch_type: "conan" "1.8.2": - patch_file: patches/0001-Change-library-names-1-7-0.patch + patch_description: "find_package conan packages" + patch_type: "conan" - patch_file: patches/0002-Change-library-targets-and-result-variables-1-7-0.patch + patch_description: "refer conan package names" + patch_type: "conan" "1.8.0": - patch_file: patches/0001-Change-library-names-1-7-0.patch + patch_description: "find_package conan packages" + patch_type: "conan" - patch_file: patches/0002-Change-library-targets-and-result-variables-1-7-0.patch + patch_description: "refer conan package names" + patch_type: "conan" "1.7.0": - patch_file: patches/0001-Change-library-names-1-7-0.patch + patch_description: "find_package conan packages" + patch_type: "conan" - patch_file: patches/0002-Change-library-targets-and-result-variables-1-7-0.patch + patch_description: "refer conan package names" + patch_type: "conan" "1.6.1": - patch_file: patches/0001-Change-library-names-1-5-2.patch + patch_description: "find_package conan packages, link sasl libraries" + patch_type: "conan" - patch_file: patches/0002-Change-library-targets-and-result-variables-1-6-1.patch + patch_description: "refer conan package names" + patch_type: "conan" "1.6.0": - patch_file: patches/0001-Change-library-names-1-5-2.patch + patch_description: "find_package conan packages, link sasl libraries" + patch_type: "conan" - patch_file: patches/0002-Change-library-targets-and-result-variables-1-6-0.patch + patch_description: "refer conan package names" + patch_type: "conan" "1.5.3": - patch_file: patches/0001-Change-library-names-1-5-2.patch + patch_description: "find_package conan packages, link sasl libraries" + patch_type: "conan" - patch_file: patches/0002-Change-library-targets-and-result-variables-1-5-2.patch + patch_description: "refer conan package names" + patch_type: "conan" diff --git a/recipes/librdkafka/all/conanfile.py b/recipes/librdkafka/all/conanfile.py index 022a2e0e1ada9..ab3bc456d08b1 100644 --- a/recipes/librdkafka/all/conanfile.py +++ b/recipes/librdkafka/all/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import Environment, VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.gnu import PkgConfigDeps from conan.tools.scm import Version import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class LibrdkafkaConan(ConanFile): @@ -46,8 +46,7 @@ def _depends_on_cyrus_sasl(self): return self.options.sasl and self.settings.os != "Windows" def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -57,27 +56,27 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") if self.options.zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.zstd: self.requires("zstd/1.5.2") if self.options.ssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self._depends_on_cyrus_sasl: self.requires("cyrus-sasl/2.1.27") if self.options.get_safe("curl", False): - self.requires("libcurl/7.84.0") + self.requires("libcurl/7.87.0") def build_requirements(self): if self._depends_on_cyrus_sasl: - self.tool_requires("pkgconf/1.7.4") - - def layout(self): - cmake_layout(self, src_folder="src") + self.tool_requires("pkgconf/1.9.3") def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-2-0-2.patch b/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-2-0-2.patch new file mode 100644 index 0000000000000..740fe7f025bc5 --- /dev/null +++ b/recipes/librdkafka/all/patches/0002-Change-library-targets-and-result-variables-2-0-2.patch @@ -0,0 +1,24 @@ +diff --git a/a/src/CMakeLists.txt b/b/src/CMakeLists.txt +index 37b43c4..78745a7 100644 +--- a/a/src/CMakeLists.txt ++++ b/b/src/CMakeLists.txt +@@ -214,9 +214,7 @@ if(WITH_ZLIB) + endif() + + if(WITH_ZSTD) +- target_link_libraries(rdkafka PRIVATE ${ZSTD_LIBRARY}) +- target_include_directories(rdkafka PRIVATE ${ZSTD_INCLUDE_DIR}) +- message(STATUS "Found ZSTD: ${ZSTD_LIBRARY}") ++ target_link_libraries(rdkafka PRIVATE $,zstd::libzstd_shared,zstd::libzstd_static>) + endif() + + if(WITH_SSL) +@@ -256,7 +254,7 @@ endif() + + if(WITH_LZ4_EXT) + target_include_directories(rdkafka PRIVATE ${LZ4_INCLUDE_DIRS}) +- target_link_libraries(rdkafka PUBLIC LZ4::LZ4) ++ target_link_libraries(rdkafka PUBLIC lz4::lz4) + endif() + + if(WIN32) diff --git a/recipes/librdkafka/all/test_package/CMakeLists.txt b/recipes/librdkafka/all/test_package/CMakeLists.txt index b30e0e118dc1d..636b897b6b9d6 100644 --- a/recipes/librdkafka/all/test_package/CMakeLists.txt +++ b/recipes/librdkafka/all/test_package/CMakeLists.txt @@ -1,7 +1,10 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package LANGUAGES C CXX) find_package(RdKafka REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE RdKafka::rdkafka++) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE RdKafka::rdkafka) + +add_executable(${PROJECT_NAME}_cpp test_package.cpp) +target_link_libraries(${PROJECT_NAME}_cpp PRIVATE RdKafka::rdkafka++) diff --git a/recipes/librdkafka/all/test_package/conanfile.py b/recipes/librdkafka/all/test_package/conanfile.py index 3a8c6c5442b33..6b68cbd742d30 100644 --- a/recipes/librdkafka/all/test_package/conanfile.py +++ b/recipes/librdkafka/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,22 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package_cpp") + self.run(bin_path, env="conanrun") diff --git a/recipes/librdkafka/all/test_package/test_package.c b/recipes/librdkafka/all/test_package/test_package.c new file mode 100644 index 0000000000000..9670aa9ff8583 --- /dev/null +++ b/recipes/librdkafka/all/test_package/test_package.c @@ -0,0 +1,12 @@ +#include +#include + +int main(int argc, char const *argv[]) { + rd_kafka_conf_t *conf = rd_kafka_conf_new(); + + printf("\n"); + printf("----------------->Tests are done.<---------------------\n"); + printf("Using version (from C lib) %s\n", rd_kafka_version_str()); + printf("///////////////////////////////////////////////////////\n"); + return 0; +} diff --git a/recipes/librdkafka/all/test_package/test_package.cpp b/recipes/librdkafka/all/test_package/test_package.cpp index 2b68c0545be73..d1ea0762857ed 100644 --- a/recipes/librdkafka/all/test_package/test_package.cpp +++ b/recipes/librdkafka/all/test_package/test_package.cpp @@ -1,11 +1,12 @@ #include -#include +#include int main(int argc, char const *argv[]) { - rd_kafka_conf_t *conf = rd_kafka_conf_new(); + RdKafka::Conf* confpp = RdKafka::Conf::create(RdKafka::Conf::CONF_GLOBAL); + std::cout << std::endl << "----------------->Tests are done.<---------------------" << std::endl - << "Using version " << rd_kafka_version_str() << std::endl + << "Using version (from C++ lib) " << RdKafka::version() << std::endl << "///////////////////////////////////////////////////////" << std::endl; return 0; } diff --git a/recipes/librdkafka/all/test_v1_package/CMakeLists.txt b/recipes/librdkafka/all/test_v1_package/CMakeLists.txt index 2a519eb83b67b..0d20897301b68 100644 --- a/recipes/librdkafka/all/test_v1_package/CMakeLists.txt +++ b/recipes/librdkafka/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(RdKafka REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE RdKafka::rdkafka++) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/librdkafka/all/test_v1_package/conanfile.py b/recipes/librdkafka/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..2be697c561678 100644 --- a/recipes/librdkafka/all/test_v1_package/conanfile.py +++ b/recipes/librdkafka/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os @@ -16,3 +15,5 @@ def test(self): if not tools.cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) + bin_path = os.path.join("bin", "test_package_cpp") + self.run(bin_path, run_environment=True) diff --git a/recipes/librdkafka/config.yml b/recipes/librdkafka/config.yml index 6ba7bbcf8c0bf..92b3b67d04bdf 100644 --- a/recipes/librdkafka/config.yml +++ b/recipes/librdkafka/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.2": + folder: all "1.9.2": folder: all "1.9.1": diff --git a/recipes/libressl/all/CMakeLists.txt b/recipes/libressl/all/CMakeLists.txt index 1848ca5a77c35..de350ebd519a2 100644 --- a/recipes/libressl/all/CMakeLists.txt +++ b/recipes/libressl/all/CMakeLists.txt @@ -4,4 +4,7 @@ project(cmake_wrapper) include(conanbuildinfo.cmake) conan_basic_setup() +if(MSVC) + add_definitions(/D_CRT_SUPPRESS_RESTRICT) +endif() add_subdirectory("source_subfolder") diff --git a/recipes/libsafec/all/conanfile.py b/recipes/libsafec/all/conanfile.py index 5e2784dc36adc..6924adfd04703 100644 --- a/recipes/libsafec/all/conanfile.py +++ b/recipes/libsafec/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.files import get, rmdir, copy, rm, chdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +from conans import AutoToolsBuildEnvironment, tools import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibSafeCConan(ConanFile): @@ -18,14 +22,16 @@ class LibSafeCConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "strmax": ["ANY"], + "memmax": ["ANY"], } default_options = { "shared": False, "fPIC": True, + "strmax": 4096, + "memmax": 268435456, } - exports_sources = "patches/*" - _autotools = None @property @@ -42,20 +48,20 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def build_requirements(self): - self.build_requires("libtool/2.4.6") + self.tool_requires("libtool/2.4.6") if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("msys2/cci.latest") @property def _supported_compiler(self): compiler = self.settings.compiler - version = tools.Version(self.settings.compiler.version) - if compiler == "Visual Studio": + version = Version(self.settings.compiler.version) + if is_msvc(self): return False if compiler == "gcc" and version < "5": return False @@ -63,14 +69,16 @@ def _supported_compiler(self): def validate(self): if self.settings.os == "Macos" and self.settings.arch == "armv8": - raise ConanInvalidConfiguration("This platform is not yet supported by libsafec (os=Macos arch=armv8)") + raise ConanInvalidConfiguration(f"This platform is not yet supported by {self.ref} (os=Macos arch=armv8)") if not self._supported_compiler: raise ConanInvalidConfiguration( - "libsafec doesn't support {}/{}".format( - self.settings.compiler, self.settings.compiler.version)) + f"{self.ref} doesn't support {self.settings.compiler}-{self.settings.compiler.version}") + + if not str(self.info.options.strmax).isdigit(): + raise ConanException(f"{self.ref} option 'strmax' must be a valid integer number.") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _configure_autotools(self): @@ -84,28 +92,30 @@ def _configure_autotools(self): "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), "--disable-doc", "--disable-Werror", + "--enable-strmax={}".format(self.options.strmax), + "--enable-memmax={}".format(self.options.memmax), ] self._autotools.configure(args=args, configure_dir=self._source_subfolder) return self._autotools def build(self): - with tools.chdir(self._source_subfolder): + with chdir(self, self._source_subfolder): self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows, run_environment=True) autotools = self._configure_autotools() autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") + copy(self, "COPYING", src=self._source_subfolder, dst=os.path.join(self.package_folder, "licenses")) autotools = self._configure_autotools() autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.includedirs.append(os.path.join("include", "libsafec")) self.cpp_info.libs = ["safec-{}".format(self.version)] - self.cpp_info.names["pkg_config"] = "libsafec" + self.cpp_info.set_property("pkg_config_name", "libsafec") bin_dir = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bin_dir)) diff --git a/recipes/libsamplerate/all/conandata.yml b/recipes/libsamplerate/all/conandata.yml index 926e264c998d5..c21907c54b1f0 100644 --- a/recipes/libsamplerate/all/conandata.yml +++ b/recipes/libsamplerate/all/conandata.yml @@ -1,7 +1,7 @@ sources: "0.2.2": - url: "https://github.com/libsndfile/libsamplerate/archive/0.2.2.tar.gz" - sha256: "16e881487f184250deb4fcb60432d7556ab12cb58caea71ef23960aec6c0405a" + url: "https://github.com/libsndfile/libsamplerate/releases/download/0.2.2/libsamplerate-0.2.2.tar.xz" + sha256: "3258da280511d24b49d6b08615bbe824d0cacc9842b0e4caf11c52cf2b043893" "0.2.1": url: "https://github.com/libsndfile/libsamplerate/releases/download/0.2.1/libsamplerate-0.2.1.tar.bz2" sha256: "f6323b5e234753579d70a0af27796dde4ebeddf58aae4be598e39b3cee00c90a" diff --git a/recipes/libsamplerate/all/conanfile.py b/recipes/libsamplerate/all/conanfile.py index 55b233bda77e4..274ee4cb75d27 100644 --- a/recipes/libsamplerate/all/conanfile.py +++ b/recipes/libsamplerate/all/conanfile.py @@ -6,7 +6,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class LibsamplerateConan(ConanFile): @@ -36,38 +36,42 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def _cmake_new_enough(self, required_version): try: - del self.settings.compiler.cppstd - except Exception: - pass + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r"cmake version (\d+\.\d+\.\d+)", output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False def build_requirements(self): if is_apple_os(self) and self.options.shared and Version(self.version) >= "0.2.2": - # At least CMake 3.17 (see https://github.com/libsndfile/libsamplerate/blob/0.2.2/src/CMakeLists.txt#L110-L119) - self.tool_requires("cmake/3.24.0") - - def layout(self): - cmake_layout(self, src_folder="src") + # see https://github.com/libsndfile/libsamplerate/blob/0.2.2/src/CMakeLists.txt#L110-L119 + if not self._cmake_new_enough("3.17"): + self.tool_requires("cmake/3.25.1") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + env = VirtualBuildEnv(self) + env.generate() tc = CMakeToolchain(self) tc.variables["LIBSAMPLERATE_EXAMPLES"] = False tc.variables["LIBSAMPLERATE_INSTALL"] = True tc.variables["BUILD_TESTING"] = False tc.generate() - env = VirtualBuildEnv(self) - env.generate() - def _patch_sources(self): # Disable upstream logic about msvc runtime policy, called before conan toolchain resolution replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), diff --git a/recipes/libsamplerate/all/test_package/conanfile.py b/recipes/libsamplerate/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/libsamplerate/all/test_package/conanfile.py +++ b/recipes/libsamplerate/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/libsamplerate/all/test_v1_package/CMakeLists.txt b/recipes/libsamplerate/all/test_v1_package/CMakeLists.txt index 1fa80ec806e05..0d20897301b68 100644 --- a/recipes/libsamplerate/all/test_v1_package/CMakeLists.txt +++ b/recipes/libsamplerate/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(SampleRate REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE SampleRate::samplerate) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsass/all/conanfile.py b/recipes/libsass/all/conanfile.py index fa494bccd79fc..374c7b2afb2fd 100644 --- a/recipes/libsass/all/conanfile.py +++ b/recipes/libsass/all/conanfile.py @@ -1,9 +1,11 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, chdir, save, replace_in_file, rmdir, rm +from conan.tools.microsoft import is_msvc +from conans import AutoToolsBuildEnvironment, MSBuild, tools import os import re -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class LibsassConan(ConanFile): @@ -33,10 +35,6 @@ def _source_subfolder(self): def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" - @property - def _is_msvc(self): - return self.settings.os == "Windows" and self.settings.compiler == "Visual Studio" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -47,10 +45,10 @@ def configure(self): def build_requirements(self): if self.settings.os != "Windows": - self.build_requires("libtool/2.4.6") + self.tool_requires("libtool/2.4.7") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _configure_autotools(self): @@ -65,8 +63,8 @@ def _configure_autotools(self): return self._autotools def _build_autotools(self): - with tools.chdir(self._source_subfolder): - tools.save(path="VERSION", content="%s" % self.version) + with chdir(self, self._source_subfolder): + save(self, path="VERSION", content=f"{self.version}") self.run("{} -fiv".format(tools.get_env("AUTORECONF"))) autotools = self._configure_autotools() autotools.make() @@ -77,10 +75,10 @@ def _make_program(self): def _build_mingw(self): makefile = os.path.join(self._source_subfolder, "Makefile") - tools.replace_in_file(makefile, "CFLAGS += -O2", "") - tools.replace_in_file(makefile, "CXXFLAGS += -O2", "") - tools.replace_in_file(makefile, "LDFLAGS += -O2", "") - with tools.chdir(self._source_subfolder): + replace_in_file(self, makefile, "CFLAGS += -O2", "") + replace_in_file(self, makefile, "CXXFLAGS += -O2", "") + replace_in_file(self, makefile, "LDFLAGS += -O2", "") + with chdir(self, self._source_subfolder): env_vars = AutoToolsBuildEnvironment(self).vars env_vars.update({ "BUILD": "shared" if self.options.shared else "static", @@ -91,10 +89,10 @@ def _build_mingw(self): "STATIC_LIBSTDCPP": "0", }) with tools.environment_append(env_vars): - self.run("{} -f Makefile".format(self._make_program)) + self.run(f"{self._make_program} -f Makefile") def _build_visual_studio(self): - with tools.chdir(self._source_subfolder): + with chdir(self, self._source_subfolder): properties = { "LIBSASS_STATIC_LIB": "" if self.options.shared else "true", "WholeProgramOptimization": "true" if any(re.finditer("(^| )[/-]GL($| )", tools.get_env("CFLAGS", ""))) else "false", @@ -109,17 +107,17 @@ def _build_visual_studio(self): def build(self): if self._is_mingw: self._build_mingw() - elif self._is_msvc: + elif is_msvc(self): self._build_visual_studio() else: self._build_autotools() def _install_autotools(self): - with tools.chdir(self._source_subfolder): + with chdir(self, self._source_subfolder): autotools = self._configure_autotools() autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(self.package_folder, "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", self.package_folder, recursive=True) def _install_mingw(self): self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) @@ -135,14 +133,14 @@ def package(self): self.copy("LICENSE", src=self._source_subfolder, dst="licenses") if self._is_mingw: self._install_mingw() - elif self._is_msvc: + elif is_msvc(self): self._install_visual_studio() else: self._install_autotools() def package_info(self): self.cpp_info.names["pkg_config"] = "libsass" - self.cpp_info.libs = ["libsass" if self._is_msvc else "sass"] + self.cpp_info.libs = ["libsass" if is_msvc(self) else "sass"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["dl", "m"]) if not self.options.shared and tools.stdcpp_library(self): diff --git a/recipes/libschrift/all/CMakeLists.txt b/recipes/libschrift/all/CMakeLists.txt index 7833150cb7a02..89baaf56270d3 100644 --- a/recipes/libschrift/all/CMakeLists.txt +++ b/recipes/libschrift/all/CMakeLists.txt @@ -1,15 +1,11 @@ cmake_minimum_required(VERSION 3.8) project(schrift LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - include(GNUInstallDirs) -add_library(schrift source_subfolder/schrift.c) -target_compile_features(schrift PRIVATE c_std_99) +add_library(schrift ${LIBSCHRIFT_SRC_DIR}/schrift.c) set_target_properties(schrift PROPERTIES - PUBLIC_HEADER source_subfolder/schrift.h + PUBLIC_HEADER ${LIBSCHRIFT_SRC_DIR}/schrift.h WINDOWS_EXPORT_ALL_SYMBOLS ON C_EXTENSIONS OFF C_STANDARD 99 diff --git a/recipes/libschrift/all/conanfile.py b/recipes/libschrift/all/conanfile.py index 54ef03bcf7593..949296527320a 100644 --- a/recipes/libschrift/all/conanfile.py +++ b/recipes/libschrift/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.46.0" + class LibschriftConan(ConanFile): name = "libschrift" @@ -22,12 +25,6 @@ class LibschriftConan(ConanFile): } exports_sources = ["CMakeLists.txt"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -35,28 +32,39 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBSCHRIFT_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/libschrift/all/test_package/CMakeLists.txt b/recipes/libschrift/all/test_package/CMakeLists.txt index 7e8a08a26324f..36819133561d5 100644 --- a/recipes/libschrift/all/test_package/CMakeLists.txt +++ b/recipes/libschrift/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(libschrift REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libschrift::libschrift) +target_link_libraries(${PROJECT_NAME} PRIVATE libschrift::libschrift) diff --git a/recipes/libschrift/all/test_package/conanfile.py b/recipes/libschrift/all/test_package/conanfile.py index a77ba6c16f4ae..d4c18b77de306 100644 --- a/recipes/libschrift/all/test_package/conanfile.py +++ b/recipes/libschrift/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") font_path = os.path.join(self.source_folder, "OpenSans-Bold.ttf") - self.run("{} {}".format(bin_path, font_path), run_environment=True) + self.run(f"{bin_path} {font_path}", env="conanrun") diff --git a/recipes/libschrift/all/test_v1_package/CMakeLists.txt b/recipes/libschrift/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a36c74cedeb93 --- /dev/null +++ b/recipes/libschrift/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(libschrift REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libschrift::libschrift) diff --git a/recipes/libschrift/all/test_v1_package/conanfile.py b/recipes/libschrift/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..da2d908b1d4a7 --- /dev/null +++ b/recipes/libschrift/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + font_path = os.path.join(self.source_folder, os.pardir, "test_package", "OpenSans-Bold.ttf") + self.run(f"{bin_path} {font_path}", run_environment=True) diff --git a/recipes/libselinux/all/conanfile.py b/recipes/libselinux/all/conanfile.py index c55bc85f7d135..b584e1b1696aa 100644 --- a/recipes/libselinux/all/conanfile.py +++ b/recipes/libselinux/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.32.0" +required_conan_version = ">=1.53.0" class LibSELinuxConan(ConanFile): @@ -12,11 +17,11 @@ class LibSELinuxConan(ConanFile): "of utilities with enhanced security functionality designed to add " "mandatory access controls to Linux" ) - topics = ("selinux", "security-enhanced linux") + topics = ("linux", "selinux", "security", "security-enhanced") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/SELinuxProject/selinux" - license = "Unlicense" # This library (libselinux) is public domain software, i.e. not copyrighted - + license = "Unlicense" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,74 +33,93 @@ class LibSELinuxConan(ConanFile): } def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("pcre2/10.40") + self.requires("pcre2/10.42") def validate(self): if self.settings.os != "Linux": - raise ConanInvalidConfiguration("Only Linux is supported") + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): - self.build_requires("flex/2.6.4") + self.tool_requires("flex/2.6.4") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): for download in self.conan_data["sources"][self.version]: - tools.get(**download) + get(self, **download) @property def _sepol_soversion(self): - return "2" if tools.Version(self.version) >= "3.2" else "1" + return "2" if Version(self.version) >= "3.2" else "1" @property def _selinux_soversion(self): return "1" @property - def _subfolders(self): - _sepol_subfolder = "libsepol-%s" % self.version - _selinux_subfolder = "libselinux-%s" % self.version - return _sepol_subfolder, _selinux_subfolder + def _sepol_library_target(self): + return f"libsepol.so.{self._sepol_soversion}" if self.options.shared else "libsepol.a" + + @property + def _selinux_library_target(self): + return f"libselinux.so.{self._selinux_soversion}" if self.options.shared else "libselinux.a" + + @property + def _sepol_source_folder(self): + return os.path.join(self.source_folder, f"libsepol-{self.version}") + + @property + def _selinux_source_folder(self): + return os.path.join(self.source_folder, f"libselinux-{self.version}") + + def generate(self): + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() + tc = AutotoolsToolchain(self) + sepol_include_folder = os.path.join(self._sepol_source_folder, "include") + tc.extra_cflags.append(f"-I{sepol_include_folder}") + sepol_lib_folder = os.path.join(self._sepol_source_folder, "src") + tc.extra_ldflags.append(f"-L{sepol_lib_folder}") + tc.make_args.append("USE_PCRE2=y") + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - _sepol_subfolder, _selinux_subfolder = self._subfolders - pcre_inc = os.path.join(self.deps_cpp_info["pcre2"].rootpath, - self.deps_cpp_info["pcre2"].includedirs[0]) - pcre_libs = ' '.join(["-l%s" % lib for lib in self.deps_cpp_info["pcre2"].libs]) - sepol_inc = os.path.join(self.source_folder, _sepol_subfolder, "include") - with tools.chdir(os.path.join(_sepol_subfolder, "src")): - args = ["libsepol.so.{}".format(self._sepol_soversion) if self.options.shared else "libsepol.a"] - env_build = AutoToolsBuildEnvironment(self) - env_build.make(args=args) - with tools.chdir(os.path.join(_selinux_subfolder, "src")): - args = ["libselinux.so.{}".format(self._selinux_soversion) if self.options.shared else "libselinux.a", - 'PCRE_CFLAGS=-DPCRE2_CODE_UNIT_WIDTH=8 -DUSE_PCRE2=1 -I%s -I%s' % (pcre_inc, sepol_inc), - 'PCRE_LDLIBS=%s' % pcre_libs] - env_build = AutoToolsBuildEnvironment(self) - env_build.make(args=args) + apply_conandata_patches(self) + autotools = Autotools(self) + with chdir(self, os.path.join(self._sepol_source_folder, "src")): + autotools.make(self._sepol_library_target) + with chdir(self, os.path.join(self._selinux_source_folder)): + autotools.make() def package(self): - _sepol_subfolder, _selinux_subfolder = self._subfolders - self.copy(pattern="LICENSE", dst="licenses", src=_selinux_subfolder) - for library in [_sepol_subfolder, _selinux_subfolder]: - self.copy(pattern="*.h", dst="include", src=os.path.join(library, "include"), keep_path=True) - self.copy(pattern="*.so*", dst="lib", src=library, keep_path=False, symlinks=True) - self.copy(pattern="*.a", dst="lib", src=library, keep_path=False) + copy(self, "LICENSE", self._selinux_source_folder, os.path.join(self.package_folder, "licenses")) + for library in [self._sepol_source_folder, self._selinux_source_folder]: + copy(self, "*.h", os.path.join(library, "include"), os.path.join(self.package_folder, "include")) + if self.options.shared: + copy(self, "*.so*", library, os.path.join(self.package_folder, "lib"), keep_path=False) + else: + copy(self, "*.a", library, os.path.join(self.package_folder, "lib"), keep_path=False) def package_info(self): - self.cpp_info.components["selinux"].names["pkg_config"] = "libselinux" + self.cpp_info.components["selinux"].set_property("pkg_config_name", "libselinux") self.cpp_info.components["selinux"].libs = ["selinux"] self.cpp_info.components["selinux"].requires = ["sepol", "pcre2::pcre2"] + if self.options.shared: + self.cpp_info.components["selinux"].system_libs = ["dl"] - self.cpp_info.components["sepol"].names["pkg_config"] = "libsepol" + self.cpp_info.components["sepol"].set_property("pkg_config_name", "libsepol") self.cpp_info.components["sepol"].libs = ["sepol"] diff --git a/recipes/libselinux/all/test_package/CMakeLists.txt b/recipes/libselinux/all/test_package/CMakeLists.txt index 7b9b613cbb24a..7a316858398f3 100644 --- a/recipes/libselinux/all/test_package/CMakeLists.txt +++ b/recipes/libselinux/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libselinux REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libselinux::libselinux) diff --git a/recipes/libselinux/all/test_package/conanfile.py b/recipes/libselinux/all/test_package/conanfile.py index 5c09494bc67c0..a9fb96656f203 100644 --- a/recipes/libselinux/all/test_package/conanfile.py +++ b/recipes/libselinux/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libselinux/all/test_v1_package/CMakeLists.txt b/recipes/libselinux/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libselinux/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libselinux/all/test_v1_package/conanfile.py b/recipes/libselinux/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libselinux/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libserial/all/conandata.yml b/recipes/libserial/all/conandata.yml new file mode 100644 index 0000000000000..6677947184a94 --- /dev/null +++ b/recipes/libserial/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20200930": + url: "https://github.com/crayzeewulf/libserial/archive/1d1e47a2faae0470f93eb291263b0ce7ea119a81.tar.gz" + sha256: "a433b04bd42e8b4504e5e1fbe7ec22b648f2872d3d125e58c17b9c6c1b171bba" diff --git a/recipes/libserial/all/conanfile.py b/recipes/libserial/all/conanfile.py new file mode 100644 index 0000000000000..9415f1c8d2625 --- /dev/null +++ b/recipes/libserial/all/conanfile.py @@ -0,0 +1,92 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rm, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + +class LibserialConan(ConanFile): + name = "libserial" + description = "Serial Port Programming in C++" + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/crayzeewulf/libserial" + topics = ("serial-ports", "rs232", "usb-serial") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + } + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} support Linux only.") + + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBSERIAL_ENABLE_TESTING"] = False + tc.variables["LIBSERIAL_BUILD_EXAMPLES"] = False + tc.variables["LIBSERIAL_PYTHON_ENABLE"] = False + tc.variables["LIBSERIAL_BUILD_DOCS"] = False + tc.variables["INSTALL_STATIC"] = not self.options.shared + tc.variables["INSTALL_SHARED"] = self.options.shared + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "Makefile.am", os.path.join(self.package_folder, "include", "libserial")) + + def package_info(self): + self.cpp_info.libs = ["serial"] + + self.cpp_info.set_property("pkg_config_name", "libserial") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/libserial/all/test_package/CMakeLists.txt b/recipes/libserial/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c896bd464b19d --- /dev/null +++ b/recipes/libserial/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(libserial REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libserial::libserial) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/libserial/all/test_package/conanfile.py b/recipes/libserial/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/libserial/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libserial/all/test_package/test_package.cpp b/recipes/libserial/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..00c0ba2b470c9 --- /dev/null +++ b/recipes/libserial/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#include + +#include +#include + +int main(void) { + using LibSerial::SerialPort ; + using LibSerial::SerialStream ; + + // Instantiate a Serial Port and a Serial Stream object. + SerialPort serial_port ; + SerialStream serial_stream ; + + serial_port.IsOpen(); + serial_stream.IsOpen(); + + return EXIT_SUCCESS; +} diff --git a/recipes/libserial/all/test_v1_package/CMakeLists.txt b/recipes/libserial/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libserial/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libserial/all/test_v1_package/conanfile.py b/recipes/libserial/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/libserial/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libserial/config.yml b/recipes/libserial/config.yml new file mode 100644 index 0000000000000..27812caf46f4d --- /dev/null +++ b/recipes/libserial/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20200930": + folder: all diff --git a/recipes/libsigcpp/2.x.x/conanfile.py b/recipes/libsigcpp/2.x.x/conanfile.py index f3ba237114633..9cb40725e278e 100644 --- a/recipes/libsigcpp/2.x.x/conanfile.py +++ b/recipes/libsigcpp/2.x.x/conanfile.py @@ -1,20 +1,23 @@ -from conans import ConanFile, Meson, tools -from conan.tools.files import rename -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import check_min_cppstd +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rename, replace_in_file, rm, rmdir +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain import glob import os -import shutil -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" -class LibSigCppConanV2(ConanFile): +class LibSigCppConan(ConanFile): name = "libsigcpp" homepage = "https://github.com/libsigcplusplus/libsigcplusplus" url = "https://github.com/conan-io/conan-center-index" - license = "LGPL-3.0" + license = "LGPL-3.0-only" description = "libsigc++ implements a typesafe callback system for standard C++." - topics = ("libsigcpp", "callback") + topics = ("callback") settings = "os", "arch", "compiler", "build_type" options = { @@ -26,88 +29,81 @@ class LibSigCppConanV2(ConanFile): "fPIC": True, } - generators = "pkg_config" - short_paths = True - - def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self): - raise ConanInvalidConfiguration("Cross-building not implemented") - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def build_requirements(self): - self.build_requires("meson/0.59.1") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("meson/0.64.1") def source(self): - tools.get( - **self.conan_data["sources"][self.version], - strip_root=True, - destination=self._source_subfolder - ) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) + tc.project_options["build-examples"] = "false" + tc.project_options["build-documentation"] = "false" + tc.generate() + + def _patch_sources(self): + if not self.options.shared: + replace_in_file( + self, os.path.join(self.source_folder, "sigc++config.h.meson"), + "define SIGC_DLL 1", "undef SIGC_DLL", + ) def build(self): - if not self.options.shared: - tools.replace_in_file( - os.path.join(self._source_subfolder, "sigc++config.h.meson"), - "define SIGC_DLL 1", "undef SIGC_DLL") - with tools.environment_append(tools.RunEnvironment(self).vars): - meson = self._configure_meson() - meson.build() - - def _configure_meson(self): + self._patch_sources() meson = Meson(self) - defs = {} - defs["build-examples"] = "false" - defs["build-documentation"] = "false" - defs["default_library"] = "shared" if self.options.shared else "static" - meson.configure( - defs=defs, - build_folder=self._build_subfolder, - source_folder=self._source_subfolder, - pkg_config_paths=[self.install_folder], - ) - return meson + meson.configure() + meson.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + meson = Meson(self) meson.install() - if self.settings.compiler == "Visual Studio": - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") - if not self.options.shared: - rename(self, - os.path.join(self.package_folder, "lib", "libsigc-2.0.a"), - os.path.join(self.package_folder, "lib", "sigc-2.0.lib")) - for header_file in glob.glob(os.path.join(self.package_folder, "lib", "sigc++-2.0", "include", "*.h")): - shutil.move( - header_file, - os.path.join(self.package_folder, "include", - "sigc++-2.0", os.path.basename(header_file)) - ) - - for dir_to_remove in ["pkgconfig", "sigc++-2.0"]: - tools.rmdir(os.path.join( - self.package_folder, "lib", dir_to_remove)) + dst = os.path.join(self.package_folder, "include", "sigc++-2.0", os.path.basename(header_file)) + rename(self, header_file, dst) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "sigc++-2.0")) + fix_apple_shared_install_name(self) + fix_msvc_libname(self) def package_info(self): - self.cpp_info.components["sigc++-2.0"].names["pkg_config"] = "sigc++-2.0" - self.cpp_info.components["sigc++-2.0"].includedirs.append(os.path.join("include", "sigc++-2.0")) - self.cpp_info.components["sigc++-2.0"].libs = ["sigc-2.0"] + self.cpp_info.set_property("pkg_config_name", "sigc++-2.0") + self.cpp_info.includedirs.append(os.path.join("include", "sigc++-2.0")) + self.cpp_info.libs = ["sigc-2.0"] + +def fix_msvc_libname(conanfile, remove_lib_prefix=True): + """remove lib prefix & change extension to .lib""" + from conan.tools.files import rename + from conan.tools.microsoft import is_msvc + import glob + import os + if not is_msvc(conanfile): + return + libdirs = getattr(conanfile.cpp.package, "libdirs") + for libdir in libdirs: + for ext in [".dll.a", ".dll.lib", ".a"]: + full_folder = os.path.join(conanfile.package_folder, libdir) + for filepath in glob.glob(os.path.join(full_folder, f"*{ext}")): + libname = os.path.basename(filepath)[0:-len(ext)] + if remove_lib_prefix and libname[0:3] == "lib": + libname = libname[3:] + rename(conanfile, filepath, os.path.join(os.path.dirname(filepath), f"{libname}.lib")) diff --git a/recipes/libsigcpp/2.x.x/test_package/CMakeLists.txt b/recipes/libsigcpp/2.x.x/test_package/CMakeLists.txt index 21ca4ecbf6eee..0fb07d5ca03ae 100644 --- a/recipes/libsigcpp/2.x.x/test_package/CMakeLists.txt +++ b/recipes/libsigcpp/2.x.x/test_package/CMakeLists.txt @@ -1,12 +1,9 @@ -cmake_minimum_required(VERSION 3.6) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGET) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(PkgConfig REQUIRED) pkg_search_module(SIGCPP IMPORTED_TARGET REQUIRED sigc++-2.0) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PkgConfig::SIGCPP) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::SIGCPP) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libsigcpp/2.x.x/test_package/conanfile.py b/recipes/libsigcpp/2.x.x/test_package/conanfile.py index ffedca59f065b..d5daeb4ad5467 100644 --- a/recipes/libsigcpp/2.x.x/test_package/conanfile.py +++ b/recipes/libsigcpp/2.x.x/test_package/conanfile.py @@ -1,13 +1,30 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.env import Environment import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "pkg_config" + generators = "CMakeToolchain", "PkgConfigDeps", "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - self.build_requires("pkgconf/1.7.4") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + + def generate(self): + # TODO: to remove once conan 1.55.0 deployed in c3i (see https://github.com/conan-io/conan/pull/12513) + env = Environment() + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + env.vars(self).save_script("conanbuild_pkg_config_path") def build(self): cmake = CMake(self) @@ -15,6 +32,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libsigcpp/2.x.x/test_v1_package/CMakeLists.txt b/recipes/libsigcpp/2.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libsigcpp/2.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsigcpp/2.x.x/test_v1_package/conanfile.py b/recipes/libsigcpp/2.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e6b0fdb8110e8 --- /dev/null +++ b/recipes/libsigcpp/2.x.x/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "pkg_config" + + def build_requirements(self): + self.build_requires("pkgconf/1.9.3") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libsigcpp/3.x.x/CMakeLists.txt b/recipes/libsigcpp/3.x.x/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c35..0000000000000 --- a/recipes/libsigcpp/3.x.x/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libsigcpp/3.x.x/conandata.yml b/recipes/libsigcpp/3.x.x/conandata.yml index 22e051100ec2e..ca82ebd4ecc93 100644 --- a/recipes/libsigcpp/3.x.x/conandata.yml +++ b/recipes/libsigcpp/3.x.x/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "3.0.7": - patch_file: "patches/3.0.7-0001-libsigcpp.patch" - base_path: "source_subfolder" "3.0.0": - patch_file: "patches/3.0.0-0001-libsigcpp.patch" - base_path: "source_subfolder" diff --git a/recipes/libsigcpp/3.x.x/conanfile.py b/recipes/libsigcpp/3.x.x/conanfile.py index dbf3fc6323f8c..7f5cc01dd330a 100644 --- a/recipes/libsigcpp/3.x.x/conanfile.py +++ b/recipes/libsigcpp/3.x.x/conanfile.py @@ -1,20 +1,25 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import ( + apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, + rename, replace_in_file, rmdir, save +) import glob import os -import shutil import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibSigCppConan(ConanFile): name = "libsigcpp" homepage = "https://github.com/libsigcplusplus/libsigcplusplus" url = "https://github.com/conan-io/conan-center-index" - license = "LGPL-3.0" + license = "LGPL-3.0-only" description = "libsigc++ implements a typesafe callback system for standard C++." - topics = ("libsigcpp", "callback") + topics = ("callback") settings = "os", "arch", "compiler", "build_type" options = { @@ -26,21 +31,22 @@ class LibSigCppConan(ConanFile): "fPIC": True, } - generators = "cmake" - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" @property - def _build_subfolder(self): - return "build_subfolder" + def _minimum_compilers_version(self): + return { + "Visual Studio": "15.7", + "msvc": "191", + "gcc": "7", + "clang": "6", + "apple-clang": "10", + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -48,64 +54,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - @property - def _minimum_compilers_version(self): - return { - "Visual Studio": "15.7", - "gcc": "7", - "clang": "6", - "apple-clang": "10", - } + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + check_min_cppstd(self, self._min_cppstd) - def lazy_lt_semver(v1, v2): + def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("libsigcpp requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("libsigcpp requires C++17, which your compiler does not support.") + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.generate() - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def _patch_sources(self): + apply_conandata_patches(self) if not self.options.shared: - tools.replace_in_file(os.path.join(self._source_subfolder, "sigc++config.h.cmake"), + replace_in_file(self, os.path.join(self.source_folder, "sigc++config.h.cmake"), "define SIGC_DLL 1", "undef SIGC_DLL") - cmake = self._configure_cmake() + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() for header_file in glob.glob(os.path.join(self.package_folder, "lib", "sigc++-3.0", "include", "*.h")): - shutil.move( - header_file, - os.path.join(self.package_folder, "include", "sigc++-3.0", os.path.basename(header_file)) - ) + dst = os.path.join(self.package_folder, "include", "sigc++-3.0", os.path.basename(header_file)) + rename(self, header_file, dst) for dir_to_remove in ["cmake", "pkgconfig", "sigc++-3.0"]: - tools.rmdir(os.path.join(self.package_folder, "lib", dir_to_remove)) + rmdir(self, os.path.join(self.package_folder, "lib", dir_to_remove)) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -113,21 +111,20 @@ def package(self): {"sigc-3.0": "sigc++-3::sigc-3.0"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "sigc++-3") @@ -136,7 +133,7 @@ def package_info(self): # TODO: back to global scope in conan v2 once cmake_find_package* generators removed self.cpp_info.components["sigc++"].includedirs = [os.path.join("include", "sigc++-3.0")] - self.cpp_info.components["sigc++"].libs = tools.collect_libs(self) + self.cpp_info.components["sigc++"].libs = collect_libs(self) if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.components["sigc++"].system_libs.append("m") diff --git a/recipes/libsigcpp/3.x.x/test_package/CMakeLists.txt b/recipes/libsigcpp/3.x.x/test_package/CMakeLists.txt index 5ed3e9d81f891..3c0d6af8191fb 100644 --- a/recipes/libsigcpp/3.x.x/test_package/CMakeLists.txt +++ b/recipes/libsigcpp/3.x.x/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(sigc++-3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} sigc-3.0) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE sigc-3.0) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/libsigcpp/3.x.x/test_package/conanfile.py b/recipes/libsigcpp/3.x.x/test_package/conanfile.py index 38f4483872d47..98ab55852ad56 100644 --- a/recipes/libsigcpp/3.x.x/test_package/conanfile.py +++ b/recipes/libsigcpp/3.x.x/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libsigcpp/3.x.x/test_v1_package/CMakeLists.txt b/recipes/libsigcpp/3.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libsigcpp/3.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsigcpp/3.x.x/test_v1_package/conanfile.py b/recipes/libsigcpp/3.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libsigcpp/3.x.x/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libslz/all/conandata.yml b/recipes/libslz/all/conandata.yml index cbdc865b700d3..8f01e85db189d 100644 --- a/recipes/libslz/all/conandata.yml +++ b/recipes/libslz/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.1": + url: "https://github.com/wtarreau/libslz/archive/v1.2.1.tar.gz" + sha256: "c1fa88556e97541a550e59fd1f0fc8f6b4c02444b14c13eb553c9827123122c5" "1.2.0": url: "https://github.com/wtarreau/libslz/archive/refs/tags/v1.2.0.tar.gz" sha256: "723a8ef648ac5b30e5074c013ff61a5e5f54a5aafc9496f7dab9f6b02030bf24" diff --git a/recipes/libslz/config.yml b/recipes/libslz/config.yml index 7ed1f1b6fc695..9f174d514c33f 100644 --- a/recipes/libslz/config.yml +++ b/recipes/libslz/config.yml @@ -1,3 +1,5 @@ versions: + "1.2.1": + folder: all "1.2.0": folder: all diff --git a/recipes/libsmacker/all/conandata.yml b/recipes/libsmacker/all/conandata.yml index 552c15f4cedf9..5b45f961f0cf1 100644 --- a/recipes/libsmacker/all/conandata.yml +++ b/recipes/libsmacker/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "1.1.1r35": - patch_file: "patches/0001-install-header.patch" - base_path: "source_subfolder" diff --git a/recipes/libsmacker/all/conanfile.py b/recipes/libsmacker/all/conanfile.py index 3f416d4b19cb9..9e27911242b4d 100644 --- a/recipes/libsmacker/all/conanfile.py +++ b/recipes/libsmacker/all/conanfile.py @@ -1,17 +1,25 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -import contextlib +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibsmackerConan(ConanFile): name = "libsmacker" url = "https://github.com/conan-io/conan-center-index" homepage = "http://libsmacker.sourceforge.net" - topics = ("libsmacker", "decoding ", "smk", "smacker", "video", "file") + topics = ("decoding ", "smk", "smacker", "video", "file") license = "LGPL-2.1-or-later" description = "A C library for decoding .smk Smacker Video files" + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -20,86 +28,72 @@ class LibsmackerConan(ConanFile): "shared": False, "fPIC": True, } - settings = "os", "arch", "compiler", "build_type" - - exports_sources = "patches/*" - _autotools = None - - @property - def _source_subfolder(self): - return os.path.join(self.source_folder, "source_subfolder") @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "cl -nologo", - "CXX": "cl -nologo", - "LD": "link -nologo", - } - with tools.environment_append(env): - yield - else: - yield - - def _configure_autotools(self): - if self._autotools is not None: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self,win_bash=tools.os_info.is_windows) - self._autotools.libs = [] - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - self._autotools.configure(configure_dir=self._source_subfolder, args=args) - return self._autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + tc.generate() + + if is_msvc(self): + env = Environment() + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + env.define("LD", "link -nologo") + env.vars(self).save_script("conanbuild_libsmacker_msvc") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - if self.settings.compiler == "Visual Studio" and self.options.shared: - os.rename(os.path.join(self.package_folder, "lib", "smacker.dll.lib"), - os.path.join(self.package_folder, "lib", "smacker.lib")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) + if is_msvc(self) and self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "smacker.dll.lib"), + os.path.join(self.package_folder, "lib", "smacker.lib")) def package_info(self): self.cpp_info.libs = ["smacker"] diff --git a/recipes/libsmacker/all/test_package/CMakeLists.txt b/recipes/libsmacker/all/test_package/CMakeLists.txt index 7b9b613cbb24a..27003d64c4b5a 100644 --- a/recipes/libsmacker/all/test_package/CMakeLists.txt +++ b/recipes/libsmacker/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libsmacker REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libsmacker::libsmacker) diff --git a/recipes/libsmacker/all/test_package/conanfile.py b/recipes/libsmacker/all/test_package/conanfile.py index 1dd7e559edc97..ca4f1763e0de3 100644 --- a/recipes/libsmacker/all/test_package/conanfile.py +++ b/recipes/libsmacker/all/test_package/conanfile.py @@ -1,9 +1,17 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) diff --git a/recipes/libsmacker/all/test_v1_package/CMakeLists.txt b/recipes/libsmacker/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libsmacker/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsmacker/all/test_v1_package/conanfile.py b/recipes/libsmacker/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3c3f444e8cad9 --- /dev/null +++ b/recipes/libsmacker/all/test_v1_package/conanfile.py @@ -0,0 +1,15 @@ +from conans import ConanFile, CMake + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + # No free .smk file to test. + pass diff --git a/recipes/libsndfile/all/conandata.yml b/recipes/libsndfile/all/conandata.yml index 9c03d46a973d3..77ba2985f3b59 100644 --- a/recipes/libsndfile/all/conandata.yml +++ b/recipes/libsndfile/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.0": + url: "https://github.com/libsndfile/libsndfile/releases/download/1.2.0/libsndfile-1.2.0.tar.xz" + sha256: "0e30e7072f83dc84863e2e55f299175c7e04a5902ae79cfb99d4249ee8f6d60a" "1.0.31": url: "https://github.com/libsndfile/libsndfile/releases/download/1.0.31/libsndfile-1.0.31.tar.bz2" sha256: "a8cfb1c09ea6e90eff4ca87322d4168cdbe5035cb48717b40bf77e751cc02163" @@ -9,7 +12,15 @@ sources: url: "https://github.com/libsndfile/libsndfile/releases/download/v1.0.29/libsndfile-1.0.29.tar.bz2" sha256: "2ba20d44817c8176f097ab25eff44ef0aeec9e00973def5a7174c5ae0764b22f" patches: + "1.2.0": + - patch_file: "patches/1.0.31-0001-fix-msvc-runtime-logic.patch" + patch_description: "always set CMP0091" + patch_type: "portability" "1.0.31": - patch_file: "patches/1.0.31-0001-fix-msvc-runtime-logic.patch" + patch_description: "always set CMP0091" + patch_type: "portability" "1.0.30": - patch_file: "patches/1.0.30-0001-disable-static-libgcc-mingw.patch" + patch_description: "disable link libgcc statically on MINGW" + patch_type: "portability" diff --git a/recipes/libsndfile/all/conanfile.py b/recipes/libsndfile/all/conanfile.py index 945a12b9aff7b..b9ca5213b1f9d 100644 --- a/recipes/libsndfile/all/conanfile.py +++ b/recipes/libsndfile/all/conanfile.py @@ -5,7 +5,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class LibsndfileConan(ConanFile): @@ -27,6 +27,7 @@ class LibsndfileConan(ConanFile): "experimental": [True, False], "with_alsa": [True, False], "with_external_libs": [True, False], + "with_mpeg": [True, False], } default_options = { "shared": False, @@ -35,6 +36,7 @@ class LibsndfileConan(ConanFile): "experimental": False, "with_alsa": False, "with_external_libs": True, + "with_mpeg": True, } def export_sources(self): @@ -45,10 +47,12 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC del self.options.with_alsa + if Version(self.version) < "1.1.0": + del self.options.with_mpeg def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): if self.options.get_safe("with_alsa"): @@ -56,15 +60,17 @@ def requirements(self): if self.options.with_external_libs: self.requires("ogg/1.3.5") self.requires("vorbis/1.3.7") - self.requires("flac/1.3.3") + self.requires("flac/1.4.2") self.requires("opus/1.3.1") + if self.options.get_safe("with_mpeg", False): + self.requires("mpg123/1.29.3") + self.requires("libmp3lame/3.100") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -87,6 +93,8 @@ def generate(self): if is_msvc(self) and Version(self.version) < "1.0.30": tc.variables["ENABLE_STATIC_RUNTIME"] = is_msvc_static_runtime(self) tc.variables["BUILD_REGTEST"] = False + if Version(self.version) > "1.11.0": + tc.variables["ENABLE_MPEG"] = self.options.with_mpeg # Fix iOS/tvOS/watchOS tc.variables["CMAKE_MACOSX_BUNDLE"] = False # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) @@ -121,6 +129,9 @@ def package_info(self): "ogg::ogg", "vorbis::vorbismain", "vorbis::vorbisenc", "flac::flac", "opus::opus", ]) + if self.options.get_safe("with_mpeg", False): + self.cpp_info.components["sndfile"].requires.append("mpg123::mpg123") + self.cpp_info.components["sndfile"].requires.append("libmp3lame::libmp3lame") if self.options.get_safe("with_alsa"): self.cpp_info.components["sndfile"].requires.append("libalsa::libalsa") if not self.options.shared: diff --git a/recipes/libsndfile/all/test_v1_package/CMakeLists.txt b/recipes/libsndfile/all/test_v1_package/CMakeLists.txt index 9d5c55d61ca3e..925ecbe19e448 100644 --- a/recipes/libsndfile/all/test_v1_package/CMakeLists.txt +++ b/recipes/libsndfile/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(SndFile REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE SndFile::sndfile) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libsndfile/config.yml b/recipes/libsndfile/config.yml index c83c8ed241a58..2248a847a68f0 100644 --- a/recipes/libsndfile/config.yml +++ b/recipes/libsndfile/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.0": + folder: "all" "1.0.31": folder: "all" "1.0.30": diff --git a/recipes/libsodium/all/conandata.yml b/recipes/libsodium/all/conandata.yml index 20722d7d34a3e..d0974216f8865 100644 --- a/recipes/libsodium/all/conandata.yml +++ b/recipes/libsodium/all/conandata.yml @@ -10,7 +10,9 @@ sources: patches: "1.0.18": - patch_file: "patches/0001-1.0.18-msvc_props.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Switch MSVC to use PDB" "cci.20220430": - patch_file: "patches/0001-1.0.18-msvc_props.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Switch MSVC to use PDB" diff --git a/recipes/libsodium/all/conanfile.py b/recipes/libsodium/all/conanfile.py index 41776465db519..f895ac1f52b3c 100644 --- a/recipes/libsodium/all/conanfile.py +++ b/recipes/libsodium/all/conanfile.py @@ -1,9 +1,14 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, AutoToolsBuildEnvironment, tools, MSBuild -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, MSBuild, MSBuildToolchain import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class LibsodiumConan(ConanFile): @@ -12,7 +17,7 @@ class LibsodiumConan(ConanFile): license = "ISC" url = "https://github.com/conan-io/conan-center-index" homepage = "https://doc.libsodium.org/" - topics = ("sodium", "libsodium", "encryption", "signature", "hashing") + topics = "encryption", "signature", "hashing" settings = "os", "arch", "compiler", "build_type" options = { @@ -28,29 +33,16 @@ class LibsodiumConan(ConanFile): "PIE": False, } - short_paths = True - - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _is_mingw(self): + return self.settings.os == "Windows" and self.settings.compiler == "gcc" @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - - @property - def _is_mingw(self): - return self.settings.os == "Windows" and self.settings.compiler == "gcc" - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -58,118 +50,137 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.options.shared and self._is_msvc and "MT" in msvc_runtime_flag(self): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Cannot build shared libsodium libraries with static runtime") def build_requirements(self): - if not self._is_msvc: + if not is_msvc(self): if self._is_mingw: - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = "{}{}".format( + "Debug" if self.settings.build_type == "Debug" else "Release", + "DLL" if self.options.shared else "LIB", + ) + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.append("--enable-soname-versions={}".format(yes_no(self.options.use_soname))) + tc.configure_args.append("--enable-pie={}".format(yes_no(self.options.PIE))) + if self._is_mingw: + tc.extra_ldflags.append("-lssp") + if self.settings.os == "Emscripten": + # FIXME: this is an old comment/test, has not been re-tested with conan2 upgrade + self.output.warn("os=Emscripten is not tested/supported by this recipe") + # FIXME: ./dist-build/emscripten.sh does not respect options of this recipe + tc.generate() @property def _msvc_sln_folder(self): - if self.settings.compiler == "Visual Studio": - folder = { + sln_folders = { + "Visual Studio": { "10": "vs2010", "11": "vs2012", "12": "vs2013", "14": "vs2015", "15": "vs2017", "16": "vs2019", - } - else: - folder = { + }, + "msvc": { + "170": "vs2012", + "180": "vs2013", "190": "vs2015", "191": "vs2017", "192": "vs2019", - } - + }, + } + default_folder = "vs2019" if self.version != "1.0.18": - if self.settings.compiler == "Visual Studio": - folder["17"] = "vs2022" - else: - folder["193"] = "vs2022" + sln_folders["Visual Studio"]["17"] = "vs2022" + sln_folders["msvc"]["193"] = "vs2022" + default_folder = "vs2022" - return folder.get(str(self.settings.compiler.version)) + return sln_folders.get(str(self.settings.compiler), {}).get(str(self.settings.compiler.version), default_folder) def _build_msvc(self): - msvc_sln_folder = self._msvc_sln_folder or ("vs2022" if self.version != "1.0.18" else "vs2019") - upgrade_project = self._msvc_sln_folder is None - sln_path = os.path.join(self.build_folder, self._source_subfolder, "builds", "msvc", msvc_sln_folder, "libsodium.sln") - build_type = "{}{}".format( + msvc_sln_folder = os.path.join(self.source_folder, "builds", "msvc", self._msvc_sln_folder) + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + if self.version == "1.0.18" and self._msvc_sln_folder == "vs2019": + toolset = MSBuildToolchain(self).toolset + replace_in_file( + self, os.path.join(msvc_sln_folder, "libsodium", "libsodium.vcxproj"), + "v142", + f"{toolset}", + ) + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file( + self, os.path.join(msvc_sln_folder, "libsodium", "libsodium.vcxproj"), + "", + f"", + ) + #============================== + + msbuild = MSBuild(self) + msbuild.build_type = "{}{}".format( "Dyn" if self.options.shared else "Static", "Debug" if self.settings.build_type == "Debug" else "Release", ) - msbuild = MSBuild(self) - msbuild.build(sln_path, upgrade_project=upgrade_project, platforms={"x86": "Win32"}, build_type=build_type) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if self._is_mingw: - self._autotools.libs.append("ssp") - - if self.settings.os == "Emscripten": - self.output.warn("os=Emscripten is not tested/supported by this recipe") - # FIXME: ./dist-build/emscripten.sh does not respect options of this recipe - - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-soname-versions={}".format(yes_no(self.options.use_soname)), - "--enable-pie={}".format(yes_no(self.options.PIE)), - ] - - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(msvc_sln_folder, "libsodium.sln")) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self._is_msvc: + apply_conandata_patches(self) + if is_msvc(self): self._build_msvc() else: + autotools = Autotools(self) if self._is_mingw: - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), cwd=self._source_subfolder, win_bash=tools.os_info.is_windows) - if tools.is_apple_os(self.settings.os): - # Relocatable shared lib for Apple platforms - tools.replace_in_file( - os.path.join(self._source_subfolder, "configure"), - "-install_name \\$rpath/", - "-install_name @rpath/" - ) - autotools = self._configure_autotools() + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy("*LICENSE", dst="licenses", keep_path=False) - if self._is_msvc: - self.copy("*.lib", dst="lib", keep_path=False) - self.copy("*.dll", dst="bin", keep_path=False) - inc_src = os.path.join(self._source_subfolder, "src", self.name, "include") - self.copy("*.h", src=inc_src, dst="include", keep_path=True, excludes=("*/private/*")) + copy(self, "*LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + output_dir = os.path.join(self.source_folder, "bin") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + inc_src = os.path.join(self.source_folder, "src", "libsodium", "include") + copy(self, "*.h", src=inc_src, dst=os.path.join(self.package_folder, "include"), excludes=("*/private/*")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "libsodium") - self.cpp_info.libs = ["{}sodium".format("lib" if self._is_msvc else "")] + self.cpp_info.libs = ["{}sodium".format("lib" if is_msvc(self) else "")] if not self.options.shared: self.cpp_info.defines = ["SODIUM_STATIC"] if self.settings.os in ("FreeBSD", "Linux"): diff --git a/recipes/libsodium/all/test_package/CMakeLists.txt b/recipes/libsodium/all/test_package/CMakeLists.txt index 7b9b613cbb24a..ffb72d743454e 100644 --- a/recipes/libsodium/all/test_package/CMakeLists.txt +++ b/recipes/libsodium/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libsodium REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libsodium::libsodium) diff --git a/recipes/libsodium/all/test_package/conanfile.py b/recipes/libsodium/all/test_package/conanfile.py index 5a299b64446c9..e845ae751a301 100644 --- a/recipes/libsodium/all/test_package/conanfile.py +++ b/recipes/libsodium/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libsodium/all/test_v1_package/CMakeLists.txt b/recipes/libsodium/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libsodium/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsodium/all/test_v1_package/conanfile.py b/recipes/libsodium/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libsodium/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libspatialindex/all/conandata.yml b/recipes/libspatialindex/all/conandata.yml index b2aedf72ba427..86f7d30291378 100644 --- a/recipes/libspatialindex/all/conandata.yml +++ b/recipes/libspatialindex/all/conandata.yml @@ -1,7 +1,7 @@ sources: "1.9.3": - url: "https://github.com/libspatialindex/libspatialindex/archive/1.9.3.tar.gz" - sha256: "7b44340a3edc55c11abfc453bb60f148b29f569cef9e1148583e76132e9c7379" + url: "https://github.com/libspatialindex/libspatialindex/releases/download/1.9.3/spatialindex-src-1.9.3.tar.bz2" + sha256: "4a529431cfa80443ab4dcd45a4b25aebbabe1c0ce2fa1665039c80e999dcc50a" patches: "1.9.3": - patch_file: "patches/0001-fix-static-and-mingw.patch" diff --git a/recipes/libspatialindex/all/conanfile.py b/recipes/libspatialindex/all/conanfile.py index 29ce2fecc218f..a24aef3d7e07c 100644 --- a/recipes/libspatialindex/all/conanfile.py +++ b/recipes/libspatialindex/all/conanfile.py @@ -1,22 +1,22 @@ from conan import ConanFile -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, stdcpp_library from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get from conan.tools.microsoft import is_msvc -from conans import tools as tools_legacy import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class LibspatialindexConan(ConanFile): name = "libspatialindex" description = "C++ implementation of R*-tree, an MVR-tree and a TPR-tree with C API." license = "MIT" - topics = ("libspatialindex", "spatial-indexing", "tree") + topics = ("spatial-indexing", "tree") homepage = "https://github.com/libspatialindex/libspatialindex" url = "https://github.com/conan-io/conan-center-index" + package_type = "explicit" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,8 +28,7 @@ class LibspatialindexConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,18 +36,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -56,8 +54,6 @@ def generate(self): tc.variables["SIDX_BIN_SUBDIR"] = "bin" tc.variables["SIDX_LIB_SUBDIR"] = "lib" tc.variables["SIDX_INCLUDE_SUBDIR"] = "include" - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): @@ -82,7 +78,7 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["spatialindex"].system_libs.append("m") if not self.options.shared: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.components["spatialindex"].system_libs.append(libcxx) diff --git a/recipes/libspatialindex/all/test_package/conanfile.py b/recipes/libspatialindex/all/test_package/conanfile.py index 94db9a10dc181..8b97085429a57 100644 --- a/recipes/libspatialindex/all/test_package/conanfile.py +++ b/recipes/libspatialindex/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,20 +7,21 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path_c = os.path.join(self.cpp.build.bindirs[0], "test_package_c") self.run(bin_path_c, env="conanrun") bin_path_cpp = os.path.join(self.cpp.build.bindirs[0], "test_package_cpp") diff --git a/recipes/libspatialindex/all/test_v1_package/CMakeLists.txt b/recipes/libspatialindex/all/test_v1_package/CMakeLists.txt index e225733af6e93..0d20897301b68 100644 --- a/recipes/libspatialindex/all/test_v1_package/CMakeLists.txt +++ b/recipes/libspatialindex/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libspatialindex REQUIRED CONFIG) - -add_executable(test_package_c ../test_package/test_package.c) -target_link_libraries(test_package_c PRIVATE libspatialindex::spatialindex_c) - -add_executable(test_package_cpp ../test_package/test_package.cpp) -target_link_libraries(test_package_cpp PRIVATE libspatialindex::spatialindex) -target_compile_features(test_package_cpp PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libspatialindex/all/test_v1_package/conanfile.py b/recipes/libspatialindex/all/test_v1_package/conanfile.py index 46d74ca8fdf82..302285c48aded 100644 --- a/recipes/libspatialindex/all/test_v1_package/conanfile.py +++ b/recipes/libspatialindex/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/libspng/all/CMakeLists.txt b/recipes/libspng/all/CMakeLists.txt deleted file mode 100644 index 9fb44bd9403ba..0000000000000 --- a/recipes/libspng/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory("source_subfolder") diff --git a/recipes/libspng/all/conandata.yml b/recipes/libspng/all/conandata.yml index 2ca5a76f3d406..20e5a777bfee5 100644 --- a/recipes/libspng/all/conandata.yml +++ b/recipes/libspng/all/conandata.yml @@ -1,9 +1,22 @@ sources: + "0.7.3": + url: "https://github.com/randy408/libspng/archive/refs/tags/v0.7.3.tar.gz" + sha256: "a50cadbe808ffda1a7fab17d145f52a23b163f34b3eb3696c7ecb5a52340fc1d" "0.7.2": url: "https://github.com/randy408/libspng/archive/refs/tags/v0.7.2.tar.gz" sha256: "4acf25571d31f540d0b7ee004f5461d68158e0a13182505376805da99f4ccc4e" - patches: + "0.7.3": + - patch_file: "patches/0.7.3-0001-fix-dll-install.patch" + patch_description: "fix install path" + patch_type: "portability" + - patch_file: "patches/0.7.3-0002-allow-miniz.patch" + patch_description: "add miniz option which is written in docs/BUILD.md" + patch_type: "portability" "0.7.2": - - patch_file: "patches/0.7.2-001-fix-install-path.patch" - base_path: "source_subfolder" + - patch_file: "patches/0.7.2-0001-fix-dll-install.patch" + patch_description: "fix install path" + patch_type: "portability" + - patch_file: "patches/0.7.2-0002-allow-miniz.patch" + patch_description: "add miniz option which is written in docs/BUILD.md" + patch_type: "portability" diff --git a/recipes/libspng/all/conanfile.py b/recipes/libspng/all/conanfile.py index c675ae7423eb5..fda5245bb07eb 100644 --- a/recipes/libspng/all/conanfile.py +++ b/recipes/libspng/all/conanfile.py @@ -1,8 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" + class LibspngConan(ConanFile): name = "libspng" @@ -22,16 +24,9 @@ class LibspngConan(ConanFile): "fPIC": True, "with_miniz": False, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,52 +34,49 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_miniz: - self.requires("miniz/2.2.0") + self.requires("miniz/3.0.1") else: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["SPNG_SHARED"] = self.options.shared - cmake.definitions["SPNG_STATIC"] = not self.options.shared - cmake.definitions["BUILD_EXAMPLES"] = False - cmake.definitions["CMAKE_C_FLAGS"] = "-DSPNG_USE_MINIZ" if self.options.with_miniz else "" - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SPNG_SHARED"] = self.options.shared + tc.variables["SPNG_STATIC"] = not self.options.shared + tc.variables["SPNG_USE_MINIZ"] = self.options.with_miniz + tc.variables["BUILD_EXAMPLES"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses", ignore_case=True, keep_path=False) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.set_property("cmake_file_name", "spng") - self.cpp_info.set_property("cmake_target_name", "spng::spng") - - self.cpp_info.names["cmake_find_package"] = "spng" - self.cpp_info.names["cmake_find_package_multi"] = "spng" - + self.cpp_info.set_property("pkg_config_name", "libspng") if not self.options.shared: self.cpp_info.defines = ["SPNG_STATIC"] - self.cpp_info.libs = ["spng"] if self.options.shared else ["spng_static"] if self.settings.os in ["Linux", "Android", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/libspng/all/patches/0.7.2-0001-fix-dll-install.patch b/recipes/libspng/all/patches/0.7.2-0001-fix-dll-install.patch new file mode 100644 index 0000000000000..223612a7c7b6c --- /dev/null +++ b/recipes/libspng/all/patches/0.7.2-0001-fix-dll-install.patch @@ -0,0 +1,16 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,7 +32,12 @@ endif() + if(SPNG_SHARED) + add_library(spng SHARED ${spng_SOURCES}) + target_link_libraries(spng ${spng_LIBS}) +- install(TARGETS spng DESTINATION lib) ++ install( ++ TARGETS spng ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) + + if(BUILD_EXAMPLES) + add_executable(example examples/example.c) diff --git a/recipes/libspng/all/patches/0.7.2-0002-allow-miniz.patch b/recipes/libspng/all/patches/0.7.2-0002-allow-miniz.patch new file mode 100644 index 0000000000000..7393b3d483583 --- /dev/null +++ b/recipes/libspng/all/patches/0.7.2-0002-allow-miniz.patch @@ -0,0 +1,62 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 3.0) ++cmake_minimum_required(VERSION 3.1) + + project(libspng C) + +@@ -10,19 +10,24 @@ set(SPNG_VERSION ${SPNG_MAJOR}.${SPNG_MINOR}.${SPNG_REVISION}) + option(ENABLE_OPT "Enable architecture-specific optimizations" ON) + option(SPNG_SHARED "Build shared lib" ON) + option(SPNG_STATIC "Build static lib" ON) ++option(SPNG_USE_MINIZ "Use Miniz instead of zlib" OFF) + option(BUILD_EXAMPLES "Build examples" ON) + + include(GNUInstallDirs) + +-find_package(ZLIB REQUIRED) +-include_directories(${ZLIB_INCLUDE_DIRS}) ++if(SPNG_USE_MINIZ) ++ find_package(miniz REQUIRED) ++ set(spng_LIBS miniz::miniz) ++else() ++ find_package(ZLIB REQUIRED) ++ set(spng_LIBS ZLIB::ZLIB) ++endif() + + set(spng_SOURCES spng/spng.c) + +-if(NOT CMAKE_HOST_WIN32) +- set(spng_LIBS -lm ${ZLIB_LIBRARIES}) +-else() +- set(spng_LIBS ${ZLIB_LIBRARIES}) ++find_library(LIBM NAMES m) ++if(LIBM) ++ list(APPEND spng_LIBS ${LIBM}) + endif() + + if(NOT ENABLE_OPT) +@@ -31,7 +36,10 @@ endif() + + if(SPNG_SHARED) + add_library(spng SHARED ${spng_SOURCES}) +- target_link_libraries(spng ${spng_LIBS}) ++ target_link_libraries(spng PRIVATE ${spng_LIBS}) ++ if(SPNG_USE_MINIZ) ++ target_compile_definitions(spng PRIVATE SPNG_USE_MINIZ) ++ endif() + install( + TARGETS spng + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +@@ -48,6 +56,10 @@ endif() + + if(SPNG_STATIC) + add_library(spng_static STATIC ${spng_SOURCES}) ++ target_link_libraries(spng_static PRIVATE ${spng_LIBS}) ++ if(SPNG_USE_MINIZ) ++ target_compile_definitions(spng_static PRIVATE SPNG_USE_MINIZ) ++ endif() + target_compile_definitions(spng_static PUBLIC SPNG_STATIC) + install(TARGETS spng_static DESTINATION lib) + endif() diff --git a/recipes/libspng/all/patches/0.7.2-001-fix-install-path.patch b/recipes/libspng/all/patches/0.7.2-001-fix-install-path.patch deleted file mode 100644 index 11d9b590d773f..0000000000000 --- a/recipes/libspng/all/patches/0.7.2-001-fix-install-path.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a50a31b..478ea43 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -32,7 +32,13 @@ endif() - if(SPNG_SHARED) - add_library(spng SHARED ${spng_SOURCES}) - target_link_libraries(spng ${spng_LIBS}) -- install(TARGETS spng DESTINATION lib) -+ install( -+ TARGETS spng -+ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} -+ ) - - if(BUILD_EXAMPLES) - add_executable(example examples/example.c) diff --git a/recipes/libspng/all/patches/0.7.3-0001-fix-dll-install.patch b/recipes/libspng/all/patches/0.7.3-0001-fix-dll-install.patch new file mode 100644 index 0000000000000..4178460de5ec4 --- /dev/null +++ b/recipes/libspng/all/patches/0.7.3-0001-fix-dll-install.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e6630a0..fff5d68 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -40,7 +40,12 @@ if(SPNG_SHARED) + add_library(spng SHARED ${spng_SOURCES}) + target_include_directories(spng PUBLIC ${PROJECT_SOURCE_DIR}/spng) + target_link_libraries(spng ${spng_LIBS}) +- install(TARGETS spng DESTINATION lib) ++ install( ++ TARGETS spng ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) + + if(BUILD_EXAMPLES) + add_executable(example examples/example.c) diff --git a/recipes/libspng/all/patches/0.7.3-0002-allow-miniz.patch b/recipes/libspng/all/patches/0.7.3-0002-allow-miniz.patch new file mode 100644 index 0000000000000..88dd6636031a7 --- /dev/null +++ b/recipes/libspng/all/patches/0.7.3-0002-allow-miniz.patch @@ -0,0 +1,64 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index fff5d68..5ed4ad0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,6 +12,7 @@ set(SPNG_VERSION ${SPNG_MAJOR}.${SPNG_MINOR}.${SPNG_REVISION}) + option(ENABLE_OPT "Enable architecture-specific optimizations" ON) + option(SPNG_SHARED "Build shared lib" ON) + option(SPNG_STATIC "Build static lib" ON) ++option(SPNG_USE_MINIZ "Use Miniz instead of zlib" OFF) + option(BUILD_EXAMPLES "Build examples" ON) + + include(GNUInstallDirs) +@@ -21,15 +22,19 @@ if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.12") + cmake_policy(SET CMP0074 NEW) + endif() + +-find_package(ZLIB REQUIRED) +-include_directories(${ZLIB_INCLUDE_DIRS}) ++if(SPNG_USE_MINIZ) ++ find_package(miniz REQUIRED) ++ set(spng_LIBS miniz::miniz) ++else() ++ find_package(ZLIB REQUIRED) ++ set(spng_LIBS ZLIB::ZLIB) ++endif() + + set(spng_SOURCES spng/spng.c) + +-if(NOT CMAKE_HOST_WIN32) +- set(spng_LIBS -lm ${ZLIB_LIBRARIES}) +-else() +- set(spng_LIBS ${ZLIB_LIBRARIES}) ++find_library(LIBM NAMES m) ++if(LIBM) ++ list(APPEND spng_LIBS ${LIBM}) + endif() + + if(NOT ENABLE_OPT) +@@ -39,7 +44,10 @@ endif() + if(SPNG_SHARED) + add_library(spng SHARED ${spng_SOURCES}) + target_include_directories(spng PUBLIC ${PROJECT_SOURCE_DIR}/spng) +- target_link_libraries(spng ${spng_LIBS}) ++ target_link_libraries(spng PRIVATE ${spng_LIBS}) ++ if(SPNG_USE_MINIZ) ++ target_compile_definitions(spng PRIVATE SPNG_USE_MINIZ) ++ endif() + install( + TARGETS spng + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +@@ -56,7 +64,12 @@ endif() + + if(SPNG_STATIC) + add_library(spng_static STATIC ${spng_SOURCES}) +- target_include_directories(spng PUBLIC ${PROJECT_SOURCE_DIR}/spng) ++ target_link_libraries(spng_static PRIVATE ${spng_LIBS}) ++ if(SPNG_USE_MINIZ) ++ target_compile_definitions(spng_static PRIVATE SPNG_USE_MINIZ) ++ endif() ++ ++ target_include_directories(spng_static PUBLIC ${PROJECT_SOURCE_DIR}/spng) + target_compile_definitions(spng_static PUBLIC SPNG_STATIC) + install(TARGETS spng_static DESTINATION lib) + endif() diff --git a/recipes/libspng/all/test_package/CMakeLists.txt b/recipes/libspng/all/test_package/CMakeLists.txt index a213a99dfd093..c8aa2ff46daf5 100644 --- a/recipes/libspng/all/test_package/CMakeLists.txt +++ b/recipes/libspng/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(spng REQUIRED CONFIG) +find_package(libspng REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} spng::spng) +target_link_libraries(${PROJECT_NAME} PRIVATE libspng::libspng) diff --git a/recipes/libspng/all/test_package/conanfile.py b/recipes/libspng/all/test_package/conanfile.py index bc2891a1b03a7..0a6bc68712d90 100644 --- a/recipes/libspng/all/test_package/conanfile.py +++ b/recipes/libspng/all/test_package/conanfile.py @@ -1,12 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -import re -import subprocess class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -14,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libspng/all/test_v1_package/CMakeLists.txt b/recipes/libspng/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libspng/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libspng/all/test_v1_package/conanfile.py b/recipes/libspng/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libspng/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libspng/config.yml b/recipes/libspng/config.yml index eb766ff2f024b..ed848445a96cc 100644 --- a/recipes/libspng/config.yml +++ b/recipes/libspng/config.yml @@ -1,3 +1,5 @@ versions: + "0.7.3": + folder: all "0.7.2": folder: all diff --git a/recipes/libsquish/all/conanfile.py b/recipes/libsquish/all/conanfile.py index 712e4727a04db..aaefbce93b7c7 100644 --- a/recipes/libsquish/all/conanfile.py +++ b/recipes/libsquish/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class LibsquishConan(ConanFile): @@ -11,10 +11,11 @@ class LibsquishConan(ConanFile): description = "The libSquish library compresses images with the DXT " \ "standard (also known as S3TC)." license = "MIT" - topics = ("libsquish", "image", "compression", "dxt", "s3tc") + topics = ("image", "compression", "dxt", "s3tc") homepage = "https://sourceforge.net/projects/libsquish" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -40,8 +41,7 @@ def _altivec_compliant_archs(self): return ["ppc32be", "ppc32", "ppc64le", "ppc64"] def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,13 +53,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder) + get(self, **self.conan_data["sources"][self.version]) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/libsquish/all/test_package/conanfile.py b/recipes/libsquish/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/libsquish/all/test_package/conanfile.py +++ b/recipes/libsquish/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/libsquish/all/test_v1_package/CMakeLists.txt b/recipes/libsquish/all/test_v1_package/CMakeLists.txt index a8157262ea797..0d20897301b68 100644 --- a/recipes/libsquish/all/test_v1_package/CMakeLists.txt +++ b/recipes/libsquish/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(libsquish REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE libsquish::libsquish) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsquish/all/test_v1_package/conanfile.py b/recipes/libsquish/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/libsquish/all/test_v1_package/conanfile.py +++ b/recipes/libsquish/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/libstudxml/all/conandata.yml b/recipes/libstudxml/1.0.x/conandata.yml similarity index 100% rename from recipes/libstudxml/all/conandata.yml rename to recipes/libstudxml/1.0.x/conandata.yml diff --git a/recipes/libstudxml/1.0.x/conanfile.py b/recipes/libstudxml/1.0.x/conanfile.py new file mode 100644 index 0000000000000..f2a8f72a20d39 --- /dev/null +++ b/recipes/libstudxml/1.0.x/conanfile.py @@ -0,0 +1,186 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, chdir, collect_libs, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +from conans import AutoToolsBuildEnvironment, MSBuild, tools +import os + +required_conan_version = ">=1.53.0" + + +class LibStudXmlConan(ConanFile): + name = "libstudxml" + description = "A streaming XML pull parser and streaming XML serializer implementation for modern, standard C++." + topics = ("xml", "xml-parser", "serialization") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.codesynthesis.com/projects/libstudxml/" + license = "MIT" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + _autotools = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + pass + + def requirements(self): + self.requires("expat/2.5.0", transitive_headers=True, transitive_libs=True) + + def validate(self): + if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < "9": + raise ConanInvalidConfiguration(f"Visual Studio {self.info.settings.compiler.version} is not supported.") + + def build_requirements(self): + if not is_msvc(self): + self.tool_requires("gnu-config/cci.20210814") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.tool_requires("msys2/cci.latest") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def _configure_autotools(self): + if not self._autotools: + args = ["--with-external-expat"] + if self.options.shared: + args.extend(["--enable-shared", "--disable-static"]) + else: + args.extend(["--disable-shared", "--enable-static"]) + + self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + self._autotools.configure(configure_dir=self._source_subfolder, args=args) + return self._autotools + + @property + def _vc_ver(self): + if self.settings.compiler == "Visual Studio": + return str(Version(self.settings.compiler.version).major) + elif self.settings.compiler == "msvc": + return { + "170": "11", + "180": "12", + "190": "14", + "191": "15", + "192": "16", + "193": "17", + }[str(self.settings.compiler.version)] + return None + + def _build_vs(self): + vc_ver = int(self._vc_ver) + sln_path = None + def get_sln_path(): + return os.path.join(self.source_folder, self._source_subfolder, f"libstudxml-vc{vc_ver}.sln") + + sln_path = get_sln_path() + while not os.path.exists(sln_path): + vc_ver -= 1 + sln_path = get_sln_path() + + proj_path = os.path.join(self.source_folder, self._source_subfolder, "xml", f"libstudxml-vc{vc_ver}.vcxproj") + + if not self.options.shared: + replace_in_file(self, proj_path, "DynamicLibrary", "StaticLibrary") + replace_in_file(self, proj_path, "LIBSTUDXML_DYNAMIC_LIB", "LIBSTUDXML_STATIC_LIB") + + msbuild = MSBuild(self) + msbuild.build(sln_path, platforms={"x86": "Win32"}) + + def _build_autotools(self): + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy( + self, + os.path.basename(gnu_config), + src=os.path.dirname(gnu_config), + dst=os.path.join(self.source_folder, self._source_subfolder, "config"), + ) + + if self.settings.compiler.get_safe("libcxx") == "libc++": + # libc++ includes a file called 'version', and since libstudxml adds source_subfolder as an + # include dir, libc++ ends up including their 'version' file instead, causing a compile error + rm(self, "version", os.path.join(self.source_folder, self._source_subfolder)) + + with chdir(self, os.path.join(self.source_folder, self._source_subfolder)): + self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) + + autotools = self._configure_autotools() + autotools.make() + + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + self._build_vs() + else: + self._build_autotools() + + def package(self): + copy(self, "LICENSE", src=os.path.join(self.source_folder, self._source_subfolder), dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + self.copy("xml/value-traits", dst="include", src=self._source_subfolder) + self.copy("xml/serializer", dst="include", src=self._source_subfolder) + self.copy("xml/qname", dst="include", src=self._source_subfolder) + self.copy("xml/parser", dst="include", src=self._source_subfolder) + self.copy("xml/forward", dst="include", src=self._source_subfolder) + self.copy("xml/exception", dst="include", src=self._source_subfolder) + self.copy("xml/content", dst="include", src=self._source_subfolder) + self.copy("xml/*.ixx", dst="include", src=self._source_subfolder) + self.copy("xml/*.txx", dst="include", src=self._source_subfolder) + self.copy("xml/*.hxx", dst="include", src=self._source_subfolder) + self.copy("xml/*.h", dst="include", src=self._source_subfolder) + + suffix = "" + if self.settings.arch == "x86_64": + suffix = "64" + if self.options.shared: + self.copy("*.lib", dst="lib", src=os.path.join(self._source_subfolder, "lib" + suffix)) + self.copy("*.dll", dst="bin", src=os.path.join(self._source_subfolder, "bin" + suffix)) + else: + self.copy("*.lib", dst="lib", src=os.path.join(self._source_subfolder, "bin" + suffix)) + else: + autotools = self._configure_autotools() + autotools.install() + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libstudxml") + self.cpp_info.libs = collect_libs(self) + + # If built with makefile, static library mechanism is provided by their buildsystem already + if is_msvc(self) and not self.options.shared: + self.cpp_info.defines = ["LIBSTUDXML_STATIC_LIB=1"] diff --git a/recipes/libstudxml/all/patches/configure-ac.patch b/recipes/libstudxml/1.0.x/patches/configure-ac.patch similarity index 100% rename from recipes/libstudxml/all/patches/configure-ac.patch rename to recipes/libstudxml/1.0.x/patches/configure-ac.patch diff --git a/recipes/libstudxml/all/patches/makefile-am.patch b/recipes/libstudxml/1.0.x/patches/makefile-am.patch similarity index 100% rename from recipes/libstudxml/all/patches/makefile-am.patch rename to recipes/libstudxml/1.0.x/patches/makefile-am.patch diff --git a/recipes/libstudxml/1.0.x/test_package/CMakeLists.txt b/recipes/libstudxml/1.0.x/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e931d3be71851 --- /dev/null +++ b/recipes/libstudxml/1.0.x/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +find_package(libstudxml REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libstudxml::libstudxml) diff --git a/recipes/libstudxml/1.0.x/test_package/conanfile.py b/recipes/libstudxml/1.0.x/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/libstudxml/1.0.x/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libstudxml/all/test_package/test_package.cpp b/recipes/libstudxml/1.0.x/test_package/test_package.cpp similarity index 100% rename from recipes/libstudxml/all/test_package/test_package.cpp rename to recipes/libstudxml/1.0.x/test_package/test_package.cpp diff --git a/recipes/libstudxml/1.0.x/test_v1_package/CMakeLists.txt b/recipes/libstudxml/1.0.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libstudxml/1.0.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libstudxml/1.0.x/test_v1_package/conanfile.py b/recipes/libstudxml/1.0.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libstudxml/1.0.x/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libstudxml/1.1.x/CMakeLists.txt b/recipes/libstudxml/1.1.x/CMakeLists.txt new file mode 100644 index 0000000000000..4eaaf23bf2205 --- /dev/null +++ b/recipes/libstudxml/1.1.x/CMakeLists.txt @@ -0,0 +1,40 @@ +cmake_minimum_required(VERSION 3.1) +project(libstudxml LANGUAGES C CXX) + +find_package(EXPAT REQUIRED MODULE) + +add_library(studxml + ${LIBSTUDXML_SRC_DIR}/libstudxml/parser.cxx + ${LIBSTUDXML_SRC_DIR}/libstudxml/qname.cxx + ${LIBSTUDXML_SRC_DIR}/libstudxml/serializer.cxx + ${LIBSTUDXML_SRC_DIR}/libstudxml/value-traits.cxx + ${LIBSTUDXML_SRC_DIR}/libstudxml/details/genx/char-props.c + ${LIBSTUDXML_SRC_DIR}/libstudxml/details/genx/genx.c +) +target_include_directories(studxml PUBLIC ${LIBSTUDXML_SRC_DIR}) +target_link_libraries(studxml PUBLIC EXPAT::EXPAT) + +if(BUILD_SHARED_LIBS) + target_compile_definitions(studxml + PRIVATE LIBSTUDXML_SHARED_BUILD + INTERFACE LIBSTUDXML_SHARED + ) +else() + target_compile_definitions(studxml + PRIVATE LIBSTUDXML_STATIC_BUILD + INTERFACE LIBSTUDXML_STATIC + ) +endif() + +include(GNUInstallDirs) +install( + TARGETS studxml + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) +install( + DIRECTORY ${LIBSTUDXML_SRC_DIR}/libstudxml + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + FILES_MATCHING REGEX "(.*).(h|hxx|ixx|txx)$" +) diff --git a/recipes/libstudxml/1.1.x/conandata.yml b/recipes/libstudxml/1.1.x/conandata.yml new file mode 100644 index 0000000000000..2001802fdfa42 --- /dev/null +++ b/recipes/libstudxml/1.1.x/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1.0-b.10+1": + url: "https://git.codesynthesis.com/cgit/libstudxml/libstudxml/snapshot/v1.1.0-b.10%2b1.tar.xz" + sha256: "6773bb700b0b61fb117f0737f3c754d2be67d70766d63430b8a95bf147cc0368" diff --git a/recipes/libstudxml/1.1.x/conanfile.py b/recipes/libstudxml/1.1.x/conanfile.py new file mode 100644 index 0000000000000..42db9e71046d4 --- /dev/null +++ b/recipes/libstudxml/1.1.x/conanfile.py @@ -0,0 +1,78 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir +import os + +required_conan_version = ">=1.53.0" + + +class LibStudXmlConan(ConanFile): + name = "libstudxml" + description = "A streaming XML pull parser and streaming XML serializer implementation for modern, standard C++." + topics = ("xml", "xml-parser", "serialization") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.codesynthesis.com/projects/libstudxml/" + license = "MIT" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + exports_sources = "CMakeLists.txt" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("expat/2.5.0", transitive_headers=True, transitive_libs=True) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBSTUDXML_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + # unvendor expat + rmdir(self, os.path.join(self.source_folder, "libstudxml", "details", "expat")) + replace_in_file( + self, + os.path.join(self.source_folder, "libstudxml", "parser.hxx"), + "#ifndef LIBSTUDXML_EXTERNAL_EXPAT", + "#if 0", + ) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libstudxml") + self.cpp_info.libs = ["studxml"] + self.cpp_info.defines = ["LIBSTUDXML_SHARED" if self.options.shared else "LIBSTUDXML_STATIC"] diff --git a/recipes/libstudxml/1.1.x/test_package/CMakeLists.txt b/recipes/libstudxml/1.1.x/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e931d3be71851 --- /dev/null +++ b/recipes/libstudxml/1.1.x/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +find_package(libstudxml REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libstudxml::libstudxml) diff --git a/recipes/libstudxml/1.1.x/test_package/conanfile.py b/recipes/libstudxml/1.1.x/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/libstudxml/1.1.x/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libstudxml/1.1.x/test_package/test_package.cpp b/recipes/libstudxml/1.1.x/test_package/test_package.cpp new file mode 100644 index 0000000000000..9ebd7090dd31e --- /dev/null +++ b/recipes/libstudxml/1.1.x/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include + +int main() { + std::istringstream is("X"); + xml::parser p(is, "test"); + + bool success = true; + success &= p.next() == xml::parser::start_element; + success &= p.next() == xml::parser::start_element; + success &= p.next() == xml::parser::characters && p.value() == "X"; + + return success ? 0 : -1; +} diff --git a/recipes/libstudxml/1.1.x/test_v1_package/CMakeLists.txt b/recipes/libstudxml/1.1.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libstudxml/1.1.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libstudxml/1.1.x/test_v1_package/conanfile.py b/recipes/libstudxml/1.1.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libstudxml/1.1.x/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libstudxml/all/conanfile.py b/recipes/libstudxml/all/conanfile.py deleted file mode 100644 index 5db634e6fdac0..0000000000000 --- a/recipes/libstudxml/all/conanfile.py +++ /dev/null @@ -1,164 +0,0 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, tools -from conans.errors import ConanInvalidConfiguration -import os -import shutil - -required_conan_version = ">=1.33.0" - - -class LibStudXmlConan(ConanFile): - name = "libstudxml" - description = "A streaming XML pull parser and streaming XML serializer implementation for modern, standard C++." - topics = ("xml", "xml-parser", "serialization") - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://www.codesynthesis.com/projects/libstudxml/" - license = "MIT" - settings = "os", "compiler", "build_type", "arch" - - exports_sources = "patches/*" - - options = { - "shared": [True, False], - "fPIC": [True, False], - } - default_options = { - "shared": False, - "fPIC": True, - } - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - - def configure(self): - if self.options.shared: - del self.options.fPIC - - def requirements(self): - self.requires("expat/2.4.1") - - def validate(self): - if self.settings.compiler == "Visual Studio": - if tools.Version(self.settings.compiler.version) < "9": - raise ConanInvalidConfiguration("Visual Studio {} is not supported.".format(self.settings.compiler.version)) - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - def build_requirements(self): - if self.settings.compiler != "Visual Studio": - self.build_requires("gnu-config/cci.20201022") - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if not self._autotools: - args = ["--with-external-expat"] - if self.options.shared: - args.extend(["--enable-shared", "--disable-static"]) - else: - args.extend(["--disable-shared", "--enable-static"]) - - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.configure(configure_dir=self._source_subfolder, args=args) - return self._autotools - - def _build_vs(self): - vc_ver = int(tools.Version(self.settings.compiler.version).major) - sln_path = None - def get_sln_path(): - return os.path.join(self._source_subfolder, "libstudxml-vc{}.sln".format(vc_ver)) - - sln_path = get_sln_path() - while not os.path.exists(sln_path): - vc_ver -= 1 - sln_path = get_sln_path() - - proj_path = os.path.join(self._source_subfolder, "xml", "libstudxml-vc{}.vcxproj".format(vc_ver)) - - if not self.options.shared: - tools.replace_in_file(proj_path, "DynamicLibrary", "StaticLibrary") - tools.replace_in_file(proj_path, "LIBSTUDXML_DYNAMIC_LIB", "LIBSTUDXML_STATIC_LIB") - - msbuild = MSBuild(self) - msbuild.build(sln_path, platforms={"x86": "Win32"}) - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - - def _build_autotools(self): - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config", "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config", "config.guess")) - - if self.settings.compiler.get_safe("libcxx") == "libc++": - # libc++ includes a file called 'version', and since libstudxml adds source_subfolder as an - # include dir, libc++ ends up including their 'version' file instead, causing a compile error - tools.remove_files_by_mask(self._source_subfolder, "version") - - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - - autotools = self._configure_autotools() - autotools.make() - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - if self.settings.compiler == "Visual Studio": - self._build_vs() - else: - self._build_autotools() - - def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - if self.settings.compiler == "Visual Studio": - self.copy("xml/value-traits", dst="include", src=self._source_subfolder) - self.copy("xml/serializer", dst="include", src=self._source_subfolder) - self.copy("xml/qname", dst="include", src=self._source_subfolder) - self.copy("xml/parser", dst="include", src=self._source_subfolder) - self.copy("xml/forward", dst="include", src=self._source_subfolder) - self.copy("xml/exception", dst="include", src=self._source_subfolder) - self.copy("xml/content", dst="include", src=self._source_subfolder) - self.copy("xml/*.ixx", dst="include", src=self._source_subfolder) - self.copy("xml/*.txx", dst="include", src=self._source_subfolder) - self.copy("xml/*.hxx", dst="include", src=self._source_subfolder) - self.copy("xml/*.h", dst="include", src=self._source_subfolder) - - suffix = "" - if self.settings.arch == "x86_64": - suffix = "64" - if self.options.shared: - self.copy("*.lib", dst="lib", src=os.path.join(self._source_subfolder, "lib" + suffix)) - self.copy("*.dll", dst="bin", src=os.path.join(self._source_subfolder, "bin" + suffix)) - else: - self.copy("*.lib", dst="lib", src=os.path.join(self._source_subfolder, "bin" + suffix)) - else: - autotools = self._configure_autotools() - autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "libstudxml.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - - def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - self.cpp_info.names["pkg_config"] = "libstudxml" - - # If built with makefile, static library mechanism is provided by their buildsystem already - if self.settings.compiler == "Visual Studio" and not self.options.shared: - self.cpp_info.defines = ["LIBSTUDXML_STATIC_LIB=1"] diff --git a/recipes/libstudxml/all/test_package/CMakeLists.txt b/recipes/libstudxml/all/test_package/CMakeLists.txt deleted file mode 100644 index 196188113685c..0000000000000 --- a/recipes/libstudxml/all/test_package/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) diff --git a/recipes/libstudxml/config.yml b/recipes/libstudxml/config.yml index 67af1aea3aa55..119e8114fa194 100644 --- a/recipes/libstudxml/config.yml +++ b/recipes/libstudxml/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.0-b.10+1": + folder: "1.1.x" "1.0.1": - folder: "all" + folder: "1.0.x" diff --git a/recipes/libsvm/all/CMakeLists.txt b/recipes/libsvm/all/CMakeLists.txt index 94b3d9d728f7d..3c3e2d6052401 100644 --- a/recipes/libsvm/all/CMakeLists.txt +++ b/recipes/libsvm/all/CMakeLists.txt @@ -1,20 +1,19 @@ cmake_minimum_required(VERSION 3.4) project(svm C CXX) -include(${CMAKE_SOURCE_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +include(GNUInstallDirs) -add_library(svm source_subfolder/svm.cpp) +add_library(svm ${LIBSVM_SRC_DIR}/svm.cpp) set_property(TARGET svm PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS ON) -set_target_properties(svm PROPERTIES PUBLIC_HEADER source_subfolder/svm.h) +set_target_properties(svm PROPERTIES PUBLIC_HEADER ${LIBSVM_SRC_DIR}/svm.h) -add_executable(svm-predict source_subfolder/svm-predict.c) +add_executable(svm-predict ${LIBSVM_SRC_DIR}/svm-predict.c) target_link_libraries(svm-predict svm) -add_executable(svm-train source_subfolder/svm-train.c) +add_executable(svm-train ${LIBSVM_SRC_DIR}/svm-train.c) target_link_libraries(svm-train svm) -add_executable(svm-scale source_subfolder/svm-scale.c) +add_executable(svm-scale ${LIBSVM_SRC_DIR}/svm-scale.c) install(TARGETS svm RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} @@ -23,4 +22,6 @@ install(TARGETS svm PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/svm ) -install(TARGETS svm-predict svm-train svm-scale DESTINATION ${CMAKE_INSTALL_BINDIR}) +install(TARGETS svm-predict svm-train svm-scale + DESTINATION ${CMAKE_INSTALL_BINDIR} + ) diff --git a/recipes/libsvm/all/conandata.yml b/recipes/libsvm/all/conandata.yml index 5cf318b9846a6..5712311441eb3 100644 --- a/recipes/libsvm/all/conandata.yml +++ b/recipes/libsvm/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "330": + url: "https://github.com/cjlin1/libsvm/archive/v330.tar.gz" + sha256: "e4fe41308c87cc210aec73e4f5f0fb4da14234d90e7a131763fbad3788ca2d80" "325": url: "https://github.com/cjlin1/libsvm/archive/v325.tar.gz" sha256: "1f587ec0df6fd422dfe50f942f8836ac179b0723b768fe9d2fabdfd1601a0963" diff --git a/recipes/libsvm/all/conanfile.py b/recipes/libsvm/all/conanfile.py index 794619a3eb1c5..5391a6c157e8a 100644 --- a/recipes/libsvm/all/conanfile.py +++ b/recipes/libsvm/all/conanfile.py @@ -1,7 +1,12 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import stdcpp_library +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import get, copy +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class libsvmConan(ConanFile): @@ -10,17 +15,19 @@ class libsvmConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.csie.ntu.edu.tw/~cjlin/libsvm/" license = "BSD-3-Clause" - topics = ("conan", "svm", "vector") - exports_sources = ["CMakeLists.txt"] - generators = "cmake" + topics = "svm", "vector" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - _cmake = None + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -28,39 +35,40 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if ( - self.settings.compiler == "Visual Studio" and - "MT" in self.settings.compiler.runtime and - self.options.shared - ): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration( - "{} can not be built as shared library + runtime {}.".format( - self.name, - self.settings.compiler.runtime - ) + f"{self.ref} can not be built as shared library with Visual Studio and static runtime" ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBSVM_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("COPYRIGHT", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "COPYRIGHT", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["svm"] + if not self.options.shared: + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/libsvm/all/test_package/CMakeLists.txt b/recipes/libsvm/all/test_package/CMakeLists.txt index 37cb8eb98e622..dca2cfa3e609e 100644 --- a/recipes/libsvm/all/test_package/CMakeLists.txt +++ b/recipes/libsvm/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libsvm CONFIG REQUIRED) -add_executable(test_package test_package.cpp) -target_link_libraries(test_package ${CONAN_LIBS}) +add_executable(test_package test_package.c) +target_link_libraries(test_package PRIVATE libsvm::libsvm) diff --git a/recipes/libsvm/all/test_package/conanfile.py b/recipes/libsvm/all/test_package/conanfile.py index a59a26a52c8dc..70b80fc025616 100644 --- a/recipes/libsvm/all/test_package/conanfile.py +++ b/recipes/libsvm/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libsvm/all/test_package/test_package.c b/recipes/libsvm/all/test_package/test_package.c new file mode 100644 index 0000000000000..fc322d31c2797 --- /dev/null +++ b/recipes/libsvm/all/test_package/test_package.c @@ -0,0 +1,19 @@ +#include + +#include +#include + +struct svm_parameter param; + +int main(int argc, char **argv) +{ + param.svm_type = C_SVC; + param.kernel_type = PRECOMPUTED; + + //Allocate some dummy data + param.weight = (double*)malloc(10 * sizeof(double)); + svm_destroy_param(¶m); + + printf("libsvm version %d test_package OK \n", LIBSVM_VERSION); + return 0; +} diff --git a/recipes/libsvm/all/test_package/test_package.cpp b/recipes/libsvm/all/test_package/test_package.cpp deleted file mode 100644 index 0dfeb6978f4e7..0000000000000 --- a/recipes/libsvm/all/test_package/test_package.cpp +++ /dev/null @@ -1,17 +0,0 @@ -#include -#include -#include "svm/svm.h" - -struct svm_parameter param; - -int main(int argc, char **argv) -{ - param.svm_type = C_SVC; - param.kernel_type = PRECOMPUTED; - - //Allocate some dummy data - param.weight = (double*)malloc(10 * sizeof(double)); - svm_destroy_param(¶m); - - printf("libsvm version %d test_package OK \n", LIBSVM_VERSION); -} diff --git a/recipes/libsvm/all/test_v1_package/CMakeLists.txt b/recipes/libsvm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libsvm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libsvm/all/test_v1_package/conanfile.py b/recipes/libsvm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c1c8554eae243 --- /dev/null +++ b/recipes/libsvm/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building + +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libsvm/config.yml b/recipes/libsvm/config.yml index eee94a5e39ec3..026fbb9e30356 100644 --- a/recipes/libsvm/config.yml +++ b/recipes/libsvm/config.yml @@ -1,4 +1,6 @@ versions: + "330": + folder: all "325": folder: all "324": diff --git a/recipes/libsvtav1/all/conandata.yml b/recipes/libsvtav1/all/conandata.yml new file mode 100644 index 0000000000000..0ad0ccad87475 --- /dev/null +++ b/recipes/libsvtav1/all/conandata.yml @@ -0,0 +1,27 @@ +sources: + "1.4.1": + url: https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v1.4.1/SVT-AV1-v1.4.1.tar.bz2 + sha256: 0e988582f315fe76c909accf5e7f81b975c5bd2b850ee760d8e9fac297f70b5d + "1.3.0": + url: https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v1.3.0/SVT-AV1-v1.3.0.tar.bz2 + sha256: f85fd13ef16880550e425797bdfdf1b0ba310c21d6b343f74ea79dd2fbb2336e + "1.2.1": + url: https://gitlab.com/AOMediaCodec/SVT-AV1/-/archive/v1.2.1/SVT-AV1-v1.2.1.tar.bz2 + sha256: 805827daa8aedec4f1362b959f377075e2a811680bfc76b6f4fbf2ef4e7101d4 + +patches: + "1.4.1": + - patch_file: "patches/llvm-clang-macos.patch" + patch_type: "portability" + patch_source: https://gitlab.com/AOMediaCodec/SVT-AV1/-/merge_requests/2070 + patch_description: "Allow statically compiling on macos with llvm-clang" + "1.3.0": + - patch_file: "patches/llvm-clang-macos.patch" + patch_type: "portability" + patch_source: https://gitlab.com/AOMediaCodec/SVT-AV1/-/merge_requests/2070 + patch_description: "Allow statically compiling on macos with llvm-clang" + "1.2.1": + - patch_file: "patches/llvm-clang-macos.patch" + patch_type: "portability" + patch_source: https://gitlab.com/AOMediaCodec/SVT-AV1/-/merge_requests/2070 + patch_description: "Allow statically compiling on macos with llvm-clang" diff --git a/recipes/libsvtav1/all/conanfile.py b/recipes/libsvtav1/all/conanfile.py new file mode 100644 index 0000000000000..511812832ae5f --- /dev/null +++ b/recipes/libsvtav1/all/conanfile.py @@ -0,0 +1,105 @@ +import os +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMakeToolchain, CMakeDeps, CMake +from conan.tools.files import copy, get, rmdir, apply_conandata_patches, export_conandata_patches +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + + +class SVTAV1Conan(ConanFile): + name = "libsvtav1" + license = "BSD-3-Clause" + description = "An AV1-compliant software encoder/decoder library" + topics = "av1", "codec", "encoder", "decoder", "video" + homepage = "https://gitlab.com/AOMediaCodec/SVT-AV1" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "build_encoder": [True, False], + "build_decoder": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "build_encoder": True, + "build_decoder": True, + } + + def config_options(self): + if self.settings.os == "Windows": + self.options.rm_safe("fPIC") + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def build_requirements(self): + if Version(self.version) >= "1.3.0": + # at least CMake 3.16 + self.tool_requires("cmake/3.25.0") + if self.settings.arch in ("x86", "x86_64"): + self.tool_requires("nasm/2.15.05") + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_APPS"] = False + tc.variables["BUILD_DEC"] = self.options.build_decoder + tc.variables["BUILD_ENC"] = self.options.build_encoder + if self.settings.arch in ("x86", "x86_64"): + tc.variables["ENABLE_NASM"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + "LICENSE.md", + self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + copy( + self, + "PATENTS.md", + self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + + cmake = CMake(self) + cmake.configure() + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + if self.options.build_encoder: + self.cpp_info.components["encoder"].libs = ["SvtAv1Enc"] + self.cpp_info.components["encoder"].includedirs = ["include/svt-av1"] + self.cpp_info.components["encoder"].set_property("pkg_config_name", "SvtAv1Enc") + self.cpp_info.components["encoder"].names["pkg_config"] = "SvtAv1Enc" + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.components["encoder"].system_libs = ["pthread", "dl", "m"] + if self.options.build_decoder: + self.cpp_info.components["decoder"].libs = ["SvtAv1Dec"] + self.cpp_info.components["decoder"].includedirs = ["include/svt-av1"] + self.cpp_info.components["decoder"].set_property("pkg_config_name", "SvtAv1Dec") + self.cpp_info.components["decoder"].names["pkg_config"] = "SvtAv1Dec" + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.components["encoder"].system_libs = ["pthread", "dl", "m"] diff --git a/recipes/libsvtav1/all/patches/llvm-clang-macos.patch b/recipes/libsvtav1/all/patches/llvm-clang-macos.patch new file mode 100644 index 0000000000000..d10d1cfa53876 --- /dev/null +++ b/recipes/libsvtav1/all/patches/llvm-clang-macos.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 4d2dd735..7cabadd0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -205,8 +205,11 @@ if(UNIX) + set(CMAKE_MACOSX_RPATH 1) + set(CMAKE_C_ARCHIVE_CREATE " Scr ") + set(CMAKE_CXX_ARCHIVE_CREATE " Scr ") +- set(CMAKE_C_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") +- set(CMAKE_CXX_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") ++ if(NOT CMAKE_RANLIB MATCHES "llvm-ranlib$") ++ # we are using apple-clang ++ set(CMAKE_C_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") ++ set(CMAKE_CXX_ARCHIVE_FINISH " -no_warning_for_no_symbols -c ") ++ endif() + else() + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -z noexecstack -z relro -z now") + endif() diff --git a/recipes/libsvtav1/all/test_package/CMakeLists.txt b/recipes/libsvtav1/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..57e131a83ee08 --- /dev/null +++ b/recipes/libsvtav1/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(libsvtav1 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libsvtav1::encoder) +target_link_libraries(${PROJECT_NAME} PRIVATE libsvtav1::decoder) diff --git a/recipes/libsvtav1/all/test_package/conanfile.py b/recipes/libsvtav1/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f76921cc6be61 --- /dev/null +++ b/recipes/libsvtav1/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libsvtav1/all/test_package/test_package.cpp b/recipes/libsvtav1/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..cb808440d268e --- /dev/null +++ b/recipes/libsvtav1/all/test_package/test_package.cpp @@ -0,0 +1,6 @@ +#include "EbSvtAv1Enc.h" +#include "EbSvtAv1Dec.h" + +#include + +int main() { std::cout << svt_av1_get_version() << "\n"; } diff --git a/recipes/libsvtav1/all/test_v1_package/CMakeLists.txt b/recipes/libsvtav1/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libsvtav1/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libsvtav1/all/test_v1_package/conanfile.py b/recipes/libsvtav1/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/libsvtav1/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libsvtav1/config.yml b/recipes/libsvtav1/config.yml new file mode 100644 index 0000000000000..37cfc8825c04f --- /dev/null +++ b/recipes/libsvtav1/config.yml @@ -0,0 +1,7 @@ +versions: + "1.4.1": + folder: all + "1.3.0": + folder: all + "1.2.1": + folder: all diff --git a/recipes/libsystemd/all/conandata.yml b/recipes/libsystemd/all/conandata.yml index bad16940c7037..5c8e2c6ade205 100644 --- a/recipes/libsystemd/all/conandata.yml +++ b/recipes/libsystemd/all/conandata.yml @@ -14,15 +14,18 @@ sources: "251.4": url: "https://github.com/systemd/systemd-stable/archive/v251.4.tar.gz" sha256: "3459239979f52b8c4ace33734d31c2fb69fa13cf81d04b1b982f7d8d4651e015" + "252.4": + url: "https://github.com/systemd/systemd-stable/archive/v252.4.tar.gz" + sha256: "cf2d27e67663d599a045101c7178cf0ec63d9df2962a54adf7de0d0357724f00" patches: "246.16": - patch_file: "patches/246.16/0001-Drop-bundled-copy-of-linux-if_arp.h.patch" patch_description: "fix build error with Linux headers >= 5.14 by removing a bundled copy of it" - patch_type: "backport" + patch_type: "portability" patch_source: "https://github.com/systemd/systemd-stable/commit/06dea04b38ce506c1436cd4fef9bf9919a34f441" - patch_file: "patches/246.16/0002-meson.build-change-operator-combining-bools-from-to-.patch" patch_description: "allow to build with meson >= 0.60.0 by fixing syntax error" - patch_type: "backport" + patch_type: "bugfix" patch_source: "https://github.com/systemd/systemd-stable/commit/3d0666d9091dd097022f02fae79890b5746285c1" - patch_file: "patches/246.16/0003-Remove-dependency-from-coreutils.patch" patch_description: "allow to build in environments without 'realpath --relative-to' by replacing it with conan-specific build variable" @@ -52,3 +55,10 @@ patches: - patch_file: "patches/251.4/0001-Remove-dependency-from-coreutils.patch" patch_description: "allow to build in environments without 'realpath --relative-to' by replacing it with conan-specific build variable" patch_type: "conan" + "252.4": + - patch_file: "patches/248.10/0001-missing_syscalls.py-Replace-unicode-with-ascii.patch" + patch_description: "allow to use meson.build with older versions of Python by replacing utf8 message to ascii message in the helper script" + patch_type: "conan" + - patch_file: "patches/251.4/0001-Remove-dependency-from-coreutils.patch" + patch_description: "allow to build in environments without 'realpath --relative-to' by replacing it with conan-specific build variable" + patch_type: "conan" diff --git a/recipes/libsystemd/all/conanfile.py b/recipes/libsystemd/all/conanfile.py index ba52c79934817..6ea4caf383334 100644 --- a/recipes/libsystemd/all/conanfile.py +++ b/recipes/libsystemd/all/conanfile.py @@ -36,7 +36,7 @@ class LibsystemdConan(ConanFile): "with_xz": True, "with_zstd": True, } - generators = "PkgConfigDeps" + generators = "PkgConfigDeps", "VirtualBuildEnv" exports_sources = "patches/**" def configure(self): @@ -188,9 +188,9 @@ def package_info(self): # FIXME: this `.version` should only happen for the `pkg_config` # generator (see https://github.com/conan-io/conan/issues/8202) # systemd uses only major version in its .pc file - self.cpp_info.version = Version(self.version).major + self.cpp_info.version = str(Version(self.version).major) self.cpp_info.set_property("component_version", - Version(self.version).major) + str(Version(self.version).major)) self.cpp_info.system_libs = ["rt", "pthread", "dl"] # FIXME: remove this block and set required_conan_version to >=1.51.1 diff --git a/recipes/libsystemd/config.yml b/recipes/libsystemd/config.yml index 46dd6c53cbb3c..c1a22f5e0a469 100644 --- a/recipes/libsystemd/config.yml +++ b/recipes/libsystemd/config.yml @@ -9,3 +9,5 @@ versions: folder: all "251.4": folder: all + "252.4": + folder: all diff --git a/recipes/libtar/all/conanfile.py b/recipes/libtar/all/conanfile.py index ee13476b984cb..60120c5cb3ca8 100644 --- a/recipes/libtar/all/conanfile.py +++ b/recipes/libtar/all/conanfile.py @@ -1,14 +1,19 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.env import VirtualRunEnv +from conan.tools.files import copy, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibTarConan(ConanFile): name = "libtar" description = "libtar is a library for manipulating tar files from within C programs." - topics = ("conan", "libtar") + topics = ("tar") license = "BSD-3-Clause" homepage = "https://repo.or.cz/libtar.git" url = "https://github.com/conan-io/conan-center-index" @@ -24,76 +29,75 @@ class LibTarConan(ConanFile): "with_zlib": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.11") + self.requires("zlib/1.2.13") def validate(self): - if self.settings.os == "Windows": + if self.info.settings.os == "Windows": raise ConanInvalidConfiguration("libtar does not support Windows") def build_requirements(self): - self.build_requires("libtool/2.4.6") + self.tool_requires("libtool/2.4.7") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] - conf_args = [ + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ "--with-zlib" if self.options.with_zlib else "--without-zlib", - ] - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) - else: - conf_args.extend(["--disable-shared", "--enable-static"]) - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + ]) + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") def _patch_sources(self): if self.options.with_zlib: - tools.replace_in_file(os.path.join(self._source_subfolder, "configure.ac"), - "AC_CHECK_LIB([z], [gzread])", - "AC_CHECK_LIB([{}], [gzread])".format(self.deps_cpp_info["zlib"].libs[0])) + replace_in_file( + self, + os.path.join(self.source_folder, "configure.ac"), + "AC_CHECK_LIB([z], [gzread])", + "AC_CHECK_LIB([{}], [gzread])".format(self.dependencies["zlib"].cpp_info.libs[0]), + ) def build(self): self._patch_sources() - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True, win_bash=tools.os_info.is_windows) - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + # TODO: use fix_apple_shared_install_name(self) instead, once https://github.com/conan-io/conan/issues/12107 fixed + replace_in_file(self, os.path.join(self.source_folder, "configure"), "-install_name \\$rpath/", "-install_name @rpath/") + autotools.configure() autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() + copy(self, "COPYRIGHT", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) autotools.install() - - os.unlink(os.path.join(os.path.join(self.package_folder, "lib", "libtar.la"))) - tools.rmdir(os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libs = ["tar"] + # TODO: to remove in conan v2 bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.deps_env_info.PATH.append(bin_path) diff --git a/recipes/libtar/all/test_package/CMakeLists.txt b/recipes/libtar/all/test_package/CMakeLists.txt index 3a403dc404b41..be08382306a84 100644 --- a/recipes/libtar/all/test_package/CMakeLists.txt +++ b/recipes/libtar/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() +find_package(libtar REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libtar::libtar) diff --git a/recipes/libtar/all/test_package/conanfile.py b/recipes/libtar/all/test_package/conanfile.py index c6abbd84ca12f..cdb17258fdda1 100644 --- a/recipes/libtar/all/test_package/conanfile.py +++ b/recipes/libtar/all/test_package/conanfile.py @@ -1,12 +1,22 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.errors import ConanException +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.files import load import os import tarfile class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -25,15 +35,15 @@ def test(self): bio.seek(0) f.addfile(tarinfo, bio) - if not tools.cross_building(self): + if can_run(self): if os.path.exists("hello_world"): raise ConanException("file extracted by tar archive should not exist yet") - bin_path = os.path.join("bin", "test_package") - self.run("{} {}".format(bin_path, "test.tar"), run_environment=True) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(f"{bin_path} test.tar", env="conanrun") if not os.path.exists("hello_world"): raise ConanException("file not extracted") - extracted_text = tools.load("hello_world") + extracted_text = load(self, "hello_world") if extracted_text != "secret text\n": - raise ConanException("File not loaded correctly. Got \"{}\"".format(repr(extracted_text))) + raise ConanException(f"File not loaded correctly. Got \"{repr(extracted_text)}\"") self.run("libtar -t test.tar", run_environment=True) diff --git a/recipes/libtar/all/test_v1_package/CMakeLists.txt b/recipes/libtar/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libtar/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libtar/all/test_v1_package/conanfile.py b/recipes/libtar/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ace7da972a9e0 --- /dev/null +++ b/recipes/libtar/all/test_v1_package/conanfile.py @@ -0,0 +1,39 @@ +from conans import ConanFile, CMake, tools +from conans.errors import ConanException +import os +import tarfile + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + with tarfile.open("test.tar", "w", format=tarfile.GNU_FORMAT) as f: + import io + bio = io.BytesIO() + bio.write(b"secret text\n") + tarinfo = tarfile.TarInfo("hello_world") + tarinfo.size = bio.tell() + import time + tarinfo.mtime = time.time() + bio.seek(0) + f.addfile(tarinfo, bio) + + if not tools.cross_building(self): + if os.path.exists("hello_world"): + raise ConanException("file extracted by tar archive should not exist yet") + bin_path = os.path.join("bin", "test_package") + self.run(f"{bin_path} test.tar", run_environment=True) + if not os.path.exists("hello_world"): + raise ConanException("file not extracted") + extracted_text = tools.load("hello_world") + if extracted_text != "secret text\n": + raise ConanException(f"File not loaded correctly. Got \"{repr(extracted_text)}\"") + + self.run("libtar -t test.tar", run_environment=True) diff --git a/recipes/libtasn1/all/conandata.yml b/recipes/libtasn1/all/conandata.yml index 2cb642694eeb9..4c2bc670569f5 100644 --- a/recipes/libtasn1/all/conandata.yml +++ b/recipes/libtasn1/all/conandata.yml @@ -4,5 +4,4 @@ sources: sha256: "0e0fb0903839117cb6e3b56e68222771bebf22ad7fc2295a0ed7d576e8d4329d" patches: "4.16.0": - - base_path: "source_subfolder" - patch_file: "patches/0001-do-not-add-static-to-functions-meant-to-be-built.patch" + - patch_file: "patches/0001-do-not-add-static-to-functions-meant-to-be-built.patch" diff --git a/recipes/libtasn1/all/conanfile.py b/recipes/libtasn1/all/conanfile.py index b6fcd3dac48b7..9ec3d89cded7e 100644 --- a/recipes/libtasn1/all/conanfile.py +++ b/recipes/libtasn1/all/conanfile.py @@ -1,19 +1,24 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class LibTasn1Conan(ConanFile): name = "libtasn1" homepage = "https://www.gnu.org/software/libtasn1/" description = "Libtasn1 is the ASN.1 library used by GnuTLS, p11-kit and some other packages." - topics = ("conan", "libtasn", "ASN.1", "cryptography") + topics = ("libtasn", "ASN.1", "cryptography") url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "arch", "build_type" license = "LGPL-2.1-or-later" - exports_sources = "patches/**" + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -23,11 +28,12 @@ class LibTasn1Conan(ConanFile): "fPIC": True, } - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,62 +41,78 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("Visual Studio is unsupported by libtasn1") - - @property - def _settings_build(self): - return self.settings_build if hasattr(self, "settings_build") else self.settings + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio") def build_requirements(self): - self.build_requires("bison/3.5.3") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("bison/3.8.2") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if self.settings.compiler != "Visual Studio": - self._autotools.flags.append("-std=c99") - conf_args = [ - "--disable-doc", - ] - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) - else: - conf_args.extend(["--disable-shared", "--enable-static"]) - self._autotools.configure(configure_dir=self._source_subfolder, args=conf_args) - return self._autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + if not is_msvc(self): + tc.extra_cflags.append("-std=c99") + tc.configure_args.append("--disable-doc") + # Workaround against SIP on macOS + if self.settings.os == "Macos" and self.options.shared: + tc.extra_ldflags.append("-Wl,-rpath,@loader_path/../lib") + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # TODO: use fix_apple_shared_install_name(self) instead, once https://github.com/conan-io/conan/issues/12107 fixed + replace_in_file(self, os.path.join(self.source_folder, "configure"), + "-install_name \\$rpath/", + "-install_name @rpath/") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - autotools = self._configure_autotools() + self._patch_sources() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - os.remove(os.path.join(self.package_folder, "lib", "libtasn1.la")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): - self.cpp_info.names["pkg_config"] = "libtasn1" + self.cpp_info.set_property("pkg_config_name", "libtasn1") self.cpp_info.libs = ["tasn1"] if not self.options.shared: self.cpp_info.defines = ["ASN1_STATIC"] + # TODO: to remove in conan v2 bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.output.info(f"Appending PATH environment variable: {bindir}") self.env_info.PATH.append(bindir) diff --git a/recipes/libtasn1/all/test_package/CMakeLists.txt b/recipes/libtasn1/all/test_package/CMakeLists.txt index 2607f861afeb7..7a3bf383182c3 100644 --- a/recipes/libtasn1/all/test_package/CMakeLists.txt +++ b/recipes/libtasn1/all/test_package/CMakeLists.txt @@ -1,12 +1,21 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() +find_program(ASN1_PARSER NAMES asn1Parser) +if(NOT ASN1_PARSER) + message(FATAL_ERROR "asn1Parser not found") +endif() +find_package(libtasn1 REQUIRED CONFIG) -add_custom_command(OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/pkix_asn1_tab.c" - COMMAND asn1Parser -o "${CMAKE_CURRENT_BINARY_DIR}/pkix_asn1_tab.c" "${CMAKE_CURRENT_SOURCE_DIR}/pkix.asn" - DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/pkix.asn") +set(PKIX_ASN1_TAB_C "${CMAKE_CURRENT_BINARY_DIR}/pkix_asn1_tab.c") +set(PKIX_ASN_IN "${CMAKE_CURRENT_SOURCE_DIR}/pkix.asn") +add_custom_command( + COMMAND ${ASN1_PARSER} -o ${PKIX_ASN1_TAB_C} ${PKIX_ASN_IN} + OUTPUT ${PKIX_ASN1_TAB_C} + DEPENDS ${PKIX_ASN_IN} +) +add_custom_target(pkix_asn DEPENDS ${PKIX_ASN1_TAB_C}) -add_executable(${PROJECT_NAME} test_package.c "${CMAKE_CURRENT_BINARY_DIR}/pkix_asn1_tab.c") -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} test_package.c ${PKIX_ASN1_TAB_C}) +target_link_libraries(${PROJECT_NAME} PRIVATE libtasn1::libtasn1) +add_dependencies(${PROJECT_NAME} pkix_asn) diff --git a/recipes/libtasn1/all/test_package/conanfile.py b/recipes/libtasn1/all/test_package/conanfile.py index 1c41e93c89e0b..8214a95b5bd16 100644 --- a/recipes/libtasn1/all/test_package/conanfile.py +++ b/recipes/libtasn1/all/test_package/conanfile.py @@ -1,10 +1,22 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv", "VirtualBuildEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +24,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") asn = os.path.join(self.source_folder, "pkix.asn") - self.run("{} {}".format(bin_path, asn), run_environment=True) + self.run(f"{bin_path} {asn}", env="conanrun") diff --git a/recipes/libtasn1/all/test_v1_package/CMakeLists.txt b/recipes/libtasn1/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a27809d08ee69 --- /dev/null +++ b/recipes/libtasn1/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,28 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +# Note: See https://github.com/conan-io/conan/issues/12237 +# `NO_CMAKE_PATH` is added to avoid searching in `CMAKE_PREFIX_PATH` +# it should find the correct executable by falling back on the `PATH` +# environment variable defined by Conan during the test_package run. +find_program(ASN1_PARSER NAMES asn1Parser NO_CMAKE_PATH) +if(NOT ASN1_PARSER) + message(FATAL_ERROR "asn1Parser not found") +endif() +find_package(libtasn1 REQUIRED CONFIG) + +set(PKIX_ASN1_TAB_C "${CMAKE_CURRENT_BINARY_DIR}/pkix_asn1_tab.c") +set(PKIX_ASN_IN "${CMAKE_CURRENT_SOURCE_DIR}/../test_package/pkix.asn") +add_custom_command( + COMMAND ${ASN1_PARSER} -o ${PKIX_ASN1_TAB_C} ${PKIX_ASN_IN} + OUTPUT ${PKIX_ASN1_TAB_C} + DEPENDS ${PKIX_ASN_IN} +) +add_custom_target(pkix_asn DEPENDS ${PKIX_ASN1_TAB_C}) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c ${PKIX_ASN1_TAB_C}) +target_link_libraries(${PROJECT_NAME} PRIVATE libtasn1::libtasn1) +add_dependencies(${PROJECT_NAME} pkix_asn) diff --git a/recipes/libtasn1/all/test_v1_package/conanfile.py b/recipes/libtasn1/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4056b294e223c --- /dev/null +++ b/recipes/libtasn1/all/test_v1_package/conanfile.py @@ -0,0 +1,25 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + asn = os.path.join(self.source_folder, os.pardir, "test_package", "pkix.asn") + self.run(f"{bin_path} {asn}", run_environment=True) diff --git a/recipes/libtiff/all/CMakeLists.txt b/recipes/libtiff/all/CMakeLists.txt deleted file mode 100644 index 61147f558a6f9..0000000000000 --- a/recipes/libtiff/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libtiff/all/conandata.yml b/recipes/libtiff/all/conandata.yml index 3cb1bcee90622..ed109970ab657 100644 --- a/recipes/libtiff/all/conandata.yml +++ b/recipes/libtiff/all/conandata.yml @@ -19,20 +19,34 @@ sources: sha256: "59d7a5a8ccd92059913f246877db95a2918e6c04fb9d43fd74e5c3390dac2910" patches: "4.4.0": - - patch_file: "patches/4.4.0-0001-cmake-add-libjpeg-turbo.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.4.0-0001-cmake-dependencies.patch" + patch_description: "CMake: robust handling of dependencies" + patch_type: "conan" "4.3.0": - - patch_file: "patches/4.3.0-0001-cmake-add-libjpeg-turbo.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.3.0-0001-cmake-dependencies.patch" + patch_description: "CMake: robust handling of dependencies" + patch_type: "conan" "4.2.0": - - patch_file: "patches/4.2.0-0001-cmake-add-libjpeg-turbo.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.2.0-0001-cmake-dependencies.patch" + patch_description: "CMake: robust handling of dependencies" + patch_type: "conan" "4.1.0": - - patch_file: "patches/4.1.0-0001-cmake-add-libjpeg-turbo.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.1.0-0001-cmake-dependencies.patch" + patch_description: "CMake: robust handling of dependencies" + patch_type: "conan" + - patch_file: "patches/4.1.0-0002-no-libm-mingw.patch" + patch_source: "https://gitlab.com/libtiff/libtiff/-/merge_requests/73" "4.0.9": - - patch_file: "patches/4.0.8-0001-cmake-add-libjpeg-turbo.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.0.8-0001-cmake-dependencies.patch" + patch_description: "CMake: robust handling of dependencies" + patch_type: "conan" + - patch_file: "patches/4.0.8-0002-no-libm-mingw.patch" + patch_source: "https://gitlab.com/libtiff/libtiff/-/merge_requests/73" "4.0.8": - - patch_file: "patches/4.0.8-0001-cmake-add-libjpeg-turbo.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.0.8-0001-cmake-dependencies.patch" + patch_description: "CMake: robust handling of dependencies" + patch_type: "conan" + - patch_file: "patches/4.0.8-0002-no-libm-mingw.patch" + patch_source: "https://gitlab.com/libtiff/libtiff/-/merge_requests/73" + - patch_file: "patches/4.0.8-0003-file-offsets-bits-mingw.patch" + patch_source: "https://gitlab.com/libtiff/libtiff/-/commit/f2a3b020402943f90957552a884788e70ece6cd7" diff --git a/recipes/libtiff/all/conanfile.py b/recipes/libtiff/all/conanfile.py index 36c2722b0e064..a288f9366d76a 100644 --- a/recipes/libtiff/all/conanfile.py +++ b/recipes/libtiff/all/conanfile.py @@ -1,11 +1,12 @@ -from conan.tools.files import get, rename, rmdir +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.microsoft import is_msvc -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version +from conan.tools.scm import Version import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class LibtiffConan(ConanFile): @@ -21,7 +22,7 @@ class LibtiffConan(ConanFile): "shared": [True, False], "fPIC": [True, False], "lzma": [True, False], - "jpeg": [False, "libjpeg-turbo", "libjpeg"], + "jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], "zlib": [True, False], "libdeflate": [True, False], "zstd": [True, False], @@ -42,17 +43,6 @@ class LibtiffConan(ConanFile): "cxx": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _has_webp_option(self): return Version(self.version) >= "4.0.10" @@ -66,9 +56,7 @@ def _has_libdeflate_option(self): return Version(self.version) >= "4.2.0" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -82,28 +70,33 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.cxx: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.get_safe("libdeflate"): - self.requires("libdeflate/1.12") + self.requires("libdeflate/1.15") if self.options.lzma: self.requires("xz_utils/5.2.5") if self.options.jpeg == "libjpeg": - self.requires("libjpeg/9d") - if self.options.jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.3") + self.requires("libjpeg/9e") + elif self.options.jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + elif self.options.jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") if self.options.jbig: self.requires("jbig/20160605") if self.options.get_safe("zstd"): self.requires("zstd/1.5.2") if self.options.get_safe("webp"): - self.requires("libwebp/1.2.3") + self.requires("libwebp/1.2.4") def validate(self): if self.options.get_safe("libdeflate") and not self.options.zlib: @@ -111,77 +104,52 @@ def validate(self): def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["lzma"] = self.options.lzma + tc.variables["jpeg"] = bool(self.options.jpeg) + tc.variables["jpeg12"] = False + tc.variables["jbig"] = self.options.jbig + tc.variables["zlib"] = self.options.zlib + if self._has_libdeflate_option: + tc.variables["libdeflate"] = self.options.libdeflate + if self._has_zstd_option: + tc.variables["zstd"] = self.options.zstd + if self._has_webp_option: + tc.variables["webp"] = self.options.webp + if Version(self.version) >= "4.3.0": + tc.variables["lerc"] = False # TODO: add lerc support for libtiff versions >= 4.3.0 + tc.variables["cxx"] = self.options.cxx + # BUILD_SHARED_LIBS must be set in command line because defined upstream before project() + tc.cache_variables["BUILD_SHARED_LIBS"] = bool(self.options.shared) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) - # Rename the generated Findjbig.cmake and Findzstd.cmake to avoid case insensitive conflicts with FindJBIG.cmake and FindZSTD.cmake on Windows - if Version(self.version) >= "4.3.0": - if self.options.jbig: - rename(self, "Findjbig.cmake", "ConanFindjbig.cmake") - else: - os.remove(os.path.join(self.build_folder, self._source_subfolder, "cmake", "FindJBIG.cmake")) - if self.options.zstd: - rename(self, "Findzstd.cmake", "ConanFindzstd.cmake") - else: - os.remove(os.path.join(self.build_folder, self._source_subfolder, "cmake", "FindZSTD.cmake")) - - if self.options.shared and is_msvc(self): - # https://github.com/Microsoft/vcpkg/blob/master/ports/tiff/fix-cxx-shared-libs.patch - tools.replace_in_file(os.path.join(self._source_subfolder, "libtiff", "CMakeLists.txt"), - r"set_target_properties(tiffxx PROPERTIES SOVERSION ${SO_COMPATVERSION})", - r"set_target_properties(tiffxx PROPERTIES SOVERSION ${SO_COMPATVERSION} " - r"WINDOWS_EXPORT_ALL_SYMBOLS ON)") - cmakefile = os.path.join(self._source_subfolder, "CMakeLists.txt") - if self.settings.os == "Windows" and not is_msvc(self): - if Version(self.version) < "4.2.0": - tools.replace_in_file(cmakefile, - "find_library(M_LIBRARY m)", - "if (NOT MINGW)\n find_library(M_LIBRARY m)\nendif()") - if Version(self.version) < "4.0.9": - tools.replace_in_file(cmakefile, "if (UNIX)", "if (UNIX OR MINGW)") - tools.replace_in_file(cmakefile, + # Export symbols of tiffxx for msvc shared + replace_in_file(self, os.path.join(self.source_folder, "libtiff", "CMakeLists.txt"), + "set_target_properties(tiffxx PROPERTIES SOVERSION ${SO_COMPATVERSION})", + "set_target_properties(tiffxx PROPERTIES SOVERSION ${SO_COMPATVERSION} WINDOWS_EXPORT_ALL_SYMBOLS ON)") + + # Disable tools, test, contrib, man & html generation + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory(tools)\nadd_subdirectory(test)\nadd_subdirectory(contrib)\nadd_subdirectory(build)\n" "add_subdirectory(man)\nadd_subdirectory(html)", "") - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["lzma"] = self.options.lzma - self._cmake.definitions["jpeg"] = self.options.jpeg != False - self._cmake.definitions["jbig"] = self.options.jbig - self._cmake.definitions["zlib"] = self.options.zlib - if self._has_libdeflate_option: - self._cmake.definitions["libdeflate"] = self.options.libdeflate - if self.options.libdeflate: - if Version(self.version) < "4.3.0": - self._cmake.definitions["DEFLATE_NAMES"] = self.deps_cpp_info["libdeflate"].libs[0] - if self._has_zstd_option: - self._cmake.definitions["zstd"] = self.options.zstd - if self._has_webp_option: - self._cmake.definitions["webp"] = self.options.webp - self._cmake.definitions["cxx"] = self.options.cxx - - # Workaround for cross-build to at least iOS/tvOS/watchOS, - # when dependencies like libdeflate, jbig and zstd are found with find_path() and find_library() - # see https://github.com/conan-io/conan-center-index/issues/6637 - if tools.cross_building(self): - self._cmake.definitions["CMAKE_FIND_ROOT_PATH_MODE_INCLUDE"] = "BOTH" - self._cmake.definitions["CMAKE_FIND_ROOT_PATH_MODE_LIBRARY"] = "BOTH" - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYRIGHT", src=self._source_subfolder, dst="licenses", ignore_case=True, keep_path=False) - cmake = self._configure_cmake() + copy(self, "COPYRIGHT", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), ignore_case=True, keep_path=False) + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) @@ -190,18 +158,34 @@ def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "TIFF") self.cpp_info.set_property("cmake_target_name", "TIFF::TIFF") - self.cpp_info.set_property("pkg_config_name", "libtiff-{}".format(Version(self.version).major)) + self.cpp_info.set_property("pkg_config_name", f"libtiff-{Version(self.version).major}") + suffix = "d" if is_msvc(self) and self.settings.build_type == "Debug" else "" if self.options.cxx: - self.cpp_info.libs.append("tiffxx") - self.cpp_info.libs.append("tiff") - if self.settings.os == "Windows" and self.settings.build_type == "Debug" and is_msvc(self): - self.cpp_info.libs = [lib + "d" for lib in self.cpp_info.libs] - if self.options.shared and self.settings.os == "Windows" and not is_msvc(self): - self.cpp_info.libs = [lib + ".dll" for lib in self.cpp_info.libs] + self.cpp_info.libs.append(f"tiffxx{suffix}") + self.cpp_info.libs.append(f"tiff{suffix}") if self.settings.os in ["Linux", "Android", "FreeBSD", "SunOS", "AIX"]: self.cpp_info.system_libs.append("m") + self.cpp_info.requires = [] + if self.options.zlib: + self.cpp_info.requires.append("zlib::zlib") + if self.options.get_safe("libdeflate"): + self.cpp_info.requires.append("libdeflate::libdeflate") + if self.options.lzma: + self.cpp_info.requires.append("xz_utils::xz_utils") + if self.options.jpeg == "libjpeg": + self.cpp_info.requires.append("libjpeg::libjpeg") + elif self.options.jpeg == "libjpeg-turbo": + self.cpp_info.requires.append("libjpeg-turbo::jpeg") + elif self.options.jpeg == "mozjpeg": + self.cpp_info.requires.append("mozjpeg::libjpeg") + if self.options.jbig: + self.cpp_info.requires.append("jbig::jbig") + if self.options.get_safe("zstd"): + self.cpp_info.requires.append("zstd::zstd") + if self.options.get_safe("webp"): + self.cpp_info.requires.append("libwebp::libwebp") + # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "TIFF" self.cpp_info.names["cmake_find_package_multi"] = "TIFF" - self.cpp_info.names["pkg_config"] = "libtiff-{}".format(Version(self.version).major) diff --git a/recipes/libtiff/all/patches/4.0.8-0001-cmake-add-libjpeg-turbo.patch b/recipes/libtiff/all/patches/4.0.8-0001-cmake-add-libjpeg-turbo.patch deleted file mode 100644 index a8338b086284b..0000000000000 --- a/recipes/libtiff/all/patches/4.0.8-0001-cmake-add-libjpeg-turbo.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -521,14 +521,14 @@ - set(PIXARLOG_SUPPORT TRUE) - endif() - endif() -- - # JPEG - option(jpeg "use libjpeg (required for JPEG compression)" ON) - if (jpeg) - find_package(JPEG) -+ find_package(libjpeg-turbo) - endif() - set(JPEG_SUPPORT FALSE) --if(JPEG_FOUND) -+if(JPEG_FOUND OR libjpeg-turbo_FOUND) - set(JPEG_SUPPORT TRUE) - endif() - -@@ -680,8 +680,8 @@ - if(ZLIB_INCLUDE_DIRS) - list(APPEND TIFF_INCLUDES ${ZLIB_INCLUDE_DIRS}) - endif() --if(JPEG_INCLUDE_DIR) -- list(APPEND TIFF_INCLUDES ${JPEG_INCLUDE_DIR}) -+if(JPEG_INCLUDE_DIR OR libjpeg-turbo_INCLUDE_DIRS) -+ list(APPEND TIFF_INCLUDES ${JPEG_INCLUDE_DIR} ${libjpeg-turbo_INCLUDE_DIRS}) - endif() - if(JPEG12_INCLUDE_DIR) - list(APPEND TIFF_INCLUDES ${JPEG12_INCLUDE_DIR}) -@@ -701,8 +701,8 @@ - if(ZLIB_LIBRARIES) - list(APPEND TIFF_LIBRARY_DEPS ${ZLIB_LIBRARIES}) - endif() --if(JPEG_LIBRARIES) -- list(APPEND TIFF_LIBRARY_DEPS ${JPEG_LIBRARIES}) -+if(JPEG_LIBRARIES OR libjpeg-turbo_LIBRARIES) -+ list(APPEND TIFF_LIBRARY_DEPS ${JPEG_LIBRARIES} ${libjpeg-turbo_LIBRARIES}) - endif() - if(JPEG12_LIBRARIES) - list(APPEND TIFF_LIBRARY_DEPS ${JPEG12_LIBRARIES}) diff --git a/recipes/libtiff/all/patches/4.0.8-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.0.8-0001-cmake-dependencies.patch new file mode 100644 index 0000000000000..7b7979045b5a1 --- /dev/null +++ b/recipes/libtiff/all/patches/4.0.8-0001-cmake-dependencies.patch @@ -0,0 +1,38 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -544,12 +544,10 @@ endif() + option(jbig "use ISO JBIG compression (requires JBIT-KIT library)" ON) + if (jbig) + set(JBIG_FOUND 0) +- find_path(JBIG_INCLUDE_DIR jbig.h) +- set(JBIG_NAMES ${JBIG_NAMES} jbig libjbig) +- find_library(JBIG_LIBRARY NAMES ${JBIG_NAMES}) +- if (JBIG_INCLUDE_DIR AND JBIG_LIBRARY) ++ find_package(jbig REQUIRED CONFIG) ++ if (1) + set(JBIG_FOUND 1) +- set(JBIG_LIBRARIES ${JBIG_LIBRARY}) ++ set(JBIG_LIBRARIES jbig::jbig) + endif() + endif() + set(JBIG_SUPPORT 0) +@@ -564,7 +562,7 @@ set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${JBIG_INCLUDE_DIR}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${JBIG_LIBRARY}) +-check_function_exists(jbg_newlen HAVE_JBG_NEWLEN) ++set(HAVE_JBG_NEWLEN TRUE) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + +@@ -701,8 +699,8 @@ endif() + if(ZLIB_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${ZLIB_LIBRARIES}) + endif() +-if(JPEG_LIBRARIES) +- list(APPEND TIFF_LIBRARY_DEPS ${JPEG_LIBRARIES}) ++if(JPEG_FOUND) ++ list(APPEND TIFF_LIBRARY_DEPS JPEG::JPEG) + endif() + if(JPEG12_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${JPEG12_LIBRARIES}) diff --git a/recipes/libtiff/all/patches/4.0.8-0002-no-libm-mingw.patch b/recipes/libtiff/all/patches/4.0.8-0002-no-libm-mingw.patch new file mode 100644 index 0000000000000..216911511380b --- /dev/null +++ b/recipes/libtiff/all/patches/4.0.8-0002-no-libm-mingw.patch @@ -0,0 +1,13 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -206,7 +206,9 @@ else() + endif() + + # Find libm, if available +-find_library(M_LIBRARY m) ++if (NOT MINGW) ++ find_library(M_LIBRARY m) ++endif() + + check_include_file(assert.h HAVE_ASSERT_H) + check_include_file(dlfcn.h HAVE_DLFCN_H) diff --git a/recipes/libtiff/all/patches/4.0.8-0003-file-offsets-bits-mingw.patch b/recipes/libtiff/all/patches/4.0.8-0003-file-offsets-bits-mingw.patch new file mode 100644 index 0000000000000..44a861121db9c --- /dev/null +++ b/recipes/libtiff/all/patches/4.0.8-0003-file-offsets-bits-mingw.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -469,7 +469,7 @@ report_values(CMAKE_HOST_SYSTEM_PROCESSOR HOST_FILLORDER + HOST_BIG_ENDIAN HAVE_IEEEFP) + + # Large file support +-if (UNIX) ++if (UNIX OR MINGW) + # This might not catch every possibility catered for by + # AC_SYS_LARGEFILE. + add_definitions(-D_FILE_OFFSET_BITS=64) diff --git a/recipes/libtiff/all/patches/4.1.0-0001-cmake-add-libjpeg-turbo.patch b/recipes/libtiff/all/patches/4.1.0-0001-cmake-add-libjpeg-turbo.patch deleted file mode 100644 index e6039391033f1..0000000000000 --- a/recipes/libtiff/all/patches/4.1.0-0001-cmake-add-libjpeg-turbo.patch +++ /dev/null @@ -1,41 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -466,14 +466,14 @@ - set(PIXARLOG_SUPPORT TRUE) - endif() - endif() -- - # JPEG - option(jpeg "use libjpeg (required for JPEG compression)" ON) - if (jpeg) - find_package(JPEG) -+ find_package(libjpeg-turbo) - endif() - set(JPEG_SUPPORT FALSE) --if(JPEG_FOUND) -+if(JPEG_FOUND OR libjpeg-turbo_FOUND) - set(JPEG_SUPPORT TRUE) - endif() - -@@ -654,8 +654,8 @@ - if(ZLIB_INCLUDE_DIRS) - list(APPEND TIFF_INCLUDES ${ZLIB_INCLUDE_DIRS}) - endif() --if(JPEG_INCLUDE_DIR) -- list(APPEND TIFF_INCLUDES ${JPEG_INCLUDE_DIR}) -+if(JPEG_INCLUDE_DIR OR libjpeg-turbo_INCLUDE_DIRS) -+ list(APPEND TIFF_INCLUDES ${JPEG_INCLUDE_DIR} ${libjpeg-turbo_INCLUDE_DIRS}) - endif() - if(JPEG12_INCLUDE_DIR) - list(APPEND TIFF_INCLUDES ${JPEG12_INCLUDE_DIR}) -@@ -681,8 +681,8 @@ - if(ZLIB_LIBRARIES) - list(APPEND TIFF_LIBRARY_DEPS ${ZLIB_LIBRARIES}) - endif() --if(JPEG_LIBRARIES) -- list(APPEND TIFF_LIBRARY_DEPS ${JPEG_LIBRARIES}) -+if(JPEG_LIBRARIES OR libjpeg-turbo_LIBRARIES) -+ list(APPEND TIFF_LIBRARY_DEPS ${JPEG_LIBRARIES} ${libjpeg-turbo_LIBRARIES}) - endif() - if(JPEG12_LIBRARIES) - list(APPEND TIFF_LIBRARY_DEPS ${JPEG12_LIBRARIES}) diff --git a/recipes/libtiff/all/patches/4.1.0-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.1.0-0001-cmake-dependencies.patch new file mode 100644 index 0000000000000..b8a3ec4a4b033 --- /dev/null +++ b/recipes/libtiff/all/patches/4.1.0-0001-cmake-dependencies.patch @@ -0,0 +1,85 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -489,12 +489,10 @@ endif() + option(jbig "use ISO JBIG compression (requires JBIT-KIT library)" ON) + if (jbig) + set(JBIG_FOUND 0) +- find_path(JBIG_INCLUDE_DIR jbig.h) +- set(JBIG_NAMES ${JBIG_NAMES} jbig libjbig) +- find_library(JBIG_LIBRARY NAMES ${JBIG_NAMES}) +- if (JBIG_INCLUDE_DIR AND JBIG_LIBRARY) ++ find_package(jbig REQUIRED CONFIG) ++ if (1) + set(JBIG_FOUND 1) +- set(JBIG_LIBRARIES ${JBIG_LIBRARY}) ++ set(JBIG_LIBRARIES jbig::jbig) + endif() + endif() + set(JBIG_SUPPORT 0) +@@ -507,7 +505,7 @@ endif() + + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${JBIG_INCLUDE_DIR}) +-check_symbol_exists(jbg_newlen "jbig.h" HAVE_JBG_NEWLEN) ++set(HAVE_JBG_NEWLEN TRUE) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + + # liblzma2 +@@ -523,13 +521,11 @@ endif() + # libzstd + option(zstd "use libzstd (required for ZSTD compression)" ON) + if (zstd) +- find_path(ZSTD_INCLUDE_DIR zstd.h) +- find_library(ZSTD_LIBRARY NAMES zstd) +- if (ZSTD_INCLUDE_DIR AND ZSTD_LIBRARY) +- check_library_exists ("${ZSTD_LIBRARY}" ZSTD_decompressStream "" ZSTD_RECENT_ENOUGH) ++ find_package(zstd REQUIRED CONFIG) ++ if (1) ++ set(ZSTD_RECENT_ENOUGH TRUE) + if (ZSTD_RECENT_ENOUGH) + set(ZSTD_FOUND TRUE) +- set(ZSTD_LIBRARIES ${ZSTD_LIBRARY}) + message(STATUS "Found ZSTD library: ${ZSTD_LIBRARY}") + else () + message(WARNING "Found ZSTD library, but not recent enough. Use zstd >= 1.0") +@@ -544,15 +540,13 @@ endif() + # libwebp + option(webp "use libwebp (required for WEBP compression)" ON) + if (webp) +- find_path(WEBP_INCLUDE_DIR /webp/decode.h) +- find_library(WEBP_LIBRARY NAMES webp) ++ find_package(WebP REQUIRED CONFIG) + endif() + set(WEBP_SUPPORT 0) +-set(WEBP_FOUND FALSE) +-if (WEBP_INCLUDE_DIR AND WEBP_LIBRARY) ++if (WebP_FOUND) + set(WEBP_SUPPORT 1) + set(WEBP_FOUND TRUE) +- set(WEBP_LIBRARIES ${WEBP_LIBRARY}) ++ set(WEBP_LIBRARIES WebP::webp) + message(STATUS "Found WEBP library: ${WEBP_LIBRARY}") + endif() + +@@ -681,8 +675,8 @@ endif() + if(ZLIB_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${ZLIB_LIBRARIES}) + endif() +-if(JPEG_LIBRARIES) +- list(APPEND TIFF_LIBRARY_DEPS ${JPEG_LIBRARIES}) ++if(JPEG_FOUND) ++ list(APPEND TIFF_LIBRARY_DEPS JPEG::JPEG) + endif() + if(JPEG12_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${JPEG12_LIBRARIES}) +@@ -693,8 +687,8 @@ endif() + if(LIBLZMA_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${LIBLZMA_LIBRARIES}) + endif() +-if(ZSTD_LIBRARIES) +- list(APPEND TIFF_LIBRARY_DEPS ${ZSTD_LIBRARIES}) ++if(ZSTD_FOUND) ++ list(APPEND TIFF_LIBRARY_DEPS $,zstd::libzstd_shared,zstd::libzstd_static>) + endif() + if(WEBP_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${WEBP_LIBRARIES}) diff --git a/recipes/libtiff/all/patches/4.1.0-0002-no-libm-mingw.patch b/recipes/libtiff/all/patches/4.1.0-0002-no-libm-mingw.patch new file mode 100644 index 0000000000000..0fcf8f5711810 --- /dev/null +++ b/recipes/libtiff/all/patches/4.1.0-0002-no-libm-mingw.patch @@ -0,0 +1,13 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -207,7 +207,9 @@ else() + endif() + + # Find libm, if available +-find_library(M_LIBRARY m) ++if (NOT MINGW) ++ find_library(M_LIBRARY m) ++endif() + + check_include_file(assert.h HAVE_ASSERT_H) + check_include_file(dlfcn.h HAVE_DLFCN_H) diff --git a/recipes/libtiff/all/patches/4.2.0-0001-cmake-add-libjpeg-turbo.patch b/recipes/libtiff/all/patches/4.2.0-0001-cmake-add-libjpeg-turbo.patch deleted file mode 100644 index df3cb8b0e3e8b..0000000000000 --- a/recipes/libtiff/all/patches/4.2.0-0001-cmake-add-libjpeg-turbo.patch +++ /dev/null @@ -1,36 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -499,9 +499,10 @@ endif() - option(jpeg "use libjpeg (required for JPEG compression)" ON) - if (jpeg) - find_package(JPEG) -+ find_package(libjpeg-turbo) - endif() - set(JPEG_SUPPORT FALSE) --if(JPEG_FOUND) -+if(JPEG_FOUND OR libjpeg-turbo_FOUND) - set(JPEG_SUPPORT TRUE) - endif() - -@@ -685,8 +686,8 @@ endif() - if(DEFLATE_INCLUDE_DIR) - list(APPEND TIFF_INCLUDES ${DEFLATE_INCLUDE_DIR}) - endif() --if(JPEG_INCLUDE_DIR) -- list(APPEND TIFF_INCLUDES ${JPEG_INCLUDE_DIR}) -+if(JPEG_INCLUDE_DIR OR libjpeg-turbo_INCLUDE_DIRS) -+ list(APPEND TIFF_INCLUDES ${JPEG_INCLUDE_DIR} ${libjpeg-turbo_INCLUDE_DIRS}) - endif() - if(JPEG12_INCLUDE_DIR) - list(APPEND TIFF_INCLUDES ${JPEG12_INCLUDE_DIR}) -@@ -715,8 +716,8 @@ endif() - if(DEFLATE_LIBRARIES) - list(APPEND TIFF_LIBRARY_DEPS ${DEFLATE_LIBRARIES}) - endif() --if(JPEG_LIBRARIES) -- list(APPEND TIFF_LIBRARY_DEPS ${JPEG_LIBRARIES}) -+if(JPEG_LIBRARIES OR libjpeg-turbo_LIBRARIES) -+ list(APPEND TIFF_LIBRARY_DEPS ${JPEG_LIBRARIES} ${libjpeg-turbo_LIBRARIES}) - endif() - if(JPEG12_LIBRARIES) - list(APPEND TIFF_LIBRARY_DEPS ${JPEG12_LIBRARIES}) diff --git a/recipes/libtiff/all/patches/4.2.0-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.2.0-0001-cmake-dependencies.patch new file mode 100644 index 0000000000000..7b04f533eb0f4 --- /dev/null +++ b/recipes/libtiff/all/patches/4.2.0-0001-cmake-dependencies.patch @@ -0,0 +1,102 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -463,12 +463,10 @@ set(ZIP_SUPPORT ${ZLIB_SUPPORT}) + option(libdeflate "use libdeflate (optional for faster Deflate support, still requires zlib)" ON) + if (libdeflate) + set(DEFLATE_FOUND 0) +- find_path(DEFLATE_INCLUDE_DIR libdeflate.h) +- set(DEFLATE_NAMES ${DEFLATE_NAMES} deflate) +- find_library(DEFLATE_LIBRARY NAMES ${DEFLATE_NAMES}) +- if (DEFLATE_INCLUDE_DIR AND DEFLATE_LIBRARY) ++ find_package(libdeflate REQUIRED CONFIG) ++ if (1) + set(DEFLATE_FOUND 1) +- set(DEFLATE_LIBRARIES ${DEFLATE_LIBRARY}) ++ set(DEFLATE_LIBRARIES $,libdeflate::libdeflate,libdeflate::libdeflate_static>) + endif() + endif() + set(LIBDEFLATE_SUPPORT FALSE) +@@ -517,12 +515,10 @@ endif() + option(jbig "use ISO JBIG compression (requires JBIT-KIT library)" ON) + if (jbig) + set(JBIG_FOUND 0) +- find_path(JBIG_INCLUDE_DIR jbig.h) +- set(JBIG_NAMES ${JBIG_NAMES} jbig libjbig) +- find_library(JBIG_LIBRARY NAMES ${JBIG_NAMES}) +- if (JBIG_INCLUDE_DIR AND JBIG_LIBRARY) ++ find_package(jbig REQUIRED CONFIG) ++ if (1) + set(JBIG_FOUND 1) +- set(JBIG_LIBRARIES ${JBIG_LIBRARY}) ++ set(JBIG_LIBRARIES jbig::jbig) + endif() + endif() + set(JBIG_SUPPORT 0) +@@ -535,7 +531,7 @@ endif() + + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${JBIG_INCLUDE_DIR}) +-check_symbol_exists(jbg_newlen "jbig.h" HAVE_JBG_NEWLEN) ++set(HAVE_JBG_NEWLEN TRUE) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + + # liblzma2 +@@ -551,14 +547,11 @@ endif() + # libzstd + option(zstd "use libzstd (required for ZSTD compression)" ON) + if (zstd) +- find_path(ZSTD_INCLUDE_DIR zstd.h) +- find_library(ZSTD_LIBRARY NAMES zstd) +- if (ZSTD_INCLUDE_DIR AND ZSTD_LIBRARY) +- check_library_exists ("${ZSTD_LIBRARY}" ZSTD_decompressStream "" ZSTD_RECENT_ENOUGH) ++ find_package(zstd REQUIRED CONFIG) ++ if (1) ++ set(ZSTD_RECENT_ENOUGH TRUE) + if (ZSTD_RECENT_ENOUGH) + set(ZSTD_FOUND TRUE) +- set(ZSTD_LIBRARIES ${ZSTD_LIBRARY}) +- message(STATUS "Found ZSTD library: ${ZSTD_LIBRARY}") + else () + message(WARNING "Found ZSTD library, but not recent enough. Use zstd >= 1.0") + endif () +@@ -572,15 +565,13 @@ endif() + # libwebp + option(webp "use libwebp (required for WEBP compression)" ON) + if (webp) +- find_path(WEBP_INCLUDE_DIR /webp/decode.h) +- find_library(WEBP_LIBRARY NAMES webp) ++ find_package(WebP REQUIRED CONFIG) + endif() + set(WEBP_SUPPORT 0) +-set(WEBP_FOUND FALSE) +-if (WEBP_INCLUDE_DIR AND WEBP_LIBRARY) ++if (WebP_FOUND) + set(WEBP_SUPPORT 1) + set(WEBP_FOUND TRUE) +- set(WEBP_LIBRARIES ${WEBP_LIBRARY}) ++ set(WEBP_LIBRARIES WebP::webp) + message(STATUS "Found WEBP library: ${WEBP_LIBRARY}") + endif() + +@@ -715,8 +706,8 @@ endif() + if(DEFLATE_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${DEFLATE_LIBRARIES}) + endif() +-if(JPEG_LIBRARIES) +- list(APPEND TIFF_LIBRARY_DEPS ${JPEG_LIBRARIES}) ++if(JPEG_FOUND) ++ list(APPEND TIFF_LIBRARY_DEPS JPEG::JPEG) + endif() + if(JPEG12_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${JPEG12_LIBRARIES}) +@@ -727,8 +718,8 @@ endif() + if(LIBLZMA_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${LIBLZMA_LIBRARIES}) + endif() +-if(ZSTD_LIBRARIES) +- list(APPEND TIFF_LIBRARY_DEPS ${ZSTD_LIBRARIES}) ++if(ZSTD_FOUND) ++ list(APPEND TIFF_LIBRARY_DEPS $,zstd::libzstd_shared,zstd::libzstd_static>) + endif() + if(WEBP_LIBRARIES) + list(APPEND TIFF_LIBRARY_DEPS ${WEBP_LIBRARIES}) diff --git a/recipes/libtiff/all/patches/4.3.0-0001-cmake-add-libjpeg-turbo.patch b/recipes/libtiff/all/patches/4.3.0-0001-cmake-add-libjpeg-turbo.patch deleted file mode 100644 index 9e17a7c186e33..0000000000000 --- a/recipes/libtiff/all/patches/4.3.0-0001-cmake-add-libjpeg-turbo.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- cmake/FindZSTD.cmake -+++ cmake/FindZSTD.cmake -@@ -1,0 +1,9 @@ -+include("${cmake_wrapper_SOURCE_DIR}/ConanFindzstd.cmake") -+if(NOT TARGET ZSTD::ZSTD) -+ add_library(ZSTD::ZSTD INTERFACE IMPORTED) -+ if(TARGET zstd::libzstd_shared) -+ set_target_properties(ZSTD::ZSTD PROPERTIES INTERFACE_LINK_LIBRARIES zstd::libzstd_shared) -+ else() -+ set_target_properties(ZSTD::ZSTD PROPERTIES INTERFACE_LINK_LIBRARIES zstd::libzstd_static) -+ endif() -+endif() ---- cmake/FindJBIG.cmake -+++ cmake/FindJBIG.cmake -@@ -1,0 +1,5 @@ -+include("${cmake_wrapper_SOURCE_DIR}/ConanFindjbig.cmake") -+if(NOT TARGET JBIG::JBIG) -+ add_library(JBIG::JBIG INTERFACE IMPORTED) -+ set_target_properties(JBIG::JBIG PROPERTIES INTERFACE_LINK_LIBRARIES jbig::jbig) -+endif() ---- cmake/JPEGCodec.cmake -+++ cmake/JPEGCodec.cmake -@@ -24,11 +24,11 @@ --# OF THIS SOFTWARE. -- -- --# JPEG - set(JPEG_SUPPORT FALSE) -+if(DEFINED CONAN_LIBJPEG_ROOT) - find_package(JPEG) -+else() -+find_package(libjpeg-turbo) -+endif() - option(jpeg "use libjpeg (required for JPEG compression)" ${JPEG_FOUND}) --if (jpeg AND JPEG_FOUND) -+if (jpeg AND (JPEG_FOUND OR libjpeg-turbo_FOUND)) - set(JPEG_SUPPORT TRUE) - endif() - ---- libtiff/CMakeLists.txt -+++ libtiff/CMakeLists.txt -@@ -113,7 +113,7 @@ - target_link_libraries(tiff PRIVATE Deflate::Deflate) - endif() - if(JPEG_SUPPORT) -- target_link_libraries(tiff PRIVATE JPEG::JPEG) -+ target_link_libraries(tiff PRIVATE $ $ $) - if(JPEG_DUAL_MODE_8_12) - target_include_directories(tiff PRIVATE ${JPEG12_INCLUDE_DIR}) - target_link_libraries(tiff PRIVATE ${JPEG12_LIBRARIES}) diff --git a/recipes/libtiff/all/patches/4.3.0-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.3.0-0001-cmake-dependencies.patch new file mode 100644 index 0000000000000..497c6171bba32 --- /dev/null +++ b/recipes/libtiff/all/patches/4.3.0-0001-cmake-dependencies.patch @@ -0,0 +1,91 @@ +--- a/cmake/DeflateCodec.cmake ++++ b/cmake/DeflateCodec.cmake +@@ -35,7 +35,10 @@ set(ZIP_SUPPORT ${ZLIB_SUPPORT}) + + # libdeflate + set(LIBDEFLATE_SUPPORT FALSE) +-find_package(Deflate) ++find_package(libdeflate CONFIG) ++if(libdeflate_FOUND) ++ set(Deflate_FOUND TRUE) ++endif() + option(libdeflate "use libdeflate (optional for faster Deflate support, still requires zlib)" ${Deflate_FOUND}) + if (libdeflate AND Deflate_FOUND AND ZIP_SUPPORT) + set(LIBDEFLATE_SUPPORT TRUE) +--- a/cmake/JBIGCodec.cmake ++++ b/cmake/JBIGCodec.cmake +@@ -27,14 +27,17 @@ + # JBIG-KIT + set(JBIG_SUPPORT FALSE) + +-find_package(JBIG) ++find_package(jbig CONFIG) ++if(jbig_FOUND) ++ set(JBIG_FOUND TRUE) ++endif() + + if(JBIG_FOUND) + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${JBIG_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${JBIG_LIBRARIES}) +- check_symbol_exists(jbg_newlen "jbig.h" HAVE_JBG_NEWLEN) ++ set(HAVE_JBG_NEWLEN TRUE) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + endif() +--- a/cmake/ZSTDCodec.cmake ++++ b/cmake/ZSTDCodec.cmake +@@ -28,14 +28,17 @@ + set(ZSTD_SUPPORT FALSE) + set(ZSTD_USABLE FALSE) + +-find_package(ZSTD) ++find_package(zstd CONFIG) ++if(zstd_FOUND) ++ set(ZSTD_FOUND TRUE) ++endif() + + if(ZSTD_FOUND) + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ZSTD_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ZSTD_LIBRARIES}) +- check_symbol_exists(ZSTD_decompressStream "zstd.h" ZSTD_RECENT_ENOUGH) ++ set(ZSTD_RECENT_ENOUGH TRUE) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + +--- a/libtiff/CMakeLists.txt ++++ b/libtiff/CMakeLists.txt +@@ -110,7 +110,7 @@ if(ZIP_SUPPORT) + target_link_libraries(tiff PRIVATE ZLIB::ZLIB) + endif() + if(ZIP_SUPPORT AND LIBDEFLATE_SUPPORT) +- target_link_libraries(tiff PRIVATE Deflate::Deflate) ++ target_link_libraries(tiff PRIVATE $,libdeflate::libdeflate,libdeflate::libdeflate_static>) + endif() + if(JPEG_SUPPORT) + target_link_libraries(tiff PRIVATE JPEG::JPEG) +@@ -120,7 +120,7 @@ if(JPEG_SUPPORT) + endif() + endif() + if(JBIG_SUPPORT) +- target_link_libraries(tiff PRIVATE JBIG::JBIG) ++ target_link_libraries(tiff PRIVATE jbig::jbig) + endif() + if(LERC_SUPPORT) + target_link_libraries(tiff PRIVATE LERC::LERC) +@@ -129,10 +129,10 @@ if(LZMA_SUPPORT) + target_link_libraries(tiff PRIVATE LibLZMA::LibLZMA) + endif() + if(ZSTD_SUPPORT) +- target_link_libraries(tiff PRIVATE ZSTD::ZSTD) ++ target_link_libraries(tiff PRIVATE $,zstd::libzstd_shared,zstd::libzstd_static>) + endif() + if(WEBP_SUPPORT) +- target_link_libraries(tiff PRIVATE WebP::WebP) ++ target_link_libraries(tiff PRIVATE WebP::webp) + endif() + target_link_libraries(tiff PRIVATE CMath::CMath) + diff --git a/recipes/libtiff/all/patches/4.4.0-0001-cmake-add-libjpeg-turbo.patch b/recipes/libtiff/all/patches/4.4.0-0001-cmake-add-libjpeg-turbo.patch deleted file mode 100644 index 6736da2ac6f15..0000000000000 --- a/recipes/libtiff/all/patches/4.4.0-0001-cmake-add-libjpeg-turbo.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- cmake/FindZSTD.cmake -+++ cmake/FindZSTD.cmake -@@ -1,0 +1,9 @@ -+include("${cmake_wrapper_SOURCE_DIR}/ConanFindzstd.cmake") -+if(NOT TARGET ZSTD::ZSTD) -+ add_library(ZSTD::ZSTD INTERFACE IMPORTED) -+ if(TARGET zstd::libzstd_shared) -+ set_target_properties(ZSTD::ZSTD PROPERTIES INTERFACE_LINK_LIBRARIES zstd::libzstd_shared) -+ else() -+ set_target_properties(ZSTD::ZSTD PROPERTIES INTERFACE_LINK_LIBRARIES zstd::libzstd_static) -+ endif() -+endif() ---- cmake/FindJBIG.cmake -+++ cmake/FindJBIG.cmake -@@ -1,0 +1,5 @@ -+include("${cmake_wrapper_SOURCE_DIR}/ConanFindjbig.cmake") -+if(NOT TARGET JBIG::JBIG) -+ add_library(JBIG::JBIG INTERFACE IMPORTED) -+ set_target_properties(JBIG::JBIG PROPERTIES INTERFACE_LINK_LIBRARIES jbig::jbig) -+endif() ---- cmake/JPEGCodec.cmake -+++ cmake/JPEGCodec.cmake -@@ -24,11 +24,11 @@ --# OF THIS SOFTWARE. -- -- --# JPEG - set(JPEG_SUPPORT FALSE) -+if(DEFINED CONAN_LIBJPEG_ROOT) - find_package(JPEG) -+else() -+find_package(libjpeg-turbo) -+endif() - option(jpeg "use libjpeg (required for JPEG compression)" ${JPEG_FOUND}) --if (jpeg AND JPEG_FOUND) -+if (jpeg AND (JPEG_FOUND OR libjpeg-turbo_FOUND)) - set(JPEG_SUPPORT TRUE) - endif() - ---- libtiff/CMakeLists.txt -+++ libtiff/CMakeLists.txt -@@ -118,7 +118,7 @@ - list(APPEND tiff_libs_private_list "${Deflate_LIBRARY}") - endif() - if(JPEG_SUPPORT) -- target_link_libraries(tiff PRIVATE JPEG::JPEG) -+ target_link_libraries(tiff PRIVATE $ $ $) - string(APPEND tiff_requires_private " libjpeg") - if(JPEG_DUAL_MODE_8_12) - target_include_directories(tiff PRIVATE ${JPEG12_INCLUDE_DIR}) diff --git a/recipes/libtiff/all/patches/4.4.0-0001-cmake-dependencies.patch b/recipes/libtiff/all/patches/4.4.0-0001-cmake-dependencies.patch new file mode 100644 index 0000000000000..e2a9148325180 --- /dev/null +++ b/recipes/libtiff/all/patches/4.4.0-0001-cmake-dependencies.patch @@ -0,0 +1,92 @@ +--- a/cmake/DeflateCodec.cmake ++++ b/cmake/DeflateCodec.cmake +@@ -35,7 +35,10 @@ set(ZIP_SUPPORT ${ZLIB_SUPPORT}) + + # libdeflate + set(LIBDEFLATE_SUPPORT FALSE) +-find_package(Deflate) ++find_package(libdeflate CONFIG) ++if(libdeflate_FOUND) ++ set(Deflate_FOUND TRUE) ++endif() + option(libdeflate "use libdeflate (optional for faster Deflate support, still requires zlib)" ${Deflate_FOUND}) + if (libdeflate AND Deflate_FOUND AND ZIP_SUPPORT) + set(LIBDEFLATE_SUPPORT TRUE) +--- a/cmake/JBIGCodec.cmake ++++ b/cmake/JBIGCodec.cmake +@@ -27,14 +27,17 @@ + # JBIG-KIT + set(JBIG_SUPPORT FALSE) + +-find_package(JBIG) ++find_package(jbig CONFIG) ++if(jbig_FOUND) ++ set(JBIG_FOUND TRUE) ++endif() + + if(JBIG_FOUND) + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${JBIG_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${JBIG_LIBRARIES}) +- check_symbol_exists(jbg_newlen "jbig.h" HAVE_JBG_NEWLEN) ++ set(HAVE_JBG_NEWLEN TRUE) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + endif() +--- a/cmake/ZSTDCodec.cmake ++++ b/cmake/ZSTDCodec.cmake +@@ -28,14 +28,17 @@ + set(ZSTD_SUPPORT FALSE) + set(ZSTD_USABLE FALSE) + +-find_package(ZSTD) ++find_package(zstd CONFIG) ++if(zstd_FOUND) ++ set(ZSTD_FOUND TRUE) ++endif() + + if(ZSTD_FOUND) + set(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES}) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES} ${ZSTD_INCLUDE_DIRS}) + set(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${ZSTD_LIBRARIES}) +- check_symbol_exists(ZSTD_decompressStream "zstd.h" ZSTD_RECENT_ENOUGH) ++ set(ZSTD_RECENT_ENOUGH TRUE) + set(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE}) + set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE}) + +--- a/libtiff/CMakeLists.txt ++++ b/libtiff/CMakeLists.txt +@@ -114,7 +114,7 @@ if(ZIP_SUPPORT) + string(APPEND tiff_requires_private " zlib") + endif() + if(ZIP_SUPPORT AND LIBDEFLATE_SUPPORT) +- target_link_libraries(tiff PRIVATE Deflate::Deflate) ++ target_link_libraries(tiff PRIVATE $,libdeflate::libdeflate,libdeflate::libdeflate_static>) + list(APPEND tiff_libs_private_list "${Deflate_LIBRARY}") + endif() + if(JPEG_SUPPORT) +@@ -126,7 +126,7 @@ if(JPEG_SUPPORT) + endif() + endif() + if(JBIG_SUPPORT) +- target_link_libraries(tiff PRIVATE JBIG::JBIG) ++ target_link_libraries(tiff PRIVATE jbig::jbig) + list(APPEND tiff_libs_private_list "${JBIG_LIBRARY}") + endif() + if(LERC_SUPPORT) +@@ -141,11 +141,11 @@ if(LZMA_SUPPORT) + string(APPEND tiff_requires_private " liblzma") + endif() + if(ZSTD_SUPPORT) +- target_link_libraries(tiff PRIVATE ZSTD::ZSTD) ++ target_link_libraries(tiff PRIVATE $,zstd::libzstd_shared,zstd::libzstd_static>) + string(APPEND tiff_requires_private " libzstd") + endif() + if(WEBP_SUPPORT) +- target_link_libraries(tiff PRIVATE WebP::WebP) ++ target_link_libraries(tiff PRIVATE WebP::webp) + string(APPEND tiff_requires_private " libwebp") + endif() + target_link_libraries(tiff PRIVATE CMath::CMath) diff --git a/recipes/libtiff/all/test_package/CMakeLists.txt b/recipes/libtiff/all/test_package/CMakeLists.txt index 5d81acd120205..cd389da928806 100644 --- a/recipes/libtiff/all/test_package/CMakeLists.txt +++ b/recipes/libtiff/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(TIFF REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} TIFF::TIFF) +target_link_libraries(${PROJECT_NAME} PRIVATE TIFF::TIFF) diff --git a/recipes/libtiff/all/test_package/conanfile.py b/recipes/libtiff/all/test_package/conanfile.py index 3da371b660e0a..0a6bc68712d90 100644 --- a/recipes/libtiff/all/test_package/conanfile.py +++ b/recipes/libtiff/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libtiff/all/test_v1_package/CMakeLists.txt b/recipes/libtiff/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libtiff/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libtiff/all/test_v1_package/conanfile.py b/recipes/libtiff/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/libtiff/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libtool/all/conandata.yml b/recipes/libtool/all/conandata.yml index 6ebc362b36f40..fb9d7cad360c8 100644 --- a/recipes/libtool/all/conandata.yml +++ b/recipes/libtool/all/conandata.yml @@ -7,10 +7,13 @@ sources: sha256: "e3bd4d5d3d025a36c21dd6af7ea818a2afcd4dfc1ea5a17b39d7854bcd0c06e3" patches: "2.4.7": - - base_path: "source_subfolder" - patch_file: "patches/2.4.7-0001-libtool-relocatable.patch" + - patch_file: "patches/2.4.7-0001-libtool-relocatable.patch" + patch_description: "Make libtool relocatable" + patch_type: "portability" "2.4.6": - - base_path: "source_subfolder" - patch_file: "patches/2.4.6-0001-libtool-relocatable.patch" - - base_path: "source_subfolder" - patch_file: "patches/2.4.6-0002-libtool-fix-type-libtool.patch" + - patch_file: "patches/2.4.6-0001-libtool-relocatable.patch" + patch_description: "Make libtool relocatable" + patch_type: "portability" + - patch_file: "patches/2.4.6-0002-libtool-fix-type-libtool.patch" + patch_description: "Fix type libtool" + patch_type: "portability" diff --git a/recipes/libtool/all/conanfile.py b/recipes/libtool/all/conanfile.py index f7fc46aed1514..6f90b31da6ebc 100644 --- a/recipes/libtool/all/conanfile.py +++ b/recipes/libtool/all/conanfile.py @@ -1,21 +1,28 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanException -from contextlib import contextmanager +from conan import ConanFile +from conan.errors import ConanException +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +from conan.tools.env import Environment +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rename, replace_in_file, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path_package_info_legacy + import os import re import shutil -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.57.0" class LibtoolConan(ConanFile): name = "libtool" + # most common use is as "application", but library traits + # are a superset of application so this should cover all cases + package_type = "library" url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.gnu.org/software/libtool/" description = "GNU libtool is a generic library support script. " - topics = ("conan", "libtool", "configure", "library", "shared", "static") + topics = ("configure", "library", "shared", "static") license = ("GPL-2.0-or-later", "GPL-3.0-or-later") - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,16 +33,8 @@ class LibtoolConan(ConanFile): "fPIC": True, } - exports_sources = "patches/**" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,89 +42,104 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("automake/1.16.5") + #TODO: consider adding m4 as direct dependency, perhaps when we start using version ranges. + # https://github.com/conan-io/conan-center-index/pull/16248#discussion_r1116332095 + #self.requires("m4/1.4.19") + @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def build_requirements(self): if hasattr(self, "settings_build"): - self.build_requires("automake/1.16.5") - self.build_requires("gnu-config/cci.20210814") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("automake/1.16.5") + self.tool_requires("m4/1.4.19") # Needed by configure + + self.tool_requires("gnu-config/cci.20210814") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextmanager - def _build_context(self): - with tools.run_environment(self): - with tools.environment_append(self._libtool_relocatable_env): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - with tools.environment_append({"CC": "cl -nologo", "CXX": "cl -nologo",}): - yield - else: - yield + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) @property def _datarootdir(self): return os.path.join(self.package_folder, "res") - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) >= "12": - self._autotools.flags.append("-FS") - conf_args = [ - "--datarootdir={}".format(tools.unix_path(self._datarootdir)), - "--prefix={}".format(tools.unix_path(self.package_folder)), + def generate(self): + if is_msvc(self): + # __VSCMD_ARG_NO_LOGO: this test_package has too many invocations, + # this avoids printing the logo everywhere + # VSCMD_SKIP_SENDTELEMETRY: avoid the telemetry process holding onto the directory + # unnecessarily + env = Environment() + env.define("__VSCMD_ARG_NO_LOGO", "1") + env.define("VSCMD_SKIP_SENDTELEMETRY", "1") + env.vars(self, scope="build").save_script("conanbuild_vcvars_options.bat") + + tc = AutotoolsToolchain(self) + + if is_msvc(self) and check_min_vs(self, "180", raise_invalid=False): + tc.extra_cflags.append("-FS") + + tc.configure_args.extend([ + "--datarootdir=${prefix}/res", "--enable-shared", "--enable-static", "--enable-ltdl-install", - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + ]) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + env = tc.environment() + if is_msvc(self): + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + + # Disable Fortran detection to handle issue with VS 2022 + # See: https://savannah.gnu.org/patch/?9313#comment1 + # In the future this could be removed if a new version fixes this + # upstream + env.define("F77", "no") + env.define("FC", "no") + tc.generate(env) def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "build-aux", "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "build-aux", "config.guess")) + apply_conandata_patches(self) + config_guess = self.dependencies.build["gnu-config"].conf_info.get("user.gnu-config:config_guess") + config_sub = self.dependencies.build["gnu-config"].conf_info.get("user.gnu-config:config_sub") + shutil.copy(config_sub, os.path.join(self.source_folder, "build-aux", "config.sub")) + shutil.copy(config_guess, os.path.join(self.source_folder, "build-aux", "config.guess")) def build(self): self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + autotools = Autotools(self) + autotools.configure() + autotools.make() @property def _shared_ext(self): if self.settings.os == "Windows": return "dll" - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): return "dylib" else: return "so" @property def _static_ext(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): return "lib" else: return "a" @@ -136,22 +150,22 @@ def _rm_binlib_files_containing(self, ext_inclusive, ext_exclusive=None): regex_out = re.compile(r".*\.({})($|\..*)".format(ext_exclusive)) else: regex_out = re.compile("^$") - for dir in ( + for directory in ( os.path.join(self.package_folder, "bin"), os.path.join(self.package_folder, "lib"), ): - for file in os.listdir(dir): + for file in os.listdir(directory): if regex_in.match(file) and not regex_out.match(file): - os.unlink(os.path.join(dir, file)) + os.unlink(os.path.join(directory, file)) def package(self): - self.copy("COPYING*", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + fix_apple_shared_install_name(self) - tools.rmdir(os.path.join(self._datarootdir, "info")) - tools.rmdir(os.path.join(self._datarootdir, "man")) + rmdir(self, os.path.join(self._datarootdir, "info")) + rmdir(self, os.path.join(self._datarootdir, "man")) os.unlink(os.path.join(self.package_folder, "lib", "libltdl.la")) if self.options.shared: @@ -159,7 +173,6 @@ def package(self): else: self._rm_binlib_files_containing(self._shared_ext) - import re files = ( os.path.join(self.package_folder, "bin", "libtool"), os.path.join(self.package_folder, "bin", "libtoolize"), @@ -181,35 +194,25 @@ def package(self): binpath = os.path.join(self.package_folder, "bin") if self.settings.os == "Windows": - tools.rename(os.path.join(binpath, "libtoolize"), + rename(self, os.path.join(binpath, "libtoolize"), os.path.join(binpath, "libtoolize.exe")) - tools.rename(os.path.join(binpath, "libtool"), + rename(self, os.path.join(binpath, "libtool"), os.path.join(binpath, "libtool.exe")) - if self.settings.compiler == "Visual Studio" and self.options.shared: - tools.rename(os.path.join(self.package_folder, "lib", "ltdl.dll.lib"), + if is_msvc(self) and self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "ltdl.dll.lib"), os.path.join(self.package_folder, "lib", "ltdl.lib")) # allow libtool to link static libs into shared for more platforms libtool_m4 = os.path.join(self._datarootdir, "aclocal", "libtool.m4") method_pass_all = "lt_cv_deplibs_check_method=pass_all" - tools.replace_in_file(libtool_m4, + replace_in_file(self, libtool_m4, "lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'", method_pass_all) - tools.replace_in_file(libtool_m4, + replace_in_file(self, libtool_m4, "lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'", method_pass_all) - @property - def _libtool_relocatable_env(self): - return { - "LIBTOOL_PREFIX": tools.unix_path(self.package_folder), - "LIBTOOL_DATADIR": tools.unix_path(self._datarootdir), - "LIBTOOL_PKGAUXDIR": tools.unix_path(os.path.join(self._datarootdir, "libtool", "build-aux")), - "LIBTOOL_PKGLTDLDIR": tools.unix_path(os.path.join(self._datarootdir, "libtool")), - "LIBTOOL_ACLOCALDIR": tools.unix_path(os.path.join(self._datarootdir, "aclocal")), - } - def package_info(self): self.cpp_info.libs = ["ltdl"] @@ -220,22 +223,19 @@ def package_info(self): if self.settings.os == "Linux": self.cpp_info.system_libs = ["dl"] + # Define environment variables such that libtool m4 files are seen by Automake + libtool_aclocal_dir = os.path.join(self._datarootdir, "aclocal") + + self.buildenv_info.append_path("ACLOCAL_PATH", libtool_aclocal_dir) + self.buildenv_info.append_path("AUTOMAKE_CONAN_INCLUDES", libtool_aclocal_dir) + self.runenv_info.append_path("ACLOCAL_PATH", libtool_aclocal_dir) + self.runenv_info.append_path("AUTOMAKE_CONAN_INCLUDES", libtool_aclocal_dir) + + # For Conan 1.x downstream consumers, can be removed once recipe is Conan 1.x only: bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env: {}".format(bin_path)) + self.output.info(f"Appending PATH env: bin_path{bin_path}") self.env_info.PATH.append(bin_path) - bin_ext = ".exe" if self.settings.os == "Windows" else "" - - libtoolize = tools.unix_path(os.path.join(self.package_folder, "bin", "libtoolize" + bin_ext)) - self.output.info("Setting LIBTOOLIZE env to {}".format(libtoolize)) - self.env_info.LIBTOOLIZE = libtoolize - - for key, value in self._libtool_relocatable_env.items(): - self.output.info("Setting {} environment variable to {}".format(key, value)) - setattr(self.env_info, key, value) + self.env_info.ACLOCAL_PATH.append(unix_path_package_info_legacy(self, libtool_aclocal_dir)) + self.env_info.AUTOMAKE_CONAN_INCLUDES.append(unix_path_package_info_legacy(self, libtool_aclocal_dir)) - libtool_aclocal = tools.unix_path(os.path.join(self._datarootdir, "aclocal")) - self.output.info("Appending ACLOCAL_PATH env: {}".format(libtool_aclocal)) - self.env_info.ACLOCAL_PATH.append(libtool_aclocal) - self.output.info("Appending AUTOMAKE_CONAN_INCLUDES environment variable: {}".format(libtool_aclocal)) - self.env_info.AUTOMAKE_CONAN_INCLUDES.append(libtool_aclocal) diff --git a/recipes/libtool/all/patches/2.4.6-0001-libtool-relocatable.patch b/recipes/libtool/all/patches/2.4.6-0001-libtool-relocatable.patch index 47bed6ae408e3..de3326ea712b7 100644 --- a/recipes/libtool/all/patches/2.4.6-0001-libtool-relocatable.patch +++ b/recipes/libtool/all/patches/2.4.6-0001-libtool-relocatable.patch @@ -1,28 +1,8 @@ -- Do not embed build-machine specific paths in the generated sources. -- Do not regenerate manuals (help2man might not be available on build system) - ---- libtoolize.in -+++ libtoolize.in -@@ -1901,11 +1901,11 @@ - pkgmacro_files="@pkgmacro_files@" - - # Locations for important files: -- prefix="@prefix@" -- datadir="@datadir@" -- pkgauxdir="@pkgauxdir@" -- pkgltdldir="@pkgdatadir@" -- aclocaldir="@aclocaldir@" -+ prefix="$LIBTOOL_PREFIX" -+ datadir="$LIBTOOL_DATADIR" -+ pkgauxdir="$LIBTOOL_PKGAUXDIR" -+ pkgltdldir="$LIBTOOL_PKGLTDLDIR" -+ aclocaldir="$LIBTOOL_ACLOCALDIR" - - # Allow the user to override the master libtoolize repository: - if test -n "$_lt_pkgdatadir"; then ---- Makefile.in -+++ Makefile.in -@@ -2324,10 +2324,10 @@ +diff --git a/Makefile.in b/Makefile.in +index 178bdec..6f1062c 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -2324,10 +2324,10 @@ $(notes_txt): $(notes_texi) # files created in the build tree, so instead we regenerate the # manual pages if the sources for the build-tree files we want to # run have changed. @@ -34,6 +14,28 @@ +# $(AM_V_GEN)$(update_mans) --help-option=--help-all libtool +#$(libtoolize_1): $(libtoolize_in) +# $(AM_V_GEN)$(update_mans) libtoolize - + install-data-local: $(lt_Makefile_in) install-scripts-local @$(NORMAL_INSTALL) +diff --git a/libtoolize.in b/libtoolize.in +index 798bd0a..bdd3d88 100644 +--- a/libtoolize.in ++++ b/libtoolize.in +@@ -1901,11 +1901,12 @@ func_require_seen_libtool () + pkgmacro_files="@pkgmacro_files@" + + # Locations for important files: +- prefix="@prefix@" +- datadir="@datadir@" +- pkgauxdir="@pkgauxdir@" +- pkgltdldir="@pkgdatadir@" +- aclocaldir="@aclocaldir@" ++ scriptdir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) ++ prefix="$scriptdir/.." ++ datadir="$scriptdir/../res" ++ pkgauxdir="$scriptdir/../res/libtool/build-aux" ++ pkgltdldir="$scriptdir/../res/libtool" ++ aclocaldir="$scriptdir/../res/aclocal" + + # Allow the user to override the master libtoolize repository: + if test -n "$_lt_pkgdatadir"; then diff --git a/recipes/libtool/all/patches/2.4.7-0001-libtool-relocatable.patch b/recipes/libtool/all/patches/2.4.7-0001-libtool-relocatable.patch index 09ace4c665841..0d9cf8555840b 100644 --- a/recipes/libtool/all/patches/2.4.7-0001-libtool-relocatable.patch +++ b/recipes/libtool/all/patches/2.4.7-0001-libtool-relocatable.patch @@ -1,28 +1,8 @@ -- Do not embed build-machine specific paths in the generated sources. -- Do not regenerate manuals (help2man might not be available on build system) - ---- libtoolize.in -+++ libtoolize.in -@@ -1903,11 +1903,11 @@ - pkgmacro_files="@pkgmacro_files@" - - # Locations for important files: -- prefix="@prefix@" -- datadir="@datadir@" -- pkgauxdir="@pkgauxdir@" -- pkgltdldir="@pkgdatadir@" -- aclocaldir="@aclocaldir@" -+ prefix="$LIBTOOL_PREFIX" -+ datadir="$LIBTOOL_DATADIR" -+ pkgauxdir="$LIBTOOL_PKGAUXDIR" -+ pkgltdldir="$LIBTOOL_PKGLTDLDIR" -+ aclocaldir="$LIBTOOL_ACLOCALDIR" - - # Allow the user to override the master libtoolize repository: - if test -n "$_lt_pkgdatadir"; then ---- Makefile.in -+++ Makefile.in -@@ -2423,10 +2423,10 @@ +diff --git a/Makefile.in b/Makefile.in +index 29db7be..3046cdf 100644 +--- a/Makefile.in ++++ b/Makefile.in +@@ -2423,10 +2423,10 @@ $(notes_txt): $(notes_texi) # files created in the build tree, so instead we regenerate the # manual pages if the sources for the build-tree files we want to # run have changed. @@ -34,6 +14,28 @@ +# $(AM_V_GEN)$(update_mans) --help-option=--help-all libtool +#$(libtoolize_1): $(libtoolize_in) +# $(AM_V_GEN)$(update_mans) libtoolize - + install-data-local: $(lt_Makefile_in) install-scripts-local @$(NORMAL_INSTALL) +diff --git a/libtoolize.in b/libtoolize.in +index 0c40fed..e82e467 100644 +--- a/libtoolize.in ++++ b/libtoolize.in +@@ -1903,11 +1903,12 @@ func_require_seen_libtool () + pkgmacro_files="@pkgmacro_files@" + + # Locations for important files: +- prefix="@prefix@" +- datadir="@datadir@" +- pkgauxdir="@pkgauxdir@" +- pkgltdldir="@pkgdatadir@" +- aclocaldir="@aclocaldir@" ++ scriptdir=$(CDPATH= cd -- "$(dirname -- "$0")" && pwd) ++ prefix="$scriptdir/.." ++ datadir="$scriptdir/../res" ++ pkgauxdir="$scriptdir/../res/libtool/build-aux" ++ pkgltdldir="$scriptdir/../res/libtool" ++ aclocaldir="$scriptdir/../res/aclocal" + + # Allow the user to override the master libtoolize repository: + if test -n "$_lt_pkgdatadir"; then diff --git a/recipes/libtool/all/test_package/autotools/Makefile.am b/recipes/libtool/all/test_package/autotools/Makefile.am index c4dd96b26fbd7..aae3d3042e762 100644 --- a/recipes/libtool/all/test_package/autotools/Makefile.am +++ b/recipes/libtool/all/test_package/autotools/Makefile.am @@ -10,4 +10,4 @@ libtestlib_la_SOURCES = lib.c libtestlib_la_LDFLAGS = -no-undefined -export-symbols "$(srcdir)/libtestlib.sym" include_HEADERS = lib.h -ACLOCAL_AMFLAGS = -I m4 +# ACLOCAL_AMFLAGS = -I m4 diff --git a/recipes/libtool/all/test_package/autotools/configure.ac b/recipes/libtool/all/test_package/autotools/configure.ac index 172fe48d25b7a..e56278b3ae822 100644 --- a/recipes/libtool/all/test_package/autotools/configure.ac +++ b/recipes/libtool/all/test_package/autotools/configure.ac @@ -11,7 +11,7 @@ AC_CONFIG_SRCDIR([test_package.c]) # Store the auxiliary build tools (e.g., install-sh, config.sub, config.guess) # in this dir (build-aux) AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIRS([m4]) +# AC_CONFIG_MACRO_DIRS([m4]) # Init automake, and specify this program use relaxed structures. # i.e. this program doesn't follow the gnu coding standards, and doesn't have @@ -25,7 +25,7 @@ AC_PROG_CXX # Check for archiver AM_PROG_AR -LT_PREREQ([2.4]) +LT_PREREQ([2.4.6]) LT_INIT([win32-dll]) AC_SEARCH_LIBS([sqrt], [m]) diff --git a/recipes/libtool/all/test_package/conanfile.py b/recipes/libtool/all/test_package/conanfile.py index f71788ff49054..fa6b79d0ca968 100644 --- a/recipes/libtool/all/test_package/conanfile.py +++ b/recipes/libtool/all/test_package/conanfile.py @@ -1,5 +1,13 @@ -from conans import AutoToolsBuildEnvironment, CMake, ConanFile, tools -from contextlib import contextmanager +from conan import ConanFile +from conan.tools.build import cross_building, can_run +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import chdir, mkdir, rmdir +from conan.tools.cmake import CMakeToolchain, CMakeDeps, CMake +from conan.tools.layout import basic_layout +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.apple import is_apple_os + import glob import os import shutil @@ -7,145 +15,185 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" test_type = "explicit" short_paths = True + win_bash = True # This assignment must be *here* to avoid "Cannot wrap command with different envs." in Conan 1.x @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def layout(self): + basic_layout(self) + def requirements(self): - self.requires(self.tested_reference_str) + self.requires(self.tested_reference_str) # Since we are testing libltdl as well def build_requirements(self): - self.build_requires(self.tested_reference_str) - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - - @contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - with tools.environment_append({ - "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)), - "LD": "link", - }): - yield - else: - yield + if hasattr(self, "settings_build") and not cross_building(self): + self.tool_requires(self.tested_reference_str) # We are testing libtool/libtoolize + + self.tool_requires("autoconf/2.71") + self.tool_requires("automake/1.16.5") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") @property - def _package_folder(self): - return os.path.join(self.build_folder, "package") + def autotools_package_folder(self): + return os.path.join(self.build_folder, "pkg_autotools") + + @property + def sis_package_folder(self): + return os.path.join(self.build_folder, "pkg_sis") + + def generate(self): + if is_msvc(self): + # __VSCMD_ARG_NO_LOGO: this test_package has too many invocations, + # this avoids printing the logo everywhere + # VSCMD_SKIP_SENDTELEMETRY: avoid the telemetry process holding onto the directory + # unnecessarily + env = Environment() + env.define("__VSCMD_ARG_NO_LOGO", "1") + env.define("VSCMD_SKIP_SENDTELEMETRY", "1") + env.vars(self, scope="build").save_script("conanbuild_vcvars_options.bat") + + # Use two instances of AutotoolsToolchain with namespaceas, + # as we have two different projects with different settings. + ar_wrapper = unix_path(self, self.conf.get("user.automake:lib-wrapper", check_type=str)) + msvc_vars = { + "CC": "cl -nologo", + "CXX": "cl -nologo", + "AR": f"{ar_wrapper} lib", + "LD": "link" + } + + # "Autotools" subfolder: project to test integration of Autotools with libtool + # at build time + tc = AutotoolsToolchain(self, namespace="autotools") + env = tc.environment() + if is_msvc(self): + for key, value in msvc_vars.items(): + env.append(key, value) + tc.generate(env) + + # "sis" subfder: project to test building shared library using libtool + # while linking to a static library + tc = AutotoolsToolchain(self, namespace="sis") + tc.configure_args.extend(["--enable-shared", "--disable-static"]) + lib_folder = unix_path(self, os.path.join(self.sis_package_folder, "lib")) + tc.extra_ldflags.append(f"-L{lib_folder}") + env = tc.environment() + if is_msvc(self): + for key, value in msvc_vars.items(): + env.append(key, value) + tc.generate(env) + + # Note: Using AutotoolsDeps causes errors on Windows when configure tries to determine compiler + # because injected values for environment variables CPPFLAGS and LDFLAGS that are not + # interpreted correctly + if is_msvc(self): + # Use NMake to workaround bug in MSBuild versions prior to 2022 that shows up as: + # error MSB6001: Invalid command line switch for "cmd.exe". System.ArgumentException: Item + # has already been added. Key in dictionary: 'tmp' Key being added: 'TMP' + self.conf.define("tools.cmake.cmaketoolchain:generator", "NMake Makefiles") + tc = CMakeToolchain(self) + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + buildenv = VirtualBuildEnv(self) + buildenv.generate() + + env = Environment() + for var in ["DYLD_LIBRARY_PATH", "LD_LIBRARY_PATH"]: + env.append_path(var, os.path.join(self.autotools_package_folder, "lib")) + env.vars(self, scope="run").save_script("conanrun_libtool_testpackage") + + runenv = VirtualRunEnv(self) + runenv.generate() + def _build_autotools(self): """ Test autotools integration """ # Copy autotools directory to build folder - shutil.copytree(os.path.join(self.source_folder, "autotools"), os.path.join(self.build_folder, "autotools")) - with tools.chdir("autotools"): - self.run("{} --install --verbose -Wall".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows) - - tools.mkdir(self._package_folder) - conf_args = [ - "--prefix={}".format(tools.unix_path(self._package_folder)), - "--enable-shared", "--enable-static", - ] - - os.mkdir("bin_autotools") - with tools.chdir("bin_autotools"): - with self._build_context(): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - autotools.configure(args=conf_args, configure_dir=os.path.join(self.build_folder, "autotools")) - autotools.make(args=["V=1"]) - autotools.install() + autotools_build_folder = os.path.join(self.build_folder, "autotools") + rmdir(self, autotools_build_folder) + shutil.copytree(os.path.join(self.source_folder, "autotools"), autotools_build_folder) + with chdir(self, "autotools"): + self.run("autoreconf --install --verbose --force -Wall") + + mkdir(self, self.autotools_package_folder) + with chdir(self, autotools_build_folder): + autotools = Autotools(self, namespace="autotools") + autotools.configure(build_script_folder=autotools_build_folder) + autotools.make(args=["V=1"]) + autotools.install(args=[f'DESTDIR={unix_path(self, self.autotools_package_folder)}']) def _test_autotools(self): - assert os.path.isdir(os.path.join(self._package_folder, "bin")) - assert os.path.isfile(os.path.join(self._package_folder, "include", "lib.h")) - assert os.path.isdir(os.path.join(self._package_folder, "lib")) + assert os.path.isdir(os.path.join(self.autotools_package_folder, "bin")) + assert os.path.isfile(os.path.join(self.autotools_package_folder, "include", "lib.h")) + assert os.path.isdir(os.path.join(self.autotools_package_folder, "lib")) - if not tools.cross_building(self): - self.run(os.path.join(self._package_folder, "bin", "test_package"), run_environment=True) + if can_run(self): + self.run(f'{unix_path(self, os.path.join(self.autotools_package_folder, "bin", "test_package"))}', env="conanrun") def _build_ltdl(self): """ Build library using ltdl library """ cmake = CMake(self) - cmake.configure(source_folder="ltdl") + cmake.configure(build_script_folder="ltdl") cmake.build() def _test_ltdl(self): """ Test library using ltdl library""" - lib_suffix = { - "Linux": "so", - "FreeBSD": "so", - "Macos": "dylib", - "Windows": "dll", - }[str(self.settings.os)] - - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - libdir = "bin" if self.settings.os == "Windows" else "lib" - lib_path = os.path.join(libdir, "liba.{}".format(lib_suffix)) - self.run("{} {}".format(bin_path, lib_path), run_environment=True) + lib_prefix = "lib" if self.settings.os != "Windows" else "" + lib_extension = "dll" if self.settings.os == "Windows" else "so" + + if can_run(self): + bin_executable = unix_path(self, os.path.join(self.cpp.build.bindirs[0], "test_package")) + lib_path = unix_path(self, os.path.join(self.cpp.build.libdirs[0], f'{lib_prefix}liba.{lib_extension}')) + self.run(f'{bin_executable} {lib_path}', env="conanrun") def _build_static_lib_in_shared(self): """ Build shared library using libtool (while linking to a static library) """ # Copy static-in-shared directory to build folder - autotools_folder = os.path.join(self.build_folder, "sis") - shutil.copytree(os.path.join(self.source_folder, "sis"), autotools_folder) - - install_prefix = os.path.join(autotools_folder, "prefix") + autotools_sis_folder = os.path.join(self.build_folder, "sis") + rmdir(self, autotools_sis_folder) + shutil.copytree(os.path.join(self.source_folder, "sis"), autotools_sis_folder) - # Build static library using CMake + # Build static library using CMake and install into a folder inside the build folder cmake = CMake(self) - cmake.definitions["CMAKE_INSTALL_PREFIX"] = install_prefix - cmake.configure(source_folder=autotools_folder, build_folder=os.path.join(autotools_folder, "cmake_build")) - cmake.build() - cmake.install() + cmake.configure(build_script_folder="ltdl") + cmake.build(target="static_lib") + install_prefix = unix_path(self, self.sis_package_folder) + self.run(f"cmake --install . --config {self.settings.build_type} --prefix {install_prefix} --component static_lib") - # Copy autotools directory to build folder - with tools.chdir(autotools_folder): - self.run("{} -ifv -Wall".format(os.environ["AUTORECONF"]), win_bash=tools.os_info.is_windows) - - with tools.chdir(autotools_folder): - conf_args = [ - "--enable-shared", - "--disable-static", - "--prefix={}".format(tools.unix_path(os.path.join(install_prefix))), - ] - with self._build_context(): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - autotools.link_flags.append("-L{}".format(tools.unix_path(os.path.join(install_prefix, "lib")))) - autotools.configure(args=conf_args, configure_dir=autotools_folder) - autotools.make(args=["V=1"]) - autotools.install() + with chdir(self, autotools_sis_folder): + self.run("autoreconf --install --verbose --force -Wall") + autotools = Autotools(self, namespace="sis") + autotools.configure(build_script_folder=autotools_sis_folder) + autotools.install(args=[f"DESTDIR={unix_path(self, self.sis_package_folder)}"]) def _test_static_lib_in_shared(self): """ Test existence of shared library """ - install_prefix = os.path.join(self.build_folder, "sis", "prefix") - - with tools.chdir(install_prefix): + with chdir(self, self.sis_package_folder): if self.settings.os == "Windows": assert len(list(glob.glob(os.path.join("bin", "*.dll")))) > 0 - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): assert len(list(glob.glob(os.path.join("lib", "*.dylib")))) > 0 else: assert len(list(glob.glob(os.path.join("lib", "*.so")))) > 0 def build(self): self._build_ltdl() - if not tools.cross_building(self): + if not cross_building(self): self._build_autotools() self._build_static_lib_in_shared() def test(self): - self._test_ltdl() - if not tools.cross_building(self): + if can_run(self): + self._test_ltdl() self._test_autotools() self._test_static_lib_in_shared() diff --git a/recipes/libtool/all/test_package/ltdl/CMakeLists.txt b/recipes/libtool/all/test_package/ltdl/CMakeLists.txt index 7fc6140320af7..e15a97d31d1b2 100644 --- a/recipes/libtool/all/test_package/ltdl/CMakeLists.txt +++ b/recipes/libtool/all/test_package/ltdl/CMakeLists.txt @@ -1,20 +1,27 @@ cmake_minimum_required(VERSION 2.8.12) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libtool REQUIRED CONFIG) include(GenerateExportHeader) -add_library(liba SHARED liba.c) +add_library(liba MODULE liba.c) generate_export_header(liba) target_include_directories(liba PUBLIC $ ) -set_property(TARGET liba PROPERTY PREFIX "") add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -target_include_directories(test_package - PUBLIC "$" +target_link_libraries(${PROJECT_NAME} PRIVATE libtool::libtool) + +add_library(static_lib STATIC + static_lib.c ) + +install(TARGETS static_lib + LIBRARY + DESTINATION lib + COMPONENT static_lib + ARCHIVE + DESTINATION lib + COMPONENT static_lib) diff --git a/recipes/libtool/all/test_package/sis/static_lib.c b/recipes/libtool/all/test_package/ltdl/static_lib.c similarity index 100% rename from recipes/libtool/all/test_package/sis/static_lib.c rename to recipes/libtool/all/test_package/ltdl/static_lib.c diff --git a/recipes/libtool/all/test_package/sis/Makefile.am b/recipes/libtool/all/test_package/sis/Makefile.am index 7ec6984fe8e35..824106cabe1d8 100644 --- a/recipes/libtool/all/test_package/sis/Makefile.am +++ b/recipes/libtool/all/test_package/sis/Makefile.am @@ -5,4 +5,4 @@ lib_LTLIBRARIES = libshared.la libshared_la_SOURCES = shared_lib.c libshared_la_LDFLAGS = -no-undefined -lstatic_lib -ACLOCAL_AMFLAGS = -I m4 +# ACLOCAL_AMFLAGS = -I m4 diff --git a/recipes/libtool/all/test_package/sis/configure.ac b/recipes/libtool/all/test_package/sis/configure.ac index 657024d82aa36..0272fc8f862a2 100644 --- a/recipes/libtool/all/test_package/sis/configure.ac +++ b/recipes/libtool/all/test_package/sis/configure.ac @@ -2,7 +2,7 @@ AC_PREREQ(2.69) AC_INIT([test_package], [1.0]) AC_CONFIG_SRCDIR([shared_lib.c]) AC_CONFIG_AUX_DIR([build-aux]) -AC_CONFIG_MACRO_DIRS([m4]) +# AC_CONFIG_MACRO_DIRS([m4]) AM_INIT_AUTOMAKE([-Wall -Werror foreign]) AC_PROG_CC AM_PROG_AR diff --git a/recipes/libtool/all/test_v1_package/autotools/Makefile.am b/recipes/libtool/all/test_v1_package/autotools/Makefile.am new file mode 100644 index 0000000000000..aae3d3042e762 --- /dev/null +++ b/recipes/libtool/all/test_v1_package/autotools/Makefile.am @@ -0,0 +1,13 @@ +# @configure_input@ + +bin_PROGRAMS = test_package +lib_LTLIBRARIES = libtestlib.la + +test_package_SOURCES = test_package.c +test_package_LDADD = libtestlib.la + +libtestlib_la_SOURCES = lib.c +libtestlib_la_LDFLAGS = -no-undefined -export-symbols "$(srcdir)/libtestlib.sym" +include_HEADERS = lib.h + +# ACLOCAL_AMFLAGS = -I m4 diff --git a/recipes/libtool/all/test_v1_package/autotools/configure.ac b/recipes/libtool/all/test_v1_package/autotools/configure.ac new file mode 100644 index 0000000000000..e56278b3ae822 --- /dev/null +++ b/recipes/libtool/all/test_v1_package/autotools/configure.ac @@ -0,0 +1,41 @@ +AC_PREREQ(2.69) +# Must init the autoconf setup +# The first parameter is project name +# second is version number +# third is bug report address +AC_INIT([test_package], [1.0]) + +# Safety checks in case user overwritten --srcdir +AC_CONFIG_SRCDIR([test_package.c]) + +# Store the auxiliary build tools (e.g., install-sh, config.sub, config.guess) +# in this dir (build-aux) +AC_CONFIG_AUX_DIR([build-aux]) +# AC_CONFIG_MACRO_DIRS([m4]) + +# Init automake, and specify this program use relaxed structures. +# i.e. this program doesn't follow the gnu coding standards, and doesn't have +# ChangeLog, COPYING, AUTHORS, INSTALL, README etc. files. +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + +# Check for CC and CXX compiler +AC_PROG_CC +AC_PROG_CXX + +# Check for archiver +AM_PROG_AR + +LT_PREREQ([2.4.6]) +LT_INIT([win32-dll]) + +AC_SEARCH_LIBS([sqrt], [m]) + +## We can add more checks in this section +# +## Tells automake to create a Makefile +## See https://www.gnu.org/software/automake/manual/html_node/Requirements.html +AC_CONFIG_FILES([Makefile]) + +## Generate the output +AC_CONFIG_HEADERS([config.h]) +AC_OUTPUT diff --git a/recipes/libtool/all/test_v1_package/autotools/lib.c b/recipes/libtool/all/test_v1_package/autotools/lib.c new file mode 100644 index 0000000000000..a633facec2691 --- /dev/null +++ b/recipes/libtool/all/test_v1_package/autotools/lib.c @@ -0,0 +1,11 @@ +#include "testlib_private.h" + +#include +#include + +double my_function(double val) { + fprintf(stderr, "inside my_function(%e)\n", val); + return sqrt(val); +} + +TESTLIB_API const int libtestlib_value = 42; diff --git a/recipes/libtool/all/test_v1_package/autotools/lib.h b/recipes/libtool/all/test_v1_package/autotools/lib.h new file mode 100644 index 0000000000000..170f9676735dc --- /dev/null +++ b/recipes/libtool/all/test_v1_package/autotools/lib.h @@ -0,0 +1,34 @@ +#ifndef TESTLIB_LIB_H +#define TESTLIB_LIB_H + +#if defined(_WIN32) +# define TESTLIB_IMPORT_SHARED __declspec(dllimport) +# define TESTLIB_EXPORT_SHARED __declspec(dllexport) +# define TESTLIB_IMPORT_STATIC +# define TESTLIB_EXPORT_STATIC +#else +# define TESTLIB_IMPORT_SHARED +# define TESTLIB_EXPORT_SHARED +# define TESTLIB_IMPORT_STATIC +# define TESTLIB_EXPORT_STATIC +#endif + +#if defined(LIBTEST_BUILDING) +# define TESTLIB_SHARED TESTLIB_EXPORT_SHARED +# define TESTLIB_STATIC TESTLIB_EXPORT_STATIC +#else +# define TESTLIB_SHARED TESTLIB_IMPORT_SHARED +# define TESTLIB_STATIC TESTLIB_IMPORT_STATIC +#endif + +#if defined(LIBHELLO_STATIC) +# define TESTLIB_API TESTLIB_STATIC +#else +# define TESTLIB_API TESTLIB_SHARED +#endif + +double my_function(double); + +extern TESTLIB_API const int libtestlib_value; + +#endif // TESTLIB_LIB_H diff --git a/recipes/libtool/all/test_v1_package/autotools/libtestlib.sym b/recipes/libtool/all/test_v1_package/autotools/libtestlib.sym new file mode 100644 index 0000000000000..8464fb190369d --- /dev/null +++ b/recipes/libtool/all/test_v1_package/autotools/libtestlib.sym @@ -0,0 +1,2 @@ +my_function +libtestlib_value diff --git a/recipes/libtool/all/test_v1_package/autotools/test_package.c b/recipes/libtool/all/test_v1_package/autotools/test_package.c new file mode 100644 index 0000000000000..4fd8442a6895e --- /dev/null +++ b/recipes/libtool/all/test_v1_package/autotools/test_package.c @@ -0,0 +1,11 @@ +#include "lib.h" + +#include + +int main(int argc, char * argv[]) +{ + double res = my_function(1.44); + printf("Result is %e\n", res); + printf("The secret value is %d\n", libtestlib_value); + return 0; +} diff --git a/recipes/libtool/all/test_v1_package/autotools/testlib_private.h b/recipes/libtool/all/test_v1_package/autotools/testlib_private.h new file mode 100644 index 0000000000000..81831aee0dc1f --- /dev/null +++ b/recipes/libtool/all/test_v1_package/autotools/testlib_private.h @@ -0,0 +1,8 @@ +#ifndef TESTLIB_PRIVATE_H +#define TESTLIB_PRIVATE_H + +#define LIBTEST_BUILDING + +#include "lib.h" + +#endif // TESTLIB_PRIVATE_H diff --git a/recipes/libtool/all/test_v1_package/conanfile.py b/recipes/libtool/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4b29d6a395ef7 --- /dev/null +++ b/recipes/libtool/all/test_v1_package/conanfile.py @@ -0,0 +1,159 @@ +from conans import AutoToolsBuildEnvironment, CMake, ConanFile, tools +from contextlib import contextmanager +import glob +import os +import shutil + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake" + test_type = "explicit" + short_paths = True + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def requirements(self): + self.requires(self.tested_reference_str) # Needed as a requirement for CMake to see libraries + + def build_requirements(self): + if hasattr(self, "settings_build") and not tools.cross_building(self): + self.build_requires(self.tested_reference_str) + self.build_requires("automake/1.16.5") # Needed for aclocal called by autoreconf + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + @contextmanager + def _build_context(self): + if self.settings.compiler == "Visual Studio": + with tools.vcvars(self.settings): + with tools.environment_append({ + "CC": "cl -nologo", + "CXX": "cl -nologo", + }): + yield + else: + yield + + @property + def _package_folder(self): + return os.path.join(self.build_folder, "package") + + def _build_autotools(self): + """ Test autotools integration """ + # Copy autotools directory to build folder + shutil.copytree(os.path.join(self.source_folder, "autotools"), os.path.join(self.build_folder, "autotools")) + with tools.chdir("autotools"): + self.run("autoreconf --install --verbose -Wall", win_bash=tools.os_info.is_windows) + + tools.mkdir(self._package_folder) + conf_args = [ + "--prefix={}".format(tools.unix_path(self._package_folder)), + "--enable-shared", "--enable-static", + ] + + os.mkdir("bin_autotools") + with tools.chdir("bin_autotools"): + with self._build_context(): + autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + autotools.libs = [] + autotools.configure(args=conf_args, configure_dir=os.path.join(self.build_folder, "autotools")) + autotools.make(args=["V=1"]) + autotools.install() + + def _test_autotools(self): + assert os.path.isdir(os.path.join(self._package_folder, "bin")) + assert os.path.isfile(os.path.join(self._package_folder, "include", "lib.h")) + assert os.path.isdir(os.path.join(self._package_folder, "lib")) + + if not tools.cross_building(self): + self.run(os.path.join(self._package_folder, "bin", "test_package"), run_environment=True) + + def _build_ltdl(self): + """ Build library using ltdl library """ + with self._build_context(): + if self.settings.compiler == "Visual Studio": + cmake = CMake(self, generator="NMake Makefiles") + else: + cmake = CMake(self) + cmake.configure(source_folder="ltdl") + cmake.build() + + def _test_ltdl(self): + """ Test library using ltdl library""" + lib_suffix = { + "Linux": "so", + "FreeBSD": "so", + "Macos": "dylib", + "Windows": "dll", + }[str(self.settings.os)] + + if not tools.cross_building(self): + bin_path = tools.unix_path(os.path.join("bin", "test_package")) + libdir = "bin" if self.settings.os == "Windows" else "lib" + lib_path = tools.unix_path(os.path.join(libdir, "liba.{}".format(lib_suffix))) + self.run("{} {}".format(bin_path, lib_path), run_environment=True, win_bash=tools.os_info.is_windows) + + def _build_static_lib_in_shared(self): + """ Build shared library using libtool (while linking to a static library) """ + + # Copy static-in-shared directory to build folder + autotools_folder = os.path.join(self.build_folder, "sis") + shutil.copytree(os.path.join(self.source_folder, "sis"), autotools_folder) + + install_prefix = os.path.join(autotools_folder, "prefix") + + # Build static library using CMake + with self._build_context(): + if self.settings.compiler == "Visual Studio": + cmake = CMake(self, generator="NMake Makefiles") + else: + cmake = CMake(self) + cmake.definitions["CMAKE_INSTALL_PREFIX"] = install_prefix + cmake.configure(source_folder=autotools_folder, build_folder=os.path.join(autotools_folder, "cmake_build")) + cmake.build() + cmake.install() + + # Copy autotools directory to build folder + with tools.chdir(autotools_folder): + self.run("autoreconf -ifv -Wall", win_bash=tools.os_info.is_windows) + + with tools.chdir(autotools_folder): + conf_args = [ + "--enable-shared", + "--disable-static", + "--prefix={}".format(tools.unix_path(os.path.join(install_prefix))), + ] + with self._build_context(): + autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + autotools.libs = [] + autotools.link_flags.append("-L{}".format(tools.unix_path(os.path.join(install_prefix, "lib")))) + autotools.configure(args=conf_args, configure_dir=autotools_folder) + autotools.make(args=["V=1"]) + autotools.install() + + def _test_static_lib_in_shared(self): + """ Test existence of shared library """ + install_prefix = os.path.join(self.build_folder, "sis", "prefix") + + with tools.chdir(install_prefix): + if self.settings.os == "Windows": + assert len(list(glob.glob(os.path.join("bin", "*.dll")))) > 0 + elif tools.is_apple_os(self.settings.os): + assert len(list(glob.glob(os.path.join("lib", "*.dylib")))) > 0 + else: + assert len(list(glob.glob(os.path.join("lib", "*.so")))) > 0 + + def build(self): + self._build_ltdl() + if not tools.cross_building(self): + self._build_autotools() + self._build_static_lib_in_shared() + + def test(self): + self._test_ltdl() + if not tools.cross_building(self): + self._test_autotools() + self._test_static_lib_in_shared() diff --git a/recipes/libtool/all/test_v1_package/ltdl/CMakeLists.txt b/recipes/libtool/all/test_v1_package/ltdl/CMakeLists.txt new file mode 100644 index 0000000000000..7fc6140320af7 --- /dev/null +++ b/recipes/libtool/all/test_v1_package/ltdl/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 2.8.12) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +include(GenerateExportHeader) + +add_library(liba SHARED liba.c) +generate_export_header(liba) +target_include_directories(liba + PUBLIC $ +) +set_property(TARGET liba PROPERTY PREFIX "") + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_include_directories(test_package + PUBLIC "$" +) diff --git a/recipes/libtool/all/test_v1_package/ltdl/liba.c b/recipes/libtool/all/test_v1_package/ltdl/liba.c new file mode 100644 index 0000000000000..790903848f667 --- /dev/null +++ b/recipes/libtool/all/test_v1_package/ltdl/liba.c @@ -0,0 +1,6 @@ +#include "liba_export.h" + +LIBA_EXPORT +int liba_function(int arg) { + return 2 * arg; +} diff --git a/recipes/libtool/all/test_v1_package/ltdl/test_package.c b/recipes/libtool/all/test_v1_package/ltdl/test_package.c new file mode 100644 index 0000000000000..51329f415f56f --- /dev/null +++ b/recipes/libtool/all/test_v1_package/ltdl/test_package.c @@ -0,0 +1,36 @@ +#include "ltdl.h" + +#include +#include + +typedef int (*liba_func_t)(int); + +int main(int argc, char **argv) +{ + if (argc < 2) { + fprintf(stderr, "Need an argument\n"); + return EXIT_FAILURE; + } + const char* libname = argv[1]; + lt_dlinit(); + + fprintf(stderr, "lt_dlopenext(\"%s\")\n", libname); + lt_dlhandle ltdl_liba = lt_dlopenext(libname); + if (!ltdl_liba) { + fprintf(stderr, "lt_dlopenext failed.\n"); + return EXIT_FAILURE; + } + + liba_func_t liba_func = (liba_func_t) lt_dlsym(ltdl_liba, "liba_function"); + int res = liba_func(21); + printf("Result is %d\n", res); + if (res != 42) { + fprintf(stderr, "Result is incorrect\n"); + return EXIT_FAILURE; + } + + lt_dlclose(ltdl_liba); + + lt_dlexit(); + return EXIT_SUCCESS; +} diff --git a/recipes/libtool/all/test_package/sis/CMakeLists.txt b/recipes/libtool/all/test_v1_package/sis/CMakeLists.txt similarity index 100% rename from recipes/libtool/all/test_package/sis/CMakeLists.txt rename to recipes/libtool/all/test_v1_package/sis/CMakeLists.txt diff --git a/recipes/libtool/all/test_v1_package/sis/Makefile.am b/recipes/libtool/all/test_v1_package/sis/Makefile.am new file mode 100644 index 0000000000000..824106cabe1d8 --- /dev/null +++ b/recipes/libtool/all/test_v1_package/sis/Makefile.am @@ -0,0 +1,8 @@ +# @configure_input@ + +lib_LTLIBRARIES = libshared.la + +libshared_la_SOURCES = shared_lib.c +libshared_la_LDFLAGS = -no-undefined -lstatic_lib + +# ACLOCAL_AMFLAGS = -I m4 diff --git a/recipes/libtool/all/test_v1_package/sis/configure.ac b/recipes/libtool/all/test_v1_package/sis/configure.ac new file mode 100644 index 0000000000000..0272fc8f862a2 --- /dev/null +++ b/recipes/libtool/all/test_v1_package/sis/configure.ac @@ -0,0 +1,13 @@ +AC_PREREQ(2.69) +AC_INIT([test_package], [1.0]) +AC_CONFIG_SRCDIR([shared_lib.c]) +AC_CONFIG_AUX_DIR([build-aux]) +# AC_CONFIG_MACRO_DIRS([m4]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) +AC_PROG_CC +AM_PROG_AR +LT_PREREQ([2.4]) +LT_INIT([win32-dll]) +AC_CONFIG_FILES([Makefile]) +AC_CONFIG_HEADERS([config.h]) +AC_OUTPUT diff --git a/recipes/libtool/all/test_v1_package/sis/shared.sym b/recipes/libtool/all/test_v1_package/sis/shared.sym new file mode 100644 index 0000000000000..e05e2d3117c07 --- /dev/null +++ b/recipes/libtool/all/test_v1_package/sis/shared.sym @@ -0,0 +1 @@ +shared_function diff --git a/recipes/libtool/all/test_v1_package/sis/shared_lib.c b/recipes/libtool/all/test_v1_package/sis/shared_lib.c new file mode 100644 index 0000000000000..b92cbe207afe1 --- /dev/null +++ b/recipes/libtool/all/test_v1_package/sis/shared_lib.c @@ -0,0 +1,7 @@ +int +static_function(int); + +int +shared_function(int arg) { + return static_function(arg) + 1337; +} diff --git a/recipes/libtool/all/test_v1_package/sis/static_lib.c b/recipes/libtool/all/test_v1_package/sis/static_lib.c new file mode 100644 index 0000000000000..2ebed9d056844 --- /dev/null +++ b/recipes/libtool/all/test_v1_package/sis/static_lib.c @@ -0,0 +1,4 @@ +int +static_function(int arg) { + return arg + 42; +} diff --git a/recipes/libtorrent/all/CMakeLists.txt b/recipes/libtorrent/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/libtorrent/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libtorrent/all/conandata.yml b/recipes/libtorrent/all/conandata.yml index edd9ac3737106..c0a04e36275d4 100644 --- a/recipes/libtorrent/all/conandata.yml +++ b/recipes/libtorrent/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.8": + url: "https://github.com/arvidn/libtorrent/releases/download/v2.0.8/libtorrent-rasterbar-2.0.8.tar.gz" + sha256: "09dd399b4477638cf140183f5f85d376abffb9c192bc2910002988e27d69e13e" "2.0.1": url: "https://github.com/arvidn/libtorrent/releases/download/v2.0.1/libtorrent-rasterbar-2.0.1.tar.gz" sha256: "7b39599bf602bf2f208f8f05bf2327576356a3c192175b3a4603262ede42ffd7" @@ -6,15 +9,13 @@ sources: url: "https://github.com/arvidn/libtorrent/releases/download/libtorrent-1_2_3/libtorrent-rasterbar-1.2.3.tar.gz" sha256: "1582fdbbd0449bcfe4ffae2ccb9e5bf0577459a32bb25604e01accb847da1a2d" patches: - "2.0.1": - - patch_file: "patches/2.0.1-0001-cmake-fix-conan-boost-openssl.patch" - base_path: "source_subfolder" "1.2.3": - - patch_file: "patches/1.2.3-0001-cmake-fix-conan-boost-openssl.patch" - base_path: "source_subfolder" - patch_file: "patches/1.2.3-0002-boost-system-header-only-1.69+.patch" - base_path: "source_subfolder" + patch_description: "use find_package with component only boost >= 1.69" + patch_type: "portability" - patch_file: "patches/1.2.3-0003-include-cstddef.patch" - base_path: "source_subfolder" + patch_description: "include cstddef instead stddef.h" + patch_type: "portability" - patch_file: "patches/1.2.3-0004-increase-handle-storage-sizes.patch" - base_path: "source_subfolder" + patch_description: "increase handle storage size" + patch_type: "portability" diff --git a/recipes/libtorrent/all/conanfile.py b/recipes/libtorrent/all/conanfile.py index 59a5d38214efb..4ccfa8ffd7705 100644 --- a/recipes/libtorrent/all/conanfile.py +++ b/recipes/libtorrent/all/conanfile.py @@ -1,10 +1,13 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class LibtorrentConan(ConanFile): name = "libtorrent" @@ -45,21 +48,8 @@ class LibtorrentConan(ConanFile): "enable_mutable_torrents": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -67,104 +57,121 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def _check_compiler_supports_cxx14(self): min_compiler_version = { "Visual Studio": "15", - "gcc": "5", + "msvc": "191", + "gcc": "5" if Version(self.version) < "2.0.8" else "6", "clang": "5", "apple-clang": "5", }.get(str(self.settings.compiler)) if min_compiler_version is None: self.output.warn("Unknown compiler. Assuming it is supporting c++14") - if tools.Version(self.settings.compiler.version) < min_compiler_version: + if Version(self.settings.compiler.version) < min_compiler_version: raise ConanInvalidConfiguration("This compiler (version) does not support c++ 14.") return True, None def validate(self): - if tools.Version(self.version) < "2.0": + if Version(self.version) < "2.0": if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) else: self._check_compiler_supports_cxx14() if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) + + if Version(self.dependencies["boost"].ref.version) < "1.69.0" and \ + (self.dependencies["boost"].options.header_only or self.dependencies["boost"].options.without_system): + raise ConanInvalidConfiguration(f"{self.ref} requires boost with system, which is non-header only in boost < 1.69.0") def requirements(self): - if tools.Version(self.version) < "2.0.0": - self.requires("boost/1.79.0") + # libtorrent 2.0.x [x<=6] have issue for recent boost https://github.com/arvidn/libtorrent/discussions/6757 + if Version(self.version) < "2.0.0" or "2.0.6" < Version(self.version): + self.requires("boost/1.81.0") else: self.requires("boost/1.76.0") if self.options.enable_encryption: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.enable_iconv: self.requires("libiconv/1.17") - def _validate_dependency_graph(self): - if tools.Version(self.deps_cpp_info["boost"].version) < "1.69.0" and \ - (self.options["boost"].header_only or self.options["boost"].without_system): - raise ConanInvalidConfiguration("libtorrent requires boost with system, which is non-header only in boost < 1.69.0") + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "2.0.4" and not self._cmake_new_enough("3.16.0"): + self.tool_requires("cmake/3.25.1") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["Boost_USE_STATIC_LIBS"] = not self.options["boost"].shared - self._cmake.definitions["deprecated-functions"] = self.options.enable_deprecated_functions - self._cmake.definitions["dht"] = self.options.enable_dht - self._cmake.definitions["encryption"] = self.options.enable_encryption - self._cmake.definitions["exceptions"] = self.options.enable_exceptions - self._cmake.definitions["i2p"] = self.options.enable_i2p - self._cmake.definitions["logging"] = self.options.enable_logging - self._cmake.definitions["mutable-torrents"] = self.options.enable_mutable_torrents - self._cmake.definitions["build_tests"] = False - self._cmake.definitions["build_examples"] = False - self._cmake.definitions["build_tools"] = False - self._cmake.definitions["python-bindings"] = False - self._cmake.definitions["python-bindings"] = False - if self._is_msvc: - self._cmake.definitions["static_runtime"] = "MT" in msvc_runtime_flag(self) - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["Boost_USE_STATIC_LIBS"] = not self.dependencies["boost"].options.shared + tc.variables["deprecated-functions"] = self.options.enable_deprecated_functions + tc.variables["dht"] = self.options.enable_dht + tc.variables["encryption"] = self.options.enable_encryption + tc.variables["exceptions"] = self.options.enable_exceptions + tc.variables["i2p"] = self.options.enable_i2p + tc.variables["logging"] = self.options.enable_logging + tc.variables["mutable-torrents"] = self.options.enable_mutable_torrents + tc.variables["build_tests"] = False + tc.variables["build_examples"] = False + tc.variables["build_tools"] = False + tc.variables["python-bindings"] = False + tc.variables["python-bindings"] = False + if is_msvc(self): + tc.variables["static_runtime"] = is_msvc_static_runtime(self) + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch_data in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch_data) + apply_conandata_patches(self) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "/W4", "") - if tools.Version(self.version) < "2.0": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "/W4", "") + if Version(self.version) < "2.0": if self.options.enable_iconv: replace = "find_public_dependency(Iconv REQUIRED)" else: replace = "set(Iconv_FOUND OFF)" - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "find_public_dependency(Iconv)", replace) if self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libstdc++": # https://github.com/arvidn/libtorrent/issues/3557 - tools.replace_in_file(os.path.join(self._source_subfolder, "include", "libtorrent", "file_storage.hpp"), + replace_in_file(self, os.path.join(self.source_folder, "include", "libtorrent", "file_storage.hpp"), "file_entry& operator=(file_entry&&) & noexcept = default;", "file_entry& operator=(file_entry&&) & = default;") def build(self): - self._validate_dependency_graph() self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "LibtorrentRasterbar") diff --git a/recipes/libtorrent/all/patches/1.2.3-0001-cmake-fix-conan-boost-openssl.patch b/recipes/libtorrent/all/patches/1.2.3-0001-cmake-fix-conan-boost-openssl.patch deleted file mode 100644 index 0fd0b09b5440f..0000000000000 --- a/recipes/libtorrent/all/patches/1.2.3-0001-cmake-fix-conan-boost-openssl.patch +++ /dev/null @@ -1,22 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -484,8 +484,8 @@ - if(static_runtime) - include(ucm_flags) - ucm_set_runtime(STATIC) -- set(Boost_USE_MULTITHREADED ON) -- set(Boost_USE_STATIC_RUNTIME ON) -+ # set(Boost_USE_MULTITHREADED ON) -+ # set(Boost_USE_STATIC_RUNTIME ON) - set(OPENSSL_USE_STATIC_LIBS TRUE) - set(OPENSSL_MSVC_STATIC_RT TRUE) - endif() -@@ -630,7 +630,7 @@ - ) - - if(OPENSSL_FOUND) -- target_link_libraries(torrent-rasterbar PUBLIC OpenSSL::SSL) -+ target_link_libraries(torrent-rasterbar PUBLIC OpenSSL::SSL ${CONAN_SYSTEM_LIBS_OPENSSL}) - target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_OPENSSL) - target_sources(torrent-rasterbar PRIVATE src/pe_crypto) - endif() diff --git a/recipes/libtorrent/all/patches/2.0.1-0001-cmake-fix-conan-boost-openssl.patch b/recipes/libtorrent/all/patches/2.0.1-0001-cmake-fix-conan-boost-openssl.patch deleted file mode 100644 index 095d34ce0f4db..0000000000000 --- a/recipes/libtorrent/all/patches/2.0.1-0001-cmake-fix-conan-boost-openssl.patch +++ /dev/null @@ -1,30 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -510,7 +510,7 @@ - if(static_runtime) - include(ucm_flags) - ucm_set_runtime(STATIC) -- set(Boost_USE_MULTITHREADED ON) -- set(Boost_USE_STATIC_RUNTIME ON) -+ # set(Boost_USE_MULTITHREADED ON) -+ # set(Boost_USE_STATIC_RUNTIME ON) - set(OPENSSL_MSVC_STATIC_RT ON) - endif() -@@ -660,7 +660,7 @@ - if(WIN32 AND OPENSSL_USE_STATIC_LIBS) - target_link_libraries(torrent-rasterbar PRIVATE crypt32) - endif() -- target_link_libraries(torrent-rasterbar PUBLIC OpenSSL::SSL) -+ target_link_libraries(torrent-rasterbar PUBLIC OpenSSL::SSL ${CONAN_SYSTEM_LIBS_OPENSSL}) - target_compile_definitions(torrent-rasterbar - PUBLIC - TORRENT_USE_OPENSSL -@@ -696,7 +696,7 @@ - - if (NOT GNUTLS_FOUND AND NOT TARGET OpenSSL::SSL) - if(TARGET OpenSSL::Crypto) -- target_link_libraries(torrent-rasterbar PUBLIC OpenSSL::Crypto) -+ target_link_libraries(torrent-rasterbar PUBLIC OpenSSL::Crypto ${CONAN_SYSTEM_LIBS_OPENSSL}) - target_compile_definitions(torrent-rasterbar PUBLIC TORRENT_USE_LIBCRYPTO) - else() - find_public_dependency(LibGcrypt) diff --git a/recipes/libtorrent/all/test_package/CMakeLists.txt b/recipes/libtorrent/all/test_package/CMakeLists.txt index 3b0214fde3a62..ad88123584e9b 100644 --- a/recipes/libtorrent/all/test_package/CMakeLists.txt +++ b/recipes/libtorrent/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) if(WIN32) add_definitions(-D_WIN32_WINNT=0x0601) @@ -11,9 +8,9 @@ endif() find_package(LibtorrentRasterbar REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} LibtorrentRasterbar::torrent-rasterbar) +target_link_libraries(${PROJECT_NAME} PRIVATE LibtorrentRasterbar::torrent-rasterbar) if(LibtorrentRasterbar_VERSION VERSION_LESS "2.0") - set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) else() - set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) endif() diff --git a/recipes/libtorrent/all/test_package/conanfile.py b/recipes/libtorrent/all/test_package/conanfile.py index 389562b941ae2..9dc671ff8c098 100644 --- a/recipes/libtorrent/all/test_package/conanfile.py +++ b/recipes/libtorrent/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,8 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") # from https://en.wikipedia.org/wiki/Magnet_URI_scheme magnet_url = "magnet:?xt=urn:btih:c12fe1c06bba254a9dc9f519b335aa7c1367a88a" - self.run("{} {}".format(bin_path, magnet_url), run_environment=True) + self.run(f"{bin_path} {magnet_url}", env="conanrun") diff --git a/recipes/libtorrent/all/test_v1_package/CMakeLists.txt b/recipes/libtorrent/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/libtorrent/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libtorrent/all/test_v1_package/conanfile.py b/recipes/libtorrent/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d96fde1be2e9a --- /dev/null +++ b/recipes/libtorrent/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + # from https://en.wikipedia.org/wiki/Magnet_URI_scheme + magnet_url = "magnet:?xt=urn:btih:c12fe1c06bba254a9dc9f519b335aa7c1367a88a" + self.run("{} {}".format(bin_path, magnet_url), run_environment=True) diff --git a/recipes/libtorrent/config.yml b/recipes/libtorrent/config.yml index cd15177f782c8..aabaf7330b305 100644 --- a/recipes/libtorrent/config.yml +++ b/recipes/libtorrent/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.8": + folder: "all" "2.0.1": folder: "all" "1.2.3": diff --git a/recipes/libucl/all/CMakeLists.txt b/recipes/libucl/all/CMakeLists.txt deleted file mode 100644 index 9719e759ff2b5..0000000000000 --- a/recipes/libucl/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/libucl/all/conandata.yml b/recipes/libucl/all/conandata.yml index b1df39720e7e0..11db4b55879f9 100644 --- a/recipes/libucl/all/conandata.yml +++ b/recipes/libucl/all/conandata.yml @@ -1,12 +1,40 @@ sources: + "0.8.2": + url: "https://github.com/vstakhov/libucl/archive/refs/tags/0.8.2.tar.gz" + sha256: "d95a0e2151cc167a0f3e51864fea4e8977a0f4c473faa805269a347f7fb4e165" "0.8.1": url: "https://github.com/vstakhov/libucl/archive/refs/tags/0.8.1.tar.gz" sha256: "a6397e179672f0e8171a0f9a2cfc37e01432b357fd748b13f4394436689d24ef" patches: + "0.8.2": + - patch_file: "patches/0001-0.8.1-shared-win32.patch" + patch_description: "fix UCL_EXTERN definition for shared build on win32" + patch_type: "portability" + - patch_file: "patches/0002-0.8.2-cmake-add-install+use-find_package.patch" + patch_description: "improve installation, use cci package" + patch_type: "conan" + - patch_file: "patches/0003-no-strings-h.patch" + patch_description: "include string.h instead of strings.h" + patch_type: "portability" + - patch_file: "patches/0004-0.8.2-cmake-minimum-required.patch" + patch_description: "declare cmake_minimum_required first" + patch_type: "portability" + - patch_file: "patches/0005-0.8.1-add-_tmp.patch" + patch_description: "add _tmp variables in sort macros" + patch_type: "portability" "0.8.1": - patch_file: "patches/0001-0.8.1-shared-win32.patch" - base_path: "source_subfolder" + patch_description: "fix UCL_EXTERN definition for shared build on win32" + patch_type: "portability" - patch_file: "patches/0002-0.8.1-cmake-add-install+use-find_package.patch" - base_path: "source_subfolder" + patch_description: "improve installation, use cci package" + patch_type: "conan" - patch_file: "patches/0003-no-strings-h.patch" - base_path: "source_subfolder" + patch_description: "include string.h instead of strings.h" + patch_type: "portability" + - patch_file: "patches/0004-0.8.1-cmake-minimum-required.patch" + patch_description: "declare cmake_minimum_required first" + patch_type: "portability" + - patch_file: "patches/0005-0.8.1-add-_tmp.patch" + patch_description: "add _tmp variables in sort macros" + patch_type: "portability" diff --git a/recipes/libucl/all/conanfile.py b/recipes/libucl/all/conanfile.py index 24d2f3383d0bb..99131d4e95863 100644 --- a/recipes/libucl/all/conanfile.py +++ b/recipes/libucl/all/conanfile.py @@ -1,17 +1,18 @@ -from conans import CMake, ConanFile, tools -import functools - -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os +required_conan_version = ">=1.53.0" class LibuclConan(ConanFile): name = "libucl" description = "Universal configuration library parser" license = "BSD-2-Clause" - homepage = "https://github.com/vstakhov/libucl" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/vstakhov/libucl" topics = ("universal", "configuration", "language", "parser", "ucl") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -27,12 +28,8 @@ class LibuclConan(ConanFile): "with_lua": False, } - generators = "cmake", "cmake_find_package_multi" - exports_sources = "CMakeLists.txt", "patches/*" - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -40,48 +37,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.enable_url_include: - self.requires("libcurl/7.84.0") + self.requires("libcurl/7.86.0") if self.options.enable_url_sign: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.with_lua == "lua": self.requires("lua/5.4.4") elif self.options.with_lua == "luajit": self.requires("luajit/2.0.5") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) on_off = lambda v: "ON" if v else "OFF" - cmake.definitions["ENABLE_URL_INCLUDE"] = on_off(self.options.enable_url_include) - cmake.definitions["ENABLE_URL_SIGN"] = on_off(self.options.enable_url_sign) - cmake.definitions["ENABLE_LUA"] = on_off(self.options.with_lua == "lua") - cmake.definitions["ENABLE_LUAJIT"] = on_off(self.options.with_lua == "luajit") - cmake.configure() - return cmake + tc.variables["ENABLE_URL_INCLUDE"] = on_off(self.options.enable_url_include) + tc.variables["ENABLE_URL_SIGN"] = on_off(self.options.enable_url_sign) + tc.variables["ENABLE_LUA"] = on_off(self.options.with_lua == "lua") + tc.variables["ENABLE_LUAJIT"] = on_off(self.options.with_lua == "luajit") + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses", keep_path=False) - cmake = self._configure_cmake() + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libs = ["ucl"] - self.cpp_info.names["pkg_config"] = "libucl" if self.settings.os == "Windows" and not self.options.shared: self.cpp_info.defines.append("UCL_STATIC") + + self.cpp_info.set_property("pkg_config_name", "libucl") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["pkg_config"] = "libucl" diff --git a/recipes/libucl/all/patches/0002-0.8.1-cmake-add-install+use-find_package.patch b/recipes/libucl/all/patches/0002-0.8.1-cmake-add-install+use-find_package.patch index 29415e0d82768..1d7992b85f978 100644 --- a/recipes/libucl/all/patches/0002-0.8.1-cmake-add-install+use-find_package.patch +++ b/recipes/libucl/all/patches/0002-0.8.1-cmake-add-install+use-find_package.patch @@ -1,28 +1,26 @@ -- Fixes dll/static cmake builds -- Fixes libcurl ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -4,13 +4,13 @@ - SET(LIBUCL_VERSION_MAJOR 0) +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7b55faf..f1da7ea 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,11 +5,14 @@ SET(LIBUCL_VERSION_MAJOR 0) SET(LIBUCL_VERSION_MINOR 5) SET(LIBUCL_VERSION_PATCH 0) -- + -SET(LIBUCL_VERSION - "${LIBUCL_VERSION_MAJOR}.${LIBUCL_VERSION_MINOR}.${LIBUCL_VERSION_PATCH}") +SET(LIBUCL_VERSION "${LIBUCL_VERSION_MAJOR}.${LIBUCL_VERSION_MINOR}.${LIBUCL_VERSION_PATCH}") -- + INCLUDE(CheckCCompilerFlag) -INCLUDE(FindOpenSSL) -- +IF(ENABLE_URL_SIGN) + FIND_PACKAGE(OpenSSL REQUIRED) + SET(HAVE_OPENSSL 1) + ADD_DEFINITIONS(-DHAVE_OPENSSL) +ENDIF(ENABLE_URL_SIGN) + OPTION(ENABLE_URL_INCLUDE "Enable urls in ucl includes (requires libcurl or libfetch) [default: OFF]" OFF) OPTION(ENABLE_URL_SIGN "Enable signatures check in ucl includes (requires openssl) [default: OFF]" OFF) - OPTION(BUILD_SHARED_LIBS "Build Shared Libraries [default: OFF]" OFF) -@@ -131,31 +131,31 @@ +@@ -131,31 +134,11 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") LIST(APPEND CMAKE_REQUIRED_LIBRARIES rt) ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") @@ -54,40 +52,17 @@ +IF(ENABLE_URL_INCLUDE) + FIND_PACKAGE(CURL REQUIRED) + ADD_DEFINITIONS(-DCURL_FOUND) -+ SET(CURL_LIBRARIES CURL::CURL) -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ ++ SET(CURL_LIBRARIES CURL::libcurl) +ENDIF() SET(CMAKE_C_WARN_FLAGS "") CHECK_C_COMPILER_FLAG(-Wall SUPPORT_WALL) -@@ -214,4 +214,4 @@ +@@ -214,35 +198,22 @@ IF (BUILD_SHARED_LIBS) ENDIF (BUILD_SHARED_LIBS) ADD_LIBRARY(ucl ${LIB_TYPE} ${UCLSRC}) SET_TARGET_PROPERTIES(ucl PROPERTIES VERSION ${LIBUCL_VERSION} SOVERSION ${LIBUCL_VERSION_MAJOR}) - -+INSTALL(TARGETS ucl RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -@@ -218,29 +218,29 @@ -IF(ENABLE_LUA MATCHES "ON") -+IF(ENABLE_LUA OR ENABLE_LUAJIT) - IF(ENABLE_LUAJIT MATCHES "ON") - FindLua(VERSION_MAJOR "5" VERSION_MINOR "1" ROOT "${LUA_ROOT}") - IF(NOT LUA_FOUND) @@ -106,6 +81,8 @@ - INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}") - ENDIF(NOT LUA_FOUND) - ENDIF(ENABLE_LUAJIT MATCHES "ON") ++INSTALL(TARGETS ucl RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) ++IF(ENABLE_LUA OR ENABLE_LUAJIT) SET(UCL_LUA_SRC lua/lua_ucl.c) ADD_LIBRARY(lua-ucl ${LIB_TYPE} ${UCL_LUA_SRC}) - IF(ENABLE_LUAJIT MATCHES "ON") @@ -115,32 +92,20 @@ - ENDIF(ENABLE_LUAJIT MATCHES "ON") TARGET_LINK_LIBRARIES(lua-ucl ucl) SET_TARGET_PROPERTIES(lua-ucl PROPERTIES VERSION ${LIBUCL_VERSION} SOVERSION ${LIBUCL_VERSION_MAJOR}) --ENDIF() -+ -+ -+ IF(ENABLE_LUA) -+ FIND_PACKAGE(lua REQUIRED CONFIG) -+ TARGET_LINK_LIBRARIES(lua-ucl lua::lua) -+ -+ ELSEIF(ENABLE_LUAJIT) -+ FIND_PACKAGE(luajit REQUIRED CONFIG) -+ TARGET_LINK_LIBRARIES(lua-ucl luajit::luajit) -+ ENDIF() -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ -+ INSTALL(TARGETS lua-ucl RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) -+ INSTALL(FILES include/lua_ucl.h DESTINATION include) -+ENDIF() -@@ -257,3 +257,4 @@ ++ IF(ENABLE_LUA) ++ FIND_PACKAGE(lua REQUIRED CONFIG) ++ TARGET_LINK_LIBRARIES(lua-ucl lua::lua) ++ ++ ELSEIF(ENABLE_LUAJIT) ++ FIND_PACKAGE(luajit REQUIRED CONFIG) ++ TARGET_LINK_LIBRARIES(lua-ucl luajit::luajit) ++ ENDIF() ++ INSTALL(TARGETS lua-ucl RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) ++ INSTALL(FILES include/lua_ucl.h DESTINATION include) + ENDIF() + + IF(HAVE_FETCH_H) +@@ -257,3 +228,4 @@ IF(ENABLE_URL_SIGN MATCHES "ON") TARGET_LINK_LIBRARIES(ucl ${OPENSSL_LIBRARIES}) ENDIF(OPENSSL_FOUND) ENDIF(ENABLE_URL_SIGN MATCHES "ON") diff --git a/recipes/libucl/all/patches/0002-0.8.2-cmake-add-install+use-find_package.patch b/recipes/libucl/all/patches/0002-0.8.2-cmake-add-install+use-find_package.patch new file mode 100644 index 0000000000000..77a86c7056b3c --- /dev/null +++ b/recipes/libucl/all/patches/0002-0.8.2-cmake-add-install+use-find_package.patch @@ -0,0 +1,122 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2201988..3698b95 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,12 +5,15 @@ SET(LIBUCL_VERSION_MAJOR 0) + SET(LIBUCL_VERSION_MINOR 8) + SET(LIBUCL_VERSION_PATCH 2) + +-SET(LIBUCL_VERSION +- "${LIBUCL_VERSION_MAJOR}.${LIBUCL_VERSION_MINOR}.${LIBUCL_VERSION_PATCH}") ++SET(LIBUCL_VERSION "${LIBUCL_VERSION_MAJOR}.${LIBUCL_VERSION_MINOR}.${LIBUCL_VERSION_PATCH}") + + INCLUDE(CheckCCompilerFlag) + INCLUDE(CheckCSourceCompiles) +-INCLUDE(FindOpenSSL) ++IF(ENABLE_URL_SIGN) ++ FIND_PACKAGE(OpenSSL REQUIRED) ++ SET(HAVE_OPENSSL 1) ++ ADD_DEFINITIONS(-DHAVE_OPENSSL) ++ENDIF(ENABLE_URL_SIGN) + INCLUDE(GNUInstallDirs) + + OPTION(ENABLE_URL_INCLUDE "Enable urls in ucl includes (requires libcurl or libfetch) [default: OFF]" OFF) +@@ -135,30 +138,10 @@ IF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux") + + IF(ENABLE_URL_INCLUDE MATCHES "ON") +- FIND_LIBRARY(LIBFETCH_LIBRARY NAMES fetch PATHS PATH_SUFFIXES lib64 lib +- PATHS +- ~/Library/Frameworks +- /Library/Frameworks +- /usr/local +- /usr +- /sw +- /opt/local +- /opt/csw +- /opt +- DOC "Path where the libfetch library can be found") +- IF(LIBFETCH_LIBRARY) +- FIND_FILE(HAVE_FETCH_H NAMES fetch.h PATHS /usr/include +- /opt/include +- /usr/local/include +- DOC "Path to libfetch header") +- ELSE(LIBFETCH_LIBRARY) +- # Try to find libcurl +- FIND_PACKAGE(CURL) +- IF(NOT CURL_FOUND) +- MESSAGE(WARNING "Neither libcurl nor libfetch were found, no support of URL includes in configuration") +- ENDIF(NOT CURL_FOUND) +- ENDIF(LIBFETCH_LIBRARY) +-ENDIF(ENABLE_URL_INCLUDE MATCHES "ON") ++ FIND_PACKAGE(CURL REQUIRED) ++ ADD_DEFINITIONS(-DCURL_FOUND) ++ SET(CURL_LIBRARIES CURL::libcurl) ++ENDIF() + + set(SYNC_BUILTINS_TEST_SOURCE [====[ + int main() +@@ -249,35 +232,24 @@ TARGET_COMPILE_DEFINITIONS(ucl + ${UCL_COMPILE_DEFS} + ) + +-IF(ENABLE_LUA MATCHES "ON") +- IF(ENABLE_LUAJIT MATCHES "ON") +- FindLua(VERSION_MAJOR "5" VERSION_MINOR "1" ROOT "${LUA_ROOT}") +- IF(NOT LUA_FOUND) +- MESSAGE(FATAL_ERROR "Lua not found, lua support is required") +- ELSE(NOT LUA_FOUND) +- INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}") +- ENDIF(NOT LUA_FOUND) +- ELSE(ENABLE_LUAJIT MATCHES "ON") +- FindLua(VERSION_MAJOR "5" VERSION_MINOR "2" ROOT "${LUA_ROOT}") +- IF(NOT LUA_FOUND) +- FindLua(VERSION_MAJOR "5" VERSION_MINOR "1" ROOT "${LUA_ROOT}") +- ENDIF(NOT LUA_FOUND) +- IF(NOT LUA_FOUND) +- MESSAGE(FATAL_ERROR "Lua not found, lua support is required") +- ELSE(NOT LUA_FOUND) +- INCLUDE_DIRECTORIES("${LUA_INCLUDE_DIR}") +- ENDIF(NOT LUA_FOUND) +- ENDIF(ENABLE_LUAJIT MATCHES "ON") ++IF(ENABLE_LUA OR ENABLE_LUAJIT) + SET(UCL_LUA_SRC lua/lua_ucl.c) + ADD_LIBRARY(lua-ucl ${LIB_TYPE} ${UCL_LUA_SRC}) + ADD_LIBRARY(ucl::lua ALIAS lua-ucl) ++ TARGET_LINK_LIBRARIES(lua-ucl ucl) + IF(ENABLE_LUAJIT MATCHES "ON") +- TARGET_LINK_LIBRARIES(lua-ucl "${LUAJIT_LIBRARY}") ++ TARGET_LINK_LIBRARIES(lua-ucl luajit::luajit) + ELSE(ENABLE_LUAJIT MATCHES "ON") +- TARGET_LINK_LIBRARIES(lua-ucl "${LUA_LIBRARY}") ++ TARGET_LINK_LIBRARIES(lua-ucl lua::lua) + ENDIF(ENABLE_LUAJIT MATCHES "ON") +- TARGET_LINK_LIBRARIES(lua-ucl ucl) + TARGET_INCLUDE_DIRECTORIES(lua-ucl PUBLIC include PRIVATE src uthash) ++ IF(ENABLE_LUA) ++ FIND_PACKAGE(lua REQUIRED CONFIG) ++ TARGET_LINK_LIBRARIES(lua-ucl lua::lua) ++ ELSEIF(ENABLE_LUAJIT) ++ FIND_PACKAGE(luajit REQUIRED CONFIG) ++ TARGET_LINK_LIBRARIES(lua-ucl luajit::luajit) ++ ENDIF() + SET_TARGET_PROPERTIES(lua-ucl PROPERTIES + VERSION ${LIBUCL_VERSION} + SOVERSION ${LIBUCL_VERSION_MAJOR} +@@ -306,7 +278,10 @@ ENDIF(UNIX) + SET_TARGET_PROPERTIES(ucl PROPERTIES + PUBLIC_HEADER "${UCLHDR}") + +-INSTALL(TARGETS ucl EXPORT uclConfig DESTINATION ${CMAKE_INSTALL_LIBDIR} ++INSTALL(TARGETS ucl EXPORT uclConfig ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + IF(ENABLE_UTILS MATCHES "ON") +@@ -318,4 +293,3 @@ install(EXPORT uclConfig + NAMESPACE ucl:: + DESTINATION "share/ucl" + ) +- diff --git a/recipes/libucl/all/patches/0004-0.8.1-cmake-minimum-required.patch b/recipes/libucl/all/patches/0004-0.8.1-cmake-minimum-required.patch new file mode 100644 index 0000000000000..e7867f1cb9467 --- /dev/null +++ b/recipes/libucl/all/patches/0004-0.8.1-cmake-minimum-required.patch @@ -0,0 +1,11 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7b55faf..2cb451f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(libucl C) + CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0 FATAL_ERROR) ++PROJECT(libucl C) + + SET(LIBUCL_VERSION_MAJOR 0) + SET(LIBUCL_VERSION_MINOR 5) diff --git a/recipes/libucl/all/patches/0004-0.8.2-cmake-minimum-required.patch b/recipes/libucl/all/patches/0004-0.8.2-cmake-minimum-required.patch new file mode 100644 index 0000000000000..85485f92c8168 --- /dev/null +++ b/recipes/libucl/all/patches/0004-0.8.2-cmake-minimum-required.patch @@ -0,0 +1,11 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2201988..0b29181 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(libucl C) + CMAKE_MINIMUM_REQUIRED(VERSION 3.1.0 FATAL_ERROR) ++PROJECT(libucl C) + + SET(LIBUCL_VERSION_MAJOR 0) + SET(LIBUCL_VERSION_MINOR 8) diff --git a/recipes/libucl/all/patches/0005-0.8.1-add-_tmp.patch b/recipes/libucl/all/patches/0005-0.8.1-add-_tmp.patch new file mode 100644 index 0000000000000..fc6e6059b0ed9 --- /dev/null +++ b/recipes/libucl/all/patches/0005-0.8.1-add-_tmp.patch @@ -0,0 +1,20 @@ +diff --git a/a/uthash/utlist.h b/b/uthash/utlist.h +index c82dd91..7369161 100644 +--- a/a/uthash/utlist.h ++++ b/b/uthash/utlist.h +@@ -111,6 +111,7 @@ do { + LDECLTYPE(list) _ls_q; \ + LDECLTYPE(list) _ls_e; \ + LDECLTYPE(list) _ls_tail; \ ++ LDECLTYPE(list) _tmp; \ + int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping; \ + if (list) { \ + _ls_insize = 1; \ +@@ -174,6 +175,7 @@ do { + LDECLTYPE(list) _ls_q; \ + LDECLTYPE(list) _ls_e; \ + LDECLTYPE(list) _ls_tail; \ ++ LDECLTYPE(list) _tmp; \ + int _ls_insize, _ls_nmerges, _ls_psize, _ls_qsize, _ls_i, _ls_looping; \ + if (list) { \ + _ls_insize = 1; \ diff --git a/recipes/libucl/all/test_package/CMakeLists.txt b/recipes/libucl/all/test_package/CMakeLists.txt index 8d0b348158f02..6bc1b43c40b43 100644 --- a/recipes/libucl/all/test_package/CMakeLists.txt +++ b/recipes/libucl/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(libucl REQUIRED) +find_package(libucl REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} libucl::libucl) -set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libucl::libucl) +target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libucl/all/test_package/conanfile.py b/recipes/libucl/all/test_package/conanfile.py index 84366eb939ca3..1848829203c84 100644 --- a/recipes/libucl/all/test_package/conanfile.py +++ b/recipes/libucl/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,7 +20,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin","test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") sample_conf = os.path.join(self.source_folder, "sample.conf") - self.run("{} {}".format(bin_path, sample_conf), run_environment=True) + self.run(f"{bin_path} {sample_conf}", env="conanrun") diff --git a/recipes/libucl/all/test_v1_package/CMakeLists.txt b/recipes/libucl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/libucl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libucl/all/test_v1_package/conanfile.py b/recipes/libucl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..bb7585234f070 --- /dev/null +++ b/recipes/libucl/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + sample_conf = os.path.join(self.source_folder, os.pardir, "test_package", "sample.conf") + self.run(f"{bin_path} {sample_conf}", run_environment=True) diff --git a/recipes/libucl/config.yml b/recipes/libucl/config.yml index b94f5b45b1bf5..7a9cbb2ce8ecb 100644 --- a/recipes/libucl/config.yml +++ b/recipes/libucl/config.yml @@ -1,3 +1,5 @@ versions: + "0.8.2": + folder: all "0.8.1": folder: all diff --git a/recipes/libudev/all/conanfile.py b/recipes/libudev/all/conanfile.py index 2a3cdc0f95b03..5e4c2d609e88c 100644 --- a/recipes/libudev/all/conanfile.py +++ b/recipes/libudev/all/conanfile.py @@ -1,5 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.system import package_manager +from conan.tools.gnu import PkgConfig + +required_conan_version = ">=1.47" class LibUDEVConan(ConanFile): @@ -10,54 +14,33 @@ class LibUDEVConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.freedesktop.org/software/systemd/man/udev.html" license = "GPL-2.0-or-later", "LGPL-2.1-or-later" - settings = "os" + settings = "os", "arch", "compiler", "build_type" def validate(self): if self.settings.os != "Linux": raise ConanInvalidConfiguration("libudev is only supported on Linux.") def package_id(self): - self.info.header_only() - - def _fill_cppinfo_from_pkgconfig(self, name): - pkg_config = tools.PkgConfig(name) - if not pkg_config.provides: - raise ConanException("libudev development files aren't available, give up") - libs = [lib[2:] for lib in pkg_config.libs_only_l] - lib_dirs = [lib[2:] for lib in pkg_config.libs_only_L] - ldflags = [flag for flag in pkg_config.libs_only_other] - include_dirs = [include[2:] for include in pkg_config.cflags_only_I] - cflags = [flag for flag in pkg_config.cflags_only_other if not flag.startswith("-D")] - defines = [flag[2:] for flag in pkg_config.cflags_only_other if flag.startswith("-D")] - - self.cpp_info.system_libs = libs - self.cpp_info.libdirs = lib_dirs - self.cpp_info.sharedlinkflags = ldflags - self.cpp_info.exelinkflags = ldflags - self.cpp_info.defines = defines - self.cpp_info.includedirs = include_dirs - self.cpp_info.cflags = cflags - self.cpp_info.cxxflags = cflags + self.info.clear() def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_yum: - packages = ["systemd-devel"] - elif tools.os_info.with_apt: - packages = ["libudev-dev"] - elif tools.os_info.with_pacman: - packages = ["systemd-libs"] - elif tools.os_info.with_zypper: - packages = ["libudev-devel"] - else: - self.output.warn("Don't know how to install %s for your distro." % self.name) - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify') - for p in packages: - package_tool.install(update=True, packages=p) + dnf = package_manager.Dnf(self) + dnf.install(["systemd-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["systemd-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + apt.install(["libudev-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["systemd-libs"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["libudev-devel"], update=True, check=True) def package_info(self): self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] - self._fill_cppinfo_from_pkgconfig("libudev") + pkg_config = PkgConfig(self, "libudev") + pkg_config.fill_cpp_info(self.cpp_info) diff --git a/recipes/libudev/all/test_package/CMakeLists.txt b/recipes/libudev/all/test_package/CMakeLists.txt index f20128e28a1d5..c22649f436e09 100644 --- a/recipes/libudev/all/test_package/CMakeLists.txt +++ b/recipes/libudev/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(libudev REQUIRED CONFIG) diff --git a/recipes/libudev/all/test_package/conanfile.py b/recipes/libudev/all/test_package/conanfile.py index 49a3a66ea5bad..07906beea6e20 100644 --- a/recipes/libudev/all/test_package/conanfile.py +++ b/recipes/libudev/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.build import can_run import os - class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libudev/all/test_v1_package/CMakeLists.txt b/recipes/libudev/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libudev/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libudev/all/test_v1_package/conanfile.py b/recipes/libudev/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/libudev/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libunistring/all/conanfile.py b/recipes/libunistring/all/conanfile.py index fa3735abcca8c..472b3ef45ff34 100644 --- a/recipes/libunistring/all/conanfile.py +++ b/recipes/libunistring/all/conanfile.py @@ -1,15 +1,25 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name, is_apple_os +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibUnistringConan(ConanFile): name = "libunistring" - description = "This library provides functions for manipulating Unicode strings and for manipulating C strings according to the Unicode standard." + description = ( + "This library provides functions for manipulating Unicode strings and " + "for manipulating C strings according to the Unicode standard." + ) homepage = "https://www.gnu.org/software/libunistring/" - topics = ("conan", "libunistring", "unicode", "string") + topics = ("unicode", "string") license = "LGPL-3.0-or-later" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" @@ -22,11 +32,9 @@ class LibUnistringConan(ConanFile): "fPIC": True, } - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def config_options(self): if self.settings.os == "Windows": @@ -34,52 +42,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("libiconv/1.17") def validate(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): raise ConanInvalidConfiguration("Visual Studio is unsupported") - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("Shared build on Windows is not supported") - - @property - def _settings_build(self): - return self.settings_build if hasattr(self, "settings_build") else self.settings def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - conf_args = [] - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) - else: - conf_args.extend(["--disable-shared", "--enable-static"]) - - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + tc.generate() + deps = AutotoolsDeps(self) + deps.generate() def build(self): - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy(pattern="COPYING*", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() - autotools.install() - - os.unlink(os.path.join(self.package_folder, "lib", "libunistring.la")) - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.libs = ["unistring"] + if not self.options.shared and is_apple_os(self): + self.cpp_info.frameworks.append("CoreFoundation") diff --git a/recipes/libunistring/all/test_package/CMakeLists.txt b/recipes/libunistring/all/test_package/CMakeLists.txt index 7b9b613cbb24a..07b5ca4d6ab00 100644 --- a/recipes/libunistring/all/test_package/CMakeLists.txt +++ b/recipes/libunistring/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libunistring REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libunistring::libunistring) diff --git a/recipes/libunistring/all/test_package/conanfile.py b/recipes/libunistring/all/test_package/conanfile.py index bd7165a553cf4..0a6bc68712d90 100644 --- a/recipes/libunistring/all/test_package/conanfile.py +++ b/recipes/libunistring/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libunistring/all/test_v1_package/CMakeLists.txt b/recipes/libunistring/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libunistring/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libunistring/all/test_v1_package/conanfile.py b/recipes/libunistring/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libunistring/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libunwind/all/conandata.yml b/recipes/libunwind/all/conandata.yml index 3350506adb22d..3379c640096e5 100644 --- a/recipes/libunwind/all/conandata.yml +++ b/recipes/libunwind/all/conandata.yml @@ -1,14 +1,13 @@ sources: - "1.3.1": - sha256: "43997a3939b6ccdf2f669b50fdb8a4d3205374728c2923ddc2354c65260214f8" - url: "https://github.com/libunwind/libunwind/releases/download/v1.3.1/libunwind-1.3.1.tar.gz" - "1.5.0": - sha256: "90337653d92d4a13de590781371c604f9031cdb50520366aa1e3a91e1efb1017" - url: "https://github.com/libunwind/libunwind/releases/download/v1.5/libunwind-1.5.0.tar.gz" "1.6.2": - sha256: "4a6aec666991fb45d0889c44aede8ad6eb108071c3554fcdff671f9c94794976" url: "https://github.com/libunwind/libunwind/releases/download/v1.6.2/libunwind-1.6.2.tar.gz" + sha256: "4a6aec666991fb45d0889c44aede8ad6eb108071c3554fcdff671f9c94794976" + "1.5.0": + url: "https://github.com/libunwind/libunwind/releases/download/v1.5/libunwind-1.5.0.tar.gz" + sha256: "90337653d92d4a13de590781371c604f9031cdb50520366aa1e3a91e1efb1017" + "1.3.1": + url: "https://github.com/libunwind/libunwind/releases/download/v1.3.1/libunwind-1.3.1.tar.gz" + sha256: "43997a3939b6ccdf2f669b50fdb8a4d3205374728c2923ddc2354c65260214f8" patches: "1.3.1": - patch_file: "patches/0001-multiple-definition-gcc10.patch" - base_path: "source_subfolder" diff --git a/recipes/libunwind/all/conanfile.py b/recipes/libunwind/all/conanfile.py index 16a67c64dbb18..dd6ce3246217b 100644 --- a/recipes/libunwind/all/conanfile.py +++ b/recipes/libunwind/all/conanfile.py @@ -1,17 +1,24 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.env import VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout -required_conan_version = ">=1.33.0" +import os +import shutil +required_conan_version = ">=1.53.0" class LiunwindConan(ConanFile): name = "libunwind" description = "Manipulate the preserved state of each call-frame and resume the execution at any point." - topics = ("conan", "libunwind", "unwind", "debuggers", "exception-handling", "introspection", "setjmp") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/libunwind/libunwind" - license = "MIT" + topics = ("unwind", "debuggers", "exception-handling", "introspection", "setjmp") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,63 +39,76 @@ class LiunwindConan(ConanFile): "zlibdebuginfo": True, } - exports_sources = "patches/**" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def configure(self): - if self.settings.os not in ["Linux", "FreeBSD"]: - raise ConanInvalidConfiguration("libunwind is only supported on Linux and FreeBSD") if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.minidebuginfo: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.0") if self.options.zlibdebuginfo: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("libunwind is only supported on Linux and FreeBSD") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - args = [ - "--enable-shared={}".format("yes" if self.options.shared else "no"), - "--enable-static={}".format("no" if self.options.shared else "yes"), - "--enable-coredump={}".format("yes" if self.options.coredump else "no"), - "--enable-ptrace={}".format("yes" if self.options.ptrace else "no"), - "--enable-setjmp={}".format("yes" if self.options.setjmp else "no"), - "--enable-minidebuginfo={}".format("yes" if self.options.minidebuginfo else "no"), - "--enable-zlibdebuginfo={}".format("yes" if self.options.zlibdebuginfo else "no"), - "--disable-tests", - "--disable-documentation" - ] - self._autotools.configure(configure_dir=self._source_subfolder, args=args) - return self._autotools + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--enable-coredump={yes_no(self.options.coredump)}", + f"--enable-ptrace={yes_no(self.options.ptrace)}", + f"--enable-setjmp={yes_no(self.options.setjmp)}", + f"--enable-minidebuginfo={yes_no(self.options.minidebuginfo)}", + f"--enable-zlibdebuginfo={yes_no(self.options.zlibdebuginfo)}", + "--disable-tests", + "--disable-documentation", + ]) + tc.generate() + + tc = AutotoolsDeps(self) + tc.generate() def build(self): - for patch_data in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch_data) - autotools = self._configure_autotools() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - autotools = self._configure_autotools() + copy(self, pattern="COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + + # In install-exec-hook in Makefile.am, libunwind_generic is linked to libunwind_${arch}. + # As this seems to be unnecessary for the conan package. + # rename the real file to libunwind_generic, + lib_ext = "so" if self.options.shared else "a" + symlink_path = os.path.join(self.package_folder, "lib", f"libunwind-generic.{lib_ext}") + source_path = os.path.realpath(symlink_path) + rm(self, os.path.basename(symlink_path), os.path.dirname(symlink_path)) + shutil.copy(source_path, symlink_path) def package_info(self): - self.cpp_info.components["unwind"].names["pkg_config"] = "libunwind" + self.cpp_info.components["unwind"].set_property("pkg_config_name", "libunwind") self.cpp_info.components["unwind"].libs = ["unwind"] if self.options.minidebuginfo: self.cpp_info.components["unwind"].requires.append("xz_utils::xz_utils") @@ -96,18 +116,18 @@ def package_info(self): self.cpp_info.components["unwind"].requires.append("zlib::zlib") if self.settings.os == "Linux": self.cpp_info.components["unwind"].system_libs.append("pthread") - self.cpp_info.components["generic"].names["pkg_config"] = "libunwind-generic" + self.cpp_info.components["generic"].set_property("pkg_config_name", "libunwind-generic") self.cpp_info.components["generic"].libs = ["unwind-generic"] self.cpp_info.components["generic"].requires = ["unwind"] if self.options.ptrace: - self.cpp_info.components["ptrace"].names["pkg_config"] = "libunwind-ptrace" + self.cpp_info.components["ptrace"].set_property("pkg_config_name", "libunwind-ptrace") self.cpp_info.components["ptrace"].libs = ["unwind-ptrace"] self.cpp_info.components["ptrace"].requires = ["generic", "unwind"] if self.options.setjmp: - self.cpp_info.components["setjmp"].names["pkg_config"] = "libunwind-setjmp" + self.cpp_info.components["setjmp"].set_property("pkg_config_name", "libunwind-setjmp") self.cpp_info.components["setjmp"].libs = ["unwind-setjmp"] self.cpp_info.components["setjmp"].requires = ["unwind"] if self.options.coredump: - self.cpp_info.components["coredump"].names["pkg_config"] = "libunwind-coredump" + self.cpp_info.components["coredump"].set_property("pkg_config_name", "libunwind-coredump") self.cpp_info.components["coredump"].libs = ["unwind-coredump"] self.cpp_info.components["coredump"].requires = ["generic", "unwind"] diff --git a/recipes/libunwind/all/test_package/CMakeLists.txt b/recipes/libunwind/all/test_package/CMakeLists.txt index 0f456c2481f41..e857c1d9df841 100644 --- a/recipes/libunwind/all/test_package/CMakeLists.txt +++ b/recipes/libunwind/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -find_package(libunwind CONFIG REQUIRED) +find_package(libunwind REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libunwind::libunwind) +target_link_libraries(${PROJECT_NAME} PRIVATE libunwind::libunwind) diff --git a/recipes/libunwind/all/test_package/conanfile.py b/recipes/libunwind/all/test_package/conanfile.py index 7e2dfe859bb27..e845ae751a301 100644 --- a/recipes/libunwind/all/test_package/conanfile.py +++ b/recipes/libunwind/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libunwind/all/test_v1_package/CMakeLists.txt b/recipes/libunwind/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de3b75d9538de --- /dev/null +++ b/recipes/libunwind/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libunwind/all/test_v1_package/conanfile.py b/recipes/libunwind/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/libunwind/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libunwind/config.yml b/recipes/libunwind/config.yml index da6301e937ffb..26cf6b32aa2bf 100644 --- a/recipes/libunwind/config.yml +++ b/recipes/libunwind/config.yml @@ -1,7 +1,7 @@ versions: - "1.3.1": + "1.6.2": folder: all "1.5.0": folder: all - "1.6.2": + "1.3.1": folder: all diff --git a/recipes/libusb/all/conandata.yml b/recipes/libusb/all/conandata.yml index 77c9b6023c5e8..447075d3a8df8 100644 --- a/recipes/libusb/all/conandata.yml +++ b/recipes/libusb/all/conandata.yml @@ -1,13 +1,30 @@ sources: - "1.0.23": - sha256: db11c06e958a82dac52cf3c65cb4dd2c3f339c8a988665110e0d24d19312ad8d - url: https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.tar.bz2 - "1.0.24": - sha256: 7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a - url: https://github.com/libusb/libusb/releases/download/v1.0.24/libusb-1.0.24.tar.bz2 + "1.0.26": + url: "https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2" + sha256: "12ce7a61fc9854d1d2a1ffe095f7b5fac19ddba095c259e6067a46500381b5a5" "1.0.25": - sha256: 8a28ef197a797ebac2702f095e81975e2b02b2eeff2774fa909c78a74ef50849 - url: https://github.com/libusb/libusb/releases/download/v1.0.25/libusb-1.0.25.tar.bz2 + url: "https://github.com/libusb/libusb/releases/download/v1.0.25/libusb-1.0.25.tar.bz2" + sha256: "8a28ef197a797ebac2702f095e81975e2b02b2eeff2774fa909c78a74ef50849" + "1.0.24": + url: "https://github.com/libusb/libusb/releases/download/v1.0.24/libusb-1.0.24.tar.bz2" + sha256: "7efd2685f7b327326dcfb85cee426d9b871fd70e22caa15bb68d595ce2a2b12a" + "1.0.23": + url: "https://github.com/libusb/libusb/releases/download/v1.0.23/libusb-1.0.23.tar.bz2" + sha256: "db11c06e958a82dac52cf3c65cb4dd2c3f339c8a988665110e0d24d19312ad8d" +patches: "1.0.26": - sha256: 12ce7a61fc9854d1d2a1ffe095f7b5fac19ddba095c259e6067a46500381b5a5 - url: https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 + - patch_file: "patches/1.0.24-0001-relax-windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" + "1.0.25": + - patch_file: "patches/1.0.24-0001-relax-windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" + "1.0.24": + - patch_file: "patches/1.0.24-0001-relax-windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" + "1.0.23": + - patch_file: "patches/1.0.23-0001-relax-windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" diff --git a/recipes/libusb/all/conanfile.py b/recipes/libusb/all/conanfile.py index 6ba0acedb8c61..60d9abeb38bd0 100644 --- a/recipes/libusb/all/conanfile.py +++ b/recipes/libusb/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, tools +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildToolchain +from conan.tools.scm import Version import os -import re -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class LibUSBConan(ConanFile): @@ -11,8 +17,8 @@ class LibUSBConan(ConanFile): license = "LGPL-2.1" homepage = "https://github.com/libusb/libusb" url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "libusb", "usb", "device") - settings = "os", "compiler", "build_type", "arch" + topics = ("usb", "device") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -23,23 +29,21 @@ class LibUSBConan(ConanFile): "fPIC": True, "enable_udev": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" @property - def _is_msvc(self): - return self.settings.os == "Windows" and self.settings.compiler == "Visual Studio" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property - def _settings_build(self): - return self.settings_build if hasattr(self, "settings_build") else self.settings + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -52,101 +56,95 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def build_requirements(self): - if self._settings_build.os == "Windows" and not self._is_msvc and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.settings.os == "Linux": if self.options.enable_udev: self.requires("libudev/system") + def build_requirements(self): + if self._settings_build.os == "Windows" and not is_msvc(self): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _build_visual_studio(self): - with tools.chdir(self._source_subfolder): - # Assume we're using the latest Visual Studio and default to libusb_2019.sln - # (or libusb_2017.sln for libusb < 1.0.24). - # If we're not using the latest Visual Studio, select an appropriate solution file. - solution_msvc_year = 2019 if tools.Version(self.version) >= "1.0.24" else 2017 - - solution_msvc_year = { - "11": 2012, - "12": 2013, - "14": 2015, - "15": 2017 - }.get(str(self.settings.compiler.version), solution_msvc_year) - - solution_file = os.path.join("msvc", "libusb_{}.sln".format(solution_msvc_year)) - platforms = {"x86":"Win32"} - properties = { - # Enable LTO when CFLAGS contains -GL - "WholeProgramOptimization": "true" if any(re.finditer("(^| )[/-]GL($| )", tools.get_env("CFLAGS", ""))) else "false", - } - msbuild = MSBuild(self) - build_type = "Debug" if self.settings.build_type == "Debug" else "Release" - msbuild.build(solution_file, platforms=platforms, upgrade_project=False, properties=properties, build_type=build_type) - - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - configure_args = ["--enable-shared" if self.options.shared else "--disable-shared"] - configure_args.append("--enable-static" if not self.options.shared else "--disable-static") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() + else: + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) if self.settings.os in ["Linux", "Android"]: - configure_args.append("--enable-udev" if self.options.enable_udev else "--disable-udev") - elif self._is_mingw: - if self.settings.arch == "x86_64": - configure_args.append("--host=x86_64-w64-mingw32") - elif self.settings.arch == "x86": - configure_args.append("--build=i686-w64-mingw32") - configure_args.append("--host=i686-w64-mingw32") - self._autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return self._autotools + tc.configure_args.append("--enable-udev" if self.options.enable_udev else "--disable-udev") + tc.generate() def build(self): - if self._is_msvc: - if tools.Version(self.version) < "1.0.24": - for vcxproj in ["fxload_2017", "getopt_2017", "hotplugtest_2017", "libusb_dll_2017", - "libusb_static_2017", "listdevs_2017", "stress_2017", "testlibusb_2017", "xusb_2017"]: - vcxproj_path = os.path.join(self._source_subfolder, "msvc", "%s.vcxproj" % vcxproj) - tools.replace_in_file(vcxproj_path, "10.0.16299.0", "") - self._build_visual_studio() - else: - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + if is_msvc(self): + solution_msvc_year = "2017" if Version(self.version) < "1.0.24" else "2019" + solution = f"libusb_{'dll' if self.options.shared else 'static'}_{solution_msvc_year}.vcxproj" + vcxproj_path = os.path.join(self.source_folder, "msvc", solution) + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + replace_in_file( + self, vcxproj_path, + "true", + "", + ) + old_toolset = "v141" if Version(self.version) < "1.0.24" else "v142" + new_toolset = MSBuildToolchain(self).toolset + replace_in_file( + self, vcxproj_path, + f"{old_toolset}", + f"{new_toolset}", + ) + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + replace_in_file( + self, vcxproj_path, + "", + f"", + ) + #============================== - def _package_visual_studio(self): - self.copy(pattern="libusb.h", dst=os.path.join("include", "libusb-1.0"), src=os.path.join(self._source_subfolder, "libusb"), keep_path=False) - arch = "x64" if self.settings.arch == "x86_64" else "Win32" - source_dir = os.path.join(self._source_subfolder, arch, str(self.settings.build_type), "dll" if self.options.shared else "lib") - if self.options.shared: - self.copy(pattern="libusb-1.0.dll", dst="bin", src=source_dir, keep_path=False) - self.copy(pattern="libusb-1.0.lib", dst="lib", src=source_dir, keep_path=False) - self.copy(pattern="libusb-usbdk-1.0.dll", dst="bin", src=source_dir, keep_path=False) - self.copy(pattern="libusb-usbdk-1.0.lib", dst="lib", src=source_dir, keep_path=False) + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.build(vcxproj_path) else: - self.copy(pattern="libusb-1.0.lib", dst="lib", src=source_dir, keep_path=False) - self.copy(pattern="libusb-usbdk-1.0.lib", dst="lib", src=source_dir, keep_path=False) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses", keep_path=False) - if self._is_msvc: - self._package_visual_studio() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + copy(self, "libusb.h", src=os.path.join(self.source_folder, "libusb"), + dst=os.path.join(self.package_folder, "include", "libusb-1.0")) + copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.names["pkg_config"] = "libusb-1.0" - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.set_property("pkg_config_name", "libusb-1.0") + prefix = "lib" if is_msvc(self) else "" + self.cpp_info.libs = [f"{prefix}usb-1.0"] self.cpp_info.includedirs.append(os.path.join("include", "libusb-1.0")) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") diff --git a/recipes/libusb/all/patches/1.0.23-0001-relax-windows-sdk-restriction.patch b/recipes/libusb/all/patches/1.0.23-0001-relax-windows-sdk-restriction.patch new file mode 100644 index 0000000000000..1c12693d1700c --- /dev/null +++ b/recipes/libusb/all/patches/1.0.23-0001-relax-windows-sdk-restriction.patch @@ -0,0 +1,20 @@ +--- a/msvc/libusb_dll_2017.vcxproj ++++ b/msvc/libusb_dll_2017.vcxproj +@@ -38,7 +38,6 @@ + libusb-1.0 (dll) + {349EE8FA-7D25-4909-AAF5-FF3FADE72187} + libusbdll +- 10.0.16299.0 + true + true + +--- a/msvc/libusb_static_2017.vcxproj ++++ b/msvc/libusb_static_2017.vcxproj +@@ -38,7 +38,6 @@ + libusb-1.0 (static) + {349EE8F9-7D25-4909-AAF5-FF3FADE72187} + libusb +- 10.0.16299.0 + true + true + diff --git a/recipes/libusb/all/patches/1.0.24-0001-relax-windows-sdk-restriction.patch b/recipes/libusb/all/patches/1.0.24-0001-relax-windows-sdk-restriction.patch new file mode 100644 index 0000000000000..a45db143ab1b1 --- /dev/null +++ b/recipes/libusb/all/patches/1.0.24-0001-relax-windows-sdk-restriction.patch @@ -0,0 +1,20 @@ +--- a/msvc/libusb_dll_2019.vcxproj ++++ b/msvc/libusb_dll_2019.vcxproj +@@ -40,7 +40,6 @@ + libusbdll + true + true +- 10.0 + + + +--- a/msvc/libusb_static_2019.vcxproj ++++ b/msvc/libusb_static_2019.vcxproj +@@ -40,7 +40,6 @@ + libusb + true + true +- 10.0 + + + diff --git a/recipes/libusb/all/test_package/CMakeLists.txt b/recipes/libusb/all/test_package/CMakeLists.txt index a5ffd526aaea7..968df07ffe10a 100644 --- a/recipes/libusb/all/test_package/CMakeLists.txt +++ b/recipes/libusb/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libusb REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.c) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE libusb::libusb) diff --git a/recipes/libusb/all/test_package/conanfile.py b/recipes/libusb/all/test_package/conanfile.py index 3695635f5e0f5..98ab55852ad56 100644 --- a/recipes/libusb/all/test_package/conanfile.py +++ b/recipes/libusb/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin","test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libusb/all/test_package/test_package.c b/recipes/libusb/all/test_package/test_package.c index 89a9b8ba85b34..0ccc95e9223f0 100644 --- a/recipes/libusb/all/test_package/test_package.c +++ b/recipes/libusb/all/test_package/test_package.c @@ -1,21 +1,18 @@ -#include "libusb-1.0/libusb.h" - +#include int main(int argc, char *argv[]) { - libusb_device **devs; - ssize_t cnt; - int r, i; + libusb_device **devs; - r = libusb_init(NULL); - if (r < 0) - return r; + int r = libusb_init(NULL); + if (r < 0) + return r; - cnt = libusb_get_device_list(NULL, &devs); - if (cnt < 0) - return (int)cnt; + ssize_t cnt = libusb_get_device_list(NULL, &devs); + if (cnt < 0) + return (int)cnt; - libusb_free_device_list(devs, 1); - libusb_exit(NULL); + libusb_free_device_list(devs, 1); + libusb_exit(NULL); - return 0; + return 0; } diff --git a/recipes/libusb/all/test_v1_package/CMakeLists.txt b/recipes/libusb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libusb/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libusb/all/test_v1_package/conanfile.py b/recipes/libusb/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..81f9e01d9be5d --- /dev/null +++ b/recipes/libusb/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin","test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libusb/config.yml b/recipes/libusb/config.yml index 8c9d67d1012f2..21a7ffcef562b 100644 --- a/recipes/libusb/config.yml +++ b/recipes/libusb/config.yml @@ -1,10 +1,9 @@ ---- versions: - "1.0.23": - folder: all - "1.0.24": + "1.0.26": folder: all "1.0.25": folder: all - "1.0.26": + "1.0.24": + folder: all + "1.0.23": folder: all diff --git a/recipes/libuuid/all/conandata.yml b/recipes/libuuid/all/conandata.yml index 37a31cc5d58bd..65a63e13dcdf9 100644 --- a/recipes/libuuid/all/conandata.yml +++ b/recipes/libuuid/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "1.0.3": - patch_file: "patches/0001-check-sys-syscall-h+wrap-includes.patch" - base_path: "source_subfolder" diff --git a/recipes/libuuid/all/conanfile.py b/recipes/libuuid/all/conanfile.py index 41ca52ec65930..83191c7fd1923 100644 --- a/recipes/libuuid/all/conanfile.py +++ b/recipes/libuuid/all/conanfile.py @@ -1,10 +1,13 @@ from conan import ConanFile -from conan.tools import files from conan.errors import ConanInvalidConfiguration -from conans import AutoToolsBuildEnvironment, tools +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class LibuuidConan(ConanFile): @@ -13,17 +16,19 @@ class LibuuidConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://sourceforge.net/projects/libuuid/" license = "BSD-3-Clause" - topics = ("conan", "libuuid", "uuid", "unique-id", "unique-identifier") + topics = "id", "identifier", "unique", "uuid" settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/**" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == 'Windows': @@ -31,50 +36,48 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("libuuid is not supported on Windows") + if self.info.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} is not supported on Windows") def build_requirements(self): - self.build_requires("libtool/2.4.7") + self.tool_requires("libtool/2.4.7") def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - yes_no = lambda v: "yes" if v else "no" - configure_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] + def generate(self): + tc = AutotoolsToolchain(self) if "x86" in self.settings.arch: - self._autotools.flags.append('-mstackrealign') - self._autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return self._autotools + tc.extra_cflags.append("-mstackrealign") + tc.generate() + env = VirtualBuildEnv(self) + env.generate() def build(self): - files.apply_conandata_patches(self) - with files.chdir(self, self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True) - autotools = self._configure_autotools() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - autotools = self._configure_autotools() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) autotools.install() - files.rm(self, "*.la", os.path.join(self.package_folder, "lib")) - files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.names["pkg_config"] = "uuid" + self.cpp_info.set_property("pkg_config_name", "uuid") self.cpp_info.libs = ["uuid"] self.cpp_info.includedirs.append(os.path.join("include", "uuid")) diff --git a/recipes/libuuid/all/test_package/CMakeLists.txt b/recipes/libuuid/all/test_package/CMakeLists.txt index fd126a732c403..75c717f769900 100644 --- a/recipes/libuuid/all/test_package/CMakeLists.txt +++ b/recipes/libuuid/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libuuid REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE libuuid::libuuid) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/libuuid/all/test_package/conanfile.py b/recipes/libuuid/all/test_package/conanfile.py index bd7165a553cf4..0a6bc68712d90 100644 --- a/recipes/libuuid/all/test_package/conanfile.py +++ b/recipes/libuuid/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libuuid/all/test_v1_package/CMakeLists.txt b/recipes/libuuid/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libuuid/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libuuid/all/test_v1_package/conanfile.py b/recipes/libuuid/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libuuid/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libuv/all/CMakeLists.txt b/recipes/libuv/all/CMakeLists.txt deleted file mode 100644 index ebd13bfa7a47e..0000000000000 --- a/recipes/libuv/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/libuv/all/conandata.yml b/recipes/libuv/all/conandata.yml index 2d67687a864cd..e251d497e772d 100644 --- a/recipes/libuv/all/conandata.yml +++ b/recipes/libuv/all/conandata.yml @@ -1,62 +1,65 @@ sources: - "1.34.2": - url: "https://github.com/libuv/libuv/archive/v1.34.2.zip" - sha256: "e1a663bcbfbeb18e447f79a39645ca555db47153d29ed81a1cb289373f357035" - "1.38.0": - url: "https://github.com/libuv/libuv/archive/v1.38.0.zip" - sha256: "6502ee75e1007325ba2e15e06d3d7b94ac911704793b2fe6f7bb933e1748db72" - "1.38.1": - url: "https://github.com/libuv/libuv/archive/v1.38.1.zip" - sha256: "0359369492742eb2a36312fffe26f80bcffe4cec981a4fd72d182b061ee14890" - "1.40.0": - url: "https://github.com/libuv/libuv/archive/v1.40.0.zip" - sha256: "61366e30d8484197dc9e4a94dbd98a0ba52fb55cb6c6d991af1f3701b10f322b" - "1.41.0": - url: "https://github.com/libuv/libuv/archive/v1.41.0.zip" - sha256: "cb89a8b9f686c5ccf7ed09a9e0ece151a73ebebc17af3813159c335b02181794" - "1.41.1": - url: "https://github.com/libuv/libuv/archive/v1.41.1.tar.gz" - sha256: "62c29d1d76b0478dc8aaed0ed1f874324f6cd2d6ff4cb59a44026c09e818cd53" - "1.42.0": - url: "https://github.com/libuv/libuv/archive/v1.42.0.tar.gz" - sha256: "371e5419708f6aaeb8656671f89400b92a9bba6443369af1bb70bcd6e4b3c764" - "1.43.0": - url: "https://github.com/libuv/libuv/archive/v1.43.0.tar.gz" - sha256: "9e27825a55279de69a7c43e42d509fd1337c9bece2547c761e91a1592e91cc4d" + "1.44.2": + url: "https://github.com/libuv/libuv/archive/v1.44.2.tar.gz" + sha256: "e6e2ba8b4c349a4182a33370bb9be5e23c51b32efb9b9e209d0e8556b73a48da" "1.44.1": url: "https://github.com/libuv/libuv/archive/v1.44.1.tar.gz" sha256: "e91614e6dc2dd0bfdd140ceace49438882206b7a6fb00b8750914e67a9ed6d6b" -patches: - "1.34.2": - - base_path: "source_subfolder" - patch_file: "patches/1.34.2/fix-cmake.patch" - "1.38.0": - - base_path: "source_subfolder" - patch_file: "patches/1.38.0/fix-cmake.patch" - "1.38.1": - - base_path: "source_subfolder" - patch_file: "patches/1.38.1/fix-cmake.patch" - "1.40.0": - - base_path: "source_subfolder" - patch_file: "patches/1.40.0/fix-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.40.0/fix-ios.patch" - "1.41.0": - - base_path: "source_subfolder" - patch_file: "patches/1.41.0/fix-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.40.0/fix-ios.patch" - "1.41.1": - - base_path: "source_subfolder" - patch_file: "patches/1.41.0/fix-cmake.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.40.0/fix-ios.patch" - "1.42.0": - - base_path: "source_subfolder" - patch_file: "patches/1.42.0/fix-cmake.patch" "1.43.0": - - base_path: "source_subfolder" - patch_file: "patches/1.43.0/fix-cmake.patch" + url: "https://github.com/libuv/libuv/archive/v1.43.0.tar.gz" + sha256: "9e27825a55279de69a7c43e42d509fd1337c9bece2547c761e91a1592e91cc4d" + "1.42.0": + url: "https://github.com/libuv/libuv/archive/v1.42.0.tar.gz" + sha256: "371e5419708f6aaeb8656671f89400b92a9bba6443369af1bb70bcd6e4b3c764" + "1.41.1": + url: "https://github.com/libuv/libuv/archive/v1.41.1.tar.gz" + sha256: "62c29d1d76b0478dc8aaed0ed1f874324f6cd2d6ff4cb59a44026c09e818cd53" + "1.41.0": + url: "https://github.com/libuv/libuv/archive/v1.41.0.zip" + sha256: "cb89a8b9f686c5ccf7ed09a9e0ece151a73ebebc17af3813159c335b02181794" + "1.40.0": + url: "https://github.com/libuv/libuv/archive/v1.40.0.zip" + sha256: "61366e30d8484197dc9e4a94dbd98a0ba52fb55cb6c6d991af1f3701b10f322b" + "1.38.1": + url: "https://github.com/libuv/libuv/archive/v1.38.1.zip" + sha256: "0359369492742eb2a36312fffe26f80bcffe4cec981a4fd72d182b061ee14890" +patches: + "1.44.2": + - patch_file: "patches/1.44.2/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" "1.44.1": - - base_path: "source_subfolder" - patch_file: "patches/1.44.1/fix-cmake.patch" + - patch_file: "patches/1.44.1/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" + "1.43.0": + - patch_file: "patches/1.43.0/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" + "1.42.0": + - patch_file: "patches/1.42.0/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" + "1.41.1": + - patch_file: "patches/1.41.0/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" + - patch_file: "patches/1.40.0/fix-ios.patch" + "1.41.0": + - patch_file: "patches/1.41.0/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" + - patch_file: "patches/1.40.0/fix-ios.patch" + patch_description: "fix dlopen filename" + patch_type: "portability" + "1.40.0": + - patch_file: "patches/1.40.0/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" + - patch_file: "patches/1.40.0/fix-ios.patch" + patch_description: "fix dlopen filename" + patch_type: "portability" + "1.38.1": + - patch_file: "patches/1.38.1/fix-cmake.patch" + patch_description: "separate shared and static library build" + patch_type: "conan" diff --git a/recipes/libuv/all/conanfile.py b/recipes/libuv/all/conanfile.py index 0def182f30fac..a147f0a7124e2 100644 --- a/recipes/libuv/all/conanfile.py +++ b/recipes/libuv/all/conanfile.py @@ -1,10 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save +from conan.tools.microsoft import is_msvc, check_min_vs import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class LibuvConan(ConanFile): @@ -25,16 +26,8 @@ class LibuvConan(ConanFile): "fPIC": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -42,40 +35,49 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler == "Visual Studio": - if tools.Version(self.settings.compiler.version) < "14": - raise ConanInvalidConfiguration("Visual Studio 2015 or higher required") + if is_msvc(self): + check_min_vs(self, "190") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["LIBUV_BUILD_TESTS"] = False - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBUV_BUILD_TESTS"] = False + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("LICENSE-docs", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + for license_file in ["LICENSE", "LICENSE-docs"]: + copy(self, license_file, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -83,21 +85,20 @@ def package(self): {self._target_lib_name: "libuv::libuv"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property def _target_lib_name(self): diff --git a/recipes/libuv/all/patches/1.34.2/fix-cmake.patch b/recipes/libuv/all/patches/1.34.2/fix-cmake.patch deleted file mode 100644 index f763d9bfd56e9..0000000000000 --- a/recipes/libuv/all/patches/1.34.2/fix-cmake.patch +++ /dev/null @@ -1,87 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2ab6d17e..9292e6a2 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -365,38 +365,26 @@ if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD") - list(APPEND uv_test_libraries util) - endif() - --add_library(uv SHARED ${uv_sources}) -+add_library(uv ${uv_sources}) - target_compile_definitions(uv -- INTERFACE USING_UV_SHARED=1 -- PRIVATE ${uv_defines} BUILDING_UV_SHARED=1) -+ PRIVATE -+ ${uv_defines} -+) -+get_target_property(target_type uv TYPE) -+if (target_type STREQUAL "SHARED_LIBRARY") -+ target_compile_definitions(uv -+ INTERFACE -+ USING_UV_SHARED=1 -+ PRIVATE -+ BUILDING_UV_SHARED=1 -+ ) -+else() -+ set_property(TARGET uv PROPERTY OUTPUT_NAME "uv_a") -+endif() - target_compile_options(uv PRIVATE ${uv_cflags}) - target_include_directories(uv PUBLIC include PRIVATE src) - target_link_libraries(uv ${uv_libraries}) - --add_library(uv_a STATIC ${uv_sources}) --target_compile_definitions(uv_a PRIVATE ${uv_defines}) --target_compile_options(uv_a PRIVATE ${uv_cflags}) --target_include_directories(uv_a PUBLIC include PRIVATE src) --target_link_libraries(uv_a ${uv_libraries}) -- --if(LIBUV_BUILD_TESTS) -- add_executable(uv_run_tests ${uv_test_sources}) -- target_compile_definitions(uv_run_tests -- PRIVATE ${uv_defines} USING_UV_SHARED=1) -- target_compile_options(uv_run_tests PRIVATE ${uv_cflags}) -- target_link_libraries(uv_run_tests uv ${uv_test_libraries}) -- add_test(NAME uv_test -- COMMAND uv_run_tests -- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) -- add_executable(uv_run_tests_a ${uv_test_sources}) -- target_compile_definitions(uv_run_tests_a PRIVATE ${uv_defines}) -- target_compile_options(uv_run_tests_a PRIVATE ${uv_cflags}) -- target_link_libraries(uv_run_tests_a uv_a ${uv_test_libraries}) -- add_test(NAME uv_test_a -- COMMAND uv_run_tests_a -- WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) --endif() -- - if(UNIX) - # Now for some gibbering horrors from beyond the stars... - foreach(x ${uv_libraries}) -@@ -411,20 +399,18 @@ if(UNIX) - set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) - set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) - set(prefix ${CMAKE_INSTALL_PREFIX}) -- configure_file(libuv.pc.in ${CMAKE_CURRENT_BINARY_DIR}/libuv.pc @ONLY) - - install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -- install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libuv.pc -- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -- install(TARGETS uv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- install(TARGETS uv_a ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}/licenses) -+ install(TARGETS uv -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - - if(WIN32) - install(DIRECTORY include/ DESTINATION include) -- install(FILES LICENSE DESTINATION .) -- install(TARGETS uv uv_a -- RUNTIME DESTINATION lib/$ -- ARCHIVE DESTINATION lib/$) -+ install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}/licenses) -+ install(TARGETS uv -+ RUNTIME DESTINATION bin -+ ARCHIVE DESTINATION lib) - endif() diff --git a/recipes/libuv/all/patches/1.38.0/fix-cmake.patch b/recipes/libuv/all/patches/1.38.0/fix-cmake.patch deleted file mode 100644 index 031e64210b090..0000000000000 --- a/recipes/libuv/all/patches/1.38.0/fix-cmake.patch +++ /dev/null @@ -1,80 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 0496d36a..90615d57 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -298,13 +298,19 @@ if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD") - list(APPEND uv_test_libraries util) - endif() - --add_library(uv SHARED ${uv_sources}) --target_compile_definitions(uv -- INTERFACE -- USING_UV_SHARED=1 -- PRIVATE -- BUILDING_UV_SHARED=1 -- ${uv_defines}) -+add_library(uv ${uv_sources}) -+get_target_property(target_type uv TYPE) -+if (target_type STREQUAL "SHARED_LIBRARY") -+ target_compile_definitions(uv -+ INTERFACE -+ USING_UV_SHARED=1 -+ PRIVATE -+ BUILDING_UV_SHARED=1 -+ ) -+else() -+ set_property(TARGET uv PROPERTY OUTPUT_NAME "uv_a") -+endif() -+target_compile_definitions(uv PRIVATE ${uv_defines}) - target_compile_options(uv PRIVATE ${uv_cflags}) - target_include_directories(uv - PUBLIC -@@ -314,17 +320,6 @@ target_include_directories(uv - $) - target_link_libraries(uv ${uv_libraries}) - --add_library(uv_a STATIC ${uv_sources}) --target_compile_definitions(uv_a PRIVATE ${uv_defines}) --target_compile_options(uv_a PRIVATE ${uv_cflags}) --target_include_directories(uv_a -- PUBLIC -- $ -- $ -- PRIVATE -- $) --target_link_libraries(uv_a ${uv_libraries}) -- - if(LIBUV_BUILD_TESTS) - # Small hack: use ${uv_test_sources} now to get the runner skeleton, - # before the actual tests are added. -@@ -558,22 +553,20 @@ if(UNIX) - set(includedir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_INCLUDEDIR}) - set(libdir ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}) - set(prefix ${CMAKE_INSTALL_PREFIX}) -- configure_file(libuv.pc.in libuv.pc @ONLY) - - install(DIRECTORY include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -- install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR}) -- install(FILES ${PROJECT_BINARY_DIR}/libuv.pc -- DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) -- install(TARGETS uv LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) -- install(TARGETS uv_a ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}/licenses) -+ install(TARGETS uv -+ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} -+ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endif() - - if(WIN32) - install(DIRECTORY include/ DESTINATION include) -- install(FILES LICENSE DESTINATION .) -- install(TARGETS uv uv_a -- RUNTIME DESTINATION lib/$ -- ARCHIVE DESTINATION lib/$) -+ install(FILES LICENSE DESTINATION ${CMAKE_INSTALL_PREFIX}/licenses) -+ install(TARGETS uv -+ RUNTIME DESTINATION bin -+ ARCHIVE DESTINATION lib) - endif() - - message(STATUS "summary of build options: diff --git a/recipes/libuv/all/patches/1.44.2/fix-cmake.patch b/recipes/libuv/all/patches/1.44.2/fix-cmake.patch new file mode 100644 index 0000000000000..8bae960541ddc --- /dev/null +++ b/recipes/libuv/all/patches/1.44.2/fix-cmake.patch @@ -0,0 +1,49 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7f46682..3477beb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -388,13 +388,18 @@ if(APPLE OR CMAKE_SYSTEM_NAME MATCHES "DragonFly|FreeBSD|Linux|NetBSD|OpenBSD") + list(APPEND uv_test_libraries util) + endif() + +-add_library(uv SHARED ${uv_sources}) ++add_library(uv ${uv_sources}) ++if(BUILD_SHARED_LIBS) + target_compile_definitions(uv + INTERFACE + USING_UV_SHARED=1 + PRIVATE + BUILDING_UV_SHARED=1 + ${uv_defines}) ++else() ++ set_property(TARGET uv PROPERTY OUTPUT_NAME "uv_a") ++ target_compile_definitions(uv PRIVATE ${uv_defines}) ++endif() + target_compile_options(uv PRIVATE ${uv_cflags}) + target_include_directories(uv + PUBLIC +@@ -408,6 +413,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OS390") + endif() + target_link_libraries(uv ${uv_libraries}) + ++if(0) + add_library(uv_a STATIC ${uv_sources}) + target_compile_definitions(uv_a PRIVATE ${uv_defines}) + target_compile_options(uv_a PRIVATE ${uv_cflags}) +@@ -422,6 +428,7 @@ if(CMAKE_SYSTEM_NAME STREQUAL "OS390") + set_target_properties(uv_a PROPERTIES LINKER_LANGUAGE CXX) + endif() + target_link_libraries(uv_a ${uv_libraries}) ++endif() + + if(LIBUV_BUILD_TESTS) + # Small hack: use ${uv_test_sources} now to get the runner skeleton, +@@ -685,8 +692,6 @@ install(TARGETS uv EXPORT libuvConfig + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +-install(TARGETS uv_a EXPORT libuvConfig +- ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(EXPORT libuvConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/libuv) + + if(MSVC) diff --git a/recipes/libuv/all/test_package/CMakeLists.txt b/recipes/libuv/all/test_package/CMakeLists.txt index 5299beae70163..582a892fd9c5b 100644 --- a/recipes/libuv/all/test_package/CMakeLists.txt +++ b/recipes/libuv/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libuv REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) if(TARGET uv_a) - target_link_libraries(${PROJECT_NAME} uv_a) + target_link_libraries(${PROJECT_NAME} PRIVATE uv_a) else() - target_link_libraries(${PROJECT_NAME} uv) + target_link_libraries(${PROJECT_NAME} PRIVATE uv) endif() diff --git a/recipes/libuv/all/test_package/conanfile.py b/recipes/libuv/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/libuv/all/test_package/conanfile.py +++ b/recipes/libuv/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libuv/all/test_v1_package/CMakeLists.txt b/recipes/libuv/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..cc50e3b1333c0 --- /dev/null +++ b/recipes/libuv/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(libuv REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +if(TARGET uv_a) + target_link_libraries(${PROJECT_NAME} PRIVATE uv_a) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE uv) +endif() diff --git a/recipes/libuv/all/test_v1_package/conanfile.py b/recipes/libuv/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libuv/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libuv/config.yml b/recipes/libuv/config.yml index 8a3012b477079..cc83d80cfe19b 100644 --- a/recipes/libuv/config.yml +++ b/recipes/libuv/config.yml @@ -1,19 +1,17 @@ versions: - "1.34.2": + "1.44.2": folder: all - "1.38.0": - folder: all - "1.38.1": + "1.44.1": folder: all - "1.40.0": + "1.43.0": folder: all - "1.41.0": + "1.42.0": folder: all "1.41.1": folder: all - "1.42.0": + "1.41.0": folder: all - "1.43.0": + "1.40.0": folder: all - "1.44.1": + "1.38.1": folder: all diff --git a/recipes/libuvc/all/CMakeLists.txt b/recipes/libuvc/all/CMakeLists.txt deleted file mode 100644 index c986d294c7547..0000000000000 --- a/recipes/libuvc/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libuvc/all/conandata.yml b/recipes/libuvc/all/conandata.yml index 2a11d1f42776b..080f9c58fdbad 100644 --- a/recipes/libuvc/all/conandata.yml +++ b/recipes/libuvc/all/conandata.yml @@ -4,7 +4,9 @@ sources: sha256: "42175a53c1c704365fdc782b44233925e40c9344fbb7f942181c1090f06e2873" patches: "0.0.6": - - patch_file: "patches/0001-adjust-libusb.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-adjust-libusb-libjpeg.patch" + patch_description: "Robust discovery and injection of libusb & libjpeg" + patch_type: "conan" - patch_file: "patches/0002-adjust-install-folder.patch" - base_path: "source_subfolder" + patch_description: "Install to standard layout" + patch_type: "conan" diff --git a/recipes/libuvc/all/conanfile.py b/recipes/libuvc/all/conanfile.py index 3dc2f88c2a0c9..17b10736856bf 100644 --- a/recipes/libuvc/all/conanfile.py +++ b/recipes/libuvc/all/conanfile.py @@ -1,14 +1,19 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibuvcConan(ConanFile): name = "libuvc" description = "A cross-platform library for USB video devices" - topics = ("libuvc", "libusb", "usb", "video") + topics = ("libusb", "usb", "video") license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/libuvc/libuvc" @@ -17,33 +22,18 @@ class LibuvcConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "jpeg_turbo": [True, False], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], + "jpeg_turbo": [True, False, "deprecated"], } default_options = { "shared": False, "fPIC": True, - "jpeg_turbo": False, + "with_jpeg": "libjpeg", + "jpeg_turbo": "deprecated", } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,55 +41,90 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + # TODO: to remove once deprecated jpeg_turbo option removed + if self.options.jpeg_turbo != "deprecated": + self.output.warning("jpeg_turbo option is deprecated, please use with_jpeg option instead") + if self.options.jpeg_turbo: + self.options.with_jpeg == "libjpeg-turbo" + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libusb/1.0.24") - if self.options.jpeg_turbo: - self.requires("libjpeg-turbo/2.1.2") - else: - self.requires("libjpeg/9d") + self.requires("libusb/1.0.26") + if self.options.with_jpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.with_jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") + + def package_id(self): + # TODO: to remove once deprecated jpeg_turbo option removed + del self.info.options.jpeg_turbo def validate(self): - if self._is_msvc: + if is_msvc(self): # Upstream issues, e.g.: # https://github.com/libuvc/libuvc/issues/100 # https://github.com/libuvc/libuvc/issues/105 raise ConanInvalidConfiguration("libuvc is not compatible with Visual Studio.") + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + + tc = CMakeToolchain(self) + tc.variables["CMAKE_BUILD_TARGET"] = "Shared" if self.options.shared else "Static" + tc.variables["LIBUVC_WITH_JPEG"] = bool(self.options.with_jpeg) + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["CMAKE_BUILD_TARGET"] = "Shared" if self.options.shared else "Static" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + CMakeDeps(self).generate() + PkgConfigDeps(self).generate() + # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) + env = Environment() + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + env.vars(self).save_script("conanbuildenv_pkg_config_path") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): cmake_target = "UVCShared" if self.options.shared else "UVCStatic" self.cpp_info.set_property("cmake_file_name", "libuvc") - self.cpp_info.set_property("cmake_target_name", "LibUVC::{}".format(cmake_target)) + self.cpp_info.set_property("cmake_target_name", f"LibUVC::{cmake_target}") self.cpp_info.set_property("pkg_config_name", "libuvc") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["_libuvc"].libs = tools.collect_libs(self) + self.cpp_info.components["_libuvc"].libs = ["uvc"] + self.cpp_info.components["_libuvc"].requires = ["libusb::libusb"] + if self.options.with_jpeg == "libjpeg": + self.cpp_info.components["_libuvc"].requires.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + self.cpp_info.components["_libuvc"].requires.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + self.cpp_info.components["_libuvc"].requires.append("mozjpeg::libjpeg") # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "libuvc" @@ -108,9 +133,5 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "LibUVC" self.cpp_info.components["_libuvc"].names["cmake_find_package"] = cmake_target self.cpp_info.components["_libuvc"].names["cmake_find_package_multi"] = cmake_target - self.cpp_info.components["_libuvc"].set_property("cmake_target_name", "LibUVC::{}".format(cmake_target)) + self.cpp_info.components["_libuvc"].set_property("cmake_target_name", f"LibUVC::{cmake_target}") self.cpp_info.components["_libuvc"].set_property("pkg_config_name", "libuvc") - self.cpp_info.components["_libuvc"].requires = [ - "libusb::libusb", - "libjpeg-turbo::libjpeg-turbo" if self.options.jpeg_turbo else "libjpeg::libjpeg" - ] diff --git a/recipes/libuvc/all/patches/0001-adjust-libusb-libjpeg.patch b/recipes/libuvc/all/patches/0001-adjust-libusb-libjpeg.patch new file mode 100644 index 0000000000000..7becb18ff92a3 --- /dev/null +++ b/recipes/libuvc/all/patches/0001-adjust-libusb-libjpeg.patch @@ -0,0 +1,63 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -19,13 +19,16 @@ set(libuvc_VERSION ${libuvc_VERSION_MAJOR}.${libuvc_VERSION_MINOR}.${libuvc_VERS + set(libuvc_DESCRIPTION "A cross-platform library for USB video devices") + set(libuvc_URL "https://github.com/ktossell/libuvc") + +-find_package(PkgConfig) ++find_package(PkgConfig REQUIRED) + pkg_check_modules(LIBUSB libusb-1.0) ++link_directories(${LIBUSB_LIBRARY_DIRS}) + + # Try to find JPEG using a module or pkg-config. If that doesn't work, search for the header. +-find_package(jpeg QUIET) +-if(JPEG_FOUND) +- set(JPEG_LINK_FLAGS ${JPEG_LIBRARIES}) ++option(LIBUVC_WITH_JPEG "Support JPEG decoding" ON) ++if(LIBUVC_WITH_JPEG) ++find_package(JPEG REQUIRED) ++if(1) ++ set(JPEG_LINK_FLAGS JPEG::JPEG) + else() + pkg_check_modules(JPEG QUIET libjpeg) + if(JPEG_FOUND) +@@ -39,6 +42,7 @@ else() + endif() + endif() + endif() ++endif() + + include(GNUInstallDirs) + +@@ -57,7 +61,7 @@ include_directories( + ${LIBUSB_INCLUDE_DIRS} + ) + +-if(JPEG_FOUND) ++if(LIBUVC_WITH_JPEG) + message(STATUS "Building libuvc with JPEG support.") + include_directories(${JPEG_INCLUDE_DIR}) + SET(LIBUVC_HAS_JPEG TRUE) +@@ -84,6 +88,10 @@ endif() + + if(BUILD_UVC_STATIC) + add_library(uvc_static STATIC ${SOURCES}) ++ target_link_libraries(uvc_static ${LIBUSB_LIBRARIES}) ++ if(LIBUVC_WITH_JPEG) ++ target_link_libraries(uvc_static ${JPEG_LINK_FLAGS}) ++ endif() + set_target_properties(uvc_static PROPERTIES OUTPUT_NAME uvc) + list(APPEND UVC_TARGETS uvc_static) + endif() +@@ -97,9 +105,9 @@ foreach(target_name ${UVC_TARGETS}) + endforeach() + + if(BUILD_UVC_SHARED) +- if(JPEG_FOUND) ++ if(LIBUVC_WITH_JPEG) + target_link_libraries (uvc ${JPEG_LINK_FLAGS}) +- endif(JPEG_FOUND) ++ endif() + + target_link_libraries(uvc ${LIBUSB_LIBRARIES}) + diff --git a/recipes/libuvc/all/patches/0001-adjust-libusb.patch b/recipes/libuvc/all/patches/0001-adjust-libusb.patch deleted file mode 100644 index 24c0fe99c85a7..0000000000000 --- a/recipes/libuvc/all/patches/0001-adjust-libusb.patch +++ /dev/null @@ -1,51 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a19209d..581a308 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -19,26 +19,9 @@ set(libuvc_VERSION ${libuvc_VERSION_MAJOR}.${libuvc_VERSION_MINOR}.${libuvc_VERS - set(libuvc_DESCRIPTION "A cross-platform library for USB video devices") - set(libuvc_URL "https://github.com/ktossell/libuvc") - --find_package(PkgConfig) --pkg_check_modules(LIBUSB libusb-1.0) -- - # Try to find JPEG using a module or pkg-config. If that doesn't work, search for the header. --find_package(jpeg QUIET) --if(JPEG_FOUND) -- set(JPEG_LINK_FLAGS ${JPEG_LIBRARIES}) --else() -- pkg_check_modules(JPEG QUIET libjpeg) -- if(JPEG_FOUND) -- set(JPEG_INCLUDE_DIR ${JPEG_INCLUDE_DIRS}) -- set(JPEG_LINK_FLAGS ${JPEG_LDFLAGS}) -- else() -- find_path(JPEG_INCLUDE_DIR jpeglib.h) -- if(JPEG_INCLUDE_DIR) -- set(JPEG_FOUND ON) -- set(JPEG_LINK_FLAGS -ljpeg) -- endif() -- endif() --endif() -+find_package(JPEG QUIET) -+set(JPEG_LINK_FLAGS ${JPEG_LIBRARIES}) - - include(GNUInstallDirs) - -@@ -54,7 +37,7 @@ SET(SOURCES src/ctrl.c src/ctrl-gen.c src/device.c src/diag.c - include_directories( - ${libuvc_SOURCE_DIR}/include - ${libuvc_BINARY_DIR}/include -- ${LIBUSB_INCLUDE_DIRS} -+ ${CONAN_INCLUDE_DIRS_LIBUSB} - ) - - if(JPEG_FOUND) -@@ -101,7 +84,7 @@ if(BUILD_UVC_SHARED) - target_link_libraries (uvc ${JPEG_LINK_FLAGS}) - endif(JPEG_FOUND) - -- target_link_libraries(uvc ${LIBUSB_LIBRARIES}) -+ target_link_libraries(uvc ${CONAN_LIBS_LIBUSB}) - - #add_executable(test src/test.c) - #target_link_libraries(test uvc ${LIBUSB_LIBRARIES} opencv_highgui diff --git a/recipes/libuvc/all/patches/0002-adjust-install-folder.patch b/recipes/libuvc/all/patches/0002-adjust-install-folder.patch index 6f0177f681d0a..aa773f521427f 100644 --- a/recipes/libuvc/all/patches/0002-adjust-install-folder.patch +++ b/recipes/libuvc/all/patches/0002-adjust-install-folder.patch @@ -1,16 +1,16 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 581a308..c3ccfa2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt -@@ -93,8 +93,9 @@ endif() +@@ -118,9 +118,10 @@ endif() install(TARGETS ${UVC_TARGETS} EXPORT libuvcTargets - LIBRARY DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}" - ARCHIVE DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/${CMAKE_LIBRARY_ARCHITECTURE}" -+ LIBRARY DESTINATION "lib" -+ ARCHIVE DESTINATION "lib" -+ RUNTIME DESTINATION "bin" - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include/libuvc" +- PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_PREFIX}/include/libuvc" ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/libuvc ) + export(TARGETS ${UVC_TARGETS} diff --git a/recipes/libuvc/all/test_package/CMakeLists.txt b/recipes/libuvc/all/test_package/CMakeLists.txt index 014804b013c2d..ff4548b24f295 100644 --- a/recipes/libuvc/all/test_package/CMakeLists.txt +++ b/recipes/libuvc/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libuvc REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) if(TARGET LibUVC::UVCShared) - target_link_libraries(${PROJECT_NAME} LibUVC::UVCShared) + target_link_libraries(${PROJECT_NAME} PRIVATE LibUVC::UVCShared) else() - target_link_libraries(${PROJECT_NAME} LibUVC::UVCStatic) + target_link_libraries(${PROJECT_NAME} PRIVATE LibUVC::UVCStatic) endif() diff --git a/recipes/libuvc/all/test_package/conanfile.py b/recipes/libuvc/all/test_package/conanfile.py index 38f4483872d47..98ab55852ad56 100644 --- a/recipes/libuvc/all/test_package/conanfile.py +++ b/recipes/libuvc/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libuvc/all/test_v1_package/CMakeLists.txt b/recipes/libuvc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libuvc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libuvc/all/test_v1_package/conanfile.py b/recipes/libuvc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libuvc/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libvault/all/conandata.yml b/recipes/libvault/all/conandata.yml index 5646346e0f5b5..c828fc89b0560 100644 --- a/recipes/libvault/all/conandata.yml +++ b/recipes/libvault/all/conandata.yml @@ -1,8 +1,23 @@ sources: + "0.52.0": + url: "https://github.com/abedra/libvault/archive/refs/tags/0.52.0.zip" + sha256: 49058ac9a1d3d1d08ac165f5f7b50e3a2a2ab0d3f9b8bb8194fa7a8de36edcf8 + "0.51.0": + url: "https://github.com/abedra/libvault/archive/refs/tags/0.51.0.zip" + sha256: 570ccc6451cf8e93b1c585bbf6ab5212ff9290b3a9b477752cf0651414b3d026 "0.48.0": url: "https://github.com/abedra/libvault/archive/0.48.0.zip" sha256: 0a42be282ff0aff77b68cb7238014aa762df5c6b62e4d3561878874ca3760489 patches: + "0.52.0": + - patch_file: "patches/fix-cmake-0.51.0.patch" + patch_type: "conan" + patch_description: "use libcurl from conan center" + "0.51.0": + - patch_file: "patches/fix-cmake-0.51.0.patch" + patch_type: "conan" + patch_description: "use libcurl from conan center" "0.48.0": - patch_file: "patches/fix-cmake-0.48.0.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "use libcurl from conan center" diff --git a/recipes/libvault/all/conanfile.py b/recipes/libvault/all/conanfile.py index ef41067c87862..659305c5f732b 100644 --- a/recipes/libvault/all/conanfile.py +++ b/recipes/libvault/all/conanfile.py @@ -1,9 +1,15 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version import os -required_conan_version = ">=1.33.0" +from conan import ConanFile, Version +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime + +required_conan_version = ">=1.53.0" class LibvaultConan(ConanFile): @@ -15,20 +21,9 @@ class LibvaultConan(ConanFile): topics = ("vault", "libvault", "secrets", "passwords") settings = "os", "arch", "compiler", "build_type" exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake", "cmake_find_package" options = {"shared": [True, False], "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True} - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _mac_os_minimum_required_version(self): return "10.15" @@ -39,75 +34,84 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - self.requires("libcurl/7.80.0") - self.requires("catch2/2.13.7") + self.requires("libcurl/7.86.0") + self.requires("catch2/3.2.0") def validate(self): - compiler = str(self.settings.compiler) + compiler = str(self.info.settings.compiler) compiler_version = Version(self.settings.compiler.version.value) minimum_compiler_version = { "Visual Studio": "19", "gcc": "8", "clang": "7.0", - "apple-clang": "12" + "apple-clang": "12", } minimum_cpp_standard = 17 if compiler in minimum_compiler_version and \ compiler_version < minimum_compiler_version[compiler]: - raise ConanInvalidConfiguration("{} requires a compiler that supports" - " at least C++{}. {} {} is not" - " supported." - .format(self.name, minimum_cpp_standard, compiler, compiler_version)) + raise ConanInvalidConfiguration( + f"{self.name} requires a compiler that supports at least C++{minimum_cpp_standard}. " + f"{compiler} {compiler_version} is not supported.") if compiler == "clang" and self.settings.compiler.libcxx in ["libstdc++", "libstdc++11"] and self.settings.compiler.version == "11": raise ConanInvalidConfiguration("clang 11 with libstdc++ is not supported due to old libstdc++ missing C++17 support") - if tools.is_apple_os(self.settings.os): - os_version = self.settings.get_safe("os.version") + if is_apple_os(self): + os_version = self.info.settings.get_safe("os.version") if os_version and Version(os_version) < self._mac_os_minimum_required_version: raise ConanInvalidConfiguration( "Macos Mojave (10.14) and earlier cannot to be built because C++ standard library too old.") if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, minimum_cpp_standard) + check_min_cppstd(self, minimum_cpp_standard) def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_TEST"] = False - self._cmake.definitions["ENABLE_INTEGRATION_TEST"] = False - self._cmake.definitions["ENABLE_COVERAGE"] = False - self._cmake.definitions["LINK_CURL"] = False - # Set `-mmacosx-version-min` to enable C++17 standard library support. - self._cmake.definitions['CMAKE_OSX_DEPLOYMENT_TARGET'] = self._mac_os_minimum_required_version - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_TEST"] = "OFF" + tc.variables["ENABLE_INTEGRATION_TEST"] = "OFF" + tc.variables["ENABLE_COVERAGE"] = "OFF" + tc.variables["LINK_CURL"] = "OFF" + tc.variables["CMAKE_OSX_DEPLOYMENT_TARGET"] = self._mac_os_minimum_required_version + if is_msvc(self): + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + tc = CMakeDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate(scope="build") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=self.build_folder) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["vault"] + self.cpp_info.system_libs = ["m"] + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == "8": + self.cpp_info.system_libs.append("stdc++fs") + # TODO: Remove after Conan 2.0 self.cpp_info.names["cmake_find_package"] = "libvault" self.cpp_info.names["cmake_find_package_multi"] = "libvault" - self.cpp_info.names["pkg_config"] = "vault" + + self.cpp_info.set_property("pkg_config_name", "vault") + self.cpp_info.set_property("cmake_file_name", "libvault") + self.cpp_info.set_property("cmake_target_name", "libvault::libvault") diff --git a/recipes/libvault/all/patches/fix-cmake-0.51.0.patch b/recipes/libvault/all/patches/fix-cmake-0.51.0.patch new file mode 100644 index 0000000000000..74ce9e72d06db --- /dev/null +++ b/recipes/libvault/all/patches/fix-cmake-0.51.0.patch @@ -0,0 +1,49 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -13,13 +13,6 @@ option(LINK_CURL "Link curl library for vault" OFF) + option(BUILD_SHARED_LIBS "Build vault as a shared library" ON) + option(INSTALL "Run install targets" ON) + +-find_package(CURL) +-if (CURL_FOUND) +- include_directories(${CURL_INCLUDE_DIR}) +-else (CURL_FOUND) +- message(FATAL_ERROR "CURL not found") +-endif (CURL_FOUND) +- + include(GNUInstallDirs) + include_directories("${PROJECT_SOURCE_DIR}/lib") + +@@ -119,6 +112,14 @@ set_target_properties(vault PROPERTIES + + target_include_directories(vault PRIVATE src) + ++OPTION(UseCurl "UseCurl" ON) ++IF (UseCurl) ++ FIND_PACKAGE(CURL) ++ IF (CURL_FOUND) ++ target_link_libraries(vault CURL::libcurl) ++ ENDIF() ++ENDIF() ++ + if(LINK_CURL) + target_link_libraries(vault curl) + endif(LINK_CURL) +@@ -155,7 +156,7 @@ if (INSTALL) + "${CMAKE_CURRENT_BINARY_DIR}/libvaultConfigVersion.cmake" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/libvault") + +- configure_file(vault.pc.in vault.pc @ONLY) ++ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/vault.pc.in" "${CMAKE_CURRENT_BINARY_DIR}/vault.pc" @ONLY) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}.pc" + DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig") + endif (INSTALL) +@@ -176,7 +177,7 @@ if (ENABLE_TEST) + target_include_directories(libvault_test PRIVATE include) + + target_link_libraries(libvault_test vault) +- target_link_libraries(libvault_test curl) ++ target_link_libraries(libvault_test CURL::libcurl) + target_link_libraries(libvault_test Catch2::Catch2) + target_link_libraries(libvault_test stdc++fs) + diff --git a/recipes/libvault/all/test_package/CMakeLists.txt b/recipes/libvault/all/test_package/CMakeLists.txt index 6212070aaadca..265e54ec6a967 100644 --- a/recipes/libvault/all/test_package/CMakeLists.txt +++ b/recipes/libvault/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package CXX) -find_package(Libvault CONFIG REQUIRED) +find_package(libvault REQUIRED CONFIG) -add_executable(example example.cpp) -set_property(TARGET example PROPERTY CXX_STANDARD 17) -target_link_libraries(example libvault::libvault) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE libvault::libvault) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/libvault/all/test_package/conanfile.py b/recipes/libvault/all/test_package/conanfile.py index 8e0bfa461006e..a9fb96656f203 100644 --- a/recipes/libvault/all/test_package/conanfile.py +++ b/recipes/libvault/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -class LibvaultTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "example"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libvault/all/test_package/example.cpp b/recipes/libvault/all/test_package/example.cpp deleted file mode 100644 index 3de7dd336eb27..0000000000000 --- a/recipes/libvault/all/test_package/example.cpp +++ /dev/null @@ -1,6 +0,0 @@ -#include - -int main() -{ - Vault::Config config = Vault::ConfigBuilder().build(); -} diff --git a/recipes/libvault/all/test_package/test_package.cpp b/recipes/libvault/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..354d2b5a580fe --- /dev/null +++ b/recipes/libvault/all/test_package/test_package.cpp @@ -0,0 +1,7 @@ +#include +#include + +int main(void) { + Vault::Config config = Vault::ConfigBuilder().build(); + return EXIT_SUCCESS; +} diff --git a/recipes/libvault/all/test_v1_package/CMakeLists.txt b/recipes/libvault/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libvault/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libvault/all/test_v1_package/conanfile.py b/recipes/libvault/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/libvault/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libvault/config.yml b/recipes/libvault/config.yml index a29852ac38277..327b1962634e5 100644 --- a/recipes/libvault/config.yml +++ b/recipes/libvault/config.yml @@ -1,3 +1,7 @@ versions: + "0.52.0": + folder: "all" + "0.51.0": + folder: "all" "0.48.0": folder: "all" diff --git a/recipes/libverto/all/conanfile.py b/recipes/libverto/all/conanfile.py index 8e6ade5b45b3c..9347e6ebb09e5 100644 --- a/recipes/libverto/all/conanfile.py +++ b/recipes/libverto/all/conanfile.py @@ -1,10 +1,15 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import contextlib +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.files import copy, get, rm, rmdir, export_conandata_patches, apply_conandata_patches +from conan.tools.env import VirtualBuildEnv +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.microsoft import is_msvc +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class LibVertoConan(ConanFile): @@ -36,14 +41,7 @@ class LibVertoConan(ConanFile): } settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/*" - generators = "pkg_config" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + @property def _settings_build(self): @@ -58,6 +56,9 @@ def _backend_dict(self): "tevent": self.options.with_tevent, } + def layout(self): + basic_layout(self, src_folder="src") + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -71,7 +72,7 @@ def configure(self): del self.settings.compiler.cppstd def validate(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): raise ConanInvalidConfiguration("libverto does not support Visual Studio") if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("Shared libraries are not supported on Windows") @@ -90,13 +91,15 @@ def validate(self): if count_builtins > 0 and count_externals > 0: raise ConanInvalidConfiguration("Cannot combine builtin and external backends") + def export_sources(self): + export_conandata_patches(self) + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def requirements(self): if self.options.with_glib: - self.requires("glib/2.69.2") + self.requires("glib/2.75.2") if self.options.with_libevent: self.requires("libevent/2.1.12") if self.options.with_libev: @@ -106,62 +109,46 @@ def requirements(self): raise ConanInvalidConfiguration("tevent is not (yet) available on conan-center") def build_requirements(self): - self.build_requires("pkgconf/1.7.4") - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "CXX": "{} cl -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "LD": "{} link -nologo".format(tools.unix_path(self.deps_user_info["automake"].compile)), - "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)), - } - with tools.environment_append(env): - yield - else: - yield - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" yes_no_builtin = lambda v: {"external": "yes", "False": "no", "builtin": "builtin"}[str(v)] - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--with-pthread={}".format(yes_no(self.options.get_safe("pthread", False))), - "--with-glib={}".format(yes_no_builtin(self.options.with_glib)), - "--with-libev={}".format(yes_no_builtin(self.options.with_libev)), - "--with-libevent={}".format(yes_no_builtin(self.options.with_libevent)), - "--with-tevent={}".format(yes_no_builtin(self.options.with_tevent)), - ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + tc.configure_args.extend([ + f"--with-pthread={yes_no(self.options.get_safe('pthread'))}", + f"--with-glib={yes_no_builtin(self.options.with_glib)}", + f"--with-libev={yes_no_builtin(self.options.with_libev)}", + f"--with-libevent={yes_no_builtin(self.options.with_libevent)}", + f"--with-tevent={yes_no_builtin(self.options.with_tevent)}", + ]) + tc.generate() + pkg = PkgConfigDeps(self) + pkg.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True, win_bash=tools.os_info.is_windows) - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() + copy(self,"COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) def package_id(self): del self.info.options.default diff --git a/recipes/libverto/all/test_package/CMakeLists.txt b/recipes/libverto/all/test_package/CMakeLists.txt index 7b9b613cbb24a..dfb9e5fed1c58 100644 --- a/recipes/libverto/all/test_package/CMakeLists.txt +++ b/recipes/libverto/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libverto REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libverto::libverto) diff --git a/recipes/libverto/all/test_package/conanfile.py b/recipes/libverto/all/test_package/conanfile.py index 8ceb9511ce02d..d8015e06ab4e8 100644 --- a/recipes/libverto/all/test_package/conanfile.py +++ b/recipes/libverto/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,9 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") for impl in self.deps_user_info["libverto"].backends.split(","): - self.run("{} {}".format(bin_path, impl), run_environment=True) - + self.run("{} {}".format(bin_path, impl), env="conanrun") diff --git a/recipes/libverto/all/test_v1_package/CMakeLists.txt b/recipes/libverto/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libverto/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libverto/all/test_v1_package/conanfile.py b/recipes/libverto/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c00625cfbfccc --- /dev/null +++ b/recipes/libverto/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + + for impl in self.deps_user_info["libverto"].backends.split(","): + self.run("{} {}".format(bin_path, impl), run_environment=True) diff --git a/recipes/libvpx/all/conandata.yml b/recipes/libvpx/all/conandata.yml index 16a335bc9457b..a64c42db322ce 100644 --- a/recipes/libvpx/all/conandata.yml +++ b/recipes/libvpx/all/conandata.yml @@ -11,12 +11,16 @@ sources: patches: "1.11.0": - patch_file: "patches/0001-extended-support-1.10.0.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Add support for more compilers" "1.10.0": - patch_file: "patches/0001-extended-support-1.10.0.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Add support for more compilers" "1.9.0": - patch_file: "patches/0001-extended-support-1.9.0.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Add support for more compilers" - patch_file: "patches/0002-msvc_conan_build.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Add support for more compilers" diff --git a/recipes/libvpx/all/conanfile.py b/recipes/libvpx/all/conanfile.py index 4c8ca454f41e5..8017b7ecf274e 100644 --- a/recipes/libvpx/all/conanfile.py +++ b/recipes/libvpx/all/conanfile.py @@ -1,12 +1,17 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conan.tools.microsoft.visual import msvc_version_to_vs_ide_version -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, replace_in_file, rename +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, VCVars, unix_path, msvc_runtime_flag +from conan.tools.scm import Version +from conan.tools.build import stdcpp_library import os import re -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class LibVPXConan(ConanFile): @@ -14,7 +19,7 @@ class LibVPXConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.webmproject.org/code" description = "WebM VP8/VP9 Codec SDK" - topics = ("vpx", "codec", "web", "VP8", "VP9") + topics = "vpx", "codec", "web", "VP8", "VP9" license = "BSD-3-Clause" settings = "os", "arch", "compiler", "build_type" @@ -33,16 +38,11 @@ class LibVPXConan(ConanFile): default_options.update({name: 'avx' not in name for name in _arch_options}) @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == 'Windows': @@ -53,67 +53,99 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("Windows shared builds are not supported") if str(self.settings.compiler) not in ["Visual Studio", "msvc", "gcc", "clang", "apple-clang"]: - raise ConanInvalidConfiguration("Unsupported compiler {}.".format(self.settings.compiler)) - if self.settings.os == "Macos" and self.settings.arch == "armv8" and tools.Version(self.version) < "1.10.0": + raise ConanInvalidConfiguration(f"Unsupported compiler {self.settings.compiler}") + if self.settings.os == "Macos" and self.settings.arch == "armv8" and Version(self.version) < "1.10.0": raise ConanInvalidConfiguration("M1 only supported since 1.10, please upgrade") - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + def layout(self): + basic_layout(self, src_folder="src") + + # libvpx configure is unusual and requires a workaround, otherwise it will fail with an error. + # look for "output_goes_here" below for more in this thread. + self.cpp.package.bindirs = [] + self.cpp.package.includedirs = [] + self.cpp.package.libdirs = [] # not strictly necessary, but lets do all as a group def build_requirements(self): - self.build_requires("yasm/1.3.0") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("yasm/1.3.0") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # relocatable shared lib on macOS - tools.replace_in_file(os.path.join(self._source_subfolder, "build", "make", "Makefile"), - "-dynamiclib", - "-dynamiclib -install_name @rpath/$$(LIBVPX_SO)") - # Disable LTO for Visual Studio when CFLAGS doesn't contain -GL - if self._is_msvc: - lto = any(re.finditer("(^| )[/-]GL($| )", tools.get_env("CFLAGS", ""))) - if not lto: - tools.replace_in_file( - os.path.join(self._source_subfolder, "build", "make", "gen_msvs_vcxproj.sh"), - "tag_content WholeProgramOptimization true", - "tag_content WholeProgramOptimization false", - ) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() - @functools.lru_cache(1) - def _configure_autotools(self): - args = [ - "--prefix={}".format(tools.unix_path(self.package_folder)), + tc = AutotoolsToolchain(self) + + if is_apple_os(self) and self.settings.get_safe("compiler.libcxx") == "libc++": + # special case, as gcc/g++ is hard-coded in makefile, it implicitly assumes -lstdc++ +# FIXME what to do + tc.extra_ldflags.append("-stdlib=libc++") + + env = Environment() + + if is_msvc(self): + # gen_msvs_vcxproj.sh doesn't like custom flags + env.define("CC", "") + # FIXME can we leave these alone? + # env.define("CFLAGS", "") + # env.define("CXXFLAGS", "") + + tc.generate(env=env) + + if is_msvc(self): + tc = VCVars(self) + tc.generate() + + + # libvpx's configure script is not a standard autotools script, + # and doesn't support some parameters like --host --build and --prefix=/ + # so we will avoid using conan's configure() call generator and run our own. + def _execute_configure(self): + configure_args = [unix_path(self,os.path.join(self.source_folder, "configure"))] + + if self.options.shared: + configure_args.extend(["--enable-shared", "--disable-static"]) + else: + configure_args.extend(["--disable-shared", "--enable-static"]) + + # Note the output_goes_here workaround, libvpx does not like --prefix=/ + # as it fails the test for "libdir must be a subfolder of prefix" + # libvpx src/build/make/configure.sh:683 + configure_args.extend([ + "--prefix=/output_goes_here", + "--libdir=/output_goes_here/lib", "--disable-examples", "--disable-unit-tests", "--disable-tools", "--disable-docs", "--enable-vp9-highbitdepth", "--as=yasm", - ] - if self.options.shared: - args.extend(['--disable-static', '--enable-shared']) - else: - args.extend(['--disable-shared', '--enable-static']) - if self.settings.os != 'Windows' and self.options.get_safe("fPIC", True): - args.append('--enable-pic') + ]) + + # Note for MSVC: release libs are always built, we just avoid keeping the release lib + # Note2: Can't use --enable-debug_libs (to help install on Windows), + # the makefile's install step fails as it wants to install a library that doesn't exist. + # Instead, we will copy the desired library manually in the package step. if self.settings.build_type == "Debug": - args.append('--enable-debug') - if self._is_msvc and "MT" in msvc_runtime_flag(self): - args.append('--enable-static-msvcrt') + configure_args.extend([ + # "--enable-debug_libs", + "--enable-debug", + ]) + + if is_msvc(self) and "MT" in msvc_runtime_flag(self): + configure_args.append('--enable-static-msvcrt') arch = {'x86': 'x86', 'x86_64': 'x86_64', @@ -122,19 +154,20 @@ def _configure_autotools(self): 'mips': 'mips32', 'mips64': 'mips64', 'sparc': 'sparc'}.get(str(self.settings.arch)) - if self._is_msvc: - if self.settings.compiler == "Visual Studio": - vc_version = self.settings.compiler.version - else: - vc_version = msvc_version_to_vs_ide_version(self.settings.compiler.version) - compiler = "vs{}".format(vc_version) + if self.settings.compiler == "Visual Studio": + vc_version = self.settings.compiler.version + compiler = f"vs{vc_version}" + elif is_msvc(self): + vc_version = str(self.settings.compiler.version) + vc_version = {"170": "11", "180": "12", "190": "14", "191": "15", "192": "16", "193": "17"}[vc_version] + compiler = f"vs{vc_version}" elif self.settings.compiler in ["gcc", "clang", "apple-clang"]: compiler = 'gcc' host_os = str(self.settings.os) if host_os == 'Windows': os_name = 'win32' if self.settings.arch == 'x86' else 'win64' - elif tools.is_apple_os(host_os): + elif is_apple_os(self): if self.settings.arch in ["x86", "x86_64"]: os_name = 'darwin11' elif self.settings.arch == "armv8" and self.settings.os == "Macos": @@ -148,53 +181,118 @@ def _configure_autotools(self): os_name = 'solaris' elif host_os == 'Android': os_name = 'android' - target = "%s-%s-%s" % (arch, os_name, compiler) - args.append('--target=%s' % target) + target = f"{arch}-{os_name}-{compiler}" + configure_args.append(f"--target={target}") if str(self.settings.arch) in ["x86", "x86_64"]: for name in self._arch_options: if not self.options.get_safe(name): - args.append('--disable-%s' % name) - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if self._is_msvc: - # gen_msvs_vcxproj.sh doesn't like custom flags - autotools.cxxflags = [] - autotools.flags = [] - if tools.is_apple_os(self.settings.os) and self.settings.get_safe("compiler.libcxx") == "libc++": - # special case, as gcc/g++ is hard-coded in makefile, it implicitly assumes -lstdc++ - autotools.link_flags.append("-stdlib=libc++") - autotools.configure(args=args, configure_dir=self._source_subfolder, host=False, build=False, target=False) - return autotools + configure_args.append(f"--disable-{name}") + + configure_command = " ".join(configure_args) + self.output.info(configure_command) + self.run(configure_command) + def build(self): - self._patch_sources() - with tools.vcvars(self) if self._is_msvc else tools.no_op(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + # Disable LTO for Visual Studio when CFLAGS doesn't contain -GL + if is_msvc(self): + cflags = " ".join(self.conf.get("tools.build:cflags", default=[], check_type=list)) + lto = any(re.finditer("(^| )[/-]GL($| )", cflags)) + if not lto: + self.output.info("Disabling LTO") + replace_in_file(self, + os.path.join(self.source_folder, "build", "make", "gen_msvs_vcxproj.sh"), + "tag_content WholeProgramOptimization true", + "tag_content WholeProgramOptimization false", + ) + else: + self.output.info("Enabling LTO") - def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - with tools.vcvars(self) if self._is_msvc else tools.no_op(): - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - - if self._is_msvc: - # don't trust install target - tools.rmdir(os.path.join(self.package_folder, "lib")) - libdir = os.path.join( - "Win32" if self.settings.arch == "x86" else "x64", - "Debug" if self.settings.build_type == "Debug" else "Release", + # The compile script wants to use CC for some of the platforms (Linux, etc), + # but incorrectly assumes gcc is the compiler for those platforms. + # This can fail some of the configure tests, and -lpthread isn't added to the link command. + replace_in_file(self, + os.path.join(self.source_folder, "build", "make", "configure.sh"), + " LD=${LD:-${CROSS}${link_with_cc:-ld}}", + """ + LD=${LD:-${CROSS}${link_with_cc:-ld}} + if [ "${link_with_cc}" = "gcc" ] + then + echo "using compiler as linker" + LD=${CC} + fi +""" ) - self.copy("vpx*.lib", src=libdir, dst="lib") + + autotools = Autotools(self) + # NOT USED # autotools.configure() # FIXME can use this if we can remove --host and --build flags + self._execute_configure() + autotools.make() + + # Helpful lines for recipe debugging. The configure script is not real autotools and is a pain to debug. + # replace_in_file(self, os.path.join(self.source_folder, "configure"), "#!/bin/sh", "#!/bin/sh -x\nprintenv") + # autotools = Autotools(self) + # # NOT USED # autotools.configure() + # self._execute_configure() + # self.output.info("config.log file generated is:") + # self.output.info(open(os.path.join(self.build_folder, "config.log")).read()) + # # self.output.info("mk file generated is:") + # # self.output.info(open(os.path.join(self.build_folder, "libs-x86_64-linux-gcc.mk")).read()) + # autotools.make("SHELL='sh -x'") + + @property + def _lib_name(self): + suffix = msvc_runtime_flag(self).lower() if is_msvc(self) else "" + return f"vpx{suffix}" + + def package(self): + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + + # The workaround requires us to move the outputs into place now + rename(self, + os.path.join(self.package_folder, "output_goes_here", "include"), + os.path.join(self.package_folder, "include") + ) + + if is_msvc(self): + # Libs are still in the build folder, get from there directly. + # The makefile cannot correctly install the debug libs (see note about --enable-debug_libs) + libs_from = os.path.join( + self.build_folder, + "Win32" if self.settings.arch == "x86" else "x64", + "Debug" if self.settings.build_type == "Debug" else "Release" + ) + # Copy for msvc, as it will generate a release and debug library, so take what we want + # Note that libvpx's configure/make doesn't support shared lib builds on windows yet. + copy(self, f"{self._lib_name}.lib", libs_from, os.path.join(self.package_folder, "lib")) + else: + # if not msvc, then libs were installed into package (in the wrong place), move them + libs_from = os.path.join(self.package_folder, "output_goes_here", "lib") + rename(self, libs_from, os.path.join(self.package_folder, "lib")) + + rmdir(self, os.path.join(self.package_folder, "output_goes_here")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "vpx") - suffix = msvc_runtime_flag(self).lower() if self._is_msvc else "" - self.cpp_info.libs = [f"vpx{suffix}"] + self.cpp_info.libs = [self._lib_name] if not self.options.shared: - libcxx = tools.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.system_libs.append(libcxx) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("m") + + # reset the paths we cleared in layout() + self.cpp_info.includedirs = ['include'] + self.cpp_info.libdirs = ['lib'] + self.cpp_info.bindirs = ['bin'] # TODO: to remove in conan v2 once pkg_config generator removed self.cpp_info.names["pkg_config"] = "vpx" diff --git a/recipes/libvpx/all/test_package/CMakeLists.txt b/recipes/libvpx/all/test_package/CMakeLists.txt index 657b40cd58a00..9522c2bd93f3f 100644 --- a/recipes/libvpx/all/test_package/CMakeLists.txt +++ b/recipes/libvpx/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package C) find_package(libvpx REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libvpx::libvpx) +target_link_libraries(${PROJECT_NAME} PRIVATE libvpx::libvpx) diff --git a/recipes/libvpx/all/test_package/conanfile.py b/recipes/libvpx/all/test_package/conanfile.py index 697dfef261b53..1111583fea732 100644 --- a/recipes/libvpx/all/test_package/conanfile.py +++ b/recipes/libvpx/all/test_package/conanfile.py @@ -1,19 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -21,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libvpx/all/test_v1_package/CMakeLists.txt b/recipes/libvpx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2f6b1a2f7ec79 --- /dev/null +++ b/recipes/libvpx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libvpx/all/test_v1_package/conanfile.py b/recipes/libvpx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2490acfa82ff8 --- /dev/null +++ b/recipes/libvpx/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libwebp/all/conandata.yml b/recipes/libwebp/all/conandata.yml index 73b2540022f74..ac9853ed7cd15 100644 --- a/recipes/libwebp/all/conandata.yml +++ b/recipes/libwebp/all/conandata.yml @@ -1,41 +1,71 @@ sources: + "1.3.0": + url: "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.3.0.tar.gz" + sha256: "64ac4614db292ae8c5aa26de0295bf1623dbb3985054cb656c55e67431def17c" "1.2.4": - url: "https://github.com/webmproject/libwebp/archive/v1.2.4.tar.gz" - sha256: "dfe7bff3390cd4958da11e760b65318f0a48c32913e4d5bc5e8d55abaaa2d32e" + url: "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.2.4.tar.gz" + sha256: "7bf5a8a28cc69bcfa8cb214f2c3095703c6b73ac5fba4d5480c205331d9494df" "1.2.3": - url: "https://github.com/webmproject/libwebp/archive/v1.2.3.tar.gz" - sha256: "021169407825d7ad918ff4554c6af885e7cf116d9b641cfd7f04c1173ffb9eb0" + url: "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.2.3.tar.gz" + sha256: "f5d7ab2390b06b8a934a4fc35784291b3885b557780d099bd32f09241f9d83f9" "1.2.2": - url: "https://github.com/webmproject/libwebp/archive/v1.2.2.tar.gz" - sha256: "51e9297aadb7d9eb99129fe0050f53a11fcce38a0848fb2b0389e385ad93695e" + url: "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.2.2.tar.gz" + sha256: "7656532f837af5f4cec3ff6bafe552c044dc39bf453587bd5b77450802f4aee6" "1.2.1": - url: "https://github.com/webmproject/libwebp/archive/refs/tags/v1.2.1.tar.gz" - sha256: "01bcde6a40a602294994050b81df379d71c40b7e39c819c024d079b3c56307f4" + url: "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.2.1.tar.gz" + sha256: "808b98d2f5b84e9b27fdef6c5372dac769c3bda4502febbfa5031bd3c4d7d018" "1.2.0": - url: "https://github.com/webmproject/libwebp/archive/v1.2.0.tar.gz" - sha256: "d60608c45682fa1e5d41c3c26c199be5d0184084cd8a971a6fc54035f76487d3" + url: "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.2.0.tar.gz" + sha256: "2fc8bbde9f97f2ab403c0224fb9ca62b2e6852cbc519e91ceaa7c153ffd88a0c" "1.1.0": - url: "https://github.com/webmproject/libwebp/archive/v1.1.0.tar.gz" - sha256: "424faab60a14cb92c2a062733b6977b4cc1e875a6398887c5911b3a1a6c56c51" + url: "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.1.0.tar.gz" + sha256: "98a052268cc4d5ece27f76572a7f50293f439c17a98e67c4ea0c7ed6f50ef043" "1.0.3": - url: "https://github.com/webmproject/libwebp/archive/v1.0.3.tar.gz" - sha256: "082d114bcb18a0e2aafc3148d43367c39304f86bf18ba0b2e766447e111a4a91" + url: "https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-1.0.3.tar.gz" + sha256: "e20a07865c8697bba00aebccc6f54912d6bc333bb4d604e6b07491c1a226b34f" patches: + "1.3.0": + - patch_file: "patches/1.3.0-0001-fix-cmake.patch" + patch_description: "disable PIC, disable prefix library name on MSVC" + patch_type: "conan" "1.2.4": - - patch_file: "patches/0001-fix-dll-export.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "1.2.3": - - patch_file: "patches/0001-fix-dll-export.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "1.2.2": - - patch_file: "patches/0001-fix-dll-export.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "1.2.1": - - patch_file: "patches/0001-fix-dll-export.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" "1.2.0": - - patch_file: "patches/0001-fix-dll-export.patch" - - patch_file: "patches/0003-build-libwebpmux-1.2.0.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" + - patch_file: "patches/1.2.0-0003-build-libwebpmux.patch" + patch_description: "always build libwebpmux" + patch_type: "conan" "1.1.0": - - patch_file: "patches/0001-fix-dll-export.patch" - - patch_file: "patches/0002-qnx.patch" - - patch_file: "patches/0003-build-libwebpmux-1.1.0.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" + - patch_file: "patches/1.1.0-0002-qnx.patch" + patch_description: "work around cmake bug on QNX" + patch_type: "conan" + patch_source: "https://chromium-review.googlesource.com/c/webm/libwebp/+/2637274" + - patch_file: "patches/1.1.0-0003-build-libwebpmux.patch" + patch_description: "always build libwebpmux" + patch_type: "conan" "1.0.3": - - patch_file: "patches/0001-fix-dll-export.patch" - - patch_file: "patches/0003-build-libwebpmux-1.0.3.patch" + - patch_file: "patches/1.0.3-0001-fix-dll-export.patch" + patch_description: "define WEBP_EXTERN for windows shared build" + patch_type: "portability" + - patch_file: "patches/1.0.3-0002-build-libwebpmux.patch" + patch_description: "always build libwebpmux" + patch_type: "conan" diff --git a/recipes/libwebp/all/conanfile.py b/recipes/libwebp/all/conanfile.py index 3feb52ddc6d52..0044f425b95b1 100644 --- a/recipes/libwebp/all/conanfile.py +++ b/recipes/libwebp/all/conanfile.py @@ -1,18 +1,18 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class LibwebpConan(ConanFile): name = "libwebp" description = "Library to encode and decode images in WebP format" url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/webmproject/libwebp" + homepage = "https://chromium.googlesource.com/webm/libwebp" topics = ("image", "libwebp", "webp", "decoding", "encoding") license = "BSD-3-Clause" @@ -33,8 +33,7 @@ class LibwebpConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -42,22 +41,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -85,8 +77,8 @@ def generate(self): tc.variables["WEBP_BUILD_LIBWEBPMUX"] = True tc.variables["WEBP_BUILD_WEBPMUX"] = False if self.options.shared and is_msvc(self): - # Building a dll (see fix-dll-export patch) - tc.preprocessor_definitions["WEBP_DLL"] = 1 + # Building a dll (see fix-dll-export patch) + tc.preprocessor_definitions["WEBP_DLL"] = 1 tc.generate() def build(self): @@ -111,7 +103,7 @@ def package_info(self): self.cpp_info.components["webpdecoder"].set_property("pkg_config_name", "libwebpdecoder") self.cpp_info.components["webpdecoder"].libs = ["webpdecoder"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["webpdecoder"].system_libs = ["pthread"] + self.cpp_info.components["webpdecoder"].system_libs = ["m", "pthread"] # webp self.cpp_info.components["webp"].set_property("cmake_target_name", "WebP::webp") @@ -120,6 +112,16 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["webp"].system_libs = ["m", "pthread"] + if Version(self.version) >= "1.3.0": + # sharpyuv + self.cpp_info.components["sharpyuv"].set_property("cmake_target_name", "WebP::sharpyuv") + self.cpp_info.components["sharpyuv"].set_property("pkg_config_name", "libsharpyuv") + self.cpp_info.components["sharpyuv"].libs = ["sharpyuv"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["sharpyuv"].system_libs = ["m", "pthread"] + # note: webp now depends on sharpyuv + self.cpp_info.components["webp"].requires = ["sharpyuv"] + # webpdemux self.cpp_info.components["webpdemux"].set_property("cmake_target_name", "WebP::webpdemux") self.cpp_info.components["webpdemux"].set_property("pkg_config_name", "libwebpdemux") diff --git a/recipes/libwebp/all/patches/0001-fix-dll-export.patch b/recipes/libwebp/all/patches/1.0.3-0001-fix-dll-export.patch similarity index 100% rename from recipes/libwebp/all/patches/0001-fix-dll-export.patch rename to recipes/libwebp/all/patches/1.0.3-0001-fix-dll-export.patch diff --git a/recipes/libwebp/all/patches/0003-build-libwebpmux-1.0.3.patch b/recipes/libwebp/all/patches/1.0.3-0002-build-libwebpmux.patch similarity index 100% rename from recipes/libwebp/all/patches/0003-build-libwebpmux-1.0.3.patch rename to recipes/libwebp/all/patches/1.0.3-0002-build-libwebpmux.patch diff --git a/recipes/libwebp/all/patches/0002-qnx.patch b/recipes/libwebp/all/patches/1.1.0-0002-qnx.patch similarity index 100% rename from recipes/libwebp/all/patches/0002-qnx.patch rename to recipes/libwebp/all/patches/1.1.0-0002-qnx.patch diff --git a/recipes/libwebp/all/patches/0003-build-libwebpmux-1.1.0.patch b/recipes/libwebp/all/patches/1.1.0-0003-build-libwebpmux.patch similarity index 100% rename from recipes/libwebp/all/patches/0003-build-libwebpmux-1.1.0.patch rename to recipes/libwebp/all/patches/1.1.0-0003-build-libwebpmux.patch diff --git a/recipes/libwebp/all/patches/0003-build-libwebpmux-1.2.0.patch b/recipes/libwebp/all/patches/1.2.0-0003-build-libwebpmux.patch similarity index 100% rename from recipes/libwebp/all/patches/0003-build-libwebpmux-1.2.0.patch rename to recipes/libwebp/all/patches/1.2.0-0003-build-libwebpmux.patch diff --git a/recipes/libwebp/all/patches/1.3.0-0001-fix-cmake.patch b/recipes/libwebp/all/patches/1.3.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..f9c41d4f6a541 --- /dev/null +++ b/recipes/libwebp/all/patches/1.3.0-0001-fix-cmake.patch @@ -0,0 +1,21 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 0a5af42..781f4c7 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -58,7 +58,6 @@ if(WEBP_LINK_STATIC) + else() + set(CMAKE_FIND_LIBRARY_SUFFIXES .a ${CMAKE_FIND_LIBRARY_SUFFIXES}) + endif() +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) + # vwebp does not compile on Ubuntu with static libraries so disabling it for + # now. + set(WEBP_BUILD_VWEBP OFF) +@@ -142,7 +141,7 @@ endif() + set(PTHREAD_LIBS ${CMAKE_THREAD_LIBS_INIT}) + set(INSTALLED_LIBRARIES) + +-if(MSVC) ++if(0) + # match the naming convention used by nmake + set(webp_libname_prefix "lib") + set(CMAKE_SHARED_LIBRARY_PREFIX "${webp_libname_prefix}") diff --git a/recipes/libwebp/all/test_package/conanfile.py b/recipes/libwebp/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/libwebp/all/test_package/conanfile.py +++ b/recipes/libwebp/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/libwebp/all/test_v1_package/CMakeLists.txt b/recipes/libwebp/all/test_v1_package/CMakeLists.txt index 7b5b22d2d65ca..0d20897301b68 100644 --- a/recipes/libwebp/all/test_v1_package/CMakeLists.txt +++ b/recipes/libwebp/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(WebP REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE WebP::webp) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libwebp/all/test_v1_package/conanfile.py b/recipes/libwebp/all/test_v1_package/conanfile.py index ec9f3f6739d6d..38f4483872d47 100644 --- a/recipes/libwebp/all/test_v1_package/conanfile.py +++ b/recipes/libwebp/all/test_v1_package/conanfile.py @@ -1,10 +1,9 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" generators = "cmake", "cmake_find_package_multi" def build(self): diff --git a/recipes/libwebp/config.yml b/recipes/libwebp/config.yml index 2a1d6bc5117bc..df097a6cc668f 100644 --- a/recipes/libwebp/config.yml +++ b/recipes/libwebp/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.0": + folder: all "1.2.4": folder: all "1.2.3": diff --git a/recipes/libx264/all/conanfile.py b/recipes/libx264/all/conanfile.py index 7105e44bd9989..fcaf19f43215d 100644 --- a/recipes/libx264/all/conanfile.py +++ b/recipes/libx264/all/conanfile.py @@ -1,9 +1,12 @@ -from conan.tools.files import rename -from conans import ConanFile, tools, AutoToolsBuildEnvironment +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building +from conan.tools.files import get, rename, rmdir +from conans import tools, AutoToolsBuildEnvironment import contextlib import os -required_conan_version = ">=1.38.0" +required_conan_version = ">=1.51.3" class LibX264Conan(ConanFile): @@ -63,8 +66,8 @@ def build_requirements(self): self.build_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) @contextlib.contextmanager def _build_context(self): @@ -98,16 +101,28 @@ def _configure_autotools(self): args.append("--enable-pic") if self.settings.build_type == "Debug": args.append("--enable-debug") - if self.settings.os == "Macos" and self.settings.arch == "armv8": + if is_apple_os(self) and self.settings.arch == "armv8": # bitstream-a.S:29:18: error: unknown token in expression extra_asflags.append("-arch arm64") extra_ldflags.append("-arch arm64") args.append("--host=aarch64-apple-darwin") + if self.settings.os != "Macos": + deployment_target_flag = tools.apple_deployment_target_flag( + self.settings.os, + self.settings.get_safe("os.version"), + self.settings.get_safe("os.sdk"), + self.settings.get_safe("os.subsystem"), + self.settings.get_safe("arch") + ) + platform_flags = ["-isysroot", tools.XCRun(self.settings).sdk_path, deployment_target_flag] + extra_asflags.extend(platform_flags) + extra_cflags.extend(platform_flags) + extra_ldflags.extend(platform_flags) if self._with_nasm: # FIXME: get using user_build_info self._override_env["AS"] = os.path.join(self.dependencies.build["nasm"].package_folder, "bin", "nasm{}".format(".exe" if tools.os_info.is_windows else "")).replace("\\", "/") - if tools.cross_building(self): + if cross_building(self): if self.settings.os == "Android": # the as of ndk does not work well for building libx264 self._override_env["AS"] = os.environ["CC"] @@ -127,8 +142,8 @@ def _configure_autotools(self): extra_cflags.append("-FS") build_canonical_name = None host_canonical_name = None - if self._is_msvc: - # autotools does not know about the msvc canonical name(s) + if self._is_msvc or self.settings.os in ["iOS", "watchOS", "tvOS"]: + # autotools does not know about the msvc and Apple embedded OS canonical name(s) build_canonical_name = False host_canonical_name = False if extra_asflags: @@ -154,7 +169,7 @@ def package(self): with self._build_context(): autotools = self._configure_autotools() autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self._is_msvc: ext = ".dll.lib" if self.options.shared else ".lib" rename(self, os.path.join(self.package_folder, "lib", "libx264{}".format(ext)), diff --git a/recipes/libxcrypt/all/conandata.yml b/recipes/libxcrypt/all/conandata.yml index 82faf7e3d0d61..df7c72ca12c22 100644 --- a/recipes/libxcrypt/all/conandata.yml +++ b/recipes/libxcrypt/all/conandata.yml @@ -24,5 +24,5 @@ sources: url: "https://github.com/besser82/libxcrypt/archive/v4.4.17.tar.gz" sha256: "7665168d0409574a03f7b484682e68334764c29c21ca5df438955a381384ca07" "4.4.16": - sha256: "a98f65b8baffa2b5ba68ee53c10c0a328166ef4116bce3baece190c8ce01f375" url: "https://github.com/besser82/libxcrypt/archive/v4.4.16.tar.gz" + sha256: "a98f65b8baffa2b5ba68ee53c10c0a328166ef4116bce3baece190c8ce01f375" diff --git a/recipes/libxcrypt/all/conanfile.py b/recipes/libxcrypt/all/conanfile.py index ad5967d5f01a3..7f1e95bcfd907 100644 --- a/recipes/libxcrypt/all/conanfile.py +++ b/recipes/libxcrypt/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibxcryptConan(ConanFile): @@ -10,7 +16,7 @@ class LibxcryptConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/besser82/libxcrypt" description = "Extended crypt library for descrypt, md5crypt, bcrypt, and others" - topics = ("libxcypt", "hash", "password", "one-way", "bcrypt", "md5", "sha256", "sha512") + topics = ("hash", "password", "one-way", "bcrypt", "md5", "sha256", "sha512") license = ("LGPL-2.1-or-later", ) settings = "os", "arch", "compiler", "build_type" options = { @@ -22,11 +28,9 @@ class LibxcryptConan(ConanFile): "fPIC": True, } - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def config_options(self): if self.settings.os == "Windows": @@ -34,60 +38,58 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - def validate(self): - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("libxcrypt does not support Visual Studio") + def layout(self): + basic_layout(self, src_folder="src") - @property - def _settings_build(self): - return self.settings_build if hasattr(self, "settings_build") else self.settings + def validate(self): + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support Visual Studio") def build_requirements(self): - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--disable-werror", - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - if self.settings.os == "Windows": - tools.replace_in_file("libtool", "-DPIC", "") - return self._autotools + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-werror") + tc.generate() + + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "Makefile.am"), + "\nlibcrypt_la_LDFLAGS = ", "\nlibcrypt_la_LDFLAGS = -no-undefined ") def build(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.am"), - "\nlibcrypt_la_LDFLAGS = ", "\nlibcrypt_la_LDFLAGS = -no-undefined ") - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - autotools = self._configure_autotools() + self._patch_sources() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + if self.settings.os == "Windows": + replace_in_file(self, os.path.join(self.build_folder, "libtool"), "-DPIC", "") autotools.make() def package(self): - self.copy("COPYING.LIB", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() - autotools.install() - - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING.LIB", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.names["pkg_config"] = "libxcrypt" + self.cpp_info.set_property("pkg_config_name", "libxcrypt") self.cpp_info.libs = ["crypt"] diff --git a/recipes/libxcrypt/all/test_package/CMakeLists.txt b/recipes/libxcrypt/all/test_package/CMakeLists.txt index 7b9b613cbb24a..af52be8acede9 100644 --- a/recipes/libxcrypt/all/test_package/CMakeLists.txt +++ b/recipes/libxcrypt/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libxcrypt REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE libxcrypt::libxcrypt) diff --git a/recipes/libxcrypt/all/test_package/conanfile.py b/recipes/libxcrypt/all/test_package/conanfile.py index d4128b0450777..0a6bc68712d90 100644 --- a/recipes/libxcrypt/all/test_package/conanfile.py +++ b/recipes/libxcrypt/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libxcrypt/all/test_v1_package/CMakeLists.txt b/recipes/libxcrypt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libxcrypt/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libxcrypt/all/test_v1_package/conanfile.py b/recipes/libxcrypt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libxcrypt/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libxft/all/conandata.yml b/recipes/libxft/all/conandata.yml index 59703e66e854d..e56e888b5fdb6 100644 --- a/recipes/libxft/all/conandata.yml +++ b/recipes/libxft/all/conandata.yml @@ -1,4 +1,14 @@ sources: + "2.3.6": + url: "https://www.x.org/archive/individual/lib/libXft-2.3.6.tar.gz" + sha256: "b7e59f69e0bbabe9438088775f7e5a7c16a572e58b11f9722519385d38192df5" "2.3.4": url: "https://www.x.org/archive/individual/lib/libXft-2.3.4.tar.gz" sha256: "1eca71bec9cb483165ce1ab94f5cd3036269f5268651df6a2d99c4a7ab644d79" +patches: + "2.3.6": + - patch_file: "patches/0001-fix-gcc-5-and-11.patch" + patch_description: "fix gcc 5 and gcc 11 compilation" + patch_type: "portability" + patch_source: "https://gitlab.freedesktop.org/xorg/lib/libxft/-/merge_requests/17" + base_path: "source_subfolder" diff --git a/recipes/libxft/all/conanfile.py b/recipes/libxft/all/conanfile.py index ea24924333b7d..5bb077b0fdb7a 100644 --- a/recipes/libxft/all/conanfile.py +++ b/recipes/libxft/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile -from conan.tools import files +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, chdir, rm, rmdir from conans import AutoToolsBuildEnvironment import functools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class libxftConan(ConanFile): name = "libxft" @@ -22,6 +22,9 @@ class libxftConan(ConanFile): def _source_subfolder(self): return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) + def requirements(self): self.requires("xorg/system") self.requires("freetype/2.12.1") @@ -33,7 +36,7 @@ def build_requirements(self): self.build_requires("libtool/2.4.7") def source(self): - files.get(self, **self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def configure(self): @@ -54,19 +57,20 @@ def _configure_autotools(self): return autotools def build(self): - with files.chdir(self, self._source_subfolder): + apply_conandata_patches(self) + with chdir(self, self._source_subfolder): autotools = self._configure_autotools() autotools.make() def package(self): self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - with files.chdir(self, self._source_subfolder): + with chdir(self, self._source_subfolder): autotools = self._configure_autotools() autotools.install(args=["-j1"]) - files.rm(self, "*.la", f"{self.package_folder}/lib", recursive=True) - files.rmdir(self, f"{self.package_folder}/lib/pkgconfig") - files.rmdir(self, f"{self.package_folder}/share") + rm(self, "*.la", f"{self.package_folder}/lib", recursive=True) + rmdir(self, f"{self.package_folder}/lib/pkgconfig") + rmdir(self, f"{self.package_folder}/share") def package_info(self): self.cpp_info.names['pkg_config'] = "Xft" diff --git a/recipes/libxft/all/patches/0001-fix-gcc-5-and-11.patch b/recipes/libxft/all/patches/0001-fix-gcc-5-and-11.patch new file mode 100644 index 0000000000000..c7b72d5585aa0 --- /dev/null +++ b/recipes/libxft/all/patches/0001-fix-gcc-5-and-11.patch @@ -0,0 +1,24 @@ +From 84310d83bf4c057dd0866e7116779c9c2f043007 Mon Sep 17 00:00:00 2001 +From: ericLemanissier +Date: Fri, 23 Sep 2022 07:59:55 +0000 +Subject: [PATCH] fix compilation with gcc 5 and gcc 11 + +stdint.h header is needed for SIZE_MAX +--- + src/xftrender.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/src/xftrender.c b/src/xftrender.c +index 3021d56..c15237e 100644 +--- a/src/xftrender.c ++++ b/src/xftrender.c +@@ -21,6 +21,7 @@ + */ + + #include "xftint.h" ++#include + + #define NUM_LOCAL 1024 + #define NUM_ELT_LOCAL 128 +-- +GitLab diff --git a/recipes/libxft/config.yml b/recipes/libxft/config.yml index 45925611b3bf0..6caf25620b5dc 100644 --- a/recipes/libxft/config.yml +++ b/recipes/libxft/config.yml @@ -1,3 +1,5 @@ versions: + "2.3.6": + folder: all "2.3.4": folder: all diff --git a/recipes/libxls/all/conandata.yml b/recipes/libxls/all/conandata.yml new file mode 100644 index 0000000000000..73215812f5900 --- /dev/null +++ b/recipes/libxls/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.6.2": + url: "https://github.com/libxls/libxls/releases/download/v1.6.2/libxls-1.6.2.tar.gz" + sha256: "5dacc34d94bf2115926c80c6fb69e4e7bd2ed6403d51cff49041a94172f5e371" +patches: + "1.6.2": + - patch_file: "patches/1.6.2-0001-fix-ssize_t-msvc.patch" + patch_description: "Solve ssize_t when building on Windows" + patch_type: "conan" diff --git a/recipes/libxls/all/conanfile.py b/recipes/libxls/all/conanfile.py new file mode 100644 index 0000000000000..007beb8962389 --- /dev/null +++ b/recipes/libxls/all/conanfile.py @@ -0,0 +1,113 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.files import export_conandata_patches, apply_conandata_patches, rmdir, copy, save, get, rm +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building + +import os + +required_conan_version = ">=1.53.0" + +class LibxlsConan(ConanFile): + name = "libxls" + description = "a C library which can read Excel (xls) files." + license = "BSD-2-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/libxls/libxls/" + topics = ("excel", "xls") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_cli": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_cli": False, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder='src') + + def requirements(self): + if not is_apple_os(self): + self.requires("libiconv/1.17") + + def validate(self): + if self.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Windows (yet). Contributions are always welcomed") + + def build_requirements(self): + if self.settings.os == "Windows": + self.tool_requires("msys2/cci.latest") + self.win_bash = True + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + toolchain = AutotoolsToolchain(self) + if cross_building(self): + toolchain.configure_args.append("ac_cv_func_malloc_0_nonnull=yes") + toolchain.configure_args.append("ac_cv_func_realloc_0_nonnull=yes") + toolchain.generate() + deps = AutotoolsDeps(self) + deps.generate() + + def _patch_sources(self): + config_h_content = """ +#define HAVE_ICONV 1 +#define ICONV_CONST +#define PACKAGE_VERSION "{}" +""".format(self.version) + if self.settings.os == "Macos": + config_h_content += "#define HAVE_XLOCALE_H 1\n" + save(self, os.path.join(self.source_folder, "include", "config.h"), config_h_content) + apply_conandata_patches(self) + + def build(self): + self._patch_sources() + autotools = Autotools(self) + autotools.configure() + autotools.make() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + + def package_info(self): + self.cpp_info.libs = ["xlsreader"] + + if is_apple_os(self): + self.cpp_info.system_libs.append("iconv") + + self.cpp_info.set_property("cmake_file_name", "libxls") + self.cpp_info.set_property("cmake_target_name", "libxls::libxls") + self.cpp_info.set_property("pkg_config_name", "libxls") + + if not is_apple_os(self): + self.cpp_info.requires.append("libiconv::libiconv") + + # TODO: Remove in Conan 2.0 + self.cpp_info.names["cmake_find_package"] = "libxls" + self.cpp_info.names["cmake_find_package_multi"] = "libxls" diff --git a/recipes/libxls/all/patches/1.6.2-0001-fix-ssize_t-msvc.patch b/recipes/libxls/all/patches/1.6.2-0001-fix-ssize_t-msvc.patch new file mode 100644 index 0000000000000..028e50681cc68 --- /dev/null +++ b/recipes/libxls/all/patches/1.6.2-0001-fix-ssize_t-msvc.patch @@ -0,0 +1,14 @@ +diff --git a/include/libxls/xlstypes.h b/include/libxls/xlstypes.h +index 52da772..3efba21 100644 +--- a/include/libxls/xlstypes.h ++++ b/include/libxls/xlstypes.h +@@ -53,4 +53,9 @@ typedef unsigned __int64 unsigned64_t; + typedef uint64_t unsigned64_t; + #endif + ++#ifdef _MSC_VER ++#include ++typedef SSIZE_T ssize_t; ++#endif ++ + #endif diff --git a/recipes/libxls/all/test_package/CMakeLists.txt b/recipes/libxls/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a4b50bc78de77 --- /dev/null +++ b/recipes/libxls/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(libxls REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libxls::libxls) diff --git a/recipes/libxls/all/test_package/conanfile.py b/recipes/libxls/all/test_package/conanfile.py new file mode 100644 index 0000000000000..8a5bb47f50c4c --- /dev/null +++ b/recipes/libxls/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libxls/all/test_package/test_package.c b/recipes/libxls/all/test_package/test_package.c new file mode 100644 index 0000000000000..09d94a0eaa57d --- /dev/null +++ b/recipes/libxls/all/test_package/test_package.c @@ -0,0 +1,12 @@ +#include + +#include "xls.h" + +int main() { + struct xlsWorkBook* wb; + struct xlsWorkSheet* ws; + + printf("libxls version : %s\n", xls_getVersion()); + + return 0; +} diff --git a/recipes/libxls/all/test_v1_package/CMakeLists.txt b/recipes/libxls/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libxls/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libxls/all/test_v1_package/conanfile.py b/recipes/libxls/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a500b98343c74 --- /dev/null +++ b/recipes/libxls/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libxls/config.yml b/recipes/libxls/config.yml new file mode 100644 index 0000000000000..9b1f6cb9f3642 --- /dev/null +++ b/recipes/libxls/config.yml @@ -0,0 +1,3 @@ +versions: + "1.6.2": + folder: "all" diff --git a/recipes/libxlsxwriter/all/CMakeLists.txt b/recipes/libxlsxwriter/all/CMakeLists.txt deleted file mode 100644 index 30c065f03128e..0000000000000 --- a/recipes/libxlsxwriter/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/libxlsxwriter/all/conandata.yml b/recipes/libxlsxwriter/all/conandata.yml index cd8028139a390..44eb2bad3dada 100644 --- a/recipes/libxlsxwriter/all/conandata.yml +++ b/recipes/libxlsxwriter/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.5": + url: "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_1.1.5.tar.gz" + sha256: "12843587d591cf679e6ec63ecc629245befec2951736804a837696cdb5d61946" "1.1.4": url: "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_1.1.4.tar.gz" sha256: "b379eb35fdd9c653ebe72485b9c992f612c7ea66f732784457997d6e782f619b" @@ -9,12 +12,23 @@ sources: url: "https://github.com/jmcnamara/libxlsxwriter/archive/RELEASE_1.0.0.tar.gz" sha256: "8b353379333c323d14a9d265cd2491d3a6c0032c8d6ec2141f10b82ab66a087c" patches: + "1.1.5": + - patch_file: "patches/1.1.5-0001-fix-cmake.patch" + patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" + patch_type: "conan" + sha256: "54bf92c1f9423d9c7b3820122ff806679e254392d66ae72696f58e7d36e4b16f" "1.1.4": - - base_path: "source_subfolder" - patch_file: "patches/1.1.3/001-patch-cmake-conan-targets.patch" + - patch_file: "patches/1.1.3-0001-fix-cmake.patch" + patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" + patch_type: "conan" + sha256: "54bf92c1f9423d9c7b3820122ff806679e254392d66ae72696f58e7d36e4b16f" "1.1.3": - - base_path: "source_subfolder" - patch_file: "patches/1.1.3/001-patch-cmake-conan-targets.patch" + - patch_file: "patches/1.1.3-0001-fix-cmake.patch" + patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" + patch_type: "conan" + sha256: "54bf92c1f9423d9c7b3820122ff806679e254392d66ae72696f58e7d36e4b16f" "1.0.0": - - base_path: "source_subfolder" - patch_file: "patches/1.0.0/001-patch-cmake-conan-targets.patch" + - patch_file: "patches/1.0.0-0001-fix-cmake.patch" + patch_description: "Fix CMake: robust dependencies discovery & avoid some hardcoded flags" + patch_type: "conan" + sha256: "d310313e55f4819db7401e1dc27795481b4a3b258fbba19f9eb5211141b09972" diff --git a/recipes/libxlsxwriter/all/conanfile.py b/recipes/libxlsxwriter/all/conanfile.py index 92136ebd9d633..0d8e6136fd0e5 100644 --- a/recipes/libxlsxwriter/all/conanfile.py +++ b/recipes/libxlsxwriter/all/conanfile.py @@ -1,17 +1,23 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" + class LibxlsxwriterConan(ConanFile): name = "libxlsxwriter" license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/jmcnamara/libxlsxwriter" - topics = ("conan", "Excel", "XLSX") + topics = ("excel", "xlsx") description = "A C library for creating Excel XLSX files" - settings = "os", "compiler", "build_type", "arch" + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -28,14 +34,9 @@ class LibxlsxwriterConan(ConanFile): "fmemopen": False, "dtoa": False, } - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,59 +46,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - def validate(self): - if tools.Version(self.version) <= "1.0.5" and self.options.md5 == "openssl": - raise ConanInvalidConfiguration("{0}:md5=openssl is not suppported in {0}/{1}".format(self.name, self.version)) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("minizip/1.2.12") - self.requires("zlib/1.2.12") + self.requires("minizip/1.2.13") + self.requires("zlib/1.2.13") if self.options.md5 == "openssl": - self.requires("openssl/1.1.1q") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + self.requires("openssl/1.1.1s") - def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["USE_STATIC_MSVC_RUNTIME"] = (self.settings.os == "Windows" and "MT" in str(self.settings.compiler.runtime)) - self._cmake.definitions["USE_SYSTEM_MINIZIP"] = True - self._cmake.definitions["USE_STANDARD_TMPFILE"] = self.options.tmpfile - - if self.options.md5 == False: - self._cmake.definitions["USE_NO_MD5"] = True - elif self.options.md5 == "openssl": - self._cmake.definitions["USE_OPENSSL_MD5"] = True - - self._cmake.definitions["USE_FMEMOPEN"] = self.options.get_safe("fmemopen", False) - self._cmake.definitions["USE_DTOA_LIBRARY"] = self.options.dtoa + def validate(self): + if Version(self.version) < "1.0.6" and self.info.options.md5 == "openssl": + raise ConanInvalidConfiguration(f"{self.name}:md5=openssl is not suppported in {self.ref}") - self._cmake.configure() - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["USE_SYSTEM_MINIZIP"] = True + tc.variables["USE_STANDARD_TMPFILE"] = self.options.tmpfile + tc.variables["USE_NO_MD5"] = not bool(self.options.md5) + if Version(self.version) >= "1.0.6": + tc.variables["USE_OPENSSL_MD5"] = self.options.md5 == "openssl" + tc.variables["USE_FMEMOPEN"] = self.options.get_safe("fmemopen", False) + tc.variables["USE_DTOA_LIBRARY"] = self.options.dtoa + if is_msvc(self): + tc.variables["USE_STATIC_MSVC_RUNTIME"] = is_msvc_static_runtime(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("License.txt", src=self._source_subfolder, dst="licenses") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.pc") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "xlsxwriter") self.cpp_info.libs = ["xlsxwriter"] diff --git a/recipes/libxlsxwriter/all/patches/1.0.0-0001-fix-cmake.patch b/recipes/libxlsxwriter/all/patches/1.0.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..ea03f6ee126ba --- /dev/null +++ b/recipes/libxlsxwriter/all/patches/1.0.0-0001-fix-cmake.patch @@ -0,0 +1,38 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -153,9 +153,8 @@ endif() + + if(NOT BUILD_SHARED_LIBS) + if(UNIX) +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) + elseif(MINGW OR MSYS) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc -Wno-char-subscripts -Wno-long-long") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-char-subscripts -Wno-long-long") + list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_FILE32API) + elseif(MSVC) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Fd\"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb\"") +@@ -183,13 +182,13 @@ enable_language(CXX) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + + # ZLIB +-find_package(ZLIB REQUIRED "1.0") ++find_package(ZLIB REQUIRED) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) + message("zlib version: " ${ZLIB_VERSION}) + + # MINIZIP + if (USE_SYSTEM_MINIZIP) +- find_package(MINIZIP REQUIRED "1.0") ++ find_package(minizip REQUIRED CONFIG) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) + endif() + +@@ -237,7 +236,7 @@ target_sources(${PROJECT_NAME} + PRIVATE ${LXW_SOURCES} + PUBLIC ${LXW_HEADERS} + ) +-target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES}) ++target_link_libraries(${PROJECT_NAME} PRIVATE ZLIB::ZLIB minizip::minizip) + target_compile_definitions(${PROJECT_NAME} PRIVATE ${LXW_PRIVATE_COMPILE_DEFINITIONS}) + + # /utf-8 needs VS2015 Update 2 or above. diff --git a/recipes/libxlsxwriter/all/patches/1.0.0/001-patch-cmake-conan-targets.patch b/recipes/libxlsxwriter/all/patches/1.0.0/001-patch-cmake-conan-targets.patch deleted file mode 100644 index 974e55ba8f8d5..0000000000000 --- a/recipes/libxlsxwriter/all/patches/1.0.0/001-patch-cmake-conan-targets.patch +++ /dev/null @@ -1,33 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2359933..955563c 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -180,16 +180,16 @@ endif() - # INCLUDES - # -------- - enable_language(CXX) --list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -+#list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - - # ZLIB --find_package(ZLIB REQUIRED "1.0") -+#find_package(ZLIB REQUIRED "1.0") - list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) - message("zlib version: " ${ZLIB_VERSION}) - - # MINIZIP - if (USE_SYSTEM_MINIZIP) -- find_package(MINIZIP REQUIRED "1.0") -+ #find_package(MINIZIP REQUIRED "1.0") - list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) - endif() - -@@ -237,7 +237,7 @@ target_sources(${PROJECT_NAME} - PRIVATE ${LXW_SOURCES} - PUBLIC ${LXW_HEADERS} - ) --target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES}) -+target_link_libraries(${PROJECT_NAME} LINK_PUBLIC CONAN_PKG::zlib CONAN_PKG::minizip) - target_compile_definitions(${PROJECT_NAME} PRIVATE ${LXW_PRIVATE_COMPILE_DEFINITIONS}) - - # /utf-8 needs VS2015 Update 2 or above. diff --git a/recipes/libxlsxwriter/all/patches/1.1.3-0001-fix-cmake.patch b/recipes/libxlsxwriter/all/patches/1.1.3-0001-fix-cmake.patch new file mode 100644 index 0000000000000..473fc10337147 --- /dev/null +++ b/recipes/libxlsxwriter/all/patches/1.1.3-0001-fix-cmake.patch @@ -0,0 +1,41 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -175,9 +175,8 @@ endif() + + if(NOT BUILD_SHARED_LIBS) + if(UNIX) +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) + elseif(MINGW OR MSYS) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc -Wno-char-subscripts -Wno-long-long") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-char-subscripts -Wno-long-long") + list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_FILE32API) + elseif(MSVC) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Fd\"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb\"") +@@ -216,13 +215,13 @@ enable_language(CXX) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + + # ZLIB +-find_package(ZLIB REQUIRED "1.0") ++find_package(ZLIB REQUIRED) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) + message("zlib version: " ${ZLIB_VERSION}) + + # MINIZIP + if (USE_SYSTEM_MINIZIP) +- find_package(MINIZIP REQUIRED "1.0") ++ find_package(minizip REQUIRED CONFIG) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) + endif() + +@@ -278,7 +277,10 @@ target_sources(${PROJECT_NAME} + PRIVATE ${LXW_SOURCES} + PUBLIC ${LXW_HEADERS} + ) +-target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${LIB_CRYPTO} ${OPENSSL_CRYPTO_LIBRARY}) ++target_link_libraries(${PROJECT_NAME} PRIVATE ZLIB::ZLIB minizip::minizip) ++if(USE_OPENSSL_MD5) ++ target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::Crypto) ++endif() + target_compile_definitions(${PROJECT_NAME} PRIVATE ${LXW_PRIVATE_COMPILE_DEFINITIONS}) + + # /utf-8 needs VS2015 Update 2 or above. diff --git a/recipes/libxlsxwriter/all/patches/1.1.3/001-patch-cmake-conan-targets.patch b/recipes/libxlsxwriter/all/patches/1.1.3/001-patch-cmake-conan-targets.patch deleted file mode 100644 index ae1aad6ac2782..0000000000000 --- a/recipes/libxlsxwriter/all/patches/1.1.3/001-patch-cmake-conan-targets.patch +++ /dev/null @@ -1,43 +0,0 @@ -diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt -index 66505b5..d63cc96 100644 ---- a/a/CMakeLists.txt -+++ b/b/CMakeLists.txt -@@ -213,16 +213,16 @@ configure_file(dev/release/pkg-config.txt xlsxwriter.pc @ONLY) - # INCLUDES - # -------- - enable_language(CXX) --list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) -+#list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) - - # ZLIB - find_package(ZLIB REQUIRED "1.0") --list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) -+#list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) - message("zlib version: " ${ZLIB_VERSION}) - - # MINIZIP - if (USE_SYSTEM_MINIZIP) -- find_package(MINIZIP REQUIRED "1.0") -+# find_package(MINIZIP REQUIRED "1.0") - list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) - endif() - -@@ -259,7 +259,7 @@ if(NOT USE_OPENSSL_MD5 AND NOT USE_NO_MD5) - endif() - - if(USE_OPENSSL_MD5) -- find_package(OpenSSL REQUIRED) -+# find_package(OpenSSL REQUIRED) - if(OpenSSL_FOUND) - include_directories(${OPENSSL_INCLUDE_DIR}) - message(STATUS "OpenSSL version: ${OPENSSL_VERSION}") -@@ -278,7 +278,8 @@ target_sources(${PROJECT_NAME} - PRIVATE ${LXW_SOURCES} - PUBLIC ${LXW_HEADERS} - ) --target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${LIB_CRYPTO} ${OPENSSL_CRYPTO_LIBRARY}) -+#target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${LIB_CRYPTO} ${OPENSSL_CRYPTO_LIBRARY}) -+target_link_libraries(${PROJECT_NAME} LINK_PUBLIC CONAN_PKG::zlib CONAN_PKG::minizip) - target_compile_definitions(${PROJECT_NAME} PRIVATE ${LXW_PRIVATE_COMPILE_DEFINITIONS}) - - # /utf-8 needs VS2015 Update 2 or above. diff --git a/recipes/libxlsxwriter/all/patches/1.1.5-0001-fix-cmake.patch b/recipes/libxlsxwriter/all/patches/1.1.5-0001-fix-cmake.patch new file mode 100644 index 0000000000000..46175dd3778a6 --- /dev/null +++ b/recipes/libxlsxwriter/all/patches/1.1.5-0001-fix-cmake.patch @@ -0,0 +1,43 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e656184..b9002e7 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -178,9 +178,8 @@ endif() + + if(NOT BUILD_SHARED_LIBS) + if(UNIX) +- set(CMAKE_POSITION_INDEPENDENT_CODE ON) + elseif(MINGW OR MSYS) +- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -static -static-libgcc -Wno-char-subscripts -Wno-long-long") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-char-subscripts -Wno-long-long") + list(APPEND LXW_PRIVATE_COMPILE_DEFINITIONS USE_FILE32API) + elseif(MSVC) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /Fd\"${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pdb\"") +@@ -219,13 +218,13 @@ enable_language(CXX) + list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) + + # ZLIB +-find_package(ZLIB REQUIRED "1.0") ++find_package(ZLIB REQUIRED CONFIG) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${ZLIB_INCLUDE_DIRS}) + message("zlib version: " ${ZLIB_VERSION}) + + # MINIZIP + if (USE_SYSTEM_MINIZIP) +- find_package(MINIZIP REQUIRED "1.0") ++ find_package(MINIZIP REQUIRED CONFIG) + list(APPEND LXW_PRIVATE_INCLUDE_DIRS ${MINIZIP_INCLUDE_DIRS}) + endif() + +@@ -281,7 +280,10 @@ target_sources(${PROJECT_NAME} + PRIVATE ${LXW_SOURCES} + PUBLIC ${LXW_HEADERS} + ) +-target_link_libraries(${PROJECT_NAME} LINK_PUBLIC ${ZLIB_LIBRARIES} ${MINIZIP_LIBRARIES} ${LIB_CRYPTO} ${OPENSSL_CRYPTO_LIBRARY}) ++target_link_libraries(${PROJECT_NAME} PRIVATE ZLIB::ZLIB minizip::minizip) ++if(USE_OPENSSL_MD5) ++ target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::Crypto) ++endif() + target_compile_definitions(${PROJECT_NAME} PRIVATE ${LXW_PRIVATE_COMPILE_DEFINITIONS}) + + # /utf-8 needs VS2015 Update 2 or above. diff --git a/recipes/libxlsxwriter/all/test_package/CMakeLists.txt b/recipes/libxlsxwriter/all/test_package/CMakeLists.txt index 37195b5e1f903..267b50e398033 100644 --- a/recipes/libxlsxwriter/all/test_package/CMakeLists.txt +++ b/recipes/libxlsxwriter/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(libxlsxwriter REQUIRED CONFIG) -add_executable(example example.c) -target_link_libraries(example CONAN_PKG::libxlsxwriter) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE libxlsxwriter::libxlsxwriter) diff --git a/recipes/libxlsxwriter/all/test_package/conanfile.py b/recipes/libxlsxwriter/all/test_package/conanfile.py index 5a6b132236463..0a6bc68712d90 100644 --- a/recipes/libxlsxwriter/all/test_package/conanfile.py +++ b/recipes/libxlsxwriter/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -class LibxlsxwriterTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libxlsxwriter/all/test_package/example.c b/recipes/libxlsxwriter/all/test_package/test_package.c similarity index 100% rename from recipes/libxlsxwriter/all/test_package/example.c rename to recipes/libxlsxwriter/all/test_package/test_package.c diff --git a/recipes/libxlsxwriter/all/test_v1_package/CMakeLists.txt b/recipes/libxlsxwriter/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libxlsxwriter/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libxlsxwriter/all/test_v1_package/conanfile.py b/recipes/libxlsxwriter/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libxlsxwriter/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libxlsxwriter/config.yml b/recipes/libxlsxwriter/config.yml index 3e62b328f7fc7..4690b80fd5fb3 100644 --- a/recipes/libxlsxwriter/config.yml +++ b/recipes/libxlsxwriter/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.5": + folder: "all" "1.1.4": folder: "all" "1.1.3": diff --git a/recipes/libxml2/all/conandata.yml b/recipes/libxml2/all/conandata.yml index 7b0bc5ab259c8..bf398536e5842 100644 --- a/recipes/libxml2/all/conandata.yml +++ b/recipes/libxml2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.10.3": + url: "https://download.gnome.org/sources/libxml2/2.10/libxml2-2.10.3.tar.xz" + sha256: "5d2cc3d78bec3dbe212a9d7fa629ada25a7da928af432c93060ff5c17ee28a9c" "2.9.14": url: "https://download.gnome.org/sources/libxml2/2.9/libxml2-2.9.14.tar.xz" sha256: "60d74a257d1ccec0475e749cba2f21559e48139efba6ff28224357c7c798dfee" diff --git a/recipes/libxml2/all/conanfile.py b/recipes/libxml2/all/conanfile.py index 7e16807397e88..22f3f4151fbd6 100644 --- a/recipes/libxml2/all/conanfile.py +++ b/recipes/libxml2/all/conanfile.py @@ -1,19 +1,25 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment -from contextlib import contextmanager -from conan.tools.files import rename -import functools -import itertools +from conan import ConanFile +from conan.tools.env import Environment, VirtualBuildEnv, VirtualRunEnv +from conan.tools.scm import Version +from conan.tools.build import cross_building, build_jobs +from conan.tools.files import copy, get, rename, rm, rmdir, replace_in_file, save, chdir, mkdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, unix_path, VCVars import os + +import itertools import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class Libxml2Conan(ConanFile): name = "libxml2" + package_type = "library" url = "https://github.com/conan-io/conan-center-index" description = "libxml2 is a software library for parsing XML documents" - topics = ("xml", "parser", "validation") + topics = "xml", "parser", "validation" homepage = "https://gitlab.gnome.org/GNOME/libxml2/-/wikis/" license = "MIT" @@ -25,7 +31,7 @@ class Libxml2Conan(ConanFile): "include_utils": True, "c14n": True, "catalog": True, - "docbook": True, + "docbook": True, # dropped after 2.10.3 "ftp": True, "http": True, "html": True, @@ -56,22 +62,16 @@ class Libxml2Conan(ConanFile): } options = {name: [True, False] for name in default_options.keys()} - _option_names = [name for name in default_options.keys() if name not in ["shared", "fPIC", "include_utils"]] - - generators = "pkg_config" @property - def _source_subfolder(self): - return "source_subfolder" + def _configure_option_names(self): + return [name for name in self.default_options.keys() if (name in self.options) + and (name not in ["shared", "fPIC", "include_utils"])] @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _is_mingw_windows(self): return self.settings.compiler == "gcc" and self.settings.os == "Windows" and self._settings_build.os == "Windows" @@ -79,45 +79,82 @@ def _is_mingw_windows(self): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) >= "2.10.3": + del self.options.docbook def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.lzma: self.requires("xz_utils/5.2.5") if self.options.iconv: - self.requires("libiconv/1.17") + self.requires("libiconv/1.17", transitive_headers=True, transitive_libs=True) if self.options.icu: - self.requires("icu/71.1") + self.requires("icu/72.1") def build_requirements(self): - if not (self._is_msvc or self._is_mingw_windows): + if not (is_msvc(self) or self._is_mingw_windows): if self.options.zlib or self.options.lzma or self.options.icu: - self.build_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - # can't use strip_root here because if fails since 2.9.10 with: - # KeyError: "linkname 'libxml2-2.9.1x/test/relaxng/ambig_name-class.xml' not found" - tools.get(**self.conan_data["sources"][self.version]) - rename(self, "libxml2-{}".format(self.version), self._source_subfolder) - - @contextmanager - def _msvc_build_environment(self): - with tools.chdir(os.path.join(self._source_subfolder, 'win32')): - with tools.vcvars(self.settings): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - yield + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + if is_msvc(self): + tc = VCVars(self) + tc.generate() + env = Environment() + # TODO: no conan v2 build helper for NMake yet (see https://github.com/conan-io/conan/issues/12188) + # So populate CL with AutotoolsToolchain cflags + c_flags = AutotoolsToolchain(self).cflags + if c_flags: + env.define("CL", c_flags) + env.vars(self).save_script("conanbuildenv_nmake") + elif self._is_mingw_windows: + pass # nothing to do for mingw? it calls mingw-make directly + else: + env = VirtualBuildEnv(self) + env.generate() + + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--enable-shared={yes_no(self.options.shared)}", + f"--enable-static={yes_no(not self.options.shared)}", + ]) + for option_name in self._configure_option_names: + option_value = getattr(self.options, option_name) + tc.configure_args.append(f"--with-{option_name}={yes_no(option_value)}") + + tc.generate() + + tc = PkgConfigDeps(self) + tc.generate() + + tc = AutotoolsDeps(self) + tc.generate() def _build_msvc(self): - with self._msvc_build_environment(): + with chdir(self, os.path.join(self.source_folder, 'win32')): debug = "yes" if self.settings.build_type == "Debug" else "no" static = "no" if self.options.shared else "yes" @@ -125,23 +162,24 @@ def _build_msvc(self): "cscript", "configure.js", "compiler=msvc", - "prefix={}".format(self.package_folder), - "cruntime=/{}".format(self.settings.compiler.runtime), - "debug={}".format(debug), - "static={}".format(static), + f"prefix={self.package_folder}", + f"cruntime=/{msvc_runtime_flag(self)}", + f"debug={debug}", + f"static={static}", ] - if self.deps_cpp_info.include_paths: - args.append("include=\"{}\"".format(";".join(self.deps_cpp_info.include_paths))) - if self.deps_cpp_info.lib_paths: - args.append("lib=\"{}\"".format(";".join(self.deps_cpp_info.lib_paths))) - for name in self._option_names: + incdirs = [incdir for dep in self.dependencies.values() for incdir in dep.cpp_info.includedirs] + libdirs = [libdir for dep in self.dependencies.values() for libdir in dep.cpp_info.libdirs] + args.append(f"include=\"{';'.join(incdirs)}\"") + args.append(f"lib=\"{';'.join(libdirs)}\"") + + for name in self._configure_option_names: cname = {"mem-debug": "mem_debug", "run-debug": "run_debug", "docbook": "docb"}.get(name, name) value = getattr(self.options, name) value = "yes" if value else "no" - args.append("%s=%s" % (cname, value)) + args.append(f"{cname}={value}") configure_command = ' '.join(args) self.output.info(configure_command) @@ -151,14 +189,15 @@ def _build_msvc(self): def fix_library(option, package, old_libname): if option: libs = [] - for lib in itertools.chain(self.deps_cpp_info[package].libs, self.deps_cpp_info[package].system_libs): + aggregated_cpp_info = self.dependencies[package].cpp_info.aggregated_components() + for lib in itertools.chain(aggregated_cpp_info.libs, aggregated_cpp_info.system_libs): libname = lib if not libname.endswith('.lib'): libname += '.lib' libs.append(libname) - tools.replace_in_file("Makefile.msvc", - "LIBS = $(LIBS) %s" % old_libname, - "LIBS = $(LIBS) %s" % ' '.join(libs)) + replace_in_file(self, "Makefile.msvc", + f"LIBS = $(LIBS) {old_libname}", + f"LIBS = $(LIBS) {' '.join(libs)}") fix_library(self.options.zlib, 'zlib', 'zlib.lib') fix_library(self.options.lzma, "xz_utils", "liblzma.lib") @@ -172,42 +211,37 @@ def fix_library(option, package, old_libname): self.run("nmake /f Makefile.msvc utils") def _package_msvc(self): - with self._msvc_build_environment(): + with chdir(self, os.path.join(self.source_folder, 'win32')): self.run("nmake /f Makefile.msvc install-libs") if self.options.include_utils: self.run("nmake /f Makefile.msvc install-dist") - @contextmanager - def _mingw_build_environment(self): - with tools.chdir(os.path.join(self._source_subfolder, "win32")): - with tools.environment_append(AutoToolsBuildEnvironment(self).vars): - yield - def _build_mingw(self): - with self._mingw_build_environment(): + with chdir(self, os.path.join(self.source_folder, "win32")): # configuration yes_no = lambda v: "yes" if v else "no" args = [ "cscript", "configure.js", "compiler=mingw", - "prefix={}".format(self.package_folder), - "debug={}".format(yes_no(self.settings.build_type == "Debug")), - "static={}".format(yes_no(not self.options.shared)), + f"prefix={self.package_folder}", + f"debug={yes_no(self.settings.build_type == 'Debug')}", + f"static={yes_no(not self.options.shared)}", ] - if self.deps_cpp_info.include_paths: - args.append("include=\"{}\"".format(" -I".join(self.deps_cpp_info.include_paths))) - if self.deps_cpp_info.lib_paths: - args.append("lib=\"{}\"".format(" -L".join(self.deps_cpp_info.lib_paths))) - for name in self._option_names: + incdirs = [incdir for dep in self.dependencies.values() for incdir in dep.cpp_info.includedirs] + libdirs = [libdir for dep in self.dependencies.values() for libdir in dep.cpp_info.libdirs] + args.append(f"include=\"{' -I'.join(incdirs)}\"") + args.append(f"lib=\"{' -L'.join(libdirs)}\"") + + for name in self._configure_option_names: cname = { "mem-debug": "mem_debug", "run-debug": "run_debug", "docbook": "docb", }.get(name, name) - args.append("{}={}".format(cname, yes_no(getattr(self.options, name)))) + args.append(f"{cname}={yes_no(getattr(self.options, name))}") configure_command = " ".join(args) self.output.info(configure_command) self.run(configure_command) @@ -215,138 +249,134 @@ def _build_mingw(self): # build def fix_library(option, package, old_libname): if option: - tools.replace_in_file( + aggregated_cpp_info = self.dependencies[package].cpp_info.aggregated_components() + replace_in_file(self, "Makefile.mingw", - "LIBS += -l{}".format(old_libname), - "LIBS += -l{}".format(" -l".join(self.deps_cpp_info[package].libs)), + f"LIBS += -l{old_libname}", + f"LIBS += -l{' -l'.join(aggregated_cpp_info.libs)}", ) fix_library(self.options.iconv, "libiconv", "iconv") fix_library(self.options.zlib, "zlib", "z") fix_library(self.options.lzma, "xz_utils", "lzma") - self.run("mingw32-make -j{} -f Makefile.mingw libxml libxmla".format(tools.cpu_count())) + self.run(f"mingw32-make -j{build_jobs(self)} -f Makefile.mingw libxml libxmla") if self.options.include_utils: - self.run("mingw32-make -j{} -f Makefile.mingw utils".format(tools.cpu_count())) + self.run(f"mingw32-make -j{build_jobs(self)} -f Makefile.mingw utils") def _package_mingw(self): - with self._mingw_build_environment(): - tools.mkdir(os.path.join(self.package_folder, "include", "libxml2")) + with chdir(self, os.path.join(self.source_folder, "win32")): + mkdir(self, os.path.join(self.package_folder, "include", "libxml2")) self.run("mingw32-make -f Makefile.mingw install-libs") if self.options.include_utils: self.run("mingw32-make -f Makefile.mingw install-dist") - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - autotools.libs = [] - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - for option_name in self._option_names: - option_value = getattr(self.options, option_name) - args.append("--with-{}={}".format(option_name, yes_no(option_value))) - - autotools.configure(args=args, configure_dir=self._source_subfolder) - return autotools - def _patch_sources(self): # Break dependency of install on build for makefile in ("Makefile.mingw", "Makefile.msvc"): - tools.replace_in_file(os.path.join(self._source_subfolder, "win32", makefile), + replace_in_file(self, os.path.join(self.source_folder, "win32", makefile), "install-libs : all", "install-libs :") # relocatable shared lib on macOS - tools.replace_in_file(os.path.join(self._source_subfolder, "configure"), + replace_in_file(self, os.path.join(self.source_folder, "configure"), "-install_name \\$rpath/", "-install_name @rpath/") def build(self): self._patch_sources() - if self._is_msvc: + if is_msvc(self): self._build_msvc() elif self._is_mingw_windows: self._build_mingw() else: - with tools.run_environment(self): # required for ICU build - autotools = self._configure_autotools() - autotools.make(["libxml2.la"]) + autotools = Autotools(self) + autotools.configure() + autotools.make("libxml2.la") - if self.options.include_utils: - autotools.make(["xmllint", "xmlcatalog", "xml2-config"]) + if self.options.include_utils: + for target in ["xmllint", "xmlcatalog", "xml2-config"]: + autotools.make(target) def package(self): - # copy package license - self.copy("COPYING", src=self._source_subfolder, dst="licenses", ignore_case=True, keep_path=False) - if self._is_msvc: + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), ignore_case=True, keep_path=False) + copy(self, "Copyright", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), ignore_case=True, keep_path=False) + if is_msvc(self): self._package_msvc() # remove redundant libraries to avoid confusion if not self.options.shared: - os.remove(os.path.join(self.package_folder, "bin", "libxml2.dll")) - os.remove(os.path.join(self.package_folder, "lib", "libxml2_a_dll.lib")) - os.remove(os.path.join(self.package_folder, "lib", "libxml2_a.lib" if self.options.shared else "libxml2.lib")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + rm(self, "libxml2.dll", os.path.join(self.package_folder, "bin")) + rm(self, "libxml2_a_dll.lib", os.path.join(self.package_folder, "lib")) + rm(self, "libxml2_a.lib" if self.options.shared else "libxml2.lib", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) elif self._is_mingw_windows: self._package_mingw() if self.options.shared: - os.remove(os.path.join(self.package_folder, "lib", "libxml2.a")) - tools.rename(os.path.join(self.package_folder, "lib", "libxml2.lib"), + rm(self, "libxml2.a", os.path.join(self.package_folder, "lib")) + rename(self, os.path.join(self.package_folder, "lib", "libxml2.lib"), os.path.join(self.package_folder, "lib", "libxml2.dll.a")) else: - os.remove(os.path.join(self.package_folder, "bin", "libxml2.dll")) - os.remove(os.path.join(self.package_folder, "lib", "libxml2.lib")) + rm(self, "libxml2.dll", os.path.join(self.package_folder, "bin")) + rm(self, "libxml2.lib", os.path.join(self.package_folder, "lib")) else: - autotools = self._configure_autotools() - autotools.make(["install-libLTLIBRARIES", "install-data"]) + autotools = Autotools(self) + + for target in ["install-libLTLIBRARIES", "install-data"]: + autotools.make(target=target, args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) if self.options.include_utils: - autotools.make(["install", "xmllint", "xmlcatalog", "xml2-config"]) + autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.sh") - for prefix in ["run", "test"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), prefix + "*") - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rm(self, "*.sh", os.path.join(self.package_folder, "lib")) + rm(self, "run*", os.path.join(self.package_folder, "bin")) + rm(self, "test*", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) for header in ["win32config.h", "wsockcompat.h"]: - self.copy(pattern=header, src=os.path.join(self._source_subfolder, "include"), - dst=os.path.join("include", "libxml2"), keep_path=False) + copy(self, pattern=header, src=os.path.join(self.source_folder, "include"), + dst=os.path.join(self.package_folder, "include", "libxml2"), keep_path=False) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_file_rel_path) ) - @staticmethod - def _create_cmake_module_variables(module_file): + def _create_cmake_module_variables(self, module_file): # FIXME: also define LIBXML2_XMLLINT_EXECUTABLE variable content = textwrap.dedent("""\ - if(DEFINED LibXml2_FOUND) - set(LIBXML2_FOUND ${LibXml2_FOUND}) - endif() - if(DEFINED LibXml2_INCLUDE_DIR) - set(LIBXML2_INCLUDE_DIR ${LibXml2_INCLUDE_DIR}) - set(LIBXML2_INCLUDE_DIRS ${LibXml2_INCLUDE_DIR}) + set(LibXml2_FOUND TRUE) + set(LIBXML2_FOUND TRUE) + if(DEFINED LibXml2_INCLUDE_DIRS) + set(LIBXML2_INCLUDE_DIR ${LibXml2_INCLUDE_DIRS}) + set(LIBXML2_INCLUDE_DIRS ${LibXml2_INCLUDE_DIRS}) + elseif(DEFINED libxml2_INCLUDE_DIRS) + set(LIBXML2_LIBRARIES ${libxml2_INCLUDE_DIRS}) + set(LIBXML2_LIBRARY ${libxml2_INCLUDE_DIRS}) endif() if(DEFINED LibXml2_LIBRARIES) set(LIBXML2_LIBRARIES ${LibXml2_LIBRARIES}) set(LIBXML2_LIBRARY ${LibXml2_LIBRARIES}) + elseif(DEFINED libxml2_LIBRARIES) + set(LIBXML2_LIBRARIES ${libxml2_LIBRARIES}) + set(LIBXML2_LIBRARY ${libxml2_LIBRARIES}) endif() if(DEFINED LibXml2_DEFINITIONS) set(LIBXML2_DEFINITIONS ${LibXml2_DEFINITIONS}) + elseif(DEFINED libxml2_DEFINITIONS) + set(LIBXML2_DEFINITIONS ${libxml2_DEFINITIONS}) endif() if(DEFINED LibXml2_VERSION) set(LIBXML2_VERSION_STRING ${LibXml2_VERSION}) + elseif(DEFINED libxml2_VERSION) + set(LIBXML2_VERSION_STRING ${libxml2_VERSION}) endif() """) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") def package_info(self): # FIXME: Provide LibXml2::xmllint & LibXml2::xmlcatalog imported target for executables @@ -356,20 +386,22 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "LibXml2::LibXml2") self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) self.cpp_info.set_property("pkg_config_name", "libxml-2.0") - prefix = "lib" if self._is_msvc else "" - suffix = "_a" if self._is_msvc and not self.options.shared else "" - self.cpp_info.libs = ["{}xml2{}".format(prefix, suffix)] + prefix = "lib" if is_msvc(self) else "" + suffix = "_a" if is_msvc(self) and not self.options.shared else "" + self.cpp_info.libs = [f"{prefix}xml2{suffix}"] self.cpp_info.includedirs.append(os.path.join("include", "libxml2")) if not self.options.shared: self.cpp_info.defines = ["LIBXML_STATIC"] if self.options.include_utils: bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) + self.output.info(f"Appending PATH environment variable: {bindir}") self.env_info.PATH.append(bindir) if self.settings.os in ["Linux", "FreeBSD", "Android"]: self.cpp_info.system_libs.append("m") if self.options.threads and self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("dl") elif self.settings.os == "Windows": if self.options.ftp or self.options.http: self.cpp_info.system_libs.extend(["ws2_32", "wsock32"]) diff --git a/recipes/libxml2/all/test_cmake_module_package/CMakeLists.txt b/recipes/libxml2/all/test_cmake_module_package/CMakeLists.txt new file mode 100644 index 0000000000000..90d37ee9afb23 --- /dev/null +++ b/recipes/libxml2/all/test_cmake_module_package/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES C) + +find_package(LibXml2 REQUIRED MODULE) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE LibXml2::LibXml2) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindLibXml2.html +# are properly defined in conan generators +set(_custom_vars + LibXml2_FOUND # since CMake 3.14 + LIBXML2_FOUND # until CMake 3.14 + LIBXML2_INCLUDE_DIR + LIBXML2_INCLUDE_DIRS + LIBXML2_LIBRARIES + LIBXML2_DEFINITIONS + LIBXML2_VERSION_STRING +) +foreach(_custom_var ${_custom_vars}) + if(DEFINED _custom_var) + message(STATUS "${_custom_var}: ${${_custom_var}}") + else() + message(FATAL_ERROR "${_custom_var} not defined") + endif() +endforeach() diff --git a/recipes/libxml2/all/test_cmake_module_package/conanfile.py b/recipes/libxml2/all/test_cmake_module_package/conanfile.py new file mode 100644 index 0000000000000..20481a742d614 --- /dev/null +++ b/recipes/libxml2/all/test_cmake_module_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + xml_path = os.path.join(self.source_folder, os.pardir, "test_package", "books.xml") + self.run(f"{bin_path} {xml_path}", env="conanrun") diff --git a/recipes/libxml2/all/test_package/CMakeLists.txt b/recipes/libxml2/all/test_package/CMakeLists.txt index ef5697dfd1bf3..9d8bc300051af 100644 --- a/recipes/libxml2/all/test_package/CMakeLists.txt +++ b/recipes/libxml2/all/test_package/CMakeLists.txt @@ -1,17 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(LibXml2 REQUIRED) -message("LIBXML2_FOUND: ${LIBXML2_FOUND}") -message("LIBXML2_INCLUDE_DIR: ${LIBXML2_INCLUDE_DIR}") -message("LIBXML2_INCLUDE_DIRS: ${LIBXML2_INCLUDE_DIRS}") -message("LIBXML2_LIBRARIES: ${LIBXML2_LIBRARIES}") -message("LIBXML2_LIBRARY: ${LIBXML2_LIBRARY}") -message("LIBXML2_DEFINITIONS: ${LIBXML2_DEFINITIONS}") -message("LIBXML2_VERSION_STRING: ${LIBXML2_VERSION_STRING}") +find_package(libxml2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} LibXml2::LibXml2) +target_link_libraries(${PROJECT_NAME} PRIVATE LibXml2::LibXml2) diff --git a/recipes/libxml2/all/test_package/conanfile.py b/recipes/libxml2/all/test_package/conanfile.py index 72a57becf4f86..dc536a85d6547 100644 --- a/recipes/libxml2/all/test_package/conanfile.py +++ b/recipes/libxml2/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,8 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") xml_path = os.path.join(self.source_folder, "books.xml") - bin_arg_path = "%s %s" % (bin_path, xml_path) - self.run(bin_arg_path, run_environment=True) + self.run(f"{bin_path} {xml_path}", env="conanrun") diff --git a/recipes/libxml2/all/test_v1_cmake_module_package/CMakeLists.txt b/recipes/libxml2/all/test_v1_cmake_module_package/CMakeLists.txt new file mode 100644 index 0000000000000..1de7a7ee473fd --- /dev/null +++ b/recipes/libxml2/all/test_v1_cmake_module_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_cmake_module_package + ${CMAKE_CURRENT_BINARY_DIR}/test_cmake_module_package) diff --git a/recipes/libxml2/all/test_v1_cmake_module_package/conanfile.py b/recipes/libxml2/all/test_v1_cmake_module_package/conanfile.py new file mode 100644 index 0000000000000..ca3b4e232a4f3 --- /dev/null +++ b/recipes/libxml2/all/test_v1_cmake_module_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + xml_path = os.path.join(self.source_folder, os.pardir, "test_package", "books.xml") + self.run(f"{bin_path} {xml_path}", run_environment=True) diff --git a/recipes/libxml2/all/test_v1_package/CMakeLists.txt b/recipes/libxml2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libxml2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libxml2/all/test_v1_package/conanfile.py b/recipes/libxml2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ae0f76f08489b --- /dev/null +++ b/recipes/libxml2/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + xml_path = os.path.join(self.source_folder, os.pardir, "test_package", "books.xml") + self.run(f"{bin_path} {xml_path}", run_environment=True) diff --git a/recipes/libxml2/config.yml b/recipes/libxml2/config.yml index 4393d19ed8611..6e02d8e0c9b1d 100644 --- a/recipes/libxml2/config.yml +++ b/recipes/libxml2/config.yml @@ -1,4 +1,6 @@ versions: + "2.10.3": + folder: all "2.9.14": folder: all "2.9.13": diff --git a/recipes/libxshmfence/all/conanfile.py b/recipes/libxshmfence/all/conanfile.py index a4136cd3cae48..abd496668a102 100644 --- a/recipes/libxshmfence/all/conanfile.py +++ b/recipes/libxshmfence/all/conanfile.py @@ -1,9 +1,11 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rm, rmdir +from conans import tools, AutoToolsBuildEnvironment import contextlib import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class LibxshmfenceConan(ConanFile): name = "libxshmfence" @@ -38,31 +40,35 @@ def _settings_build(self): def _user_info_build(self): return getattr(self, "user_info_build", self.deps_user_info) + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - + def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + # for plain C projects only + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("Windows is not supported by libxshmfence recipe. Contributions are welcome") def build_requirements(self): - self.build_requires("automake/1.16.4") - self.build_requires("pkgconf/1.7.4") + self.build_requires("automake/1.16.5") + self.build_requires("pkgconf/1.9.3") if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): self.build_requires("msys2/cci.latest") def requirements(self): - self.requires("xorg-proto/2021.4") + self.requires("xorg-proto/2022.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) @contextlib.contextmanager @@ -91,8 +97,7 @@ def _configure_autotools(self): return self._autotools def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) with self._build_context(): autotools = self._configure_autotools() autotools.make() @@ -102,9 +107,10 @@ def package(self): with self._build_context(): autotools = self._configure_autotools() autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.libs = ["xshmfence"] self.cpp_info.names["pkg_config"] = "xshmfence" + self.cpp_info.set_property("pkg_config_name", "xshmfence") diff --git a/recipes/libyaml/all/conanfile.py b/recipes/libyaml/all/conanfile.py index 2a57f8a141776..cccd3e0ddb5e0 100644 --- a/recipes/libyaml/all/conanfile.py +++ b/recipes/libyaml/all/conanfile.py @@ -5,17 +5,18 @@ import os import textwrap -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.54.0" class LibYAMLConan(ConanFile): name = "libyaml" description = "LibYAML is a YAML parser and emitter library." - topics = ("libyaml", "yaml", "parser", "emitter") + topics = ("yaml", "parser", "emitter") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/yaml/libyaml" license = "MIT" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,29 +33,20 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) - tc.variables["INSTALL_CMAKE_DIR"] = 'lib/cmake/libyaml' + tc.variables["INSTALL_CMAKE_DIR"] = "lib/cmake/libyaml" tc.variables["YAML_STATIC_LIB_NAME"] = "yaml" - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): diff --git a/recipes/libyaml/all/test_package/conanfile.py b/recipes/libyaml/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/libyaml/all/test_package/conanfile.py +++ b/recipes/libyaml/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/libyaml/all/test_v1_package/CMakeLists.txt b/recipes/libyaml/all/test_v1_package/CMakeLists.txt index a18efb3f96156..0d20897301b68 100644 --- a/recipes/libyaml/all/test_v1_package/CMakeLists.txt +++ b/recipes/libyaml/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(yaml REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE yaml) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libyuv/all/CMakeLists.txt b/recipes/libyuv/all/CMakeLists.txt deleted file mode 100644 index 0feb437e18418..0000000000000 --- a/recipes/libyuv/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/libyuv/all/conandata.yml b/recipes/libyuv/all/conandata.yml index 263cd3d833101..e839599c0c5fc 100644 --- a/recipes/libyuv/all/conandata.yml +++ b/recipes/libyuv/all/conandata.yml @@ -1,8 +1,28 @@ +# Versions from LIBYUV_VERSION definition in include/libyuv/version.h +# Pay attention to package commits incrementing this definition sources: - "cci.20201106": - url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/2664f649bc0a32e05f5bc3ff4d12134e41aa08c4.tar.gz" - + "1854": + url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/3abd6f36b6e4f5a2e0ce236580a8bc1da3c7cf7e.tar.gz" + "1845": + url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/b9adaef1133ee835efc8970d1dcdcf23a5b68eba.tar.gz" + "1841": + url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/f71c83552d373f0ff41833b17e2880632d8561d7.tar.gz" + "1768": + url: "https://chromium.googlesource.com/libyuv/libyuv/+archive/dfaf7534e0e536f7e5ef8ddd7326797bd09b8622.tar.gz" patches: - "cci.20201106": - - patch_file: "patches/001-cmake.patch" - base_path: "source_subfolder" + "1854": + - patch_file: "patches/1854-0001-fix-cmake.patch" + patch_description: "Fix CMake to be more robust & predictable" + patch_type: "conan" + "1845": + - patch_file: "patches/1841-0001-fix-cmake.patch" + patch_description: "Fix CMake to be more robust & predictable" + patch_type: "conan" + "1841": + - patch_file: "patches/1841-0001-fix-cmake.patch" + patch_description: "Fix CMake to be more robust & predictable" + patch_type: "conan" + "1768": + - patch_file: "patches/1768-0001-fix-cmake.patch" + patch_description: "Fix CMake to be more robust & predictable" + patch_type: "conan" diff --git a/recipes/libyuv/all/conanfile.py b/recipes/libyuv/all/conanfile.py index eb9cd551985b4..7e0ba399e3d6e 100644 --- a/recipes/libyuv/all/conanfile.py +++ b/recipes/libyuv/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os +required_conan_version = ">=1.53.0" + class LibyuvConan(ConanFile): name = "libyuv" @@ -10,21 +13,21 @@ class LibyuvConan(ConanFile): description = "libyuv is an open source project that includes YUV scaling and conversion functionality." topics = ["YUV", "libyuv", "google", "chromium"] license = "BSD-3-Clause" - settings = "os", "compiler", "arch", "build_type" - options = {"shared": [True, False], - "fPIC": [True, False], - "with_jpeg": [False, "libjpeg", "libjpeg-turbo"]} - default_options = {"shared": False, - "fPIC": True, - "with_jpeg": "libjpeg"} - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - _cmake = None + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], + } + default_options = { + "shared": False, + "fPIC": True, + "with_jpeg": "libjpeg", + } - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -32,42 +35,50 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - if str(self.options.with_jpeg) == "libjpeg-turbo": - raise ConanInvalidConfiguration( - "libjpeg-turbo is an invalid option right now, as it is not supported by the cmake script.") + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_jpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.0.5") + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") def source(self): - tools.get(**self.conan_data["sources"] - [self.version], destination=self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder) - if not self.options.with_jpeg: - self._cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_JPEG"] = True - - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TEST"] = False + tc.variables["LIBYUV_WITH_JPEG"] = bool(self.options.with_jpeg) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["yuv"] + self.cpp_info.requires = [] + if self.options.with_jpeg == "libjpeg": + self.cpp_info.requires.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + self.cpp_info.requires.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + self.cpp_info.requires.append("mozjpeg::libjpeg") + + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/libyuv/all/patches/001-cmake.patch b/recipes/libyuv/all/patches/001-cmake.patch deleted file mode 100644 index 592839d0d2872..0000000000000 --- a/recipes/libyuv/all/patches/001-cmake.patch +++ /dev/null @@ -1,50 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -23,19 +23,21 @@ - INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} ) - - # this creates the static library (.a) --ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} ) -+ADD_LIBRARY ( ${ly_lib_static} ${ly_source_files} ) -+set_property(TARGET ${ly_lib_static} PROPERTY CXX_STANDARD 11) -+target_link_libraries(${ly_lib_static} ${CONAN_LIBS}) - - # this creates the shared library (.so) --ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} ) --SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" ) --SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" ) -+#ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} ) -+#SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" ) -+#SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" ) - - # this creates the conversion tool - ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc ) - TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} ) - - --INCLUDE ( FindJPEG ) -+find_package(JPEG) - if (JPEG_FOUND) - include_directories( ${JPEG_INCLUDE_DIR} ) - target_link_libraries( yuvconvert ${JPEG_LIBRARY} ) -@@ -81,11 +83,17 @@ - - - # install the conversion tool, .so, .a, and all the header files --INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) --INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) --INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) -+#INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) -+#INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) -+#INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) - INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) - -+INSTALL(TARGETS ${ly_lib_static} -+ RUNTIME DESTINATION bin -+ LIBRARY DESTINATION lib -+ ARCHIVE DESTINATION lib -+) -+ - # create the .deb and .rpm packages using cpack - INCLUDE ( CM_linux_packages.cmake ) - diff --git a/recipes/libyuv/all/patches/1768-0001-fix-cmake.patch b/recipes/libyuv/all/patches/1768-0001-fix-cmake.patch new file mode 100644 index 0000000000000..c5cf6a86be66a --- /dev/null +++ b/recipes/libyuv/all/patches/1768-0001-fix-cmake.patch @@ -0,0 +1,59 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,8 +2,8 @@ + # Originally created for "roxlu build system" to compile libyuv on windows + # Run with -DTEST=ON to build unit tests + ++CMAKE_MINIMUM_REQUIRED( VERSION 3.8 ) + PROJECT ( YUV C CXX ) # "C" is required even for C++ projects +-CMAKE_MINIMUM_REQUIRED( VERSION 2.8 ) + OPTION( TEST "Built unit tests" OFF ) + + SET ( ly_base_dir ${PROJECT_SOURCE_DIR} ) +@@ -23,23 +23,23 @@ LIST ( SORT ly_unittest_sources ) + INCLUDE_DIRECTORIES( BEFORE ${ly_inc_dir} ) + + # this creates the static library (.a) +-ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} ) ++ADD_LIBRARY ( ${ly_lib_static} ${ly_source_files} ) ++target_compile_features(${ly_lib_static} PUBLIC cxx_std_11) ++set_target_properties(${ly_lib_static} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + + # this creates the shared library (.so) +-ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} ) +-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" ) +-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" ) + + # this creates the conversion tool + ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc ) + TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} ) + + +-INCLUDE ( FindJPEG ) +-if (JPEG_FOUND) +- include_directories( ${JPEG_INCLUDE_DIR} ) +- target_link_libraries( yuvconvert ${JPEG_LIBRARY} ) +- add_definitions( -DHAVE_JPEG ) ++option(LIBYUV_WITH_JPEG "Build libyuv with jpeg" ON) ++if (LIBYUV_WITH_JPEG) ++ find_package(JPEG REQUIRED) ++ target_link_libraries(${ly_lib_static} JPEG::JPEG ) ++ target_compile_definitions(${ly_lib_static} PRIVATE HAVE_JPEG) ++ target_compile_definitions(yuvconvert PRIVATE HAVE_JPEG) + endif() + + if(TEST) +@@ -81,11 +81,9 @@ endif() + + + # install the conversion tool, .so, .a, and all the header files +-INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) +-INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) +-INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) ++INSTALL ( TARGETS yuvconvert DESTINATION bin) ++INSTALL ( TARGETS ${ly_lib_static} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) + INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) + + # create the .deb and .rpm packages using cpack +-INCLUDE ( CM_linux_packages.cmake ) + diff --git a/recipes/libyuv/all/patches/1841-0001-fix-cmake.patch b/recipes/libyuv/all/patches/1841-0001-fix-cmake.patch new file mode 100644 index 0000000000000..aa4506b3d1cac --- /dev/null +++ b/recipes/libyuv/all/patches/1841-0001-fix-cmake.patch @@ -0,0 +1,62 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,8 +2,8 @@ + # Originally created for "roxlu build system" to compile libyuv on windows + # Run with -DTEST=ON to build unit tests + ++CMAKE_MINIMUM_REQUIRED( VERSION 3.8 ) + PROJECT ( YUV C CXX ) # "C" is required even for C++ projects +-CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 ) + OPTION( TEST "Built unit tests" OFF ) + + SET ( ly_base_dir ${PROJECT_SOURCE_DIR} ) +@@ -27,26 +27,23 @@ if(MSVC) + endif() + + # this creates the static library (.a) +-ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} ) ++ADD_LIBRARY ( ${ly_lib_static} ${ly_source_files} ) ++target_compile_features(${ly_lib_static} PUBLIC cxx_std_11) ++set_target_properties(${ly_lib_static} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + + # this creates the shared library (.so) +-ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} ) +-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" ) +-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" ) +-if(WIN32) +- SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES IMPORT_PREFIX "lib" ) +-endif() + + # this creates the conversion tool + ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc ) + TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} ) + + +-INCLUDE ( FindJPEG ) +-if (JPEG_FOUND) +- include_directories( ${JPEG_INCLUDE_DIR} ) +- target_link_libraries( yuvconvert ${JPEG_LIBRARY} ) +- add_definitions( -DHAVE_JPEG ) ++option(LIBYUV_WITH_JPEG "Build libyuv with jpeg" ON) ++if (LIBYUV_WITH_JPEG) ++ find_package(JPEG REQUIRED) ++ target_link_libraries(${ly_lib_static} JPEG::JPEG ) ++ target_compile_definitions(${ly_lib_static} PRIVATE HAVE_JPEG) ++ target_compile_definitions(yuvconvert PRIVATE HAVE_JPEG) + endif() + + if(TEST) +@@ -82,11 +79,9 @@ endif() + + + # install the conversion tool, .so, .a, and all the header files +-INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) +-INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) +-INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) ++INSTALL ( TARGETS yuvconvert DESTINATION bin) ++INSTALL ( TARGETS ${ly_lib_static} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) + INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) + + # create the .deb and .rpm packages using cpack +-INCLUDE ( CM_linux_packages.cmake ) + diff --git a/recipes/libyuv/all/patches/1854-0001-fix-cmake.patch b/recipes/libyuv/all/patches/1854-0001-fix-cmake.patch new file mode 100644 index 0000000000000..1a2b79c67847c --- /dev/null +++ b/recipes/libyuv/all/patches/1854-0001-fix-cmake.patch @@ -0,0 +1,69 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -2,8 +2,8 @@ + # Originally created for "roxlu build system" to compile libyuv on windows + # Run with -DTEST=ON to build unit tests + ++CMAKE_MINIMUM_REQUIRED( VERSION 3.8 ) + PROJECT ( YUV C CXX ) # "C" is required even for C++ projects +-CMAKE_MINIMUM_REQUIRED( VERSION 2.8.12 ) + OPTION( TEST "Built unit tests" OFF ) + + SET ( ly_base_dir ${PROJECT_SOURCE_DIR} ) +@@ -27,15 +27,11 @@ if(MSVC) + endif() + + # this creates the static library (.a) +-ADD_LIBRARY ( ${ly_lib_static} STATIC ${ly_source_files} ) ++ADD_LIBRARY ( ${ly_lib_static} ${ly_source_files} ) ++target_compile_features(${ly_lib_static} PUBLIC cxx_std_11) ++set_target_properties(${ly_lib_static} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + + # this creates the shared library (.so) +-ADD_LIBRARY ( ${ly_lib_shared} SHARED ${ly_source_files} ) +-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES OUTPUT_NAME "${ly_lib_name}" ) +-SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES PREFIX "lib" ) +-if(WIN32) +- SET_TARGET_PROPERTIES ( ${ly_lib_shared} PROPERTIES IMPORT_PREFIX "lib" ) +-endif() + + # this creates the conversion tool + ADD_EXECUTABLE ( yuvconvert ${ly_base_dir}/util/yuvconvert.cc ) +@@ -44,12 +40,18 @@ TARGET_LINK_LIBRARIES ( yuvconvert ${ly_lib_static} ) + # this creates the yuvconstants tool + ADD_EXECUTABLE ( yuvconstants ${ly_base_dir}/util/yuvconstants.c ) + TARGET_LINK_LIBRARIES ( yuvconstants ${ly_lib_static} ) ++include(CheckFunctionExists) ++check_function_exists(round HAVE_MATH_SYSTEM) ++if(NOT HAVE_MATH_SYSTEM) ++ target_link_libraries(yuvconstants m) ++endif() + +-find_package ( JPEG ) +-if (JPEG_FOUND) +- include_directories( ${JPEG_INCLUDE_DIR} ) +- target_link_libraries( ${ly_lib_shared} ${JPEG_LIBRARY} ) +- add_definitions( -DHAVE_JPEG ) ++option(LIBYUV_WITH_JPEG "Build libyuv with jpeg" ON) ++if (LIBYUV_WITH_JPEG) ++ find_package(JPEG REQUIRED) ++ target_link_libraries(${ly_lib_static} JPEG::JPEG ) ++ target_compile_definitions(${ly_lib_static} PRIVATE HAVE_JPEG) ++ target_compile_definitions(yuvconvert PRIVATE HAVE_JPEG) + endif() + + if(TEST) +@@ -91,11 +93,9 @@ endif() + + + # install the conversion tool, .so, .a, and all the header files +-INSTALL ( PROGRAMS ${CMAKE_BINARY_DIR}/yuvconvert DESTINATION bin ) +-INSTALL ( TARGETS ${ly_lib_static} DESTINATION lib ) +-INSTALL ( TARGETS ${ly_lib_shared} LIBRARY DESTINATION lib RUNTIME DESTINATION bin ) ++INSTALL ( TARGETS yuvconvert yuvconstants DESTINATION bin) ++INSTALL ( TARGETS ${ly_lib_static} RUNTIME DESTINATION bin ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) + INSTALL ( DIRECTORY ${PROJECT_SOURCE_DIR}/include/ DESTINATION include ) + + # create the .deb and .rpm packages using cpack +-INCLUDE ( CM_linux_packages.cmake ) + diff --git a/recipes/libyuv/all/test_package/CMakeLists.txt b/recipes/libyuv/all/test_package/CMakeLists.txt index 9c43a46da45b0..639163e3b7c5c 100644 --- a/recipes/libyuv/all/test_package/CMakeLists.txt +++ b/recipes/libyuv/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(libyuv REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE libyuv::libyuv) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libyuv/all/test_package/conanfile.py b/recipes/libyuv/all/test_package/conanfile.py index 1d0bdd3779793..0a6bc68712d90 100644 --- a/recipes/libyuv/all/test_package/conanfile.py +++ b/recipes/libyuv/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libyuv/all/test_v1_package/CMakeLists.txt b/recipes/libyuv/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libyuv/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libyuv/all/test_v1_package/conanfile.py b/recipes/libyuv/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libyuv/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libyuv/config.yml b/recipes/libyuv/config.yml index 9e8967e0f82ea..c1f0cfd37130f 100644 --- a/recipes/libyuv/config.yml +++ b/recipes/libyuv/config.yml @@ -1,3 +1,9 @@ versions: - "cci.20201106": + "1854": + folder: all + "1845": + folder: all + "1841": + folder: all + "1768": folder: all diff --git a/recipes/libzen/all/CMakeLists.txt b/recipes/libzen/all/CMakeLists.txt deleted file mode 100644 index 81aa48abdc8fb..0000000000000 --- a/recipes/libzen/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_subdirectory(source_subfolder/Project/CMake) diff --git a/recipes/libzen/all/conandata.yml b/recipes/libzen/all/conandata.yml index 40a3c7bd86016..c0b761db1ccf7 100644 --- a/recipes/libzen/all/conandata.yml +++ b/recipes/libzen/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "0.4.38": - patch_file: "patches/0001-enable-WIN32-shared-libraries.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-export-data-in-windows-dlls.patch" - base_path: "source_subfolder" diff --git a/recipes/libzen/all/conanfile.py b/recipes/libzen/all/conanfile.py index f5c678b4efb25..1a994b7d1e470 100644 --- a/recipes/libzen/all/conanfile.py +++ b/recipes/libzen/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class LibzenConan(ConanFile): @@ -11,9 +14,9 @@ class LibzenConan(ConanFile): homepage = "https://github.com/MediaArea/ZenLib" url = "https://github.com/conan-io/conan-center-index" description = "Small C++ derivate classes to have an easier life" - topics = ("libzen", "c++", "helper", "util") + topics = ("c++", "helper", "util") - settings = "os", "arch", "compiler", "build_type" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -27,17 +30,8 @@ class LibzenConan(ConanFile): "enable_large_files": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,39 +39,43 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_UNICODE"] = self.options.enable_unicode - self._cmake.definitions["LARGE_FILES"] = self.options.enable_large_files + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_UNICODE"] = self.options.enable_unicode + tc.variables["LARGE_FILES"] = self.options.enable_large_files + # Export symbols for msvc shared + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True # To install relocatable shared libs on Macos - self._cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - self._cmake.configure() - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "Project", "CMake")) cmake.build() def package(self): - self.copy("License.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -85,21 +83,20 @@ def package(self): {"zen": "ZenLib::ZenLib"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "ZenLib") @@ -109,9 +106,9 @@ def package_info(self): if self.settings.build_type == "Debug": if self.settings.os == "Windows": suffix = "d" - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): suffix = "_debug" - self.cpp_info.libs = ["zen{}".format(suffix)] + self.cpp_info.libs = [f"zen{suffix}"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "pthread"]) if self.options.enable_unicode: diff --git a/recipes/libzen/all/test_package/CMakeLists.txt b/recipes/libzen/all/test_package/CMakeLists.txt index debeb0617c7a5..761c4f457a6d2 100644 --- a/recipes/libzen/all/test_package/CMakeLists.txt +++ b/recipes/libzen/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(ZenLib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} zen) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE zen) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libzen/all/test_package/conanfile.py b/recipes/libzen/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/libzen/all/test_package/conanfile.py +++ b/recipes/libzen/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libzen/all/test_v1_package/CMakeLists.txt b/recipes/libzen/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libzen/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libzen/all/test_v1_package/conanfile.py b/recipes/libzen/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/libzen/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libzip/all/CMakeLists.txt b/recipes/libzip/all/CMakeLists.txt deleted file mode 100644 index 824352804d5b4..0000000000000 --- a/recipes/libzip/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/libzip/all/conandata.yml b/recipes/libzip/all/conandata.yml index 9d8421b4670c9..567f243d79a98 100644 --- a/recipes/libzip/all/conandata.yml +++ b/recipes/libzip/all/conandata.yml @@ -1,14 +1,26 @@ sources: + "1.9.2": + url: [ + "https://libzip.org/download/libzip-1.9.2.tar.gz", + "https://github.com/nih-at/libzip/releases/download/v1.9.2/libzip-1.9.2.tar.gz", + ] + sha256: "fd6a7f745de3d69cf5603edc9cb33d2890f0198e415255d0987a0cf10d824c6f" "1.8.0": - url: "https://libzip.org/download/libzip-1.8.0.tar.gz" + url: [ + "https://libzip.org/download/libzip-1.8.0.tar.gz", + "https://github.com/nih-at/libzip/releases/download/v1.8.0/libzip-1.8.0.tar.gz", + ] sha256: "30ee55868c0a698d3c600492f2bea4eb62c53849bcf696d21af5eb65f3f3839e" "1.7.3": - url: "https://libzip.org/download/libzip-1.7.3.tar.gz" + url: [ + "https://libzip.org/download/libzip-1.7.3.tar.gz", + "https://github.com/nih-at/libzip/releases/download/v1.7.3/libzip-1.7.3.tar.gz", + ] sha256: "0e2276c550c5a310d4ebf3a2c3dfc43fb3b4602a072ff625842ad4f3238cb9cc" patches: + "1.9.2": + - patch_file: "patches/0001-cmake-install-bundle.patch" "1.8.0": - patch_file: "patches/0001-cmake-install-bundle.patch" - base_path: "source_subfolder" "1.7.3": - patch_file: "patches/0001-cmake-install-bundle.patch" - base_path: "source_subfolder" diff --git a/recipes/libzip/all/conanfile.py b/recipes/libzip/all/conanfile.py index bbfa5e8862971..aa51f4e16ed75 100644 --- a/recipes/libzip/all/conanfile.py +++ b/recipes/libzip/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LibZipConan(ConanFile): @@ -11,7 +14,7 @@ class LibZipConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/nih-at/libzip" license = "BSD-3-Clause" - topics = ("zip", "libzip", "zip-archives", "zip-editing") + topics = ("zip", "zip-archives", "zip-editing") settings = "os", "arch", "compiler", "build_type" options = { @@ -20,7 +23,7 @@ class LibZipConan(ConanFile): "with_bzip2": [True, False], "with_lzma": [True, False], "with_zstd": [True, False], - "crypto": [False, "win32", "openssl", "mbedtls", "auto"], + "crypto": [False, "win32", "openssl", "mbedtls"], "tools": [True, False], } default_options = { @@ -33,21 +36,12 @@ class LibZipConan(ConanFile): "tools": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _has_zstd_support(self): - return tools.Version(self.version) >= "1.8.0" + return Version(self.version) >= "1.8.0" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -59,19 +53,16 @@ def config_options(self): self.options.crypto = "win32" def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - # Deprecate "auto" value of crypto option - if self.options.crypto == "auto": - crypto_value = "win32" if self.settings.os == "Windows" else "openssl" - self.output.warn("'auto' value of 'crypto' option is deprecated, fallback to default value on {}: {}".format(self.settings.os, crypto_value)) - self.options.crypto = crypto_value + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_bzip2: self.requires("bzip2/1.0.8") @@ -83,76 +74,86 @@ def requirements(self): self.requires("zstd/1.5.2") if self.options.crypto == "openssl": - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") elif self.options.crypto == "mbedtls": self.requires("mbedtls/3.2.1") def validate(self): - if self.options.crypto == "win32" and self.settings.os != "Windows": + if self.info.options.crypto == "win32" and self.info.settings.os != "Windows": raise ConanInvalidConfiguration("Windows is required to use win32 crypto libraries") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TOOLS"] = self.options.tools + tc.variables["BUILD_REGRESS"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_DOC"] = False + tc.variables["ENABLE_LZMA"] = self.options.with_lzma + tc.variables["ENABLE_BZIP2"] = self.options.with_bzip2 + if self._has_zstd_support: + tc.variables["ENABLE_ZSTD"] = self.options.with_zstd + tc.variables["ENABLE_COMMONCRYPTO"] = False # TODO: We need CommonCrypto package + tc.variables["ENABLE_GNUTLS"] = False # TODO: We need GnuTLS package + tc.variables["ENABLE_MBEDTLS"] = self.options.crypto == "mbedtls" + tc.variables["ENABLE_OPENSSL"] = self.options.crypto == "openssl" + tc.variables["ENABLE_WINDOWS_CRYPTO"] = self.options.crypto == "win32" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) - top_cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") + top_cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") # Honor zstd enabled if self._has_zstd_support: - lib_cmakelists = os.path.join(self._source_subfolder, "lib", "CMakeLists.txt") - tools.replace_in_file(top_cmakelists, "find_package(Zstd)", "find_package(zstd)") - tools.replace_in_file(top_cmakelists, "Zstd_FOUND", "zstd_FOUND") - tools.replace_in_file(lib_cmakelists, "Zstd::Zstd", "zstd::zstd") + def zstd_find_package_pattern(version): + if version >= "1.9.2": + return "find_package(Zstd 1.3.6)" + else: + return "find_package(Zstd)" + lib_cmakelists = os.path.join(self.source_folder, "lib", "CMakeLists.txt") + replace_in_file(self, top_cmakelists, zstd_find_package_pattern(Version(self.version)), "find_package(zstd)") + replace_in_file(self, top_cmakelists, "Zstd_FOUND", "zstd_FOUND") + replace_in_file( + self, + lib_cmakelists, + "Zstd::Zstd", + "$,zstd::libzstd_shared,zstd::libzstd_static>", + ) # Do not pollute rpath of installed binaries - tools.replace_in_file( + replace_in_file( + self, top_cmakelists, "set(CMAKE_INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR})", "", ) - tools.replace_in_file( + replace_in_file( + self, top_cmakelists, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "", ) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TOOLS"] = self.options.tools - self._cmake.definitions["BUILD_REGRESS"] = False - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_DOC"] = False - - self._cmake.definitions["ENABLE_LZMA"] = self.options.with_lzma - self._cmake.definitions["ENABLE_BZIP2"] = self.options.with_bzip2 - if self._has_zstd_support: - self._cmake.definitions["ENABLE_ZSTD"] = self.options.with_zstd - - self._cmake.definitions["ENABLE_COMMONCRYPTO"] = False # TODO: We need CommonCrypto package - self._cmake.definitions["ENABLE_GNUTLS"] = False # TODO: We need GnuTLS package - - self._cmake.definitions["ENABLE_MBEDTLS"] = self.options.crypto == "mbedtls" - self._cmake.definitions["ENABLE_OPENSSL"] = self.options.crypto == "openssl" - self._cmake.definitions["ENABLE_WINDOWS_CRYPTO"] = self.options.crypto == "win32" - - self._cmake.configure() - return self._cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "libzip") @@ -166,11 +167,6 @@ def package_info(self): if self.options.crypto == "win32": self.cpp_info.components["_libzip"].system_libs.append("bcrypt") - if self.options.tools: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "libzip" self.cpp_info.names["cmake_find_package_multi"] = "libzip" @@ -189,3 +185,5 @@ def package_info(self): self.cpp_info.components["_libzip"].requires.append("openssl::crypto") elif self.options.crypto == "mbedtls": self.cpp_info.components["_libzip"].requires.append("mbedtls::mbedtls") + if self.options.tools: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/libzip/all/test_package/CMakeLists.txt b/recipes/libzip/all/test_package/CMakeLists.txt index 6654a3a296286..c95ee806189e5 100644 --- a/recipes/libzip/all/test_package/CMakeLists.txt +++ b/recipes/libzip/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(libzip REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} libzip::zip) +target_link_libraries(${PROJECT_NAME} PRIVATE libzip::zip) diff --git a/recipes/libzip/all/test_package/conanfile.py b/recipes/libzip/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/libzip/all/test_package/conanfile.py +++ b/recipes/libzip/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libzip/all/test_v1_package/CMakeLists.txt b/recipes/libzip/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/libzip/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/libzip/all/test_v1_package/conanfile.py b/recipes/libzip/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/libzip/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libzip/config.yml b/recipes/libzip/config.yml index 46f6fe51385c7..63ddbcf63ff11 100644 --- a/recipes/libzip/config.yml +++ b/recipes/libzip/config.yml @@ -1,4 +1,6 @@ versions: + "1.9.2": + folder: all "1.8.0": folder: all "1.7.3": diff --git a/recipes/libzippp/all/CMakeLists.txt b/recipes/libzippp/all/CMakeLists.txt deleted file mode 100644 index bcd4ccf17fd78..0000000000000 --- a/recipes/libzippp/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -set(CMAKE_CXX_STANDARD 11) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/libzippp/all/conandata.yml b/recipes/libzippp/all/conandata.yml index 49a240e225faf..f31401deb346d 100644 --- a/recipes/libzippp/all/conandata.yml +++ b/recipes/libzippp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "6.0-1.9.2": + url: "https://github.com/ctabin/libzippp/archive/libzippp-v6.0-1.9.2.tar.gz" + sha256: "f9aef9811802a18e69cd50527381d70c2e0f0d8a839f1d41914f6234f5964fc3" "5.0-1.8.0": url: "https://github.com/ctabin/libzippp/archive/libzippp-v5.0-1.8.0.tar.gz" sha256: "b70f2d0f64eb68b00a16290bac40ac1a3fd3d2896cfddc93e370a7fa28c591c5" diff --git a/recipes/libzippp/all/conanfile.py b/recipes/libzippp/all/conanfile.py index fa1cfae1a117c..b05dfec251011 100644 --- a/recipes/libzippp/all/conanfile.py +++ b/recipes/libzippp/all/conanfile.py @@ -1,33 +1,35 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.53.0" class LibZipppConan(ConanFile): name = "libzippp" description = "A simple basic C++ wrapper around the libzip library" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/ctabin/libzippp" - license = "BSD-3-Clause" - topics = ("zip", "libzippp", "zip-archives", "zip-editing") - exports_sources = ["CMakeLists.txt"] - generators = "cmake", "cmake_find_package_multi" - settings = "os", "compiler", "build_type", "arch" + topics = ("zip", "zlib", "libzip", "zip-archives", "zip-editing") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "with_encryption": [True, False] + "with_encryption": [True, False], } default_options = { "shared": False, "fPIC": True, - "with_encryption": False + "with_encryption": False, } - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 def config_options(self): if self.settings.os == "Windows": @@ -35,54 +37,72 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def validate(self): - libzippp_version = str(self.version) - if libzippp_version != "4.0" and len(libzippp_version.split("-")) != 2: - raise tools.ConanInvalidConfiguration("{}: version number must include '-'. (ex. '5.0-1.8.0')".format(self.name)) + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.11") - if tools.Version(self.version) == "4.0": + self.requires("zlib/1.2.13") + if Version(self.version) == "4.0": self.requires("libzip/1.7.3") else: - libzip_version = str(self.version).split("-")[1] - self.requires("libzip/{}".format(libzip_version)) + versions = str(self.version).split("-") + if len(versions) == 2: + self.requires(f"libzip/{versions[1]}") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + + libzippp_version = str(self.version) + if libzippp_version != "4.0" and len(libzippp_version.split("-")) != 2: + raise ConanInvalidConfiguration(f"{self.ref}: version number must include '-'. (ex. '5.0-1.8.0')") + + if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": + raise ConanInvalidConfiguration(f"{self.ref} does not support clang with libc++. Use libstdc++ instead.") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LIBZIPPP_INSTALL"] = True - self._cmake.definitions["LIBZIPPP_INSTALL_HEADERS"] = True - self._cmake.definitions["LIBZIPPP_ENABLE_ENCRYPTION"] = self.options.with_encryption - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.variables["LIBZIPPP_INSTALL"] = True + tc.variables["LIBZIPPP_INSTALL_HEADERS"] = True + tc.variables["LIBZIPPP_ENABLE_ENCRYPTION"] = self.options.with_encryption + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_source(self): - tools.replace_in_file('source_subfolder/CMakeLists.txt', - 'find_package(LIBZIP MODULE REQUIRED)', - 'find_package(libzip REQUIRED CONFIG)') + replace_in_file(self, os.path.join(self.source_folder, 'CMakeLists.txt'), + 'find_package(LIBZIP MODULE REQUIRED)', + 'find_package(libzip REQUIRED CONFIG)') def build(self): self._patch_source() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENCE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - self.copy(pattern="LICENCE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "cmake")) + + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "cmake")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + prefix = "lib" if self.settings.os == "Windows" else "" + postfix = "" if self.options.shared else "_static" + self.cpp_info.libs = [f"{prefix}zippp{postfix}"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.names["cmake_find_package"] = "libzippp" self.cpp_info.names["cmake_find_package_multi"] = "libzippp" self.cpp_info.set_property("cmake_file_name", "libzippp") diff --git a/recipes/libzippp/all/test_package/CMakeLists.txt b/recipes/libzippp/all/test_package/CMakeLists.txt index 148357d043ba6..5514f16e5d6bb 100644 --- a/recipes/libzippp/all/test_package/CMakeLists.txt +++ b/recipes/libzippp/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(libzippp REQUIRED) +find_package(libzippp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} libzippp::libzippp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE libzippp::libzippp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/libzippp/all/test_package/conanfile.py b/recipes/libzippp/all/test_package/conanfile.py index 3da371b660e0a..a9fb96656f203 100644 --- a/recipes/libzippp/all/test_package/conanfile.py +++ b/recipes/libzippp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/libzippp/all/test_v1_package/CMakeLists.txt b/recipes/libzippp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/libzippp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/libzippp/all/test_v1_package/conanfile.py b/recipes/libzippp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/libzippp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/libzippp/config.yml b/recipes/libzippp/config.yml index a529e567c0975..4ba054a3032a9 100644 --- a/recipes/libzippp/config.yml +++ b/recipes/libzippp/config.yml @@ -1,4 +1,6 @@ versions: + "6.0-1.9.2": + folder: all "5.0-1.8.0": folder: all "4.0": diff --git a/recipes/lief/all/CMakeLists.txt b/recipes/lief/all/CMakeLists.txt deleted file mode 100644 index 30c065f03128e..0000000000000 --- a/recipes/lief/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.5) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/lief/all/conandata.yml b/recipes/lief/all/conandata.yml index 783cb3b5db868..322361c8a5bce 100644 --- a/recipes/lief/all/conandata.yml +++ b/recipes/lief/all/conandata.yml @@ -1,18 +1,46 @@ sources: + "0.12.3": + url: "https://github.com/lief-project/LIEF/archive/0.12.3.tar.gz" + sha256: "762925ad2eed642a6e7ef2cc899bcd3e93a40a2ce1dd2391d9b9ecadfe6438cf" + "0.12.2": + url: "https://github.com/lief-project/LIEF/archive/0.12.2.tar.gz" + sha256: "d779c802ba1f80d0e93765e038e0a198fb5ffe4662afe467e33102cb44a06e99" "0.10.1": url: "https://github.com/lief-project/LIEF/archive/0.10.1.tar.gz" sha256: "6f30c98a559f137e08b25bcbb376c0259914b33c307b8b901e01ca952241d00a" patches: + "0.12.3": + - patch_file: "patches/0.12.3-001_link_to_conan.patch" + patch_description: "find conan package and link these" + patch_type: "conan" + - patch_file: "patches/0.12.2-002_support_older_gcc.patch" + patch_description: "fix name look up issue" + patch_type: "portability" + patch_source: "https://github.com/lief-project/LIEF/pull/815" + "0.12.2": + - patch_file: "patches/0.12.2-001_link_to_conan.patch" + patch_description: "find conan package and link these" + patch_type: "conan" + - patch_file: "patches/0.12.2-002_support_older_gcc.patch" + patch_description: "fix name look up issue" + patch_type: "portability" + patch_source: "https://github.com/lief-project/LIEF/pull/815" "0.10.1": - patch_file: "patches/001_link_to_conan.patch" - base_path: "source_subfolder" + patch_description: "find conan package and link these" + patch_type: "conan" - patch_file: "patches/002_fix_resources_manager.patch" - base_path: "source_subfolder" + patch_description: "use rang for colorizing" + patch_type: "backport" - patch_file: "patches/003_fix_json_include_path.patch" - base_path: "source_subfolder" + patch_description: "fix include path for conan package" + patch_type: "conan" - patch_file: "patches/004_fix_elf_parser.patch" - base_path: "source_subfolder" + patch_description: "remove LIEF_API" + patch_type: "backport" - patch_file: "patches/005_fix_compiler_detection.patch" - base_path: "source_subfolder" + patch_description: "fix check logic for compiler C++17 support" + patch_type: "backport" - patch_file: "patches/006_fix_binary_cpp.patch" - base_path: "source_subfolder" + patch_description: "include cctype" + patch_type: "backport" diff --git a/recipes/lief/all/conanfile.py b/recipes/lief/all/conanfile.py index 94959a4ba4b2a..4a9cf2b5cd972 100644 --- a/recipes/lief/all/conanfile.py +++ b/recipes/lief/all/conanfile.py @@ -1,18 +1,23 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + import os -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +required_conan_version = ">=1.53.0" class LiefConan(ConanFile): name = "lief" description = "Library to Instrument Executable Formats" - topics = ("conan", "lief", "executable", "elf") + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lief-project/LIEF" - license = "Apache-2.0" - exports_sources = "CMakeLists.txt", "patches/*" - generators = "cmake", - settings = "os", "compiler", "build_type", "arch" + topics = ("executable", "elf", "pe", "mach-o") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -42,80 +47,118 @@ class LiefConan(ConanFile): "with_vdex": True, } - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version.value) <= 14 and self.options.shared: - raise ConanInvalidConfiguration("{} {} does not support Visual Studio <= 14 with shared:True".format(self.name, self.version)) + if self.options.shared: + self.options.rm_safe("fPIC") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + + if ((self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) <= "14") + or + (self.info.settings.compiler == "msvc" and Version(self.info.settings.compiler.version) <= "190")) \ + and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} does not support Visual Studio <= 14 with shared:True") + + if self.info.settings.compiler.get_safe("libcxx") == "libstdc++": + raise ConanInvalidConfiguration(f"{self.ref} does not support libstdc++") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("rang/3.1.0") - self.requires("mbedtls/2.16.3-apache") + if Version(self.version) < "0.12.2": + self.requires("rang/3.2") + self.requires("mbedtls/3.2.1") if self.options.with_json: - self.requires("nlohmann_json/3.9.1") + self.requires("nlohmann_json/3.11.2") if self.options.with_frozen: - self.requires("frozen/1.0.0") + self.requires("frozen/1.1.1") + if Version(self.version) >= "0.12.2": + self.requires("utfcpp/3.2.2") + # lief doesn't supprot spdlog/1.11.0 with fmt/9.x yet. + self.requires("spdlog/1.10.0") + self.requires("boost/1.81.0") + self.requires("tcb-span/cci.20220616") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "LIEF-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LIEF_ART"] = self.options.with_art - self._cmake.definitions["LIEF_DEX"] = self.options.with_dex - self._cmake.definitions["LIEF_ELF"] = self.options.with_elf - self._cmake.definitions["LIEF_OAT"] = self.options.with_oat - self._cmake.definitions["LIEF_PE"] = self.options.with_pe - self._cmake.definitions["LIEF_VDEX"] = self.options.with_vdex - self._cmake.definitions["LIEF_MACHO"] = self.options.with_macho - self._cmake.definitions["LIEF_ENABLE_JSON"] = self.options.with_json - self._cmake.definitions["LIEF_DISABLE_FROZEN"] = not self.options.with_frozen - self._cmake.definitions["LIEF_C_API"] = self.options.with_c_api - self._cmake.definitions["LIEF_EXAMPLES"] = False - self._cmake.definitions["LIEF_TESTS"] = False - self._cmake.definitions["LIEF_DOC"] = False - self._cmake.definitions["LIEF_LOGGING"] = False - self._cmake.definitions["LIEF_PYTHON_API"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIEF_ART"] = self.options.with_art + tc.variables["LIEF_DEX"] = self.options.with_dex + tc.variables["LIEF_ELF"] = self.options.with_elf + tc.variables["LIEF_OAT"] = self.options.with_oat + tc.variables["LIEF_PE"] = self.options.with_pe + tc.variables["LIEF_VDEX"] = self.options.with_vdex + tc.variables["LIEF_MACHO"] = self.options.with_macho + tc.variables["LIEF_ENABLE_JSON"] = self.options.with_json + tc.variables["LIEF_DISABLE_FROZEN"] = not self.options.with_frozen + tc.variables["LIEF_C_API"] = self.options.with_c_api + tc.variables["LIEF_EXAMPLES"] = False + tc.variables["LIEF_TESTS"] = False + tc.variables["LIEF_DOC"] = False + tc.variables["LIEF_LOGGING"] = False + tc.variables["LIEF_PYTHON_API"] = False + if Version(self.version) >= "0.12.2": + tc.variables["LIEF_USE_CCACHE"] = False + tc.variables["LIEF_OPT_MBEDTLS_EXTERNAL"] = True + tc.variables["LIEF_OPT_NLOHMANN_JSON_EXTERNAL"] = True + tc.variables["LIEF_OPT_FROZEN_EXTERNAL"] = True + tc.variables["LIEF_OPT_UTFCPP_EXTERNAL"] = True + tc.variables["LIEF_EXTERNAL_SPDLOG"] = True + tc.variables["LIEF_OPT_EXTERNAL_LEAF"] = True + tc.variables["LIEF_OPT_EXTERNAL_SPAN"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.names["pkg_config"] = "lief" - self.cpp_info.names["cmake_find_package"] = "LIEF" - self.cpp_info.names["cmake_find_package_multi"] = "LIEF" - self.cpp_info.libs = tools.collect_libs(self) - self.cpp_info.defines = ["_GLIBCXX_USE_CXX11_ABI=1"] + self.cpp_info.libs = ["LIEF"] + + self.cpp_info.set_property("cmake_file_name", "LIEF") + self.cpp_info.set_property("cmake_target_name", "LIEF::LIEF") + self.cpp_info.set_property("pkg_config_name", "LIEF") + if self.options.shared: self.cpp_info.defines.append("LIEF_IMPORT") - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.cpp_info.cxxflags += ["/FIiso646.h"] if self.settings.os == "Windows" and self.options.shared: self.cpp_info.system_libs = ["ws2_32"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "LIEF" + self.cpp_info.filenames["cmake_find_package_multi"] = "LIEF" + self.cpp_info.names["cmake_find_package"] = "LIEF" + self.cpp_info.names["cmake_find_package_multi"] = "LIEF" + self.cpp_info.names["pkg_config"] = "LIEF" diff --git a/recipes/lief/all/patches/0.12.2-001_link_to_conan.patch b/recipes/lief/all/patches/0.12.2-001_link_to_conan.patch new file mode 100644 index 0000000000000..f5fad544a589a --- /dev/null +++ b/recipes/lief/all/patches/0.12.2-001_link_to_conan.patch @@ -0,0 +1,96 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7d59f14..9fdfe43 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,7 +12,6 @@ endif() + + + if(WIN32 OR ${IS_WIN_CROSS_COMPILE}) +- include(ChooseMSVCCRT) + endif() + include(CheckCXXCompilerFlag) + include(CheckCCompilerFlag) +@@ -70,7 +69,6 @@ endif() + + # Dependencies + # ============ +-set(THIRD_PARTY_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/third-party/") + include(LIEFDependencies) + + # iOS specific config +@@ -376,12 +374,14 @@ endif() + # Leaf + # ======================================= + if(LIEF_EXTERNAL_LEAF) ++ find_package(Boost REQUIRED CONFIG) + message(STATUS "Using external LEAF version") + if(LIEF_EXTERNAL_LEAF_DIR) + message(STATUS "External LEAF include dir: ${LIEF_EXTERNAL_LEAF_DIR}") + target_include_directories(LIB_LIEF SYSTEM PUBLIC + "$") + endif() ++ target_link_libraries(LIB_LIEF PRIVATE Boost::headers) + else() + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/leaf.hpp + COMMAND +@@ -425,6 +425,8 @@ if(LIEF_EXTERNAL_SPAN) + target_include_directories(LIB_LIEF SYSTEM PUBLIC + "$") + endif() ++ find_package(tcb-span REQUIRED CONFIG) ++ target_link_libraries(LIB_LIEF PRIVATE tcb-span::tcb-span) + else() + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/span.hpp + COMMAND +@@ -439,7 +441,6 @@ else() + endif() + + +- + target_link_libraries(LIB_LIEF PRIVATE lief_spdlog) + + # Flags definition +@@ -448,8 +449,7 @@ target_link_libraries(LIB_LIEF PRIVATE lief_spdlog) + # cmake-format: off + set_target_properties( + LIB_LIEF +- PROPERTIES POSITION_INDEPENDENT_CODE ON +- CXX_STANDARD 11 ++ PROPERTIES CXX_STANDARD 11 + CXX_STANDARD_REQUIRED ON + CXX_VISIBILITY_PRESET hidden + C_VISIBILITY_PRESET hidden) +@@ -667,8 +667,9 @@ endif() + # Installation + # ====================== + ++include(GNUInstallDirs) ++if(0) + if(UNIX) +- include(GNUInstallDirs) + set(CMAKE_INSTALL_LIBDIR "lib") + else() + if(WIN32) +@@ -682,13 +683,14 @@ else() + message(FATAL_ERROR "System not UNIX nor WIN32 - not implemented yet") + endif() + endif() ++endif() + + install( + TARGETS LIB_LIEF lief_spdlog + EXPORT LIEFExport + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + install( +@@ -727,6 +729,3 @@ export( + NAMESPACE LIEF:: + FILE LIEFExport-${lib_type}.cmake) + +-# Package +-# ====================== +-add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/package") diff --git a/recipes/lief/all/patches/0.12.2-002_support_older_gcc.patch b/recipes/lief/all/patches/0.12.2-002_support_older_gcc.patch new file mode 100644 index 0000000000000..2ab323a4fbd5c --- /dev/null +++ b/recipes/lief/all/patches/0.12.2-002_support_older_gcc.patch @@ -0,0 +1,13 @@ +diff --git a/src/PE/Binary.cpp b/src/PE/Binary.cpp +index 0e032c3..d2eaae9 100644 +--- a/src/PE/Binary.cpp ++++ b/src/PE/Binary.cpp +@@ -1732,7 +1732,7 @@ std::ostream& Binary::print(std::ostream& os) const { + if (has_debug()) { + os << "Debug" << std::endl; + os << "=====" << std::endl; +- for (const Debug& debug : debug()) { ++ for (const Debug& debug : this->debug()) { + os << debug << std::endl; + } + os << std::endl; diff --git a/recipes/lief/all/patches/0.12.3-001_link_to_conan.patch b/recipes/lief/all/patches/0.12.3-001_link_to_conan.patch new file mode 100644 index 0000000000000..b614ea503a68c --- /dev/null +++ b/recipes/lief/all/patches/0.12.3-001_link_to_conan.patch @@ -0,0 +1,89 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index eadac9a..5ad254c 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -17,7 +17,6 @@ endif() + + + if(WIN32 OR ${IS_WIN_CROSS_COMPILE}) +- include(ChooseMSVCCRT) + endif() + include(CheckCXXCompilerFlag) + include(CheckCCompilerFlag) +@@ -75,7 +74,6 @@ endif() + + # Dependencies + # ============ +-set(THIRD_PARTY_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/third-party/") + include(LIEFDependencies) + + # iOS specific config +@@ -381,12 +379,14 @@ endif() + # Leaf + # ======================================= + if(LIEF_EXTERNAL_LEAF) ++ find_package(Boost REQUIRED CONFIG) + message(STATUS "Using external LEAF version") + if(LIEF_EXTERNAL_LEAF_DIR) + message(STATUS "External LEAF include dir: ${LIEF_EXTERNAL_LEAF_DIR}") + target_include_directories(LIB_LIEF SYSTEM PUBLIC + "$") + endif() ++ target_link_libraries(LIB_LIEF PRIVATE Boost::headers) + else() + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/leaf.hpp + COMMAND +@@ -430,6 +430,8 @@ if(LIEF_EXTERNAL_SPAN) + target_include_directories(LIB_LIEF SYSTEM PUBLIC + "$") + endif() ++ find_package(tcb-span REQUIRED CONFIG) ++ target_link_libraries(LIB_LIEF PRIVATE tcb-span::tcb-span) + else() + add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/LIEF/third-party/internal/span.hpp + COMMAND +@@ -453,8 +455,7 @@ target_link_libraries(LIB_LIEF PRIVATE lief_spdlog) + # cmake-format: off + set_target_properties( + LIB_LIEF +- PROPERTIES POSITION_INDEPENDENT_CODE ON +- CXX_STANDARD 11 ++ PROPERTIES CXX_STANDARD 11 + CXX_STANDARD_REQUIRED ON + CXX_VISIBILITY_PRESET hidden + C_VISIBILITY_PRESET hidden) +@@ -672,8 +673,9 @@ endif() + # Installation + # ====================== + ++include(GNUInstallDirs) ++if(0) + if(UNIX) +- include(GNUInstallDirs) + set(CMAKE_INSTALL_LIBDIR "lib") + else() + if(WIN32) +@@ -687,13 +689,14 @@ else() + message(FATAL_ERROR "System not UNIX nor WIN32 - not implemented yet") + endif() + endif() ++endif() + + install( + TARGETS LIB_LIEF lief_spdlog + EXPORT LIEFExport + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} +- RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT libraries ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + + install( +@@ -731,7 +734,3 @@ export( + EXPORT LIEFExport + NAMESPACE LIEF:: + FILE LIEFExport-${lib_type}.cmake) +- +-# Package +-# ====================== +-add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/package") diff --git a/recipes/lief/all/patches/001_link_to_conan.patch b/recipes/lief/all/patches/001_link_to_conan.patch index c70b6f9ecad22..e999cd3dd9317 100644 --- a/recipes/lief/all/patches/001_link_to_conan.patch +++ b/recipes/lief/all/patches/001_link_to_conan.patch @@ -1,6 +1,8 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -5,7 +5,6 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9b168d9..243bbc2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,7 +5,6 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON) # Modules list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/") if (WIN32) @@ -8,8 +10,8 @@ endif() include(CheckCXXCompilerFlag) include(CheckCCompilerFlag) -@@ -49,14 +48,14 @@ - +@@ -49,14 +48,14 @@ endif() + # Dependencies # ============ -set(THIRD_PARTY_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/third-party/") @@ -19,17 +21,17 @@ + message(STATUS "Enable Frozen (C++14 support)") + set(LIEF_FROZEN_ENABLED 1) +endif() - + # LIEF Source definition # ====================== -set_source_files_properties(${mbedtls_src_crypto} PROPERTIES GENERATED TRUE) -set_source_files_properties(${mbedtls_src_x509} PROPERTIES GENERATED TRUE) -set_source_files_properties(${mbedtls_src_tls} PROPERTIES GENERATED TRUE) - + if (LIEF_LOGGING) set_source_files_properties(${ELG_SOURCE_DIR}/easylogging++.cc PROPERTIES GENERATED TRUE) -@@ -73,9 +72,6 @@ - +@@ -73,9 +72,6 @@ set(LIEF_PRIVATE_INCLUDE_FILES) + set(LIBLIEF_SOURCE_FILES "${ELG_CC_PATH}" - "${mbedtls_src_crypto}" @@ -38,31 +40,31 @@ "${LIBFUZZER_SRC_FILES}" "${CMAKE_CURRENT_SOURCE_DIR}/src/logging.cpp" "${CMAKE_CURRENT_SOURCE_DIR}/src/exception.cpp" -@@ -126,13 +122,11 @@ +@@ -126,13 +122,11 @@ set(LIEF_INCLUDE_FILES set(LIEF_JSON_SRC "${CMAKE_CURRENT_SOURCE_DIR}/src/visitors/json.cpp") set(LIEF_JSON_HDR "${CMAKE_CURRENT_SOURCE_DIR}/include/LIEF/json.hpp" - "${LIBJSON_SOURCE_DIR}/json.hpp" ) - + if (LIEF_ENABLE_JSON) list(APPEND LIBLIEF_SOURCE_FILES "${LIEF_JSON_SRC}") list(APPEND LIEF_INC_FILES "${LIEF_JSON_HDR}") - list(APPEND LIEF_PUBLIC_INCLUDE_DIR "${LIBJSON_SOURCE_DIR}/") endif() - + source_group("Header Files" FILES ${LIEF_INC_FILES}) -@@ -224,9 +218,6 @@ - +@@ -224,9 +218,6 @@ endif() + # Frozen Configuration # ==================== -if (LIEF_FROZEN_ENABLED) - list(APPEND LIEF_PRIVATE_INCLUDE_DIR "${FROZEN_INCLUDE_DIR}") -endif() - + # OAT part # ======== -@@ -292,19 +283,15 @@ +@@ -292,19 +283,15 @@ list(APPEND LIEF_PUBLIC_INCLUDE_DIR list(APPEND LIEF_PRIVATE_INCLUDE_DIR "${LIEF_PUBLIC_INCLUDE_DIR}" "${LIEF_PUBLIC_INCLUDE_DIR}" @@ -73,8 +75,8 @@ "${ELG_SOURCE_DIR}" - "${MBEDTLS_INCLUDE_DIRS}" ) - - + + # Grouping external projects # ========================== -source_group("mbedtls\\crypto" FILES ${mbedtls_src_crypto}) @@ -83,38 +85,42 @@ if (LIEF_LOGGING) source_group("easylogging" FILES ${ELG_SOURCE_DIR}/easylogging++.cc) endif() -@@ -316,7 +303,7 @@ +@@ -316,7 +303,8 @@ target_include_directories(LIB_LIEF PRIVATE "${LIEF_PRIVATE_INCLUDE_DIR}") - + if (LIEF_ENABLE_JSON) - add_dependencies(LIB_LIEF lief_libjson) -+ target_link_libraries(LIB_LIEF CONAN_PKG::nlohmann_json) ++ find_package(nlohmann_json REQUIRED CONFIG) ++ target_link_libraries(LIB_LIEF nlohmann_json::nlohmann_json) endif() - + if (LIEF_LOGGING) -@@ -324,18 +311,17 @@ +@@ -324,18 +312,20 @@ if (LIEF_LOGGING) endif() - + if (LIEF_FROZEN_ENABLED) - add_dependencies(LIB_LIEF lief_frozen) -+ target_link_libraries(LIB_LIEF CONAN_PKG::frozen) ++ find_package(frozen REQUIRED CONFIG) ++ target_link_libraries(LIB_LIEF frozen::frozen) endif() - + -add_dependencies(LIB_LIEF lief_rang_cpp_color) -+target_link_libraries(LIB_LIEF CONAN_PKG::rang) - ++find_package(rang REQUIRED CONFIG) ++target_link_libraries(LIB_LIEF rang::rang) + -add_dependencies(LIB_LIEF lief_mbed_tls) -+target_link_libraries(LIB_LIEF CONAN_PKG::mbedtls) - ++find_package(MbedTLS REQUIRED CONFIG) ++target_link_libraries(LIB_LIEF MbedTLS::mbedtls) + # Flags definition # ---------------- set_property(TARGET LIB_LIEF PROPERTY CXX_STANDARD 11) set_property(TARGET LIB_LIEF PROPERTY CXX_STANDARD_REQUIRED ON) -set_property(TARGET LIB_LIEF PROPERTY POSITION_INDEPENDENT_CODE ON) set_property(TARGET LIB_LIEF PROPERTY CXX_VISIBILITY_PRESET hidden) - + target_compile_definitions(LIB_LIEF PUBLIC -D_GLIBCXX_USE_CXX11_ABI=1) -@@ -345,11 +331,6 @@ +@@ -345,11 +335,6 @@ target_compile_definitions(LIB_LIEF PUBLIC -D_GLIBCXX_USE_CXX11_ABI=1) # with the SpcSpAgencyInfo Critical Extension, which mbed TLS doesn't # support, so set MBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION to # have it skip this extension. @@ -123,11 +129,11 @@ - -DMBEDTLS_MD4_C - -DMBEDTLS_X509_ALLOW_UNSUPPORTED_CRITICAL_EXTENSION -) - - + + # ASAN - LSAN - TSAN - USAN -@@ -512,16 +493,16 @@ - +@@ -512,16 +497,16 @@ endif() + install(TARGETS LIB_LIEF ARCHIVE - DESTINATION lib @@ -139,7 +145,7 @@ - DESTINATION lib + DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT libraries) - + install( DIRECTORY ${LIEF_PUBLIC_INCLUDE_DIR} - DESTINATION include diff --git a/recipes/lief/all/test_package/CMakeLists.txt b/recipes/lief/all/test_package/CMakeLists.txt index 2c5505ca7220d..21ece2b1f32cb 100644 --- a/recipes/lief/all/test_package/CMakeLists.txt +++ b/recipes/lief/all/test_package/CMakeLists.txt @@ -1,9 +1,11 @@ -cmake_minimum_required(VERSION 3.0) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(LIEF REQUIRED CONFIG) -add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${CMAKE_PROJECT_NAME} PROPERTY CXX_STANDARD 11) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE LIEF::LIEF) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + +# It is required for gcc 5 +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/lief/all/test_package/conanfile.py b/recipes/lief/all/test_package/conanfile.py index f98baa955fbcd..5bef6136fec8e 100644 --- a/recipes/lief/all/test_package/conanfile.py +++ b/recipes/lief/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,9 +21,9 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") arg_path = bin_path if self.settings.os == "Windows": arg_path += ".exe" - self.run("{0} {1}".format(bin_path, arg_path), run_environment=True) + self.run(f"{bin_path} {arg_path}", env="conanrun") diff --git a/recipes/lief/all/test_v1_package/CMakeLists.txt b/recipes/lief/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/lief/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/lief/all/test_v1_package/conanfile.py b/recipes/lief/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..326a291210aff --- /dev/null +++ b/recipes/lief/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + arg_path = bin_path + if self.settings.os == "Windows": + arg_path += ".exe" + self.run(f"{bin_path} {arg_path}", run_environment=True) diff --git a/recipes/lief/config.yml b/recipes/lief/config.yml index c1d72c1a28d68..f24eac175f18c 100644 --- a/recipes/lief/config.yml +++ b/recipes/lief/config.yml @@ -1,3 +1,7 @@ versions: + "0.12.3": + folder: "all" + "0.12.2": + folder: "all" "0.10.1": folder: "all" diff --git a/recipes/linmath.h/all/conandata.yml b/recipes/linmath.h/all/conandata.yml new file mode 100644 index 0000000000000..c521734fe3fb8 --- /dev/null +++ b/recipes/linmath.h/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20220619": + url: "https://github.com/datenwolf/linmath.h/archive/3eef82841046507e16a0f6194a61cee2eadd34b3.tar.gz" + sha256: "786c3f9c5e415cc1607d377242759eca736ea1002dcf6312a7f6ae08bc3d6e87" diff --git a/recipes/linmath.h/all/conanfile.py b/recipes/linmath.h/all/conanfile.py new file mode 100644 index 0000000000000..72dbc48e507a8 --- /dev/null +++ b/recipes/linmath.h/all/conanfile.py @@ -0,0 +1,41 @@ +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" + + +class LinmathConan(ConanFile): + name = "linmath.h" + description = ( + "A lean linear math library, aimed at graphics programming. Supports " + "vec3, vec4, mat4x4 and quaternions" + ) + license = "WTFPL" + topics = ("math", "graphics", "linear-algebra", "vector", "matrix", "quaternion") + homepage = "https://github.com/datenwolf/linmath.h" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def package_id(self): + self.info.clear() + + def layout(self): + basic_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "LICENCE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "linmath.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/linmath.h/all/test_package/CMakeLists.txt b/recipes/linmath.h/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5ff54df0112b2 --- /dev/null +++ b/recipes/linmath.h/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(linmath.h REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE linmath.h::linmath.h) diff --git a/recipes/linmath.h/all/test_package/conanfile.py b/recipes/linmath.h/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/linmath.h/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/linmath.h/all/test_package/test_package.c b/recipes/linmath.h/all/test_package/test_package.c new file mode 100644 index 0000000000000..1f59cf9ccad91 --- /dev/null +++ b/recipes/linmath.h/all/test_package/test_package.c @@ -0,0 +1,8 @@ +#include + +int main() +{ + quat q; + quat_identity(q); + return 0; +} diff --git a/recipes/linmath.h/all/test_v1_package/CMakeLists.txt b/recipes/linmath.h/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/linmath.h/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/linmath.h/all/test_v1_package/conanfile.py b/recipes/linmath.h/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/linmath.h/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/linmath.h/config.yml b/recipes/linmath.h/config.yml new file mode 100644 index 0000000000000..5d463c9509aed --- /dev/null +++ b/recipes/linmath.h/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20220619": + folder: all diff --git a/recipes/litehtml/all/CMakeLists.txt b/recipes/litehtml/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/litehtml/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/litehtml/all/conandata.yml b/recipes/litehtml/all/conandata.yml index 2496f19eb9a58..db5e01516c1d0 100644 --- a/recipes/litehtml/all/conandata.yml +++ b/recipes/litehtml/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "cci.20211028": - patch_file: "patches/0001-icu.patch" - base_path: "source_subfolder" diff --git a/recipes/litehtml/all/conanfile.py b/recipes/litehtml/all/conanfile.py index 38ec963a000a4..c3158edb62025 100644 --- a/recipes/litehtml/all/conanfile.py +++ b/recipes/litehtml/all/conanfile.py @@ -1,9 +1,13 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save +from conan.tools.microsoft import is_msvc import os import textwrap -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LitehtmlConan(ConanFile): @@ -28,30 +32,13 @@ class LitehtmlConan(ConanFile): "with_icu": False, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _with_xxd(self): # FIXME: create conan recipe for xxd, and use it unconditionally (returning False means cross build doesn't work) return self.settings.os != "Windows" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -59,51 +46,52 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): # FIXME: add gumbo requirement (it is vendored right now) if self.options.with_icu: - self.requires("icu/70.1") + self.requires("icu/72.1") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - if self.options.shared and self._is_msvc: - raise ConanInvalidConfiguration("litehtml shared not supported with Visual Studio") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if self.info.options.shared and is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} shared not supported with Visual Studio") def build_requirements(self): # FIXME: add unconditional xxd build requirement pass def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["LITEHTML_UTF8"] = self.options.utf8 + tc.variables["USE_ICU"] = self.options.with_icu + tc.variables["EXTERNAL_GUMBO"] = False # FIXME: add cci recipe, and use it unconditionally (option value should be True) + tc.variables["EXTERNAL_XXD"] = self._with_xxd # FIXME: should be True unconditionally + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["LITEHTML_UTF8"] = self.options.utf8 - self._cmake.definitions["USE_ICU"] = self.options.with_icu - self._cmake.definitions["EXTERNAL_GUMBO"] = False # FIXME: add cci recipe, and use it unconditionally (option value should be True) - self._cmake.definitions["EXTERNAL_XXD"] = self._with_xxd # FIXME: should be True unconditionally - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -114,21 +102,20 @@ def package(self): } ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "litehtml") diff --git a/recipes/litehtml/all/test_package/CMakeLists.txt b/recipes/litehtml/all/test_package/CMakeLists.txt index 04b785e1efe02..01d00c41e24f2 100644 --- a/recipes/litehtml/all/test_package/CMakeLists.txt +++ b/recipes/litehtml/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(litehtml REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} litehtml) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE litehtml) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/litehtml/all/test_package/conanfile.py b/recipes/litehtml/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/litehtml/all/test_package/conanfile.py +++ b/recipes/litehtml/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/litehtml/all/test_v1_package/CMakeLists.txt b/recipes/litehtml/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/litehtml/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/litehtml/all/test_v1_package/conanfile.py b/recipes/litehtml/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/litehtml/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/llvm-core/all/CMakeLists.txt b/recipes/llvm-core/all/CMakeLists.txt index b0d7e135d6b47..e88dcfa953495 100644 --- a/recipes/llvm-core/all/CMakeLists.txt +++ b/recipes/llvm-core/all/CMakeLists.txt @@ -4,4 +4,23 @@ project(conanllvm) include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(KEEP_RPATHS) +if(LLVM_ENABLE_ZLIB) + find_package(ZLIB QUIET) + + # The FindZLIB find module provided by CMake behaves differently than the FindZLIB.cmake script generated by CONAN. + # So the following two lines fill in the needed properties. + list(GET ZLIB_LIBRARIES 0 ZLIB_LIBRARY) + set_property(TARGET ZLIB::ZLIB PROPERTY LOCATION "${ZLIB_LIBRARY}") + + # Additionally LLVM 11.1.0 requires the zlib lib dir to be in the library path. + # This is not needed for later versions and can be removed once + # LLVM-12 becomes the oldest supported version. + if(UNIX) + set(ENV{LIBRARY_PATH} "${CONAN_LIB_DIRS_ZLIB}:$ENV{LIBRARY_PATH}") + elseif(WIN32) + file(TO_NATIVE_PATH "${CONAN_LIB_DIRS_ZLIB}" WINDOWS_ZLIB_PATH) + string(APPEND CMAKE_EXE_LINKER_FLAGS " /LIBPATH:${WINDOWS_ZLIB_PATH}") + endif() +endif() + add_subdirectory("source") diff --git a/recipes/llvm-core/all/conanfile.py b/recipes/llvm-core/all/conanfile.py index ab2f5f4ef1c98..263cb7360506c 100644 --- a/recipes/llvm-core/all/conanfile.py +++ b/recipes/llvm-core/all/conanfile.py @@ -1,5 +1,9 @@ -from conans.errors import ConanInvalidConfiguration -from conans import ConanFile, CMake, tools +from conan.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.files import apply_conandata_patches, chdir, collect_libs, get, load, rename, replace_in_file, rm, rmdir, save +from conan.tools.scm import Version +from conans import CMake from collections import defaultdict import json import re @@ -7,7 +11,7 @@ import os import textwrap -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.2" # Due to conan.tools.scm.Version class LLVMCoreConan(ConanFile): @@ -78,6 +82,7 @@ class LLVMCoreConan(ConanFile): generators = 'cmake', 'cmake_find_package' no_copy_source = True + short_paths = True @property def _source_subfolder(self): @@ -85,8 +90,8 @@ def _source_subfolder(self): def _supports_compiler(self): compiler = self.settings.compiler.value - version = tools.Version(self.settings.compiler.version) - major_rev, minor_rev = int(version.major), int(version.minor) + version = Version(self.settings.compiler.version) + major_rev, minor_rev = version.major, (version.minor or 0) unsupported_combinations = [ [compiler == 'gcc', major_rev == 5, minor_rev < 1], @@ -100,12 +105,11 @@ def _supports_compiler(self): raise ConanInvalidConfiguration(message.format(compiler, version)) def _patch_sources(self): - for patch in self.conan_data.get('patches', {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def _patch_build(self): if os.path.exists('FindIconv.cmake'): - tools.replace_in_file('FindIconv.cmake', 'iconv charset', 'iconv') + replace_in_file(self, 'FindIconv.cmake', 'iconv charset', 'iconv') def _configure_cmake(self): cmake = CMake(self) @@ -178,8 +182,8 @@ def _configure_cmake(self): cmake.definitions['LLVM_ENABLE_LIBPFM'] = False cmake.definitions['LLVM_ENABLE_LIBEDIT'] = False cmake.definitions['LLVM_ENABLE_FFI'] = self.options.with_ffi - cmake.definitions['LLVM_ENABLE_ZLIB'] = \ - self.options.get_safe('with_zlib', False) + cmake.definitions['LLVM_ENABLE_ZLIB'] = "FORCE_ON" if \ + self.options.get_safe('with_zlib', False) else False cmake.definitions['LLVM_ENABLE_LIBXML2'] = \ self.options.get_safe('with_xml2', False) return cmake @@ -192,7 +196,6 @@ def export_sources(self): def config_options(self): if self.settings.os == 'Windows': del self.options.fPIC - del self.options.with_zlib del self.options.with_xml2 def requirements(self): @@ -218,12 +221,12 @@ def validate(self): message = 'Cannot enable exceptions without rtti support' raise ConanInvalidConfiguration(message) self._supports_compiler() - if tools.cross_building(self, skip_x64_x86=True): + if cross_building(self, skip_x64_x86=True): raise ConanInvalidConfiguration('Cross-building not implemented') def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True, + destination=self._source_subfolder) self._patch_sources() def build(self): @@ -244,8 +247,7 @@ def _alias_module_file_rel_path(self): def _old_alias_module_file_rel_path(self): return os.path.join(self._module_subfolder, "conan-official-{}-old-targets.cmake".format(self.name)) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -254,7 +256,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) def package(self): self.copy('LICENSE.TXT', dst='licenses', src=self._source_subfolder) @@ -271,8 +273,8 @@ def package(self): self.copy(lib, dst='lib', src='lib') CMake(self).configure(args=['--graphviz=graph/llvm.dot'], source_dir='.', build_dir='.') - with tools.chdir('graph'): - dot_text = tools.load('llvm.dot').replace('\r\n', '\n') + with chdir(self, 'graph'): + dot_text = load(self, 'llvm.dot').replace('\r\n', '\n') dep_regex = re.compile(r'//\s(.+)\s->\s(.+)$', re.MULTILINE) deps = re.findall(dep_regex, dot_text) @@ -327,23 +329,23 @@ def package(self): old_alias_targets ) - tools.rmdir(os.path.join(self.package_folder, 'share')) + rmdir(self, os.path.join(self.package_folder, 'share')) - tools.remove_files_by_mask(self.package_folder, "LLVMExports*.cmake") - tools.rename(os.path.join(self.package_folder, self._module_subfolder, 'LLVM-Config.cmake'), - os.path.join(self.package_folder, self._module_subfolder, 'LLVM-ConfigInternal.cmake')) - tools.rename(os.path.join(self.package_folder, self._module_subfolder, 'LLVMConfig.cmake'), - os.path.join(self.package_folder, self._module_subfolder, 'LLVMConfigInternal.cmake')) + rm(self, "LLVMExports*.cmake", self.package_folder, recursive=True) + rename(self, os.path.join(self.package_folder, self._module_subfolder, 'LLVM-Config.cmake'), + os.path.join(self.package_folder, self._module_subfolder, 'LLVM-ConfigInternal.cmake')) + rename(self, os.path.join(self.package_folder, self._module_subfolder, 'LLVMConfig.cmake'), + os.path.join(self.package_folder, self._module_subfolder, 'LLVMConfigInternal.cmake')) - tools.replace_in_file(os.path.join(self.package_folder, self._module_subfolder, 'AddLLVM.cmake'), - "include(LLVM-Config)", - "include(LLVM-ConfigInternal)") - tools.replace_in_file(os.path.join(self.package_folder, self._module_subfolder, 'LLVMConfigInternal.cmake'), - "LLVM-Config.cmake", - "LLVM-ConfigInternal.cmake") + replace_in_file(self, os.path.join(self.package_folder, self._module_subfolder, 'AddLLVM.cmake'), + "include(LLVM-Config)", + "include(LLVM-ConfigInternal)") + replace_in_file(self, os.path.join(self.package_folder, self._module_subfolder, 'LLVMConfigInternal.cmake'), + "LLVM-Config.cmake", + "LLVM-ConfigInternal.cmake") for mask in ["Find*.cmake", "*Config.cmake", "*-config.cmake"]: - tools.remove_files_by_mask(self.package_folder, mask) + rm(self, mask, self.package_folder, recursive=True) for name in os.listdir(lib_path): fullname = os.path.join(lib_path, name) @@ -368,7 +370,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "LLVM") if self.options.shared: - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os == 'Linux': self.cpp_info.system_libs = ['pthread', 'rt', 'dl', 'm'] elif self.settings.os == 'Macos': diff --git a/recipes/lmdb/all/CMakeLists.txt b/recipes/lmdb/all/CMakeLists.txt index 679dd60a12c26..888afb35a88e0 100644 --- a/recipes/lmdb/all/CMakeLists.txt +++ b/recipes/lmdb/all/CMakeLists.txt @@ -1,25 +1,24 @@ cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) +project(lmdb LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup() +include(GNUInstallDirs) # LMDB library: add_library(lmdb - source_subfolder/lmdb.h - source_subfolder/mdb.c - source_subfolder/midl.c - source_subfolder/midl.h + ${LMDB_SRC_DIR}/lmdb.h + ${LMDB_SRC_DIR}/mdb.c + ${LMDB_SRC_DIR}/midl.c + ${LMDB_SRC_DIR}/midl.h ) set_target_properties(lmdb PROPERTIES - PUBLIC_HEADER source_subfolder/lmdb.h + PUBLIC_HEADER ${LMDB_SRC_DIR}/lmdb.h WINDOWS_EXPORT_ALL_SYMBOLS ON ) -include(FindThreads) -target_link_libraries(lmdb PUBLIC ${CMAKE_THREAD_LIBS_INIT}) +find_package(Threads REQUIRED) +target_link_libraries(lmdb PUBLIC Threads::Threads) install(TARGETS lmdb RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} @@ -37,7 +36,7 @@ endif (LMDB_ENABLE_ROBUST_MUTEX) if(NOT WIN32) foreach(TOOL mdb_stat mdb_copy mdb_dump mdb_load) - add_executable(${TOOL} source_subfolder/${TOOL}.c) + add_executable(${TOOL} ${LMDB_SRC_DIR}/${TOOL}.c) target_link_libraries(${TOOL} lmdb) install(TARGETS ${TOOL} DESTINATION ${CMAKE_INSTALL_BINDIR}) endforeach() diff --git a/recipes/lmdb/all/conanfile.py b/recipes/lmdb/all/conanfile.py index b90a6bbeb1c7c..7700c885b181c 100644 --- a/recipes/lmdb/all/conanfile.py +++ b/recipes/lmdb/all/conanfile.py @@ -1,7 +1,9 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get import os -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.29.0" +required_conan_version = ">=1.46.0" class lmdbConan(ConanFile): @@ -10,8 +12,9 @@ class lmdbConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://symas.com/lmdb/" description = "Fast and compat memory-mapped key-value database" - topics = ("LMDB", "database", "key-value", "memory-mapped") - settings = "os", "compiler", "build_type", "arch" + topics = ("database", "key-value", "memory-mapped") + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,18 +25,8 @@ class lmdbConan(ConanFile): "fPIC": True, "enable_robust_mutex": True, } - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + exports_sources = ["CMakeLists.txt"] def config_options(self): if self.settings.os == "Windows": @@ -45,40 +38,49 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - root = "openldap-LMDB_{}".format(self.version) - tools.rename(os.path.join(root, "libraries", "liblmdb"), self._source_subfolder) - tools.rmdir(root) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LMDB_SRC_DIR"] = os.path.join(self.source_folder, "libraries", "liblmdb").replace("\\", "/") + tc.variables["LMDB_ENABLE_ROBUST_MUTEX"] = self.options.enable_robust_mutex + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LMDB_ENABLE_ROBUST_MUTEX"] = self.options.enable_robust_mutex - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=os.path.join(self.source_folder, "libraries", "liblmdb"), dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): + self.cpp_info.set_property("pkg_config_name", "lmdb") self.cpp_info.libs = ["lmdb"] - self.cpp_info.names["pkg_config"] = "lmdb" if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/lmdb/all/test_package/CMakeLists.txt b/recipes/lmdb/all/test_package/CMakeLists.txt index c18f9b2f3fce4..3342cb59e0fea 100644 --- a/recipes/lmdb/all/test_package/CMakeLists.txt +++ b/recipes/lmdb/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.4) -project(test_package C) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(lmdb REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE lmdb::lmdb) diff --git a/recipes/lmdb/all/test_package/conanfile.py b/recipes/lmdb/all/test_package/conanfile.py index 2ab7e3a608f12..0a6bc68712d90 100644 --- a/recipes/lmdb/all/test_package/conanfile.py +++ b/recipes/lmdb/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" -class LmdbTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lmdb/all/test_v1_package/CMakeLists.txt b/recipes/lmdb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..20645081348a3 --- /dev/null +++ b/recipes/lmdb/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(lmdb REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE lmdb::lmdb) diff --git a/recipes/lmdb/all/test_v1_package/conanfile.py b/recipes/lmdb/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/lmdb/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/log.c/all/conanfile.py b/recipes/log.c/all/conanfile.py index 498417347ac71..eb9d4135d51ce 100644 --- a/recipes/log.c/all/conanfile.py +++ b/recipes/log.c/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class LogcConan(ConanFile): @@ -14,6 +14,7 @@ class LogcConan(ConanFile): description = "A simple logging library implemented in C99" topics = ("logging", "log", "logging-library", "logc", "purec", "c99") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,22 +35,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/log.c/all/test_package/conanfile.py b/recipes/log.c/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/log.c/all/test_package/conanfile.py +++ b/recipes/log.c/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/log.c/all/test_v1_package/CMakeLists.txt b/recipes/log.c/all/test_v1_package/CMakeLists.txt index 89149a107c10c..0d20897301b68 100644 --- a/recipes/log.c/all/test_v1_package/CMakeLists.txt +++ b/recipes/log.c/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(log.c REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE log.c::log.c) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/log4cplus/all/CMakeLists.txt b/recipes/log4cplus/all/CMakeLists.txt deleted file mode 100644 index b48fd2a5eb5ad..0000000000000 --- a/recipes/log4cplus/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) - -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/log4cplus/all/conandata.yml b/recipes/log4cplus/all/conandata.yml index 38211284d2331..a0ac90c32b364 100644 --- a/recipes/log4cplus/all/conandata.yml +++ b/recipes/log4cplus/all/conandata.yml @@ -1,13 +1,45 @@ sources: - "2.0.4": - url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_4/log4cplus-2.0.4.tar.bz2" - sha256: "0c8a7b4cabff07032385f0c6d1a078d2a79c69b1c43b06991ca774fb85880252" - "2.0.5": - url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_5/log4cplus-2.0.5.tar.bz2" - sha256: "b38dbfc68ef6d771e4de7de0be3544bc51bd3f7d5b75c5f6500d10e23203eb15" + "2.1.0": + url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_1_0/log4cplus-2.1.0.tar.bz2" + sha256: "a04945aca5fbc0487503c852befb9cdefbc3ae3fe614b08a905333f6df754387" + "2.0.8": + url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_8/log4cplus-2.0.8.tar.bz2" + sha256: "ca36aa366036d1c61fc0366a9ffbcf32bad55d74878b2c36a9c34dcc00b8a0ca" + "2.0.7": + url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_7/log4cplus-2.0.7.tar.bz2" + sha256: "8fadbafee2ba4e558a0f78842613c9fb239c775d83f23340d091084c0e1b12ab" "2.0.6": url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_6/log4cplus-2.0.6.tar.bz2" sha256: "1a963afd0f883d62de946b18927d238051fd47936e415eabeffe2b1397f16eca" + "2.0.5": + url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_5/log4cplus-2.0.5.tar.bz2" + sha256: "b38dbfc68ef6d771e4de7de0be3544bc51bd3f7d5b75c5f6500d10e23203eb15" + "2.0.4": + url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_4/log4cplus-2.0.4.tar.bz2" + sha256: "0c8a7b4cabff07032385f0c6d1a078d2a79c69b1c43b06991ca774fb85880252" + +patches: + "2.1.0": + - patch_file: "patches/2.0.6-0001-fix-cmake.patch" + patch_description: "disable fPIC, move cmake_minimum_version to front" + patch_type: "conan" + "2.0.8": + - patch_file: "patches/2.0.6-0001-fix-cmake.patch" + patch_description: "disable fPIC, move cmake_minimum_version to front" + patch_type: "conan" "2.0.7": - url: "https://github.com/log4cplus/log4cplus/releases/download/REL_2_0_7/log4cplus-2.0.7.tar.bz2" - sha256: "8fadbafee2ba4e558a0f78842613c9fb239c775d83f23340d091084c0e1b12ab" + - patch_file: "patches/2.0.6-0001-fix-cmake.patch" + patch_description: "disable fPIC, move cmake_minimum_version to front" + patch_type: "conan" + "2.0.6": + - patch_file: "patches/2.0.6-0001-fix-cmake.patch" + patch_description: "disable fPIC, move cmake_minimum_version to front" + patch_type: "conan" + "2.0.5": + - patch_file: "patches/2.0.4-0001-fix-cmake.patch" + patch_description: "disable fPIC, move cmake_minimum_version to front" + patch_type: "conan" + "2.0.4": + - patch_file: "patches/2.0.4-0001-fix-cmake.patch" + patch_description: "disable fPIC, move cmake_minimum_version to front" + patch_type: "conan" diff --git a/recipes/log4cplus/all/conanfile.py b/recipes/log4cplus/all/conanfile.py index aa98e3e12c8fe..6d7e6eed30a07 100644 --- a/recipes/log4cplus/all/conanfile.py +++ b/recipes/log4cplus/all/conanfile.py @@ -1,51 +1,48 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, collect_libs +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version import os -from conan.tools import files -from conans import ConanFile, CMake, tools - -required_conan_version = ">=1.35.0" +required_conan_version = ">=1.53.0" class Log4cplusConan(ConanFile): name = "log4cplus" description = "simple to use C++ logging API, modelled after the Java log4j API" + license = ("BSD-2-Clause, Apache-2.0") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/log4cplus/log4cplus" - topics = ("log4cplus", "logging", "log", "logging-library") - license = ("BSD-2-Clause, Apache-2.0") - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], - "fPIC": [True, False], - "single_threaded": [True, False], - "build_logging_server": [True, False], - "with_iconv": [True, False], - "working_locale": [True, False], - "working_c_locale": [True, False], - "decorated_name": [True, False], - "unicode": [True, False], - "thread_pool": [True, False]} - default_options = {"shared": False, - "fPIC": True, - "single_threaded": False, - "build_logging_server": False, - "with_iconv": False, - "working_locale": False, - "working_c_locale": False, - "decorated_name": False, - "unicode": True, - "thread_pool": True} + topics = ("logging", "log", "logging-library") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "single_threaded": [True, False], + "build_logging_server": [True, False], + "with_iconv": [True, False], + "working_locale": [True, False], + "working_c_locale": [True, False], + "decorated_name": [True, False], + "unicode": [True, False], + "thread_pool": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "single_threaded": False, + "build_logging_server": False, + "with_iconv": False, + "working_locale": False, + "working_c_locale": False, + "decorated_name": False, + "unicode": True, + "thread_pool": True, + } short_paths = True - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,58 +50,66 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_iconv: - self.requires("libiconv/1.16") + self.requires("libiconv/1.17") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) def source(self): - files.get(self, **self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LOG4CPLUS_ENABLE_THREAD_POOL"] = self.options.thread_pool - self._cmake.definitions["UNICODE"] = self.options.unicode - self._cmake.definitions["LOG4CPLUS_BUILD_TESTING"] = False - self._cmake.definitions["WITH_UNIT_TESTS"] = False - self._cmake.definitions["LOG4CPLUS_ENABLE_DECORATED_LIBRARY_NAME"] = self.options.decorated_name - self._cmake.definitions["LOG4CPLUS_QT4"] = False - self._cmake.definitions["LOG4CPLUS_QT5"] = False - self._cmake.definitions["LOG4CPLUS_SINGLE_THREADED"] = self.options.single_threaded - self._cmake.definitions["LOG4CPLUS_BUILD_LOGGINGSERVER"] = self.options.build_logging_server - self._cmake.definitions["WITH_ICONV"] = self.options.with_iconv - self._cmake.definitions["LOG4CPLUS_WORKING_LOCALE"] = self.options.working_locale - self._cmake.definitions["LOG4CPLUS_WORKING_C_LOCALE"] = self.options.working_c_locale - self._cmake.configure(build_dir=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LOG4CPLUS_ENABLE_THREAD_POOL"] = self.options.thread_pool + tc.variables["UNICODE"] = self.options.unicode + tc.variables["LOG4CPLUS_BUILD_TESTING"] = False + tc.variables["WITH_UNIT_TESTS"] = False + tc.variables["LOG4CPLUS_ENABLE_DECORATED_LIBRARY_NAME"] = self.options.decorated_name + tc.variables["LOG4CPLUS_QT4"] = False + tc.variables["LOG4CPLUS_QT5"] = False + tc.variables["LOG4CPLUS_SINGLE_THREADED"] = self.options.single_threaded + tc.variables["LOG4CPLUS_BUILD_LOGGINGSERVER"] = self.options.build_logging_server + tc.variables["WITH_ICONV"] = self.options.with_iconv + tc.variables["LOG4CPLUS_WORKING_LOCALE"] = self.options.working_locale + tc.variables["LOG4CPLUS_WORKING_C_LOCALE"] = self.options.working_c_locale + tc.generate() - def _patch_sources(self): - # don't force PIC - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") + dpes = CMakeDeps(self) + dpes.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + if Version(self.version) >= "2.1.0": + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.set_property("cmake_file_name", "log4cplus") + self.cpp_info.set_property("cmake_target_name", "log4cplus::log4cplus") + if Version(self.version) >= "2.1.0": + self.cpp_info.set_property("pkg_config_name", "log4cplus") + + self.cpp_info.libs = collect_libs(self) if self.options.unicode: self.cpp_info.defines = ["UNICODE", "_UNICODE"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["dl", "m", "rt", "nsl"] if not self.options.single_threaded: self.cpp_info.system_libs.append("pthread") diff --git a/recipes/log4cplus/all/patches/2.0.4-0001-fix-cmake.patch b/recipes/log4cplus/all/patches/2.0.4-0001-fix-cmake.patch new file mode 100644 index 0000000000000..d76b76d7eee51 --- /dev/null +++ b/recipes/log4cplus/all/patches/2.0.4-0001-fix-cmake.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index abe12e0..73d443f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,3 +1,5 @@ ++cmake_minimum_required (VERSION 3.1) ++ + # This block needs to stay before the project (log4cplus) line so that + # the output files placed into Android's libs directory. + if (CMAKE_TOOLCHAIN_FILE) +@@ -12,10 +14,6 @@ endif () + set (CMAKE_LEGACY_CYGWIN_WIN32 0) + + project (log4cplus) +-cmake_minimum_required (VERSION 3.1) +- +-# Use "-fPIC" / "-fPIE" for all targets by default, including static libs. +-set (CMAKE_POSITION_INDEPENDENT_CODE ON) + + enable_language (CXX) + if (MSVC) diff --git a/recipes/log4cplus/all/patches/2.0.6-0001-fix-cmake.patch b/recipes/log4cplus/all/patches/2.0.6-0001-fix-cmake.patch new file mode 100644 index 0000000000000..4abbd5b9d672b --- /dev/null +++ b/recipes/log4cplus/all/patches/2.0.6-0001-fix-cmake.patch @@ -0,0 +1,21 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5fa96f7..4209098 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,3 +1,5 @@ ++cmake_minimum_required (VERSION 3.12) ++ + # This block needs to stay before the project (log4cplus) line so that + # the output files placed into Android's libs directory. + if (CMAKE_TOOLCHAIN_FILE) +@@ -12,10 +14,6 @@ endif () + set (CMAKE_LEGACY_CYGWIN_WIN32 0) + + project (log4cplus) +-cmake_minimum_required (VERSION 3.12) +- +-# Use "-fPIC" / "-fPIE" for all targets by default, including static libs. +-set (CMAKE_POSITION_INDEPENDENT_CODE ON) + + enable_language (CXX) + if (MSVC) diff --git a/recipes/log4cplus/all/test_package/CMakeLists.txt b/recipes/log4cplus/all/test_package/CMakeLists.txt index 3b2426c8dfefa..d9b0e93737a79 100644 --- a/recipes/log4cplus/all/test_package/CMakeLists.txt +++ b/recipes/log4cplus/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(log4cplus REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} log4cplus::log4cplus) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE log4cplus::log4cplus) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/log4cplus/all/test_package/conanfile.py b/recipes/log4cplus/all/test_package/conanfile.py index abcaeed3f89b6..a9fbb7f543162 100644 --- a/recipes/log4cplus/all/test_package/conanfile.py +++ b/recipes/log4cplus/all/test_package/conanfile.py @@ -1,10 +1,18 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/log4cplus/all/test_v1_package/CMakeLists.txt b/recipes/log4cplus/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/log4cplus/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/log4cplus/all/test_v1_package/conanfile.py b/recipes/log4cplus/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/log4cplus/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/log4cplus/config.yml b/recipes/log4cplus/config.yml index 53f3c9cf0f166..c48cbc75b8c2f 100644 --- a/recipes/log4cplus/config.yml +++ b/recipes/log4cplus/config.yml @@ -1,9 +1,13 @@ versions: - "2.0.4": + "2.1.0": folder: all - "2.0.5": + "2.0.8": + folder: all + "2.0.7": folder: all "2.0.6": folder: all - "2.0.7": + "2.0.5": + folder: all + "2.0.4": folder: all diff --git a/recipes/logr/all/conandata.yml b/recipes/logr/all/conandata.yml index 9af49e299416a..46dc2294ce601 100644 --- a/recipes/logr/all/conandata.yml +++ b/recipes/logr/all/conandata.yml @@ -11,3 +11,9 @@ sources: "0.4.0": url: "https://github.com/ngrodzitski/logr/archive/v0.4.0.tar.gz" sha256: "c355aa455d0a9c6d1d3bc168a2db0cd7f3c9706b382088e96948ec3a4cf1286f" + "0.5.1": + url: "https://github.com/ngrodzitski/logr/archive/v0.5.1.tar.gz" + sha256: "674be6a53d5b3f40273b1b5710ac9e32d870827032b5008c41621db47f4b3b0e" + "0.6.0": + url: "https://github.com/ngrodzitski/logr/archive/v0.6.0.tar.gz" + sha256: "2ecb40396add33f2120a79957633533381f3df13cb3b53278eb9dec3a1230eb2" diff --git a/recipes/logr/all/conanfile.py b/recipes/logr/all/conanfile.py index ee7363a51c446..a5e869c032b2e 100644 --- a/recipes/logr/all/conanfile.py +++ b/recipes/logr/all/conanfile.py @@ -1,7 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps +from conan.tools.files import get, copy, rmdir +from conan.tools.layout import basic_layout +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version import os +required_conan_version = ">=1.50.0" class LogrConan(ConanFile): name = "logr" @@ -13,110 +20,96 @@ class LogrConan(ConanFile): "for server/desktop applications" ) topics = ("logger", "development", "util", "utils") - generators = "cmake" + settings = "os", "compiler", "build_type", "arch" - no_copy_source = True options = {"backend": ["spdlog", "glog", "log4cplus", "boostlog", None]} default_options = {"backend": "spdlog"} - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("fmt/8.1.1") + if Version(self.version) >= "0.6.0": + fmt_ref = "fmt/9.1.0" + spdlog_ref = "spdlog/1.11.0" + else: + fmt_ref = "fmt/8.1.1" + spdlog_ref = "spdlog/1.9.2" + + self.requires(fmt_ref) if self.options.backend == "spdlog": - self.requires("spdlog/1.9.2") + self.requires(spdlog_ref) elif self.options.backend == "glog": - self.requires("glog/0.5.0") + self.requires("glog/0.6.0") elif self.options.backend == "log4cplus": self.requires("log4cplus/2.0.5") elif self.options.backend == "boostlog": self.requires("boost/1.77.0") - def configure(self): + def package_id(self): + self.info.settings.clear() + self.info.requires.clear() + + def validate(self): minimal_cpp_standard = "17" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, minimal_cpp_standard) minimal_version = { - "gcc": "7", - "clang": "7", - "apple-clang": "10", - "Visual Studio": "16", + "gcc": "10", + "clang": "11", + "apple-clang": "12", } - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - ( - "%s recipe lacks information about the %s compiler " - "standard version support" + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = minimal_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires minimum {self.settings.compiler}-{minimum_version}." ) - % (self.name, compiler) - ) - self.output.warn( - "%s requires a compiler that supports at least C++%s" - % (self.name, minimal_cpp_standard) - ) - return - - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - raise ConanInvalidConfiguration( - "%s requires a compiler that supports at least C++%s" - % (self.name, minimal_cpp_standard) - ) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["LOGR_WITH_SPDLOG_BACKEND"] = ( + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LOGR_WITH_SPDLOG_BACKEND"] = ( self.options.backend == "spdlog" ) - self._cmake.definitions["LOGR_WITH_GLOG_BACKEND"] = ( + tc.variables["LOGR_WITH_GLOG_BACKEND"] = ( self.options.backend == "glog" ) - self._cmake.definitions["LOGR_WITH_LOG4CPLUS_BACKEND"] = ( + tc.variables["LOGR_WITH_LOG4CPLUS_BACKEND"] = ( self.options.backend == "log4cplus" ) - self._cmake.definitions["LOGR_WITH_BOOSTLOG_BACKEND"] = ( + tc.variables["LOGR_WITH_BOOSTLOG_BACKEND"] = ( self.options.backend == "boostlog" ) + tc.variables["LOGR_INSTALL"] = True + tc.variables["LOGR_CONAN_PACKAGING"] = True + tc.variables["LOGR_BUILD_TESTS"] = False + tc.variables["LOGR_BUILD_EXAMPLES"] = False + tc.variables["LOGR_BUILD_BENCHMARKS"] = False + tc.generate() - self._cmake.definitions["LOGR_INSTALL"] = True - self._cmake.definitions["LOGR_CONAN_PACKAGING"] = True - self._cmake.definitions["LOGR_BUILD_TESTS"] = False - self._cmake.definitions["LOGR_BUILD_EXAMPLES"] = False - self._cmake.definitions["LOGR_BUILD_BENCHMARKS"] = False - - self._cmake.configure(source_folder=self._source_subfolder) - return self._cmake + deps = CMakeDeps(self) + deps.generate() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "logr")) cmake.install() - - tools.rmdir(os.path.join(self.package_folder, "lib")) - - def package_id(self): - self.info.settings.clear() + rmdir(self, os.path.join(self.package_folder, "lib")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.set_property("cmake_file_name", "logr") + self.cpp_info.names["cmake_find_package"] = "logr" self.cpp_info.names["cmake_find_package_multi"] = "logr" diff --git a/recipes/logr/all/test_package/CMakeLists.txt b/recipes/logr/all/test_package/CMakeLists.txt index e76b63abc7322..866a0cc839d26 100644 --- a/recipes/logr/all/test_package/CMakeLists.txt +++ b/recipes/logr/all/test_package/CMakeLists.txt @@ -1,15 +1,8 @@ cmake_minimum_required(VERSION 3.8) - -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -project(PackageTest CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package CXX) find_package(logr REQUIRED) -add_executable(example example.cpp) -target_link_libraries(example logr::logr) +add_executable(${PROJECT_NAME} example.cpp) +target_link_libraries(${PROJECT_NAME} logr::logr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/logr/all/test_package/conanfile.py b/recipes/logr/all/test_package/conanfile.py index cdeff684590d2..a9fb96656f203 100644 --- a/recipes/logr/all/test_package/conanfile.py +++ b/recipes/logr/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class LogrTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/logr/all/test_v1_package/CMakeLists.txt b/recipes/logr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7a2102f144a4f --- /dev/null +++ b/recipes/logr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(logr REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/example.cpp) +target_link_libraries(${PROJECT_NAME} logr::logr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/logr/all/test_v1_package/conanfile.py b/recipes/logr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..923245bfa853d --- /dev/null +++ b/recipes/logr/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + + +class LogrTestConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/logr/config.yml b/recipes/logr/config.yml index 5d8c97aa7e21b..2642be9922766 100644 --- a/recipes/logr/config.yml +++ b/recipes/logr/config.yml @@ -9,3 +9,7 @@ versions: folder: all "0.4.0": folder: all + "0.5.1": + folder: all + "0.6.0": + folder: all diff --git a/recipes/ls-qpack/all/conandata.yml b/recipes/ls-qpack/all/conandata.yml new file mode 100644 index 0000000000000..2760252082cf6 --- /dev/null +++ b/recipes/ls-qpack/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "2.5.1": + url: "https://github.com/litespeedtech/ls-qpack/archive/refs/tags/v2.5.1.tar.gz" + sha256: "dae1c159afc8541d51c12f5ad78209fe092815d37cb621b5ee46a9db049a283f" + +patches: + "2.5.1": + - patch_file: "patches/0001-use-cci-package.patch" + patch_description: "use cci packages" + patch_type: "conan" + - patch_file: "patches/0002-add-installer.patch" + patch_description: "add installer" + patch_type: "conan" diff --git a/recipes/ls-qpack/all/conanfile.py b/recipes/ls-qpack/all/conanfile.py new file mode 100644 index 0000000000000..dd139a2740293 --- /dev/null +++ b/recipes/ls-qpack/all/conanfile.py @@ -0,0 +1,77 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.53.0" + +class LsQpackConan(ConanFile): + name = "ls-qpack" + description = "QPACK compression library for use with HTTP/3" + license = "MIT", + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/litespeedtech/ls-qpack/" + topics = ("compression", "quic", "http3", "qpack") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_xxh": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_xxh": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_xxh: + self.requires("xxhash/0.8.1") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["LSQPACK_TESTS"] = False + tc.variables["LSQPACK_BIN"] = False + tc.variables["LSQPACK_XXH"] = self.options.with_xxh + tc.generate() + + dpes = CMakeDeps(self) + dpes.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["ls-qpack"] + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.system_libs = ["m"] + if self.settings.os == "Windows": + self.cpp_info.includedirs.append(os.path.join("include", "wincompat")) diff --git a/recipes/ls-qpack/all/patches/0001-use-cci-package.patch b/recipes/ls-qpack/all/patches/0001-use-cci-package.patch new file mode 100644 index 0000000000000..21e1e856275c9 --- /dev/null +++ b/recipes/ls-qpack/all/patches/0001-use-cci-package.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d9d9aa3..826e99b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -20,9 +20,10 @@ add_library(ls-qpack "") + target_include_directories(ls-qpack PUBLIC .) + target_sources(ls-qpack PRIVATE lsqpack.c) + +-target_include_directories(ls-qpack PRIVATE deps/xxhash/) + if(LSQPACK_XXH) ++ find_package(xxHash REQUIRED CONFIG) + target_sources(ls-qpack PRIVATE deps/xxhash/xxhash.c) ++ target_link_libraries(ls-qpack PUBLIC xxHash::xxhash) + endif() + + if(MSVC) diff --git a/recipes/ls-qpack/all/patches/0002-add-installer.patch b/recipes/ls-qpack/all/patches/0002-add-installer.patch new file mode 100644 index 0000000000000..1acf784e4597a --- /dev/null +++ b/recipes/ls-qpack/all/patches/0002-add-installer.patch @@ -0,0 +1,23 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 670ea97..f2dd257 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -100,3 +100,18 @@ endif() + if(LSQPACK_BIN) + add_subdirectory(bin) + endif() ++ ++include(GNUInstallDirs) ++ ++install( ++ TARGETS ls-qpack ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++) ++ ++install(FILES lsqpack.h DESTINATION include) ++ ++if(WIN32) ++ install(DIRECTORY wincompat DESTINATION include) ++endif() diff --git a/recipes/ls-qpack/all/test_package/CMakeLists.txt b/recipes/ls-qpack/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..20bf4d87148f5 --- /dev/null +++ b/recipes/ls-qpack/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(ls-qpack REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE ls-qpack::ls-qpack) diff --git a/recipes/ls-qpack/all/test_package/conanfile.py b/recipes/ls-qpack/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/ls-qpack/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ls-qpack/all/test_package/test_package.c b/recipes/ls-qpack/all/test_package/test_package.c new file mode 100644 index 0000000000000..315d2c1f5f1d6 --- /dev/null +++ b/recipes/ls-qpack/all/test_package/test_package.c @@ -0,0 +1,80 @@ +#include +#include +#include +#include + +#include "lsqpack.h" + +int +lsqpack_dec_int (const unsigned char **src_p, const unsigned char *src_end, + unsigned prefix_bits, uint64_t *value_p, + struct lsqpack_dec_int_state *state); + + +struct int_test +{ + int it_lineno; + unsigned it_prefix_bits; + unsigned char it_encoded[20]; + size_t it_enc_sz; + uint64_t it_decoded; + int it_dec_retval; +}; + +static const struct int_test tests[] = +{ + + { .it_lineno = __LINE__, + .it_prefix_bits = 7, + .it_encoded = { 0x7F, 0x02, }, + .it_enc_sz = 2, + .it_decoded = 0x81, + .it_dec_retval = 0, + }, +}; + +int +main (void) +{ + struct lsqpack_enc enc; + size_t dec_sz; + int s; + unsigned i; + const unsigned char *p; + uint64_t val; + struct lsqpack_dec_int_state state; + unsigned char dec_buf[LSQPACK_LONGEST_SDTC]; + + const struct { + unsigned peer_max_size; /* Value provided by peer */ + unsigned our_max_size; /* Value to use */ + int expected_tsu; /* Expecting TSU instruction? */ + } tests[] = { + { 0x1000, 0x1000, 1, }, + { 0x1000, 1, 1, }, + { 0x100, 0x100, 1, }, + { 0x1000, 0, 0, }, + }; + + for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i) + { + dec_sz = sizeof(dec_buf); + s = lsqpack_enc_init(&enc, stderr, tests[i].peer_max_size, + tests[i].our_max_size, 0, 0, dec_buf, &dec_sz); + assert(s == 0); + if (tests[i].expected_tsu) + { + assert(dec_sz > 0); + assert((dec_buf[0] & 0xE0) == 0x20); + p = dec_buf; + state.resume = 0; + s = lsqpack_dec_int(&p, p + dec_sz, 5, &val, &state); + assert(s == 0); + assert(val == tests[i].our_max_size); + } + else + assert(dec_sz == 0); + lsqpack_enc_cleanup(&enc); + } + return 0; +} diff --git a/recipes/ls-qpack/all/test_v1_package/CMakeLists.txt b/recipes/ls-qpack/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de3b75d9538de --- /dev/null +++ b/recipes/ls-qpack/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/ls-qpack/all/test_v1_package/conanfile.py b/recipes/ls-qpack/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/ls-qpack/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/ls-qpack/config.yml b/recipes/ls-qpack/config.yml new file mode 100644 index 0000000000000..eab83a303df52 --- /dev/null +++ b/recipes/ls-qpack/config.yml @@ -0,0 +1,3 @@ +versions: + "2.5.1": + folder: all diff --git a/recipes/lua/all/CMakeLists.txt b/recipes/lua/all/CMakeLists.txt index 5c9c34c634730..ed493a41f2982 100644 --- a/recipes/lua/all/CMakeLists.txt +++ b/recipes/lua/all/CMakeLists.txt @@ -1,11 +1,6 @@ cmake_minimum_required(VERSION 2.8.12) project(lua) -include(conanbuildinfo.cmake) -conan_basic_setup() - - - # The following was originally taken from: https://raw.githubusercontent.com/microsoft/vcpkg/master/ports/lua/CMakeLists.txt # Lua can be compiled as either C or C++. @@ -17,7 +12,7 @@ conan_basic_setup() # - This is a source-incompatible change because extern "C" is chosen by the including application. # - The lua.hpp header will not be available. -SET(SOURCE_DIR ${CMAKE_SOURCE_DIR}/${SOURCE_SUBDIR} ) +SET(SOURCE_DIR ${LUA_SRC_DIR}) # Build Libraries FILE(GLOB SRC_LIBLUA "${SOURCE_DIR}/src/*.c") diff --git a/recipes/lua/all/conandata.yml b/recipes/lua/all/conandata.yml index b67859f85a77d..f5255a70f03a4 100644 --- a/recipes/lua/all/conandata.yml +++ b/recipes/lua/all/conandata.yml @@ -8,10 +8,13 @@ sources: "5.4.1": url: "https://www.lua.org/ftp/lua-5.4.1.tar.gz" sha256: "4ba786c3705eb9db6567af29c91a01b81f1c0ac3124fdbf6cd94bdd9e53cca7d" + "5.3.6": + url: "https://www.lua.org/ftp/lua-5.3.6.tar.gz" + sha256: "fc5fd69bb8736323f026672b1b7235da613d7177e72558893a0bdcd320466d60" "5.3.5": url: "https://www.lua.org/ftp/lua-5.3.5.tar.gz" sha256: "0c2eed3f960446e1a3e4b9a1ca2f3ff893b6ce41942cf54d5dd59ab4b3b058ac" patches: "5.3.5": - patch_file: "patches/5.3.5/lua_mobile.patch" - base_path: "source_subfolder/src" + patch_type: "portability" diff --git a/recipes/lua/all/conanfile.py b/recipes/lua/all/conanfile.py index 0d101409713b8..1c9406858f97e 100644 --- a/recipes/lua/all/conanfile.py +++ b/recipes/lua/all/conanfile.py @@ -1,30 +1,38 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import get, copy, load, save, export_conandata_patches, apply_conandata_patches, collect_libs +from conan.tools.apple import fix_apple_shared_install_name + + +required_conan_version = ">=1.53.0" + class LuaConan(ConanFile): name = "lua" + package_type = "library" description = "Lua is a powerful, efficient, lightweight, embeddable scripting language." url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.lua.org/" topics = ("lua", "scripting") license = "MIT" - generators = "cmake" - settings = "os", "compiler", "arch", "build_type" - options = {"shared": [False, True], "fPIC": [True, False], "compile_as_cpp": [True, False]} - default_options = {"shared": False, "fPIC": True, "compile_as_cpp": False} - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + settings = "os", "compiler", "arch", "build_type" + options = { + "shared": [False, True], + "fPIC": [True, False], + "compile_as_cpp": [True, False] + } + default_options = { + "shared": False, + "fPIC": True, + "compile_as_cpp": False + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -32,41 +40,41 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.compile_as_cpp: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("compiler.libcxx") + self.options.rm_safe("compiler.cppstd") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def layout(self): + cmake_layout(self, src_folder="src") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["SOURCE_SUBDIR"] = self._source_subfolder - self._cmake.definitions["SKIP_INSTALL_TOOLS"] = True - self._cmake.definitions["COMPILE_AS_CPP"] = self.options.compile_as_cpp - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LUA_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["SKIP_INSTALL_TOOLS"] = True + tc.variables["COMPILE_AS_CPP"] = self.options.compile_as_cpp + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): # Extract the License/s from the header to a file - tmp = tools.load( os.path.join(self._source_subfolder, "src", "lua.h") ) + tmp = load(self, os.path.join(self.source_folder, "src", "lua.h")) license_contents = tmp[tmp.find("/***", 1):tmp.find("****/", 1)] - tools.save(os.path.join(self.package_folder, "licenses", "COPYING.txt"), license_contents) - cmake = self._configure_cmake() + save(self, os.path.join(self.package_folder, "licenses", "COPYING.txt"), license_contents) + cmake = CMake(self) cmake.install() + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["dl", "m"] if self.settings.os in ["Linux", "FreeBSD", "Macos"]: diff --git a/recipes/lua/all/patches/5.3.5/lua_mobile.patch b/recipes/lua/all/patches/5.3.5/lua_mobile.patch index 2e0db5ea3a80d..8cf7ac6439692 100644 --- a/recipes/lua/all/patches/5.3.5/lua_mobile.patch +++ b/recipes/lua/all/patches/5.3.5/lua_mobile.patch @@ -1,4 +1,4 @@ ---- loslib.c 2020-02-14 12:04:26.000000000 +0100 +--- src/loslib.c 2020-02-14 12:04:26.000000000 +0100 +++ loslib_mobile.c 2020-02-14 12:03:59.000000000 +0100 @@ -140,6 +140,7 @@ diff --git a/recipes/lua/all/test_package/CMakeLists.txt b/recipes/lua/all/test_package/CMakeLists.txt index 1b7dae43e2bfc..4ca1d96700d41 100644 --- a/recipes/lua/all/test_package/CMakeLists.txt +++ b/recipes/lua/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(lua REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/lua/all/test_package/conanfile.py b/recipes/lua/all/test_package/conanfile.py index df7c8083a43c2..7841d879aa96a 100644 --- a/recipes/lua/all/test_package/conanfile.py +++ b/recipes/lua/all/test_package/conanfile.py @@ -1,20 +1,32 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.build import can_run + class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["COMPILE_AS_CPP"] = self.dependencies.host["lua"].options.compile_as_cpp + tc.generate() def build(self): cmake = CMake(self) - # Only for the test package, so we can choose which #include header to use - cmake.definitions["COMPILE_AS_CPP"] = self.options["lua"].compile_as_cpp - cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lua/all/test_v1_package/CMakeLists.txt b/recipes/lua/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..1241d9397ce36 --- /dev/null +++ b/recipes/lua/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/lua/all/test_v1_package/conanfile.py b/recipes/lua/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..df7c8083a43c2 --- /dev/null +++ b/recipes/lua/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + # Only for the test package, so we can choose which #include header to use + cmake.definitions["COMPILE_AS_CPP"] = self.options["lua"].compile_as_cpp + + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/lua/config.yml b/recipes/lua/config.yml index 9070b63a4816a..00ba0957e8f66 100644 --- a/recipes/lua/config.yml +++ b/recipes/lua/config.yml @@ -5,5 +5,7 @@ versions: folder: all "5.4.1": folder: all + "5.3.6": + folder: all "5.3.5": folder: all diff --git a/recipes/luajit/all/conandata.yml b/recipes/luajit/all/conandata.yml index b066a8d0de964..1e7abff8db36b 100644 --- a/recipes/luajit/all/conandata.yml +++ b/recipes/luajit/all/conandata.yml @@ -1,4 +1,12 @@ sources: + "2.1.0-beta3": + url: "https://luajit.org/download/LuaJIT-2.1.0-beta3.tar.gz" + sha256: "1ad2e34b111c802f9d0cdf019e986909123237a28c746b21295b63c9e785d9c3" "2.0.5": url: "http://luajit.org/download/LuaJIT-2.0.5.tar.gz" sha256: "874b1f8297c697821f561f9b73b57ffd419ed8f4278c82e05b48806d30c1e979" +patches: + "2.1.0-beta3": + - patch_file: "patches/2.1.0-beta3-0001-remove-mac-deploy.patch" + patch_type: "conan" + patch_description: "Do not enforce default value for MACOSX_DEPLOYMENT_TARGET" diff --git a/recipes/luajit/all/conanfile.py b/recipes/luajit/all/conanfile.py index 7d70d0b565c90..5271897d749e2 100644 --- a/recipes/luajit/all/conanfile.py +++ b/recipes/luajit/all/conanfile.py @@ -1,6 +1,16 @@ +from conan import ConanFile +from conan.tools.scm import Version +from conan.tools.files import get, chdir, replace_in_file, copy, rmdir, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc, MSBuildToolchain, VCVars, unix_path +from conan.tools.layout import basic_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building +from conan.errors import ConanInvalidConfiguration import os -import platform -from conans import ConanFile, tools, VisualStudioBuildEnvironment, AutoToolsBuildEnvironment + + +required_conan_version = ">=1.53.0" class LuajitConan(ConanFile): @@ -9,99 +19,124 @@ class LuajitConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "http://luajit.org" description = "LuaJIT is a Just-In-Time Compiler (JIT) for the Lua programming language." - topics = ("conan", "lua", "jit") + topics = ("lua", "jit") settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], - "fPIC": [True, False]} - default_options = {"shared": False, - "fPIC": True} - _env_build = None + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + def layout(self): + basic_layout(self, src_folder="src") - def _configure_autotools(self): - if not self._env_build: - self._env_build = AutoToolsBuildEnvironment(self) - return self._env_build + def validate(self): + if self.settings.os == "Macos" and self.settings.arch == "armv8" and cross_building(self): + raise ConanInvalidConfiguration(f"{self.ref} can not be cross-built to Mac M1. Please, try any version >=2.1") + elif Version(self.version) <= "2.1.0-beta1" and self.settings.os == "Macos" and self.settings.arch == "armv8": + raise ConanInvalidConfiguration(f"{self.ref} is not supported by Mac M1. Please, try any version >=2.1") - def build(self): - if self.settings.compiler == 'Visual Studio': - with tools.chdir(os.path.join(self._source_subfolder, 'src')): - env_build = VisualStudioBuildEnvironment(self) - with tools.environment_append(env_build.vars), tools.vcvars(self): - variant = '' if self.options.shared else 'static' - self.run("msvcbuild.bat %s" % variant) + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.generate() + tc = VCVars(self) + tc.generate() else: + tc = AutotoolsToolchain(self) + tc.generate() + + def _patch_sources(self): + if not is_msvc(self): buildmode = 'shared' if self.options.shared else 'static' - makefile = os.path.join(self._source_subfolder, 'src', 'Makefile') - tools.replace_in_file(makefile, + makefile = os.path.join(self.source_folder, 'src', 'Makefile') + replace_in_file(self, makefile, 'BUILDMODE= mixed', 'BUILDMODE= %s' % buildmode) - tools.replace_in_file(makefile, + replace_in_file(self, makefile, 'TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME)', 'TARGET_DYLIBPATH= $(TARGET_DYLIBNAME)') # adjust mixed mode defaults to build either .so or .a, but not both if not self.options.shared: - tools.replace_in_file(makefile, + replace_in_file(self, makefile, 'TARGET_T= $(LUAJIT_T) $(LUAJIT_SO)', 'TARGET_T= $(LUAJIT_T) $(LUAJIT_A)') - tools.replace_in_file(makefile, + replace_in_file(self, makefile, 'TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_SO)', 'TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_A)') else: - tools.replace_in_file(makefile, + replace_in_file(self, makefile, 'TARGET_O= $(LUAJIT_A)', 'TARGET_O= $(LUAJIT_SO)') - env = dict() - if self.settings.os == "Macos": - # Per https://luajit.org/install.html: If MACOSX_DEPLOYMENT_TARGET - # is not set then it's forced to 10.4, which breaks compile on Mojave. - version = self.settings.get_safe("os.version") - if not version and platform.system() == "Darwin": - major, minor, _ = platform.mac_ver()[0].split(".") - version = "%s.%s" % (major, minor) - env["MACOSX_DEPLOYMENT_TARGET"] = version - with tools.chdir(self._source_subfolder), tools.environment_append(env): - env_build = self._configure_autotools() - env_build.make(args=["PREFIX=%s" % self.package_folder]) + if "clang" in str(self.settings.compiler): + replace_in_file(self, makefile, 'CC= $(DEFAULT_CC)', 'CC= clang') + + @property + def _macosx_deployment_target(self): + return self.settings.get_safe("os.version") + + @property + def _make_arguments(self): + args = [f"PREFIX={unix_path(self, self.package_folder)}"] + if is_apple_os(self) and self._macosx_deployment_target: + args.append(f"MACOSX_DEPLOYMENT_TARGET={self._macosx_deployment_target}") + return args + + @property + def _luajit_include_folder(self): + luaversion = Version(self.version) + if luaversion.major == "2": + return f"luajit-{luaversion.major}.{luaversion.minor}" + return "luajit-2.1" + + def build(self): + apply_conandata_patches(self) + self._patch_sources() + if is_msvc(self): + with chdir(self, os.path.join(self.source_folder, "src")): + variant = '' if self.options.shared else 'static' + self.run(f"msvcbuild.bat {variant}", env="conanbuild") + else: + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make(args=self._make_arguments) def package(self): - self.copy("COPYRIGHT", dst="licenses", src=self._source_subfolder) - if self.settings.compiler == 'Visual Studio': - ljs = os.path.join(self._source_subfolder, "src") - inc = os.path.join(self.package_folder, "include", "luajit-2.0") - self.copy("lua.h", dst=inc, src=ljs) - self.copy("lualib.h", dst=inc, src=ljs) - self.copy("lauxlib.h", dst=inc, src=ljs) - self.copy("luaconf.h", dst=inc, src=ljs) - self.copy("lua.hpp", dst=inc, src=ljs) - self.copy("luajit.h", dst=inc, src=ljs) - self.copy("lua51.lib", dst="lib", src=ljs) - self.copy("lua51.dll", dst="bin", src=ljs) + copy(self, "COPYRIGHT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + src_folder = os.path.join(self.source_folder, "src") + include_folder = os.path.join(self.package_folder, "include", self._luajit_include_folder) + if is_msvc(self): + copy(self, "lua.h", src=src_folder, dst=include_folder) + copy(self, "lualib.h", src=src_folder, dst=include_folder) + copy(self, "lauxlib.h", src=src_folder, dst=include_folder) + copy(self, "luaconf.h", src=src_folder, dst=include_folder) + copy(self, "lua.hpp", src=src_folder, dst=include_folder) + copy(self, "luajit.h", src=src_folder, dst=include_folder) + copy(self, "lua51.lib", src=src_folder, dst=os.path.join(self.package_folder, "lib")) + copy(self, "lua51.dll", src=src_folder, dst=os.path.join(self.package_folder, "bin")) else: - with tools.chdir(self._source_subfolder): - env_build = self._configure_autotools() - env_build.install(args=["PREFIX=%s" % self.package_folder]) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.install(args=self._make_arguments + ["DESTDIR="]) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.libs = ["lua51" if self.settings.compiler == "Visual Studio" else "luajit-5.1"] - self.cpp_info.includedirs = [os.path.join(self.package_folder, "include", "luajit-2.0")] - if self.settings.os == "Linux": + self.cpp_info.libs = ["lua51" if is_msvc(self) else "luajit-5.1"] + self.cpp_info.set_property("pkg_config_name", "luajit") + self.cpp_info.includedirs = [os.path.join("include", self._luajit_include_folder)] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["m", "dl"]) diff --git a/recipes/luajit/all/patches/2.1.0-beta3-0001-remove-mac-deploy.patch b/recipes/luajit/all/patches/2.1.0-beta3-0001-remove-mac-deploy.patch new file mode 100644 index 0000000000000..26345dc4f02f0 --- /dev/null +++ b/recipes/luajit/all/patches/2.1.0-beta3-0001-remove-mac-deploy.patch @@ -0,0 +1,14 @@ +diff --git a/src/Makefile b/src/Makefile +index f56465d..a6838bc 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -312,9 +312,6 @@ ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector + TARGET_XCFLAGS+= -fno-stack-protector + endif + ifeq (Darwin,$(TARGET_SYS)) +- ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) +- export MACOSX_DEPLOYMENT_TARGET=10.4 +- endif + TARGET_STRIP+= -x + TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC + TARGET_DYNXLDOPTS= diff --git a/recipes/luajit/all/patches/20230104-0001-remove-mac-deploy.patch b/recipes/luajit/all/patches/20230104-0001-remove-mac-deploy.patch new file mode 100644 index 0000000000000..42e0eca4a7fb6 --- /dev/null +++ b/recipes/luajit/all/patches/20230104-0001-remove-mac-deploy.patch @@ -0,0 +1,14 @@ +diff --git a/src/Makefile b/src/Makefile +index 30d64be..b753ea1 100644 +--- a/src/Makefile ++++ b/src/Makefile +@@ -316,9 +316,6 @@ ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector + TARGET_XCFLAGS+= -fno-stack-protector + endif + ifeq (Darwin,$(TARGET_SYS)) +- ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) +- $(error missing: export MACOSX_DEPLOYMENT_TARGET=XX.YY) +- endif + TARGET_STRIP+= -x + TARGET_XCFLAGS+= -DLUAJIT_UNWIND_EXTERNAL + TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC diff --git a/recipes/luajit/all/test_package/CMakeLists.txt b/recipes/luajit/all/test_package/CMakeLists.txt index c4a786d619086..c0ae2aa0ba9ba 100644 --- a/recipes/luajit/all/test_package/CMakeLists.txt +++ b/recipes/luajit/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package C) find_package(luajit REQUIRED CONFIG) diff --git a/recipes/luajit/all/test_package/conanfile.py b/recipes/luajit/all/test_package/conanfile.py index 7e2dfe859bb27..1d87f369a24da 100644 --- a/recipes/luajit/all/test_package/conanfile.py +++ b/recipes/luajit/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan.tools.build import can_run +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/luajit/all/test_v1_package/CMakeLists.txt b/recipes/luajit/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2f6b1a2f7ec79 --- /dev/null +++ b/recipes/luajit/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/luajit/all/test_v1_package/conanfile.py b/recipes/luajit/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9d6b68dd18b5e --- /dev/null +++ b/recipes/luajit/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/luajit/config.yml b/recipes/luajit/config.yml index 1630e08ca5f32..f13e8f0f1a9ec 100644 --- a/recipes/luajit/config.yml +++ b/recipes/luajit/config.yml @@ -1,3 +1,5 @@ versions: + "2.1.0-beta3": + folder: "all" "2.0.5": folder: "all" diff --git a/recipes/luau/all/CMakeLists.txt b/recipes/luau/all/CMakeLists.txt index a9e2b43449f18..b7e55166bfcf9 100644 --- a/recipes/luau/all/CMakeLists.txt +++ b/recipes/luau/all/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.8) -project(conan_wrapper CXX) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) +project(conan_wrapper LANGUAGES CXX) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -add_subdirectory(source_subfolder) +add_subdirectory(${LUAU_SRC_DIR}) ## installer include(GNUInstallDirs) @@ -17,7 +14,7 @@ install( LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) -install(DIRECTORY "source_subfolder/Ast/include/Luau" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") +install(DIRECTORY "${LUAU_SRC_DIR}/Ast/include/Luau" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") install( TARGETS Luau.Compiler @@ -26,9 +23,9 @@ install( ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) -install(DIRECTORY "source_subfolder/Compiler/include/Luau" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") +install(DIRECTORY "${LUAU_SRC_DIR}/Compiler/include/Luau" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") install(FILES - "source_subfolder/Compiler/include/luacode.h" + "${LUAU_SRC_DIR}/Compiler/include/luacode.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") install( @@ -37,7 +34,7 @@ install( LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) -install(DIRECTORY "source_subfolder/CodeGen/include/Luau" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") +install(DIRECTORY "${LUAU_SRC_DIR}/CodeGen/include/Luau" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") install( @@ -47,7 +44,7 @@ install( ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) -install(DIRECTORY "source_subfolder/Analysis/include/Luau" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") +install(DIRECTORY "${LUAU_SRC_DIR}/Analysis/include/Luau" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") install( TARGETS Luau.VM @@ -57,9 +54,9 @@ install( PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) install(FILES - "source_subfolder/VM/include/lua.h" - "source_subfolder/VM/include/luaconf.h" - "source_subfolder/VM/include/lualib.h" + "${LUAU_SRC_DIR}/VM/include/lua.h" + "${LUAU_SRC_DIR}/VM/include/luaconf.h" + "${LUAU_SRC_DIR}/VM/include/lualib.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") if(LUAU_BUILD_CLI) diff --git a/recipes/luau/all/conandata.yml b/recipes/luau/all/conandata.yml index f1531ff67e9a1..a3d5e744000c9 100644 --- a/recipes/luau/all/conandata.yml +++ b/recipes/luau/all/conandata.yml @@ -1,51 +1,83 @@ sources: + "0.563": + url: "https://github.com/Roblox/luau/archive/0.563.tar.gz" + sha256: "717c1b3e03d20829d75eb484e0699fc824b651b8f394164bc4ab8194482890b2" + "0.558": + url: "https://github.com/Roblox/luau/archive/0.558.tar.gz" + sha256: "3484adddb18872700e033f5917af44d90c266f9e0fff2fac21aec1061f472a06" + "0.556": + url: "https://github.com/Roblox/luau/archive/0.556.tar.gz" + sha256: "dc72f91f4e866a2b25f7608e062c91c84e92a2e5611026e9789f127c3caf39f6" + "0.552": + url: "https://github.com/Roblox/luau/archive/0.552.tar.gz" + sha256: "c638aee88010197d7e6f22e592fa12360e38a69f54ed91980b11ac0f89676db5" + "0.548": + url: "https://github.com/Roblox/luau/archive/0.548.tar.gz" + sha256: "1ec0aa919955aaa2d88dbef115801681d3b4dbfa7a276435a03d20230918659c" + "0.544": + url: "https://github.com/Roblox/luau/archive/0.544.tar.gz" + sha256: "c1e2d4e04fe6f191192d1570bd83f96531804fc484a0bc0e00b53248a01d7dee" "0.541": url: "https://github.com/Roblox/luau/archive/0.541.tar.gz" sha256: "02d50b8c0396a353ed641a61959851d6858607d535ed7373478b8fbc2a508eba" "0.540": url: "https://github.com/Roblox/luau/archive/0.540.tar.gz" sha256: "84b3e52b3b0ccf4d5bc0e0c04055f3a9b2f045c1281e203a858335a6fe76b0ff" - "0.539": - url: "https://github.com/Roblox/luau/archive/0.539.tar.gz" - sha256: "d0a33bbafc88d6d89f23e43229e523b117cd761f1fdbd86977800b5725cc647f" - "0.538": - url: "https://github.com/Roblox/luau/archive/0.538.tar.gz" - sha256: "8a1240e02a7daacf1e5cff249040a3298c013157fc496c66adce6dcb21cc30be" - "0.537": - url: "https://github.com/Roblox/luau/archive/0.537.tar.gz" - sha256: "24122d3192083b2133de47d8039fb744b8007c6667fc1b6f254a2a8d72e15d53" - "0.536": - url: "https://github.com/Roblox/luau/archive/refs/tags/0.536.tar.gz" - sha256: "e6de36e83e9c537d92bcc94852ab498e3c15a310fd2c4cc4e21c616d8ae1a84f" patches: - "0.541": - - patch_file: "patches/0.536-0001-fix-cmake.patch" - base_path: "source_subfolder" + "0.563": + - patch_file: "patches/0.552-0001-fix-cmake.patch" + patch_description: "enable shared build" + patch_type: "portability" - patch_file: "patches/0.536-0002-rename-lerp.patch" - base_path: "source_subfolder" - "0.540": - - patch_file: "patches/0.536-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "rename lerp function to avoid name conflict" + patch_type: "portability" + "0.558": + - patch_file: "patches/0.552-0001-fix-cmake.patch" + patch_description: "enable shared build" + patch_type: "portability" - patch_file: "patches/0.536-0002-rename-lerp.patch" - base_path: "source_subfolder" - "0.539": + patch_description: "rename lerp function to avoid name conflict" + patch_type: "portability" + "0.556": + - patch_file: "patches/0.552-0001-fix-cmake.patch" + patch_description: "enable shared build" + patch_type: "portability" + - patch_file: "patches/0.536-0002-rename-lerp.patch" + patch_description: "rename lerp function to avoid name conflict" + patch_type: "portability" + "0.552": + - patch_file: "patches/0.552-0001-fix-cmake.patch" + patch_description: "enable shared build" + patch_type: "portability" + - patch_file: "patches/0.536-0002-rename-lerp.patch" + patch_description: "rename lerp function to avoid name conflict" + patch_type: "portability" + "0.548": - patch_file: "patches/0.536-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "enable shared build" + patch_type: "portability" - patch_file: "patches/0.536-0002-rename-lerp.patch" - base_path: "source_subfolder" - "0.538": + patch_description: "rename lerp function to avoid name conflict" + patch_type: "portability" + "0.544": - patch_file: "patches/0.536-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "enable shared build" + patch_type: "portability" - patch_file: "patches/0.536-0002-rename-lerp.patch" - base_path: "source_subfolder" - "0.537": + patch_description: "rename lerp function to avoid name conflict" + patch_type: "portability" + "0.541": - patch_file: "patches/0.536-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "enable shared build" + patch_type: "portability" - patch_file: "patches/0.536-0002-rename-lerp.patch" - base_path: "source_subfolder" - "0.536": + patch_description: "rename lerp function to avoid name conflict" + patch_type: "portability" + "0.540": - patch_file: "patches/0.536-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "enable shared build" + patch_type: "portability" - patch_file: "patches/0.536-0002-rename-lerp.patch" - base_path: "source_subfolder" + patch_description: "rename lerp function to avoid name conflict" + patch_type: "portability" diff --git a/recipes/luau/all/conanfile.py b/recipes/luau/all/conanfile.py index abfe5f337d960..5cc40412c6b22 100644 --- a/recipes/luau/all/conanfile.py +++ b/recipes/luau/all/conanfile.py @@ -1,13 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.microsoft import is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout + import os -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class LuauConan(ConanFile): name = "luau" - description = "A fast, small, safe, gradually typed embeddable scripting language derived from Lua " + description = "A fast, small, safe, gradually typed embeddable scripting language derived from Lua" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://luau-lang.org/" @@ -18,23 +23,33 @@ class LuauConan(ConanFile): "fPIC": [True, False], "with_cli": [True, False], "with_web": [True, False], + "native_code_gen": [True, False], } default_options = { "shared": False, "fPIC": True, "with_cli": False, "with_web": False, + "native_code_gen": False, } - generators = "cmake" @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8" if Version(self.version) < "0.549" else "9", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "15", + "msvc": "191", + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -42,55 +57,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + if Version(self.version) < "0.549": + del self.options.native_code_gen - @property - def _compiler_required_cpp17(self): - return { - "Visual Studio": "16", - "gcc": "8", - "clang": "7", - "apple-clang": "12.0", - } + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) - - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise tools.ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{0} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) if is_msvc(self) and self.options.shared: - raise tools.ConanInvalidConfiguration("{} does not support shared build in MSVC".format(self.name)) + raise ConanInvalidConfiguration(f"{self.ref} does not support shared build in MSVC") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["LUAU_BUILD_CLI"] = self.options.with_cli - cmake.definitions["LUAU_BUILD_TESTS"] = False - cmake.definitions["LUAU_BUILD_WEB"] = self.options.with_web - cmake.definitions["LUAU_WERROR"] = False - cmake.definitions["LUAU_STATIC_CRT"] = False - cmake.configure() - return cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LUAU_BUILD_CLI"] = self.options.with_cli + tc.variables["LUAU_BUILD_TESTS"] = False + tc.variables["LUAU_BUILD_WEB"] = self.options.with_web + tc.variables["LUAU_WERROR"] = False + tc.variables["LUAU_STATIC_CRT"] = False + if Version(self.version) >= "0.549": + tc.variables["LUAU_NATIVE"] = self.options.native_code_gen + tc.variables["LUAU_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + if Version(self.version) >= "0.548" and self.options.shared: + replace_in_file(self, os.path.join(self.source_folder, "VM", "include", "luaconf.h"), + "#define LUAI_FUNC __attribute__((visibility(\"hidden\"))) extern", + "#define LUAI_FUNC extern") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy(pattern="lua_LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "lua_LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): @@ -122,10 +138,12 @@ def package_info(self): self.cpp_info.components["CodeGen"].libs = ["Luau.CodeGen"] self.cpp_info.components["CodeGen"].set_property("cmake_target_name", "Luau::CodeGen") self.cpp_info.components["CodeGen"].requires = ["Ast"] + if Version(self.version) >= "0.548": + self.cpp_info.components["CodeGen"].requires.append("VM") if self.options.with_cli: bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) if self.options.with_web: diff --git a/recipes/luau/all/patches/0.552-0001-fix-cmake.patch b/recipes/luau/all/patches/0.552-0001-fix-cmake.patch new file mode 100644 index 0000000000000..aaff66adb45b9 --- /dev/null +++ b/recipes/luau/all/patches/0.552-0001-fix-cmake.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 05d701e..4c73783 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -22,12 +22,12 @@ endif() + + project(Luau LANGUAGES CXX C) + add_library(Luau.Common INTERFACE) +-add_library(Luau.Ast STATIC) +-add_library(Luau.Compiler STATIC) +-add_library(Luau.Analysis STATIC) +-add_library(Luau.CodeGen STATIC) +-add_library(Luau.VM STATIC) +-add_library(isocline STATIC) ++add_library(Luau.Ast) ++add_library(Luau.Compiler) ++add_library(Luau.Analysis) ++add_library(Luau.CodeGen) ++add_library(Luau.VM) ++add_library(isocline) + + if(LUAU_BUILD_CLI) + add_executable(Luau.Repl.CLI) diff --git a/recipes/luau/all/test_package/CMakeLists.txt b/recipes/luau/all/test_package/CMakeLists.txt index 893cbad04577d..6f927f5fc234f 100644 --- a/recipes/luau/all/test_package/CMakeLists.txt +++ b/recipes/luau/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(Luau REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Luau::Luau) +target_link_libraries(${PROJECT_NAME} PRIVATE Luau::Luau) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/luau/all/test_package/conanfile.py b/recipes/luau/all/test_package/conanfile.py index 81a08015e01f1..a9fbb7f543162 100644 --- a/recipes/luau/all/test_package/conanfile.py +++ b/recipes/luau/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/luau/all/test_v1_package/CMakeLists.txt b/recipes/luau/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/luau/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/luau/all/test_v1_package/conanfile.py b/recipes/luau/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..81a08015e01f1 --- /dev/null +++ b/recipes/luau/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/luau/config.yml b/recipes/luau/config.yml index d649377c4e1b8..80eae0ce2170c 100644 --- a/recipes/luau/config.yml +++ b/recipes/luau/config.yml @@ -1,13 +1,17 @@ versions: - "0.541": + "0.563": folder: all - "0.540": + "0.558": + folder: all + "0.556": folder: all - "0.539": + "0.552": folder: all - "0.538": + "0.548": folder: all - "0.537": + "0.544": folder: all - "0.536": + "0.541": + folder: all + "0.540": folder: all diff --git a/recipes/lunasvg/all/CMakeLists.txt b/recipes/lunasvg/all/CMakeLists.txt deleted file mode 100644 index 71d3f2c29c326..0000000000000 --- a/recipes/lunasvg/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/lunasvg/all/conandata.yml b/recipes/lunasvg/all/conandata.yml index 79538b2b85992..e504366930815 100644 --- a/recipes/lunasvg/all/conandata.yml +++ b/recipes/lunasvg/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.3.5": + url: "https://github.com/sammycage/lunasvg/archive/v2.3.5.tar.gz" + sha256: "350ff56aa1acdedefe2ad8a4241a9fb8f9b232868adc7bd36dfb3dbdd57e2e93" + "2.3.4": + url: "https://github.com/sammycage/lunasvg/archive/v2.3.4.tar.gz" + sha256: "1933bf3fcdec81a1c17702b3c6efb00b9e3380e3fcea508f4ee4b11b0d2e45c0" "2.3.2": url: "https://github.com/sammycage/lunasvg/archive/v2.3.2.tar.gz" sha256: "12abe6865dd030adfac70c30592eaa25c4e34fa81379e5149b0186282721f40c" @@ -7,9 +13,19 @@ sources: sha256: "6492bf0f51982f5382f83f1a42f247bb1bbcbaef4a15963bbd53073cd4944a25" patches: + "2.3.5": + - patch_file: "patches/2.3.5-0001-fix-cmake.patch" + patch_description: "use external plutovg and fix installation path for conan" + patch_type: "conan" + "2.3.4": + - patch_file: "patches/2.3.1-0001-fix-cmake.patch" + patch_description: "use external plutovg and fix installation path for conan" + patch_type: "conan" "2.3.2": - - base_path: "source_subfolder" - patch_file: "patches/2.3.1-0001-fix-cmake.patch" + - patch_file: "patches/2.3.1-0001-fix-cmake.patch" + patch_description: "use external plutovg and fix installation path for conan" + patch_type: "conan" "2.3.1": - - base_path: "source_subfolder" - patch_file: "patches/2.3.1-0001-fix-cmake.patch" + - patch_file: "patches/2.3.1-0001-fix-cmake.patch" + patch_description: "use external plutovg and fix installation path for conan" + patch_type: "conan" diff --git a/recipes/lunasvg/all/conanfile.py b/recipes/lunasvg/all/conanfile.py index a6afb71ae1817..faebad4a7c975 100644 --- a/recipes/lunasvg/all/conanfile.py +++ b/recipes/lunasvg/all/conanfile.py @@ -1,15 +1,22 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -required_conan_version = ">=1.33.0" +import os + +required_conan_version = ">=1.52.0" class LunaSVGConan(ConanFile): name = "lunasvg" description = "lunasvg is a standalone SVG rendering library in C++." - topics = ("svg", "renderer", ) license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/sammycage/lunasvg" + topics = ("svg", "renderer", ) settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -19,27 +26,31 @@ class LunaSVGConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake", "cmake_find_package_multi" - - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + if Version(self.version) <= "2.3.2": + return 14 + else: + return 17 @property def _compilers_minimum_version(self): - return { - "Visual Studio": "15", - "gcc": "5", - "clang": "3.5", - "apple-clang": "10" - } + if Version(self.version) <= "2.3.2": + return { + "gcc": "5", + "clang": "3.5", + "apple-clang": "10" + } + else: + return { + "gcc": "7.1", + "clang": "7", + "apple-clang": "12.0" + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -47,48 +58,55 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("plutovg/cci.20220103") + if Version(self.version) < "2.3.5": + self.requires("plutovg/cci.20220103") + else: + self.requires("plutovg/cci.20221030") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") - - def lazy_lt_semver(v1, v2): - lv1 = [int(v) for v in v1.split(".")] - lv2 = [int(v) for v in v2.split(".")] - min_length = min(len(lv1), len(lv2)) - return lv1[:min_length] < lv2[:min_length] - - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("{} requires C++14. Your compiler is unknown. Assuming it supports C++14.".format(self.name)) - elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("{} requires C++14, which your compiler does not fully support.".format(self.name)) + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + if Version(self.version) <= "2.3.2": + check_min_vs(self, 191) + else: + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_SHARED_LIBS"] = self.options.shared - self._cmake.configure() - return self._cmake + tc = CMakeDeps(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/lunasvg/all/patches/2.3.5-0001-fix-cmake.patch b/recipes/lunasvg/all/patches/2.3.5-0001-fix-cmake.patch new file mode 100644 index 0000000000000..4b6e4b7f0ffef --- /dev/null +++ b/recipes/lunasvg/all/patches/2.3.5-0001-fix-cmake.patch @@ -0,0 +1,36 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index b2f07dc..3c40ad5 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -12,7 +12,9 @@ add_library(lunasvg) + + add_subdirectory(include) + add_subdirectory(source) +-add_subdirectory(3rdparty/plutovg) ++ ++find_package(plutovg CONFIG REQUIRED) ++target_link_libraries(lunasvg plutovg::plutovg) + + if(BUILD_SHARED_LIBS) + target_compile_definitions(lunasvg PUBLIC LUNASVG_SHARED) +@@ -23,16 +25,13 @@ if(LUNASVG_BUILD_EXAMPLES) + add_subdirectory(example) + endif() + +-set(LUNASVG_LIBDIR ${CMAKE_INSTALL_PREFIX}/lib) +-set(LUNASVG_INCDIR ${CMAKE_INSTALL_PREFIX}/include) +- + install(FILES + include/lunasvg.h +- DESTINATION ${LUNASVG_INCDIR} ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) + + install(TARGETS lunasvg +- LIBRARY DESTINATION ${LUNASVG_LIBDIR} +- ARCHIVE DESTINATION ${LUNASVG_LIBDIR} +- INCLUDES DESTINATION ${LUNASVG_INCDIR} ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" + ) diff --git a/recipes/lunasvg/all/test_package/CMakeLists.txt b/recipes/lunasvg/all/test_package/CMakeLists.txt index 3207e80a2f2ed..1c8a5ea6697c7 100644 --- a/recipes/lunasvg/all/test_package/CMakeLists.txt +++ b/recipes/lunasvg/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) find_package(lunasvg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} lunasvg::lunasvg) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE lunasvg::lunasvg) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/lunasvg/all/test_package/conanfile.py b/recipes/lunasvg/all/test_package/conanfile.py index 49a3a66ea5bad..a9fb96656f203 100644 --- a/recipes/lunasvg/all/test_package/conanfile.py +++ b/recipes/lunasvg/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lunasvg/all/test_v1_package/CMakeLists.txt b/recipes/lunasvg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..596ce1fb31ebb --- /dev/null +++ b/recipes/lunasvg/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(lunasvg REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE lunasvg::lunasvg) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/lunasvg/all/test_v1_package/conanfile.py b/recipes/lunasvg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..81a08015e01f1 --- /dev/null +++ b/recipes/lunasvg/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/lunasvg/config.yml b/recipes/lunasvg/config.yml index 73ae77ffcdd83..d8c968c29bee6 100644 --- a/recipes/lunasvg/config.yml +++ b/recipes/lunasvg/config.yml @@ -1,4 +1,8 @@ versions: + "2.3.5": + folder: all + "2.3.4": + folder: all "2.3.2": folder: all "2.3.1": diff --git a/recipes/luple/all/conanfile.py b/recipes/luple/all/conanfile.py index e4f4a3acdd2e6..9334773f3ff8a 100644 --- a/recipes/luple/all/conanfile.py +++ b/recipes/luple/all/conanfile.py @@ -1,8 +1,12 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, download, get +from conan.tools.layout import basic_layout import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" + class LupleConan(ConanFile): name = "luple" @@ -10,41 +14,58 @@ class LupleConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/alexpolt/luple" description = "Home to luple, nuple, C++ String Interning, Struct Reader and C++ Type Loophole" - topics = ("conan", "loophole", "luple", "nuple", "struct", "intern") - settings = "compiler" + topics = ("loophole", "luple", "nuple", "struct", "intern") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def validate(self): - minimal_cpp_standard = "14" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { + @property + def _min_cppstd(self): + return "14" + + @property + def _compilers_minimum_version(self): + return { "gcc": "5", "clang": "3.4", "apple-clang": "10", - "Visual Studio": "14" + "Visual Studio": "14", + "msvc": "190", } - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - return - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version][0], strip_root=True) - tools.download(filename="LICENSE", **self.conan_data["sources"][self.version][1]) + get(self, **self.conan_data["sources"][self.version][0], + destination=self.source_folder, strip_root=True) + download(self, filename="LICENSE", **self.conan_data["sources"][self.version][1]) - def package(self): - self.copy("LICENSE", dst="licenses") - self.copy("*.h", dst="include") + def build(self): + pass - def package_id(self): - self.info.header_only() + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) def package_info(self): + self.cpp_info.bindirs = [] self.cpp_info.libdirs = [] diff --git a/recipes/luple/all/test_package/CMakeLists.txt b/recipes/luple/all/test_package/CMakeLists.txt index 3300ff7750277..b556daffe2a12 100644 --- a/recipes/luple/all/test_package/CMakeLists.txt +++ b/recipes/luple/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(luple REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE luple::luple) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/luple/all/test_package/conanfile.py b/recipes/luple/all/test_package/conanfile.py index 1d0bdd3779793..0a6bc68712d90 100644 --- a/recipes/luple/all/test_package/conanfile.py +++ b/recipes/luple/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/luple/all/test_v1_package/CMakeLists.txt b/recipes/luple/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/luple/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/luple/all/test_v1_package/conanfile.py b/recipes/luple/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/luple/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/lurlparser/all/CMakeLists.txt b/recipes/lurlparser/all/CMakeLists.txt new file mode 100644 index 0000000000000..e0daa695ec3ad --- /dev/null +++ b/recipes/lurlparser/all/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.8) +project(LUrlParser LANGUAGES CXX) + +add_library(lurlparser ${LURLPARSER_SRC_DIR}/LUrlParser.cpp) +target_include_directories(lurlparser PRIVATE ${LURLPARSER_SRC_DIR}) +target_compile_features(lurlparser PRIVATE cxx_std_11) +set_target_properties(lurlparser PROPERTIES + PUBLIC_HEADER ${LURLPARSER_SRC_DIR}/LUrlParser.h + CMAKE_CXX_STANDARD_REQUIRED ON + CMAKE_CXX_EXTENSIONS OFF + WINDOWS_EXPORT_ALL_SYMBOLS ON +) + +include(GNUInstallDirs) +install( + TARGETS lurlparser + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) diff --git a/recipes/lurlparser/all/conandata.yml b/recipes/lurlparser/all/conandata.yml new file mode 100644 index 0000000000000..5f5dd28919386 --- /dev/null +++ b/recipes/lurlparser/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1": + url: "https://github.com/corporateshark/LUrlParser/archive/refs/tags/release-1.1.tar.gz" + sha256: "f697bf9151c78b5e54682ff8f1ff759b15c3cbe73b179576a921b526cdf9ff22" diff --git a/recipes/lurlparser/all/conanfile.py b/recipes/lurlparser/all/conanfile.py new file mode 100644 index 0000000000000..6469f5166a747 --- /dev/null +++ b/recipes/lurlparser/all/conanfile.py @@ -0,0 +1,73 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.50.0" + +class PackageConan(ConanFile): + name = "lurlparser" + description = "Lightweight URL & URI parser (RFC 1738, RFC 3986)" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/corporateshark/LUrlParser/" + topics = ("url", "uri", "parser") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _minimum_cpp_standard(self): + return 11 + + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LURLPARSER_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() + + def package(self): + copy(self, pattern="License.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["lurlparser"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/lurlparser/all/test_package/CMakeLists.txt b/recipes/lurlparser/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2160e23166fc3 --- /dev/null +++ b/recipes/lurlparser/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(lurlparser REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE lurlparser::lurlparser) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/lurlparser/all/test_package/conanfile.py b/recipes/lurlparser/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/lurlparser/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lurlparser/all/test_package/test_package.cpp b/recipes/lurlparser/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ef4db579b3178 --- /dev/null +++ b/recipes/lurlparser/all/test_package/test_package.cpp @@ -0,0 +1,20 @@ +#include + +#include "LUrlParser.h" + +int main() { + const auto URL = LUrlParser::ParseURL::parseURL("https://John:Dow@github.com:80/corporateshark/LUrlParser"); + + if (URL.isValid()) { + std::cout << "Scheme : " << URL.scheme_ << std::endl; + std::cout << "Host : " << URL.host_ << std::endl; + std::cout << "Port : " << URL.port_ << std::endl; + std::cout << "Path : " << URL.path_ << std::endl; + std::cout << "Query : " << URL.query_ << std::endl; + std::cout << "Fragment : " << URL.fragment_ << std::endl; + std::cout << "User name : " << URL.userName_ << std::endl; + std::cout << "Password : " << URL.password_ << std::endl; + } + + return 0; +} diff --git a/recipes/lurlparser/all/test_v1_package/CMakeLists.txt b/recipes/lurlparser/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..44cd3222ce1e5 --- /dev/null +++ b/recipes/lurlparser/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(lurlparser REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE lurlparser::lurlparser) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/lurlparser/all/test_v1_package/conanfile.py b/recipes/lurlparser/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/lurlparser/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/lurlparser/config.yml b/recipes/lurlparser/config.yml new file mode 100644 index 0000000000000..3f8a45fae5832 --- /dev/null +++ b/recipes/lurlparser/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1": + folder: all diff --git a/recipes/lyra/all/conandata.yml b/recipes/lyra/all/conandata.yml index 7c677cbb2b102..f6627e78699fe 100644 --- a/recipes/lyra/all/conandata.yml +++ b/recipes/lyra/all/conandata.yml @@ -23,3 +23,6 @@ sources: "1.6.0": sha256: 919e92a9c02fea3f365a3a7bdccd8b306311a28a7f2044dac8e7651106d7b644 url: https://github.com/bfgroup/Lyra/archive/1.6.tar.gz + "1.6.1": + sha256: a93f247ed89eba11ca36eb24c4f8ba7be636bf24e74aaaa8e1066e0954bec7e3 + url: https://github.com/bfgroup/Lyra/archive/1.6.1.tar.gz diff --git a/recipes/lyra/all/conanfile.py b/recipes/lyra/all/conanfile.py index 379e7cf1b206e..184573a6e3fe9 100644 --- a/recipes/lyra/all/conanfile.py +++ b/recipes/lyra/all/conanfile.py @@ -1,7 +1,10 @@ import os -from conans import ConanFile, tools +from conan import ConanFile +import conan.tools.files +import conan.tools.layout +import conan.tools.build -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class LyraConan(ConanFile): @@ -15,30 +18,39 @@ class LyraConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" license = "MIT" - _source_subfolder = "source_subfolder" - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + if self.settings.compiler.get_safe("cppstd"): + conan.tools.build.check_min_cppstd(self, 11) def package_id(self): - self.info.header_only() + self.info.clear() + + def layout(self): + conan.tools.layout.basic_layout(self, src_folder="root") def source(self): - tools.get( + conan.tools.files.get( + self, **self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + strip_root=True) def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy("*.h*", dst="include", src=os.path.join(self._source_subfolder, "include")) + conan.tools.files.copy( + self, "LICENSE.txt", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + conan.tools.files.copy( + self, "*.h*", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "lyra") self.cpp_info.set_property("cmake_target_name", "bfg::lyra") # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["_lyra"].set_property("cmake_target_name", "bfg::lyra") + self.cpp_info.components["_lyra"].set_property( + "cmake_target_name", "bfg::lyra") self.cpp_info.filenames["cmake_find_package"] = "lyra" self.cpp_info.filenames["cmake_find_package_multi"] = "lyra" self.cpp_info.names["cmake_find_package"] = "bfg" diff --git a/recipes/lyra/all/test_package/CMakeLists.txt b/recipes/lyra/all/test_package/CMakeLists.txt index b200e21129c40..294a9afb37677 100644 --- a/recipes/lyra/all/test_package/CMakeLists.txt +++ b/recipes/lyra/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(lyra REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/lyra/all/test_package/conanfile.py b/recipes/lyra/all/test_package/conanfile.py index 49a3a66ea5bad..0b275b10a2f3c 100644 --- a/recipes/lyra/all/test_package/conanfile.py +++ b/recipes/lyra/all/test_package/conanfile.py @@ -1,17 +1,26 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +import conan.tools.build +import conan.tools.cmake import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + conan.tools.cmake.cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): - cmake = CMake(self) + cmake = conan.tools.cmake.CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if conan.tools.build.can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lyra/all/test_v1_package/CMakeLists.txt b/recipes/lyra/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b200e21129c40 --- /dev/null +++ b/recipes/lyra/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(lyra REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} bfg::lyra) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/lyra/all/test_v1_package/conanfile.py b/recipes/lyra/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/lyra/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/lyra/all/test_v1_package/test_package.cpp b/recipes/lyra/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..5298875e31c6a --- /dev/null +++ b/recipes/lyra/all/test_v1_package/test_package.cpp @@ -0,0 +1,6 @@ +#include + +int main(int argc, const char** argv) +{ + auto cli = lyra::cli_parser(); +} diff --git a/recipes/lyra/config.yml b/recipes/lyra/config.yml index 2983a97d0280f..425271e9a388e 100644 --- a/recipes/lyra/config.yml +++ b/recipes/lyra/config.yml @@ -15,3 +15,5 @@ versions: folder: all "1.6.0": folder: all + "1.6.1": + folder: all diff --git a/recipes/lz4/all/conandata.yml b/recipes/lz4/all/conandata.yml index 3579b5186e78a..577763acfe7a6 100644 --- a/recipes/lz4/all/conandata.yml +++ b/recipes/lz4/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.9.4": + sha256: 0b0e3aa07c8c063ddf40b082bdf7e37a1562bda40a0ff5272957f3e987e0e54b + url: https://github.com/lz4/lz4/archive/v1.9.4.tar.gz "1.9.3": sha256: 030644df4611007ff7dc962d981f390361e6c97a34e5cbc393ddfbe019ffe2c1 url: https://github.com/lz4/lz4/archive/v1.9.3.tar.gz @@ -8,7 +11,15 @@ sources: patches: "1.9.3": - patch_file: "patches/0003-cmake-minimum-required-first-1.9.3.patch" + patch_description: "Move cmake_minimum_required to the top of CMakeFile.txt" + patch_type: conan "1.9.2": - patch_file: "patches/0001-cmake-add-shared-DEFINE_SYMBOL.patch" + patch_description: "Add LZ4_DLL_EXPORT to MSVC" + patch_type: portability - patch_file: "patches/0002-cmake-optional-cli.patch" + patch_description: "Add ability not to compile the CLI" + patch_type: conan - patch_file: "patches/0003-cmake-minimum-required-first-1.9.2.patch" + patch_description: "Move cmake_minimum_required to the top of CMakeFile.txt" + patch_type: conan diff --git a/recipes/lz4/all/conanfile.py b/recipes/lz4/all/conanfile.py index 1bfaf60d3093c..00e8eb7116e69 100644 --- a/recipes/lz4/all/conanfile.py +++ b/recipes/lz4/all/conanfile.py @@ -1,11 +1,12 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os +import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class LZ4Conan(ConanFile): @@ -14,7 +15,7 @@ class LZ4Conan(ConanFile): license = ("BSD-2-Clause", "BSD-3-Clause") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/lz4/lz4" - topics = ("lz4", "compression") + topics = ("compression") settings = "os", "arch", "compiler", "build_type" options = { @@ -27,8 +28,7 @@ class LZ4Conan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -36,15 +36,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") @@ -79,17 +73,50 @@ def build(self): cmake.configure(build_script_folder=self._cmakelists_folder) cmake.build() + def _create_cmake_module_alias_targets(self, module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent(f"""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() + if Version(self.version) >= "1.9.4": + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "share")) + # TODO: to remove in conan v2 once legacy generators removed + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {self._lz4_target: "lz4::lz4"}, + ) + + @property + def _lz4_target(self): + return f"LZ4::{'lz4_shared' if self.options.shared else 'lz4_static'}" + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "lz4") + self.cpp_info.set_property("cmake_target_name", self._lz4_target) + self.cpp_info.set_property("cmake_target_aliases", ["lz4::lz4"]) # old unofficial target in CCI for lz4, kept for the moment to not break consumers self.cpp_info.set_property("pkg_config_name", "liblz4") self.cpp_info.libs = ["lz4"] if is_msvc(self) and self.options.shared: self.cpp_info.defines.append("LZ4_DLL_IMPORT=1") + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] self.cpp_info.names["pkg_config"] = "liblz4" diff --git a/recipes/lz4/all/test_package/CMakeLists.txt b/recipes/lz4/all/test_package/CMakeLists.txt index 635cd8a81b70b..14b12b7977c2c 100644 --- a/recipes/lz4/all/test_package/CMakeLists.txt +++ b/recipes/lz4/all/test_package/CMakeLists.txt @@ -4,10 +4,18 @@ project(test_package LANGUAGES C) find_package(lz4 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE lz4::lz4) +if(TARGET LZ4::lz4_static) + target_link_libraries(${PROJECT_NAME} PRIVATE LZ4::lz4_static) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE LZ4::lz4_shared) +endif() option(TEST_SHARED_LIB "Use package in a shared library") if(TEST_AS_SHARED_LIB) add_library(${PROJECT_NAME}2 SHARED lib.c) - target_link_libraries(${PROJECT_NAME}2 PRIVATE lz4::lz4) + if(TARGET LZ4::lz4_static) + target_link_libraries(${PROJECT_NAME}2 PRIVATE LZ4::lz4_static) + else() + target_link_libraries(${PROJECT_NAME}2 PRIVATE LZ4::lz4_shared) + endif() endif() diff --git a/recipes/lz4/all/test_package/conanfile.py b/recipes/lz4/all/test_package/conanfile.py index e75f5178b45bc..e1a1aff777023 100644 --- a/recipes/lz4/all/test_package/conanfile.py +++ b/recipes/lz4/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os @@ -7,6 +7,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) @@ -15,8 +16,9 @@ def layout(self): cmake_layout(self) def generate(self): + lz4 = self.dependencies["lz4"] tc = CMakeToolchain(self) - tc.variables["TEST_SHARED_LIB"] = dict(self.options["lz4"].items()).get("fPIC", True) + tc.variables["TEST_SHARED_LIB"] = lz4.options.get_safe("fPIC", True) tc.generate() def build(self): @@ -25,6 +27,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/lz4/all/test_v1_package/CMakeLists.txt b/recipes/lz4/all/test_v1_package/CMakeLists.txt index 027f3c1a4263e..f9324f7603fe8 100644 --- a/recipes/lz4/all/test_v1_package/CMakeLists.txt +++ b/recipes/lz4/all/test_v1_package/CMakeLists.txt @@ -7,10 +7,18 @@ conan_basic_setup(TARGETS) find_package(lz4 REQUIRED CONFIG) add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE lz4::lz4) +if(TARGET LZ4::lz4_static) + target_link_libraries(${PROJECT_NAME} PRIVATE LZ4::lz4_static) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE LZ4::lz4_shared) +endif() option(TEST_SHARED_LIB "Use package in a shared library") if(TEST_AS_SHARED_LIB) add_library(${PROJECT_NAME}2 SHARED ../test_package/lib.c) - target_link_libraries(${PROJECT_NAME}2 PRIVATE lz4::lz4) + if(TARGET LZ4::lz4_static) + target_link_libraries(${PROJECT_NAME}2 PRIVATE LZ4::lz4_static) + else() + target_link_libraries(${PROJECT_NAME}2 PRIVATE LZ4::lz4_shared) + endif() endif() diff --git a/recipes/lz4/all/test_v1_package/conanfile.py b/recipes/lz4/all/test_v1_package/conanfile.py index 051325f9879dc..77061a2f84fa0 100644 --- a/recipes/lz4/all/test_v1_package/conanfile.py +++ b/recipes/lz4/all/test_v1_package/conanfile.py @@ -1,5 +1,5 @@ -# pylint: skip-file -from conans import ConanFile, CMake, tools +from conans import ConanFile, CMake +from conan.tools.build import cross_building import os @@ -14,6 +14,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if not cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) diff --git a/recipes/lz4/config.yml b/recipes/lz4/config.yml index 21112b10e25d5..f96920e268df8 100644 --- a/recipes/lz4/config.yml +++ b/recipes/lz4/config.yml @@ -1,4 +1,6 @@ versions: + "1.9.4": + folder: all "1.9.3": folder: all "1.9.2": diff --git a/recipes/lzfse/all/conanfile.py b/recipes/lzfse/all/conanfile.py index 530adaa40f1f9..a6aa023686644 100644 --- a/recipes/lzfse/all/conanfile.py +++ b/recipes/lzfse/all/conanfile.py @@ -1,19 +1,20 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class LzfseConan(ConanFile): name = "lzfse" description = "Lempel-Ziv style data compression algorithm using Finite State Entropy coding." license = "BSD-3-Clause" - topics = ("lzfse", "compression", "decompression") + topics = ("compression", "decompression") homepage = "https://github.com/lzfse/lzfse" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,8 +26,7 @@ class LzfseConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -34,22 +34,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -75,6 +68,5 @@ def package_info(self): if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("LZFSE_DLL") - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/lzfse/all/test_package/conanfile.py b/recipes/lzfse/all/test_package/conanfile.py index feb43a8fb1857..a3fbe307717ad 100644 --- a/recipes/lzfse/all/test_package/conanfile.py +++ b/recipes/lzfse/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,20 +7,21 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") txt_path = os.path.join(self.source_folder, "test.txt") self.run(f"{bin_path} -encode -i {txt_path}", env="conanrun") diff --git a/recipes/lzfse/all/test_v1_package/CMakeLists.txt b/recipes/lzfse/all/test_v1_package/CMakeLists.txt index 92018de27c3ec..0d20897301b68 100644 --- a/recipes/lzfse/all/test_v1_package/CMakeLists.txt +++ b/recipes/lzfse/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGET) +conan_basic_setup(TARGETS) -find_package(lzfse REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE lzfse::lzfse) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/lzfse/all/test_v1_package/conanfile.py b/recipes/lzfse/all/test_v1_package/conanfile.py index 6f91d1323474b..4e6c8eb3b50fd 100644 --- a/recipes/lzfse/all/test_v1_package/conanfile.py +++ b/recipes/lzfse/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/lzham/all/conandata.yml b/recipes/lzham/all/conandata.yml new file mode 100644 index 0000000000000..17b541de9d7b8 --- /dev/null +++ b/recipes/lzham/all/conandata.yml @@ -0,0 +1,33 @@ +sources: + "cci.20220103": + sha256: "3e3ccf7a57b1e6a90099784597aa7da30de3249a5f7fe532cefb3a77db5acbfb" + url: "https://github.com/richgel999/lzham_codec/archive/d379b1f9121e2197881c61cfc4713c78848bdfe7.zip" +patches: + "cci.20220103": + - patch_file: "patches/aarch64-yield-cci.20220103.patch" + patch_description: 'Uses "yield" rather than "pause" mneumonic to fix + aarch64 build' + patch_type: portability + + - patch_file: "patches/cmake-min-req-swap-cci.20220103.patch" + patch_description: 'Puts cmake_minimum_required before project in all + CMakeLists' + patch_type: portability + + - patch_file: "patches/fix-osx-cci.20220103.patch" + patch_description: "Fixes building on OSX" + patch_type: portability + + - patch_file: "patches/use-lzham-types-cci.20220103.patch" + patch_description: 'Uses typedefs prefixed with LZHAM to fix linux build + errors' + patch_type: portability + + - patch_file: "patches/cmake-rm-tests-cci.20220103.patch" + patch_description: "Skips building of lzhamtest for CMake" + patch_type: conan + + - patch_file: "patches/msvc-conan-cci.20220103.patch" + patch_description: 'Skips building of lzhamtest and examples for MSVC, + and injects conan toolchain for MSVC' + patch_type: conan diff --git a/recipes/lzham/all/conanfile.py b/recipes/lzham/all/conanfile.py new file mode 100644 index 0000000000000..b1b9dc2a684e4 --- /dev/null +++ b/recipes/lzham/all/conanfile.py @@ -0,0 +1,158 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import ( + apply_conandata_patches, + copy, + export_conandata_patches, + get, + rmdir +) +from conan.tools.microsoft import ( + MSBuild, MSBuildDeps, MSBuildToolchain, VCVars, is_msvc, vs_layout +) + +required_conan_version = ">=1.52.0" + +SLN_FILE = "lzham.sln" + + +class PackageConan(ConanFile): + name = "lzham" + + description = ( + "Compression algorithm similar compression ratio and faster " + "decompression than LZMA." + ) + + license = "LicenseRef-LICENSE" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/richgel999/lzham_codec" + topics = ("compression", "lz-compression") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + if is_msvc(self): + vs_layout(self) + else: + cmake_layout(self, src_folder="src") + + def source(self): + get( + self, + **self.conan_data["sources"][self.version], + destination=self.source_folder, + strip_root=True + ) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.generate() + tc = MSBuildDeps(self) + tc.generate() + tc = VCVars(self) + tc.generate() + else: + tc = CMakeToolchain(self) + + # Honor BUILD_SHARED_LIBS from conan_toolchain (see + # https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + msbuild = MSBuild(self) + msbuild.build_type = ( + "Debug" if self.settings.build_type == "Debug" else "Release" + ) + msbuild.platform = ( + "Win32" if self.settings.arch == "x86" else msbuild.platform + ) + msbuild.build(sln="lzham.sln") + else: + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder + ) + + if is_msvc(self): + suffix = "x64D" if self.settings.build_type == "Debug" else "x64" + copy( + self, + pattern=f"lzham_{suffix}.lib", + dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.build_folder, "lib", "x64"), + keep_path=False + ) + copy( + self, + pattern=f"lzham_{suffix}.dll", + dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(self.build_folder, "bin"), + keep_path=False + ) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + else: + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "res")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) + + if is_msvc(self): + lib_name = "lzham_x64" + if self.settings.build_type == "Debug": + lib_name += "D" + self.cpp_info.libs = [lib_name] + else: + self.cpp_info.libs = ["lzhamdll", "lzhamcomp", "lzhamdecomp"] + self.cpp_info.set_property("cmake_file_name", "lzham") + self.cpp_info.set_property("cmake_target_name", "lzham::lzham") + self.cpp_info.set_property("pkg_config_name", "lzham") + + # TODO: to remove in conan v2 once cmake_find_package_* generators + # removed + self.cpp_info.names["cmake_find_package"] = "lzham" + self.cpp_info.names["cmake_find_package_multi"] = "lzham" + self.cpp_info.names["pkg_config"] = "lzham" diff --git a/recipes/lzham/all/patches/aarch64-yield-cci.20220103.patch b/recipes/lzham/all/patches/aarch64-yield-cci.20220103.patch new file mode 100644 index 0000000000000..313029dda755c --- /dev/null +++ b/recipes/lzham/all/patches/aarch64-yield-cci.20220103.patch @@ -0,0 +1,16 @@ +diff --git a/lzhamdecomp/lzham_platform.h b/lzhamdecomp/lzham_platform.h +index 01704be..920a8f4 100644 +--- a/lzhamdecomp/lzham_platform.h ++++ b/lzhamdecomp/lzham_platform.h +@@ -24,7 +24,11 @@ void lzham_fail(const char* pExp, const char* pFile, unsigned line); + #if defined(__GNUC__) && LZHAM_PLATFORM_PC + extern __inline__ __attribute__((__always_inline__,__gnu_inline__)) void lzham_yield_processor() + { ++ #if defined(__aarch64__) ++ __asm__ __volatile__("yield"); ++ #else + __asm__ __volatile__("pause"); ++ #endif + } + #elif LZHAM_PLATFORM_X360 + #define lzham_yield_processor() \ diff --git a/recipes/lzham/all/patches/cmake-min-req-swap-cci.20220103.patch b/recipes/lzham/all/patches/cmake-min-req-swap-cci.20220103.patch new file mode 100644 index 0000000000000..8c598c5b49697 --- /dev/null +++ b/recipes/lzham/all/patches/cmake-min-req-swap-cci.20220103.patch @@ -0,0 +1,55 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 428cdfc..b8980e5 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ +-# PROJECT(lzham) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzham) + option(BUILD_X64 "build 64-bit" ON) + option(BUILD_SHARED_LIBS "build shared/static libs" ON) + +diff --git a/lzhamcomp/CMakeLists.txt b/lzhamcomp/CMakeLists.txt +index c80cc66..a3f77e7 100644 +--- a/lzhamcomp/CMakeLists.txt ++++ b/lzhamcomp/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamcomp) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamcomp) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") +diff --git a/lzhamdecomp/CMakeLists.txt b/lzhamdecomp/CMakeLists.txt +index bf87a02..723379e 100644 +--- a/lzhamdecomp/CMakeLists.txt ++++ b/lzhamdecomp/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamdecomp) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamdecomp) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") +diff --git a/lzhamdll/CMakeLists.txt b/lzhamdll/CMakeLists.txt +index f77f3fe..5a162b6 100644 +--- a/lzhamdll/CMakeLists.txt ++++ b/lzhamdll/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamdll) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamdll) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") +diff --git a/lzhamtest/CMakeLists.txt b/lzhamtest/CMakeLists.txt +index 3349911..b8833b9 100644 +--- a/lzhamtest/CMakeLists.txt ++++ b/lzhamtest/CMakeLists.txt +@@ -1,5 +1,5 @@ +-PROJECT(lzhamtest) + cmake_minimum_required(VERSION 2.8) ++PROJECT(lzhamtest) + option(BUILD_X64 "build 64-bit" TRUE) + + message("Initial BUILD_X64=${BUILD_X64}") diff --git a/recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch b/recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch new file mode 100644 index 0000000000000..7b5cf8afef5f7 --- /dev/null +++ b/recipes/lzham/all/patches/cmake-rm-tests-cci.20220103.patch @@ -0,0 +1,12 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 428cdfc..1857db2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,6 @@ option(BUILD_SHARED_LIBS "build shared/static libs" ON) + add_subdirectory(lzhamdecomp) + add_subdirectory(lzhamcomp) + add_subdirectory(lzhamdll) +-add_subdirectory(lzhamtest) + + install(FILES include/lzham_dynamic_lib.h + include/lzham_exports.inc diff --git a/recipes/lzham/all/patches/fix-osx-cci.20220103.patch b/recipes/lzham/all/patches/fix-osx-cci.20220103.patch new file mode 100644 index 0000000000000..156502e346443 --- /dev/null +++ b/recipes/lzham/all/patches/fix-osx-cci.20220103.patch @@ -0,0 +1,28 @@ +diff --git a/lzhamdecomp/lzham_platform.cpp b/lzhamdecomp/lzham_platform.cpp +index cfc85c1..599a847 100644 +--- a/lzhamdecomp/lzham_platform.cpp ++++ b/lzhamdecomp/lzham_platform.cpp +@@ -61,7 +61,7 @@ void lzham_debug_break(void) + { + #if LZHAM_USE_WIN32_API + DebugBreak(); +-#elif (TARGET_OS_MAC == 1) && (TARGET_IPHONE_SIMULATOR == 0) && (TARGET_OS_IPHONE == 0) ++#elif (TARGET_OS_MAC == 1) && (TARGET_IPHONE_SIMULATOR == 0) && (TARGET_OS_IPHONE == 0) && !defined(__clang__) + __asm {int 3} + #else + assert(0); +diff --git a/lzhamdecomp/lzham_traits.h b/lzhamdecomp/lzham_traits.h +index ea7214f..e103bad 100644 +--- a/lzhamdecomp/lzham_traits.h ++++ b/lzhamdecomp/lzham_traits.h +@@ -67,7 +67,9 @@ namespace lzham + // Defines type Q as bitwise copyable. + #define LZHAM_DEFINE_BITWISE_COPYABLE(Q) template<> struct bitwise_copyable { enum { cFlag = true }; }; + +-#if defined(__APPLE__) || defined(__NetBSD__) ++#if defined(__APPLE__) ++ #define LZHAM_IS_POD(T) std::is_pod::value ++#elif defined(__NetBSD__) + #define LZHAM_IS_POD(T) std::__is_pod::__value + #else + #define LZHAM_IS_POD(T) __is_pod(T) diff --git a/recipes/lzham/all/patches/msvc-conan-cci.20220103.patch b/recipes/lzham/all/patches/msvc-conan-cci.20220103.patch new file mode 100644 index 0000000000000..ca0b641855eed --- /dev/null +++ b/recipes/lzham/all/patches/msvc-conan-cci.20220103.patch @@ -0,0 +1,83 @@ +diff --git a/lzham.sln b/lzham.sln +index 5c0edb6..63343f3 100644 +--- a/lzham.sln ++++ b/lzham.sln +@@ -3,22 +3,12 @@ Microsoft Visual Studio Solution File, Format Version 11.00 + # Visual Studio 2010 + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamdll", "lzhamdll\lzham.vcxproj", "{763BE79D-1280-41B7-81C5-7DC41E2BDB44}" + EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamtest", "lzhamtest\lzhamtest.vcxproj", "{BBE16587-150E-460C-8AB4-F18B92D0B981}" +-EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamdecomp", "lzhamdecomp\lzhamdecomp.vcxproj", "{8DA0CD32-701D-48D7-AE92-728338501500}" + EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamcomp", "lzhamcomp\lzhamcomp.vcxproj", "{8DA0CD46-791D-48D7-AE92-728338501500}" + EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example1", "example1\example1.vcxproj", "{BBE16587-150E-460C-8AB4-E18B92D0B982}" +-EndProject + Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lzhamlib", "lzhamlib\lzhamlib.vcxproj", "{83A2F0B5-1D02-4A13-B579-714F60E31774}" + EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example2", "example2\example2.vcxproj", "{CBE16587-150E-460C-8AB4-E18B92D0B983}" +-EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example3", "example3\example3.vcxproj", "{1BE16587-150E-460C-8AB4-E18B92D0BA87}" +-EndProject +-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "example4", "example4\example4.vcxproj", "{1BE16587-260E-460C-8AB4-E18B92D0BA87}" +-EndProject + Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 +diff --git a/lzhamcomp/lzhamcomp.vcxproj b/lzhamcomp/lzhamcomp.vcxproj +index 5fd6155..b45f3dc 100644 +--- a/lzhamcomp/lzhamcomp.vcxproj ++++ b/lzhamcomp/lzhamcomp.vcxproj +@@ -23,6 +23,9 @@ + lzhamcomp + Win32Proj + ++ ++ ++ + + + StaticLibrary +diff --git a/lzhamdecomp/lzhamdecomp.vcxproj b/lzhamdecomp/lzhamdecomp.vcxproj +index dbaf54c..5f78ca5 100644 +--- a/lzhamdecomp/lzhamdecomp.vcxproj ++++ b/lzhamdecomp/lzhamdecomp.vcxproj +@@ -23,6 +23,9 @@ + lzhamdecomp + Win32Proj + ++ ++ ++ + + + StaticLibrary +diff --git a/lzhamdll/lzham.vcxproj b/lzhamdll/lzham.vcxproj +index ec0a280..5536234 100644 +--- a/lzhamdll/lzham.vcxproj ++++ b/lzhamdll/lzham.vcxproj +@@ -24,6 +24,9 @@ + lzham + Win32Proj + ++ ++ ++ + + + DynamicLibrary +diff --git a/lzhamlib/lzhamlib.vcxproj b/lzhamlib/lzhamlib.vcxproj +index 954dd99..cdd2c26 100644 +--- a/lzhamlib/lzhamlib.vcxproj ++++ b/lzhamlib/lzhamlib.vcxproj +@@ -23,6 +23,9 @@ + lzhamlib + Win32Proj + ++ ++ ++ + + + StaticLibrary diff --git a/recipes/lzham/all/patches/use-lzham-types-cci.20220103.patch b/recipes/lzham/all/patches/use-lzham-types-cci.20220103.patch new file mode 100644 index 0000000000000..db6f4925fa490 --- /dev/null +++ b/recipes/lzham/all/patches/use-lzham-types-cci.20220103.patch @@ -0,0 +1,142 @@ +diff --git a/lzhamcomp/lzham_win32_threading.h b/lzhamcomp/lzham_win32_threading.h +index 0e1d16b..4aaff8c 100644 +--- a/lzhamcomp/lzham_win32_threading.h ++++ b/lzhamcomp/lzham_win32_threading.h +@@ -43,9 +43,9 @@ namespace lzham + } + } + +- bool wait(uint32 milliseconds = UINT32_MAX) ++ bool wait(uint32 milliseconds = LZHAM_UINT32_MAX) + { +- LZHAM_ASSUME(INFINITE == UINT32_MAX); ++ LZHAM_ASSUME(INFINITE == LZHAM_UINT32_MAX); + + DWORD result = WaitForSingleObject(m_handle, milliseconds); + +diff --git a/lzhamdecomp/lzham_huffman_codes.cpp b/lzhamdecomp/lzham_huffman_codes.cpp +index 11bdbd4..788414a 100644 +--- a/lzhamdecomp/lzham_huffman_codes.cpp ++++ b/lzhamdecomp/lzham_huffman_codes.cpp +@@ -224,7 +224,7 @@ namespace lzham + + sym_freq& sf = state.syms0[num_used_syms]; + sf.m_left = (uint16)i; +- sf.m_right = UINT16_MAX; ++ sf.m_right = LZHAM_UINT16_MAX; + sf.m_freq = freq; + num_used_syms++; + } +diff --git a/lzhamdecomp/lzham_prefix_coding.cpp b/lzhamdecomp/lzham_prefix_coding.cpp +index e9ada15..52377c9 100644 +--- a/lzhamdecomp/lzham_prefix_coding.cpp ++++ b/lzhamdecomp/lzham_prefix_coding.cpp +@@ -149,7 +149,7 @@ namespace lzham + { + uint c = pCodesizes[i]; + +- LZHAM_ASSERT(!c || (next_code[c] <= UINT16_MAX)); ++ LZHAM_ASSERT(!c || (next_code[c] <= LZHAM_UINT16_MAX)); + + pCodes[i] = static_cast(next_code[c]++); + +@@ -296,7 +296,7 @@ namespace lzham + + LZHAM_ASSERT(t < (1U << table_bits)); + +- LZHAM_ASSERT(pTables->m_lookup[t] == UINT32_MAX); ++ LZHAM_ASSERT(pTables->m_lookup[t] == LZHAM_UINT32_MAX); + + pTables->m_lookup[t] = sym_index | (codesize << 16U); + } +diff --git a/lzhamdecomp/lzham_symbol_codec.cpp b/lzhamdecomp/lzham_symbol_codec.cpp +index 5623584..b2ea7ee 100644 +--- a/lzhamdecomp/lzham_symbol_codec.cpp ++++ b/lzhamdecomp/lzham_symbol_codec.cpp +@@ -581,7 +581,7 @@ namespace lzham + freq++; + m_sym_freq[sym] = static_cast(freq); + +- LZHAM_ASSERT(freq <= UINT16_MAX); ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); + + if (--m_symbols_until_update == 0) + { +@@ -828,7 +828,7 @@ namespace lzham + freq++; + model.m_sym_freq[sym] = static_cast(freq); + +- LZHAM_ASSERT(freq <= UINT16_MAX); ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); + + if (--model.m_symbols_until_update == 0) + { +@@ -1265,8 +1265,8 @@ namespace lzham + { + uint32 t = pTables->m_lookup[m_bit_buf >> (cBitBufSize - pTables->m_table_bits)]; + +- LZHAM_ASSERT(t != UINT32_MAX); +- sym = t & UINT16_MAX; ++ LZHAM_ASSERT(t != LZHAM_UINT32_MAX); ++ sym = t & LZHAM_UINT16_MAX; + len = t >> 16; + + LZHAM_ASSERT(model.m_code_sizes[sym] == len); +@@ -1301,7 +1301,7 @@ namespace lzham + freq++; + model.m_sym_freq[sym] = static_cast(freq); + +- LZHAM_ASSERT(freq <= UINT16_MAX); ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); + + if (--model.m_symbols_until_update == 0) + { +diff --git a/lzhamdecomp/lzham_symbol_codec.h b/lzhamdecomp/lzham_symbol_codec.h +index 306d59b..b231530 100644 +--- a/lzhamdecomp/lzham_symbol_codec.h ++++ b/lzhamdecomp/lzham_symbol_codec.h +@@ -19,7 +19,7 @@ namespace lzham + typedef uint64 bit_cost_t; + const uint32 cBitCostScaleShift = 24; + const uint32 cBitCostScale = (1U << cBitCostScaleShift); +- const bit_cost_t cBitCostMax = UINT64_MAX; ++ const bit_cost_t cBitCostMax = LZHAM_UINT64_MAX; + + inline bit_cost_t convert_to_scaled_bitcost(uint bits) { LZHAM_ASSERT(bits <= 255); uint32 scaled_bits = bits << cBitCostScaleShift; return static_cast(scaled_bits); } + +@@ -444,7 +444,7 @@ namespace lzham + if (LZHAM_BUILTIN_EXPECT(k <= pTables->m_table_max_code, 1)) \ + { \ + uint32 t = pTables->m_lookup[bit_buf >> (symbol_codec::cBitBufSize - pTables->m_table_bits)]; \ +- result = t & UINT16_MAX; \ ++ result = t & LZHAM_UINT16_MAX; \ + len = t >> 16; \ + } \ + else \ +@@ -465,7 +465,7 @@ namespace lzham + uint freq = pModel->m_sym_freq[result]; \ + freq++; \ + pModel->m_sym_freq[result] = static_cast(freq); \ +- LZHAM_ASSERT(freq <= UINT16_MAX); \ ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); \ + if (LZHAM_BUILTIN_EXPECT(--pModel->m_symbols_until_update == 0, 0)) \ + { \ + pModel->update_tables(); \ +@@ -501,7 +501,7 @@ namespace lzham + if (LZHAM_BUILTIN_EXPECT(k <= pTables->m_table_max_code, 1)) \ + { \ + uint32 t = pTables->m_lookup[bit_buf >> (symbol_codec::cBitBufSize - pTables->m_table_bits)]; \ +- result = t & UINT16_MAX; \ ++ result = t & LZHAM_UINT16_MAX; \ + len = t >> 16; \ + } \ + else \ +@@ -522,7 +522,7 @@ namespace lzham + uint freq = pModel->m_sym_freq[result]; \ + freq++; \ + pModel->m_sym_freq[result] = static_cast(freq); \ +- LZHAM_ASSERT(freq <= UINT16_MAX); \ ++ LZHAM_ASSERT(freq <= LZHAM_UINT16_MAX); \ + if (LZHAM_BUILTIN_EXPECT(--pModel->m_symbols_until_update == 0, 0)) \ + { \ + pModel->update_tables(); \ diff --git a/recipes/lzham/all/test_package/CMakeLists.txt b/recipes/lzham/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c4780ae45756c --- /dev/null +++ b/recipes/lzham/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +find_package(lzham REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC lzham::lzham) diff --git a/recipes/lzham/all/test_package/conanfile.py b/recipes/lzham/all/test_package/conanfile.py new file mode 100644 index 0000000000000..eea09bfb32ab1 --- /dev/null +++ b/recipes/lzham/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +import os + +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/lzham/all/test_package/test_package.cpp b/recipes/lzham/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c588215577f5f --- /dev/null +++ b/recipes/lzham/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include +#include + +#include + +int main() { + unsigned char in[] = "Hello Conan Center!"; + unsigned char out[sizeof(in)]; + + lzham_z_stream stream; + std::memset(&stream, 0, sizeof(stream)); + stream.next_in = in; + stream.avail_in = sizeof(in); + stream.next_out = out; + stream.avail_out = sizeof(out); + if (lzham_z_deflateInit(&stream, LZHAM_Z_BEST_COMPRESSION) != LZHAM_Z_OK) + return EXIT_FAILURE; + + if (lzham_z_deflate(&stream, LZHAM_Z_FULL_FLUSH) != LZHAM_Z_OK) + return EXIT_FAILURE; + + return EXIT_SUCCESS; +} diff --git a/recipes/lzham/all/test_v1_package/CMakeLists.txt b/recipes/lzham/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..231cec51e4ab9 --- /dev/null +++ b/recipes/lzham/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(lzham REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PUBLIC lzham::lzham) diff --git a/recipes/lzham/all/test_v1_package/conanfile.py b/recipes/lzham/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0f735b51a2642 --- /dev/null +++ b/recipes/lzham/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/lzham/config.yml b/recipes/lzham/config.yml new file mode 100644 index 0000000000000..d334d7a80bf72 --- /dev/null +++ b/recipes/lzham/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20220103": + folder: all diff --git a/recipes/lzma_sdk/9.20/conanfile.py b/recipes/lzma_sdk/9.20/conanfile.py index 3d677c0f510f8..66f4dfa40693b 100644 --- a/recipes/lzma_sdk/9.20/conanfile.py +++ b/recipes/lzma_sdk/9.20/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment +from conan import ConanFile +from conan.tools.files import get, chdir, replace_in_file, rm +from conans import tools, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" """ This older lzma release is used to build 7zip (to extract its sources). @@ -41,9 +43,9 @@ def package_id(self): del self.info.settings.compiler def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder) - os.unlink(os.path.join(self._source_subfolder, "7zr.exe")) - os.unlink(os.path.join(self._source_subfolder, "lzma.exe")) + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder) + rm(self, "7zr.exe", self._source_subfolder) + rm(self, "lzma.exe", self._source_subfolder) @property def _msvc_build_dirs(self): @@ -66,8 +68,8 @@ def _msvc_cpu(self): def _autotools_build_dirs(self): es = ".exe" if self.settings.os == "Windows" else "" return ( - (os.path.join(self._source_subfolder, "C", "Util", "7z"), "7zDec{}".format(es)), - (os.path.join(self._source_subfolder, "CPP", "7zip", "Bundles", "LzmaCon"), "lzma{}".format(es)), + (os.path.join(self._source_subfolder, "C", "Util", "7z"), f"7zDec{es}"), + (os.path.join(self._source_subfolder, "CPP", "7zip", "Bundles", "LzmaCon"), f"lzma{es}"), ) def _build_msvc(self): @@ -75,13 +77,13 @@ def _build_msvc(self): with tools.vcvars(self): with tools.environment_append(VisualStudioBuildEnvironment(self).vars): with tools.chdir(make_dir): - self.run("nmake /f makefile NEW_COMPILER=1 CPU={}".format(self._msvc_cpu)) + self.run(f"nmake /f makefile NEW_COMPILER=1 CPU={self._msvc_cpu} NO_BUFFEROVERFLOWU=1") def _build_autotools(self): env_build = AutoToolsBuildEnvironment(self) with tools.environment_append(env_build.vars): for make_dir, _ in self._autotools_build_dirs: - with tools.chdir(make_dir): + with chdir(self, make_dir): args = [ "-f", "makefile.gcc", ] @@ -92,24 +94,24 @@ def _build_autotools(self): def _patch_sources(self): if self.settings.compiler == "Visual Studio": - tools.replace_in_file(os.path.join(self._source_subfolder, "CPP", "Build.mak"), + replace_in_file(self, os.path.join(self._source_subfolder, "CPP", "Build.mak"), "-MT\r", "-" + str(self.settings.compiler.runtime)) - tools.replace_in_file(os.path.join(self._source_subfolder, "CPP", "Build.mak"), + replace_in_file(self, os.path.join(self._source_subfolder, "CPP", "Build.mak"), "-MD\r", "-" + str(self.settings.compiler.runtime)) - tools.replace_in_file(os.path.join(self._source_subfolder, "CPP", "Build.mak"), + replace_in_file(self, os.path.join(self._source_subfolder, "CPP", "Build.mak"), " -WX ", " ") # Patches for other build systems - tools.replace_in_file(os.path.join(self._source_subfolder, "C", "Util", "7z", "makefile.gcc"), + replace_in_file(self, os.path.join(self._source_subfolder, "C", "Util", "7z", "makefile.gcc"), "CFLAGS = ", "CFLAGS = -fpermissive ") - tools.replace_in_file(os.path.join(self._source_subfolder, "C", "Util", "7z", "makefile.gcc"), + replace_in_file(self, os.path.join(self._source_subfolder, "C", "Util", "7z", "makefile.gcc"), ": 7zAlloc.c", ": ../../7zAlloc.c") - tools.replace_in_file(os.path.join(self._source_subfolder, "C", "Util", "Lzma", "makefile.gcc"), + replace_in_file(self, os.path.join(self._source_subfolder, "C", "Util", "Lzma", "makefile.gcc"), "CFLAGS = ", "CFLAGS = -fpermissive ") - tools.replace_in_file(os.path.join(self._source_subfolder, "CPP", "Common", "MyString.h"), + replace_in_file(self, os.path.join(self._source_subfolder, "CPP", "Common", "MyString.h"), "#ifdef _WIN32\r\n", "#ifdef _WIN32\r\n#ifndef UNDER_CE\r\n#include \r\n#endif\r\n") @@ -132,6 +134,7 @@ def package(self): def package_info(self): self.cpp_info.libdirs = [] + self.cpp_info.includedirs = [] bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.path.append(bin_path) diff --git a/recipes/lzo/all/conanfile.py b/recipes/lzo/all/conanfile.py index 1babfd0e8f2d7..d5a4ce4f0d916 100644 --- a/recipes/lzo/all/conanfile.py +++ b/recipes/lzo/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class LZOConan(ConanFile): @@ -14,6 +14,7 @@ class LZOConan(ConanFile): homepage = "http://www.oberhumer.com/opensource/lzo/" topics = ("lzo", "compression") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,22 +31,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/lzo/all/test_package/conanfile.py b/recipes/lzo/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/lzo/all/test_package/conanfile.py +++ b/recipes/lzo/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/lzo/all/test_v1_package/CMakeLists.txt b/recipes/lzo/all/test_v1_package/CMakeLists.txt index 4217d911bdc88..0d20897301b68 100644 --- a/recipes/lzo/all/test_v1_package/CMakeLists.txt +++ b/recipes/lzo/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(lzo REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE lzo::lzo) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/lzo/all/test_v1_package/conanfile.py b/recipes/lzo/all/test_v1_package/conanfile.py index ad9be58bc8e99..94c6eef557e71 100644 --- a/recipes/lzo/all/test_v1_package/conanfile.py +++ b/recipes/lzo/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/m4/all/conandata.yml b/recipes/m4/all/conandata.yml index add3c40a064ae..3b25f4d23294d 100644 --- a/recipes/m4/all/conandata.yml +++ b/recipes/m4/all/conandata.yml @@ -1,34 +1,27 @@ sources: "1.4.19": - url: "https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.gz" + url: + - "https://ftp.gnu.org/gnu/m4/m4-1.4.19.tar.gz" + - "https://ftpmirror.gnu.org/gnu/m4/m4-1.4.19.tar.gz" sha256: "3be4a26d825ffdfda52a56fc43246456989a3630093cced3fbddf4771ee58a70" "1.4.18": - url: "https://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz" + url: + - "https://ftp.gnu.org/gnu/m4/m4-1.4.18.tar.gz" + - "https://ftpmirror.gnu.org/gnu/m4/m4-1.4.18.tar.gz" sha256: "ab2633921a5cd38e48797bf5521ad259bdc4b979078034a3b790d7fec5493fab" patches: "1.4.19": - patch_file: "patches/1.4.19-0001-open-files-in-binary-mode.patch" - base_path: "source_subfolder" - patch_file: "patches/1.4.19-0002-ar-lib.patch" - base_path: "source_subfolder" - patch_file: "patches/1.4.19-0003-msvc-debug-assertion.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.4.19-0004-disable-hardening-in-source.patch" "1.4.18": - patch_file: "patches/1.4.18-0001-fflush-adjust-to-glibc-2.28-libio.h-removal.patch" - base_path: "source_subfolder" - patch_file: "patches/1.4.18-0002-fflush-be-more-paranoid-about-libio.h-change.patch" - base_path: "source_subfolder" - patch_file: "patches/1.4.18-0004-fix-checks.patch" - base_path: "source_subfolder" - patch_file: "patches/1.4.18-0005-vasnprintf-Fix-for-MSVC-14.patch" - base_path: "source_subfolder" - patch_file: "patches/1.4.18-0006-manywarnings-update-for-gcc-7.patch" - base_path: "source_subfolder" - patch_file: "patches/1.4.18-0007-vasnprintf-port-to-macos-10.13.patch" - base_path: "source_subfolder" - patch_file: "patches/1.4.18-0008-open-files-in-binary-mode.patch" - base_path: "source_subfolder" - patch_file: "patches/1.4.18-0009-disable-hardening-in-source.patch" - base_path: "source_subfolder" - patch_file: "patches/1.4.18-0010-c-stack-stop-using-SIGSTKSZ.patch" - base_path: "source_subfolder" diff --git a/recipes/m4/all/conanfile.py b/recipes/m4/all/conanfile.py index 65f289cb47abe..7ed736181065e 100644 --- a/recipes/m4/all/conanfile.py +++ b/recipes/m4/all/conanfile.py @@ -1,13 +1,19 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from contextlib import contextmanager -import functools +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os +import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.55.0" class M4Conan(ConanFile): name = "m4" + package_type = "application" description = "GNU M4 is an implementation of the traditional Unix macro processor" topics = ("macro", "preprocessor") homepage = "https://www.gnu.org/software/m4/" @@ -15,116 +21,105 @@ class M4Conan(ConanFile): license = "GPL-3.0-only" settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/*.patch", - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" or self.settings.compiler == "msvc" + def export_sources(self): + export_conandata_patches(self) - def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.settings.compiler + def build_requirements(self): + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_autotools(self): - conf_args = [] - autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") - build_canonical_name = None - host_canonical_name = None - if self._is_msvc: - # The somewhat older configure script of m4 does not understand the canonical names of Visual Studio - build_canonical_name = False - host_canonical_name = False - autotools.flags.append("-FS") + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + if is_msvc(self): + tc.extra_cflags.append("-FS") # Avoid a `Assertion Failed Dialog Box` during configure with build_type=Debug # Visual Studio does not support the %n format flag: # https://docs.microsoft.com/en-us/cpp/c-runtime-library/format-specification-syntax-printf-and-wprintf-functions # Because the %n format is inherently insecure, it is disabled by default. If %n is encountered in a format string, # the invalid parameter handler is invoked, as described in Parameter Validation. To enable %n support, see _set_printf_count_output. - conf_args.extend(["gl_cv_func_printf_directive_n=no", "gl_cv_func_snprintf_directive_n=no", "gl_cv_func_snprintf_directive_n=no"]) + tc.configure_args.extend([ + "gl_cv_func_printf_directive_n=no", + "gl_cv_func_snprintf_directive_n=no", + "gl_cv_func_snprintf_directive_n=no", + ]) if self.settings.build_type in ("Debug", "RelWithDebInfo"): - autotools.link_flags.append("-PDB") + tc.extra_ldflags.append("-PDB") elif self.settings.compiler == "clang": - if tools.Version(self.version) < "1.4.19": - autotools.flags.extend(["-rtlib=compiler-rt", "-Wno-unused-command-line-argument"]) - if self.settings.os == 'Windows': - conf_args.extend(["ac_cv_func__set_invalid_parameter_handler=yes"]) - - autotools.configure(args=conf_args, configure_dir=self._source_subfolder, build=build_canonical_name, host=host_canonical_name) - return autotools - - @contextmanager - def _build_context(self): - env = {"PATH": [os.path.abspath(self._source_subfolder)]} - if self._is_msvc: - with tools.vcvars(self.settings): - env.update({ - "AR": "{}/build-aux/ar-lib lib".format(tools.unix_path(self._source_subfolder)), - "CC": "cl -nologo", - "CXX": "cl -nologo", - "LD": "link", - "NM": "dumpbin -symbols", - "OBJDUMP": ":", - "RANLIB": ":", - "STRIP": ":", - }) - with tools.environment_append(env): - yield - else: - with tools.environment_append(env): - yield + if Version(self.version) < "1.4.19": + tc.extra_cflags.extend([ + "-rtlib=compiler-rt", + "-Wno-unused-command-line-argument", + ]) + if self.settings.os == "Windows": + tc.configure_args.append("ac_cv_func__set_invalid_parameter_handler=yes") + env = tc.environment() + # help2man trick + env.prepend_path("PATH", self.source_folder) + # handle msvc + if is_msvc(self): + ar_wrapper = unix_path(self, os.path.join(self.source_folder, "build-aux", "ar-lib")) + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + env.define("AR", f"{ar_wrapper} lib") + env.define("LD", "link") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + tc.generate(env) def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) + if shutil.which("help2man") == None: + # dummy file for configure + help2man = os.path.join(self.source_folder, "help2man") + save(self, help2man, "#!/usr/bin/env bash\n:") + if os.name == "posix": + os.chmod(help2man, os.stat(help2man).st_mode | 0o111) def build(self): - with tools.chdir(self._source_subfolder): - tools.save("help2man", '#!/usr/bin/env bash\n:') - if os.name == 'posix': - os.chmod("help2man", os.stat("help2man").st_mode | 0o111) self._patch_sources() - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() - if tools.get_env("CONAN_RUN_TESTS", False): - self.output.info("Running m4 checks...") - with tools.chdir("tests"): - autotools.make(target="check") + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - + # M4 environment variable is used by a lot of scripts as a way to override a hard-coded embedded m4 path bin_ext = ".exe" if self.settings.os == "Windows" else "" - m4_bin = os.path.join(self.package_folder, "bin", "m4{}".format(bin_ext)).replace("\\", "/") + m4_bin = os.path.join(self.package_folder, "bin", f"m4{bin_ext}").replace("\\", "/") + self.runenv_info.define_path("M4", m4_bin) + self.buildenv_info.define_path("M4", m4_bin) - # M4 environment variable is used by a lot of scripts as a way to override a hard-coded embedded m4 path - self.output.info("Setting M4 environment variable: {}".format(m4_bin)) + # TODO: to remove in conan v2 + bin_path = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH environment variable: {bin_path}") + self.env_info.PATH.append(bin_path) self.env_info.M4 = m4_bin diff --git a/recipes/m4/all/patches/1.4.19-0004-disable-hardening-in-source.patch b/recipes/m4/all/patches/1.4.19-0004-disable-hardening-in-source.patch new file mode 100644 index 0000000000000..9386ee55aedce --- /dev/null +++ b/recipes/m4/all/patches/1.4.19-0004-disable-hardening-in-source.patch @@ -0,0 +1,16 @@ +This requires linking to ssp on some systems, which might not always present. +If this is really desired: +* add `-lssp` to LDFLAGS, and +* add `-D_FORTIFY_SOURCE=2` to CPPFLAGS/CFLAGS + +--- a/lib/config.hin ++++ b/lib/config.hin +@@ -198,7 +198,7 @@ + /* Enable compile-time and run-time bounds-checking, and some warnings, + without upsetting newer glibc. */ + #if defined __OPTIMIZE__ && __OPTIMIZE__ +- # define _FORTIFY_SOURCE 2 ++ //# define _FORTIFY_SOURCE 2 + #endif + + diff --git a/recipes/m4/all/test_package/conanfile.py b/recipes/m4/all/test_package/conanfile.py index 5351f6a04f5ac..b665b86aad8f3 100644 --- a/recipes/m4/all/test_package/conanfile.py +++ b/recipes/m4/all/test_package/conanfile.py @@ -1,5 +1,5 @@ -from conans import ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.tools.files import save from io import StringIO import os import textwrap @@ -7,13 +7,18 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" @property def _m4_input_path(self): return os.path.join(self.build_folder, "input.m4") + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + def build(self): - tools.save(self._m4_input_path, textwrap.dedent("""\ + save(self, self._m4_input_path, textwrap.dedent("""\ m4_define(NAME1, `Harry, Jr.') m4_define(NAME2, `Sally') m4_define(MET, `$1 met $2') @@ -21,21 +26,11 @@ def build(self): """)) def test(self): - if hasattr(self, "settings_build"): - exe_suffix = ".exe" if self.settings.os == "Windows" else "" - m4_bin = os.path.join(self.deps_cpp_info["m4"].rootpath, "bin", "m4" + exe_suffix) - else: - m4_bin = tools.get_env("M4") - if m4_bin is None or not m4_bin.startswith(self.deps_cpp_info["m4"].rootpath): - raise ConanException("M4 environment variable not set") - - if not tools.cross_building(self, skip_x64_x86=True): - self.run("{} --version".format(m4_bin), run_environment=True) - self.run("{} -P {}".format(m4_bin, self._m4_input_path)) - - self.run("m4 -R {0}/frozen.m4f {0}/test.m4".format(self.source_folder), run_environment=True) + self.run("m4 --version") + self.run(f"m4 -P {self._m4_input_path}") - output = StringIO() - self.run("{} -P {}".format(m4_bin, self._m4_input_path), output=output) + self.run(f"m4 -R {self.source_folder}/frozen.m4f {self.source_folder}/test.m4") - assert "Harry, Jr. met Sally" in output.getvalue() + output = StringIO() + self.run(f"m4 -P {self._m4_input_path}", output) + assert "Harry, Jr. met Sally" in output.getvalue() diff --git a/recipes/m4/all/test_v1_package/conanfile.py b/recipes/m4/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..23409570c2d3d --- /dev/null +++ b/recipes/m4/all/test_v1_package/conanfile.py @@ -0,0 +1,41 @@ +from conans import ConanFile, tools +from conans.errors import ConanException +from io import StringIO +import os +import textwrap + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + @property + def _m4_input_path(self): + return os.path.join(self.build_folder, "input.m4") + + def build(self): + tools.save(self._m4_input_path, textwrap.dedent("""\ + m4_define(NAME1, `Harry, Jr.') + m4_define(NAME2, `Sally') + m4_define(MET, `$1 met $2') + MET(`NAME1', `NAME2') + """)) + + def test(self): + if hasattr(self, "settings_build"): + exe_suffix = ".exe" if self.settings.os == "Windows" else "" + m4_bin = os.path.join(self.deps_cpp_info["m4"].rootpath, "bin", "m4" + exe_suffix) + else: + m4_bin = tools.get_env("M4") + if m4_bin is None or not m4_bin.startswith(self.deps_cpp_info["m4"].rootpath): + raise ConanException("M4 environment variable not set") + + if not tools.cross_building(self, skip_x64_x86=True): + self.run("{} --version".format(m4_bin), run_environment=True) + self.run("{} -P {}".format(m4_bin, self._m4_input_path)) + + self.run("m4 -R {0}/frozen.m4f {0}/test.m4".format(os.path.join(self.source_folder, os.pardir, "test_package"), run_environment=True)) + + output = StringIO() + self.run("{} -P {}".format(m4_bin, self._m4_input_path), output=output) + + assert "Harry, Jr. met Sally" in output.getvalue() diff --git a/recipes/magic_enum/all/conandata.yml b/recipes/magic_enum/all/conandata.yml index e66d1d0b0f713..f1eb6c3e30073 100644 --- a/recipes/magic_enum/all/conandata.yml +++ b/recipes/magic_enum/all/conandata.yml @@ -20,3 +20,9 @@ sources: "0.8.0": url: "https://github.com/Neargye/magic_enum/archive/v0.8.0.tar.gz" sha256: "5e7680e877dd4cf68d9d0c0e3c2a683b432a9ba84fc1993c4da3de70db894c3c" + "0.8.1": + url: "https://github.com/Neargye/magic_enum/archive/v0.8.1.tar.gz" + sha256: "6b948d1680f02542d651fc82154a9e136b341ce55c5bf300736b157e23f9df11" + "0.8.2": + url: "https://github.com/Neargye/magic_enum/archive/v0.8.2.tar.gz" + sha256: "62bd7034bbbfc3d7806001767d5775ab42f3ff33bb38366e1ceb21102f0dff9a" diff --git a/recipes/magic_enum/all/conanfile.py b/recipes/magic_enum/all/conanfile.py index 4b7a9fa79b96f..ad2dd7598a2f6 100644 --- a/recipes/magic_enum/all/conanfile.py +++ b/recipes/magic_enum/all/conanfile.py @@ -1,29 +1,31 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os +required_conan_version = ">=1.50.0" + + class MagicEnumConan(ConanFile): name = "magic_enum" - description = "Header-only C++17 library provides static reflection for enums, work with any enum type without any macro or boilerplate code." - topics = ( - "conan", - "cplusplus", - "enum-to-string", - "string-to-enum" - "serialization", - "reflection", - "header-only", - "compile-time" + description = ( + "Header-only C++17 library provides static reflection for enums, work " + "with any enum type without any macro or boilerplate code." ) - url = "https://github.com/conan-io/conan-center-index " + topics = ("cplusplus", "enum-to-string", "string-to-enum", "serialization", + "reflection", "header-only", "compile-time") + url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/Neargye/magic_enum" license = "MIT" - settings = "compiler", "arch", "build_type", "os" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" @property def _compilers_minimum_version(self): @@ -34,25 +36,36 @@ def _compilers_minimum_version(self): "apple-clang": "10", } - def configure(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("magic_enum requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("magic_enum: Unsupported compiler: {}-{} " - "(https://github.com/Neargye/magic_enum#compiler-compatibility)." - .format(self.settings.compiler, self.settings.compiler.version)) + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy("LICENSE", dst="licenses" , src=self._source_subfolder) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "magic_enum") + self.cpp_info.set_property("cmake_target_name", "magic_enum::magic_enum") + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/magic_enum/all/test_package/CMakeLists.txt b/recipes/magic_enum/all/test_package/CMakeLists.txt index 60591d4de621c..c185d76435a4f 100644 --- a/recipes/magic_enum/all/test_package/CMakeLists.txt +++ b/recipes/magic_enum/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(magic_enum REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) -target_link_libraries(${PROJECT_NAME} magic_enum::magic_enum) +target_link_libraries(${PROJECT_NAME} PRIVATE magic_enum::magic_enum) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/magic_enum/all/test_package/conanfile.py b/recipes/magic_enum/all/test_package/conanfile.py index 7e2dfe859bb27..0a6bc68712d90 100644 --- a/recipes/magic_enum/all/test_package/conanfile.py +++ b/recipes/magic_enum/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/magic_enum/all/test_v1_package/CMakeLists.txt b/recipes/magic_enum/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de886ea1bc291 --- /dev/null +++ b/recipes/magic_enum/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(magic_enum REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE magic_enum::magic_enum) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/magic_enum/all/test_v1_package/conanfile.py b/recipes/magic_enum/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/magic_enum/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/magic_enum/config.yml b/recipes/magic_enum/config.yml index e39e41e8c8906..affbfa65ae445 100644 --- a/recipes/magic_enum/config.yml +++ b/recipes/magic_enum/config.yml @@ -13,3 +13,7 @@ versions: folder: all "0.8.0": folder: all + "0.8.1": + folder: all + "0.8.2": + folder: all diff --git a/recipes/mailio/all/CMakeLists.txt b/recipes/mailio/all/CMakeLists.txt deleted file mode 100644 index 8977c3f43d6f8..0000000000000 --- a/recipes/mailio/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/mailio/all/conandata.yml b/recipes/mailio/all/conandata.yml index a365e3a29f7a8..068f2f54981f1 100644 --- a/recipes/mailio/all/conandata.yml +++ b/recipes/mailio/all/conandata.yml @@ -8,7 +8,9 @@ sources: patches: "0.21.0": - patch_file: "patches/0.21.0-adapt-cmakelists.patch" - base_path: "source_subfolder" + patch_description: "fix install path" + patch_type: "conan" "0.20.0": - patch_file: "patches/0.20.0-adapt-cmakelists.patch" - base_path: "source_subfolder" + patch_description: "fix install path" + patch_type: "conan" diff --git a/recipes/mailio/all/conanfile.py b/recipes/mailio/all/conanfile.py index a0a2c6874d4a7..8024179a3697b 100644 --- a/recipes/mailio/all/conanfile.py +++ b/recipes/mailio/all/conanfile.py @@ -1,17 +1,23 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc_static_runtime, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class mailioConan(ConanFile): name = "mailio" + description = "mailio is a cross platform C++ library for MIME format and SMTP, POP3 and IMAP protocols." license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/karastojko/mailio" - description = "mailio is a cross platform C++ library for MIME format and SMTP, POP3 and IMAP protocols." topics = ("smtp", "imap", "email", "mail", "libraries", "cpp") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], "shared": [True, False] @@ -20,38 +26,24 @@ class mailioConan(ConanFile): "fPIC": True, "shared": False } - generators = "cmake", "cmake_find_package" short_paths = True - _cmake = None - - _compiler_required_cpp17 = { - "gcc": "8.3", - "clang": "6", - "Visual Studio": "15", - "apple-clang": "10", - } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 @property - def _build_subfolder(self): - return "build_subfolder" - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["MAILIO_BUILD_SHARED_LIBRARY"] = self.options.shared - self._cmake.definitions["MAILIO_BUILD_DOCUMENTATION"] = False - self._cmake.definitions["MAILIO_BUILD_EXAMPLES"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def _compiler_required_cpp(self): + return { + "gcc": "8.3", + "clang": "6", + "Visual Studio": "15", + "msvc": "191", + "apple-clang": "10", + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -59,42 +51,57 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.79.0") - self.requires("openssl/1.1.1q") + self.requires("boost/1.81.0") + self.requires("openssl/1.1.1s") def validate(self): if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, "17") + check_min_cppstd(self, self._min_cppstd) try: - minimum_required_compiler_version = self._compiler_required_cpp17[str(self.settings.compiler)] - if tools.Version(self.settings.compiler.version) < minimum_required_compiler_version: - raise ConanInvalidConfiguration("This package requires c++17 support. The current compiler does not support it.") + minimum_required_compiler_version = self._compiler_required_cpp[str(self.settings.compiler)] + if Version(self.settings.compiler.version) < minimum_required_compiler_version: + raise ConanInvalidConfiguration(f"{self.ref} requires c++{self._min_cppstd} support. The current compiler does not support it.") except KeyError: - self.output.warn("This recipe has no support for the current compiler. Please consider adding it.") + self.output.warn(f"{self.ref} has no support for the current compiler. Please consider adding it.") def build_requirements(self): # mailio requires cmake >= 3.16.3 - self.build_requires("cmake/3.23.2") + self.tool_requires("cmake/3.25.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MAILIO_BUILD_SHARED_LIBRARY"] = self.options.shared + tc.variables["MAILIO_BUILD_DOCUMENTATION"] = False + tc.variables["MAILIO_BUILD_EXAMPLES"] = False + tc.generate() + + dpes = CMakeDeps(self) + dpes.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.libs = ["mailio"] self.cpp_info.requires = ["boost::system", "boost::date_time", "boost::regex", "openssl::openssl"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/mailio/all/test_package/CMakeLists.txt b/recipes/mailio/all/test_package/CMakeLists.txt index 6a193e3e9907d..efd57b8a24474 100644 --- a/recipes/mailio/all/test_package/CMakeLists.txt +++ b/recipes/mailio/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(mailio REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} mailio::mailio) -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) +target_link_libraries(${PROJECT_NAME} PRIVATE mailio::mailio) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mailio/all/test_package/conanfile.py b/recipes/mailio/all/test_package/conanfile.py index 0d81e955db7e7..1111583fea732 100644 --- a/recipes/mailio/all/test_package/conanfile.py +++ b/recipes/mailio/all/test_package/conanfile.py @@ -1,28 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class mailioTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) cmake.configure() cmake.build() - def build_requirements(self): - if hasattr(self, "settings_build") and tools.cross_building(self) and \ - self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") - def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mailio/all/test_v1_package/CMakeLists.txt b/recipes/mailio/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/mailio/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mailio/all/test_v1_package/conanfile.py b/recipes/mailio/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/mailio/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/make/all/conandata.yml b/recipes/make/all/conandata.yml index 4b0c97e2f2b60..fb6e6264363e7 100644 --- a/recipes/make/all/conandata.yml +++ b/recipes/make/all/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "4.3": - patch_file: "patches/4.3-0001-clang.patch" - base_path: "source_subfolder" "4.2.1": - patch_file: "patches/4.2.1-0001-clang.patch" - base_path: "source_subfolder" diff --git a/recipes/make/all/conanfile.py b/recipes/make/all/conanfile.py index 6978b6c4ef5f4..ca2bde5638e0a 100644 --- a/recipes/make/all/conanfile.py +++ b/recipes/make/all/conanfile.py @@ -1,64 +1,82 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, VCVars import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class MakeConan(ConanFile): name = "make" - description = "GNU Make is a tool which controls the generation of executables and other non-source files of a program from the program's source files" - topics = ("conan", "make", "build", "makefile") + description = ( + "GNU Make is a tool which controls the generation of executables and " + "other non-source files of a program from the program's source files" + ) + topics = ("make", "build", "makefile") homepage = "https://www.gnu.org/software/make/" url = "https://github.com/conan-io/conan-center-index" license = "GPL-3.0-or-later" settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/*" - @property - def _source_subfolder(self): - return "source_subfolder" + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def export_sources(self): + export_conandata_patches(self) def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.settings.compiler - def build(self): - for patch in self.conan_data.get("patches").get(self.version, []): - tools.patch(**patch) + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + if is_msvc(self): + vcvars = VCVars(self) + vcvars.generate() + if self._settings_build.os != "Windows": + tc = AutotoolsToolchain(self) + tc.generate() - with tools.chdir(self._source_subfolder): + def build(self): + apply_conandata_patches(self) + with chdir(self, self.source_folder): # README.W32 - if tools.os_info.is_windows: - if self.settings.compiler == "Visual Studio": + if self._settings_build.os == "Windows": + if is_msvc(self): command = "build_w32.bat --without-guile" else: command = "build_w32.bat --without-guile gcc" else: - env_build = AutoToolsBuildEnvironment(self) - env_build.configure() + autotools = Autotools(self) + autotools.configure() command = "./build.sh" - with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): - self.run(command) + self.run(command) def package(self): - self.copy(pattern="COPYING", src=self._source_subfolder, dst="licenses") - self.copy(pattern="make", src=self._source_subfolder, dst="bin", keep_path=False) - self.copy(pattern="*gnumake.exe", src=self._source_subfolder, dst="bin", keep_path=False) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + for make_exe in ("make", "*gnumake.exe"): + copy(self, make_exe, src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) def package_info(self): + self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] make = os.path.join(self.package_folder, "bin", "gnumake.exe" if self.settings.os == "Windows" else "make") + self.conf_info.define("tools.gnu:make_program", make) + # TODO: to remove in conan v2 self.user_info.make = make - - self.output.info('Creating CONAN_MAKE_PROGRAM environment variable: %s' % make) self.env_info.CONAN_MAKE_PROGRAM = make + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/make/all/test_package/.gitattributes b/recipes/make/all/test_package/.gitattributes deleted file mode 100644 index 9c5165597b05b..0000000000000 --- a/recipes/make/all/test_package/.gitattributes +++ /dev/null @@ -1,2 +0,0 @@ -* text=auto -Makefile* text eol=lf diff --git a/recipes/make/all/test_package/conanfile.py b/recipes/make/all/test_package/conanfile.py index 40a73e6a128e7..7533b4eedc4fc 100644 --- a/recipes/make/all/test_package/conanfile.py +++ b/recipes/make/all/test_package/conanfile.py @@ -1,22 +1,14 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -import contextlib +from conan import ConanFile class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" - @contextlib.contextmanager - def _build_context(self): - if hasattr(self, "settings_build"): - # Environments are not inherited when cross building, so manually set the `CONANMAKE_PROGRAM' environment variable - with tools.environment_append({"CONAN_MAKE_PROGRAM": self.deps_user_info["make"].make}): - yield - else: - yield + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - with tools.chdir(self.source_folder): - with self._build_context(): - env_build = AutoToolsBuildEnvironment(self) - env_build.make(args=["love"]) + make = self.conf.get("tools.gnu:make_program", check_type=str) + self.run(f"{make} -C {self.source_folder} love") diff --git a/recipes/make/all/test_v1_package/conanfile.py b/recipes/make/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2348d97eef993 --- /dev/null +++ b/recipes/make/all/test_v1_package/conanfile.py @@ -0,0 +1,13 @@ +from conans import ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not tools.cross_building(self): + with tools.run_environment(self): + make = self.deps_user_info["make"].make + makefile_dir = os.path.join(self.source_folder, os.pardir, "test_package") + self.run(f"{make} -C {makefile_dir} love") diff --git a/recipes/mapbox-geometry/all/conanfile.py b/recipes/mapbox-geometry/all/conanfile.py index 670f3a943e8f7..9edf42d2b8db1 100644 --- a/recipes/mapbox-geometry/all/conanfile.py +++ b/recipes/mapbox-geometry/all/conanfile.py @@ -1,6 +1,11 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.52.0" + class MapboxGeometryConan(ConanFile): name = "mapbox-geometry" @@ -15,24 +20,30 @@ class MapboxGeometryConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("mapbox-variant/1.2.0") + self.requires("mapbox-variant/1.2.0", transitive_headers=True) def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/mapbox-geometry/all/test_package/CMakeLists.txt b/recipes/mapbox-geometry/all/test_package/CMakeLists.txt index 227f67e30f443..9bad4b5d60471 100644 --- a/recipes/mapbox-geometry/all/test_package/CMakeLists.txt +++ b/recipes/mapbox-geometry/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(mapbox-geometry REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} mapbox-geometry::mapbox-geometry) +target_link_libraries(${PROJECT_NAME} PRIVATE mapbox-geometry::mapbox-geometry) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/mapbox-geometry/all/test_package/conanfile.py b/recipes/mapbox-geometry/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/mapbox-geometry/all/test_package/conanfile.py +++ b/recipes/mapbox-geometry/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mapbox-geometry/all/test_v1_package/CMakeLists.txt b/recipes/mapbox-geometry/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..e4046b86f9232 --- /dev/null +++ b/recipes/mapbox-geometry/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(mapbox-geometry REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mapbox-geometry::mapbox-geometry) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/mapbox-geometry/all/test_v1_package/conanfile.py b/recipes/mapbox-geometry/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/mapbox-geometry/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mariadb-connector-c/all/conandata.yml b/recipes/mariadb-connector-c/all/conandata.yml index a74dc266f2982..74a7f76fab54c 100644 --- a/recipes/mariadb-connector-c/all/conandata.yml +++ b/recipes/mariadb-connector-c/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.3.3": + url: "https://downloads.mariadb.com/Connectors/c/connector-c-3.3.3/mariadb-connector-c-3.3.3-src.tar.gz" + sha256: "d77630e2376fe08185b5354621c877b0a203a6b186a0694574d37b764aeb2874" + "3.1.19": + url: "https://downloads.mariadb.com/Connectors/c/connector-c-3.1.19/mariadb-connector-c-3.1.19-src.tar.gz" + sha256: "3cafe6e197a0610e9a77aea4f0733a52e0697e8557998de4c4156c242e1ff405" "3.1.12": url: "https://downloads.mariadb.com/Connectors/c/connector-c-3.1.12/mariadb-connector-c-3.1.12-src.tar.gz" sha256: "2f5ae14708b4813e4ff6857d152c22e6fc0e551c9fa743c1ef81a68e3254fe63" @@ -6,15 +12,63 @@ sources: url: "https://downloads.mariadb.com/Connectors/c/connector-c-3.1.11/mariadb-connector-c-3.1.11-src.tar.gz" sha256: "3e6f6c399493fe90efdc21a3fe70c30434b7480e8195642a959f1dd7a0fa5b0f" patches: + "3.3.3": + - patch_file: "patches/3.3.3-0001-fix-install-and-static-or-shared.patch" + patch_description: "fix install path, separate static/shared build" + patch_type: "conan" + - patch_file: "patches/3.1.19-0002-remove-wx-flag.patch" + patch_description: "remove WX flags in MSVC" + patch_type: "conan" + - patch_file: "patches/3.1.11-0003-include-order-windows-winsock2.patch" + patch_description: "fix include order for windows winsock2" + patch_type: "portability" + - patch_file: "patches/3.1.11-0004-include-mysqld_error-header.patch" + patch_description: "always include mysqld_error.h" + patch_type: "portability" + "3.1.19": + - patch_file: "patches/3.1.19-0001-fix-install-and-static-or-shared.patch" + patch_description: "fix install path, separate static/shared build" + patch_type: "conan" + - patch_file: "patches/3.1.19-0002-remove-wx-flag.patch" + patch_description: "remove WX flags in MSVC" + patch_type: "conan" + - patch_file: "patches/3.1.11-0003-include-order-windows-winsock2.patch" + patch_description: "fix include order for windows winsock2" + patch_type: "portability" + - patch_file: "patches/3.1.11-0004-include-mysqld_error-header.patch" + patch_description: "always include mysqld_error.h" + patch_type: "portability" "3.1.12": - - patch_file: "patches/0001-fix-install-and-static-or-shared.patch" - - patch_file: "patches/0002-msvc-no-override-md-zi.patch" - - patch_file: "patches/0003-include-order-windows-winsock2.patch" - - patch_file: "patches/0004-include-mysqld_error-header.patch" - - patch_file: "patches/0005-fix-cmake-connectorname.patch" + - patch_file: "patches/3.1.11-0001-fix-install-and-static-or-shared.patch" + patch_description: "fix install path, separate static/shared build" + patch_type: "conan" + - patch_file: "patches/3.1.11-0002-msvc-no-override-md-zi.patch" + patch_description: "honor conan's build type" + patch_type: "conan" + - patch_file: "patches/3.1.11-0003-include-order-windows-winsock2.patch" + patch_description: "fix include order for windows winsock2" + patch_type: "portability" + - patch_file: "patches/3.1.11-0004-include-mysqld_error-header.patch" + patch_description: "always include mysqld_error.h" + patch_type: "portability" + - patch_file: "patches/3.1.11-0005-fix-cmake-connectorname.patch" + patch_description: "fix wrong function name END()" + patch_type: "bugfix" + patch_source: "https://github.com/mariadb-corporation/mariadb-connector-c/commit/242cab8cbcd91af882233730a83627d3b12ced83" "3.1.11": - - patch_file: "patches/0001-fix-install-and-static-or-shared.patch" - - patch_file: "patches/0002-msvc-no-override-md-zi.patch" - - patch_file: "patches/0003-include-order-windows-winsock2.patch" - - patch_file: "patches/0004-include-mysqld_error-header.patch" - - patch_file: "patches/0005-fix-cmake-connectorname.patch" + - patch_file: "patches/3.1.11-0001-fix-install-and-static-or-shared.patch" + patch_description: "fix install path, separate static/shared build" + patch_type: "conan" + - patch_file: "patches/3.1.11-0002-msvc-no-override-md-zi.patch" + patch_description: "honor conan's build type" + patch_type: "conan" + - patch_file: "patches/3.1.11-0003-include-order-windows-winsock2.patch" + patch_description: "fix include order for windows winsock2" + patch_type: "portability" + - patch_file: "patches/3.1.11-0004-include-mysqld_error-header.patch" + patch_description: "always include mysqld_error.h" + patch_type: "portability" + - patch_file: "patches/3.1.11-0005-fix-cmake-connectorname.patch" + patch_description: "fix wrong function name END()" + patch_type: "bugfix" + patch_source: "https://github.com/mariadb-corporation/mariadb-connector-c/commit/242cab8cbcd91af882233730a83627d3b12ced83" diff --git a/recipes/mariadb-connector-c/all/conanfile.py b/recipes/mariadb-connector-c/all/conanfile.py index 2f72898f8206d..506ffe3e1ec2f 100644 --- a/recipes/mariadb-connector-c/all/conanfile.py +++ b/recipes/mariadb-connector-c/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, replace_in_file, rm, rmdir +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rm, rmdir import os -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.53.0" class MariadbConnectorcConan(ConanFile): @@ -35,8 +35,7 @@ class MariadbConnectorcConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -46,24 +45,21 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.get_safe("with_iconv"): self.requires("libiconv/1.17") if self.options.with_curl: - self.requires("libcurl/7.84.0") + self.requires("libcurl/7.85.0") if self.options.with_ssl == "openssl": - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") def validate(self): if self.info.settings.os != "Windows" and self.info.options.with_ssl == "schannel": @@ -71,9 +67,6 @@ def validate(self): if self.info.options.with_ssl == "gnutls": raise ConanInvalidConfiguration("gnutls not yet available in CCI") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -127,6 +120,7 @@ def package(self): cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "symbols")) + rmdir(self, os.path.join(self.package_folder, "man")) rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) def package_info(self): @@ -141,7 +135,7 @@ def package_info(self): self.cpp_info.system_libs.append("secur32") plugin_dir = os.path.join(self.package_folder, "lib", "plugin").replace("\\", "/") - self.output.info("Prepending to MARIADB_PLUGIN_DIR runtime environment variable: {}".format(plugin_dir)) + self.output.info(f"Prepending to MARIADB_PLUGIN_DIR runtime environment variable: {plugin_dir}") self.runenv_info.prepend_path("MARIADB_PLUGIN_DIR", plugin_dir) # TODO: to remove in conan v2? diff --git a/recipes/mariadb-connector-c/all/patches/0001-fix-install-and-static-or-shared.patch b/recipes/mariadb-connector-c/all/patches/3.1.11-0001-fix-install-and-static-or-shared.patch similarity index 100% rename from recipes/mariadb-connector-c/all/patches/0001-fix-install-and-static-or-shared.patch rename to recipes/mariadb-connector-c/all/patches/3.1.11-0001-fix-install-and-static-or-shared.patch diff --git a/recipes/mariadb-connector-c/all/patches/0002-msvc-no-override-md-zi.patch b/recipes/mariadb-connector-c/all/patches/3.1.11-0002-msvc-no-override-md-zi.patch similarity index 100% rename from recipes/mariadb-connector-c/all/patches/0002-msvc-no-override-md-zi.patch rename to recipes/mariadb-connector-c/all/patches/3.1.11-0002-msvc-no-override-md-zi.patch diff --git a/recipes/mariadb-connector-c/all/patches/0003-include-order-windows-winsock2.patch b/recipes/mariadb-connector-c/all/patches/3.1.11-0003-include-order-windows-winsock2.patch similarity index 100% rename from recipes/mariadb-connector-c/all/patches/0003-include-order-windows-winsock2.patch rename to recipes/mariadb-connector-c/all/patches/3.1.11-0003-include-order-windows-winsock2.patch diff --git a/recipes/mariadb-connector-c/all/patches/0004-include-mysqld_error-header.patch b/recipes/mariadb-connector-c/all/patches/3.1.11-0004-include-mysqld_error-header.patch similarity index 100% rename from recipes/mariadb-connector-c/all/patches/0004-include-mysqld_error-header.patch rename to recipes/mariadb-connector-c/all/patches/3.1.11-0004-include-mysqld_error-header.patch diff --git a/recipes/mariadb-connector-c/all/patches/0005-fix-cmake-connectorname.patch b/recipes/mariadb-connector-c/all/patches/3.1.11-0005-fix-cmake-connectorname.patch similarity index 100% rename from recipes/mariadb-connector-c/all/patches/0005-fix-cmake-connectorname.patch rename to recipes/mariadb-connector-c/all/patches/3.1.11-0005-fix-cmake-connectorname.patch diff --git a/recipes/mariadb-connector-c/all/patches/3.1.19-0001-fix-install-and-static-or-shared.patch b/recipes/mariadb-connector-c/all/patches/3.1.19-0001-fix-install-and-static-or-shared.patch new file mode 100644 index 0000000000000..64399d7ee68cb --- /dev/null +++ b/recipes/mariadb-connector-c/all/patches/3.1.19-0001-fix-install-and-static-or-shared.patch @@ -0,0 +1,122 @@ +diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt +index f257926..a78329e 100644 +--- a/libmariadb/CMakeLists.txt ++++ b/libmariadb/CMakeLists.txt +@@ -379,7 +379,7 @@ ELSE() + ENDIF() + + +-IF(CMAKE_VERSION VERSION_GREATER 2.8.7) ++IF(FALSE) + # CREATE OBJECT LIBRARY + ADD_LIBRARY(mariadb_obj OBJECT ${LIBMARIADB_SOURCES}) + IF(UNIX) +@@ -405,26 +405,28 @@ IF(WIN32) + "FILE_DESCRIPTION:Dynamic lib for client/server communication") + ENDIF() + +- ++IF(NOT BUILD_SHARED_LIBS) + ADD_LIBRARY(mariadbclient STATIC ${MARIADB_OBJECTS} ${EMPTY_FILE}) + TARGET_LINK_LIBRARIES(mariadbclient ${SYSTEM_LIBS}) +- ++ELSE() + IF(UNIX) + ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} ${MARIADB_OBJECTS} ${EMPTY_FILE}) + SET_TARGET_PROPERTIES(libmariadb PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}") + ELSE() +- ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} ${MARIADB_OBJECTS} mariadbclient.def) ++ ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} ${MARIADB_OBJECTS} ${EMPTY_FILE} mariadbclient.def) + SET_TARGET_PROPERTIES(libmariadb PROPERTIES LINKER_LANGUAGE C) + ENDIF() + + TARGET_LINK_LIBRARIES(libmariadb LINK_PRIVATE ${SYSTEM_LIBS}) + + SIGN_TARGET(libmariadb) ++ENDIF() + +-IF(CMAKE_SIZEOF_VOID_P EQUAL 8 AND MSVC) ++IF(CMAKE_SIZEOF_VOID_P EQUAL 8 AND MSVC AND NOT BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(mariadbclient PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64") + ENDIF() + ++IF(BUILD_SHARED_LIBS) + IF(CMAKE_SYSTEM_NAME MATCHES "Linux" OR + CMAKE_SYSTEM_NAME MATCHES "kFreeBSD" OR + CMAKE_SYSTEM_NAME MATCHES "GNU") +@@ -434,10 +436,14 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux" OR + SET_TARGET_PROPERTIES(libmariadb PROPERTIES LINK_FLAGS "${CC_BINARY_DIR}/libmariadb/mariadbclient.def") + ENDIF() + ++ELSE() + SET_TARGET_PROPERTIES(mariadbclient PROPERTIES IMPORTED_INTERFACE_LINK_LIBRARIES "${SYSTEM_LIBS}") ++ENDIF() ++IF(BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(libmariadb PROPERTIES IMPORTED_INTERFACE_LINK_LIBRARIES "${SYSTEM_LIBS}") + + SET_TARGET_PROPERTIES(libmariadb PROPERTIES PREFIX "") ++ENDIF() + + # + # Installation +@@ -457,11 +463,15 @@ IF(WITH_MYSQLCOMPAT) + ENDIF() + ENDIF() + ++IF(NOT BUILD_SHARED_LIBS) + create_symlink(libmariadb${CMAKE_STATIC_LIBRARY_SUFFIX} mariadbclient ${INSTALL_LIBDIR}) ++ENDIF() + ++IF(BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION + ${CPACK_PACKAGE_VERSION_MAJOR} + SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}) ++ELSE() + + IF(NOT WIN32) + SET_TARGET_PROPERTIES(mariadbclient PROPERTIES OUTPUT_NAME "${LIBMARIADB_STATIC_NAME}") +@@ -469,20 +479,33 @@ ENDIF() + + INSTALL(TARGETS mariadbclient + COMPONENT Development +- DESTINATION ${INSTALL_LIBDIR}) ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ENDIF() ++ ++IF(BUILD_SHARED_LIBS) + IF(WIN32) + INSTALL(TARGETS libmariadb + COMPONENT SharedLibraries +- DESTINATION ${INSTALL_LIBDIR}) ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + ELSE() + # in cmake 3.12+ we can use + #INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR} + # COMPONENT SharedLibraries NAMELINK_COMPONENT Development) + # but as long as we build on CentOS 7 with its cmake 2.8.12.2 we have to use +-INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR} +- COMPONENT SharedLibraries NAMELINK_SKIP) +-INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR} +- COMPONENT Development NAMELINK_ONLY) ++INSTALL(TARGETS libmariadb LIBRARY ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ COMPONENT SharedLibraries) ++INSTALL(TARGETS libmariadb LIBRARY ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ COMPONENT Development) + ENDIF() + + IF(MSVC) +@@ -491,3 +514,4 @@ IF(MSVC) + CONFIGURATIONS Debug RelWithDebInfo + COMPONENT Development) + ENDIF() ++ENDIF() diff --git a/recipes/mariadb-connector-c/all/patches/3.1.19-0002-remove-wx-flag.patch b/recipes/mariadb-connector-c/all/patches/3.1.19-0002-remove-wx-flag.patch new file mode 100644 index 0000000000000..4dde44415f18b --- /dev/null +++ b/recipes/mariadb-connector-c/all/patches/3.1.19-0002-remove-wx-flag.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f3b6cbd..f3e8993 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -100,7 +100,7 @@ IF(MSVC) + ADD_DEFINITIONS(-DWIN32_LEAN_AND_MEAN) + IF (MSVC) + # Treat warnings as errors +- SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -WX") ++ # SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -WX") + SET(CONFIG_TYPES "DEBUG" "RELEASE" "RELWITHDEBINFO") + FOREACH(BUILD_TYPE ${CONFIG_TYPES}) + FOREACH(COMPILER CXX C) diff --git a/recipes/mariadb-connector-c/all/patches/3.3.3-0001-fix-install-and-static-or-shared.patch b/recipes/mariadb-connector-c/all/patches/3.3.3-0001-fix-install-and-static-or-shared.patch new file mode 100644 index 0000000000000..8a6f9ad7f1f55 --- /dev/null +++ b/recipes/mariadb-connector-c/all/patches/3.3.3-0001-fix-install-and-static-or-shared.patch @@ -0,0 +1,127 @@ +diff --git a/libmariadb/CMakeLists.txt b/libmariadb/CMakeLists.txt +index 070fdc9..77584e6 100644 +--- a/libmariadb/CMakeLists.txt ++++ b/libmariadb/CMakeLists.txt +@@ -288,7 +288,7 @@ SET(MARIADB_NONBLOCK_SYMBOLS + + # handle static plugins + SET(LIBMARIADB_SOURCES ${LIBMARIADB_SOURCES} ${LIBMARIADB_PLUGIN_SOURCES}) +-SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBMARIADB_PLUGIN_LIBS} ${ZSTD_LIBRARY} ${ZLIB_LIBRARY}) ++SET(SYSTEM_LIBS ${SYSTEM_LIBS} ${LIBMARIADB_PLUGIN_LIBS} ${ZSTD_LIBRARY} ZLIB::ZLIB) + MESSAGE(STATUS "SYSTEM_LIBS: ${SYSTEM_LIBS}") + INCLUDE_DIRECTORIES(${LIBMARIADB_PLUGIN_INCLUDES}) + ADD_DEFINITIONS(${LIBMARIADB_PLUGIN_DEFS}) +@@ -404,7 +404,7 @@ ELSE() + ENDIF() + + +-IF(CMAKE_VERSION VERSION_GREATER 2.8.7) ++IF(FALSE) + # CREATE OBJECT LIBRARY + ADD_LIBRARY(mariadb_obj OBJECT ${LIBMARIADB_SOURCES}) + IF(UNIX) +@@ -433,22 +433,24 @@ IF(WIN32) + "FILE_DESCRIPTION:Dynamic lib for client/server communication") + ENDIF() + +- ++IF(NOT BUILD_SHARED_LIBS) + ADD_LIBRARY(mariadbclient STATIC ${MARIADB_OBJECTS} ${EMPTY_FILE}) + TARGET_LINK_LIBRARIES(mariadbclient ${SYSTEM_LIBS}) +- ++ELSE() + IF(UNIX) + ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} ${MARIADB_OBJECTS} ${EMPTY_FILE}) + SET_TARGET_PROPERTIES(libmariadb PROPERTIES COMPILE_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}") + ELSE() +- ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} ${MARIADB_OBJECTS} mariadbclient.def) ++ ADD_LIBRARY(libmariadb SHARED ${libmariadb_RC} ${MARIADB_OBJECTS} ${EMPTY_FILE} mariadbclient.def) + SET_TARGET_PROPERTIES(libmariadb PROPERTIES LINKER_LANGUAGE C) + ENDIF() + + TARGET_LINK_LIBRARIES(libmariadb LINK_PRIVATE ${SYSTEM_LIBS}) + + SIGN_TARGET(libmariadb) ++ENDIF() + ++IF(BUILD_SHARED_LIBS) + IF(CMAKE_SYSTEM_NAME MATCHES "Linux" OR + CMAKE_SYSTEM_NAME MATCHES "kFreeBSD" OR + CMAKE_SYSTEM_NAME MATCHES "GNU") +@@ -457,11 +459,14 @@ IF(CMAKE_SYSTEM_NAME MATCHES "Linux" OR + ENDIF() + SET_TARGET_PROPERTIES(libmariadb PROPERTIES LINK_FLAGS "${CC_BINARY_DIR}/libmariadb/mariadbclient.def") + ENDIF() +- ++ELSE() + SET_TARGET_PROPERTIES(mariadbclient PROPERTIES IMPORTED_INTERFACE_LINK_LIBRARIES "${SYSTEM_LIBS}") ++ENDIF() ++IF(BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(libmariadb PROPERTIES IMPORTED_INTERFACE_LINK_LIBRARIES "${SYSTEM_LIBS}") + + SET_TARGET_PROPERTIES(libmariadb PROPERTIES PREFIX "") ++ENDIF() + + # + # Installation +@@ -481,11 +486,15 @@ IF(WITH_MYSQLCOMPAT) + ENDIF() + ENDIF() + ++IF(NOT BUILD_SHARED_LIBS) + create_symlink(libmariadb${CMAKE_STATIC_LIBRARY_SUFFIX} mariadbclient ${INSTALL_LIBDIR}) ++ENDIF() + ++IF(BUILD_SHARED_LIBS) + SET_TARGET_PROPERTIES(libmariadb PROPERTIES VERSION + ${CPACK_PACKAGE_VERSION_MAJOR} + SOVERSION ${CPACK_PACKAGE_VERSION_MAJOR}) ++ELSE() + + IF(NOT WIN32) + SET_TARGET_PROPERTIES(mariadbclient PROPERTIES OUTPUT_NAME "${LIBMARIADB_STATIC_NAME}") +@@ -493,20 +502,33 @@ ENDIF() + + INSTALL(TARGETS mariadbclient + COMPONENT Development +- DESTINATION ${INSTALL_LIBDIR}) ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ENDIF() ++ ++IF(BUILD_SHARED_LIBS) + IF(WIN32) + INSTALL(TARGETS libmariadb + COMPONENT SharedLibraries +- DESTINATION ${INSTALL_LIBDIR}) ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + ELSE() + # in cmake 3.12+ we can use + #INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR} + # COMPONENT SharedLibraries NAMELINK_COMPONENT Development) + # but as long as we build on CentOS 7 with its cmake 2.8.12.2 we have to use +-INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR} +- COMPONENT SharedLibraries NAMELINK_SKIP) +-INSTALL(TARGETS libmariadb LIBRARY DESTINATION ${INSTALL_LIBDIR} +- COMPONENT Development NAMELINK_ONLY) ++INSTALL(TARGETS libmariadb LIBRARY ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ COMPONENT SharedLibraries) ++INSTALL(TARGETS libmariadb LIBRARY ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ COMPONENT Development) + ENDIF() + + IF(MSVC) +@@ -515,3 +537,4 @@ IF(MSVC) + CONFIGURATIONS Debug RelWithDebInfo + COMPONENT Development) + ENDIF() ++ENDIF() diff --git a/recipes/mariadb-connector-c/all/test_package/conanfile.py b/recipes/mariadb-connector-c/all/test_package/conanfile.py index 8a5bb47f50c4c..0a6bc68712d90 100644 --- a/recipes/mariadb-connector-c/all/test_package/conanfile.py +++ b/recipes/mariadb-connector-c/all/test_package/conanfile.py @@ -9,12 +9,12 @@ class TestPackageConan(ConanFile): generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" test_type = "explicit" - def requirements(self): - self.requires(self.tested_reference_str) - def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/mariadb-connector-c/all/test_v1_package/CMakeLists.txt b/recipes/mariadb-connector-c/all/test_v1_package/CMakeLists.txt index 2ff7650134f6d..0d20897301b68 100644 --- a/recipes/mariadb-connector-c/all/test_v1_package/CMakeLists.txt +++ b/recipes/mariadb-connector-c/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(mariadb-connector-c REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE mariadb-connector-c::mariadb-connector-c) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/mariadb-connector-c/config.yml b/recipes/mariadb-connector-c/config.yml index 74d65343f6ebd..c4757604b999d 100644 --- a/recipes/mariadb-connector-c/config.yml +++ b/recipes/mariadb-connector-c/config.yml @@ -1,4 +1,8 @@ versions: + "3.3.3": + folder: all + "3.1.19": + folder: all "3.1.12": folder: all "3.1.11": diff --git a/recipes/marisa/all/CMakeLists.txt b/recipes/marisa/all/CMakeLists.txt new file mode 100644 index 0000000000000..84887fbda2ddf --- /dev/null +++ b/recipes/marisa/all/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(cmake_wrapper) + +include(conanbuildinfo.cmake) +conan_basic_setup(KEEP_RPATHS) + +add_subdirectory(source_subfolder) diff --git a/recipes/marisa/all/conandata.yml b/recipes/marisa/all/conandata.yml new file mode 100644 index 0000000000000..087e45138b499 --- /dev/null +++ b/recipes/marisa/all/conandata.yml @@ -0,0 +1,8 @@ +sources: + "0.2.6": + url: "https://github.com/s-yata/marisa-trie/archive/refs/tags/v0.2.6.tar.gz" + sha256: "1063a27c789e75afa2ee6f1716cc6a5486631dcfcb7f4d56d6485d2462e566de" +patches: + "0.2.6": + - patch_file: "patches/0001-add-cmake.patch" + base_path: "source_subfolder" diff --git a/recipes/marisa/all/conanfile.py b/recipes/marisa/all/conanfile.py new file mode 100644 index 0000000000000..13b534d613bd9 --- /dev/null +++ b/recipes/marisa/all/conanfile.py @@ -0,0 +1,87 @@ +import os +from conan import ConanFile, tools +from conan.tools.files import apply_conandata_patches +from conans import CMake + +required_conan_version = ">=1.45.0" + + +class MarisaConan(ConanFile): + name = "marisa" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/s-yata/marisa-trie" + description = "Matching Algorithm with Recursively Implemented StorAge " + license = ("BSD-2-Clause", "LGPL-2.1") + topics = ("algorithm", "dictionary", "marisa") + exports_sources = "patches/**", "CMakeLists.txt" + settings = "os", "compiler", "build_type", "arch" + options = { + "shared": [True, False], + "fPIC": [True, False], + "tools": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "tools": True, + } + + generators = "cmake" + _cmake = None + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + del self.options.fPIC + del self.settings.compiler.libcxx + del self.settings.compiler.cppstd + + def source(self): + tools.files.get(**self.conan_data["sources"][self.version], + conanfile=self, destination=self._source_subfolder, strip_root=True) + + def _configure_cmake(self): + if self._cmake: + return self._cmake + self._cmake = CMake(self) + + self._cmake.definitions["BUILD_TOOLS"] = self.options.tools + + self._cmake.configure(build_folder=self._build_subfolder) + return self._cmake + + def build(self): + apply_conandata_patches(self) + cmake = self._configure_cmake() + cmake.build() + + def package(self): + self.copy(pattern="COPYING.md", dst="licenses", + src=self._source_subfolder) + cmake = self._configure_cmake() + cmake.install() + tools.files.rmdir(self, os.path.join( + self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.names["cmake_find_package"] = "marisa" + self.cpp_info.names["cmake_find_package_multi"] = "marisa" + self.cpp_info.names["pkgconfig"] = "marisa" + self.cpp_info.libs = ["marisa"] + if self.settings.os == "Linux": + self.cpp_info.system_libs = ["m"] + + bin_path = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH env var with : '{bin_path}'") + self.env_info.PATH.append(bin_path) diff --git a/recipes/marisa/all/patches/0001-add-cmake.patch b/recipes/marisa/all/patches/0001-add-cmake.patch new file mode 100644 index 0000000000000..4635c52208c27 --- /dev/null +++ b/recipes/marisa/all/patches/0001-add-cmake.patch @@ -0,0 +1,120 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..c7e4c0e +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,114 @@ ++cmake_minimum_required(VERSION 3.1) ++project(marisa CXX) ++ ++include(GNUInstallDirs) ++ ++option(BUILD_SHARED_LIBS "Build as shared library" OFF) ++option(BUILD_TOOLS "Build tools" ON) ++option(ENABLE_TESTS "Build and run tests" ON) ++ ++if(BUILD_SHARED_LIBS) ++ set(MARISA_LIBRARY_TYPE SHARED) ++else() ++ set(MARISA_LIBRARY_TYPE STATIC) ++endif(BUILD_SHARED_LIBS) ++ ++set(CMAKE_CXX_STANDARD 11) ++ ++if(NOT CMAKE_BUILD_TYPE) ++ set(CMAKE_BUILD_TYPE Debug) ++endif() ++ ++set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") ++ ++if(NOT MSVC) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weffc++ -Wextra -Wconversion") ++endif() ++ ++if(BUILD_SHARED_LIBS AND MSVC) ++ set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ++endif() ++ ++include_directories("${PROJECT_SOURCE_DIR}/include") ++include_directories("${PROJECT_SOURCE_DIR}/lib") ++ ++set(HDR_COMPAT ++ include/marisa.h) ++ ++set(HDR_PUBLIC ++ include/marisa/agent.h ++ include/marisa/base.h ++ include/marisa/exception.h ++ include/marisa/iostream.h ++ include/marisa/key.h ++ include/marisa/keyset.h ++ include/marisa/query.h ++ include/marisa/scoped-array.h ++ include/marisa/scoped-ptr.h ++ include/marisa/stdio.h ++ include/marisa/trie.h) ++add_library(marisa ${MARISA_LIBRARY_TYPE} ++ "${PROJECT_SOURCE_DIR}/lib/marisa/grimoire/io/mapper.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/grimoire/io/reader.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/grimoire/io/writer.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/grimoire/trie/tail.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/grimoire/trie/louds-trie.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/grimoire/vector/bit-vector.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/keyset.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/trie.cc" ++ "${PROJECT_SOURCE_DIR}/lib/marisa/agent.cc") ++ ++install(TARGETS marisa ++ RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) ++ ++if(BUILD_TOOLS) ++ add_library(cmdopt OBJECT "${PROJECT_SOURCE_DIR}/tools/cmdopt.cc") ++ set(TOOLS ++ marisa-benchmark ++ marisa-build ++ marisa-common-prefix-search ++ marisa-dump ++ marisa-lookup ++ marisa-predictive-search ++ marisa-reverse-lookup ++ ) ++ ++ foreach(TOOL ${TOOLS}) ++ add_executable(${TOOL} "${PROJECT_SOURCE_DIR}/tools/${TOOL}.cc") ++ target_link_libraries(${TOOL} PRIVATE marisa cmdopt) ++ install(TARGETS ${TOOL} ++ RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}) ++ endforeach(TOOL) ++endif() ++ ++if(ENABLE_TESTS) ++ enable_testing() ++ set(TESTS ++ base-test ++ io-test ++ trie-test ++ vector-test ++ marisa-test ++ ) ++ ++ foreach(TEST ${TESTS}) ++ add_executable(${TEST} "${PROJECT_SOURCE_DIR}/tests/${TEST}.cc") ++ target_link_libraries(${TEST} PRIVATE marisa) ++ add_test(${TEST} ${TEST}) ++ endforeach(TEST) ++endif() ++ ++configure_file( ++ ${PROJECT_SOURCE_DIR}/marisa.pc.in ++ ${PROJECT_BINARY_DIR}/marisa.pc ++ @ONLY) ++install(FILES ${PROJECT_BINARY_DIR}/marisa.pc ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) ++ ++install(FILES ${HDR_COMPAT} ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ++ ++install(FILES ${HDR_PUBLIC} ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/marisa) diff --git a/recipes/marisa/all/test_package/CMakeLists.txt b/recipes/marisa/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..9bae1c0958b76 --- /dev/null +++ b/recipes/marisa/all/test_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +find_package(marisa REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} marisa::marisa) diff --git a/recipes/marisa/all/test_package/conanfile.py b/recipes/marisa/all/test_package/conanfile.py new file mode 100644 index 0000000000000..251bf8ae3e3dd --- /dev/null +++ b/recipes/marisa/all/test_package/conanfile.py @@ -0,0 +1,18 @@ +import os +from conans import CMake, ConanFile, tools +from conan.tools.build import cross_building + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/marisa/all/test_package/test_package.cpp b/recipes/marisa/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..ba90951dd5e1b --- /dev/null +++ b/recipes/marisa/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include "marisa.h" + + +int main() { + int x = 100; + int y = 200; + + marisa::swap(x, y); + + return EXIT_SUCCESS; +} diff --git a/recipes/marisa/config.yml b/recipes/marisa/config.yml new file mode 100644 index 0000000000000..070a32463b25e --- /dev/null +++ b/recipes/marisa/config.yml @@ -0,0 +1,3 @@ +versions: + "0.2.6": + folder: all diff --git a/recipes/mathfu/all/conanfile.py b/recipes/mathfu/all/conanfile.py index f683a695f0807..1b35d3c154c77 100644 --- a/recipes/mathfu/all/conanfile.py +++ b/recipes/mathfu/all/conanfile.py @@ -1,35 +1,43 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.52.0" + class MathfuConan(ConanFile): name = "mathfu" description = "C++ math library developed primarily for games focused on simplicity and efficiency." - topics = ("conan", "mathfu", "math", "geometry") + topics = ("math", "geometry") license = "Apache-2.0" homepage = "https://github.com/google/mathfu" url = "https://github.com/conan-io/conan-center-index" - settings = "os" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("vectorial/cci.20190628") + self.requires("vectorial/cci.20190628", transitive_headers=True, transitive_libs=True) def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename(self.name + "-" + self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): - if self.settings.os == "Linux": + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/mathfu/all/test_package/CMakeLists.txt b/recipes/mathfu/all/test_package/CMakeLists.txt index 196188113685c..71adac698445b 100644 --- a/recipes/mathfu/all/test_package/CMakeLists.txt +++ b/recipes/mathfu/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(mathfu REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE mathfu::mathfu) diff --git a/recipes/mathfu/all/test_package/conanfile.py b/recipes/mathfu/all/test_package/conanfile.py index 5216332f39f5c..0a6bc68712d90 100644 --- a/recipes/mathfu/all/test_package/conanfile.py +++ b/recipes/mathfu/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mathfu/all/test_v1_package/CMakeLists.txt b/recipes/mathfu/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/mathfu/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mathfu/all/test_v1_package/conanfile.py b/recipes/mathfu/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/mathfu/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mbedtls/all/CMakeLists.txt b/recipes/mbedtls/all/CMakeLists.txt index 343a494173c9c..3d32ee21cb1d7 100644 --- a/recipes/mbedtls/all/CMakeLists.txt +++ b/recipes/mbedtls/all/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.4) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - if(MSVC) if(MSVC_VERSION LESS 1900) add_definitions(-DMBEDTLS_PLATFORM_SNPRINTF_MACRO=MBEDTLS_PLATFORM_STD_SNPRINTF) @@ -16,4 +13,4 @@ if(MSVC) endif() endif() -add_subdirectory(source_subfolder) +add_subdirectory(src) diff --git a/recipes/mbedtls/all/conandata.yml b/recipes/mbedtls/all/conandata.yml index dc637270ed1d4..2e2a89aefe311 100644 --- a/recipes/mbedtls/all/conandata.yml +++ b/recipes/mbedtls/all/conandata.yml @@ -17,16 +17,3 @@ sources: "2.23.0": url: "https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.23.0.tar.gz" sha256: "5c8998217402aa1fc734f4afaeac38fad2421470fac4b3abc112bd46391054fe" - "2.16.3-apache": - url: "https://tls.mbed.org/download/mbedtls-2.16.3-apache.tgz" - sha256: "ec1bee6d82090ed6ea2690784ea4b294ab576a65d428da9fe8750f932d2da661" - "2.16.3-gpl": - url: "https://tls.mbed.org/download/mbedtls-2.16.3-gpl.tgz" - sha256: "fd01fe4b289116df7781d05e1ef712b6c98823c5334f4a27404f13a8d066ef6a" -patches: - "2.16.3-apache": - - patch_file: "patches/0001-visual-studio-shared-apache.patch" - base_path: "source_subfolder" - "2.16.3-gpl": - - patch_file: "patches/0001-visual-studio-shared-gpl.patch" - base_path: "source_subfolder" diff --git a/recipes/mbedtls/all/conanfile.py b/recipes/mbedtls/all/conanfile.py index 243093255b7a8..78c7bf30e76ae 100644 --- a/recipes/mbedtls/all/conanfile.py +++ b/recipes/mbedtls/all/conanfile.py @@ -1,18 +1,23 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class MBedTLSConan(ConanFile): name = "mbedtls" - description = "mbed TLS makes it trivially easy for developers to include cryptographic and SSL/TLS capabilities in their (embedded) products" - topics = ("mbedtls", "polarssl", "tls", "security") + description = ( + "mbed TLS makes it trivially easy for developers to include " + "cryptographic and SSL/TLS capabilities in their (embedded) products" + ) + topics = ("polarssl", "tls", "security") url = "https://github.com/conan-io/conan-center-index" homepage = "https://tls.mbed.org" - license = ("GPL-2.0", "Apache-2.0",) + license = "Apache-2.0" settings = "os", "arch", "compiler", "build_type" options = { @@ -26,99 +31,66 @@ class MBedTLSConan(ConanFile): "with_zlib": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _license(self): - return self.version.rsplit("-", 1)[1] - - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + exports_sources = "CMakeLists.txt" def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) >= "3.0.0": + if Version(self.version) >= "3.0.0": # ZLIB support has been ditched on version 3.0.0 del self.options.with_zlib def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - if tools.Version(self.version) >= "2.23.0": - self.license = "Apache-2.0" + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): - if tools.Version(self.version) >= "2.23.0" \ - and self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration( - f"{self.name}/{self.version} does not support shared build on Windows" - ) + if self.info.settings.os == "Windows" and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} does not support shared build on Windows") - if tools.Version(self.version) >= "2.23.0" \ - and self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": # The command line flags set are not supported on older versions of gcc raise ConanInvalidConfiguration( - f"{self.settings.compiler}-{self.settings.compiler.version} is not supported by this recipe" - ) + f"{self.ref} does not support {self.info.settings.compiler}-{self.info.settings.compiler.version}" + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root = True, destination=self._source_subfolder) - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) < "2.23.0": - # No warnings as errors - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakelists, "-Werror", "") - tools.replace_in_file(cmakelists, "/WX", "") - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["USE_SHARED_MBEDTLS_LIBRARY"] = self.options.shared - cmake.definitions["USE_STATIC_MBEDTLS_LIBRARY"] = not self.options.shared - if tools.Version(self.version) < "3.0.0": - cmake.definitions["ENABLE_ZLIB_SUPPORT"] = self.options.with_zlib - cmake.definitions["ENABLE_PROGRAMS"] = False - if tools.Version(self.version) >= "2.23.0": - cmake.definitions["MBEDTLS_FATAL_WARNINGS"] = False - cmake.definitions["ENABLE_TESTING"] = False - if tools.Version(self.version) < "3.0.0": + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root = True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_SHARED_MBEDTLS_LIBRARY"] = self.options.shared + tc.variables["USE_STATIC_MBEDTLS_LIBRARY"] = not self.options.shared + if Version(self.version) < "3.0.0": + tc.variables["ENABLE_ZLIB_SUPPORT"] = self.options.with_zlib + tc.variables["ENABLE_PROGRAMS"] = False + tc.variables["MBEDTLS_FATAL_WARNINGS"] = False + tc.variables["ENABLE_TESTING"] = False + if Version(self.version) < "3.0.0": # relocatable shared libs on macOS - cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - cmake.configure() - return cmake + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=os.path.join(self.source_folder, self._source_subfolder), dst="licenses") - if tools.Version(self.version) < "2.23.0": # less then 2.23 is multi-licensed - if self._license == "gpl": - self.copy("gpl-2.0.txt", src=os.path.join(self.source_folder, self._source_subfolder), dst="licenses") - else: - self.copy("apache-2.0.txt", src=os.path.join(self.source_folder, self._source_subfolder), dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "MbedTLS") diff --git a/recipes/mbedtls/all/patches/0001-visual-studio-shared-apache.patch b/recipes/mbedtls/all/patches/0001-visual-studio-shared-apache.patch deleted file mode 100644 index b26ae19ed4de9..0000000000000 --- a/recipes/mbedtls/all/patches/0001-visual-studio-shared-apache.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- include/mbedtls/bn_mul.h 2019-09-06 16:33:55.000000000 +0200 -+++ include/mbedtls/bn_mul.h 2019-11-04 16:42:16.682670628 +0100 -@@ -62,7 +62,7 @@ - * This is done as the number of registers used in the assembly code doesn't - * work with the -O0 option. - */ --#if defined(__i386__) && defined(__OPTIMIZE__) -+#if defined(__i386__) && defined(__OPTIMIZE__) && !defined(__PIC__) - - #define MULADDC_INIT \ - asm( \ ---- include/mbedtls/x509_crt.h 2019-09-06 16:33:55.000000000 +0200 -+++ include/mbedtls/x509_crt.h 2019-11-04 16:42:16.681670623 +0100 -@@ -201,22 +201,34 @@ - #endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */ - - #if defined(MBEDTLS_X509_CRT_PARSE_C) -+#ifdef _MSC_VER -+ #if defined(X509_USE_SHARED) -+ #define X509_EXPORT __declspec(dllimport) -+ #elif defined(X509_BUILD_SHARED) -+ #define X509_EXPORT __declspec(dllexport) -+ #else -+ #define X509_EXPORT extern -+ #endif -+#else -+ #define X509_EXPORT extern -+#endif -+ - /** - * Default security profile. Should provide a good balance between security - * and compatibility with current deployments. - */ --extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_default; -+X509_EXPORT const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_default; - - /** - * Expected next default profile. Recommended for new deployments. - * Currently targets a 128-bit security level, except for RSA-2048. - */ --extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_next; -+X509_EXPORT const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_next; - - /** - * NSA Suite B profile. - */ --extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb; -+X509_EXPORT const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb; - - /** - * \brief Parse a single DER formatted certificate and add it ---- library/CMakeLists.txt 2019-09-06 14:35:30.000000000 +0200 -+++ library/CMakeLists.txt 2019-11-04 16:42:16.681670623 +0100 -@@ -159,7 +159,7 @@ - target_link_libraries(${mbedtls_static_target} ${libs} ${mbedx509_static_target}) - - install(TARGETS ${mbedtls_static_target} ${mbedx509_static_target} ${mbedcrypto_static_target} -- DESTINATION ${LIB_INSTALL_DIR} -+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR} LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - endif(USE_STATIC_MBEDTLS_LIBRARY) - -@@ -177,7 +177,7 @@ - target_link_libraries(mbedtls ${libs} mbedx509) - - install(TARGETS mbedtls mbedx509 mbedcrypto -- DESTINATION ${LIB_INSTALL_DIR} -+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR} LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - endif(USE_SHARED_MBEDTLS_LIBRARY) - diff --git a/recipes/mbedtls/all/patches/0001-visual-studio-shared-gpl.patch b/recipes/mbedtls/all/patches/0001-visual-studio-shared-gpl.patch deleted file mode 100644 index ae06c9bdd796b..0000000000000 --- a/recipes/mbedtls/all/patches/0001-visual-studio-shared-gpl.patch +++ /dev/null @@ -1,71 +0,0 @@ ---- include/mbedtls/bn_mul.h 2019-09-06 16:33:55.000000000 +0200 -+++ include/mbedtls/bn_mul.h 2019-11-04 16:42:16.682670628 +0100 -@@ -64,7 +64,7 @@ - * This is done as the number of registers used in the assembly code doesn't - * work with the -O0 option. - */ --#if defined(__i386__) && defined(__OPTIMIZE__) -+#if defined(__i386__) && defined(__OPTIMIZE__) && !defined(__PIC__) - - #define MULADDC_INIT \ - asm( \ ---- include/mbedtls/x509_crt.h 2019-09-06 16:33:55.000000000 +0200 -+++ include/mbedtls/x509_crt.h 2019-11-04 16:42:16.681670623 +0100 -@@ -203,22 +203,34 @@ - #endif /* MBEDTLS_ECDSA_C && MBEDTLS_ECP_RESTARTABLE */ - - #if defined(MBEDTLS_X509_CRT_PARSE_C) -+#ifdef _MSC_VER -+ #if defined(X509_USE_SHARED) -+ #define X509_EXPORT __declspec(dllimport) -+ #elif defined(X509_BUILD_SHARED) -+ #define X509_EXPORT __declspec(dllexport) -+ #else -+ #define X509_EXPORT extern -+ #endif -+#else -+ #define X509_EXPORT extern -+#endif -+ - /** - * Default security profile. Should provide a good balance between security - * and compatibility with current deployments. - */ --extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_default; -+X509_EXPORT const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_default; - - /** - * Expected next default profile. Recommended for new deployments. - * Currently targets a 128-bit security level, except for RSA-2048. - */ --extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_next; -+X509_EXPORT const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_next; - - /** - * NSA Suite B profile. - */ --extern const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb; -+X509_EXPORT const mbedtls_x509_crt_profile mbedtls_x509_crt_profile_suiteb; - - /** - * \brief Parse a single DER formatted certificate and add it ---- library/CMakeLists.txt 2019-09-06 14:35:30.000000000 +0200 -+++ library/CMakeLists.txt 2019-11-04 16:42:16.681670623 +0100 -@@ -159,7 +159,7 @@ - target_link_libraries(${mbedtls_static_target} ${libs} ${mbedx509_static_target}) - - install(TARGETS ${mbedtls_static_target} ${mbedx509_static_target} ${mbedcrypto_static_target} -- DESTINATION ${LIB_INSTALL_DIR} -+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR} LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - endif(USE_STATIC_MBEDTLS_LIBRARY) - -@@ -177,7 +177,7 @@ - target_link_libraries(mbedtls ${libs} mbedx509) - - install(TARGETS mbedtls mbedx509 mbedcrypto -- DESTINATION ${LIB_INSTALL_DIR} -+ ARCHIVE DESTINATION ${LIB_INSTALL_DIR} LIBRARY DESTINATION ${LIB_INSTALL_DIR} RUNTIME DESTINATION bin - PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE) - endif(USE_SHARED_MBEDTLS_LIBRARY) - diff --git a/recipes/mbedtls/all/test_package/CMakeLists.txt b/recipes/mbedtls/all/test_package/CMakeLists.txt index 7a975cc3df94d..708448e53f170 100644 --- a/recipes/mbedtls/all/test_package/CMakeLists.txt +++ b/recipes/mbedtls/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(MbedTLS REQUIRED) +find_package(MbedTLS REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} MbedTLS::mbedtls) +target_link_libraries(${PROJECT_NAME} PRIVATE MbedTLS::mbedtls) diff --git a/recipes/mbedtls/all/test_package/conanfile.py b/recipes/mbedtls/all/test_package/conanfile.py index 19e6a0c06e3d8..0a6bc68712d90 100644 --- a/recipes/mbedtls/all/test_package/conanfile.py +++ b/recipes/mbedtls/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mbedtls/all/test_v1_package/CMakeLists.txt b/recipes/mbedtls/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/mbedtls/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/mbedtls/all/test_v1_package/conanfile.py b/recipes/mbedtls/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/mbedtls/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mbedtls/config.yml b/recipes/mbedtls/config.yml index 276042bd4cfdd..114a3e62d619d 100644 --- a/recipes/mbedtls/config.yml +++ b/recipes/mbedtls/config.yml @@ -11,7 +11,3 @@ versions: folder: all "2.23.0": folder: all - "2.16.3-apache": - folder: all - "2.16.3-gpl": - folder: all diff --git a/recipes/mbits-args/all/CMakeLists.txt b/recipes/mbits-args/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/mbits-args/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/mbits-args/all/conandata.yml b/recipes/mbits-args/all/conandata.yml index 9396e3b4afe52..c5ec46f3c1e27 100644 --- a/recipes/mbits-args/all/conandata.yml +++ b/recipes/mbits-args/all/conandata.yml @@ -1,4 +1,10 @@ sources: - 0.12.3: + "0.12.3": url: "https://github.com/mbits-libs/args/archive/v0.12.3.tar.gz" sha256: "1a1dc5793e927a7f8c34b77c776b4d4a88f7ce9557657d8e806fca2922bd07a0" +patches: + "0.12.3": + - patch_file: "patches/0.12.3-0001-export-cmake-config.patch" + patch_description: "conan v2: drop the unneeded dependency, export cmake config" + patch_source: "https://github.com/mbits-libs/args/commit/f0593ed24d8edc33bcef5acaad5a2d27bf566ede" + patch_type: "conan" diff --git a/recipes/mbits-args/all/conanfile.py b/recipes/mbits-args/all/conanfile.py index 67fd62d66485d..061c5b3a891b0 100644 --- a/recipes/mbits-args/all/conanfile.py +++ b/recipes/mbits-args/all/conanfile.py @@ -1,103 +1,122 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import ( + apply_conandata_patches, + export_conandata_patches, + get, + copy, + rmdir, +) +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os +required_conan_version = ">=1.53.0" + + class MBitsArgsConan(ConanFile): name = "mbits-args" - description = "Small open-source library for program argument parser, inspired by Python's `argparse`, " \ - "depending only on the standard library, with C++17 as minimum requirement." - homepage = "https://github.com/mbits-libs/args" + description = ( + "Small open-source library for program argument parser, inspired by Python's `argparse`, " + "depending only on the standard library, with C++17 as minimum requirement." + ) license = "MIT" - topics = ("command-line", "commandline", "commandline-interface", - "program-arguments", "argparse", "argparser", "argument-parsing") - url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mbits-libs/args" + topics = ( + "command-line", + "commandline", + "commandline-interface", + "program-arguments", + "argparse", + "argparser", + "argument-parsing", + ) settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake" - exports_sources = "CMakeLists.txt" - - _cmake = None + options = {"fPIC": [True, False]} + default_options = {"fPIC": True} - _compilers_minimum_version = { - "gcc": "8", - "clang": "7.0", - "Visual Studio": "16", - "apple-clang": "10.0", - } + @property + def _min_cppstd(self): + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "12", + "Visual Studio": "16", + "msvc": "192", + "apple-clang": "10.0", + } + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - def configure(self): - if self.options.shared: - del self.options.fPIC - - if self.settings.compiler == "Visual Studio" and "MT" in str(self.settings.compiler.runtime): + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False + ) + if ( + minimum_version + and Version(self.settings.compiler.version) < minimum_version + ): raise ConanInvalidConfiguration( - "mbits-args: combining shared library with private C++ " - "library (MT/MTd) is not supported.") - - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - - minimum_version = self._compilers_minimum_version.get( - str(self.settings.compiler), False) - if not minimum_version: - self.output.warn( - "mbits-args requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("mbits-args: Unsupported compiler: {} {}; " - "minimal version known to work is {}." - .format(self.settings.compiler, self.settings.compiler.version, minimum_version)) - elif str(self.settings.compiler) == "clang" and tools.Version(self.settings.compiler.version) < "8": - libcxx = self.settings.compiler.get_safe("libcxx") - if libcxx and str(libcxx) == "libc++": - raise ConanInvalidConfiguration("mbits-args: Unsupported compiler: clang {} with libc++;\n" - "minimal version known to work is either clang 8 with " - "libc++ or clang {} with libstdc++/libstdc++11." - .format(self.settings.compiler.version, minimum_version)) + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("args-{}".format(self.version), - self._source_subfolder) - - def _configure_cmake(self): - if self._cmake is not None: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LIBARGS_TESTING"] = False - self._cmake.definitions["LIBARGS_INSTALL"] = True - self._cmake.definitions["LIBARGS_SHARED"] = self.options.shared - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBARGS_TESTING"] = False + tc.variables["LIBARGS_INSTALL"] = True + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", - "licenses", keep_path=False, src=self._source_subfolder) + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "args" - self.cpp_info.filenames["cmake_find_package_multi"] = "args" + self.cpp_info.libs = ["args"] + + self.cpp_info.set_property("cmake_file_name", "mbits-args") + self.cpp_info.set_property("cmake_target_name", "mbits::args") + + self.cpp_info.filenames["cmake_find_package"] = "mbits-args" + self.cpp_info.filenames["cmake_find_package_multi"] = "mbits-args" self.cpp_info.names["cmake_find_package"] = "mbits" self.cpp_info.names["cmake_find_package_multi"] = "mbits" - self.cpp_info.components["libargs"].names["cmake_find_package"] = "args" - self.cpp_info.components["libargs"].names["cmake_find_package_multi"] = "args" - self.cpp_info.components["libargs"].libs = tools.collect_libs(self) - - # FIXME: CMake imported target shouldn't be namespaced (requires https://github.com/conan-io/conan/issues/7615) - # https://github.com/mbits-libs/args/blob/72f5f2b87ae39f26638a585fa4ad0b96b4152ae6/CMakeLists.txt#L152 + self.cpp_info.components["args"].set_property( + "cmake_target_name", "mbits::args" + ) + self.cpp_info.components["args"].libs = ["args"] diff --git a/recipes/mbits-args/all/patches/0.12.3-0001-export-cmake-config.patch b/recipes/mbits-args/all/patches/0.12.3-0001-export-cmake-config.patch new file mode 100644 index 0000000000000..b14f33f3a470e --- /dev/null +++ b/recipes/mbits-args/all/patches/0.12.3-0001-export-cmake-config.patch @@ -0,0 +1,36 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 3d9271c..28c176f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -9,9 +9,6 @@ set(PROJECT_VERSION_STABILITY "") # or "-alpha", or "-beta", or "-rc.5" + if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) + message(STATUS "Libargs: Standalone") + +- include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +- conan_basic_setup(TARGETS) +- + set(LIBARG_TESTING_DEFAULT ON) + set(LIBARG_INSTALL_DEFAULT ON) + set_property(GLOBAL PROPERTY USE_FOLDERS ON) +@@ -123,8 +120,9 @@ target_compile_definitions(args PRIVATE LIBARGS_EXPORTING) + target_compile_features(args PRIVATE cxx_std_17) + target_include_directories(args + PUBLIC +- ${CMAKE_CURRENT_SOURCE_DIR}/include +- ${CMAKE_CURRENT_BINARY_DIR}/include ++ $ ++ $ ++ $ + PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src) + + if (LIBARGS_SHARED) +@@ -149,7 +147,8 @@ endif() + ################################################################## + + if (LIBARGS_INSTALL) +- install(TARGETS args) ++ install(TARGETS args EXPORT mbits) ++ install(EXPORT mbits NAMESPACE "mbits::" DESTINATION lib/cmake) + install(DIRECTORY include/args DESTINATION include) + install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/args/version.hpp" DESTINATION include/args) + endif() diff --git a/recipes/mbits-args/all/test_package/CMakeLists.txt b/recipes/mbits-args/all/test_package/CMakeLists.txt index edca4cb0bfe7f..6048bc9a7928f 100644 --- a/recipes/mbits-args/all/test_package/CMakeLists.txt +++ b/recipes/mbits-args/all/test_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.12) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(mbits-args REQUIRED CONFIG) -find_package(args REQUIRED CONFIG) - -add_executable(example example.cpp) -# FIXME: CMake imported target shouldn't be namespaced (requires https://github.com/conan-io/conan/issues/7615) -target_link_libraries(example mbits::args) -set_target_properties(example PROPERTIES - CXX_STANDARD 20 - CXX_STANDARD_REQUIRED OFF) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mbits::args) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mbits-args/all/test_package/conanfile.py b/recipes/mbits-args/all/test_package/conanfile.py index 9ded35e45e703..3202cf875bb92 100644 --- a/recipes/mbits-args/all/test_package/conanfile.py +++ b/recipes/mbits-args/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class LibargsTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "example") - self.run("{} --sum 1000 700 1".format(bin_path), - run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run("{} --sum 1000 700 1".format(bin_path), env="conanrun") diff --git a/recipes/mbits-args/all/test_package/example.cpp b/recipes/mbits-args/all/test_package/test_package.cpp similarity index 100% rename from recipes/mbits-args/all/test_package/example.cpp rename to recipes/mbits-args/all/test_package/test_package.cpp diff --git a/recipes/mbits-args/all/test_v1_package/CMakeLists.txt b/recipes/mbits-args/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/mbits-args/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mbits-args/all/test_v1_package/conanfile.py b/recipes/mbits-args/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..897d76acb188a --- /dev/null +++ b/recipes/mbits-args/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run("{} --sum 1000 700 1".format(bin_path), run_environment=True) diff --git a/recipes/mbits-args/config.yml b/recipes/mbits-args/config.yml index 0ea23cbe62531..fba0b105d56ef 100644 --- a/recipes/mbits-args/config.yml +++ b/recipes/mbits-args/config.yml @@ -1,3 +1,3 @@ versions: - 0.12.3: + "0.12.3": folder: all diff --git a/recipes/mbits-diags/all/conandata.yml b/recipes/mbits-diags/all/conandata.yml new file mode 100644 index 0000000000000..39c27e3a72100 --- /dev/null +++ b/recipes/mbits-diags/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.9.4": + url: "https://github.com/mbits-libs/diags/archive/v0.9.4.tar.gz" + sha256: "4fa47e416fa9521c1d268765faf8b313f8e38de249049bc09950a303e11571bf" diff --git a/recipes/mbits-diags/all/conanfile.py b/recipes/mbits-diags/all/conanfile.py new file mode 100644 index 0000000000000..f6c4c3381f0e0 --- /dev/null +++ b/recipes/mbits-diags/all/conanfile.py @@ -0,0 +1,117 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class MBitsDiagsConan(ConanFile): + name = "mbits-diags" + description = "Diagnostic library with source positions, ranges and hints." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mbits-libs/diags" + topics = ("diagnostics", "cli", "logging", "errors") + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "12", + "Visual Studio": "16", + "msvc": "192", + "apple-clang": "11.0.3", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("fmt/9.1.0") + self.requires("mbits-semver/0.1.1") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False + ) + if ( + minimum_version + and Version(self.settings.compiler.version) < minimum_version + ): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DIAGS_TESTING"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["diags"] + + self.cpp_info.set_property("cmake_file_name", "mbits-diags") + self.cpp_info.set_property("cmake_target_name", "mbits::diags") + + self.cpp_info.filenames["cmake_find_package"] = "mbits-diags" + self.cpp_info.filenames["cmake_find_package_multi"] = "mbits-diags" + self.cpp_info.names["cmake_find_package"] = "mbits" + self.cpp_info.names["cmake_find_package_multi"] = "mbits" + self.cpp_info.components["diags"].set_property( + "cmake_target_name", "mbits::diags" + ) + self.cpp_info.components["diags"].libs = ["diags"] + self.cpp_info.components["diags"].requires = [ + "fmt::fmt", + "mbits-semver::semver", + ] diff --git a/recipes/mbits-diags/all/test_package/CMakeLists.txt b/recipes/mbits-diags/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..931abded16bce --- /dev/null +++ b/recipes/mbits-diags/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(mbits-diags REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mbits::diags) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mbits-diags/all/test_package/conanfile.py b/recipes/mbits-diags/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/mbits-diags/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mbits-diags/all/test_package/test_package.cpp b/recipes/mbits-diags/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..0408581ead243 --- /dev/null +++ b/recipes/mbits-diags/all/test_package/test_package.cpp @@ -0,0 +1,59 @@ +#include +#include +#include + +using namespace diags; +using namespace std::literals; + +namespace app { +enum class str { in_use }; +UNPACK_DIAGS_TYPES(diags::string::singular); +SINGLE_FORM_DIAGS_SUPPORT(str) + +struct strings : translator_type { + std::string_view get(str id) const noexcept final { + switch (id) { + case str::in_use: + return "Library is in use"sv; + } + return {}; + } + std::string_view get(severity sev) const noexcept final { + switch (sev) { + case severity::note: + return "note"sv; + case severity::warning: + return "warning"sv; + case severity::error: + return "error"sv; + case severity::fatal: + return "fatal"sv; + default: + break; + } + return {}; + } +}; + +location_range_severity pos_from(source_code &source, + severity sev = severity::note) { + auto const start = source.position(1, 13); + auto const stop = start.moved_by(0, 7); + return start - stop[sev]; +} +} // namespace app + +int main() { + app::strings strings{}; + sources host{}; + auto src = host.source("use-diags.cpp"); + + host.set_contents("use-diags.cpp", "- underline [range] in brackets"sv); + auto msg = app::pos_from(src) + << format("{}: {}", app::str::in_use, version.to_string()); + host.push_back(msg); + + auto tr = strings.make(); + host.set_printer(&get_stdout(), tr, color::always, link_type::gcc); + host.print_diagnostics(); +} diff --git a/recipes/mbits-diags/all/test_v1_package/CMakeLists.txt b/recipes/mbits-diags/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/mbits-diags/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mbits-diags/all/test_v1_package/conanfile.py b/recipes/mbits-diags/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/mbits-diags/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mbits-diags/config.yml b/recipes/mbits-diags/config.yml new file mode 100644 index 0000000000000..b894994ccfb77 --- /dev/null +++ b/recipes/mbits-diags/config.yml @@ -0,0 +1,3 @@ +versions: + "0.9.4": + folder: all diff --git a/recipes/mbits-mstch/all/conandata.yml b/recipes/mbits-mstch/all/conandata.yml new file mode 100644 index 0000000000000..252a49a795bd6 --- /dev/null +++ b/recipes/mbits-mstch/all/conandata.yml @@ -0,0 +1,5 @@ +sources: + # Newer versions at the top + "1.0.4": + url: "https://github.com/mbits-libs/libmstch/archive/v1.0.4.tar.gz" + sha256: "ee3052b9c2321b46fffabb5db5d5659e5f963070cdfd0004701b515867ed6857" diff --git a/recipes/mbits-mstch/all/conanfile.py b/recipes/mbits-mstch/all/conanfile.py new file mode 100644 index 0000000000000..a06f83e964b39 --- /dev/null +++ b/recipes/mbits-mstch/all/conanfile.py @@ -0,0 +1,105 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class MBitsMstchConan(ConanFile): + name = "mbits-mstch" + description = "libmstch implemented in terms of C++17 variant." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mbits-libs/libmstch" + topics = ("parser", "mstch", "mustache", "libmstch", "libmstch-parser") + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "12", + "msvc": "192", + "apple-clang": "11.0.3", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False + ) + if ( + minimum_version + and Version(self.settings.compiler.version) < minimum_version + ): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["mstch"] + + self.cpp_info.set_property("cmake_file_name", "mbits-mstch") + self.cpp_info.set_property("cmake_target_name", "mbits::mstch") + + self.cpp_info.filenames["cmake_find_package"] = "mbits-mstch" + self.cpp_info.filenames["cmake_find_package_multi"] = "mbits-mstch" + self.cpp_info.names["cmake_find_package"] = "mbits" + self.cpp_info.names["cmake_find_package_multi"] = "mbits" + self.cpp_info.components["mstch"].set_property( + "cmake_target_name", "mbits::mstch" + ) + self.cpp_info.components["mstch"].libs = ["mstch"] diff --git a/recipes/mbits-mstch/all/test_package/CMakeLists.txt b/recipes/mbits-mstch/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b7067fa3ea38e --- /dev/null +++ b/recipes/mbits-mstch/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(mbits-mstch REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mbits::mstch) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mbits-mstch/all/test_package/conanfile.py b/recipes/mbits-mstch/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/mbits-mstch/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mbits-mstch/all/test_package/test_package.cpp b/recipes/mbits-mstch/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..dee76b9b4ce2e --- /dev/null +++ b/recipes/mbits-mstch/all/test_package/test_package.cpp @@ -0,0 +1,26 @@ +#include +#include + +int main() { + mstch::map root{ + {"it", "works"}, + {"happy", true}, + {"various", + mstch::array{ + mstch::map{{"value", nullptr}}, + mstch::map{{"value", 0ll}}, + mstch::map{{"value", 3.14}}, + mstch::map{{"value", false}}, + }}, + }; + + puts(mstch::render(R"(>>> It {{it}} + I'm {{^happy}}not {{/happy}}happy about it. + Various: +{{#various}} + - {{value}}; +{{/various}} +)", + root) + .c_str()); +} diff --git a/recipes/mbits-mstch/all/test_v1_package/CMakeLists.txt b/recipes/mbits-mstch/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/mbits-mstch/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mbits-mstch/all/test_v1_package/conanfile.py b/recipes/mbits-mstch/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/mbits-mstch/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mbits-mstch/config.yml b/recipes/mbits-mstch/config.yml new file mode 100644 index 0000000000000..a7562f7a5313a --- /dev/null +++ b/recipes/mbits-mstch/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "1.0.4": + folder: all diff --git a/recipes/mbits-semver/all/conandata.yml b/recipes/mbits-semver/all/conandata.yml new file mode 100644 index 0000000000000..dfbd10562ef66 --- /dev/null +++ b/recipes/mbits-semver/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + 0.1.1: + url: "https://github.com/mbits-libs/semver/archive/v0.1.1.tar.gz" + sha256: "edfa9b04bdffd8efbdea31c9cfd7064801483d8cab0b2de5734018bdb318cf18" diff --git a/recipes/mbits-semver/all/conanfile.py b/recipes/mbits-semver/all/conanfile.py new file mode 100644 index 0000000000000..f0cda9dbb4ea7 --- /dev/null +++ b/recipes/mbits-semver/all/conanfile.py @@ -0,0 +1,103 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class MBitsSemverConan(ConanFile): + name = "mbits-semver" + description = "Semantic Version type for C++17" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mbits-libs/semver" + topics = ("semver", "semantic-versioning") + settings = "os", "compiler", "build_type", "arch" + options = {"fPIC": [True, False]} + default_options = {"fPIC": True} + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "12", + "Visual Studio": "16", + "msvc": "192", + "apple-clang": "11.0.3", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False + ) + if ( + minimum_version + and Version(self.settings.compiler.version) < minimum_version + ): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SEMVER_TESTING"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["semver"] + + self.cpp_info.set_property("cmake_file_name", "mbits-semver") + self.cpp_info.set_property("cmake_target_name", "mbits::semver") + + self.cpp_info.filenames["cmake_find_package"] = "mbits-semver" + self.cpp_info.filenames["cmake_find_package_multi"] = "mbits-semver" + self.cpp_info.names["cmake_find_package"] = "mbits" + self.cpp_info.names["cmake_find_package_multi"] = "mbits" + self.cpp_info.components["semver"].set_property( + "cmake_target_name", "mbits::semver" + ) + self.cpp_info.components["semver"].libs = ["semver"] diff --git a/recipes/mbits-semver/all/test_package/CMakeLists.txt b/recipes/mbits-semver/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4d8d4734ef155 --- /dev/null +++ b/recipes/mbits-semver/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(mbits-semver REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mbits::semver) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mbits-semver/all/test_package/conanfile.py b/recipes/mbits-semver/all/test_package/conanfile.py new file mode 100644 index 0000000000000..1111583fea732 --- /dev/null +++ b/recipes/mbits-semver/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mbits-semver/all/test_package/test_package.cpp b/recipes/mbits-semver/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..fa9dbd47eb837 --- /dev/null +++ b/recipes/mbits-semver/all/test_package/test_package.cpp @@ -0,0 +1,29 @@ +#include +#include +#include + +int main() { + auto const ver_data = std::string{"1.3.0-beta.5+something.mixed.5"}; + semver::project_version beta5{ver_data}; + + auto const ver_data_rc = std::string{"1.3.0-rc"}; + semver::project_version rc{ver_data_rc}; + + char const *verdict = semver::version.compatible_with(beta5) ? "" : "in"; + printf("Compiled-in version %s is %scompatible with runtime version %s\n", + semver::version.to_string().c_str(), verdict, + beta5.to_string().c_str()); + + verdict = semver::version.compatible_with(semver::get_version()) ? "" : "in"; + printf("Compiled-in version %s is %scompatible with runtime version %s\n", + semver::version.to_string().c_str(), verdict, + semver::get_version().to_string().c_str()); + + verdict = beta5.compatible_with(rc) ? "" : "in"; + printf("Compiled-in version %s is %scompatible with runtime version %s\n", + beta5.to_string().c_str(), verdict, rc.to_string().c_str()); + + verdict = rc.compatible_with(beta5) ? "" : "in"; + printf("Compiled-in version %s is %scompatible with runtime version %s\n", + rc.to_string().c_str(), verdict, beta5.to_string().c_str()); +} diff --git a/recipes/mbits-semver/all/test_v1_package/CMakeLists.txt b/recipes/mbits-semver/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/mbits-semver/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mbits-semver/all/test_v1_package/conanfile.py b/recipes/mbits-semver/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/mbits-semver/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mbits-semver/config.yml b/recipes/mbits-semver/config.yml new file mode 100644 index 0000000000000..931f26d75751d --- /dev/null +++ b/recipes/mbits-semver/config.yml @@ -0,0 +1,3 @@ +versions: + 0.1.1: + folder: all diff --git a/recipes/mbits-utfconv/all/conandata.yml b/recipes/mbits-utfconv/all/conandata.yml new file mode 100644 index 0000000000000..f315fc7cf457d --- /dev/null +++ b/recipes/mbits-utfconv/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.3": + url: "https://github.com/mbits-libs/utfconv/archive/v1.0.3.tar.gz" + sha256: "2077e3dcb999dc76d2bdc06cc141b38e10f15762975c261f72cc1a8c2519a27a" diff --git a/recipes/mbits-utfconv/all/conanfile.py b/recipes/mbits-utfconv/all/conanfile.py new file mode 100644 index 0000000000000..28ec757d2eaab --- /dev/null +++ b/recipes/mbits-utfconv/all/conanfile.py @@ -0,0 +1,115 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class MBitsUtfConvConan(ConanFile): + name = "mbits-utfconv" + description = ( + "Conversion library between string, u16string, u32string and u8string." + ) + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mbits-libs/utfconv" + topics = ("utf-conversion", "utf", "conversion", "utfconv") + settings = "os", "arch", "compiler", "build_type" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "12", + "apple-clang": "11.0.3", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("mbits-semver/0.1.1") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False + ) + if ( + minimum_version + and Version(self.settings.compiler.version) < minimum_version + ): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["UTFCONV_TESTING"] = False + tc.variables["UTFCONV_INSTALL"] = True + tc.variables["UTFCONV_BUILD_AS_STANDALONE"] = True + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy( + self, + pattern="LICENSE", + dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder, + ) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["utfconv"] + + self.cpp_info.set_property("cmake_file_name", "mbits-utfconv") + self.cpp_info.set_property("cmake_target_name", "mbits::utfconv") + + self.cpp_info.filenames["cmake_find_package"] = "mbits-utfconv" + self.cpp_info.filenames["cmake_find_package_multi"] = "mbits-utfconv" + self.cpp_info.names["cmake_find_package"] = "mbits" + self.cpp_info.names["cmake_find_package_multi"] = "mbits" + self.cpp_info.components["utfconv"].set_property( + "cmake_target_name", "mbits::utfconv" + ) + self.cpp_info.components["utfconv"].libs = ["utfconv"] + self.cpp_info.components["utfconv"].requires = ["mbits-semver::semver"] diff --git a/recipes/mbits-utfconv/all/test_package/CMakeLists.txt b/recipes/mbits-utfconv/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..1afdb5a7117b8 --- /dev/null +++ b/recipes/mbits-utfconv/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(mbits-utfconv REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mbits::utfconv) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mbits-utfconv/all/test_package/conanfile.py b/recipes/mbits-utfconv/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/mbits-utfconv/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mbits-utfconv/all/test_package/test_package.cpp b/recipes/mbits-utfconv/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..0e688cebdcbaf --- /dev/null +++ b/recipes/mbits-utfconv/all/test_package/test_package.cpp @@ -0,0 +1,20 @@ +#include +#include +#include + +using namespace utf; +using namespace std::literals; + +static constexpr auto smiley8sv = "\360\237\230\200"sv; +static constexpr auto smiley16 = u"\U0001F600"sv; + +int main() { + std::printf("Uses utf/%s\n", version.to_string().c_str()); + if (!utf::is_valid(smiley8sv)) + std::fprintf(stderr, "smiley8s is invalid...\n"); + if (!utf::is_valid(smiley16)) + std::fprintf(stderr, "smiley16 is invalid...\n"); + if (utf::as_str8(smiley16) != smiley8sv) + std::fprintf(stderr, "smiley16 differs from \"%.*s\"\n", + (int)smiley8sv.length(), smiley8sv.data()); +} diff --git a/recipes/mbits-utfconv/all/test_v1_package/CMakeLists.txt b/recipes/mbits-utfconv/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/mbits-utfconv/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mbits-utfconv/all/test_v1_package/conanfile.py b/recipes/mbits-utfconv/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/mbits-utfconv/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mbits-utfconv/config.yml b/recipes/mbits-utfconv/config.yml new file mode 100644 index 0000000000000..372dd1cb646bd --- /dev/null +++ b/recipes/mbits-utfconv/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.3": + folder: all diff --git a/recipes/mcap/all/conandata.yml b/recipes/mcap/all/conandata.yml index a12e743fc57b2..902534f8f869d 100644 --- a/recipes/mcap/all/conandata.yml +++ b/recipes/mcap/all/conandata.yml @@ -1,10 +1,22 @@ sources: - 0.1.0: - url: https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.1.0/main.tar.gz - sha256: a936abb1493b0d189d7909a79c45bdc6703b6016801e10b5cd129ba39642d2b2 - 0.1.1: - url: https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.1.1/main.tar.gz - sha256: a9ea899315851bfacdb234b7acc917b1a9c67593f0d68e1920321a8f6fa2cfbf + 0.9.0: + url: "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.9.0/main.tar.gz" + sha256: "e17702fcc0259bf72eab0d84d3fa6e02c051256357ab7ba4421462f2c02b434f" + 0.5.0: + url: "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.5.0/main.tar.gz" + sha256: "408e255a6c6419b16de38a9ecbdd9729d60adc657767b2d52a234d1da1185349" + 0.4.0: + url: "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.4.0/main.tar.gz" + sha256: "c0ab99e51005fa8b74fe9ca1ed23b205cf532b8b0723eedd243f35a28d7b466b" + 0.3.0: + url: "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.3.0/main.tar.gz" + sha256: "ef29ea4c09520b8aaa2d78ce5e79cbbcd87511ed14d6abf3c4b249ae67a4153b" 0.1.2: - url: https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.1.2/main.tar.gz - sha256: 0f456d6c53730445c3dbf57afd285493cf748c66a02f77d6e48c075128fd0896 + url: "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.1.2/main.tar.gz" + sha256: "0f456d6c53730445c3dbf57afd285493cf748c66a02f77d6e48c075128fd0896" + 0.1.1: + url: "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.1.1/main.tar.gz" + sha256: "a9ea899315851bfacdb234b7acc917b1a9c67593f0d68e1920321a8f6fa2cfbf" + 0.1.0: + url: "https://github.com/foxglove/mcap/archive/refs/tags/releases/cpp/v0.1.0/main.tar.gz" + sha256: "a936abb1493b0d189d7909a79c45bdc6703b6016801e10b5cd129ba39642d2b2" diff --git a/recipes/mcap/all/conanfile.py b/recipes/mcap/all/conanfile.py index 07e6eeb817206..328d64781c0d0 100644 --- a/recipes/mcap/all/conanfile.py +++ b/recipes/mcap/all/conanfile.py @@ -1,53 +1,79 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.52.0" class McapConan(ConanFile): name = "mcap" + description = ( + "MCAP is a modular, performant, and serialization-agnostic container file format for pub/sub messages, " + "primarily intended for use in robotics applications." + ) + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/foxglove/mcap" - description = "A C++ implementation of the MCAP file format" - license = "Apache-2.0" - topics = ("mcap", "serialization", "deserialization", "recording") + topics = ("serialization", "deserialization", "recording", "header-only") + settings = "os", "arch", "compiler", "build_type" - settings = ("os", "compiler", "build_type", "arch") - generators = ("cmake", "cmake_find_package") + @property + def _min_cppstd(self): + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "191", + "gcc": "9", + "clang": "9", + "apple-clang": "12", + } @property def _source_package_path(self): - return os.path.join(self._source_subfolder, "cpp", "mcap") + return os.path.join(self.source_folder, "cpp", "mcap") - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + def configure(self): + if Version(self.version) < "0.3.0": + self.license = "Apache-2.0" + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("lz4/1.9.3") + self.requires("lz4/1.9.4") self.requires("zstd/1.5.2") - if tools.Version(self.version) < "0.1.1": - self.requires("fmt/8.1.1") + if Version(self.version) < "0.1.1": + self.requires("fmt/9.1.0") + + def package_id(self): + self.info.clear() def validate(self): + if Version(self.version) < "0.1.1" and is_msvc(self): + raise ConanInvalidConfiguration("Visual Studio compiler has been supported since 0.1.1") + if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - if self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) <= 11: - raise ConanInvalidConfiguration("Compiler version is not supported, c++17 support is required") - if (self.settings.compiler == "gcc" or self.settings.compiler == "clang") and tools.Version(self.settings.compiler.version) <= 8: - raise ConanInvalidConfiguration("Compiler version is not supported, c++17 support is required") - if tools.Version(self.version) < "0.1.1" and self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("Visual Studio compiler support is added in 0.1.1") - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < 16: - raise ConanInvalidConfiguration("Compiler version is not supported, c++17 support is required") + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_package_path) - self.copy("include/*", src=self._source_package_path) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self._source_package_path) + copy(self, "*", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._source_package_path, "include")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/mcap/all/test_package/CMakeLists.txt b/recipes/mcap/all/test_package/CMakeLists.txt index 6ce93b65ccf57..fa5c6d575b8ef 100644 --- a/recipes/mcap/all/test_package/CMakeLists.txt +++ b/recipes/mcap/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(mcap REQUIRED CONFIG) -add_executable(test_package test_package.cpp) -set_target_properties(test_package PROPERTIES CXX_STANDARD 17 CXX_STANDARD_REQUIRED ON) -target_link_libraries(test_package mcap::mcap) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mcap::mcap) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/mcap/all/test_package/conanfile.py b/recipes/mcap/all/test_package/conanfile.py index 005eae16e0474..14c16cdc02a92 100644 --- a/recipes/mcap/all/test_package/conanfile.py +++ b/recipes/mcap/all/test_package/conanfile.py @@ -1,10 +1,15 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = ("os", "arch", "compiler", "build_type") - generators = ("cmake", "cmake_find_package_multi") + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +17,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mcap/all/test_v1_package/CMakeLists.txt b/recipes/mcap/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/mcap/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mcap/all/test_v1_package/conanfile.py b/recipes/mcap/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/mcap/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mcap/config.yml b/recipes/mcap/config.yml index 06a637acf5c81..72a0eda7e1def 100644 --- a/recipes/mcap/config.yml +++ b/recipes/mcap/config.yml @@ -1,7 +1,15 @@ versions: - 0.1.0: + 0.9.0: folder: all - 0.1.1: + 0.5.0: + folder: all + 0.4.0: + folder: all + 0.3.0: folder: all 0.1.2: folder: all + 0.1.1: + folder: all + 0.1.0: + folder: all diff --git a/recipes/md4c/all/CMakeLists.txt b/recipes/md4c/all/CMakeLists.txt deleted file mode 100644 index 1632809b71a7a..0000000000000 --- a/recipes/md4c/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/md4c/all/conandata.yml b/recipes/md4c/all/conandata.yml index 32ec845b1785b..013088e384ddf 100644 --- a/recipes/md4c/all/conandata.yml +++ b/recipes/md4c/all/conandata.yml @@ -2,8 +2,7 @@ sources: "0.4.8": url: "https://github.com/mity/md4c/archive/refs/tags/release-0.4.8.tar.gz" sha256: "4a457df853425b6bb6e3457aa1d1a13bccec587a04c38c622b1013a0da41439f" - patches: "0.4.8": - - base_path: "source_subfolder" - patch_file: "patches/0.4.8-0001-remove-unused-files.patch" + - patch_file: "patches/0001-honor-vc-runtime.patch" + patch_description: "Honor msvc runtime from profile" diff --git a/recipes/md4c/all/conanfile.py b/recipes/md4c/all/conanfile.py index 3b0624afabb2a..4b5bb25a31a26 100644 --- a/recipes/md4c/all/conanfile.py +++ b/recipes/md4c/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir + import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" + class Md4cConan(ConanFile): name = "md4c" @@ -22,16 +26,9 @@ class Md4cConan(ConanFile): "fPIC": True, "encoding": "utf-8", } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,45 +36,90 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.os != "Windows" and self.options.encoding == "utf-16": - raise tools.ConanInvalidConfiguration("utf-16 options is not supported on non-Windows platforms") + if self.info.settings.os != "Windows" and self.info.options.encoding == "utf-16": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support utf-16 options on non-Windows platforms") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - - if self.options.encoding == "utf-16": - cmake.definitions["CONAN_C_FLAGS"] = "-DMD4C_USE_UTF16" + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if self.options.encoding == "utf-8": + tc.preprocessor_definitions["MD4C_USE_UTF8"] = "1" + elif self.options.encoding == "utf-16": + tc.preprocessor_definitions["MD4C_USE_UTF16"] = "1" elif self.options.encoding == "ascii": - cmake.definitions["CONAN_C_FLAGS"] = "-DMD4C_USE_ASCII" - - cmake.configure() - return cmake + tc.preprocessor_definitions["MD4C_USE_ASCII"] = "1" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # Honor encoding option + replace_in_file( + self, + os.path.join(self.source_folder, "src", "CMakeLists.txt"), + "COMPILE_FLAGS \"-DMD4C_USE_UTF8\"", + "", + ) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE.md", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.libs = ["md4c", "md4c-html",] - - if self.options.encoding == "utf-16": - self.cpp_info.defines.append("MD4C_USE_UTF16") + self.cpp_info.set_property("cmake_file_name", "md4c") + + self.cpp_info.components["_md4c"].set_property("cmake_target_name", "md4c::md4c") + self.cpp_info.components["_md4c"].set_property("pkg_config_name", "md4c") + self.cpp_info.components["_md4c"].libs = ["md4c"] + if self.settings.os == "Windows" and self.options.encoding == "utf-16": + self.cpp_info.components["_md4c"].defines.append("MD4C_USE_UTF16") + + self.cpp_info.components["md4c_html"].set_property("cmake_target_name", "md4c::md4c-html") + self.cpp_info.components["md4c_html"].set_property("pkg_config_name", "md4c-html") + self.cpp_info.components["md4c_html"].libs = ["md4c-html"] + self.cpp_info.components["md4c_html"].requires = ["_md4c"] + + # workaround so that global target & pkgconfig file have all components while avoiding + # to create unofficial target or pkgconfig file + self.cpp_info.set_property("cmake_target_name", "md4c::md4c-html") + self.cpp_info.set_property("pkg_config_name", "md4c-html") + + # TODO: to remove in conan v2 + self.cpp_info.components["_md4c"].names["cmake_find_package"] = "md4c" + self.cpp_info.components["_md4c"].names["cmake_find_package_multi"] = "md4c" + self.cpp_info.components["md4c_html"].names["cmake_find_package"] = "md4c-html" + self.cpp_info.components["md4c_html"].names["cmake_find_package_multi"] = "md4c-html" + bin_path = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH environment variable: {bin_path}") + self.env_info.PATH.append(bin_path) diff --git a/recipes/md4c/all/patches/0.4.8-0001-remove-unused-files.patch b/recipes/md4c/all/patches/0.4.8-0001-remove-unused-files.patch deleted file mode 100644 index 899960abf53f6..0000000000000 --- a/recipes/md4c/all/patches/0.4.8-0001-remove-unused-files.patch +++ /dev/null @@ -1,29 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 57e353f..ed62385 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -56,4 +56,3 @@ endif() - include(GNUInstallDirs) - - add_subdirectory(src) --add_subdirectory(md2html) -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 66f2f50..891abb9 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -40,7 +40,6 @@ install( - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - ) --install(FILES ${CMAKE_BINARY_DIR}/src/md4c.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) - - install( - TARGETS md4c-html -@@ -50,7 +49,6 @@ install( - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} - ) --install(FILES ${CMAKE_BINARY_DIR}/src/md4c-html.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) - - install(EXPORT md4cConfig DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/md4c/ NAMESPACE md4c::) - diff --git a/recipes/md4c/all/patches/0001-honor-vc-runtime.patch b/recipes/md4c/all/patches/0001-honor-vc-runtime.patch new file mode 100644 index 0000000000000..a20b07a134764 --- /dev/null +++ b/recipes/md4c/all/patches/0001-honor-vc-runtime.patch @@ -0,0 +1,18 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -42,15 +42,6 @@ elseif(MSVC) + # Disable warnings about the so-called unsecured functions: + add_definitions(/D_CRT_SECURE_NO_WARNINGS) + +- # Specify proper C runtime library: +- string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}") +- string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}") +- string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_RELWITHDEBINFO "{$CMAKE_C_FLAGS_RELWITHDEBINFO}") +- string(REGEX REPLACE "/M[DT]d?" "" CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}") +- set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} /MTd") +- set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} /MT") +- set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELEASE} /MT") +- set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_RELEASE} /MT") + endif() + + include(GNUInstallDirs) diff --git a/recipes/md4c/all/test_package/CMakeLists.txt b/recipes/md4c/all/test_package/CMakeLists.txt index c11ad83370d6c..dd82268d730c4 100644 --- a/recipes/md4c/all/test_package/CMakeLists.txt +++ b/recipes/md4c/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest C) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package C) find_package(md4c CONFIG REQUIRED) -add_executable(test_package test_package.c) -target_link_libraries(test_package md4c::md4c) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(test_package PRIVATE md4c::md4c) diff --git a/recipes/md4c/all/test_package/conanfile.py b/recipes/md4c/all/test_package/conanfile.py index 609b243f149ba..a9fb96656f203 100644 --- a/recipes/md4c/all/test_package/conanfile.py +++ b/recipes/md4c/all/test_package/conanfile.py @@ -1,9 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools -class Md4cTestConan(ConanFile): + +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/md4c/all/test_v1_package/CMakeLists.txt b/recipes/md4c/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a7e30d5cc2c2d --- /dev/null +++ b/recipes/md4c/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(md4c CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE md4c::md4c) diff --git a/recipes/md4c/all/test_v1_package/conanfile.py b/recipes/md4c/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/md4c/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/md4qt/all/conandata.yml b/recipes/md4qt/all/conandata.yml new file mode 100644 index 0000000000000..3d8d45af50a23 --- /dev/null +++ b/recipes/md4qt/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "2.0.4": + url: "https://github.com/igormironchik/md4qt/archive/refs/tags/2.0.4.tar.gz" + sha256: "2980a0d0b5d3539a5a1402942a1345e97c8ab36acfc8e00d932df157d2e6edc2" + "2.0.3": + url: "https://github.com/igormironchik/md4qt/archive/refs/tags/2.0.3.tar.gz" + sha256: "374bfc74aa6ebb1ea7d2332b96f8b2f6001118793bbe4e55109a13d0ffe7ce55" + "2.0.2": + url: "https://github.com/igormironchik/md4qt/archive/refs/tags/2.0.2.tar.gz" + sha256: "721c7e5f8676dba1023931b9e2fd0d22cbc643bc9864c1d1163df3c5615e7e96" + "2.0.1": + url: "https://github.com/igormironchik/md4qt/archive/refs/tags/2.0.1.tar.gz" + sha256: "879f069cd12db44f2fcc33590ded1f9d778f4c854be14a7ad72fb2ff4acdb3d2" + "2.0.0": + url: "https://github.com/igormironchik/md4qt/archive/refs/tags/2.0.0.tar.gz" + sha256: "3c834c4d832208658f042bd85a821c297fafd0f2eedda9d6ddddced7b724f61a" diff --git a/recipes/md4qt/all/conanfile.py b/recipes/md4qt/all/conanfile.py new file mode 100644 index 0000000000000..ce75e30212e5e --- /dev/null +++ b/recipes/md4qt/all/conanfile.py @@ -0,0 +1,72 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.50.0" + + +class Md4QtConan(ConanFile): + name = "md4qt" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/igormironchik/md4qt" + license = "MIT" + description = "Header-only C++ library for parsing Markdown." + topics = ("markdown", "gfm", "parser", "icu", "ast", "commonmark", "md", "qt6", "stl", "cpp17") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return "17" + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "191", + "gcc": "9", + "clang": "12", + "apple-clang": "14", + } + + def package_id(self): + self.info.clear() + + def requirements(self): + self.requires("icu/72.1") + self.requires("uriparser/0.9.7") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + def layout(self): + basic_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "md4qt"), dst=os.path.join(self.package_folder, "include", "md4qt")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "md4qt") + self.cpp_info.set_property("cmake_target_name", "md4qt::md4qt") + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/md4qt/all/test_package/CMakeLists.txt b/recipes/md4qt/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3c95a973f47fa --- /dev/null +++ b/recipes/md4qt/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(md4qt REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE md4qt::md4qt) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/md4qt/all/test_package/conanfile.py b/recipes/md4qt/all/test_package/conanfile.py new file mode 100644 index 0000000000000..c78095722f7aa --- /dev/null +++ b/recipes/md4qt/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + md_path = os.path.join(self.source_folder, "test.md") + self.run("{} \"{}\"".format(bin_path, md_path), env="conanrun") diff --git a/recipes/md4qt/all/test_package/test.md b/recipes/md4qt/all/test_package/test.md new file mode 100644 index 0000000000000..3de705a41ff24 --- /dev/null +++ b/recipes/md4qt/all/test_package/test.md @@ -0,0 +1 @@ +Text diff --git a/recipes/md4qt/all/test_package/test_package.cpp b/recipes/md4qt/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..e1265d68ef6a6 --- /dev/null +++ b/recipes/md4qt/all/test_package/test_package.cpp @@ -0,0 +1,30 @@ +#define MD4QT_ICU_STL_SUPPORT +#include + +#include +#include +#include +#include +#include + +int main(int argc, char ** argv) +{ + if (argc < 2) { + std::cerr << "Need an argument\n"; + return 1; + } + + MD::Parser< MD::UnicodeStringTrait > parser; + + const auto doc = parser.parse(MD::UnicodeString(argv[1])); + + auto path = std::filesystem::canonical(std::filesystem::path(argv[1], + std::filesystem::path::generic_format)).u8string(); + std::replace( path.begin(), path.end(), '\\', '/' ); + + if(std::static_pointer_cast>(doc->items().at(0))->label() == + MD::UnicodeString(path)) + return 0; + else + return 1; +} diff --git a/recipes/md4qt/all/test_v1_package/CMakeLists.txt b/recipes/md4qt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b24e1b03fbf83 --- /dev/null +++ b/recipes/md4qt/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(md4qt REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE md4qt::md4qt) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/md4qt/all/test_v1_package/conanfile.py b/recipes/md4qt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..df702b6f48d7c --- /dev/null +++ b/recipes/md4qt/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + md_path = os.path.join(self.source_folder, os.pardir, "test_package", "test.md") + self.run("{} \"{}\"".format(bin_path, md_path), run_environment=True) diff --git a/recipes/md4qt/config.yml b/recipes/md4qt/config.yml new file mode 100644 index 0000000000000..e588fe3f46fb3 --- /dev/null +++ b/recipes/md4qt/config.yml @@ -0,0 +1,11 @@ +versions: + "2.0.4": + folder: all + "2.0.3": + folder: all + "2.0.2": + folder: all + "2.0.1": + folder: all + "2.0.0": + folder: all diff --git a/recipes/mdnsresponder/all/conandata.yml b/recipes/mdnsresponder/all/conandata.yml index 9a6a9bb85cd92..cadda75d51e61 100644 --- a/recipes/mdnsresponder/all/conandata.yml +++ b/recipes/mdnsresponder/all/conandata.yml @@ -1,10 +1,10 @@ sources: "878.200.35": - url: "https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-878.200.35.tar.gz" - sha256: "e777b4d7dbf5eb1552cb80090ad1ede319067ab6e45e3990d68aabf6e8b3f5a0" + url: "https://github.com/apple-oss-distributions/mDNSResponder/archive/mDNSResponder-878.200.35.tar.gz" + sha256: "71769924286328a3c405700856c9897c5277360b2f9fd0f450440304d315f6c1" "1310.140.1": - sha256: "040f6495c18b9f0557bcf9e00cbcfc82b03405f5ba6963dc147730ca0ca90d6f" - url: "https://opensource.apple.com/tarballs/mDNSResponder/mDNSResponder-1310.140.1.tar.gz" + url: "https://github.com/apple-oss-distributions/mDNSResponder/archive/mDNSResponder-1310.140.1.tar.gz" + sha256: "ecb0043ffc5a3cbf4f43da0298e351d787654d980b291d1cb567c6ddee9dc983" patches: "878.200.35": - base_path: "source_subfolder" diff --git a/recipes/meshoptimizer/all/CMakeLists.txt b/recipes/meshoptimizer/all/CMakeLists.txt deleted file mode 100644 index a60992e8dd75d..0000000000000 --- a/recipes/meshoptimizer/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") - -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/meshoptimizer/all/conandata.yml b/recipes/meshoptimizer/all/conandata.yml index 3780c1e85f5f8..1132907df3841 100644 --- a/recipes/meshoptimizer/all/conandata.yml +++ b/recipes/meshoptimizer/all/conandata.yml @@ -14,4 +14,3 @@ sources: patches: "0.14": - patch_file: "patches/0.14/0001-fix-build-on-old-AppleClang-versions.patch" - base_path: "source_subfolder" diff --git a/recipes/meshoptimizer/all/conanfile.py b/recipes/meshoptimizer/all/conanfile.py index f20253e331a79..38ff3a5d86908 100644 --- a/recipes/meshoptimizer/all/conanfile.py +++ b/recipes/meshoptimizer/all/conanfile.py @@ -1,20 +1,21 @@ +from conan import ConanFile +from conan.tools.build import stdcpp_library +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir import os -import glob -from conans import ConanFile, CMake, tools - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class MeshOptimizerConan(ConanFile): name = "meshoptimizer" - description = " Mesh optimization library that makes meshes smaller and faster to render" - topics = ("conan", "mesh", "optimizer", "3d") + description = "Mesh optimization library that makes meshes smaller and faster to render" + topics = ("mesh", "optimizer", "3d") homepage = "https://github.com/zeux/meshoptimizer" url = "https://github.com/conan-io/conan-center-index" license = "MIT" - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" + + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,60 +26,55 @@ class MeshOptimizerConan(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): - if self.settings.os == 'Windows': + if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def layout(self): + cmake_layout(self, src_folder="src") - def _configure_cmake(self): - if self._cmake: - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) - self._cmake = CMake(self) - self._cmake.definitions["MESHOPT_BUILD_SHARED_LIBS"] = self.options.shared - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MESHOPT_BUILD_SHARED_LIBS"] = self.options.shared + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # Don't override warning levels for msvc - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "add_compile_options(/W4 /WX)", "") + apply_conandata_patches(self) + # No warnings as errors + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "add_compile_options(/W4 /WX)", "") + replace_in_file(self, cmakelists, "-Werror", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE.md", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - for f in glob.glob(os.path.join(self.package_folder, "bin", "*.pdb")): - os.remove(f) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - if not self.options.shared and tools.stdcpp_library(self): - self.cpp_info.system_libs.append(tools.stdcpp_library(self)) + self.cpp_info.set_property("cmake_file_name", "meshoptimizer") + self.cpp_info.set_property("cmake_target_name", "meshoptimizer::meshoptimizer") + self.cpp_info.libs = ["meshoptimizer"] + if not self.options.shared: + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) if self.options.shared and self.settings.os == "Windows": self.cpp_info.defines = ["MESHOPTIMIZER_API=__declspec(dllimport)"] diff --git a/recipes/meshoptimizer/all/test_package/CMakeLists.txt b/recipes/meshoptimizer/all/test_package/CMakeLists.txt index 541e7b29f6c39..034ae19a0ca08 100644 --- a/recipes/meshoptimizer/all/test_package/CMakeLists.txt +++ b/recipes/meshoptimizer/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(meshoptimizer REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} meshoptimizer::meshoptimizer) +target_link_libraries(${PROJECT_NAME} PRIVATE meshoptimizer::meshoptimizer) diff --git a/recipes/meshoptimizer/all/test_package/conanfile.py b/recipes/meshoptimizer/all/test_package/conanfile.py index f8eeed898d7bd..0a6bc68712d90 100644 --- a/recipes/meshoptimizer/all/test_package/conanfile.py +++ b/recipes/meshoptimizer/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/meshoptimizer/all/test_v1_package/CMakeLists.txt b/recipes/meshoptimizer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/meshoptimizer/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/meshoptimizer/all/test_v1_package/conanfile.py b/recipes/meshoptimizer/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/meshoptimizer/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/meson/all/conandata.yml b/recipes/meson/all/conandata.yml index 8b3154bd5a7bf..1f58656822bf2 100644 --- a/recipes/meson/all/conandata.yml +++ b/recipes/meson/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "1.0.0": + url: "https://github.com/mesonbuild/meson/releases/download/1.0.0/meson-1.0.0.tar.gz" + sha256: "aa50a4ba4557c25e7d48446abfde857957dcdf58385fffbe670ba0e8efacce05" + "0.64.1": + url: "https://github.com/mesonbuild/meson/archive/0.64.1.tar.gz" + sha256: "1d12a4bc1cf3ab18946d12cf0b6452e5254ada1ad50aacc97f87e2cccd7da315" + "0.64.0": + url: "https://github.com/mesonbuild/meson/archive/0.64.0.tar.gz" + sha256: "6477993d781b6efea93091616a6d6a0766c0e026076dbeb11249bf1c9b49a347" + "0.63.3": + url: "https://github.com/mesonbuild/meson/archive/0.63.3.tar.gz" + sha256: "7c516c2099b762203e8a0a22412aa465b7396e6f9b1ab728bad6e6db44dc2659" "0.63.2": url: "https://github.com/mesonbuild/meson/archive/0.63.2.tar.gz" sha256: "023a3f7c74e68991154c3205a6975705861eedbf8130e013d15faa1df1af216e" diff --git a/recipes/meson/all/conanfile.py b/recipes/meson/all/conanfile.py index dfb05d6d59a9e..e2d65a1b60825 100644 --- a/recipes/meson/all/conanfile.py +++ b/recipes/meson/all/conanfile.py @@ -1,57 +1,38 @@ -from conan import ConanFile -from conan.tools.files import copy, get, rmdir, save -from conan.tools.layout import basic_layout import os import textwrap -required_conan_version = ">=1.50.0" +from conan import ConanFile, conan_version +from conan.tools.files import copy, get, rmdir, save +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.52.0" class MesonConan(ConanFile): name = "meson" + package_type = "application" description = "Meson is a project to create the best possible next-generation build system" topics = ("meson", "mesonbuild", "build-system") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mesonbuild/meson" license = "Apache-2.0" - settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("ninja/1.11.0") + if self.conf.get("tools.meson.mesontoolchain:backend", default="ninja", check_type=str) == "ninja": + self.requires("ninja/1.11.1") def package_id(self): self.info.clear() - def layout(self): - basic_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - # FIXME: https://github.com/conan-io/conan/issues/10726 - def _fix_symlinks(root, files): - if not self._settings_build.os == "Windows": - return - for filename in files: - filename = os.path.join(root, filename) - if os.path.islink(filename): - target = os.readlink(filename) - if "/" in target: - self.output.info(f"fixing broken link {target}") - target = target.replace("/", "\\") - os.unlink(filename) - os.symlink(target, filename) - - for root, dirs, files in os.walk(self.source_folder): - _fix_symlinks(root, dirs) - _fix_symlinks(root, files) - def build(self): pass @@ -78,15 +59,13 @@ def _chmod_plus_x(filename): def package_info(self): meson_root = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {meson_root}") - self.env_info.PATH.append(meson_root) - self._chmod_plus_x(os.path.join(meson_root, "meson")) self._chmod_plus_x(os.path.join(meson_root, "meson.py")) self.cpp_info.builddirs = [os.path.join("bin", "mesonbuild", "cmake", "data")] - self.cpp_info.frameworkdirs = [] self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] + + if Version(conan_version).major < 2: + self.env_info.PATH.append(meson_root) diff --git a/recipes/meson/all/test_package/conanfile.py b/recipes/meson/all/test_package/conanfile.py index 946c63a8024cb..19ffe682ab919 100644 --- a/recipes/meson/all/test_package/conanfile.py +++ b/recipes/meson/all/test_package/conanfile.py @@ -1,8 +1,9 @@ +import os + from conan import ConanFile from conan.tools.build import can_run from conan.tools.layout import basic_layout from conan.tools.meson import Meson -import os class TestPackageConan(ConanFile): diff --git a/recipes/meson/config.yml b/recipes/meson/config.yml index 07ee0c49f572f..b08dc9001574f 100644 --- a/recipes/meson/config.yml +++ b/recipes/meson/config.yml @@ -1,4 +1,12 @@ versions: + "1.0.0": + folder: all + "0.64.1": + folder: all + "0.64.0": + folder: all + "0.63.3": + folder: all "0.63.2": folder: all "0.63.1": diff --git a/recipes/metall/all/conandata.yml b/recipes/metall/all/conandata.yml index f12b53c6a50f6..788ef5da15507 100644 --- a/recipes/metall/all/conandata.yml +++ b/recipes/metall/all/conandata.yml @@ -5,3 +5,6 @@ sources: "0.20": url: "https://github.com/LLNL/metall/archive/refs/tags/v0.20.tar.gz" sha256: "cafe54c682004a66a059f54e2d7128ea7622e9941ea492297d04c260675e9af4" + "0.23.1": + url: "https://github.com/LLNL/metall/archive/refs/tags/v0.23.1.tar.gz" + sha256: "25e8fbc424e66d09e0faf60029288e4612685675bfd947cc142bd9d6d0645ac4" diff --git a/recipes/metall/all/test_v1_package/conanfile.py b/recipes/metall/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/metall/all/test_v1_package/conanfile.py +++ b/recipes/metall/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/metall/config.yml b/recipes/metall/config.yml index 77eec165d7918..e3fb6e5067c49 100644 --- a/recipes/metall/config.yml +++ b/recipes/metall/config.yml @@ -3,3 +3,5 @@ versions: folder: all "0.20": folder: all + "0.23.1": + folder: all diff --git a/recipes/mfast/all/CMakeLists.txt b/recipes/mfast/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/mfast/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/mfast/all/conandata.yml b/recipes/mfast/all/conandata.yml index 6864deb0bd015..05805bbb6d14e 100644 --- a/recipes/mfast/all/conandata.yml +++ b/recipes/mfast/all/conandata.yml @@ -8,11 +8,7 @@ sources: patches: "1.2.2": - patch_file: "patches/0001-fix-cmake-1.2.2.patch" - base_path: "source_subfolder" "1.2.1": - patch_file: "patches/0001-fix-cmake-1.2.1.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-remove-deprecated-boost-detail-endian.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-mfast-sqlite3.patch" - base_path: "source_subfolder" diff --git a/recipes/mfast/all/conanfile.py b/recipes/mfast/all/conanfile.py index c23447275579e..41c45b6db58d8 100644 --- a/recipes/mfast/all/conanfile.py +++ b/recipes/mfast/all/conanfile.py @@ -1,10 +1,16 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd, valid_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import ( + apply_conandata_patches, copy, export_conandata_patches, get, load, mkdir, + rename, rm, rmdir, save +) +from conan.tools.scm import Version import os -import shutil import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class mFASTConan(ConanFile): @@ -16,7 +22,7 @@ class mFASTConan(ConanFile): "mFAST is a high performance C++ encoding/decoding library for FAST " "(FIX Adapted for STreaming) protocol" ) - topics = ("mfast", "fast", "fix", "fix-adapted-for-streaming", + topics = ("fast", "fix", "fix-adapted-for-streaming", "financial-information-exchange", "libraries", "cpp") settings = "os", "arch", "compiler", "build_type" @@ -32,30 +38,26 @@ class mFASTConan(ConanFile): } short_paths = True - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return "14" if Version(self.version) >= "1.2.2" else "98" @property def _compilers_minimum_version(self): - return { - "gcc": "6", - "Visual Studio": "14", - "clang": "3.4", - "apple-clang": "5.1", - } + if Version(self.version) >= "1.2.2": + return { + "gcc": "6", + "Visual Studio": "14", + "msvc": "190", + "clang": "3.4", + "apple-clang": "5.1", + } + else: + return {} def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -63,68 +65,66 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("boost/1.75.0") self.requires("tinyxml2/9.0.0") if self.options.with_sqlite3: - self.requires("sqlite3/3.37.2") + self.requires("sqlite3/3.40.1") def validate(self): - if tools.Version(self.version) >= "1.2.2": - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) - - def lazy_lt_semver(v1, v2): - lv1 = [int(v) for v in v1.split(".")] - lv2 = [int(v) for v in v2.split(".")] - min_length = min(len(lv1), len(lv2)) - return lv1[:min_length] < lv2[:min_length] - - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if minimum_version and lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration( - "mfast {} requires C++14, which your compiler does not support.".format(self.version) - ) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_PACKAGES"] = False - self._cmake.definitions["BUILD_SQLITE3"] = self.options.with_sqlite3 - if tools.Version(self.version) >= "1.2.2" and not tools.valid_min_cppstd(self, 14): - self._cmake.definitions["CMAKE_CXX_STANDARD"] = 14 - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_PACKAGES"] = False + tc.variables["BUILD_SQLITE3"] = self.options.with_sqlite3 + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "licence.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("licence.txt", dst="licenses", src=self._source_subfolder) - - tools.mkdir(os.path.join(self.package_folder, self._new_mfast_config_dir)) + mkdir(self, os.path.join(self.package_folder, self._new_mfast_config_dir)) self._extract_fasttypegentarget_macro() - - tools.rmdir(os.path.join(self.package_folder, self._old_mfast_config_dir)) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, self._old_mfast_config_dir)) + rmdir(self, os.path.join(self.package_folder, "share")) if self.options.shared: - tools.remove_files_by_mask( - os.path.join(self.package_folder, "lib"), - "*_static*" if self.settings.os == "Windows" else "*.a" - ) + rm(self, "*_static*" if self.settings.os == "Windows" else "*.a", os.path.join(self.package_folder, "lib")) # TODO: several CMake variables should also be emulated (casing issues): # [ ] MFAST_INCLUDE_DIR - include directories for mFAST @@ -154,17 +154,15 @@ def _fast_type_gen_target_file(self): return os.path.join(self._new_mfast_config_dir, "FastTypeGenTarget.cmake") def _extract_fasttypegentarget_macro(self): - if tools.Version(self.version) < "1.2.2": - config_file_content = tools.load(os.path.join(self.package_folder, self._old_mfast_config_dir, "mFASTConfig.cmake")) + if Version(self.version) < "1.2.2": + config_file_content = load(self, os.path.join(self.package_folder, self._old_mfast_config_dir, "mFASTConfig.cmake")) begin = config_file_content.find("macro(FASTTYPEGEN_TARGET Name)") end = config_file_content.find("endmacro()", begin) + len("endmacro()") macro_str = config_file_content[begin:end] - tools.save(os.path.join(self.package_folder, self._fast_type_gen_target_file), macro_str) + save(self, os.path.join(self.package_folder, self._fast_type_gen_target_file), macro_str) else: - shutil.move( - os.path.join(self.package_folder, self._old_mfast_config_dir, "FastTypeGenTarget.cmake"), - os.path.join(self.package_folder, self._fast_type_gen_target_file) - ) + rename(self, os.path.join(self.package_folder, self._old_mfast_config_dir, "FastTypeGenTarget.cmake"), + os.path.join(self.package_folder, self._fast_type_gen_target_file)) def _prepend_exec_target_in_fasttypegentarget(self): extension = ".exe" if self.settings.os == "Windows" else "" @@ -184,26 +182,24 @@ def _prepend_exec_target_in_fasttypegentarget(self): endif() """.format(fast_type_rel_path=fast_type_rel_path)) module_abs_path = os.path.join(self.package_folder, self._fast_type_gen_target_file) - old_content = tools.load(module_abs_path) + old_content = load(self, module_abs_path) new_content = exec_target_content + old_content - tools.save(module_abs_path, new_content) + save(self, module_abs_path, new_content) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _lib_targets_module_file(self): - return os.path.join(self._new_mfast_config_dir, - "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join(self._new_mfast_config_dir, f"conan-official-{self.name}-targets.cmake") @property def _mfast_lib_components(self): @@ -255,10 +251,12 @@ def package_info(self): comp = values["comp"] lib = values["lib"] requires = values["requires"] - self.cpp_info.components[conan_comp].set_property("cmake_file_name", target) + self.cpp_info.components[conan_comp].set_property("cmake_target_name", target) if comp != target: # Also provide alias component for find_package(mFAST COMPONENTS ...) if static self.cpp_info.components[conan_comp].set_property("cmake_target_aliases", [comp]) + if self.settings.os in ("FreeBSD", "Linux"): + self.cpp_info.components[conan_comp].system_libs.append("m") self.cpp_info.components[conan_comp].libs = [lib] self.cpp_info.components[conan_comp].requires = requires if self.options.shared: @@ -278,9 +276,7 @@ def package_info(self): self.cpp_info.components[conan_comp_alias].requires = [conan_comp] self.cpp_info.components[conan_comp_alias].includedirs = [] self.cpp_info.components[conan_comp_alias].libdirs = [] - self.cpp_info.components[conan_comp_alias].resdirs = [] self.cpp_info.components[conan_comp_alias].bindirs = [] - self.cpp_info.components[conan_comp_alias].frameworkdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "mFAST" diff --git a/recipes/mfast/all/test_package/CMakeLists.txt b/recipes/mfast/all/test_package/CMakeLists.txt index d997066619922..f00b094711581 100644 --- a/recipes/mfast/all/test_package/CMakeLists.txt +++ b/recipes/mfast/all/test_package/CMakeLists.txt @@ -1,16 +1,13 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(mFAST REQUIRED mfast_xml_parser CONFIG) FASTTYPEGEN_TARGET(Test Test.xml) add_executable(${PROJECT_NAME} ${FASTTYPEGEN_Test_OUTPUTS} message_printer.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) if(TARGET mfast_xml_parser_static) - target_link_libraries(${PROJECT_NAME} mfast_xml_parser_static) + target_link_libraries(${PROJECT_NAME} PRIVATE mfast_xml_parser_static) else() - target_link_libraries(${PROJECT_NAME} mfast_xml_parser) + target_link_libraries(${PROJECT_NAME} PRIVATE mfast_xml_parser) endif() diff --git a/recipes/mfast/all/test_package/conanfile.py b/recipes/mfast/all/test_package/conanfile.py index 3aa69bfc84c8f..fecd6e83f0b2f 100644 --- a/recipes/mfast/all/test_package/conanfile.py +++ b/recipes/mfast/all/test_package/conanfile.py @@ -1,14 +1,31 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - if hasattr(self, "settings_build") and tools.cross_building(self): - self.build_requires(str(self.requires["mfast"])) + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires(self.tested_reference_str) + + def generate(self): + VirtualRunEnv(self).generate() + if hasattr(self, "settings_build") and cross_building(self): + VirtualBuildEnv(self).generate() + else: + VirtualRunEnv(self).generate(scope="build") def build(self): cmake = CMake(self) @@ -16,6 +33,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mfast/all/test_v1_package/CMakeLists.txt b/recipes/mfast/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/mfast/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/mfast/all/test_v1_package/conanfile.py b/recipes/mfast/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e08462ea1a998 --- /dev/null +++ b/recipes/mfast/all/test_v1_package/conanfile.py @@ -0,0 +1,26 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + if hasattr(self, "settings_build"): + self.build_requires(self.tested_reference_str) + + def build(self): + with tools.no_op() if hasattr(self, "settings_build") else tools.run_environment(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mgs/all/conandata.yml b/recipes/mgs/all/conandata.yml index c3099b0d8bf72..2d9059f1e4cb3 100644 --- a/recipes/mgs/all/conandata.yml +++ b/recipes/mgs/all/conandata.yml @@ -1,13 +1,16 @@ sources: - 0.1.2: - url: https://github.com/theodelrieu/mgs/releases/download/v0.1.2/mgs.zip - sha256: aba95870eafad95147c969c167a0e7c09b2c749ccafadbdd477de815e3e5bfd3 - 0.1.4: - url: https://github.com/theodelrieu/mgs/releases/download/v0.1.4/mgs.zip - sha256: e247976860a0c8d237caaf62a918627f59d4f8a5b5bb811ab01e7cbecf31d4ce - 0.1.5: - url: https://github.com/theodelrieu/mgs/releases/download/v0.1.5/mgs.zip - sha256: ca00e5d26be18beac9874270c17bddbc4f96cad6d92aab685c9eb4be0e6d7fc7 + 0.2.1: + url: "https://github.com/theodelrieu/mgs/releases/download/v0.2.1/mgs.zip" + sha256: "da4a74d1cdaeb6c32c2097bcbebe21ba912ad84176a89014ac8232885d76bcc7" 0.2.0: - url: https://github.com/theodelrieu/mgs/releases/download/v0.2.0/mgs.zip - sha256: aa057a4096da9451bef1950a3e784350df590f09f6bad0c0ca59ed1874df4a36 + url: "https://github.com/theodelrieu/mgs/releases/download/v0.2.0/mgs.zip" + sha256: "aa057a4096da9451bef1950a3e784350df590f09f6bad0c0ca59ed1874df4a36" + 0.1.5: + url: "https://github.com/theodelrieu/mgs/releases/download/v0.1.5/mgs.zip" + sha256: "ca00e5d26be18beac9874270c17bddbc4f96cad6d92aab685c9eb4be0e6d7fc7" + 0.1.4: + url: "https://github.com/theodelrieu/mgs/releases/download/v0.1.4/mgs.zip" + sha256: "e247976860a0c8d237caaf62a918627f59d4f8a5b5bb811ab01e7cbecf31d4ce" + 0.1.2: + url: "https://github.com/theodelrieu/mgs/releases/download/v0.1.2/mgs.zip" + sha256: "aba95870eafad95147c969c167a0e7c09b2c749ccafadbdd477de815e3e5bfd3" diff --git a/recipes/mgs/all/conanfile.py b/recipes/mgs/all/conanfile.py index 27505433d4c66..a3d503d5b0627 100644 --- a/recipes/mgs/all/conanfile.py +++ b/recipes/mgs/all/conanfile.py @@ -1,49 +1,93 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os +required_conan_version = ">=1.52.0" class MgsConan(ConanFile): name = "mgs" - url = "https://github.com/conan-io/conan-center-index" description = "C++14 codec library" - homepage = "https://theodelrieu.github.io/mgs-docs" license = "MIT" - topics = ("codec", "base64", "base32", "base16") - settings = "compiler" - _source_subfolder = "source_subfolder" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://theodelrieu.github.io/mgs-docs" + topics = ("codec", "base64", "base32", "base16", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 14 @property def _compilers_minimum_version(self): return { "gcc": "5", "Visual Studio": "14", + "msvc": "190", "clang": "3.4", "apple-clang": "3.4", } - def configure(self): + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("mgs requires C++14, which your compiler does not fully support.") + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not fully support.") else: - self.output.warn("mgs requires C++14. Your compiler is unknown. Assuming it supports C++14.") + self.output.warn(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename(self.name, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("*", src=os.path.join(self._source_subfolder, "include"), dst="include") - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - - def package_id(self): - self.info.header_only() + self.copy("*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "mgs") + + self.cpp_info.components["mgs-config"].set_property("cmake_target_name", "mgs::config") + + self.cpp_info.components["mgs-meta"].set_property("cmake_target_name", "mgs::meta") + self.cpp_info.components["mgs-meta"].requires = ["mgs-config"] + + self.cpp_info.components["mgs-exceptions"].set_property("cmake_target_name", "mgs::exceptions") + self.cpp_info.components["mgs-exceptions"].requires = ["mgs-config"] + + self.cpp_info.components["mgs-codecs"].set_property("cmake_target_name", "mgs::codecs") + self.cpp_info.components["mgs-codecs"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions"] + + self.cpp_info.components["mgs-base_n"].set_property("cmake_target_name", "mgs::base_n") + self.cpp_info.components["mgs-base_n"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions", "mgs-codecs"] + + self.cpp_info.components["mgs-base16"].set_property("cmake_target_name", "mgs::base16") + self.cpp_info.components["mgs-base16"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions", "mgs-codecs", "mgs-base_n"] + + self.cpp_info.components["mgs-base32"].set_property("cmake_target_name", "mgs::base32") + self.cpp_info.components["mgs-base32"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions", "mgs-codecs", "mgs-base_n"] + + self.cpp_info.components["mgs-base64"].set_property("cmake_target_name", "mgs::base64") + self.cpp_info.components["mgs-base64"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions", "mgs-codecs", "mgs-base_n"] + + self.cpp_info.components["mgs-base64url"].set_property("cmake_target_name", "mgs::base64url") + self.cpp_info.components["mgs-base64url"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions", "mgs-codecs", "mgs-base_n"] + + self.cpp_info.components["mgs-base32hex"].set_property("cmake_target_name", "mgs::base32hex") + self.cpp_info.components["mgs-base32hex"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions", "mgs-codecs", "mgs-base_n"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "mgs" self.cpp_info.names["cmake_find_package_multi"] = "mgs" @@ -52,36 +96,27 @@ def package_info(self): self.cpp_info.components["mgs-meta"].names["cmake_find_package"] = "meta" self.cpp_info.components["mgs-meta"].names["cmake_find_package"] = "meta" - self.cpp_info.components["mgs-meta"].requires = ["mgs-config"] self.cpp_info.components["mgs-exceptions"].names["cmake_find_package"] = "exceptions" self.cpp_info.components["mgs-exceptions"].names["cmake_find_package_multi"] = "exceptions" - self.cpp_info.components["mgs-exceptions"].requires = ["mgs-config"] self.cpp_info.components["mgs-codecs"].names["cmake_find_package"] = "codecs" self.cpp_info.components["mgs-codecs"].names["cmake_find_package_multi"] = "codecs" - self.cpp_info.components["mgs-codecs"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions"] self.cpp_info.components["mgs-base_n"].names["cmake_find_package"] = "base_n" self.cpp_info.components["mgs-base_n"].names["cmake_find_package_multi"] = "base_n" - self.cpp_info.components["mgs-base_n"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions", "mgs-codecs"] self.cpp_info.components["mgs-base16"].names["cmake_find_package"] = "base16" self.cpp_info.components["mgs-base16"].names["cmake_find_package_multi"] = "base16" - self.cpp_info.components["mgs-base16"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions", "mgs-codecs", "mgs-base_n"] self.cpp_info.components["mgs-base32"].names["cmake_find_package"] = "base32" self.cpp_info.components["mgs-base32"].names["cmake_find_package_multi"] = "base32" - self.cpp_info.components["mgs-base32"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions", "mgs-codecs", "mgs-base_n"] self.cpp_info.components["mgs-base64"].names["cmake_find_package"] = "base64" self.cpp_info.components["mgs-base64"].names["cmake_find_package_multi"] = "base64" - self.cpp_info.components["mgs-base64"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions", "mgs-codecs", "mgs-base_n"] self.cpp_info.components["mgs-base64url"].names["cmake_find_package"] = "base64url" self.cpp_info.components["mgs-base64url"].names["cmake_find_package_multi"] = "base64url" - self.cpp_info.components["mgs-base64url"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions", "mgs-codecs", "mgs-base_n"] self.cpp_info.components["mgs-base32hex"].names["cmake_find_package"] = "base32hex" self.cpp_info.components["mgs-base32hex"].names["cmake_find_package_multi"] = "base32hex" - self.cpp_info.components["mgs-base32hex"].requires = ["mgs-config", "mgs-meta", "mgs-exceptions", "mgs-codecs", "mgs-base_n"] diff --git a/recipes/mgs/all/test_package/CMakeLists.txt b/recipes/mgs/all/test_package/CMakeLists.txt index 58ce474ef215e..2f8ba640718db 100644 --- a/recipes/mgs/all/test_package/CMakeLists.txt +++ b/recipes/mgs/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(mgs REQUIRED base64 CONFIG) -add_executable(example example.cpp) -target_link_libraries(example mgs::base64) -set_property(TARGET example PROPERTY CXX_STANDARD 14) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE mgs::base64) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/mgs/all/test_package/conanfile.py b/recipes/mgs/all/test_package/conanfile.py index 3a882f144ad43..b9d7f11e89dcd 100644 --- a/recipes/mgs/all/test_package/conanfile.py +++ b/recipes/mgs/all/test_package/conanfile.py @@ -1,9 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -class TestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,5 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "example"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mgs/all/test_package/example.cpp b/recipes/mgs/all/test_package/test_package.cpp similarity index 100% rename from recipes/mgs/all/test_package/example.cpp rename to recipes/mgs/all/test_package/test_package.cpp diff --git a/recipes/mgs/all/test_v1_package/CMakeLists.txt b/recipes/mgs/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/mgs/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mgs/all/test_v1_package/conanfile.py b/recipes/mgs/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/mgs/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mgs/config.yml b/recipes/mgs/config.yml index f61776783a322..579a8f87004dc 100644 --- a/recipes/mgs/config.yml +++ b/recipes/mgs/config.yml @@ -1,9 +1,11 @@ versions: - "0.1.2": + "0.2.1": folder: all - "0.1.4": + "0.2.0": folder: all "0.1.5": folder: all - "0.2.0": + "0.1.4": + folder: all + "0.1.2": folder: all diff --git a/recipes/microtar/all/CMakeLists.txt b/recipes/microtar/all/CMakeLists.txt index 8573c8c48a939..ab2ce85f21a44 100644 --- a/recipes/microtar/all/CMakeLists.txt +++ b/recipes/microtar/all/CMakeLists.txt @@ -1,15 +1,18 @@ cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) +project(microtar LANGUAGES C) -include("conanbuildinfo.cmake") -conan_basic_setup() -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +include(GNUInstallDirs) -set(SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/src/microtar.c") -set(HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/src/microtar.h") +add_library(microtar ${MICROTAR_SRC_DIR}/src/microtar.c) +set_target_properties(microtar PROPERTIES + PUBLIC_HEADER "${MICROTAR_SRC_DIR}/src/microtar.h" + WINDOWS_EXPORT_ALL_SYMBOLS ON +) -add_library(microtar ${SOURCES} ${HEADERS}) - -set_target_properties(microtar PROPERTIES PUBLIC_HEADER ${HEADERS}) - -install(TARGETS microtar) +install( + TARGETS microtar + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) diff --git a/recipes/microtar/all/conanfile.py b/recipes/microtar/all/conanfile.py index 177d54d53c604..0cac3914af1fe 100644 --- a/recipes/microtar/all/conanfile.py +++ b/recipes/microtar/all/conanfile.py @@ -1,5 +1,9 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get import os -from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.53.0" class MicrotarConan(ConanFile): @@ -8,52 +12,50 @@ class MicrotarConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/rxi/microtar" description = "A lightweight tar library written in ANSI C" - topics = ("conan", "tar", "archive") - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], - "fPIC": [True, False]} - default_options = {"shared": False, - "fPIC": True} - exports_sources = ["CMakeLists.txt"] - generators = "cmake", - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + topics = ("tar", "archive") - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } - def configure(self): - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + exports_sources = "CMakeLists.txt" def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - def _configure_cmake(self): - if self._cmake: - return self._cmake - cmake = CMake(self) - cmake.configure(build_folder=self._build_subfolder) - self._cmake = cmake - return self._cmake + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MICROTAR_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/microtar/all/test_package/CMakeLists.txt b/recipes/microtar/all/test_package/CMakeLists.txt index 18aaf927051ca..b1c35c594fadb 100644 --- a/recipes/microtar/all/test_package/CMakeLists.txt +++ b/recipes/microtar/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(microtar REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} microtar::microtar) +target_link_libraries(${PROJECT_NAME} PRIVATE microtar::microtar) diff --git a/recipes/microtar/all/test_package/conanfile.py b/recipes/microtar/all/test_package/conanfile.py index 7e2dfe859bb27..0a6bc68712d90 100644 --- a/recipes/microtar/all/test_package/conanfile.py +++ b/recipes/microtar/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/microtar/all/test_v1_package/CMakeLists.txt b/recipes/microtar/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/microtar/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/microtar/all/test_v1_package/conanfile.py b/recipes/microtar/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/microtar/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mikelankamp-fpm/all/conandata.yml b/recipes/mikelankamp-fpm/all/conandata.yml new file mode 100644 index 0000000000000..360fcf6413abc --- /dev/null +++ b/recipes/mikelankamp-fpm/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1.0": + url: "https://github.com/MikeLankamp/fpm/archive/refs/tags/v1.1.0.tar.gz" + sha256: "e34941b4cd1d1f1fbe9ecf39b740cb20b9c272a832f63be27fa24eddf400e51b" diff --git a/recipes/mikelankamp-fpm/all/conanfile.py b/recipes/mikelankamp-fpm/all/conanfile.py new file mode 100644 index 0000000000000..4f1037ea6348f --- /dev/null +++ b/recipes/mikelankamp-fpm/all/conanfile.py @@ -0,0 +1,56 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.52.0" + +class MikeLankampFpmConan(ConanFile): + name = "mikelankamp-fpm" + description = "C++ header-only fixed-point math library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/MikeLankamp/fpm" + topics = ("fixed-point", "math", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 11 + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "fpm") + self.cpp_info.set_property("cmake_target_name", "fpm::fpm") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "fpm" + self.cpp_info.filenames["cmake_find_package_multi"] = "fpm" + self.cpp_info.names["cmake_find_package"] = "fpm" + self.cpp_info.names["cmake_find_package_multi"] = "fpm" diff --git a/recipes/mikelankamp-fpm/all/test_package/CMakeLists.txt b/recipes/mikelankamp-fpm/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..4b78d3f578ec0 --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(fpm REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE fpm::fpm) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/mikelankamp-fpm/all/test_package/conanfile.py b/recipes/mikelankamp-fpm/all/test_package/conanfile.py new file mode 100644 index 0000000000000..48499fa0989d9 --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mikelankamp-fpm/all/test_package/test_package.cpp b/recipes/mikelankamp-fpm/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f57e54c2093e5 --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include +#include + +#include + +int main() { + std::cout << "Please input a number: "; + fpm::fixed_16_16 x; + std::cin >> x; + std::cout << "The cosine of " << x << " radians is: " << cos(x) << std::endl; + + return 0; +} diff --git a/recipes/mikelankamp-fpm/all/test_v1_package/CMakeLists.txt b/recipes/mikelankamp-fpm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mikelankamp-fpm/all/test_v1_package/conanfile.py b/recipes/mikelankamp-fpm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/mikelankamp-fpm/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mikelankamp-fpm/config.yml b/recipes/mikelankamp-fpm/config.yml new file mode 100644 index 0000000000000..b5c0d3cb2d409 --- /dev/null +++ b/recipes/mikelankamp-fpm/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.0": + folder: all diff --git a/recipes/mikktspace/all/CMakeLists.txt b/recipes/mikktspace/all/CMakeLists.txt index 3eb15462a684a..d8848832b7e30 100644 --- a/recipes/mikktspace/all/CMakeLists.txt +++ b/recipes/mikktspace/all/CMakeLists.txt @@ -1,22 +1,20 @@ cmake_minimum_required(VERSION 3.4) -project(mikktspace) +project(mikktspace LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +add_library(mikktspace ${MIKKTSPACE_SRC_DIR}/mikktspace.c) +target_include_directories(mikktspace PUBLIC ${MIKKTSPACE_SRC_DIR}) +set_target_properties(mikktspace PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_library(mikktspace ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/mikktspace.c) -target_include_directories(mikktspace PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) -if(CMAKE_HOST_SYSTEM_NAME MATCHES "Linux") +include(CheckFunctionExists) +check_function_exists(pow HAVE_MATH_SYSTEM) +if(NOT HAVE_MATH_SYSTEM) target_link_libraries(mikktspace PRIVATE m) endif() +include(GNUInstallDirs) install(TARGETS mikktspace RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ) -install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/mikktspace.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(FILES ${MIKKTSPACE_SRC_DIR}/mikktspace.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/mikktspace/all/conanfile.py b/recipes/mikktspace/all/conanfile.py index 13838e6596dd4..ebe053f1cb1f9 100644 --- a/recipes/mikktspace/all/conanfile.py +++ b/recipes/mikktspace/all/conanfile.py @@ -1,6 +1,9 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import get, save import os -import glob -from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.53.0" class MikkTSpaceConan(ConanFile): @@ -9,31 +12,19 @@ class MikkTSpaceConan(ConanFile): homepage = "https://github.com/mmikk/MikkTSpace" url = "https://github.com/conan-io/conan-center-index" license = "Zlib" - topics = ("conan", "tangent", "space", "normal") + topics = ("tangent", "space", "normal") settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False], "shared": [True, False], + "fPIC": [True, False], } default_options = { + "shared": False, "fPIC": True, - "shared": False } - generators = "cmake" - exports_sources = ['CMakeLists.txt'] - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob('MikkTSpace-*/')[0] - os.rename(extracted_dir, self._source_subfolder) + exports_sources = "CMakeLists.txt" def config_options(self): if self.settings.os == "Windows": @@ -41,35 +32,41 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MIKKTSPACE_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() @property def _extracted_license(self): - content_lines = open(os.path.join(self.source_folder, self._source_subfolder, "mikktspace.h")).readlines() + content_lines = open(os.path.join(self.source_folder, "mikktspace.h")).readlines() license_content = [] for i in range(4, 21): license_content.append(content_lines[i][4:-1]) return "\n".join(license_content) def package(self): - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), self._extracted_license) - cmake = self._configure_cmake() + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extracted_license) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["mikktspace"] - if self.settings.os == "Linux": + if not self.options.shared and self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/mikktspace/all/test_package/CMakeLists.txt b/recipes/mikktspace/all/test_package/CMakeLists.txt index bbb1d4b048d19..e098a7e87ec40 100644 --- a/recipes/mikktspace/all/test_package/CMakeLists.txt +++ b/recipes/mikktspace/all/test_package/CMakeLists.txt @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) +find_package(mikktspace REQUIRED CONFIG) +add_executable(${CMAKE_PROJECT_NAME} test_package.c) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE mikktspace::mikktspace) diff --git a/recipes/mikktspace/all/test_package/conanfile.py b/recipes/mikktspace/all/test_package/conanfile.py index ffc9be1e577c3..0a6bc68712d90 100644 --- a/recipes/mikktspace/all/test_package/conanfile.py +++ b/recipes/mikktspace/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake_find_package", "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mikktspace/all/test_package/test_package.c b/recipes/mikktspace/all/test_package/test_package.c new file mode 100644 index 0000000000000..b1fe82cf21c2a --- /dev/null +++ b/recipes/mikktspace/all/test_package/test_package.c @@ -0,0 +1,20 @@ +#include +#include + +static int GetNumFaces(const SMikkTSpaceContext *pContext) +{ + return 0; +} + +int main() +{ + SMikkTSpaceInterface sInterface = {NULL}; + sInterface.m_getNumFaces = GetNumFaces; + + SMikkTSpaceContext sContext = {NULL}; + sContext.m_pInterface = &sInterface; + + genTangSpaceDefault(&sContext); + + return 0; +} diff --git a/recipes/mikktspace/all/test_package/test_package.cpp b/recipes/mikktspace/all/test_package/test_package.cpp deleted file mode 100644 index 8e159e04557a6..0000000000000 --- a/recipes/mikktspace/all/test_package/test_package.cpp +++ /dev/null @@ -1,26 +0,0 @@ -#include -#include -#include -#include -#include -#include - -#include - -static int GetNumFaces(const SMikkTSpaceContext *pContext) -{ - return 0; -} - -int main() -{ - SMikkTSpaceInterface sInterface = {NULL}; - sInterface.m_getNumFaces = GetNumFaces; - - SMikkTSpaceContext sContext = {NULL}; - sContext.m_pInterface = &sInterface; - - genTangSpaceDefault(&sContext); - - return 0; -} diff --git a/recipes/mikktspace/all/test_v1_package/CMakeLists.txt b/recipes/mikktspace/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/mikktspace/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/mikktspace/all/test_v1_package/conanfile.py b/recipes/mikktspace/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/mikktspace/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mimalloc/all/CMakeLists.txt b/recipes/mimalloc/all/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c35..0000000000000 --- a/recipes/mimalloc/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/mimalloc/all/conandata.yml b/recipes/mimalloc/all/conandata.yml index 60cebd0e6f08b..c25b069c45c60 100644 --- a/recipes/mimalloc/all/conandata.yml +++ b/recipes/mimalloc/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.0.9": + url: "https://github.com/microsoft/mimalloc/archive/v2.0.9.tar.gz" + sha256: "4a29edae32a914a706715e2ac8e7e4109e25353212edeed0888f4e3e15db5850" + "2.0.7": + url: "https://github.com/microsoft/mimalloc/archive/v2.0.7.tar.gz" + sha256: "f23aac6c73594e417af50cb38f1efed88ef1dc14a490f0eff07c7f7b079810a4" "2.0.6": url: "https://github.com/microsoft/mimalloc/archive/v2.0.6.tar.gz" sha256: "9f05c94cc2b017ed13698834ac2a3567b6339a8bde27640df5a1581d49d05ce5" @@ -11,6 +17,12 @@ sources: "2.0.2": url: "https://github.com/microsoft/mimalloc/archive/v2.0.2.tar.gz" sha256: "c81a5f443f72373e3105172d6a935e29b0dabd13ba387c080bc444586cbe3021" + "1.7.9": + url: "https://github.com/microsoft/mimalloc/archive/v1.7.9.tar.gz" + sha256: "45e05be518363d32b2cdcce1a1fac3580895ea2e4524e1a3c7e71145cb58659f" + "1.7.7": + url: "https://github.com/microsoft/mimalloc/archive/v1.7.7.tar.gz" + sha256: "0f6663be1e1764851bf9563fcf7a6b3330e23b933eb4737dd07e3289b87895fe" "1.7.6": url: "https://github.com/microsoft/mimalloc/archive/v1.7.6.tar.gz" sha256: "d74f86ada2329016068bc5a243268f1f555edd620b6a7d6ce89295e7d6cf18da" @@ -21,28 +33,59 @@ sources: url: "https://github.com/microsoft/mimalloc/archive/v1.6.7.tar.gz" sha256: "111b718b496f297f128d842880e72e90e33953cf00b45ba0ccd2167e7340ed17" patches: + "2.0.9": + - patch_file: "patches/2.0.9-0001-change-install-paths.patch" + patch_description: "fix install paths" + patch_type: "conan" + - patch_file: "patches/2.0.9-0002-support-older-compiler.patch" + patch_description: "fix compilation errors on older compilers" + patch_type: "portability" + "2.0.7": + - patch_file: "patches/2.0.7-0001-change-install-paths.patch" + patch_description: "fix install paths" + patch_type: "conan" "2.0.6": - patch_file: "patches/2.0.6-0001-change-install-paths.patch" - base_path: "source_subfolder" + patch_description: "fix install paths" + patch_type: "conan" "2.0.5": - patch_file: "patches/2.0.6-0001-change-install-paths.patch" - base_path: "source_subfolder" + patch_description: "fix install paths" + patch_type: "conan" "2.0.3": - patch_file: "patches/2.0.3-0001-change-install-paths-avoid-symlink.patch" - base_path: "source_subfolder" + patch_description: "fix install paths, disable creating symlink" + patch_type: "conan" "2.0.2": - patch_file: "patches/2.0.2-0001-change-install-paths-avoid-symlink.patch" - base_path: "source_subfolder" + patch_description: "fix install paths, disable creating symlink" + patch_type: "conan" - patch_file: "patches/2.0.2-0002-include-cstddef-to-get-std-size-t.patch" - base_path: "source_subfolder" + patch_description: "include stddef" + patch_type: "portability" + "1.7.9": + - patch_file: "patches/1.7.9-0001-change-install-paths.patch" + patch_description: "fix install paths" + patch_type: "conan" + - patch_file: "patches/1.7.9-0002-support-older-compiler.patch" + patch_description: "fix compilation errors on older compilers" + patch_type: "portability" + "1.7.7": + - patch_file: "patches/1.7.7-0001-change-install-paths.patch" + patch_description: "fix install paths" + patch_type: "conan" "1.7.6": - - patch_file: "patches/1.7.6-0001-change-install-paths-avoid-symlink.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.7.5-0001-change-install-paths.patch" + patch_description: "fix install paths" + patch_type: "conan" "1.7.5": - - patch_file: "patches/1.7.5-0001-change-install-paths-avoid-symlink.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.7.5-0001-change-install-paths.patch" + patch_description: "fix install paths" + patch_type: "conan" "1.6.7": - patch_file: "patches/1.6.7-0001-change-install-paths-avoid-symlink.patch" - base_path: "source_subfolder" + patch_description: "fix install paths, disable creating symlink" + patch_type: "conan" - patch_file: "patches/1.6.7-0002-include-cstddef-to-get-std-size-t.patch" - base_path: "source_subfolder" + patch_description: "include stddef" + patch_type: "portability" diff --git a/recipes/mimalloc/all/conanfile.py b/recipes/mimalloc/all/conanfile.py index 7cc899ee605eb..392d44fdee88c 100644 --- a/recipes/mimalloc/all/conanfile.py +++ b/recipes/mimalloc/all/conanfile.py @@ -1,13 +1,15 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools import microsoft - +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, VCVars +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file, save, collect_libs +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os import shutil import textwrap -import functools -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" class MimallocConan(ConanFile): @@ -36,29 +38,23 @@ class MimallocConan(ConanFile): "single_object": False, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return 17 @property def _compilers_minimum_version(self): return { "gcc": "7", "Visual Studio": "15", + "msvc": "191", "clang": "5", "apple-clang": "10", } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -66,46 +62,46 @@ def config_options(self): # single_object and inject are options # only when overriding on Unix-like platforms: - if microsoft.is_msvc(self): + if is_msvc(self): del self.options.single_object del self.options.inject def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") # single_object is valid only for static # override: - if self.options.get_safe("single_object"): - del self.options.single_object + self.options.rm_safe("single_object") # inject is valid only for Unix-like dynamic override: - if not self.options.shared and self.options.get_safe("inject"): - del self.options.inject + if not self.options.shared: + self.options.rm_safe("inject") # single_object and inject are valid only when # overriding on Unix-like platforms: if not self.options.override: - if self.options.get_safe("single_object"): - del self.options.single_object - if self.options.get_safe("inject"): - del self.options.inject + self.options.rm_safe("single_object") + self.options.rm_safe("inject") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - # Currently, mimalloc/1.7.6,2.0.6 does not work properly with shared MD builds. + # Currently, mimalloc some version do not work properly with shared MD builds. # https://github.com/conan-io/conan-center-index/pull/10333#issuecomment-1114110046 - if self.version in ["1.7.6", "2.0.6"] and \ + if self.version in ["1.7.6", "1.7.7", "2.0.6", "2.0.7"] and \ self.options.shared and \ - microsoft.is_msvc(self) and \ - "MD" in microsoft.msvc_runtime_flag(self): + is_msvc(self) and \ + "MD" in msvc_runtime_flag(self): raise ConanInvalidConfiguration( - "Currently, mimalloc/1.7.6,2.0.6 doesn't work properly with shared MD builds.") + f"Currently, {self.ref} doesn't work properly with shared MD builds in CCI. Contributions welcomed") # Shared overriding requires dynamic runtime for MSVC: - if self.options.override and \ - self.options.shared and \ - microsoft.is_msvc(self) and \ - "MT" in microsoft.msvc_runtime_flag(self): + if self.info.options.override and \ + self.info.options.shared and \ + is_msvc(self) and \ + "MT" in msvc_runtime_flag(self): raise ConanInvalidConfiguration( "Dynamic runtime (MD/MDd) is required when using mimalloc as a shared library for override") @@ -114,58 +110,54 @@ def validate(self): self.options.get_safe("inject"): raise ConanInvalidConfiguration("Single object is incompatible with library injection") - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - - if not minimum_version: - self.output.warn("mimalloc requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("mimalloc requires a compiler that supports at least C++17") + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - if cmake.is_multi_configuration: - cmake.definitions["CMAKE_BUILD_TYPE"] = self.settings.build_type - cmake.definitions["MI_BUILD_TESTS"] = "OFF" - cmake.definitions["MI_BUILD_SHARED"] = self.options.shared - cmake.definitions["MI_BUILD_STATIC"] = not self.options.shared - cmake.definitions["MI_BUILD_OBJECT"] = self.options.get_safe("single_object", False) - cmake.definitions["MI_OVERRIDE"] = "ON" if self.options.override else "OFF" - cmake.definitions["MI_SECURE"] = "ON" if self.options.secure else "OFF" - if tools.Version(self.version) >= "1.7.0": - cmake.definitions["MI_INSTALL_TOPLEVEL"] = "ON" - cmake.configure(build_folder=self._build_subfolder) - return cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MI_BUILD_TESTS"] = "OFF" + tc.variables["MI_BUILD_SHARED"] = self.options.shared + tc.variables["MI_BUILD_STATIC"] = not self.options.shared + tc.variables["MI_BUILD_OBJECT"] = self.options.get_safe("single_object", False) + tc.variables["MI_OVERRIDE"] = "ON" if self.options.override else "OFF" + tc.variables["MI_SECURE"] = "ON" if self.options.secure else "OFF" + if Version(self.version) >= "1.7.0": + tc.variables["MI_INSTALL_TOPLEVEL"] = "ON" + tc.generate() + + if is_msvc(self): + vcvars = VCVars(self) + vcvars.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if microsoft.is_msvc(self) and self.settings.arch == "x86": - tools.replace_path_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "mimalloc-redirect.lib", "mimalloc-redirect32.lib") - with tools.vcvars(self.settings) if microsoft.is_msvc(self) else tools.no_op(): - cmake = self._configure_cmake() - cmake.build() + apply_conandata_patches(self) + if is_msvc(self) and self.settings.arch == "x86": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "mimalloc-redirect.lib", + "mimalloc-redirect32.lib") + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - with tools.vcvars(self.settings) if microsoft.is_msvc(self) else tools.no_op(): - cmake = self._configure_cmake() - cmake.install() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self.options.get_safe("single_object"): - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), - "*.a") + rm(self, "*.a", os.path.join(self.package_folder, "lib")) shutil.move(os.path.join(self.package_folder, self._obj_name + ".o"), os.path.join(self.package_folder, "lib")) shutil.copy(os.path.join(self.package_folder, "lib", self._obj_name + ".o"), @@ -173,13 +165,15 @@ def package(self): if self.settings.os == "Windows" and self.options.shared: if self.settings.arch == "x86_64": - self.copy("mimalloc-redirect.dll", src=os.path.join(self._source_subfolder, "bin"), - dst="bin") + copy(self, "mimalloc-redirect.dll", + src=os.path.join(self.source_folder, "bin"), + dst=os.path.join(self.package_folder, "bin")) elif self.settings.arch == "x86": - self.copy("mimalloc-redirect32.dll", src=os.path.join(self._source_subfolder, "bin"), - dst="bin") + copy(self, "mimalloc-redirect32.dll", + src=os.path.join(self.source_folder, "bin"), + dst=os.path.join(self.package_folder, "bin")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) cmake_target = "mimalloc" if self.options.shared else "mimalloc-static" self._create_cmake_module_alias_targets( @@ -187,8 +181,7 @@ def package(self): {cmake_target: "mimalloc::mimalloc"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -197,7 +190,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_subfolder(self): @@ -254,7 +247,7 @@ def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.bindirs = [] else: - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os == "Linux": self.cpp_info.system_libs.append("pthread") diff --git a/recipes/mimalloc/all/patches/1.7.5-0001-change-install-paths-avoid-symlink.patch b/recipes/mimalloc/all/patches/1.7.5-0001-change-install-paths.patch similarity index 100% rename from recipes/mimalloc/all/patches/1.7.5-0001-change-install-paths-avoid-symlink.patch rename to recipes/mimalloc/all/patches/1.7.5-0001-change-install-paths.patch diff --git a/recipes/mimalloc/all/patches/1.7.6-0001-change-install-paths-avoid-symlink.patch b/recipes/mimalloc/all/patches/1.7.6-0001-change-install-paths-avoid-symlink.patch deleted file mode 100644 index ad84ddb0e3b97..0000000000000 --- a/recipes/mimalloc/all/patches/1.7.6-0001-change-install-paths-avoid-symlink.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index b702300..d739857 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -319,7 +319,7 @@ if(MI_BUILD_SHARED) - install(FILES "$/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_libdir}) - endif() - -- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY) -+ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) - install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) - endif() - -@@ -343,7 +343,7 @@ if (MI_BUILD_STATIC) - set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename}) - endif() - -- install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY) -+ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) - install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) - endif() - diff --git a/recipes/mimalloc/all/patches/1.7.7-0001-change-install-paths.patch b/recipes/mimalloc/all/patches/1.7.7-0001-change-install-paths.patch new file mode 100644 index 0000000000000..108558a1f1922 --- /dev/null +++ b/recipes/mimalloc/all/patches/1.7.7-0001-change-install-paths.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2bc0f76..f40e272 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -360,7 +360,7 @@ if(MI_BUILD_SHARED) + install(FILES "$/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_libdir}) + endif() + +- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY) ++ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) + endif() + +@@ -384,7 +384,7 @@ if (MI_BUILD_STATIC) + set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename}) + endif() + +- install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY) ++ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) + endif() + diff --git a/recipes/mimalloc/all/patches/1.7.9-0001-change-install-paths.patch b/recipes/mimalloc/all/patches/1.7.9-0001-change-install-paths.patch new file mode 100644 index 0000000000000..1091c508194e2 --- /dev/null +++ b/recipes/mimalloc/all/patches/1.7.9-0001-change-install-paths.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0011b87..41a15a2 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -383,7 +383,7 @@ if(MI_BUILD_SHARED) + install(FILES "$/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_libdir}) + endif() + +- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY) ++ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) + endif() + +@@ -407,7 +407,7 @@ if (MI_BUILD_STATIC) + set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename}) + endif() + +- install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY) ++ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) + endif() + diff --git a/recipes/mimalloc/all/patches/1.7.9-0002-support-older-compiler.patch b/recipes/mimalloc/all/patches/1.7.9-0002-support-older-compiler.patch new file mode 100644 index 0000000000000..7a9f7edb032b6 --- /dev/null +++ b/recipes/mimalloc/all/patches/1.7.9-0002-support-older-compiler.patch @@ -0,0 +1,22 @@ +diff --git a/include/mimalloc.h b/include/mimalloc.h +index f590033..a4275c5 100644 +--- a/include/mimalloc.h ++++ b/include/mimalloc.h +@@ -493,7 +493,7 @@ template struct _mi_heap_stl_allocator_common : public _m + #endif + + void collect(bool force) { mi_heap_collect(this->heap.get(), force); } +- template bool is_equal(const _mi_heap_stl_allocator_common& x) const { return (this->heap == x.heap); } ++ template bool is_equal(const _mi_heap_stl_allocator_common& x) const { return (this->heap == x.heap); } + + protected: + std::shared_ptr heap; +@@ -504,7 +504,7 @@ protected: + this->heap.reset(hp, (destroy ? &heap_destroy : &heap_delete)); /* calls heap_delete/destroy when the refcount drops to zero */ + } + _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { } +- template _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { } ++ template _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { } + + private: + static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } } diff --git a/recipes/mimalloc/all/patches/2.0.7-0001-change-install-paths.patch b/recipes/mimalloc/all/patches/2.0.7-0001-change-install-paths.patch new file mode 100644 index 0000000000000..adf1e00f9607c --- /dev/null +++ b/recipes/mimalloc/all/patches/2.0.7-0001-change-install-paths.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2550f0d..da42112 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -360,7 +360,7 @@ if(MI_BUILD_SHARED) + install(FILES "$/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_libdir}) + endif() + +- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY) ++ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) + endif() + +@@ -384,7 +384,7 @@ if (MI_BUILD_STATIC) + set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename}) + endif() + +- install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY) ++ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) + endif() + diff --git a/recipes/mimalloc/all/patches/2.0.9-0001-change-install-paths.patch b/recipes/mimalloc/all/patches/2.0.9-0001-change-install-paths.patch new file mode 100644 index 0000000000000..91c4b6fa129dd --- /dev/null +++ b/recipes/mimalloc/all/patches/2.0.9-0001-change-install-paths.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 74c1f29..d657144 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -383,7 +383,7 @@ if(MI_BUILD_SHARED) + install(FILES "$/mimalloc-redirect${MIMALLOC_REDIRECT_SUFFIX}.dll" DESTINATION ${mi_install_libdir}) + endif() + +- install(TARGETS mimalloc EXPORT mimalloc DESTINATION ${mi_install_libdir} LIBRARY) ++ install(TARGETS mimalloc EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) + endif() + +@@ -407,7 +407,7 @@ if (MI_BUILD_STATIC) + set_target_properties(mimalloc-static PROPERTIES OUTPUT_NAME ${mi_basename}) + endif() + +- install(TARGETS mimalloc-static EXPORT mimalloc DESTINATION ${mi_install_objdir} LIBRARY) ++ install(TARGETS mimalloc-static EXPORT mimalloc RUNTIME DESTINATION bin LIBRARY DESTINATION lib ARCHIVE DESTINATION lib) + install(EXPORT mimalloc DESTINATION ${mi_install_cmakedir}) + endif() + diff --git a/recipes/mimalloc/all/patches/2.0.9-0002-support-older-compiler.patch b/recipes/mimalloc/all/patches/2.0.9-0002-support-older-compiler.patch new file mode 100644 index 0000000000000..d8c391792f463 --- /dev/null +++ b/recipes/mimalloc/all/patches/2.0.9-0002-support-older-compiler.patch @@ -0,0 +1,22 @@ +diff --git a/include/mimalloc.h b/include/mimalloc.h +index 9b72fbf..b34362f 100644 +--- a/include/mimalloc.h ++++ b/include/mimalloc.h +@@ -500,7 +500,7 @@ template struct _mi_heap_stl_allocator_common : public _m + #endif + + void collect(bool force) { mi_heap_collect(this->heap.get(), force); } +- template bool is_equal(const _mi_heap_stl_allocator_common& x) const { return (this->heap == x.heap); } ++ template bool is_equal(const _mi_heap_stl_allocator_common& x) const { return (this->heap == x.heap); } + + protected: + std::shared_ptr heap; +@@ -511,7 +511,7 @@ protected: + this->heap.reset(hp, (destroy ? &heap_destroy : &heap_delete)); /* calls heap_delete/destroy when the refcount drops to zero */ + } + _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { } +- template _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { } ++ template _mi_heap_stl_allocator_common(const _mi_heap_stl_allocator_common& x) mi_attr_noexcept : heap(x.heap) { } + + private: + static void heap_delete(mi_heap_t* hp) { if (hp != NULL) { mi_heap_delete(hp); } } diff --git a/recipes/mimalloc/all/test_package/CMakeLists.txt b/recipes/mimalloc/all/test_package/CMakeLists.txt index 619c8110ed80b..f0ee34e277443 100644 --- a/recipes/mimalloc/all/test_package/CMakeLists.txt +++ b/recipes/mimalloc/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest C CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(PackageTest LANGUAGES C CXX) option(BUILD_NO_CHANGES "Build no_changes sources" ON) option(BUILD_INCLUDE_OVERRIDE "Build include_override sources" ON) @@ -15,7 +12,6 @@ else() set(MIMALLOC_LIBS mimalloc) endif() - if (BUILD_NO_CHANGES) add_executable(no_changes no_changes.c) target_link_libraries(no_changes ${MIMALLOC_LIBS}) diff --git a/recipes/mimalloc/all/test_package/conanfile.py b/recipes/mimalloc/all/test_package/conanfile.py index 4702c7a3df51b..9e32697b3c0e4 100644 --- a/recipes/mimalloc/all/test_package/conanfile.py +++ b/recipes/mimalloc/all/test_package/conanfile.py @@ -1,44 +1,85 @@ -from conans import ConanFile, CMake, RunEnvironment, tools -import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, Environment +import os +import functools class MimallocTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + @functools.lru_cache(1) + def _test_files(self): + test_files = [] - def build(self): # No override: if not self.options["mimalloc"].override: - self._test_files = ["mi_api"] + test_files = ["mi_api"] # Visual Studio overriding: elif self.settings.compiler == "Visual Studio" and self.options["mimalloc"].shared: - self._test_files = ["include_override", "mi_api"] + test_files = ["include_override", "mi_api"] elif self.settings.compiler == "Visual Studio" and not self.options["mimalloc"].shared: - self._test_files = ["include_override", "mi_api"] + test_files = ["include_override", "mi_api"] # Non Macos injected override: elif self.settings.os != "Macos" and \ self.options["mimalloc"].override and \ self.options["mimalloc"].shared and \ self.options["mimalloc"].inject: - self._test_files = ["no_changes"] + test_files = ["no_changes"] # Could not simulate Macos preload, so just ignore it: elif self.settings.os == "Macos" and \ self.options["mimalloc"].override and \ self.options["mimalloc"].shared and \ self.options["mimalloc"].inject: - self._test_files = [] + test_files = [] # Unix-like non injected override: else: - self._test_files = ["include_override", "mi_api"] + test_files = ["include_override", "mi_api"] + + return test_files + + def generate(self): + test_files = self._test_files() + + tc = CMakeToolchain(self) + tc.variables["BUILD_NO_CHANGES"] = "no_changes" in test_files + tc.variables["BUILD_INCLUDE_OVERRIDE"] = "include_override" in test_files + tc.variables["BUILD_MI_API"] = "mi_api" in test_files + tc.generate() + + env = Environment() + env.define("MIMALLOC_VERBOSE", "1") + + if self.settings.os == "Linux": + env.define("LD_PRELOAD", f"{self._lib_name}.so") + elif self.settings.os == "Macos": + env.define("DYLD_FORCE_FLAT_NAMESPACE", "1") + insert_library = os.path.join(self.deps_cpp_info["mimalloc"].libdirs[0], self._lib_name +".dylib") + env.define("DYLD_INSERT_LIBRARIES", insert_library) + envvars = env.vars(self, scope="run") + envvars.save_script("mimalloc_env_file") + + deps = CMakeDeps(self) + deps.generate() + + vbe = VirtualBuildEnv(self) + vbe.generate(scope="build") + + def build(self): cmake = CMake(self) - cmake.definitions["BUILD_NO_CHANGES"] = "no_changes" in self._test_files - cmake.definitions["BUILD_INCLUDE_OVERRIDE"] = "include_override" in self._test_files - cmake.definitions["BUILD_MI_API"] = "mi_api" in self._test_files cmake.configure() cmake.build() @@ -53,39 +94,16 @@ def _lib_name(self): name += "-{}".format(str(self.settings.build_type).lower()) return name - @property - def _environment(self): - environment = {"MIMALLOC_VERBOSE": "1"} - - if self.settings.compiler == "Visual Studio" or \ - not self.options["mimalloc"].shared or \ - not self.options["mimalloc"].override or \ - not self.options["mimalloc"].inject: - return environment - - if self.settings.os == "Linux": - environment["LD_PRELOAD"] = self._lib_name + ".so" - elif self.settings.os == "Macos": - env_build = RunEnvironment(self) - insert_library = os.path.join(env_build.vars["DYLD_LIBRARY_PATH"][0], self._lib_name +".dylib") - - environment["DYLD_FORCE_FLAT_NAMESPACE"] = "1" - environment["DYLD_INSERT_LIBRARIES"] = insert_library - - return environment - def test(self): - if tools.cross_building(self): + if not can_run(self): return - self.output.info("Environment append: {}".format(self._environment)) - - with tools.environment_append(self._environment): - for file in self._test_files: - test_package = os.path.join("bin", file) - self.output.info("test: {}".format(test_package)) - self.run(test_package, run_environment=True) + test_files = self._test_files() + for file in test_files: + test_package = os.path.join(self.cpp.build.bindirs[0], file) + self.output.info("test: {}".format(test_package)) + self.run(test_package, run_environment=True) - test_package_cpp = os.path.join("bin", file + "_cpp") - self.output.info("test: {}".format(test_package_cpp)) - self.run(test_package_cpp, run_environment=True) + test_package_cpp = os.path.join(self.cpp.build.bindirs[0], f"{file}_cpp") + self.output.info("test: {}".format(test_package_cpp)) + self.run(test_package_cpp, run_environment=True) diff --git a/recipes/mimalloc/all/test_v1_package/CMakeLists.txt b/recipes/mimalloc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/mimalloc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mimalloc/all/test_v1_package/conanfile.py b/recipes/mimalloc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4702c7a3df51b --- /dev/null +++ b/recipes/mimalloc/all/test_v1_package/conanfile.py @@ -0,0 +1,91 @@ +from conans import ConanFile, CMake, RunEnvironment, tools +import os + + +class MimallocTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + # No override: + if not self.options["mimalloc"].override: + self._test_files = ["mi_api"] + + # Visual Studio overriding: + elif self.settings.compiler == "Visual Studio" and self.options["mimalloc"].shared: + self._test_files = ["include_override", "mi_api"] + elif self.settings.compiler == "Visual Studio" and not self.options["mimalloc"].shared: + self._test_files = ["include_override", "mi_api"] + + # Non Macos injected override: + elif self.settings.os != "Macos" and \ + self.options["mimalloc"].override and \ + self.options["mimalloc"].shared and \ + self.options["mimalloc"].inject: + self._test_files = ["no_changes"] + + # Could not simulate Macos preload, so just ignore it: + elif self.settings.os == "Macos" and \ + self.options["mimalloc"].override and \ + self.options["mimalloc"].shared and \ + self.options["mimalloc"].inject: + self._test_files = [] + + # Unix-like non injected override: + else: + self._test_files = ["include_override", "mi_api"] + + cmake = CMake(self) + cmake.definitions["BUILD_NO_CHANGES"] = "no_changes" in self._test_files + cmake.definitions["BUILD_INCLUDE_OVERRIDE"] = "include_override" in self._test_files + cmake.definitions["BUILD_MI_API"] = "mi_api" in self._test_files + cmake.configure() + cmake.build() + + @property + def _lib_name(self): + name = "mimalloc" if self.settings.os == "Windows" else "libmimalloc" + if self.settings.os == "Windows" and not self.options["mimalloc"].shared: + name += "-static" + if self.options["mimalloc"].secure: + name += "-secure" + if self.settings.build_type not in ("Release", "RelWithDebInfo", "MinSizeRel"): + name += "-{}".format(str(self.settings.build_type).lower()) + return name + + @property + def _environment(self): + environment = {"MIMALLOC_VERBOSE": "1"} + + if self.settings.compiler == "Visual Studio" or \ + not self.options["mimalloc"].shared or \ + not self.options["mimalloc"].override or \ + not self.options["mimalloc"].inject: + return environment + + if self.settings.os == "Linux": + environment["LD_PRELOAD"] = self._lib_name + ".so" + elif self.settings.os == "Macos": + env_build = RunEnvironment(self) + insert_library = os.path.join(env_build.vars["DYLD_LIBRARY_PATH"][0], self._lib_name +".dylib") + + environment["DYLD_FORCE_FLAT_NAMESPACE"] = "1" + environment["DYLD_INSERT_LIBRARIES"] = insert_library + + return environment + + def test(self): + if tools.cross_building(self): + return + + self.output.info("Environment append: {}".format(self._environment)) + + with tools.environment_append(self._environment): + for file in self._test_files: + test_package = os.path.join("bin", file) + self.output.info("test: {}".format(test_package)) + self.run(test_package, run_environment=True) + + test_package_cpp = os.path.join("bin", file + "_cpp") + self.output.info("test: {}".format(test_package_cpp)) + self.run(test_package_cpp, run_environment=True) diff --git a/recipes/mimalloc/config.yml b/recipes/mimalloc/config.yml index 441cce6955998..cabec88f14c46 100644 --- a/recipes/mimalloc/config.yml +++ b/recipes/mimalloc/config.yml @@ -1,4 +1,8 @@ versions: + "2.0.9": + folder: all + "2.0.7": + folder: all "2.0.6": folder: all "2.0.5": @@ -7,6 +11,10 @@ versions: folder: all "2.0.2": folder: all + "1.7.9": + folder: all + "1.7.7": + folder: all "1.7.6": folder: all "1.7.5": diff --git a/recipes/mingw-builds/all/conandata.yml b/recipes/mingw-builds/all/conandata.yml index 8134359e054f8..6703f0f20681d 100644 --- a/recipes/mingw-builds/all/conandata.yml +++ b/recipes/mingw-builds/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "12.2.0": + posix: + seh: + url: "https://github.com/niXman/mingw-builds-binaries/releases/download/12.2.0-rt_v10-rev1/x86_64-12.2.0-release-posix-seh-rt_v10-rev1.7z" + sha256: "077e1857ad2ea5e29d57127b0b9137d01bbae31b5bc65e18a7b98f4b866fd09d" + win32: + seh: + url: "https://github.com/niXman/mingw-builds-binaries/releases/download/12.2.0-rt_v10-rev1/x86_64-12.2.0-release-win32-seh-rt_v10-rev1.7z" + sha256: "774916c4403c5219f8af3a3ee3012de6c017c034895c2c92bc4de99895c2c924" "12.1.0": posix: seh: diff --git a/recipes/mingw-builds/config.yml b/recipes/mingw-builds/config.yml index 38d9425ea7e4a..6ceaf5fe4c164 100644 --- a/recipes/mingw-builds/config.yml +++ b/recipes/mingw-builds/config.yml @@ -1,7 +1,9 @@ versions: + "12.2.0": + folder: "all" "12.1.0": - folder: "all" + folder: "all" "11.2.0": - folder: "all" + folder: "all" "8.1": - folder: "all" + folder: "all" diff --git a/recipes/miniaudio/all/CMakeLists.txt b/recipes/miniaudio/all/CMakeLists.txt index 1aeb33afcf8b4..8e18371d5a460 100644 --- a/recipes/miniaudio/all/CMakeLists.txt +++ b/recipes/miniaudio/all/CMakeLists.txt @@ -1,12 +1,9 @@ cmake_minimum_required(VERSION 3.4) -project(miniaudio C) +project(miniaudio LANGUAGES C) include(GNUInstallDirs) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(SOURCE_SUBFOLDER ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/extras/miniaudio_split/) +set(SOURCE_SUBFOLDER ${MINIAUDIO_SRC_DIR}/extras/miniaudio_split/) add_library(miniaudio ${SOURCE_SUBFOLDER}/miniaudio.c) target_include_directories(miniaudio PRIVATE ${SOURCE_SUBFOLDER}) diff --git a/recipes/miniaudio/all/conandata.yml b/recipes/miniaudio/all/conandata.yml index 4e97b3b81f271..49cc53a5d3381 100644 --- a/recipes/miniaudio/all/conandata.yml +++ b/recipes/miniaudio/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.11.11": + url: "https://github.com/mackron/miniaudio/archive/a0dc1037f99a643ff5fad7272cd3d6461f2d63fa.tar.gz" + sha256: "4821e2f796d95b772fd4ef1274181d5302854bfe55680125a5cd9b24b8542dcf" "0.11.9": url: "https://github.com/mackron/miniaudio/archive/4dfe7c4c31df46e78d9a1cc0d2d6f1aef5a5d58c.tar.gz" sha256: "76c154a60e320ae2054ac0e93480f2dffc12a5129bdb2ed4a62e0cce8d345c36" @@ -20,12 +23,3 @@ sources: "0.10.39": url: "https://github.com/mackron/miniaudio/archive/8bf157f10e278302f8a6c1c9cd1065f2bea26dd2.tar.gz" sha256: "573C511F1FD1C64BD331160E357DE611A144E5BDBAF1CD872195B8D535FA557E" - "0.10.35": - url: "https://github.com/mackron/miniaudio/archive/199d6a7875b4288af6a7b615367c8fdc2019b03c.tar.gz" - sha256: "3D9C5FCB112E24E9C038F7520C93D52882CECE6C93DF259FD33A389B7DEB7C40" - "0.10.33": - url: "https://github.com/mackron/miniaudio/archive/fca829edefd8389380f8e3ee26cc4b8c426dd742.tar.gz" - sha256: "DF1B4E36211112FDC35AF92F2288DAFDEB07290F4010E7C5E2505AFFA880E0EE" - "0.10.32": - url: "https://github.com/mackron/miniaudio/archive/d06d4983d3ff512690eb37f5edd25bf96f8f3764.tar.gz" - sha256: "1FB7784AA6BC1C8138376C966BBDB444FF51CE04EF4289067BC59FB163CF38EA" diff --git a/recipes/miniaudio/all/conanfile.py b/recipes/miniaudio/all/conanfile.py index c2a81461cd58b..599f3c0195bdc 100644 --- a/recipes/miniaudio/all/conanfile.py +++ b/recipes/miniaudio/all/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.layout import basic_layout import os -import textwrap - -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class MiniaudioConan(ConanFile): name = "miniaudio" description = "A single file audio playback and capture library." - topics = ("miniaudio", "header-only", "sound") - homepage = "https://github.com/mackron/miniaudio" - url = "https://github.com/conan-io/conan-center-index" license = ["Unlicense", "MIT-0"] - settings = "os", "compiler", "build_type", "arch" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mackron/miniaudio" + topics = ("audio", "header-only", "sound") + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -25,66 +25,74 @@ class MiniaudioConan(ConanFile): "header_only": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - self.license = "miniaudio-{}".format(self.version) def configure(self): - if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + if self.options.header_only or self.options.shared: + self.options.rm_safe("fPIC") + if self.options.header_only: + del self.options.shared + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + if self.options.header_only: + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") + + def package_id(self): + if self.options.header_only: + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["MINIAUDIO_VERSION_STRING"] = self.version - self._cmake.configure() - return self._cmake + def generate(self): + if self.options.header_only: + return + + tc = CMakeToolchain(self) + tc.variables["MINIAUDIO_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["MINIAUDIO_VERSION_STRING"] = self.version + tc.generate() def build(self): if self.options.header_only: return - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", - src=self._source_subfolder) - self.copy( + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, pattern="**", - dst="include/extras", - src=os.path.join(self._source_subfolder, "extras"), + dst=os.path.join(self.package_folder, "include", "extras"), + src=os.path.join(self.source_folder, "extras"), ) if self.options.header_only: - self.copy(pattern="miniaudio.h", dst="include", - src=self._source_subfolder) - self.copy( + copy( + self, + pattern="miniaudio.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder) + copy( + self, pattern="miniaudio.*", - dst="include/extras/miniaudio_split", - src=os.path.join(self._source_subfolder, - "extras/miniaudio_split"), + dst=os.path.join(self.package_folder, "include", "extras", "miniaudio_split"), + src=os.path.join(self.source_folder, "extras", "miniaudio_split"), ) else: - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() def package_info(self): @@ -98,11 +106,11 @@ def package_info(self): ) self.cpp_info.defines.append("MA_NO_RUNTIME_LINKING=1") - if not self.options.header_only: + if self.options.header_only: + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + else: self.cpp_info.libs = ["miniaudio"] if self.options.shared: self.cpp_info.defines.append("MA_DLL") - def package_id(self): - if self.options.header_only: - self.info.header_only() diff --git a/recipes/miniaudio/all/test_package/CMakeLists.txt b/recipes/miniaudio/all/test_package/CMakeLists.txt index 95daa0c2d8509..b334a63d0191a 100644 --- a/recipes/miniaudio/all/test_package/CMakeLists.txt +++ b/recipes/miniaudio/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(miniaudio REQUIRED) -add_executable(test_package example.c) -target_link_libraries(test_package miniaudio::miniaudio) +add_executable(${PROJECT_NAME} example.c) +target_link_libraries(${PROJECT_NAME} miniaudio::miniaudio) diff --git a/recipes/miniaudio/all/test_package/conanfile.py b/recipes/miniaudio/all/test_package/conanfile.py index 1bf1c7e26255d..e140654a3db4e 100644 --- a/recipes/miniaudio/all/test_package/conanfile.py +++ b/recipes/miniaudio/all/test_package/conanfile.py @@ -1,9 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +20,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + diff --git a/recipes/miniaudio/all/test_v1_package/CMakeLists.txt b/recipes/miniaudio/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/miniaudio/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/miniaudio/all/test_v1_package/conanfile.py b/recipes/miniaudio/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/miniaudio/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/miniaudio/config.yml b/recipes/miniaudio/config.yml index 0bdedbadaa4f2..52824dc107878 100644 --- a/recipes/miniaudio/config.yml +++ b/recipes/miniaudio/config.yml @@ -1,4 +1,6 @@ versions: + "0.11.11": + folder: all "0.11.9": folder: all "0.11.8": @@ -13,9 +15,3 @@ versions: folder: all "0.10.39": folder: all - "0.10.35": - folder: all - "0.10.33": - folder: all - "0.10.32": - folder: all diff --git a/recipes/miniscript/all/CMakeLists.txt b/recipes/miniscript/all/CMakeLists.txt new file mode 100644 index 0000000000000..b203ccd24f5f1 --- /dev/null +++ b/recipes/miniscript/all/CMakeLists.txt @@ -0,0 +1,66 @@ +cmake_minimum_required(VERSION 3.8) +project(miniscript LANGUAGES CXX) + +set(MINISCRIPT_SRC + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/Dictionary.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/List.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptInterpreter.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptIntrinsics.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptKeywords.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptLexer.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptParser.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptTAC.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptTypes.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/QA.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/SimpleString.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/SimpleVector.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/SplitJoin.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/UnicodeUtil.cpp + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/UnitTest.cpp +) + +set(MINISCRIPT_INC + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/Dictionary.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/List.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptErrors.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptInterpreter.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptIntrinsics.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptKeywords.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptLexer.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptParser.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptTAC.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/MiniscriptTypes.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/QA.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/RefCountedStorage.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/SimpleString.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/SimpleVector.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/SplitJoin.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/UnicodeUtil.h + ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src/MiniScript/UnitTest.h +) + + +add_library(miniscript ${MINISCRIPT_SRC}) +target_include_directories(miniscript PRIVATE ${MINISCRIPT_SRC_DIR}/MiniScript-cpp/src) +set_target_properties(miniscript PROPERTIES + PUBLIC_HEADER "${MINISCRIPT_INC}" + WINDOWS_EXPORT_ALL_SYMBOLS ON + C_EXTENSIONS OFF +) +target_compile_features(miniscript PRIVATE cxx_std_11) + +if(MSVC) + target_compile_options(miniscript PRIVATE /EHsc /wd4068) +endif() + +find_library(LIBM m) +target_link_libraries(miniscript PRIVATE $<$:${LIBM}>) + +include(GNUInstallDirs) +install( + TARGETS miniscript + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/MiniScript +) diff --git a/recipes/miniscript/all/conandata.yml b/recipes/miniscript/all/conandata.yml new file mode 100644 index 0000000000000..bafad0fb939fc --- /dev/null +++ b/recipes/miniscript/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.5.1": + url: "https://github.com/JoeStrout/miniscript/archive/172bea8e762c96b1b2a5ea743228ff6a58702cc3.tar.gz" + sha256: "a82ac634621657e14f046b6fd08dbc624e8e9890b646573edef454a2e540a1e2" diff --git a/recipes/miniscript/all/conanfile.py b/recipes/miniscript/all/conanfile.py new file mode 100644 index 0000000000000..d85d56bf3dc9b --- /dev/null +++ b/recipes/miniscript/all/conanfile.py @@ -0,0 +1,60 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout + +import os + +required_conan_version = ">=1.53.0" + +class MiniscriptConan(ConanFile): + name = "miniscript" + description = "modern, elegant, easy to learn, and easy to embed in your own C# or C++ projects." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/JoeStrout/miniscript" + topics = ("script", "embedded", "programming-language") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + exports_sources = ["CMakeLists.txt"] + + def config_options(self): + if self.settings.os == 'Windows': + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MINISCRIPT_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["miniscript"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/miniscript/all/test_package/CMakeLists.txt b/recipes/miniscript/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..677b1ee8fe710 --- /dev/null +++ b/recipes/miniscript/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(miniscript REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE miniscript::miniscript) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/miniscript/all/test_package/conanfile.py b/recipes/miniscript/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/miniscript/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/miniscript/all/test_package/test_package.cpp b/recipes/miniscript/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..91d25c569fcf6 --- /dev/null +++ b/recipes/miniscript/all/test_package/test_package.cpp @@ -0,0 +1,25 @@ +#include +#include + +#include "MiniScript/SimpleString.h" +#include "MiniScript/UnicodeUtil.h" +#include "MiniScript/SimpleVector.h" +#include "MiniScript/List.h" +#include "MiniScript/Dictionary.h" +#include "MiniScript/MiniscriptParser.h" +#include "MiniScript/MiniscriptInterpreter.h" + +int main() { + MiniScript::Interpreter interp; + + interp.standardOutput = [](MiniScript::String s) { std::cout << s.c_str() << std::endl; }; + interp.errorOutput = [](MiniScript::String s) { std::cerr << s.c_str() << std::endl; }; + interp.implicitOutput = [](MiniScript::String s) { std::cout << s.c_str() << std::endl; }; + + interp.REPL("x = 5"); + interp.REPL("print \"x = \" + x"); + interp.REPL("y = 5 + x"); + interp.REPL("print \"y = \" + y"); + + return 0; +} diff --git a/recipes/miniscript/all/test_v1_package/CMakeLists.txt b/recipes/miniscript/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/miniscript/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/miniscript/all/test_v1_package/conanfile.py b/recipes/miniscript/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/miniscript/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/miniscript/config.yml b/recipes/miniscript/config.yml new file mode 100644 index 0000000000000..f1c5e3d313178 --- /dev/null +++ b/recipes/miniscript/config.yml @@ -0,0 +1,3 @@ +versions: + "1.5.1": + folder: all diff --git a/recipes/minitrace/all/conanfile.py b/recipes/minitrace/all/conanfile.py index 1c39ada6eb865..af8d398e935c1 100644 --- a/recipes/minitrace/all/conanfile.py +++ b/recipes/minitrace/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class MinitraceConan(ConanFile): @@ -12,7 +12,8 @@ class MinitraceConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/hrydgard/minitrace" - topics = ("trace", "chrome", "about:tracing",) + topics = ("trace", "chrome", "about:tracing") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -24,8 +25,7 @@ class MinitraceConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -33,26 +33,19 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass - - def generate(self): - toolchain = CMakeToolchain(self) - toolchain.generate() + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() def build(self): apply_conandata_patches(self) diff --git a/recipes/minitrace/all/test_package/conanfile.py b/recipes/minitrace/all/test_package/conanfile.py index a18b32874e404..98ab55852ad56 100644 --- a/recipes/minitrace/all/test_package/conanfile.py +++ b/recipes/minitrace/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,6 +7,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def layout(self): cmake_layout(self) @@ -20,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/minitrace/all/test_v1_package/CMakeLists.txt b/recipes/minitrace/all/test_v1_package/CMakeLists.txt index a96803edb197f..0d20897301b68 100644 --- a/recipes/minitrace/all/test_v1_package/CMakeLists.txt +++ b/recipes/minitrace/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(minitrace REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE minitrace::minitrace) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/minitrace/all/test_v1_package/conanfile.py b/recipes/minitrace/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/minitrace/all/test_v1_package/conanfile.py +++ b/recipes/minitrace/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/miniupnpc/all/conanfile.py b/recipes/miniupnpc/all/conanfile.py index ac41bbffd99d4..23ce55638aada 100644 --- a/recipes/miniupnpc/all/conanfile.py +++ b/recipes/miniupnpc/all/conanfile.py @@ -1,16 +1,16 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class MiniupnpcConan(ConanFile): name = "miniupnpc" description = "UPnP client library/tool to access Internet Gateway Devices." license = "BSD-3-Clause" - topics = ("miniupnpc", "upnp", "networking", "internet-gateway") + topics = ("upnp", "networking", "internet-gateway") homepage = "https://github.com/miniupnp/miniupnp" url = "https://github.com/conan-io/conan-center-index" @@ -25,8 +25,7 @@ class MiniupnpcConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -34,15 +33,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/miniupnpc/all/test_package/conanfile.py b/recipes/miniupnpc/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/miniupnpc/all/test_package/conanfile.py +++ b/recipes/miniupnpc/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/miniupnpc/all/test_v1_package/CMakeLists.txt b/recipes/miniupnpc/all/test_v1_package/CMakeLists.txt index a8089285d6860..0d20897301b68 100644 --- a/recipes/miniupnpc/all/test_v1_package/CMakeLists.txt +++ b/recipes/miniupnpc/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(miniupnpc REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE miniupnpc::miniupnpc) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/miniz/all/conandata.yml b/recipes/miniz/all/conandata.yml index 7af461e4a722c..5be42f3eada37 100644 --- a/recipes/miniz/all/conandata.yml +++ b/recipes/miniz/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.0.2": + url: "https://github.com/richgel999/miniz/archive/refs/tags/3.0.2.tar.gz" + sha256: "c4b4c25a4eb81883448ff8924e6dba95c800094a198dc9ce66a292ac2ef8e018" + "3.0.1": + url: "https://github.com/richgel999/miniz/archive/refs/tags/3.0.1.tar.gz" + sha256: "53c29ed75bf1a9dd838349982ec8890f95269c422b17399d3880fd2d0f703af8" "2.2.0": url: "https://github.com/richgel999/miniz/archive/refs/tags/2.2.0.tar.gz" sha256: "bd1136d0a1554520dcb527a239655777148d90fd2d51cf02c36540afc552e6ec" diff --git a/recipes/miniz/all/conanfile.py b/recipes/miniz/all/conanfile.py index 66b82060bcbcf..a90739b0d0d4e 100644 --- a/recipes/miniz/all/conanfile.py +++ b/recipes/miniz/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class MinizConan(ConanFile): @@ -13,10 +13,9 @@ class MinizConan(ConanFile): "implements the zlib (RFC 1950) and Deflate (RFC 1951) " \ "compressed data format specification standards" license = "MIT" - topics = ("miniz", "compression", "lossless") - homepage = "https://github.com/richgel999/miniz" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/richgel999/miniz" + topics = ("zlib", "compression", "lossless") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,8 +27,7 @@ class MinizConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,15 +35,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") @@ -77,6 +69,7 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): diff --git a/recipes/miniz/all/test_v1_package/CMakeLists.txt b/recipes/miniz/all/test_v1_package/CMakeLists.txt index 63f78425e4d0b..de3b75d9538de 100644 --- a/recipes/miniz/all/test_v1_package/CMakeLists.txt +++ b/recipes/miniz/all/test_v1_package/CMakeLists.txt @@ -4,7 +4,5 @@ project(test_package LANGUAGES C) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(miniz REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE miniz::miniz) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/miniz/all/test_v1_package/conanfile.py b/recipes/miniz/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/miniz/all/test_v1_package/conanfile.py +++ b/recipes/miniz/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/miniz/config.yml b/recipes/miniz/config.yml index 57df2fc911f74..7c99dc2de1035 100644 --- a/recipes/miniz/config.yml +++ b/recipes/miniz/config.yml @@ -1,4 +1,8 @@ versions: + "3.0.2": + folder: all + "3.0.1": + folder: all "2.2.0": folder: all "2.1.0": diff --git a/recipes/minizip-ng/all/CMakeLists.txt b/recipes/minizip-ng/all/CMakeLists.txt deleted file mode 100644 index 5bc1a4c709a97..0000000000000 --- a/recipes/minizip-ng/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper C) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/minizip-ng/all/conandata.yml b/recipes/minizip-ng/all/conandata.yml index 8f3820f91e16d..4e96dfa1d6b27 100644 --- a/recipes/minizip-ng/all/conandata.yml +++ b/recipes/minizip-ng/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.0.8": + url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.8.tar.gz" + sha256: "27cc2f62cd02d79b71b346fc6ace02728385f8ba9c6b5f124062b0790a04629a" + "3.0.7": + url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.7.tar.gz" + sha256: "39981a0db1bb6da504909bce63d7493286c5e50825c056564544c990d15c55cf" "3.0.6": url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.6.tar.gz" sha256: "383fa1bdc28c482828a8a8db53f758dbd44291b641182724fda5df5b59cce543" @@ -17,3 +23,66 @@ sources: "3.0.1": url: "https://github.com/zlib-ng/minizip-ng/archive/3.0.1.tar.gz" sha256: "96c95b274dd535984ce0e87691691388f2b976106e8cf8d527b15da552ac94e4" +patches: + "3.0.8": + - patch_file: "patches/3.0.8-0001-fix-cmake-project.patch" + patch_description: "CMake: declare project() sooner" + patch_type: "conan" + - patch_file: "patches/3.0.6-0002-fix-lzma-libdir.patch" + patch_description: "CMake: inject libdir of lzma" + patch_type: "conan" + patch_source: "https://github.com/zlib-ng/minizip-ng/pull/658" + "3.0.7": + - patch_file: "patches/3.0.7-0001-fix-cmake-project.patch" + patch_description: "CMake: declare project() sooner" + patch_type: "conan" + - patch_file: "patches/3.0.6-0002-fix-lzma-libdir.patch" + patch_description: "CMake: inject libdir of lzma" + patch_type: "conan" + patch_source: "https://github.com/zlib-ng/minizip-ng/pull/658" + "3.0.6": + - patch_file: "patches/3.0.6-0001-fix-cmake-project.patch" + patch_description: "CMake: declare project() sooner" + patch_type: "conan" + - patch_file: "patches/3.0.6-0002-fix-lzma-libdir.patch" + patch_description: "CMake: inject libdir of lzma" + patch_type: "conan" + patch_source: "https://github.com/zlib-ng/minizip-ng/pull/658" + "3.0.5": + - patch_file: "patches/3.0.5-0001-fix-cmake-project.patch" + patch_description: "CMake: declare project() sooner" + patch_type: "conan" + - patch_file: "patches/3.0.5-0002-fix-lzma-libdir.patch" + patch_description: "CMake: inject libdir of lzma" + patch_type: "conan" + patch_source: "https://github.com/zlib-ng/minizip-ng/pull/658" + "3.0.4": + - patch_file: "patches/3.0.4-0001-fix-cmake-project.patch" + - patch_file: "patches/3.0.1-0002-fix-lzma-libdir.patch" + patch_description: "CMake: inject libdir of lzma" + patch_type: "conan" + patch_source: "https://github.com/zlib-ng/minizip-ng/pull/658" + "3.0.3": + - patch_file: "patches/3.0.3-0001-fix-cmake-project.patch" + patch_description: "CMake: declare project() sooner" + patch_type: "conan" + - patch_file: "patches/3.0.1-0002-fix-lzma-libdir.patch" + patch_description: "CMake: inject libdir of lzma" + patch_type: "conan" + patch_source: "https://github.com/zlib-ng/minizip-ng/pull/658" + "3.0.2": + - patch_file: "patches/3.0.2-0001-fix-cmake-project.patch" + patch_description: "CMake: declare project() sooner" + patch_type: "conan" + - patch_file: "patches/3.0.1-0002-fix-lzma-libdir.patch" + patch_description: "CMake: inject libdir of lzma" + patch_type: "conan" + patch_source: "https://github.com/zlib-ng/minizip-ng/pull/658" + "3.0.1": + - patch_file: "patches/3.0.1-0001-fix-cmake-project.patch" + patch_description: "CMake: declare project() sooner" + patch_type: "conan" + - patch_file: "patches/3.0.1-0002-fix-lzma-libdir.patch" + patch_description: "CMake: inject libdir of lzma" + patch_type: "conan" + patch_source: "https://github.com/zlib-ng/minizip-ng/pull/658" diff --git a/recipes/minizip-ng/all/conanfile.py b/recipes/minizip-ng/all/conanfile.py index b267a9c8b4896..a40841850695a 100644 --- a/recipes/minizip-ng/all/conanfile.py +++ b/recipes/minizip-ng/all/conanfile.py @@ -1,9 +1,14 @@ +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.gnu import PkgConfigDeps from conan.tools.microsoft import is_msvc -from conans import ConanFile, tools, CMake -import functools +from conan.tools.scm import Version import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" class MinizipNgConan(ConanFile): @@ -42,95 +47,110 @@ class MinizipNgConan(ConanFile): "with_libcomp": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package", "pkg_config" - @property - def _source_subfolder(self): - return "source_subfolder" + def _is_clang_cl(self): + return self.settings.os == "Windows" and self.settings.compiler == "clang" @property - def _build_subfolder(self): - return "build_subfolder" + def _needs_pkg_config(self): + return self.options.with_lzma or self.options.with_zstd or self.options.with_openssl - @property - def _is_clang_cl(self): - return self.settings.os == "Windows" and self.settings.compiler == "clang" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC del self.options.with_iconv del self.options.with_libbsd - if not tools.is_apple_os(self.settings.os): + if not is_apple_os(self): del self.options.with_libcomp def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if self.options.mz_compatibility: self.provides = "minizip" if self.options.get_safe("with_libcomp"): del self.options.with_zlib + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_bzip2: self.requires("bzip2/1.0.8") if self.options.with_lzma: - self.requires("xz_utils/5.2.5") + self.requires("xz_utils/5.4.0") if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.settings.os != "Windows": if self.options.get_safe("with_iconv"): self.requires("libiconv/1.17") def build_requirements(self): - self.build_requires("pkgconf/1.7.4") + if self._needs_pkg_config: + self.tool_requires("pkgconf/1.9.3") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["MZ_FETCH_LIBS"] = False - cmake.definitions["MZ_COMPAT"] = self.options.mz_compatibility - cmake.definitions["MZ_ZLIB"] = self.options.get_safe("with_zlib", False) - cmake.definitions["MZ_BZIP2"] = self.options.with_bzip2 - cmake.definitions["MZ_LZMA"] = self.options.with_lzma - cmake.definitions["MZ_ZSTD"] = self.options.with_zstd - cmake.definitions["MZ_OPENSSL"] = self.options.with_openssl - cmake.definitions["MZ_LIBCOMP"] = self.options.get_safe("with_libcomp", False) - + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + if self._needs_pkg_config: + env = VirtualBuildEnv(self) + env.generate() + + tc = CMakeToolchain(self) + tc.cache_variables["MZ_FETCH_LIBS"] = False + tc.cache_variables["MZ_COMPAT"] = self.options.mz_compatibility + tc.cache_variables["MZ_ZLIB"] = self.options.get_safe("with_zlib", False) + tc.cache_variables["MZ_BZIP2"] = self.options.with_bzip2 + tc.cache_variables["MZ_LZMA"] = self.options.with_lzma + tc.cache_variables["MZ_ZSTD"] = self.options.with_zstd + tc.cache_variables["MZ_OPENSSL"] = self.options.with_openssl + tc.cache_variables["MZ_LIBCOMP"] = self.options.get_safe("with_libcomp", False) if self.settings.os != "Windows": - cmake.definitions["MZ_ICONV"] = self.options.with_iconv - cmake.definitions["MZ_LIBBSD"] = self.options.with_libbsd - - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.cache_variables["MZ_ICONV"] = self.options.with_iconv + tc.cache_variables["MZ_LIBBSD"] = self.options.with_libbsd + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + if self._needs_pkg_config: + deps = PkgConfigDeps(self) + deps.generate() + # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) + env = Environment() + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + env.vars(self).save_script("conanbuild_pkg_config_path") def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE 1)", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "minizip") @@ -139,11 +159,11 @@ def package_info(self): # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed prefix = "lib" if is_msvc(self) or self._is_clang_cl else "" - suffix = "" if tools.Version(self.version) < "3.0.5" or self.options.mz_compatibility else "-ng" + suffix = "" if Version(self.version) < "3.0.5" or self.options.mz_compatibility else "-ng" self.cpp_info.components["minizip"].libs = [f"{prefix}minizip{suffix}"] if self.options.with_lzma: self.cpp_info.components["minizip"].defines.append("HAVE_LZMA") - if tools.is_apple_os(self.settings.os) and self.options.get_safe("with_libcomp"): + if is_apple_os(self) and self.options.get_safe("with_libcomp"): self.cpp_info.components["minizip"].defines.append("HAVE_LIBCOMP") if self.options.with_bzip2: self.cpp_info.components["minizip"].defines.append("HAVE_BZIP2") @@ -153,7 +173,6 @@ def package_info(self): self.cpp_info.filenames["cmake_find_package_multi"] = "minizip" self.cpp_info.names["cmake_find_package"] = "MINIZIP" self.cpp_info.names["cmake_find_package_multi"] = "MINIZIP" - self.cpp_info.names["pkg_config"] = "minizip" self.cpp_info.components["minizip"].names["cmake_find_package"] = "minizip" self.cpp_info.components["minizip"].names["cmake_find_package_multi"] = "minizip" self.cpp_info.components["minizip"].set_property("cmake_target_name", "MINIZIP::minizip") diff --git a/recipes/minizip-ng/all/patches/3.0.1-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.1-0001-fix-cmake-project.patch new file mode 100644 index 0000000000000..c44b1784ce620 --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.1-0001-fix-cmake-project.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,10 +63,10 @@ endif() + # BZIP2_ROOT - Parent directory of BZip2 installation + # OPENSSL_ROOT - Parent directory of OpenSSL installation + +-enable_language(C) + + # Library version + set(VERSION "3.0.1") ++project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION} LANGUAGES C) + + # API version + set(SOVERSION "3.0") +@@ -677,7 +677,6 @@ endif() + list(APPEND MINIZIP_INC ${CMAKE_CURRENT_SOURCE_DIR}) + + # Create minizip library +-project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION}) + + if(NOT ${MZ_PROJECT_SUFFIX} STREQUAL "") + message(STATUS "Project configured as ${PROJECT_NAME}") diff --git a/recipes/minizip-ng/all/patches/3.0.1-0002-fix-lzma-libdir.patch b/recipes/minizip-ng/all/patches/3.0.1-0002-fix-lzma-libdir.patch new file mode 100644 index 0000000000000..cb1ecba6e8149 --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.1-0002-fix-lzma-libdir.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -312,6 +312,7 @@ if(MZ_LZMA) + + list(APPEND MINIZIP_INC ${LIBLZMA_INCLUDE_DIRS}) + list(APPEND MINIZIP_LIB ${LIBLZMA_LIBRARIES}) ++ list(APPEND MINIZIP_LBD ${LIBLZMA_LIBRARY_DIRS}) + + set(PC_PRIVATE_LIBS "${PC_PRIVATE_LIBS} -lliblzma") + elseif(MZ_FETCH_LIBS) diff --git a/recipes/minizip-ng/all/patches/3.0.2-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.2-0001-fix-cmake-project.patch new file mode 100644 index 0000000000000..8cfa267f8cff7 --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.2-0001-fix-cmake-project.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,10 +63,10 @@ endif() + # BZIP2_ROOT - Parent directory of BZip2 installation + # OPENSSL_ROOT - Parent directory of OpenSSL installation + +-enable_language(C) + + # Library version + set(VERSION "3.0.2") ++project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION} LANGUAGES C) + + # API version + set(SOVERSION "3.0") +@@ -681,7 +681,6 @@ endif() + list(APPEND MINIZIP_INC ${CMAKE_CURRENT_SOURCE_DIR}) + + # Create minizip library +-project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION}) + + if(NOT ${MZ_PROJECT_SUFFIX} STREQUAL "") + message(STATUS "Project configured as ${PROJECT_NAME}") diff --git a/recipes/minizip-ng/all/patches/3.0.3-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.3-0001-fix-cmake-project.patch new file mode 100644 index 0000000000000..484eb23a91671 --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.3-0001-fix-cmake-project.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,10 +63,10 @@ endif() + # BZIP2_ROOT - Parent directory of BZip2 installation + # OPENSSL_ROOT - Parent directory of OpenSSL installation + +-enable_language(C) + + # Library version + set(VERSION "3.0.3") ++project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION} LANGUAGES C) + + # API version + set(SOVERSION "3") +@@ -681,7 +681,6 @@ endif() + list(APPEND MINIZIP_INC ${CMAKE_CURRENT_SOURCE_DIR}) + + # Create minizip library +-project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION}) + + if(NOT ${MZ_PROJECT_SUFFIX} STREQUAL "") + message(STATUS "Project configured as ${PROJECT_NAME}") diff --git a/recipes/minizip-ng/all/patches/3.0.4-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.4-0001-fix-cmake-project.patch new file mode 100644 index 0000000000000..5ae134194c263 --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.4-0001-fix-cmake-project.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -63,10 +63,10 @@ endif() + # BZIP2_ROOT - Parent directory of BZip2 installation + # OPENSSL_ROOT - Parent directory of OpenSSL installation + +-enable_language(C) + + # Library version + set(VERSION "3.0.4") ++project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION} LANGUAGES C) + + # API version + set(SOVERSION "3") +@@ -681,7 +681,6 @@ endif() + list(APPEND MINIZIP_INC ${CMAKE_CURRENT_SOURCE_DIR}) + + # Create minizip library +-project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION}) + + if(NOT ${MZ_PROJECT_SUFFIX} STREQUAL "") + message(STATUS "Project configured as ${PROJECT_NAME}") diff --git a/recipes/minizip-ng/all/patches/3.0.5-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.5-0001-fix-cmake-project.patch new file mode 100644 index 0000000000000..bc28f8055105e --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.5-0001-fix-cmake-project.patch @@ -0,0 +1,22 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -66,10 +66,10 @@ endif() + # BZIP2_ROOT - Parent directory of BZip2 installation + # OPENSSL_ROOT - Parent directory of OpenSSL installation + +-enable_language(C) + + # Library version + set(VERSION "3.0.5") ++project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION} LANGUAGES C) + + # API version + set(SOVERSION "3") +@@ -661,7 +661,6 @@ endif() + list(APPEND MINIZIP_INC ${CMAKE_CURRENT_SOURCE_DIR}) + + # Create minizip library +-project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION}) + + if(NOT ${MZ_PROJECT_SUFFIX} STREQUAL "") + message(STATUS "Project configured as ${PROJECT_NAME}") diff --git a/recipes/minizip-ng/all/patches/3.0.5-0002-fix-lzma-libdir.patch b/recipes/minizip-ng/all/patches/3.0.5-0002-fix-lzma-libdir.patch new file mode 100644 index 0000000000000..0e4b01050297b --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.5-0002-fix-lzma-libdir.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -303,6 +303,7 @@ if(MZ_LZMA) + + list(APPEND MINIZIP_INC ${LIBLZMA_INCLUDE_DIRS}) + list(APPEND MINIZIP_LIB ${LIBLZMA_LIBRARIES}) ++ list(APPEND MINIZIP_LBD ${LIBLZMA_LIBRARY_DIRS}) + + set(PC_PRIVATE_LIBS "${PC_PRIVATE_LIBS} -lliblzma") + elseif(MZ_FETCH_LIBS) diff --git a/recipes/minizip-ng/all/patches/3.0.6-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.6-0001-fix-cmake-project.patch new file mode 100644 index 0000000000000..e08990e93540e --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.6-0001-fix-cmake-project.patch @@ -0,0 +1,18 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -70,6 +70,7 @@ enable_language(C) + + # Library version + set(VERSION "3.0.6") ++project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION} LANGUAGES C) + + # API version + set(SOVERSION "3") +@@ -663,7 +664,6 @@ endif() + list(APPEND MINIZIP_INC ${CMAKE_CURRENT_SOURCE_DIR}) + + # Create minizip library +-project(minizip${MZ_PROJECT_SUFFIX} LANGUAGES C VERSION ${VERSION}) + + if(NOT ${MZ_PROJECT_SUFFIX} STREQUAL "") + message(STATUS "Project configured as ${PROJECT_NAME}") diff --git a/recipes/minizip-ng/all/patches/3.0.6-0002-fix-lzma-libdir.patch b/recipes/minizip-ng/all/patches/3.0.6-0002-fix-lzma-libdir.patch new file mode 100644 index 0000000000000..5e74ea2fc0802 --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.6-0002-fix-lzma-libdir.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -304,6 +304,7 @@ if(MZ_LZMA) + + list(APPEND MINIZIP_INC ${LIBLZMA_INCLUDE_DIRS}) + list(APPEND MINIZIP_LIB ${LIBLZMA_LIBRARIES}) ++ list(APPEND MINIZIP_LBD ${LIBLZMA_LIBRARY_DIRS}) + + set(PC_PRIVATE_LIBS "${PC_PRIVATE_LIBS} -lliblzma") + elseif(MZ_FETCH_LIBS) diff --git a/recipes/minizip-ng/all/patches/3.0.7-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.7-0001-fix-cmake-project.patch new file mode 100644 index 0000000000000..5f9e5f69169bc --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.7-0001-fix-cmake-project.patch @@ -0,0 +1,18 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -70,6 +70,7 @@ enable_language(C) + + # Library version + set(VERSION "3.0.7") ++project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION} LANGUAGES C) + + # API version + set(SOVERSION "3") +@@ -670,7 +671,6 @@ endif() + list(APPEND MINIZIP_INC ${CMAKE_CURRENT_SOURCE_DIR}) + + # Create minizip library +-project(minizip${MZ_PROJECT_SUFFIX} LANGUAGES C VERSION ${VERSION}) + + if(NOT ${MZ_PROJECT_SUFFIX} STREQUAL "") + message(STATUS "Project configured as ${PROJECT_NAME}") diff --git a/recipes/minizip-ng/all/patches/3.0.8-0001-fix-cmake-project.patch b/recipes/minizip-ng/all/patches/3.0.8-0001-fix-cmake-project.patch new file mode 100644 index 0000000000000..608ac1f98c9c7 --- /dev/null +++ b/recipes/minizip-ng/all/patches/3.0.8-0001-fix-cmake-project.patch @@ -0,0 +1,20 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index a073919..7ff2b58 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -70,6 +70,7 @@ enable_language(C) + + # Library version + set(VERSION "3.0.8") ++project(minizip${MZ_PROJECT_SUFFIX} VERSION ${VERSION} LANGUAGES C) + + # API version + set(SOVERSION "3") +@@ -663,7 +664,6 @@ endif() + list(APPEND MINIZIP_INC ${CMAKE_CURRENT_SOURCE_DIR}) + + # Create minizip library +-project(minizip${MZ_PROJECT_SUFFIX} LANGUAGES C VERSION ${VERSION}) + + if(NOT ${MZ_PROJECT_SUFFIX} STREQUAL "") + message(STATUS "Project configured as ${PROJECT_NAME}") diff --git a/recipes/minizip-ng/all/test_package/CMakeLists.txt b/recipes/minizip-ng/all/test_package/CMakeLists.txt index 3e53683d176a0..db0b9a15e540e 100644 --- a/recipes/minizip-ng/all/test_package/CMakeLists.txt +++ b/recipes/minizip-ng/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(minizip CONFIG REQUIRED) +find_package(minizip REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} MINIZIP::minizip) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE MINIZIP::minizip) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/minizip-ng/all/test_package/conanfile.py b/recipes/minizip-ng/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/minizip-ng/all/test_package/conanfile.py +++ b/recipes/minizip-ng/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/minizip-ng/all/test_v1_package/CMakeLists.txt b/recipes/minizip-ng/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/minizip-ng/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/minizip-ng/all/test_v1_package/conanfile.py b/recipes/minizip-ng/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/minizip-ng/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/minizip-ng/config.yml b/recipes/minizip-ng/config.yml index ab9b917838ae4..7802f2e3e4d7f 100644 --- a/recipes/minizip-ng/config.yml +++ b/recipes/minizip-ng/config.yml @@ -1,4 +1,8 @@ versions: + "3.0.8": + folder: all + "3.0.7": + folder: all "3.0.6": folder: all "3.0.5": diff --git a/recipes/minizip/all/CMakeLists.txt b/recipes/minizip/all/CMakeLists.txt index 951dd69554eab..c17b5f7dd7466 100644 --- a/recipes/minizip/all/CMakeLists.txt +++ b/recipes/minizip/all/CMakeLists.txt @@ -1,75 +1,75 @@ -# This CMake file has been extracted from VCPKG and is under MIT license: -# https://github.com/microsoft/vcpkg/blob/master/ports/minizip/CMakeLists.txt cmake_minimum_required(VERSION 3.4) -project(minizip C) +project(minizip LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -option(ENABLE_BZIP2 "Build minizip with bzip2 support" ON) -option(BUILD_TOOLS "Build minizip tool" OFF) +option(MINIZIP_ENABLE_BZIP2 "Build minizip with bzip2 support" ON) +option(MINIZIP_BUILD_TOOLS "Build minizip tool" OFF) include(GNUInstallDirs) -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") -set(MIN_SRC "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/contrib/minizip") -include_directories(${MIN_SRC}) +find_package(ZLIB REQUIRED) +if(MINIZIP_ENABLE_BZIP2) + find_package(BZip2 REQUIRED) +endif() set(SOURCE_FILES - ${MIN_SRC}/ioapi.c - ${MIN_SRC}/unzip.c - ${MIN_SRC}/zip.c - ${MIN_SRC}/mztools.c + ${MINIZIP_SRC_DIR}/ioapi.c + ${MINIZIP_SRC_DIR}/unzip.c + ${MINIZIP_SRC_DIR}/zip.c + ${MINIZIP_SRC_DIR}/mztools.c ) if(WIN32) - list(APPEND SOURCE_FILES ${MIN_SRC}/iowin32.c) + list(APPEND SOURCE_FILES ${MINIZIP_SRC_DIR}/iowin32.c) endif() set(HEADER_FILES - ${MIN_SRC}/ioapi.h - ${MIN_SRC}/unzip.h - ${MIN_SRC}/zip.h - ${MIN_SRC}/mztools.h + ${MINIZIP_SRC_DIR}/ioapi.h + ${MINIZIP_SRC_DIR}/unzip.h + ${MINIZIP_SRC_DIR}/zip.h + ${MINIZIP_SRC_DIR}/mztools.h ) if(WIN32) - list(APPEND HEADER_FILES ${MIN_SRC}/iowin32.h) + list(APPEND HEADER_FILES ${MINIZIP_SRC_DIR}/iowin32.h) endif() add_library(minizip ${SOURCE_FILES}) -target_link_libraries(minizip PUBLIC ${CONAN_LIBS}) +target_link_libraries(minizip PUBLIC ZLIB::ZLIB) target_compile_definitions(minizip PRIVATE -D_ZLIB_H) +target_include_directories(minizip PUBLIC ${MINIZIP_SRC_DIR}) +set_target_properties(minizip PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) -if(ENABLE_BZIP2) - target_compile_definitions(minizip PRIVATE -DHAVE_BZIP2=1) +if(MINIZIP_ENABLE_BZIP2) + target_compile_definitions(minizip PUBLIC HAVE_BZIP2=1) + target_link_libraries(minizip PUBLIC BZip2::BZip2) endif() if(MSVC) - target_compile_options(minizip PUBLIC /W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) + target_compile_options(minizip PRIVATE /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) endif() -if (BUILD_TOOLS) - add_executable(minizip_bin ${MIN_SRC}/minizip.c) - add_executable(miniunz_bin ${MIN_SRC}/miniunz.c) +install( + TARGETS minizip + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/minizip) + +if(MINIZIP_BUILD_TOOLS) + add_executable(minizip_bin ${MINIZIP_SRC_DIR}/minizip.c) + add_executable(miniunz_bin ${MINIZIP_SRC_DIR}/miniunz.c) - target_link_libraries(minizip_bin minizip ${CONAN_LIBS}) - target_link_libraries(miniunz_bin minizip ${CONAN_LIBS}) + target_link_libraries(minizip_bin PRIVATE minizip) + target_link_libraries(miniunz_bin PRIVATE minizip) set_target_properties(minizip_bin PROPERTIES OUTPUT_NAME minizip) set_target_properties(miniunz_bin PROPERTIES OUTPUT_NAME miniunz) if(MSVC) - target_compile_options(minizip_bin PUBLIC /W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) - target_compile_options(miniunz_bin PUBLIC /W3 /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) + target_compile_options(minizip_bin PRIVATE /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) + target_compile_options(miniunz_bin PRIVATE /wd4005 /wd4996 /wd4018 -D_CRT_SECURE_NO_WARNINGS) endif() install(TARGETS minizip_bin miniunz_bin DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() - -install( - TARGETS minizip - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} -) - -install(FILES ${HEADER_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/minizip) diff --git a/recipes/minizip/all/conandata.yml b/recipes/minizip/all/conandata.yml index 5bf7501fd7ca5..d1d3166de347b 100644 --- a/recipes/minizip/all/conandata.yml +++ b/recipes/minizip/all/conandata.yml @@ -1,18 +1,19 @@ sources: + "1.2.13": + url: "https://zlib.net/fossils/zlib-1.2.13.tar.gz" + sha256: "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30" "1.2.12": - url: "https://github.com/madler/zlib/archive/refs/tags/v1.2.12.tar.gz" - sha256: "d8688496ea40fb61787500e863cc63c9afcbc524468cedeb478068924eb54932" + url: "https://zlib.net/fossils/zlib-1.2.12.tar.gz" + sha256: "91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9" "1.2.11": - url: "https://github.com/madler/zlib/archive/v1.2.11.tar.gz" - sha256: "629380c90a77b964d896ed37163f5c3a34f6e6d897311f1df2a7016355c45eff" + url: "https://zlib.net/fossils/zlib-1.2.11.tar.gz" + sha256: "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1" patches: + "1.2.13": + - patch_file: "patches/minizip.patch" "1.2.12": - patch_file: "patches/minizip.patch" - base_path: "source_subfolder" - patch_file: "patches/ioapi.patch" - base_path: "source_subfolder" "1.2.11": - patch_file: "patches/minizip.patch" - base_path: "source_subfolder" - patch_file: "patches/miniunz.patch" - base_path: "source_subfolder" diff --git a/recipes/minizip/all/conanfile.py b/recipes/minizip/all/conanfile.py index 02e4e854caf96..e4316426a6e9c 100644 --- a/recipes/minizip/all/conanfile.py +++ b/recipes/minizip/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile -from conan.tools import files -from conans import CMake -import functools +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, save +import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class MinizipConan(ConanFile): @@ -28,16 +28,9 @@ class MinizipConan(ConanFile): "tools": False, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,51 +38,53 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13", transitive_headers=True) if self.options.bzip2: - self.requires("bzip2/1.0.8") + self.requires("bzip2/1.0.8", transitive_headers=True) def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["ENABLE_BZIP2"] = self.options.bzip2 - cmake.definitions["BUILD_TOOLS"] = self.options.tools - cmake.configure() - return cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MINIZIP_SRC_DIR"] = os.path.join(self.source_folder, "contrib", "minizip").replace("\\", "/") + tc.variables["MINIZIP_ENABLE_BZIP2"] = self.options.bzip2 + tc.variables["MINIZIP_BUILD_TOOLS"] = self.options.tools + # fopen64 and similar are unavailable before API level 24: https://github.com/madler/zlib/pull/436 + if self.settings.os == "Android" and int(str(self.settings.os.api_level)) < 24: + tc.preprocessor_definitions["IOAPI_NO_64"] = "1" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - files.apply_conandata_patches(self) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def _extract_license(self): - with files.chdir(self, f"{self.source_folder}/{self._source_subfolder}"): - tmp = files.load(self, "zlib.h") - license_contents = tmp[2:tmp.find("*/", 1)] - files.save(self, "LICENSE", license_contents) + zlib_h = load(self, os.path.join(self.source_folder, "zlib.h")) + return zlib_h[2:zlib_h.find("*/", 1)] def package(self): - self._extract_license() - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["minizip"] - self.cpp_info.includedirs = ["include", "include/minizip"] + self.cpp_info.includedirs.append(os.path.join("include", "minizip")) if self.options.bzip2: self.cpp_info.defines.append("HAVE_BZIP2") if self.options.tools: - bin_path = f"{self.package_folder}/bin" - self.output.info(f"Appending PATH environment variable: {bin_path}") - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/minizip/all/test_package/CMakeLists.txt b/recipes/minizip/all/test_package/CMakeLists.txt index cd42f4ee7bc25..b56bb073cf606 100644 --- a/recipes/minizip/all/test_package/CMakeLists.txt +++ b/recipes/minizip/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(minizip REQUIRED CONFIG) -add_executable(test_package test_package.c) -target_link_libraries(test_package minizip::minizip) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE minizip::minizip) diff --git a/recipes/minizip/all/test_package/conanfile.py b/recipes/minizip/all/test_package/conanfile.py index 13a71350a8761..0a6bc68712d90 100644 --- a/recipes/minizip/all/test_package/conanfile.py +++ b/recipes/minizip/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/minizip/all/test_package/test_package.c b/recipes/minizip/all/test_package/test_package.c index a75ed1b968020..46d12fc8ea16c 100644 --- a/recipes/minizip/all/test_package/test_package.c +++ b/recipes/minizip/all/test_package/test_package.c @@ -50,4 +50,3 @@ int main(int argc, char** argv) { return EXIT_SUCCESS; } - diff --git a/recipes/minizip/all/test_v1_package/CMakeLists.txt b/recipes/minizip/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/minizip/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/minizip/all/test_v1_package/conanfile.py b/recipes/minizip/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/minizip/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/minizip/config.yml b/recipes/minizip/config.yml index a92270f2d870a..351c06f68201f 100644 --- a/recipes/minizip/config.yml +++ b/recipes/minizip/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.13": + folder: all "1.2.12": folder: all "1.2.11": diff --git a/recipes/modern-cpp-kafka/all/conandata.yml b/recipes/modern-cpp-kafka/all/conandata.yml index bc2b322038f8f..5e88d0cb2152f 100644 --- a/recipes/modern-cpp-kafka/all/conandata.yml +++ b/recipes/modern-cpp-kafka/all/conandata.yml @@ -1,7 +1,16 @@ sources: + "2023.01.05": + url: "https://github.com/morganstanley/modern-cpp-kafka/archive/v2023.01.05.tar.gz" + sha256: "3ac5256b7b16bab020b32ac048cf53fddc3353682068bb727eb7c95550598b9b" + "2022.12.07": + url: "https://github.com/morganstanley/modern-cpp-kafka/archive/v2022.12.07.tar.gz" + sha256: "980533fe5e0f5630d7deab6567ed051cf51d61ac341e4a75810f68d58cbff439" + "2022.10.12": + url: "https://github.com/morganstanley/modern-cpp-kafka/archive/v2022.10.12.tar.gz" + sha256: "f60c6d6328e64a8ae0c3233921078160fc4e42a3484eb823d9918895f5f1b39f" "2022.08.01": url: "https://github.com/morganstanley/modern-cpp-kafka/archive/v2022.08.01.tar.gz" sha256: "77998caf50ffcc55c77713571d9ce04a37020ccff7b713d14abad9eb8ceb05b3" "2022.06.15": - url: https://github.com/morganstanley/modern-cpp-kafka/archive/refs/tags/v2022.06.15.tar.gz - sha256: 478fcf560057b7cf7b4be851838ebf0520806d057b172de23261606fce088d27 + url: "https://github.com/morganstanley/modern-cpp-kafka/archive/refs/tags/v2022.06.15.tar.gz" + sha256: "478fcf560057b7cf7b4be851838ebf0520806d057b172de23261606fce088d27" diff --git a/recipes/modern-cpp-kafka/all/conanfile.py b/recipes/modern-cpp-kafka/all/conanfile.py index eebf2c5395b60..623a7a9a942f9 100644 --- a/recipes/modern-cpp-kafka/all/conanfile.py +++ b/recipes/modern-cpp-kafka/all/conanfile.py @@ -1,41 +1,71 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.microsoft import check_min_vs, is_msvc import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.52.0" class ModernCppKafkaConan(ConanFile): name = "modern-cpp-kafka" description = "A C++ API for Kafka clients (i.e. KafkaProducer, KafkaConsumer, AdminClient)" license = "Apache-2.0" - topics = ("kafka", "librdkafka", "kafkaproducer", "kafkaconsumer") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/morganstanley/modern-cpp-kafka" - settings = "arch", "build_type", "compiler", "os" + topics = ("kafka", "librdkafka", "kafkaproducer", "kafkaconsumer", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def requirements(self): - self.requires("librdkafka/1.8.2") + @property + def _min_cppstd(self): + return 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("librdkafka/1.9.2") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) - def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def package_id(self): - self.info.header_only() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "ModernCppKafka") self.cpp_info.set_property("cmake_target_name", "ModernCppKafka::ModernCppKafka") self.cpp_info.names["cmake_find_package"] = "ModernCppKafka" diff --git a/recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt b/recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt index 0d36924d633da..e00b58eaa4743 100644 --- a/recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt +++ b/recipes/modern-cpp-kafka/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_CXX_STANDARD 17) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(ModernCppKafka REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ModernCppKafka::ModernCppKafka) +target_link_libraries(${PROJECT_NAME} PRIVATE ModernCppKafka::ModernCppKafka) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/modern-cpp-kafka/all/test_package/conanfile.py b/recipes/modern-cpp-kafka/all/test_package/conanfile.py index 81a08015e01f1..b9d7f11e89dcd 100644 --- a/recipes/modern-cpp-kafka/all/test_package/conanfile.py +++ b/recipes/modern-cpp-kafka/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/modern-cpp-kafka/all/test_v1_package/CMakeLists.txt b/recipes/modern-cpp-kafka/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/modern-cpp-kafka/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/modern-cpp-kafka/all/test_v1_package/conanfile.py b/recipes/modern-cpp-kafka/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/modern-cpp-kafka/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/modern-cpp-kafka/config.yml b/recipes/modern-cpp-kafka/config.yml index a56acb8dfd0e1..200b1492abe9f 100644 --- a/recipes/modern-cpp-kafka/config.yml +++ b/recipes/modern-cpp-kafka/config.yml @@ -1,4 +1,10 @@ versions: + "2023.01.05": + folder: all + "2022.12.07": + folder: all + "2022.10.12": + folder: all "2022.08.01": folder: all "2022.06.15": diff --git a/recipes/mold/1.3.1/conandata.yml b/recipes/mold/1.3.1/conandata.yml new file mode 100644 index 0000000000000..5d89f31c243f2 --- /dev/null +++ b/recipes/mold/1.3.1/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.3.1": + url: "https://github.com/rui314/mold/archive/refs/tags/v1.3.1.tar.gz" + sha256: "d436e2d4c1619a97aca0e28f26c4e79c0242d10ce24e829c1b43cfbdd196fd77" diff --git a/recipes/mold/1.3.1/conanfile.py b/recipes/mold/1.3.1/conanfile.py new file mode 100644 index 0000000000000..132186858b019 --- /dev/null +++ b/recipes/mold/1.3.1/conanfile.py @@ -0,0 +1,104 @@ +from conan import ConanFile +from conan.tools.scm import Version +from conan.tools import files +from conan.tools.files import copy +from conan.errors import ConanInvalidConfiguration +from conans import AutoToolsBuildEnvironment +import os + +required_conan_version = ">=1.47.0" + +class MoldConan(ConanFile): + name = "mold" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/rui314/mold/" + license = "AGPL-3.0" + description = ("mold is a faster drop-in replacement for existing Unix linkers. It is several times faster than the LLVM lld linker") + topics = ("mold", "ld", "linkage", "compilation") + + settings = "os", "arch", "compiler", "build_type" + + generators = "make" + + def validate(self): + if self.settings.build_type == "Debug": + raise ConanInvalidConfiguration('Mold is a build tool, specify mold:build_type=Release in your build profile, see https://github.com/conan-io/conan-center-index/pull/11536#issuecomment-1195607330') + if self.settings.compiler in ["gcc", "clang", "intel-cc"] and self.settings.compiler.libcxx != "libstdc++11": + raise ConanInvalidConfiguration('Mold can only be built with libstdc++11; specify mold:compiler.libcxx=libstdc++11 in your build profile') + if self.settings.os == "Windows": + raise ConanInvalidConfiguration(f'{self.name} can not be built on {self.settings.os}.') + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "10": + raise ConanInvalidConfiguration("GCC version 10 or higher required") + if (self.settings.compiler == "clang" or self.settings.compiler == "apple-clang") and Version(self.settings.compiler.version) < "12": + raise ConanInvalidConfiguration("Clang version 12 or higher required") + if self.settings.compiler == "apple-clang" and "armv8" == self.settings.arch : + raise ConanInvalidConfiguration(f'{self.name} is still not supported by Mac M1.') + + @property + def _source_subfolder(self): + return "source_subfolder" + + @property + def _build_subfolder(self): + return "build_subfolder" + + def _get_include_path(self, dependency): + include_path = self.deps_cpp_info[dependency].rootpath + include_path = os.path.join(include_path, "include") + return include_path + + def _patch_sources(self): + if self.settings.compiler == "apple-clang" or (self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "11"): + files.replace_in_file(self, "source_subfolder/Makefile", "-std=c++20", "-std=c++2a") + + files.replace_in_file(self, "source_subfolder/Makefile", "-Ithird-party/xxhash ", "-I{} -I{} -I{} -I{} -I{}".format( + self._get_include_path("zlib"), + self._get_include_path("openssl"), + self._get_include_path("xxhash"), + self._get_include_path("mimalloc"), + self._get_include_path("onetbb") + )) + + files.replace_in_file(self, "source_subfolder/Makefile", "MOLD_LDFLAGS += -ltbb", "MOLD_LDFLAGS += -L{} -ltbb".format( + self.deps_cpp_info["onetbb"].lib_paths[0])) + + files.replace_in_file(self, "source_subfolder/Makefile", "MOLD_LDFLAGS += -lmimalloc", "MOLD_LDFLAGS += -L{} -lmimalloc".format( + self.deps_cpp_info["mimalloc"].lib_paths[0])) + + def requirements(self): + self.requires("zlib/1.2.12") + self.requires("openssl/1.1.1q") + self.requires("xxhash/0.8.1") + self.requires("onetbb/2021.3.0") + self.requires("mimalloc/2.0.6") + + def source(self): + files.get(self, **self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) + + def build(self): + self._patch_sources() + with files.chdir(self, self._source_subfolder): + autotools = AutoToolsBuildEnvironment(self) + autotools.make(target="mold", args=['SYSTEM_TBB=1', 'SYSTEM_MIMALLOC=1']) + + def package(self): + copy(self, "LICENSE", src=self._source_subfolder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "mold", src="bin", dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "mold", src=self._source_subfolder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + + def package_id(self): + del self.info.settings.compiler + + def package_info(self): + bindir = os.path.join(self.package_folder, "bin") + mold_location = os.path.join(bindir, "bindir") + + self.output.info('Appending PATH environment variable: {}'.format(bindir)) + self.env_info.PATH.append(bindir) + self.env_info.LD = mold_location + self.buildenv_info.prepend_path("MOLD_ROOT", bindir) + self.cpp_info.includedirs = [] + + if self.settings.os == "Linux": + self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) diff --git a/recipes/mold/1.3.1/test_package/conanfile.py b/recipes/mold/1.3.1/test_package/conanfile.py new file mode 100644 index 0000000000000..f4c00d1c189e7 --- /dev/null +++ b/recipes/mold/1.3.1/test_package/conanfile.py @@ -0,0 +1,9 @@ +from conan import ConanFile +from conan.tools.build import cross_building + +class TestPackageConan(ConanFile): + settings = "os", "arch", "build_type", "compiler" + + def test(self): + if not cross_building(self): + self.run("mold -v", run_environment=True) diff --git a/recipes/mold/all/conandata.yml b/recipes/mold/all/conandata.yml index 5d89f31c243f2..1a021caadcd5c 100644 --- a/recipes/mold/all/conandata.yml +++ b/recipes/mold/all/conandata.yml @@ -1,4 +1,13 @@ sources: - "1.3.1": - url: "https://github.com/rui314/mold/archive/refs/tags/v1.3.1.tar.gz" - sha256: "d436e2d4c1619a97aca0e28f26c4e79c0242d10ce24e829c1b43cfbdd196fd77" + "1.4.2": + url: "https://github.com/rui314/mold/archive/refs/tags/v1.4.2.tar.gz" + sha256: "47e6c48d20f49e5b47dfb8197dd9ffcb11a8833d614f7a03bd29741c658a69cd" + "1.5.1": + url: "https://github.com/rui314/mold/archive/refs/tags/v1.5.1.tar.gz" + sha256: "ec94aa74758f1bc199a732af95c6304ec98292b87f2f4548ce8436a7c5b054a1" + "1.7.1": + url: "https://github.com/rui314/mold/archive/refs/tags/v1.7.1.tar.gz" + sha256: "fa2558664db79a1e20f09162578632fa856b3cde966fbcb23084c352b827dfa9" + "1.8.0": + url: "https://github.com/rui314/mold/archive/refs/tags/v1.8.0.tar.gz" + sha256: "7210225478796c2528aae30320232a5a3b93a640292575a8c55aa2b140041b5c" diff --git a/recipes/mold/all/conanfile.py b/recipes/mold/all/conanfile.py index d04bcc560084e..7a48206ed3782 100644 --- a/recipes/mold/all/conanfile.py +++ b/recipes/mold/all/conanfile.py @@ -1,11 +1,10 @@ +import os from conan import ConanFile -from conan.tools.scm import Version -from conan.tools import files +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import copy, get, rmdir from conan.errors import ConanInvalidConfiguration -from conans import AutoToolsBuildEnvironment -import os - -required_conan_version = ">=1.47.0" +from conan.tools.scm import Version +from conan.tools.env import VirtualBuildEnv class MoldConan(ConanFile): name = "mold" @@ -16,10 +15,16 @@ class MoldConan(ConanFile): topics = ("mold", "ld", "linkage", "compilation") settings = "os", "arch", "compiler", "build_type" - - generators = "make" + options = { + "with_mimalloc": [True, False], + } + default_options = { + "with_mimalloc": False, + } def validate(self): + #TODO most of these checks should run on validate_build, but the conan-center hooks are broken and fail the PR because they + # think we're raising on the build() method if self.settings.build_type == "Debug": raise ConanInvalidConfiguration('Mold is a build tool, specify mold:build_type=Release in your build profile, see https://github.com/conan-io/conan-center-index/pull/11536#issuecomment-1195607330') if self.settings.compiler in ["gcc", "clang", "intel-cc"] and self.settings.compiler.libcxx != "libstdc++11": @@ -28,75 +33,68 @@ def validate(self): raise ConanInvalidConfiguration(f'{self.name} can not be built on {self.settings.os}.') if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "10": raise ConanInvalidConfiguration("GCC version 10 or higher required") - if (self.settings.compiler == "clang" or self.settings.compiler == "apple-clang") and Version(self.settings.compiler.version) < "12": + if self.settings.compiler in ('clang', 'apple-clang') and Version(self.settings.compiler.version) < "12": raise ConanInvalidConfiguration("Clang version 12 or higher required") if self.settings.compiler == "apple-clang" and "armv8" == self.settings.arch : raise ConanInvalidConfiguration(f'{self.name} is still not supported by Mac M1.') - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - def _get_include_path(self, dependency): - include_path = self.deps_cpp_info[dependency].rootpath - include_path = os.path.join(include_path, "include") - return include_path - - def _patch_sources(self): - if self.settings.compiler == "apple-clang" or (self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "11"): - files.replace_in_file(self, "source_subfolder/Makefile", "-std=c++20", "-std=c++2a") - - files.replace_in_file(self, "source_subfolder/Makefile", "-Ithird-party/xxhash ", "-I{} -I{} -I{} -I{} -I{}".format( - self._get_include_path("zlib"), - self._get_include_path("openssl"), - self._get_include_path("xxhash"), - self._get_include_path("mimalloc"), - self._get_include_path("onetbb") - )) - - files.replace_in_file(self, "source_subfolder/Makefile", "MOLD_LDFLAGS += -ltbb", "MOLD_LDFLAGS += -L{} -ltbb".format( - self.deps_cpp_info["onetbb"].lib_paths[0])) - - files.replace_in_file(self, "source_subfolder/Makefile", "MOLD_LDFLAGS += -lmimalloc", "MOLD_LDFLAGS += -L{} -lmimalloc".format( - self.deps_cpp_info["mimalloc"].lib_paths[0])) + def layout(self): + cmake_layout(self, src_folder="src") + + def package_id(self): + del self.info.settings.compiler def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") self.requires("openssl/1.1.1q") self.requires("xxhash/0.8.1") self.requires("onetbb/2021.3.0") - self.requires("mimalloc/2.0.6") + if self.options.with_mimalloc: + self.requires("mimalloc/2.0.6") def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MOLD_USE_MIMALLOC"] = self.options.with_mimalloc + tc.variables["MOLD_USE_SYSTEM_MIMALLOC"] = True + tc.variables["MOLD_USE_SYSTEM_TBB"] = True + tc.variables["CMAKE_INSTALL_LIBEXECDIR"] = "libexec" + tc.generate() + + cd = CMakeDeps(self) + cd.generate() + + vbe = VirtualBuildEnv(self) + vbe.generate() def build(self): - self._patch_sources() - with files.chdir(self, self._source_subfolder): - autotools = AutoToolsBuildEnvironment(self) - autotools.make(target="mold", args=['SYSTEM_TBB=1', 'SYSTEM_MIMALLOC=1']) + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("mold", src=self._source_subfolder, dst="bin", keep_path=False) + cmake = CMake(self) + cmake.install() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - def package_id(self): - del self.info.settings.compiler + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): bindir = os.path.join(self.package_folder, "bin") - mold_location = os.path.join(bindir, "bindir") + mold_location = os.path.join(bindir, "mold") self.output.info('Appending PATH environment variable: {}'.format(bindir)) self.env_info.PATH.append(bindir) self.env_info.LD = mold_location self.buildenv_info.prepend_path("MOLD_ROOT", bindir) self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.resdirs = [] if self.settings.os == "Linux": self.cpp_info.system_libs.extend(["m", "pthread", "dl"]) diff --git a/recipes/mold/all/test_package/conanfile.py b/recipes/mold/all/test_package/conanfile.py index ce72e1030b169..60e9ac3ecf6ee 100644 --- a/recipes/mold/all/test_package/conanfile.py +++ b/recipes/mold/all/test_package/conanfile.py @@ -1,10 +1,16 @@ -import os -from conans import ConanFile, tools -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run -class TestPackageConan(ConanFile): - settings = "os", "arch", "build_type", "compiler" + +class MoldTestConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not cross_building(self): - self.run("mold -v", run_environment=True) + if can_run(self): + self.run("mold -v") + diff --git a/recipes/mold/all/test_v1_package/conanfile.py b/recipes/mold/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ce72e1030b169 --- /dev/null +++ b/recipes/mold/all/test_v1_package/conanfile.py @@ -0,0 +1,10 @@ +import os +from conans import ConanFile, tools +from conan.tools.build import cross_building + +class TestPackageConan(ConanFile): + settings = "os", "arch", "build_type", "compiler" + + def test(self): + if not cross_building(self): + self.run("mold -v", run_environment=True) diff --git a/recipes/mold/config.yml b/recipes/mold/config.yml index 59334d5077368..7461d58f360be 100644 --- a/recipes/mold/config.yml +++ b/recipes/mold/config.yml @@ -1,3 +1,11 @@ versions: "1.3.1": + folder: 1.3.1 + "1.4.2": + folder: all + "1.5.1": + folder: all + "1.7.1": + folder: all + "1.8.0": folder: all diff --git a/recipes/moltenvk/all/CMakeLists.txt b/recipes/moltenvk/all/CMakeLists.txt index 46d320ed52047..0b453780ee747 100644 --- a/recipes/moltenvk/all/CMakeLists.txt +++ b/recipes/moltenvk/all/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.12) project(MoltenVK) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - if(NOT (CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "tvOS")) @@ -12,19 +9,25 @@ endif() option(MVK_WITH_SPIRV_TOOLS "Build MoltenVK without the MVK_EXCLUDE_SPIRV_TOOLS build setting" ON) option(MVK_BUILD_SHADERCONVERTER_TOOL "Build MoltenVKShaderConverter" ON) +if(MVK_VERSION VERSION_GREATER_EQUAL "1.1.7" AND BUILD_SHARED_LIBS) + option(MVK_HIDE_VULKAN_SYMBOLS "Hide Vulkan symbols" OFF) +endif() -set(MVK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) -set(MVK_COMMON_DIR ${MVK_DIR}/common) -set(MVK_SC_DIR ${MVK_DIR}/MoltenVKShaderConverter) -set(MVK_LIB_DIR ${MVK_DIR}/MoltenVK) +set(MVK_COMMON_DIR ${MVK_SRC_DIR}/common) +set(MVK_SC_DIR ${MVK_SRC_DIR}/MoltenVKShaderConverter) +set(MVK_LIB_DIR ${MVK_SRC_DIR}/MoltenVK) set(MVK_INSTALL_TARGETS "") +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin) + # PIC required for objects targets linked into shared MoltenVK if(BUILD_SHARED_LIBS) set(CMAKE_POSITION_INDEPENDENT_CODE ON) endif() find_package(cereal REQUIRED CONFIG) +find_package(glslang REQUIRED glslang SPIRV CONFIG) +find_package(spirv-cross REQUIRED CONFIG) find_package(VulkanHeaders REQUIRED CONFIG) if(MVK_WITH_SPIRV_TOOLS) find_package(SPIRV-Tools REQUIRED CONFIG) @@ -108,12 +111,15 @@ target_include_directories(MoltenVKShaderConverter ) target_link_libraries(MoltenVKShaderConverter PRIVATE - CONAN_PKG::glslang + glslang::glslang + glslang::SPIRV MoltenVKCommon $<$:SPIRV-Tools> ${FOUNDATION_FRAMEWORK} PUBLIC - CONAN_PKG::spirv-cross + spirv-cross-core + spirv-cross-msl + spirv-cross-reflect ) target_compile_definitions(MoltenVKShaderConverter PRIVATE $<$>:MVK_EXCLUDE_SPIRV_TOOLS> @@ -180,7 +186,6 @@ target_include_directories(MoltenVK PRIVATE target_link_libraries(MoltenVK PRIVATE cereal - CONAN_PKG::spirv-cross MoltenVKCommon MoltenVKShaderConverter ${FOUNDATION_FRAMEWORK} @@ -190,7 +195,6 @@ target_link_libraries(MoltenVK $<$>:${UIKIT_FRAMEWORK}> PUBLIC Vulkan::Headers - $<$:CONAN_PKG::vulkan-portability> ${METAL_FRAMEWORK} ${IOSURFACE_FRAMEWORK} ${COREGRAPHICS_FRAMEWORK} @@ -203,6 +207,9 @@ if(BUILD_SHARED_LIBS) OBJCXX_VISIBILITY_PRESET hidden VISIBILITY_INLINES_HIDDEN ON ) + if(MVK_VERSION VERSION_GREATER_EQUAL "1.1.7" AND MVK_HIDE_VULKAN_SYMBOLS) + target_compile_definitions(MoltenVK PRIVATE MVK_HIDE_VULKAN_SYMBOLS) + endif() endif() list(APPEND MVK_INSTALL_TARGETS MoltenVK) @@ -212,7 +219,7 @@ list(APPEND MVK_INSTALL_TARGETS MoltenVK) # - if moltenvk >= 1.0.44: moltenvk commit hash in mvkRevString variable (but we still # use spirv-cross commit hash, since MoltenVK hash is not available in this context, # and hash value is no really important) -set(MVK_REV_FILE ${MVK_DIR}/ExternalRevisions/SPIRV-Cross_repo_revision) +set(MVK_REV_FILE ${MVK_SRC_DIR}/ExternalRevisions/SPIRV-Cross_repo_revision) set(MVK_REV_HEADER_DIR ${CMAKE_CURRENT_BINARY_DIR}/mvk_hash_generated) if(MVK_VERSION VERSION_LESS "1.0.44") set(MVK_REV_HEADER ${MVK_REV_HEADER_DIR}/SPIRV-Cross/mvkSpirvCrossRevisionDerived.h) diff --git a/recipes/moltenvk/all/conandata.yml b/recipes/moltenvk/all/conandata.yml index 4f152ed1959d2..f9cb951dc3054 100644 --- a/recipes/moltenvk/all/conandata.yml +++ b/recipes/moltenvk/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.2.1": + url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.2.1.tar.gz" + sha256: "4742df8f35473c5a737f2b120ae06aa6b9e8a7a3753b88932e501b06b1d17ea8" + "1.2.0": + url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.2.0.tar.gz" + sha256: "6e7af2dad0530b2b404480dbe437ca4670c6615cc2ec6cf6a20ed04d9d75e0bd" + "1.1.11": + url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.1.11.tar.gz" + sha256: "938ea0ba13c6538b0ee505ab391a3020f206ab9d29c869f20dd19318a4ee8997" "1.1.10": url: "https://github.com/KhronosGroup/MoltenVK/archive/refs/tags/v1.1.10.tar.gz" sha256: "fac11c2501195c9ce042103685c7778e35484562e6c084963a22072dd0a602e0" @@ -24,18 +33,43 @@ sources: url: "https://github.com/KhronosGroup/MoltenVK/archive/v1.1.0.tar.gz" sha256: "0538fa1c23ddae495c7f82ccd0db90790a90b7017a258ca7575fbae8021f3058" patches: + "1.2.0": + - patch_file: "patches/1.2.0-0001-fix-version-number-icd-json.patch" + patch_description: "Fix api_version in MoltenVK_icd.json" + patch_type: "portability" + patch_source: "https://github.com/KhronosGroup/MoltenVK/pull/1747" + "1.1.11": + - patch_file: "patches/1.1.11-0001-vulkan-alias-private-extern.patch" + patch_description: "Fix vulkan alias symbols when vulkan symbols are hidden" + patch_type: "portability" + "1.1.10": + - patch_file: "patches/1.1.8-0002-vulkan-alias-private-extern.patch" + patch_description: "Fix vulkan alias symbols when vulkan symbols are hidden" + patch_type: "portability" + "1.1.9": + - patch_file: "patches/1.1.8-0002-vulkan-alias-private-extern.patch" + patch_description: "Fix vulkan alias symbols when vulkan symbols are hidden" + patch_type: "portability" "1.1.8": - - patch_file: "patches/0002-allow-c++11-std-1.1.8.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.1.8-0001-allow-c++11-std.patch" + patch_description: "Allow to compile with C++11" + patch_type: "portability" + - patch_file: "patches/1.1.8-0002-vulkan-alias-private-extern.patch" + patch_description: "Fix vulkan alias symbols when vulkan symbols are hidden" + patch_type: "portability" "1.1.6": - - patch_file: "patches/0002-allow-c++11-std-1.1.6.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.1.6-0001-allow-c++11-std.patch" + patch_description: "Allow to compile with C++11" + patch_type: "portability" "1.1.5": - - patch_file: "patches/0002-allow-c++11-std-1.1.5.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.1.5-0001-allow-c++11-std.patch" + patch_description: "Allow to compile with C++11" + patch_type: "portability" "1.1.1": - - patch_file: "patches/0001-fix-spirv-cross-includes-1.1.x.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.1.0-0001-fix-spirv-cross-includes.patch" + patch_description: "Use spirv-cross include convention" + patch_type: "conan" "1.1.0": - - patch_file: "patches/0001-fix-spirv-cross-includes-1.1.x.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.1.0-0001-fix-spirv-cross-includes.patch" + patch_description: "Use spirv-cross include convention" + patch_type: "conan" diff --git a/recipes/moltenvk/all/conanfile.py b/recipes/moltenvk/all/conanfile.py index 5d6fddc60fa12..cc911daf940ad 100644 --- a/recipes/moltenvk/all/conanfile.py +++ b/recipes/moltenvk/all/conanfile.py @@ -1,10 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanException, ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.scm import Version import functools import os import yaml -required_conan_version = ">=1.35.0" +required_conan_version = ">=1.53.0" class MoltenVKConan(ConanFile): @@ -23,22 +27,18 @@ class MoltenVKConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "hide_vulkan_symbols": [True, False], "with_spirv_tools": [True, False], "tools": [True, False], } default_options = { - "shared": False, + "shared": True, "fPIC": True, + "hide_vulkan_symbols": False, "with_spirv_tools": True, "tools": True, } - generators = "cmake", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _dependencies_filename(self): return f"dependencies-{self.version}.yml" @@ -54,22 +54,34 @@ def _dependencies_versions(self): @property def _min_cppstd(self): - return 11 if tools.Version(self.version) < "1.1.9" else 17 + return 11 if Version(self.version) < "1.1.9" else 17 + + @property + def _has_hide_vulkan_symbols_option(self): + return Version(self.version) >= "1.1.7" def export(self): - self.copy(self._dependencies_filename, src="dependencies", dst="dependencies") + copy(self, f"dependencies/{self._dependencies_filename}", self.recipe_folder, self.export_folder) def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) + + def config_options(self): + if not self._has_hide_vulkan_symbols_option: + del self.options.hide_vulkan_symbols def configure(self): if self.options.shared: del self.options.fPIC + elif self._has_hide_vulkan_symbols_option: + self.options.rm_safe("hide_vulkan_symbols") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("cereal/1.3.1") + self.requires("cereal/1.3.2") self.requires(self._require("glslang")) self.requires(self._require("spirv-cross")) self.requires(self._require("vulkan-headers")) @@ -84,63 +96,77 @@ def _require(self, recipe_name): def package_id(self): # MoltenVK >=1.O.42 requires at least XCode 12.0 (11.4 actually) at build # time but can be consumed by older compiler versions if shared - if tools.Version(self.version) >= "1.0.42" and self.options.shared: - if tools.Version(self.settings.compiler.version) < "12.0": + if Version(self.version) >= "1.0.42" and self.options.shared: + if Version(self.settings.compiler.version) < "12.0": compatible_pkg = self.info.clone() compatible_pkg.settings.compiler.version = "12.0" self.compatible_packages.append(compatible_pkg) def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._min_cppstd) + check_min_cppstd(self, self._min_cppstd) if self.settings.os not in ["Macos", "iOS", "tvOS"]: - raise ConanInvalidConfiguration("MoltenVK only supported on MacOS, iOS and tvOS") + raise ConanInvalidConfiguration(f"{self.ref} only supported on MacOS, iOS and tvOS") if self.settings.compiler != "apple-clang": - raise ConanInvalidConfiguration("MoltenVK requires apple-clang") - if tools.Version(self.version) >= "1.0.42": - if tools.Version(self.settings.compiler.version) < "12.0": - raise ConanInvalidConfiguration("MoltenVK {} requires XCode 12.0 or higher at build time".format(self.version)) + raise ConanInvalidConfiguration(f"{self.ref} requires apple-clang") + if Version(self.version) >= "1.0.42": + if Version(self.settings.compiler.version) < "12.0": + raise ConanInvalidConfiguration(f"{self.ref} requires XCode 12.0 or higher at build time") - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def validate_build(self): + spirv_cross = self.dependencies["spirv-cross"] + if spirv_cross.options.shared or not spirv_cross.options.msl or not spirv_cross.options.reflect: + raise ConanInvalidConfiguration(f"{self.ref} requires spirv-cross static with msl & reflect enabled") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["MVK_VERSION"] = self.version - cmake.definitions["MVK_WITH_SPIRV_TOOLS"] = self.options.with_spirv_tools - cmake.definitions["MVK_BUILD_SHADERCONVERTER_TOOL"] = self.options.tools - cmake.configure() - return cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MVK_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["MVK_VERSION"] = self.version + tc.variables["MVK_WITH_SPIRV_TOOLS"] = self.options.with_spirv_tools + tc.variables["MVK_BUILD_SHADERCONVERTER_TOOL"] = self.options.tools + if self._has_hide_vulkan_symbols_option and self.options.shared: + tc.variables["MVK_HIDE_VULKAN_SYMBOLS"] = self.options.hide_vulkan_symbols + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["MoltenVK"] - self.cpp_info.frameworks = ["Metal", "Foundation", "QuartzCore", "IOSurface", "CoreGraphics"] + self.cpp_info.frameworks = ["Metal", "Foundation", "CoreFoundation", "QuartzCore", "IOSurface", "CoreGraphics"] if self.settings.os == "Macos": self.cpp_info.frameworks.extend(["AppKit", "IOKit"]) elif self.settings.os in ["iOS", "tvOS"]: self.cpp_info.frameworks.append("UIKit") + self.cpp_info.requires = [ + "cereal::cereal", "glslang::glslang-core", "glslang::spirv", "spirv-cross::spirv-cross-core", + "spirv-cross::spirv-cross-msl", "spirv-cross::spirv-cross-reflect", "vulkan-headers::vulkan-headers", + ] + if self.options.with_spirv_tools: + self.cpp_info.requires.append("spirv-tools::spirv-tools-core") + if self.options.shared: moltenvk_icd_path = os.path.join(self.package_folder, "lib", "MoltenVK_icd.json") - self.output.info("Prepending to VK_ICD_FILENAMES runtime environment variable: {}".format(moltenvk_icd_path)) + self.runenv_info.prepend_path("VK_DRIVER_FILES", moltenvk_icd_path) self.runenv_info.prepend_path("VK_ICD_FILENAMES", moltenvk_icd_path) # TODO: to remove after conan v2, it allows to not break consumers still relying on virtualenv generator + self.env_info.VK_DRIVER_FILES.append(moltenvk_icd_path) self.env_info.VK_ICD_FILENAMES.append(moltenvk_icd_path) if self.options.tools: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.1.11.yml b/recipes/moltenvk/all/dependencies/dependencies-1.1.11.yml new file mode 100644 index 0000000000000..1a11b23c8e3ad --- /dev/null +++ b/recipes/moltenvk/all/dependencies/dependencies-1.1.11.yml @@ -0,0 +1,4 @@ +glslang: "1.3.224.0" +spirv-cross: "1.3.224.0" +spirv-tools: "1.3.224.0" +vulkan-headers: "1.3.224.0" diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.2.0.yml b/recipes/moltenvk/all/dependencies/dependencies-1.2.0.yml new file mode 100644 index 0000000000000..33e0cb279be8b --- /dev/null +++ b/recipes/moltenvk/all/dependencies/dependencies-1.2.0.yml @@ -0,0 +1,4 @@ +glslang: "1.3.231.1" +spirv-cross: "1.3.231.1" +spirv-tools: "1.3.231.1" +vulkan-headers: "1.3.231.1" diff --git a/recipes/moltenvk/all/dependencies/dependencies-1.2.1.yml b/recipes/moltenvk/all/dependencies/dependencies-1.2.1.yml new file mode 100644 index 0000000000000..ba333592e0199 --- /dev/null +++ b/recipes/moltenvk/all/dependencies/dependencies-1.2.1.yml @@ -0,0 +1,4 @@ +glslang: "1.3.236.0" +spirv-cross: "1.3.236.0" +spirv-tools: "1.3.236.0" +vulkan-headers: "1.3.236.0" diff --git a/recipes/moltenvk/all/patches/0001-fix-spirv-cross-includes-1.1.x.patch b/recipes/moltenvk/all/patches/1.1.0-0001-fix-spirv-cross-includes.patch similarity index 100% rename from recipes/moltenvk/all/patches/0001-fix-spirv-cross-includes-1.1.x.patch rename to recipes/moltenvk/all/patches/1.1.0-0001-fix-spirv-cross-includes.patch diff --git a/recipes/moltenvk/all/patches/1.1.11-0001-vulkan-alias-private-extern.patch b/recipes/moltenvk/all/patches/1.1.11-0001-vulkan-alias-private-extern.patch new file mode 100644 index 0000000000000..32ae960f5a370 --- /dev/null +++ b/recipes/moltenvk/all/patches/1.1.11-0001-vulkan-alias-private-extern.patch @@ -0,0 +1,21 @@ +--- a/Common/MVKCommonEnvironment.h ++++ b/Common/MVKCommonEnvironment.h +@@ -108,6 +108,9 @@ extern "C" { + /** Directive to make a public alias of another symbol. */ + #define MVK_PUBLIC_ALIAS(ALIAS, TARGET) asm(".globl _" #ALIAS "\n\t_" #ALIAS " = _" #TARGET) + ++/** Directive to make a private extern alias of another symbol. */ ++#define MVK_PRIVATE_EXTERN_ALIAS(ALIAS, TARGET) asm(".private_extern _" #ALIAS "\n\t_" #ALIAS " = _" #TARGET) ++ + /** + * Directives to hide public symbols from the Vulkan API, to avoid library linking + * conflicts when bound to a Vulkan Loader that also exports identical symbols. +@@ -117,7 +120,7 @@ extern "C" { + #endif + #if MVK_HIDE_VULKAN_SYMBOLS + # define MVK_PUBLIC_VULKAN_SYMBOL +-# define MVK_PUBLIC_VULKAN_ALIAS(ALIAS, TARGET) ++# define MVK_PUBLIC_VULKAN_ALIAS(ALIAS, TARGET) MVK_PRIVATE_EXTERN_ALIAS(ALIAS, TARGET) + #else + # define MVK_PUBLIC_VULKAN_SYMBOL MVK_PUBLIC_SYMBOL + # define MVK_PUBLIC_VULKAN_ALIAS(ALIAS, TARGET) MVK_PUBLIC_ALIAS(ALIAS, TARGET) diff --git a/recipes/moltenvk/all/patches/0002-allow-c++11-std-1.1.5.patch b/recipes/moltenvk/all/patches/1.1.5-0001-allow-c++11-std.patch similarity index 100% rename from recipes/moltenvk/all/patches/0002-allow-c++11-std-1.1.5.patch rename to recipes/moltenvk/all/patches/1.1.5-0001-allow-c++11-std.patch diff --git a/recipes/moltenvk/all/patches/0002-allow-c++11-std-1.1.6.patch b/recipes/moltenvk/all/patches/1.1.6-0001-allow-c++11-std.patch similarity index 100% rename from recipes/moltenvk/all/patches/0002-allow-c++11-std-1.1.6.patch rename to recipes/moltenvk/all/patches/1.1.6-0001-allow-c++11-std.patch diff --git a/recipes/moltenvk/all/patches/0002-allow-c++11-std-1.1.8.patch b/recipes/moltenvk/all/patches/1.1.8-0001-allow-c++11-std.patch similarity index 100% rename from recipes/moltenvk/all/patches/0002-allow-c++11-std-1.1.8.patch rename to recipes/moltenvk/all/patches/1.1.8-0001-allow-c++11-std.patch diff --git a/recipes/moltenvk/all/patches/1.1.8-0002-vulkan-alias-private-extern.patch b/recipes/moltenvk/all/patches/1.1.8-0002-vulkan-alias-private-extern.patch new file mode 100644 index 0000000000000..e488faca8335a --- /dev/null +++ b/recipes/moltenvk/all/patches/1.1.8-0002-vulkan-alias-private-extern.patch @@ -0,0 +1,21 @@ +--- a/Common/MVKCommonEnvironment.h ++++ b/Common/MVKCommonEnvironment.h +@@ -104,6 +104,9 @@ extern "C" { + /** Directive to make a public alias of another symbol. */ + #define MVK_PUBLIC_ALIAS(ALIAS, TARGET) asm(".globl _" #ALIAS "\n\t_" #ALIAS " = _" #TARGET) + ++/** Directive to make a private extern alias of another symbol. */ ++#define MVK_PRIVATE_EXTERN_ALIAS(ALIAS, TARGET) asm(".private_extern _" #ALIAS "\n\t_" #ALIAS " = _" #TARGET) ++ + /** + * Directives to hide public symbols from the Vulkan API, to avoid library linking + * conflicts when bound to a Vulkan Loader that also exports identical symbols. +@@ -113,7 +116,7 @@ extern "C" { + #endif + #if MVK_HIDE_VULKAN_SYMBOLS + # define MVK_PUBLIC_VULKAN_SYMBOL +-# define MVK_PUBLIC_VULKAN_ALIAS(ALIAS, TARGET) ++# define MVK_PUBLIC_VULKAN_ALIAS(ALIAS, TARGET) MVK_PRIVATE_EXTERN_ALIAS(ALIAS, TARGET) + #else + # define MVK_PUBLIC_VULKAN_SYMBOL MVK_PUBLIC_SYMBOL + # define MVK_PUBLIC_VULKAN_ALIAS(ALIAS, TARGET) MVK_PUBLIC_ALIAS(ALIAS, TARGET) diff --git a/recipes/moltenvk/all/patches/1.2.0-0001-fix-version-number-icd-json.patch b/recipes/moltenvk/all/patches/1.2.0-0001-fix-version-number-icd-json.patch new file mode 100644 index 0000000000000..6f8bf87465fe2 --- /dev/null +++ b/recipes/moltenvk/all/patches/1.2.0-0001-fix-version-number-icd-json.patch @@ -0,0 +1,11 @@ +--- a/MoltenVK/icd/MoltenVK_icd.json ++++ b/MoltenVK/icd/MoltenVK_icd.json +@@ -2,7 +2,7 @@ + "file_format_version" : "1.0.0", + "ICD": { + "library_path": "./libMoltenVK.dylib", +- "api_version" : "1.1.0", ++ "api_version" : "1.2.0", + "is_portability_driver" : true + } + } diff --git a/recipes/moltenvk/all/test_package/CMakeLists.txt b/recipes/moltenvk/all/test_package/CMakeLists.txt index 33ae887aa6aea..a5c97f937b4f7 100644 --- a/recipes/moltenvk/all/test_package/CMakeLists.txt +++ b/recipes/moltenvk/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(moltenvk REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE moltenvk::moltenvk) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/moltenvk/all/test_package/conanfile.py b/recipes/moltenvk/all/test_package/conanfile.py index 5c09494bc67c0..0a6bc68712d90 100644 --- a/recipes/moltenvk/all/test_package/conanfile.py +++ b/recipes/moltenvk/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/moltenvk/all/test_v1_package/CMakeLists.txt b/recipes/moltenvk/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/moltenvk/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/moltenvk/all/test_v1_package/conanfile.py b/recipes/moltenvk/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/moltenvk/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/moltenvk/config.yml b/recipes/moltenvk/config.yml index c0f9f949dbcd1..2199e02c92906 100644 --- a/recipes/moltenvk/config.yml +++ b/recipes/moltenvk/config.yml @@ -1,4 +1,10 @@ versions: + "1.2.1": + folder: all + "1.2.0": + folder: all + "1.1.11": + folder: all "1.1.10": folder: all "1.1.9": diff --git a/recipes/mongo-c-driver/all/conandata.yml b/recipes/mongo-c-driver/all/conandata.yml index 2546c26f4700e..be9c59fe3dc4d 100644 --- a/recipes/mongo-c-driver/all/conandata.yml +++ b/recipes/mongo-c-driver/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.23.2": + url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.23.2/mongo-c-driver-1.23.2.tar.gz" + sha256: "123c358827eea07cd76a31c40281bb1c81b6744f6587c96d0cf217be8b1234e3" + "1.22.2": + url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.22.2/mongo-c-driver-1.22.2.tar.gz" + sha256: "2e59b9d38d600bd63ccc0b215dd44c6254a66eeb8085a5ac513748cd6220532e" "1.22.0": url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.22.0/mongo-c-driver-1.22.0.tar.gz" sha256: "272067f75e7e57c98f90a6f0c42500ef818b4b085539343676b6ce6831655eaf" @@ -15,15 +21,49 @@ sources: url: "https://github.com/mongodb/mongo-c-driver/releases/download/1.17.2/mongo-c-driver-1.17.2.tar.gz" sha256: "bc53d5f72ab628a1ae549db6888325d6dc34db3ca31c5e16e550c1bb4266d864" patches: + "1.23.2": + - patch_file: "patches/1.23.2-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" + - patch_file: "patches/1.22.0-0002-fix-uninitialized-warning.patch" + patch_description: "fix uninitialized variable warning" + patch_type: "portability" + - patch_file: "patches/1.22.0-0003-disable-warning-errors.patch" + patch_description: "disable compiler flags to make warnings into errors" + patch_type: "conan" + "1.22.2": + - patch_file: "patches/1.22.0-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" + - patch_file: "patches/1.22.0-0002-fix-uninitialized-warning.patch" + patch_description: "fix uninitialized variable warning" + patch_type: "portability" + - patch_file: "patches/1.22.0-0003-disable-warning-errors.patch" + patch_description: "disable compiler flags to make warnings into errors" + patch_type: "conan" "1.22.0": - patch_file: "patches/1.22.0-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" - patch_file: "patches/1.22.0-0002-fix-uninitialized-warning.patch" + patch_description: "fix uninitialized variable warning" + patch_type: "portability" - patch_file: "patches/1.22.0-0003-disable-warning-errors.patch" + patch_description: "disable compiler flags to make warnings into errors" + patch_type: "conan" "1.17.6": - patch_file: "patches/1.17.6-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" "1.17.4": - patch_file: "patches/1.17.2-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" "1.17.3": - patch_file: "patches/1.17.2-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" "1.17.2": - patch_file: "patches/1.17.2-0001-disable-shared-when-static.patch" + patch_description: "separate static and shared builds" + patch_type: "conan" diff --git a/recipes/mongo-c-driver/all/conanfile.py b/recipes/mongo-c-driver/all/conanfile.py index c046165084403..71ed6d84f3627 100644 --- a/recipes/mongo-c-driver/all/conanfile.py +++ b/recipes/mongo-c-driver/all/conanfile.py @@ -3,13 +3,13 @@ from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import Environment, VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.gnu import PkgConfigDeps from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class MongoCDriverConan(ConanFile): @@ -47,8 +47,7 @@ class MongoCDriverConan(ConanFile): short_paths = True def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -57,19 +56,16 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_ssl == "openssl": - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") elif self.options.with_ssl == "libressl": self.requires("libressl/3.5.3") if self.options.with_sasl == "cyrus": @@ -77,11 +73,11 @@ def requirements(self): if self.options.with_snappy: self.requires("snappy/1.1.9") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.with_icu: - self.requires("icu/71.1") + self.requires("icu/72.1") def validate(self): if self.info.options.with_ssl == "darwin" and not is_apple_os(self.settings.os): @@ -93,10 +89,8 @@ def validate(self): def build_requirements(self): if self.options.with_ssl == "libressl" or self.options.with_zstd: - self.tool_requires("pkgconf/1.7.4") - - def layout(self): - cmake_layout(self, src_folder="src") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): get(self, **self.conan_data["sources"][self.version], diff --git a/recipes/mongo-c-driver/all/patches/1.23.2-0001-disable-shared-when-static.patch b/recipes/mongo-c-driver/all/patches/1.23.2-0001-disable-shared-when-static.patch new file mode 100644 index 0000000000000..1b39914f6b921 --- /dev/null +++ b/recipes/mongo-c-driver/all/patches/1.23.2-0001-disable-shared-when-static.patch @@ -0,0 +1,82 @@ +diff --git a/src/libbson/CMakeLists.txt b/src/libbson/CMakeLists.txt +index d6df66f..dccdfee 100644 +--- a/src/libbson/CMakeLists.txt ++++ b/src/libbson/CMakeLists.txt +@@ -209,6 +209,7 @@ set (HEADERS_FORWARDING + ${PROJECT_SOURCE_DIR}/src/bson/forwarding/bson.h + ) + ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + add_library (bson_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) + set (CMAKE_CXX_VISIBILITY_PRESET hidden) + target_compile_definitions (bson_shared +@@ -275,6 +276,7 @@ if (WIN32) + # must be handled specially since we can't resolve them + set (BSON_SYSTEM_LIBRARIES ${BSON_SYSTEM_LIBRARIES} ws2_32) + endif () ++endif() + + if (MONGOC_ENABLE_STATIC_BUILD) + add_library (bson_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) +@@ -349,7 +351,7 @@ set (BSON_HEADER_INSTALL_DIR + ) + + if (MONGOC_ENABLE_STATIC_INSTALL) +- set (TARGETS_TO_INSTALL bson_shared bson_static) ++ set (TARGETS_TO_INSTALL bson_static) + else () + set (TARGETS_TO_INSTALL bson_shared) + endif () +diff --git a/src/libmongoc/CMakeLists.txt b/src/libmongoc/CMakeLists.txt +index 39f66ac..3f4eefc 100644 +--- a/src/libmongoc/CMakeLists.txt ++++ b/src/libmongoc/CMakeLists.txt +@@ -758,6 +758,7 @@ if (MONGOC_ENABLE_MONGODB_AWS_AUTH) + endif() + endif () + ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + add_library (mongoc_shared SHARED ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) + set_target_properties (mongoc_shared PROPERTIES CMAKE_CXX_VISIBILITY_PRESET hidden) + target_link_libraries (mongoc_shared PRIVATE ${LIBRARIES} PUBLIC ${BSON_LIBRARIES}) +@@ -795,6 +796,7 @@ target_include_directories ( + + set_target_properties (mongoc_shared PROPERTIES VERSION 0.0.0 SOVERSION 0) + set_target_properties (mongoc_shared PROPERTIES OUTPUT_NAME "${MONGOC_OUTPUT_BASENAME}-${MONGOC_API_VERSION}") ++endif() + + if (MONGOC_ENABLE_STATIC_BUILD) + add_library (mongoc_static STATIC ${SOURCES} ${HEADERS} ${HEADERS_FORWARDING}) +@@ -835,6 +837,7 @@ if (MONGOC_ENABLE_STATIC_BUILD) + set_target_properties (mongoc_static PROPERTIES OUTPUT_NAME "${MONGOC_OUTPUT_BASENAME}-static-${MONGOC_API_VERSION}") + endif () + ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + if (ENABLE_APPLE_FRAMEWORK) + set_target_properties (mongoc_shared PROPERTIES + FRAMEWORK TRUE +@@ -845,9 +848,15 @@ if (ENABLE_APPLE_FRAMEWORK) + PUBLIC_HEADER "${HEADERS}" + ) + endif () ++endif() + + add_executable (mongoc-stat ${PROJECT_SOURCE_DIR}/../../src/tools/mongoc-stat.c) ++if (NOT MONGOC_ENABLE_STATIC_BUILD) + target_link_libraries (mongoc-stat mongoc_shared ${LIBRARIES}) ++else () ++target_link_libraries (mongoc-stat mongoc_static ${STATIC_LIBRARIES}) ++endif () ++ + + # mongoc-stat works if shared memory performance counters are enabled. + if (ENABLE_SHM_COUNTERS STREQUAL "ON") +@@ -1128,7 +1137,7 @@ file (COPY ${PROJECT_SOURCE_DIR}/tests/x509gen DESTINATION ${PROJECT_BINARY_DIR} + file (COPY ${PROJECT_SOURCE_DIR}/tests/release_files DESTINATION ${PROJECT_BINARY_DIR}/tests) + + if (MONGOC_ENABLE_STATIC_INSTALL) +- set (TARGETS_TO_INSTALL mongoc_shared mongoc_static) ++ set (TARGETS_TO_INSTALL mongoc_static) + else () + set (TARGETS_TO_INSTALL mongoc_shared) + endif () diff --git a/recipes/mongo-c-driver/all/test_package/conanfile.py b/recipes/mongo-c-driver/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/mongo-c-driver/all/test_package/conanfile.py +++ b/recipes/mongo-c-driver/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/mongo-c-driver/all/test_v1_package/CMakeLists.txt b/recipes/mongo-c-driver/all/test_v1_package/CMakeLists.txt index 9963c43bd4637..0d20897301b68 100644 --- a/recipes/mongo-c-driver/all/test_v1_package/CMakeLists.txt +++ b/recipes/mongo-c-driver/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(mongoc-1.0 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -if(TARGET mongo::mongoc_shared) - target_link_libraries(${PROJECT_NAME} PRIVATE mongo::mongoc_shared mongo::bson_shared) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE mongo::mongoc_static mongo::bson_static) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/mongo-c-driver/config.yml b/recipes/mongo-c-driver/config.yml index 59ca0a1a54b12..1b2d5cda4e394 100644 --- a/recipes/mongo-c-driver/config.yml +++ b/recipes/mongo-c-driver/config.yml @@ -1,4 +1,8 @@ versions: + "1.23.2": + folder: all + "1.22.2": + folder: all "1.22.0": folder: all "1.17.6": diff --git a/recipes/mongo-cxx-driver/all/conandata.yml b/recipes/mongo-cxx-driver/all/conandata.yml index 9c36439157a9b..63919e45005aa 100644 --- a/recipes/mongo-cxx-driver/all/conandata.yml +++ b/recipes/mongo-cxx-driver/all/conandata.yml @@ -1,26 +1,52 @@ sources: + "3.7.0": + url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.7.0/mongo-cxx-driver-r3.7.0.tar.gz" + sha256: "fb2da11178db728f63147fe4b0c7509eb49b1b02c5cb55f9bee5f927e451a0c7" "3.6.7": - url: "https://github.com/mongodb/mongo-cxx-driver/archive/debian/3.6.7-1.tar.gz" - sha256: "62a0a16e4a35289e1692f60cf07a7f6957485446b7bc1d82306b731ad6763fb9" + url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.7/mongo-cxx-driver-r3.6.7.tar.gz" + sha256: "2c58005d4fe46f1973352fba821f7bb37e818cefc922377ce979a9fd1bff38ac" "3.6.6": - url: "https://github.com/mongodb/mongo-cxx-driver/archive/r3.6.6.tar.gz" - sha256: "f989c371800458ae45ef69f6d9566e010f9420435a01bf5eb14db77fc024662e" + url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.6/mongo-cxx-driver-r3.6.6.tar.gz" + sha256: "d5906b9e308a8a353a2ef92b699c9b27ae28ec6b34fdda94e15d2981b27e64ca" "3.6.2": - url: "https://github.com/mongodb/mongo-cxx-driver/archive/r3.6.2.tar.gz" - sha256: "f50a1acb98a473f0850e2766dc7e84c05415dc63b1a2f851b77b12629ac14d62" + url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.2/mongo-cxx-driver-r3.6.2.tar.gz" + sha256: "24325dce74723f7632da76d0eeb5f5020828498cc5bc1a624c6d7117efb2b7cf" "3.6.1": - url: https://github.com/mongodb/mongo-cxx-driver/archive/r3.6.1.tar.gz - sha256: c6d1b307f7b074d178c4a815d8739195fb4d7870701064bdad6f1f2360ae0af9 + url: "https://github.com/mongodb/mongo-cxx-driver/releases/download/r3.6.1/mongo-cxx-driver-r3.6.1.tar.gz" + sha256: "83523e897ef18f7ce05d85d1632dd4ba486c264a1b89c09020163ab29e11eab7" patches: + "3.7.0": + - patch_file: "patches/3.7.0-dirs.patch" + patch_description: "disable documentation features, fix directories" + patch_type: "conan" + - patch_file: "patches/poly_use_std_define.patch" + patch_description: "use poly macro instead __cplusplus" + patch_type: "portability" "3.6.7": - - patch_file: "patches/dirs_and_tests.patch" + - patch_file: "patches/3.6.x-dirs_and_tests.patch" + patch_description: "disable test and documentation features, fix directories" + patch_type: "conan" - patch_file: "patches/poly_use_std_define.patch" + patch_description: "use poly macro instead __cplusplus" + patch_type: "portability" "3.6.6": - - patch_file: "patches/dirs_and_tests.patch" + - patch_file: "patches/3.6.x-dirs_and_tests.patch" + patch_description: "disable test and documentation features, fix directories" + patch_type: "conan" - patch_file: "patches/poly_use_std_define.patch" + patch_description: "use poly macro instead __cplusplus" + patch_type: "portability" "3.6.2": - - patch_file: "patches/dirs_and_tests.patch" + - patch_file: "patches/3.6.x-dirs_and_tests.patch" + patch_description: "disable test and documentation features, fix directories" + patch_type: "conan" - patch_file: "patches/poly_use_std_define.patch" + patch_description: "use poly macro instead __cplusplus" + patch_type: "portability" "3.6.1": - - patch_file: "patches/dirs_and_tests.patch" + - patch_file: "patches/3.6.x-dirs_and_tests.patch" + patch_description: "disable test and documentation features, fix directories" + patch_type: "conan" - patch_file: "patches/poly_use_std_define.patch" + patch_description: "use poly macro instead __cplusplus" + patch_type: "portability" diff --git a/recipes/mongo-cxx-driver/all/conanfile.py b/recipes/mongo-cxx-driver/all/conanfile.py index 0325bf551fe00..118ad3a647540 100644 --- a/recipes/mongo-cxx-driver/all/conanfile.py +++ b/recipes/mongo-cxx-driver/all/conanfile.py @@ -2,12 +2,12 @@ from conan.errors import ConanException, ConanInvalidConfiguration from conan.tools.build import check_min_cppstd, valid_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rm, rmdir +from conan.tools.files import export_conandata_patches, apply_conandata_patches, copy, get, rm, rmdir from conan.tools.scm import Version import os import shutil -required_conan_version = ">=1.51.1" +required_conan_version = ">=1.54.0" class MongoCxxConan(ConanFile): @@ -33,8 +33,7 @@ class MongoCxxConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -42,12 +41,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("mongo-c-driver/1.22.0") + self.requires("mongo-c-driver/1.23.2") if self.options.polyfill == "boost": - self.requires("boost/1.79.0") + self.requires("boost/1.81.0") @property def _minimal_std_version(self): @@ -90,33 +92,29 @@ def _compilers_minimum_version(self): ) def validate(self): - if self.info.options.with_ssl and not bool(self.dependencies["mongo-c-driver"].options.with_ssl): + if self.options.with_ssl and not bool(self.dependencies["mongo-c-driver"].options.with_ssl): raise ConanInvalidConfiguration("mongo-cxx-driver with_ssl=True requires mongo-c-driver with a ssl implementation") - if self.info.options.polyfill == "mnmlstc": + if self.options.polyfill == "mnmlstc": # TODO: add mnmlstc polyfill support # Cannot model mnmlstc (not packaged, is pulled dynamically) polyfill dependencies raise ConanInvalidConfiguration("mnmlstc polyfill is not yet supported") - if self.info.settings.compiler.get_safe("cppstd"): + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._minimal_std_version) - compiler = str(self.info.settings.compiler) - if self.info.options.polyfill == "experimental" and compiler == "apple-clang": + compiler = str(self.settings.compiler) + if self.options.polyfill == "experimental" and compiler == "apple-clang": raise ConanInvalidConfiguration("experimental polyfill is not supported for apple-clang") - version = Version(self.info.settings.compiler.version) + version = Version(self.settings.compiler.version) if compiler in self._compilers_minimum_version and version < self._compilers_minimum_version[compiler]: raise ConanInvalidConfiguration( f"{self.name} {self.version} requires a compiler that supports at least C++{self._minimal_std_version}", ) - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -130,8 +128,7 @@ def generate(self): tc.variables["MONGOCXX_ENABLE_SSL"] = self.options.with_ssl if not valid_min_cppstd(self, self._minimal_std_version): tc.variables["CMAKE_CXX_STANDARD"] = self._minimal_std_version - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.variables["ENABLE_TESTS"] = False tc.generate() deps = CMakeDeps(self) diff --git a/recipes/mongo-cxx-driver/all/patches/dirs_and_tests.patch b/recipes/mongo-cxx-driver/all/patches/3.6.x-dirs_and_tests.patch similarity index 100% rename from recipes/mongo-cxx-driver/all/patches/dirs_and_tests.patch rename to recipes/mongo-cxx-driver/all/patches/3.6.x-dirs_and_tests.patch diff --git a/recipes/mongo-cxx-driver/all/patches/3.7.0-dirs.patch b/recipes/mongo-cxx-driver/all/patches/3.7.0-dirs.patch new file mode 100644 index 0000000000000..0166bc9b8ae35 --- /dev/null +++ b/recipes/mongo-cxx-driver/all/patches/3.7.0-dirs.patch @@ -0,0 +1,80 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 20254fa..d7dc7c4 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -206,6 +206,7 @@ set (BUILD_SOURCE_DIR ${CMAKE_BINARY_DIR}) + + include (MakeDistFiles) + ++if(FALSE) + add_custom_target(hugo_dir + COMMAND ${CMAKE_COMMAND} -E make_directory hugo + ) +@@ -261,6 +262,7 @@ add_custom_target(format-lint + add_custom_target(docs + DEPENDS hugo doxygen-current + ) ++endif() + + set(THIRD_PARTY_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/src/third_party) + +@@ -270,6 +272,9 @@ if (ENABLE_TESTS) + enable_testing() + endif () + ++set(MONGO_CXX_PROJECT_DIR ${CMAKE_CURRENT_SOURCE_DIR}) ++set(MONGO_CXX_PROJECT_BIN_DIR ${CMAKE_CURRENT_BINARY_DIR}) ++ + add_subdirectory(src) + + add_subdirectory(examples EXCLUDE_FROM_ALL) +@@ -281,6 +286,7 @@ add_subdirectory(benchmark EXCLUDE_FROM_ALL) + # CMake does not implement anything like 'dist' from autotools. + # This implementation is based on the one in GnuCash. + ++if(FALSE) + add_subdirectory (cmake) + add_subdirectory (data) + add_subdirectory (docs) +@@ -381,4 +387,4 @@ endif () + if (CMAKE_GENERATOR_TOOLSET) + message (STATUS "\tinstance: ${CMAKE_GENERATOR_TOOLSET}") + endif () +- ++endif() +diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt +index d87d588..1aefd91 100644 +--- a/src/bsoncxx/CMakeLists.txt ++++ b/src/bsoncxx/CMakeLists.txt +@@ -71,7 +71,7 @@ set(BSONCXX_VERSION_NO_EXTRA ${BSONCXX_VERSION_MAJOR}.${BSONCXX_VERSION_MINOR}.$ + set(BSONCXX_VERSION ${BSONCXX_VERSION_NO_EXTRA}${BSONCXX_VERSION_EXTRA}) + message ("bsoncxx version: ${BSONCXX_VERSION}") + set(BSONCXX_INLINE_NAMESPACE "v${BSONCXX_ABI_VERSION}") +-set(BSONCXX_HEADER_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/bsoncxx/${BSONCXX_INLINE_NAMESPACE}" CACHE INTERNAL "") ++set(BSONCXX_HEADER_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}" CACHE INTERNAL "") + + set(LIBBSON_REQUIRED_VERSION 1.13.0) + set(LIBBSON_REQUIRED_ABI_VERSION 1.0) +@@ -94,7 +94,8 @@ if(TARGET bson_shared OR TARGET bson_static) + endif() + else() + # Attempt to find libbson by new package name (without lib). +- find_package(bson-${LIBBSON_REQUIRED_ABI_VERSION} ${LIBBSON_REQUIRED_VERSION} QUIET) ++ find_package(bson-${LIBBSON_REQUIRED_ABI_VERSION} REQUIRED) ++ set(bson-${LIBBSON_REQUIRED_ABI_VERSION}_FOUND TRUE) + + if(bson-${LIBBSON_REQUIRED_ABI_VERSION}_FOUND) + message ("found libbson version ${bson-${LIBBSON_REQUIRED_ABI_VERSION}_VERSION}") +diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt +index 7106040..3be4b83 100644 +--- a/src/mongocxx/CMakeLists.txt ++++ b/src/mongocxx/CMakeLists.txt +@@ -27,7 +27,7 @@ set(MONGOCXX_VERSION_NO_EXTRA ${MONGOCXX_VERSION_MAJOR}.${MONGOCXX_VERSION_MINOR + set(MONGOCXX_VERSION ${MONGOCXX_VERSION_NO_EXTRA}${MONGOCXX_VERSION_EXTRA}) + message ("mongocxx version: ${MONGOCXX_VERSION}") + set(MONGOCXX_INLINE_NAMESPACE "v${MONGOCXX_ABI_VERSION}") +-set(MONGOCXX_HEADER_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/mongocxx/${MONGOCXX_INLINE_NAMESPACE}" CACHE INTERNAL "") ++set(MONGOCXX_HEADER_INSTALL_DIR "${CMAKE_INSTALL_INCLUDEDIR}/" CACHE INTERNAL "") + + set(LIBMONGOC_REQUIRED_VERSION 1.19.0) + set(LIBMONGOC_REQUIRED_ABI_VERSION 1.0) diff --git a/recipes/mongo-cxx-driver/all/test_package/conanfile.py b/recipes/mongo-cxx-driver/all/test_package/conanfile.py index a650aa79a9355..00f1cae8925b9 100644 --- a/recipes/mongo-cxx-driver/all/test_package/conanfile.py +++ b/recipes/mongo-cxx-driver/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def generate(self): tc = CMakeToolchain(self) tc.variables["MONGO-CXX-DRIVER_POLYFILL"] = self.dependencies["mongo-cxx-driver"].options.polyfill diff --git a/recipes/mongo-cxx-driver/all/test_v1_package/CMakeLists.txt b/recipes/mongo-cxx-driver/all/test_v1_package/CMakeLists.txt index 20e6aa5c91caf..be00a8c7f57c7 100644 --- a/recipes/mongo-cxx-driver/all/test_v1_package/CMakeLists.txt +++ b/recipes/mongo-cxx-driver/all/test_v1_package/CMakeLists.txt @@ -1,23 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(mongocxx REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) - -if(${MONGO-CXX-DRIVER_POLYFILL} STREQUAL "std") - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -elseif(${MONGO-CXX-DRIVER_POLYFILL} STREQUAL "experimental") - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) -else() - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -endif() - -if(TARGET mongo::mongocxx_shared) - target_link_libraries(${PROJECT_NAME} PRIVATE mongo::mongocxx_shared mongo::bsoncxx_shared) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE mongo::mongocxx_static mongo::bsoncxx_static) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mongo-cxx-driver/config.yml b/recipes/mongo-cxx-driver/config.yml index f7b7e026a30f6..fe3fd8b511744 100644 --- a/recipes/mongo-cxx-driver/config.yml +++ b/recipes/mongo-cxx-driver/config.yml @@ -1,4 +1,6 @@ versions: + "3.7.0": + folder: all "3.6.7": folder: all "3.6.6": diff --git a/recipes/mosquitto/1.x/CMakeLists.txt b/recipes/mosquitto/1.x/CMakeLists.txt deleted file mode 100644 index 16d33ed296f4b..0000000000000 --- a/recipes/mosquitto/1.x/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory("source_subfolder") diff --git a/recipes/mosquitto/1.x/conandata.yml b/recipes/mosquitto/1.x/conandata.yml index 76ef7f9d17eaa..71a70509ff81d 100644 --- a/recipes/mosquitto/1.x/conandata.yml +++ b/recipes/mosquitto/1.x/conandata.yml @@ -1,4 +1,12 @@ sources: "1.6.12": - sha256: 18b1f455c83645f8aaecff1f6d623898ff630eba391352fcc7a2c241a9d9556a - url: https://github.com/eclipse/mosquitto/archive/v1.6.12.tar.gz + url: "https://mosquitto.org/files/source/mosquitto-1.6.12.tar.gz" + sha256: "548d73d19fb787dd0530334e398fd256ef3a581181678488a741a995c4f007fb" +patches: + "1.6.12": + - patch_file: "patches/1.6.12-0001-fix-cmake.patch" + patch_description: "Several CMake fixes: installation and system libs on Windows, bad CMakeLists initialization" + patch_type: "conan" + - patch_file: "patches/1.6.12-0002-fix-macos.patch" + patch_description: "Add missing includes for macOS" + patch_type: "conan" diff --git a/recipes/mosquitto/1.x/conanfile.py b/recipes/mosquitto/1.x/conanfile.py index 99b1ba7b3566e..c9cd7eb5586db 100644 --- a/recipes/mosquitto/1.x/conanfile.py +++ b/recipes/mosquitto/1.x/conanfile.py @@ -1,36 +1,36 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.microsoft import is_msvc import os -import glob -from conans import CMake, ConanFile, tools -required_conan_version = ">=1.29.1" +required_conan_version = ">=1.53.0" + class MosquittoConan(ConanFile): name = "mosquitto" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/eclipse/mosquitto" - topics = ("mqtt", "broker", "libwebsockets", "mosquitto", "eclipse", "iot") + topics = ("mqtt", "broker", "libwebsockets", "eclipse", "iot") license = "EPL-1.0", "BSD-3-Clause" # https://lists.spdx.org/g/Spdx-legal/message/2701 description = "Eclipse Mosquitto - An open source MQTT broker" - exports_sources = "CMakeLists.txt" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], - "fPIC": [True, False], - "with_tls": [True, False], - "with_websockets": [True, False]} - default_options = {"shared": False, - "fPIC": True, - "with_tls": True, - "with_websockets": True} - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_tls": [True, False], + "with_websockets": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_tls": True, + "with_websockets": True, + } + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,76 +38,62 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_tls: - self.requires("openssl/1.1.1i") + self.requires("openssl/1.1.1s") if self.options.with_websockets: - self.requires("libwebsockets/4.1.6") + self.requires("libwebsockets/4.3.2") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name.replace("-", ".") + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["WITH_PIC"] = self.options.get_safe("fPIC", True) - self._cmake.definitions["WITH_STATIC_LIBRARIES"] = not self.options.shared - self._cmake.definitions["WITH_TLS"] = self.options.with_tls - self._cmake.definitions["WITH_TLS_PSK"] = self.options.with_tls - self._cmake.definitions["WITH_EC"] = self.options.with_tls - self._cmake.definitions["DOCUMENTATION"] = False - self._cmake.definitions["WITH_THREADING"] = self.settings.compiler != "Visual Studio" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _patch_sources(self): - if self.settings.os == "Windows": - if self.options.with_tls: - tools.replace_in_file(os.path.join(self._source_subfolder, "lib", "CMakeLists.txt"), - "set (LIBRARIES ${LIBRARIES} ws2_32)", - "set (LIBRARIES ${LIBRARIES} ws2_32 crypt32)") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), - "set (MOSQ_LIBS ${MOSQ_LIBS} ws2_32)", - "set (MOSQ_LIBS ${MOSQ_LIBS} ws2_32 crypt32)") - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), - "target_link_libraries(mosquitto_passwd ${OPENSSL_LIBRARIES})", - "target_link_libraries(mosquitto_passwd ${OPENSSL_LIBRARIES} ws2_32 crypt32)") - tools.replace_in_file(os.path.join(self._source_subfolder, "lib", "CMakeLists.txt"), - "install(TARGETS libmosquitto RUNTIME DESTINATION \"${CMAKE_INSTALL_BINDIR}\" LIBRARY DESTINATION \"${CMAKE_INSTALL_LIBDIR}\")", - "install(TARGETS libmosquitto RUNTIME DESTINATION \"${CMAKE_INSTALL_BINDIR}\" LIBRARY DESTINATION \"${CMAKE_INSTALL_LIBDIR}\" ARCHIVE DESTINATION \"${CMAKE_INSTALL_LIBDIR}\")") - tools.replace_in_file(os.path.join(self._source_subfolder, "lib", "cpp", "CMakeLists.txt"), - "install(TARGETS mosquittopp RUNTIME DESTINATION \"${CMAKE_INSTALL_BINDIR}\" LIBRARY DESTINATION \"${CMAKE_INSTALL_LIBDIR}\")", - "install(TARGETS mosquittopp RUNTIME DESTINATION \"${CMAKE_INSTALL_BINDIR}\" LIBRARY DESTINATION \"${CMAKE_INSTALL_LIBDIR}\" ARCHIVE DESTINATION \"${CMAKE_INSTALL_LIBDIR}\")") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["WITH_STATIC_LIBRARIES"] = not self.options.shared + tc.variables["WITH_TLS"] = self.options.with_tls + tc.variables["WITH_TLS_PSK"] = self.options.with_tls + tc.variables["WITH_EC"] = self.options.with_tls + tc.variables["DOCUMENTATION"] = False + tc.variables["WITH_THREADING"] = not is_msvc(self) + tc.variables["CMAKE_INSTALL_SYSCONFDIR"] = "res" + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="edl-v10", dst="licenses", src=self._source_subfolder) - self.copy(pattern="epl-v10", dst="licenses", src=self._source_subfolder) - self.copy(pattern="mosquitto.conf", src=self._source_subfolder, dst="res") - cmake = self._configure_cmake() + for license_file in ("LICENSE.txt", "edl-v10", "epl-v10"): + copy(self, license_file, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if not self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.so*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.dll*") - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.dylib") + rm(self, "*.dll", os.path.join(self.package_folder, "bin")) + rm(self, "mosquitto.lib", os.path.join(self.package_folder, "lib")) + rm(self, "mosquittopp.lib", os.path.join(self.package_folder, "lib")) + rm(self, "*.dll.a", os.path.join(self.package_folder, "lib")) + rm(self, "*.so*", os.path.join(self.package_folder, "lib")) + rm(self, "*.dylib", os.path.join(self.package_folder, "lib")) def package_info(self): lib_suffix = "_static" if not self.options.shared else "" - # FIXME: there should be no namespace for CMake targets - self.cpp_info.components["libmosquitto"].name = "mosquitto" - self.cpp_info.components["libmosquitto"].libs = ["mosquitto" + lib_suffix] - self.cpp_info.components["libmosquitto"].names["pkgconfig"] = "libmosquitto" + self.cpp_info.components["libmosquitto"].set_property("pkg_config_name", "libmosquitto") + self.cpp_info.components["libmosquitto"].libs = [f"mosquitto{lib_suffix}"] + self.cpp_info.components["libmosquitto"].resdirs = ["res"] + if not self.options.shared: + self.cpp_info.components["libmosquitto"].defines.append("LIBMOSQUITTO_STATIC") if self.options.with_tls: self.cpp_info.components["libmosquitto"].requires.append("openssl::openssl") self.cpp_info.components["libmosquitto"].defines.extend(["WITH_TLS", "WITH_TLS_PSK", "WITH_EC"]) @@ -118,16 +104,12 @@ def package_info(self): self.cpp_info.components["libmosquitto"].system_libs.append("ws2_32") if self.options.with_tls: self.cpp_info.components["libmosquitto"].system_libs.append("crypt32") - elif self.settings.os == "Linux": + elif self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libmosquitto"].system_libs.extend(["rt", "pthread", "dl"]) - self.cpp_info.components["libmosquittopp"].name = "mosquittopp" - self.cpp_info.components["libmosquittopp"].libs = ["mosquittopp" + lib_suffix] + self.cpp_info.components["libmosquittopp"].set_property("pkg_config_name", "libmosquittopp") + self.cpp_info.components["libmosquittopp"].libs = [f"mosquittopp{lib_suffix}"] self.cpp_info.components["libmosquittopp"].requires = ["libmosquitto"] - self.cpp_info.components["libmosquittopp"].names["pkgconfig"] = "libmosquittopp" - if not self.options.shared: - self.cpp_info.components["libmosquitto"].defines.append("LIBMOSQUITTO_STATIC") - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var with : {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/mosquitto/1.x/patches/1.6.12-0001-fix-cmake.patch b/recipes/mosquitto/1.x/patches/1.6.12-0001-fix-cmake.patch new file mode 100644 index 0000000000000..1e2a3630d2035 --- /dev/null +++ b/recipes/mosquitto/1.x/patches/1.6.12-0001-fix-cmake.patch @@ -0,0 +1,68 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -4,11 +4,11 @@ + # To configure the build options either use the CMake gui, or run the command + # line utility including the "-i" option. + ++cmake_minimum_required(VERSION 3.1) + set(CMAKE_LEGACY_CYGWIN_WIN32 0) + + project(mosquitto) + +-cmake_minimum_required(VERSION 2.8) + # Only for version 3 and up. cmake_policy(SET CMP0042 NEW) + + set (VERSION 1.6.12) +--- a/lib/CMakeLists.txt ++++ b/lib/CMakeLists.txt +@@ -65,6 +65,9 @@ endif (UNIX AND NOT APPLE) + + if (WIN32) + set (LIBRARIES ${LIBRARIES} ws2_32) ++ if(WITH_TLS) ++ list(APPEND LIBRARIES crypt32) ++ endif() + endif (WIN32) + + if (WITH_SRV) +@@ -91,7 +94,7 @@ set_target_properties(libmosquitto PROPERTIES + SOVERSION 1 + ) + +-install(TARGETS libmosquitto RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") ++install(TARGETS libmosquitto RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + if (WITH_STATIC_LIBRARIES) + add_library(libmosquitto_static STATIC ${C_SRC}) +--- a/lib/cpp/CMakeLists.txt ++++ b/lib/cpp/CMakeLists.txt +@@ -13,7 +13,7 @@ set_target_properties(mosquittopp PROPERTIES + VERSION ${VERSION} + SOVERSION 1 + ) +-install(TARGETS mosquittopp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}") ++install(TARGETS mosquittopp RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + + if (WITH_STATIC_LIBRARIES) + add_library(mosquittopp_static STATIC +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -167,6 +167,9 @@ endif (UNIX) + + if (WIN32) + set (MOSQ_LIBS ${MOSQ_LIBS} ws2_32) ++ if(WITH_TLS) ++ list(APPEND MOSQ_LIBS crypt32) ++ endif() + endif (WIN32) + + if (WITH_WEBSOCKETS) +@@ -198,5 +201,8 @@ install(FILES mosquitto_broker.h mosquitto_plugin.h DESTINATION "${CMAKE_INSTALL + if (WITH_TLS) + add_executable(mosquitto_passwd mosquitto_passwd.c ../lib/misc_mosq.c) + target_link_libraries(mosquitto_passwd ${OPENSSL_LIBRARIES}) ++ if(WIN32) ++ target_link_libraries(mosquitto_passwd ws2_32 crypt32) ++ endif() + install(TARGETS mosquitto_passwd RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + endif (WITH_TLS) diff --git a/recipes/mosquitto/1.x/patches/1.6.12-0002-fix-macos.patch b/recipes/mosquitto/1.x/patches/1.6.12-0002-fix-macos.patch new file mode 100644 index 0000000000000..31267eccf3f27 --- /dev/null +++ b/recipes/mosquitto/1.x/patches/1.6.12-0002-fix-macos.patch @@ -0,0 +1,24 @@ +--- a/lib/mosquitto.c ++++ b/lib/mosquitto.c +@@ -23,6 +23,9 @@ Contributors: + #include + #include + #endif ++#ifdef __APPLE__ ++#include ++#endif + + #include "logging_mosq.h" + #include "mosquitto.h" +--- a/src/logging.c ++++ b/src/logging.c +@@ -22,6 +22,9 @@ Contributors: + #include + #endif + #include ++#ifdef __APPLE__ ++#include ++#endif + + #ifdef WITH_DLT + #include diff --git a/recipes/mosquitto/1.x/test_package/CMakeLists.txt b/recipes/mosquitto/1.x/test_package/CMakeLists.txt index 34af13462f44f..d1e99239bfe10 100644 --- a/recipes/mosquitto/1.x/test_package/CMakeLists.txt +++ b/recipes/mosquitto/1.x/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(mosquitto REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE mosquitto::libmosquitto) diff --git a/recipes/mosquitto/1.x/test_package/conanfile.py b/recipes/mosquitto/1.x/test_package/conanfile.py index 4903f1a7e8fa0..98ab55852ad56 100644 --- a/recipes/mosquitto/1.x/test_package/conanfile.py +++ b/recipes/mosquitto/1.x/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mosquitto/1.x/test_v1_package/CMakeLists.txt b/recipes/mosquitto/1.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/mosquitto/1.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/mosquitto/1.x/test_v1_package/conanfile.py b/recipes/mosquitto/1.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/mosquitto/1.x/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mosquitto/2.x/conandata.yml b/recipes/mosquitto/2.x/conandata.yml index 2b7a331d90143..622f72a77af8b 100644 --- a/recipes/mosquitto/2.x/conandata.yml +++ b/recipes/mosquitto/2.x/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.0.15": + url: "https://github.com/eclipse/mosquitto/archive/v2.0.15.tar.gz" + sha256: "26dc3f1758b00c1725a0e4dd32f40c61f374375717f09b6af2bac62c5b44f1eb" "2.0.14": url: "https://github.com/eclipse/mosquitto/archive/v2.0.14.tar.gz" sha256: "c0ce97b1911d1769ccfd65da237e919fd7eaa60209fd190c113d63fbd0c40347" diff --git a/recipes/mosquitto/2.x/conanfile.py b/recipes/mosquitto/2.x/conanfile.py index 8b1f31453b306..a2b39f2d1e5d0 100644 --- a/recipes/mosquitto/2.x/conanfile.py +++ b/recipes/mosquitto/2.x/conanfile.py @@ -26,6 +26,7 @@ class Mosquitto(ConanFile): "cjson": [True, False], "build_cpp": [True, False], "websockets": [True, False], + "threading": [True, False], } default_options = { "shared": False, @@ -37,6 +38,7 @@ class Mosquitto(ConanFile): "cjson": True, # https://github.com/eclipse/mosquitto/commit/bbe0afbfbe7bb392361de41e275759ee4ef06b1c "build_cpp": True, "websockets": False, + "threading": True, } exports_sources = ["CMakeLists.txt"] generators = "cmake", "cmake_find_package" @@ -93,7 +95,7 @@ def _configure_cmake(self): self._cmake.definitions["WITH_APPS"] = self.options.apps self._cmake.definitions["WITH_PLUGINS"] = False self._cmake.definitions["WITH_LIB_CPP"] = self.options.build_cpp - self._cmake.definitions["WITH_THREADING"] = self.settings.compiler != "Visual Studio" + self._cmake.definitions["WITH_THREADING"] = self.settings.compiler != "Visual Studio" and self.options.threading self._cmake.definitions["WITH_WEBSOCKETS"] = self.options.get_safe("websockets", False) self._cmake.definitions["STATIC_WEBSOCKETS"] = self.options.get_safe("websockets", False) and not self.options["libwebsockets"].shared self._cmake.definitions["DOCUMENTATION"] = False diff --git a/recipes/mosquitto/config.yml b/recipes/mosquitto/config.yml index 83aa878cef82a..7627743e2625f 100644 --- a/recipes/mosquitto/config.yml +++ b/recipes/mosquitto/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.15": + folder: "2.x" "2.0.14": folder: "2.x" "2.0.12": diff --git a/recipes/mozilla-build/all/conanfile.py b/recipes/mozilla-build/all/conanfile.py index 56f0c507eb671..c13282cd3e215 100644 --- a/recipes/mozilla-build/all/conanfile.py +++ b/recipes/mozilla-build/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import download +from conan.errors import ConanInvalidConfiguration import os +required_conan_version = ">=1.52.0" class MozillaBuildConan(ConanFile): name = "mozilla-build" @@ -21,8 +23,8 @@ def build_requirements(self): def build(self): filename = "mozilla-build.exe" - tools.download(**self.conan_data["sources"][self.version][0], filename=filename) - tools.download(**self.conan_data["sources"][self.version][1], filename="LICENSE") + download(self, **self.conan_data["sources"][self.version][0], filename=filename) + download(self, **self.conan_data["sources"][self.version][1], filename="LICENSE") self.run(f"7z x {filename}", run_environment=True) @@ -35,6 +37,7 @@ def package_id(self): del self.info.settings.compiler def package_info(self): + self.cpp_info.includedirs = [] binpath = os.path.join(self.package_folder, "bin") - self.output.info("Adding to PATH: {}".format(binpath)) + self.output.info(f"Adding to PATH: {binpath}") self.env_info.PATH.append(binpath) diff --git a/recipes/mozjpeg/all/CMakeLists.txt b/recipes/mozjpeg/all/CMakeLists.txt deleted file mode 100644 index 6d4e2abf9a485..0000000000000 --- a/recipes/mozjpeg/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -include(GNUInstallDirs) - -add_subdirectory(source_subfolder) diff --git a/recipes/mozjpeg/all/conandata.yml b/recipes/mozjpeg/all/conandata.yml index 49a83576b27b3..b3cb941ad21eb 100644 --- a/recipes/mozjpeg/all/conandata.yml +++ b/recipes/mozjpeg/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.1.1": + url: "https://github.com/mozilla/mozjpeg/archive/v4.1.1.tar.gz" + sha256: "66b1b8d6b55d263f35f27f55acaaa3234df2a401232de99b6d099e2bb0a9d196" "4.0.0": url: "https://github.com/mozilla/mozjpeg/archive/v4.0.0.tar.gz" sha256: "961e14e73d06a015e9b23b8af416f010187cc0bec95f6e3b0fcb28cc7e2cbdd4" @@ -6,9 +9,15 @@ sources: url: "https://github.com/mozilla/mozjpeg/archive/v3.3.1.tar.gz" sha256: "aebbea60ea038a84a2d1ed3de38fdbca34027e2e54ee2b7d08a97578be72599d" patches: + "4.1.1": + - patch_file: "patches/4.1.1-0001-cmake-fixes.patch" + patch_description: "fix install folder and disable /NODEFAULT in MSVC" + patch_type: "conan" "4.0.0": - - base_path: "source_subfolder" - patch_file: "patches/4.0.0-0001-cmake-fixes.patch" + - patch_file: "patches/4.0.0-0001-cmake-fixes.patch" + patch_description: "fix install folder" + patch_type: "conan" "3.3.1": - - base_path: "source_subfolder" - patch_file: "patches/3.3.1-0001-cmake-fixes.patch" + - patch_file: "patches/3.3.1-0001-cmake-fixes.patch" + patch_description: "fix install folder" + patch_type: "conan" diff --git a/recipes/mozjpeg/all/conanfile.py b/recipes/mozjpeg/all/conanfile.py index 5e05fb0bce716..3dcf78b0f0e8e 100644 --- a/recipes/mozjpeg/all/conanfile.py +++ b/recipes/mozjpeg/all/conanfile.py @@ -1,19 +1,25 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, CMake, tools -import os +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class MozjpegConan(ConanFile): name = "mozjpeg" description = "MozJPEG is an improved JPEG encoder" - url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "image", "format", "mozjpeg", "jpg", "jpeg", "picture", "multimedia", "graphics") license = ("BSD", "BSD-3-Clause", "ZLIB") + url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mozilla/mozjpeg" - exports_sources = ("CMakeLists.txt", "patches/*") - generators = "cmake" + topics = ("image", "format", "mozjpeg", "jpg", "jpeg", "picture", "multimedia", "graphics") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -42,21 +48,13 @@ class MozjpegConan(ConanFile): "enable12bit": False, } - _autotools = None - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _has_simd_support(self): return self.settings.arch in ["x86", "x86_64"] + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -65,122 +63,150 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") self.provides = ["libjpeg", "libjpeg-turbo"] if self.options.turbojpeg else "libjpeg" @property def _use_cmake(self): - return self.settings.os == "Windows" or tools.Version(self.version) >= "4.0.0" + return self.settings.os == "Windows" or Version(self.version) >= "4.0.0" + + def layout(self): + if self._use_cmake: + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder='src') def build_requirements(self): if not self._use_cmake: - if self.settings.os != "Windows": - self.build_requires("libtool/2.4.6") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("libtool/2.4.7") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") if self.options.get_safe("SIMD"): - self.build_requires("nasm/2.15.05") + self.tool_requires("nasm/2.15.05") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - if tools.cross_building(self.settings): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate_cmake(self): + tc = CMakeToolchain(self) + if cross_building(self): # FIXME: too specific and error prone, should be delegated to CMake helper cmake_system_processor = { "armv8": "aarch64", "armv8.3": "aarch64", }.get(str(self.settings.arch), str(self.settings.arch)) - self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = cmake_system_processor - self._cmake.definitions["ENABLE_TESTING"] = False - self._cmake.definitions["ENABLE_STATIC"] = not self.options.shared - self._cmake.definitions["ENABLE_SHARED"] = self.options.shared - self._cmake.definitions["REQUIRE_SIMD"] = self.options.get_safe("SIMD", False) - self._cmake.definitions["WITH_SIMD"] = self.options.get_safe("SIMD", False) - self._cmake.definitions["WITH_ARITH_ENC"] = self.options.arithmetic_encoder - self._cmake.definitions["WITH_ARITH_DEC"] = self.options.arithmetic_decoder - self._cmake.definitions["WITH_JPEG7"] = self.options.libjpeg7_compatibility - self._cmake.definitions["WITH_JPEG8"] = self.options.libjpeg8_compatibility - self._cmake.definitions["WITH_MEM_SRCDST"] = self.options.mem_src_dst - self._cmake.definitions["WITH_TURBOJPEG"] = self.options.turbojpeg - self._cmake.definitions["WITH_JAVA"] = self.options.java - self._cmake.definitions["WITH_12BIT"] = self.options.enable12bit - self._cmake.definitions["CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT"] = False - self._cmake.definitions["PNG_SUPPORTED"] = False # PNG and zlib are only required for executables (and static libraries) - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["WITH_CRT_DLL"] = "MD" in str(self.settings.compiler.runtime) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - - def _configure_autotools(self): - if not self._autotools: - self._autotools = AutoToolsBuildEnvironment(self) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True))), - "--with-simd={}".format(yes_no(self.options.get_safe("SIMD", False))), - "--with-arith-enc={}".format(yes_no(self.options.arithmetic_encoder)), - "--with-arith-dec={}".format(yes_no(self.options.arithmetic_decoder)), - "--with-jpeg7={}".format(yes_no(self.options.libjpeg7_compatibility)), - "--with-jpeg8={}".format(yes_no(self.options.libjpeg8_compatibility)), - "--with-mem-srcdst={}".format(yes_no(self.options.mem_src_dst)), - "--with-turbojpeg={}".format(yes_no(self.options.turbojpeg)), - "--with-java={}".format(yes_no(self.options.java)), - "--with-12bit={}".format(yes_no(self.options.enable12bit)), - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - self._autotools.configure(configure_dir=self._source_subfolder, args=args) - return self._autotools + tc.variables["CMAKE_SYSTEM_PROCESSOR"] = cmake_system_processor + tc.variables["ENABLE_SHARED"] = self.options.shared + tc.variables["ENABLE_STATIC"] = not self.options.shared + tc.variables["ENABLE_TESTING"] = False + tc.variables["REQUIRE_SIMD"] = bool(self.options.get_safe("SIMD", False)) + tc.variables["WITH_SIMD"] = bool(self.options.get_safe("SIMD", False)) + tc.variables["WITH_ARITH_ENC"] = bool(self.options.arithmetic_encoder) + tc.variables["WITH_ARITH_DEC"] = bool(self.options.arithmetic_decoder) + tc.variables["WITH_JPEG7"] = bool(self.options.libjpeg7_compatibility) + tc.variables["WITH_JPEG8"] = bool(self.options.libjpeg8_compatibility) + tc.variables["WITH_MEM_SRCDST"] = bool(self.options.mem_src_dst) + tc.variables["WITH_TURBOJPEG"] = bool(self.options.turbojpeg) + tc.variables["WITH_JAVA"] = bool(self.options.java) + tc.variables["WITH_12BIT"] = bool(self.options.enable12bit) + tc.variables["CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT"] = False + tc.variables["PNG_SUPPORTED"] = False # PNG and zlib are only required for executables (and static libraries) + if is_msvc(self): + tc.variables["WITH_CRT_DLL"] = not is_msvc_static_runtime(self) + tc.generate() + + def generate_autotools(self): + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + "--with-pic={}".format(yes_no(self.options.get_safe("fPIC", True))), + "--with-simd={}".format(yes_no(self.options.get_safe("SIMD", False))), + "--with-arith-enc={}".format(yes_no(self.options.arithmetic_encoder)), + "--with-arith-dec={}".format(yes_no(self.options.arithmetic_decoder)), + "--with-jpeg7={}".format(yes_no(self.options.libjpeg7_compatibility)), + "--with-jpeg8={}".format(yes_no(self.options.libjpeg8_compatibility)), + "--with-mem-srcdst={}".format(yes_no(self.options.mem_src_dst)), + "--with-turbojpeg={}".format(yes_no(self.options.turbojpeg)), + "--with-java={}".format(yes_no(self.options.java)), + "--with-12bit={}".format(yes_no(self.options.enable12bit)), + ]) + tc.generate() + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if self._use_cmake: + self.generate_cmake() + else: + self.generate_autotools() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if self._use_cmake: - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() else: - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF"))) - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy(pattern="LICENSE.md", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) if self._use_cmake: - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "doc")) + rmdir(self, os.path.join(self.package_folder, "doc")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rm(self, pattern="*.la", folder=os.path.join(self.package_folder, "lib")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + copy(self, pattern="*.a", dst=os.path.join(self.package_folder, "lib"), src=os.path.join(self.package_folder, "lib64")) + rmdir(self, os.path.join(self.package_folder, "lib64")) # remove binaries and pdb files for bin_pattern_to_remove in ["cjpeg*", "djpeg*", "jpegtran*", "tjbench*", "wrjpgcom*", "rdjpgcom*", "*.pdb"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), bin_pattern_to_remove) + rm(self, pattern=bin_pattern_to_remove, folder=os.path.join(self.package_folder, "bin")) def _lib_name(self, name): - if self.settings.os == "Windows" and self.settings.compiler == "Visual Studio" and not self.options.shared: + if is_msvc(self) and not self.options.shared: return name + "-static" return name def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_module_file_name", "JPEG") + self.cpp_info.set_property("cmake_file_name", "mozjpeg") + + cmake_target_suffix = "-static" if not self.options.shared else "" + # libjpeg - self.cpp_info.components["libjpeg"].names["pkg_config"] = "libjpeg" + self.cpp_info.components["libjpeg"].set_property("cmake_module_target_name", "JPEG::JPEG") + self.cpp_info.components["libjpeg"].set_property("cmake_target_name", f"mozjpeg::jpeg{cmake_target_suffix}") + self.cpp_info.components["libjpeg"].set_property("pkg_config_name", "libjpeg") self.cpp_info.components["libjpeg"].libs = [self._lib_name("jpeg")] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libjpeg"].system_libs.append("m") # libturbojpeg if self.options.turbojpeg: - self.cpp_info.components["libturbojpeg"].names["pkg_config"] = "libturbojpeg" + self.cpp_info.components["libturbojpeg"].set_property("cmake_target_name", f"mozjpeg::turbojpeg{cmake_target_suffix}") + self.cpp_info.components["libturbojpeg"].set_property("pkg_config_name", "libturbojpeg") self.cpp_info.components["libturbojpeg"].libs = [self._lib_name("turbojpeg")] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["libturbojpeg"].system_libs.append("m") + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "JPEG" + self.cpp_info.names["cmake_find_package_multi"] = "mozjpeg" + self.cpp_info.components["libjpeg"].names["cmake_find_package"] = "JPEG" + self.cpp_info.components["libjpeg"].names["cmake_find_package_multi"] = f"jpeg{cmake_target_suffix}" + if self.options.turbojpeg: + self.cpp_info.components["libturbojpeg"].names["cmake_find_package"] = f"turbojpeg{cmake_target_suffix}" + self.cpp_info.components["libturbojpeg"].names["cmake_find_package_multi"] = f"turbojpeg{cmake_target_suffix}" diff --git a/recipes/mozjpeg/all/patches/3.3.1-0001-cmake-fixes.patch b/recipes/mozjpeg/all/patches/3.3.1-0001-cmake-fixes.patch index b126195864e79..de72859433e6a 100644 --- a/recipes/mozjpeg/all/patches/3.3.1-0001-cmake-fixes.patch +++ b/recipes/mozjpeg/all/patches/3.3.1-0001-cmake-fixes.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 743a243..b5d41a1 100644 +index 743a243..eb787c8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -168,7 +168,7 @@ message(STATUS "Install directory = ${CMAKE_INSTALL_PREFIX}") @@ -34,7 +34,7 @@ index 743a243..b5d41a1 100644 install(TARGETS turbojpeg-static ARCHIVE DESTINATION lib) if(NOT ENABLE_SHARED) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/tjbench-static.exe -+ install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/tjbench-static.exe ++ install(PROGRAMS $ DESTINATION bin RENAME tjbench.exe) endif() endif() @@ -46,13 +46,13 @@ index 743a243..b5d41a1 100644 install(TARGETS jpeg-static ARCHIVE DESTINATION lib) if(NOT ENABLE_SHARED) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/cjpeg-static.exe -+ install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/cjpeg-static.exe ++ install(PROGRAMS $ DESTINATION bin RENAME cjpeg.exe) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/djpeg-static.exe -+ install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/djpeg-static.exe ++ install(PROGRAMS $ DESTINATION bin RENAME djpeg.exe) - install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/jpegtran-static.exe -+ install(PROGRAMS ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/jpegtran-static.exe ++ install(PROGRAMS $ DESTINATION bin RENAME jpegtran.exe) endif() endif() diff --git a/recipes/mozjpeg/all/patches/4.1.1-0001-cmake-fixes.patch b/recipes/mozjpeg/all/patches/4.1.1-0001-cmake-fixes.patch new file mode 100644 index 0000000000000..0d6ad37fc19fd --- /dev/null +++ b/recipes/mozjpeg/all/patches/4.1.1-0001-cmake-fixes.patch @@ -0,0 +1,34 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8d295c6..b30dacb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1461,7 +1461,7 @@ if(WITH_TURBOJPEG) + else() + set(DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() +- install(PROGRAMS ${DIR}/tjbench-static${EXE} ++ install(PROGRAMS $ + DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME tjbench${EXE}) + endif() + endif() +@@ -1479,16 +1479,16 @@ if(ENABLE_STATIC) + else() + set(DIR ${CMAKE_CURRENT_BINARY_DIR}) + endif() +- install(PROGRAMS ${DIR}/cjpeg-static${EXE} ++ install(PROGRAMS $ + DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME cjpeg${EXE}) +- install(PROGRAMS ${DIR}/djpeg-static${EXE} ++ install(PROGRAMS $ + DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME djpeg${EXE}) +- install(PROGRAMS ${DIR}/jpegtran-static${EXE} ++ install(PROGRAMS $ + DESTINATION ${CMAKE_INSTALL_BINDIR} RENAME jpegtran${EXE}) + endif() + endif() + +-install(TARGETS rdjpgcom wrjpgcom RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) ++install(TARGETS rdjpgcom wrjpgcom DESTINATION ${CMAKE_INSTALL_BINDIR}) + + install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/README.ijg + ${CMAKE_CURRENT_SOURCE_DIR}/README.md ${CMAKE_CURRENT_SOURCE_DIR}/example.txt diff --git a/recipes/mozjpeg/all/test_package/CMakeLists.txt b/recipes/mozjpeg/all/test_package/CMakeLists.txt index 7b9b613cbb24a..43fbdac6cca73 100644 --- a/recipes/mozjpeg/all/test_package/CMakeLists.txt +++ b/recipes/mozjpeg/all/test_package/CMakeLists.txt @@ -1,8 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(mozjpeg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +if(TARGET mozjpeg::jpeg) + target_link_libraries(${PROJECT_NAME} PRIVATE mozjpeg::jpeg) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE mozjpeg::jpeg-static) +endif() diff --git a/recipes/mozjpeg/all/test_package/conanfile.py b/recipes/mozjpeg/all/test_package/conanfile.py index 3ae27388e5a6d..2494f49b77c0d 100644 --- a/recipes/mozjpeg/all/test_package/conanfile.py +++ b/recipes/mozjpeg/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") img_name = os.path.join(self.source_folder, "testimg.jpg") - self.run("%s %s" % (bin_path, img_name), run_environment=True) + self.run(f"{bin_path} {img_name}", env="conanrun") diff --git a/recipes/mozjpeg/all/test_package_module/CMakeLists.txt b/recipes/mozjpeg/all/test_package_module/CMakeLists.txt new file mode 100644 index 0000000000000..e21fd04d88d98 --- /dev/null +++ b/recipes/mozjpeg/all/test_package_module/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(JPEG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE JPEG::JPEG) diff --git a/recipes/mozjpeg/all/test_package_module/conanfile.py b/recipes/mozjpeg/all/test_package_module/conanfile.py new file mode 100644 index 0000000000000..fd19bb1425057 --- /dev/null +++ b/recipes/mozjpeg/all/test_package_module/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", env="conanrun") diff --git a/recipes/mozjpeg/all/test_v1_package/CMakeLists.txt b/recipes/mozjpeg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/mozjpeg/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/mozjpeg/all/test_v1_package/conanfile.py b/recipes/mozjpeg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..cf6e3a0371de5 --- /dev/null +++ b/recipes/mozjpeg/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", run_environment=True) diff --git a/recipes/mozjpeg/all/test_v1_package_module/CMakeLists.txt b/recipes/mozjpeg/all/test_v1_package_module/CMakeLists.txt new file mode 100644 index 0000000000000..27f7a57e7a0b3 --- /dev/null +++ b/recipes/mozjpeg/all/test_v1_package_module/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package_module + ${CMAKE_CURRENT_BINARY_DIR}/test_package_module) diff --git a/recipes/mozjpeg/all/test_v1_package_module/conanfile.py b/recipes/mozjpeg/all/test_v1_package_module/conanfile.py new file mode 100644 index 0000000000000..b6600e428515c --- /dev/null +++ b/recipes/mozjpeg/all/test_v1_package_module/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_name = os.path.join(self.source_folder, os.pardir, "test_package", "testimg.jpg") + self.run(f"{bin_path} {img_name}", run_environment=True) diff --git a/recipes/mozjpeg/config.yml b/recipes/mozjpeg/config.yml index 7bdb507696897..c5a4dbb215dd3 100644 --- a/recipes/mozjpeg/config.yml +++ b/recipes/mozjpeg/config.yml @@ -1,5 +1,7 @@ versions: - "3.3.1": + "4.1.1": folder: all "4.0.0": folder: all + "3.3.1": + folder: all diff --git a/recipes/mpark-variant/all/conanfile.py b/recipes/mpark-variant/all/conanfile.py index 3f8a0dc88a728..e015db951bf2d 100644 --- a/recipes/mpark-variant/all/conanfile.py +++ b/recipes/mpark-variant/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, save +from conan.tools.layout import basic_layout import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class MparkVariantConan(ConanFile): @@ -15,24 +18,26 @@ class MparkVariantConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, "11") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy(pattern="LICENSE.md", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self._create_cmake_module_alias_targets( @@ -40,25 +45,26 @@ def package(self): {"mpark_variant": "mpark_variant::mpark_variant"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "mpark_variant") self.cpp_info.set_property("cmake_target_name", "mpark_variant") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "mpark_variant" diff --git a/recipes/mpark-variant/all/test_package/CMakeLists.txt b/recipes/mpark-variant/all/test_package/CMakeLists.txt index 50961a264fe58..1d878b6a4c4f5 100644 --- a/recipes/mpark-variant/all/test_package/CMakeLists.txt +++ b/recipes/mpark-variant/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(mpark_variant REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} mpark_variant) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE mpark_variant) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/mpark-variant/all/test_package/conanfile.py b/recipes/mpark-variant/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/mpark-variant/all/test_package/conanfile.py +++ b/recipes/mpark-variant/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mpark-variant/all/test_v1_package/CMakeLists.txt b/recipes/mpark-variant/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/mpark-variant/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/mpark-variant/all/test_v1_package/conanfile.py b/recipes/mpark-variant/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/mpark-variant/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mpc/all/conandata.yml b/recipes/mpc/all/conandata.yml index 007c14f9a1cc4..cd8f83a739d7d 100644 --- a/recipes/mpc/all/conandata.yml +++ b/recipes/mpc/all/conandata.yml @@ -8,4 +8,5 @@ sources: patches: "1.2.0": - patch_file: "patches/1.2.0-0001-asin-missing-limits.patch" - base_path: "source_subfolder" + patch_description: "asin.c needs limits.h" + patch_type: "portability" diff --git a/recipes/mpc/all/conanfile.py b/recipes/mpc/all/conanfile.py index 0d3ae8cad33a5..f996155628e5c 100644 --- a/recipes/mpc/all/conanfile.py +++ b/recipes/mpc/all/conanfile.py @@ -1,11 +1,20 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.layout import basic_layout +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.apple import fix_apple_shared_install_name +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" + +required_conan_version = ">=1.54.0" class MpcConan(ConanFile): name = "mpc" + package_type = "library" description = "GNU MPC is a C library for the arithmetic of complex numbers with arbitrarily high precision " \ "and correct rounding of the result" topics = ("conan", "mpc", "multiprecision", "math", "mathematics") @@ -15,66 +24,78 @@ class MpcConan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = {"shared": [True, False], "fPIC": [True, False]} default_options = {"shared": False, "fPIC": True} - exports_sources = "patches/**" - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == 'Windows': - del self.options.fPIC + self.options.rm_safe("fPIC") def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def requirements(self): - self.requires("mpfr/4.1.0") + self.requires("gmp/6.2.1", transitive_headers=True) + self.requires("mpfr/4.1.0", transitive_headers=True) def validate(self): - # FIXME: add Visual Studio support, upstream has a makefile.vc - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("mpc can be built with Visual Studio, but it's not supported yet in this recipe.") + # FIXME: add msvc support, upstream has a makefile.vc + if is_msvc(self): + raise ConanInvalidConfiguration("mpc can be built with msvc, but it's not supported yet in this recipe.") @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def layout(self): + basic_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - args = [] - if self.options.shared: - args.extend(["--disable-static", "--enable-shared"]) - else: - args.extend(["--disable-shared", "--enable-static"]) - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + tc.configure_args.append(f'--with-gmp={unix_path(self, self.dependencies["gmp"].package_folder)}') + tc.configure_args.append(f'--with-mpfr={unix_path(self, self.dependencies["mpfr"].package_folder)}') + tc.generate() + + tc = AutotoolsDeps(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - autotools = self._configure_autotools() + apply_conandata_patches(self) + autotools = Autotools(self) + if not os.path.exists(os.path.join(self.source_folder, "configure")): + autotools.autoreconf(["-i"]) + autotools.configure() autotools.make() def package(self): - self.copy(pattern="COPYING.LESSER", dst="licenses", src=self._source_subfolder) - autotools = self._configure_autotools() + copy(self, "COPYING.LESSER", self.source_folder, os.path.join(self.package_folder, "licenses"), keep_path=False) + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + fix_apple_shared_install_name(self) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib"), recursive=True) def package_info(self): self.cpp_info.libs = ["mpc"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["m"] diff --git a/recipes/mpc/all/test_package/CMakeLists.txt b/recipes/mpc/all/test_package/CMakeLists.txt index 7b9b613cbb24a..5167a095daebe 100644 --- a/recipes/mpc/all/test_package/CMakeLists.txt +++ b/recipes/mpc/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(mpc REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE mpc::mpc) diff --git a/recipes/mpc/all/test_package/conanfile.py b/recipes/mpc/all/test_package/conanfile.py index bd7165a553cf4..da190011b6b6d 100644 --- a/recipes/mpc/all/test_package/conanfile.py +++ b/recipes/mpc/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import cross_building import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if not cross_building(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mpc/all/test_v1_package/CMakeLists.txt b/recipes/mpc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/mpc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/mpc/all/test_v1_package/conanfile.py b/recipes/mpc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e2dfe859bb27 --- /dev/null +++ b/recipes/mpc/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mpg123/all/CMakeLists.txt b/recipes/mpg123/all/CMakeLists.txt deleted file mode 100644 index 8c39621ac3881..0000000000000 --- a/recipes/mpg123/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder/ports/cmake) diff --git a/recipes/mpg123/all/conandata.yml b/recipes/mpg123/all/conandata.yml index b41c8b1f2db34..aa66e1050ebb7 100644 --- a/recipes/mpg123/all/conandata.yml +++ b/recipes/mpg123/all/conandata.yml @@ -1,16 +1,25 @@ sources: - "1.26.4": - url: "https://sourceforge.net/projects/mpg123/files/mpg123/1.26.4/mpg123-1.26.4.tar.bz2" - sha256: "081991540df7a666b29049ad870f293cfa28863b36488ab4d58ceaa7b5846454" + "1.31.2": + url: + - "https://sourceforge.net/projects/mpg123/files/mpg123/1.31.2/mpg123-1.31.2.tar.bz2" + - "https://www.mpg123.de/download/mpg123-1.31.2.tar.bz2" + sha256: "b17f22905e31f43b6b401dfdf6a71ed11bb7d056f68db449d70b9f9ae839c7de" "1.29.3": - url: "https://sourceforge.net/projects/mpg123/files/mpg123/1.29.3/mpg123-1.29.3.tar.bz2" + url: + - "https://sourceforge.net/projects/mpg123/files/mpg123/1.29.3/mpg123-1.29.3.tar.bz2" + - "https://www.mpg123.de/download/mpg123-1.29.3.tar.bz2" sha256: "963885d8cc77262f28b77187c7d189e32195e64244de2530b798ddf32183e847" + "1.26.4": + url: + - "https://sourceforge.net/projects/mpg123/files/mpg123/1.26.4/mpg123-1.26.4.tar.bz2" + - "https://www.mpg123.de/download/mpg123-1.26.4.tar.bz2" + sha256: "081991540df7a666b29049ad870f293cfa28863b36488ab4d58ceaa7b5846454" + patches: + "1.31.2": + - patch_file: "patches/0001-msvc-export-symbols.patch" "1.26.4": - patch_file: "patches/0001-msvc-export-symbols.patch" - base_path: "source_subfolder" "1.29.3": - patch_file: "patches/0001-msvc-export-symbols.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-cmake-read_api_version-fix.patch" - base_path: "source_subfolder" diff --git a/recipes/mpg123/all/conanfile.py b/recipes/mpg123/all/conanfile.py index c5a4ec0ca9d4a..e52bf0dba5e9e 100644 --- a/recipes/mpg123/all/conanfile.py +++ b/recipes/mpg123/all/conanfile.py @@ -1,14 +1,22 @@ -from conans import AutoToolsBuildEnvironment, CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain +from conan.tools.layout import basic_layout +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.files import get, copy, export_conandata_patches, apply_conandata_patches, rmdir, rm +from conan.tools.microsoft import is_msvc +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.build import cross_building import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class Mpg123Conan(ConanFile): name = "mpg123" description = "Fast console MPEG Audio Player and decoder library" - topics = ("conan", "mpg123", "mpeg", "audio", "player", "decoder") + topics = ("mpeg", "audio", "player", "decoder") url = "https://github.com/conan-io/conan-center-index" homepage = "http://mpg123.org/" license = "LGPL-2.1-or-later", "GPL-2.0-or-later" @@ -25,7 +33,7 @@ class Mpg123Conan(ConanFile): "layer2": [True, False], "layer3": [True, False], "moreinfo": [True, False], - "seektable": "ANY", + "seektable": [None, "ANY"], "module": ["dummy", "libalsa", "tinyalsa", "win32"], } default_options = { @@ -43,153 +51,167 @@ class Mpg123Conan(ConanFile): "seektable": "1000", "module": "dummy", } - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake", "pkg_config", "cmake_find_package" - _autotools = None - _cmake = None + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property - def _source_subfolder(self): - return "source_subfolder" + def _audio_module(self): + return { + "libalsa": "alsa", + }.get(str(self.options.module), str(self.options.module)) + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + if is_msvc(self): + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def requirements(self): if self.options.module == "libalsa": - self.requires("libalsa/1.2.4") + self.requires("libalsa/1.2.7.2") if self.options.module == "tinyalsa": - self.requires("tinyalsa/1.1.1") + self.requires("tinyalsa/2.0.0") def validate(self): - try: - int(self.options.seektable) - except ValueError: - raise ConanInvalidConfiguration("seektable must be an integer") - if self.settings.os != "Windows": - if self.options.module == "win32": - raise ConanInvalidConfiguration("win32 is an invalid module for non-Windows os'es") + if not str(self.options.seektable).isdigit(): + raise ConanInvalidConfiguration(f"The option -o {self.ref.name}:seektable must be an integer number.") + if self.settings.os != "Windows" and self.options.module == "win32": + raise ConanInvalidConfiguration(f"The option -o {self.ref.name}:module should not use 'win32' for non-Windows OS") - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) def build_requirements(self): - self.build_requires("pkgconf/1.7.4") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") if self.settings.arch in ["x86", "x86_64"]: - self.build_requires("yasm/1.3.0") - if self._settings_build.os == "Windows" and self.settings.compiler != "Visual Studio" and \ - not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("yasm/1.3.0") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @property - def _audio_module(self): - return { - "libalsa": "alsa", - }.get(str(self.options.module), str(self.options.module)) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--enable-moreinfo={}".format(yes_no(self.options.moreinfo)), - "--enable-network={}".format(yes_no(self.options.network)), - "--enable-ntom={}".format(yes_no(self.options.flexible_resampling)), - "--enable-icy={}".format(yes_no(self.options.icy)), - "--enable-id3v2={}".format(yes_no(self.options.id3v2)), - "--enable-ieeefloat={}".format(yes_no(self.options.ieeefloat)), - "--enable-layer1={}".format(yes_no(self.options.layer1)), - "--enable-layer2={}".format(yes_no(self.options.layer2)), - "--enable-layer3={}".format(yes_no(self.options.layer3)), - "--with-audio={}".format(self._audio_module), - "--with-default-audio={}".format(self._audio_module), - "--with-seektable={}".format(self.options.seektable), - "--enable-modules=no", - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["NO_MOREINFO"] = not self.options.moreinfo - self._cmake.definitions["NETWORK"] = self.options.network - self._cmake.definitions["NO_NTOM"] = not self.options.flexible_resampling - self._cmake.definitions["NO_ICY"] = not self.options.icy - self._cmake.definitions["NO_ID3V2"] = not self.options.id3v2 - self._cmake.definitions["IEEE_FLOAT"] = self.options.ieeefloat - self._cmake.definitions["NO_LAYER1"] = not self.options.layer1 - self._cmake.definitions["NO_LAYER2"] = not self.options.layer2 - self._cmake.definitions["NO_LAYER3"] = not self.options.layer3 - self._cmake.definitions["USE_MODULES"] = False - self._cmake.definitions["CHECK_MODULES"] = self._audio_module - self._cmake.definitions["WITH_SEEKTABLE"] = self.options.seektable - self._cmake.verbose = True - self._cmake.parallel = False - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + if is_msvc(self): + tc = CMakeToolchain(self) + tc.variables["NO_MOREINFO"] = not self.options.moreinfo + tc.variables["NETWORK"] = self.options.network + tc.variables["NO_NTOM"] = not self.options.flexible_resampling + tc.variables["NO_ICY"] = not self.options.icy + tc.variables["NO_ID3V2"] = not self.options.id3v2 + tc.variables["IEEE_FLOAT"] = self.options.ieeefloat + tc.variables["NO_LAYER1"] = not self.options.layer1 + tc.variables["NO_LAYER2"] = not self.options.layer2 + tc.variables["NO_LAYER3"] = not self.options.layer3 + tc.variables["USE_MODULES"] = False + tc.variables["CHECK_MODULES"] = self._audio_module + tc.variables["WITH_SEEKTABLE"] = self.options.seektable + tc.generate() + tc = CMakeDeps(self) + tc.generate() + else: + yes_no = lambda v: "yes" if v else "no" + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ + f"--enable-moreinfo={yes_no(self.options.moreinfo)}", + f"--enable-network={yes_no(self.options.network)}", + f"--enable-ntom={yes_no(self.options.flexible_resampling)}", + f"--enable-icy={yes_no(self.options.icy)}", + f"--enable-id3v2={yes_no(self.options.id3v2)}", + f"--enable-ieeefloat={yes_no(self.options.ieeefloat)}", + f"--enable-layer1={yes_no(self.options.layer1)}", + f"--enable-layer2={yes_no(self.options.layer2)}", + f"--enable-layer3={yes_no(self.options.layer3)}", + f"--with-audio={self._audio_module}", + f"--with-default-audio={self._audio_module}", + f"--with-seektable={self.options.seektable}", + f"--enable-modules=no", + f"--enable-shared={yes_no(self.options.shared)}", + f"--enable-static={yes_no(not self.options.shared)}", + ]) + if is_apple_os(self): + # Needed for fix_apple_shared_install_name invocation in package method + tc.extra_cflags = ["-headerpad_max_install_names"] + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self.settings.compiler == "Visual Studio": - cmake = self._configure_cmake() + apply_conandata_patches(self) + if is_msvc(self): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "ports", "cmake")) cmake.build() else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - if self.settings.compiler == "Visual Studio": - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "mpg123" - self.cpp_info.filenames["cmake_find_package_multi"] = "mpg123" - self.cpp_info.names["cmake_find_package"] = "MPG123" - self.cpp_info.names["cmake_find_package_multi"] = "MPG123" + self.cpp_info.set_property("cmake_file_name", "mpg123") self.cpp_info.components["libmpg123"].libs = ["mpg123"] - self.cpp_info.components["libmpg123"].names["pkg_config"] = "libmpg123" + self.cpp_info.components["libmpg123"].set_property("pkg_config_name", "libmpg123") + self.cpp_info.components["libmpg123"].set_property("cmake_target_name", "MPG123::libmpg123") + self.cpp_info.components["libmpg123"].names["cmake_find_package"] = "libmpg123" + self.cpp_info.components["libmpg123"].names["cmake_find_package_multi"] = "libmpg123" if self.settings.os == "Windows" and self.options.shared: self.cpp_info.components["libmpg123"].defines.append("LINK_MPG123_DLL") self.cpp_info.components["libout123"].libs = ["out123"] - self.cpp_info.components["libout123"].names["pkg_config"] = "libout123" + self.cpp_info.components["libout123"].set_property("pkg_config_name", "libout123") + self.cpp_info.components["libout123"].set_property("cmake_target_name", "MPG123::libout123") + self.cpp_info.components["libout123"].names["cmake_find_package"] = "libout123" + self.cpp_info.components["libout123"].names["cmake_find_package_multi"] = "libout123" self.cpp_info.components["libout123"].requires = ["libmpg123"] self.cpp_info.components["libsyn123"].libs = ["syn123"] - self.cpp_info.components["libsyn123"].names["pkg_config"] = "libsyn123" + self.cpp_info.components["libsyn123"].set_property("pkg_config_name", "libsyn123") + self.cpp_info.components["libsyn123"].set_property("cmake_target_name", "MPG123::libsyn123") + self.cpp_info.components["libsyn123"].names["cmake_find_package"] = "libsyn123" + self.cpp_info.components["libsyn123"].names["cmake_find_package_multi"] = "libsyn123" self.cpp_info.components["libsyn123"].requires = ["libmpg123"] if self.settings.os == "Linux": self.cpp_info.components["libmpg123"].system_libs = ["m"] + self.cpp_info.components["libsyn123"].system_libs = ["mvec"] elif self.settings.os == "Windows": self.cpp_info.components["libmpg123"].system_libs = ["shlwapi"] @@ -200,6 +222,13 @@ def package_info(self): if self.options.module == "win32": self.cpp_info.components["libout123"].system_libs.append("winmm") + + # TODO: Remove after Conan 2.x becomes the standard + self.cpp_info.filenames["cmake_find_package"] = "mpg123" + self.cpp_info.filenames["cmake_find_package_multi"] = "mpg123" + self.cpp_info.names["cmake_find_package"] = "MPG123" + self.cpp_info.names["cmake_find_package_multi"] = "MPG123" + bin_path = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bin_path)) self.env_info.PATH.append(bin_path) diff --git a/recipes/mpg123/all/test_package/CMakeLists.txt b/recipes/mpg123/all/test_package/CMakeLists.txt index 151a7eb5be518..f76bb27a27d92 100644 --- a/recipes/mpg123/all/test_package/CMakeLists.txt +++ b/recipes/mpg123/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(mpg123 REQUIRED CONFIG) diff --git a/recipes/mpg123/all/test_package/conanfile.py b/recipes/mpg123/all/test_package/conanfile.py index 7e2dfe859bb27..a9fb96656f203 100644 --- a/recipes/mpg123/all/test_package/conanfile.py +++ b/recipes/mpg123/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mpg123/all/test_v1_package/CMakeLists.txt b/recipes/mpg123/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/mpg123/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mpg123/all/test_v1_package/conanfile.py b/recipes/mpg123/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/mpg123/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mpg123/all/test_v1_package/test_package.c b/recipes/mpg123/all/test_v1_package/test_package.c new file mode 100644 index 0000000000000..9db524c82cb7a --- /dev/null +++ b/recipes/mpg123/all/test_v1_package/test_package.c @@ -0,0 +1,12 @@ +#include "mpg123.h" +#include + +int main() { + int error; + mpg123_pars *pars; + + pars = mpg123_new_pars(&error); + mpg123_fmt_all(pars); + mpg123_delete_pars(pars); + return 0; +} diff --git a/recipes/mpg123/config.yml b/recipes/mpg123/config.yml index bf527ae59b5fa..72e2327209ae3 100644 --- a/recipes/mpg123/config.yml +++ b/recipes/mpg123/config.yml @@ -1,5 +1,7 @@ versions: - "1.26.4": + "1.31.2": folder: "all" "1.29.3": folder: "all" + "1.26.4": + folder: "all" diff --git a/recipes/mppp/all/CMakeLists.txt b/recipes/mppp/all/CMakeLists.txt deleted file mode 100644 index 89b149fab29dd..0000000000000 --- a/recipes/mppp/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS TARGETS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - -add_subdirectory(source_subfolder) diff --git a/recipes/mppp/all/conandata.yml b/recipes/mppp/all/conandata.yml index 3228eb567b811..9e4f3e0e2fcbe 100644 --- a/recipes/mppp/all/conandata.yml +++ b/recipes/mppp/all/conandata.yml @@ -1,12 +1,17 @@ sources: + "0.27": + url: "https://github.com/bluescarni/mppp/archive/v0.27.tar.gz" + sha256: "a1e04f6605b3242d4361742159cf5ab273162fd7c105c2743a9bebcf44c846c3" "0.26": url: "https://github.com/bluescarni/mppp/archive/v0.26.tar.gz" sha256: "4dbfa68802d9a1365eda884f085418afc147d01b7a928e8333e4dcc1c3b3ce9e" patches: + "0.27": + - patch_file: "patches/0.27-0001-disable-warning-error.patch" + patch_description: "disable the flag for treats warning as errors" + patch_type: "portability" "0.26": - # FIXME: can't find Boost serialization COMPONENT. - - patch_file: "patches/0.26-0001-remove-boost-components.patch" - base_path: "source_subfolder" - - patch_file: "patches/0.26-0002-disable-warning-error.patch" - base_path: "source_subfolder" + - patch_file: "patches/0.26-0001-disable-warning-error.patch" + patch_description: "disable the flag for treats warning as errors" + patch_type: "portability" diff --git a/recipes/mppp/all/conanfile.py b/recipes/mppp/all/conanfile.py index aab60e2170f78..f6d828ae44a49 100644 --- a/recipes/mppp/all/conanfile.py +++ b/recipes/mppp/all/conanfile.py @@ -1,10 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc_static_runtime +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version import os -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class MpppConan(ConanFile): name = "mppp" @@ -22,6 +26,7 @@ class MpppConan(ConanFile): "with_mpc": [True, False], "with_quadmath": [True, False], "with_boost": [True, False], + "with_fmt": [True, False], } default_options = { "shared": False, @@ -31,17 +36,15 @@ class MpppConan(ConanFile): "with_mpc": False, "with_quadmath": False, "with_boost": False, + "with_fmt": False, } - generators = "cmake", "cmake_find_package_multi" @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -49,7 +52,12 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + if Version(self.version) < "0.27": + del self.options.with_fmt + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("gmp/6.2.1") @@ -58,56 +66,63 @@ def requirements(self): if self.options.with_mpc == True: self.requires("mpc/1.2.0") if self.options.with_boost == True: - self.requires("boost/1.79.0") + self.requires("boost/1.81.0") + if self.options.get_safe("with_fmt"): + self.requires("fmt/9.1.0") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, self._minimum_cpp_standard) if self.options.with_arb: - raise ConanInvalidConfiguration("{}/{} doesn't supported arb (yet)".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref}:with_arb=True is not supported because `fredrik-johansson/arb` is not packaged in CCI. (yet)") if self.options.with_quadmath: - raise ConanInvalidConfiguration("{}/{} doesn't supported libquadmath (yet)".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref}:with_quadmath=True is not supported because `libquadmath` is not available from CCI. (yet)") if self.options.with_boost and self.options["boost"].without_serialization: - raise ConanInvalidConfiguration("{}:with_boost=True requires boost::without_serialization=False".format(self.name)) + raise ConanInvalidConfiguration(f"{self.name}:with_boost=True requires boost::without_serialization=False") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["MPPP_BUILD_STATIC_LIBRARY"] = not self.options.shared - cmake.definitions["MPPP_WITH_MPFR"] = self.options.with_mpfr - cmake.definitions["MPPP_WITH_ARB"] = self.options.with_arb - cmake.definitions["MPPP_WITH_MPC"] = self.options.with_mpc - cmake.definitions["MPPP_WITH_QUADMATH"] = self.options.with_quadmath - cmake.definitions["MPPP_WITH_BOOST_S11N"] = self.options.with_boost + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.variables["MPPP_BUILD_STATIC_LIBRARY"] = not self.options.shared + tc.variables["MPPP_WITH_MPFR"] = self.options.with_mpfr + tc.variables["MPPP_WITH_ARB"] = self.options.with_arb + tc.variables["MPPP_WITH_MPC"] = self.options.with_mpc + tc.variables["MPPP_WITH_QUADMATH"] = self.options.with_quadmath + tc.variables["MPPP_WITH_BOOST_S11N"] = self.options.with_boost + if Version(self.version) >= "0.27": + tc.variables["MPPP_WITH_FMT"] = self.options.with_fmt if not self.options.shared: - cmake.definitions["MPPP_BUILD_STATIC_LIBRARY_WITH_DYNAMIC_MSVC_RUNTIME"] = self.settings.compiler.get_safe("runtime") in ["MD", "MDd"] - cmake.configure() - return cmake + tc.variables["MPPP_BUILD_STATIC_LIBRARY_WITH_DYNAMIC_MSVC_RUNTIME"] = not is_msvc_static_runtime(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.libs = ["mp++"] self.cpp_info.set_property("cmake_file_name", "mp++") self.cpp_info.set_property("cmake_target_name", "mp++::mp++") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + if self.options.get_safe("with_fmt"): + self.cpp_info.defines.append("MPPP_WITH_FMT") + # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "mp++" self.cpp_info.filenames["cmake_find_package_multi"] = "mp++" diff --git a/recipes/mppp/all/patches/0.26-0002-disable-warning-error.patch b/recipes/mppp/all/patches/0.26-0001-disable-warning-error.patch similarity index 100% rename from recipes/mppp/all/patches/0.26-0002-disable-warning-error.patch rename to recipes/mppp/all/patches/0.26-0001-disable-warning-error.patch diff --git a/recipes/mppp/all/patches/0.26-0001-remove-boost-components.patch b/recipes/mppp/all/patches/0.26-0001-remove-boost-components.patch deleted file mode 100644 index 21ac5a78eb95e..0000000000000 --- a/recipes/mppp/all/patches/0.26-0001-remove-boost-components.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 317e9be..7110e0d 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -407,7 +407,7 @@ endif() - # Optional dependency on Boost s11n. - set(_MPPP_MIN_BOOST_VERSION "1.60") - if(MPPP_WITH_BOOST_S11N) -- find_package(Boost ${_MPPP_MIN_BOOST_VERSION} REQUIRED COMPONENTS serialization) -+ find_package(Boost ${_MPPP_MIN_BOOST_VERSION} REQUIRED) - target_link_libraries(mp++ PUBLIC Boost::serialization Boost::disable_autolinking) - endif() - -diff --git a/mp++-config.cmake.in b/mp++-config.cmake.in -index 6aabf77..6d888e5 100644 ---- a/mp++-config.cmake.in -+++ b/mp++-config.cmake.in -@@ -20,7 +20,7 @@ endif() - set(mp++_WITH_MPC @MPPP_WITH_MPC@) - - if(@MPPP_WITH_BOOST_S11N@) -- find_package(Boost @_MPPP_MIN_BOOST_VERSION@ REQUIRED COMPONENTS serialization) -+ find_package(Boost @_MPPP_MIN_BOOST_VERSION@ REQUIRED) - endif() - set(mp++_WITH_BOOST_S11N @MPPP_WITH_BOOST_S11N@) - diff --git a/recipes/mppp/all/patches/0.27-0001-disable-warning-error.patch b/recipes/mppp/all/patches/0.27-0001-disable-warning-error.patch new file mode 100644 index 0000000000000..8906bc4799f22 --- /dev/null +++ b/recipes/mppp/all/patches/0.27-0001-disable-warning-error.patch @@ -0,0 +1,25 @@ +diff --git a/cmake/yacma/YACMACompilerLinkerSettings.cmake b/cmake/yacma/YACMACompilerLinkerSettings.cmake +index edafe6d..10f40ed 100644 +--- a/cmake/yacma/YACMACompilerLinkerSettings.cmake ++++ b/cmake/yacma/YACMACompilerLinkerSettings.cmake +@@ -91,11 +91,6 @@ if(NOT _YACMACompilerLinkerSettingsRun) + # For now it seems like -Wshadow from clang behaves better than GCC's, just enable it here + # for the time being. + _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wshadow) +- # Clang is better at this flag than GCC. +- # NOTE: enable unconditionally, as it seems like the CMake +- # machinery for detecting this fails. Perhaps the source code +- # used for checking the flag emits warnings? +- list(APPEND _YACMA_CXX_FLAGS_DEBUG "-Werror") + # New warnings in clang 8. + # NOTE: a few issues with macros here, let's disable for now. + # _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(-Wextra-semi-stmt) +@@ -190,8 +185,6 @@ if(NOT _YACMACompilerLinkerSettingsRun) + if(YACMA_COMPILER_IS_MSVC AND NOT YACMA_COMPILER_IS_CLANGXX) + # Enable higher warning level than usual. + _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(/W4) +- # Treat warnings as errors. +- _YACMA_CHECK_ENABLE_DEBUG_CXX_FLAG(/WX) + endif() + + # Set the cache variables. diff --git a/recipes/mppp/all/test_package/CMakeLists.txt b/recipes/mppp/all/test_package/CMakeLists.txt index 50383c8436730..320edf00b9406 100644 --- a/recipes/mppp/all/test_package/CMakeLists.txt +++ b/recipes/mppp/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(mp++ CONFIG REQUIRED) +find_package(mp++ REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} mp++::mp++) +target_link_libraries(${PROJECT_NAME} PRIVATE mp++::mp++) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/mppp/all/test_package/conanfile.py b/recipes/mppp/all/test_package/conanfile.py index 4cb48eb218eea..a9fbb7f543162 100644 --- a/recipes/mppp/all/test_package/conanfile.py +++ b/recipes/mppp/all/test_package/conanfile.py @@ -1,11 +1,18 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + def requirements(self): + self.requires(self.tested_reference_str) -class MpppTestConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/mppp/all/test_v1_package/CMakeLists.txt b/recipes/mppp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/mppp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/mppp/all/test_v1_package/conanfile.py b/recipes/mppp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/mppp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/mppp/config.yml b/recipes/mppp/config.yml index f2efdc62e3e34..d4d8ae20a50d8 100644 --- a/recipes/mppp/config.yml +++ b/recipes/mppp/config.yml @@ -1,3 +1,5 @@ versions: + "0.27": + folder: all "0.26": folder: all diff --git a/recipes/ms-gsl/all/conandata.yml b/recipes/ms-gsl/all/conandata.yml index 34cb37d416bb2..00aab19c60dba 100644 --- a/recipes/ms-gsl/all/conandata.yml +++ b/recipes/ms-gsl/all/conandata.yml @@ -1,16 +1,16 @@ sources: - "2.0.0": - url: https://github.com/microsoft/GSL/archive/v2.0.0.tar.gz - sha256: "6cce6fb16b651e62711a4f58e484931013c33979b795d1b1f7646f640cfa9c8e" - "2.1.0": - url: https://github.com/microsoft/GSL/archive/v2.1.0.tar.gz - sha256: "ef73814657b073e1be86c8f7353718771bf4149b482b6cb54f99e79b23ff899d" - "3.0.1": - url: "https://github.com/microsoft/GSL/archive/v3.0.1.tar.gz" - sha256: "7ceba191e046e5347357c6b605f53e6bed069c974aeda851254cb6962a233572" - "3.1.0": - url: "https://github.com/microsoft/GSL/archive/v3.1.0.tar.gz" - sha256: "d3234d7f94cea4389e3ca70619b82e8fb4c2f33bb3a070799f1e18eef500a083" "4.0.0": url: "https://github.com/microsoft/GSL/archive/v4.0.0.tar.gz" sha256: "f0e32cb10654fea91ad56bde89170d78cfbf4363ee0b01d8f097de2ba49f6ce9" + "3.1.0": + url: "https://github.com/microsoft/GSL/archive/v3.1.0.tar.gz" + sha256: "d3234d7f94cea4389e3ca70619b82e8fb4c2f33bb3a070799f1e18eef500a083" + "3.0.1": + url: "https://github.com/microsoft/GSL/archive/v3.0.1.tar.gz" + sha256: "7ceba191e046e5347357c6b605f53e6bed069c974aeda851254cb6962a233572" + "2.1.0": + url: https://github.com/microsoft/GSL/archive/v2.1.0.tar.gz + sha256: "ef73814657b073e1be86c8f7353718771bf4149b482b6cb54f99e79b23ff899d" + "2.0.0": + url: https://github.com/microsoft/GSL/archive/v2.0.0.tar.gz + sha256: "6cce6fb16b651e62711a4f58e484931013c33979b795d1b1f7646f640cfa9c8e" diff --git a/recipes/ms-gsl/all/conanfile.py b/recipes/ms-gsl/all/conanfile.py index ddc0e0a316945..1f2447a4480af 100644 --- a/recipes/ms-gsl/all/conanfile.py +++ b/recipes/ms-gsl/all/conanfile.py @@ -13,13 +13,13 @@ class MicrosoftGslConan(ConanFile): name = "ms-gsl" - description = "Microsoft implementation of the Guidelines Support Library" + description = "Microsoft's implementation of the Guidelines Support Library" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/microsoft/GSL" license = "MIT" topics = ("gsl", "guidelines", "core", "span") no_copy_source = True - settings = "compiler" + settings = "os", "arch", "compiler", "build_type" options = { "on_contract_violation": ["terminate", "throw", "unenforced"] } @@ -27,6 +27,10 @@ class MicrosoftGslConan(ConanFile): "on_contract_violation": "terminate" } + @property + def _minimum_cpp_standard(self): + return 14 + @property def _contract_map(self): return { @@ -52,7 +56,7 @@ def package_id(self): def validate(self): if self.settings.compiler.cppstd: - check_min_cppstd(self, 14) + check_min_cppstd(self, self._minimum_cpp_standard) check_min_vs(self, "190") @@ -60,15 +64,18 @@ def validate(self): minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version: if Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("ms-gsl requires C++14, which your compiler does not fully support.") + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not fully support.") else: - self.output.warn("ms-gsl requires C++14. Your compiler is unknown. Assuming it supports C++14.") + self.output.warn(f"{self.ref} requires C++{self._minimum_cpp_standard}. " + "Your compiler is unknown. Assuming it supports C++{self._minimum_cpp_standard}.") def layout(self): basic_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def generate(self): pass diff --git a/recipes/ms-gsl/all/test_package/CMakeLists.txt b/recipes/ms-gsl/all/test_package/CMakeLists.txt index 5e9fb17a52268..81fc0751a73bb 100644 --- a/recipes/ms-gsl/all/test_package/CMakeLists.txt +++ b/recipes/ms-gsl/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.16) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Microsoft.GSL REQUIRED CONFIG) add_executable(test_package test_package.cpp) -target_link_libraries(test_package Microsoft.GSL::GSL) -set_property(TARGET test_package PROPERTY CXX_STANDARD 14) +target_link_libraries(test_package PRIVATE Microsoft.GSL::GSL) +target_compile_features(test_package PRIVATE cxx_std_14) diff --git a/recipes/ms-gsl/all/test_package/conanfile.py b/recipes/ms-gsl/all/test_package/conanfile.py index 25e19fcddebcd..074627225806d 100644 --- a/recipes/ms-gsl/all/test_package/conanfile.py +++ b/recipes/ms-gsl/all/test_package/conanfile.py @@ -8,6 +8,7 @@ class TestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/ms-gsl/all/test_v1_package/CMakeLists.txt b/recipes/ms-gsl/all/test_v1_package/CMakeLists.txt index b4d56a42650b6..925ecbe19e448 100644 --- a/recipes/ms-gsl/all/test_v1_package/CMakeLists.txt +++ b/recipes/ms-gsl/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Microsoft.GSL REQUIRED CONFIG) - -add_executable(test_package ../test_package/test_package.cpp) -target_link_libraries(test_package Microsoft.GSL::GSL) -set_property(TARGET test_package PROPERTY CXX_STANDARD 14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/ms-gsl/config.yml b/recipes/ms-gsl/config.yml index 0434aa8fdb3bb..b00b1020b4e16 100644 --- a/recipes/ms-gsl/config.yml +++ b/recipes/ms-gsl/config.yml @@ -1,11 +1,11 @@ versions: - "2.0.0": + "4.0.0": folder: all - "2.1.0": + "3.1.0": folder: all "3.0.1": folder: all - "3.1.0": + "2.1.0": folder: all - "4.0.0": + "2.0.0": folder: all diff --git a/recipes/msdfgen/all/CMakeLists.txt b/recipes/msdfgen/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/msdfgen/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/msdfgen/all/conandata.yml b/recipes/msdfgen/all/conandata.yml index 68280085d13a4..f43fd3e983ea6 100644 --- a/recipes/msdfgen/all/conandata.yml +++ b/recipes/msdfgen/all/conandata.yml @@ -6,6 +6,15 @@ sources: url: "https://github.com/Chlumsky/msdfgen/archive/refs/tags/v1.9.tar.gz" sha256: "909eb88c71268dc00cdda244a1fa40a0feefae45f68a779fbfddd5463559fa40" patches: + "1.9.1": + - patch_file: "patches/1.9-0001-unvendor-external-libs.patch" + patch_description: "Use external libs from conan instead of vendored ones" + patch_type: "conan" "1.9": - - patch_file: "patches/0001-fix-install-bundle.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.9-0001-unvendor-external-libs.patch" + patch_description: "Use external libs from conan instead of vendored ones" + patch_type: "conan" + - patch_file: "patches/1.9-0002-fix-install-bundle.patch" + patch_description: "Fix installation in iOS/tvOS/watchOS" + patch_type: "portability" + patch_source: "https://github.com/Chlumsky/msdfgen/pull/125" diff --git a/recipes/msdfgen/all/conanfile.py b/recipes/msdfgen/all/conanfile.py index 039af25baae11..fa5bc750fd043 100644 --- a/recipes/msdfgen/all/conanfile.py +++ b/recipes/msdfgen/all/conanfile.py @@ -1,15 +1,19 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class MsdfgenConan(ConanFile): name = "msdfgen" description = "Multi-channel signed distance field generator" license = "MIT" - topics = ("msdfgen", "msdf", "shape", "glyph", "font") + topics = ("msdf", "shape", "glyph", "font") homepage = "https://github.com/Chlumsky/msdfgen" url = "https://github.com/conan-io/conan-center-index" @@ -29,21 +33,8 @@ class MsdfgenConan(ConanFile): "utility": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,63 +42,67 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("freetype/2.11.1") + self.requires("freetype/2.12.1") self.requires("lodepng/cci.20200615") self.requires("tinyxml2/9.0.0") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - if self._is_msvc and self.options.shared: - raise ConanInvalidConfiguration("msdfgen shared not supported by Visual Studio") + check_min_cppstd(self, 11) + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") if self.options.with_skia: raise ConanInvalidConfiguration("skia recipe not available yet in CCI") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MSDFGEN_BUILD_MSDFGEN_STANDALONE"] = self.options.utility + tc.variables["MSDFGEN_USE_OPENMP"] = self.options.with_openmp + tc.variables["MSDFGEN_USE_CPP11"] = True + tc.variables["MSDFGEN_USE_SKIA"] = self.options.with_skia + tc.variables["MSDFGEN_INSTALL"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - # unvendor lodepng & tinyxml2 - tools.rmdir(os.path.join(self._source_subfolder, "lib")) - tools.replace_in_file(cmakelists, "\"lib/*.cpp\"", "") - tools.replace_in_file(cmakelists, - "target_link_libraries(msdfgen-ext PUBLIC msdfgen::msdfgen Freetype::Freetype)", - "target_link_libraries(msdfgen-ext PUBLIC msdfgen::msdfgen ${CONAN_LIBS})") + apply_conandata_patches(self) + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + # workaround against CMAKE_FIND_PACKAGE_PREFER_CONFIG ON in conan toolchain + replace_in_file(self, cmakelists, "find_package(Freetype REQUIRED)", "find_package(Freetype REQUIRED MODULE)") + # remove bundled lodepng & tinyxml2 + rmdir(self, os.path.join(self.source_folder, "lib")) + rmdir(self, os.path.join(self.source_folder, "include")) # very weird but required for Visual Studio when libs are unvendored (at least for Ninja generator) - if self._is_msvc: - tools.replace_in_file(cmakelists, - "set_target_properties(msdfgen-standalone PROPERTIES ARCHIVE_OUTPUT_DIRECTORY archive OUTPUT_NAME msdfgen)", - "set_target_properties(msdfgen-standalone PROPERTIES OUTPUT_NAME msdfgen IMPORT_PREFIX foo)") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["MSDFGEN_BUILD_MSDFGEN_STANDALONE"] = self.options.utility - self._cmake.definitions["MSDFGEN_USE_OPENMP"] = self.options.with_openmp - self._cmake.definitions["MSDFGEN_USE_CPP11"] = True - self._cmake.definitions["MSDFGEN_USE_SKIA"] = self.options.with_skia - self._cmake.definitions["MSDFGEN_INSTALL"] = True - self._cmake.configure() - return self._cmake + if is_msvc(self): + replace_in_file( + self, + cmakelists, + "set_target_properties(msdfgen-standalone PROPERTIES ARCHIVE_OUTPUT_DIRECTORY archive OUTPUT_NAME msdfgen)", + "set_target_properties(msdfgen-standalone PROPERTIES OUTPUT_NAME msdfgen IMPORT_PREFIX foo)", + ) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "msdfgen") diff --git a/recipes/msdfgen/all/patches/0001-fix-install-bundle.patch b/recipes/msdfgen/all/patches/0001-fix-install-bundle.patch deleted file mode 100644 index 195cb3e50f2fe..0000000000000 --- a/recipes/msdfgen/all/patches/0001-fix-install-bundle.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -170,7 +170,7 @@ if(MSDFGEN_INSTALL) - ) - - if(MSDFGEN_BUILD_MSDFGEN_STANDALONE) -- install(TARGETS msdfgen-standalone EXPORT msdfgenTargets RUNTIME DESTINATION bin) -+ install(TARGETS msdfgen-standalone EXPORT msdfgenTargets DESTINATION bin) - endif() - - install( diff --git a/recipes/msdfgen/all/patches/1.9-0001-unvendor-external-libs.patch b/recipes/msdfgen/all/patches/1.9-0001-unvendor-external-libs.patch new file mode 100644 index 0000000000000..825ea34d6cfdf --- /dev/null +++ b/recipes/msdfgen/all/patches/1.9-0001-unvendor-external-libs.patch @@ -0,0 +1,29 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -39,8 +39,6 @@ file(GLOB_RECURSE msdfgen-ext_PRIVATE_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DI + + file(GLOB_RECURSE msdfgen-ext_SOURCES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + "ext/*.cpp" +- "lib/*.cpp" +- "lib/*.cpp" + ) + + # Build the library (aliased name because it's the same target name the exe) +@@ -86,14 +84,14 @@ add_library(msdfgen::msdfgen-ext ALIAS msdfgen-ext) + set_target_properties(msdfgen-ext PROPERTIES + PUBLIC_HEADER "${msdfgen-ext_PUBLIC_HEADERS}" + ) +-target_link_libraries(msdfgen-ext PUBLIC msdfgen::msdfgen Freetype::Freetype) ++find_package(lodepng REQUIRED CONFIG) ++find_package(tinyxml2 REQUIRED CONFIG) ++target_link_libraries(msdfgen-ext PUBLIC msdfgen::msdfgen Freetype::Freetype lodepng::lodepng tinyxml2::tinyxml2) + target_include_directories(msdfgen-ext + PUBLIC + $ + $ + +-PRIVATE +- ${CMAKE_CURRENT_SOURCE_DIR}/include + ) + + target_compile_definitions(msdfgen-ext PUBLIC MSDFGEN_CMAKE_BUILD) diff --git a/recipes/msdfgen/all/patches/1.9-0002-fix-install-bundle.patch b/recipes/msdfgen/all/patches/1.9-0002-fix-install-bundle.patch new file mode 100644 index 0000000000000..70618310fd767 --- /dev/null +++ b/recipes/msdfgen/all/patches/1.9-0002-fix-install-bundle.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -168,7 +168,7 @@ if(MSDFGEN_INSTALL) + ) + + if(MSDFGEN_BUILD_MSDFGEN_STANDALONE) +- install(TARGETS msdfgen-standalone EXPORT msdfgenTargets RUNTIME DESTINATION bin) ++ install(TARGETS msdfgen-standalone EXPORT msdfgenTargets DESTINATION bin) + endif() + + install( diff --git a/recipes/msdfgen/all/test_package/CMakeLists.txt b/recipes/msdfgen/all/test_package/CMakeLists.txt index 21c326b4889f2..6016e8cfe3244 100644 --- a/recipes/msdfgen/all/test_package/CMakeLists.txt +++ b/recipes/msdfgen/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(msdfgen REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} msdfgen::msdfgen msdfgen::msdfgen-ext) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE msdfgen::msdfgen msdfgen::msdfgen-ext) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/msdfgen/all/test_package/conanfile.py b/recipes/msdfgen/all/test_package/conanfile.py index 5a0706c8f6c9c..c4fdfb4dbdc98 100644 --- a/recipes/msdfgen/all/test_package/conanfile.py +++ b/recipes/msdfgen/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") ttf_path = os.path.join(self.source_folder, "OpenSans-Bold.ttf") - bin_path = os.path.join("bin", "test_package") - self.run("{0} {1}".format(bin_path, ttf_path), run_environment=True) + self.run(f"{bin_path} {ttf_path}", env="conanrun") diff --git a/recipes/msdfgen/all/test_v1_package/CMakeLists.txt b/recipes/msdfgen/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/msdfgen/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/msdfgen/all/test_v1_package/conanfile.py b/recipes/msdfgen/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7b775db727c08 --- /dev/null +++ b/recipes/msdfgen/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + ttf_path = os.path.join(self.source_folder, os.pardir, "test_package", "OpenSans-Bold.ttf") + self.run(f"{bin_path} {ttf_path}", run_environment=True) diff --git a/recipes/msgpack-c/all/CMakeLists.txt b/recipes/msgpack-c/all/CMakeLists.txt deleted file mode 100644 index 11573c481bf89..0000000000000 --- a/recipes/msgpack-c/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/msgpack-c/all/conandata.yml b/recipes/msgpack-c/all/conandata.yml index c4ec3f12fd71c..58a4d3651c031 100644 --- a/recipes/msgpack-c/all/conandata.yml +++ b/recipes/msgpack-c/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.0.0": + url: "https://github.com/msgpack/msgpack-c/releases/download/c-5.0.0/msgpack-c-5.0.0.tar.gz" + sha256: "eb6d77f32dbaaae9174d96cacfe02af30bf1ea329c45018074cd95ac6e6fa6e5" "4.0.0": url: "https://github.com/msgpack/msgpack-c/releases/download/c-4.0.0/msgpack-c-4.0.0.tar.gz" sha256: "420fe35e7572f2a168d17e660ef981a589c9cbe77faa25eb34a520e1fcc032c8" diff --git a/recipes/msgpack-c/all/conanfile.py b/recipes/msgpack-c/all/conanfile.py index b46a9fad94eec..cb504cee9941b 100644 --- a/recipes/msgpack-c/all/conanfile.py +++ b/recipes/msgpack-c/all/conanfile.py @@ -1,19 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, rmdir, save +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os import textwrap -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class MsgpackCConan(ConanFile): name = "msgpack-c" description = "MessagePack implementation for C" + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/msgpack/msgpack-c" topics = ("msgpack", "message-pack", "serialization") - license = "BSL-1.0" - exports_sources = "CMakeLists.txt" - generators = "cmake" settings = "os", "arch", "build_type", "compiler" options = { "fPIC": [True, False], @@ -24,60 +23,49 @@ class MsgpackCConan(ConanFile): "shared": False, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["MSGPACK_ENABLE_SHARED"] = self.options.shared - self._cmake.definitions["MSGPACK_ENABLE_STATIC"] = not self.options.shared - self._cmake.definitions["MSGPACK_32BIT"] = self.settings.arch == "x86" - self._cmake.definitions["MSGPACK_BUILD_EXAMPLES"] = False - self._cmake.definitions["MSGPACK_BUILD_TESTS"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["MSGPACK_ENABLE_SHARED"] = self.options.shared + tc.variables["MSGPACK_ENABLE_STATIC"] = not self.options.shared + tc.variables["MSGPACK_32BIT"] = self.settings.arch == "x86" + tc.variables["MSGPACK_BUILD_EXAMPLES"] = False + tc.variables["MSGPACK_BUILD_TESTS"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE_1_0.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE_1_0.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"msgpackc": "msgpack::msgpack"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -86,11 +74,11 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "msgpack") diff --git a/recipes/msgpack-c/all/test_package/CMakeLists.txt b/recipes/msgpack-c/all/test_package/CMakeLists.txt index 03402926ba00c..c764bd8b7906e 100644 --- a/recipes/msgpack-c/all/test_package/CMakeLists.txt +++ b/recipes/msgpack-c/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(msgpack REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} msgpackc) +target_link_libraries(${PROJECT_NAME} PRIVATE msgpackc) diff --git a/recipes/msgpack-c/all/test_package/conanfile.py b/recipes/msgpack-c/all/test_package/conanfile.py index ae98db96b89a1..a9fb96656f203 100644 --- a/recipes/msgpack-c/all/test_package/conanfile.py +++ b/recipes/msgpack-c/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_c_path = os.path.join("bin", "test_package") - self.run(bin_c_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/msgpack-c/all/test_v1_package/CMakeLists.txt b/recipes/msgpack-c/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..961b416af6b07 --- /dev/null +++ b/recipes/msgpack-c/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/msgpack-c/all/test_v1_package/conanfile.py b/recipes/msgpack-c/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/msgpack-c/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/msgpack-c/config.yml b/recipes/msgpack-c/config.yml index d2be8f453d7c0..81665de5ada8e 100644 --- a/recipes/msgpack-c/config.yml +++ b/recipes/msgpack-c/config.yml @@ -1,3 +1,5 @@ versions: + "5.0.0": + folder: all "4.0.0": folder: all diff --git a/recipes/msgpack-cxx/all/conandata.yml b/recipes/msgpack-cxx/all/conandata.yml index 99a928cf90da3..aea8a30431a27 100644 --- a/recipes/msgpack-cxx/all/conandata.yml +++ b/recipes/msgpack-cxx/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "5.0.0": + url: "https://github.com/msgpack/msgpack-c/archive/cpp-5.0.0.tar.gz" + sha256: "bd6b8e255f0a62cf8f50f1d292f979ac8ea9a4aa121938679d6f419d6df70ea3" + "4.1.3": + url: "https://github.com/msgpack/msgpack-c/archive/cpp-4.1.3.tar.gz" + sha256: "fd0a685656f11b8aa09ed33bcbdcad3105d25d0034ca3dba9fe957623a42d253" + "4.1.2": + url: "https://github.com/msgpack/msgpack-c/archive/cpp-4.1.2.tar.gz" + sha256: "7460ad43552c9d9b56a75f20e1f4fedf18fff1c48715d6cfa91d779b26ca3795" "4.1.1": url: "https://github.com/msgpack/msgpack-c/archive/cpp-4.1.1.tar.gz" sha256: "221cc539e77f5ca02f4f0bbb1edafa9ca8c08de7ba8072d7baf2139930d99182" diff --git a/recipes/msgpack-cxx/all/conanfile.py b/recipes/msgpack-cxx/all/conanfile.py index bffb037fb91b7..34a261745f555 100644 --- a/recipes/msgpack-cxx/all/conanfile.py +++ b/recipes/msgpack-cxx/all/conanfile.py @@ -1,64 +1,66 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, copy, save +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class MsgpackCXXConan(ConanFile): name = "msgpack-cxx" description = "The official C++ library for MessagePack" + license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/msgpack/msgpack-c" - topics = ("msgpack", "message-pack", "serialization") - license = "BSL-1.0" - no_copy_source = True - - settings = "os", "compiler", "build_type", "arch" + topics = ("msgpack", "message-pack", "serialization", "header-only") + settings = "os", "arch", "compiler", "build_type" options = { "use_boost": [True, False], } default_options = { - "use_boost": True + "use_boost": True, } - - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + no_copy_source = True def configure_options(self): - # No boost was added in 4.1.0 - if tools.Version(self.version) < "4.1.0": + # No boost was added since 4.1.0 + if Version(self.version) < "4.1.0": del self.options.use_boost + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): if self.options.get_safe("use_boost", True): - self.requires("boost/1.78.0") + self.requires("boost/1.81.0") def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy("LICENSE_1_0.txt", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, pattern="LICENSE_1_0.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"msgpackc-cxx": "msgpackc-cxx::msgpackc-cxx"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -67,7 +69,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_subfolder(self): @@ -75,20 +77,24 @@ def _module_subfolder(self): @property def _module_file_rel_path(self): - return os.path.join(self._module_subfolder, - "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "msgpack") self.cpp_info.set_property("cmake_target_name", "msgpackc-cxx") + self.cpp_info.libdirs = [] + self.cpp_info.bindirs = [] + + if Version(self.version) >= "4.1.0" and not self.options.use_boost: + self.cpp_info.defines.append("MSGPACK_NO_BOOST") + else: + self.cpp_info.requires.append("boost::headers") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "msgpack" self.cpp_info.filenames["cmake_find_package_multi"] = "msgpack" self.cpp_info.names["cmake_find_package"] = "msgpackc-cxx" self.cpp_info.names["cmake_find_package_multi"] = "msgpackc-cxx" - self.cpp_info.builddirs.append(self._module_subfolder) self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - - if tools.Version(self.version) >= "4.1.0" and not self.options.use_boost: - self.cpp_info.defines.append("MSGPACK_NO_BOOST") diff --git a/recipes/msgpack-cxx/all/test_package/CMakeLists.txt b/recipes/msgpack-cxx/all/test_package/CMakeLists.txt index 26b4c63518e05..ed380c765040e 100644 --- a/recipes/msgpack-cxx/all/test_package/CMakeLists.txt +++ b/recipes/msgpack-cxx/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(msgpack REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} msgpackc-cxx) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/msgpack-cxx/all/test_package/conanfile.py b/recipes/msgpack-cxx/all/test_package/conanfile.py index 89b74736462b2..e845ae751a301 100644 --- a/recipes/msgpack-cxx/all/test_package/conanfile.py +++ b/recipes/msgpack-cxx/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_cpp_path = os.path.join("bin", "test_package") - self.run(bin_cpp_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/msgpack-cxx/all/test_v1_package/CMakeLists.txt b/recipes/msgpack-cxx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/msgpack-cxx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/msgpack-cxx/all/test_v1_package/conanfile.py b/recipes/msgpack-cxx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/msgpack-cxx/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/msgpack-cxx/config.yml b/recipes/msgpack-cxx/config.yml index d20f35fd44a6b..f59df5a4653d5 100644 --- a/recipes/msgpack-cxx/config.yml +++ b/recipes/msgpack-cxx/config.yml @@ -1,4 +1,10 @@ versions: + "5.0.0": + folder: all + "4.1.3": + folder: all + "4.1.2": + folder: all "4.1.1": folder: all "4.1.0": diff --git a/recipes/msys2/all/conanfile.py b/recipes/msys2/all/conanfile.py index 335f7da9b6296..2606f171ddcec 100644 --- a/recipes/msys2/all/conanfile.py +++ b/recipes/msys2/all/conanfile.py @@ -1,18 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration, ConanException -from conan.tools.files import chdir, get, replace_in_file +from conan.tools.files import chdir, get, replace_in_file, copy +from conan.tools.layout import basic_layout import fnmatch import os import shutil import subprocess import errno - -try: - import ctypes -except ImportError: - pass -except ValueError: - pass +import ctypes required_conan_version = ">=1.47.0" @@ -38,7 +33,6 @@ def close(self): __del__ = close - class MSYS2Conan(ConanFile): name = "msys2" description = "MSYS2 is a software distro and building platform for Windows" @@ -47,34 +41,38 @@ class MSYS2Conan(ConanFile): license = "MSYS license" topics = ("msys", "unix", "subsystem") - settings = "os", "arch", "compiler", "build_type" + settings = "os", "arch" # "exclude_files" "packages" "additional_packages" values are a comma separated list options = { "exclude_files": ["ANY"], "packages": ["ANY"], - "additional_packages": ["ANY"], + "additional_packages": [None, "ANY"], + "no_kill": [True, False] } default_options = { "exclude_files": "*/link.exe", "packages": "base-devel,binutils,gcc", "additional_packages": None, + "no_kill": False, } short_paths = True + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): - del self.info.settings.compiler - del self.info.settings.build_type + del self.info.options.no_kill def validate(self): - if self.info.settings.os != "Windows": + if self.settings.os != "Windows": raise ConanInvalidConfiguration("Only Windows supported") - if self.info.settings.arch != "x86_64": + if self.settings.arch != "x86_64": raise ConanInvalidConfiguration("Only Windows x64 supported") def source(self): - # sources are different per configuration - do download in build - pass + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=False) # Preserve tarball root dir (msys64/) def _update_pacman(self): with chdir(self, os.path.join(self._msys_dir, "usr", "bin")): @@ -94,6 +92,8 @@ def _update_pacman(self): # https://github.com/msys2/MSYS2-packages/issues/1966 def _kill_pacman(self): + if self.options.no_kill: + return if (self.settings.os == "Windows"): taskkill_exe = os.path.join(os.environ.get('SystemRoot'), 'system32', 'taskkill.exe') @@ -102,7 +102,7 @@ def _kill_pacman(self): out = subprocess.PIPE err = subprocess.STDOUT else: - out = open(os.devnull, 'w') + out = open(os.devnull, 'w', encoding='UTF-8') err = subprocess.PIPE if os.path.exists(taskkill_exe): @@ -118,16 +118,14 @@ def _kill_pacman(self): proc.wait() except OSError as e: if e.errno == errno.ENOENT: - raise ConanException("Cannot kill pacman") + raise ConanException("Cannot kill pacman") from e @property def _msys_dir(self): - subdir = "msys64" - return os.path.join(self.package_folder, "bin", subdir) + subdir = "msys64" # top-level directoy in tarball + return os.path.join(self.source_folder, subdir) def build(self): - get(self, **self.conan_data["sources"][self.version], - destination=os.path.join(self.package_folder, "bin")) with lock(): self._do_build() @@ -154,7 +152,7 @@ def _do_build(self): if not os.path.isdir(tmp_dir): os.makedirs(tmp_dir) tmp_name = os.path.join(tmp_dir, 'dummy') - with open(tmp_name, 'a'): + with open(tmp_name, 'a', encoding='UTF-8'): os.utime(tmp_name, None) # Prepend the PKG_CONFIG_PATH environment variable with an eventual PKG_CONFIG_PATH environment variable @@ -165,29 +163,26 @@ def package(self): excludes = None if self.options.exclude_files: excludes = tuple(str(self.options.exclude_files).split(",")) - #self.copy("*", dst="bin", src=self._msys_dir, excludes=excludes) for exclude in excludes: for root, _, filenames in os.walk(self._msys_dir): for filename in filenames: fullname = os.path.join(root, filename) if fnmatch.fnmatch(fullname, exclude): os.unlink(fullname) + # See https://github.com/conan-io/conan-center-index/blob/master/docs/error_knowledge_base.md#kb-h013-default-package-layout + copy(self, "*", dst=os.path.join(self.package_folder, "bin", "msys64"), src=self._msys_dir, excludes=excludes) shutil.copytree(os.path.join(self._msys_dir, "usr", "share", "licenses"), os.path.join(self.package_folder, "licenses")) def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] - self.cpp_info.resdirs = [] - msys_root = self._msys_dir + msys_root = os.path.join(self.package_folder, "bin", "msys64") msys_bin = os.path.join(msys_root, "usr", "bin") self.cpp_info.bindirs.append(msys_bin) - self.output.info(f"Creating MSYS_ROOT env var : {msys_root}") self.buildenv_info.define_path("MSYS_ROOT", msys_root) - - self.output.info(f"Creating MSYS_BIN env var : {msys_bin}") self.buildenv_info.define_path("MSYS_BIN", msys_bin) self.conf_info.define("tools.microsoft.bash:subsystem", "msys2") @@ -196,5 +191,4 @@ def package_info(self): # conan v1 specific stuff self.env_info.MSYS_ROOT = msys_root self.env_info.MSYS_BIN = msys_bin - self.output.info(f"Appending PATH env var with : {msys_bin}") self.env_info.path.append(msys_bin) diff --git a/recipes/msys2/all/test_package/conanfile.py b/recipes/msys2/all/test_package/conanfile.py index 93ee00629e591..fa7d81b8ee739 100644 --- a/recipes/msys2/all/test_package/conanfile.py +++ b/recipes/msys2/all/test_package/conanfile.py @@ -4,7 +4,7 @@ class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type" + settings = "os", "arch" generators = "VirtualBuildEnv" test_type = "explicit" @@ -30,6 +30,6 @@ def test(self): self.run('bash.exe -c ^"! test -f /usr/bin/link^"') output = StringIO() - self.run('bash.exe -c "echo $PKG_CONFIG_PATH"', output=output) + self.run('bash.exe -c "echo $PKG_CONFIG_PATH"', output) print(output.getvalue()) assert self._secret_value in output.getvalue() diff --git a/recipes/mujs/all/conanfile.py b/recipes/mujs/all/conanfile.py index b9be736a9eeb6..4d4b59f453109 100644 --- a/recipes/mujs/all/conanfile.py +++ b/recipes/mujs/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class MujsConan(ConanFile): @@ -11,10 +11,11 @@ class MujsConan(ConanFile): description = "MuJS is a lightweight Javascript interpreter designed for " \ "embedding in other software to extend them with scripting capabilities." license = "ISC" - topics = ("mujs", "interpreter", "javascript") + topics = ("interpreter", "javascript") homepage = "https://mujs.com" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,22 +34,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/mujs/all/test_package/conanfile.py b/recipes/mujs/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/mujs/all/test_package/conanfile.py +++ b/recipes/mujs/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/mujs/all/test_v1_package/CMakeLists.txt b/recipes/mujs/all/test_v1_package/CMakeLists.txt index 9b3aa7909e4a0..0d20897301b68 100644 --- a/recipes/mujs/all/test_v1_package/CMakeLists.txt +++ b/recipes/mujs/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(mujs REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE mujs::mujs) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/muparser/all/CMakeLists.txt b/recipes/muparser/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f..0000000000000 --- a/recipes/muparser/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/muparser/all/conandata.yml b/recipes/muparser/all/conandata.yml index 1f691e6dfbdf4..cd86d2cd3c232 100644 --- a/recipes/muparser/all/conandata.yml +++ b/recipes/muparser/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.4": + url: "https://github.com/beltoforion/muparser/archive/refs/tags/v2.3.4.tar.gz" + sha256: "0c3fa54a3ebf36dda0ed3e7cd5451c964afbb15102bdbcba08aafb359a290121" "2.3.2": url: "https://github.com/beltoforion/muparser/archive/v2.3.2.tar.gz" sha256: "b35fc84e3667d432e3414c8667d5764dfa450ed24a99eeef7ee3f6647d44f301" diff --git a/recipes/muparser/all/conanfile.py b/recipes/muparser/all/conanfile.py index 917968db52c18..2de9bbd1cb080 100644 --- a/recipes/muparser/all/conanfile.py +++ b/recipes/muparser/all/conanfile.py @@ -1,5 +1,11 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd, stdcpp_library +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version import os -from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.54.0" class MuParserConan(ConanFile): @@ -9,9 +15,9 @@ class MuParserConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" topics = ("math", "parser",) description = "Fast Math Parser Library" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - settings = "os", "compiler", "build_type", "arch" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -23,59 +29,52 @@ class MuParserConan(ConanFile): "with_openmp": False, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - if self.options.with_openmp: - self.output.warn("Conan package for OpenMP is not available, this package will be used from system.") + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "{}-{}".format(self.name, self.version) - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_SAMPLES"] = False - self._cmake.definitions["ENABLE_OPENMP"] = self.options.with_openmp - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_SAMPLES"] = False + tc.variables["ENABLE_OPENMP"] = self.options.with_openmp + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("License.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + license_file = "License.txt" if Version(self.version) < "2.3.3" else "LICENSE" + copy(self, license_file, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "muparser" - self.cpp_info.names["cmake_find_package_multi"] = "muparser" - self.cpp_info.names["pkg_config"] = "muparser" + self.cpp_info.set_property("cmake_file_name", "muparser") + self.cpp_info.set_property("cmake_target_name", "muparser::muparser") + self.cpp_info.set_property("pkg_config_name", "muparser") self.cpp_info.libs = ["muparser"] if not self.options.shared: self.cpp_info.defines = ["MUPARSER_STATIC=1"] - if not self.options.shared and tools.stdcpp_library(self): - self.cpp_info.system_libs.append(tools.stdcpp_library(self)) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/muparser/all/test_package/CMakeLists.txt b/recipes/muparser/all/test_package/CMakeLists.txt index 7c11c72e38970..9cc92e84977a5 100644 --- a/recipes/muparser/all/test_package/CMakeLists.txt +++ b/recipes/muparser/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(muparser CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} muparser::muparser) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE muparser::muparser) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/muparser/all/test_package/conanfile.py b/recipes/muparser/all/test_package/conanfile.py index 7e2dfe859bb27..0a6bc68712d90 100644 --- a/recipes/muparser/all/test_package/conanfile.py +++ b/recipes/muparser/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/muparser/all/test_v1_package/CMakeLists.txt b/recipes/muparser/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/muparser/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/muparser/all/test_v1_package/conanfile.py b/recipes/muparser/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/muparser/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/muparser/config.yml b/recipes/muparser/config.yml index aee8de619ec30..d7f66fca815a8 100644 --- a/recipes/muparser/config.yml +++ b/recipes/muparser/config.yml @@ -1,3 +1,5 @@ versions: + "2.3.4": + folder: all "2.3.2": folder: all diff --git a/recipes/muparserx/all/CMakeLists.txt b/recipes/muparserx/all/CMakeLists.txt deleted file mode 100644 index e4e575f4e6b8f..0000000000000 --- a/recipes/muparserx/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") - diff --git a/recipes/muparserx/all/conandata.yml b/recipes/muparserx/all/conandata.yml index c44bf79ffc14b..9f14a4951a1b8 100644 --- a/recipes/muparserx/all/conandata.yml +++ b/recipes/muparserx/all/conandata.yml @@ -1,5 +1,4 @@ sources: "4.0.8": - url: https://github.com/beltoforion/muparserx/archive/v4.0.8.tar.gz - sha256: 5913e0a4ca29a097baad1b78a4674963bc7a06e39ff63df3c73fbad6fadb34e1 - + url: "https://github.com/beltoforion/muparserx/archive/v4.0.8.tar.gz" + sha256: "5913e0a4ca29a097baad1b78a4674963bc7a06e39ff63df3c73fbad6fadb34e1" diff --git a/recipes/muparserx/all/conanfile.py b/recipes/muparserx/all/conanfile.py index 38f85bfdbf6da..565601842d1b8 100644 --- a/recipes/muparserx/all/conanfile.py +++ b/recipes/muparserx/all/conanfile.py @@ -1,62 +1,77 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.53.0" + class MuparserxConan(ConanFile): name = "muparserx" description = "A C++ Library for Parsing Expressions with Strings, Complex Numbers, Vectors, Matrices and more" license = "BSD-2-Clause" - topics = ("conan", "muparserx", "math", "parser") + topics = ("math", "parser") homepage = "https://beltoforion.de/article.php?a=muparserx" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], - "fPIC": [True, False]} - default_options = {"shared": False, - "fPIC": True} - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("Muparserx does not support windows dll library!") + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_EXAMPLES"] = False + # Export symbols for msvc shared + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + + def _patch_sources(self): + replace_in_file( + self, os.path.join(self.source_folder, "CMakeLists.txt"), + "set_property(TARGET muparserx PROPERTY POSITION_INDEPENDENT_CODE TRUE)", + "", + ) def build(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "set_property(TARGET muparserx PROPERTY POSITION_INDEPENDENT_CODE TRUE)", "") - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="License.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - if self.settings.os == "Linux": + self.cpp_info.set_property("cmake_file_name", "muparserx") + self.cpp_info.set_property("pkg_config_name", "muparserx") + self.cpp_info.libs = ["muparserx"] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/muparserx/all/test_package/CMakeLists.txt b/recipes/muparserx/all/test_package/CMakeLists.txt index 33adbf4def465..5e16107e1d831 100644 --- a/recipes/muparserx/all/test_package/CMakeLists.txt +++ b/recipes/muparserx/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(test_package test_package.cpp) -target_link_libraries(test_package ${CONAN_LIBS}) -set_target_properties(test_package PROPERTIES CXX_STANDARD 11) +find_package(muparserx REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE muparserx::muparserx) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/muparserx/all/test_package/conanfile.py b/recipes/muparserx/all/test_package/conanfile.py index 7c6dc51a06bcb..0a6bc68712d90 100644 --- a/recipes/muparserx/all/test_package/conanfile.py +++ b/recipes/muparserx/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class MuparserxTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/muparserx/all/test_v1_package/CMakeLists.txt b/recipes/muparserx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/muparserx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/muparserx/all/test_v1_package/conanfile.py b/recipes/muparserx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/muparserx/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/muparserx/config.yml b/recipes/muparserx/config.yml index 2b106ffcc80aa..5bcadc3524910 100644 --- a/recipes/muparserx/config.yml +++ b/recipes/muparserx/config.yml @@ -1,5 +1,3 @@ ---- versions: "4.0.8": folder: all - diff --git a/recipes/nanobench/all/conandata.yml b/recipes/nanobench/all/conandata.yml index b2980ea2da211..35db0353ebb57 100644 --- a/recipes/nanobench/all/conandata.yml +++ b/recipes/nanobench/all/conandata.yml @@ -1,16 +1,26 @@ sources: - "4.0.0": - url: "https://github.com/martinus/nanobench/archive/v4.0.0.tar.gz" - sha256: 34b9bbfc7bf3bc30599f3b7cb398455539edb8ea67930aaef22b707f1ad3824f - "4.3.0": - url: "https://github.com/martinus/nanobench/archive/v4.3.0.tar.gz" - sha256: 6cf97e940eca42394f64d4e9d341e72804c92575247269695beb24f7e2539e82 - "4.3.5": - url: "https://github.com/martinus/nanobench/archive/v4.3.5.tar.gz" - sha256: "205e6cf0ea901f64af971335bfe8011c1f6bd66f6ae678c616da0eddfbe70437" - "4.3.6": - url: "https://github.com/martinus/nanobench/archive/v4.3.6.tar.gz" - sha256: "cfa223fefca8752c0c96416f3440a9b02219f4695a8307db7e8c7054aaed7f01" + "4.3.9": + url: "https://github.com/martinus/nanobench/archive/v4.3.9.tar.gz" + sha256: "4a7fd8fdd5819e4d1c34ae558df010a0ccf36db0508c41c51cd0181bc04c6356" "4.3.7": url: "https://github.com/martinus/nanobench/archive/v4.3.7.tar.gz" sha256: "6a2dadb8230370c7fb7a9362be1c3677e44d8e06193a4ecb489a4748ef9483d7" + "4.3.6": + url: "https://github.com/martinus/nanobench/archive/v4.3.6.tar.gz" + sha256: "cfa223fefca8752c0c96416f3440a9b02219f4695a8307db7e8c7054aaed7f01" + "4.3.5": + url: "https://github.com/martinus/nanobench/archive/v4.3.5.tar.gz" + sha256: "205e6cf0ea901f64af971335bfe8011c1f6bd66f6ae678c616da0eddfbe70437" + "4.3.0": + url: "https://github.com/martinus/nanobench/archive/v4.3.0.tar.gz" + sha256: "6cf97e940eca42394f64d4e9d341e72804c92575247269695beb24f7e2539e82" + "4.0.0": + url: "https://github.com/martinus/nanobench/archive/v4.0.0.tar.gz" + sha256: "34b9bbfc7bf3bc30599f3b7cb398455539edb8ea67930aaef22b707f1ad3824f" + +patches: + "4.3.9": + - patch_file: "patches/4.3.9-0001-support-older-msvc.patch" + patch_description: "fix compilation error on msvc < 1928" + patch_type: "portability" + patch_source: "https://github.com/martinus/nanobench/pull/82" diff --git a/recipes/nanobench/all/conanfile.py b/recipes/nanobench/all/conanfile.py index 19c1a77a013b1..67a58bc871cff 100644 --- a/recipes/nanobench/all/conanfile.py +++ b/recipes/nanobench/all/conanfile.py @@ -1,33 +1,53 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, export_conandata_patches, apply_conandata_patches +from conan.tools.layout import basic_layout import os -import glob -from conans import ConanFile, tools +required_conan_version = ">=1.52.0" class NanobenchConan(ConanFile): name = "nanobench" description = """ankerl::nanobench is a platform independent microbenchmarking library for C++11/14/17/20.""" - topics = ("conan", "nanobench", "benchmark", "microbenchmark") + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/martinus/nanobench" - license = "MIT" - no_copy_source = True + topics = ("benchmark", "microbenchmark", "header-only") + settings = "os", "arch", "compiler", "build_type" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob(self.name + "-*/")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + apply_conandata_patches(self) def package(self): - include_folder = os.path.join( - self._source_subfolder, os.path.join("src", "include")) - self.copy(pattern="LICENSE", dst="licenses", - src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src=include_folder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src", "include"), + ) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/nanobench/all/patches/4.3.9-0001-support-older-msvc.patch b/recipes/nanobench/all/patches/4.3.9-0001-support-older-msvc.patch new file mode 100644 index 0000000000000..f7d7dccdcefd7 --- /dev/null +++ b/recipes/nanobench/all/patches/4.3.9-0001-support-older-msvc.patch @@ -0,0 +1,51 @@ +diff --git a/src/include/nanobench.h b/src/include/nanobench.h +index c03d9ad..30f7353 100644 +--- a/src/include/nanobench.h ++++ b/src/include/nanobench.h +@@ -405,7 +405,11 @@ struct Config { + Config& operator=(Config const&); + Config& operator=(Config&&); + Config(Config const&); ++#if defined(_MSC_VER) && _MSC_VER < 1928 ++ Config(Config&&); ++#else + Config(Config&&) noexcept; ++#endif + }; + ANKERL_NANOBENCH(IGNORE_PADDED_POP) + +@@ -431,7 +435,11 @@ public: + Result& operator=(Result const&); + Result& operator=(Result&&); + Result(Result const&); ++#if defined(_MSC_VER) && _MSC_VER < 1928 ++ Result(Result&&); ++#else + Result(Result&&) noexcept; ++#endif + + // adds new measurement results + // all values are scaled by iters (except iters...) +@@ -2854,14 +2862,22 @@ Config::~Config() = default; + Config& Config::operator=(Config const&) = default; + Config& Config::operator=(Config&&) = default; + Config::Config(Config const&) = default; ++#if defined(_MSC_VER) && _MSC_VER < 1928 ++Config::Config(Config&&) = default; ++#else + Config::Config(Config&&) noexcept = default; ++#endif + + // provide implementation here so it's only generated once + Result::~Result() = default; + Result& Result::operator=(Result const&) = default; + Result& Result::operator=(Result&&) = default; + Result::Result(Result const&) = default; ++#if defined(_MSC_VER) && _MSC_VER < 1928 ++Result::Result(Result&&) = default; ++#else + Result::Result(Result&&) noexcept = default; ++#endif + + namespace detail { + template diff --git a/recipes/nanobench/all/test_package/CMakeLists.txt b/recipes/nanobench/all/test_package/CMakeLists.txt index 829b5ca81b9ce..39d04ec4c7104 100644 --- a/recipes/nanobench/all/test_package/CMakeLists.txt +++ b/recipes/nanobench/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(nanobench REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE nanobench::nanobench) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/nanobench/all/test_package/conanfile.py b/recipes/nanobench/all/test_package/conanfile.py index bd7165a553cf4..e845ae751a301 100644 --- a/recipes/nanobench/all/test_package/conanfile.py +++ b/recipes/nanobench/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nanobench/all/test_v1_package/CMakeLists.txt b/recipes/nanobench/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/nanobench/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/nanobench/all/test_v1_package/conanfile.py b/recipes/nanobench/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/nanobench/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/nanobench/config.yml b/recipes/nanobench/config.yml index a48eba85edbb2..e4f35b37cfb39 100644 --- a/recipes/nanobench/config.yml +++ b/recipes/nanobench/config.yml @@ -1,11 +1,13 @@ versions: - "4.0.0": + "4.3.9": folder: "all" - "4.3.0": + "4.3.7": + folder: "all" + "4.3.6": folder: "all" "4.3.5": folder: "all" - "4.3.6": + "4.3.0": folder: "all" - "4.3.7": + "4.0.0": folder: "all" diff --git a/recipes/nas/all/conandata.yml b/recipes/nas/all/conandata.yml index 8a174de309503..1215a1cb1a46d 100644 --- a/recipes/nas/all/conandata.yml +++ b/recipes/nas/all/conandata.yml @@ -1,6 +1,16 @@ sources: + "1.9.5": + - url: "https://downloads.sourceforge.net/nas/nas-1.9.5.tar.gz" + sha256: "b7884afb38feec03a196bd3b7e9c47b803c830ecd10d7455e9c97e122c37944c" + - url: "https://unlicense.org/UNLICENSE" + sha256: "7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c" "1.9.4": - - url: "https://downloads.sourceforge.net/nas/nas-1.9.4.src.tar.gz" + - url: "https://downloads.sourceforge.net/project/nas/nas/nas%201.9.4%20%28stable%29/nas-1.9.4.src.tar.gz" sha256: "cf36ea63751ce86cfd3b76c1659ce0d6a361a2e7cb34069854e156532703b39d" - url: "https://unlicense.org/UNLICENSE" sha256: "7e12e5df4bae12cb21581ba157ced20e1986a0508dd10d0e8a4ab9a4cf94e85c" +patches: + "1.9.4": + - patch_file: "patches/0001-1.9.4-extern-variable-bugfix.patch" + patch_description: "Extern variable to fix bug" + patch_type: "bugfix" diff --git a/recipes/nas/all/conanfile.py b/recipes/nas/all/conanfile.py index b0ef8613914c6..17ddc0ee3412e 100644 --- a/recipes/nas/all/conanfile.py +++ b/recipes/nas/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile + +from conan.errors import ConanInvalidConfiguration +from conan.tools.layout import basic_layout +from conan.tools.files import chdir, get, download, export_conandata_patches, apply_conandata_patches, rm, copy +from conan.tools.gnu import AutotoolsToolchain, Autotools, AutotoolsDeps import os -required_conan_version = ">=1.33.0" + +required_conan_version = ">=1.54.0" class NasRecipe(ConanFile): @@ -22,19 +27,17 @@ class NasRecipe(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def export_sources(self): + export_conandata_patches(self) def validate(self): if self.settings.os not in ("FreeBSD", "Linux"): @@ -44,25 +47,28 @@ def requirements(self): self.requires("xorg/system") def build_requirements(self): - self.build_requires("bison/3.7.1") - self.build_requires("flex/2.6.4") - self.build_requires("imake/1.0.8") - self.build_requires("xorg-cf-files/1.0.7") - self.build_requires("xorg-makedepend/1.0.6") - self.build_requires("xorg-gccmakedep/1.0.3") + self.tool_requires("bison/3.7.1") + self.tool_requires("flex/2.6.4") + self.tool_requires("imake/1.0.8") + self.tool_requires("xorg-cf-files/1.0.7") + self.tool_requires("xorg-makedepend/1.0.6") + self.tool_requires("xorg-gccmakedep/1.0.3") def source(self): - tools.get(**self.conan_data["sources"][self.version][0], destination=self._source_subfolder, strip_root=True) - tools.download(filename="LICENSE", **self.conan_data["sources"][self.version][1]) + get(self, **self.conan_data["sources"][self.version][0], strip_root=True) + # This library does not come with a License file by itself, package it from an external source + download(self, filename="LICENSE", **self.conan_data["sources"][self.version][1]) @property def _user_info_build(self): return getattr(self, "user_info_build", self.deps_user_info) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self) - autotools.libs = [] - return autotools + def generate(self): + autotools = AutotoolsToolchain(self) + autotools.generate() + + deps = AutotoolsDeps(self) + deps.generate() @property def _imake_irulesrc(self): @@ -77,36 +83,41 @@ def _imake_make_args(self): return ["IRULESRC={}".format(self._imake_irulesrc), "IMAKE_DEFINES={}".format(self._imake_defines)] def build(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "server", "dia", "main.c"), - "\nFILE *yyin", "\nextern FILE *yyin") - with tools.chdir(self._source_subfolder): + apply_conandata_patches(self) + + with chdir(self, self.source_folder): self.run("imake -DUseInstalled -I{} {}".format(self._imake_irulesrc, self._imake_defines), run_environment=True) - autotools = self._configure_autotools() - autotools.make(target="World",args=["-j1"] + self._imake_make_args) + autotools = Autotools(self) + # j1 avoids some errors while trying to run this target + autotools.make(target="World", args=["-j1"] + self._imake_make_args) def package(self): - self.copy("LICENSE", dst="licenses") - - with tools.chdir(self._source_subfolder): - autotools = self._configure_autotools() - tmp_install = os.path.join(self.build_folder, "prefix") - install_args = [ - "DESTDIR={}".format(tmp_install), - "INCDIR=/include", - "ETCDIR=/etc", - "USRLIBDIR=/lib", - "BINDIR=/bin", - ] + self._imake_make_args + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + tmp_install = os.path.join(self.build_folder, "prefix") + self.output.warning(tmp_install) + install_args = [ + "DESTDIR={}".format(tmp_install), + "INCDIR=/include", + "ETCDIR=/etc", + "USRLIBDIR=/lib", + "BINDIR=/bin", + ] + self._imake_make_args + with chdir(self, self.source_folder): + autotools = Autotools(self) + # j1 avoids some errors while trying to install autotools.install(args=["-j1"] + install_args) - self.copy("*", src=os.path.join(tmp_install, "bin"), dst="bin") - self.copy("*", src=os.path.join(tmp_install, "include"), dst=os.path.join("include", "audio")) - self.copy("*", src=os.path.join(tmp_install, "lib"), dst="lib") + copy(self, "*", src=os.path.join(tmp_install, "bin"), dst=os.path.join(self.package_folder, "bin")) + copy(self, "*.h", src=os.path.join(tmp_install, "include"), dst=os.path.join(self.package_folder, "include", "audio")) + copy(self, "*", src=os.path.join(tmp_install, "lib"), dst=os.path.join(self.package_folder, "lib")) + # Both are present in the final build and there does not seem to be an obvious way to tell the build system + # to only generate one of them, so remove the unwanted one if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.a") + rm(self, "*.a", os.path.join(self.package_folder, "lib")) else: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.so*") + rm(self, "*.so*", os.path.join(self.package_folder, "lib")) def package_info(self): self.cpp_info.libs = ["audio"] diff --git a/recipes/nas/all/patches/0001-1.9.4-extern-variable-bugfix.patch b/recipes/nas/all/patches/0001-1.9.4-extern-variable-bugfix.patch new file mode 100644 index 0000000000000..dec6423609c24 --- /dev/null +++ b/recipes/nas/all/patches/0001-1.9.4-extern-variable-bugfix.patch @@ -0,0 +1,13 @@ +diff --git a/server/dia/main.c b/server/dia/main.c +index 83601ae..e5d2287 100644 +--- a/server/dia/main.c ++++ b/server/dia/main.c +@@ -76,7 +76,7 @@ static char *AuServerName(void); + extern char *display; + + static int restart = 0; +-FILE *yyin; /* for the config parser */ ++extern FILE *yyin; /* for the config parser */ + + void + NotImplemented() diff --git a/recipes/nas/all/test_package/CMakeLists.txt b/recipes/nas/all/test_package/CMakeLists.txt index 7b9b613cbb24a..12f5de7a8d67c 100644 --- a/recipes/nas/all/test_package/CMakeLists.txt +++ b/recipes/nas/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(nas REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE nas::nas) diff --git a/recipes/nas/all/test_package/conanfile.py b/recipes/nas/all/test_package/conanfile.py index e745e8cbe21e6..eede891e8102c 100644 --- a/recipes/nas/all/test_package/conanfile.py +++ b/recipes/nas/all/test_package/conanfile.py @@ -1,9 +1,19 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + class NasTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nas/all/test_v1_package/CMakeLists.txt b/recipes/nas/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de3b75d9538de --- /dev/null +++ b/recipes/nas/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/nas/all/test_v1_package/conanfile.py b/recipes/nas/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/nas/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/nas/config.yml b/recipes/nas/config.yml index 528a6a4373727..1aefdb4ac4b54 100644 --- a/recipes/nas/config.yml +++ b/recipes/nas/config.yml @@ -1,3 +1,5 @@ versions: + "1.9.5": + folder: all "1.9.4": folder: all diff --git a/recipes/nasm/all/conandata.yml b/recipes/nasm/all/conandata.yml index 6cd038086b3e9..c97415979c9f2 100644 --- a/recipes/nasm/all/conandata.yml +++ b/recipes/nasm/all/conandata.yml @@ -14,4 +14,3 @@ sources: patches: "2.15.05": - patch_file: "patches/2.15.05-0001-disable-newly-integrated-dependency-tracking.patch" - base_path: "source_subfolder" diff --git a/recipes/nasm/all/conanfile.py b/recipes/nasm/all/conanfile.py index fd394629da656..25d5fec8b82ba 100644 --- a/recipes/nasm/all/conanfile.py +++ b/recipes/nasm/all/conanfile.py @@ -1,95 +1,103 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import NMakeToolchain, is_msvc import os import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.55.0" class NASMConan(ConanFile): name = "nasm" + package_type = "application" url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.nasm.us" description = "The Netwide Assembler, NASM, is an 80x86 and x86-64 assembler" license = "BSD-2-Clause" - settings = "os", "arch", "compiler", "build_type" topics = ("nasm", "installer", "assembler") - exports_sources = "patches/*" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + settings = "os", "arch", "compiler", "build_type" @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - def build_requirements(self): - if self._settings_build.os == "Windows": - self.build_requires("strawberryperl/5.30.0.1") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): del self.info.settings.compiler - def _build_vs(self): - with tools.chdir(self._source_subfolder): - with tools.vcvars(self): - autotools = AutoToolsBuildEnvironment(self) - autotools.flags.append("-nologo") - self.run("nmake /f {} {}".format(os.path.join("Mkfiles", "msvc.mak"), " ".join("{}=\"{}\"".format(k, v) for k, v in autotools.vars.items()))) - shutil.copy("nasm.exe", "nasmw.exe") - shutil.copy("ndisasm.exe", "ndisasmw.exe") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=(self._settings_build.os == "Windows")) - if self.settings.arch == "x86": - self._autotools.flags.append("-m32") - elif self.settings.arch == "x86_64": - self._autotools.flags.append("-m64") - self._autotools.configure(configure_dir=self._source_subfolder) - - # GCC9 - "pure" attribute on function returning "void" - tools.replace_in_file("Makefile", "-Werror=attributes", "") - - # Need "-arch" flag for the linker when cross-compiling. - # FIXME: Revisit after https://github.com/conan-io/conan/issues/9069, using new Autotools integration - if str(self.version).startswith("2.13"): - tools.replace_in_file("Makefile", "$(CC) $(LDFLAGS) -o", "$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o") - - return self._autotools + def build_requirements(self): + if self._settings_build.os == "Windows": + self.tool_requires("strawberryperl/5.32.1.1") + if not is_msvc(self): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + if self.settings.arch == "x86": + tc.extra_cflags.append("-m32") + elif self.settings.arch == "x86_64": + tc.extra_cflags.append("-m64") + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self.settings.compiler == "Visual Studio": - self._build_vs() + apply_conandata_patches(self) + if is_msvc(self): + with chdir(self, self.source_folder): + self.run(f'nmake /f {os.path.join("Mkfiles", "msvc.mak")}') else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() + + # GCC9 - "pure" attribute on function returning "void" + replace_in_file(self, "Makefile", "-Werror=attributes", "") + + # Need "-arch" flag for the linker when cross-compiling. + # FIXME: Revisit after https://github.com/conan-io/conan/issues/9069, using new Autotools integration + # TODO it is time to revisit, not sure what to do here though... + if str(self.version).startswith("2.13"): + replace_in_file(self, "Makefile", "$(CC) $(LDFLAGS) -o", "$(CC) $(ALL_CFLAGS) $(LDFLAGS) -o") + replace_in_file(self, "Makefile", "$(INSTALLROOT)", "$(DESTDIR)") autotools.make() def package(self): - self.copy(pattern="LICENSE", src=self._source_subfolder, dst="licenses") - if self.settings.compiler == "Visual Studio": - self.copy(pattern="*.exe", src=self._source_subfolder, dst="bin", keep_path=False) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + if is_msvc(self): + copy(self, pattern="*.exe", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + with chdir(self, os.path.join(self.package_folder, "bin")): + shutil.copy2("nasm.exe", "nasmw.exe") + shutil.copy2("ndisasm.exe", "ndisasmw.exe") else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] + + # TODO: Legacy, to be removed on Conan 2.0 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/nasm/all/test_package/conanfile.py b/recipes/nasm/all/test_package/conanfile.py index 116e500b7291d..8ec69275ade00 100644 --- a/recipes/nasm/all/test_package/conanfile.py +++ b/recipes/nasm/all/test_package/conanfile.py @@ -1,18 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run import os -from conans import ConanFile, tools class TestPackageConan(ConanFile): - settings = "os", "arch", + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - self.run("nasm --version", run_environment=True) - asm_file = os.path.join(self.source_folder, "hello_linux.asm") - out_file = os.path.join(self.build_folder, "hello_linux.o") - bin_file = os.path.join(self.build_folder, "hello_linux") - self.run("nasm -felf64 {} -o {}".format(asm_file, out_file), run_environment=True) + self.run("nasm --version") + asm_file = os.path.join(self.source_folder, "hello_linux.asm") + out_file = os.path.join(self.build_folder, "hello_linux.o") + self.run(f"nasm -felf64 {asm_file} -o {out_file}") + if can_run(self): if self.settings.os == "Linux" and self.settings.arch == "x86_64": - ld = tools.get_env("LD", "ld") - self.run("{} hello_linux.o -o {}".format(ld, bin_file), run_environment=True) + # TODO was tools.get_env, what should it be? + ld = os.getenv("LD", "ld") + bin_file = os.path.join(self.build_folder, "hello_linux") + self.run(f"{ld} hello_linux.o -o {bin_file}") self.run(bin_file) diff --git a/recipes/nasm/all/test_v1_package/conanfile.py b/recipes/nasm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..ea9bfae804ef3 --- /dev/null +++ b/recipes/nasm/all/test_v1_package/conanfile.py @@ -0,0 +1,22 @@ +import os +from conans import ConanFile, tools + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + + def test(self): + self.run("nasm --version") + asm_file = os.path.join(self.source_folder, "hello_linux.asm") + out_file = os.path.join(self.build_folder, "hello_linux.o") + self.run(f"nasm -felf64 {asm_file} -o {out_file}") + if not tools.cross_building(self): + if self.settings.os == "Linux" and self.settings.arch == "x86_64": + ld = tools.get_env("LD", "ld") + bin_file = os.path.join(self.build_folder, "hello_linux") + self.run(f"{ld} hello_linux.o -o {bin_file}") + self.run(bin_file) diff --git a/recipes/nasm/all/test_v1_package/hello_linux.asm b/recipes/nasm/all/test_v1_package/hello_linux.asm new file mode 100644 index 0000000000000..82a250faaa6a6 --- /dev/null +++ b/recipes/nasm/all/test_v1_package/hello_linux.asm @@ -0,0 +1,16 @@ +; Print "Hello, Conan" + + global _start + + section .text +_start: mov rax, 1 ; system call for write + mov rdi, 1 ; file handle 1 is stdout + mov rsi, message ; address of string to output + mov rdx, 13 ; number of bytes + syscall ; invoke operating system to do the write + mov rax, 60 ; system call for exit + xor rdi, rdi ; exit code 0 + syscall ; invoke operating system to exit + + section .data +message: db "Hello, Conan", 10 ; note the newline at the end diff --git a/recipes/ncurses/all/conandata.yml b/recipes/ncurses/all/conandata.yml index d8543569369b7..fc77450ebeca3 100644 --- a/recipes/ncurses/all/conandata.yml +++ b/recipes/ncurses/all/conandata.yml @@ -1,51 +1,54 @@ sources: + "6.4": + url: + - "https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.4.tar.gz" + - "https://invisible-mirror.net/archives/ncurses/ncurses-6.4.tar.gz" + sha256: "6931283d9ac87c5073f30b6290c4c75f21632bb4fc3603ac8100812bed248159" "6.3": - url: [ - "https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.3.tar.gz", - "https://invisible-mirror.net/archives/ncurses/ncurses-6.3.tar.gz", - ] + url: + - "https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.3.tar.gz" + - "https://invisible-mirror.net/archives/ncurses/ncurses-6.3.tar.gz" sha256: "97fc51ac2b085d4cde31ef4d2c3122c21abc217e9090a43a30fc5ec21684e059" "6.2": - url: [ - "https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.2.tar.gz", - "https://invisible-mirror.net/archives/ncurses/ncurses-6.2.tar.gz", - ] + url: + - "https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.2.tar.gz" + - "https://invisible-mirror.net/archives/ncurses/ncurses-6.2.tar.gz" sha256: "30306e0c76e0f9f1f0de987cf1c82a5c21e1ce6568b9227f7da5b71cbea86c9d" patches: "6.2": - patch_file: "patches/6.2.0-0001-Look-for-pcre2posix-instead-of-pcre2-posix.h.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0002-Optionally-include-sys-time.h.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0003-Do-not-redeclare-exit.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0004-fix-win32con.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0005-api-must-be-placed-next-to-variable-name.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0006-Add-potentially-missing-STDOUT_FILENO.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0007-No-import-export-declaration-on-class-members.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0008-Add-include-file-to-add-export-annotation.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0010-Pass-BUILDING_XXX-compile-definition-while-building-.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0011-Let-each-sublibrary-do-its-own-import-exporting.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0012-Learn-configure-about-msvc.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0013-Fix-lib_gen.c.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0014-avoid-macro-expansion-in-args-by-defining-NCURSES_NO.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0015-MSVC-access-does-not-support-X_OK.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0016-msvc-has-wchar-support.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0017-msvc-fix-tests.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0018-missing-functions-c-linkage.patch" - base_path: "source_subfolder" + patch_type: "portability" - patch_file: "patches/6.2.0-0019-Run-autoreconf.patch" - base_path: "source_subfolder" + patch_type: "portability" diff --git a/recipes/ncurses/config.yml b/recipes/ncurses/config.yml index 0791c21efa476..1c6db8931421d 100644 --- a/recipes/ncurses/config.yml +++ b/recipes/ncurses/config.yml @@ -1,4 +1,6 @@ versions: + "6.4": + folder: all "6.3": folder: all "6.2": diff --git a/recipes/netcdf/all/CMakeLists.txt b/recipes/netcdf/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/netcdf/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/netcdf/all/conandata.yml b/recipes/netcdf/all/conandata.yml index b00014281bd6c..c96fc1ea18103 100644 --- a/recipes/netcdf/all/conandata.yml +++ b/recipes/netcdf/all/conandata.yml @@ -7,12 +7,10 @@ sources: sha256: "bc018cc30d5da402622bf76462480664c6668b55eb16ba205a0dfb8647161dd0" patches: "4.7.4": - - base_path: "source_subfolder" - patch_file: "patches/4.7.4-0001-cmake-subproject.patch" - - base_path: "source_subfolder" - patch_file: "patches/4.7.4-0002-cmake-msvc.patch" - - base_path: "source_subfolder" - patch_file: "patches/4.7.4-0003-cmake-HDF5-cmake-components-wrong.patch" + - patch_file: "patches/4.7.4-0001-fix-cmake.patch" + patch_description: "fixes for cmake target_link_libraries and using deps" + patch_type: "conan" "4.8.1": - - base_path: "source_subfolder" - patch_file: "patches/4.8.1-0001-fix-cmake.patch" + - patch_file: "patches/4.8.1-0001-fix-cmake.patch" + patch_description: "fixes for cmake target_link_libraries and using deps" + patch_type: "conan" diff --git a/recipes/netcdf/all/conanfile.py b/recipes/netcdf/all/conanfile.py index 7a134d470624c..72c48b4aa776b 100644 --- a/recipes/netcdf/all/conanfile.py +++ b/recipes/netcdf/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class NetcdfConan(ConanFile): @@ -11,7 +13,7 @@ class NetcdfConan(ConanFile): "scientific data access and a freely-distributed software library " "that provides an implementation of the interface." ) - topics = ("unidata", "unidata-netcdf", "networking") + topics = "unidata", "unidata-netcdf", "networking" license = "BSD-3-Clause" homepage = "https://github.com/Unidata/netcdf-c" url = "https://github.com/conan-io/conan-center-index" @@ -36,25 +38,12 @@ class NetcdfConan(ConanFile): "byterange": False, } - generators = "cmake_find_package", "cmake_find_package_multi", "cmake" - _cmake = None - @property def _with_hdf5(self): return self.options.with_hdf5 or self.options.netcdf4 - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -62,13 +51,16 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self._with_hdf5: - if self.version == "4.7.4": + if self.version == "4.7.4" and self.options.byterange: # 4.7.4 was built and tested with hdf5/1.12.0 # It would be nice to upgrade to 1.12.1, # but when the byterange feature is enabled, @@ -76,56 +68,58 @@ def requirements(self): # So we will require the older hdf5 to keep the older behaviour. self.requires("hdf5/1.12.0") else: - self.requires("hdf5/1.12.1") + self.requires("hdf5/1.13.1") if self.options.dap or self.options.byterange: - self.requires("libcurl/7.83.1") + self.requires("libcurl/7.87.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["BUILD_UTILITIES"] = False - self._cmake.definitions["ENABLE_TESTS"] = False - self._cmake.definitions["ENABLE_FILTER_TESTING"] = False - - self._cmake.definitions["ENABLE_NETCDF_4"] = self.options.netcdf4 - self._cmake.definitions["ENABLE_CDF5"] = self.options.cdf5 - self._cmake.definitions["ENABLE_DAP"] = self.options.dap - self._cmake.definitions["ENABLE_BYTERANGE"] = self.options.byterange - self._cmake.definitions["USE_HDF5"] = self.options.with_hdf5 - self._cmake.definitions["NC_FIND_SHARED_LIBS"] = self.options.with_hdf5 and self.options["hdf5"].shared - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_UTILITIES"] = False + tc.variables["ENABLE_TESTS"] = False + tc.variables["ENABLE_FILTER_TESTING"] = False + + tc.variables["ENABLE_NETCDF_4"] = self.options.netcdf4 + tc.variables["ENABLE_CDF5"] = self.options.cdf5 + tc.variables["ENABLE_DAP"] = self.options.dap + tc.variables["ENABLE_BYTERANGE"] = self.options.byterange + tc.variables["USE_HDF5"] = self.options.with_hdf5 + tc.variables["NC_FIND_SHARED_LIBS"] = self.options.with_hdf5 and self.dependencies["hdf5"].options.shared + + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" - cmake = self._configure_cmake() + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYRIGHT", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "COPYRIGHT", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - os.unlink(os.path.join(self.package_folder, "bin", "nc-config")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.settings") - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rm(self, "nc-config", os.path.join(self.package_folder, "bin")) + rm(self, "*.settings", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) if self.settings.os == "Windows" and self.options.shared: for vc_file in ["concrt*.dll", "msvcp*.dll", "vcruntime*.dll"]: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), vc_file) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*[!.dll]") + rm(self, vc_file, os.path.join(self.package_folder, "bin")) + rm(self, "*[!.dll]", os.path.join(self.package_folder, "bin")) else: - tools.rmdir(os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "netCDF") diff --git a/recipes/netcdf/all/patches/4.7.4-0001-cmake-subproject.patch b/recipes/netcdf/all/patches/4.7.4-0001-cmake-subproject.patch deleted file mode 100644 index bb9e090d807a5..0000000000000 --- a/recipes/netcdf/all/patches/4.7.4-0001-cmake-subproject.patch +++ /dev/null @@ -1,40 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -85,8 +85,7 @@ IF(MSVC) - ENDIF() - - #Add custom CMake Module --SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/" -- CACHE INTERNAL "Location of our custom CMake modules.") -+list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/") - - # auto-configure style checks, other CMake modules. - INCLUDE(CheckLibraryExists) -@@ -789,7 +788,6 @@ ENDIF(USE_HDF5 OR ENABLE_NETCDF_4) - - # See if we have libcurl - FIND_PACKAGE(CURL) --ADD_DEFINITIONS(-DCURL_STATICLIB=1) - INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) - - # Check to see if CURLOPT_USERNAME is defined. -@@ -854,7 +852,7 @@ ENDIF() - # Option to support byte-range reading of remote datasets - OPTION(ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." OFF) - --IF(NOT CURL_LIBRARY) -+IF(NOT CURL_FOUND) - IF(ENABLE_BYTERANGE) - MESSAGE(FATAL_ERROR "Byte-range support specified, CURL libraries are not found.") - ENDIF() ---- liblib/CMakeLists.txt -+++ liblib/CMakeLists.txt -@@ -88,7 +88,7 @@ IF(USE_HDF5 OR USE_NETCDF4) - ENDIF() - - IF(USE_DAP) -- SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARY}) -+ SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES}) - ENDIF() - - IF(USE_HDF4) diff --git a/recipes/netcdf/all/patches/4.7.4-0001-fix-cmake.patch b/recipes/netcdf/all/patches/4.7.4-0001-fix-cmake.patch new file mode 100644 index 0000000000000..6a6d55ecb336f --- /dev/null +++ b/recipes/netcdf/all/patches/4.7.4-0001-fix-cmake.patch @@ -0,0 +1,114 @@ +diff -ru a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2020-03-27 23:33:36.000000000 +0800 ++++ b/CMakeLists.txt 2022-12-14 16:52:33.780579500 +0800 +@@ -85,8 +85,7 @@ + ENDIF() + + #Add custom CMake Module +-SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/" +- CACHE INTERNAL "Location of our custom CMake modules.") ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules/") + + # auto-configure style checks, other CMake modules. + INCLUDE(CheckLibraryExists) +@@ -615,7 +614,7 @@ + # examples, even though the previous version of what we + # had worked. + ##### +- IF(MSVC) ++ IF(0) + SET(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME}) + FIND_PACKAGE(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL CONFIG REQUIRED ${NC_HDF5_LINK_TYPE}) + ELSE(MSVC) +@@ -789,7 +788,6 @@ + + # See if we have libcurl + FIND_PACKAGE(CURL) +-ADD_DEFINITIONS(-DCURL_STATICLIB=1) + INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) + + # Check to see if CURLOPT_USERNAME is defined. +@@ -854,7 +852,7 @@ + # Option to support byte-range reading of remote datasets + OPTION(ENABLE_BYTERANGE "Enable byte-range access to remote datasets.." OFF) + +-IF(NOT CURL_LIBRARY) ++IF(NOT CURL_FOUND) + IF(ENABLE_BYTERANGE) + MESSAGE(FATAL_ERROR "Byte-range support specified, CURL libraries are not found.") + ENDIF() +@@ -1733,6 +1731,8 @@ + ##### + SET(netCDF_LIB_CORENAME "netcdf") + ++add_subdirectory(liblib) ++ + ##### + # Set the true names of all the libraries, if customized by external project + ##### +@@ -1764,8 +1764,6 @@ + ADD_SUBDIRECTORY(libdap4) + ENDIF() + +-add_subdirectory(liblib) +- + IF(ENABLE_FILTER_TESTING) + add_subdirectory(plugins) + ENDIF() +@@ -1830,7 +1828,7 @@ + # install them in the binary dir. Grab all of the .libs, put them + # in the libdir. + ## +-IF(MSVC) ++IF(0) + FILE(GLOB COPY_FILES ${CMAKE_PREFIX_PATH}/lib/*.lib) + INSTALL(FILES ${COPY_FILES} + DESTINATION ${CMAKE_INSTALL_LIBDIR} +diff -ru a/libdap4/CMakeLists.txt b/libdap4/CMakeLists.txt +--- a/libdap4/CMakeLists.txt 2020-03-27 23:33:36.000000000 +0800 ++++ b/libdap4/CMakeLists.txt 2022-12-14 16:53:32.120065700 +0800 +@@ -7,6 +7,7 @@ + SET(dap4_SOURCES d4crc32.c d4curlfunctions.c d4fix.c d4data.c d4file.c d4parser.c d4meta.c d4varx.c d4dump.c d4swap.c d4chunk.c d4printer.c d4read.c d4http.c d4util.c d4odom.c d4cvt.c d4debug.c ncd4dispatch.c ezxml_extra.c ezxml.c) + + add_library(dap4 OBJECT ${dap4_SOURCES}) ++target_link_libraries(dap4 ${TLL_LIBS}) + + ### + # Options related to the man page generation. +diff -ru a/liblib/CMakeLists.txt b/liblib/CMakeLists.txt +--- a/liblib/CMakeLists.txt 2020-03-27 23:33:36.000000000 +0800 ++++ b/liblib/CMakeLists.txt 2022-12-14 16:52:22.028667900 +0800 +@@ -81,14 +81,14 @@ + # builds: + # Make sure that HDF5_C_LIBRARY appears *after* + # HDF5_HL_LIBRARY. +- SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) ++ SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) + ELSE() # Windows CMake defines HDF5_LIBRARIES. + SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) + ENDIF() + ENDIF() + + IF(USE_DAP) +- SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARY}) ++ SET(TLL_LIBS ${TLL_LIBS} ${CURL_LIBRARIES}) + ENDIF() + + IF(USE_HDF4) +@@ -155,3 +155,5 @@ + FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.c) + SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am) + ADD_EXTRA_DIST("${CUR_EXTRA_DIST}") ++ ++SET(TLL_LIBS ${TLL_LIBS} PARENT_SCOPE) +diff -ru a/oc2/CMakeLists.txt b/oc2/CMakeLists.txt +--- a/oc2/CMakeLists.txt 2020-03-27 23:33:36.000000000 +0800 ++++ b/oc2/CMakeLists.txt 2022-12-14 16:53:32.035864200 +0800 +@@ -8,6 +8,7 @@ + + + add_library(oc2 OBJECT ${oc_SOURCES}) ++target_link_libraries(oc2 ${TLL_LIBS}) + + # Apparently fails under cmake + #set(ocprint_FILES ocprint.c ) diff --git a/recipes/netcdf/all/patches/4.7.4-0002-cmake-msvc.patch b/recipes/netcdf/all/patches/4.7.4-0002-cmake-msvc.patch deleted file mode 100644 index 8ae6c58c1cc05..0000000000000 --- a/recipes/netcdf/all/patches/4.7.4-0002-cmake-msvc.patch +++ /dev/null @@ -1,20 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -614,7 +614,7 @@ IF(USE_HDF5 OR ENABLE_NETCDF_4) - # examples, even though the previous version of what we - # had worked. - ##### -- IF(MSVC) -+ IF(0) - SET(SEARCH_PACKAGE_NAME ${HDF5_PACKAGE_NAME}) - FIND_PACKAGE(HDF5 NAMES ${SEARCH_PACKAGE_NAME} COMPONENTS C HL CONFIG REQUIRED ${NC_HDF5_LINK_TYPE}) - ELSE(MSVC) -@@ -1828,7 +1828,7 @@ ADD_SUBDIRECTORY(docs) - # install them in the binary dir. Grab all of the .libs, put them - # in the libdir. - ## --IF(MSVC) -+IF(0) - FILE(GLOB COPY_FILES ${CMAKE_PREFIX_PATH}/lib/*.lib) - INSTALL(FILES ${COPY_FILES} - DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/recipes/netcdf/all/patches/4.7.4-0003-cmake-HDF5-cmake-components-wrong.patch b/recipes/netcdf/all/patches/4.7.4-0003-cmake-HDF5-cmake-components-wrong.patch deleted file mode 100644 index 2e3f184605fc7..0000000000000 --- a/recipes/netcdf/all/patches/4.7.4-0003-cmake-HDF5-cmake-components-wrong.patch +++ /dev/null @@ -1,13 +0,0 @@ -conan-center-index is currently not able to correctly the components of HDF5. - ---- liblib/CMakeLists.txt -+++ liblib/CMakeLists.txt -@@ -81,7 +81,7 @@ - # builds: - # Make sure that HDF5_C_LIBRARY appears *after* - # HDF5_HL_LIBRARY. -- SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_C_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) -+ SET(TLL_LIBS ${HDF5_HL_LIBRARIES} ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) - ELSE() # Windows CMake defines HDF5_LIBRARIES. - SET(TLL_LIBS ${HDF5_LIBRARIES} ${TLL_LIBS} ${SZIP_LIBRARY}) - ENDIF() diff --git a/recipes/netcdf/all/patches/4.8.1-0001-fix-cmake.patch b/recipes/netcdf/all/patches/4.8.1-0001-fix-cmake.patch index c64e1a3bb7d3f..7ef3820efcd54 100644 --- a/recipes/netcdf/all/patches/4.8.1-0001-fix-cmake.patch +++ b/recipes/netcdf/all/patches/4.8.1-0001-fix-cmake.patch @@ -29,6 +29,24 @@ index 6b39f0e4..76f69653 100644 INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIRS}) # Define a test flag for have curl library +@@ -1920,6 +1918,8 @@ + ##### + SET(netCDF_LIB_CORENAME "netcdf") + ++add_subdirectory(liblib) ++ + ##### + # Set the true names of all the libraries, if customized by external project + ##### +@@ -1962,8 +1963,6 @@ + DESTINATION ${netCDF_BINARY_DIR}/nczarr_test/) + ENDIF() + +-add_subdirectory(liblib) +- + IF(ENABLE_FILTER_TESTING) + add_subdirectory(plugins) + ENDIF() @@ -2028,7 +2026,7 @@ ADD_SUBDIRECTORY(docs) # install them in the binary dir. Grab all of the .libs, put them # in the libdir. @@ -59,3 +77,31 @@ index be72612c..e0edb4ca 100644 ENDIF() IF(USE_HDF4) +@@ -174,3 +174,5 @@ + FILE(GLOB CUR_EXTRA_DIST RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.h ${CMAKE_CURRENT_SOURCE_DIR}/*.c) + SET(CUR_EXTRA_DIST ${CUR_EXTRA_DIST} CMakeLists.txt Makefile.am) + ADD_EXTRA_DIST("${CUR_EXTRA_DIST}") ++ ++SET(TLL_LIBS ${TLL_LIBS} PARENT_SCOPE) +diff -ru a/libdap4/CMakeLists.txt b/libdap4/CMakeLists.txt +--- a/libdap4/CMakeLists.txt 2021-08-19 01:49:05.000000000 +0800 ++++ b/libdap4/CMakeLists.txt 2022-12-14 15:03:47.416608700 +0800 +@@ -7,6 +7,7 @@ + SET(dap4_SOURCES d4curlfunctions.c d4fix.c d4data.c d4file.c d4parser.c d4meta.c d4varx.c d4dump.c d4swap.c d4chunk.c d4printer.c d4read.c d4http.c d4util.c d4odom.c d4cvt.c d4debug.c ncd4dispatch.c ezxml_extra.c ezxml.c) + + add_library(dap4 OBJECT ${dap4_SOURCES}) ++target_link_libraries(dap4 ${TLL_LIBS}) + + ### + # Options related to the man page generation. +diff -ru a/oc2/CMakeLists.txt b/oc2/CMakeLists.txt +--- a/oc2/CMakeLists.txt 2021-08-19 01:49:05.000000000 +0800 ++++ b/oc2/CMakeLists.txt 2022-12-14 15:05:29.788474600 +0800 +@@ -8,6 +8,7 @@ + + + add_library(oc2 OBJECT ${oc_SOURCES}) ++target_link_libraries(oc2 ${TLL_LIBS}) + + # Apparently fails under cmake + #set(ocprint_FILES ocprint.c ) diff --git a/recipes/netcdf/all/test_package/CMakeLists.txt b/recipes/netcdf/all/test_package/CMakeLists.txt index 9bfb2d959e54e..2d1df83efe1db 100644 --- a/recipes/netcdf/all/test_package/CMakeLists.txt +++ b/recipes/netcdf/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +project(test_package C) find_package(netCDF REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} netCDF::netcdf) +target_link_libraries(${PROJECT_NAME} PRIVATE netCDF::netcdf) diff --git a/recipes/netcdf/all/test_package/conanfile.py b/recipes/netcdf/all/test_package/conanfile.py index 38f4483872d47..a317735660a3c 100644 --- a/recipes/netcdf/all/test_package/conanfile.py +++ b/recipes/netcdf/all/test_package/conanfile.py @@ -1,10 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +22,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + diff --git a/recipes/netcdf/all/test_v1_package/CMakeLists.txt b/recipes/netcdf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..5f8b62ff9d493 --- /dev/null +++ b/recipes/netcdf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(netCDF REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} netCDF::netcdf) diff --git a/recipes/netcdf/all/test_v1_package/conanfile.py b/recipes/netcdf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/netcdf/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/nettle/all/conandata.yml b/recipes/nettle/all/conandata.yml index 346e8e5aad534..8e0d6c4f8c0c7 100644 --- a/recipes/nettle/all/conandata.yml +++ b/recipes/nettle/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.8.1": + url: "https://ftp.gnu.org/gnu/nettle/nettle-3.8.1.tar.gz" + sha256: "364f3e2b77cd7dcde83fd7c45219c834e54b0c75e428b6f894a23d12dd41cbfe" "3.6": url: "https://ftp.gnu.org/gnu/nettle/nettle-3.6.tar.gz" sha256: "d24c0d0f2abffbc8f4f34dcf114b0f131ec3774895f3555922fe2f40f3d5e3f1" diff --git a/recipes/nettle/all/conanfile.py b/recipes/nettle/all/conanfile.py index 0f476a9033e95..6fad71c864b8b 100644 --- a/recipes/nettle/all/conanfile.py +++ b/recipes/nettle/all/conanfile.py @@ -1,15 +1,23 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.51.1" -class NettleTLS(ConanFile): +class NettleConan(ConanFile): name = "nettle" description = "The Nettle and Hogweed low-level cryptographic libraries" homepage = "https://www.lysator.liu.se/~nisse/nettle" - topics = ("conan", "nettle", "crypto", "low-level-cryptographic", "cryptographic") + topics = ("crypto", "low-level-cryptographic", "cryptographic") license = ("GPL-2.0-or-later", "GPL-3.0-or-later") url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" @@ -30,12 +38,6 @@ class NettleTLS(ConanFile): "x86_shani": False, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -47,18 +49,30 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.public_key: self.requires("gmp/6.2.1") def validate(self): - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("Nettle cannot be built using Visual Studio") - if tools.Version(self.version) < "3.6" and self.options.get_safe("fat") and self.settings.arch == "x86_64": + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} cannot be built using '{self.info.settings.compiler}'") + if Version(self.version) < "3.6" and self.info.options.get_safe("fat") and self.info.settings.arch == "x86_64": raise ConanInvalidConfiguration("fat support is broken on this nettle release (due to a missing x86_64/sha_ni/sha1-compress.asm source)") @property @@ -66,65 +80,72 @@ def _settings_build(self): return getattr(self, "settings_build", self.settings) def build_requirements(self): - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=bool): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - conf_args = [ + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.extend([ "--enable-public-key" if self.options.public_key else "--disable-public-key", "--enable-fat" if self.options.get_safe("fat") else "--disable-fat", "--enable-x86-aesni" if self.options.get_safe("x86_aesni") else "--disable-x86-aesni", "--enable-x86_sshni" if self.options.get_safe("x86_sshni") else "--disable-x86_sshni", - ] - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) - else: - conf_args.extend(["--disable-shared", "--enable-static"]) - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - # srcdir in unix path causes some troubles in asm files on Windows - if self.settings.os == "Windows": - tools.replace_in_file(os.path.join(self.build_folder, "config.m4"), - tools.unix_path(os.path.join(self.build_folder, self._source_subfolder)), - os.path.join(self.build_folder, self._source_subfolder).replace("\\", "/")) - return self._autotools + ]) + tc.generate() + tc = AutotoolsDeps(self) + tc.generate() + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") def _patch_sources(self): - makefile_in = os.path.join(self._source_subfolder, "Makefile.in") - tools.replace_in_file(makefile_in, + makefile_in = os.path.join(self.source_folder, "Makefile.in") + # discard subdirs + replace_in_file(self, makefile_in, "SUBDIRS = tools testsuite examples", "SUBDIRS = ") # Fix broken tests for compilers like apple-clang with -Werror,-Wimplicit-function-declaration - tools.replace_in_file(os.path.join(self._source_subfolder, "aclocal.m4"), + replace_in_file(self, os.path.join(self.source_folder, "aclocal.m4"), "cat >conftest.c <conftest.c <") def build(self): self._patch_sources() - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + # srcdir in unix path causes some troubles in asm files on Windows + if self._settings_build.os == "Windows": + replace_in_file(self, os.path.join(self.build_folder, "config.m4"), + unix_path(self, os.path.join(self.build_folder, self.source_folder)), + os.path.join(self.build_folder, self.source_folder).replace("\\", "/")) + autotools.configure() autotools.make() def package(self): - self.copy(pattern="COPYING*", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, pattern="COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.components["hogweed"].names["pkgconfig"] = "hogweed" + self.cpp_info.set_property("pkg_config_name", "hogweed") + + self.cpp_info.components["libnettle"].set_property("pkg_config_name", "nettle") + self.cpp_info.components["libnettle"].libs = ["nettle"] + + self.cpp_info.components["hogweed"].set_property("pkg_config_name", "hogweed") self.cpp_info.components["hogweed"].libs = ["hogweed"] + self.cpp_info.components["hogweed"].requires = ["libnettle"] if self.options.public_key: self.cpp_info.components["hogweed"].requires.append("gmp::libgmp") - - self.cpp_info.components["libnettle"].libs = ["nettle"] - self.cpp_info.components["libnettle"].requires = ["hogweed"] - self.cpp_info.components["libnettle"].names["pkgconfig"] = "nettle" diff --git a/recipes/nettle/all/test_package/CMakeLists.txt b/recipes/nettle/all/test_package/CMakeLists.txt index 7b9b613cbb24a..5392db1d1ea64 100644 --- a/recipes/nettle/all/test_package/CMakeLists.txt +++ b/recipes/nettle/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(nettle REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE nettle::libnettle nettle::hogweed) diff --git a/recipes/nettle/all/test_package/conanfile.py b/recipes/nettle/all/test_package/conanfile.py index bd7165a553cf4..a9fb96656f203 100644 --- a/recipes/nettle/all/test_package/conanfile.py +++ b/recipes/nettle/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nettle/all/test_v1_package/CMakeLists.txt b/recipes/nettle/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..6ec75079b3fc2 --- /dev/null +++ b/recipes/nettle/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(nettle REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE nettle::libnettle nettle::hogweed) diff --git a/recipes/nettle/all/test_v1_package/conanfile.py b/recipes/nettle/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/nettle/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/nettle/config.yml b/recipes/nettle/config.yml index 0b500b1c6ae57..e749bd36291ee 100644 --- a/recipes/nettle/config.yml +++ b/recipes/nettle/config.yml @@ -1,4 +1,6 @@ versions: + "3.8.1": + folder: "all" "3.6": folder: "all" "3.5": diff --git a/recipes/ninja/1.10.x/CMakeLists.txt b/recipes/ninja/1.10.x/CMakeLists.txt deleted file mode 100644 index 97030501e5bd7..0000000000000 --- a/recipes/ninja/1.10.x/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/ninja/1.10.x/conandata.yml b/recipes/ninja/1.10.x/conandata.yml deleted file mode 100644 index 85c6ec3022a97..0000000000000 --- a/recipes/ninja/1.10.x/conandata.yml +++ /dev/null @@ -1,7 +0,0 @@ -sources: - "1.10.2": - url: "https://github.com/ninja-build/ninja/archive/v1.10.2.tar.gz" - sha256: "ce35865411f0490368a8fc383f29071de6690cbadc27704734978221f25e2bed" - "1.11.0": - url: "https://github.com/ninja-build/ninja/archive/v1.11.0.tar.gz" - sha256: "3c6ba2e66400fe3f1ae83deb4b235faf3137ec20bd5b08c29bfc368db143e4c6" diff --git a/recipes/ninja/1.10.x/conanfile.py b/recipes/ninja/1.10.x/conanfile.py deleted file mode 100644 index 0bfbdc2cb45a0..0000000000000 --- a/recipes/ninja/1.10.x/conanfile.py +++ /dev/null @@ -1,50 +0,0 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import os - -class NinjaConan(ConanFile): - name = "ninja" - description = "Ninja is a small build system with a focus on speed" - license = "Apache-2.0" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/ninja-build/ninja" - settings = "os", "arch", "compiler", "build_type" - exports_sources = ["CMakeLists.txt", "*.patch"] - generators = "cmake" - topics = ("conan", "ninja", "build") - - _source_subfolder = "source_subfolder" - _cmake = None - - def package_id(self): - del self.info.settings.compiler - - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTING"] = "OFF" - self._cmake.configure() - return self._cmake - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("ninja-%s" % self.version, self._source_subfolder) - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - cmake = self._configure_cmake() - cmake.build() - - def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() - cmake.install() - - def package_info(self): - self.cpp_info.includedirs = [] - self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) - self.env_info.CONAN_CMAKE_GENERATOR = "Ninja" diff --git a/recipes/ninja/1.10.x/test_package/conanfile.py b/recipes/ninja/1.10.x/test_package/conanfile.py deleted file mode 100644 index bf4c31199d341..0000000000000 --- a/recipes/ninja/1.10.x/test_package/conanfile.py +++ /dev/null @@ -1,14 +0,0 @@ -from conans import ConanFile -import os - - -class TestPackage(ConanFile): - settings = "os", "arch" - - test_type = "explicit" - - def build_requirements(self): - self.build_requires(self.tested_reference_str) - - def test(self): - self.run("ninja --version", run_environment=True) diff --git a/recipes/ninja/1.9.x/conandata.yml b/recipes/ninja/1.9.x/conandata.yml deleted file mode 100644 index 5a52be9167a97..0000000000000 --- a/recipes/ninja/1.9.x/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -sources: - "1.9.0": - url: "https://github.com/ninja-build/ninja/archive/v1.9.0.tar.gz" - sha256: "5d7ec75828f8d3fd1a0c2f31b5b0cea780cdfe1031359228c428c1a48bfcd5b9" diff --git a/recipes/ninja/1.9.x/conanfile.py b/recipes/ninja/1.9.x/conanfile.py deleted file mode 100644 index 972b81bc12166..0000000000000 --- a/recipes/ninja/1.9.x/conanfile.py +++ /dev/null @@ -1,69 +0,0 @@ -import os -import sys -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration - - -class NinjaConan(ConanFile): - name = "ninja" - description = "Ninja is a small build system with a focus on speed" - license = "Apache-2.0" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/ninja-build/ninja" - settings = "os", "arch", "compiler", "build_type" - topics = ("conan", "ninja", "build") - - _source_subfolder = "source_subfolder" - - def package_id(self): - del self.info.settings.compiler - - def validate(self): - if hasattr(self, 'settings_build') and tools.cross_building(self, skip_x64_x86=True): - raise ConanInvalidConfiguration("Cross-building not implemented") - - def _build_vs(self): - with tools.chdir(self._source_subfolder): - with tools.vcvars(self.settings, filter_known_paths=False): - self.run("%s configure.py --bootstrap" % sys.executable) - - def _build_configure(self): - with tools.chdir(self._source_subfolder): - cxx = os.environ.get("CXX", "g++") - if self.settings.os == "Linux": - if self.settings.arch == "x86": - cxx += " -m32" - elif self.settings.arch == "x86_64": - cxx += " -m64" - env_build = AutoToolsBuildEnvironment(self) - env_build_vars = env_build.vars - env_build_vars.update({'CXX': cxx}) - with tools.environment_append(env_build_vars): - self.run("%s configure.py --bootstrap" % sys.executable) - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("ninja-%s" % self.version, self._source_subfolder) - - def build(self): - if self.settings.os == "Windows": - self._build_vs() - else: - self._build_configure() - - def package(self): - self.copy(pattern="COPYING", dst="licenses", - src=self._source_subfolder) - self.copy(pattern="ninja*", dst="bin", src=self._source_subfolder) - pdb = os.path.join(self.package_folder, "bin", "ninja.pdb") - if os.path.isfile(pdb): - os.unlink(pdb) - - def package_info(self): - self.cpp_info.includedirs = [] - # ensure ninja is executable - if self.settings.os in ["Linux", "Macos"]: - name = os.path.join(self.package_folder, "bin", "ninja") - os.chmod(name, os.stat(name).st_mode | 0o111) - self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) - self.env_info.CONAN_CMAKE_GENERATOR = "Ninja" diff --git a/recipes/ninja/1.9.x/test_package/conanfile.py b/recipes/ninja/1.9.x/test_package/conanfile.py deleted file mode 100644 index 379e60b03587f..0000000000000 --- a/recipes/ninja/1.9.x/test_package/conanfile.py +++ /dev/null @@ -1,9 +0,0 @@ -from conans import ConanFile, tools -import os - - -class TestPackage(ConanFile): - - def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - self.run("ninja --version", run_environment=True) diff --git a/recipes/ninja/all/conandata.yml b/recipes/ninja/all/conandata.yml new file mode 100644 index 0000000000000..02891869efb97 --- /dev/null +++ b/recipes/ninja/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "1.11.1": + url: "https://github.com/ninja-build/ninja/archive/v1.11.1.tar.gz" + sha256: "31747ae633213f1eda3842686f83c2aa1412e0f5691d1c14dbbcc67fe7400cea" + "1.11.0": + url: "https://github.com/ninja-build/ninja/archive/v1.11.0.tar.gz" + sha256: "3c6ba2e66400fe3f1ae83deb4b235faf3137ec20bd5b08c29bfc368db143e4c6" + "1.10.2": + url: "https://github.com/ninja-build/ninja/archive/v1.10.2.tar.gz" + sha256: "ce35865411f0490368a8fc383f29071de6690cbadc27704734978221f25e2bed" diff --git a/recipes/ninja/all/conanfile.py b/recipes/ninja/all/conanfile.py new file mode 100644 index 0000000000000..d1a9ba2c4828e --- /dev/null +++ b/recipes/ninja/all/conanfile.py @@ -0,0 +1,52 @@ +from conan import ConanFile, conan_version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + + +class NinjaConan(ConanFile): + name = "ninja" + package_type = "application" + description = "Ninja is a small build system with a focus on speed" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ninja-build/ninja" + topics = ("ninja", "build") + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + cmake_layout(self, src_folder="src") + + def package_id(self): + del self.info.settings.compiler + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + + # TODO: to remove in conan v2 + if Version(conan_version).major < 2: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.env_info.CONAN_CMAKE_GENERATOR = "Ninja" diff --git a/recipes/ninja/all/test_package/conanfile.py b/recipes/ninja/all/test_package/conanfile.py new file mode 100644 index 0000000000000..18b4e003b1889 --- /dev/null +++ b/recipes/ninja/all/test_package/conanfile.py @@ -0,0 +1,13 @@ +from conan import ConanFile + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def test(self): + self.run("ninja --version") diff --git a/recipes/ninja/all/test_v1_package/conanfile.py b/recipes/ninja/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..f520548c1be19 --- /dev/null +++ b/recipes/ninja/all/test_v1_package/conanfile.py @@ -0,0 +1,12 @@ +from conans import ConanFile + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + + def test(self): + self.run("ninja --version", run_environment=True) diff --git a/recipes/ninja/config.yml b/recipes/ninja/config.yml index c071c04eddc6a..0a0061dfb232d 100644 --- a/recipes/ninja/config.yml +++ b/recipes/ninja/config.yml @@ -1,7 +1,7 @@ versions: - "1.9.0": - folder: 1.9.x - "1.10.2": - folder: 1.10.x + "1.11.1": + folder: all "1.11.0": - folder: 1.10.x + folder: all + "1.10.2": + folder: all diff --git a/recipes/nlohmann_json/all/conandata.yml b/recipes/nlohmann_json/all/conandata.yml index d61287998ab12..6d20bef200f0e 100644 --- a/recipes/nlohmann_json/all/conandata.yml +++ b/recipes/nlohmann_json/all/conandata.yml @@ -1,49 +1,49 @@ sources: - "3.1.1": - sha256: 9f3549824af3ca7e9707a2503959886362801fb4926b869789d6929098a79e47 - url: https://github.com/nlohmann/json/archive/v3.1.1.tar.gz - "3.2.0": - sha256: 2de558ff3b3b32eebfb51cf2ceb835a0fa5170e6b8712b02be9c2c07fcfe52a1 - url: https://github.com/nlohmann/json/archive/v3.2.0.tar.gz - "3.4.0": - sha256: C377963A95989270C943D522BFEFE7B889EF5ED0E1E15D535FD6F6F16ED70732 - url: https://github.com/nlohmann/json/archive/v3.4.0.tar.gz - "3.7.0": - sha256: D51A3A8D3EFBB1139D7608E28782EA9EFEA7E7933157E8FF8184901EFD8EE760 - url: https://github.com/nlohmann/json/archive/v3.7.0.tar.gz - "3.7.3": - sha256: 249548F4867417D66AE46B338DFE0A2805F3323E81C9E9B83C89F3ADBFDE6F31 - url: https://github.com/nlohmann/json/archive/v3.7.3.tar.gz - "3.8.0": - sha256: 7d0edf65f2ac7390af5e5a0b323b31202a6c11d744a74b588dc30f5a8c9865ba - url: https://github.com/nlohmann/json/archive/v3.8.0.tar.gz - "3.9.0": - sha256: 9943db11eeaa5b23e58a88fbc26c453faccef7b546e55063ad00e7caaaf76d0b - url: https://github.com/nlohmann/json/archive/v3.9.0.tar.gz - "3.9.1": - sha256: 4cf0df69731494668bdd6460ed8cb269b68de9c19ad8c27abc24cd72605b2d5b - url: https://github.com/nlohmann/json/archive/v3.9.1.tar.gz - "3.10.0": - sha256: eb8b07806efa5f95b349766ccc7a8ec2348f3b2ee9975ad879259a371aea8084 - url: https://github.com/nlohmann/json/archive/v3.10.0.tar.gz - "3.10.2": - sha256: 081ed0f9f89805c2d96335c3acfa993b39a0a5b4b4cef7edb68dd2210a13458c - url: https://github.com/nlohmann/json/archive/v3.10.2.tar.gz - "3.10.3": - url: "https://github.com/nlohmann/json/archive/v3.10.3.tar.gz" - sha256: "e0d7c1b120cac47fa7f14a41d10a5d390f67d423d8e97b9d6834887285d6873c" - "3.10.4": - url: "https://github.com/nlohmann/json/archive/v3.10.4.tar.gz" - sha256: "1155fd1a83049767360e9a120c43c578145db3204d2b309eba49fbbedd0f4ed3" - "3.10.5": - url: "https://github.com/nlohmann/json/archive/v3.10.5.tar.gz" - sha256: "5daca6ca216495edf89d167f808d1d03c4a4d929cef7da5e10f135ae1540c7e4" - "3.11.0": - url: "https://github.com/nlohmann/json/archive/v3.11.0.tar.gz" - sha256: "e0c4fbd03c0bb7e99b40791e0276be61e5f531106e1486e8f0d771a7ed6d754a" - "3.11.1": - url: "https://github.com/nlohmann/json/archive/v3.11.1.tar.gz" - sha256: "598becb62ee0e01cf32795073c8ae09b6e95335cd43a4417b785d93ce105b0d0" "3.11.2": url: "https://github.com/nlohmann/json/archive/v3.11.2.tar.gz" sha256: "d69f9deb6a75e2580465c6c4c5111b89c4dc2fa94e3a85fcd2ffcd9a143d9273" + "3.11.1": + url: "https://github.com/nlohmann/json/archive/v3.11.1.tar.gz" + sha256: "598becb62ee0e01cf32795073c8ae09b6e95335cd43a4417b785d93ce105b0d0" + "3.11.0": + url: "https://github.com/nlohmann/json/archive/v3.11.0.tar.gz" + sha256: "e0c4fbd03c0bb7e99b40791e0276be61e5f531106e1486e8f0d771a7ed6d754a" + "3.10.5": + url: "https://github.com/nlohmann/json/archive/v3.10.5.tar.gz" + sha256: "5daca6ca216495edf89d167f808d1d03c4a4d929cef7da5e10f135ae1540c7e4" + "3.10.4": + url: "https://github.com/nlohmann/json/archive/v3.10.4.tar.gz" + sha256: "1155fd1a83049767360e9a120c43c578145db3204d2b309eba49fbbedd0f4ed3" + "3.10.3": + url: "https://github.com/nlohmann/json/archive/v3.10.3.tar.gz" + sha256: "e0d7c1b120cac47fa7f14a41d10a5d390f67d423d8e97b9d6834887285d6873c" + "3.10.2": + sha256: 081ed0f9f89805c2d96335c3acfa993b39a0a5b4b4cef7edb68dd2210a13458c + url: https://github.com/nlohmann/json/archive/v3.10.2.tar.gz + "3.10.0": + sha256: eb8b07806efa5f95b349766ccc7a8ec2348f3b2ee9975ad879259a371aea8084 + url: https://github.com/nlohmann/json/archive/v3.10.0.tar.gz + "3.9.1": + sha256: 4cf0df69731494668bdd6460ed8cb269b68de9c19ad8c27abc24cd72605b2d5b + url: https://github.com/nlohmann/json/archive/v3.9.1.tar.gz + "3.9.0": + sha256: 9943db11eeaa5b23e58a88fbc26c453faccef7b546e55063ad00e7caaaf76d0b + url: https://github.com/nlohmann/json/archive/v3.9.0.tar.gz + "3.8.0": + sha256: 7d0edf65f2ac7390af5e5a0b323b31202a6c11d744a74b588dc30f5a8c9865ba + url: https://github.com/nlohmann/json/archive/v3.8.0.tar.gz + "3.7.3": + sha256: 249548F4867417D66AE46B338DFE0A2805F3323E81C9E9B83C89F3ADBFDE6F31 + url: https://github.com/nlohmann/json/archive/v3.7.3.tar.gz + "3.7.0": + sha256: D51A3A8D3EFBB1139D7608E28782EA9EFEA7E7933157E8FF8184901EFD8EE760 + url: https://github.com/nlohmann/json/archive/v3.7.0.tar.gz + "3.4.0": + sha256: C377963A95989270C943D522BFEFE7B889EF5ED0E1E15D535FD6F6F16ED70732 + url: https://github.com/nlohmann/json/archive/v3.4.0.tar.gz + "3.2.0": + sha256: 2de558ff3b3b32eebfb51cf2ceb835a0fa5170e6b8712b02be9c2c07fcfe52a1 + url: https://github.com/nlohmann/json/archive/v3.2.0.tar.gz + "3.1.1": + sha256: 9f3549824af3ca7e9707a2503959886362801fb4926b869789d6929098a79e47 + url: https://github.com/nlohmann/json/archive/v3.1.1.tar.gz diff --git a/recipes/nlohmann_json/all/conanfile.py b/recipes/nlohmann_json/all/conanfile.py index 5bb517c0955a7..83bc77059e036 100644 --- a/recipes/nlohmann_json/all/conanfile.py +++ b/recipes/nlohmann_json/all/conanfile.py @@ -1,8 +1,8 @@ -import os - from conan import ConanFile +from conan.tools.build import check_min_cppstd from conan.tools.files import copy, get from conan.tools.layout import basic_layout +import os required_conan_version = ">=1.50.0" @@ -11,29 +11,43 @@ class NlohmannJsonConan(ConanFile): name = "nlohmann_json" homepage = "https://github.com/nlohmann/json" description = "JSON for Modern C++ parser and generator." - topics = ("jsonformoderncpp", "nlohmann_json", "json", "header-only") + topics = "json", "header-only" url = "https://github.com/conan-io/conan-center-index" license = "MIT" settings = "os", "arch", "compiler", "build_type" no_copy_source = True + @property + def _minimum_cpp_standard(self): + return 11 + def layout(self): basic_layout(self, src_folder="src") def package_id(self): self.info.clear() + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + def generate(self): pass - def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True) + def build(self): + pass def package(self): copy(self, "LICENSE*", self.source_folder, os.path.join(self.package_folder, "licenses")) copy(self, "*", os.path.join(self.source_folder, "include"), os.path.join(self.package_folder, "include")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "nlohmann_json" - self.cpp_info.names["cmake_find_package_multi"] = "nlohmann_json" - self.cpp_info.names["pkg_config"] = "nlohmann_json" + self.cpp_info.set_property("cmake_file_name", "nlohmann_json") + self.cpp_info.set_property("cmake_target_name", "nlohmann_json::nlohmann_json") + self.cpp_info.set_property("pkg_config_name", "nlohmann_json") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/nlohmann_json/all/test_package/CMakeLists.txt b/recipes/nlohmann_json/all/test_package/CMakeLists.txt index a0cd149e8acbf..8976512b85ce6 100644 --- a/recipes/nlohmann_json/all/test_package/CMakeLists.txt +++ b/recipes/nlohmann_json/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(nlohmann_json REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} nlohmann_json::nlohmann_json) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE nlohmann_json::nlohmann_json) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/nlohmann_json/all/test_package/conanfile.py b/recipes/nlohmann_json/all/test_package/conanfile.py index 87a7297528bf3..cb68885270b30 100644 --- a/recipes/nlohmann_json/all/test_package/conanfile.py +++ b/recipes/nlohmann_json/all/test_package/conanfile.py @@ -8,6 +8,7 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/nlohmann_json/all/test_package/test_package.cpp b/recipes/nlohmann_json/all/test_package/test_package.cpp index 6b38ea7a2e145..1289a2fa9f10d 100644 --- a/recipes/nlohmann_json/all/test_package/test_package.cpp +++ b/recipes/nlohmann_json/all/test_package/test_package.cpp @@ -25,6 +25,6 @@ int main() { #else auto f = data["pi"].get(); #endif - std::cout << data.dump(4) << std::endl; + std::cout << data.dump(4) << "\n"; return 0; } diff --git a/recipes/nlohmann_json/all/test_v1_package/CMakeLists.txt b/recipes/nlohmann_json/all/test_v1_package/CMakeLists.txt index 6eb158583c5c7..925ecbe19e448 100644 --- a/recipes/nlohmann_json/all/test_v1_package/CMakeLists.txt +++ b/recipes/nlohmann_json/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1.2) +cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(nlohmann_json REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} nlohmann_json::nlohmann_json) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/nlohmann_json/config.yml b/recipes/nlohmann_json/config.yml index d35466e33f93f..f26a7154dd392 100644 --- a/recipes/nlohmann_json/config.yml +++ b/recipes/nlohmann_json/config.yml @@ -1,33 +1,33 @@ versions: - "3.1.1": - folder: all - "3.2.0": + "3.11.2": folder: all - "3.4.0": + "3.11.1": folder: all - "3.7.0": + "3.11.0": folder: all - "3.7.3": + "3.10.5": folder: all - "3.8.0": + "3.10.4": folder: all - "3.9.0": + "3.10.3": folder: all - "3.9.1": + "3.10.2": folder: all "3.10.0": folder: all - "3.10.2": + "3.9.1": folder: all - "3.10.3": + "3.9.0": folder: all - "3.10.4": + "3.8.0": folder: all - "3.10.5": + "3.7.3": folder: all - "3.11.0": + "3.7.0": folder: all - "3.11.1": + "3.4.0": folder: all - "3.11.2": + "3.2.0": + folder: all + "3.1.1": folder: all diff --git a/recipes/nlopt/all/conanfile.py b/recipes/nlopt/all/conanfile.py index 9bb9f2396a50f..8d8fd8b762dc4 100644 --- a/recipes/nlopt/all/conanfile.py +++ b/recipes/nlopt/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile +from conan.tools.build import stdcpp_library from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, replace_in_file, rm, rmdir -from conans import tools as tools_legacy import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class NloptConan(ConanFile): @@ -13,10 +13,11 @@ class NloptConan(ConanFile): "algorithms for global and local, constrained or " \ "unconstrained, optimization." license = ["LGPL-2.1-or-later", "MIT"] - topics = ("nlopt", "optimization", "nonlinear") + topics = ("optimization", "nonlinear") homepage = "https://github.com/stevengj/nlopt" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,23 +36,16 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.enable_cxx_routines: - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -64,8 +58,6 @@ def generate(self): tc.variables["NLOPT_SWIG"] = False tc.variables["NLOPT_TESTS"] = False tc.variables["WITH_THREADLOCAL"] = True - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def _patch_sources(self): @@ -120,7 +112,7 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["nloptlib"].system_libs.append("m") if not self.options.shared and self.options.enable_cxx_routines: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.components["nloptlib"].system_libs.append(libcxx) if self.settings.os == "Windows" and self.options.shared: diff --git a/recipes/nlopt/all/test_package/conanfile.py b/recipes/nlopt/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/nlopt/all/test_package/conanfile.py +++ b/recipes/nlopt/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/nlopt/all/test_v1_package/CMakeLists.txt b/recipes/nlopt/all/test_v1_package/CMakeLists.txt index 03ab80df6594c..0d20897301b68 100644 --- a/recipes/nlopt/all/test_v1_package/CMakeLists.txt +++ b/recipes/nlopt/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(NLopt REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE NLopt::nlopt) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/nmos-cpp/all/CMakeLists.txt b/recipes/nmos-cpp/all/CMakeLists.txt deleted file mode 100644 index 446552b526f4b..0000000000000 --- a/recipes/nmos-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -# see https://github.com/conan-io/cmake-conan/issues/249#issuecomment-737011732 -cmake_minimum_required(VERSION 3.17) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -# conanfile.py source() method extracts to source_subfolder -# nmos-cpp top-level CMakeLists.txt is in Development -add_subdirectory("source_subfolder/Development") diff --git a/recipes/nmos-cpp/all/conandata.yml b/recipes/nmos-cpp/all/conandata.yml index bb8d60a8922bc..94817c0d8466a 100644 --- a/recipes/nmos-cpp/all/conandata.yml +++ b/recipes/nmos-cpp/all/conandata.yml @@ -1,20 +1,34 @@ sources: # see https://github.com/conan-io/conan-center-index/blob/master/docs/faqs.md#what-version-should-packages-use-for-libraries-without-official-releases - "cci.20210902": - url: "https://github.com/sony/nmos-cpp/archive/d3a8c7935f80ce5de6d4727c307ddcef667b5d57.tar.gz" - sha256: "f5bd0b96542810ac1ed3ebaf7237d7471f3c42e68d966ae8b2d39db2601a38f9" - "cci.20211015": - url: "https://github.com/sony/nmos-cpp/archive/d115866f8f1d2c1c55bb64d05d34aa7d61c039e3.tar.gz" - sha256: "74e48497d6d7cc76a97b5a6331f88a58b2c96ce2f24b78176d3631051caceb6a" - "cci.20220120": - url: "https://github.com/sony/nmos-cpp/archive/46750381f33d19ce6b12a2f760db2f2f5faf2818.tar.gz" - sha256: "cd6fd81b1a5a10fd0a917fec362aae517a72f13889ec4418c29beb3ec8996df7" - "cci.20220208": - url: "https://github.com/sony/nmos-cpp/archive/7ca64c4fb5604fb8a3e0c05db2e8f8ffe7ef3857.tar.gz" - sha256: "751e7a35501cdada0e3943dcfd23a4e4f5caa02661d7f961204e8f9fea567c42" + "cci.20221203": + url: "https://github.com/sony/nmos-cpp/archive/0fb6b51737f737ae011cbcc39cdfb2c5236ec59f.tar.gz" + sha256: "9e811b2707afe084c4470fcaa5664f57468fd03e86b1eebd03ec9216cf31cac1" + "cci.20220620": + url: "https://github.com/sony/nmos-cpp/archive/3a904a3fcc39057a8db74656a697f0d97d8a3651.tar.gz" + sha256: "49a16ad5c8b1cf45cd519b96c880340b369a737c6814f8c533fff1cf49439fda" "cci.20220428": url: "https://github.com/sony/nmos-cpp/archive/07b8742d5e3413c903a0b0e74d0c87a76e9ecdfa.tar.gz" sha256: "be305ea343822f0aa76376955b7adcbf61807b2fe54084c067daa837ef37b0cd" + "cci.20220208": + url: "https://github.com/sony/nmos-cpp/archive/7ca64c4fb5604fb8a3e0c05db2e8f8ffe7ef3857.tar.gz" + sha256: "751e7a35501cdada0e3943dcfd23a4e4f5caa02661d7f961204e8f9fea567c42" + "cci.20220120": + url: "https://github.com/sony/nmos-cpp/archive/46750381f33d19ce6b12a2f760db2f2f5faf2818.tar.gz" + sha256: "cd6fd81b1a5a10fd0a917fec362aae517a72f13889ec4418c29beb3ec8996df7" +patches: "cci.20220620": - url: "https://github.com/sony/nmos-cpp/archive/3a904a3fcc39057a8db74656a697f0d97d8a3651.tar.gz" - sha256: "49a16ad5c8b1cf45cd519b96c880340b369a737c6814f8c533fff1cf49439fda" + - patch_file: "patches/cmakedeps-targets.patch" + patch_type: "conan" + patch_description: "Fix upstream/CMakeDeps target names" + "cci.20220428": + - patch_file: "patches/cmakedeps-targets.patch" + patch_type: "conan" + patch_description: "Fix upstream/CMakeDeps target names" + "cci.20220208": + - patch_file: "patches/cmakedeps-targets.patch" + patch_type: "conan" + patch_description: "Fix upstream/CMakeDeps target names" + "cci.20220120": + - patch_file: "patches/cmakedeps-targets.patch" + patch_type: "conan" + patch_description: "Fix upstream/CMakeDeps target names" diff --git a/recipes/nmos-cpp/all/conanfile.py b/recipes/nmos-cpp/all/conanfile.py index 4a2aae9486b39..be9549d77d691 100644 --- a/recipes/nmos-cpp/all/conanfile.py +++ b/recipes/nmos-cpp/all/conanfile.py @@ -1,9 +1,12 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools import build, files +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import json import os import re -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class NmosCppConan(ConanFile): name = "nmos-cpp" @@ -25,23 +28,10 @@ class NmosCppConan(ConanFile): "with_dnssd": "mdnsresponder", } - # wrapper CMakeLists.txt to call conan_basic_setup() - exports_sources = ["CMakeLists.txt"] - # use cmake_find_package_multi and prefer config-file packages - generators = "cmake", "cmake_find_package_multi" - short_paths = True - _cmake = None - - # for out-of-source build, cf. wrapper CMakeLists.txt - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + files.export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -56,11 +46,13 @@ def config_options(self): def requirements(self): # for now, consistent with project's conanfile.txt - self.requires("boost/1.79.0") + self.requires("boost/1.80.0") self.requires("cpprestsdk/2.10.18") self.requires("websocketpp/0.8.2") - self.requires("openssl/1.1.1o") - self.requires("json-schema-validator/2.1.0") + self.requires("openssl/1.1.1s") + self.requires("json-schema-validator/2.2.0") + self.requires("nlohmann_json/3.11.2") + self.requires("zlib/1.2.13") if self.options.get_safe("with_dnssd") == "mdnsresponder": self.requires("mdnsresponder/878.200.35") @@ -73,57 +65,65 @@ def requirements(self): def build_requirements(self): # nmos-cpp needs CMake 3.17 or higher but CCI doesn't allow version ranges - self.build_requires("cmake/3.23.2") + self.build_requires("cmake/3.24.2") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.os in ["Macos"]: + raise ConanInvalidConfiguration(f"{self.ref} is not currently supported on {self.info.settings.os}. Contributions welcomed.") + if self.info.settings.compiler.get_safe("cppstd"): + build.check_min_cppstd(self, 11) def package_id(self): self.info.requires["boost"].minor_mode() + self.info.requires["nlohmann_json"].patch_mode() + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + files.get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + files.rm(self, "conanfile.txt", os.path.join(self.source_folder, "Development")) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) # prefer config-file packages created by cmake_find_package_multi # over any system-installed find-module packages - self._cmake.definitions["CMAKE_FIND_PACKAGE_PREFER_CONFIG"] = True + tc.cache_variables["CMAKE_FIND_PACKAGE_PREFER_CONFIG"] = True + # disable cmake-conan, consume conan packages in local cache to avoid incompatible requirements + # between this recipe and project's conanfile.txt + tc.cache_variables["CONAN_EXPORTED"] = True # (on Linux) select Avahi or mDNSResponder - self._cmake.definitions["NMOS_CPP_USE_AVAHI"] = self.options.get_safe("with_dnssd") == "avahi" + tc.variables["NMOS_CPP_USE_AVAHI"] = self.options.get_safe("with_dnssd") == "avahi" # (on Windows) use the Conan package for DNSSD (mdnsresponder), not the project's own DLL stub library - self._cmake.definitions["NMOS_CPP_USE_BONJOUR_SDK"] = True + tc.variables["NMOS_CPP_USE_BONJOUR_SDK"] = True # no need to build unit tests - self._cmake.definitions["NMOS_CPP_BUILD_TESTS"] = False + tc.variables["NMOS_CPP_BUILD_TESTS"] = False # the examples (nmos-cpp-registry and nmos-cpp-node) are useful utilities for users - self._cmake.definitions["NMOS_CPP_BUILD_EXAMPLES"] = True - # out-of-source build - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["NMOS_CPP_BUILD_EXAMPLES"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + files.apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder="Development") cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + files.copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() cmake_folder = os.path.join(self.package_folder, "lib", "cmake") self._create_components_file_from_cmake_target_file(os.path.join(cmake_folder, "nmos-cpp", "nmos-cpp-targets.cmake")) # remove the project's own generated config-file package - tools.rmdir(cmake_folder) + files.rmdir(self, cmake_folder) - # based on abseil recipe - # see https://github.com/conan-io/conan-center-index/blob/master/recipes/abseil/all/conanfile.py def _create_components_file_from_cmake_target_file(self, target_file_path): components = {} - target_content = tools.load(target_file_path) + target_content = files.load(self, target_file_path) cmake_functions = re.findall(r"(?Padd_library|set_target_properties)[\n|\s]*\([\n|\s]*(?P[^)]*)\)", target_content) for (cmake_function_name, cmake_function_args) in cmake_functions: @@ -162,21 +162,22 @@ def _create_components_file_from_cmake_target_file(self, target_file_path): match_private = re.fullmatch(r"\$", dependency) if match_private: dependency = match_private.group(1) - if "::" in dependency: + # target dependencies can be treated fairly consistently + if "::" in dependency or dependency in ["nlohmann_json_schema_validator"]: dependency = dependency.replace("nmos-cpp::", "") # Conan component name cannot be the same as the package name if dependency == "nmos-cpp": dependency = "nmos-cpp-lib" # Conan packages for Boost, cpprestsdk, websocketpp, OpenSSL and Avahi have component names that (except for being lowercase) match the CMake targets - # json-schema-validator overrides cmake_find_package[_multi] names - elif dependency == "nlohmann_json_schema_validator::nlohmann_json_schema_validator": + # json-schema-validator overrides cmake_find_package[_multi] names and v2 cmake_target_name + elif dependency == "nlohmann_json_schema_validator": dependency = "json-schema-validator::json-schema-validator" # mdnsresponder overrides cmake_find_package[_multi] names elif dependency == "DNSSD::DNSSD": dependency = "mdnsresponder::mdnsresponder" components[component_name].setdefault("requires" if not match_private else "requires_private", []).append(dependency.lower()) elif "${_IMPORT_PREFIX}/lib/" in dependency: - self.output.warn("{} recipe does not handle {} {} (yet)".format(self.name, property_type, dependency)) + self.output.warn(f"{self.name} recipe does not handle {property_type} {dependency} (yet)") else: components[component_name].setdefault("system_libs", []).append(dependency) elif property_type == "INTERFACE_COMPILE_DEFINITIONS": @@ -185,7 +186,7 @@ def _create_components_file_from_cmake_target_file(self, target_file_path): elif property_type == "INTERFACE_COMPILE_FEATURES": for property_value in property_values: if property_value not in ["cxx_std_11"]: - self.output.warn("{} recipe does not handle {} {} (yet)".format(self.name, property_type, property_value)) + self.output.warn(f"{self.name} recipe does not handle {property_type} {property_value} (yet)") elif property_type == "INTERFACE_COMPILE_OPTIONS": for property_value in property_values: # handle forced include (Visual Studio /FI, gcc -include) by relying on includedirs containing "include" @@ -194,7 +195,7 @@ def _create_components_file_from_cmake_target_file(self, target_file_path): elif property_type == "INTERFACE_INCLUDE_DIRECTORIES": for property_value in property_values: if property_value not in ["${_IMPORT_PREFIX}/include"]: - self.output.warn("{} recipe does not handle {} {} (yet)".format(self.name, property_type, property_value)) + self.output.warn(f"{self.name} recipe does not handle {property_type} {property_value} (yet)") elif property_type == "INTERFACE_LINK_OPTIONS": for property_value in property_values: # workaround required because otherwise "/ignore:4099" gets converted to "\ignore:4099.obj" @@ -206,10 +207,10 @@ def _create_components_file_from_cmake_target_file(self, target_file_path): property_value = re.sub(r"^/", r"-", property_value) components[component_name].setdefault("linkflags", []).append(property_value) else: - self.output.warn("{} recipe does not handle {} (yet)".format(self.name, property_type)) + self.output.warn(f"{self.name} recipe does not handle {property_type} (yet)") # Save components informations in json file - with open(self._components_helper_filepath, "w") as json_file: + with open(self._components_helper_filepath, "w", encoding="utf-8") as json_file: json.dump(components, json_file, indent=4) @property @@ -224,9 +225,11 @@ def package_info(self): config_install_dir = "Debug" if self.settings.build_type == "Debug" else "Release" bindir = os.path.join(bindir, config_install_dir) libdir = os.path.join(libdir, config_install_dir) + self.cpp_info.bindirs = [bindir] + self.cpp_info.libdirs = [libdir] def _register_components(): - components_json_file = tools.load(self._components_helper_filepath) + components_json_file = files.load(self, self._components_helper_filepath) components = json.loads(components_json_file) for component_name, values in components.items(): cmake_target = values["cmake_target"] @@ -249,5 +252,5 @@ def _register_components(): # add nmos-cpp-registry and nmos-cpp-node to the path bin_path = os.path.join(self.package_folder, bindir) - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/nmos-cpp/all/patches/cmakedeps-targets.patch b/recipes/nmos-cpp/all/patches/cmakedeps-targets.patch new file mode 100644 index 0000000000000..15a9e60940ea6 --- /dev/null +++ b/recipes/nmos-cpp/all/patches/cmakedeps-targets.patch @@ -0,0 +1,20 @@ +--- a/Development/cmake/NmosCppDependencies.cmake ++++ b/Development/cmake/NmosCppDependencies.cmake +@@ -197,7 +197,7 @@ + endif() + + add_library(json_schema_validator INTERFACE) +- target_link_libraries(json_schema_validator INTERFACE nlohmann_json_schema_validator::nlohmann_json_schema_validator) ++ target_link_libraries(json_schema_validator INTERFACE nlohmann_json_schema_validator) + else() + set(JSON_SCHEMA_VALIDATOR_SOURCES + third_party/nlohmann/json-patch.cpp +@@ -264,7 +264,7 @@ + message(STATUS "Found Avahi version " ${Avahi_VERSION}) + endif() + +- target_link_libraries(DNSSD INTERFACE Avahi::compat-libdns_sd) ++ target_link_libraries(DNSSD INTERFACE avahi::compat-libdns_sd) + else() + find_package(DNSSD REQUIRED) + if(NOT DNSSD_VERSION) diff --git a/recipes/nmos-cpp/all/test_package/CMakeLists.txt b/recipes/nmos-cpp/all/test_package/CMakeLists.txt index 9fd1df2d45f21..fd5f713e08b82 100644 --- a/recipes/nmos-cpp/all/test_package/CMakeLists.txt +++ b/recipes/nmos-cpp/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(NmosCppTestPackage CXX) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package CXX) -find_package(nmos-cpp REQUIRED) +find_package(nmos-cpp REQUIRED CONFIG) -add_executable(test_package main.cpp) -target_link_libraries(test_package nmos-cpp::compile-settings nmos-cpp::nmos-cpp) -set_target_properties(test_package PROPERTIES CXX_STANDARD 11 CXX_STANDARD_REQUIRED ON) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE nmos-cpp::compile-settings nmos-cpp::nmos-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/nmos-cpp/all/test_package/conanfile.py b/recipes/nmos-cpp/all/test_package/conanfile.py index bc0089a6ae374..dbb752cd0c9a2 100644 --- a/recipes/nmos-cpp/all/test_package/conanfile.py +++ b/recipes/nmos-cpp/all/test_package/conanfile.py @@ -1,12 +1,22 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os +import shutil import subprocess from six import StringIO -from conans import ConanFile, CMake, tools + class NmosCppTestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - # use cmake_find_package_multi because the project installs a config-file package - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -14,14 +24,15 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - with open("registry-config.json", "w") as config: + if can_run(self): + with open("registry-config.json", "w", encoding="utf-8") as config: config.write('{"http_port": 10000, "domain": "local.", "pri": 51967}') - with open("node-config.json", "w") as config: + with open("node-config.json", "w", encoding="utf-8") as config: config.write('{"http_port": 20000, "domain": "local.", "highest_pri": 51967, "lowest_pri": 51967}') - # start up the installed nmos-cpp-registry to check it works - registry = subprocess.Popen(["nmos-cpp-registry", "registry-config.json"], + # find and start up the installed nmos-cpp-registry to check it works + registry_path = shutil.which("nmos-cpp-registry", path=os.pathsep.join(self.env["PATH"])) + registry = subprocess.Popen([registry_path, "registry-config.json"], stdout=subprocess.PIPE, stderr=subprocess.STDOUT, universal_newlines=True) @@ -29,8 +40,8 @@ def test(self): # run the test_package node which should have time to register and then exit node_out = StringIO() try: - bin_path = os.path.join("bin", "test_package") - self.run(bin_path + " node-config.json", run_environment=True, output=node_out) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path + " node-config.json", env="conanrun", output=node_out) finally: registry.terminate() if "Adopting registered operation" not in node_out.getvalue(): diff --git a/recipes/nmos-cpp/all/test_package/main.cpp b/recipes/nmos-cpp/all/test_package/test_package.cpp similarity index 100% rename from recipes/nmos-cpp/all/test_package/main.cpp rename to recipes/nmos-cpp/all/test_package/test_package.cpp diff --git a/recipes/nmos-cpp/all/test_v1_package/CMakeLists.txt b/recipes/nmos-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/nmos-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/nmos-cpp/all/test_v1_package/conanfile.py b/recipes/nmos-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..bc0089a6ae374 --- /dev/null +++ b/recipes/nmos-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,43 @@ +import os +import subprocess +from six import StringIO +from conans import ConanFile, CMake, tools + +class NmosCppTestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + # use cmake_find_package_multi because the project installs a config-file package + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + with open("registry-config.json", "w") as config: + config.write('{"http_port": 10000, "domain": "local.", "pri": 51967}') + with open("node-config.json", "w") as config: + config.write('{"http_port": 20000, "domain": "local.", "highest_pri": 51967, "lowest_pri": 51967}') + + # start up the installed nmos-cpp-registry to check it works + registry = subprocess.Popen(["nmos-cpp-registry", "registry-config.json"], + stdout=subprocess.PIPE, + stderr=subprocess.STDOUT, + universal_newlines=True) + + # run the test_package node which should have time to register and then exit + node_out = StringIO() + try: + bin_path = os.path.join("bin", "test_package") + self.run(bin_path + " node-config.json", run_environment=True, output=node_out) + finally: + registry.terminate() + if "Adopting registered operation" not in node_out.getvalue(): + self.output.warn("test_package node failed to register with nmos-cpp-registry\n" + "\n" + "nmos-cpp-registry log:\n" + "{}\n" + "test_package log:\n" + "{}" + .format(registry.communicate()[0], node_out.getvalue())) diff --git a/recipes/nmos-cpp/config.yml b/recipes/nmos-cpp/config.yml index 3ebe54b261d3d..1ebebe8a73c09 100644 --- a/recipes/nmos-cpp/config.yml +++ b/recipes/nmos-cpp/config.yml @@ -1,13 +1,11 @@ versions: - "cci.20210902": + "cci.20221203": folder: all - "cci.20211015": + "cci.20220620": folder: all - "cci.20220120": + "cci.20220428": folder: all "cci.20220208": folder: all - "cci.20220428": - folder: all - "cci.20220620": + "cci.20220120": folder: all diff --git a/recipes/norm/all/CMakeLists.txt b/recipes/norm/all/CMakeLists.txt deleted file mode 100644 index 70578b30fc5b4..0000000000000 --- a/recipes/norm/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/norm/all/conandata.yml b/recipes/norm/all/conandata.yml index bca4b6b833125..84742a26f918f 100644 --- a/recipes/norm/all/conandata.yml +++ b/recipes/norm/all/conandata.yml @@ -1,10 +1,8 @@ sources: "1.5.9": url: "https://github.com/USNavalResearchLaboratory/norm/releases/download/v1.5.9/src-norm-1.5.9.tgz" - sha256: ef6d7bbb7b278584e057acefe3bc764d30122e83fa41d41d8211e39f25b6e3fa + sha256: "ef6d7bbb7b278584e057acefe3bc764d30122e83fa41d41d8211e39f25b6e3fa" patches: "1.5.9": - - base_path: "source_subfolder/protolib" - patch_file: "patches/0001-fix-pthread.patch" - - base_path: "source_subfolder/protolib" - patch_file: "patches/0002-fix-fpic.patch" + - patch_file: "patches/0001-fix-pthread.patch" + - patch_file: "patches/0002-fix-fpic.patch" diff --git a/recipes/norm/all/conanfile.py b/recipes/norm/all/conanfile.py index fef2a3413a749..8a6e8274f50f0 100644 --- a/recipes/norm/all/conanfile.py +++ b/recipes/norm/all/conanfile.py @@ -1,17 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir import os +required_conan_version = ">=1.53.0" + class NormConan(ConanFile): name = "norm" description = "A reliable multicast transport protocol" - topics = ("norm", "multicast", "transport protocol", "nack-oriented reliable multicast") + topics = ("multicast", "transport protocol", "nack-oriented reliable multicast") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.nrl.navy.mil/itd/ncs/products/norm" - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake" license = "NRL" - settings = "os", "compiler", "build_type", "arch" + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -21,48 +24,50 @@ class NormConan(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["NORM_CUSTOM_PROTOLIB_VERSION"] = "./protolib" # FIXME: use external protolib when available in CCI - self._cmake.configure() - return self._cmake - def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("libxml2/2.10.3") # dependency of protolib actually + + def source(self): + get(self, **self.conan_data["sources"][self.version]) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["NORM_CUSTOM_PROTOLIB_VERSION"] = "./protolib" # FIXME: use external protolib when available in CCI + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*proto*") + rm(self, "*proto*", os.path.join(self.package_folder, "lib")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "norm" - self.cpp_info.names["cmake_find_package_multi"] = "norm" + self.cpp_info.set_property("cmake_file_name", "norm") + self.cpp_info.set_property("cmake_target_name", "norm::norm") self.cpp_info.libs = ["norm"] if not self.options.shared: self.cpp_info.libs.append("protokit") @@ -71,10 +76,9 @@ def package_info(self): self.cpp_info.defines.append("NORM_USE_DLL") if self.settings.os == "Windows": - self.cpp_info.system_libs = [ - "ws2_32", "iphlpapi", "user32", "gdi32", "Advapi32", "ntdll"] + # system libs of protolib actually + self.cpp_info.system_libs.extend(["ws2_32", "iphlpapi", "user32", "gdi32", "advapi32", "ntdll"]) elif self.settings.os == "Linux": - self.cpp_info.system_libs = ["dl", "rt"] - - if self.settings.os == "Linux" or self.settings.os == "FreeBSD": + self.cpp_info.system_libs.extend(["dl", "rt"]) + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") diff --git a/recipes/norm/all/patches/0001-fix-pthread.patch b/recipes/norm/all/patches/0001-fix-pthread.patch index 473afb40c7817..bb4f3a8c5dbce 100644 --- a/recipes/norm/all/patches/0001-fix-pthread.patch +++ b/recipes/norm/all/patches/0001-fix-pthread.patch @@ -1,7 +1,5 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 15735c6ab31e92f781decc72d71dde0b0ec3c81f..3e3ad34d01a7e88af2232391411330b24387d43d 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt +--- a/protolib/CMakeLists.txt ++++ b/protolib/CMakeLists.txt @@ -92,6 +92,7 @@ if(LibXml2_FOUND) list(APPEND PUBLIC_HEADER_FILES include/protoXml.h) list(APPEND COMMON_SOURCE_FILES ${COMMON}/protoXml.cpp) diff --git a/recipes/norm/all/patches/0002-fix-fpic.patch b/recipes/norm/all/patches/0002-fix-fpic.patch index c9445e4c11af9..02429b673a989 100644 --- a/recipes/norm/all/patches/0002-fix-fpic.patch +++ b/recipes/norm/all/patches/0002-fix-fpic.patch @@ -1,7 +1,5 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 15735c6ab31e92f781decc72d71dde0b0ec3c81f..1f3e55c640d09088dae9acc2aea09b152bab540a 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt +--- a/protolib/CMakeLists.txt ++++ b/protolib/CMakeLists.txt @@ -4,6 +4,7 @@ cmake_policy(SET CMP0077 NEW) # set the project name project(protokit) diff --git a/recipes/norm/all/test_package/CMakeLists.txt b/recipes/norm/all/test_package/CMakeLists.txt index 2c68dbd1ec2a5..25295e1f60e18 100644 --- a/recipes/norm/all/test_package/CMakeLists.txt +++ b/recipes/norm/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(norm REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - target_link_libraries(${PROJECT_NAME} norm::norm) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE norm::norm) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/norm/all/test_package/conanfile.py b/recipes/norm/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/norm/all/test_package/conanfile.py +++ b/recipes/norm/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/norm/all/test_v1_package/CMakeLists.txt b/recipes/norm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/norm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/norm/all/test_v1_package/conanfile.py b/recipes/norm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/norm/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/npcap/all/conandata.yml b/recipes/npcap/all/conandata.yml new file mode 100644 index 0000000000000..4212558bf5452 --- /dev/null +++ b/recipes/npcap/all/conandata.yml @@ -0,0 +1,13 @@ +# We don't need a new verion here for each release of Npcap +# Only a new version is required if the SDK version changes +# You can find SDK version in https://github.com/nmap/npcap/blob/{GIT_TAG}/version.h + +sources: + # Newer versions at the top + "1.70": + sdk: + url: https://npcap.com/dist/npcap-sdk-1.13.zip + sha256: dad1f2bf1b02b787be08ca4862f99e39a876c1f274bac4ac0cedc9bbc58f94fd + license: + url: https://raw.githubusercontent.com/nmap/npcap/v1.70/LICENSE + sha256: 112d17c43097ae1740b7cb231850da597beeb02a845c566573504b2fbab233e8 diff --git a/recipes/npcap/all/conanfile.py b/recipes/npcap/all/conanfile.py new file mode 100644 index 0000000000000..a8632292b21bd --- /dev/null +++ b/recipes/npcap/all/conanfile.py @@ -0,0 +1,53 @@ +from conan import ConanFile +from conan.tools.files import get, download, copy, collect_libs +from conan.errors import ConanInvalidConfiguration +from os.path import join + + +class NpcapConan(ConanFile): + name = "npcap" + description = "Windows port of the libpcap library" + homepage = "https://npcap.com/" + url = "https://github.com/conan-io/conan-center-index" + license = "LicenseRef-NPCAP" + topics = ("pcap", "windows", "packet-capture") + settings = "os", "arch", "build_type", "compiler" + + # not needed but supress warning message from conan commands + def layout(self): + pass + + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type + + def validate(self): + if self.info.settings.os != "Windows": + raise ConanInvalidConfiguration(f"{self.ref} requires Windows") + + # do not cache as source, instead, use build folder + def source(self): + pass + + def build(self): + source = self.conan_data["sources"][self.version] + get(self, **source['sdk'], destination=self.source_folder) + download(self, filename="LICENSE", **source['license']) + + def package(self): + + copy(self, "LICENSE", dst=join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, "*.h", dst=join(self.package_folder, "include"), src=join(self.source_folder, "Include")) + + if self.settings.arch == "x86_64": + copy(self, "*.lib", dst=join(self.package_folder, "lib"), src=join(self.source_folder, "Lib", "x64")) + elif self.settings.arch == "armv8": + copy(self, "*.lib", dst=join(self.package_folder, "lib"), src=join(self.source_folder, "Lib", "ARM64")) + else: + copy(self, "*.lib", dst=join(self.package_folder, "lib"), src=join(self.source_folder, "Lib")) + + def package_info(self): + self.cpp_info.frameworkdirs = [] + self.cpp_info.bindirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.libs = collect_libs(self) diff --git a/recipes/npcap/all/test_package/CMakeLists.txt b/recipes/npcap/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..873f1064773ee --- /dev/null +++ b/recipes/npcap/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ + +cmake_minimum_required(VERSION 3.8) + +project(test_package C) + +find_package(npcap REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE npcap::npcap) diff --git a/recipes/npcap/all/test_package/conanfile.py b/recipes/npcap/all/test_package/conanfile.py new file mode 100644 index 0000000000000..88fb844b5824b --- /dev/null +++ b/recipes/npcap/all/test_package/conanfile.py @@ -0,0 +1,47 @@ +from conan import ConanFile +from conan.tools import files +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +from io import StringIO +import os + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + if can_run(self): + self.requires("libpcap/1.10.1") + + def configure(self): + if can_run(self): + self.options["libpcap"].shared = True + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bindir = self.cpp.build.bindirs[0] + # Use libpcap DLL as a replacement for npcap DLL + # It will not provide all the functions + # but it will cover enough to check that what we compiled is correct + files.rm(self, "wpcap.dll", bindir) + files.copy(self, "pcap.dll", src=self.deps_cpp_info['libpcap'].bin_paths[0], dst=bindir) + files.rename(self, os.path.join(bindir, "pcap.dll"), os.path.join(bindir, "wpcap.dll")) + + bin_path = os.path.join(bindir, "test_package") + output = StringIO() + self.run(bin_path, env="conanrun", output=output) + test_output = output.getvalue() + print(test_output) + assert "libpcap version 1.10.1" in test_output diff --git a/recipes/npcap/all/test_package/test_package.c b/recipes/npcap/all/test_package/test_package.c new file mode 100644 index 0000000000000..2ac760451bd42 --- /dev/null +++ b/recipes/npcap/all/test_package/test_package.c @@ -0,0 +1,9 @@ +#include + +#include "pcap/pcap.h" + +int main(void) +{ + printf(pcap_lib_version()); + return EXIT_SUCCESS; +} diff --git a/recipes/npcap/all/test_v1_package/CMakeLists.txt b/recipes/npcap/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..90f019f9f9a28 --- /dev/null +++ b/recipes/npcap/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(npcap REQUIRED CONFIG) + +# Re-use the same source file from test_package folder +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +# don't link to ${CONAN_LIBS} or CONAN_PKG::package +target_link_libraries(${PROJECT_NAME} PRIVATE npcap::npcap) diff --git a/recipes/npcap/all/test_v1_package/conanfile.py b/recipes/npcap/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1b88417f558b4 --- /dev/null +++ b/recipes/npcap/all/test_v1_package/conanfile.py @@ -0,0 +1,41 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +from conan.tools import files +from io import StringIO +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def requirements(self): + self.requires(self.tested_reference_str) + if not cross_building(self): + self.requires("libpcap/1.10.1") + + def configure(self): + if not cross_building(self): + self.options["libpcap"].shared = True + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + # Use libpcap DLL as a replacement for npcap DLL + # It will not provide all the functions + # but it will cover enough to check that what we compiled is correct + files.rm(self, "wpcap.dll", "bin") + files.copy(self, "pcap.dll", src=self.deps_cpp_info['libpcap'].bin_paths[0], dst="bin") + files.rename(self, os.path.join("bin", "pcap.dll"), os.path.join("bin", "wpcap.dll")) + + bin_path = os.path.join("bin", "test_package") + output = StringIO() + self.run(bin_path, run_environment=True, output=output) + test_output = output.getvalue() + print(test_output) + assert "libpcap version 1.10.1" in test_output diff --git a/recipes/npcap/config.yml b/recipes/npcap/config.yml new file mode 100644 index 0000000000000..cec2bb065c323 --- /dev/null +++ b/recipes/npcap/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "1.70": + folder: all diff --git a/recipes/nspr/all/conandata.yml b/recipes/nspr/all/conandata.yml index c7a9539834aa3..d2ac3c69dc0ae 100644 --- a/recipes/nspr/all/conandata.yml +++ b/recipes/nspr/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.35": + url: "https://ftp.mozilla.org/pub/nspr/releases/v4.35/src/nspr-4.35.tar.gz" + sha256: "7ea3297ea5969b5d25a5dd8d47f2443cda88e9ee746301f6e1e1426f8a6abc8f" "4.33": url: "https://ftp.mozilla.org/pub/nspr/releases/v4.33/src/nspr-4.33.tar.gz" sha256: "b23ee315be0e50c2fb1aa374d17f2d2d9146a835b1a79c1918ea15d075a693d7" diff --git a/recipes/nspr/all/conanfile.py b/recipes/nspr/all/conanfile.py index 1a69fcc85e883..b0ce8c9099e1b 100644 --- a/recipes/nspr/all/conanfile.py +++ b/recipes/nspr/all/conanfile.py @@ -1,12 +1,14 @@ from conan.tools.microsoft import msvc_runtime_flag -from conan.tools.files import rename -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan.tools.files import rename, get, rmdir, chdir, replace_in_file +from conan.tools.scm import Version +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conans import tools, AutoToolsBuildEnvironment import contextlib import functools import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.47.0" class NsprConan(ConanFile): @@ -57,7 +59,7 @@ def configure(self): def validate(self): # https://bugzilla.mozilla.org/show_bug.cgi?id=1658671 - if tools.Version(self.version) < "4.29": + if Version(self.version) < "4.29": if self.settings.os == "Macos" and self.settings.arch == "armv8": raise ConanInvalidConfiguration("NSPR does not support mac M1 before 4.29") @@ -68,10 +70,10 @@ def build_requirements(self): self.build_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination="tmp", strip_root=True) rename(self, os.path.join("tmp", "nspr"), self._source_subfolder) - tools.rmdir("tmp") + rmdir(self, "tmp") @contextlib.contextmanager def _build_context(self): @@ -120,9 +122,9 @@ def _configure_autotools(self): return autotools def build(self): - with tools.chdir(self._source_subfolder): + with chdir(self, self._source_subfolder): # relocatable shared libs on macOS - tools.replace_in_file( + replace_in_file(self, "configure", "-install_name @executable_path/", "-install_name @rpath/" @@ -133,13 +135,13 @@ def build(self): def package(self): self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - with tools.chdir(self._source_subfolder): + with chdir(self, self._source_subfolder): with self._build_context(): autotools = self._configure_autotools() autotools.install() - tools.rmdir(os.path.join(self.package_folder, "bin")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) if self.settings.os == "Windows": if self.options.shared: os.mkdir(os.path.join(self.package_folder, "bin")) @@ -147,31 +149,31 @@ def package(self): libsuffix = "lib" if self._is_msvc else "a" libprefix = "" if self._is_msvc else "lib" if self.options.shared: - os.unlink(os.path.join(self.package_folder, "lib", "{}{}_s.{}".format(libprefix, lib, libsuffix))) - rename(self, os.path.join(self.package_folder, "lib", "{}.dll".format(lib)), - os.path.join(self.package_folder, "bin", "{}.dll".format(lib))) + os.unlink(os.path.join(self.package_folder, "lib", f"{libprefix}{lib}_s.{libsuffix}")) + rename(self, os.path.join(self.package_folder, "lib", f"{lib}.dll"), + os.path.join(self.package_folder, "bin", f"{lib}.dll")) else: - os.unlink(os.path.join(self.package_folder, "lib", "{}{}.{}".format(libprefix, lib, libsuffix))) - os.unlink(os.path.join(self.package_folder, "lib", "{}.dll".format(lib))) + os.unlink(os.path.join(self.package_folder, "lib", f"{libprefix}{lib}.{libsuffix}")) + os.unlink(os.path.join(self.package_folder, "lib", f"{lib}.dll")) if not self.options.shared: - tools.replace_in_file(os.path.join(self.package_folder, "include", "nspr", "prtypes.h"), + replace_in_file(self, os.path.join(self.package_folder, "include", "nspr", "prtypes.h"), "#define NSPR_API(__type) PR_IMPORT(__type)", "#define NSPR_API(__type) extern __type") - tools.replace_in_file(os.path.join(self.package_folder, "include", "nspr", "prtypes.h"), + replace_in_file(self, os.path.join(self.package_folder, "include", "nspr", "prtypes.h"), "#define NSPR_DATA_API(__type) PR_IMPORT_DATA(__type)", "#define NSPR_DATA_API(__type) extern __type") else: shared_ext = "dylib" if self.settings.os == "Macos" else "so" for lib in self._library_names: if self.options.shared: - os.unlink(os.path.join(self.package_folder, "lib", "lib{}.a".format(lib))) + os.unlink(os.path.join(self.package_folder, "lib", f"lib{lib}.a")) else: - os.unlink(os.path.join(self.package_folder, "lib", "lib{}.{}".format(lib, shared_ext))) + os.unlink(os.path.join(self.package_folder, "lib", f"lib{lib}.{shared_ext}")) if self._is_msvc: if self.settings.build_type == "Debug": for lib in self._library_names: - os.unlink(os.path.join(self.package_folder, "lib", "{}.pdb".format(lib))) + os.unlink(os.path.join(self.package_folder, "lib", f"{lib}.pdb")) if not self.options.shared or self.settings.os == "Windows": for f in os.listdir(os.path.join(self.package_folder, "lib")): @@ -185,7 +187,7 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "nspr") libs = self._library_names if self.settings.os == "Windows" and not self.options.shared: - libs = list("{}_s".format(l) for l in libs) + libs = list(f"{l}_s" for l in libs) self.cpp_info.libs = libs if self.settings.compiler == "gcc" and self.settings.os == "Windows": if self.settings.arch == "x86": @@ -194,12 +196,12 @@ def package_info(self): self.cpp_info.defines.append("_M_X64") self.cpp_info.includedirs.append(os.path.join("include", "nspr")) if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.extend(["dl", "pthread"]) + self.cpp_info.system_libs.extend(["dl", "pthread", "rt"]) elif self.settings.os == "Windows": self.cpp_info.system_libs.extend(["winmm", "ws2_32"]) aclocal = tools.unix_path(os.path.join(self.package_folder, "res", "aclocal")) - self.output.info("Appending AUTOMAKE_CONAN_INCLUDES environment variable: {}".format(aclocal)) + self.output.info(f"Appending AUTOMAKE_CONAN_INCLUDES environment variable: {aclocal}") self.env_info.AUTOMAKE_CONAN_INCLUDES.append(aclocal) self.cpp_info.resdirs = ["res"] diff --git a/recipes/nspr/config.yml b/recipes/nspr/config.yml index e2aac52e9a538..d437dc203c15e 100644 --- a/recipes/nspr/config.yml +++ b/recipes/nspr/config.yml @@ -1,4 +1,6 @@ versions: + "4.35": + folder: all "4.33": folder: all "4.32": diff --git a/recipes/nss/all/conandata.yml b/recipes/nss/all/conandata.yml index 3b0108b7efb89..352d7c2ccf087 100644 --- a/recipes/nss/all/conandata.yml +++ b/recipes/nss/all/conandata.yml @@ -1,13 +1,28 @@ sources: + "3.88.1": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_88_1_RTM/src/nss-3.88.1.tar.gz" + sha256: "27d243edf87d1cf1bb9c861f03d387e0e9230ce5017f4308c941f558b54b3496" + "3.87": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_87_RTM/src/nss-3.87.tar.gz" + sha256: "68a1894496d3d158babc75f8a5dda3f55b7c1560573936e3b101a10fa4ac152d" + "3.86": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_86_RTM/src/nss-3.86.tar.gz" + sha256: "3f385fc686476bbba811035fa6821b542475d55747b18c20c221d4d66573b975" + "3.85": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_85_RTM/src/nss-3.85.tar.gz" + sha256: "afd9d64510b1154debbd6cab3571e9ff64a3373898e03483e4c85cdada13d297" + "3.84": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_84_RTM/src/nss-3.84.tar.gz" + sha256: "9a387ffe350ff14f001d943f96cc0c064891551d71e1a97a5ddbffe7f1207a25" + "3.83": + url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_83_RTM/src/nss-3.83.tar.gz" + sha256: "ab23ea67f964090b8b73c80a674082571c36e5f4eba92057ac648c9c1def0128" "3.77": url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_77_RTM/src/nss-3.77.tar.gz" sha256: "825edf5a2fd35b788a23ff80face591f82919ae3ad2b8f77d424a450d618dedd" "3.76.1": url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_76_1_RTM/src/nss-3.76.1.tar.gz" sha256: "e13104c374e2e1d7890d8f6bc18d0f18eb886ed4dbad4144d1c482f2983d232a" - "3.76": - url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_76_RTM/src/nss-3.76.tar.gz" - sha256: "1b8e0310add364d2ade40620cde0f1c37f4f00a6999b2d3e7ea8dacda4aa1630" "3.72": url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_72_RTM/src/nss-3.72.tar.gz" sha256: "6ea60a9ff113e493ea2ab25f41ea75a9fbd10af7903f26f703dac8680732d02e" diff --git a/recipes/nss/all/conanfile.py b/recipes/nss/all/conanfile.py index 902bc8ad356a9..4a063d42abaeb 100644 --- a/recipes/nss/all/conanfile.py +++ b/recipes/nss/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration from conan.tools.microsoft import msvc_runtime_flag -import os, glob +from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, get, chdir, rename, rm +from conan.tools.build import cross_building +from conans import tools +import os +import glob +required_conan_version = ">=1.51.3" class NSSConan(ConanFile): name = "nss" @@ -30,7 +36,7 @@ def build_requirements(self): if self.settings.os == "Windows": self.build_requires("mozilla-build/3.3") if hasattr(self, "settings_build"): - self.build_requires("sqlite3/3.38.1") + self.build_requires("sqlite3/3.39.3") def configure(self): self.options["nspr"].shared = True @@ -42,8 +48,8 @@ def configure(self): del self.settings.compiler.cppstd def requirements(self): - self.requires("nspr/4.33") - self.requires("sqlite3/3.38.1") + self.requires("nspr/4.35") + self.requires("sqlite3/3.39.3") self.requires("zlib/1.2.12") def validate(self): @@ -57,10 +63,13 @@ def validate(self): raise ConanInvalidConfiguration("NSS cannot link to static sqlite. Please use option sqlite3:shared=True") if self.settings.arch in ["armv8", "armv8.3"] and self.settings.os in ["Macos"]: raise ConanInvalidConfiguration("Macos ARM64 builds not yet supported. Contributions are welcome.") + if Version(self.version) < "3.74": + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) >= 13: + raise ConanInvalidConfiguration("nss < 3.74 requires clang < 13 .") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) @property def _make_args(self): @@ -131,7 +140,7 @@ def _format_libraries(libraries, settings): library += ".lib" result.append(library) else: - result.append("-l%s" % library) + result.append(f"-l{library}") return result @@ -143,21 +152,20 @@ def _format_libraries(libraries, settings): args.append("SQLITE_INCLUDE_DIR=%s" % self.deps_cpp_info["sqlite3"].include_paths[0]) args.append("SQLITE_LIB_DIR=%s" % self.deps_cpp_info["sqlite3"].lib_paths[0]) args.append("NSDISTMODE=copy") - if tools.cross_building(self): + if cross_building(self): args.append("CROSS_COMPILE=1") return args def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with tools.chdir(os.path.join(self._source_subfolder, "nss")): + apply_conandata_patches(self) + with chdir(self, os.path.join(self._source_subfolder, "nss")): with tools.vcvars(self) if self.settings.compiler == "Visual Studio" else tools.no_op(): self.run("make %s" % " ".join(self._make_args), run_environment=True) def package(self): self.copy("COPYING", src = os.path.join(self._source_subfolder, "nss"), dst = "licenses") - with tools.chdir(os.path.join(self._source_subfolder, "nss")): + with chdir(self, os.path.join(self._source_subfolder, "nss")): self.run("make install %s" % " ".join(self._make_args)) self.copy("*", src=os.path.join(self._source_subfolder, "dist", "public", "nss"), @@ -171,23 +179,20 @@ def package(self): self.copy("*", src = f) for dll_file in glob.glob(os.path.join(self.package_folder, "lib", "*.dll")): - tools.rename(dll_file, os.path.join(self.package_folder, "bin", os.path.basename(dll_file))) + rename(self, dll_file, os.path.join(self.package_folder, "bin", os.path.basename(dll_file))) if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.a") + rm(self, "*.a", os.path.join(self.package_folder, "lib")) else: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.so") - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.dll") + rm(self, "*.so", os.path.join(self.package_folder, "lib")) + rm(self, "*.dll", os.path.join(self.package_folder, "bin")) def package_info(self): def _library_name(lib,vers): - if self.options.shared: - return "%s%s" % (lib,vers) - else: - return lib + return f"{lib}{vers}" if self.options.shared else lib self.cpp_info.components["libnss"].libs.append(_library_name("nss", 3)) self.cpp_info.components["libnss"].requires = ["nssutil", "nspr::nspr"] diff --git a/recipes/nss/config.yml b/recipes/nss/config.yml index a60acb1f0ed26..e4002665eafef 100644 --- a/recipes/nss/config.yml +++ b/recipes/nss/config.yml @@ -1,9 +1,19 @@ versions: + "3.88.1": + folder: all + "3.87": + folder: all + "3.86": + folder: all + "3.85": + folder: all + "3.84": + folder: all + "3.83": + folder: all "3.77": folder: all "3.76.1": folder: all - "3.76": - folder: all "3.72": folder: all diff --git a/recipes/ntv2/all/conanfile.py b/recipes/ntv2/all/conanfile.py index eec83d9188141..11da5721c44d1 100644 --- a/recipes/ntv2/all/conanfile.py +++ b/recipes/ntv2/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class Ntv2Conan(ConanFile): @@ -12,8 +12,9 @@ class Ntv2Conan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/aja-video/ntv2" description = "AJA NTV2 SDK" - topics = "video, hardware" + topics = "video", "hardware" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,14 +31,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/ntv2/all/test_package/conanfile.py b/recipes/ntv2/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/ntv2/all/test_package/conanfile.py +++ b/recipes/ntv2/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/ntv2/all/test_v1_package/CMakeLists.txt b/recipes/ntv2/all/test_v1_package/CMakeLists.txt index d2430382760fd..0d20897301b68 100644 --- a/recipes/ntv2/all/test_v1_package/CMakeLists.txt +++ b/recipes/ntv2/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(ntv2 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE ntv2::ntv2) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/ntv2/all/test_v1_package/conanfile.py b/recipes/ntv2/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/ntv2/all/test_v1_package/conanfile.py +++ b/recipes/ntv2/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/numcpp/all/conandata.yml b/recipes/numcpp/all/conandata.yml index ea2f641d0b415..bc5d4611e644e 100644 --- a/recipes/numcpp/all/conandata.yml +++ b/recipes/numcpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.9.0": + url: "https://github.com/dpilger26/NumCpp/archive/Version_2.9.0.tar.gz" + sha256: "1c15e23beb4f3d4933d7a6e8d5eb0259e825685973c8f0219485d3f606e5378a" "2.8.0": url: "https://github.com/dpilger26/NumCpp/archive/Version_2.8.0.tar.gz" sha256: "3868cf24b0981d5b5bfeaea65719f541f82d331ef7b79ba0d73cedb4dc7ddd47" diff --git a/recipes/numcpp/all/conanfile.py b/recipes/numcpp/all/conanfile.py index 7a0ac9c3536e9..16ba0517e3916 100644 --- a/recipes/numcpp/all/conanfile.py +++ b/recipes/numcpp/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class NumCppConan(ConanFile): @@ -26,66 +30,76 @@ class NumCppConan(ConanFile): no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 14 if Version(self.version) < "2.9.0" else 17 + + @property + def _compilers_minimum_version(self): + if self._min_cppstd == 14: + return { + "gcc": "5", + "clang": "3.4", + "apple-clang": "10", + "Visual Studio": "14", + "msvc": "190", + } + return { + "gcc": "8", + "clang": "7", + "apple-clang": "12", + "Visual Studio": "15", + "msvc": "191", + } def config_options(self): - if tools.Version(self.version) < "2.5.0": + if Version(self.version) < "2.5.0": del self.options.with_boost self.options.threads = True + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): - if tools.Version(self.version) < "2.5.0" or self.options.with_boost: - self.requires("boost/1.78.0") + if self.options.get_safe("with_boost", True): + self.requires("boost/1.80.0", transitive_headers=True) def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): - minimal_cpp_standard = "14" if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, minimal_cpp_standard) - minimal_version = { - "gcc": "5", - "clang": "3.4", - "apple-clang": "10", - "Visual Studio": "14" - } - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - return - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + pass def package(self): - include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", dst="include", src=include_folder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "NumCpp") self.cpp_info.set_property("cmake_target_name", "NumCpp::NumCpp") - if not self.options.get_safe("with_boost", False): + if self.options.get_safe("with_boost", True): + self.cpp_info.requires = ["boost::headers"] + else: self.cpp_info.defines.append("NUMCPP_NO_USE_BOOST") - if tools.Version(self.version) < "2.5.0" and not self.options.threads: + if Version(self.version) < "2.5.0" and not self.options.threads: self.cpp_info.defines.append("NO_MULTITHREAD") - if tools.Version(self.version) >= "2.5.0" and self.options.threads: + if Version(self.version) >= "2.5.0" and self.options.threads: self.cpp_info.defines.append("NUMCPP_USE_MULTITHREAD") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "NumCpp" diff --git a/recipes/numcpp/all/test_package/CMakeLists.txt b/recipes/numcpp/all/test_package/CMakeLists.txt index 0be7b056897e1..18d7cfddbd897 100644 --- a/recipes/numcpp/all/test_package/CMakeLists.txt +++ b/recipes/numcpp/all/test_package/CMakeLists.txt @@ -1,11 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(NumCpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} NumCpp::NumCpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE NumCpp::NumCpp) +if(NumCpp_VERSION VERSION_LESS "2.9.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/numcpp/all/test_package/conanfile.py b/recipes/numcpp/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/numcpp/all/test_package/conanfile.py +++ b/recipes/numcpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/numcpp/all/test_v1_package/CMakeLists.txt b/recipes/numcpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/numcpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/numcpp/all/test_v1_package/conanfile.py b/recipes/numcpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/numcpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/numcpp/config.yml b/recipes/numcpp/config.yml index d9c228a9d4542..8bc128c7f1485 100644 --- a/recipes/numcpp/config.yml +++ b/recipes/numcpp/config.yml @@ -1,4 +1,6 @@ versions: + "2.9.0": + folder: "all" "2.8.0": folder: "all" "2.7.0": diff --git a/recipes/nuraft/all/conandata.yml b/recipes/nuraft/all/conandata.yml new file mode 100644 index 0000000000000..a9ea8cc742401 --- /dev/null +++ b/recipes/nuraft/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "2.1.0": + url: https://github.com/ebay/nuraft/archive/refs/tags/v2.1.0.tar.gz + sha256: 42d19682149cf24ae12de0dabf70d7ad7e71e49fbfa61d565e9b46e2b3cd517f + "2.0.0": + url: https://github.com/ebay/nuraft/archive/refs/tags/v2.0.0.tar.gz + sha256: f7f535f0e5c0417fb9a0ab87514a1b77647fc8e7ed967b85ca611df1cae14023 +patches: + "2.1.0": + - patch_file: "patches/1001-cmake_patches.patch" + patch_description: "Provide CMake correct dependency discovery logic." + patch_type: "conan" + "2.0.0": + - patch_file: "patches/0001-cmake_patches.patch" + patch_description: "Provide CMake correct dependency discovery logic." + patch_type: "conan" diff --git a/recipes/nuraft/all/conanfile.py b/recipes/nuraft/all/conanfile.py new file mode 100644 index 0000000000000..14fe8362db98d --- /dev/null +++ b/recipes/nuraft/all/conanfile.py @@ -0,0 +1,78 @@ +from os.path import join +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, apply_conandata_patches +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain +from conan.tools.build import check_min_cppstd + +required_conan_version = ">=1.50.0" + +class NuRaftConan(ConanFile): + name = "nuraft" + homepage = "https://github.corp.ebay.com/sds/NuRaft" + description = """Cornerstone based RAFT library.""" + topics = ("raft") + url = "https://github.com/conan-io/conan-center-index" + license = "Apache-2.0" + + settings = "os", "compiler", "arch", "build_type" + + options = { + "asio": ["boost", "standalone"], + "shared": ['True', 'False'], + "fPIC": ['True', 'False'], + } + default_options = { + "asio": "boost", + "shared": False, + "fPIC": True, + } + + def export_sources(self): + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + + def requirements(self): + if self.options.asio == "boost": + self.requires("boost/1.79.0") + else: + self.requires("asio/1.24.0") + self.requires("openssl/1.1.1s") + + def validate(self): + if self.info.settings.os in ["Windows"]: + raise ConanInvalidConfiguration("{} Builds are unsupported".format(self.info.settings.os)) + if self.info.settings.os in ["Macos"] and self.options.shared: + raise ConanInvalidConfiguration("Building Shared Object for {} unsupported".format(self.info.settings.os)) + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, 11) + + def configure(self): + if self.options.shared: + del self.options.fPIC + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + cmake = CMakeDeps(self) + cmake.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + copy(self, "LICENSE", self.source_folder, join(self.package_folder, "licenses"), keep_path=False) + + def package_info(self): + self.cpp_info.libs = ["nuraft"] + self.cpp_info.system_libs = ["m"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["pthread"]) diff --git a/recipes/nuraft/all/patches/0001-cmake_patches.patch b/recipes/nuraft/all/patches/0001-cmake_patches.patch new file mode 100644 index 0000000000000..3dfdc0a6844d7 --- /dev/null +++ b/recipes/nuraft/all/patches/0001-cmake_patches.patch @@ -0,0 +1,147 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 980d466..9258209 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,6 @@ + cmake_minimum_required(VERSION 3.5) + project(NuRaft VERSION 1.0.0 LANGUAGES CXX) ++set (CMAKE_CXX_STANDARD 11) + + # === Build type (default: RelWithDebInfo, O2) =========== + if (NOT CMAKE_BUILD_TYPE) +@@ -26,41 +27,23 @@ endif() + + + # === Find ASIO === +-if (BOOST_INCLUDE_PATH AND BOOST_LIBRARY_PATH) ++find_package(OpenSSL CONFIG REQUIRED) ++find_package(Boost CONFIG) ++if (Boost_FOUND) + # If Boost path (both include and library) is given, + # use Boost's ASIO. +- message(STATUS "Boost include path: " ${BOOST_INCLUDE_PATH}) +- message(STATUS "Boost library path: " ${BOOST_LIBRARY_PATH}) +- + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_BOOST_ASIO") +- +- set(ASIO_INCLUDE_DIR ${BOOST_INCLUDE_PATH}) +- set(LIBBOOST_SYSTEM "${BOOST_LIBRARY_PATH}/libboost_system.a") +- ++ set(ASIO_DEP boost::boost) + else () + # If not, ASIO standalone mode. +- FIND_PATH(ASIO_INCLUDE_DIR +- NAME asio.hpp +- HINTS ${PROJECT_SOURCE_DIR}/asio/asio/include +- $ENV{HOME}/local/include +- /opt/local/include +- /usr/local/include +- /usr/include) +- ++ find_package(Asio CONFIG REQUIRED) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DASIO_STANDALONE") +- +-endif () +- +-if (NOT ASIO_INCLUDE_DIR) +- message(FATAL_ERROR "Can't find ASIO header files") +-else () +- message(STATUS "ASIO include path: " ${ASIO_INCLUDE_DIR}) ++ set(ASIO_DEP asio::asio) + endif () + + + # === Includes === + include_directories(BEFORE ./) +-include_directories(BEFORE ${ASIO_INCLUDE_DIR}) + include_directories(BEFORE ${PROJECT_SOURCE_DIR}/include) + include_directories(BEFORE ${PROJECT_SOURCE_DIR}/include/libnuraft) + include_directories(BEFORE ${PROJECT_SOURCE_DIR}/examples) +@@ -81,20 +64,10 @@ endif() + if (NOT WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pessimizing-move") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") +- if (APPLE) +- include_directories(BEFORE /usr/local/opt/openssl/include) +- link_directories(/usr/local/opt/openssl/lib) +- else() +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") +- endif () +- + else () + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd5045 /wd4571 /wd4774 /wd4820 /wd5039 /wd4626 /wd4625 /wd5026 /wd5027 /wd4623 /wd4996 /wd4530 /wd4267 /wd4244 /W3") + message(STATUS "---- WIN32 ----") +- set(DISABLE_SSL 1) + endif () + + # === Disable SSL === +@@ -250,6 +223,7 @@ set(RAFT_CORE + ${ROOT_SRC}/stat_mgr.cxx + ) + add_library(RAFT_CORE_OBJ OBJECT ${RAFT_CORE}) ++target_link_libraries(RAFT_CORE_OBJ ${ASIO_DEP} openssl::openssl) + + set(STATIC_LIB_SRC + $) +@@ -257,54 +231,11 @@ set(STATIC_LIB_SRC + # === Executables === + set(LIBRARY_NAME "nuraft") + +-add_library(static_lib ${STATIC_LIB_SRC}) +-set_target_properties(static_lib PROPERTIES OUTPUT_NAME ${LIBRARY_NAME} CLEAN_DIRECT_OUTPUT 1) +- +-add_library(shared_lib SHARED ${STATIC_LIB_SRC}) +-set_target_properties(shared_lib PROPERTIES OUTPUT_NAME ${LIBRARY_NAME} CLEAN_DIRECT_OUTPUT 1) +-if (APPLE) +- target_link_libraries(shared_lib ${LIBRARIES}) +-endif () +- +-if (WIN32) +- set(LIBRARY_OUTPUT_NAME "${LIBRARY_NAME}.lib") +-else () +- set(LIBRARY_OUTPUT_NAME "lib${LIBRARY_NAME}.a") +-endif () +-message(STATUS "Output library file name: ${LIBRARY_OUTPUT_NAME}") +- +-# === Examples === +-add_subdirectory("${PROJECT_SOURCE_DIR}/examples") ++add_library(nuraft ${STATIC_LIB_SRC}) ++target_link_libraries(nuraft ${ASIO_DEP} openssl::openssl) + + + # === Tests === +-add_subdirectory("${PROJECT_SOURCE_DIR}/tests") +- +- +-if (CODE_COVERAGE GREATER 0) +- set(CODE_COVERAGE_DEPS +- raft_server_test +- failure_test +- asio_service_test +- buffer_test +- serialization_test +- timer_test +- strfmt_test +- stat_mgr_test +- ) +- +- # lcov +- SETUP_TARGET_FOR_COVERAGE( +- NAME raft_cov +- EXECUTABLE ./runtests.sh +- DEPENDENCIES ${CODE_COVERAGE_DEPS} +- ) +-endif() +- +- +-# === Install Targets === +-install(TARGETS static_lib ARCHIVE DESTINATION lib) +-install(TARGETS shared_lib LIBRARY DESTINATION lib) ++install(TARGETS nuraft ARCHIVE DESTINATION lib) ++install(TARGETS nuraft LIBRARY DESTINATION lib) + install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/libnuraft DESTINATION include) +- +- diff --git a/recipes/nuraft/all/patches/1001-cmake_patches.patch b/recipes/nuraft/all/patches/1001-cmake_patches.patch new file mode 100644 index 0000000000000..6d5e619fc2252 --- /dev/null +++ b/recipes/nuraft/all/patches/1001-cmake_patches.patch @@ -0,0 +1,151 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 55d29a8..3af27be 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,6 @@ + cmake_minimum_required(VERSION 3.5) + project(NuRaft VERSION 1.0.0 LANGUAGES CXX) ++set (CMAKE_CXX_STANDARD 11) + + # === Build type (default: RelWithDebInfo, O2) =========== + if (NOT CMAKE_BUILD_TYPE) +@@ -26,41 +27,23 @@ endif() + + + # === Find ASIO === +-if (BOOST_INCLUDE_PATH AND BOOST_LIBRARY_PATH) ++find_package(OpenSSL CONFIG REQUIRED) ++find_package(Boost CONFIG) ++if (Boost_FOUND) + # If Boost path (both include and library) is given, + # use Boost's ASIO. +- message(STATUS "Boost include path: " ${BOOST_INCLUDE_PATH}) +- message(STATUS "Boost library path: " ${BOOST_LIBRARY_PATH}) +- + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DUSE_BOOST_ASIO") +- +- set(ASIO_INCLUDE_DIR ${BOOST_INCLUDE_PATH}) +- set(LIBBOOST_SYSTEM "${BOOST_LIBRARY_PATH}/libboost_system.a") +- ++ set(ASIO_DEP boost::boost) + else () + # If not, ASIO standalone mode. +- FIND_PATH(ASIO_INCLUDE_DIR +- NAME asio.hpp +- HINTS ${PROJECT_SOURCE_DIR}/asio/asio/include +- $ENV{HOME}/local/include +- /opt/local/include +- /usr/local/include +- /usr/include) +- ++ find_package(Asio CONFIG REQUIRED) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DASIO_STANDALONE") +- +-endif () +- +-if (NOT ASIO_INCLUDE_DIR) +- message(FATAL_ERROR "Can't find ASIO header files") +-else () +- message(STATUS "ASIO include path: " ${ASIO_INCLUDE_DIR}) ++ set(ASIO_DEP asio::asio) + endif () + + + # === Includes === + include_directories(BEFORE ./) +-include_directories(BEFORE ${ASIO_INCLUDE_DIR}) + include_directories(BEFORE ${PROJECT_SOURCE_DIR}/include) + include_directories(BEFORE ${PROJECT_SOURCE_DIR}/include/libnuraft) + include_directories(BEFORE ${PROJECT_SOURCE_DIR}/examples) +@@ -81,24 +64,11 @@ endif() + if (NOT WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-pessimizing-move") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") +- if (APPLE) +- include_directories(BEFORE +- /usr/local/opt/openssl/include +- ) +- link_directories( +- /usr/local/opt/openssl/lib +- ) +- else() +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pthread") +- endif () + + else () + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd5045 /wd4571 /wd4774 /wd4820 /wd5039 /wd4626 /wd4625 /wd5026 /wd5027 /wd4623 /wd4996 /wd4530 /wd4267 /wd4244 /W3") + message(STATUS "---- WIN32 ----") +- set(DISABLE_SSL 1) + endif () + + # === Disable SSL === +@@ -254,6 +224,7 @@ set(RAFT_CORE + ${ROOT_SRC}/stat_mgr.cxx + ) + add_library(RAFT_CORE_OBJ OBJECT ${RAFT_CORE}) ++target_link_libraries(RAFT_CORE_OBJ ${ASIO_DEP} openssl::openssl) + + set(STATIC_LIB_SRC + $) +@@ -261,54 +232,11 @@ set(STATIC_LIB_SRC + # === Executables === + set(LIBRARY_NAME "nuraft") + +-add_library(static_lib ${STATIC_LIB_SRC}) +-set_target_properties(static_lib PROPERTIES OUTPUT_NAME ${LIBRARY_NAME} CLEAN_DIRECT_OUTPUT 1) +- +-add_library(shared_lib SHARED ${STATIC_LIB_SRC}) +-set_target_properties(shared_lib PROPERTIES OUTPUT_NAME ${LIBRARY_NAME} CLEAN_DIRECT_OUTPUT 1) +-if (APPLE) +- target_link_libraries(shared_lib ${LIBRARIES}) +-endif () +- +-if (WIN32) +- set(LIBRARY_OUTPUT_NAME "${LIBRARY_NAME}.lib") +-else () +- set(LIBRARY_OUTPUT_NAME "lib${LIBRARY_NAME}.a") +-endif () +-message(STATUS "Output library file name: ${LIBRARY_OUTPUT_NAME}") +- +-# === Examples === +-add_subdirectory("${PROJECT_SOURCE_DIR}/examples") ++add_library(nuraft ${STATIC_LIB_SRC}) ++target_link_libraries(nuraft ${ASIO_DEP} openssl::openssl) + + + # === Tests === +-add_subdirectory("${PROJECT_SOURCE_DIR}/tests") +- +- +-if (CODE_COVERAGE GREATER 0) +- set(CODE_COVERAGE_DEPS +- raft_server_test +- failure_test +- asio_service_test +- buffer_test +- serialization_test +- timer_test +- strfmt_test +- stat_mgr_test +- ) +- +- # lcov +- SETUP_TARGET_FOR_COVERAGE( +- NAME raft_cov +- EXECUTABLE ./runtests.sh +- DEPENDENCIES ${CODE_COVERAGE_DEPS} +- ) +-endif() +- +- +-# === Install Targets === +-install(TARGETS static_lib ARCHIVE DESTINATION lib) +-install(TARGETS shared_lib LIBRARY DESTINATION lib) ++install(TARGETS nuraft ARCHIVE DESTINATION lib) ++install(TARGETS nuraft LIBRARY DESTINATION lib) + install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/libnuraft DESTINATION include) +- +- diff --git a/recipes/nuraft/all/test_package/CMakeLists.txt b/recipes/nuraft/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d722680750dcd --- /dev/null +++ b/recipes/nuraft/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(nuraft CONFIG REQUIRED) + +add_executable(${PROJECT_NAME}) +target_sources(${PROJECT_NAME} PRIVATE test_package.cpp) +target_link_libraries(${PROJECT_NAME} nuraft::nuraft) +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) diff --git a/recipes/nuraft/all/test_package/conanfile.py b/recipes/nuraft/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a81309f2fe1fc --- /dev/null +++ b/recipes/nuraft/all/test_package/conanfile.py @@ -0,0 +1,18 @@ +import os +from conan import ConanFile +from conans import CMake +from conan.tools.build import cross_building + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/nuraft/all/test_package/test_package.cpp b/recipes/nuraft/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..bf1cb8aaed19b --- /dev/null +++ b/recipes/nuraft/all/test_package/test_package.cpp @@ -0,0 +1,61 @@ +#include +#include + +struct ex_logger : ::nuraft::logger { + void set_level(int) override {} + void debug(const std::string&) override {} + void info(const std::string&) override {} + void warn(const std::string&) override {} + void err(const std::string& log_line) override { + std::cout << log_line << std::endl; + } + + void put_details(int, const char*, const char*, size_t, + const std::string&) override {} +}; + +class echo_state_machine : public nuraft::state_machine { + nuraft::ulong last_commit_idx_; + + public: + echo_state_machine() : last_commit_idx_(0) {} + + nuraft::ptr commit(const nuraft::ulong log_idx, + nuraft::buffer&) override { + last_commit_idx_ = log_idx; + return nullptr; + } + nuraft::ptr pre_commit(const nuraft::ulong, + nuraft::buffer&) override { + return nullptr; + } + void rollback(const nuraft::ulong, nuraft::buffer&) override {} + void save_snapshot_data(nuraft::snapshot&, const nuraft::ulong, + nuraft::buffer&) override {} + bool apply_snapshot(nuraft::snapshot&) override { return true; } + int read_snapshot_data(nuraft::snapshot&, const nuraft::ulong, + nuraft::buffer&) override { + return 0; + } + nuraft::ptr last_snapshot() override { return nullptr; } + void create_snapshot(nuraft::snapshot&, + nuraft::async_result::handler_type&) override {} + nuraft::ulong last_commit_index() override { return last_commit_idx_; } +}; + +int main(int argc, char** argv) { + // State machine. + nuraft::ptr smachine( + nuraft::cs_new()); + + // Parameters. + nuraft::raft_params params; + + // ASIO service. + nuraft::ptr l = nuraft::cs_new(); + nuraft::ptr asio_svc_ = + nuraft::cs_new(); + nuraft::ptr listener( + asio_svc_->create_rpc_listener((ushort)(9001), l)); + return 0; +} diff --git a/recipes/nuraft/config.yml b/recipes/nuraft/config.yml new file mode 100644 index 0000000000000..2d136f3fe768d --- /dev/null +++ b/recipes/nuraft/config.yml @@ -0,0 +1,5 @@ +versions: + "2.1.0": + folder: all + "2.0.0": + folder: all diff --git a/recipes/nvtx/all/conanfile.py b/recipes/nvtx/all/conanfile.py index ff701e48fe766..fbe722ba0c892 100644 --- a/recipes/nvtx/all/conanfile.py +++ b/recipes/nvtx/all/conanfile.py @@ -1,11 +1,17 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" + class NVTXConan(ConanFile): name = "nvtx" - description = "The NVIDIA Tools Extension SDK (NVTX) is a C-based API for annotating events, code ranges, and resources in your applications." + description = ( + "The NVIDIA Tools Extension SDK (NVTX) is a C-based API for annotating " + "events, code ranges, and resources in your applications." + ) homepage = "https://github.com/NVIDIA/NVTX" url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" @@ -13,23 +19,25 @@ class NVTXConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - self.copy( - pattern="*.h", - dst=os.path.join(self.package_folder, "include"), - src=os.path.join(self._source_subfolder, "c", "include")) + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "c", "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("dl") diff --git a/recipes/nvtx/all/test_package/CMakeLists.txt b/recipes/nvtx/all/test_package/CMakeLists.txt index b35a6d3bc5e81..eae79b2f4aa39 100644 --- a/recipes/nvtx/all/test_package/CMakeLists.txt +++ b/recipes/nvtx/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(nvtx REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} nvtx::nvtx) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE nvtx::nvtx) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/nvtx/all/test_package/conanfile.py b/recipes/nvtx/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/nvtx/all/test_package/conanfile.py +++ b/recipes/nvtx/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/nvtx/all/test_v1_package/CMakeLists.txt b/recipes/nvtx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/nvtx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/nvtx/all/test_v1_package/conanfile.py b/recipes/nvtx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/nvtx/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/oatpp-libressl/all/CMakeLists.txt b/recipes/oatpp-libressl/all/CMakeLists.txt deleted file mode 100644 index 7b920d87ae627..0000000000000 --- a/recipes/oatpp-libressl/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) # Mininum as required oatpp -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/oatpp-libressl/all/conanfile.py b/recipes/oatpp-libressl/all/conanfile.py index 64ed19cdac443..6eec475cde13d 100644 --- a/recipes/oatpp-libressl/all/conanfile.py +++ b/recipes/oatpp-libressl/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" + class OatppLibresslConan(ConanFile): name = "oatpp-libressl" @@ -11,21 +17,16 @@ class OatppLibresslConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "oat++ libressl library" topics = ("oat++", "oatpp", "libressl") - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -33,60 +34,75 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("oatpp-libressl can not be built as shared library on Windows") - - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("oatpp-libressl requires GCC >=5") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("oatpp/" + self.version) - self.requires("libressl/3.2.1") + self.requires(f"oatpp/{self.version}") + self.requires("libressl/3.5.3") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) - def _configure_cmake(self): - if self._cmake: - return self._cmake + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") - self._cmake = CMake(self) - self._cmake.definitions["OATPP_BUILD_TESTS"] = False - self._cmake.definitions["OATPP_MODULES_LOCATION"] = "INSTALLED" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=5") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OATPP_BUILD_TESTS"] = False + tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "oatpp-libressl" - self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-libressl" self.cpp_info.set_property("cmake_file_name", "oatpp-libressl") - self.cpp_info.names["cmake_find_package"] = "oatpp" - self.cpp_info.names["cmake_find_package_multi"] = "oatpp" self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-libressl") - self.cpp_info.components["_oatpp-libressl"].names["cmake_find_package"] = "oatpp-libressl" - self.cpp_info.components["_oatpp-libressl"].names["cmake_find_package_multi"] = "oatpp-libressl" - self.cpp_info.components["_oatpp-libressl"].set_property("cmake_target_name", "oatpp::oatpp-libressl") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-libressl"].includedirs = [ - os.path.join("include", "oatpp-{}".format(self.version), "oatpp-libressl") + os.path.join("include", f"oatpp-{self.version}", "oatpp-libressl") ] - self.cpp_info.components["_oatpp-libressl"].libdirs = [os.path.join("lib", "oatpp-{}".format(self.version))] + self.cpp_info.components["_oatpp-libressl"].libdirs = [os.path.join("lib", f"oatpp-{self.version}")] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_oatpp-libressl"].bindirs = [os.path.join("bin", f"oatpp-{self.version}")] + else: + self.cpp_info.components["_oatpp-libressl"].bindirs = [] self.cpp_info.components["_oatpp-libressl"].libs = ["oatpp-libressl"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_oatpp-libressl"].system_libs = ["pthread"] + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "oatpp-libressl" + self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-libressl" + self.cpp_info.names["cmake_find_package"] = "oatpp" + self.cpp_info.names["cmake_find_package_multi"] = "oatpp" + self.cpp_info.components["_oatpp-libressl"].names["cmake_find_package"] = "oatpp-libressl" + self.cpp_info.components["_oatpp-libressl"].names["cmake_find_package_multi"] = "oatpp-libressl" + self.cpp_info.components["_oatpp-libressl"].set_property("cmake_target_name", "oatpp::oatpp-libressl") self.cpp_info.components["_oatpp-libressl"].requires = ["oatpp::oatpp", "libressl::libressl"] diff --git a/recipes/oatpp-libressl/all/test_package/CMakeLists.txt b/recipes/oatpp-libressl/all/test_package/CMakeLists.txt index 704e2b23f267b..3cc329996c9b0 100644 --- a/recipes/oatpp-libressl/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-libressl/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(oatpp-libressl-test CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(oatpp-libressl REQUIRED CONFIG) -find_package(oatpp-libressl REQUIRED) - -add_executable(oatpp-libressl-test oatpp-libressl-test.cpp) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - -target_link_libraries(oatpp-libressl-test PRIVATE oatpp::oatpp-libressl) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-libressl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-libressl/all/test_package/conanfile.py b/recipes/oatpp-libressl/all/test_package/conanfile.py index d63ea54eb1d46..0a6bc68712d90 100644 --- a/recipes/oatpp-libressl/all/test_package/conanfile.py +++ b/recipes/oatpp-libressl/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class OatppLibresslTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "oatpp-libressl-test"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oatpp-libressl/all/test_package/oatpp-libressl-test.cpp b/recipes/oatpp-libressl/all/test_package/test_package.cpp similarity index 100% rename from recipes/oatpp-libressl/all/test_package/oatpp-libressl-test.cpp rename to recipes/oatpp-libressl/all/test_package/test_package.cpp diff --git a/recipes/oatpp-libressl/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-libressl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..07afded94f59c --- /dev/null +++ b/recipes/oatpp-libressl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(oatpp-libressl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-libressl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-libressl/all/test_v1_package/conanfile.py b/recipes/oatpp-libressl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/oatpp-libressl/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/oatpp-openssl/all/CMakeLists.txt b/recipes/oatpp-openssl/all/CMakeLists.txt deleted file mode 100644 index 7b920d87ae627..0000000000000 --- a/recipes/oatpp-openssl/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) # Mininum as required oatpp -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/oatpp-openssl/all/conanfile.py b/recipes/oatpp-openssl/all/conanfile.py index b250393d708cc..d109d1b7545bb 100644 --- a/recipes/oatpp-openssl/all/conanfile.py +++ b/recipes/oatpp-openssl/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" + class OatppOpenSSLConan(ConanFile): name = "oatpp-openssl" @@ -11,21 +17,16 @@ class OatppOpenSSLConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "Oat++ OpenSSL library" topics = ("oat++", "oatpp", "openssl") - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -33,60 +34,75 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("oatpp-openssl can not be built as shared library on Windows") - - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("oatpp-openssl requires GCC >=5") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("oatpp/" + self.version) - self.requires("openssl/3.0.1") + self.requires(f"oatpp/{self.version}") + self.requires("openssl/3.0.5") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) - def _configure_cmake(self): - if self._cmake: - return self._cmake + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") - self._cmake = CMake(self) - self._cmake.definitions["OATPP_BUILD_TESTS"] = False - self._cmake.definitions["OATPP_MODULES_LOCATION"] = "INSTALLED" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=5") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OATPP_BUILD_TESTS"] = False + tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "oatpp-openssl" - self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-openssl" self.cpp_info.set_property("cmake_file_name", "oatpp-openssl") - self.cpp_info.names["cmake_find_package"] = "oatpp" - self.cpp_info.names["cmake_find_package_multi"] = "oatpp" self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-openssl") - self.cpp_info.components["_oatpp-openssl"].names["cmake_find_package"] = "oatpp-openssl" - self.cpp_info.components["_oatpp-openssl"].names["cmake_find_package_multi"] = "oatpp-openssl" - self.cpp_info.components["_oatpp-openssl"].set_property("cmake_target_name", "oatpp::oatpp-openssl") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-openssl"].includedirs = [ - os.path.join("include", "oatpp-{}".format(self.version), "oatpp-openssl") + os.path.join("include", f"oatpp-{self.version}", "oatpp-openssl") ] - self.cpp_info.components["_oatpp-openssl"].libdirs = [os.path.join("lib", "oatpp-{}".format(self.version))] + self.cpp_info.components["_oatpp-openssl"].libdirs = [os.path.join("lib", f"oatpp-{self.version}")] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_oatpp-openssl"].bindirs = [os.path.join("bin", f"oatpp-{self.version}")] + else: + self.cpp_info.components["_oatpp-openssl"].bindirs = [] self.cpp_info.components["_oatpp-openssl"].libs = ["oatpp-openssl"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_oatpp-openssl"].system_libs = ["pthread"] + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "oatpp-openssl" + self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-openssl" + self.cpp_info.names["cmake_find_package"] = "oatpp" + self.cpp_info.names["cmake_find_package_multi"] = "oatpp" + self.cpp_info.components["_oatpp-openssl"].names["cmake_find_package"] = "oatpp-openssl" + self.cpp_info.components["_oatpp-openssl"].names["cmake_find_package_multi"] = "oatpp-openssl" + self.cpp_info.components["_oatpp-openssl"].set_property("cmake_target_name", "oatpp::oatpp-openssl") self.cpp_info.components["_oatpp-openssl"].requires = ["oatpp::oatpp", "openssl::openssl"] diff --git a/recipes/oatpp-openssl/all/test_package/CMakeLists.txt b/recipes/oatpp-openssl/all/test_package/CMakeLists.txt index b28526769f48c..716aedd7390f1 100644 --- a/recipes/oatpp-openssl/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-openssl/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(oatpp-openssl REQUIRED) +find_package(oatpp-openssl REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-openssl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-openssl/all/test_package/conanfile.py b/recipes/oatpp-openssl/all/test_package/conanfile.py index a77f6e7a20977..0a6bc68712d90 100644 --- a/recipes/oatpp-openssl/all/test_package/conanfile.py +++ b/recipes/oatpp-openssl/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class OatppOpenSSLTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oatpp-openssl/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-openssl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..07d783bdbcaec --- /dev/null +++ b/recipes/oatpp-openssl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(oatpp-openssl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-openssl) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-openssl/all/test_v1_package/conanfile.py b/recipes/oatpp-openssl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/oatpp-openssl/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/oatpp-postgresql/all/CMakeLists.txt b/recipes/oatpp-postgresql/all/CMakeLists.txt deleted file mode 100644 index d32836cbae4aa..0000000000000 --- a/recipes/oatpp-postgresql/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/oatpp-postgresql/all/conandata.yml b/recipes/oatpp-postgresql/all/conandata.yml index dc5c0e7bf5a99..3a58631f67a6d 100644 --- a/recipes/oatpp-postgresql/all/conandata.yml +++ b/recipes/oatpp-postgresql/all/conandata.yml @@ -11,10 +11,8 @@ sources: patches: "1.3.0": - patch_file: "patches/1.3.0/01-add-bigobj.patch" - base_path: "source_subfolder" "1.2.5": - patch_file: "patches/1.2.5/01-fix-windows-build.patch" - base_path: "source_subfolder" - # patch_type: portability - # patch_source: https://github.com/oatpp/oatpp-postgresql/pull/8 - # patch_description: Fix build error in Windows. + patch_description: Fix build error in Windows. + patch_type: portability + patch_source: https://github.com/oatpp/oatpp-postgresql/pull/8 diff --git a/recipes/oatpp-postgresql/all/conanfile.py b/recipes/oatpp-postgresql/all/conanfile.py index c223c73c7d01d..5aa80c1777d6d 100644 --- a/recipes/oatpp-postgresql/all/conanfile.py +++ b/recipes/oatpp-postgresql/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class OatppPostgresqlConan(ConanFile): @@ -12,25 +17,19 @@ class OatppPostgresqlConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "oat++ PostgreSQL library" topics = ("oat", "postgresql", "orm", "database") - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake", "cmake_find_package" - - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,62 +37,76 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + try: + del self.options.fPIC + except Exception: + pass - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("oatpp-postgresql can not be built as shared library on Windows") - - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("oatpp-postgresql requires GCC >=5") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("oatpp/{}".format(self.version)) - self.requires("libpq/13.4") + self.requires(f"oatpp/{self.version}") + self.requires("libpq/14.5") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) - def _configure_cmake(self): - if self._cmake: - return self._cmake + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") - self._cmake = CMake(self) - self._cmake.definitions["OATPP_BUILD_TESTS"] = False - self._cmake.definitions["OATPP_MODULES_LOCATION"] = "INSTALLED" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=5") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OATPP_BUILD_TESTS"] = False + tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "oatpp-postgresql" - self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-postgresql" self.cpp_info.set_property("cmake_file_name", "oatpp-postgresql") - self.cpp_info.names["cmake_find_package"] = "oatpp" - self.cpp_info.names["cmake_find_package_multi"] = "oatpp" self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-postgresql") - self.cpp_info.components["_oatpp-postgresql"].names["cmake_find_package"] = "oatpp-postgresql" - self.cpp_info.components["_oatpp-postgresql"].names["cmake_find_package_multi"] = "oatpp-postgresql" - self.cpp_info.components["_oatpp-postgresql"].set_property("cmake_target_name", "oatpp::oatpp-postgresql") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-postgresql"].includedirs = [ - os.path.join("include", "oatpp-{}".format(self.version), "oatpp-postgresql") + os.path.join("include", f"oatpp-{self.version}", "oatpp-postgresql") ] - self.cpp_info.components["_oatpp-postgresql"].libdirs = [os.path.join("lib", "oatpp-{}".format(self.version))] + self.cpp_info.components["_oatpp-postgresql"].libdirs = [os.path.join("lib", f"oatpp-{self.version}")] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_oatpp-postgresql"].bindirs = [os.path.join("bin", f"oatpp-{self.version}")] + else: + self.cpp_info.components["_oatpp-postgresql"].bindirs = [] self.cpp_info.components["_oatpp-postgresql"].libs = ["oatpp-postgresql"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_oatpp-postgresql"].system_libs = ["pthread"] + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "oatpp-postgresql" + self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-postgresql" + self.cpp_info.names["cmake_find_package"] = "oatpp" + self.cpp_info.names["cmake_find_package_multi"] = "oatpp" + self.cpp_info.components["_oatpp-postgresql"].names["cmake_find_package"] = "oatpp-postgresql" + self.cpp_info.components["_oatpp-postgresql"].names["cmake_find_package_multi"] = "oatpp-postgresql" + self.cpp_info.components["_oatpp-postgresql"].set_property("cmake_target_name", "oatpp::oatpp-postgresql") self.cpp_info.components["_oatpp-postgresql"].requires = ["oatpp::oatpp", "libpq::libpq"] diff --git a/recipes/oatpp-postgresql/all/test_package/CMakeLists.txt b/recipes/oatpp-postgresql/all/test_package/CMakeLists.txt index 6528f26999838..3e6651b60950e 100644 --- a/recipes/oatpp-postgresql/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-postgresql/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(oatpp-postgresql REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-postgresql) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-postgresql/all/test_package/conanfile.py b/recipes/oatpp-postgresql/all/test_package/conanfile.py index 30f0822166f0d..0a6bc68712d90 100644 --- a/recipes/oatpp-postgresql/all/test_package/conanfile.py +++ b/recipes/oatpp-postgresql/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - -class OatppPostgresqlTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) - - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oatpp-postgresql/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-postgresql/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..5d0c80f735ffb --- /dev/null +++ b/recipes/oatpp-postgresql/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(oatpp-postgresql REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-postgresql) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-postgresql/all/test_v1_package/conanfile.py b/recipes/oatpp-postgresql/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/oatpp-postgresql/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/oatpp-sqlite/all/CMakeLists.txt b/recipes/oatpp-sqlite/all/CMakeLists.txt deleted file mode 100644 index 1b8db564f6044..0000000000000 --- a/recipes/oatpp-sqlite/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/oatpp-sqlite/all/conanfile.py b/recipes/oatpp-sqlite/all/conanfile.py index 82525eb53e8d9..75896ed5f3e71 100644 --- a/recipes/oatpp-sqlite/all/conanfile.py +++ b/recipes/oatpp-sqlite/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" class OatppsqliteConan(ConanFile): @@ -12,21 +17,16 @@ class OatppsqliteConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "oat++ SQLite library" topics = ("oat++", "oatpp", "sqlite") - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt" - - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -34,60 +34,73 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + def layout(self): + cmake_layout(self, src_folder="src") - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("oatpp-sqlite can not be built as shared library on Windows") + def requirements(self): + self.requires(f"oatpp/{self.version}") + self.requires("sqlite3/3.39.4") - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("oatpp-sqlite requires GCC >=5") + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) - def requirements(self): - self.requires("oatpp/" + self.version) - self.requires("sqlite3/3.37.0") + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=5") - def _configure_cmake(self): - if self._cmake: - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - self._cmake = CMake(self) - self._cmake.definitions["OATPP_BUILD_TESTS"] = False - self._cmake.definitions["OATPP_MODULES_LOCATION"] = "INSTALLED" - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OATPP_BUILD_TESTS"] = False + tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "oatpp-sqlite" - self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-sqlite" self.cpp_info.set_property("cmake_file_name", "oatpp-sqlite") - self.cpp_info.names["cmake_find_package"] = "oatpp" - self.cpp_info.names["cmake_find_package_multi"] = "oatpp" self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-sqlite") - self.cpp_info.components["_oatpp-sqlite"].names["cmake_find_package"] = "oatpp-sqlite" - self.cpp_info.components["_oatpp-sqlite"].names["cmake_find_package_multi"] = "oatpp-sqlite" - self.cpp_info.components["_oatpp-sqlite"].set_property("cmake_target_name", "oatpp::oatpp-sqlite") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-sqlite"].includedirs = [ - os.path.join("include", "oatpp-{}".format(self.version), "oatpp-sqlite") + os.path.join("include", f"oatpp-{self.version}", "oatpp-sqlite") ] - self.cpp_info.components["_oatpp-sqlite"].libdirs = [os.path.join("lib", "oatpp-{}".format(self.version))] + self.cpp_info.components["_oatpp-sqlite"].libdirs = [os.path.join("lib", f"oatpp-{self.version}")] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_oatpp-sqlite"].bindirs = [os.path.join("bin", f"oatpp-{self.version}")] + else: + self.cpp_info.components["_oatpp-sqlite"].bindirs = [] self.cpp_info.components["_oatpp-sqlite"].libs = ["oatpp-sqlite"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_oatpp-sqlite"].system_libs = ["pthread"] + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "oatpp-sqlite" + self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-sqlite" + self.cpp_info.names["cmake_find_package"] = "oatpp" + self.cpp_info.names["cmake_find_package_multi"] = "oatpp" + self.cpp_info.components["_oatpp-sqlite"].names["cmake_find_package"] = "oatpp-sqlite" + self.cpp_info.components["_oatpp-sqlite"].names["cmake_find_package_multi"] = "oatpp-sqlite" + self.cpp_info.components["_oatpp-sqlite"].set_property("cmake_target_name", "oatpp::oatpp-sqlite") self.cpp_info.components["_oatpp-sqlite"].requires = ["oatpp::oatpp", "sqlite3::sqlite3"] diff --git a/recipes/oatpp-sqlite/all/test_package/CMakeLists.txt b/recipes/oatpp-sqlite/all/test_package/CMakeLists.txt index 8b55c43a919b9..ca51c6a39660d 100644 --- a/recipes/oatpp-sqlite/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-sqlite/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(oatpp-sqlite REQUIRED) +find_package(oatpp-sqlite REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-sqlite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-sqlite/all/test_package/conanfile.py b/recipes/oatpp-sqlite/all/test_package/conanfile.py index 68d108b091ab2..0a6bc68712d90 100644 --- a/recipes/oatpp-sqlite/all/test_package/conanfile.py +++ b/recipes/oatpp-sqlite/all/test_package/conanfile.py @@ -1,21 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - -class OatppSqliteTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) - # Current dir is "test_package/build/" and CMakeLists.txt is - # in "test_package" cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) - - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oatpp-sqlite/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-sqlite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..ec8289a60ed9c --- /dev/null +++ b/recipes/oatpp-sqlite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(oatpp-sqlite REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-sqlite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-sqlite/all/test_v1_package/conanfile.py b/recipes/oatpp-sqlite/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/oatpp-sqlite/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/oatpp-swagger/all/CMakeLists.txt b/recipes/oatpp-swagger/all/CMakeLists.txt deleted file mode 100644 index d32836cbae4aa..0000000000000 --- a/recipes/oatpp-swagger/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/oatpp-swagger/all/conanfile.py b/recipes/oatpp-swagger/all/conanfile.py index 862bd63348b83..0f264dec12f02 100644 --- a/recipes/oatpp-swagger/all/conanfile.py +++ b/recipes/oatpp-swagger/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" + class OatppSwaggerConan(ConanFile): name = "oatpp-swagger" @@ -11,21 +17,16 @@ class OatppSwaggerConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "oat++ Swagger library" topics = ("oat++", "oatpp", "swagger") - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt" - - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -33,66 +34,80 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + try: + del self.options.fPIC + except Exception: + pass - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("oatpp-swagger can not be built as shared library on Windows") - - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("oatpp-swagger requires GCC >=5") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("oatpp/" + self.version) + self.requires(f"oatpp/{self.version}") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") - def _configure_cmake(self): - if self._cmake: - return self._cmake + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=5") - self._cmake = CMake(self) - self._cmake.definitions["OATPP_BUILD_TESTS"] = False - self._cmake.definitions["OATPP_MODULES_LOCATION"] = "INSTALLED" - if tools.Version(self.version) >= "1.3.0" and self.settings.compiler == "Visual Studio": - self._cmake.definitions["OATPP_MSVC_LINK_STATIC_RUNTIME"] = self.settings.compiler.runtime in ["MT", "MTd"] - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OATPP_BUILD_TESTS"] = False + tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + if Version(self.version) >= "1.3.0" and is_msvc(self): + tc.variables["OATPP_MSVC_LINK_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "oatpp-swagger" - self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-swagger" self.cpp_info.set_property("cmake_file_name", "oatpp-swagger") - self.cpp_info.names["cmake_find_package"] = "oatpp" - self.cpp_info.names["cmake_find_package_multi"] = "oatpp" self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-swagger") - self.cpp_info.components["_oatpp-swagger"].names["cmake_find_package"] = "oatpp-swagger" - self.cpp_info.components["_oatpp-swagger"].names["cmake_find_package_multi"] = "oatpp-swagger" - self.cpp_info.components["_oatpp-swagger"].set_property("cmake_target_name", "oatpp::oatpp-swagger") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-swagger"].includedirs = [ - os.path.join("include", "oatpp-{}".format(self.version), "oatpp-swagger") + os.path.join("include", f"oatpp-{self.version}", "oatpp-swagger") ] - self.cpp_info.components["_oatpp-swagger"].libdirs = [os.path.join("lib", "oatpp-{}".format(self.version))] + self.cpp_info.components["_oatpp-swagger"].libdirs = [os.path.join("lib", f"oatpp-{self.version}")] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_oatpp-swagger"].bindirs = [os.path.join("bin", f"oatpp-{self.version}")] + else: + self.cpp_info.components["_oatpp-swagger"].bindirs = [] self.cpp_info.components["_oatpp-swagger"].libs = ["oatpp-swagger"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_oatpp-swagger"].system_libs = ["pthread"] - self.cpp_info.components["_oatpp-swagger"].requires = ["oatpp::oatpp"] # export env var - res_path = os.path.join(self.package_folder, "include", "oatpp-{}".format(self.version), "bin", "oatpp-swagger", "res") - self.output.info("Creating OATPP_SWAGGER_RES_PATH environment variable: {}".format(res_path)) - self.env_info.OATPP_SWAGGER_RES_PATH = res_path + res_path = os.path.join(self.package_folder, "include", f"oatpp-{self.version}", "bin", "oatpp-swagger", "res") self.runenv_info.prepend_path("OATPP_SWAGGER_RES_PATH", res_path) + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "oatpp-swagger" + self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-swagger" + self.cpp_info.names["cmake_find_package"] = "oatpp" + self.cpp_info.names["cmake_find_package_multi"] = "oatpp" + self.cpp_info.components["_oatpp-swagger"].names["cmake_find_package"] = "oatpp-swagger" + self.cpp_info.components["_oatpp-swagger"].names["cmake_find_package_multi"] = "oatpp-swagger" + self.cpp_info.components["_oatpp-swagger"].set_property("cmake_target_name", "oatpp::oatpp-swagger") + self.cpp_info.components["_oatpp-swagger"].requires = ["oatpp::oatpp"] + self.env_info.OATPP_SWAGGER_RES_PATH = res_path diff --git a/recipes/oatpp-swagger/all/test_package/CMakeLists.txt b/recipes/oatpp-swagger/all/test_package/CMakeLists.txt index a30f4f9f8f19b..bc689c85dba9b 100644 --- a/recipes/oatpp-swagger/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-swagger/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(oatpp-swagger REQUIRED) +find_package(oatpp-swagger REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-swagger) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-swagger/all/test_package/conanfile.py b/recipes/oatpp-swagger/all/test_package/conanfile.py index 3cd3965663c04..0a6bc68712d90 100644 --- a/recipes/oatpp-swagger/all/test_package/conanfile.py +++ b/recipes/oatpp-swagger/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - -class OatppSwaggerTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) - - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oatpp-swagger/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-swagger/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9c51a16ee8925 --- /dev/null +++ b/recipes/oatpp-swagger/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(oatpp-swagger REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-swagger) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-swagger/all/test_v1_package/conanfile.py b/recipes/oatpp-swagger/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/oatpp-swagger/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/oatpp-websocket/all/CMakeLists.txt b/recipes/oatpp-websocket/all/CMakeLists.txt deleted file mode 100644 index d32836cbae4aa..0000000000000 --- a/recipes/oatpp-websocket/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/oatpp-websocket/all/conanfile.py b/recipes/oatpp-websocket/all/conanfile.py index 8aa50210c01f2..5a8cfa0227561 100644 --- a/recipes/oatpp-websocket/all/conanfile.py +++ b/recipes/oatpp-websocket/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" + class OatppWebSocketConan(ConanFile): name = "oatpp-websocket" @@ -11,21 +17,16 @@ class OatppWebSocketConan(ConanFile): license = "Apache-2.0" topics = ("oat++", "oatpp", "websocket") url = "https://github.com/conan-io/conan-center-index" - generators = "cmake", "cmake_find_package" - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - exports_sources = "CMakeLists.txt" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": @@ -33,62 +34,76 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass - def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - - if self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("oatpp-websocket can not be built as shared library on Windows") - - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": - raise ConanInvalidConfiguration("oatpp-websocket requires GCC >=5") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - # oatpp and oatpp-websocket are tightly coupled so use the same version - self.requires("oatpp/" + self.version) + self.requires(f"oatpp/{self.version}") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) - def _configure_cmake(self): - if self._cmake: - return self._cmake + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared library with msvc") - self._cmake = CMake(self) - self._cmake.definitions["OATPP_BUILD_TESTS"] = False - self._cmake.definitions["OATPP_MODULES_LOCATION"] = "INSTALLED" - if tools.Version(self.version) >= "1.3.0" and self.settings.compiler == "Visual Studio": - self._cmake.definitions["OATPP_MSVC_LINK_STATIC_RUNTIME"] = self.settings.compiler.runtime in ["MT", "MTd"] - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=5") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OATPP_BUILD_TESTS"] = False + tc.variables["OATPP_MODULES_LOCATION"] = "INSTALLED" + if Version(self.version) >= "1.3.0" and is_msvc(self): + tc.variables["OATPP_MSVC_LINK_STATIC_RUNTIME"] = is_msvc_static_runtime(self) + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.filenames["cmake_find_package"] = "oatpp-websocket" - self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-websocket" self.cpp_info.set_property("cmake_file_name", "oatpp-websocket") - self.cpp_info.names["cmake_find_package"] = "oatpp" - self.cpp_info.names["cmake_find_package_multi"] = "oatpp" self.cpp_info.set_property("cmake_target_name", "oatpp::oatpp-websocket") - self.cpp_info.components["_oatpp-websocket"].names["cmake_find_package"] = "oatpp-websocket" - self.cpp_info.components["_oatpp-websocket"].names["cmake_find_package_multi"] = "oatpp-websocket" - self.cpp_info.components["_oatpp-websocket"].set_property("cmake_target_name", "oatpp::oatpp-websocket") + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["_oatpp-websocket"].includedirs = [ - os.path.join("include", "oatpp-{}".format(self.version), "oatpp-websocket") + os.path.join("include", f"oatpp-{self.version}", "oatpp-websocket") ] - self.cpp_info.components["_oatpp-websocket"].libdirs = [os.path.join("lib", "oatpp-{}".format(self.version))] + self.cpp_info.components["_oatpp-websocket"].libdirs = [os.path.join("lib", f"oatpp-{self.version}")] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.components["_oatpp-websocket"].bindirs = [os.path.join("bin", f"oatpp-{self.version}")] + else: + self.cpp_info.components["_oatpp-websocket"].bindirs = [] self.cpp_info.components["_oatpp-websocket"].libs = ["oatpp-websocket"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_oatpp-websocket"].system_libs = ["pthread"] + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "oatpp-websocket" + self.cpp_info.filenames["cmake_find_package_multi"] = "oatpp-websocket" + self.cpp_info.names["cmake_find_package"] = "oatpp" + self.cpp_info.names["cmake_find_package_multi"] = "oatpp" + self.cpp_info.components["_oatpp-websocket"].names["cmake_find_package"] = "oatpp-websocket" + self.cpp_info.components["_oatpp-websocket"].names["cmake_find_package_multi"] = "oatpp-websocket" + self.cpp_info.components["_oatpp-websocket"].set_property("cmake_target_name", "oatpp::oatpp-websocket") self.cpp_info.components["_oatpp-websocket"].requires = ["oatpp::oatpp"] diff --git a/recipes/oatpp-websocket/all/test_package/CMakeLists.txt b/recipes/oatpp-websocket/all/test_package/CMakeLists.txt index 5ed80d9dbfced..7ec180083e3d0 100644 --- a/recipes/oatpp-websocket/all/test_package/CMakeLists.txt +++ b/recipes/oatpp-websocket/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(oatpp-websocket REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -# Use linking with components to properly test package_info() target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-websocket) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-websocket/all/test_package/conanfile.py b/recipes/oatpp-websocket/all/test_package/conanfile.py index 72a1273530ef4..0a6bc68712d90 100644 --- a/recipes/oatpp-websocket/all/test_package/conanfile.py +++ b/recipes/oatpp-websocket/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - -class OatppWebSocketTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oatpp-websocket/all/test_v1_package/CMakeLists.txt b/recipes/oatpp-websocket/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..6d7f1dc7c5bad --- /dev/null +++ b/recipes/oatpp-websocket/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(oatpp-websocket REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp-websocket) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/oatpp-websocket/all/test_v1_package/conanfile.py b/recipes/oatpp-websocket/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/oatpp-websocket/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/oatpp/all/conanfile.py b/recipes/oatpp/all/conanfile.py index 900a520d4fc5d..cae12177c9d72 100644 --- a/recipes/oatpp/all/conanfile.py +++ b/recipes/oatpp/all/conanfile.py @@ -7,7 +7,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class OatppConan(ConanFile): @@ -15,10 +15,11 @@ class OatppConan(ConanFile): description = "Modern Web Framework for C++" homepage = "https://github.com/oatpp/oatpp" license = "Apache-2.0" - topics = ("oat++", "oatpp", "web-framework") + topics = ("oat++", "web-framework") url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type", + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -34,23 +35,22 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - if self.info.settings.os == "Windows" and self.info.options.shared: + if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("oatpp can not be built as shared library on Windows") - if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": raise ConanInvalidConfiguration("oatpp requires GCC >=5") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -58,8 +58,6 @@ def generate(self): tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True if is_msvc(self) and Version(self.version) >= "1.3.0": tc.variables["OATPP_MSVC_LINK_STATIC_RUNTIME"] = is_msvc_static_runtime(self) - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): diff --git a/recipes/oatpp/all/test_package/conanfile.py b/recipes/oatpp/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/oatpp/all/test_package/conanfile.py +++ b/recipes/oatpp/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/oatpp/all/test_v1_package/CMakeLists.txt b/recipes/oatpp/all/test_v1_package/CMakeLists.txt index ec4b4a8dc1381..0d20897301b68 100644 --- a/recipes/oatpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/oatpp/all/test_v1_package/CMakeLists.txt @@ -1,17 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(oatpp REQUIRED CONFIG) - -if ("${oatpp_VERSION}" VERSION_GREATER_EQUAL "1.3.0") - add_executable(${PROJECT_NAME} ../test_package/test_package.cpp ../test_package/DeserializerTest_1_3_0.cpp) -elseif("${oatpp_VERSION}" VERSION_GREATER_EQUAL "1.1.0") - add_executable(${PROJECT_NAME} ../test_package/test_package.cpp ../test_package/DeserializerTest_1_1_0.cpp) -else() - add_executable(${PROJECT_NAME} ../test_package/test_package.cpp ../test_package/DeserializerTest_1_0_0.cpp) -endif() -target_link_libraries(${PROJECT_NAME} PRIVATE oatpp::oatpp oatpp::oatpp-test) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/objectbox/all/CMakeLists.txt b/recipes/objectbox/all/CMakeLists.txt deleted file mode 100644 index 46490d668b723..0000000000000 --- a/recipes/objectbox/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper C) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/objectbox/all/conandata.yml b/recipes/objectbox/all/conandata.yml index dd393e6697d16..af3abbeb88948 100644 --- a/recipes/objectbox/all/conandata.yml +++ b/recipes/objectbox/all/conandata.yml @@ -1,9 +1,24 @@ sources: + "0.18.1": + url: "https://github.com/objectbox/objectbox-c/archive/v0.18.1.tar.gz" + sha256: "108ac7fac843f2962374a12b361bb57b4d114013d16f7716cfedbc7df52feb2e" + "0.18.0": + url: "https://github.com/objectbox/objectbox-c/archive/v0.18.0.tar.gz" + sha256: "e86e921d59c6c36a4a0c0ddc5a2b641789bfa012e0824506c285feb4e9285ae7" "0.17.0": url: "https://github.com/objectbox/objectbox-c/archive/refs/tags/v0.17.0.tar.gz" sha256: "3b936b3352ae0c8ea3706cc0a1790d2714a415cdce16007c2caca367ead5af8d" patches: + "0.18.1": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "add sync option, disable tests/examples, support max length of windows path" + patch_type: "conan" + "0.18.0": + - patch_file: "patches/0001-fix-cmake.patch" + patch_description: "add sync option, disable tests/examples, support max length of windows path" + patch_type: "conan" "0.17.0": - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "add sync option, disable tests/examples, support max length of windows path" + patch_type: "conan" diff --git a/recipes/objectbox/all/conanfile.py b/recipes/objectbox/all/conanfile.py index e14e7b0b2f9b4..c5710cc60873c 100644 --- a/recipes/objectbox/all/conanfile.py +++ b/recipes/objectbox/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import CMake, ConanFile, tools -import functools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.scm import Version +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class ObjectboxCConan(ConanFile): name = "objectbox" @@ -17,46 +20,37 @@ class ObjectboxCConan(ConanFile): default_options = { "with_sync": False, } - generators = "cmake", - - @property - def _source_subfolder(self): - return "source_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["OBJECTBOX_WITH_SYNC"] = self.options.with_sync - cmake.configure() - return cmake + def generate(self): + # BUILD_SHARED_LIBS and POSITION_INDEPENDENT_CODE are automatically parsed when self.options.shared or self.options.fPIC exist + tc = CMakeToolchain(self) + tc.variables["OBJECTBOX_WITH_SYNC"] = self.options.with_sync + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["objectbox"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("m") - + self.cpp_info.system_libs.extend(["m", "pthread"]) + if Version(self.version) >= "0.18.0": + self.cpp_info.system_libs.append("dl") diff --git a/recipes/objectbox/all/test_package/CMakeLists.txt b/recipes/objectbox/all/test_package/CMakeLists.txt index 6b823b4c18ea1..8ef573610ef44 100644 --- a/recipes/objectbox/all/test_package/CMakeLists.txt +++ b/recipes/objectbox/all/test_package/CMakeLists.txt @@ -1,12 +1,7 @@ cmake_minimum_required(VERSION 3.1) - project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - -conan_basic_setup(TARGETS) - find_package(objectbox REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} objectbox::objectbox) +target_link_libraries(${PROJECT_NAME} PRIVATE objectbox::objectbox) diff --git a/recipes/objectbox/all/test_package/conanfile.py b/recipes/objectbox/all/test_package/conanfile.py index 38f4483872d47..a9fbb7f543162 100644 --- a/recipes/objectbox/all/test_package/conanfile.py +++ b/recipes/objectbox/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/objectbox/all/test_v1_package/CMakeLists.txt b/recipes/objectbox/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/objectbox/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/objectbox/all/test_v1_package/conanfile.py b/recipes/objectbox/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/objectbox/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/objectbox/config.yml b/recipes/objectbox/config.yml index 60a00f1b4d579..f2cc4d23dcbd0 100644 --- a/recipes/objectbox/config.yml +++ b/recipes/objectbox/config.yml @@ -1,3 +1,7 @@ versions: + "0.18.1": + folder: all + "0.18.0": + folder: all "0.17.0": folder: all diff --git a/recipes/oboe/all/conandata.yml b/recipes/oboe/all/conandata.yml new file mode 100644 index 0000000000000..93bb5ba9ec089 --- /dev/null +++ b/recipes/oboe/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.7.0": + url: "https://github.com/google/oboe/archive/refs/tags/1.7.0.tar.gz" + sha256: "b01896f9180f725a38806cfef73a29b36b2ea37f91389ed4e69d664ce83b79b6" +patches: + "1.7.0": + - patch_file: "patches/1.7.0-0001-fix-cmake.patch" + patch_description: "Fix CMakeLists" + patch_type: "conan" diff --git a/recipes/oboe/all/conanfile.py b/recipes/oboe/all/conanfile.py new file mode 100644 index 0000000000000..a70215ca04760 --- /dev/null +++ b/recipes/oboe/all/conanfile.py @@ -0,0 +1,65 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +import os + +required_conan_version = ">=1.53.0" + + +class OboeConan(ConanFile): + name = "oboe" + description = "Oboe is a C++ library which makes it easy to build high-performance audio apps on Android." + license = "Apache-2.0" + topics = ("android", "audio") + homepage = "https://github.com/google/oboe" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type", + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def validate(self): + if self.settings.os != "Android": + raise ConanInvalidConfiguration("oboe supports Android only") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 17) + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["oboe"] + self.cpp_info.system_libs.extend(["log", "OpenSLES"]) diff --git a/recipes/oboe/all/patches/1.7.0-0001-fix-cmake.patch b/recipes/oboe/all/patches/1.7.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..452cd94a1c2bb --- /dev/null +++ b/recipes/oboe/all/patches/1.7.0-0001-fix-cmake.patch @@ -0,0 +1,30 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -79,13 +79,13 @@ target_include_directories(oboe + # Enable -Ofast + target_compile_options(oboe + PRIVATE +- -std=c++17 + -Wall + -Wextra-semi + -Wshadow + -Wshadow-field + -Ofast +- "$<$:-Werror>") ++) ++target_compile_features(oboe PUBLIC cxx_std_17) + + # Enable logging of D,V for debug builds + target_compile_definitions(oboe PUBLIC $<$:OBOE_ENABLE_LOGGING=1>) +@@ -94,8 +94,8 @@ target_link_libraries(oboe PRIVATE log OpenSLES) + + # When installing oboe put the libraries in the lib/ folder e.g. lib/arm64-v8a + install(TARGETS oboe +- LIBRARY DESTINATION lib/${ANDROID_ABI} +- ARCHIVE DESTINATION lib/${ANDROID_ABI}) ++ LIBRARY DESTINATION lib ++ ARCHIVE DESTINATION lib) + + # Also install the headers + install(DIRECTORY include/oboe DESTINATION include) +\ No newline at end of file diff --git a/recipes/oboe/all/test_package/CMakeLists.txt b/recipes/oboe/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..9f44285ca4f5d --- /dev/null +++ b/recipes/oboe/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(oboe REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE oboe::oboe) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/oboe/all/test_package/conanfile.py b/recipes/oboe/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/oboe/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/oboe/all/test_package/test_package.cpp b/recipes/oboe/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..2fda575839770 --- /dev/null +++ b/recipes/oboe/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include + +int main() { + oboe::AudioStreamBuilder builder; + builder.setDirection(oboe::Direction::Output); + builder.setPerformanceMode(oboe::PerformanceMode::LowLatency); + builder.setSharingMode(oboe::SharingMode::Exclusive); + builder.setFormat(oboe::AudioFormat::Float); + builder.setChannelCount(oboe::ChannelCount::Mono); + return 0; +} diff --git a/recipes/oboe/all/test_v1_package/CMakeLists.txt b/recipes/oboe/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/oboe/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/oboe/all/test_v1_package/conanfile.py b/recipes/oboe/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/oboe/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/oboe/config.yml b/recipes/oboe/config.yml new file mode 100644 index 0000000000000..0f57b11de8fb0 --- /dev/null +++ b/recipes/oboe/config.yml @@ -0,0 +1,3 @@ +versions: + "1.7.0": + folder: all diff --git a/recipes/octomap/all/conanfile.py b/recipes/octomap/all/conanfile.py index 0da2ca11366f6..52d010aca9b55 100644 --- a/recipes/octomap/all/conanfile.py +++ b/recipes/octomap/all/conanfile.py @@ -1,23 +1,24 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save from conan.tools.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class OctomapConan(ConanFile): name = "octomap" description = "An Efficient Probabilistic 3D Mapping Framework Based on Octrees." license = "BSD-3-Clause" - topics = ("octomap", "octree", "3d", "robotics") + topics = ("octree", "3d", "robotics") homepage = "https://github.com/OctoMap/octomap" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,8 +32,7 @@ class OctomapConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -40,18 +40,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.options.shared and is_msvc(self) and is_msvc_static_runtime(self): - raise ConanInvalidConfiguration("shared octomap doesn't support MT runtime") + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("shared octomap doesn't support MT runtime") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -95,25 +94,25 @@ def package(self): self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), { - self._octomath_target: "octomap::{}".format(self._octomath_target), - self._octomap_target: "octomap::{}".format(self._octomap_target), + self._octomath_target: f"octomap::{self._octomath_target}", + self._octomap_target: f"octomap::{self._octomap_target}", } ) def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) + """) save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property def _octomath_target(self): diff --git a/recipes/octomap/all/test_package/conanfile.py b/recipes/octomap/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/octomap/all/test_package/conanfile.py +++ b/recipes/octomap/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/octomap/all/test_v1_package/CMakeLists.txt b/recipes/octomap/all/test_v1_package/CMakeLists.txt index a2620369b5bc7..0d20897301b68 100644 --- a/recipes/octomap/all/test_v1_package/CMakeLists.txt +++ b/recipes/octomap/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(octomap REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -if(TARGET octomap-static) - target_link_libraries(${PROJECT_NAME} PRIVATE octomap-static octomath-static) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE octomap octomath) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/octomap/all/test_v1_package/conanfile.py b/recipes/octomap/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/octomap/all/test_v1_package/conanfile.py +++ b/recipes/octomap/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/odbc/all/conandata.yml b/recipes/odbc/all/conandata.yml index df25a82c0ba11..d79ee7fbfc269 100644 --- a/recipes/odbc/all/conandata.yml +++ b/recipes/odbc/all/conandata.yml @@ -1,4 +1,9 @@ sources: + "2.3.11": + url: + - "http://www.unixodbc.org/unixODBC-2.3.11.tar.gz" + - "http://www.unixodbc.net/unixODBC-2.3.11.tar.gz" + sha256: "d9e55c8e7118347e3c66c87338856dad1516b490fb7c756c1562a2c267c73b5c" "2.3.9": url: - "http://www.unixodbc.org/unixODBC-2.3.9.tar.gz" @@ -10,6 +15,10 @@ sources: - "http://www.unixodbc.net/unixODBC-2.3.7.tar.gz" sha256: "45f169ba1f454a72b8fcbb82abd832630a3bf93baa84731cf2949f449e1e3e77" patches: + "2.3.11": + - patch_file: "patches/0001-duplicated-get-connection.patch" + "2.3.9": + - patch_file: "patches/0001-duplicated-get-connection.patch" "2.3.7": - - patch_file: "patches/missing-declarations.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-duplicated-get-connection.patch" + - patch_file: "patches/0002-missing-declarations.patch" diff --git a/recipes/odbc/all/conanfile.py b/recipes/odbc/all/conanfile.py index 52f93e639c109..f192cd232425a 100644 --- a/recipes/odbc/all/conanfile.py +++ b/recipes/odbc/all/conanfile.py @@ -1,14 +1,17 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout import os -import shutil -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class OdbcConan(ConanFile): name = "odbc" + package_type = "library" description = "Package providing unixODBC" topics = ("odbc", "database", "dbms", "data-access") url = "https://github.com/conan-io/conan-center-index" @@ -27,25 +30,20 @@ class OdbcConan(ConanFile): "with_libiconv": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): + self.requires("libtool/2.4.7") if self.options.with_libiconv: self.requires("libiconv/1.17") @@ -54,57 +52,68 @@ def validate(self): raise ConanInvalidConfiguration("odbc is a system lib on Windows") def build_requirements(self): - self.build_requires("gnu-config/cci.20201022") + self.tool_requires("gnu-config/cci.20210814") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - # relocatable shared libs on macOS - for configure in [ - os.path.join(self._source_subfolder, "configure"), - os.path.join(self._source_subfolder, "libltdl", "configure"), - ]: - tools.replace_in_file(configure, "-install_name \\$rpath/", "-install_name @rpath/") + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self) - autotools.libs = [] + def generate(self): + tc = AutotoolsToolchain(self) yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-ltdl-install", - "--enable-iconv={}".format(yes_no(self.options.with_libiconv)), + libtool_cppinfo = self.dependencies["libtool"].cpp_info.aggregated_components() + tc.configure_args.extend([ + "--without-included-ltdl", + f"--with-ltdl-include={libtool_cppinfo.includedirs[0]}", + f"--with-ltdl-lib={libtool_cppinfo.libdirs[0]}", + "--disable-ltdl-install", + f"--enable-iconv={yes_no(self.options.with_libiconv)}", "--sysconfdir=/etc", - ] + ]) if self.options.with_libiconv: - libiconv_prefix = self.deps_cpp_info["libiconv"].rootpath - args.append("--with-libiconv-prefix={}".format(libiconv_prefix)) - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + libiconv_prefix = self.dependencies["libiconv"].package_folder + tc.configure_args.append(f"--with-libiconv-prefix={libiconv_prefix}") + tc.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # support more triplets + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), src=os.path.dirname(gnu_config), dst=self.source_folder) + # allow external libtdl (in libtool recipe) + replace_in_file( + self, + os.path.join(self.source_folder, "configure"), + "if test -f \"$with_ltdl_lib/libltdl.la\";", + "if true;", + ) + libtool_system_libs = self.dependencies["libtool"].cpp_info.aggregated_components().system_libs + if libtool_system_libs: + replace_in_file( + self, + os.path.join(self.source_folder, "configure"), + "-L$with_ltdl_lib -lltdl", + "-L$with_ltdl_lib -lltdl -l{}".format(" -l".join(libtool_system_libs)), + ) def build(self): self._patch_sources() - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "etc")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "etc")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -119,26 +128,22 @@ def package_info(self): # odbc self.cpp_info.components["_odbc"].set_property("pkg_config_name", "odbc") self.cpp_info.components["_odbc"].libs = ["odbc"] - self.cpp_info.components["_odbc"].requires = ["odbcltdl"] + self.cpp_info.components["_odbc"].requires = ["libtool::libtool"] if self.options.with_libiconv: self.cpp_info.components["_odbc"].requires.append("libiconv::libiconv") # odbcinst self.cpp_info.components["odbcinst"].set_property("pkg_config_name", "odbcinst") self.cpp_info.components["odbcinst"].libs = ["odbcinst"] - self.cpp_info.components["odbcinst"].requires = ["odbcltdl"] + self.cpp_info.components["odbcinst"].requires = ["libtool::libtool"] # odbccr self.cpp_info.components["odbccr"].set_property("pkg_config_name", "odbccr") self.cpp_info.components["odbccr"].libs = ["odbccr"] - self.cpp_info.components["odbcltdl"].libs = ["ltdl"] - if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["_odbc"].system_libs = ["pthread"] self.cpp_info.components["odbcinst"].system_libs = ["pthread"] - self.cpp_info.components["odbcltdl"].system_libs = ["dl"] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/odbc/all/patches/0001-duplicated-get-connection.patch b/recipes/odbc/all/patches/0001-duplicated-get-connection.patch new file mode 100644 index 0000000000000..4357214d44a8d --- /dev/null +++ b/recipes/odbc/all/patches/0001-duplicated-get-connection.patch @@ -0,0 +1,11 @@ +--- a/cur/SQLGetDiagRec.c ++++ b/cur/SQLGetDiagRec.c +@@ -101,8 +101,4 @@ SQLRETURN CLGetDiagRec( SQLSMALLINT handle_type, + text_length_ptr); + } + +-DMHDBC __get_connection( EHEAD * head ) +-{ +- return 0; +-} + diff --git a/recipes/odbc/all/patches/missing-declarations.patch b/recipes/odbc/all/patches/0002-missing-declarations.patch similarity index 100% rename from recipes/odbc/all/patches/missing-declarations.patch rename to recipes/odbc/all/patches/0002-missing-declarations.patch diff --git a/recipes/odbc/all/test_package/CMakeLists.txt b/recipes/odbc/all/test_package/CMakeLists.txt index 5250e0988835b..7079befc5a173 100644 --- a/recipes/odbc/all/test_package/CMakeLists.txt +++ b/recipes/odbc/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(ODBC REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ODBC::ODBC) +target_link_libraries(${PROJECT_NAME} PRIVATE ODBC::ODBC) diff --git a/recipes/odbc/all/test_package/conanfile.py b/recipes/odbc/all/test_package/conanfile.py index 620e449c0ca6b..a0bef6bd96975 100644 --- a/recipes/odbc/all/test_package/conanfile.py +++ b/recipes/odbc/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str, run=True) def build(self): cmake = CMake(self) @@ -21,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - self.run("odbcinst --version", run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + self.run("odbcinst --version", env="conanrun") diff --git a/recipes/odbc/all/test_v1_package/CMakeLists.txt b/recipes/odbc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/odbc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/odbc/all/test_v1_package/conanfile.py b/recipes/odbc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..dfa9a73cae43c --- /dev/null +++ b/recipes/odbc/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + self.run("odbcinst --version", run_environment=True) diff --git a/recipes/odbc/config.yml b/recipes/odbc/config.yml index ce75cb93300de..2237b5771605c 100644 --- a/recipes/odbc/config.yml +++ b/recipes/odbc/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.11": + folder: all "2.3.9": folder: all "2.3.7": diff --git a/recipes/ode/all/conandata.yml b/recipes/ode/all/conandata.yml new file mode 100644 index 0000000000000..cb490a2db9ad2 --- /dev/null +++ b/recipes/ode/all/conandata.yml @@ -0,0 +1,18 @@ +sources: + "0.16.2": + url: "https://bitbucket.org/odedevs/ode/downloads/ode-0.16.2.tar.gz" + sha256: "b26aebdcb015e2d89720ef48e0cb2e8a3ca77915f89d853893e7cc861f810f22" +patches: + "0.16.2": + - patch_file: "patches/0001-fix-apple.patch" + patch_description: "Fix cross-build to macOS, iOS, watchOS & tvOS" + patch_type: "portability" + - patch_file: "patches/0002-dont-force-pic.patch" + patch_description: "Allow to build static library without PIC" + patch_type: "conan" + - patch_file: "patches/0003-cmake-fix-ccd-target.patch" + patch_description: "Fix link to CMake imported target of libccd" + patch_type: "conan" + - patch_file: "patches/0004-fix-include-ode-timer.patch" + patch_description: "Fix casing issue in include of ode/timer.h" + patch_type: "conan" diff --git a/recipes/ode/all/conanfile.py b/recipes/ode/all/conanfile.py new file mode 100644 index 0000000000000..380cefe469f49 --- /dev/null +++ b/recipes/ode/all/conanfile.py @@ -0,0 +1,126 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import stdcpp_library +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +import os + +required_conan_version = ">=1.54.0" + + +class OdeConan(ConanFile): + name = "ode" + description = "ODE is an open source, high performance library for simulating rigid body dynamics." + license = ("LGPL-2.1-or-later", "BSD-3-Clause") + topics = ("open-dynamics-engine", "physics", "physics-engine", "physics-simulation", "dynamics", "rigid-body") + homepage = "https://www.ode.org" + url = "https://github.com/conan-io/conan-center-index" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "precision": ["single", "double"], + "with_libccd": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "precision": "double", + "with_libccd": False, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_libccd: + self.requires("libccd/2.1") + + def validate(self): + if self.options.with_libccd: + ccd_double_precision = self.dependencies["libccd"].options.enable_double_precision + if self.options.precision == "single" and ccd_double_precision: + raise ConanInvalidConfiguration("ode:precision=single requires libccd:enable_double_precision=False") + elif self.options.precision == "double" and not ccd_double_precision: + raise ConanInvalidConfiguration("ode:precision=double requires libccd:enable_double_precision=True") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ODE_16BIT_INDICES"] = False + tc.variables["ODE_NO_BUILTIN_THREADING_IMPL"] = False + tc.variables["ODE_NO_THREADING_INTF"] = False + tc.variables["ODE_OLD_TRIMESH"] = False + tc.variables["ODE_WITH_DEMOS"] = False + tc.variables["ODE_WITH_GIMPACT"] = False + tc.variables["ODE_WITH_LIBCCD"] = self.options.with_libccd + tc.variables["ODE_WITH_OPCODE"] = True + tc.variables["ODE_WITH_OU"] = False + tc.variables["ODE_WITH_TESTS"] = False + if self.options.with_libccd: + tc.variables["ODE_WITH_LIBCCD_SYSTEM"] = True + tc.variables["ODE_DOUBLE_PRECISION"] = self.options.precision == "double" + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # Avoid a warning + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0075"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + for license_file in ("COPYING", "LICENSE*"): + copy(self, license_file, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "ode") + self.cpp_info.set_property("cmake_target_name", "ODE::ODE") + self.cpp_info.set_property("pkg_config_name", "ode") + lib_name = "ode" + if self.settings.os == "Windows": + lib_name += "_double" if self.options.precision == "double" else "_single" + lib_name += "" if self.options.shared else "s" + lib_name += "d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [lib_name] + self.cpp_info.defines.append("dIDEDOUBLE" if self.options.precision == "double" else "dIDESINGLE") + if not self.options.shared: + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m", "pthread"]) + elif self.settings.os == "Macos": + self.cpp_info.frameworks.append("CoreServices") + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.filenames["cmake_find_package"] = "ode" + self.cpp_info.filenames["cmake_find_package_multi"] = "ode" + self.cpp_info.names["cmake_find_package"] = "ODE" + self.cpp_info.names["cmake_find_package_multi"] = "ODE" diff --git a/recipes/ode/all/patches/0001-fix-apple.patch b/recipes/ode/all/patches/0001-fix-apple.patch new file mode 100644 index 0000000000000..0d9f7ce9ced3b --- /dev/null +++ b/recipes/ode/all/patches/0001-fix-apple.patch @@ -0,0 +1,28 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -518,6 +518,10 @@ target_compile_definitions( + + if(APPLE) + target_compile_definitions(ODE PRIVATE -DMAC_OS_X_VERSION=${MAC_OS_X_VERSION}) ++ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") ++ find_library(CORESERVICES_FW NAMES CoreServices) ++ target_link_libraries(ODE PRIVATE ${CORESERVICES_FW}) ++ endif() + endif() + + if(WIN32) +--- a/ode/src/timer.cpp ++++ b/ode/src/timer.cpp +@@ -176,7 +176,11 @@ double dTimerTicksPerSecond() + + #if !defined(PENTIUM) && !defined(WIN32) + +-#ifndef macintosh ++#ifdef macintosh ++#include ++#endif ++ ++#if !defined(macintosh) || !TARGET_OS_OSX + + #include + #include diff --git a/recipes/ode/all/patches/0002-dont-force-pic.patch b/recipes/ode/all/patches/0002-dont-force-pic.patch new file mode 100644 index 0000000000000..3184475f7b9ba --- /dev/null +++ b/recipes/ode/all/patches/0002-dont-force-pic.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -481,7 +481,6 @@ set_target_properties( + ODE + PROPERTIES + OUTPUT_NAME ode +- POSITION_INDEPENDENT_CODE ON + VERSION ${VERSION} + ) + diff --git a/recipes/ode/all/patches/0003-cmake-fix-ccd-target.patch b/recipes/ode/all/patches/0003-cmake-fix-ccd-target.patch new file mode 100644 index 0000000000000..e9dd8b78218bb --- /dev/null +++ b/recipes/ode/all/patches/0003-cmake-fix-ccd-target.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -572,7 +572,7 @@ if(ODE_WITH_LIBCCD) + if(ODE_WITH_LIBCCD_SYSTEM) + find_package(ccd) + target_compile_definitions(ode PRIVATE -DdLIBCCD_ENABLED -DdLIBCCD_SYSTEM) +- target_link_libraries(ODE ccd::ccd) ++ target_link_libraries(ODE PRIVATE ccd) + else() + target_compile_definitions(ODE PRIVATE -DdLIBCCD_ENABLED -DdLIBCCD_INTERNAL) + target_include_directories( diff --git a/recipes/ode/all/patches/0004-fix-include-ode-timer.patch b/recipes/ode/all/patches/0004-fix-include-ode-timer.patch new file mode 100644 index 0000000000000..5e77d5f751293 --- /dev/null +++ b/recipes/ode/all/patches/0004-fix-include-ode-timer.patch @@ -0,0 +1,11 @@ +--- a/ode/src/timer.cpp ++++ b/ode/src/timer.cpp +@@ -197,7 +197,7 @@ static inline void getClockCount (unsigned long cc[2]) + #else // macintosh + + #include +-#include ++#include + + static inline void getClockCount (unsigned long cc[2]) + { diff --git a/recipes/ode/all/test_package/CMakeLists.txt b/recipes/ode/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..98cf5d519a1d1 --- /dev/null +++ b/recipes/ode/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(ode REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE ODE::ODE) diff --git a/recipes/ode/all/test_package/conanfile.py b/recipes/ode/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/ode/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ode/all/test_package/test_package.c b/recipes/ode/all/test_package/test_package.c new file mode 100644 index 0000000000000..9b372c93bba97 --- /dev/null +++ b/recipes/ode/all/test_package/test_package.c @@ -0,0 +1,40 @@ +#include + +int main() +{ + dInitODE(); + + const int VertexCount = 4; + const int IndexCount = 2 * 3; + float vertices[12] = { + -1,-1,0, + 1,-1,0, + 1,1,0, + -1,1,0 + }; + dTriIndex indices[6] = { + 0,1,2, + 0,2,3 + }; + + dTriMeshDataID data = dGeomTriMeshDataCreate(); + dGeomTriMeshDataBuildSingle(data, + vertices, + 3 * sizeof(float), + VertexCount, + indices, + IndexCount, + 3 * sizeof(dTriIndex)); + dGeomID trimesh = dCreateTriMesh(0, data, 0, 0, 0); + const dReal radius = 4; + dGeomID sphere = dCreateSphere(0, radius); + dContactGeom cg[4]; + int nc; + dVector3 trinormal = { 0, 0, -1 }; + + dGeomSetPosition(sphere, 0,0,radius); + nc = dCollide(trimesh, sphere, 4, &cg[0], sizeof cg[0]); + + dCloseODE(); + return 0; +} diff --git a/recipes/ode/all/test_v1_package/CMakeLists.txt b/recipes/ode/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/ode/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/ode/all/test_v1_package/conanfile.py b/recipes/ode/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/ode/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/ode/config.yml b/recipes/ode/config.yml new file mode 100644 index 0000000000000..62178f7b45783 --- /dev/null +++ b/recipes/ode/config.yml @@ -0,0 +1,3 @@ +versions: + "0.16.2": + folder: all diff --git a/recipes/ogg/all/conanfile.py b/recipes/ogg/all/conanfile.py index 42d45c958a608..9d7da300191e0 100644 --- a/recipes/ogg/all/conanfile.py +++ b/recipes/ogg/all/conanfile.py @@ -1,15 +1,15 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class OggConan(ConanFile): name = "ogg" description = "The OGG library" - topics = ("ogg", "codec", "audio", "lossless") + topics = ("codec", "audio", "lossless") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/xiph/ogg" license = "BSD-2-Clause" @@ -25,8 +25,7 @@ class OggConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -34,15 +33,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/ogg/all/test_v1_package/conanfile.py b/recipes/ogg/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/ogg/all/test_v1_package/conanfile.py +++ b/recipes/ogg/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/onetbb/2020.x/conanfile.py b/recipes/onetbb/2020.x/conanfile.py index 56c838d1bed5e..0fd823e9ffd15 100644 --- a/recipes/onetbb/2020.x/conanfile.py +++ b/recipes/onetbb/2020.x/conanfile.py @@ -1,10 +1,13 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration, ConanException +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.files import get, replace_in_file, save, chdir, copy +from conan.tools.microsoft import msvc_runtime_flag, is_msvc +from conan.tools.scm import Version +from conans import tools as legacy_tools import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class OneTBBConan(ConanFile): @@ -41,10 +44,6 @@ def _source_subfolder(self): def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _is_clanglc(self): return self.settings.os == "Windows" and self.settings.compiler == "clang" @@ -62,14 +61,11 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): if self.settings.os == "Macos": - if hasattr(self, "settings_build") and tools.cross_building(self): - # See logs from https://github.com/conan-io/conan-center-index/pull/8454 - raise ConanInvalidConfiguration("Cross building on Macos is not yet supported. Contributions are welcome") - if self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) < "8.0": + if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "8.0": raise ConanInvalidConfiguration("%s %s couldn't be built by apple-clang < 8.0" % (self.name, self.version)) if not self.options.shared: self.output.warn("oneTBB strongly discourages usage of static linkage") @@ -84,11 +80,11 @@ def package_id(self): def build_requirements(self): if self._settings_build.os == "Windows": - if "CONAN_MAKE_PROGRAM" not in os.environ and not tools.which("make"): - self.build_requires("make/4.2.1") + if "CONAN_MAKE_PROGRAM" not in os.environ and not legacy_tools.which("make"): + self.tool_requires("make/4.2.1") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def build(self): @@ -100,14 +96,14 @@ def add_flag(name, value): # Get the version of the current compiler instead of gcc linux_include = os.path.join(self._source_subfolder, "build", "linux.inc") - tools.replace_in_file(linux_include, "shell gcc", "shell $(CC)") - tools.replace_in_file(linux_include, "= gcc", "= $(CC)") + replace_in_file(self, linux_include, "shell gcc", "shell $(CC)") + replace_in_file(self, linux_include, "= gcc", "= $(CC)") if self.version != "2019_u9" and self.settings.build_type == "Debug": - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile"), "release", "debug") + replace_in_file(self, os.path.join(self._source_subfolder, "Makefile"), "release", "debug") if str(self._base_compiler) in ["Visual Studio", "msvc"]: - tools.save( + save(self, os.path.join(self._source_subfolder, "build", "big_iron_msvc.inc"), # copy of big_iron.inc adapted for MSVC textwrap.dedent("""\ @@ -142,10 +138,15 @@ def add_flag(name, value): "x86": "ia32", "x86_64": "intel64", "armv7": "armv7", - "armv8": "aarch64", + "armv8": "arm64" + if (self.settings.os == "iOS" or self.settings.os == "Macos") + else "aarch64", }[str(self.settings.arch)] extra += " arch=%s" % arch + if self.settings.os == "iOS": + extra += " target=ios" + if str(self._base_compiler) in ("gcc", "clang", "apple-clang"): if str(self._base_compiler.libcxx) in ("libstdc++", "libstdc++11"): extra += " stdlib=libstdc++" @@ -195,51 +196,61 @@ def add_flag(name, value): extra += " compiler=icl" else: extra += " compiler=cl" + cxx_std_flag = legacy_tools.cppstd_flag(self.settings) + if cxx_std_flag: + cxx_std_value = ( + cxx_std_flag.split("=")[1] + if "=" in cxx_std_flag + else cxx_std_flag.split(":")[1] + if ":" in cxx_std_flag + else None + ) + if cxx_std_value: + extra += f" stdver={cxx_std_value}" - make = tools.get_env("CONAN_MAKE_PROGRAM", tools.which("make") or tools.which("mingw32-make")) + make = legacy_tools.get_env("CONAN_MAKE_PROGRAM", legacy_tools.which("make") or legacy_tools.which("mingw32-make")) if not make: raise ConanException("This package needs 'make' in the path to build") - with tools.chdir(self._source_subfolder): + with chdir(self, self._source_subfolder): # intentionally not using AutoToolsBuildEnvironment for now - it's broken for clang-cl if self._is_clanglc: add_flag("CFLAGS", "-mrtm") add_flag("CXXFLAGS", "-mrtm") targets = ["tbb", "tbbmalloc", "tbbproxy"] - context = tools.no_op() + context = legacy_tools.no_op() if self.settings.compiler == "intel": - context = tools.intel_compilervars(self) - elif self._is_msvc: + context = legacy_tools.intel_compilervars(self) + elif is_msvc(self): # intentionally not using vcvars for clang-cl yet - context = tools.vcvars(self) + context = legacy_tools.vcvars(self) with context: self.run("%s %s %s" % (make, extra, " ".join(targets))) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src="%s/include" % self._source_subfolder) - self.copy(pattern="*", dst="include/tbb/compat", src="%s/include/tbb/compat" % self._source_subfolder) - build_folder = "%s/build/" % self._source_subfolder + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self._source_subfolder) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._source_subfolder, "include")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "include", "tbb", "compat"), src=os.path.join(self._source_subfolder, "include", "tbb", "compat")) + build_folder = os.path.join(self._source_subfolder, "build") build_type = "debug" if self.settings.build_type == "Debug" else "release" - self.copy(pattern="*%s*.lib" % build_type, dst="lib", src=build_folder, keep_path=False) - self.copy(pattern="*%s*.a" % build_type, dst="lib", src=build_folder, keep_path=False) - self.copy(pattern="*%s*.dll" % build_type, dst="bin", src=build_folder, keep_path=False) - self.copy(pattern="*%s*.dylib" % build_type, dst="lib", src=build_folder, keep_path=False) + copy(self, pattern=f"*{build_type}*.lib", dst=os.path.join(self.package_folder, "lib"), src=build_folder, keep_path=False) + copy(self, pattern=f"*{build_type}*.a", dst=os.path.join(self.package_folder, "lib"), src=build_folder, keep_path=False) + copy(self, pattern=f"*{build_type}*.dll", dst=os.path.join(self.package_folder, "bin"), src=build_folder, keep_path=False) + copy(self, pattern=f"*{build_type}*.dylib", dst=os.path.join(self.package_folder, "lib"), src=build_folder, keep_path=False) # Copy also .dlls to lib folder so consumers can link against them directly when using MinGW if self.settings.os == "Windows" and self.settings.compiler == "gcc": - self.copy("*%s*.dll" % build_type, dst="lib", src=build_folder, keep_path=False) + copy(self, f"*{build_type}*.dll", dst=os.path.join(self.package_folder, "lib"), src=build_folder, keep_path=False) if self.settings.os == "Linux": extension = "so" if self.options.shared: - self.copy("*%s*.%s.*" % (build_type, extension), "lib", build_folder, - keep_path=False) + copy(self, f"*{build_type}*.{extension}.*", dst=os.path.join(self.package_folder, "lib"), src=build_folder, keep_path=False) outputlibdir = os.path.join(self.package_folder, "lib") - os.chdir(outputlibdir) - for fpath in os.listdir(outputlibdir): - self.run("ln -s \"%s\" \"%s\"" % - (fpath, fpath[0:fpath.rfind("." + extension) + len(extension) + 1])) + with chdir(self, outputlibdir): + for fpath in os.listdir(outputlibdir): + filepath = fpath[0:fpath.rfind("." + extension) + len(extension) + 1] + self.run(f'ln -s "{fpath}" "{filepath}"', run_environment=True) def package_info(self): self.cpp_info.set_property("cmake_file_name", "TBB") diff --git a/recipes/onetbb/all/conandata.yml b/recipes/onetbb/all/conandata.yml index ea0c621b1ec0c..8b78e00c51454 100644 --- a/recipes/onetbb/all/conandata.yml +++ b/recipes/onetbb/all/conandata.yml @@ -1,4 +1,21 @@ sources: + "2021.7.0": + url: "https://github.com/oneapi-src/oneTBB/archive/refs/tags/v2021.7.0.tar.gz" + sha256: "2cae2a80cda7d45dc7c072e4295c675fff5ad8316691f26f40539f7e7e54c0cc" + "2021.6.0": + url: "https://github.com/oneapi-src/oneTBB/archive/v2021.6.0.tar.gz" + sha256: "4897dd106d573e9dacda8509ca5af1a0e008755bf9c383ef6777ac490223031f" "2021.3.0": url: "https://github.com/oneapi-src/oneTBB/archive/v2021.3.0.tar.gz" sha256: "8f616561603695bbb83871875d2c6051ea28f8187dbe59299961369904d1d49e" +patches: + "2021.6.0": + - patch_description: "cherry-pick upstream patch: avoid android compile errors for current NDKs on releases <= 2021.6.0" + patch_type: "backport" + patch_source: "https://github.com/oneapi-src/oneTBB/pull/716.diff" + patch_file: "patches/fix-overeager-stripping-of-compile-flag.diff" + "2021.3.0": + - patch_description: "cherry-pick upstream patch: avoid android compile errors for current NDKs on releases <= 2021.6.0" + patch_type: "backport" + patch_source: "https://github.com/oneapi-src/oneTBB/pull/716.diff" + patch_file: "patches/fix-overeager-stripping-of-compile-flag.diff" diff --git a/recipes/onetbb/all/conanfile.py b/recipes/onetbb/all/conanfile.py index 0a0702971da74..240acbbc36f0d 100644 --- a/recipes/onetbb/all/conanfile.py +++ b/recipes/onetbb/all/conanfile.py @@ -1,12 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import copy, get, load, rmdir +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, load, rmdir from conan.tools.scm import Version import os import re -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.52.0" class OneTBBConan(ConanFile): @@ -26,31 +27,39 @@ class OneTBBConan(ConanFile): "fPIC": [True, False], "tbbmalloc": [True, False], "tbbproxy": [True, False], + "interprocedural_optimization": [True, False], } default_options = { "shared": True, "fPIC": True, "tbbmalloc": False, "tbbproxy": False, + "interprocedural_optimization": True, } def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if not (Version(self.version) >= "2021.6.0" and self.options.shared and self.settings.os != "Android"): + del self.options.interprocedural_optimization if Version(self.version) < "2021.2.0": del self.options.shared del self.options.fPIC + def export_sources(self): + export_conandata_patches(self) + def configure(self): if self.options.get_safe("shared", True): del self.options.fPIC def package_id(self): - del self.info.options.tbbmalloc - del self.info.options.tbbproxy + if Version(self.version) < "2021.6.0": + del self.info.options.tbbmalloc + del self.info.options.tbbproxy def validate(self): - if (self.settings.os == "Macos" + if (is_apple_os(self) and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "11.0"): raise ConanInvalidConfiguration( @@ -59,6 +68,12 @@ def validate(self): self.version, )) if not self.options.get_safe("shared", True): + if Version(self.version) >= "2021.6.0": + raise ConanInvalidConfiguration( + "Building oneTBB as a static library is highly discouraged and not supported " + "to avoid unforeseen issues like https://github.com/oneapi-src/oneTBB/issues/920. " + "Please consider fixing at least the aforementioned issue in upstream." + ) self.output.warn( "oneTBB strongly discourages usage of static linkage") if (self.options.tbbproxy @@ -78,9 +93,14 @@ def generate(self): toolchain = CMakeToolchain(self) toolchain.variables["TBB_TEST"] = False toolchain.variables["TBB_STRICT"] = False + if Version(self.version) >= "2021.6.0": + toolchain.variables["TBBMALLOC_BUILD"] = self.options.tbbmalloc + toolchain.variables["TBBMALLOC_PROXY_BUILD"] = self.options.tbbproxy + toolchain.variables["TBB_ENABLE_IPO"] = self.options.get_safe("interprocedural_optimization", False) toolchain.generate() def build(self): + apply_conandata_patches(self) cmake = CMake(self) cmake.configure() cmake.build() @@ -120,7 +140,7 @@ def lib_name(name): ) tbb.libs.append(lib_name("tbb{}".format(binary_version))) if self.settings.os in ["Linux", "FreeBSD"]: - tbb.system_libs = ["dl", "rt", "pthread"] + tbb.system_libs = ["m", "dl", "rt", "pthread"] # tbbmalloc if self.options.tbbmalloc: @@ -138,6 +158,8 @@ def lib_name(name): tbbproxy.set_property("cmake_target_name", "TBB::tbbmalloc_proxy") tbbproxy.libs = [lib_name("tbbmalloc_proxy")] tbbproxy.requires = ["tbbmalloc"] + if self.settings.os in ["Linux", "FreeBSD"]: + tbbproxy.system_libs = ["m", "dl", "pthread"] # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "TBB" diff --git a/recipes/onetbb/all/patches/fix-overeager-stripping-of-compile-flag.diff b/recipes/onetbb/all/patches/fix-overeager-stripping-of-compile-flag.diff new file mode 100644 index 0000000000000..914764c6a369d --- /dev/null +++ b/recipes/onetbb/all/patches/fix-overeager-stripping-of-compile-flag.diff @@ -0,0 +1,13 @@ +diff --git a/cmake/utils.cmake b/cmake/utils.cmake +index f74abfcf9..a090bacbb 100644 +--- a/cmake/utils.cmake ++++ b/cmake/utils.cmake +@@ -18,7 +18,7 @@ macro(tbb_remove_compile_flag flag) + set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY COMPILE_OPTIONS ${_tbb_compile_options}) + unset(_tbb_compile_options) + if (CMAKE_CXX_FLAGS) +- string(REGEX REPLACE ${flag} "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) ++ string(REGEX REPLACE "(^|[ \t\r\n]+)${flag}($|[ \t\r\n]+)" " " CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS}) + endif() + endmacro() + diff --git a/recipes/onetbb/all/test_v1_package/conanfile.py b/recipes/onetbb/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/onetbb/all/test_v1_package/conanfile.py +++ b/recipes/onetbb/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/onetbb/config.yml b/recipes/onetbb/config.yml index 198048be7bd45..20a58c634a9a6 100644 --- a/recipes/onetbb/config.yml +++ b/recipes/onetbb/config.yml @@ -1,4 +1,8 @@ versions: + "2021.7.0": + folder: all + "2021.6.0": + folder: all "2021.3.0": folder: all "2020.3": diff --git a/recipes/oniguruma/all/conanfile.py b/recipes/oniguruma/all/conanfile.py index 2e23490378a95..6d15941400fd2 100644 --- a/recipes/oniguruma/all/conanfile.py +++ b/recipes/oniguruma/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class OnigurumaConan(ConanFile): @@ -15,6 +15,7 @@ class OnigurumaConan(ConanFile): homepage = "https://github.com/kkos/oniguruma" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,22 +34,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -57,8 +51,6 @@ def generate(self): if Version(self.version) >= "6.9.8": tc.variables["INSTALL_DOCUMENTATION"] = False tc.variables["INSTALL_EXAMPLES"] = False - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): diff --git a/recipes/oniguruma/all/test_package/conanfile.py b/recipes/oniguruma/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/oniguruma/all/test_package/conanfile.py +++ b/recipes/oniguruma/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/oniguruma/all/test_v1_package/CMakeLists.txt b/recipes/oniguruma/all/test_v1_package/CMakeLists.txt index ca4837b656284..0d20897301b68 100644 --- a/recipes/oniguruma/all/test_v1_package/CMakeLists.txt +++ b/recipes/oniguruma/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(oniguruma REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE oniguruma::onig) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/oniguruma/all/test_v1_package/conanfile.py b/recipes/oniguruma/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/oniguruma/all/test_v1_package/conanfile.py +++ b/recipes/oniguruma/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/onnx/all/conanfile.py b/recipes/onnx/all/conanfile.py index 21814da896d45..7bcba4042129a 100644 --- a/recipes/onnx/all/conanfile.py +++ b/recipes/onnx/all/conanfile.py @@ -1,15 +1,16 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import check_min_cppstd +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import check_min_cppstd, cross_building from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.env import VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, get, rmdir, save +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.53.0" class OnnxConan(ConanFile): @@ -20,6 +21,7 @@ class OnnxConan(ConanFile): homepage = "https://github.com/onnx/onnx" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -33,11 +35,10 @@ class OnnxConan(ConanFile): @property def _protobuf_version(self): # onnx < 1.9.0 doesn't support protobuf >= 3.18 - return "3.21.4" if Version(self.version) >= "1.9.0" else "3.17.1" + return "3.21.9" if Version(self.version) >= "1.9.0" else "3.17.1" def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,32 +46,36 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires(f"protobuf/{self._protobuf_version}") + self.requires(f"protobuf/{self._protobuf_version}", run=not cross_building(self), transitive_headers=True, transitive_libs=True) def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - if is_msvc(self) and self.info.options.shared: + if is_msvc(self) and self.options.shared: raise ConanInvalidConfiguration("onnx shared is broken with Visual Studio") def build_requirements(self): - if hasattr(self, "settings_build"): + if hasattr(self, "settings_build") and cross_building(self): self.tool_requires(f"protobuf/{self._protobuf_version}") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") tc = CMakeToolchain(self) tc.variables["ONNX_BUILD_BENCHMARKS"] = False - tc.variables["ONNX_USE_PROTOBUF_SHARED_LIBS"] = self.options["protobuf"].shared + tc.variables["ONNX_USE_PROTOBUF_SHARED_LIBS"] = self.dependencies.host["protobuf"].options.shared tc.variables["BUILD_ONNX_PYTHON"] = False tc.variables["ONNX_GEN_PB_TYPE_STUBS"] = False tc.variables["ONNX_WERROR"] = False @@ -86,8 +91,6 @@ def generate(self): tc.generate() deps = CMakeDeps(self) deps.generate() - env = VirtualBuildEnv(self) - env.generate() def build(self): apply_conandata_patches(self) @@ -100,6 +103,7 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + fix_apple_shared_install_name(self) # TODO: to remove in conan v2 once legacy generators removed self._create_cmake_module_alias_targets( @@ -138,7 +142,8 @@ def _onnx_components(self): "requires": ["protobuf::libprotobuf"] }, "onnxifi": { - "target": "onnxifi" + "target": "onnxifi", + "system_libs": [(self.settings.os in ["Linux", "FreeBSD"], ["dl"])], }, "onnxifi_dummy": { "target": "onnxifi_dummy", @@ -167,10 +172,12 @@ def _register_components(components): libs = comp_values.get("libs", []) defines = comp_values.get("defines", []) requires = comp_values.get("requires", []) + system_libs = [l for cond, sys_libs in comp_values.get("system_libs", []) if cond for l in sys_libs] self.cpp_info.components[comp_name].set_property("cmake_target_name", target) self.cpp_info.components[comp_name].libs = libs self.cpp_info.components[comp_name].defines = defines self.cpp_info.components[comp_name].requires = requires + self.cpp_info.components[comp_name].system_libs = system_libs # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.components[comp_name].names["cmake_find_package"] = target diff --git a/recipes/onnx/all/test_package/conanfile.py b/recipes/onnx/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/onnx/all/test_package/conanfile.py +++ b/recipes/onnx/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/onnx/all/test_v1_package/CMakeLists.txt b/recipes/onnx/all/test_v1_package/CMakeLists.txt index cb8caee54747b..0d20897301b68 100644 --- a/recipes/onnx/all/test_v1_package/CMakeLists.txt +++ b/recipes/onnx/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(ONNX REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE onnx) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/open-dis-cpp/all/conandata.yml b/recipes/open-dis-cpp/all/conandata.yml new file mode 100644 index 0000000000000..02787c5993558 --- /dev/null +++ b/recipes/open-dis-cpp/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.1": + url: "https://github.com/open-dis/open-dis-cpp/archive/refs/tags/v1.0.1.tar.gz" + sha256: "c8c899aa3553da898f586c31e1b34512a448921a77bd15fc2611c0b1a7ce49b2" diff --git a/recipes/open-dis-cpp/all/conanfile.py b/recipes/open-dis-cpp/all/conanfile.py new file mode 100644 index 0000000000000..b00b3d36a279f --- /dev/null +++ b/recipes/open-dis-cpp/all/conanfile.py @@ -0,0 +1,94 @@ +import os + +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.layout import basic_layout +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version + +required_conan_version = ">=1.53.0" + + +class OpenDisConan(ConanFile): + name = "open-dis-cpp" + homepage = "https://open-dis.org" + description = "C++ implementation of the IEEE-1278.1 Distributed Interactive Simulation (DIS) application protocol v6 and v7" + topics = ("library","protocol","simulation-framework","dis") + url = "https://github.com/conan-io/conan-center-index" + license = "BSD-2-Clause" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False] + } + default_options = { + "shared": False, + "fPIC": True + } + + def export_sources(self): + export_conandata_patches(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["BUILD_EXAMPLES"] = "FALSE" + tc.cache_variables["BUILD_TESTS"] = "FALSE" + tc.generate() + + def layout(self): + cmake_layout(self, src_folder="src") + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def validate(self): + if self.info.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, 11) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "res")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_module_file_name", "OpenDIS") + self.cpp_info.set_property("cmake_file_name", "OpenDIS") + + # TODO: back to global scope in conan v2 once cmake_find_package* generators removed + self.cpp_info.components["OpenDIS6"].libs = ["OpenDIS6"] + self.cpp_info.components["OpenDIS7"].libs = ["OpenDIS7"] + + # TODO: to remove in conan v2 once cmake_find_package* generators removed + self.cpp_info.filenames["cmake_find_package"] = "OpenDIS" + self.cpp_info.filenames["cmake_find_package_multi"] = "OpenDIS" + self.cpp_info.names["cmake_find_package"] = "OpenDIS" + self.cpp_info.names["cmake_find_package_multi"] = "OpenDIS" + self.cpp_info.components["OpenDIS6"].names["cmake_find_package"] = "OpenDIS6" + self.cpp_info.components["OpenDIS6"].names["cmake_find_package_multi"] = "OpenDIS6" + self.cpp_info.components["OpenDIS6"].set_property("cmake_target_name", "OpenDIS::OpenDIS6") + self.cpp_info.components["OpenDIS6"].set_property("cmake_target_aliases", ["OpenDIS::DIS6","OpenDIS6"]) + self.cpp_info.components["OpenDIS7"].names["cmake_find_package"] = "OpenDIS7" + self.cpp_info.components["OpenDIS7"].names["cmake_find_package_multi"] = "OpenDIS7" + self.cpp_info.components["OpenDIS7"].set_property("cmake_target_name", "OpenDIS::OpenDIS7") + self.cpp_info.components["OpenDIS7"].set_property("cmake_target_aliases", ["OpenDIS::DIS7","OpenDIS7"]) diff --git a/recipes/open-dis-cpp/all/test_package/CMakeLists.txt b/recipes/open-dis-cpp/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..59a664a4ce0e4 --- /dev/null +++ b/recipes/open-dis-cpp/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(OpenDIS REQUIRED) + +add_executable(test_package_dis6 test_package.cpp) +target_link_libraries(test_package_dis6 PRIVATE OpenDIS::OpenDIS6) + + +add_executable(test_package_dis7 test_package.cpp) +target_compile_definitions(test_package_dis7 PRIVATE TEST_DIS7) +target_link_libraries(test_package_dis7 PRIVATE OpenDIS::OpenDIS7) diff --git a/recipes/open-dis-cpp/all/test_package/conanfile.py b/recipes/open-dis-cpp/all/test_package/conanfile.py new file mode 100644 index 0000000000000..eb28dfa80ed5b --- /dev/null +++ b/recipes/open-dis-cpp/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +import os +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package_dis6"), env="conanrun") + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package_dis7"), env="conanrun") diff --git a/recipes/open-dis-cpp/all/test_package/test_package.cpp b/recipes/open-dis-cpp/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..38cc303f245d0 --- /dev/null +++ b/recipes/open-dis-cpp/all/test_package/test_package.cpp @@ -0,0 +1,18 @@ +#ifdef TEST_DIS7 +#include +#else +#include +#endif + +#include + +int main() { + DIS::EntityStatePdu pdu1, pdu2; + + DIS::DataStream ds(DIS::BIG); + pdu1.marshal(ds); + pdu2.unmarshal(ds); + + std::cout << "Success\n"; + return EXIT_SUCCESS; +} diff --git a/recipes/open-dis-cpp/all/test_v1_package/CMakeLists.txt b/recipes/open-dis-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/open-dis-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/open-dis-cpp/all/test_v1_package/conanfile.py b/recipes/open-dis-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8651492935b32 --- /dev/null +++ b/recipes/open-dis-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join("bin", "test_package_dis6"), run_environment=True) + self.run(os.path.join("bin", "test_package_dis7"), run_environment=True) diff --git a/recipes/open-dis-cpp/config.yml b/recipes/open-dis-cpp/config.yml new file mode 100644 index 0000000000000..715e55357a17b --- /dev/null +++ b/recipes/open-dis-cpp/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.1": + folder: all diff --git a/recipes/open62541/all/conandata.yml b/recipes/open62541/all/conandata.yml index 6e8ccb43a8658..d458e6add2e68 100644 --- a/recipes/open62541/all/conandata.yml +++ b/recipes/open62541/all/conandata.yml @@ -1,7 +1,13 @@ sources: + "1.3.4": + url: "https://github.com/open62541/open62541/archive/v1.3.4.tar.gz" + sha256: "3489cfa2f98c52df252adc8e641a9e59cb675bdfd5ef413b0d947e667cddd16d" "1.3.1": url: "https://github.com/open62541/open62541/archive/v1.3.1.tar.gz" sha256: "f54d10325fd08fc1505aea37d83daa085912a269521e6d018bfc41a744ba57aa" + "1.2.6": + url: "https://github.com/open62541/open62541/archive/v1.2.6.tar.gz" + sha256: "7470c1e2f97d0e7dad9632ced7b62f0add66a3c689532204ef85b0556d129106" "1.2.4": url: "https://github.com/open62541/open62541/archive/v1.2.4.tar.gz" sha256: "b2d00b91e8315b61efaef6398f0902a0c9a8f357aa6d02f7f000a429048c97ae" @@ -24,41 +30,70 @@ sources: url: "https://github.com/open62541/open62541/archive/v1.0.3.tar.gz" sha256: "3e4c939d702d06d89f32a1cafe2b992c7f3d81c8f8579e093a972d4bc4fb3d50" patches: + "1.3.4": + - patch_file: "patches/0001-fix-cmake-find-deps-1_3_4.patch" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" "1.3.1": - - patch_file: "patches/0001-fix-cmake-find-deps-1_3_x.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-fix-cmake-find-deps-1_3_1.patch" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" + "1.2.6": + - patch_file: "patches/0001-fix-cmake-find-deps-1_2_x.patch" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" + - patch_file: "patches/0003-disable-sanitizers-1_2_x.patch" + patch_description: "Disable static code analysis" + patch_type: "conan" + - patch_file: "patches/0003-fix-use-usr-bin-env-python3.patch" + patch_description: "Use python3 instead of default python interpreter" + patch_type: "conan" "1.2.4": - patch_file: "patches/0001-fix-cmake-find-deps-1_2_x.patch" - base_path: "source_subfolder" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" - patch_file: "patches/0003-disable-sanitizers-1_2_x.patch" - base_path: "source_subfolder" + patch_description: "Disable static code analysis" + patch_type: "conan" - patch_file: "patches/0003-fix-use-usr-bin-env-python3.patch" - base_path: "source_subfolder" + patch_description: "Use python3 instead of default python interpreter" + patch_type: "conan" "1.2.2": - patch_file: "patches/0001-fix-cmake-find-deps-1_2_x.patch" - base_path: "source_subfolder" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" - patch_file: "patches/0003-disable-sanitizers-1_2_x.patch" - base_path: "source_subfolder" + patch_description: "Disable static code analysis" + patch_type: "conan" - patch_file: "patches/0003-fix-use-usr-bin-env-python3.patch" - base_path: "source_subfolder" + patch_description: "Use python3 instead of default python interpreter" + patch_type: "conan" "1.1.6": - patch_file: "patches/0001-fix-cmake-find-deps-1_1_x.patch" - base_path: "source_subfolder" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" - patch_file: "patches/0003-disable-sanitizers-1_1_6.patch" - base_path: "source_subfolder" + patch_description: "Disable static code analysis" + patch_type: "conan" "1.1.5": - patch_file: "patches/0001-fix-cmake-find-deps-1_1_x.patch" - base_path: "source_subfolder" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" - patch_file: "patches/0002-disable-sanitizers-1_1_3-and-1_1_5.patch" - base_path: "source_subfolder" + patch_description: "Disable static code analysis" + patch_type: "conan" "1.1.3": - patch_file: "patches/0001-fix-cmake-find-deps-1_1_x.patch" - base_path: "source_subfolder" + patch_description: "Use Cmake find_package(*) to resolve external dependencies" + patch_type: "portability" - patch_file: "patches/0002-disable-sanitizers-1_1_3-and-1_1_5.patch" - base_path: "source_subfolder" + patch_description: "Disable static code analysis" + patch_type: "conan" "1.0.6": - patch_file: "patches/1_0_x.patch" - base_path: "source_subfolder" + patch_description: "Fix CMAKE_MODULE_PATH and PROJECT_VERSION variables, remove -Werror flag, disable static code analysis, use Cmake find_package(*) to resolve external dependencies, fix include paths" + patch_type: "conan" "1.0.3": - patch_file: "patches/1_0_x.patch" - base_path: "source_subfolder" + patch_description: "Fix CMAKE_MODULE_PATH and PROJECT_VERSION variables, remove -Werror flag, disable static code analysis, use Cmake find_package(*) to resolve external dependencies, fix include paths" + patch_type: "conan" diff --git a/recipes/open62541/all/conanfile.py b/recipes/open62541/all/conanfile.py index c1f545696a3c5..25dd98cf850ff 100644 --- a/recipes/open62541/all/conanfile.py +++ b/recipes/open62541/all/conanfile.py @@ -1,11 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.files import rename, get +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain, CMakeDeps +from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, collect_libs, export_conandata_patches, rename, rm, rmdir, get +from conan.errors import ConanInvalidConfiguration import glob import os import yaml -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class Open62541Conan(ConanFile): @@ -136,49 +138,52 @@ class Open62541Conan(ConanFile): "readable_statuscodes": True } - exports_sources = ["CMakeLists.txt", "patches/**"] exports = "submoduledata.yml" - generators = "cmake", "cmake_find_package" - _cmake = None short_paths = True - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) >= "1.3.1": + + if Version(self.version) >= "1.3.1": del self.options.embedded_profile def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + if not self.options.cpp_compatible: - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") # Due to https://github.com/open62541/open62541/issues/4687 we cannot build with 1.2.2 + Windows + shared - if tools.Version(self.version) >= "1.2.2" and self.settings.os == "Windows" and self.options.shared: - raise ConanInvalidConfiguration("{0} {1} doesn't properly support shared lib on Windows".format(self.name, - self.version)) + if Version(self.version) >= "1.2.2" and self.settings.os == "Windows" and self.options.shared: + raise ConanInvalidConfiguration( + f"{self.ref} doesn't properly support shared lib on Windows") if self.options.subscription == "With Events": - self.output.warning("`{name}:subscription=With Events` is deprecated. Use `{name}:subscription=events` instead".format(name=self.name)) # Deprecated in 1.2.2 + # Deprecated in 1.2.2 + self.output.warning( + f"`{self.ref}:subscription=With Events` is deprecated. Use `{self.ref}:subscription=events` instead") self.options.subscription = "events" if self.options.web_socket: self.options["libwebsockets"].with_ssl = self.options.encryption + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.encryption == "mbedtls": self.requires("mbedtls/2.25.0") elif self.options.encryption == "openssl": - self.requires("openssl/1.1.1o") + self.requires("openssl/1.1.1s") if self.options.web_socket: - self.requires("libwebsockets/4.2.0") + self.requires("libwebsockets/4.3.2") if self.options.discovery == "With Multicast" or "multicast" in str(self.options.discovery): self.requires("pro-mdnsd/0.8.4") @@ -192,7 +197,7 @@ def validate(self): raise ConanInvalidConfiguration( "Open62541 discovery sempahore option requires discovery option to be enabled") - if tools.Version(self.version) < "1.1.0": + if Version(self.version) < "1.1.0": if self.options.encryption == "openssl": raise ConanInvalidConfiguration( "Lower Open62541 versions than 1.1.0 do not support openssl") @@ -210,13 +215,14 @@ def validate(self): "Lower Open62541 versions than 1.1.0 are not cpp compatible due to -fpermisive flags") # FIXME: correct clang versions condition - max_clang_version = "8" if tools.Version(self.version) < "1.1.0" else "9" - if self.settings.compiler == "clang" and tools.Version(self.settings.compiler.version) > max_clang_version: + max_clang_version = "8" if Version( + self.version) < "1.1.0" else "9" + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) > max_clang_version: raise ConanInvalidConfiguration( "Open62541 supports Clang up to {} compiler version".format(max_clang_version)) if self.settings.compiler == "clang": - if tools.Version(self.settings.compiler.version) < "5": + if Version(self.settings.compiler.version) < "5": raise ConanInvalidConfiguration( "Older clang compiler version than 5.0 are not supported") @@ -231,7 +237,7 @@ def validate(self): def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + destination=self.source_folder, strip_root=True) submodule_filename = os.path.join( self.recipe_folder, 'submoduledata.yml') @@ -248,8 +254,8 @@ def source(self): } get(self, **submodule_data) - submodule_source = os.path.join(self._source_subfolder, path) - tools.rmdir(submodule_source) + submodule_source = os.path.join(self.source_folder, path) + rmdir(self, submodule_source) rename(self, archive_name, submodule_source) def _get_log_level(self): @@ -270,122 +276,142 @@ def _get_multithreading_option(self): "Internal threads": "200" }.get(str(self.options.multithreading), "0") - def _configure_cmake(self): - if self._cmake: - return self._cmake + def generate(self): + tc = CMakeToolchain(self) - self._cmake = CMake(self) + version = Version(self.version) + tc.variables["OPEN62541_VER_MAJOR"] = version.major + tc.variables["OPEN62541_VER_MINOR"] = version.minor + tc.variables["OPEN62541_VER_PATCH"] = version.patch - version = tools.Version(self.version) - self._cmake.definitions["OPEN62541_VER_MAJOR"] = version.major - self._cmake.definitions["OPEN62541_VER_MINOR"] = version.minor - self._cmake.definitions["OPEN62541_VER_PATCH"] = version.patch + tc.variables["UA_LOGLEVEL"] = self._get_log_level() + tc.variables["UA_ENABLE_SUBSCRIPTIONS"] = self.options.subscription != False - self._cmake.definitions["UA_LOGLEVEL"] = self._get_log_level() - self._cmake.definitions["UA_ENABLE_SUBSCRIPTIONS"] = self.options.subscription != False if self.options.subscription != False: if "events" in str(self.options.subscription): - self._cmake.definitions["UA_ENABLE_SUBSCRIPTIONS_EVENTS"] = True + tc.variables["UA_ENABLE_SUBSCRIPTIONS_EVENTS"] = True if "alarms" in str(self.options.subscription) and "conditions" in str(self.options.subscription): - self._cmake.definitions["UA_ENABLE_SUBSCRIPTIONS_ALARMS_CONDITIONS"] = True - self._cmake.definitions["UA_ENABLE_METHODCALLS"] = self.options.methods - self._cmake.definitions["UA_ENABLE_NODEMANAGEMENT"] = self.options.dynamic_nodes - self._cmake.definitions["UA_ENABLE_AMALGAMATION"] = self.options.single_header + tc.variables["UA_ENABLE_SUBSCRIPTIONS_ALARMS_CONDITIONS"] = True + + tc.variables["UA_ENABLE_METHODCALLS"] = self.options.methods + tc.variables["UA_ENABLE_NODEMANAGEMENT"] = self.options.dynamic_nodes + tc.variables["UA_ENABLE_AMALGAMATION"] = self.options.single_header + if version >= "1.1.3": - self._cmake.definitions["UA_MULTITHREADING"] = self._get_multithreading_option( - ) - self._cmake.definitions["UA_ENABLE_IMMUTABLE_NODES"] = self.options.imutable_nodes - self._cmake.definitions["UA_ENABLE_WEBSOCKET_SERVER"] = self.options.web_socket - self._cmake.definitions["UA_ENABLE_HISTORIZING"] = self.options.historize != False + tc.variables["UA_MULTITHREADING"] = self._get_multithreading_option() + + tc.variables["UA_ENABLE_IMMUTABLE_NODES"] = self.options.imutable_nodes + tc.variables["UA_ENABLE_WEBSOCKET_SERVER"] = self.options.web_socket + tc.variables["UA_ENABLE_HISTORIZING"] = self.options.historize != False + if self.options.historize != False: if self.options.historize == "Experimental": - self._cmake.definitions["UA_ENABLE_EXPERIMENTAL_HISTORIZING"] = True - self._cmake.definitions["UA_ENABLE_DISCOVERY"] = self.options.discovery != False + tc.variables["UA_ENABLE_EXPERIMENTAL_HISTORIZING"] = True + + tc.variables["UA_ENABLE_DISCOVERY"] = self.options.discovery != False + if self.options.discovery != False: - self._cmake.definitions["UA_ENABLE_DISCOVERY_MULTICAST"] = \ - self.options.discovery == "With Multicast" or "multicast" in str(self.options.discovery) - self._cmake.definitions["UA_ENABLE_DISCOVERY_SEMAPHORE"] = \ - self.options.discovery_semaphore or "semaphore" in str(self.options.discovery) - self._cmake.definitions["UA_ENABLE_QUERY"] = self.options.query - if tools.Version(self.version) >= "1.3.1": + tc.variables["UA_ENABLE_DISCOVERY_MULTICAST"] = \ + self.options.discovery == "With Multicast" or "multicast" in str( + self.options.discovery) + tc.variables["UA_ENABLE_DISCOVERY_SEMAPHORE"] = \ + self.options.discovery_semaphore or "semaphore" in str( + self.options.discovery) + + tc.variables["UA_ENABLE_QUERY"] = self.options.query + + if Version(self.version) >= "1.3.1": if self.options.encryption == "openssl": - self._cmake.definitions["UA_ENABLE_ENCRYPTION"] = "OPENSSL" + tc.variables["UA_ENABLE_ENCRYPTION"] = "OPENSSL" elif self.options.encryption == "mbedtls": - self._cmake.definitions["UA_ENABLE_ENCRYPTION"] = "MBEDTLS" + tc.variables["UA_ENABLE_ENCRYPTION"] = "MBEDTLS" else: - self._cmake.definitions["UA_ENABLE_ENCRYPTION"] = "OFF" + tc.variables["UA_ENABLE_ENCRYPTION"] = "OFF" else: - self._cmake.definitions["UA_ENABLE_ENCRYPTION"] = self.options.encryption != False + tc.variables["UA_ENABLE_ENCRYPTION"] = self.options.encryption != False if self.options.encryption != False: if self.options.encryption == "openssl": - self._cmake.definitions["UA_ENABLE_ENCRYPTION_OPENSSL"] = True - self._cmake.definitions["UA_ENABLE_JSON_ENCODING"] = self.options.json_support - self._cmake.definitions["UA_ENABLE_PUBSUB"] = self.options.pub_sub != False - self._cmake.definitions["UA_ENABLE_PUBSUB_ENCRYPTION"] = self.options.pub_sub_encryption != False + tc.variables["UA_ENABLE_ENCRYPTION_OPENSSL"] = True + + tc.variables["UA_ENABLE_JSON_ENCODING"] = self.options.json_support + tc.variables["UA_ENABLE_PUBSUB"] = self.options.pub_sub != False + tc.variables["UA_ENABLE_PUBSUB_ENCRYPTION"] = self.options.pub_sub_encryption != False + if self.options.pub_sub != False: if self.settings.os == "Linux" and self.options.pub_sub == "Ethernet": - self._cmake.definitions["UA_ENABLE_PUBSUB_ETH_UADP"] = True + tc.variables["UA_ENABLE_PUBSUB_ETH_UADP"] = True elif self.settings.os == "Linux" and self.options.pub_sub == "Ethernet_XDP": - self._cmake.definitions["UA_ENABLE_PUBSUB_ETH_UADP_XDP"] = True - self._cmake.definitions["UA_ENABLE_DA"] = self.options.data_access + tc.variables["UA_ENABLE_PUBSUB_ETH_UADP_XDP"] = True + tc.variables["UA_ENABLE_DA"] = self.options.data_access + if self.options.compiled_nodeset_descriptions == True: - self._cmake.definitions["UA_ENABLE_NODESET_COMPILER_DESCRIPTIONS"] = self.options.compiled_nodeset_descriptions - self._cmake.definitions["UA_NAMESPACE_ZERO"] = "FULL" + tc.variables["UA_ENABLE_NODESET_COMPILER_DESCRIPTIONS"] = self.options.compiled_nodeset_descriptions + tc.variables["UA_NAMESPACE_ZERO"] = "FULL" else: - self._cmake.definitions["UA_NAMESPACE_ZERO"] = self.options.namespace_zero - if tools.Version(self.version) < "1.3.1": - self._cmake.definitions["UA_ENABLE_MICRO_EMB_DEV_PROFILE"] = self.options.embedded_profile - self._cmake.definitions["UA_ENABLE_TYPENAMES"] = self.options.typenames - self._cmake.definitions["UA_ENABLE_STATUSCODE_DESCRIPTIONS"] = self.options.readable_statuscodes - self._cmake.definitions["UA_ENABLE_HARDENING"] = self.options.hardening + tc.variables["UA_NAMESPACE_ZERO"] = self.options.namespace_zero + if Version(self.version) < "1.3.1": + tc.variables["UA_ENABLE_MICRO_EMB_DEV_PROFILE"] = self.options.embedded_profile + + tc.variables["UA_ENABLE_TYPENAMES"] = self.options.typenames + tc.variables["UA_ENABLE_STATUSCODE_DESCRIPTIONS"] = self.options.readable_statuscodes + tc.variables["UA_ENABLE_HARDENING"] = self.options.hardening + if self.settings.compiler == "Visual Studio" and self.options.shared == True: - self._cmake.definitions["UA_MSVC_FORCE_STATIC_CRT"] = True - self._cmake.definitions["UA_COMPILE_AS_CXX"] = self.options.cpp_compatible + tc.variables["UA_MSVC_FORCE_STATIC_CRT"] = True + + tc.variables["UA_COMPILE_AS_CXX"] = self.options.cpp_compatible + + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" - self._cmake.configure(source_dir=self._source_subfolder) - return self._cmake + tc.generate() + tc = CMakeDeps(self) + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) >= "1.3.1": - os.unlink(os.path.join(self._source_subfolder, "tools", "cmake", "FindPython3.cmake")) + apply_conandata_patches(self) + if Version(self.version) >= "1.3.1": + os.unlink(os.path.join(self.source_folder, + "tools", "cmake", "FindPython3.cmake")) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() @property def _tools_subfolder(self): - return os.path.join(self._source_subfolder, "tools") + return os.path.join(self.source_folder, "tools") + + @property + def _module_subfolder(self): + return os.path.join("lib", "cmake", "open62541") + + @property + def _module_file_rel_path(self): + return os.path.join(self._module_subfolder, "open62541Macros.cmake") def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("LICENSE-CC0", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + self.copy("LICENSE", dst="licenses", src=self.source_folder) + self.copy("LICENSE-CC0", dst="licenses", src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.remove_files_by_mask(os.path.join( - self.package_folder, "bin"), '*.pdb') - tools.remove_files_by_mask(os.path.join( - self.package_folder, "lib"), '*.pdb') + rm(self, '*.pdb', os.path.join(self.package_folder, "bin")) + rm(self, '*.pdb', os.path.join(self.package_folder, "lib")) for cmake_file in glob.glob(os.path.join(self.package_folder, self._module_subfolder, "*")): if not cmake_file.endswith(self._module_file_rel_path): os.remove(cmake_file) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - self.copy("generate_*.py", src=self._tools_subfolder, dst=os.path.join("res", "tools")) - self.copy("nodeset_compiler/*", src=self._tools_subfolder, dst=os.path.join("res", "tools")) - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake", "open62541") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) - @property - def _module_file_rel_path(self): - return os.path.join(self._module_subfolder, "open62541Macros.cmake") + self.copy("generate_*.py", src=self._tools_subfolder, + dst=os.path.join("res", "tools")) + self.copy("nodeset_compiler/*", src=self._tools_subfolder, + dst=os.path.join("res", "tools")) @staticmethod def _chmod_plus_x(filename): @@ -396,24 +422,38 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "open62541" self.cpp_info.names["cmake_find_package_multi"] = "open62541" self.cpp_info.names["pkg_config"] = "open62541" - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) self.cpp_info.includedirs = [ "include", os.path.join("include", "open62541", "plugin") ] # required for creating custom servers from ua-nodeset - self.user_info.tools_dir = os.path.join(self.package_folder, "res", "tools") - self._chmod_plus_x(os.path.join(self.package_folder, "res", "tools", "generate_nodeid_header.py")) + self.conf_info.define("user.open62541:tools_dir", os.path.join( + self.package_folder, "res", "tools").replace("\\", "/")) + # v1 legacy support for tools_dir definition + self.user_info.tools_dir = os.path.join( + self.package_folder, "res", "tools").replace("\\", "/") + self._chmod_plus_x(os.path.join(self.package_folder, + "res", "tools", "generate_nodeid_header.py")) if self.options.single_header: self.cpp_info.defines.append("UA_ENABLE_AMALGAMATION") if self.settings.os == "Windows": self.cpp_info.system_libs.append("ws2_32") - self.cpp_info.includedirs.append(os.path.join("include", "open62541", "win32")) + self.cpp_info.includedirs.append( + os.path.join("include", "open62541", "win32")) else: - self.cpp_info.includedirs.append(os.path.join("include", "open62541", "posix")) + self.cpp_info.includedirs.append( + os.path.join("include", "open62541", "posix")) if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.system_libs.extend(["pthread", "m", "rt"]) + self.cpp_info.builddirs.append(self._module_subfolder) - self.cpp_info.build_modules = [self._module_file_rel_path] + # v1 legacy support for open62541Macros.cmake auto-include + self.cpp_info.build_modules["cmake_find_package"] = [ + self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [ + self._module_file_rel_path] + self.cpp_info.set_property("cmake_build_modules", [ + self._module_file_rel_path]) diff --git a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_1_x.patch b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_1_x.patch index 62c1ab4b5cd3f..a90cc17ef1753 100644 --- a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_1_x.patch +++ b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_1_x.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2fd6ef2..e3bc6a5 100755 +index 2fd6ef29..0aa072b6 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,8 @@ endif() @@ -31,7 +31,14 @@ index 2fd6ef2..e3bc6a5 100755 ################# # Build Options # -@@ -462,7 +460,7 @@ if(UA_ENABLE_ENCRYPTION) +@@ -456,13 +454,13 @@ if(UA_ENABLE_ENCRYPTION) + # use the OpenSSL encryption library + # https://cmake.org/cmake/help/v3.0/module/FindOpenSSL.html + find_package(OpenSSL REQUIRED) +- list(APPEND open62541_LIBRARIES ${OPENSSL_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${OpenSSL_LIBRARIES}) + else() + # The recommended way is to install mbedtls via the OS package manager. If # that is not possible, manually compile mbedTLS and set the cmake variables # defined in /tools/cmake/FindMbedTLS.cmake. find_package(MbedTLS REQUIRED) @@ -66,7 +73,7 @@ index 2fd6ef2..e3bc6a5 100755 # Use a strict subset of the C and C++ languages check_add_cc_flag("-Wc++-compat") -@@ -632,8 +620,6 @@ if(APPLE) +@@ -632,8 +632,6 @@ if(APPLE) endif() if(MSVC) @@ -75,7 +82,7 @@ index 2fd6ef2..e3bc6a5 100755 if(UA_MSVC_FORCE_STATIC_CRT AND NOT BUILD_SHARED_LIBS) set(CompilerFlags CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE) -@@ -659,8 +645,8 @@ configure_file(include/open62541/config.h.in ${PROJECT_BINARY_DIR}/src_generated +@@ -659,8 +657,8 @@ configure_file(include/open62541/config.h.in ${PROJECT_BINARY_DIR}/src_generated configure_file(open62541.pc.in ${PROJECT_BINARY_DIR}/src_generated/open62541.pc @ONLY) if(UA_ENABLE_DISCOVERY_MULTICAST) @@ -85,7 +92,7 @@ index 2fd6ef2..e3bc6a5 100755 endif() set(exported_headers ${exported_headers} -@@ -946,18 +932,7 @@ if(UA_DEBUG_DUMP_PKGS) +@@ -946,18 +944,7 @@ if(UA_DEBUG_DUMP_PKGS) endif() if(UA_ENABLE_DISCOVERY_MULTICAST) @@ -104,7 +111,7 @@ index 2fd6ef2..e3bc6a5 100755 ${lib_sources}) endif() -@@ -1147,11 +1122,14 @@ if(UA_ENABLE_AMALGAMATION) +@@ -1147,10 +1134,13 @@ if(UA_ENABLE_AMALGAMATION) target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR}) target_include_directories(open62541-object PRIVATE "${ua_architecture_directories_to_include}") if(UA_ENABLE_ENCRYPTION_MBEDTLS) @@ -112,15 +119,15 @@ index 2fd6ef2..e3bc6a5 100755 + target_include_directories(open62541-object PRIVATE ${MbedTLS_INCLUDE_DIRS}) endif() if(UA_ENABLE_ENCRYPTION_OPENSSL) - target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) - endif() +- target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) ++ target_include_directories(open62541-object PRIVATE ${OpenSSL_INCLUDE_DIR}) ++ endif() + if(UA_ENABLE_WEBSOCKET_SERVER) + target_include_directories(open62541-plugins PRIVATE ${Libwebsockets_INCLUDE_DIR}) -+ endif() + endif() # make sure the open62541_amalgamation target builds before so that amalgamation is finished and it is not executed again for open62541-object - # and thus may overwrite the amalgamation result during multiprocessor compilation -@@ -1186,6 +1164,9 @@ else() +@@ -1186,6 +1176,9 @@ else() ) target_include_directories(open62541-object PRIVATE ${PROJECT_SOURCE_DIR}/src) @@ -130,7 +137,7 @@ index 2fd6ef2..e3bc6a5 100755 add_library(open62541-plugins OBJECT ${default_plugin_sources} ${ua_architecture_sources} ${exported_headers}) add_dependencies(open62541-plugins open62541-generator-types open62541-generator-transport open62541-generator-namespace) -@@ -1194,6 +1175,10 @@ else() +@@ -1194,6 +1187,10 @@ else() target_compile_definitions(open62541-plugins PRIVATE -DUA_DYNAMIC_LINKING_EXPORT) set_target_properties(open62541-plugins PROPERTIES FOLDER "open62541/lib") @@ -141,7 +148,7 @@ index 2fd6ef2..e3bc6a5 100755 if(UA_PACK_DEBIAN) add_library(open62541-static STATIC $ $) set_target_properties(open62541-static PROPERTIES OUTPUT_NAME open62541) -@@ -1232,7 +1217,7 @@ else() +@@ -1232,10 +1229,10 @@ else() include_directories_private("${PROJECT_BINARY_DIR}") if(UA_ENABLE_ENCRYPTION_MBEDTLS) @@ -149,9 +156,13 @@ index 2fd6ef2..e3bc6a5 100755 + include_directories_private(${MbedTLS_INCLUDE_DIRS}) endif() if(UA_ENABLE_ENCRYPTION_OPENSSL) - include_directories_private(${OPENSSL_INCLUDE_DIR}) +- include_directories_private(${OPENSSL_INCLUDE_DIR}) ++ include_directories_private(${OpenSSL_INCLUDE_DIR}) + endif() + + # Option-specific includes diff --git a/src/server/ua_discovery_manager.h b/src/server/ua_discovery_manager.h -index 7787b40..99dc884 100644 +index 7787b40e..99dc884b 100644 --- a/src/server/ua_discovery_manager.h +++ b/src/server/ua_discovery_manager.h @@ -50,7 +50,7 @@ typedef struct periodicServerRegisterCallback_entry { @@ -164,7 +175,7 @@ index 7787b40..99dc884 100644 /** * TXT record: diff --git a/src/server/ua_server_discovery_mdns.c b/src/server/ua_server_discovery_mdns.c -index 6121b8c..e4cae7c 100644 +index 6121b8c3..e4cae7c5 100644 --- a/src/server/ua_server_discovery_mdns.c +++ b/src/server/ua_server_discovery_mdns.c @@ -11,8 +11,8 @@ diff --git a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_2_x.patch b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_2_x.patch index 1b8a156ff258b..97765e7ca4ecf 100644 --- a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_2_x.patch +++ b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_2_x.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 9184b943..8f4b6772 100644 +index ae6405e9..df78f4e9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,8 @@ endif() @@ -31,7 +31,14 @@ index 9184b943..8f4b6772 100644 ################# # Build Options # -@@ -481,7 +479,7 @@ if(UA_ENABLE_ENCRYPTION) +@@ -475,13 +473,13 @@ if(UA_ENABLE_ENCRYPTION) + # use the OpenSSL encryption library + # https://cmake.org/cmake/help/v3.0/module/FindOpenSSL.html + find_package(OpenSSL REQUIRED) +- list(APPEND open62541_LIBRARIES ${OPENSSL_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${OpenSSL_LIBRARIES}) + else() + # The recommended way is to install mbedtls via the OS package manager. If # that is not possible, manually compile mbedTLS and set the cmake variables # defined in /tools/cmake/FindMbedTLS.cmake. find_package(MbedTLS REQUIRED) @@ -116,7 +123,7 @@ index 9184b943..8f4b6772 100644 ${lib_sources}) endif() -@@ -1178,11 +1152,14 @@ if(UA_ENABLE_AMALGAMATION) +@@ -1178,10 +1152,13 @@ if(UA_ENABLE_AMALGAMATION) target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR}) target_include_directories(open62541-object PRIVATE "${ua_architecture_directories_to_include}") if(UA_ENABLE_ENCRYPTION_MBEDTLS) @@ -124,14 +131,14 @@ index 9184b943..8f4b6772 100644 + target_include_directories(open62541-object PRIVATE ${MbedTLS_INCLUDE_DIRS}) endif() if(UA_ENABLE_ENCRYPTION_OPENSSL) - target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) - endif() +- target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) ++ target_include_directories(open62541-object PRIVATE ${OpenSSL_INCLUDE_DIR}) ++ endif() + if(UA_ENABLE_WEBSOCKET_SERVER) + target_include_directories(open62541-plugins PRIVATE ${Libwebsockets_INCLUDE_DIR}) -+ endif() + endif() # make sure the open62541_amalgamation target builds before so that amalgamation is finished and it is not executed again for open62541-object - # and thus may overwrite the amalgamation result during multiprocessor compilation @@ -1217,6 +1194,12 @@ else() ) @@ -159,7 +166,7 @@ index 9184b943..8f4b6772 100644 if(UA_FORCE_CPP) set_source_files_properties(${lib_sources} PROPERTIES LANGUAGE CXX) -@@ -1263,7 +1253,7 @@ else() +@@ -1263,10 +1253,10 @@ else() include_directories_private("${PROJECT_BINARY_DIR}") if(UA_ENABLE_ENCRYPTION_MBEDTLS) @@ -167,7 +174,11 @@ index 9184b943..8f4b6772 100644 + include_directories_private(${MbedTLS_INCLUDE_DIRS}) endif() if(UA_ENABLE_ENCRYPTION_OPENSSL) - include_directories_private(${OPENSSL_INCLUDE_DIR}) +- include_directories_private(${OPENSSL_INCLUDE_DIR}) ++ include_directories_private(${OpenSSL_INCLUDE_DIR}) + endif() + + # Option-specific includes diff --git a/src/server/ua_discovery_manager.h b/src/server/ua_discovery_manager.h index 38de16e7..16b137af 100644 --- a/src/server/ua_discovery_manager.h diff --git a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_1.patch b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_1.patch new file mode 100644 index 0000000000000..470202a51fce2 --- /dev/null +++ b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_1.patch @@ -0,0 +1,200 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 2a140ebd..bbca9b1f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,7 +11,7 @@ endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER_CASE) + +-set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake") ++set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR};${PROJECT_SOURCE_DIR}/tools/cmake") + find_package(Python3 REQUIRED) + set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) + find_package(Git) +@@ -40,15 +40,12 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + # The current version information. On the master branch, we take the version + # number from the latest release plus the "-undefined" label. Will be + # overwritten with more detailed information if git is available. +-set(OPEN62541_VER_MAJOR 1) +-set(OPEN62541_VER_MINOR 2) +-set(OPEN62541_VER_PATCH 2) +-set(OPEN62541_VER_LABEL "-unknown") # like "-rc1" or "-g4538abcd" or "-g4538abcd-dirty" +-set(OPEN62541_VER_COMMIT "undefined") + +-# Overwrite the version information based on git if available +-include(SetGitBasedVersion) +-set_open62541_version() ++set(OPEN62541_VER_MINOR "0" CACHE STRING "Set the major version. Used by conan") ++set(OPEN62541_VER_MAJOR "0" CACHE STRING "Set the minor version. Used by conan") ++set(OPEN62541_VER_PATCH "0" CACHE STRING "Set the patch version. Used by conan") ++set(OPEN62541_VER_LABEL "") ++set(OPEN62541_VER_COMMIT "${OPEN62541_VER_MAJOR}.${OPEN62541_VER_MINOR}.${OPEN62541_VER_PATCH}") + + # Examples for the version string are: + # v1.2 +@@ -580,7 +577,7 @@ if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) + # use the OpenSSL encryption library + # https://cmake.org/cmake/help/v3.0/module/FindOpenSSL.html + find_package(OpenSSL REQUIRED) +- list(APPEND open62541_LIBRARIES ${OPENSSL_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${OpenSSL_LIBRARIES}) + endif () + + if(UA_ENABLE_ENCRYPTION_LIBRESSL) +@@ -598,7 +595,7 @@ if(UA_ENABLE_ENCRYPTION_MBEDTLS OR UA_ENABLE_PUBSUB_ENCRYPTION) + # that is not possible, manually compile mbedTLS and set the cmake variables + # defined in /tools/cmake/FindMbedTLS.cmake. + find_package(MbedTLS REQUIRED) +- list(APPEND open62541_LIBRARIES ${MBEDTLS_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${MbedTLS_LIBRARIES}) + endif() + + if(UA_ENABLE_TPM2_SECURITY) +@@ -609,8 +606,10 @@ if(UA_ENABLE_WEBSOCKET_SERVER) + # The recommended way is to install libwebsockets via the OS package manager. If + # that is not possible, manually compile libwebsockets and set the cmake variables + # defined in /tools/cmake/Findlibwebsockets.cmake +- find_package(libwebsockets REQUIRED) +- list(APPEND open62541_LIBRARIES ${LIBWEBSOCKETS_LIBRARIES}) ++ find_package(Libwebsockets REQUIRED) ++ list(APPEND open62541_LIBRARIES ${Libwebsockets_LIBRARIES}) ++ message(STATUS "Libwebsockets library: ${Libwebsockets_LIBRARIES}") ++ message(STATUS "Libwebsockets includes: ${Libwebsockets_INCLUDE_DIRS}") + + set(ua_architecture_directories_to_include ${ua_architecture_directories_to_include} + ${LIBWEBSOCKETS_INCLUDE_DIR}) +@@ -725,7 +724,7 @@ if(NOT UA_FORCE_CPP AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" ST + set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default + + # Debug +- if(BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND ++ if(FALSE AND BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND + "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang" AND NOT UA_ENABLE_UNIT_TESTS_MEMCHECK) + # Add default sanitizer settings when using clang and Debug build. + # This allows e.g. CLion to find memory locations for SegFaults +@@ -811,24 +810,7 @@ configure_file(include/open62541/config.h.in ${PROJECT_BINARY_DIR}/src_generated + configure_file(tools/open62541.pc.in ${PROJECT_BINARY_DIR}/src_generated/open62541.pc @ONLY) + + if(UA_ENABLE_DISCOVERY_MULTICAST) +- include(GenerateExportHeader) +- set(MDNSD_LOGLEVEL 300 CACHE STRING "Level at which logs shall be reported" FORCE) +- # create a "fake" empty library to generate the export header macros +- add_library(libmdnsd ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.h) +- if (UA_FORCE_CPP) +- set_property(TARGET libmdnsd PROPERTY LINKER_LANGUAGE CXX) +- else() +- set_property(TARGET libmdnsd PROPERTY LINKER_LANGUAGE C) +- endif() +- set_property(TARGET libmdnsd PROPERTY DEFINE_SYMBOL "MDNSD_DYNAMIC_LINKING_EXPORT") +- configure_file("deps/mdnsd/libmdnsd/mdnsd_config_extra.in" +- "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config_extra") +- file(READ "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config_extra" MDNSD_CONFIG_EXTRA) +- generate_export_header(libmdnsd +- EXPORT_FILE_NAME "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config.h" +- BASE_NAME MDNSD +- DEFINE_NO_DEPRECATED +- CUSTOM_CONTENT_FROM_VARIABLE MDNSD_CONFIG_EXTRA) ++ find_package(mdnsd) + endif() + + set(exported_headers ${ua_architecture_headers_beginning}) +@@ -1133,18 +1115,7 @@ if(UA_DEBUG_DUMP_PKGS) + endif() + + if(UA_ENABLE_DISCOVERY_MULTICAST) +- # prepend in list, otherwise it complains that winsock2.h has to be included before windows.h +- set(internal_headers ${PROJECT_BINARY_DIR}/src_generated/mdnsd_config.h +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/1035.h +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/xht.h +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/sdtxt.h +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.h +- ${internal_headers} ) + set(lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_server_discovery_mdns.c +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/1035.c +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/xht.c +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/sdtxt.c +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.c + ${lib_sources}) + endif() + +@@ -1349,10 +1320,10 @@ if(UA_ENABLE_AMALGAMATION) + target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR}) + target_include_directories(open62541-object PRIVATE "${ua_architecture_directories_to_include}") + if(UA_ENABLE_ENCRYPTION_MBEDTLS) +- target_include_directories(open62541-object PRIVATE ${MBEDTLS_INCLUDE_DIRS}) ++ target_include_directories(open62541-object PRIVATE ${MbedTLS_INCLUDE_DIRS}) + endif() + if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) +- target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) ++ target_include_directories(open62541-object PRIVATE ${OpenSSL_INCLUDE_DIR}) + endif() + if(UA_ENABLE_ENCRYPTION_LIBRESSL) + target_include_directories(open62541-object PRIVATE ${LIBRESSL_INCLUDE_DIR}) +@@ -1391,6 +1362,12 @@ else() + ) + + target_include_directories(open62541-object PRIVATE ${PROJECT_SOURCE_DIR}/src) ++ if(UA_ENABLE_DISCOVERY_MULTICAST) ++ target_include_directories(open62541-object PUBLIC ${mdnsd_INCLUDE_DIRS}) ++ endif() ++ if(UA_ENABLE_WEBSOCKET_SERVER) ++ target_include_directories(open62541-object PUBLIC ${Libwebsockets_INCLUDE_DIRS}) ++ endif() + + add_library(open62541-plugins OBJECT ${default_plugin_sources} ${ua_architecture_sources} ${exported_headers}) + add_dependencies(open62541-plugins open62541-generator-types open62541-generator-transport open62541-generator-namespace) +@@ -1404,6 +1381,13 @@ else() + set_target_properties(open62541-static PROPERTIES OUTPUT_NAME open62541) + endif() + add_library(open62541 $ $) ++ if(UA_ENABLE_DISCOVERY_MULTICAST) ++ list(APPEND open62541_LIBRARIES mdnsd::mdnsd) ++ endif() ++ ++ if(UA_ENABLE_WEBSOCKET_SERVER) ++ list(APPEND open62541_LIBRARIES Libwebsockets::Libwebsockets) ++ endif() + + if(UA_FORCE_CPP) + set_source_files_properties(${lib_sources} PROPERTIES LANGUAGE CXX) +@@ -1444,10 +1428,10 @@ else() + include_directories_private("${PROJECT_BINARY_DIR}") + + if(UA_ENABLE_ENCRYPTION_MBEDTLS) +- include_directories_private(${MBEDTLS_INCLUDE_DIRS}) ++ include_directories_private(${MbedTLS_INCLUDE_DIRS}) + endif() + if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) +- include_directories_private(${OPENSSL_INCLUDE_DIR}) ++ include_directories_private(${OpenSSL_INCLUDE_DIR}) + endif() + if(UA_ENABLE_ENCRYPTION_LIBRESSL) + include_directories_private(${LIBRESSL_INCLUDE_DIR}) +diff --git a/src/server/ua_discovery_manager.h b/src/server/ua_discovery_manager.h +index e0f48c0f..bae9bd65 100644 +--- a/src/server/ua_discovery_manager.h ++++ b/src/server/ua_discovery_manager.h +@@ -44,7 +44,7 @@ typedef struct periodicServerRegisterCallback_entry { + + #ifdef UA_ENABLE_DISCOVERY_MULTICAST + +-#include "mdnsd/libmdnsd/mdnsd.h" ++#include "libmdnsd/mdnsd.h" + + /** + * TXT record: +diff --git a/src/server/ua_server_discovery_mdns.c b/src/server/ua_server_discovery_mdns.c +index fccb9c73..aa585b8f 100644 +--- a/src/server/ua_server_discovery_mdns.c ++++ b/src/server/ua_server_discovery_mdns.c +@@ -11,8 +11,8 @@ + #ifdef UA_ENABLE_DISCOVERY_MULTICAST + + #ifndef UA_ENABLE_AMALGAMATION +-#include "mdnsd/libmdnsd/xht.h" +-#include "mdnsd/libmdnsd/sdtxt.h" ++#include "libmdnsd/xht.h" ++#include "libmdnsd/sdtxt.h" + #endif + + #ifdef _WIN32 diff --git a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_4.patch b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_4.patch new file mode 100644 index 0000000000000..c1c291956aa8a --- /dev/null +++ b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_4.patch @@ -0,0 +1,196 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1934374e..199df369 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -11,7 +11,7 @@ endif() + + string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER_CASE) + +-set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake") ++set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR};${PROJECT_SOURCE_DIR}/tools/cmake") + find_package(Python3 REQUIRED) + set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) + find_package(Git) +@@ -41,11 +41,11 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) + # The current version information. On the master branch, we take the version + # number from the latest release plus the "-undefined" label. Will be + # overwritten with more detailed information if git is available. +-set(OPEN62541_VER_MAJOR 1) +-set(OPEN62541_VER_MINOR 3) +-set(OPEN62541_VER_PATCH 3) +-set(OPEN62541_VER_LABEL "-undefined") # like "-rc1" or "-g4538abcd" or "-g4538abcd-dirty" +-set(OPEN62541_VER_COMMIT "unknown-commit") ++set(OPEN62541_VER_MINOR "0" CACHE STRING "Set the major version. Used by conan") ++set(OPEN62541_VER_MAJOR "0" CACHE STRING "Set the minor version. Used by conan") ++set(OPEN62541_VER_PATCH "0" CACHE STRING "Set the patch version. Used by conan") ++set(OPEN62541_VER_LABEL "") ++set(OPEN62541_VER_COMMIT "${OPEN62541_VER_MAJOR}.${OPEN62541_VER_MINOR}.${OPEN62541_VER_PATCH}") + + # Overwrite the version information based on git if available + include(SetGitBasedVersion) +@@ -601,7 +601,7 @@ if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) + # use the OpenSSL encryption library + # https://cmake.org/cmake/help/v3.0/module/FindOpenSSL.html + find_package(OpenSSL REQUIRED) +- list(APPEND open62541_LIBRARIES ${OPENSSL_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${OpenSSL_LIBRARIES}) + endif () + + if(UA_ENABLE_ENCRYPTION_LIBRESSL) +@@ -619,7 +619,7 @@ if(UA_ENABLE_ENCRYPTION_MBEDTLS OR UA_ENABLE_PUBSUB_ENCRYPTION) + # that is not possible, manually compile mbedTLS and set the cmake variables + # defined in /tools/cmake/FindMbedTLS.cmake. + find_package(MbedTLS REQUIRED) +- list(APPEND open62541_LIBRARIES ${MBEDTLS_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${MbedTLS_LIBRARIES}) + endif() + + if(UA_ENABLE_TPM2_SECURITY) +@@ -630,8 +630,10 @@ if(UA_ENABLE_WEBSOCKET_SERVER) + # The recommended way is to install libwebsockets via the OS package manager. If + # that is not possible, manually compile libwebsockets and set the cmake variables + # defined in /tools/cmake/Findlibwebsockets.cmake +- find_package(libwebsockets REQUIRED) +- list(APPEND open62541_LIBRARIES ${LIBWEBSOCKETS_LIBRARIES}) ++ find_package(Libwebsockets REQUIRED) ++ list(APPEND open62541_LIBRARIES ${Libwebsockets_LIBRARIES}) ++ message(STATUS "Libwebsockets library: ${Libwebsockets_LIBRARIES}") ++ message(STATUS "Libwebsockets includes: ${Libwebsockets_INCLUDE_DIRS}") + + set(ua_architecture_directories_to_include ${ua_architecture_directories_to_include} + ${LIBWEBSOCKETS_INCLUDE_DIR}) +@@ -746,7 +748,7 @@ if(NOT UA_FORCE_CPP AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" ST + set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default + + # Debug +- if(BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND ++ if(FALSE AND BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND + "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang" AND NOT UA_ENABLE_UNIT_TESTS_MEMCHECK) + # Add default sanitizer settings when using clang and Debug build. + # This allows e.g. CLion to find memory locations for SegFaults +@@ -832,24 +834,7 @@ configure_file(include/open62541/config.h.in ${PROJECT_BINARY_DIR}/src_generated + configure_file(tools/open62541.pc.in ${PROJECT_BINARY_DIR}/src_generated/open62541.pc @ONLY) + + if(UA_ENABLE_DISCOVERY_MULTICAST) +- include(GenerateExportHeader) +- set(MDNSD_LOGLEVEL 300 CACHE STRING "Level at which logs shall be reported" FORCE) +- # create a "fake" empty library to generate the export header macros +- add_library(libmdnsd ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.h) +- if (UA_FORCE_CPP) +- set_property(TARGET libmdnsd PROPERTY LINKER_LANGUAGE CXX) +- else() +- set_property(TARGET libmdnsd PROPERTY LINKER_LANGUAGE C) +- endif() +- set_property(TARGET libmdnsd PROPERTY DEFINE_SYMBOL "MDNSD_DYNAMIC_LINKING_EXPORT") +- configure_file("deps/mdnsd/libmdnsd/mdnsd_config_extra.in" +- "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config_extra") +- file(READ "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config_extra" MDNSD_CONFIG_EXTRA) +- generate_export_header(libmdnsd +- EXPORT_FILE_NAME "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config.h" +- BASE_NAME MDNSD +- DEFINE_NO_DEPRECATED +- CUSTOM_CONTENT_FROM_VARIABLE MDNSD_CONFIG_EXTRA) ++ find_package(mdnsd) + endif() + + set(exported_headers ${ua_architecture_headers_beginning}) +@@ -1154,18 +1139,7 @@ if(UA_DEBUG_DUMP_PKGS) + endif() + + if(UA_ENABLE_DISCOVERY_MULTICAST) +- # prepend in list, otherwise it complains that winsock2.h has to be included before windows.h +- set(internal_headers ${PROJECT_BINARY_DIR}/src_generated/mdnsd_config.h +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/1035.h +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/xht.h +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/sdtxt.h +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.h +- ${internal_headers} ) + set(lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_server_discovery_mdns.c +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/1035.c +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/xht.c +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/sdtxt.c +- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.c + ${lib_sources}) + endif() + +@@ -1370,10 +1344,10 @@ if(UA_ENABLE_AMALGAMATION) + target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR}) + target_include_directories(open62541-object PRIVATE "${ua_architecture_directories_to_include}") + if(UA_ENABLE_ENCRYPTION_MBEDTLS) +- target_include_directories(open62541-object PRIVATE ${MBEDTLS_INCLUDE_DIRS}) ++ target_include_directories(open62541-object PRIVATE ${MbedTLS_INCLUDE_DIRS}) + endif() + if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) +- target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) ++ target_include_directories(open62541-object PRIVATE ${OpenSSL_INCLUDE_DIR}) + endif() + if(UA_ENABLE_ENCRYPTION_LIBRESSL) + target_include_directories(open62541-object PRIVATE ${LIBRESSL_INCLUDE_DIR}) +@@ -1412,6 +1386,12 @@ else() + ) + + target_include_directories(open62541-object PRIVATE ${PROJECT_SOURCE_DIR}/src) ++ if(UA_ENABLE_DISCOVERY_MULTICAST) ++ target_include_directories(open62541-object PUBLIC ${mdnsd_INCLUDE_DIRS}) ++ endif() ++ if(UA_ENABLE_WEBSOCKET_SERVER) ++ target_include_directories(open62541-object PUBLIC ${Libwebsockets_INCLUDE_DIRS}) ++ endif() + + add_library(open62541-plugins OBJECT ${default_plugin_sources} ${ua_architecture_sources} ${exported_headers}) + add_dependencies(open62541-plugins open62541-generator-types open62541-generator-transport open62541-generator-namespace) +@@ -1425,6 +1405,13 @@ else() + set_target_properties(open62541-static PROPERTIES OUTPUT_NAME open62541) + endif() + add_library(open62541 $ $) ++ if(UA_ENABLE_DISCOVERY_MULTICAST) ++ list(APPEND open62541_LIBRARIES mdnsd::mdnsd) ++ endif() ++ ++ if(UA_ENABLE_WEBSOCKET_SERVER) ++ list(APPEND open62541_LIBRARIES Libwebsockets::Libwebsockets) ++ endif() + + if(UA_FORCE_CPP) + set_source_files_properties(${lib_sources} PROPERTIES LANGUAGE CXX) +@@ -1465,10 +1452,10 @@ else() + include_directories_private("${PROJECT_BINARY_DIR}") + + if(UA_ENABLE_ENCRYPTION_MBEDTLS) +- include_directories_private(${MBEDTLS_INCLUDE_DIRS}) ++ include_directories_private(${MbedTLS_INCLUDE_DIRS}) + endif() + if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) +- include_directories_private(${OPENSSL_INCLUDE_DIR}) ++ include_directories_private(${OpenSSL_INCLUDE_DIR}) + endif() + if(UA_ENABLE_ENCRYPTION_LIBRESSL) + include_directories_private(${LIBRESSL_INCLUDE_DIR}) +diff --git a/src/server/ua_discovery_manager.h b/src/server/ua_discovery_manager.h +index e0f48c0f..bae9bd65 100644 +--- a/src/server/ua_discovery_manager.h ++++ b/src/server/ua_discovery_manager.h +@@ -44,7 +44,7 @@ typedef struct periodicServerRegisterCallback_entry { + + #ifdef UA_ENABLE_DISCOVERY_MULTICAST + +-#include "mdnsd/libmdnsd/mdnsd.h" ++#include "libmdnsd/mdnsd.h" + + /** + * TXT record: +diff --git a/src/server/ua_server_discovery_mdns.c b/src/server/ua_server_discovery_mdns.c +index fccb9c73..aa585b8f 100644 +--- a/src/server/ua_server_discovery_mdns.c ++++ b/src/server/ua_server_discovery_mdns.c +@@ -11,8 +11,8 @@ + #ifdef UA_ENABLE_DISCOVERY_MULTICAST + + #ifndef UA_ENABLE_AMALGAMATION +-#include "mdnsd/libmdnsd/xht.h" +-#include "mdnsd/libmdnsd/sdtxt.h" ++#include "libmdnsd/xht.h" ++#include "libmdnsd/sdtxt.h" + #endif + + #ifdef _WIN32 diff --git a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_x.patch b/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_x.patch deleted file mode 100644 index cdefdfc0dde97..0000000000000 --- a/recipes/open62541/all/patches/0001-fix-cmake-find-deps-1_3_x.patch +++ /dev/null @@ -1,183 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 2a140ebd..605aed72 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -11,7 +11,7 @@ endif() - - string(TOLOWER "${CMAKE_BUILD_TYPE}" BUILD_TYPE_LOWER_CASE) - --set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/tools/cmake") -+set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${PROJECT_SOURCE_DIR};${PROJECT_SOURCE_DIR}/tools/cmake") - find_package(Python3 REQUIRED) - set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) - find_package(Git) -@@ -40,15 +40,12 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) - # The current version information. On the master branch, we take the version - # number from the latest release plus the "-undefined" label. Will be - # overwritten with more detailed information if git is available. --set(OPEN62541_VER_MAJOR 1) --set(OPEN62541_VER_MINOR 2) --set(OPEN62541_VER_PATCH 2) --set(OPEN62541_VER_LABEL "-unknown") # like "-rc1" or "-g4538abcd" or "-g4538abcd-dirty" --set(OPEN62541_VER_COMMIT "undefined") - --# Overwrite the version information based on git if available --include(SetGitBasedVersion) --set_open62541_version() -+set(OPEN62541_VER_MINOR "0" CACHE STRING "Set the major version. Used by conan") -+set(OPEN62541_VER_MAJOR "0" CACHE STRING "Set the minor version. Used by conan") -+set(OPEN62541_VER_PATCH "0" CACHE STRING "Set the patch version. Used by conan") -+set(OPEN62541_VER_LABEL "") -+set(OPEN62541_VER_COMMIT "${OPEN62541_VER_MAJOR}.${OPEN62541_VER_MINOR}.${OPEN62541_VER_PATCH}") - - # Examples for the version string are: - # v1.2 -@@ -598,7 +595,7 @@ if(UA_ENABLE_ENCRYPTION_MBEDTLS OR UA_ENABLE_PUBSUB_ENCRYPTION) - # that is not possible, manually compile mbedTLS and set the cmake variables - # defined in /tools/cmake/FindMbedTLS.cmake. - find_package(MbedTLS REQUIRED) -- list(APPEND open62541_LIBRARIES ${MBEDTLS_LIBRARIES}) -+ list(APPEND open62541_LIBRARIES ${MbedTLS_LIBRARIES}) - endif() - - if(UA_ENABLE_TPM2_SECURITY) -@@ -609,8 +606,10 @@ if(UA_ENABLE_WEBSOCKET_SERVER) - # The recommended way is to install libwebsockets via the OS package manager. If - # that is not possible, manually compile libwebsockets and set the cmake variables - # defined in /tools/cmake/Findlibwebsockets.cmake -- find_package(libwebsockets REQUIRED) -- list(APPEND open62541_LIBRARIES ${LIBWEBSOCKETS_LIBRARIES}) -+ find_package(Libwebsockets REQUIRED) -+ list(APPEND open62541_LIBRARIES ${Libwebsockets_LIBRARIES}) -+ message(STATUS "Libwebsockets library: ${Libwebsockets_LIBRARIES}") -+ message(STATUS "Libwebsockets includes: ${Libwebsockets_INCLUDE_DIRS}") - - set(ua_architecture_directories_to_include ${ua_architecture_directories_to_include} - ${LIBWEBSOCKETS_INCLUDE_DIR}) -@@ -725,7 +724,7 @@ if(NOT UA_FORCE_CPP AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID}" ST - set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # cmake sets -rdynamic by default - - # Debug -- if(BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND -+ if(FALSE AND BUILD_TYPE_LOWER_CASE STREQUAL "debug" AND UNIX AND NOT UA_BUILD_OSS_FUZZ AND - "x${CMAKE_C_COMPILER_ID}" STREQUAL "xClang" AND NOT UA_ENABLE_UNIT_TESTS_MEMCHECK) - # Add default sanitizer settings when using clang and Debug build. - # This allows e.g. CLion to find memory locations for SegFaults -@@ -811,24 +810,7 @@ configure_file(include/open62541/config.h.in ${PROJECT_BINARY_DIR}/src_generated - configure_file(tools/open62541.pc.in ${PROJECT_BINARY_DIR}/src_generated/open62541.pc @ONLY) - - if(UA_ENABLE_DISCOVERY_MULTICAST) -- include(GenerateExportHeader) -- set(MDNSD_LOGLEVEL 300 CACHE STRING "Level at which logs shall be reported" FORCE) -- # create a "fake" empty library to generate the export header macros -- add_library(libmdnsd ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.h) -- if (UA_FORCE_CPP) -- set_property(TARGET libmdnsd PROPERTY LINKER_LANGUAGE CXX) -- else() -- set_property(TARGET libmdnsd PROPERTY LINKER_LANGUAGE C) -- endif() -- set_property(TARGET libmdnsd PROPERTY DEFINE_SYMBOL "MDNSD_DYNAMIC_LINKING_EXPORT") -- configure_file("deps/mdnsd/libmdnsd/mdnsd_config_extra.in" -- "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config_extra") -- file(READ "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config_extra" MDNSD_CONFIG_EXTRA) -- generate_export_header(libmdnsd -- EXPORT_FILE_NAME "${PROJECT_BINARY_DIR}/src_generated/mdnsd_config.h" -- BASE_NAME MDNSD -- DEFINE_NO_DEPRECATED -- CUSTOM_CONTENT_FROM_VARIABLE MDNSD_CONFIG_EXTRA) -+ find_package(mdnsd) - endif() - - set(exported_headers ${ua_architecture_headers_beginning}) -@@ -1133,18 +1115,7 @@ if(UA_DEBUG_DUMP_PKGS) - endif() - - if(UA_ENABLE_DISCOVERY_MULTICAST) -- # prepend in list, otherwise it complains that winsock2.h has to be included before windows.h -- set(internal_headers ${PROJECT_BINARY_DIR}/src_generated/mdnsd_config.h -- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/1035.h -- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/xht.h -- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/sdtxt.h -- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.h -- ${internal_headers} ) - set(lib_sources ${PROJECT_SOURCE_DIR}/src/server/ua_server_discovery_mdns.c -- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/1035.c -- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/xht.c -- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/sdtxt.c -- ${PROJECT_SOURCE_DIR}/deps/mdnsd/libmdnsd/mdnsd.c - ${lib_sources}) - endif() - -@@ -1349,7 +1320,7 @@ if(UA_ENABLE_AMALGAMATION) - target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR}) - target_include_directories(open62541-object PRIVATE "${ua_architecture_directories_to_include}") - if(UA_ENABLE_ENCRYPTION_MBEDTLS) -- target_include_directories(open62541-object PRIVATE ${MBEDTLS_INCLUDE_DIRS}) -+ target_include_directories(open62541-object PRIVATE ${MbedTLS_INCLUDE_DIRS}) - endif() - if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) - target_include_directories(open62541-object PRIVATE ${OPENSSL_INCLUDE_DIR}) -@@ -1391,6 +1362,12 @@ else() - ) - - target_include_directories(open62541-object PRIVATE ${PROJECT_SOURCE_DIR}/src) -+ if(UA_ENABLE_DISCOVERY_MULTICAST) -+ target_include_directories(open62541-object PUBLIC ${mdnsd_INCLUDE_DIRS}) -+ endif() -+ if(UA_ENABLE_WEBSOCKET_SERVER) -+ target_include_directories(open62541-object PUBLIC ${Libwebsockets_INCLUDE_DIRS}) -+ endif() - - add_library(open62541-plugins OBJECT ${default_plugin_sources} ${ua_architecture_sources} ${exported_headers}) - add_dependencies(open62541-plugins open62541-generator-types open62541-generator-transport open62541-generator-namespace) -@@ -1404,6 +1381,13 @@ else() - set_target_properties(open62541-static PROPERTIES OUTPUT_NAME open62541) - endif() - add_library(open62541 $ $) -+ if(UA_ENABLE_DISCOVERY_MULTICAST) -+ list(APPEND open62541_LIBRARIES mdnsd::mdnsd) -+ endif() -+ -+ if(UA_ENABLE_WEBSOCKET_SERVER) -+ list(APPEND open62541_LIBRARIES Libwebsockets::Libwebsockets) -+ endif() - - if(UA_FORCE_CPP) - set_source_files_properties(${lib_sources} PROPERTIES LANGUAGE CXX) -@@ -1444,7 +1428,7 @@ else() - include_directories_private("${PROJECT_BINARY_DIR}") - - if(UA_ENABLE_ENCRYPTION_MBEDTLS) -- include_directories_private(${MBEDTLS_INCLUDE_DIRS}) -+ include_directories_private(${MbedTLS_INCLUDE_DIRS}) - endif() - if(UA_ENABLE_ENCRYPTION_OPENSSL OR UA_ENABLE_MQTT_TLS_OPENSSL) - include_directories_private(${OPENSSL_INCLUDE_DIR}) -diff --git a/src/server/ua_discovery_manager.h b/src/server/ua_discovery_manager.h -index e0f48c0f..bae9bd65 100644 ---- a/src/server/ua_discovery_manager.h -+++ b/src/server/ua_discovery_manager.h -@@ -44,7 +44,7 @@ typedef struct periodicServerRegisterCallback_entry { - - #ifdef UA_ENABLE_DISCOVERY_MULTICAST - --#include "mdnsd/libmdnsd/mdnsd.h" -+#include "libmdnsd/mdnsd.h" - - /** - * TXT record: -diff --git a/src/server/ua_server_discovery_mdns.c b/src/server/ua_server_discovery_mdns.c -index fccb9c73..aa585b8f 100644 ---- a/src/server/ua_server_discovery_mdns.c -+++ b/src/server/ua_server_discovery_mdns.c -@@ -11,8 +11,8 @@ - #ifdef UA_ENABLE_DISCOVERY_MULTICAST - - #ifndef UA_ENABLE_AMALGAMATION --#include "mdnsd/libmdnsd/xht.h" --#include "mdnsd/libmdnsd/sdtxt.h" -+#include "libmdnsd/xht.h" -+#include "libmdnsd/sdtxt.h" - #endif - - #ifdef _WIN32 diff --git a/recipes/open62541/all/patches/1_0_x.patch b/recipes/open62541/all/patches/1_0_x.patch index a3095f005e7f2..b6c8ade0e3577 100644 --- a/recipes/open62541/all/patches/1_0_x.patch +++ b/recipes/open62541/all/patches/1_0_x.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index 94ceb127..00b7ca1d 100644 +index 94ceb127..3aa9ec26 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -7,9 +7,8 @@ endif() @@ -31,6 +31,15 @@ index 94ceb127..00b7ca1d 100644 ################# # Build Options # +@@ -378,7 +376,7 @@ if(UA_ENABLE_ENCRYPTION) + # that is not possible, manually compile mbedTLS and set the cmake variables + # defined in /tools/cmake/FindMbedTLS.cmake. + find_package(MbedTLS REQUIRED) +- list(APPEND open62541_LIBRARIES ${MBEDTLS_LIBRARIES}) ++ list(APPEND open62541_LIBRARIES ${MbedTLS_LIBRARIES}) + endif() + + ##################### @@ -405,7 +403,6 @@ if(NOT UA_COMPILE_AS_CXX AND (CMAKE_COMPILER_IS_GNUCC OR "x${CMAKE_C_COMPILER_ID -fno-strict-aliasing # fewer compiler assumptions about pointer types -fexceptions # recommended for multi-threaded C code, also in combination with C++ code @@ -96,6 +105,15 @@ index 94ceb127..00b7ca1d 100644 ${lib_sources}) endif() +@@ -939,7 +911,7 @@ if(UA_ENABLE_AMALGAMATION) + target_include_directories(open62541-object PRIVATE ${PROJECT_BINARY_DIR}) + target_include_directories(open62541-object PRIVATE "${ua_architecture_directories_to_include}") + if(UA_ENABLE_ENCRYPTION) +- target_include_directories(open62541-object PRIVATE ${MBEDTLS_INCLUDE_DIRS}) ++ target_include_directories(open62541-object PRIVATE ${MbedTLS_INCLUDE_DIRS}) + endif() + + # make sure the open62541_amalgamation target builds before so that amalgamation is finished and it is not executed again for open62541-object @@ -972,6 +944,10 @@ else() open62541-generator-namespace ) @@ -107,6 +125,15 @@ index 94ceb127..00b7ca1d 100644 add_library(open62541-plugins OBJECT ${default_plugin_sources} ${ua_architecture_sources} ${exported_headers}) add_dependencies(open62541-plugins open62541-generator-types open62541-generator-transport open62541-generator-namespace) +@@ -1018,7 +994,7 @@ else() + include_directories_private("${PROJECT_BINARY_DIR}") + + if(UA_ENABLE_ENCRYPTION) +- include_directories_private(${MBEDTLS_INCLUDE_DIRS}) ++ include_directories_private(${MbedTLS_INCLUDE_DIRS}) + endif() + + # Option-specific includes @@ -1163,7 +1139,7 @@ install(TARGETS open62541 ${EXTRATARGETS} EXPORT open62541Targets LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} @@ -116,6 +143,11 @@ index 94ceb127..00b7ca1d 100644 INCLUDES DESTINATION include) if(UA_ENABLE_AMALGAMATION) +@@ -1296,4 +1272,3 @@ set_target_properties(open62541-generator-namespace PROPERTIES FOLDER "open62541 + set_target_properties(open62541-generator-statuscode PROPERTIES FOLDER "open62541/generators") + set_target_properties(open62541-generator-transport PROPERTIES FOLDER "open62541/generators") + set_target_properties(open62541-generator-types PROPERTIES FOLDER "open62541/generators") +- diff --git a/src/server/ua_discovery_manager.h b/src/server/ua_discovery_manager.h index 3d1ae299..7d5f1051 100644 --- a/src/server/ua_discovery_manager.h diff --git a/recipes/open62541/all/submoduledata.yml b/recipes/open62541/all/submoduledata.yml index 744201d5b92e4..19278804be705 100644 --- a/recipes/open62541/all/submoduledata.yml +++ b/recipes/open62541/all/submoduledata.yml @@ -34,8 +34,18 @@ submodules: sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip archive_pattern: "UA-Nodeset-{version}" + "1.2.6": + deps/ua-nodeset: + sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 + url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip + archive_pattern: "UA-Nodeset-{version}" "1.3.1": deps/ua-nodeset: sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip archive_pattern: "UA-Nodeset-{version}" + "1.3.4": + deps/ua-nodeset: + sha256: a2bcc1cda0154091ecbed25b8c40436c5b75d11bb38df28b35a2ceedb331d562 + url: https://github.com/OPCFoundation/UA-Nodeset/archive/Errata-1.04.5.zip + archive_pattern: "UA-Nodeset-{version}" diff --git a/recipes/open62541/all/test_package/CMakeLists.txt b/recipes/open62541/all/test_package/CMakeLists.txt index 111c07cd3204c..553baebf9bc49 100644 --- a/recipes/open62541/all/test_package/CMakeLists.txt +++ b/recipes/open62541/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ -cmake_minimum_required(VERSION 3.12) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(open62541 REQUIRED CONFIG) find_package(Threads REQUIRED) @@ -21,17 +18,16 @@ ua_generate_nodeset_and_datatypes( FILE_BSD "${PROJECT_SOURCE_DIR}/FooFlt.Types.bsd" OUTPUT_DIR "${GENERATE_OUTPUT_DIR}" NAMESPACE_IDX 2 # This namespace index must match the order in which you are adding the nodeset in the source code - #NAMESPACE_MAP "2:http://opcfoundation.org/UA/DI/" NAMESPACE_MAP "2:https://new.foo.com/zebra-compression/flattening-and-subspacefolding/UA/" FILE_NS "${PROJECT_SOURCE_DIR}/FooFlt.NodeSet2.xml" INTERNAL ) # Previous macro automatically sets some variables which hold the generated source code files using the provided NAME -add_executable(${PROJECT_NAME}_nodeset +add_executable(${PROJECT_NAME} ${UA_NODESET_FOO_FLT_SOURCES} ${UA_TYPES_FOO_FLT_SOURCES} - test_package_nodeset.c + test_package.c ) # Make sure the nodeset compiler is executed before compiling the main file -add_dependencies(${PROJECT_NAME}_nodeset ${PROJECT_NAME}-ns-foo_flt) -target_link_libraries(${PROJECT_NAME}_nodeset PRIVATE open62541::open62541) +add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}-ns-foo_flt) +target_link_libraries(${PROJECT_NAME} PRIVATE open62541::open62541) diff --git a/recipes/open62541/all/test_package/conanfile.py b/recipes/open62541/all/test_package/conanfile.py index b19700d426fad..52782cf8480cf 100644 --- a/recipes/open62541/all/test_package/conanfile.py +++ b/recipes/open62541/all/test_package/conanfile.py @@ -1,25 +1,36 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain import os +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def requirements(self): + self.requires(self.tested_reference_str) self.requires("ua-nodeset/padim-1.02-2021-07-21") + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["open62541_NODESET_DIR"] = self.deps_user_info["ua-nodeset"].nodeset_dir.replace( + "\\", "/") # ua-nodeset path needs to be sanitized for windows systems + tc.variables["open62541_TOOLS_DIR"] = self.dependencies["open62541"].conf_info.get( + "user.open62541:tools_dir") + tc.generate() + def build(self): cmake = CMake(self) - cmake.definitions["open62541_NODESET_DIR"] = self.deps_user_info["ua-nodeset"].nodeset_dir - cmake.definitions["open62541_TOOLS_DIR"] = self.deps_user_info["open62541"].tools_dir cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - # bin_path = os.path.join("bin", "test_package") - # self.run(bin_path, run_environment=True) - - bin_path = os.path.join("bin", "test_package_nodeset") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/open62541/all/test_package/test_package_nodeset.c b/recipes/open62541/all/test_package/test_package.c similarity index 100% rename from recipes/open62541/all/test_package/test_package_nodeset.c rename to recipes/open62541/all/test_package/test_package.c diff --git a/recipes/open62541/all/test_v1_package/CMakeLists.txt b/recipes/open62541/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..bd17b291f8bc6 --- /dev/null +++ b/recipes/open62541/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(open62541 REQUIRED CONFIG) +find_package(Threads REQUIRED) + +find_package(Python3 REQUIRED) +set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) + +# Output directory for Nodeset Compiler +set(GENERATE_OUTPUT_DIR "${CMAKE_BINARY_DIR}/src_generated/") +file(MAKE_DIRECTORY "${GENERATE_OUTPUT_DIR}") +include_directories("${GENERATE_OUTPUT_DIR}") +ua_generate_nodeset_and_datatypes( + NAME "foo_flt" + TARGET_PREFIX "${PROJECT_NAME}" + FILE_CSV "${PROJECT_SOURCE_DIR}/../test_package/FooFltModel.csv" + FILE_BSD "${PROJECT_SOURCE_DIR}/../test_package/FooFlt.Types.bsd" + OUTPUT_DIR "${GENERATE_OUTPUT_DIR}" + NAMESPACE_IDX 2 # This namespace index must match the order in which you are adding the nodeset in the source code + NAMESPACE_MAP "2:https://new.foo.com/zebra-compression/flattening-and-subspacefolding/UA/" + FILE_NS "${PROJECT_SOURCE_DIR}/../test_package/FooFlt.NodeSet2.xml" + INTERNAL +) +# Previous macro automatically sets some variables which hold the generated source code files using the provided NAME +add_executable(${PROJECT_NAME} + ${UA_NODESET_FOO_FLT_SOURCES} + ${UA_TYPES_FOO_FLT_SOURCES} + ../test_package/test_package.c +) +# Make sure the nodeset compiler is executed before compiling the main file +add_dependencies(${PROJECT_NAME} ${PROJECT_NAME}-ns-foo_flt) +target_link_libraries(${PROJECT_NAME} PRIVATE open62541::open62541) diff --git a/recipes/open62541/all/test_v1_package/conanfile.py b/recipes/open62541/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..95cab84f3695f --- /dev/null +++ b/recipes/open62541/all/test_v1_package/conanfile.py @@ -0,0 +1,24 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def requirements(self): + self.requires("ua-nodeset/padim-1.02-2021-07-21") + + def build(self): + cmake = CMake(self) + cmake.definitions["open62541_NODESET_DIR"] = self.deps_user_info["ua-nodeset"].nodeset_dir + cmake.definitions["open62541_TOOLS_DIR"] = self.deps_user_info["open62541"].tools_dir + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/open62541/config.yml b/recipes/open62541/config.yml index eb0be7a7f5d36..76c7748700110 100644 --- a/recipes/open62541/config.yml +++ b/recipes/open62541/config.yml @@ -1,6 +1,10 @@ versions: + "1.3.4": + folder: all "1.3.1": folder: all + "1.2.6": + folder: all "1.2.4": folder: all "1.2.2": diff --git a/recipes/openal-soft/all/conandata.yml b/recipes/openal-soft/all/conandata.yml new file mode 100644 index 0000000000000..39085eaa09938 --- /dev/null +++ b/recipes/openal-soft/all/conandata.yml @@ -0,0 +1,37 @@ +sources: + "1.22.2": + url: "https://openal-soft.org/openal-releases/openal-soft-1.22.2.tar.bz2" + sha256: "ae94cc95cda76b7cc6e92e38c2531af82148e76d3d88ce996e2928a1ea7c3d20" + "1.21.1": + url: "https://openal-soft.org/openal-releases/openal-soft-1.21.1.tar.bz2" + sha256: "c8ad767e9a3230df66756a21cc8ebf218a9d47288f2514014832204e666af5d8" + "1.21.0": + url: "https://openal-soft.org/openal-releases/openal-soft-1.21.0.tar.bz2" + sha256: "2916b4fc24e23b0271ce0b3468832ad8b6d8441b1830215b28cc4fee6cc89297" + "1.20.1": + url: "https://openal-soft.org/openal-releases/openal-soft-1.20.1.tar.bz2" + sha256: "b6ceb051325732c23f5c8b6d37dbd89534517e6439a87e970882b447c3025d6d" + "1.19.1": + url: "https://openal-soft.org/openal-releases/openal-soft-1.19.1.tar.bz2" + sha256: "5c2f87ff5188b95e0dc4769719a9d89ce435b8322b4478b95dd4b427fe84b2e9" +patches: + "1.22.2": + - patch_file: "patches/1.22.2-0001-fix-al-optional-in-if-compile-error.patch" + "1.21.0": + - patch_file: "patches/1.21.0-0001-c++14-does-not-have-std-aligned_alloc.patch" + - patch_file: "patches/1.21.0-0002-fix-windows-sdk.patch" + patch_description: "Avoid explicitly searching for the WindowsSDK" + patch_type: "portability" + patch_source: "https://github.com/kcat/openal-soft/commit/13698362f1726326ab60180b04a86df79b518614" + "1.20.1": + - patch_file: "patches/1.20.1-0001-fix-windows-sdk.patch" + patch_description: "Avoid explicitly searching for the WindowsSDK" + patch_type: "portability" + patch_source: "https://github.com/kcat/openal-soft/commit/13698362f1726326ab60180b04a86df79b518614" + "1.19.1": + - patch_file: "patches/1.19.1-0001-aligned-alloc.patch" + - patch_file: "patches/1.19.1-0002-gcc-10-fnocommon.patch" + - patch_file: "patches/1.19.1-0003-fix-windows-sdk.patch" + patch_description: "Avoid explicitly searching for the WindowsSDK" + patch_type: "portability" + patch_source: "https://github.com/kcat/openal-soft/commit/13698362f1726326ab60180b04a86df79b518614" diff --git a/recipes/openal-soft/all/conanfile.py b/recipes/openal-soft/all/conanfile.py new file mode 100644 index 0000000000000..d82132329ef5b --- /dev/null +++ b/recipes/openal-soft/all/conanfile.py @@ -0,0 +1,165 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd, stdcpp_library +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, export_conandata_patches, copy, get, rmdir, save +from conan.tools.scm import Version +import os +import textwrap + +required_conan_version = ">=1.54.0" + + +class OpenALSoftConan(ConanFile): + name = "openal-soft" + description = "OpenAL Soft is a software implementation of the OpenAL 3D audio API." + topics = ("openal", "audio", "api") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://openal-soft.org/" + license = "LGPL-2.0-or-later" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _openal_cxx_backend(self): + return Version(self.version) >= "1.20" + + @property + def _min_cppstd(self): + return "11" if Version(self.version) < "1.21" else "14" + + @property + def _minimum_compilers_version(self): + return { + "Visual Studio": "13" if Version(self.version) < "1.21" else "15", + "msvc": "180" if Version(self.version) < "1.21" else "191", + "gcc": "5", + "clang": "5", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + # OpenAL's API is pure C, thus the c++ standard does not matter + # Because the backend is C++, the C++ STL matters + self.settings.rm_safe("compiler.cppstd") + if not self._openal_cxx_backend: + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.settings.os == "Linux": + self.requires("libalsa/1.2.7.2") + + def validate(self): + if self._openal_cxx_backend: + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + compiler = self.settings.compiler + + minimum_version = self._minimum_compilers_version.get(str(compiler), False) + if minimum_version and Version(compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + if compiler == "clang" and Version(compiler.version) < "9" and \ + compiler.get_safe("libcxx") in ("libstdc++", "libstdc++11"): + raise ConanInvalidConfiguration( + f"{self.ref} cannot be built with {compiler} {compiler.version} and stdlibc++(11) c++ runtime", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBTYPE"] = "SHARED" if self.options.shared else "STATIC" + tc.variables["ALSOFT_UTILS"] = False + tc.variables["ALSOFT_EXAMPLES"] = False + tc.variables["ALSOFT_TESTS"] = False + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_SoundIO"] = True + tc.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + self._create_cmake_module_variables( + os.path.join(self.package_folder, self._module_file_rel_path) + ) + + def _create_cmake_module_variables(self, module_file): + content = textwrap.dedent("""\ + set(OPENAL_FOUND TRUE) + if(DEFINED OpenAL_INCLUDE_DIR) + set(OPENAL_INCLUDE_DIR ${OpenAL_INCLUDE_DIR}) + endif() + if(DEFINED OpenAL_LIBRARIES) + set(OPENAL_LIBRARY ${OpenAL_LIBRARIES}) + endif() + if(DEFINED OpenAL_VERSION) + set(OPENAL_VERSION_STRING ${OpenAL_VERSION}) + endif() + """) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + + def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_file_name", "OpenAL") + self.cpp_info.set_property("cmake_target_name", "OpenAL::OpenAL") + self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) + self.cpp_info.set_property("pkg_config_name", "openal") + + self.cpp_info.names["cmake_find_package"] = "OpenAL" + self.cpp_info.names["cmake_find_package_multi"] = "OpenAL" + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + + self.cpp_info.libs = collect_libs(self) + self.cpp_info.includedirs.append(os.path.join("include", "AL")) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["dl", "m"]) + elif is_apple_os(self): + self.cpp_info.frameworks.extend(["AudioToolbox", "AudioUnit", "CoreAudio", "CoreFoundation"]) + if self.settings.os == "Macos": + self.cpp_info.frameworks.append("ApplicationServices") + elif self.settings.os == "Windows": + self.cpp_info.system_libs.extend(["winmm", "ole32", "shell32", "user32"]) + if self._openal_cxx_backend and not self.options.shared: + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) + if not self.options.shared: + self.cpp_info.defines.append("AL_LIBTYPE_STATIC") diff --git a/recipes/openal-soft/all/patches/1.19.1-0001-aligned-alloc.patch b/recipes/openal-soft/all/patches/1.19.1-0001-aligned-alloc.patch new file mode 100644 index 0000000000000..f734aeb89945e --- /dev/null +++ b/recipes/openal-soft/all/patches/1.19.1-0001-aligned-alloc.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -546,7 +546,7 @@ IF(HAVE_INTRIN_H) + ENDIF() + + CHECK_SYMBOL_EXISTS(sysconf unistd.h HAVE_SYSCONF) +-CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC) ++#CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC) + CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN) + CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC) + CHECK_SYMBOL_EXISTS(proc_pidpath libproc.h HAVE_PROC_PIDPATH) diff --git a/recipes/openal/all/patches/1.19.1/gcc-10-fnocommon.patch b/recipes/openal-soft/all/patches/1.19.1-0002-gcc-10-fnocommon.patch similarity index 100% rename from recipes/openal/all/patches/1.19.1/gcc-10-fnocommon.patch rename to recipes/openal-soft/all/patches/1.19.1-0002-gcc-10-fnocommon.patch diff --git a/recipes/openal-soft/all/patches/1.19.1-0003-fix-windows-sdk.patch b/recipes/openal-soft/all/patches/1.19.1-0003-fix-windows-sdk.patch new file mode 100644 index 0000000000000..922c2a2f1c321 --- /dev/null +++ b/recipes/openal-soft/all/patches/1.19.1-0003-fix-windows-sdk.patch @@ -0,0 +1,38 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1092,17 +1092,24 @@ IF(HAVE_WINDOWS_H) + ENDIF() + + # Check DSound backend +- FIND_PACKAGE(DSound) +- IF(DSOUND_FOUND) +- OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) +- IF(ALSOFT_BACKEND_DSOUND) +- SET(HAVE_DSOUND 1) +- SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},") +- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c) +- ADD_BACKEND_LIBS(${DSOUND_LIBRARIES}) +- SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS}) +- ENDIF() +- ENDIF() ++ check_include_file(dsound.h HAVE_DSOUND_H) ++ if(DXSDK_DIR) ++ find_path(DSOUND_INCLUDE_DIR NAMES "dsound.h" ++ PATHS "${DXSDK_DIR}" PATH_SUFFIXES include ++ DOC "The DirectSound include directory") ++ endif() ++ if(HAVE_DSOUND_H OR DSOUND_INCLUDE_DIR) ++ option(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) ++ if(ALSOFT_BACKEND_DSOUND) ++ set(HAVE_DSOUND 1) ++ set(BACKENDS "${BACKENDS} DirectSound,") ++ set(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c) ++ ++ if(NOT HAVE_DSOUND_H) ++ set(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIR}) ++ endif() ++ endif() ++ endif() + + # Check for WASAPI backend + CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H) diff --git a/recipes/openal-soft/all/patches/1.20.1-0001-fix-windows-sdk.patch b/recipes/openal-soft/all/patches/1.20.1-0001-fix-windows-sdk.patch new file mode 100644 index 0000000000000..61ba2e012e0da --- /dev/null +++ b/recipes/openal-soft/all/patches/1.20.1-0001-fix-windows-sdk.patch @@ -0,0 +1,76 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -854,44 +854,38 @@ OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF) + OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF) + OPTION(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF) + IF(WIN32) +- SET(WINSDK_LIB_DIRS ) +- SET(WINSDK_INCLUDE_DIRS ) +- FIND_PACKAGE(WindowsSDK) +- IF(WINDOWSSDK_FOUND) +- get_windowssdk_library_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_LIB_DIRS) +- get_windowssdk_include_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_INCLUDE_DIRS) +- ENDIF() +- +- SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}) +- SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502) +- + # Check MMSystem backend +- CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H) +- FIND_LIBRARY(WINMM_LIBRARY NAMES winmm +- PATHS ${WINSDK_LIB_DIRS} +- PATH_SUFFIXES lib lib/x86 lib/x64) +- IF(HAVE_MMSYSTEM_H AND WINMM_LIBRARY) +- OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON) +- IF(ALSOFT_BACKEND_WINMM) +- SET(HAVE_WINMM 1) +- SET(BACKENDS "${BACKENDS} WinMM,") +- SET(ALC_OBJS ${ALC_OBJS} alc/backends/winmm.cpp alc/backends/winmm.h) +- SET(EXTRA_LIBS ${WINMM_LIBRARY} ${EXTRA_LIBS}) +- ENDIF() +- ENDIF() ++ option(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON) ++ if(ALSOFT_BACKEND_WINMM) ++ set(HAVE_WINMM 1) ++ set(BACKENDS "${BACKENDS} WinMM,") ++ set(ALC_OBJS ${ALC_OBJS} alc/backends/winmm.cpp alc/backends/winmm.h) ++ # There doesn't seem to be good way to search for winmm.lib for MSVC. ++ # find_library doesn't find it without being told to look in a specific ++ # place in the WindowsSDK, but it links anyway. If there ends up being ++ # Windows targets without this, another means to detect it is needed. ++ set(EXTRA_LIBS winmm ${EXTRA_LIBS}) ++ endif() + + # Check DSound backend +- FIND_PACKAGE(DSound) +- IF(DSOUND_FOUND) +- OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) +- IF(ALSOFT_BACKEND_DSOUND) +- SET(HAVE_DSOUND 1) +- SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},") +- SET(ALC_OBJS ${ALC_OBJS} alc/backends/dsound.cpp alc/backends/dsound.h) +- ADD_BACKEND_LIBS(${DSOUND_LIBRARIES}) +- SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS}) +- ENDIF() +- ENDIF() ++ check_include_file(dsound.h HAVE_DSOUND_H) ++ if(DXSDK_DIR) ++ find_path(DSOUND_INCLUDE_DIR NAMES "dsound.h" ++ PATHS "${DXSDK_DIR}" PATH_SUFFIXES include ++ DOC "The DirectSound include directory") ++ endif() ++ if(HAVE_DSOUND_H OR DSOUND_INCLUDE_DIR) ++ option(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) ++ if(ALSOFT_BACKEND_DSOUND) ++ set(HAVE_DSOUND 1) ++ set(BACKENDS "${BACKENDS} DirectSound,") ++ set(ALC_OBJS ${ALC_OBJS} alc/backends/dsound.cpp alc/backends/dsound.h) ++ ++ if(NOT HAVE_DSOUND_H) ++ set(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIR}) ++ endif() ++ endif() ++ endif() + + # Check for WASAPI backend + CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H) diff --git a/recipes/openal/all/patches/1.21.0-c++14-does-not-have-std-aligned_alloc.patch b/recipes/openal-soft/all/patches/1.21.0-0001-c++14-does-not-have-std-aligned_alloc.patch similarity index 100% rename from recipes/openal/all/patches/1.21.0-c++14-does-not-have-std-aligned_alloc.patch rename to recipes/openal-soft/all/patches/1.21.0-0001-c++14-does-not-have-std-aligned_alloc.patch diff --git a/recipes/openal-soft/all/patches/1.21.0-0002-fix-windows-sdk.patch b/recipes/openal-soft/all/patches/1.21.0-0002-fix-windows-sdk.patch new file mode 100644 index 0000000000000..3a6c7afb5a414 --- /dev/null +++ b/recipes/openal-soft/all/patches/1.21.0-0002-fix-windows-sdk.patch @@ -0,0 +1,74 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -880,49 +880,36 @@ option(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF) + option(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF) + option(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF) + if(WIN32) +- set(WINSDK_LIB_DIRS ) +- set(WINSDK_INCLUDE_DIRS ) +- find_package(WindowsSDK) +- if(WINDOWSSDK_FOUND) +- get_windowssdk_library_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_LIB_DIRS) +- get_windowssdk_include_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_INCLUDE_DIRS) +- endif() +- + # Check MMSystem backend +- check_include_files("windows.h;mmsystem.h" HAVE_MMSYSTEM_H) +- find_library(WINMM_LIBRARY NAMES winmm +- PATHS ${WINSDK_LIB_DIRS}) +- if(HAVE_MMSYSTEM_H AND WINMM_LIBRARY) +- option(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON) +- if(ALSOFT_BACKEND_WINMM) +- set(HAVE_WINMM 1) +- set(BACKENDS "${BACKENDS} WinMM,") +- set(ALC_OBJS ${ALC_OBJS} alc/backends/winmm.cpp alc/backends/winmm.h) +- set(EXTRA_LIBS ${WINMM_LIBRARY} ${EXTRA_LIBS}) +- endif() ++ option(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON) ++ if(ALSOFT_BACKEND_WINMM) ++ set(HAVE_WINMM 1) ++ set(BACKENDS "${BACKENDS} WinMM,") ++ set(ALC_OBJS ${ALC_OBJS} alc/backends/winmm.cpp alc/backends/winmm.h) ++ # There doesn't seem to be good way to search for winmm.lib for MSVC. ++ # find_library doesn't find it without being told to look in a specific ++ # place in the WindowsSDK, but it links anyway. If there ends up being ++ # Windows targets without this, another means to detect it is needed. ++ set(EXTRA_LIBS winmm ${EXTRA_LIBS}) + endif() + + # Check DSound backend +- find_package(DSound) +- if(DSOUND_FOUND) ++ check_include_file(dsound.h HAVE_DSOUND_H) ++ if(DXSDK_DIR) ++ find_path(DSOUND_INCLUDE_DIR NAMES "dsound.h" ++ PATHS "${DXSDK_DIR}" PATH_SUFFIXES include ++ DOC "The DirectSound include directory") ++ endif() ++ if(HAVE_DSOUND_H OR DSOUND_INCLUDE_DIR) + option(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) + if(ALSOFT_BACKEND_DSOUND) + set(HAVE_DSOUND 1) +- set(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},") +- set(ALC_OBJS ${ALC_OBJS} alc/backends/dsound.cpp alc/backends/dsound.h) +- add_backend_libs(${DSOUND_LIBRARIES}) +- set(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS}) +- endif() +- endif() ++ set(BACKENDS "${BACKENDS} DirectSound,") ++ set(ALC_OBJS ${ALC_OBJS} alc/backends/dsound.cpp alc/backends/dsound.h) + +- # Check for WASAPI backend +- check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H) +- if(HAVE_MMDEVICEAPI_H) +- option(ALSOFT_BACKEND_WASAPI "Enable WASAPI backend" ON) +- if(ALSOFT_BACKEND_WASAPI) +- set(HAVE_WASAPI 1) +- set(BACKENDS "${BACKENDS} WASAPI,") +- set(ALC_OBJS ${ALC_OBJS} alc/backends/wasapi.cpp alc/backends/wasapi.h) ++ if(NOT HAVE_DSOUND_H) ++ set(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIR}) ++ endif() + endif() + endif() + endif() diff --git a/recipes/openal/all/patches/1.22.2-fix-al-optional-in-if-compile-error.patch b/recipes/openal-soft/all/patches/1.22.2-0001-fix-al-optional-in-if-compile-error.patch similarity index 100% rename from recipes/openal/all/patches/1.22.2-fix-al-optional-in-if-compile-error.patch rename to recipes/openal-soft/all/patches/1.22.2-0001-fix-al-optional-in-if-compile-error.patch diff --git a/recipes/openal-soft/all/test_package/CMakeLists.txt b/recipes/openal-soft/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..f25fa5a765b27 --- /dev/null +++ b/recipes/openal-soft/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(OpenAL REQUIRED) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenAL::OpenAL) diff --git a/recipes/openal-soft/all/test_package/conanfile.py b/recipes/openal-soft/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/openal-soft/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openal-soft/all/test_package/test_package.c b/recipes/openal-soft/all/test_package/test_package.c new file mode 100644 index 0000000000000..23fe4c11dcfc0 --- /dev/null +++ b/recipes/openal-soft/all/test_package/test_package.c @@ -0,0 +1,134 @@ +#include "alc.h" +#include "al.h" +#include "alext.h" + +#include +#include + +static ALenum checkALErrors(int linenum) +{ + ALenum err = alGetError(); + if(err != AL_NO_ERROR) + printf("OpenAL Error: %s (0x%x), @ %d\n", alGetString(err), err, linenum); + return err; +} +#define checkALErrors() checkALErrors(__LINE__) + +static ALCenum checkALCErrors(ALCdevice *device, int linenum) +{ + ALCenum err = alcGetError(device); + if(err != ALC_NO_ERROR) + printf("ALC Error: %s (0x%x), @ %d\n", alcGetString(device, err), err, linenum); + return err; +} +#define checkALCErrors(x) checkALCErrors((x),__LINE__) + +#define MAX_WIDTH 80 + +static void printList(const char *list, char separator) +{ + size_t col = MAX_WIDTH, len; + const char *indent = " "; + const char *next; + + if(!list || *list == '\0') + { + fprintf(stdout, "\n%s!!! none !!!\n", indent); + return; + } + + do { + next = strchr(list, separator); + if(next) + { + len = next-list; + do { + next++; + } while(*next == separator); + } + else + len = strlen(list); + + if(len + col + 2 >= MAX_WIDTH) + { + fprintf(stdout, "\n%s", indent); + col = strlen(indent); + } + else + { + fputc(' ', stdout); + col++; + } + + len = fwrite(list, 1, len, stdout); + col += len; + + if(!next || *next == '\0') + break; + fputc(',', stdout); + col++; + + list = next; + } while(1); + fputc('\n', stdout); +} + +static void printALCInfo(ALCdevice *device) +{ + ALCint major, minor; + + if(device) + { + const ALCchar *devname = NULL; + printf("\n"); + if(alcIsExtensionPresent(device, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE) + devname = alcGetString(device, ALC_ALL_DEVICES_SPECIFIER); + if(checkALCErrors(device) != ALC_NO_ERROR || !devname) + devname = alcGetString(device, ALC_DEVICE_SPECIFIER); + printf("** Info for device \"%s\" **\n", devname); + } + alcGetIntegerv(device, ALC_MAJOR_VERSION, 1, &major); + alcGetIntegerv(device, ALC_MINOR_VERSION, 1, &minor); + if(checkALCErrors(device) == ALC_NO_ERROR) + printf("ALC version: %d.%d\n", major, minor); + if(device) + { + printf("ALC extensions:"); + printList(alcGetString(device, ALC_EXTENSIONS), ' '); + checkALCErrors(device); + } +} + +static void printDeviceList(const char *list) +{ + if(!list || *list == '\0') + printf(" !!! none !!!\n"); + else do { + printf(" %s\n", list); + list += strlen(list) + 1; + } while(*list != '\0'); +} + +int main(int argc, char **argv) +{ + printf("Available playback devices:\n"); + if(alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE) + printDeviceList(alcGetString(NULL, ALC_ALL_DEVICES_SPECIFIER)); + else + printDeviceList(alcGetString(NULL, ALC_DEVICE_SPECIFIER)); + printf("Available capture devices:\n"); + printDeviceList(alcGetString(NULL, ALC_CAPTURE_DEVICE_SPECIFIER)); + + if(alcIsExtensionPresent(NULL, "ALC_ENUMERATE_ALL_EXT") != AL_FALSE) + printf("Default playback device: %s\n", + alcGetString(NULL, ALC_DEFAULT_ALL_DEVICES_SPECIFIER)); + else + printf("Default playback device: %s\n", + alcGetString(NULL, ALC_DEFAULT_DEVICE_SPECIFIER)); + printf("Default capture device: %s\n", + alcGetString(NULL, ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER)); + + printALCInfo(NULL); + + return 0; +} diff --git a/recipes/openal-soft/all/test_v1_package/CMakeLists.txt b/recipes/openal-soft/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/openal-soft/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/openal-soft/all/test_v1_package/conanfile.py b/recipes/openal-soft/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/openal-soft/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/openal-soft/config.yml b/recipes/openal-soft/config.yml new file mode 100644 index 0000000000000..e4eea213adbce --- /dev/null +++ b/recipes/openal-soft/config.yml @@ -0,0 +1,11 @@ +versions: + "1.22.2": + folder: all + "1.21.1": + folder: all + "1.21.0": + folder: all + "1.20.1": + folder: all + "1.19.1": + folder: all diff --git a/recipes/openal/all/CMakeLists.txt b/recipes/openal/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/openal/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/openal/all/conandata.yml b/recipes/openal/all/conandata.yml index 9f2fddbe352fc..39085eaa09938 100644 --- a/recipes/openal/all/conandata.yml +++ b/recipes/openal/all/conandata.yml @@ -1,28 +1,37 @@ sources: "1.22.2": - url: "https://github.com/kcat/openal-soft/archive/1.22.2.tar.gz" - sha256: "3e58f3d4458f5ee850039b1a6b4dac2343b3a5985a6a2e7ae2d143369c5b8135" + url: "https://openal-soft.org/openal-releases/openal-soft-1.22.2.tar.bz2" + sha256: "ae94cc95cda76b7cc6e92e38c2531af82148e76d3d88ce996e2928a1ea7c3d20" "1.21.1": - url: "https://github.com/kcat/openal-soft/archive/refs/tags/1.21.1.tar.gz" - sha256: "8ac17e4e3b32c1af3d5508acfffb838640669b4274606b7892aa796ca9d7467f" + url: "https://openal-soft.org/openal-releases/openal-soft-1.21.1.tar.bz2" + sha256: "c8ad767e9a3230df66756a21cc8ebf218a9d47288f2514014832204e666af5d8" "1.21.0": - url: "https://github.com/kcat/openal-soft/archive/openal-soft-1.21.0.tar.gz" - sha256: "cd3650530866f3906058225f4bfbe0052be19e0a29dcc6df185a460f9948feec" + url: "https://openal-soft.org/openal-releases/openal-soft-1.21.0.tar.bz2" + sha256: "2916b4fc24e23b0271ce0b3468832ad8b6d8441b1830215b28cc4fee6cc89297" "1.20.1": - url: "https://github.com/kcat/openal-soft/archive/openal-soft-1.20.1.tar.gz" - sha256: "c32d10473457a8b545aab50070fe84be2b5b041e1f2099012777ee6be0057c13" + url: "https://openal-soft.org/openal-releases/openal-soft-1.20.1.tar.bz2" + sha256: "b6ceb051325732c23f5c8b6d37dbd89534517e6439a87e970882b447c3025d6d" "1.19.1": - url: "https://github.com/kcat/openal-soft/archive/openal-soft-1.19.1.tar.gz" - sha256: "9f3536ab2bb7781dbafabc6a61e0b34b17edd16bd6c2eaf2ae71bc63078f98c7" + url: "https://openal-soft.org/openal-releases/openal-soft-1.19.1.tar.bz2" + sha256: "5c2f87ff5188b95e0dc4769719a9d89ce435b8322b4478b95dd4b427fe84b2e9" patches: "1.22.2": - - base_path: "source_subfolder" - patch_file: "patches/1.22.2-fix-al-optional-in-if-compile-error.patch" + - patch_file: "patches/1.22.2-0001-fix-al-optional-in-if-compile-error.patch" "1.21.0": - - base_path: "source_subfolder" - patch_file: "patches/1.21.0-c++14-does-not-have-std-aligned_alloc.patch" + - patch_file: "patches/1.21.0-0001-c++14-does-not-have-std-aligned_alloc.patch" + - patch_file: "patches/1.21.0-0002-fix-windows-sdk.patch" + patch_description: "Avoid explicitly searching for the WindowsSDK" + patch_type: "portability" + patch_source: "https://github.com/kcat/openal-soft/commit/13698362f1726326ab60180b04a86df79b518614" + "1.20.1": + - patch_file: "patches/1.20.1-0001-fix-windows-sdk.patch" + patch_description: "Avoid explicitly searching for the WindowsSDK" + patch_type: "portability" + patch_source: "https://github.com/kcat/openal-soft/commit/13698362f1726326ab60180b04a86df79b518614" "1.19.1": - - base_path: "source_subfolder" - patch_file: "patches/1.19.1/aligned-alloc.patch" - - base_path: "source_subfolder" - patch_file: "patches/1.19.1/gcc-10-fnocommon.patch" + - patch_file: "patches/1.19.1-0001-aligned-alloc.patch" + - patch_file: "patches/1.19.1-0002-gcc-10-fnocommon.patch" + - patch_file: "patches/1.19.1-0003-fix-windows-sdk.patch" + patch_description: "Avoid explicitly searching for the WindowsSDK" + patch_type: "portability" + patch_source: "https://github.com/kcat/openal-soft/commit/13698362f1726326ab60180b04a86df79b518614" diff --git a/recipes/openal/all/conanfile.py b/recipes/openal/all/conanfile.py index e11010fd8f180..4de9550fc2a4b 100644 --- a/recipes/openal/all/conanfile.py +++ b/recipes/openal/all/conanfile.py @@ -1,12 +1,19 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd, stdcpp_library +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, export_conandata_patches, copy, get, rmdir, save +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class OpenALConan(ConanFile): + deprecated = "openal-soft" + name = "openal" description = "OpenAL Soft is a software implementation of the OpenAL 3D audio API." topics = ("openal", "audio", "api") @@ -24,123 +31,97 @@ class OpenALConan(ConanFile): "fPIC": True, } - generators = "cmake" - _cmake = None + @property + def _openal_cxx_backend(self): + return Version(self.version) >= "1.20" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "11" if Version(self.version) < "1.21" else "14" @property - def _build_subfolder(self): - return "build_subfolder" + def _minimum_compilers_version(self): + return { + "Visual Studio": "13" if Version(self.version) < "1.21" else "15", + "msvc": "180" if Version(self.version) < "1.21" else "191", + "gcc": "5", + "clang": "5", + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - @property - def _openal_cxx_backend(self): - return tools.Version(self.version) >= "1.20" - def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") # OpenAL's API is pure C, thus the c++ standard does not matter # Because the backend is C++, the C++ STL matters - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.cppstd") if not self._openal_cxx_backend: - del self.settings.compiler.libcxx + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.settings.os == "Linux": - self.requires("libalsa/1.2.5.1") + self.requires("libalsa/1.2.7.2") - @property - def _supports_cxx14(self): - if self.settings.compiler == "clang" and self.settings.compiler.libcxx in ("libstdc++", "libstdc++11"): - if tools.Version(self.settings.compiler.version) < "9": - return False, "openal on clang {} cannot be built with stdlibc++(11) c++ runtime".format(self.settings.compiler.version) - min_version = { - "Visual Studio": "15", - "gcc": "5", - "clang": "5", - }.get(str(self.settings.compiler)) - if min_version and tools.Version(self.settings.compiler.version) < min_version: - return False, "This compiler version does not support c++14" - return True, None + def validate(self): + if self._openal_cxx_backend: + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - @property - def _supports_cxx11(self): - if self.settings.compiler == "clang" and self.settings.compiler.libcxx in ("libstdc++", "libstdc++11"): - if tools.Version(self.settings.compiler.version) < "9": - return False, "openal on clang {} cannot be built with stdlibc++(11) c++ runtime".format(self.settings.compiler.version) - min_version = { - "Visual Studio": "13", - "gcc": "5", - "clang": "5", - }.get(str(self.settings.compiler)) - if min_version and tools.Version(self.settings.compiler.version) < min_version: - return False, "This compiler version does not support c++11" - return True, None + compiler = self.settings.compiler - def validate(self): - if tools.Version(self.version) >= "1.21": - ok, msg = self._supports_cxx14 - if not ok: - raise ConanInvalidConfiguration(msg) - if msg: - self.output.warn(msg) - elif tools.Version(self.version) >= "1.20": - ok, msg = self._supports_cxx11 - if not ok: - raise ConanInvalidConfiguration(msg) - if msg: - self.output.warn(msg) + minimum_version = self._minimum_compilers_version.get(str(compiler), False) + if minimum_version and Version(compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + if compiler == "clang" and Version(compiler.version) < "9" and \ + compiler.get_safe("libcxx") in ("libstdc++", "libstdc++11"): + raise ConanInvalidConfiguration( + f"{self.ref} cannot be built with {compiler} {compiler.version} and stdlibc++(11) c++ runtime", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["LIBTYPE"] = "SHARED" if self.options.shared else "STATIC" - self._cmake.definitions["ALSOFT_UTILS"] = False - self._cmake.definitions["ALSOFT_EXAMPLES"] = False - self._cmake.definitions["ALSOFT_TESTS"] = False - self._cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_SoundIO"] = True - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["LIBTYPE"] = "SHARED" if self.options.shared else "STATIC" + tc.variables["ALSOFT_UTILS"] = False + tc.variables["ALSOFT_EXAMPLES"] = False + tc.variables["ALSOFT_TESTS"] = False + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_SoundIO"] = True + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_file_rel_path) ) - @staticmethod - def _create_cmake_module_variables(module_file): + def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ - if(DEFINED OpenAL_FOUND) - set(OPENAL_FOUND ${OpenAL_FOUND}) - endif() + set(OPENAL_FOUND TRUE) if(DEFINED OpenAL_INCLUDE_DIR) set(OPENAL_INCLUDE_DIR ${OpenAL_INCLUDE_DIR}) endif() @@ -151,11 +132,11 @@ def _create_cmake_module_variables(module_file): set(OPENAL_VERSION_STRING ${OpenAL_VERSION}) endif() """) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -168,16 +149,18 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "OpenAL" self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) self.cpp_info.includedirs.append(os.path.join("include", "AL")) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.extend(["dl", "m"]) - elif tools.is_apple_os(self.settings.os): - self.cpp_info.frameworks.extend(["AudioToolbox", "CoreAudio", "CoreFoundation"]) + elif is_apple_os(self): + self.cpp_info.frameworks.extend(["AudioToolbox", "AudioUnit", "CoreAudio", "CoreFoundation"]) + if self.settings.os == "Macos": + self.cpp_info.frameworks.append("ApplicationServices") elif self.settings.os == "Windows": - self.cpp_info.system_libs.extend(["winmm", "ole32", "shell32", "User32"]) - if self._openal_cxx_backend: - libcxx = tools.stdcpp_library(self) + self.cpp_info.system_libs.extend(["winmm", "ole32", "shell32", "user32"]) + if self._openal_cxx_backend and not self.options.shared: + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.system_libs.append(libcxx) if not self.options.shared: diff --git a/recipes/openal/all/patches/1.19.1-0001-aligned-alloc.patch b/recipes/openal/all/patches/1.19.1-0001-aligned-alloc.patch new file mode 100644 index 0000000000000..f734aeb89945e --- /dev/null +++ b/recipes/openal/all/patches/1.19.1-0001-aligned-alloc.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -546,7 +546,7 @@ IF(HAVE_INTRIN_H) + ENDIF() + + CHECK_SYMBOL_EXISTS(sysconf unistd.h HAVE_SYSCONF) +-CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC) ++#CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC) + CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN) + CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC) + CHECK_SYMBOL_EXISTS(proc_pidpath libproc.h HAVE_PROC_PIDPATH) diff --git a/recipes/openal/all/patches/1.19.1-0002-gcc-10-fnocommon.patch b/recipes/openal/all/patches/1.19.1-0002-gcc-10-fnocommon.patch new file mode 100644 index 0000000000000..1283ee70f8fe7 --- /dev/null +++ b/recipes/openal/all/patches/1.19.1-0002-gcc-10-fnocommon.patch @@ -0,0 +1,15 @@ +--- a/Alc/bformatdec.h 2018-10-11 18:05:31.000000000 -0400 ++++ b/Alc/bformatdec.h 2020-10-10 21:01:08.842986977 -0400 +@@ -24,9 +24,9 @@ + /* NOTE: These are scale factors as applied to Ambisonics content. Decoder + * coefficients should be divided by these values to get proper N3D scalings. + */ +-const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS]; +-const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS]; +-const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS]; ++extern const ALfloat N3D2N3DScale[MAX_AMBI_COEFFS]; ++extern const ALfloat SN3D2N3DScale[MAX_AMBI_COEFFS]; ++extern const ALfloat FuMa2N3DScale[MAX_AMBI_COEFFS]; + + + struct AmbDecConf; diff --git a/recipes/openal/all/patches/1.19.1-0003-fix-windows-sdk.patch b/recipes/openal/all/patches/1.19.1-0003-fix-windows-sdk.patch new file mode 100644 index 0000000000000..922c2a2f1c321 --- /dev/null +++ b/recipes/openal/all/patches/1.19.1-0003-fix-windows-sdk.patch @@ -0,0 +1,38 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1092,17 +1092,24 @@ IF(HAVE_WINDOWS_H) + ENDIF() + + # Check DSound backend +- FIND_PACKAGE(DSound) +- IF(DSOUND_FOUND) +- OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) +- IF(ALSOFT_BACKEND_DSOUND) +- SET(HAVE_DSOUND 1) +- SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},") +- SET(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c) +- ADD_BACKEND_LIBS(${DSOUND_LIBRARIES}) +- SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS}) +- ENDIF() +- ENDIF() ++ check_include_file(dsound.h HAVE_DSOUND_H) ++ if(DXSDK_DIR) ++ find_path(DSOUND_INCLUDE_DIR NAMES "dsound.h" ++ PATHS "${DXSDK_DIR}" PATH_SUFFIXES include ++ DOC "The DirectSound include directory") ++ endif() ++ if(HAVE_DSOUND_H OR DSOUND_INCLUDE_DIR) ++ option(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) ++ if(ALSOFT_BACKEND_DSOUND) ++ set(HAVE_DSOUND 1) ++ set(BACKENDS "${BACKENDS} DirectSound,") ++ set(ALC_OBJS ${ALC_OBJS} Alc/backends/dsound.c) ++ ++ if(NOT HAVE_DSOUND_H) ++ set(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIR}) ++ endif() ++ endif() ++ endif() + + # Check for WASAPI backend + CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H) diff --git a/recipes/openal/all/patches/1.19.1/aligned-alloc.patch b/recipes/openal/all/patches/1.19.1/aligned-alloc.patch deleted file mode 100644 index 0bb0b5673fe4d..0000000000000 --- a/recipes/openal/all/patches/1.19.1/aligned-alloc.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index cf10bc203..605285152 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -546,7 +546,6 @@ IF(HAVE_INTRIN_H) - ENDIF() - - CHECK_SYMBOL_EXISTS(sysconf unistd.h HAVE_SYSCONF) --CHECK_SYMBOL_EXISTS(aligned_alloc stdlib.h HAVE_ALIGNED_ALLOC) - CHECK_SYMBOL_EXISTS(posix_memalign stdlib.h HAVE_POSIX_MEMALIGN) - CHECK_SYMBOL_EXISTS(_aligned_malloc malloc.h HAVE__ALIGNED_MALLOC) - CHECK_SYMBOL_EXISTS(proc_pidpath libproc.h HAVE_PROC_PIDPATH) diff --git a/recipes/openal/all/patches/1.20.1-0001-fix-windows-sdk.patch b/recipes/openal/all/patches/1.20.1-0001-fix-windows-sdk.patch new file mode 100644 index 0000000000000..61ba2e012e0da --- /dev/null +++ b/recipes/openal/all/patches/1.20.1-0001-fix-windows-sdk.patch @@ -0,0 +1,76 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -854,44 +854,38 @@ OPTION(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF) + OPTION(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF) + OPTION(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF) + IF(WIN32) +- SET(WINSDK_LIB_DIRS ) +- SET(WINSDK_INCLUDE_DIRS ) +- FIND_PACKAGE(WindowsSDK) +- IF(WINDOWSSDK_FOUND) +- get_windowssdk_library_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_LIB_DIRS) +- get_windowssdk_include_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_INCLUDE_DIRS) +- ENDIF() +- +- SET(OLD_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}) +- SET(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} -D_WIN32_WINNT=0x0502) +- + # Check MMSystem backend +- CHECK_INCLUDE_FILES("windows.h;mmsystem.h" HAVE_MMSYSTEM_H) +- FIND_LIBRARY(WINMM_LIBRARY NAMES winmm +- PATHS ${WINSDK_LIB_DIRS} +- PATH_SUFFIXES lib lib/x86 lib/x64) +- IF(HAVE_MMSYSTEM_H AND WINMM_LIBRARY) +- OPTION(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON) +- IF(ALSOFT_BACKEND_WINMM) +- SET(HAVE_WINMM 1) +- SET(BACKENDS "${BACKENDS} WinMM,") +- SET(ALC_OBJS ${ALC_OBJS} alc/backends/winmm.cpp alc/backends/winmm.h) +- SET(EXTRA_LIBS ${WINMM_LIBRARY} ${EXTRA_LIBS}) +- ENDIF() +- ENDIF() ++ option(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON) ++ if(ALSOFT_BACKEND_WINMM) ++ set(HAVE_WINMM 1) ++ set(BACKENDS "${BACKENDS} WinMM,") ++ set(ALC_OBJS ${ALC_OBJS} alc/backends/winmm.cpp alc/backends/winmm.h) ++ # There doesn't seem to be good way to search for winmm.lib for MSVC. ++ # find_library doesn't find it without being told to look in a specific ++ # place in the WindowsSDK, but it links anyway. If there ends up being ++ # Windows targets without this, another means to detect it is needed. ++ set(EXTRA_LIBS winmm ${EXTRA_LIBS}) ++ endif() + + # Check DSound backend +- FIND_PACKAGE(DSound) +- IF(DSOUND_FOUND) +- OPTION(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) +- IF(ALSOFT_BACKEND_DSOUND) +- SET(HAVE_DSOUND 1) +- SET(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},") +- SET(ALC_OBJS ${ALC_OBJS} alc/backends/dsound.cpp alc/backends/dsound.h) +- ADD_BACKEND_LIBS(${DSOUND_LIBRARIES}) +- SET(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS}) +- ENDIF() +- ENDIF() ++ check_include_file(dsound.h HAVE_DSOUND_H) ++ if(DXSDK_DIR) ++ find_path(DSOUND_INCLUDE_DIR NAMES "dsound.h" ++ PATHS "${DXSDK_DIR}" PATH_SUFFIXES include ++ DOC "The DirectSound include directory") ++ endif() ++ if(HAVE_DSOUND_H OR DSOUND_INCLUDE_DIR) ++ option(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) ++ if(ALSOFT_BACKEND_DSOUND) ++ set(HAVE_DSOUND 1) ++ set(BACKENDS "${BACKENDS} DirectSound,") ++ set(ALC_OBJS ${ALC_OBJS} alc/backends/dsound.cpp alc/backends/dsound.h) ++ ++ if(NOT HAVE_DSOUND_H) ++ set(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIR}) ++ endif() ++ endif() ++ endif() + + # Check for WASAPI backend + CHECK_INCLUDE_FILE(mmdeviceapi.h HAVE_MMDEVICEAPI_H) diff --git a/recipes/openal/all/patches/1.21.0-0001-c++14-does-not-have-std-aligned_alloc.patch b/recipes/openal/all/patches/1.21.0-0001-c++14-does-not-have-std-aligned_alloc.patch new file mode 100644 index 0000000000000..11b0c43304b4a --- /dev/null +++ b/recipes/openal/all/patches/1.21.0-0001-c++14-does-not-have-std-aligned_alloc.patch @@ -0,0 +1,16 @@ +gcc-11 triggers an error. std::aligned_alloc needs c++17. +This patch ports openal 1.21.1 behavior back to 1.21.0. +--- common/almalloc.cpp ++++ common/almalloc.cpp +@@ -21,4 +21,4 @@ +-#if defined(HAVE_STD_ALIGNED_ALLOC) +- size = (size+(alignment-1))&~(alignment-1); +- return std::aligned_alloc(alignment, size); ++//#if defined(HAVE_STD_ALIGNED_ALLOC) ++// size = (size+(alignment-1))&~(alignment-1); ++// return std::aligned_alloc(alignment, size); +-#elif defined(HAVE_POSIX_MEMALIGN) ++#if defined(HAVE_POSIX_MEMALIGN) +@@ -56,1 +56,1 @@ +-#if defined(HAVE_STD_ALIGNED_ALLOC) || defined(HAVE_POSIX_MEMALIGN) ++#if defined(HAVE_POSIX_MEMALIGN) diff --git a/recipes/openal/all/patches/1.21.0-0002-fix-windows-sdk.patch b/recipes/openal/all/patches/1.21.0-0002-fix-windows-sdk.patch new file mode 100644 index 0000000000000..3a6c7afb5a414 --- /dev/null +++ b/recipes/openal/all/patches/1.21.0-0002-fix-windows-sdk.patch @@ -0,0 +1,74 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -880,49 +880,36 @@ option(ALSOFT_REQUIRE_WINMM "Require Windows Multimedia backend" OFF) + option(ALSOFT_REQUIRE_DSOUND "Require DirectSound backend" OFF) + option(ALSOFT_REQUIRE_WASAPI "Require WASAPI backend" OFF) + if(WIN32) +- set(WINSDK_LIB_DIRS ) +- set(WINSDK_INCLUDE_DIRS ) +- find_package(WindowsSDK) +- if(WINDOWSSDK_FOUND) +- get_windowssdk_library_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_LIB_DIRS) +- get_windowssdk_include_dirs(${WINDOWSSDK_PREFERRED_DIR} WINSDK_INCLUDE_DIRS) +- endif() +- + # Check MMSystem backend +- check_include_files("windows.h;mmsystem.h" HAVE_MMSYSTEM_H) +- find_library(WINMM_LIBRARY NAMES winmm +- PATHS ${WINSDK_LIB_DIRS}) +- if(HAVE_MMSYSTEM_H AND WINMM_LIBRARY) +- option(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON) +- if(ALSOFT_BACKEND_WINMM) +- set(HAVE_WINMM 1) +- set(BACKENDS "${BACKENDS} WinMM,") +- set(ALC_OBJS ${ALC_OBJS} alc/backends/winmm.cpp alc/backends/winmm.h) +- set(EXTRA_LIBS ${WINMM_LIBRARY} ${EXTRA_LIBS}) +- endif() ++ option(ALSOFT_BACKEND_WINMM "Enable Windows Multimedia backend" ON) ++ if(ALSOFT_BACKEND_WINMM) ++ set(HAVE_WINMM 1) ++ set(BACKENDS "${BACKENDS} WinMM,") ++ set(ALC_OBJS ${ALC_OBJS} alc/backends/winmm.cpp alc/backends/winmm.h) ++ # There doesn't seem to be good way to search for winmm.lib for MSVC. ++ # find_library doesn't find it without being told to look in a specific ++ # place in the WindowsSDK, but it links anyway. If there ends up being ++ # Windows targets without this, another means to detect it is needed. ++ set(EXTRA_LIBS winmm ${EXTRA_LIBS}) + endif() + + # Check DSound backend +- find_package(DSound) +- if(DSOUND_FOUND) ++ check_include_file(dsound.h HAVE_DSOUND_H) ++ if(DXSDK_DIR) ++ find_path(DSOUND_INCLUDE_DIR NAMES "dsound.h" ++ PATHS "${DXSDK_DIR}" PATH_SUFFIXES include ++ DOC "The DirectSound include directory") ++ endif() ++ if(HAVE_DSOUND_H OR DSOUND_INCLUDE_DIR) + option(ALSOFT_BACKEND_DSOUND "Enable DirectSound backend" ON) + if(ALSOFT_BACKEND_DSOUND) + set(HAVE_DSOUND 1) +- set(BACKENDS "${BACKENDS} DirectSound${IS_LINKED},") +- set(ALC_OBJS ${ALC_OBJS} alc/backends/dsound.cpp alc/backends/dsound.h) +- add_backend_libs(${DSOUND_LIBRARIES}) +- set(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIRS}) +- endif() +- endif() ++ set(BACKENDS "${BACKENDS} DirectSound,") ++ set(ALC_OBJS ${ALC_OBJS} alc/backends/dsound.cpp alc/backends/dsound.h) + +- # Check for WASAPI backend +- check_include_file(mmdeviceapi.h HAVE_MMDEVICEAPI_H) +- if(HAVE_MMDEVICEAPI_H) +- option(ALSOFT_BACKEND_WASAPI "Enable WASAPI backend" ON) +- if(ALSOFT_BACKEND_WASAPI) +- set(HAVE_WASAPI 1) +- set(BACKENDS "${BACKENDS} WASAPI,") +- set(ALC_OBJS ${ALC_OBJS} alc/backends/wasapi.cpp alc/backends/wasapi.h) ++ if(NOT HAVE_DSOUND_H) ++ set(INC_PATHS ${INC_PATHS} ${DSOUND_INCLUDE_DIR}) ++ endif() + endif() + endif() + endif() diff --git a/recipes/openal/all/patches/1.22.2-0001-fix-al-optional-in-if-compile-error.patch b/recipes/openal/all/patches/1.22.2-0001-fix-al-optional-in-if-compile-error.patch new file mode 100644 index 0000000000000..6e0e4aa8641f8 --- /dev/null +++ b/recipes/openal/all/patches/1.22.2-0001-fix-al-optional-in-if-compile-error.patch @@ -0,0 +1,47 @@ +From 650a6d49e9a511d005171940761f6dd6b440ee66 Mon Sep 17 00:00:00 2001 +From: Chris Robinson +Date: Mon, 18 Jul 2022 11:10:27 -0700 +Subject: [PATCH] Declare variables closer to where they're used + +--- + alc/backends/alsa.cpp | 6 ++---- + 1 file changed, 2 insertions(+), 4 deletions(-) + +diff --git a/alc/backends/alsa.cpp b/alc/backends/alsa.cpp +index 9c78b6c6a..b6efeaba1 100644 +--- a/alc/backends/alsa.cpp ++++ b/alc/backends/alsa.cpp +@@ -623,7 +623,6 @@ int AlsaPlayback::mixerNoMMapProc() + + void AlsaPlayback::open(const char *name) + { +- al::optional driveropt; + const char *driver{"default"}; + if(name) + { +@@ -640,7 +639,7 @@ void AlsaPlayback::open(const char *name) + else + { + name = alsaDevice; +- if(bool{driveropt = ConfigValueStr(nullptr, "alsa", "device")}) ++ if(auto driveropt = ConfigValueStr(nullptr, "alsa", "device")) + driver = driveropt->c_str(); + } + TRACE("Opening device \"%s\"\n", driver); +@@ -896,7 +895,6 @@ AlsaCapture::~AlsaCapture() + + void AlsaCapture::open(const char *name) + { +- al::optional driveropt; + const char *driver{"default"}; + if(name) + { +@@ -913,7 +911,7 @@ void AlsaCapture::open(const char *name) + else + { + name = alsaDevice; +- if(bool{driveropt = ConfigValueStr(nullptr, "alsa", "capture")}) ++ if(auto driveropt = ConfigValueStr(nullptr, "alsa", "capture")) + driver = driveropt->c_str(); + } + diff --git a/recipes/openal/all/test_package/CMakeLists.txt b/recipes/openal/all/test_package/CMakeLists.txt index 43f738951a358..f25fa5a765b27 100644 --- a/recipes/openal/all/test_package/CMakeLists.txt +++ b/recipes/openal/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(OpenAL REQUIRED CONFIG) +find_package(OpenAL REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} OpenAL::OpenAL) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenAL::OpenAL) diff --git a/recipes/openal/all/test_package/conanfile.py b/recipes/openal/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/openal/all/test_package/conanfile.py +++ b/recipes/openal/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openal/all/test_v1_package/CMakeLists.txt b/recipes/openal/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/openal/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/openal/all/test_v1_package/conanfile.py b/recipes/openal/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/openal/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/openapi-generator/all/conandata.yml b/recipes/openapi-generator/all/conandata.yml new file mode 100644 index 0000000000000..25015addd3eaf --- /dev/null +++ b/recipes/openapi-generator/all/conandata.yml @@ -0,0 +1,10 @@ +sources: + "6.4.0": + url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.4.0/openapi-generator-cli-6.4.0.jar" + sha256: "35aead300e0c9469fbd9d30cf46f4153897dcb282912091ca4ec9212dce9d151" + "6.3.0": + url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.3.0/openapi-generator-cli-6.3.0.jar" + sha256: "d714d7beec500a4b024fea63e3e787c9bf1f01ce1870af539f7c488a307b3f5b" + "6.2.1": + url: "https://repo1.maven.org/maven2/org/openapitools/openapi-generator-cli/6.2.1/openapi-generator-cli-6.2.1.jar" + sha256: "f2c8600f2c23ee1123eebf47ef0f40db386627e75b0340ca16182c10f4174fa9" diff --git a/recipes/openapi-generator/all/conanfile.py b/recipes/openapi-generator/all/conanfile.py new file mode 100644 index 0000000000000..2f6139881be2a --- /dev/null +++ b/recipes/openapi-generator/all/conanfile.py @@ -0,0 +1,80 @@ +from conan import ConanFile +from conan.tools.files import copy, download, save +import os +import stat + + +required_conan_version = ">=1.47.0" + + +class OpenApiGeneratorConan(ConanFile): + name = "openapi-generator" + description = "Generation of API client libraries (SDK generation), server stubs, documentation and configuration automatically given an OpenAPI Spec (v2, v3)" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://openapi-generator.tech" + topics = ("api", "sdk", "generator", "openapi") + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + pass + + def requirements(self): + self.requires("openjdk/16.0.1") + + def package_id(self): + del self.info.settings.arch + del self.info.settings.compiler + del self.info.settings.build_type + + def source(self): + pass + + def build(self): + v = self.conan_data["sources"][self.version] + download( + self, + url=v["url"], + filename=os.path.join(self.source_folder, "openapi-generator.jar"), + sha256=v["sha256"], + ) + download( + self, + url="https://raw.githubusercontent.com/OpenAPITools/openapi-generator/master/LICENSE", + filename=os.path.join(self.source_folder, "LICENSE"), + sha256="91a2fcdfc23cbd1188a22cc3b76647bf6eb05c87889e376a19fe478f0398ff02", + ) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="openapi-generator.jar", dst=os.path.join(self.package_folder, "res"), src=self.source_folder) + if self.info.settings.os == "Windows": + save(self, + path=os.path.join(self.package_folder, "bin", "openapi-generator.bat"), + content="""\ + java -classpath %CLASSPATH% org.openapitools.codegen.OpenAPIGenerator %* + """ + ) + else: + bin_path = os.path.join(self.package_folder, "bin", "openapi-generator") + save(self, + path=bin_path, + content="""\ + #!/bin/bash + java -classpath $CLASSPATH org.openapitools.codegen.OpenAPIGenerator $@ + """ + ) + st = os.stat(bin_path) + os.chmod(bin_path, st.st_mode | stat.S_IEXEC) + + def package_info(self): + # folders not used for pre-built binaries + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] + jar = os.path.join(self.package_folder, "res", "openapi-generator.jar") + self.runenv_info.prepend_path("CLASSPATH", jar) + + # TODO: Legacy, to be removed on Conan 2.0 + self.env_info.CLASSPATH.append(jar) diff --git a/recipes/openapi-generator/all/test_package/conanfile.py b/recipes/openapi-generator/all/test_package/conanfile.py new file mode 100644 index 0000000000000..3065918ed1fdf --- /dev/null +++ b/recipes/openapi-generator/all/test_package/conanfile.py @@ -0,0 +1,16 @@ +from conan import ConanFile +from conan.tools.build import can_run + + +# It will become the standard on Conan 2.x +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def test(self): + if can_run(self): + self.run("openapi-generator --version") diff --git a/recipes/openapi-generator/all/test_v1_package/conanfile.py b/recipes/openapi-generator/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a481f4b62ad17 --- /dev/null +++ b/recipes/openapi-generator/all/test_v1_package/conanfile.py @@ -0,0 +1,10 @@ +from conans import ConanFile +from conan.tools.build import can_run + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if can_run(self): + self.run("openapi-generator --version", run_environment=True) diff --git a/recipes/openapi-generator/config.yml b/recipes/openapi-generator/config.yml new file mode 100644 index 0000000000000..70b19bc266392 --- /dev/null +++ b/recipes/openapi-generator/config.yml @@ -0,0 +1,7 @@ +versions: + "6.4.0": + folder: all + "6.3.0": + folder: all + "6.2.1": + folder: all diff --git a/recipes/opencl-headers/all/conandata.yml b/recipes/opencl-headers/all/conandata.yml index 1fa22044b31c0..bc33b51742e45 100644 --- a/recipes/opencl-headers/all/conandata.yml +++ b/recipes/opencl-headers/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2022.09.30": + url: "https://github.com/KhronosGroup/OpenCL-Headers/archive/refs/tags/v2022.09.30.tar.gz" + sha256: "0ae857ecb28af95a420c800b21ed2d0f437503e104f841ab8db249df5f4fbe5c" "2022.05.18": url: "https://github.com/KhronosGroup/OpenCL-Headers/archive/v2022.05.18.tar.gz" sha256: "88a1177853b279eaf574e2aafad26a84be1a6f615ab1b00c20d5af2ace95c42e" diff --git a/recipes/opencl-headers/all/conanfile.py b/recipes/opencl-headers/all/conanfile.py index 818ee5e05bd79..3e936c8d7457e 100644 --- a/recipes/opencl-headers/all/conanfile.py +++ b/recipes/opencl-headers/all/conanfile.py @@ -10,18 +10,18 @@ class OpenclHeadersConan(ConanFile): name = "opencl-headers" description = "C language headers for the OpenCL API" license = "Apache-2.0" - topics = ("opencl-headers", "opencl", "header-only", "api-headers") + topics = ("opencl", "header-only", "api-headers") homepage = "https://github.com/KhronosGroup/OpenCL-Headers" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def package_id(self): - self.info.clear() - def layout(self): basic_layout(self, src_folder="src") + def package_id(self): + self.info.clear() + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -38,9 +38,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "OpenCL::Headers") self.cpp_info.set_property("pkg_config_name", "OpenCL") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "OpenCLHeaders" @@ -53,6 +51,4 @@ def package_info(self): self.cpp_info.components["_opencl-headers"].set_property("cmake_target_name", "OpenCL::Headers") self.cpp_info.components["_opencl-headers"].set_property("pkg_config_name", "OpenCL") self.cpp_info.components["_opencl-headers"].bindirs = [] - self.cpp_info.components["_opencl-headers"].frameworkdirs = [] self.cpp_info.components["_opencl-headers"].libdirs = [] - self.cpp_info.components["_opencl-headers"].resdirs = [] diff --git a/recipes/opencl-headers/all/test_package/conanfile.py b/recipes/opencl-headers/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/opencl-headers/all/test_package/conanfile.py +++ b/recipes/opencl-headers/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/opencl-headers/all/test_v1_package/CMakeLists.txt b/recipes/opencl-headers/all/test_v1_package/CMakeLists.txt index 0fb6ffa063526..0d20897301b68 100644 --- a/recipes/opencl-headers/all/test_v1_package/CMakeLists.txt +++ b/recipes/opencl-headers/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(OpenCLHeaders REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE OpenCL::Headers) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opencl-headers/config.yml b/recipes/opencl-headers/config.yml index 20c740973773e..ce621bb7cdbe5 100644 --- a/recipes/opencl-headers/config.yml +++ b/recipes/opencl-headers/config.yml @@ -1,4 +1,6 @@ versions: + "2022.09.30": + folder: all "2022.05.18": folder: all "2022.01.04": diff --git a/recipes/opencl-icd-loader/all/CMakeLists.txt b/recipes/opencl-icd-loader/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/opencl-icd-loader/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/opencl-icd-loader/all/conandata.yml b/recipes/opencl-icd-loader/all/conandata.yml index a3f89d19bb81a..398c17f249549 100644 --- a/recipes/opencl-icd-loader/all/conandata.yml +++ b/recipes/opencl-icd-loader/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2022.09.30": + url: "https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v2022.09.30.tar.gz" + sha256: "e9522fb736627dd4feae2a9c467a864e7d25bb715f808de8a04eea5a7d394b74" + "2022.05.18": + url: "https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/refs/tags/v2022.05.18.tar.gz" + sha256: "71f70bba797a501b13b6b0905dc852f3fd6e264d74ce294f2df98d29914c4303" "2022.01.04": url: "https://github.com/KhronosGroup/OpenCL-ICD-Loader/archive/v2022.01.04.tar.gz" sha256: "9f21d958af68c1b625a03c2befddd79da95d610614ddab6c291f26f01a947dd8" @@ -10,8 +16,7 @@ sources: sha256: "e7a0c161376bfb46b869e292d4593a64f4ff7b358837494a5f2d765d9a2af683" patches: "2020.06.16": - - base_path: "source_subfolder" - patch_file: "patches/2020.06.16/0001-xcode-missing-includes.patch" - # patch_type: portability - # source: https://github.com/KhronosGroup/OpenCL-ICD-Loader/pull/131 - # description: Add missing includes (needed for new Xcode versions) + - patch_file: "patches/2020.06.16/0001-xcode-missing-includes.patch" + patch_description: "Add missing includes (needed for new Xcode versions)" + patch_type: "portability" + patch_source: "https://github.com/KhronosGroup/OpenCL-ICD-Loader/pull/131" diff --git a/recipes/opencl-icd-loader/all/conanfile.py b/recipes/opencl-icd-loader/all/conanfile.py index 6328f43b1ab66..58940f83c77c3 100644 --- a/recipes/opencl-icd-loader/all/conanfile.py +++ b/recipes/opencl-icd-loader/all/conanfile.py @@ -1,31 +1,34 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class OpenclIcdLoaderConan(ConanFile): name = "opencl-icd-loader" description = "OpenCL ICD Loader." license = "Apache-2.0" - topics = ("opencl-icd-loader", "opencl", "khronos", "parallel", "icd-loader") + topics = ("opencl", "khronos", "parallel", "icd-loader") homepage = "https://github.com/KhronosGroup/OpenCL-ICD-Loader" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False], "disable_openclon12": [True, False]} - default_options = {"shared": False, "fPIC": True, "disable_openclon12": False} - - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + options = { + "shared": [True, False], + "fPIC": [True, False], + "disable_openclon12": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "disable_openclon12": False, + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,49 +38,70 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("opencl-headers/{}".format(self.version)) + self.requires(f"opencl-headers/{self.version}", transitive_headers=True) def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["OPENCL_ICD_LOADER_HEADERS_DIR"] = ";".join(self.deps_cpp_info["opencl-headers"].include_paths) - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["USE_DYNAMIC_VCXX_RUNTIME"] = str(self.settings.compiler.runtime).startswith("MD") - self._cmake.definitions["OPENCL_ICD_LOADER_PIC"] = self.options.get_safe("fPIC", True) - self._cmake.definitions["OPENCL_ICD_LOADER_BUILD_TESTING"] = False + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["OPENCL_ICD_LOADER_HEADERS_DIR"] = ";".join(self.deps_cpp_info["opencl-headers"].include_paths) + if is_msvc(self): + tc.variables["USE_DYNAMIC_VCXX_RUNTIME"] = not is_msvc_static_runtime(self) + tc.variables["OPENCL_ICD_LOADER_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["OPENCL_ICD_LOADER_BUILD_TESTING"] = False if self.settings.os == "Windows": - self._cmake.definitions["OPENCL_ICD_LOADER_DISABLE_OPENCLON12"] = self.options.disable_openclon12 - self._cmake.configure() - return self._cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + tc.variables["OPENCL_ICD_LOADER_DISABLE_OPENCLON12"] = self.options.disable_openclon12 + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.set_property("cmake_find_mode", "both") + self.cpp_info.set_property("cmake_module_file_name", "OpenCL") + self.cpp_info.set_property("cmake_file_name", "OpenCLICDLoader") + self.cpp_info.set_property("cmake_target_name", "OpenCL::OpenCL") self.cpp_info.includedirs = [] self.cpp_info.libs = ["OpenCL"] if not self.options.shared: - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["dl", "pthread"] elif self.settings.os == "Windows": self.cpp_info.system_libs = ["cfgmgr32", "runtimeobject"] + + # TODO: to remove in conan v2 + self.cpp_info.filenames["cmake_find_package"] = "OpenCL" + self.cpp_info.filenames["cmake_find_package_multi"] = "OpenCLICDLoader" + self.cpp_info.names["cmake_find_package"] = "OpenCL" + self.cpp_info.names["cmake_find_package_multi"] = "OpenCL" diff --git a/recipes/opencl-icd-loader/all/test_package/CMakeLists.txt b/recipes/opencl-icd-loader/all/test_package/CMakeLists.txt index 7b9b613cbb24a..d33ec86059870 100644 --- a/recipes/opencl-icd-loader/all/test_package/CMakeLists.txt +++ b/recipes/opencl-icd-loader/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(OpenCLICDLoader REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenCL::OpenCL) diff --git a/recipes/opencl-icd-loader/all/test_package/conanfile.py b/recipes/opencl-icd-loader/all/test_package/conanfile.py index 5c09494bc67c0..0a6bc68712d90 100644 --- a/recipes/opencl-icd-loader/all/test_package/conanfile.py +++ b/recipes/opencl-icd-loader/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opencl-icd-loader/all/test_v1_package/CMakeLists.txt b/recipes/opencl-icd-loader/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/opencl-icd-loader/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opencl-icd-loader/all/test_v1_package/conanfile.py b/recipes/opencl-icd-loader/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/opencl-icd-loader/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opencl-icd-loader/config.yml b/recipes/opencl-icd-loader/config.yml index 16434eecdd52e..ee1b6d54f979e 100644 --- a/recipes/opencl-icd-loader/config.yml +++ b/recipes/opencl-icd-loader/config.yml @@ -1,4 +1,8 @@ versions: + "2022.09.30": + folder: all + "2022.05.18": + folder: all "2022.01.04": folder: all "2021.04.29": diff --git a/recipes/opencore-amr/all/conandata.yml b/recipes/opencore-amr/all/conandata.yml index dabe33b6467ab..44a009a38d2e0 100644 --- a/recipes/opencore-amr/all/conandata.yml +++ b/recipes/opencore-amr/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.1.6": + url: "https://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.6.tar.gz" + sha256: "483eb4061088e2b34b358e47540b5d495a96cd468e361050fae615b1809dc4a1" "0.1.5": url: "https://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.5.tar.gz" sha256: "2c006cb9d5f651bfb5e60156dbff6af3c9d35c7bbcc9015308c0aff1e14cd341" diff --git a/recipes/opencore-amr/all/conanfile.py b/recipes/opencore-amr/all/conanfile.py index 0db57e278a137..3c1ebbcb2a163 100644 --- a/recipes/opencore-amr/all/conanfile.py +++ b/recipes/opencore-amr/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools +from conan import ConanFile +from conan.tools import files +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +from conans import AutoToolsBuildEnvironment +from conans.tools import environment_append, get_env, os_info, vcvars, unix_path from contextlib import contextmanager import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class OpencoreAmrConan(ConanFile): @@ -18,7 +23,7 @@ class OpencoreAmrConan(ConanFile): "fPIC": [True, False], } default_options = { - "shared": False, + "shared": False, "fPIC": True, } @@ -41,26 +46,26 @@ def configure(self): del self.options.fPIC def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + if self._settings_build.os == "Windows" and not get_env("CONAN_BASH_PATH"): self.build_requires("msys2/cci.latest") if self.settings.compiler == "Visual Studio": - self.build_requires("automake/1.16.4") + self.build_requires("automake/1.16.5") def source(self): - tools.get(**self.conan_data["sources"][self.version], + files.get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) @contextmanager def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): + if is_msvc(self): + with vcvars(self): env = { "CC": "cl -nologo", "CXX": "cl -nologo", "LD": "link -nologo", - "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)), + "AR": "{} lib".format(unix_path(self.deps_user_info["automake"].ar_lib)), } - with tools.environment_append(env): + with environment_append(env): yield else: yield @@ -68,17 +73,20 @@ def _build_context(self): def _configure_autotools(self): if self._autotools: return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" + self._autotools = AutoToolsBuildEnvironment( + self, win_bash=os_info.is_windows) + + def yes_no(v): return "yes" if v else "no" args = [ "--enable-shared={}".format(yes_no(self.options.shared)), "--enable-static={}".format(yes_no(not self.options.shared)), ] - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self._autotools.cxx_flags.append("-EHsc") - if tools.Version(self.settings.compiler.version) >= "12": + if Version(self.settings.compiler.version) >= "12": self._autotools.flags.append("-FS") - self._autotools.configure(args=args, configure_dir=self._source_subfolder) + self._autotools.configure( + args=args, configure_dir=self._source_subfolder) return self._autotools def build(self): @@ -89,14 +97,22 @@ def build(self): def package(self): self._autotools.install() self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + files.rm(self, "*.la", os.path.join(self.package_folder, "lib")) + files.rmdir(self, os.path.join( + self.package_folder, "lib", "pkgconfig")) if self.settings.compiler == "Visual Studio" and self.options.shared: for lib in ("opencore-amrwb", "opencore-amrnb"): - tools.rename(os.path.join(self.package_folder, "lib", "{}.dll.lib".format(lib)), + files.rename(self, os.path.join(self.package_folder, "lib", "{}.dll.lib".format(lib)), os.path.join(self.package_folder, "lib", "{}.lib".format(lib))) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "opencore-amr") + self.cpp_info.set_property( + "cmake_target_name", "opencore-amr::opencore-amr") for lib in ("opencore-amrwb", "opencore-amrnb"): - self.cpp_info.components[lib].names["pkg_config"] = lib + self.cpp_info.components[lib].set_property( + "cmake_target_name", f'opencore-amr::{lib}') + self.cpp_info.components[lib].set_property("pkg_config_name", lib) self.cpp_info.components[lib].libs = [lib] + # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generator removed + self.cpp_info.components[lib].names["pkg_config"] = lib diff --git a/recipes/opencore-amr/config.yml b/recipes/opencore-amr/config.yml index 08750607a91c8..b59a632b1da64 100644 --- a/recipes/opencore-amr/config.yml +++ b/recipes/opencore-amr/config.yml @@ -1,3 +1,5 @@ versions: + "0.1.6": + folder: "all" "0.1.5": folder: "all" diff --git a/recipes/opencv/2.x/CMakeLists.txt b/recipes/opencv/2.x/CMakeLists.txt deleted file mode 100644 index 45bfb17ed31bc..0000000000000 --- a/recipes/opencv/2.x/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(src) diff --git a/recipes/opencv/2.x/conandata.yml b/recipes/opencv/2.x/conandata.yml index 9bd9ee8e16d81..c7fff0b6f44c7 100644 --- a/recipes/opencv/2.x/conandata.yml +++ b/recipes/opencv/2.x/conandata.yml @@ -5,4 +5,8 @@ sources: patches: "2.4.13.7": - patch_file: "patches/0001-jasper.patch" - base_path: "src" + patch_description: "Compatibility with recent jasper versions" + patch_type: "portability" + - patch_file: "patches/0002-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" diff --git a/recipes/opencv/2.x/conanfile.py b/recipes/opencv/2.x/conanfile.py index 49082ca596f05..33f0ecba72fd2 100644 --- a/recipes/opencv/2.x/conanfile.py +++ b/recipes/opencv/2.x/conanfile.py @@ -1,11 +1,41 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import valid_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir, save +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os import textwrap -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.54.0" + + +OPENCV_MAIN_MODULES_OPTIONS = ( + "calib3d", + "contrib", + "features2d", + "flann", + "gpu", + "highgui", + "imgproc", + "legacy", + "ml", + "objdetect", + "photo", + "stitching", + "superres", + "ts", + "video", + "videostab", +) + +OPENCV_EXTRA_MODULES_OPTIONS = ( + "androidcamera", + "nonfree", + "ocl", + "viz", +) class OpenCVConan(ConanFile): name = "opencv" @@ -19,328 +49,584 @@ class OpenCVConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "with_jpeg": [True, False], + # global options + "with_eigen": [True, False], + "with_tbb": [True, False], + "world": [True, False], + # highgui module options + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], "with_png": [True, False], "with_tiff": [True, False], "with_jasper": [True, False], "with_openexr": [True, False], - "with_eigen": [True, False], - "with_tbb": [True, False], "with_gtk": [True, False], - "nonfree": [True, False], } + options.update({_name: [True, False] for _name in OPENCV_MAIN_MODULES_OPTIONS}) + options.update({_name: [True, False] for _name in OPENCV_EXTRA_MODULES_OPTIONS}) + default_options = { "shared": False, "fPIC": True, - "with_jpeg": True, + # global options + "with_eigen": True, + "with_tbb": False, + "world": False, + # highgui module options + "with_jpeg": "libjpeg", "with_png": True, "with_tiff": True, "with_jasper": True, "with_openexr": True, - "with_eigen": True, - "with_tbb": False, "with_gtk": True, - "nonfree": False, } - - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "src" - - @property - def _build_subfolder(self): - return "build" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + default_options.update({_name: True for _name in OPENCV_MAIN_MODULES_OPTIONS}) + default_options.update({_name: False for _name in OPENCV_EXTRA_MODULES_OPTIONS}) def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if self.settings.os != "Android": + del self.options.androidcamera + if self.settings.os == "iOS": + del self.options.gpu + del self.options.superres + del self.options.ts if self.settings.os != "Linux": del self.options.with_gtk + @property + def _opencv_modules(self): + def imageformats_deps(): + components = [] + if self.options.get_safe("with_png"): + components.append("libpng::libpng") + if self.options.get_safe("with_jpeg") == "libjpeg": + components.append("libjpeg::libjpeg") + elif self.options.get_safe("with_jpeg") == "libjpeg-turbo": + components.append("libjpeg-turbo::jpeg") + elif self.options.get_safe("with_jpeg") == "mozjpeg": + components.append("mozjpeg::libjpeg") + if self.options.get_safe("with_tiff"): + components.append("libtiff::libtiff") + if self.options.get_safe("with_jasper"): + components.append("jasper::jasper") + if self.options.get_safe("with_openexr"): + components.append("openexr::openexr") + return components + + def eigen(): + return ["eigen::eigen"] if self.options.with_eigen else [] + + def gtk(): + return ["gtk::gtk"] if self.options.get_safe("with_gtk") else [] + + def tbb(): + return ["onetbb::onetbb"] if self.options.with_tbb else [] + + def opencv_gpu(): + return ["opencv_gpu"] if self.options.get_safe("gpu") else [] + + def opencv_highgui(): + return ["opencv_highgui"] if self.options.highgui else [] + + def opencv_nonfree(): + return ["opencv_nonfree"] if self.options.nonfree else [] + + def opencv_ocl(): + return ["opencv_ocl"] if self.options.ocl else [] + + def opencv_androidcamera(): + return ["opencv_androidcamera"] if self.options.get_safe("androidcamera") else [] + + opencv_modules = { + # Main modules + "calib3d": { + "is_built": self.options.calib3d, + "mandatory_options": ["features2d", "imgproc"], + "requires": ["opencv_features2d", "opencv_imgproc"] + eigen() + tbb(), + }, + "contrib": { + "is_built": self.options.contrib, + "mandatory_options": ["calib3d", "features2d", "imgproc", "ml", "objdetect", "video"], + "requires": ["opencv_calib3d", "opencv_features2d", "opencv_imgproc", "opencv_ml", "opencv_objdetect", + "opencv_video"] + opencv_highgui() + opencv_nonfree() + eigen() + tbb(), + }, + "core": { + "is_built": True, + "no_option": True, + "requires": ["zlib::zlib"] + eigen() + tbb(), + "system_libs": [ + (self.settings.os == "Android", ["dl", "m", "log"]), + (self.settings.os == "FreeBSD", ["m", "pthread"]), + (self.settings.os == "Linux", ["dl", "m", "pthread", "rt"]), + ], + }, + "features2d": { + "is_built": self.options.features2d, + "mandatory_options": ["flann", "imgproc"], + "requires": ["opencv_flann", "opencv_imgproc"] + opencv_highgui() + eigen() + tbb(), + }, + "flann": { + "is_built": self.options.flann, + "requires": ["opencv_core"] + eigen() + tbb(), + }, + "gpu": { + "is_built": self.options.get_safe("gpu"), + "mandatory_options": ["calib3d", "imgproc", "legacy", "objdetect", "photo", "video"], + "requires": ["opencv_calib3d", "opencv_imgproc", "opencv_legacy", "opencv_objdetect", "opencv_photo", + "opencv_video"] + eigen() + tbb(), + }, + "highgui": { + "is_built": self.options.highgui, + "mandatory_options": ["imgproc"], + "requires": ["opencv_imgproc"] + opencv_androidcamera() + imageformats_deps() + gtk() + eigen() + tbb(), + "system_libs": [ + (self.settings.os == "Windows", ["comctl32", "gdi32", "ole32", "setupapi", "ws2_32", "vfw32"]), + ], + "frameworks": [ + (is_apple_os(self), ["Accelerate", "AVFoundation", "CoreFoundation", "CoreGraphics", "CoreMedia", + "CoreVideo", "Foundation", "QuartzCore"]), + (self.settings.os == "iOS", ["UIKit"]), + (self.settings.os == "Macos", ["AppKit", "Cocoa"]), + ], + }, + "imgproc": { + "is_built": self.options.imgproc, + "requires": ["opencv_core"] + eigen() + tbb(), + }, + "legacy": { + "is_built": self.options.legacy, + "mandatory_options": ["calib3d", "ml", "video"], + "requires": ["opencv_calib3d", "opencv_ml", "opencv_video"] + opencv_highgui() + eigen() + tbb(), + }, + "ml": { + "is_built": self.options.ml, + "requires": ["opencv_core"] + eigen() + tbb(), + }, + "objdetect": { + "is_built": self.options.objdetect, + "mandatory_options": ["imgproc"], + "requires": ["opencv_core", "opencv_imgproc"] + opencv_highgui() + eigen() + tbb(), + }, + "photo": { + "is_built": self.options.photo, + "mandatory_options": ["imgproc"], + "requires": ["opencv_imgproc"] + eigen() + tbb(), + }, + "stitching": { + "is_built": self.options.stitching, + "mandatory_options": ["calib3d", "features2d", "imgproc", "objdetect"], + "requires": ["opencv_calib3d", "opencv_features2d", "opencv_imgproc", "opencv_objdetect"] + + opencv_gpu() + opencv_nonfree() + eigen() + tbb(), + }, + "superres": { + "is_built": self.options.get_safe("superres"), + "mandatory_options": ["imgproc", "video"], + "requires": ["opencv_imgproc", "opencv_video"] + opencv_gpu() + opencv_highgui() + opencv_ocl() + + eigen() + tbb(), + }, + "ts": { + "is_built": self.options.get_safe("ts"), + "is_part_of_world": False, + "mandatory_options": ["calib3d", "features2d", "highgui", "imgproc", "video"], + "requires": ["opencv_core", "opencv_calib3d", "opencv_features2d", "opencv_highgui", "opencv_imgproc", + "opencv_video"] + eigen() + tbb(), + }, + "video": { + "is_built": self.options.video, + "mandatory_options": ["imgproc"], + "requires": ["opencv_imgproc"] + eigen() + tbb(), + }, + "videostab": { + "is_built": self.options.videostab, + "mandatory_options": ["calib3d", "features2d", "highgui", "imgproc", "photo", "video"], + "requires": ["opencv_calib3d", "opencv_features2d", "opencv_highgui", "opencv_imgproc", "opencv_photo", + "opencv_video"] + opencv_gpu() + eigen() + tbb(), + }, + # Extra modules + "androidcamera": { + "is_built": self.options.get_safe("androidcamera"), + "requires": ["opencv_core"] + eigen() + tbb(), + "system_libs": [ + (self.settings.os == "Android", ["dl", "log"]), + ], + }, + "nonfree": { + "is_built": self.options.nonfree, + "mandatory_options": ["calib3d", "features2d", "imgproc"], + "requires": ["opencv_calib3d", "opencv_features2d", "opencv_imgproc"] + opencv_gpu() + opencv_ocl() + + eigen() + tbb(), + }, + "ocl": { + "is_built": self.options.ocl, + "mandatory_options": ["calib3d", "features2d", "imgproc", "ml", "objdetect", "video"], + "requires": ["opencv_calib3d", "opencv_core", "opencv_features2d", "opencv_imgproc", "opencv_ml", + "opencv_objdetect", "opencv_video"] + eigen() + tbb(), + "frameworks": [ + (self.settings.os == "Macos", ["OpenCL"]), + ], + }, + "viz": { + "is_built": self.options.viz, + "requires": ["opencv_core", "vtk::vtk"] + eigen() + tbb(), + }, + } + + return opencv_modules + + def _get_mandatory_disabled_options(self, opencv_modules): + direct_options_to_enable = {} + transitive_options_to_enable = {} + + # Check which direct options have to be enabled + base_options = [option for option, values in opencv_modules.items() + if not values.get("no_option") and self.options.get_safe(option)] + for base_option in base_options: + for mandatory_option in opencv_modules.get(base_option, {}).get("mandatory_options", []): + if not self.options.get_safe(mandatory_option): + direct_options_to_enable.setdefault(mandatory_option, set()).add(base_option) + + # Now traverse the graph to check which transitive options have to be enabled + def collect_transitive_options(base_option, option): + for mandatory_option in opencv_modules.get(option, {}).get("mandatory_options", []): + if not self.options.get_safe(mandatory_option): + if mandatory_option not in transitive_options_to_enable: + transitive_options_to_enable[mandatory_option] = set() + collect_transitive_options(base_option, mandatory_option) + if base_option not in direct_options_to_enable.get(mandatory_option, set()): + transitive_options_to_enable[mandatory_option].add(base_option) + + for base_option in base_options: + collect_transitive_options(base_option, base_option) + + return { + "direct": direct_options_to_enable, + "transitive": transitive_options_to_enable, + } + + def _solve_internal_dependency_graph(self, opencv_modules): + disabled_options = self._get_mandatory_disabled_options(opencv_modules) + direct_options_to_enable = disabled_options["direct"] + transitive_options_to_enable = disabled_options["transitive"] + + # Enable mandatory options + all_options_to_enable = set(direct_options_to_enable.keys()) + all_options_to_enable.update(transitive_options_to_enable.keys()) + if all_options_to_enable: + message = ("Several opencv options which were disabled will be enabled because " + "they are required by modules you have explicitly requested:\n") + + for option_to_enable in all_options_to_enable: + setattr(self.options, option_to_enable, True) + + direct_and_transitive = [] + direct = ", ".join(direct_options_to_enable.get(option_to_enable, [])) + if direct: + direct_and_transitive.append(f"direct dependency of {direct}") + transitive = ", ".join(transitive_options_to_enable.get(option_to_enable, [])) + if transitive: + direct_and_transitive.append(f"transitive dependency of {transitive}") + message += f" - {option_to_enable}: {' / '.join(direct_and_transitive)}\n" + + self.output.warning(message) + def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + # Call this first before any further manipulation of options based on other options + self._solve_internal_dependency_graph(self._opencv_modules) + + if not self.options.highgui: + self.options.rm_safe("with_jpeg") + self.options.rm_safe("with_png") + self.options.rm_safe("with_tiff") + self.options.rm_safe("with_jasper") + self.options.rm_safe("with_openexr") + self.options.rm_safe("with_gtk") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") - if self.options.with_jpeg: - self.requires("libjpeg/9d") - if self.options.with_png: - self.requires("libpng/1.6.37") - if self.options.with_jasper: - self.requires("jasper/2.0.33") - if self.options.with_openexr: - self.requires("openexr/2.5.7") - if self.options.with_tiff: - self.requires("libtiff/4.3.0") + self.requires("zlib/1.2.13") if self.options.with_eigen: self.requires("eigen/3.4.0") if self.options.with_tbb: + # opencv 2.x doesn't support onetbb >= 2021 self.requires("onetbb/2020.3") + # highgui module options + if self.options.get_safe("with_jpeg") == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.get_safe("with_jpeg") == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + elif self.options.get_safe("with_jpeg") == "mozjpeg": + self.requires("mozjpeg/4.1.1") + if self.options.get_safe("with_png"): + self.requires("libpng/1.6.39") + if self.options.get_safe("with_jasper"): + self.requires("jasper/4.0.0") + if self.options.get_safe("with_openexr"): + # opencv 2.x doesn't support openexr >= 3 + self.requires("openexr/2.5.7") + if self.options.get_safe("with_tiff"): + self.requires("libtiff/4.4.0") if self.options.get_safe("with_gtk"): self.requires("gtk/system") + def _check_mandatory_options(self, opencv_modules): + disabled_options = self._get_mandatory_disabled_options(opencv_modules) + direct_disabled_mandatory_options = disabled_options["direct"] + transitive_disabled_mandatory_options = disabled_options["transitive"] + + # check mandatory options + all_disabled_mandatory_options = set(direct_disabled_mandatory_options.keys()) + all_disabled_mandatory_options.update(transitive_disabled_mandatory_options.keys()) + if all_disabled_mandatory_options: + message = ("Several opencv options are disabled but are required by modules " + "you have explicitly requested:\n") + + for disabled_option in all_disabled_mandatory_options: + direct_and_transitive = [] + direct = ", ".join(direct_disabled_mandatory_options.get(disabled_option, [])) + if direct: + direct_and_transitive.append(f"direct dependency of {direct}") + transitive = ", ".join(transitive_disabled_mandatory_options.get(disabled_option, [])) + if transitive: + direct_and_transitive.append(f"transitive dependency of {transitive}") + message += f" - {disabled_option}: {' / '.join(direct_and_transitive)}\n" + + raise ConanInvalidConfiguration(message) + def validate(self): - if self.options.shared and self._is_msvc and "MT" in msvc_runtime_flag(self): + self._check_mandatory_options(self._opencv_modules) + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Visual Studio with static runtime is not supported for shared library.") + if self.options.viz: + raise ConanInvalidConfiguration( + "viz module can't be enabled yet. It requires VTK which is not available in conan-center." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_opencv(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.rmdir(os.path.join(self._source_subfolder, "3rdparty")) - - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - - # allow to find conan-supplied OpenEXR - if self.options.with_openexr: - find_openexr = os.path.join(self._source_subfolder, "cmake", "OpenCVFindOpenEXR.cmake") - tools.replace_in_file(find_openexr, - r'SET(OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \"Deploy\" folder")', - "") - tools.replace_in_file(find_openexr, r'set(OPENEXR_ROOT "")', "") - tools.replace_in_file(find_openexr, "SET(OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug)", "") - tools.replace_in_file(find_openexr, "SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug)", "") - - def openexr_library_names(name): - # OpenEXR library may have different names, depends on namespace versioning, static, debug, etc. - reference = str(self.requires["openexr"]) - version_name = reference.split("@")[0] - version = version_name.split("/")[1] - version_tokens = version.split(".") - major, minor = version_tokens[0], version_tokens[1] - suffix = "%s_%s" % (major, minor) - names = ["%s-%s" % (name, suffix), - "%s-%s_s" % (name, suffix), - "%s-%s_d" % (name, suffix), - "%s-%s_s_d" % (name, suffix), - "%s" % name, - "%s_s" % name, - "%s_d" % name, - "%s_s_d" % name] - return " ".join(names) - - for lib in ["Half", "Iex", "Imath", "IlmImf", "IlmThread"]: - tools.replace_in_file(find_openexr, "NAMES %s" % lib, "NAMES %s" % openexr_library_names(lib)) - - tools.replace_in_file(cmakelists, - "project(OpenCV CXX C)", "project(OpenCV CXX C)\nset(CMAKE_CXX_STANDARD 11)") + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def _patch_sources(self): + apply_conandata_patches(self) + rmdir(self, os.path.join(self.source_folder, "3rdparty")) + + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") for cascade in ["lbpcascades", "haarcascades"]: - tools.replace_in_file(os.path.join(self._source_subfolder, "data", "CMakeLists.txt"), - "share/OpenCV/%s" % cascade, "res/%s" % cascade) + replace_in_file(self, os.path.join(self.source_folder, "data", "CMakeLists.txt"), + f"share/OpenCV/{cascade}", f"res/{cascade}") - tools.replace_in_file(cmakelists, "staticlib", "lib") - tools.replace_in_file(cmakelists, "ANDROID OR NOT UNIX", "FALSE") - tools.replace_in_file(cmakelists, "${OpenCV_ARCH}/${OpenCV_RUNTIME}/", "") - tools.replace_in_file(os.path.join(self._source_subfolder, "modules", "highgui", "CMakeLists.txt"), "JASPER_", "Jasper_") + replace_in_file(self, cmakelists, "staticlib", "lib") + replace_in_file(self, cmakelists, "ANDROID OR NOT UNIX", "FALSE") + replace_in_file(self, cmakelists, "${OpenCV_ARCH}/${OpenCV_RUNTIME}/", "") + replace_in_file(self, os.path.join(self.source_folder, "modules", "highgui", "CMakeLists.txt"), "JASPER_", "Jasper_") # relocatable shared lib on macOS - tools.replace_in_file(cmakelists, "cmake_policy(SET CMP0042 OLD)", "cmake_policy(SET CMP0042 NEW)") + replace_in_file(self, cmakelists, "cmake_policy(SET CMP0042 OLD)", "cmake_policy(SET CMP0042 NEW)") # Cleanup RPATH - tools.replace_in_file(cmakelists, + replace_in_file(self, cmakelists, "set(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}\")", "") - tools.replace_in_file(cmakelists, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") + replace_in_file(self, cmakelists, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") # Do not try to detect Python - tools.replace_in_file(cmakelists, "include(cmake/OpenCVDetectPython.cmake)", "") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_DOCS"] = False - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_PACKAGE"] = False - self._cmake.definitions["BUILD_PERF_TESTS"] = False - self._cmake.definitions["BUILD_opencv_apps"] = False - self._cmake.definitions["BUILD_opencv_java"] = False - self._cmake.definitions["BUILD_ZLIB"] = False - self._cmake.definitions["BUILD_JPEG"] = False - self._cmake.definitions["BUILD_PNG"] = False - self._cmake.definitions["BUILD_TIFF"] = False - self._cmake.definitions["BUILD_JASPER"] = False - self._cmake.definitions["BUILD_OPENEXR"] = False - - self._cmake.definitions["WITH_CUFFT"] = False - self._cmake.definitions["WITH_CUBLAS"] = False - self._cmake.definitions["WITH_NVCUVID"] = False - self._cmake.definitions["WITH_FFMPEG"] = False - self._cmake.definitions["WITH_GSTREAMER"] = False - self._cmake.definitions["WITH_OPENCL"] = False - self._cmake.definitions["WITH_CUDA"] = False - - self._cmake.definitions["WITH_GTK"] = self.options.get_safe("with_gtk", False) - self._cmake.definitions["WITH_JPEG"] = self.options.with_jpeg - self._cmake.definitions["WITH_PNG"] = self.options.with_png - self._cmake.definitions["WITH_TIFF"] = self.options.with_tiff - self._cmake.definitions["WITH_JASPER"] = self.options.with_jasper - self._cmake.definitions["WITH_OPENEXR"] = self.options.with_openexr - self._cmake.definitions["WITH_EIGEN"] = self.options.with_eigen - self._cmake.definitions["WITH_TBB"] = self.options.with_tbb - self._cmake.definitions["OPENCV_MODULES_PUBLIC"] = "opencv" - self._cmake.definitions["BUILD_opencv_nonfree"] = self.options.nonfree - - self._cmake.definitions["ENABLE_CCACHE"] = False - - if self._is_msvc: - self._cmake.definitions["BUILD_WITH_STATIC_CRT"] = "MT" in msvc_runtime_flag(self) - self._cmake.configure(build_folder=self._build_subfolder) - - return self._cmake + replace_in_file(self, cmakelists, "include(cmake/OpenCVDetectPython.cmake)", "") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_ANDROID_EXAMPLES"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_DOCS"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_PACKAGE"] = False + tc.variables["BUILD_PERF_TESTS"] = False + tc.variables["BUILD_opencv_apps"] = False + tc.variables["BUILD_opencv_java"] = False + tc.variables["BUILD_ZLIB"] = False + tc.variables["BUILD_JPEG"] = False + tc.variables["BUILD_PNG"] = False + tc.variables["BUILD_TIFF"] = False + tc.variables["BUILD_JASPER"] = False + tc.variables["BUILD_OPENEXR"] = False + tc.variables["BUILD_TBB"] = False + tc.variables["WITH_VTK"] = self.options.viz + tc.variables["WITH_CUFFT"] = False + tc.variables["WITH_CUBLAS"] = False + tc.variables["WITH_NVCUVID"] = False + tc.variables["WITH_FFMPEG"] = False + tc.variables["WITH_GSTREAMER"] = False + tc.variables["WITH_OPENCL"] = self.options.ocl + tc.variables["WITH_CUDA"] = False + tc.variables["WITH_GTK"] = self.options.get_safe("with_gtk", False) + tc.variables["WITH_JPEG"] = bool(self.options.get_safe("with_jpeg", False)) + tc.variables["WITH_PNG"] = self.options.get_safe("with_png", False) + tc.variables["WITH_TIFF"] = self.options.get_safe("with_tiff", False) + tc.variables["WITH_JASPER"] = self.options.get_safe("with_jasper", False) + tc.variables["WITH_OPENEXR"] = self.options.get_safe("with_openexr", False) + if self.options.get_safe("with_openexr") and not valid_min_cppstd(self, 11): + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.variables["WITH_EIGEN"] = self.options.with_eigen + tc.variables["WITH_QT"] = False + tc.variables["WITH_TBB"] = self.options.with_tbb + tc.variables["WITH_OPENMP"] = False + tc.variables["OPENCV_MODULES_PUBLIC"] = "opencv" + # Main modules + tc.variables["BUILD_opencv_calib3d"] = self.options.calib3d + tc.variables["BUILD_opencv_contrib"] = self.options.contrib + tc.variables["BUILD_opencv_core"] = True + tc.variables["BUILD_opencv_features2d"] = self.options.features2d + tc.variables["BUILD_opencv_flann"] = self.options.flann + tc.variables["BUILD_opencv_gpu"] = self.options.get_safe("gpu", False) + tc.variables["BUILD_opencv_highgui"] = self.options.highgui + tc.variables["BUILD_opencv_imgproc"] = self.options.imgproc + tc.variables["BUILD_opencv_legacy"] = self.options.legacy + tc.variables["BUILD_opencv_ml"] = self.options.ml + tc.variables["BUILD_opencv_objdetect"] = self.options.objdetect + tc.variables["BUILD_opencv_photo"] = self.options.photo + tc.variables["BUILD_opencv_stitching"] = self.options.stitching + tc.variables["BUILD_opencv_superres"] = self.options.get_safe("superres", False) + tc.variables["BUILD_opencv_ts"] = self.options.get_safe("ts", False) + tc.variables["BUILD_opencv_video"] = self.options.video + tc.variables["BUILD_opencv_videostab"] = self.options.videostab + tc.variables["BUILD_opencv_world"] = self.options.world + # Extra modules + tc.variables["BUILD_opencv_androidcamera"] = self.options.get_safe("androidcamera", False) + tc.variables["BUILD_opencv_dynamicuda"] = False + tc.variables["BUILD_opencv_nonfree"] = self.options.nonfree + tc.variables["BUILD_opencv_ocl"] = self.options.ocl + tc.variables["BUILD_opencv_viz"] = self.options.viz + + tc.variables["ENABLE_CCACHE"] = False + if is_msvc(self): + tc.variables["BUILD_WITH_STATIC_CRT"] = is_msvc_static_runtime(self) + tc.generate() + + CMakeDeps(self).generate() def build(self): - self._patch_opencv() - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "staticlib")) - tools.remove_files_by_mask(self.package_folder, "*.cmake") + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "staticlib")) + rm(self, "*.cmake", self.package_folder, recursive=True) # TODO: to remove in conan v2 once cmake_find_package* generators removed + targets_mapping = {self._cmake_target(k): f"opencv::{self._cmake_target(k)}" for k in self._opencv_modules.keys()} + if self.options.world: + targets_mapping.update({"opencv_world": "opencv::opencv_world"}) self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {component["target"]:"opencv::{}".format(component["target"]) for component in self._opencv_components} + targets_mapping, ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) - - @property - def _opencv_components(self): - def imageformats_deps(): - components = [] - if self.options.with_jasper: - components.append("jasper::jasper") - if self.options.with_png: - components.append("libpng::libpng") - if self.options.with_jpeg: - components.append("libjpeg::libjpeg") - if self.options.with_tiff: - components.append("libtiff::libtiff") - if self.options.with_openexr: - components.append("openexr::openexr") - return components + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") - def eigen(): - return ["eigen::eigen"] if self.options.with_eigen else [] - - def tbb(): - return ["onetbb::onetbb"] if self.options.with_tbb else [] - - def gtk(): - return ["gtk::gtk"] if self.options.get_safe("with_gtk") else [] - - def nonfree(): - return ["opencv_nonfree"] if self.options.nonfree else [] - - opencv_components = [ - {"target": "opencv_core", "lib": "core", "requires": ["zlib::zlib"] + tbb()}, - {"target": "opencv_flann", "lib": "flann", "requires": ["opencv_core"] + tbb()}, - {"target": "opencv_imgproc", "lib": "imgproc", "requires": ["opencv_core"] + tbb()}, - {"target": "opencv_highgui", "lib": "highgui", "requires": ["opencv_core", "opencv_imgproc"] + eigen() + tbb() + gtk() + imageformats_deps()}, - {"target": "opencv_features2d", "lib": "features2d", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_highgui"] + tbb()}, - {"target": "opencv_calib3d", "lib": "calib3d", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_highgui", "opencv_features2d"] + tbb()}, - {"target": "opencv_ml", "lib": "ml", "requires": ["opencv_core"] + tbb()}, - {"target": "opencv_video", "lib": "video", "requires": ["opencv_core", "opencv_imgproc"] + tbb()}, - {"target": "opencv_legacy", "lib": "legacy", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_highgui", "opencv_features2d", "opencv_calib3d", "opencv_ml", "opencv_video"] + eigen() + tbb()}, - {"target": "opencv_objdetect", "lib": "objdetect", "requires": ["opencv_core", "opencv_imgproc", "opencv_highgui"] + tbb()}, - {"target": "opencv_photo", "lib": "photo", "requires": ["opencv_core", "opencv_imgproc"] + tbb()}, - {"target": "opencv_gpu", "lib": "gpu", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_highgui", "opencv_features2d", "opencv_calib3d", "opencv_ml", "opencv_video", "opencv_legacy", "opencv_objdetect", "opencv_photo"] + tbb()}, - {"target": "opencv_contrib", "lib": "contrib", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_highgui", "opencv_features2d", "opencv_calib3d", "opencv_ml", "opencv_video", "opencv_legacy", "opencv_objdetect", "opencv_photo", "opencv_gpu"] + nonfree() + tbb()}, - {"target": "opencv_stitching", "lib": "stitching", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_highgui", "opencv_features2d", "opencv_calib3d", "opencv_ml", "opencv_video", "opencv_legacy", "opencv_objdetect", "opencv_photo", "opencv_gpu"] + nonfree() + tbb()}, - {"target": "opencv_superres", "lib": "superres", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_highgui", "opencv_features2d", "opencv_calib3d", "opencv_ml", "opencv_video", "opencv_legacy", "opencv_objdetect", "opencv_photo", "opencv_gpu"] + tbb()}, - {"target": "opencv_ts", "lib": "ts", "requires": ["opencv_core", "opencv_flann", "opencv_highgui", "opencv_features2d", "opencv_calib3d", "opencv_video"] + tbb()}, - {"target": "opencv_videostab", "lib": "videostab", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_highgui", "opencv_features2d", "opencv_calib3d", "opencv_ml", "opencv_video", "opencv_legacy", "opencv_objdetect", "opencv_photo", "opencv_gpu"] + tbb()} - ] - if self.options.nonfree: - opencv_components.append({"target": "opencv_nonfree", "lib": "nonfree", "requires": ["opencv_core", "opencv_flann", "opencv_imgproc", "opencv_highgui", "opencv_features2d", "opencv_calib3d", "opencv_ml", "opencv_video", "opencv_legacy", "opencv_objdetect", "opencv_photo", "opencv_gpu"] + tbb()}) - - return opencv_components + @staticmethod + def _cmake_target(module): + return f"opencv_{module}" def package_info(self): version = self.version.split(".")[:-1] # last version number is not used version = "".join(version) if self.settings.os == "Windows" else "" - debug = "d" if self.settings.build_type == "Debug" and self._is_msvc else "" + debug = "d" if self.settings.build_type == "Debug" and is_msvc(self) else "" def get_lib_name(module): - return "opencv_%s%s%s" % (module, version, debug) + return f"opencv_{module}{version}{debug}" def add_components(components): - for component in components: - conan_component = component["target"] - cmake_target = component["target"] - cmake_component = component["lib"] - lib_name = get_lib_name(component["lib"]) - requires = component["requires"] + if self.options.world: + self.cpp_info.components["opencv_world"].set_property("cmake_target_name", "opencv_world") + self.cpp_info.components["opencv_world"].libs = [get_lib_name("world")] + world_requires = set() + world_requires_exclude = set() + world_system_libs = set() + world_frameworks = set() + + for module, values in components.items(): + if not values.get("is_built"): + continue + cmake_target = self._cmake_target(module) + conan_component = cmake_target # TODO: we should also define COMPONENTS names of each target for find_package() but not possible yet in CMakeDeps # see https://github.com/conan-io/conan/issues/10258 self.cpp_info.components[conan_component].set_property("cmake_target_name", cmake_target) - self.cpp_info.components[conan_component].libs = [lib_name] - self.cpp_info.components[conan_component].requires = requires - if self.settings.os == "Linux": - self.cpp_info.components[conan_component].system_libs = ["dl", "m", "pthread", "rt"] + + module_requires = values.get("requires", []) + module_system_libs = [] + for _condition, _system_libs in values.get("system_libs", []): + if _condition: + module_system_libs.extend(_system_libs) + module_frameworks = [] + for _condition, _frameworks in values.get("frameworks", []): + if _condition: + module_frameworks.extend(_frameworks) + + if self.options.world and values.get("is_part_of_world", True): + self.cpp_info.components[conan_component].requires = ["opencv_world"] + world_requires.update(module_requires) + world_requires_exclude.add(conan_component) + world_system_libs.update(module_system_libs) + world_frameworks.update(module_frameworks) + else: + self.cpp_info.components[conan_component].libs = [get_lib_name(module)] + self.cpp_info.components[conan_component].requires = module_requires + self.cpp_info.components[conan_component].system_libs = module_system_libs + self.cpp_info.components[conan_component].frameworks = module_frameworks # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.components[conan_component].names["cmake_find_package"] = cmake_target self.cpp_info.components[conan_component].names["cmake_find_package_multi"] = cmake_target self.cpp_info.components[conan_component].build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.components[conan_component].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - if cmake_component != cmake_target: + if module != cmake_target: conan_component_alias = conan_component + "_alias" - self.cpp_info.components[conan_component_alias].names["cmake_find_package"] = cmake_component - self.cpp_info.components[conan_component_alias].names["cmake_find_package_multi"] = cmake_component + self.cpp_info.components[conan_component_alias].names["cmake_find_package"] = module + self.cpp_info.components[conan_component_alias].names["cmake_find_package_multi"] = module self.cpp_info.components[conan_component_alias].requires = [conan_component] + self.cpp_info.components[conan_component_alias].bindirs = [] self.cpp_info.components[conan_component_alias].includedirs = [] self.cpp_info.components[conan_component_alias].libdirs = [] - self.cpp_info.components[conan_component_alias].resdirs = [] - self.cpp_info.components[conan_component_alias].bindirs = [] - self.cpp_info.components[conan_component_alias].frameworkdirs = [] - self.cpp_info.set_property("cmake_file_name", "OpenCV") + if self.options.world: + self.cpp_info.components["opencv_world"].requires = list(world_requires - world_requires_exclude) + self.cpp_info.components["opencv_world"].system_libs = list(world_system_libs) + self.cpp_info.components["opencv_world"].frameworks = list(world_frameworks) - add_components(self._opencv_components) + # TODO: to remove in conan v2 once cmake_find_package* generators removed + self.cpp_info.components["opencv_world"].build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.components["opencv_world"].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - if self.settings.os == "Windows": - self.cpp_info.components["opencv_highgui"].system_libs = ["comctl32", "gdi32", "ole32", "setupapi", "ws2_32", "vfw32"] - elif self.settings.os == "Macos": - self.cpp_info.components["opencv_highgui"].frameworks = ["Cocoa"] + self.cpp_info.set_property("cmake_file_name", "OpenCV") + + add_components(self._opencv_modules) # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "OpenCV" diff --git a/recipes/opencv/2.x/patches/0002-find-openexr.patch b/recipes/opencv/2.x/patches/0002-find-openexr.patch new file mode 100644 index 0000000000000..757789eca25bb --- /dev/null +++ b/recipes/opencv/2.x/patches/0002-find-openexr.patch @@ -0,0 +1,18 @@ +--- a/cmake/OpenCVFindOpenEXR.cmake ++++ b/cmake/OpenCVFindOpenEXR.cmake +@@ -8,6 +8,15 @@ + # OPENEXR_INCLUDE_PATHS = OpenEXR include directories. + # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. + # ++find_package(OpenEXR REQUIRED) ++if(TARGET OpenEXR::OpenEXR) ++ set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) ++else() ++ set(OPENEXR_LIBRARIES openexr::openexr) ++endif() ++set(OPENEXR_FOUND TRUE) ++set(OPENEXR_VERSION ${OpenEXR_VERSION}) ++return() + + SET(OPENEXR_LIBRARIES "") + SET(OPENEXR_LIBSEARCH_SUFFIXES "") diff --git a/recipes/opencv/2.x/test_package/CMakeLists.txt b/recipes/opencv/2.x/test_package/CMakeLists.txt index f35b448655b4f..d43070a4b5daf 100644 --- a/recipes/opencv/2.x/test_package/CMakeLists.txt +++ b/recipes/opencv/2.x/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(OpenCV REQUIRED core CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} opencv_core) +target_link_libraries(${PROJECT_NAME} PRIVATE opencv_core) diff --git a/recipes/opencv/2.x/test_package/conanfile.py b/recipes/opencv/2.x/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/opencv/2.x/test_package/conanfile.py +++ b/recipes/opencv/2.x/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opencv/2.x/test_v1_package/CMakeLists.txt b/recipes/opencv/2.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/opencv/2.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opencv/2.x/test_v1_package/conanfile.py b/recipes/opencv/2.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/opencv/2.x/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opencv/3.x/CMakeLists.txt b/recipes/opencv/3.x/CMakeLists.txt deleted file mode 100644 index f4edb2bde38a4..0000000000000 --- a/recipes/opencv/3.x/CMakeLists.txt +++ /dev/null @@ -1,12 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -# OpenEXR public headers require C++11 -if (WITH_OPENEXR) - set(CMAKE_CXX_STANDARD 11) -endif() - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/opencv/3.x/conandata.yml b/recipes/opencv/3.x/conandata.yml index 515148bc68c37..e0e79edab327a 100644 --- a/recipes/opencv/3.x/conandata.yml +++ b/recipes/opencv/3.x/conandata.yml @@ -9,3 +9,12 @@ sources: sha256: "c8919dfb5ead6be67534bf794cb0925534311f1cd5c6680f8164ad1813c88d13" - url: "https://github.com/opencv/opencv_contrib/archive/3.4.12.tar.gz" sha256: "b207024589674dd2efc7c25740ef192ee4f3e0783e773e2d49a198c37e3e7570" +patches: + "3.4.17": + - patch_file: "patches/3.4.17-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + "3.4.12": + - patch_file: "patches/3.4.12-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" diff --git a/recipes/opencv/3.x/conanfile.py b/recipes/opencv/3.x/conanfile.py index aa96384d55072..51dc5157837a5 100644 --- a/recipes/opencv/3.x/conanfile.py +++ b/recipes/opencv/3.x/conanfile.py @@ -1,10 +1,13 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rmdir, save +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class OpenCVConan(ConanFile): @@ -21,7 +24,7 @@ class OpenCVConan(ConanFile): "fPIC": [True, False], "contrib": [True, False], "parallel": [False, "tbb", "openmp"], - "with_jpeg": [False, "libjpeg", "libjpeg-turbo"], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], "with_png": [True, False], "with_tiff": [True, False], "with_jasper": [True, False], @@ -48,25 +51,13 @@ class OpenCVConan(ConanFile): } short_paths = True - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" @property def _contrib_folder(self): - return "contrib" + return os.path.join(self.source_folder, "contrib") - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -76,228 +67,225 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") self.options["*"].jpeg = self.options.with_jpeg self.options["*"].with_libjpeg = self.options.with_jpeg self.options["*"].with_jpeg = self.options.with_jpeg + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_jpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.2") + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_jasper: - self.requires("jasper/2.0.33") + self.requires("jasper/4.0.0") if self.options.with_openexr: + # opencv 3.x doesn't support openexr >= 3 self.requires("openexr/2.5.7") if self.options.with_tiff: - self.requires("libtiff/4.3.0") + self.requires("libtiff/4.4.0") if self.options.with_eigen: self.requires("eigen/3.3.9") if self.options.parallel == "tbb": + # opencv 3.x doesn't support onetbb >= 2021 self.requires("onetbb/2020.3") if self.options.with_webp: - self.requires("libwebp/1.2.2") + self.requires("libwebp/1.2.4") if self.options.contrib: - self.requires("freetype/2.11.1") - self.requires("harfbuzz/3.2.0") + self.requires("freetype/2.12.1") + self.requires("harfbuzz/6.0.0") self.requires("gflags/2.2.2") - self.requires("glog/0.5.0") + self.requires("glog/0.6.0") if self.options.get_safe("with_gtk"): self.requires("gtk/system") def validate(self): - if self.settings.compiler.get_safe("cppstd") and self.options.with_openexr: - tools.check_min_cppstd(self, 11) - if self.options.shared and self._is_msvc and "MT" in msvc_runtime_flag(self): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Visual Studio with static runtime is not supported for shared library.") - if self.settings.compiler == "clang" and tools.Version(self.settings.compiler.version) < "4": + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "4": raise ConanInvalidConfiguration("Clang 3.x cannot build OpenCV 3.x due an internal bug.") def source(self): - tools.get(**self.conan_data["sources"][self.version][0], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][0], strip_root=True) - tools.get(**self.conan_data["sources"][self.version][1], - destination=self._contrib_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][1], + destination=self._contrib_folder, strip_root=True) - def _patch_opencv(self): - tools.rmdir(os.path.join(self._source_subfolder, "3rdparty")) + def _patch_sources(self): + apply_conandata_patches(self) + rmdir(self, os.path.join(self.source_folder, "3rdparty")) if self.options.contrib: freetype_cmake = os.path.join(self._contrib_folder, "modules", "freetype", "CMakeLists.txt") - tools.replace_in_file(freetype_cmake, "ocv_check_modules(FREETYPE freetype2)", "find_package(Freetype REQUIRED)") - tools.replace_in_file(freetype_cmake, "FREETYPE_", "Freetype_") + replace_in_file(self, freetype_cmake, "ocv_check_modules(FREETYPE freetype2)", "find_package(Freetype REQUIRED MODULE)") + replace_in_file(self, freetype_cmake, "FREETYPE_", "Freetype_") - tools.replace_in_file(freetype_cmake, "ocv_check_modules(HARFBUZZ harfbuzz)", "find_package(harfbuzz REQUIRED)") - tools.replace_in_file(freetype_cmake, "HARFBUZZ_", "harfbuzz_") + replace_in_file(self, freetype_cmake, "ocv_check_modules(HARFBUZZ harfbuzz)", "find_package(harfbuzz REQUIRED)") + replace_in_file(self, freetype_cmake, "HARFBUZZ_", "harfbuzz_") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "ANDROID OR NOT UNIX", "FALSE") - tools.replace_in_file(os.path.join(self._source_subfolder, "modules", "imgcodecs", "CMakeLists.txt"), "JASPER_", "Jasper_") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "ANDROID OR NOT UNIX", "FALSE") + replace_in_file(self, os.path.join(self.source_folder, "modules", "imgcodecs", "CMakeLists.txt"), "JASPER_", "Jasper_") # Cleanup RPATH - if tools.Version(self.version) < "3.4.8": - install_layout_file = os.path.join(self._source_subfolder, "CMakeLists.txt") + if Version(self.version) < "3.4.8": + install_layout_file = os.path.join(self.source_folder, "CMakeLists.txt") else: - install_layout_file = os.path.join(self._source_subfolder, "cmake", "OpenCVInstallLayout.cmake") - tools.replace_in_file(install_layout_file, + install_layout_file = os.path.join(self.source_folder, "cmake", "OpenCVInstallLayout.cmake") + replace_in_file(self, install_layout_file, "ocv_update(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}\")", "") - tools.replace_in_file(install_layout_file, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") + replace_in_file(self, install_layout_file, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") - if self.options.contrib and tools.Version(self.version) <= "3.4.12": + if self.options.contrib and Version(self.version) <= "3.4.12": sfm_cmake = os.path.join(self._contrib_folder, "modules", "sfm", "CMakeLists.txt") - search = ' find_package(Glog QUIET)\nendif()' - tools.replace_in_file(sfm_cmake, search, """{} + search = " find_package(Glog QUIET)\nendif()" + replace_in_file(self, sfm_cmake, search, f"""{search} if(NOT GFLAGS_LIBRARIES AND TARGET gflags::gflags) set(GFLAGS_LIBRARIES gflags::gflags) endif() if(NOT GLOG_LIBRARIES AND TARGET glog::glog) set(GLOG_LIBRARIES glog::glog) - endif()""".format(search)) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["OPENCV_CONFIG_INSTALL_PATH"] = "cmake" - self._cmake.definitions["OPENCV_BIN_INSTALL_PATH"] = "bin" - self._cmake.definitions["OPENCV_LIB_INSTALL_PATH"] = "lib" - self._cmake.definitions["OPENCV_3P_LIB_INSTALL_PATH"] = "lib" - self._cmake.definitions["OPENCV_OTHER_INSTALL_PATH"] = "res" - self._cmake.definitions["OPENCV_LICENSES_INSTALL_PATH"] = "licenses" - - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_DOCS"] = False - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_PACKAGE"] = False - self._cmake.definitions["BUILD_PERF_TESTS"] = False - - self._cmake.definitions["BUILD_JAVA"] = False - self._cmake.definitions["BUILD_FAT_JAVA_LIB"] = False - self._cmake.definitions["BUILD_PERF_TESTS"] = False - self._cmake.definitions["BUILD_ZLIB"] = False - self._cmake.definitions["BUILD_JPEG"] = False - self._cmake.definitions["BUILD_PNG"] = False - self._cmake.definitions["BUILD_TIFF"] = False - self._cmake.definitions["BUILD_JASPER"] = False - self._cmake.definitions["BUILD_OPENEXR"] = False - self._cmake.definitions["BUILD_WEBP"] = False - self._cmake.definitions["BUILD_TBB"] = False - self._cmake.definitions["BUILD_JPEG_TURBO_DISABLE"] = True - self._cmake.definitions["BUILD_IPP_IW"] = False - self._cmake.definitions["BUILD_ITT"] = False - self._cmake.definitions["BUILD_PROTOBUF"] = False - self._cmake.definitions["BUILD_USE_SYMLINKS"] = False - self._cmake.definitions["OPENCV_FORCE_3RDPARTY_BUILD"] = False - self._cmake.definitions["BUILD_opencv_java_bindings_gen"] = False - self._cmake.definitions["BUILD_opencv_js"] = False - self._cmake.definitions["BUILD_opencv_apps"] = False - self._cmake.definitions["BUILD_opencv_java"] = False - self._cmake.definitions["OPENCV_PYTHON_SKIP_DETECTION"] = True - self._cmake.definitions["BUILD_opencv_python2"] = False - self._cmake.definitions["BUILD_opencv_python3"] = False - self._cmake.definitions["BUILD_opencv_python_bindings_g"] = False - self._cmake.definitions["BUILD_opencv_python_tests"] = False - self._cmake.definitions["BUILD_opencv_ts"] = False - - self._cmake.definitions["WITH_CUFFT"] = False - self._cmake.definitions["WITH_CUBLAS"] = False - self._cmake.definitions["WITH_NVCUVID"] = False - self._cmake.definitions["WITH_FFMPEG"] = False - self._cmake.definitions["WITH_GSTREAMER"] = False - self._cmake.definitions["WITH_OPENCL"] = False - self._cmake.definitions["WITH_CUDA"] = False - self._cmake.definitions["WITH_1394"] = False - self._cmake.definitions["WITH_ADE"] = False - self._cmake.definitions["WITH_ARAVIS"] = False - self._cmake.definitions["WITH_CLP"] = False - self._cmake.definitions["WITH_HALIDE"] = False - self._cmake.definitions["WITH_HPX"] = False - self._cmake.definitions["WITH_IMGCODEC_HDR"] = False - self._cmake.definitions["WITH_IMGCODEC_PFM"] = False - self._cmake.definitions["WITH_IMGCODEC_PXM"] = False - self._cmake.definitions["WITH_IMGCODEC_SUNRASTER"] = False - self._cmake.definitions["WITH_INF_ENGINE"] = False - self._cmake.definitions["WITH_IPP"] = False - self._cmake.definitions["WITH_ITT"] = False - self._cmake.definitions["WITH_LIBREALSENSE"] = False - self._cmake.definitions["WITH_MFX"] = False - self._cmake.definitions["WITH_NGRAPH"] = False - self._cmake.definitions["WITH_OPENCLAMDBLAS"] = False - self._cmake.definitions["WITH_OPENCLAMDFFT"] = False - self._cmake.definitions["WITH_OPENCL_SVM"] = False - self._cmake.definitions["WITH_OPENGL"] = False - self._cmake.definitions["WITH_OPENNI"] = False - self._cmake.definitions["WITH_OPENNI2"] = False - self._cmake.definitions["WITH_OPENVX"] = False - self._cmake.definitions["WITH_PLAIDML"] = False - self._cmake.definitions["WITH_PROTOBUF"] = False - self._cmake.definitions["WITH_PTHREADS_PF"] = False - self._cmake.definitions["WITH_PVAPI"] = False - self._cmake.definitions["WITH_QT"] = False - self._cmake.definitions["WITH_QUIRC"] = False - self._cmake.definitions["WITH_V4L"] = False - self._cmake.definitions["WITH_VA"] = False - self._cmake.definitions["WITH_VA_INTEL"] = False - self._cmake.definitions["WITH_VTK"] = False - self._cmake.definitions["WITH_VULKAN"] = False - self._cmake.definitions["WITH_XIMEA"] = False - self._cmake.definitions["WITH_XINE"] = False - self._cmake.definitions["WITH_LAPACK"] = False - self._cmake.definitions["WITH_IPP_IW"] = False - self._cmake.definitions["WITH_CAROTENE"] = False - self._cmake.definitions["WITH_PROTOBUF"] = False - self._cmake.definitions["WITH_LAPACK"] = False - - self._cmake.definitions["WITH_JPEG"] = self.options.with_jpeg - self._cmake.definitions["WITH_PNG"] = self.options.with_png - self._cmake.definitions["WITH_TIFF"] = self.options.with_tiff - self._cmake.definitions["WITH_JASPER"] = self.options.with_jasper - self._cmake.definitions["WITH_OPENEXR"] = self.options.with_openexr - self._cmake.definitions["WITH_EIGEN"] = self.options.with_eigen - self._cmake.definitions["WITH_WEBP"] = self.options.with_webp - self._cmake.definitions["WITH_DSHOW"] = self._is_msvc - self._cmake.definitions["WITH_MSMF"] = self._is_msvc - self._cmake.definitions["WITH_MSMF_DXVA"] = self._is_msvc - self._cmake.definitions["WITH_GTK"] = self.options.get_safe("with_gtk", False) - self._cmake.definitions["WITH_GTK_2_X"] = self.options.get_safe("with_gtk", False) - - self._cmake.definitions["OPENCV_MODULES_PUBLIC"] = "opencv" - self._cmake.definitions["OPENCV_ENABLE_NONFREE"] = self.options.nonfree + endif()""") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OPENCV_CONFIG_INSTALL_PATH"] = "cmake" + tc.variables["OPENCV_BIN_INSTALL_PATH"] = "bin" + tc.variables["OPENCV_LIB_INSTALL_PATH"] = "lib" + tc.variables["OPENCV_3P_LIB_INSTALL_PATH"] = "lib" + tc.variables["OPENCV_OTHER_INSTALL_PATH"] = "res" + tc.variables["OPENCV_LICENSES_INSTALL_PATH"] = "licenses" + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_DOCS"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_PACKAGE"] = False + tc.variables["BUILD_PERF_TESTS"] = False + tc.variables["BUILD_JAVA"] = False + tc.variables["BUILD_FAT_JAVA_LIB"] = False + tc.variables["BUILD_PERF_TESTS"] = False + tc.variables["BUILD_ZLIB"] = False + tc.variables["BUILD_JPEG"] = False + tc.variables["BUILD_PNG"] = False + tc.variables["BUILD_TIFF"] = False + tc.variables["BUILD_JASPER"] = False + tc.variables["BUILD_OPENEXR"] = False + tc.variables["BUILD_WEBP"] = False + tc.variables["BUILD_TBB"] = False + tc.variables["BUILD_JPEG_TURBO_DISABLE"] = True + tc.variables["BUILD_IPP_IW"] = False + tc.variables["BUILD_ITT"] = False + tc.variables["BUILD_PROTOBUF"] = False + tc.variables["BUILD_USE_SYMLINKS"] = False + tc.variables["OPENCV_FORCE_3RDPARTY_BUILD"] = False + tc.variables["BUILD_opencv_java_bindings_gen"] = False + tc.variables["BUILD_opencv_js"] = False + tc.variables["BUILD_opencv_apps"] = False + tc.variables["BUILD_opencv_java"] = False + tc.variables["OPENCV_PYTHON_SKIP_DETECTION"] = True + tc.variables["BUILD_opencv_python2"] = False + tc.variables["BUILD_opencv_python3"] = False + tc.variables["BUILD_opencv_python_bindings_g"] = False + tc.variables["BUILD_opencv_python_tests"] = False + tc.variables["BUILD_opencv_ts"] = False + tc.variables["WITH_CUFFT"] = False + tc.variables["WITH_CUBLAS"] = False + tc.variables["WITH_NVCUVID"] = False + tc.variables["WITH_FFMPEG"] = False + tc.variables["WITH_GSTREAMER"] = False + tc.variables["WITH_OPENCL"] = False + tc.variables["WITH_CUDA"] = False + tc.variables["WITH_1394"] = False + tc.variables["WITH_ADE"] = False + tc.variables["WITH_ARAVIS"] = False + tc.variables["WITH_CLP"] = False + tc.variables["WITH_HALIDE"] = False + tc.variables["WITH_HPX"] = False + tc.variables["WITH_IMGCODEC_HDR"] = False + tc.variables["WITH_IMGCODEC_PFM"] = False + tc.variables["WITH_IMGCODEC_PXM"] = False + tc.variables["WITH_IMGCODEC_SUNRASTER"] = False + tc.variables["WITH_INF_ENGINE"] = False + tc.variables["WITH_IPP"] = False + tc.variables["WITH_ITT"] = False + tc.variables["WITH_LIBREALSENSE"] = False + tc.variables["WITH_MFX"] = False + tc.variables["WITH_NGRAPH"] = False + tc.variables["WITH_OPENCLAMDBLAS"] = False + tc.variables["WITH_OPENCLAMDFFT"] = False + tc.variables["WITH_OPENCL_SVM"] = False + tc.variables["WITH_OPENGL"] = False + tc.variables["WITH_OPENNI"] = False + tc.variables["WITH_OPENNI2"] = False + tc.variables["WITH_OPENVX"] = False + tc.variables["WITH_PLAIDML"] = False + tc.variables["WITH_PROTOBUF"] = False + tc.variables["WITH_PTHREADS_PF"] = False + tc.variables["WITH_PVAPI"] = False + tc.variables["WITH_QT"] = False + tc.variables["WITH_QUIRC"] = False + tc.variables["WITH_V4L"] = False + tc.variables["WITH_VA"] = False + tc.variables["WITH_VA_INTEL"] = False + tc.variables["WITH_VTK"] = False + tc.variables["WITH_VULKAN"] = False + tc.variables["WITH_XIMEA"] = False + tc.variables["WITH_XINE"] = False + tc.variables["WITH_LAPACK"] = False + tc.variables["WITH_IPP_IW"] = False + tc.variables["WITH_CAROTENE"] = False + tc.variables["WITH_PROTOBUF"] = False + tc.variables["WITH_LAPACK"] = False + tc.variables["WITH_JPEG"] = bool(self.options.with_jpeg) + tc.variables["WITH_PNG"] = self.options.with_png + tc.variables["WITH_TIFF"] = self.options.with_tiff + tc.variables["WITH_JASPER"] = self.options.with_jasper + tc.variables["WITH_OPENEXR"] = self.options.with_openexr + if self.options.with_openexr: + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.variables["WITH_EIGEN"] = self.options.with_eigen + tc.variables["WITH_WEBP"] = self.options.with_webp + tc.variables["WITH_DSHOW"] = is_msvc(self) + tc.variables["WITH_MSMF"] = is_msvc(self) + tc.variables["WITH_MSMF_DXVA"] = is_msvc(self) + tc.variables["WITH_GTK"] = self.options.get_safe("with_gtk", False) + tc.variables["WITH_GTK_2_X"] = self.options.get_safe("with_gtk", False) + tc.variables["OPENCV_MODULES_PUBLIC"] = "opencv" + tc.variables["OPENCV_ENABLE_NONFREE"] = self.options.nonfree if self.options.parallel: - self._cmake.definitions["WITH_TBB"] = self.options.parallel == "tbb" - self._cmake.definitions["WITH_OPENMP"] = self.options.parallel == "openmp" - + tc.variables["WITH_TBB"] = self.options.parallel == "tbb" + tc.variables["WITH_OPENMP"] = self.options.parallel == "openmp" if self.options.contrib: - self._cmake.definitions["OPENCV_EXTRA_MODULES_PATH"] = os.path.join(self.build_folder, self._contrib_folder, 'modules') - - if self._is_msvc: - self._cmake.definitions["BUILD_WITH_STATIC_CRT"] = "MT" in msvc_runtime_flag(self) - if self.options.with_openexr: - self._cmake.definitions["OPENEXR_ROOT"] = self.deps_cpp_info['openexr'].rootpath.replace("\\", "/") - self._cmake.definitions["ENABLE_PIC"] = self.options.get_safe("fPIC", True) - self._cmake.definitions["ENABLE_CCACHE"] = False + tc.variables["OPENCV_EXTRA_MODULES_PATH"] = os.path.join(self._contrib_folder, "modules").replace("\\", "/") + if is_msvc(self): + tc.variables["BUILD_WITH_STATIC_CRT"] = is_msvc_static_runtime(self) + tc.variables["ENABLE_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["ENABLE_CCACHE"] = False + tc.generate() - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + CMakeDeps(self).generate() def build(self): - self._patch_opencv() - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "cmake")) if os.path.isfile(os.path.join(self.package_folder, "setup_vars_opencv3.cmd")): - os.rename(os.path.join(self.package_folder, "setup_vars_opencv3.cmd"), - os.path.join(self.package_folder, "res", "setup_vars_opencv3.cmd")) + rename(self, os.path.join(self.package_folder, "setup_vars_opencv3.cmd"), + os.path.join(self.package_folder, "res", "setup_vars_opencv3.cmd")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -305,21 +293,20 @@ def package(self): {component["target"]:"opencv::{}".format(component["target"]) for component in self._opencv_components} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property def _opencv_components(self): @@ -329,8 +316,12 @@ def imageformats_deps(): components.append("jasper::jasper") if self.options.with_png: components.append("libpng::libpng") - if self.options.with_jpeg: - components.append("{0}::{0}".format(self.options.with_jpeg)) + if self.options.with_jpeg == "libjpeg": + components.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + components.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + components.append("mozjpeg::libjpeg") if self.options.with_tiff: components.append("libtiff::libtiff") if self.options.with_openexr: @@ -413,13 +404,13 @@ def gtk(): def package_info(self): version = self.version.split(".") version = "".join(version) if self.settings.os == "Windows" else "" - debug = "d" if self.settings.build_type == "Debug" and self._is_msvc else "" + debug = "d" if self.settings.build_type == "Debug" and is_msvc(self) else "" def get_lib_name(module): if module in ("correspondence", "multiview", "numeric"): return module else: - return "opencv_%s%s%s" % (module, version, debug) + return f"opencv_{module}{version}{debug}" def add_components(components): for component in components: @@ -434,7 +425,7 @@ def add_components(components): self.cpp_info.components[conan_component].libs = [lib_name] self.cpp_info.components[conan_component].libs = [lib_name] self.cpp_info.components[conan_component].requires = requires - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components[conan_component].system_libs = ["dl", "m", "pthread", "rt"] # TODO: to remove in conan v2 once cmake_find_package* generators removed @@ -447,11 +438,9 @@ def add_components(components): self.cpp_info.components[conan_component_alias].names["cmake_find_package"] = cmake_component self.cpp_info.components[conan_component_alias].names["cmake_find_package_multi"] = cmake_component self.cpp_info.components[conan_component_alias].requires = [conan_component] + self.cpp_info.components[conan_component_alias].bindirs = [] self.cpp_info.components[conan_component_alias].includedirs = [] self.cpp_info.components[conan_component_alias].libdirs = [] - self.cpp_info.components[conan_component_alias].resdirs = [] - self.cpp_info.components[conan_component_alias].bindirs = [] - self.cpp_info.components[conan_component_alias].frameworkdirs = [] self.cpp_info.set_property("cmake_file_name", "OpenCV") @@ -460,7 +449,7 @@ def add_components(components): if self.settings.os == "Windows": self.cpp_info.components["opencv_imgcodecs"].system_libs = ["comctl32", "gdi32", "ole32", "setupapi", "ws2_32", "vfw32"] elif self.settings.os == "Macos": - self.cpp_info.components["opencv_imgcodecs"].frameworks = ['OpenCL', 'Accelerate', 'CoreMedia', 'CoreVideo', 'CoreGraphics', 'AVFoundation', 'QuartzCore', 'Cocoa'] + self.cpp_info.components["opencv_imgcodecs"].frameworks = ["OpenCL", "Accelerate", "CoreMedia", "CoreVideo", "CoreGraphics", "AVFoundation", "QuartzCore", "Cocoa"] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "OpenCV" diff --git a/recipes/opencv/3.x/patches/3.4.12-0001-find-openexr.patch b/recipes/opencv/3.x/patches/3.4.12-0001-find-openexr.patch new file mode 100644 index 0000000000000..757789eca25bb --- /dev/null +++ b/recipes/opencv/3.x/patches/3.4.12-0001-find-openexr.patch @@ -0,0 +1,18 @@ +--- a/cmake/OpenCVFindOpenEXR.cmake ++++ b/cmake/OpenCVFindOpenEXR.cmake +@@ -8,6 +8,15 @@ + # OPENEXR_INCLUDE_PATHS = OpenEXR include directories. + # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. + # ++find_package(OpenEXR REQUIRED) ++if(TARGET OpenEXR::OpenEXR) ++ set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) ++else() ++ set(OPENEXR_LIBRARIES openexr::openexr) ++endif() ++set(OPENEXR_FOUND TRUE) ++set(OPENEXR_VERSION ${OpenEXR_VERSION}) ++return() + + SET(OPENEXR_LIBRARIES "") + SET(OPENEXR_LIBSEARCH_SUFFIXES "") diff --git a/recipes/opencv/3.x/patches/3.4.17-0001-find-openexr.patch b/recipes/opencv/3.x/patches/3.4.17-0001-find-openexr.patch new file mode 100644 index 0000000000000..1a2233a68e779 --- /dev/null +++ b/recipes/opencv/3.x/patches/3.4.17-0001-find-openexr.patch @@ -0,0 +1,18 @@ +--- a/cmake/OpenCVFindOpenEXR.cmake ++++ b/cmake/OpenCVFindOpenEXR.cmake +@@ -8,6 +8,15 @@ + # OPENEXR_INCLUDE_PATHS = OpenEXR include directories. + # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. + # ++find_package(OpenEXR REQUIRED) ++if(TARGET OpenEXR::OpenEXR) ++ set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) ++else() ++ set(OPENEXR_LIBRARIES openexr::openexr) ++endif() ++set(OPENEXR_FOUND TRUE) ++set(OPENEXR_VERSION ${OpenEXR_VERSION}) ++return() + + if(NOT HAVE_CXX11) + message(STATUS "OpenEXR: enable C++11 to use external OpenEXR") diff --git a/recipes/opencv/3.x/test_package/CMakeLists.txt b/recipes/opencv/3.x/test_package/CMakeLists.txt index 18a5ba5919ce8..779574ba19f62 100644 --- a/recipes/opencv/3.x/test_package/CMakeLists.txt +++ b/recipes/opencv/3.x/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +option(built_contrib "Enabled if opencv is built contrib sfm" OFF) find_package(OpenCV REQUIRED core imgproc CONFIG) -option(built_contrib "Enabled if opencv is built contrib sfm" OFF) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE opencv_core opencv_imgproc $) if(built_contrib) - add_definitions(-DBUILT_CONTRIB) + target_compile_definitions(${PROJECT_NAME} PRIVATE BUILT_CONTRIB) endif() - -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} opencv_core opencv_imgproc $) diff --git a/recipes/opencv/3.x/test_package/conanfile.py b/recipes/opencv/3.x/test_package/conanfile.py index 3f79fd5e038ff..c7db2feac4ede 100644 --- a/recipes/opencv/3.x/test_package/conanfile.py +++ b/recipes/opencv/3.x/test_package/conanfile.py @@ -1,18 +1,31 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["built_contrib"] = self.dependencies["opencv"].options.contrib + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["built_contrib"] = self.options["opencv"].contrib cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opencv/3.x/test_v1_package/CMakeLists.txt b/recipes/opencv/3.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/opencv/3.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opencv/3.x/test_v1_package/conanfile.py b/recipes/opencv/3.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3f79fd5e038ff --- /dev/null +++ b/recipes/opencv/3.x/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["built_contrib"] = self.options["opencv"].contrib + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opencv/4.x/CMakeLists.txt b/recipes/opencv/4.x/CMakeLists.txt deleted file mode 100644 index a401f82668b0c..0000000000000 --- a/recipes/opencv/4.x/CMakeLists.txt +++ /dev/null @@ -1,16 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -if (WITH_OPENEXR) - set(CMAKE_CXX_STANDARD 11) -endif() - -set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR}) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(NOT CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CONAN_OPENCV_SYSTEM_PROCESSOR}) -endif() - -add_subdirectory("source_subfolder") diff --git a/recipes/opencv/4.x/conandata.yml b/recipes/opencv/4.x/conandata.yml index 88bdca68c62a1..07c4f73b1ee73 100644 --- a/recipes/opencv/4.x/conandata.yml +++ b/recipes/opencv/4.x/conandata.yml @@ -30,8 +30,93 @@ sources: - url: "https://github.com/opencv/opencv_contrib/archive/4.1.2.tar.gz" sha256: "0f6c3d30baa39e3e7611afb481ee86dea45dafb182cac87d570c95dccd83eb8b" patches: + "4.5.5": + - patch_file: "patches/4.5.5-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + - patch_file: "patches/4.5.2-0001-fix-zlib-static-android.patch" + patch_description: "Fix discovery of zlib static if Android" + patch_type: "conan" + - patch_file: "patches/4.1.2-0007-android-install-layout.patch" + patch_description: "Honor install layout from conan if Android" + patch_type: "conan" + "4.5.3": + - patch_file: "patches/4.5.3-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + - patch_file: "patches/4.5.2-0001-fix-zlib-static-android.patch" + patch_description: "Fix discovery of zlib static if Android" + patch_type: "conan" + - patch_file: "patches/4.1.2-0007-android-install-layout.patch" + patch_description: "Honor install layout from conan if Android" + patch_type: "conan" + "4.5.2": + - patch_file: "patches/4.1.2-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + - patch_file: "patches/4.5.2-0001-fix-zlib-static-android.patch" + patch_description: "Fix discovery of zlib static if Android" + patch_type: "conan" + - patch_file: "patches/4.1.2-0007-android-install-layout.patch" + patch_description: "Honor install layout from conan if Android" + patch_type: "conan" + "4.5.1": + - patch_file: "patches/4.1.2-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + - patch_file: "patches/4.1.2-0007-android-install-layout.patch" + patch_description: "Honor install layout from conan if Android" + patch_type: "conan" + "4.5.0": + - patch_file: "patches/4.1.2-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.5.0-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + - patch_file: "patches/4.1.2-0007-android-install-layout.patch" + patch_description: "Honor install layout from conan if Android" + patch_type: "conan" "4.1.2": - - patch_file: "patches/0001-jasper.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-openexr.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.1.2-0001-find-openexr.patch" + patch_description: "Robust discovery & injection of OpenEXR" + patch_type: "conan" + - patch_file: "patches/4.1.2-0002-find-ade.patch" + patch_description: "Robust discovery & injection of ade" + patch_type: "conan" + - patch_file: "patches/4.1.2-0003-find-quirc.patch" + patch_description: "Robust discovery & injection of quirc" + patch_type: "conan" + - patch_file: "patches/4.1.2-0004-jasper.patch" + patch_description: "Compatibility with recent jasper versions" + patch_type: "portability" + - patch_file: "patches/4.1.2-0007-android-install-layout.patch" + patch_description: "Honor install layout from conan if Android" + patch_type: "conan" diff --git a/recipes/opencv/4.x/conanfile.py b/recipes/opencv/4.x/conanfile.py index dc6c82ea44df3..bc47b9d740314 100644 --- a/recipes/opencv/4.x/conanfile.py +++ b/recipes/opencv/4.x/conanfile.py @@ -1,10 +1,16 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rename, replace_in_file, rmdir, save +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version import os +import re import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class OpenCVConan(ConanFile): @@ -25,7 +31,7 @@ class OpenCVConan(ConanFile): "parallel": [False, "tbb", "openmp"], "with_ipp": [False, "intel-ipp", "opencv-icv"], "with_ade": [True, False], - "with_jpeg": [False, "libjpeg", "libjpeg-turbo"], + "with_jpeg": [False, "libjpeg", "libjpeg-turbo", "mozjpeg"], "with_png": [True, False], "with_tiff": [True, False], "with_jpeg2000": [False, "jasper", "openjpeg"], @@ -44,12 +50,14 @@ class OpenCVConan(ConanFile): "with_imgcodec_pfm": [True, False], "with_imgcodec_pxm": [True, False], "with_imgcodec_sunraster": [True, False], + "with_msmf": [True, False], + "with_msmf_dxva": [True, False], "neon": [True, False], "dnn": [True, False], "dnn_cuda": [True, False], - "cuda_arch_bin": "ANY", - "cpu_baseline": "ANY", - "cpu_dispatch": "ANY", + "cuda_arch_bin": [None, "ANY"], + "cpu_baseline": [None, "ANY"], + "cpu_dispatch": [None, "ANY"], "nonfree": [True, False], } default_options = { @@ -80,6 +88,8 @@ class OpenCVConan(ConanFile): "with_imgcodec_pfm": False, "with_imgcodec_pxm": False, "with_imgcodec_sunraster": False, + "with_msmf": True, + "with_msmf_dxva": True, "neon": True, "dnn": True, "dnn_cuda": False, @@ -90,24 +100,10 @@ class OpenCVConan(ConanFile): } short_paths = True - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" @property def _contrib_folder(self): - return "contrib" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + return os.path.join(self.source_folder, "contrib") @property def _has_with_jpeg2000_option(self): @@ -123,12 +119,10 @@ def _has_with_ffmpeg_option(self): @property def _protobuf_version(self): - return "protobuf/3.17.1" + return "3.17.1" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -136,6 +130,9 @@ def config_options(self): if self.settings.os != "Linux": del self.options.with_gtk del self.options.with_v4l + if self.settings.os != "Windows": + del self.options.with_msmf + del self.options.with_msmf_dxva if self._has_with_ffmpeg_option: # Following the packager choice, ffmpeg is enabled by default when @@ -154,7 +151,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.contrib: del self.options.contrib_freetype del self.options.contrib_sfm @@ -175,356 +172,342 @@ def configure(self): if self.settings.os == "Android": self.options.with_openexr = False # disabled because this forces linkage to libc++_shared.so + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_jpeg == "libjpeg": - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") elif self.options.with_jpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.2") + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") if self.options.get_safe("with_jpeg2000") == "jasper": - self.requires("jasper/2.0.33") + self.requires("jasper/4.0.0") elif self.options.get_safe("with_jpeg2000") == "openjpeg": - self.requires("openjpeg/2.4.0") + self.requires("openjpeg/2.5.0") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_openexr: - self.requires("openexr/2.5.7") + if Version(self.version) < "4.5.3": + # opencv < 4.5.3 doesn't support openexr >= 3 + self.requires("openexr/2.5.7") + else: + self.requires("openexr/3.1.5") if self.options.get_safe("with_tiff"): - self.requires("libtiff/4.3.0") + self.requires("libtiff/4.4.0") if self.options.with_eigen: self.requires("eigen/3.3.9") if self.options.get_safe("with_ffmpeg"): + # opencv doesn't support ffmpeg >= 5.0.0 for the moment (until 4.5.5 at least) self.requires("ffmpeg/4.4") if self.options.parallel == "tbb": - self.requires("onetbb/2020.3") + self.requires("onetbb/2021.7.0") if self.options.with_ipp == "intel-ipp": self.requires("intel-ipp/2020") if self.options.with_webp: - self.requires("libwebp/1.2.2") + self.requires("libwebp/1.2.4") if self.options.get_safe("contrib_freetype"): - self.requires("freetype/2.11.1") - self.requires("harfbuzz/3.2.0") + self.requires("freetype/2.12.1") + self.requires("harfbuzz/6.0.0") if self.options.get_safe("contrib_sfm"): self.requires("gflags/2.2.2") - self.requires("glog/0.5.0") + self.requires("glog/0.6.0") if self.options.with_quirc: self.requires("quirc/1.1") if self.options.get_safe("with_gtk"): self.requires("gtk/system") if self.options.dnn: - self.requires(self._protobuf_version) + self.requires(f"protobuf/{self._protobuf_version}") if self.options.with_ade: - self.requires("ade/0.1.1f") + self.requires("ade/0.1.2a") def validate(self): - if self.options.shared and self._is_msvc and "MT" in msvc_runtime_flag(self): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Visual Studio with static runtime is not supported for shared library.") - if self.settings.compiler == "clang" and tools.Version(self.settings.compiler.version) < "4": + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "4": raise ConanInvalidConfiguration("Clang 3.x can't build OpenCV 4.x due to an internal bug.") if self.options.with_cuda and not self.options.contrib: raise ConanInvalidConfiguration("contrib must be enabled for cuda") - if self.options.get_safe("dnn_cuda", False) and \ + if self.options.get_safe("dnn_cuda") and \ (not self.options.with_cuda or not self.options.contrib or not self.options.with_cublas or not self.options.with_cudnn): raise ConanInvalidConfiguration("with_cublas, with_cudnn and contrib must be enabled for dnn_cuda") if self.options.with_ipp == "opencv-icv" and \ (not str(self.settings.arch) in ["x86", "x86_64"] or \ not str(self.settings.os) in ["Linux", "Macos", "Windows"]): - raise ConanInvalidConfiguration("opencv-icv is not available for %s/%s" % \ - (str(self.settings.os), str(self.settings.arch))) + raise ConanInvalidConfiguration(f"opencv-icv is not available for {self.settings.os}/{self.settings.arch}") def build_requirements(self): - if self.options.dnn and hasattr(self, "settings_build"): - self.build_requires(self._protobuf_version) + if self.options.dnn: + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires(f"protobuf/{self._protobuf_version}") def source(self): - tools.get(**self.conan_data["sources"][self.version][0], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][0], + destination=self.source_folder, strip_root=True) - tools.get(**self.conan_data["sources"][self.version][1], - destination=self._contrib_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][1], + destination=self._contrib_folder, strip_root=True) - def _patch_opencv(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - for directory in ['libjasper', 'libjpeg-turbo', 'libjpeg', 'libpng', 'libtiff', 'libwebp', 'openexr', 'protobuf', 'zlib', 'quirc']: - tools.rmdir(os.path.join(self._source_subfolder, '3rdparty', directory)) - if self.options.with_openexr: - find_openexr = os.path.join(self._source_subfolder, "cmake", "OpenCVFindOpenEXR.cmake") - tools.replace_in_file(find_openexr, - r'SET(OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \"Deploy\" folder")', - "") - tools.replace_in_file(find_openexr, "SET(OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug)", "") - tools.replace_in_file(find_openexr, "SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug)", "") + def _patch_sources(self): + apply_conandata_patches(self) + for directory in ["libjasper", "libjpeg-turbo", "libjpeg", "libpng", "libtiff", "libwebp", "openexr", "protobuf", "zlib", "quirc"]: + rmdir(self, os.path.join(self.source_folder, "3rdparty", directory)) + + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "ANDROID OR NOT UNIX", "FALSE") + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "elseif(EMSCRIPTEN)", "elseif(QNXNTO)\nelseif(EMSCRIPTEN)") + replace_in_file(self, os.path.join(self.source_folder, "modules", "imgcodecs", "CMakeLists.txt"), "JASPER_", "Jasper_") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "ANDROID OR NOT UNIX", "FALSE") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "elseif(EMSCRIPTEN)", "elseif(QNXNTO)\nelseif(EMSCRIPTEN)") - tools.replace_in_file(os.path.join(self._source_subfolder, "modules", "imgcodecs", "CMakeLists.txt"), "JASPER_", "Jasper_") + # Fix detection of ffmpeg + replace_in_file(self, os.path.join(self.source_folder, "modules", "videoio", "cmake", "detect_ffmpeg.cmake"), + "FFMPEG_FOUND", "ffmpeg_FOUND") # Cleanup RPATH - if tools.Version(self.version) < "4.1.2": - install_layout_file = os.path.join(self._source_subfolder, "CMakeLists.txt") + if Version(self.version) < "4.1.2": + install_layout_file = os.path.join(self.source_folder, "CMakeLists.txt") else: - install_layout_file = os.path.join(self._source_subfolder, "cmake", "OpenCVInstallLayout.cmake") - tools.replace_in_file(install_layout_file, + install_layout_file = os.path.join(self.source_folder, "cmake", "OpenCVInstallLayout.cmake") + replace_in_file(self, install_layout_file, "ocv_update(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_PREFIX}/${OPENCV_LIB_INSTALL_PATH}\")", "") - tools.replace_in_file(install_layout_file, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") + replace_in_file(self, install_layout_file, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") if self.options.dnn: - find_protobuf = os.path.join(self._source_subfolder, "cmake", "OpenCVFindProtobuf.cmake") - # variables generated by protobuf recipe have all lowercase prefixes - tools.replace_in_file(find_protobuf, - 'find_package(Protobuf QUIET)', - '''find_package(Protobuf QUIET) - if(NOT DEFINED Protobuf_LIBRARIES) - set(Protobuf_LIBRARIES ${protobuf_LIBRARIES}) - endif() - if(NOT DEFINED Protobuf_LIBRARY) - set(Protobuf_LIBRARY ${protobuf_LIBS}) - endif() - if(NOT DEFINED Protobuf_INCLUDE_DIR) - set(Protobuf_INCLUDE_DIR ${protobuf_INCLUDE_DIR}) - endif()''') + find_protobuf = os.path.join(self.source_folder, "cmake", "OpenCVFindProtobuf.cmake") + # OpenCV expects to find FindProtobuf.cmake, not the config file + replace_in_file(self, find_protobuf, + "find_package(Protobuf QUIET)", + "find_package(Protobuf REQUIRED MODULE)") # in 'if' block, get_target_property() produces an error - if tools.Version(self.version) >= "4.4.0": - tools.replace_in_file(find_protobuf, + if Version(self.version) >= "4.4.0": + replace_in_file(self, find_protobuf, 'if(TARGET "${Protobuf_LIBRARIES}")', 'if(FALSE) # patch: disable if(TARGET "${Protobuf_LIBRARIES}")') - if self.options.with_ade: - ade_cmake = os.path.join(self._source_subfolder, "modules", "gapi", - "cmake", "init.cmake") - replacement = '''find_package(ade REQUIRED) - if(ade_DIR)''' - tools.replace_in_file(ade_cmake, 'if(ade_DIR)', replacement, strict=False) - tools.replace_in_file(ade_cmake, 'if (ade_DIR)', replacement, strict=False) - tools.replace_in_file(ade_cmake, "TARGET ade", "TARGET ade::ade") - gapi_cmake = os.path.join(self._source_subfolder, "modules", "gapi", "CMakeLists.txt") - tools.replace_in_file(gapi_cmake, " ade)", " ade::ade)") - - if self.options.contrib and self.options.contrib_sfm and tools.Version(self.version) <= "4.5.2": + + if self.options.get_safe("contrib_freetype"): + freetype_cmake = os.path.join(self._contrib_folder, "modules", "freetype", "CMakeLists.txt") + replace_in_file(self, freetype_cmake, "ocv_check_modules(FREETYPE freetype2)", "find_package(Freetype REQUIRED MODULE)") + replace_in_file(self, freetype_cmake, "FREETYPE_", "Freetype_") + + replace_in_file(self, freetype_cmake, "ocv_check_modules(HARFBUZZ harfbuzz)", "find_package(harfbuzz REQUIRED)") + replace_in_file(self, freetype_cmake, "HARFBUZZ_", "harfbuzz_") + + if self.options.get_safe("contrib_sfm") and Version(self.version) <= "4.5.2": sfm_cmake = os.path.join(self._contrib_folder, "modules", "sfm", "CMakeLists.txt") - ver = tools.Version(self.version) + ver = Version(self.version) if ver <= "4.5.0": - search = ' find_package(Glog QUIET)\nendif()' + search = " find_package(Glog QUIET)\nendif()" else: search = ' set(GLOG_INCLUDE_DIRS "${GLOG_INCLUDE_DIR}")\nendif()' - tools.replace_in_file(sfm_cmake, search, """{} + replace_in_file(self, sfm_cmake, search, f"""{search} if(NOT GFLAGS_LIBRARIES AND TARGET gflags::gflags) set(GFLAGS_LIBRARIES gflags::gflags) endif() if(NOT GLOG_LIBRARIES AND TARGET glog::glog) set(GLOG_LIBRARIES glog::glog) - endif()""".format(search)) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["OPENCV_CONFIG_INSTALL_PATH"] = "cmake" - self._cmake.definitions["OPENCV_BIN_INSTALL_PATH"] = "bin" - self._cmake.definitions["OPENCV_LIB_INSTALL_PATH"] = "lib" - self._cmake.definitions["OPENCV_3P_LIB_INSTALL_PATH"] = "lib" - self._cmake.definitions["OPENCV_OTHER_INSTALL_PATH"] = "res" - self._cmake.definitions["OPENCV_LICENSES_INSTALL_PATH"] = "licenses" - - self._cmake.definitions["BUILD_CUDA_STUBS"] = False - self._cmake.definitions["BUILD_DOCS"] = False - self._cmake.definitions["BUILD_EXAMPLES"] = False - self._cmake.definitions["BUILD_FAT_JAVA_LIB"] = False - self._cmake.definitions["BUILD_IPP_IW"] = False - self._cmake.definitions["BUILD_ITT"] = False - self._cmake.definitions["BUILD_JASPER"] = False - self._cmake.definitions["BUILD_JAVA"] = False - self._cmake.definitions["BUILD_JPEG"] = False - self._cmake.definitions["BUILD_OPENEXR"] = False - self._cmake.definitions["BUILD_OPENJPEG"] = False - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_PROTOBUF"] = False - self._cmake.definitions["BUILD_PACKAGE"] = False - self._cmake.definitions["BUILD_PERF_TESTS"] = False - self._cmake.definitions["BUILD_USE_SYMLINKS"] = False - self._cmake.definitions["BUILD_opencv_apps"] = False - self._cmake.definitions["BUILD_opencv_java"] = False - self._cmake.definitions["BUILD_opencv_java_bindings_gen"] = False - self._cmake.definitions["BUILD_opencv_js"] = False - self._cmake.definitions["BUILD_ZLIB"] = False - self._cmake.definitions["BUILD_PNG"] = False - self._cmake.definitions["BUILD_TIFF"] = False - self._cmake.definitions["BUILD_WEBP"] = False - self._cmake.definitions["BUILD_TBB"] = False - self._cmake.definitions["OPENCV_FORCE_3RDPARTY_BUILD"] = False - self._cmake.definitions["OPENCV_PYTHON_SKIP_DETECTION"] = True - self._cmake.definitions["BUILD_opencv_python2"] = False - self._cmake.definitions["BUILD_opencv_python3"] = False - self._cmake.definitions["BUILD_opencv_python_bindings_g"] = False - self._cmake.definitions["BUILD_opencv_python_tests"] = False - self._cmake.definitions["BUILD_opencv_ts"] = False - - self._cmake.definitions["WITH_1394"] = False - self._cmake.definitions["WITH_ADE"] = False - self._cmake.definitions["WITH_ARAVIS"] = False - self._cmake.definitions["WITH_CLP"] = False - self._cmake.definitions["WITH_NVCUVID"] = False - - self._cmake.definitions["WITH_FFMPEG"] = self.options.get_safe("with_ffmpeg") + endif()""") + + def generate(self): + if self.options.dnn: + if hasattr(self, "settings_build") and cross_building(self): + VirtualBuildEnv(self).generate() + else: + VirtualRunEnv(self).generate(scope="build") + + tc = CMakeToolchain(self) + tc.variables["OPENCV_CONFIG_INSTALL_PATH"] = "cmake" + tc.variables["OPENCV_BIN_INSTALL_PATH"] = "bin" + tc.variables["OPENCV_LIB_INSTALL_PATH"] = "lib" + tc.variables["OPENCV_3P_LIB_INSTALL_PATH"] = "lib" + tc.variables["OPENCV_OTHER_INSTALL_PATH"] = "res" + tc.variables["OPENCV_LICENSES_INSTALL_PATH"] = "licenses" + + tc.variables["BUILD_CUDA_STUBS"] = False + tc.variables["BUILD_DOCS"] = False + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_FAT_JAVA_LIB"] = False + tc.variables["BUILD_IPP_IW"] = False + tc.variables["BUILD_ITT"] = False + tc.variables["BUILD_JASPER"] = False + tc.variables["BUILD_JAVA"] = False + tc.variables["BUILD_JPEG"] = False + tc.variables["BUILD_OPENEXR"] = False + tc.variables["BUILD_OPENJPEG"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_PROTOBUF"] = False + tc.variables["BUILD_PACKAGE"] = False + tc.variables["BUILD_PERF_TESTS"] = False + tc.variables["BUILD_USE_SYMLINKS"] = False + tc.variables["BUILD_opencv_apps"] = False + tc.variables["BUILD_opencv_java"] = False + tc.variables["BUILD_opencv_java_bindings_gen"] = False + tc.variables["BUILD_opencv_js"] = False + tc.variables["BUILD_ZLIB"] = False + tc.variables["BUILD_PNG"] = False + tc.variables["BUILD_TIFF"] = False + tc.variables["BUILD_WEBP"] = False + tc.variables["BUILD_TBB"] = False + tc.variables["OPENCV_FORCE_3RDPARTY_BUILD"] = False + tc.variables["OPENCV_PYTHON_SKIP_DETECTION"] = True + tc.variables["BUILD_opencv_python2"] = False + tc.variables["BUILD_opencv_python3"] = False + tc.variables["BUILD_opencv_python_bindings_g"] = False + tc.variables["BUILD_opencv_python_tests"] = False + tc.variables["BUILD_opencv_ts"] = False + + tc.variables["WITH_1394"] = False + tc.variables["WITH_ADE"] = False + tc.variables["WITH_ARAVIS"] = False + tc.variables["WITH_CLP"] = False + tc.variables["WITH_NVCUVID"] = False + + tc.variables["WITH_FFMPEG"] = self.options.get_safe("with_ffmpeg") if self.options.get_safe("with_ffmpeg"): - self._cmake.definitions["OPENCV_FFMPEG_SKIP_BUILD_CHECK"] = True - self._cmake.definitions["OPENCV_FFMPEG_SKIP_DOWNLOAD"] = True + tc.variables["OPENCV_FFMPEG_SKIP_BUILD_CHECK"] = True + tc.variables["OPENCV_FFMPEG_SKIP_DOWNLOAD"] = True # opencv will not search for ffmpeg package, but for # libavcodec;libavformat;libavutil;libswscale modules - self._cmake.definitions["OPENCV_FFMPEG_USE_FIND_PACKAGE"] = "ffmpeg" - self._cmake.definitions["OPENCV_INSTALL_FFMPEG_DOWNLOAD_SCRIPT"] = False - self._cmake.definitions["FFMPEG_LIBRARIES"] = "ffmpeg::avcodec;ffmpeg::avformat;ffmpeg::avutil;ffmpeg::swscale" + tc.variables["OPENCV_FFMPEG_USE_FIND_PACKAGE"] = "ffmpeg" + tc.variables["OPENCV_INSTALL_FFMPEG_DOWNLOAD_SCRIPT"] = False + tc.variables["FFMPEG_LIBRARIES"] = "ffmpeg::avcodec;ffmpeg::avformat;ffmpeg::avutil;ffmpeg::swscale" for component in ["avcodec", "avformat", "avutil", "swscale", "avresample"]: - self._cmake.definitions["FFMPEG_lib%s_VERSION" % component] = self.deps_cpp_info["ffmpeg"].components[component].version - - self._cmake.definitions["WITH_GSTREAMER"] = False - self._cmake.definitions["WITH_HALIDE"] = False - self._cmake.definitions["WITH_HPX"] = False - self._cmake.definitions["WITH_IMGCODEC_HDR"] = self.options.with_imgcodec_hdr - self._cmake.definitions["WITH_IMGCODEC_PFM"] = self.options.with_imgcodec_pfm - self._cmake.definitions["WITH_IMGCODEC_PXM"] = self.options.with_imgcodec_pxm - self._cmake.definitions["WITH_IMGCODEC_SUNRASTER"] = self.options.with_imgcodec_sunraster - self._cmake.definitions["WITH_INF_ENGINE"] = False - self._cmake.definitions["WITH_IPP"] = False + # TODO: use self.dependencies once https://github.com/conan-io/conan/issues/12728 fixed + ffmpeg_component_version = self.deps_cpp_info["ffmpeg"].components[component].version + tc.variables[f"FFMPEG_lib{component}_VERSION"] = ffmpeg_component_version + + tc.variables["WITH_GSTREAMER"] = False + tc.variables["WITH_HALIDE"] = False + tc.variables["WITH_HPX"] = False + tc.variables["WITH_IMGCODEC_HDR"] = self.options.with_imgcodec_hdr + tc.variables["WITH_IMGCODEC_PFM"] = self.options.with_imgcodec_pfm + tc.variables["WITH_IMGCODEC_PXM"] = self.options.with_imgcodec_pxm + tc.variables["WITH_IMGCODEC_SUNRASTER"] = self.options.with_imgcodec_sunraster + tc.variables["WITH_INF_ENGINE"] = False + tc.variables["WITH_IPP"] = False if self.options.with_ipp: - self._cmake.definitions["WITH_IPP"] = True + tc.variables["WITH_IPP"] = True if self.options.with_ipp == "intel-ipp": - ipp_root = self.deps_cpp_info["intel-ipp"].rootpath + ipp_root = self.dependencies["intel-ipp"].package_folder.replace("\\", "/") if self.settings.os == "Windows": ipp_root = ipp_root.replace("\\", "/") - self._cmake.definitions["IPPROOT"] = ipp_root - self._cmake.definitions["IPPIWROOT"] = ipp_root + tc.variables["IPPROOT"] = ipp_root + tc.variables["IPPIWROOT"] = ipp_root else: - self._cmake.definitions["BUILD_IPP_IW"] = True - self._cmake.definitions["WITH_ITT"] = False - self._cmake.definitions["WITH_LIBREALSENSE"] = False - self._cmake.definitions["WITH_MFX"] = False - self._cmake.definitions["WITH_NGRAPH"] = False - self._cmake.definitions["WITH_OPENCL"] = False - self._cmake.definitions["WITH_OPENCLAMDBLAS"] = False - self._cmake.definitions["WITH_OPENCLAMDFFT"] = False - self._cmake.definitions["WITH_OPENCL_SVM"] = False - self._cmake.definitions["WITH_OPENGL"] = False - self._cmake.definitions["WITH_OPENMP"] = False - self._cmake.definitions["WITH_OPENNI"] = False - self._cmake.definitions["WITH_OPENNI2"] = False - self._cmake.definitions["WITH_OPENVX"] = False - self._cmake.definitions["WITH_PLAIDML"] = False - self._cmake.definitions["WITH_PVAPI"] = False - self._cmake.definitions["WITH_QT"] = False - self._cmake.definitions["WITH_QUIRC"] = False - self._cmake.definitions["WITH_V4L"] = self.options.get_safe("with_v4l", False) - self._cmake.definitions["WITH_VA"] = False - self._cmake.definitions["WITH_VA_INTEL"] = False - self._cmake.definitions["WITH_VTK"] = False - self._cmake.definitions["WITH_VULKAN"] = False - self._cmake.definitions["WITH_XIMEA"] = False - self._cmake.definitions["WITH_XINE"] = False - self._cmake.definitions["WITH_LAPACK"] = False - - self._cmake.definitions["WITH_GTK"] = self.options.get_safe("with_gtk", False) - self._cmake.definitions["WITH_GTK_2_X"] = self._is_gtk_version2 - self._cmake.definitions["WITH_WEBP"] = self.options.with_webp - self._cmake.definitions["WITH_JPEG"] = self.options.with_jpeg != False - self._cmake.definitions["WITH_PNG"] = self.options.with_png + tc.variables["BUILD_IPP_IW"] = True + tc.variables["WITH_ITT"] = False + tc.variables["WITH_LIBREALSENSE"] = False + tc.variables["WITH_MFX"] = False + tc.variables["WITH_NGRAPH"] = False + tc.variables["WITH_OPENCL"] = False + tc.variables["WITH_OPENCLAMDBLAS"] = False + tc.variables["WITH_OPENCLAMDFFT"] = False + tc.variables["WITH_OPENCL_SVM"] = False + tc.variables["WITH_OPENGL"] = False + tc.variables["WITH_OPENMP"] = False + tc.variables["WITH_OPENNI"] = False + tc.variables["WITH_OPENNI2"] = False + tc.variables["WITH_OPENVX"] = False + tc.variables["WITH_PLAIDML"] = False + tc.variables["WITH_PVAPI"] = False + tc.variables["WITH_QT"] = False + tc.variables["WITH_QUIRC"] = False + tc.variables["WITH_V4L"] = self.options.get_safe("with_v4l", False) + tc.variables["WITH_VA"] = False + tc.variables["WITH_VA_INTEL"] = False + tc.variables["WITH_VTK"] = False + tc.variables["WITH_VULKAN"] = False + tc.variables["WITH_XIMEA"] = False + tc.variables["WITH_XINE"] = False + tc.variables["WITH_LAPACK"] = False + + tc.variables["WITH_GTK"] = self.options.get_safe("with_gtk", False) + tc.variables["WITH_GTK_2_X"] = self._is_gtk_version2 + tc.variables["WITH_WEBP"] = self.options.with_webp + tc.variables["WITH_JPEG"] = bool(self.options.with_jpeg) + tc.variables["WITH_PNG"] = self.options.with_png if self._has_with_tiff_option: - self._cmake.definitions["WITH_TIFF"] = self.options.with_tiff + tc.variables["WITH_TIFF"] = self.options.with_tiff if self._has_with_jpeg2000_option: - self._cmake.definitions["WITH_JASPER"] = self.options.with_jpeg2000 == "jasper" - self._cmake.definitions["WITH_OPENJPEG"] = self.options.with_jpeg2000 == "openjpeg" - self._cmake.definitions["WITH_OPENEXR"] = self.options.with_openexr - self._cmake.definitions["WITH_EIGEN"] = self.options.with_eigen - self._cmake.definitions["HAVE_QUIRC"] = self.options.with_quirc # force usage of quirc requirement - self._cmake.definitions["WITH_DSHOW"] = self._is_msvc - self._cmake.definitions["WITH_MSMF"] = self._is_msvc - self._cmake.definitions["WITH_MSMF_DXVA"] = self._is_msvc - self._cmake.definitions["OPENCV_MODULES_PUBLIC"] = "opencv" - self._cmake.definitions["OPENCV_ENABLE_NONFREE"] = self.options.nonfree - - if self.options.cpu_baseline: - self._cmake.definitions["CPU_BASELINE"] = self.options.cpu_baseline - - if self.options.cpu_dispatch: - self._cmake.definitions["CPU_DISPATCH"] = self.options.cpu_dispatch + tc.variables["WITH_JASPER"] = self.options.with_jpeg2000 == "jasper" + tc.variables["WITH_OPENJPEG"] = self.options.with_jpeg2000 == "openjpeg" + tc.variables["WITH_OPENEXR"] = self.options.with_openexr + if self.options.with_openexr: + tc.variables["CMAKE_CXX_STANDARD"] = 11 + tc.variables["WITH_EIGEN"] = self.options.with_eigen + tc.variables["HAVE_QUIRC"] = self.options.with_quirc # force usage of quirc requirement + tc.variables["WITH_DSHOW"] = is_msvc(self) + tc.variables["WITH_MSMF"] = self.options.get_safe("with_msmf", False) + tc.variables["WITH_MSMF_DXVA"] = self.options.get_safe("with_msmf_dxva", False) + tc.variables["OPENCV_MODULES_PUBLIC"] = "opencv" + tc.variables["OPENCV_ENABLE_NONFREE"] = self.options.nonfree + + if self.options.cpu_baseline or self.options.cpu_baseline == "": + tc.variables["CPU_BASELINE"] = self.options.cpu_baseline + + if self.options.cpu_dispatch or self.options.cpu_dispatch == "": + tc.variables["CPU_DISPATCH"] = self.options.cpu_dispatch if self.options.get_safe("neon") is not None: - self._cmake.definitions["ENABLE_NEON"] = self.options.get_safe("neon") + tc.variables["ENABLE_NEON"] = self.options.get_safe("neon") - self._cmake.definitions["WITH_PROTOBUF"] = self.options.dnn + tc.variables["WITH_PROTOBUF"] = self.options.dnn if self.options.dnn: - self._cmake.definitions["PROTOBUF_UPDATE_FILES"] = True - self._cmake.definitions["BUILD_opencv_dnn"] = True - self._cmake.definitions["OPENCV_DNN_CUDA"] = self.options.get_safe("dnn_cuda", False) + tc.variables["PROTOBUF_UPDATE_FILES"] = True + tc.variables["BUILD_opencv_dnn"] = True + tc.variables["OPENCV_DNN_CUDA"] = self.options.get_safe("dnn_cuda", False) if self.options.contrib: - self._cmake.definitions['OPENCV_EXTRA_MODULES_PATH'] = os.path.join(self.build_folder, self._contrib_folder, 'modules') - self._cmake.definitions['BUILD_opencv_freetype'] = self.options.get_safe("contrib_freetype", False) - self._cmake.definitions['BUILD_opencv_sfm'] = self.options.get_safe("contrib_sfm", False) + tc.variables["OPENCV_EXTRA_MODULES_PATH"] = os.path.join(self._contrib_folder, "modules").replace("\\", "/") + tc.variables["BUILD_opencv_freetype"] = self.options.get_safe("contrib_freetype", False) + tc.variables["BUILD_opencv_sfm"] = self.options.get_safe("contrib_sfm", False) - if self.options.with_openexr: - self._cmake.definitions["OPENEXR_ROOT"] = self.deps_cpp_info["openexr"].rootpath if self.options.get_safe("with_jpeg2000") == "openjpeg": - openjpeg_version = tools.Version(self.deps_cpp_info["openjpeg"].version) - self._cmake.definitions["OPENJPEG_MAJOR_VERSION"] = openjpeg_version.major - self._cmake.definitions["OPENJPEG_MINOR_VERSION"] = openjpeg_version.minor - self._cmake.definitions["OPENJPEG_BUILD_VERSION"] = openjpeg_version.patch + openjpeg_version = Version(self.dependencies["openjpeg"].ref.version) + tc.variables["OPENJPEG_MAJOR_VERSION"] = openjpeg_version.major + tc.variables["OPENJPEG_MINOR_VERSION"] = openjpeg_version.minor + tc.variables["OPENJPEG_BUILD_VERSION"] = openjpeg_version.patch if self.options.parallel: - self._cmake.definitions["WITH_TBB"] = self.options.parallel == "tbb" - self._cmake.definitions["WITH_OPENMP"] = self.options.parallel == "openmp" + tc.variables["WITH_TBB"] = self.options.parallel == "tbb" + tc.variables["WITH_OPENMP"] = self.options.parallel == "openmp" - self._cmake.definitions["WITH_CUDA"] = self.options.with_cuda - self._cmake.definitions["WITH_ADE"] = self.options.with_ade + tc.variables["WITH_CUDA"] = self.options.with_cuda + tc.variables["WITH_ADE"] = self.options.with_ade if self.options.with_cuda: # This allows compilation on older GCC/NVCC, otherwise build errors. - self._cmake.definitions["CUDA_NVCC_FLAGS"] = "--expt-relaxed-constexpr" + tc.variables["CUDA_NVCC_FLAGS"] = "--expt-relaxed-constexpr" if self.options.cuda_arch_bin: - self._cmake.definitions["CUDA_ARCH_BIN"] = self.options.cuda_arch_bin - self._cmake.definitions["WITH_CUBLAS"] = self.options.get_safe("with_cublas", False) - self._cmake.definitions["WITH_CUFFT"] = self.options.get_safe("with_cufft", False) - self._cmake.definitions["WITH_CUDNN"] = self.options.get_safe("with_cudnn", False) + tc.variables["CUDA_ARCH_BIN"] = self.options.cuda_arch_bin + tc.variables["WITH_CUBLAS"] = self.options.get_safe("with_cublas", False) + tc.variables["WITH_CUFFT"] = self.options.get_safe("with_cufft", False) + tc.variables["WITH_CUDNN"] = self.options.get_safe("with_cudnn", False) - self._cmake.definitions["ENABLE_PIC"] = self.options.get_safe("fPIC", True) - self._cmake.definitions["ENABLE_CCACHE"] = False + tc.variables["ENABLE_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["ENABLE_CCACHE"] = False - if self._is_msvc: - self._cmake.definitions["BUILD_WITH_STATIC_CRT"] = "MT" in msvc_runtime_flag(self) + if is_msvc(self): + tc.variables["BUILD_WITH_STATIC_CRT"] = is_msvc_static_runtime(self) if self.settings.os == "Android": - self._cmake.definitions["ANDROID_STL"] = "c++_static" - self._cmake.definitions["ANDROID_NATIVE_API_LEVEL"] = self.settings.os.api_level - self._cmake.definitions["ANDROID_ABI"] = tools.to_android_abi(str(self.settings.arch)) - self._cmake.definitions["BUILD_ANDROID_EXAMPLES"] = False - if "ANDROID_NDK_HOME" in os.environ: - self._cmake.definitions["ANDROID_NDK"] = os.environ.get("ANDROID_NDK_HOME") - - if tools.cross_building(self): - # FIXME: too specific and error prone, should be delegated to CMake helper - cmake_system_processor = { - "armv8": "aarch64", - "armv8.3": "aarch64", - }.get(str(self.settings.arch), str(self.settings.arch)) - self._cmake.definitions["CONAN_OPENCV_SYSTEM_PROCESSOR"] = cmake_system_processor - # Workaround for cross-build to at least iOS/tvOS/watchOS, - # when dependencies are found with find_path() and find_library() - self._cmake.definitions["CMAKE_FIND_ROOT_PATH_MODE_INCLUDE"] = "BOTH" - self._cmake.definitions["CMAKE_FIND_ROOT_PATH_MODE_LIBRARY"] = "BOTH" - - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["BUILD_ANDROID_EXAMPLES"] = False + + tc.generate() + + CMakeDeps(self).generate() def build(self): - self._patch_opencv() - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "cmake")) if os.path.isfile(os.path.join(self.package_folder, "setup_vars_opencv4.cmd")): - tools.rename(os.path.join(self.package_folder, "setup_vars_opencv4.cmd"), + rename(self, os.path.join(self.package_folder, "setup_vars_opencv4.cmd"), os.path.join(self.package_folder, "res", "setup_vars_opencv4.cmd")) # TODO: to remove in conan v2 once cmake_find_package* generators removed @@ -533,21 +516,20 @@ def package(self): {component["target"]:"opencv::{}".format(component["target"]) for component in self._opencv_components} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") # returns true if GTK2 is selected. To do this, the version option # of the gtk/system package is checked or the conan package version @@ -556,11 +538,11 @@ def _module_file_rel_path(self): def _is_gtk_version2(self): if not self.options.get_safe("with_gtk", False): return False - gtk_version = self.deps_cpp_info["gtk"].version + gtk_version = self.dependencies["gtk"].ref.version if gtk_version == "system": return self.options["gtk"].version == 2 else: - return tools.Version(gtk_version) < "3.0.0" + return Version(gtk_version) < "3.0.0" @property def _opencv_components(self): @@ -570,8 +552,12 @@ def imageformats_deps(): components.append("{0}::{0}".format(self.options.with_jpeg2000)) if self.options.with_png: components.append("libpng::libpng") - if self.options.with_jpeg: - components.append("{0}::{0}".format(self.options.with_jpeg)) + if self.options.with_jpeg == "libjpeg": + components.append("libjpeg::libjpeg") + elif self.options.with_jpeg == "libjpeg-turbo": + components.append("libjpeg-turbo::jpeg") + elif self.options.with_jpeg == "mozjpeg": + components.append("mozjpeg::libjpeg") if self.options.get_safe("with_tiff"): components.append("libtiff::libtiff") if self.options.with_openexr: @@ -737,11 +723,11 @@ def package_info(self): def get_lib_name(module): if module == "ippiw": - return "%s%s" % (module, debug) + return f"{module}{debug}" elif module in ("correspondence", "multiview", "numeric"): return module else: - return "opencv_%s%s%s" % (module, version, debug) + return f"opencv_{module}{version}{debug}" def add_components(components): for component in components: @@ -763,23 +749,14 @@ def add_components(components): self.cpp_info.components[conan_component].system_libs = ["dl", "m", "pthread", "rt"] if self.settings.os == "Android": - self.cpp_info.components[conan_component].includedirs = [ - os.path.join("sdk", "native", "jni", "include")] self.cpp_info.components[conan_component].system_libs.append("log") if int(str(self.settings.os.api_level)) > 20: self.cpp_info.components[conan_component].system_libs.append("mediandk") - if not self.options.shared: - self.cpp_info.components[conan_component].libdirs.append( - os.path.join("sdk", "native", "staticlibs", tools.to_android_abi(str(self.settings.arch)))) - if conan_component == "opencv_core": - self.cpp_info.components[conan_component].libdirs.append("lib") - self.cpp_info.components[conan_component].libs += tools.collect_libs(self) - - if self.settings.os in ["iOS", "Macos", "Linux", "Neutrino"]: - if not self.options.shared: - if conan_component == "opencv_core": - libs = list(filter(lambda x: not x.startswith("opencv"), tools.collect_libs(self))) - self.cpp_info.components[conan_component].libs += libs + + if conan_component == "opencv_core" and not self.options.shared: + lib_exclude_filter = "(opencv_|ippi|correspondence|multiview|numeric).*" + libs = list(filter(lambda x: not re.match(lib_exclude_filter, x), collect_libs(self))) + self.cpp_info.components[conan_component].libs += libs # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.components[conan_component].names["cmake_find_package"] = cmake_target @@ -791,11 +768,9 @@ def add_components(components): self.cpp_info.components[conan_component_alias].names["cmake_find_package"] = cmake_component self.cpp_info.components[conan_component_alias].names["cmake_find_package_multi"] = cmake_component self.cpp_info.components[conan_component_alias].requires = [conan_component] + self.cpp_info.components[conan_component_alias].bindirs = [] self.cpp_info.components[conan_component_alias].includedirs = [] self.cpp_info.components[conan_component_alias].libdirs = [] - self.cpp_info.components[conan_component_alias].resdirs = [] - self.cpp_info.components[conan_component_alias].bindirs = [] - self.cpp_info.components[conan_component_alias].frameworkdirs = [] self.cpp_info.set_property("cmake_file_name", "OpenCV") diff --git a/recipes/opencv/4.x/patches/0002-openexr.patch b/recipes/opencv/4.x/patches/0002-openexr.patch deleted file mode 100644 index f0a2e1826d2a1..0000000000000 --- a/recipes/opencv/4.x/patches/0002-openexr.patch +++ /dev/null @@ -1,143 +0,0 @@ -diff --git a/cmake/OpenCVFindOpenEXR.cmake b/cmake/OpenCVFindOpenEXR.cmake -index c0a46806e1..ef633e853a 100644 ---- a/cmake/OpenCVFindOpenEXR.cmake -+++ b/cmake/OpenCVFindOpenEXR.cmake -@@ -15,60 +15,97 @@ file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH) - - if(WIN32) - SET(OPENEXR_ROOT "C:/Deploy" CACHE STRING "Path to the OpenEXR \"Deploy\" folder") -- if(CMAKE_CL_64) -+ if(X86_64) - SET(OPENEXR_LIBSEARCH_SUFFIXES x64/Release x64 x64/Debug) - elseif(MSVC) - SET(OPENEXR_LIBSEARCH_SUFFIXES Win32/Release Win32 Win32/Debug) - endif() --else() -- set(OPENEXR_ROOT "") -+elseif(UNIX) -+ SET(OPENEXR_LIBSEARCH_SUFFIXES ${CMAKE_LIBRARY_ARCHITECTURE}) - endif() - --SET(LIBRARY_PATHS -- /usr/lib -- /usr/local/lib -- /sw/lib -- /opt/local/lib -- "${ProgramFiles_ENV_PATH}/OpenEXR/lib/static" -- "${OPENEXR_ROOT}/lib") -+SET(SEARCH_PATHS -+ "${OPENEXR_ROOT}" -+ /usr -+ /usr/local -+ /sw -+ /opt -+ "${ProgramFiles_ENV_PATH}/OpenEXR") - --FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h -- PATH_SUFFIXES OpenEXR -- PATHS -- /usr/include -- /usr/local/include -- /sw/include -- /opt/local/include -- "${ProgramFiles_ENV_PATH}/OpenEXR/include" -- "${OPENEXR_ROOT}/include") -+MACRO(FIND_OPENEXR_LIBRARY LIBRARY_NAME LIBRARY_SUFFIX) -+ string(TOUPPER "${LIBRARY_NAME}" LIBRARY_NAME_UPPER) -+ FIND_LIBRARY(OPENEXR_${LIBRARY_NAME_UPPER}_LIBRARY -+ NAMES ${LIBRARY_NAME}${LIBRARY_SUFFIX} -+ PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -+ NO_DEFAULT_PATH -+ PATHS "${SEARCH_PATH}/lib" "${SEARCH_PATH}/lib/static") -+ENDMACRO() - --FIND_LIBRARY(OPENEXR_HALF_LIBRARY -- NAMES Half -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+MACRO(ocv_find_openexr LIBRARY_SUFFIX) -+ IF(NOT OPENEXR_FOUND) -+ FIND_OPENEXR_LIBRARY("Half" "${LIBRARY_SUFFIX}") -+ FIND_OPENEXR_LIBRARY("Iex" "${LIBRARY_SUFFIX}") -+ FIND_OPENEXR_LIBRARY("Imath" "${LIBRARY_SUFFIX}") -+ FIND_OPENEXR_LIBRARY("IlmImf" "${LIBRARY_SUFFIX}") -+ FIND_OPENEXR_LIBRARY("IlmThread" "${LIBRARY_SUFFIX}") -+ IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY AND OPENEXR_ILMTHREAD_LIBRARY) -+ SET(OPENEXR_FOUND TRUE) -+ ELSE() -+ UNSET(OPENEXR_IMATH_LIBRARY) -+ UNSET(OPENEXR_ILMIMF_LIBRARY) -+ UNSET(OPENEXR_IEX_LIBRARY) -+ UNSET(OPENEXR_ILMTHREAD_LIBRARY) -+ UNSET(OPENEXR_HALF_LIBRARY) -+ ENDIF() -+ ENDIF() -+ENDMACRO() - --FIND_LIBRARY(OPENEXR_IEX_LIBRARY -- NAMES Iex -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+FOREACH(SEARCH_PATH ${SEARCH_PATHS}) -+ FIND_PATH(OPENEXR_INCLUDE_PATH ImfRgbaFile.h -+ PATH_SUFFIXES OpenEXR -+ NO_DEFAULT_PATH -+ PATHS -+ "${SEARCH_PATH}/include") - --FIND_LIBRARY(OPENEXR_IMATH_LIBRARY -- NAMES Imath -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+ IF (OPENEXR_INCLUDE_PATH) -+ SET(OPENEXR_VERSION_FILE "${OPENEXR_INCLUDE_PATH}/OpenEXRConfig.h") -+ IF (EXISTS ${OPENEXR_VERSION_FILE}) -+ FILE (STRINGS ${OPENEXR_VERSION_FILE} contents REGEX "#define OPENEXR_VERSION_MAJOR ") -+ IF (${contents} MATCHES "#define OPENEXR_VERSION_MAJOR ([0-9]+)") -+ SET(OPENEXR_VERSION_MAJOR "${CMAKE_MATCH_1}") -+ ENDIF () -+ FILE (STRINGS ${OPENEXR_VERSION_FILE} contents REGEX "#define OPENEXR_VERSION_MINOR ") -+ IF (${contents} MATCHES "#define OPENEXR_VERSION_MINOR ([0-9]+)") -+ SET(OPENEXR_VERSION_MINOR "${CMAKE_MATCH_1}") -+ ENDIF () -+ ENDIF () -+ ENDIF () - --FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY -- NAMES IlmImf -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+ IF (OPENEXR_VERSION_MAJOR AND OPENEXR_VERSION_MINOR) -+ set(OPENEXR_VERSION "${OPENEXR_VERSION_MAJOR}_${OPENEXR_VERSION_MINOR}") -+ ENDIF () - --FIND_LIBRARY(OPENEXR_ILMTHREAD_LIBRARY -- NAMES IlmThread -- PATH_SUFFIXES ${OPENEXR_LIBSEARCH_SUFFIXES} -- PATHS ${LIBRARY_PATHS}) -+ ocv_find_openexr("-${OPENEXR_VERSION}") -+ ocv_find_openexr("-${OPENEXR_VERSION}_s") -+ ocv_find_openexr("-${OPENEXR_VERSION}_d") -+ ocv_find_openexr("-${OPENEXR_VERSION}_s_d") -+ ocv_find_openexr("") -+ ocv_find_openexr("_s") -+ ocv_find_openexr("_d") -+ ocv_find_openexr("_s_d") - --IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY) -- SET(OPENEXR_FOUND TRUE) -+ IF (OPENEXR_FOUND) -+ BREAK() -+ ENDIF() -+ -+ UNSET(OPENEXR_INCLUDE_PATH) -+ UNSET(OPENEXR_VERSION_FILE) -+ UNSET(OPENEXR_VERSION_MAJOR) -+ UNSET(OPENEXR_VERSION_MINOR) -+ UNSET(OPENEXR_VERSION) -+ENDFOREACH() -+ -+IF (OPENEXR_FOUND) - SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE PATH "The include paths needed to use OpenEXR") - SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} ${OPENEXR_ILMTHREAD_LIBRARY} CACHE STRING "The libraries needed to use OpenEXR" FORCE) - ENDIF () diff --git a/recipes/opencv/4.x/patches/4.1.2-0001-find-openexr.patch b/recipes/opencv/4.x/patches/4.1.2-0001-find-openexr.patch new file mode 100644 index 0000000000000..5fb088fdf0888 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0001-find-openexr.patch @@ -0,0 +1,18 @@ +--- a/cmake/OpenCVFindOpenEXR.cmake ++++ b/cmake/OpenCVFindOpenEXR.cmake +@@ -9,6 +9,15 @@ + # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. + # + ++find_package(OpenEXR REQUIRED) ++if(TARGET OpenEXR::OpenEXR) ++ set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) ++else() ++ set(OPENEXR_LIBRARIES openexr::openexr) ++endif() ++set(OPENEXR_FOUND TRUE) ++set(OPENEXR_VERSION ${OpenEXR_VERSION}) ++return() + SET(OPENEXR_LIBRARIES "") + SET(OPENEXR_LIBSEARCH_SUFFIXES "") + file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles_ENV_PATH) diff --git a/recipes/opencv/4.x/patches/4.1.2-0002-find-ade.patch b/recipes/opencv/4.x/patches/4.1.2-0002-find-ade.patch new file mode 100644 index 0000000000000..98f88b7c0ec2d --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0002-find-ade.patch @@ -0,0 +1,11 @@ +--- a/modules/gapi/cmake/init.cmake ++++ b/modules/gapi/cmake/init.cmake +@@ -4,7 +4,7 @@ if(NOT WITH_ADE) + return() + endif() + +-if (ade_DIR) ++if (1) + # if ade_DIR is set, use ADE-supplied CMake script + # to set up variables to the prebuilt ADE + find_package(ade 0.1.0) diff --git a/recipes/opencv/4.x/patches/4.1.2-0003-find-quirc.patch b/recipes/opencv/4.x/patches/4.1.2-0003-find-quirc.patch new file mode 100644 index 0000000000000..acfad3e91a1e0 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0003-find-quirc.patch @@ -0,0 +1,8 @@ +--- a/modules/objdetect/CMakeLists.txt ++++ b/modules/objdetect/CMakeLists.txt +@@ -5,3 +5,2 @@ if(HAVE_QUIRC) +- get_property(QUIRC_INCLUDE GLOBAL PROPERTY QUIRC_INCLUDE_DIR) +- ocv_include_directories(${QUIRC_INCLUDE}) +- ocv_target_link_libraries(${the_module} quirc) ++ find_package(quirc REQUIRED CONFIG) ++ ocv_target_link_libraries(${the_module} quirc::quirc) diff --git a/recipes/opencv/4.x/patches/0001-jasper.patch b/recipes/opencv/4.x/patches/4.1.2-0004-jasper.patch similarity index 100% rename from recipes/opencv/4.x/patches/0001-jasper.patch rename to recipes/opencv/4.x/patches/4.1.2-0004-jasper.patch diff --git a/recipes/opencv/4.x/patches/4.1.2-0007-android-install-layout.patch b/recipes/opencv/4.x/patches/4.1.2-0007-android-install-layout.patch new file mode 100644 index 0000000000000..75157a1e7cf4a --- /dev/null +++ b/recipes/opencv/4.x/patches/4.1.2-0007-android-install-layout.patch @@ -0,0 +1,11 @@ +--- a/cmake/OpenCVInstallLayout.cmake ++++ b/cmake/OpenCVInstallLayout.cmake +@@ -1,7 +1,7 @@ + # message(STATUS "Initial install layout:") + # ocv_cmake_dump_vars("OPENCV_.*_INSTALL_PATH") + +-if(ANDROID) ++if(0) + + ocv_update(OPENCV_BIN_INSTALL_PATH "sdk/native/bin/${ANDROID_NDK_ABI_NAME}") + ocv_update(OPENCV_TEST_INSTALL_PATH "${OPENCV_BIN_INSTALL_PATH}") diff --git a/recipes/opencv/4.x/patches/4.5.0-0002-find-ade.patch b/recipes/opencv/4.x/patches/4.5.0-0002-find-ade.patch new file mode 100644 index 0000000000000..cf954ad2c04e8 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.0-0002-find-ade.patch @@ -0,0 +1,11 @@ +--- a/modules/gapi/cmake/init.cmake ++++ b/modules/gapi/cmake/init.cmake +@@ -7,7 +7,7 @@ if(NOT WITH_ADE) + return() + endif() + +-if(ade_DIR) ++if(1) + # if ade_DIR is set, use ADE-supplied CMake script + # to set up variables to the prebuilt ADE + find_package(ade 0.1.0) diff --git a/recipes/opencv/4.x/patches/4.5.2-0001-fix-zlib-static-android.patch b/recipes/opencv/4.x/patches/4.5.2-0001-fix-zlib-static-android.patch new file mode 100644 index 0000000000000..5d3c6b55ce8f2 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.2-0001-fix-zlib-static-android.patch @@ -0,0 +1,17 @@ +--- a/cmake/OpenCVFindLibsGrfmt.cmake ++++ b/cmake/OpenCVFindLibsGrfmt.cmake +@@ -7,12 +7,12 @@ if(BUILD_ZLIB) + ocv_clear_vars(ZLIB_FOUND) + else() + ocv_clear_internal_cache_vars(ZLIB_LIBRARY ZLIB_INCLUDE_DIR) +- if(ANDROID) ++ if(0) + set(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES}) + set(CMAKE_FIND_LIBRARY_SUFFIXES .so) + endif() + find_package(ZLIB "${MIN_VER_ZLIB}") +- if(ANDROID) ++ if(0) + set(CMAKE_FIND_LIBRARY_SUFFIXES ${_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES}) + unset(_zlib_ORIG_CMAKE_FIND_LIBRARY_SUFFIXES) + endif() diff --git a/recipes/opencv/4.x/patches/4.5.3-0001-find-openexr.patch b/recipes/opencv/4.x/patches/4.5.3-0001-find-openexr.patch new file mode 100644 index 0000000000000..d78a290b65ab0 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.3-0001-find-openexr.patch @@ -0,0 +1,23 @@ +--- a/cmake/OpenCVFindOpenEXR.cmake ++++ b/cmake/OpenCVFindOpenEXR.cmake +@@ -9,13 +9,15 @@ + # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. + # + +-find_package(OpenEXR 3.0 CONFIG QUIET) ++find_package(OpenEXR REQUIRED) + if(TARGET OpenEXR::OpenEXR) +- SET(OPENEXR_FOUND TRUE) +- SET(OPENEXR_LIBRARIES OpenEXR::OpenEXR) +- SET(OPENEXR_VERSION ${OpenEXR_VERSION}) +- return() ++ set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) ++else() ++ set(OPENEXR_LIBRARIES openexr::openexr) + endif() ++set(OPENEXR_FOUND TRUE) ++set(OPENEXR_VERSION ${OpenEXR_VERSION}) ++return() + + SET(OPENEXR_LIBRARIES "") + SET(OPENEXR_LIBSEARCH_SUFFIXES "") diff --git a/recipes/opencv/4.x/patches/4.5.5-0001-find-openexr.patch b/recipes/opencv/4.x/patches/4.5.5-0001-find-openexr.patch new file mode 100644 index 0000000000000..67e0aad7b7430 --- /dev/null +++ b/recipes/opencv/4.x/patches/4.5.5-0001-find-openexr.patch @@ -0,0 +1,32 @@ +--- a/cmake/OpenCVFindOpenEXR.cmake ++++ b/cmake/OpenCVFindOpenEXR.cmake +@@ -9,21 +9,15 @@ + # OPENEXR_LIBRARIES = libraries that are needed to use OpenEXR. + # + +-if(NOT OPENCV_SKIP_OPENEXR_FIND_PACKAGE) +- find_package(OpenEXR 3 QUIET) +- #ocv_cmake_dump_vars(EXR) +- if(OpenEXR_FOUND) +- if(TARGET OpenEXR::OpenEXR) # OpenEXR 3+ +- set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) +- set(OPENEXR_INCLUDE_PATHS "") +- set(OPENEXR_VERSION "${OpenEXR_VERSION}") +- set(OPENEXR_FOUND 1) +- return() +- else() +- message(STATUS "Unsupported find_package(OpenEXR) - missing OpenEXR::OpenEXR target (version ${OpenEXR_VERSION})") +- endif() +- endif() ++find_package(OpenEXR REQUIRED) ++if(TARGET OpenEXR::OpenEXR) ++ set(OPENEXR_LIBRARIES OpenEXR::OpenEXR) ++else() ++ set(OPENEXR_LIBRARIES openexr::openexr) + endif() ++set(OPENEXR_FOUND TRUE) ++set(OPENEXR_VERSION ${OpenEXR_VERSION}) ++return() + + SET(OPENEXR_LIBRARIES "") + SET(OPENEXR_LIBSEARCH_SUFFIXES "") diff --git a/recipes/opencv/4.x/test_package/CMakeLists.txt b/recipes/opencv/4.x/test_package/CMakeLists.txt index 3361bc4c26e1f..590e6c1b43a32 100644 --- a/recipes/opencv/4.x/test_package/CMakeLists.txt +++ b/recipes/opencv/4.x/test_package/CMakeLists.txt @@ -1,28 +1,14 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(OpenCV REQUIRED imgcodecs highgui objdetect CONFIG) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) option(built_with_ade "Enabled if opencv is built with ade" OFF) -if(built_with_ade) - add_definitions(-DBUILT_WITH_ADE) -endif() - option(built_with_ffmpeg "Enabled if opencv is built with ffmpeg" OFF) -if(built_with_ffmpeg) - add_definitions(-DBUILT_WITH_FFMPEG) -endif() - option(built_contrib_sfm "Enabled if opencv is built contrib sfm" OFF) -if(built_contrib_sfm) - add_definitions(-DBUILT_CONTRIB_SFM) -endif() + +find_package(OpenCV REQUIRED imgcodecs highgui objdetect CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} +target_link_libraries(${PROJECT_NAME} PRIVATE opencv_imgcodecs opencv_highgui opencv_objdetect @@ -30,4 +16,13 @@ target_link_libraries(${PROJECT_NAME} $ $ ) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if(built_with_ade) + target_compile_definitions(${PROJECT_NAME} PRIVATE BUILT_WITH_ADE) +endif() +if(built_with_ffmpeg) + target_compile_definitions(${PROJECT_NAME} PRIVATE BUILT_WITH_FFMPEG) +endif() +if(built_contrib_sfm) + target_compile_definitions(${PROJECT_NAME} PRIVATE BUILT_CONTRIB_SFM) +endif() diff --git a/recipes/opencv/4.x/test_package/conanfile.py b/recipes/opencv/4.x/test_package/conanfile.py index 1c034b84e089a..8cbff65ecd5a3 100644 --- a/recipes/opencv/4.x/test_package/conanfile.py +++ b/recipes/opencv/4.x/test_package/conanfile.py @@ -1,20 +1,33 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["built_with_ade"] = self.dependencies["opencv"].options.with_ade + tc.variables["built_with_ffmpeg"] = self.dependencies["opencv"].options.with_ffmpeg + tc.variables["built_contrib_sfm"] = self.dependencies["opencv"].options.contrib and self.dependencies["opencv"].options.contrib_sfm + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["built_with_ade"] = self.options["opencv"].with_ade - cmake.definitions["built_with_ffmpeg"] = self.options["opencv"].with_ffmpeg - cmake.definitions["built_contrib_sfm"] = self.options["opencv"].contrib and self.options["opencv"].contrib_sfm cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opencv/4.x/test_package/test_package.cpp b/recipes/opencv/4.x/test_package/test_package.cpp index 046f0f961f9b2..220a68d7c84b1 100644 --- a/recipes/opencv/4.x/test_package/test_package.cpp +++ b/recipes/opencv/4.x/test_package/test_package.cpp @@ -12,8 +12,9 @@ #include #include #endif -#ifdef BUILD_WITH_FFMPEF +#ifdef BUILT_WITH_FFMPEG #include +#include #endif #ifdef BUILT_CONTRIB_SFM #include @@ -218,7 +219,7 @@ void TestGAPI() void TestVideo() { -#ifdef BUILD_WITH_FFMPEG +#ifdef BUILT_WITH_FFMPEG if (!videoio_registry::hasBackend(CAP_FFMPEG)) throw std::runtime_error("FFmpeg backend was not found"); #endif diff --git a/recipes/opencv/4.x/test_v1_package/CMakeLists.txt b/recipes/opencv/4.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/opencv/4.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opencv/4.x/test_v1_package/conanfile.py b/recipes/opencv/4.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1c034b84e089a --- /dev/null +++ b/recipes/opencv/4.x/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["built_with_ade"] = self.options["opencv"].with_ade + cmake.definitions["built_with_ffmpeg"] = self.options["opencv"].with_ffmpeg + cmake.definitions["built_contrib_sfm"] = self.options["opencv"].contrib and self.options["opencv"].contrib_sfm + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/openddl-parser/all/conanfile.py b/recipes/openddl-parser/all/conanfile.py index 83d89549b99f6..85b5510043782 100644 --- a/recipes/openddl-parser/all/conanfile.py +++ b/recipes/openddl-parser/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class OpenDDLParserConan(ConanFile): @@ -15,6 +15,7 @@ class OpenDDLParserConan(ConanFile): description = "A simple and fast OpenDDL Parser" topics = ("openddl", "parser") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,8 +27,7 @@ class OpenDDLParserConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,26 +35,23 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) tc.variables["DDL_STATIC_LIBRARY"] = not self.options.shared tc.variables["DDL_BUILD_TESTS"] = False tc.variables["DDL_BUILD_PARSER_DEMO"] = False - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): diff --git a/recipes/openddl-parser/all/test_package/conanfile.py b/recipes/openddl-parser/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/openddl-parser/all/test_package/conanfile.py +++ b/recipes/openddl-parser/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/openddl-parser/all/test_v1_package/CMakeLists.txt b/recipes/openddl-parser/all/test_v1_package/CMakeLists.txt index 6eecd93d926a3..0d20897301b68 100644 --- a/recipes/openddl-parser/all/test_v1_package/CMakeLists.txt +++ b/recipes/openddl-parser/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(openddlparser REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE openddlparser::openddlparser) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/openexr/2.x/conanfile.py b/recipes/openexr/2.x/conanfile.py index 871879a5c3f88..9665a746c28df 100644 --- a/recipes/openexr/2.x/conanfile.py +++ b/recipes/openexr/2.x/conanfile.py @@ -1,14 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import cross_building +from conan.tools.build import cross_building, stdcpp_library from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, replace_in_file, rmdir, save from conan.tools.scm import Version -from conans import tools as tools_legacy import os import textwrap -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.54.0" class OpenEXRConan(ConanFile): @@ -36,10 +35,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if Version(self.version) < "2.5.0" and hasattr(self, "settings_build") and cross_building(self): @@ -217,7 +216,7 @@ def package_info(self): self.cpp_info.components["ilmbase_ilmbaseconfig"].defines.append("OPENEXR_DLL") if not self.options.shared: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.components["openexr_ilmimfconfig"].system_libs.append(libcxx) self.cpp_info.components["ilmbase_ilmbaseconfig"].system_libs.append(libcxx) diff --git a/recipes/openexr/3.x/conanfile.py b/recipes/openexr/3.x/conanfile.py index 7d9caddb48d9f..e96841da78ea1 100644 --- a/recipes/openexr/3.x/conanfile.py +++ b/recipes/openexr/3.x/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.53.0" class OpenEXRConan(ConanFile): @@ -28,8 +28,7 @@ class OpenEXRConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,24 +36,22 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - self.requires("zlib/1.2.12") - + self.requires("zlib/1.2.13") # Note: OpenEXR and Imath are versioned independently. - self.requires("imath/3.1.5") + self.requires("imath/3.1.6", transitive_headers=True) def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.cppstd: check_min_cppstd(self, 11) def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/openfbx/all/CMakeLists.txt b/recipes/openfbx/all/CMakeLists.txt index 7ecf50295356b..5f3c0ba123b04 100644 --- a/recipes/openfbx/all/CMakeLists.txt +++ b/recipes/openfbx/all/CMakeLists.txt @@ -1,17 +1,16 @@ cmake_minimum_required(VERSION 3.8) -project(openfbx) +project(OpenFBX LANGUAGES CXX) -include(conanbuildinfo.cmake) -conan_basic_setup() +find_package(miniz REQUIRED CONFIG) -add_library(${PROJECT_NAME} source_subfolder/src/ofbx.cpp) -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) -set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) -target_link_libraries(${PROJECT_NAME} PRIVATE ${CONAN_LIBS}) +add_library(OpenFBX ${OPENFBX_SRC_DIR}/src/ofbx.cpp) +target_compile_features(OpenFBX PUBLIC cxx_std_11) +set_target_properties(OpenFBX PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) +target_link_libraries(OpenFBX PRIVATE miniz::miniz) -install(TARGETS ${PROJECT_NAME} +install(TARGETS OpenFBX RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) -install(FILES source_subfolder/src/ofbx.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +install(FILES ${OPENFBX_SRC_DIR}/src/ofbx.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/openfbx/all/conanfile.py b/recipes/openfbx/all/conanfile.py index ab7a5ea338b62..08c1a1b0126c6 100644 --- a/recipes/openfbx/all/conanfile.py +++ b/recipes/openfbx/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rm import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class OpenfbxConan(ConanFile): @@ -23,12 +26,6 @@ class OpenfbxConan(ConanFile): } exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -36,41 +33,45 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("miniz/2.1.0") + self.requires("miniz/3.0.1") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OPENFBX_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): # unvendor miniz - tools.remove_files_by_mask(os.path.join(self._source_subfolder, "src"), "miniz*") - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + rm(self, "miniz*", os.path.join(self.source_folder, "src")) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.libs = ["openfbx"] + self.cpp_info.libs = ["OpenFBX"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/openfbx/all/test_package/CMakeLists.txt b/recipes/openfbx/all/test_package/CMakeLists.txt index 33ae887aa6aea..d08ab62734d1f 100644 --- a/recipes/openfbx/all/test_package/CMakeLists.txt +++ b/recipes/openfbx/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(openfbx REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE openfbx::openfbx) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/openfbx/all/test_package/conanfile.py b/recipes/openfbx/all/test_package/conanfile.py index 0219e5fd61f67..7635e9e283758 100644 --- a/recipes/openfbx/all/test_package/conanfile.py +++ b/recipes/openfbx/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") fbx_path = os.path.join(self.source_folder, "d.fbx") - self.run("{} {}".format(bin_path, fbx_path), run_environment=True) + self.run(f"{bin_path} {fbx_path}", env="conanrun") diff --git a/recipes/openfbx/all/test_v1_package/CMakeLists.txt b/recipes/openfbx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/openfbx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/openfbx/all/test_v1_package/conanfile.py b/recipes/openfbx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..fad029416492d --- /dev/null +++ b/recipes/openfbx/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + fbx_path = os.path.join(self.source_folder, os.pardir, "test_package", "d.fbx") + self.run(f"{bin_path} {fbx_path}", run_environment=True) diff --git a/recipes/opengl-registry/all/conandata.yml b/recipes/opengl-registry/all/conandata.yml new file mode 100644 index 0000000000000..1fa4f5c98ec9a --- /dev/null +++ b/recipes/opengl-registry/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20220929": + url: "https://github.com/KhronosGroup/OpenGL-Registry/archive/5bae8738b23d06968e7c3a41308568120943ae77.tar.gz" + sha256: "e69eb5738a517737d91717c4f9bb8da1e1fac7a04afe0fc24532ca92df1da53d" diff --git a/recipes/opengl-registry/all/conanfile.py b/recipes/opengl-registry/all/conanfile.py new file mode 100644 index 0000000000000..46486aec2fc82 --- /dev/null +++ b/recipes/opengl-registry/all/conanfile.py @@ -0,0 +1,48 @@ +from conan import ConanFile +from conan.tools.files import copy, get, load, save +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" + + +class OpenGLRegistryConan(ConanFile): + name = "opengl-registry" + description = "OpenGL, OpenGL ES, and OpenGL ES-SC API and Extension Registry." + license = "Apache-2.0" + topics = ("opengl-registry", "opengl") + homepage = "https://github.com/KhronosGroup/OpenGL-Registry" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("khrplatform/cci.20200529") + + def package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + license_data = load(self, os.path.join(self.source_folder, "api", "GL", "glext.h")) + begin = license_data.find("/*") + len("/*") + end = license_data.find("*/") + license_data = license_data[begin:end] + license_data = license_data.replace("**", "") + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_data) + + copy(self, "*", src=os.path.join(self.source_folder, "api"), dst=os.path.join(self.package_folder, "include")) + copy(self, "*", src=os.path.join(self.source_folder, "xml"), dst=os.path.join(self.package_folder, "res", "xml")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/opengl-registry/all/test_package/CMakeLists.txt b/recipes/opengl-registry/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c42d75e86ff9e --- /dev/null +++ b/recipes/opengl-registry/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(opengl-registry REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} opengl-registry::opengl-registry) diff --git a/recipes/opengl-registry/all/test_package/conanfile.py b/recipes/opengl-registry/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/opengl-registry/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opengl-registry/all/test_package/test_package.c b/recipes/opengl-registry/all/test_package/test_package.c new file mode 100644 index 0000000000000..a9cb3640b85e1 --- /dev/null +++ b/recipes/opengl-registry/all/test_package/test_package.c @@ -0,0 +1,10 @@ +#include "GL/glcorearb.h" +#include "GL/glext.h" +#include +#include + +int main() { + GLenum value = GL_UNSIGNED_BYTE_3_3_2; + printf("GL_UNSIGNED_BYTE_3_3_2: %x\n", value); + return EXIT_SUCCESS; +} diff --git a/recipes/opengl-registry/all/test_v1_package/CMakeLists.txt b/recipes/opengl-registry/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de3b75d9538de --- /dev/null +++ b/recipes/opengl-registry/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/opengl-registry/all/test_v1_package/conanfile.py b/recipes/opengl-registry/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..90f7a062ba0d0 --- /dev/null +++ b/recipes/opengl-registry/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conans import CMake +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opengl-registry/config.yml b/recipes/opengl-registry/config.yml new file mode 100644 index 0000000000000..0168ee0addf88 --- /dev/null +++ b/recipes/opengl-registry/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20220929": + folder: all diff --git a/recipes/opengl/all/conanfile.py b/recipes/opengl/all/conanfile.py index 264e40ea5e0f0..a7f52cf28c574 100644 --- a/recipes/opengl/all/conanfile.py +++ b/recipes/opengl/all/conanfile.py @@ -1,6 +1,8 @@ from conan import ConanFile -from conan.errors import ConanException -from conans import tools +from conan.tools.system import package_manager +from conan.tools.gnu import PkgConfig + +required_conan_version = ">=1.50.0" class SysConfigOpenGLConan(ConanFile): @@ -11,59 +13,32 @@ class SysConfigOpenGLConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.opengl.org/" license = "MIT" - settings = "os" + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + pass def package_id(self): - self.info.header_only() + self.info.clear() - def _fill_cppinfo_from_pkgconfig(self, name): - pkg_config = tools.PkgConfig(name) - if not pkg_config.provides: - raise ConanException("OpenGL development files aren't available, give up") - libs = [lib[2:] for lib in pkg_config.libs_only_l] - lib_dirs = [lib[2:] for lib in pkg_config.libs_only_L] - ldflags = [flag for flag in pkg_config.libs_only_other] - include_dirs = [include[2:] for include in pkg_config.cflags_only_I] - cflags = [flag for flag in pkg_config.cflags_only_other if not flag.startswith("-D")] - defines = [flag[2:] for flag in pkg_config.cflags_only_other if flag.startswith("-D")] + def system_requirements(self): + dnf = package_manager.Dnf(self) + dnf.install_substitutes(["libglvnd-devel"], ["mesa-libGL-devel"], update=True, check=True) - self.cpp_info.system_libs.extend(libs) - self.cpp_info.libdirs.extend(lib_dirs) - self.cpp_info.sharedlinkflags.extend(ldflags) - self.cpp_info.exelinkflags.extend(ldflags) - self.cpp_info.defines.extend(defines) - self.cpp_info.includedirs.extend(include_dirs) - self.cpp_info.cflags.extend(cflags) - self.cpp_info.cxxflags.extend(cflags) + yum = package_manager.Yum(self) + yum.install(["mesa-libGL-devel"], update=True, check=True) - def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_yum: - if tools.os_info.linux_distro == "fedora" and tools.os_info.os_version >= "32": - packages = ["libglvnd-devel"] - else: - packages = ["mesa-libGL-devel"] - elif tools.os_info.with_apt: - ubuntu_20_or_later = tools.os_info.linux_distro == "ubuntu" and tools.os_info.os_version >= "20" - debian_11_or_later = tools.os_info.linux_distro == "debian" and tools.os_info.os_version >= "11" - pop_os_20_or_later = tools.os_info.linux_distro == "pop" and tools.os_info.os_version >= "20" - if ubuntu_20_or_later or debian_11_or_later or pop_os_20_or_later: - packages = ["libgl-dev"] - else: - packages = ["libgl1-mesa-dev"] - elif tools.os_info.with_pacman: - packages = ["libglvnd"] - elif tools.os_info.with_zypper: - packages = ["Mesa-libGL-devel"] - else: - self.output.warn("Don't know how to install OpenGL for your distro.") - elif tools.os_info.is_freebsd and self.settings.os == "FreeBSD": - packages = ["libglvnd"] - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify') - for p in packages: - package_tool.install(update=True, packages=p) + apt = package_manager.Apt(self) + apt.install_substitutes(["libgl-dev"], ["libgl1-mesa-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["libglvnd"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["Mesa-libGL-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install(["libglvnd"], update=True, check=True) def package_info(self): # TODO: Workaround for #2311 until a better solution can be found @@ -72,6 +47,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "opengl_system") + self.cpp_info.bindirs = [] self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] if self.settings.os == "Macos": @@ -80,4 +56,5 @@ def package_info(self): elif self.settings.os == "Windows": self.cpp_info.system_libs = ["opengl32"] elif self.settings.os in ["Linux", "FreeBSD"]: - self._fill_cppinfo_from_pkgconfig('gl') + pkg_config = PkgConfig(self, 'gl') + pkg_config.fill_cpp_info(self.cpp_info, is_system=self.settings.os != "FreeBSD") diff --git a/recipes/opengl/all/test_cmake_module_package/CMakeLists.txt b/recipes/opengl/all/test_cmake_module_package/CMakeLists.txt new file mode 100644 index 0000000000000..9c1b23a3582d3 --- /dev/null +++ b/recipes/opengl/all/test_cmake_module_package/CMakeLists.txt @@ -0,0 +1,31 @@ +cmake_minimum_required(VERSION 3.10) +project(test_package) + +find_package(OpenGL REQUIRED) + +set(SOURCES ../test_package/test_package.cpp) + +if(WIN32) + list(APPEND SOURCES ../test_package/win.cpp) +endif() + +if(APPLE) + list(APPEND SOURCES ../test_package/osx.mm) + set_source_files_properties(../test_package/osx.mm PROPERTIES COMPILE_FLAGS "-x objective-c++") + + list(APPEND PLATFORM_LIBS "objc") + + find_library(APPKIT_LIBRARY AppKit) + find_library(FOUNDATION_LIBRARY Foundation) + + if(APPKIT_LIBRARY) + list(APPEND PLATFORM_LIBS ${APPKIT_LIBRARY}) + endif() + + if(FOUNDATION_LIBRARY) + list(APPEND PLATFORM_LIBS ${FOUNDATION_LIBRARY}) + endif() +endif() + +add_executable(${PROJECT_NAME} ${SOURCES}) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenGL::GL ${PLATFORM_LIBS}) diff --git a/recipes/opengl/all/test_cmake_module_package/conanfile.py b/recipes/opengl/all/test_cmake_module_package/conanfile.py new file mode 100644 index 0000000000000..3a91c9439218e --- /dev/null +++ b/recipes/opengl/all/test_cmake_module_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opengl/all/test_package/CMakeLists.txt b/recipes/opengl/all/test_package/CMakeLists.txt index 9bda7d9ae1dc3..cedabff6c4ea6 100644 --- a/recipes/opengl/all/test_package/CMakeLists.txt +++ b/recipes/opengl/all/test_package/CMakeLists.txt @@ -1,34 +1,31 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.10) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(opengl_system REQUIRED CONFIG) set(SOURCES test_package.cpp) if(WIN32) -list(APPEND SOURCES win.cpp) + list(APPEND SOURCES win.cpp) endif() if(APPLE) + list(APPEND SOURCES osx.mm) + set_source_files_properties(osx.mm PROPERTIES COMPILE_FLAGS "-x objective-c++") -list(APPEND SOURCES osx.mm) -set_source_files_properties(osx.mm PROPERTIES COMPILE_FLAGS "-x objective-c++") + list(APPEND PLATFORM_LIBS "objc") -list(APPEND PLATFORM_LIBS "objc") + find_library(APPKIT_LIBRARY AppKit) + find_library(FOUNDATION_LIBRARY Foundation) -find_library(APPKIT_LIBRARY AppKit) -find_library(FOUNDATION_LIBRARY Foundation) - -if(APPKIT_LIBRARY) -list(APPEND PLATFORM_LIBS ${APPKIT_LIBRARY}) -endif() - -if(FOUNDATION_LIBRARY) -list(APPEND PLATFORM_LIBS ${FOUNDATION_LIBRARY}) -endif() + if(APPKIT_LIBRARY) + list(APPEND PLATFORM_LIBS ${APPKIT_LIBRARY}) + endif() + if(FOUNDATION_LIBRARY) + list(APPEND PLATFORM_LIBS ${FOUNDATION_LIBRARY}) + endif() endif() add_executable(${PROJECT_NAME} ${SOURCES}) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS} ${PLATFORM_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE opengl::opengl ${PLATFORM_LIBS}) diff --git a/recipes/opengl/all/test_package/conanfile.py b/recipes/opengl/all/test_package/conanfile.py index d4128b0450777..3a91c9439218e 100644 --- a/recipes/opengl/all/test_package/conanfile.py +++ b/recipes/opengl/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opengl/all/test_v1_cmake_module_package/CMakeLists.txt b/recipes/opengl/all/test_v1_cmake_module_package/CMakeLists.txt new file mode 100644 index 0000000000000..1de7a7ee473fd --- /dev/null +++ b/recipes/opengl/all/test_v1_cmake_module_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_cmake_module_package + ${CMAKE_CURRENT_BINARY_DIR}/test_cmake_module_package) diff --git a/recipes/opengl/all/test_v1_cmake_module_package/conanfile.py b/recipes/opengl/all/test_v1_cmake_module_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/opengl/all/test_v1_cmake_module_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opengl/all/test_v1_package/CMakeLists.txt b/recipes/opengl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/opengl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opengl/all/test_v1_package/conanfile.py b/recipes/opengl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/opengl/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opengrm/all/conanfile.py b/recipes/opengrm/all/conanfile.py index 02fe5ca8d989f..a84efefc7e882 100644 --- a/recipes/opengrm/all/conanfile.py +++ b/recipes/opengrm/all/conanfile.py @@ -1,18 +1,22 @@ -import conan +from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.gnu import AutotoolsDeps, AutotoolsToolchain, Autotools -from conans.tools import Version, check_min_cppstd, remove_files_by_mask - -import functools +from conan.tools.build import check_min_cppstd, cross_building +from conan.tools.env import VirtualRunEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -from pathlib import Path -required_conan_version = ">=1.49.0" +required_conan_version = ">=1.53.0" -class OpenGrmConan(conan.ConanFile): +class OpenGrmConan(ConanFile): name = "opengrm" - description = "The OpenGrm Thrax tools compile grammars expressed as regular expressions and context-dependent rewrite rules into weighted finite-state transducers." + description = ( + "The OpenGrm Thrax tools compile grammars expressed as regular expressions " + "and context-dependent rewrite rules into weighted finite-state transducers." + ) topics = ("fst", "wfst", "opengrm", "thrax") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.opengrm.org/twiki/bin/view/GRM/Thrax" @@ -30,102 +34,85 @@ class OpenGrmConan(conan.ConanFile): "enable_bin": True, } - def requirements(self): - self.requires("openfst/1.8.2") - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "7", + } def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") self.options["openfst"].enable_grm = True + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("openfst/1.8.2") + def validate(self): if self.settings.os != "Linux": raise ConanInvalidConfiguration("OpenGrm is only supported on linux") - if not self.options["openfst"].enable_grm: + if not self.dependencies["openfst"].options.enable_grm: raise ConanInvalidConfiguration("OpenGrm requires OpenFst with enable_grm enabled.") - compilers = { - "gcc": "8", - "clang": "7", - } + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - if self.settings.compiler.cppstd: - check_min_cppstd(self, 17) - minimum_compiler = compilers.get(str(self.settings.compiler)) - if minimum_compiler: - if Version(self.settings.compiler.version) < minimum_compiler: - raise ConanInvalidConfiguration(f"{self.name} requires c++17, which your compiler does not support.") - else: - self.output.warn(f"{self.name} requires c++17, but this compiler is unknown to this recipe. Assuming your compiler supports c++17.") + minimum_compiler = self._compilers_minimum_version.get(str(self.settings.compiler)) + if minimum_compiler and Version(self.settings.compiler.version) < minimum_compiler: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) # Check stdlib ABI compatibility if self.settings.compiler == "gcc" and self.settings.compiler.libcxx != "libstdc++11": raise ConanInvalidConfiguration(f'Using {self.name} with GCC requires "compiler.libcxx=libstdc++11"') - if self.settings.compiler == "clang" and self.settings.compiler.libcxx not in ["libstdc++11", "libc++"]: - raise ConanInvalidConfiguration(f'Using {self.name} with Clang requires either "compiler.libcxx=libstdc++11"' - ' or "compiler.libcxx=libc++"') def source(self): - conan.tools.files.get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - @staticmethod - def _yes_no(v): - return "yes" if v else "no" - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - conan.tools.files.patch(**patch) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): - tc = AutotoolsDeps(self) - tc.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" tc.configure_args.extend([ - f"--enable-bin={self._yes_no(self.options.enable_bin)}", + f"--enable-bin={yes_no(self.options.enable_bin)}", "LIBS=-lpthread", ]) tc.make_args.append("-j1") tc.generate() + deps = AutotoolsDeps(self) + deps.generate() + def build(self): - self._patch_sources() autotools = Autotools(self) - autotools.configure(build_script_folder=self._source_subfolder) + autotools.configure() autotools.make() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) autotools = Autotools(self) autotools.install() - - conan.tools.files.rmdir(self, Path(self.package_folder) / "share") - remove_files_by_mask(Path(self.package_folder) / "lib", "*.la") + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) def package_info(self): - self.cpp_info.set_property("cmake_file_name", "OpenGrm") - self.cpp_info.set_property("cmake_target_name", "OpenGrm::OpenGrm") - self.cpp_info.set_property("cmake_find_mode", "both") - self.cpp_info.names["cmake_find_package"] = "OpenGrm" - self.cpp_info.names["cmake_find_package_multi"] = "OpenGrm" - self.cpp_info.libs = ["thrax"] + self.cpp_info.resdirs = ["res"] + self.cpp_info.system_libs = ["pthread", "dl", "m"] + # TODO: to remove in conan v2 if self.options.enable_bin: - bindir = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment var: {bindir}") - self.env_info.PATH.append(bindir) - - self.cpp_info.system_libs = ["pthread", "dl", "m"] + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/opengrm/all/test_package/CMakeLists.txt b/recipes/opengrm/all/test_package/CMakeLists.txt index fc26c923ccf83..9f0abc98d4226 100644 --- a/recipes/opengrm/all/test_package/CMakeLists.txt +++ b/recipes/opengrm/all/test_package/CMakeLists.txt @@ -1,12 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 17) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(OpenGrm REQUIRED CONFIG) +find_package(opengrm REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} OpenGrm::OpenGrm) +target_link_libraries(${PROJECT_NAME} PRIVATE opengrm::opengrm) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/opengrm/all/test_package/conanfile.py b/recipes/opengrm/all/test_package/conanfile.py index 364b9cbe73827..0a6bc68712d90 100644 --- a/recipes/opengrm/all/test_package/conanfile.py +++ b/recipes/opengrm/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -# pylint: skip-file +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opengrm/all/test_v1_package/CMakeLists.txt b/recipes/opengrm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/opengrm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opengrm/all/test_v1_package/conanfile.py b/recipes/opengrm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/opengrm/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opengv/all/CMakeLists.txt b/recipes/opengv/all/CMakeLists.txt deleted file mode 100644 index 2ccaa2e599ec0..0000000000000 --- a/recipes/opengv/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -if(NOT CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CONAN_OPENGV_SYSTEM_PROCESSOR}) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/opengv/all/conandata.yml b/recipes/opengv/all/conandata.yml index 5ed5228ad47c9..4f45e53b7f2aa 100644 --- a/recipes/opengv/all/conandata.yml +++ b/recipes/opengv/all/conandata.yml @@ -2,3 +2,14 @@ sources: "cci.20200806": url: "https://github.com/laurentkneip/opengv/archive/91f4b19c73450833a40e463ad3648aae80b3a7f3.tar.gz" sha256: "b03f61ff597a6c16a32b8939c3e49e9f240ae7b4da3358f1430e9743e093d596" +patches: + "cci.20200806": + - patch_file: "patches/0001-use-conans-pybind11.patch" + patch_description: "fix call to pybind to use conan provided config file" + patch_type: "conan" + - patch_file: "patches/0002-use-conans-eigen.patch" + patch_description: "fix call to find_package to use conan provided file" + patch_type: "conan" + - patch_file: "patches/0003-let-conan-handle-shared-fpic-and-marchs.patch" + patch_description: "disable some options such that conan manages values" + patch_type: "conan" diff --git a/recipes/opengv/all/conanfile.py b/recipes/opengv/all/conanfile.py index f30c29e4d5cc8..34bbe096cc7bc 100644 --- a/recipes/opengv/all/conanfile.py +++ b/recipes/opengv/all/conanfile.py @@ -1,10 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration import os import textwrap -required_conan_version = ">=1.43.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.files import get, copy, rmdir, save, apply_conandata_patches, export_conandata_patches +required_conan_version = ">=1.52.0" class opengvConan(ConanFile): name = "opengv" @@ -13,8 +15,8 @@ class opengvConan(ConanFile): homepage = "https://github.com/laurentkneip/opengv" license = "BSD-3-Clause" topics = ("computer", "vision", "geometric", "pose", "triangulation", "point-cloud") - settings = "os", "arch", "compiler", "build_type" + options = { "shared": [True, False], "fPIC": [True, False], @@ -26,13 +28,8 @@ class opengvConan(ConanFile): "with_python_bindings": False, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -45,81 +42,43 @@ def configure(self): def requirements(self): self.requires("eigen/3.4.0") if self.options.with_python_bindings: - self.requires("pybind11/2.8.1") + self.requires("pybind11/2.10.0") def validate(self): # Disable windows builds since they error out. if self.settings.os == "Windows": raise ConanInvalidConfiguration("Windows builds are not supported by this recipe.") - #FIXME disable this one CCI has more RAM available - if self.settings.compiler == "gcc" and self.options.shared: - raise ConanInvalidConfiguration("Shared builds not supported with gcc since CCI errors out due to excessive memory usage.") - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_PYTHON"] = self.options.with_python_bindings - self._cmake.definitions["BUILD_POSITION_INDEPENDENT_CODE"] = self.settings.os != "Windows" and self.options.get_safe("fPIC", True) - if tools.cross_building(self): - cmake_system_processor = { - "armv8": "aarch64", - "armv8.3": "aarch64", - }.get(str(self.settings.arch), str(self.settings.arch)) - self._cmake.definitions["CONAN_OPENGV_SYSTEM_PROCESSOR"] = cmake_system_processor - self._cmake.configure() - return self._cmake - - def _patch_sources(self): - # Use conan's Eigen - old = """\ - find_package(Eigen REQUIRED) - set(ADDITIONAL_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIR}/unsupported)""" - - new = """\ - find_package(Eigen3 REQUIRED) - set(ADDITIONAL_INCLUDE_DIRS ${Eigen3_INCLUDE_DIRS} ${Eigen3_INCLUDE_DIR}/unsupported)""" - - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - textwrap.dedent(old), - textwrap.dedent(new) - ) + #FIXME this passes locally but fails on CCI with a clang internal error + if self.settings.compiler == "clang" and self.settings.compiler.version == 12: + raise ConanInvalidConfiguration("Clang 12 builds fail on Conan CI.") - # Use conan's pybind11 - tools.replace_in_file(os.path.join(self._source_subfolder, "python", "CMakeLists.txt"), - "add_subdirectory(pybind11)", - "find_package(pybind11 REQUIRED)" - ) + def layout(self): + cmake_layout(self, src_folder="src") - # Let conan handle fPIC / shared - old = """\ - IF(MSVC) - set(BUILD_SHARED_LIBS OFF)""" + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - new = """\ - IF(1) - #set(BUILD_SHARED_LIBS OFF)""" + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_PYTHON"] = self.options.with_python_bindings + tc.variables["BUILD_POSITION_INDEPENDENT_CODE"] = self.settings.os != "Windows" and self.options.get_safe("fPIC", True) + tc.generate() - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - textwrap.dedent(old), - textwrap.dedent(new) - ) + cd = CMakeDeps(self) + cd.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "License.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -127,8 +86,7 @@ def package(self): {"opengv": "opengv::opengv"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -137,7 +95,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): @@ -146,7 +104,7 @@ def _module_file_rel_path(self): def package_info(self): self.cpp_info.set_property("cmake_file_name", "opengv") self.cpp_info.set_property("cmake_target_name", "opengv") - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["opengv"] if self.options.with_python_bindings: opengv_dist_packages = os.path.join(self.package_folder, "lib", "python3", "dist-packages") self.runenv_info.prepend_path("PYTHONPATH", opengv_dist_packages) diff --git a/recipes/opengv/all/patches/0001-use-conans-pybind11.patch b/recipes/opengv/all/patches/0001-use-conans-pybind11.patch new file mode 100644 index 0000000000000..8b5fc6651a5e9 --- /dev/null +++ b/recipes/opengv/all/patches/0001-use-conans-pybind11.patch @@ -0,0 +1,9 @@ +--- python/CMakeLists.txt 2020-08-06 09:02:15.000000000 -0300 ++++ python/CMakeLists.txt 2022-10-06 12:38:05.123192352 -0300 +@@ -1,5 +1,5 @@ + +-add_subdirectory(pybind11) ++find_package(pybind11 REQUIRED) + + include_directories(${PYTHON_INCLUDE_DIRS}) + diff --git a/recipes/opengv/all/patches/0002-use-conans-eigen.patch b/recipes/opengv/all/patches/0002-use-conans-eigen.patch new file mode 100644 index 0000000000000..3acd32a886cf6 --- /dev/null +++ b/recipes/opengv/all/patches/0002-use-conans-eigen.patch @@ -0,0 +1,13 @@ +--- CMakeLists.txt 2020-08-06 09:02:15.000000000 -0300 ++++ CMakeLists.txt 2022-10-06 12:32:08.838766142 -0300 +@@ -54,8 +54,8 @@ + ENDIF() + + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/modules/") +-find_package(Eigen REQUIRED) +-set(ADDITIONAL_INCLUDE_DIRS ${EIGEN_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIR}/unsupported) ++find_package(Eigen3 REQUIRED) ++set(ADDITIONAL_INCLUDE_DIRS ${Eigen3_INCLUDE_DIRS} ${Eigen3_INCLUDE_DIR}/unsupported) + + set( OPENGV_SOURCE_FILES + src/absolute_pose/modules/main.cpp diff --git a/recipes/opengv/all/patches/0003-let-conan-handle-shared-fpic-and-marchs.patch b/recipes/opengv/all/patches/0003-let-conan-handle-shared-fpic-and-marchs.patch new file mode 100644 index 0000000000000..87de75e13c94d --- /dev/null +++ b/recipes/opengv/all/patches/0003-let-conan-handle-shared-fpic-and-marchs.patch @@ -0,0 +1,24 @@ +--- CMakeLists.txt 2020-08-06 09:02:15.000000000 -0300 ++++ CMakeLists.txt 2022-10-06 12:39:57.766560501 -0300 +@@ -19,16 +19,16 @@ + OPTION(BUILD_TESTS "Build tests" ON) + OPTION(BUILD_PYTHON "Build Python extension" OFF) + +-IF(MSVC) +- set(BUILD_SHARED_LIBS OFF) ++IF(1) ++ #set(BUILD_SHARED_LIBS OFF) + ELSE() + OPTION(BUILD_SHARED_LIBS "Build shared libraries" OFF) + OPTION(BUILD_POSITION_INDEPENDENT_CODE "Build position independent code (-fPIC)" ON) + ENDIF() + +-IF(MSVC) +- add_compile_options(/wd4514 /wd4267 /bigobj) +- add_definitions(-D_USE_MATH_DEFINES) ++IF(1) ++ #add_compile_options(/wd4514 /wd4267 /bigobj) ++ #add_definitions(-D_USE_MATH_DEFINES) + ELSE() + IF (CMAKE_SYSTEM_PROCESSOR MATCHES "(arm64)|(ARM64)|(aarch64)|(AARCH64)") + add_definitions (-march=armv8-a) diff --git a/recipes/opengv/all/test_package/CMakeLists.txt b/recipes/opengv/all/test_package/CMakeLists.txt index 93f2ed4e10baf..17768c1b86abd 100644 --- a/recipes/opengv/all/test_package/CMakeLists.txt +++ b/recipes/opengv/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(opengv REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/opengv/all/test_package/conanfile.py b/recipes/opengv/all/test_package/conanfile.py index 38f4483872d47..0a318ba85a952 100644 --- a/recipes/opengv/all/test_package/conanfile.py +++ b/recipes/opengv/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools import os - +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake +from conan.tools.layout import cmake_layout class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opengv/all/test_v1_package/CMakeLists.txt b/recipes/opengv/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..56b29eaba3a22 --- /dev/null +++ b/recipes/opengv/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(opengv REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} opengv) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/opengv/all/test_v1_package/conanfile.py b/recipes/opengv/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/opengv/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/openh264/all/conandata.yml b/recipes/openh264/all/conandata.yml index ecf3f55bbf87a..679b1b0e3b70d 100644 --- a/recipes/openh264/all/conandata.yml +++ b/recipes/openh264/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.3.1": + url: "https://github.com/cisco/openh264/archive/refs/tags/v2.3.1.tar.gz" + sha256: "453afa66dacb560bc5fd0468aabee90c483741571bca820a39a1c07f0362dc32" "2.1.1": url: "https://github.com/cisco/openh264/archive/v2.1.1.tar.gz" sha256: "af173e90fce65f80722fa894e1af0d6b07572292e76de7b65273df4c0a8be678" @@ -6,21 +9,30 @@ sources: url: "https://github.com/cisco/openh264/archive/v1.7.0.tar.gz" sha256: "9c07c38d7de00046c9c52b12c76a2af7648b70d05bd5460c8b67f6895738653f" patches: + "2.3.1": + - patch_file: "patches/2.3.1-0001-platform-android.mk.patch" + patch_type: "portability" + patch_description: "Android Fix" + - patch_file: "patches/2.3.1-0002-macos-relocatable-shared.patch" + patch_type: "portability" + patch_description: "Macos relocatable shared fix" "2.1.1": - patch_file: "patches/2.1.1-0001-platform-android.mk.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Android Fix" - patch_file: "patches/2.1.1-0002-macos-relocatable-shared.patch" - base_path: "source_subfolder" - - patch_file: "patches/2.1.1-0003-no-fpic.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Macos relocatable shared fix" - patch_file: "patches/1.7.0-0004-mingw-override-CC-CXX-AR-from-env.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Mingw Override CC CXX AR from env Fix" "1.7.0": - patch_file: "patches/1.7.0-0001-platform-android.mk.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Android Fix" - patch_file: "patches/1.7.0-0002-macos-relocatable-shared.patch" - base_path: "source_subfolder" - - patch_file: "patches/1.7.0-0003-no-fpic.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Macos relocatable shared fix" - patch_file: "patches/1.7.0-0004-mingw-override-CC-CXX-AR-from-env.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "Mingw Override CC CXX AR from env Fix" diff --git a/recipes/openh264/all/conanfile.py b/recipes/openh264/all/conanfile.py index 0e8cec5d5cffc..0d33427fd3228 100644 --- a/recipes/openh264/all/conanfile.py +++ b/recipes/openh264/all/conanfile.py @@ -1,8 +1,16 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, tools, AutoToolsBuildEnvironment +from conan import ConanFile +from conan.tools.build import stdcpp_library +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, replace_in_file, chdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.apple import is_apple_os, fix_apple_shared_install_name +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc, unix_path, msvc_runtime_flag + import os -required_conan_version = ">=1.33.0" + +required_conan_version = ">=1.57.0" class OpenH264Conan(ConanFile): @@ -24,24 +32,15 @@ class OpenH264Conan(ConanFile): } @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property def _is_clang_cl(self): return self.settings.os == 'Windows' and self.settings.compiler == 'clang' - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -49,48 +48,53 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): if self.settings.arch in ("x86", "x86_64"): - self.build_requires("nasm/2.15.05") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("nasm/2.15.05") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", default=False, check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.tool_requires("automake/1.16.5") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self._is_msvc: - tools.replace_in_file(os.path.join(self._source_subfolder, "build", "platform-msvc.mk"), - "CFLAGS_OPT += -MT", - "CFLAGS_OPT += -{}".format(msvc_runtime_flag(self))) - tools.replace_in_file(os.path.join(self._source_subfolder, "build", "platform-msvc.mk"), - "CFLAGS_DEBUG += -MTd -Gm", - "CFLAGS_DEBUG += -{} -Gm".format(msvc_runtime_flag(self))) + if is_msvc(self): + replace_in_file(self, os.path.join(self.source_folder, "build", "platform-msvc.mk"), + "CFLAGS_OPT += -MT", + f"CFLAGS_OPT += -{msvc_runtime_flag(self)}") + replace_in_file(self, os.path.join(self.source_folder, "build", "platform-msvc.mk"), + "CFLAGS_DEBUG += -MTd -Gm", + f"CFLAGS_DEBUG += -{msvc_runtime_flag(self)} -Gm") if self.settings.os == "Android": - tools.replace_in_file(os.path.join(self._source_subfolder, "codec", "build", "android", "dec", "jni", "Application.mk"), - "APP_STL := stlport_shared", - "APP_STL := {}".format(self.settings.compiler.libcxx)) - tools.replace_in_file(os.path.join(self._source_subfolder, "codec", "build", "android", "dec", "jni", "Application.mk"), - "APP_PLATFORM := android-12", - "APP_PLATFORM := {}".format(self._android_target)) + replace_in_file(self, os.path.join(self.source_folder, "codec", "build", "android", "dec", "jni", "Application.mk"), + "APP_STL := stlport_shared", + f"APP_STL := {self.settings.compiler.libcxx}") + replace_in_file(self, os.path.join(self.source_folder, "codec", "build", "android", "dec", "jni", "Application.mk"), + "APP_PLATFORM := android-12", + f"APP_PLATFORM := {self._android_target}") @property def _library_filename(self): - prefix = "" if (self._is_msvc or self._is_clang_cl) else "lib" + prefix = "" if (is_msvc(self) or self._is_clang_cl) else "lib" if self.options.shared: - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): suffix = ".dylib" elif self.settings.os == "Windows": suffix = ".dll" else: suffix = ".so" else: - if self._is_msvc or self._is_clang_cl: + if is_msvc(self) or self._is_clang_cl: suffix = ".lib" else: suffix = ".a" @@ -102,80 +106,85 @@ def _make_arch(self): "armv7": "arm", "armv8": "arm64", "x86": "i386", - "x86_64": "x86_64", }.get(str(self.settings.arch), str(self.settings.arch)) @property def _android_target(self): - return "android-{}".format(self.settings.os.api_level) + return f"android-{self.settings.os.api_level}" @property def _make_args(self): - prefix = os.path.abspath(self.package_folder) - if tools.os_info.is_windows: - prefix = tools.unix_path(prefix) + prefix = unix_path(self, os.path.abspath(self.package_folder)) args = [ - "ARCH={}".format(self._make_arch), - "PREFIX={}".format(prefix), + f"ARCH={self._make_arch}", + f"PREFIX={prefix}" ] - autotools = AutoToolsBuildEnvironment(self) - if self._is_msvc: - autotools.flags.extend(["-nologo", "-{}".format(self.settings.compiler.runtime)]) - autotools.link_flags.insert(0, "-link") - if not (self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < "12"): - autotools.flags.append("-FS") - elif self.settings.compiler in ("apple-clang",): - if self.settings.arch in ("armv8",): - autotools.link_flags.append("-arch arm64") - if self.options.shared: - autotools.fpic = True - args.extend(["{}={}".format(k, v) for k,v in autotools.vars.items()]) - if self._is_msvc or self._is_clang_cl: + if is_msvc(self) or self._is_clang_cl: args.append("OS=msvc") else: if self.settings.os == "Windows": args.append("OS=mingw_nt") if self.settings.os == "Android": libcxx = str(self.settings.compiler.libcxx) - stl_lib = "$(NDKROOT)/sources/cxx-stl/llvm-libc++/libs/$(APP_ABI)/lib{}".format("c++_static.a" if libcxx == "c++_static" else "c++_shared.so") \ + stl_lib = f'$(NDKROOT)/sources/cxx-stl/llvm-libc++/libs/$(APP_ABI)/lib{"c++_static.a" if libcxx == "c++_static" else "c++_shared.so"}' \ + "$(NDKROOT)/sources/cxx-stl/llvm-libc++/libs/$(APP_ABI)/libc++abi.a" ndk_home = os.environ["ANDROID_NDK_HOME"] args.extend([ - "NDKLEVEL={}".format(self.settings.os.api_level), - "STL_LIB={}".format(stl_lib), + f"NDKLEVEL={self.settings.os.api_level}", + f"STL_LIB={stl_lib}", "OS=android", - "NDKROOT={}".format(ndk_home), # not NDK_ROOT here - "TARGET={}".format(self._android_target), + f"NDKROOT={ndk_home}", # not NDK_ROOT here + f"TARGET={self._android_target}", "CCASFLAGS=$(CFLAGS) -fno-integrated-as", ]) return args + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.make_args.extend(self._make_args) + + if is_msvc(self): + tc.extra_cxxflags.append("-nologo") + if check_min_vs(self, "180", raise_invalid=False): + # https://github.com/conan-io/conan/issues/6514 + tc.extra_cxxflags.append("-FS") + # not needed during and after 2.3.1 + elif self.settings.compiler in ("apple-clang",): + if self.settings.arch in ("armv8",): + tc.extra_ldflags.append("-arch arm64") + tc.generate() + def build(self): + apply_conandata_patches(self) self._patch_sources() - with tools.vcvars(self) if (self._is_msvc or self._is_clang_cl) else tools.no_op(): - with tools.chdir(self._source_subfolder): - env_build = AutoToolsBuildEnvironment(self) - env_build.make(args=self._make_args, target=self._library_filename) + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.make(target=self._library_filename) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - with tools.vcvars(self) if (self._is_msvc or self._is_clang_cl) else tools.no_op(): - with tools.chdir(self._source_subfolder): - env_build = AutoToolsBuildEnvironment(self) - env_build.make(args=self._make_args, target="install-" + ("shared" if self.options.shared else "static-lib")) + copy(self, pattern="LICENSE", dst=os.path.join( + self.package_folder, "licenses"), src=self.source_folder) + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.make( + target=f'install-{"shared" if self.options.shared else "static-lib"}') - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "openh264") - suffix = "_dll" if (self._is_msvc or self._is_clang_cl) and self.options.shared else "" - self.cpp_info.libs = ["openh264{}".format(suffix)] + suffix = "_dll" if ( + is_msvc(self) or self._is_clang_cl) and self.options.shared else "" + self.cpp_info.libs = [f"openh264{suffix}"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs.extend(["m", "pthread"]) if self.settings.os == "Android": self.cpp_info.system_libs.append("m") - libcxx = tools.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/openh264/all/patches/1.7.0-0003-no-fpic.patch b/recipes/openh264/all/patches/1.7.0-0003-no-fpic.patch deleted file mode 100644 index a800538867a6d..0000000000000 --- a/recipes/openh264/all/patches/1.7.0-0003-no-fpic.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- build/platform-linux.mk -+++ build/platform-linux.mk -@@ -6,1 +6,1 @@ --CFLAGS += -Wall -fno-strict-aliasing -fPIC -MMD -MP -+CFLAGS += -Wall -fno-strict-aliasing -MMD -MP ---- build/platform-bsd.mk -+++ build/platform-bsd.mk -@@ -6,1 +6,1 @@ --CFLAGS += -fPIC -+CFLAGS += ---- build/platform-darwin.mk -+++ build/platform-darwin.mk -@@ -13,1 +13,1 @@ --CFLAGS += -Wall -fPIC -MMD -MP -+CFLAGS += -Wall -MMD -MP diff --git a/recipes/openh264/all/patches/2.1.1-0003-no-fpic.patch b/recipes/openh264/all/patches/2.1.1-0003-no-fpic.patch deleted file mode 100644 index 4f34a6048fab1..0000000000000 --- a/recipes/openh264/all/patches/2.1.1-0003-no-fpic.patch +++ /dev/null @@ -1,15 +0,0 @@ ---- build/platform-linux.mk -+++ build/platform-linux.mk -@@ -6,1 +6,1 @@ --CFLAGS += -Wall -fno-strict-aliasing -fPIC -MMD -MP -fstack-protector-all -+CFLAGS += -Wall -fno-strict-aliasing -MMD -MP -fstack-protector-all ---- build/platform-bsd.mk -+++ build/platform-bsd.mk -@@ -6,1 +6,1 @@ --CFLAGS += -fPIC -fstack-protector-all -+CFLAGS += -fstack-protector-all ---- build/platform-darwin.mk -+++ build/platform-darwin.mk -@@ -13,1 +13,1 @@ --CFLAGS += -Wall -fPIC -MMD -MP -fstack-protector-all -+CFLAGS += -Wall -MMD -MP -fstack-protector-all diff --git a/recipes/openh264/all/patches/2.3.1-0001-platform-android.mk.patch b/recipes/openh264/all/patches/2.3.1-0001-platform-android.mk.patch new file mode 100644 index 0000000000000..7b4564ae8dded --- /dev/null +++ b/recipes/openh264/all/patches/2.3.1-0001-platform-android.mk.patch @@ -0,0 +1,21 @@ +--- build/platform-android.mk ++++ build/platform-android.mk +@@ -40,14 +40,9 @@ + TOOLCHAIN_NAME = $(shell NDK_TOOLCHAIN_VERSION= NDK_PROJECT_PATH=$(SRC_PATH)/codec/build/android/dec make --no-print-dir -f $(NDKROOT)/build/core/build-local.mk DUMP_TOOLCHAIN_NAME APP_ABI=$(APP_ABI)) + GCC_TOOLCHAIN_PATH = $(shell dirname $(TOOLCHAINPREFIX) | xargs dirname ) + +-SYSROOT = $(NDKROOT)/platforms/android-$(NDKLEVEL)/arch-$(ARCH) +-CXX = $(TOOLCHAINPREFIX)g++ +-CC = $(TOOLCHAINPREFIX)gcc +-AR = $(TOOLCHAINPREFIX)ar +-CFLAGS += -DANDROID_NDK -fpic --sysroot=$(SYSROOT) -MMD -MP ++CFLAGS += -DANDROID_NDK -fpic -MMD -MP + ifeq ($(USE_STACK_PROTECTOR), Yes) + CFLAGS += -fstack-protector-all + endif + CFLAGS += -isystem $(NDKROOT)/sysroot/usr/include -isystem $(NDKROOT)/sysroot/usr/include/$(TOOLCHAIN_NAME) -D__ANDROID_API__=$(NDKLEVEL) + CXXFLAGS += -fno-rtti -fno-exceptions +-LDFLAGS += --sysroot=$(SYSROOT) + SHLDFLAGS = -Wl,--no-undefined -Wl,-z,relro -Wl,-z,now -Wl,-soname,lib$(PROJECT_NAME).so + UTSHLDFLAGS = -Wl,-soname,libut.so + diff --git a/recipes/openh264/all/patches/2.3.1-0002-macos-relocatable-shared.patch b/recipes/openh264/all/patches/2.3.1-0002-macos-relocatable-shared.patch new file mode 100644 index 0000000000000..7b9b27ea4570a --- /dev/null +++ b/recipes/openh264/all/patches/2.3.1-0002-macos-relocatable-shared.patch @@ -0,0 +1,11 @@ +--- a/build/platform-darwin.mk ++++ b/build/platform-darwin.mk +@@ -7,7 +7,7 @@ CURRENT_VERSION := 2.3.1 + COMPATIBILITY_VERSION := 2.3.1 + SHLDFLAGS = -dynamiclib -twolevel_namespace -undefined dynamic_lookup \ + -fno-common -headerpad_max_install_names -install_name \ +- $(SHAREDLIB_DIR)/$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXMAJORVER) ++ @rpath/$(LIBPREFIX)$(PROJECT_NAME).$(SHAREDLIBSUFFIXMAJORVER) + SHARED = -dynamiclib + SHARED += -current_version $(CURRENT_VERSION) -compatibility_version $(COMPATIBILITY_VERSION) + CFLAGS += -Wall -fPIC -MMD -MP -stdlib=libc++ diff --git a/recipes/openh264/all/test_package/CMakeLists.txt b/recipes/openh264/all/test_package/CMakeLists.txt index f44db9f63be7e..e48438bdd6d7b 100644 --- a/recipes/openh264/all/test_package/CMakeLists.txt +++ b/recipes/openh264/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(openh264 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/openh264/all/test_package/conanfile.py b/recipes/openh264/all/test_package/conanfile.py index 105315b8a9d2f..1a1d9c4ff58f1 100644 --- a/recipes/openh264/all/test_package/conanfile.py +++ b/recipes/openh264/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if not cross_building(self, skip_x64_x86=True): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openh264/all/test_v1_package/CMakeLists.txt b/recipes/openh264/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2f6b1a2f7ec79 --- /dev/null +++ b/recipes/openh264/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/openh264/all/test_v1_package/conanfile.py b/recipes/openh264/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..f4b0754b85efb --- /dev/null +++ b/recipes/openh264/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self, skip_x64_x86=True): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/openh264/config.yml b/recipes/openh264/config.yml index 0d7bbfdc95732..783b155e8bb7a 100644 --- a/recipes/openh264/config.yml +++ b/recipes/openh264/config.yml @@ -1,4 +1,6 @@ versions: + "2.3.1": + folder: all "2.1.1": folder: all "1.7.0": diff --git a/recipes/openjdk/all/conanfile.py b/recipes/openjdk/all/conanfile.py index ca7fe99201c90..3b3d7b50653c4 100644 --- a/recipes/openjdk/all/conanfile.py +++ b/recipes/openjdk/all/conanfile.py @@ -1,8 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import copy, get, symlinks +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" class OpenJDK(ConanFile): @@ -12,42 +13,54 @@ class OpenJDK(ConanFile): homepage = "https://jdk.java.net" license = "GPL-2.0-with-classpath-exception" topics = ("java", "jdk", "openjdk") - settings = "os", "arch" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type - def configure(self): + def validate(self): if self.settings.arch != "x86_64": raise ConanInvalidConfiguration("Unsupported Architecture. This package currently only supports x86_64.") if self.settings.os not in ["Windows", "Macos", "Linux"]: raise ConanInvalidConfiguration("Unsupported os. This package currently only support Linux/Macos/Windows") def build(self): - tools.get(**self.conan_data["sources"][self.version][str(self.settings.os)], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][str(self.settings.os)], + destination=self.source_folder, strip_root=True) def package(self): if self.settings.os == "Macos": - _source_subfolder = os.path.join(self._source_subfolder, "jdk-{}.jdk".format(self.version), "Contents", "Home") + source_folder = os.path.join(self.source_folder, f"jdk-{self.version}.jdk", "Contents", "Home") else: - _source_subfolder = self._source_subfolder - self.copy(pattern="*", dst="bin", src=os.path.join(_source_subfolder, "bin"), - excludes=("msvcp140.dll", "vcruntime140.dll", "vcruntime140_1.dll")) - self.copy(pattern="*", dst="include", src=os.path.join(_source_subfolder, "include")) - self.copy(pattern="*", dst="lib", src=os.path.join(_source_subfolder, "lib")) - self.copy(pattern="*", dst=os.path.join("lib", "jmods"), src=os.path.join(_source_subfolder, "jmods")) - self.copy(pattern="*", dst="licenses", src=os.path.join(_source_subfolder, "legal")) + source_folder = self.source_folder + symlinks.remove_broken_symlinks(self, source_folder) + copy(self, pattern="*", + src=os.path.join(source_folder, "bin"), + dst=os.path.join(self.package_folder, "bin"), + excludes=("msvcp140.dll", "vcruntime140.dll", "vcruntime140_1.dll")) + copy(self, pattern="*", + src=os.path.join(source_folder, "include"), + dst=os.path.join(self.package_folder, "include")) + copy(self, pattern="*", + src=os.path.join(source_folder, "lib"), + dst=os.path.join(self.package_folder, "lib")) + copy(self, pattern="*", + src=os.path.join(source_folder, "jmods"), + dst=os.path.join(self.package_folder, "lib", "jmods")) + copy(self, pattern="*", + src=os.path.join(source_folder, "legal"), + dst=os.path.join(self.package_folder, "licenses")) # conf folder is required for security settings, to avoid # java.lang.SecurityException: Can't read cryptographic policy directory: unlimited # https://github.com/conan-io/conan-center-index/pull/4491#issuecomment-774555069 - self.copy(pattern="*", dst="conf", src=os.path.join(_source_subfolder, "conf")) + copy(self, pattern="*", + src=os.path.join(source_folder, "conf"), + dst=os.path.join(self.package_folder, "conf")) def package_info(self): - self.output.info("Creating JAVA_HOME environment variable with : {0}".format(self.package_folder)) + self.output.info(f"Creating JAVA_HOME environment variable with : {self.package_folder}") self.env_info.JAVA_HOME = self.package_folder - - self.output.info("Appending PATH environment variable with : {0}".format(os.path.join(self.package_folder, "bin"))) + self.buildenv_info.append("JAVA_HOME", self.package_folder) self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/openjdk/all/test_package/conanfile.py b/recipes/openjdk/all/test_package/conanfile.py index 2ca843f3c7b71..79aa1f6d3ba7f 100644 --- a/recipes/openjdk/all/test_package/conanfile.py +++ b/recipes/openjdk/all/test_package/conanfile.py @@ -1,8 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.tools.build import can_run +from conan.errors import ConanException from io import StringIO -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.47.0" class TestPackage(ConanFile): @@ -15,7 +16,7 @@ def build(self): pass # nothing to build, but tests should not warn def test(self): - if not tools.cross_building(self): + if can_run(self): output = StringIO() self.run("java --version", output=output, run_environment=True) print(output.getvalue) diff --git a/recipes/openjdk/all/test_v1_package/conanfile.py b/recipes/openjdk/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e79724dff669e --- /dev/null +++ b/recipes/openjdk/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +from conans import ConanFile, tools +from conans.errors import ConanException +from io import StringIO + + + +class TestPackage(ConanFile): + test_type = "explicit" + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + + def build(self): + pass # nothing to build, but tests should not warn + + def test(self): + if not tools.cross_building(self): + output = StringIO() + self.run("java --version", output=output, run_environment=True) + print(output.getvalue) + version_info = output.getvalue() + if "openjdk" not in version_info: + raise ConanException("java call seems not use the openjdk bin") diff --git a/recipes/openjpeg/all/conanfile.py b/recipes/openjpeg/all/conanfile.py index bc86e099bf7bd..d4b1a9482f6b7 100644 --- a/recipes/openjpeg/all/conanfile.py +++ b/recipes/openjpeg/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.54.0" class OpenjpegConan(ConanFile): @@ -16,6 +16,7 @@ class OpenjpegConan(ConanFile): homepage = "https://github.com/uclouvain/openjpeg" license = "BSD 2-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,8 +30,7 @@ class OpenjpegConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,25 +38,18 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass - - def package_id(self): - del self.info.options.build_codec # not used for the moment + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") + def package_id(self): + del self.info.options.build_codec # not used for the moment + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -76,8 +69,6 @@ def generate(self): tc.variables["BUILD_PKGCONFIG_FILES"] = False tc.variables["OPJ_DISABLE_TPSOT_FIX"] = False tc.variables["OPJ_USE_THREAD"] = True - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): diff --git a/recipes/openjpeg/all/test_package/conanfile.py b/recipes/openjpeg/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/openjpeg/all/test_package/conanfile.py +++ b/recipes/openjpeg/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/openjpeg/all/test_v1_package/CMakeLists.txt b/recipes/openjpeg/all/test_v1_package/CMakeLists.txt index 39ff9e0a1d38d..0d20897301b68 100644 --- a/recipes/openjpeg/all/test_v1_package/CMakeLists.txt +++ b/recipes/openjpeg/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(OpenJPEG REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE openjp2) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/openmesh/all/conanfile.py b/recipes/openmesh/all/conanfile.py index 2b2d6c360f11c..36d307d2c5111 100644 --- a/recipes/openmesh/all/conanfile.py +++ b/recipes/openmesh/all/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rm, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, save from conan.tools.microsoft import is_msvc import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class OpenmeshConan(ConanFile): @@ -14,10 +14,11 @@ class OpenmeshConan(ConanFile): description = "OpenMesh is a generic and efficient data structure for " \ "representing and manipulating polygonal meshes." license = "BSD-3-Clause" - topics = ("openmesh", "mesh", "structure", "geometry") + topics = ("mesh", "structure", "geometry") homepage = "https://www.graphics.rwth-aachen.de/software/openmesh" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,8 +30,7 @@ class OpenmeshConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,18 +38,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -86,17 +85,17 @@ def package(self): def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) + """) save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "OpenMesh") diff --git a/recipes/openmesh/all/test_package/conanfile.py b/recipes/openmesh/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/openmesh/all/test_package/conanfile.py +++ b/recipes/openmesh/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/openmesh/all/test_v1_package/CMakeLists.txt b/recipes/openmesh/all/test_v1_package/CMakeLists.txt index cfbe22375eb78..0d20897301b68 100644 --- a/recipes/openmesh/all/test_v1_package/CMakeLists.txt +++ b/recipes/openmesh/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(OpenMesh REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE OpenMeshCore) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/openmesh/all/test_v1_package/conanfile.py b/recipes/openmesh/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/openmesh/all/test_v1_package/conanfile.py +++ b/recipes/openmesh/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/openssl/1.x.x/conandata.yml b/recipes/openssl/1.x.x/conandata.yml index b4834a9996ead..d35e2ee74b6f2 100644 --- a/recipes/openssl/1.x.x/conandata.yml +++ b/recipes/openssl/1.x.x/conandata.yml @@ -1,44 +1,45 @@ sources: 1.0.2u: sha256: ecd0c6ffb493dd06707d38b14bb4d8c2288bb7033735606569d8f90f89669d16 - url: [ - "https://www.openssl.org/source/openssl-1.0.2u.tar.gz", - "https://www.openssl.org/source/old/openssl-1.0.2u.tar.gz" - ] + url: + - "https://www.openssl.org/source/openssl-1.0.2u.tar.gz" + - "https://www.openssl.org/source/old/1.0.2/openssl-1.0.2u.tar.gz" 1.1.0l: sha256: 74a2f756c64fd7386a29184dc0344f4831192d61dc2481a93a4c5dd727f41148 - url: [ - "https://www.openssl.org/source/openssl-1.1.0l.tar.gz", - "https://www.openssl.org/source/old/openssl-1.1.0l.tar.gz" - ] - 1.1.1o: - sha256: 9384a2b0570dd80358841464677115df785edb941c71211f75076d72fe6b438f - url: [ - "https://www.openssl.org/source/openssl-1.1.1o.tar.gz", - "https://www.openssl.org/source/old/openssl-1.1.1o.tar.gz" - ] - 1.1.1p: - sha256: bf61b62aaa66c7c7639942a94de4c9ae8280c08f17d4eac2e44644d9fc8ace6f - url: [ - "https://www.openssl.org/source/openssl-1.1.1p.tar.gz", - "https://www.openssl.org/source/old/openssl-1.1.1p.tar.gz" - ] + url: + - "https://www.openssl.org/source/openssl-1.1.0l.tar.gz" + - "https://www.openssl.org/source/old/1.1.0/openssl-1.1.0l.tar.gz" 1.1.1q: sha256: d7939ce614029cdff0b6c20f0e2e5703158a489a72b2507b8bd51bf8c8fd10ca - url: [ - "https://www.openssl.org/source/openssl-1.1.1q.tar.gz", - "https://www.openssl.org/source/old/openssl-1.1.1q.tar.gz" - ] + url: + - "https://www.openssl.org/source/openssl-1.1.1q.tar.gz" + - "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1q.tar.gz" + 1.1.1s: + sha256: c5ac01e760ee6ff0dab61d6b2bbd30146724d063eb322180c6f18a6f74e4b6aa + url: + - "https://www.openssl.org/source/openssl-1.1.1s.tar.gz" + - "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1s.tar.gz" + - "https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1s/openssl-1.1.1s.tar.gz" + 1.1.1t: + sha256: 8dee9b24bdb1dcbf0c3d1e9b02fb8f6bf22165e807f45adeb7c9677536859d3b + url: + - "https://www.openssl.org/source/openssl-1.1.1t.tar.gz" + - "https://www.openssl.org/source/old/1.1.1/openssl-1.1.1t.tar.gz" + - "https://github.com/openssl/openssl/releases/download/OpenSSL_1_1_1t/openssl-1.1.1t.tar.gz" patches: 1.0.2u: - patch_file: patches/1.0.2u-darwin-arm64.patch - base_path: source_subfolder - 1.1.1o: + patch_description: "Darwin ARM64 support" + patch_type: "portability" + 1.1.1q: - patch_file: patches/1.1.1-tvos-watchos.patch - base_path: source_subfolder - 1.1.1p: + patch_description: "TVOS and WatchOS don't like fork()" + patch_type: "portability" + 1.1.1s: - patch_file: patches/1.1.1-tvos-watchos.patch - base_path: source_subfolder - 1.1.1q: + patch_description: "TVOS and WatchOS don't like fork()" + patch_type: "portability" + 1.1.1t: - patch_file: patches/1.1.1-tvos-watchos.patch - base_path: source_subfolder + patch_description: "TVOS and WatchOS don't like fork()" + patch_type: "portability" diff --git a/recipes/openssl/1.x.x/conanfile.py b/recipes/openssl/1.x.x/conanfile.py index 8483f75ebb8be..4a1bb6ee9b0f6 100644 --- a/recipes/openssl/1.x.x/conanfile.py +++ b/recipes/openssl/1.x.x/conanfile.py @@ -1,22 +1,30 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os, XCRun from conan.tools.build import cross_building -from conan.tools.files import rename, get, rmdir -from conan.tools.microsoft import is_msvc, msvc_runtime_flag -from conans import AutoToolsBuildEnvironment, tools +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, chdir, copy, export_conandata_patches, + get, load, rename, replace_in_file, rm, rmdir, save +) +from conan.tools.gnu import Autotools, AutotoolsToolchain, AutotoolsDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, unix_path +from conan.tools.scm import Version from contextlib import contextmanager from functools import total_ordering import fnmatch +import json import os import textwrap -required_conan_version = ">=1.47.0" - +required_conan_version = ">=1.53.0" @total_ordering -class OpenSSLVersion(object): - def __init__(self, version_str): +class OpenSSLVersion: + def __init__(self, version): self._pre = "" + version_str = str(version) tokens = version_str.split("-") if len(tokens) > 1: @@ -59,7 +67,7 @@ def compare(self, other): other = OpenSSLVersion(other) if self.as_list == other.as_list: return 0 - elif self.as_list < other.as_list: + if self.as_list < other.as_list: return -1 else: return 1 @@ -67,6 +75,7 @@ def compare(self, other): class OpenSSLConan(ConanFile): name = "openssl" + package_type = "library" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/openssl/openssl" license = "OpenSSL" @@ -136,19 +145,13 @@ class OpenSSLConan(ConanFile): "no_tls1": [True, False], "capieng_dialog": [True, False], "enable_capieng": [True, False], - "openssldir": "ANY", + "openssldir": ["ANY", None] } default_options = {key: False for key in options.keys()} default_options["fPIC"] = True default_options["no_md2"] = True default_options["openssldir"] = None - _env_build = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _is_clangcl(self): return self.settings.compiler == "clang" and self.settings.os == "Windows" @@ -169,15 +172,8 @@ def _settings_build(self): def _full_version(self): return OpenSSLVersion(self.version) - @property - def _win_bash(self): - return self._settings_build.os == "Windows" and \ - not self._use_nmake and \ - (self._is_mingw or cross_building(self, skip_x64_x86=True)) - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self._full_version >= "1.1.0": @@ -223,13 +219,16 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - if self._full_version < "1.1.0" and self.options.get_safe("no_zlib") == False: - self.requires("zlib/1.2.12") + if self._full_version < "1.1.0" and not self.options.get_safe("no_zlib"): + self.requires("zlib/1.2.13") def validate(self): if self.settings.os == "Emscripten": @@ -238,16 +237,52 @@ def validate(self): def build_requirements(self): if self._settings_build.os == "Windows": - if not self._win_bash: - self.build_requires("strawberryperl/5.30.0.1") - if not self.options.no_asm and not tools.which("nasm"): - self.build_requires("nasm/2.15.05") - if self._win_bash and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not self.options.no_asm: + self.tool_requires("nasm/2.15.05") + if self._use_nmake: + self.tool_requires("strawberryperl/5.32.1.1") + else: + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + destination=self.source_folder, strip_root=True) + + def generate(self): + VirtualBuildEnv(self).generate() + + tc = AutotoolsToolchain(self) + # workaround for random error: size too large (archive member extends past the end of the file) + # /Library/Developer/CommandLineTools/usr/bin/ar: internal ranlib command failed + if self.settings.os == "Macos" and self._full_version < "1.1.0": + tc.make_args = ["-j1"] + # 1.1.0 era Makefiles don't do well with parallel installs + if not self._use_nmake and self._full_version >= "1.1.0" and self._full_version < "1.1.1": + tc.make_args = ["-j1"] + if self.settings.os == "Macos" and not cross_building(self): + tc.extra_cflags = [f"-isysroot {XCRun(self).sdk_path}"] + tc.extra_cxxflags = [f"-isysroot {XCRun(self).sdk_path}"] + tc.extra_ldflags = [f"-isysroot {XCRun(self).sdk_path}"] + env = tc.environment() + env.define("PERL", self._perl) + tc.generate(env) + gen_info = {} + gen_info["CFLAGS"] = tc.cflags + gen_info["CXXFLAGS"] = tc.cxxflags + gen_info["DEFINES"] = tc.defines + gen_info["LDFLAGS"] = tc.ldflags + if self._full_version < "1.1.0" and not self.options.get_safe("no_zlib"): + zlib_cpp_info = self.dependencies["zlib"].cpp_info.aggregated_components() + gen_info["zlib_include_path"] = zlib_cpp_info.includedirs[0] + if self.settings.os == "Windows": + gen_info["zlib_lib_path"] = f"{zlib_cpp_info.libdirs[0]}/{zlib_cpp_info.libs[0]}.lib" + else: + gen_info["zlib_lib_path"] = zlib_cpp_info.libdirs[0] # Just path, linux will find the right file + save(self, "gen_info.conf", json.dumps(gen_info)) + tc = AutotoolsDeps(self) + tc.generate() @property def _target_prefix(self): @@ -280,7 +315,7 @@ def _perlasm_scheme(self): "armv8_32": "ios64", "armv8.3": "ios64", "armv7k": "ios32"}.get(the_arch, None) - elif the_os == "Android": + if the_os == "Android": return {"armv7": "void", "armv8": "linux64", "mips": "o32", @@ -291,6 +326,8 @@ def _perlasm_scheme(self): @property def _asm_target(self): + # FIXME This function is broken since https://github.com/conan-io/conan-center-index/pull/791 + # either it returns None (because the_os is not a key of the map below), or it does not return the_os = str(self.settings.os) if the_os in ["Android", "iOS", "watchOS", "tvOS"]: return { @@ -444,14 +481,14 @@ def _tool(self, env_name, apple_name): if env_name in os.environ: return os.environ[env_name] if self.settings.compiler == "apple-clang": - return getattr(tools.XCRun(self.settings), apple_name) + return getattr(XCRun(self), apple_name) return None def _patch_configure(self): # since _patch_makefile_org will replace binutils variables # use a more restricted regular expresion to prevent that Configure script trying to do it again - configure = os.path.join(self._source_subfolder, "Configure") - tools.replace_in_file(configure, r"s/^AR=\s*ar/AR= $ar/;", r"s/^AR=\s*ar\b/AR= $ar/;") + configure = os.path.join(self.source_folder, "Configure") + replace_in_file(self, configure, r"s/^AR=\s*ar/AR= $ar/;", r"s/^AR=\s*ar\b/AR= $ar/;",encoding="latin_1") def _adjust_path(self, path): return path.replace("\\", "/") if self._settings_build.os == "Windows" else path @@ -459,43 +496,36 @@ def _adjust_path(self, path): def _patch_makefile_org(self): # https://wiki.openssl.org/index.php/Compilation_and_Installation#Modifying_Build_Settings # its often easier to modify Configure and Makefile.org rather than trying to add targets to the configure scripts - makefile_org = os.path.join(self._source_subfolder, "Makefile.org") - env_build = self._get_env_build() - with tools.environment_append(env_build.vars): - if not "CROSS_COMPILE" in os.environ: - cc = os.environ.get("CC", "cc") - tools.replace_in_file(makefile_org, "CC= cc\n", "CC= %s %s\n" % (self._adjust_path(cc), os.environ["CFLAGS"])) - if "AR" in os.environ: - tools.replace_in_file(makefile_org, "AR=ar $(ARFLAGS) r\n", "AR=%s $(ARFLAGS) r\n" % self._adjust_path(os.environ["AR"])) - if "RANLIB" in os.environ: - tools.replace_in_file(makefile_org, "RANLIB= ranlib\n", "RANLIB= %s\n" % self._adjust_path(os.environ["RANLIB"])) - rc = os.environ.get("WINDRES", os.environ.get("RC")) - if rc: - tools.replace_in_file(makefile_org, "RC= windres\n", "RC= %s\n" % self._adjust_path(rc)) - if "NM" in os.environ: - tools.replace_in_file(makefile_org, "NM= nm\n", "NM= %s\n" % self._adjust_path(os.environ["NM"])) - if "AS" in os.environ: - tools.replace_in_file(makefile_org, "AS=$(CC) -c\n", "AS=%s\n" % self._adjust_path(os.environ["AS"])) - - def _get_env_build(self): - if not self._env_build: - self._env_build = AutoToolsBuildEnvironment(self) - return self._env_build + makefile_org = os.path.join(self.source_folder, "Makefile.org") + if not "CROSS_COMPILE" in os.environ: + cc = os.environ.get("CC", "cc") + gen_info = json.loads(load(self, os.path.join(self.generators_folder, "gen_info.conf"))) + replace_in_file(self, makefile_org, "CC= cc\n", "CC= %s %s\n" % (self._adjust_path(cc), gen_info["CFLAGS"])) + if "AR" in os.environ: + replace_in_file(self, makefile_org, "AR=ar $(ARFLAGS) r\n", "AR=%s $(ARFLAGS) r\n" % self._adjust_path(os.environ["AR"])) + if "RANLIB" in os.environ: + replace_in_file(self, makefile_org, "RANLIB= ranlib\n", "RANLIB= %s\n" % self._adjust_path(os.environ["RANLIB"])) + rc = os.environ.get("WINDRES", os.environ.get("RC")) + if rc: + replace_in_file(self, makefile_org, "RC= windres\n", "RC= %s\n" % self._adjust_path(rc)) + if "NM" in os.environ: + replace_in_file(self, makefile_org, "NM= nm\n", "NM= %s\n" % self._adjust_path(os.environ["NM"])) + if "AS" in os.environ: + replace_in_file(self, makefile_org, "AS=$(CC) -c\n", "AS=%s\n" % self._adjust_path(os.environ["AS"])) def _get_default_openssl_dir(self): if self.settings.os == "Linux" and self._full_version >= "1.1.0": return "/etc/ssl" - return os.path.join(self.package_folder, "res") + return "res" @property def _configure_args(self): openssldir = self.options.openssldir or self._get_default_openssl_dir() - prefix = tools.unix_path(self.package_folder) if self._win_bash else self.package_folder - openssldir = tools.unix_path(openssldir) if self._win_bash else openssldir + openssldir = unix_path(self, openssldir) if self.win_bash else openssldir args = [ '"%s"' % (self._target if self._full_version >= "1.1.0" else self._ancestor_target), "shared" if self.options.shared else "no-shared", - "--prefix=\"%s\"" % prefix, + "--prefix=/", "--openssldir=\"%s\"" % openssldir, "no-unit-test", "no-threads" if self.options.no_threads else "threads" @@ -507,6 +537,8 @@ def _configure_args(self): if self._full_version >= "1.1.0": args.append("--debug" if self.settings.build_type == "Debug" else "--release") + args.append("--libdir=lib") # See https://github.com/openssl/openssl/blob/master/INSTALL.md#libdir + if self.settings.os in ["tvOS", "watchOS"]: args.append(" -DNO_FORK") # fork is not available on tvOS and watchOS if self.settings.os == "Android": @@ -532,17 +564,14 @@ def _configure_args(self): if self.options.get_safe("no_zlib"): args.append("no-zlib") else: - zlib_info = self.deps_cpp_info["zlib"] - include_path = zlib_info.include_paths[0] - if self.settings.os == "Windows": - lib_path = "%s/%s.lib" % (zlib_info.lib_paths[0], zlib_info.libs[0]) - else: - lib_path = zlib_info.lib_paths[0] # Just path, linux will find the right file + gen_info = json.loads(load(self, os.path.join(self.generators_folder, "gen_info.conf"))) + include_path = gen_info["zlib_include_path"] + lib_path = gen_info["zlib_lib_path"] # clang-cl doesn't like backslashes in #define CFLAGS (builldinf.h -> cversion.c) include_path = self._adjust_path(include_path) - lib_path = self._adjust_path(lib_path) + lib_path = self._adjust_path(lib_path) - if self.options["zlib"].shared: + if self.dependencies["zlib"].options.shared: args.append("zlib-dynamic") else: args.append("zlib") @@ -550,9 +579,12 @@ def _configure_args(self): args.extend(['--with-zlib-include="%s"' % include_path, '--with-zlib-lib="%s"' % lib_path]) - - for option_name in self.options.values.fields: - activated = getattr(self.options, option_name) + if Version(conan_version).major < 2: + possible_values = self.options.values.fields + else: + possible_values = self.options.possible_values + for option_name in possible_values: + activated = self.options.get_safe(option_name) if activated and option_name not in ["fPIC", "openssldir", "capieng_dialog", "enable_capieng", "no_md2"]: self.output.info("activated option: %s" % option_name) args.append(option_name.replace("_", "-")) @@ -578,11 +610,12 @@ def _create_targets(self): }}, ); """ + gen_info = json.loads(load(self, os.path.join(self.generators_folder, "gen_info.conf"))) + self.output.info(f"gen_info = {gen_info}") cflags = [] cxxflags = [] - env_build = self._get_env_build() - cflags.extend(env_build.vars_dict["CFLAGS"]) - cxxflags.extend(env_build.vars_dict["CXXFLAGS"]) + cflags.extend(gen_info["CFLAGS"]) + cxxflags.extend(gen_info["CXXFLAGS"]) cc = self._tool("CC", "cc") cxx = self._tool("CXX", "cxx") @@ -596,13 +629,11 @@ def _create_targets(self): cc = 'cc => "%s",' % cc if cc else "" cxx = 'cxx => "%s",' % cxx if cxx else "" ar = 'ar => "%s",' % ar if ar else "" - defines = " ".join(env_build.defines) - defines = 'defines => add("%s"),' % defines if defines else "" + defines = ", ".join(f'"{d}"' for d in gen_info["DEFINES"]) + defines = 'defines => add([%s]),' % defines if defines else "" ranlib = 'ranlib => "%s",' % ranlib if ranlib else "" targets = "my %targets" if self._full_version >= "1.1.1" else "%targets" - includes = ", ".join(['"%s"' % include for include in env_build.include_paths]) - if self.settings.os == "Windows": - includes = includes.replace('\\', '/') # OpenSSL doesn't like backslashes + includes = "" if self._asm_target: ancestor = '[ "%s", asm("%s") ]' % (self._ancestor_target, self._asm_target) @@ -613,7 +644,7 @@ def _create_targets(self): shared_target = '' if self.settings.os == 'Neutrino': if self.options.shared: - shared_extension = 'shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",' + shared_extension = r'shared_extension => ".so.\$(SHLIB_VERSION_NUMBER)",' shared_target = 'shared_target => "gnu-shared",' if self.options.get_safe("fPIC", True): shared_cflag='shared_cflag => "-fPIC",' @@ -633,101 +664,22 @@ def _create_targets(self): shared_target=shared_target, shared_extension=shared_extension, shared_cflag=shared_cflag, - lflags=" ".join(env_build.link_flags)) + lflags=" ".join(gen_info["LDFLAGS"])) self.output.info("using target: %s -> %s" % (self._target, self._ancestor_target)) self.output.info(config) - tools.save(os.path.join(self._source_subfolder, "Configurations", "20-conan.conf"), config) - - def _run_make(self, targets=None, makefile=None, parallel=True): - command = [self._make_program] - if makefile: - command.extend(["-f", makefile]) - if targets: - command.extend(targets) - if not self._use_nmake: - # workaround for random error: size too large (archive member extends past the end of the file) - # /Library/Developer/CommandLineTools/usr/bin/ar: internal ranlib command failed - if self.settings.os == "Macos" and self._full_version < "1.1.0": - parallel = False - - # Building in parallel for versions less than 1.0.2d causes errors - # See https://github.com/openssl/openssl/issues/298 - if self._full_version < "1.0.2d": - parallel = False - command.append(("-j%s" % tools.cpu_count()) if parallel else "-j1") - self.run(" ".join(command), win_bash=self._win_bash) + save(self, os.path.join(self.source_folder, "Configurations", "20-conan.conf"), config) @property def _perl(self): - if self._settings_build.os == "Windows" and not self._win_bash: - # enforce strawberry perl, otherwise wrong perl could be used (from Git bash, MSYS, etc.) - if "strawberryperl" in self.deps_cpp_info.deps: - return os.path.join(self.deps_cpp_info["strawberryperl"].rootpath, "bin", "perl.exe") - elif hasattr(self, "user_info_build") and "strawberryperl" in self.user_info_build: - return self.user_info_build["strawberryperl"].perl + if self._use_nmake: + return self.dependencies.build["strawberryperl"].conf_info.get("user.strawberryperl:perl", check_type=str) return "perl" @property def _nmake_makefile(self): return r"ms\ntdll.mak" if self.options.shared else r"ms\nt.mak" - def _make(self): - with tools.chdir(self._source_subfolder): - # workaround for clang-cl not producing .pdb files - if self._is_clangcl: - tools.save("ossl_static.pdb", "") - args = " ".join(self._configure_args) - self.output.info(self._configure_args) - - if self._use_nmake and self._full_version >= "1.1.0": - self._replace_runtime_in_file(os.path.join("Configurations", "10-main.conf")) - - self.run('{perl} ./Configure {args}'.format(perl=self._perl, args=args), win_bash=self._win_bash) - - self._patch_install_name() - - if self._use_nmake and self._full_version < "1.1.0": - if not self.options.no_asm and self.settings.arch == "x86": - self.run(r"ms\do_nasm") - else: - self.run(r"ms\do_ms" if self.settings.arch == "x86" else r"ms\do_win64a") - - self._replace_runtime_in_file(os.path.join("ms", "nt.mak")) - self._replace_runtime_in_file(os.path.join("ms", "ntdll.mak")) - if self.settings.arch == "x86": - tools.replace_in_file(os.path.join("ms", "nt.mak"), "-WX", "") - tools.replace_in_file(os.path.join("ms", "ntdll.mak"), "-WX", "") - - self._run_make(makefile=self._nmake_makefile) - else: - self._run_make() - - def _make_install(self): - with tools.chdir(self._source_subfolder): - # workaround for MinGW (https://github.com/openssl/openssl/issues/7653) - if not os.path.isdir(os.path.join(self.package_folder, "bin")): - os.makedirs(os.path.join(self.package_folder, "bin")) - - if self._use_nmake and self._full_version < "1.1.0": - self._run_make(makefile=self._nmake_makefile, targets=["install"], parallel=False) - else: - self._run_make(targets=["install_sw"], parallel=False) - - @property - def _cc(self): - if "CROSS_COMPILE" in os.environ: - return "gcc" - if "CC" in os.environ: - return os.environ["CC"] - if self.settings.compiler == "apple-clang": - return tools.XCRun(self.settings).find("clang") - elif self.settings.compiler == "clang": - return "clang" - elif self.settings.compiler == "gcc": - return "gcc" - return "cc" - @contextmanager def _make_context(self): if self._use_nmake: @@ -736,93 +688,137 @@ def _make_context(self): # break nmake (don't know about mingw make). So we fix them def sanitize_env_var(var): return '"{}"'.format(var).replace('/', '\\') if '"' not in var else var - env = {key: sanitize_env_var(tools.get_env(key)) for key in ("CC", "RC") if tools.get_env(key)} - with tools.environment_append(env): + env = Environment() + for key in ("CC", "RC"): + if os.getenv(key): + env.define(key, sanitize_env_var(os.getenv(key))) + with env.vars(self).apply(): yield else: yield def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with tools.vcvars(self.settings) if self._use_nmake else tools.no_op(): - env_vars = {"PERL": self._perl} - if self._full_version < "1.1.0": - cflags = " ".join(self._get_env_build().vars_dict["CFLAGS"]) - env_vars["CC"] = "%s %s" % (self._cc, cflags) - if self.settings.compiler == "apple-clang": - xcrun = tools.XCRun(self.settings) - env_vars["CROSS_SDK"] = os.path.basename(xcrun.sdk_path) - env_vars["CROSS_TOP"] = os.path.dirname(os.path.dirname(xcrun.sdk_path)) - with tools.environment_append(env_vars): - if self._full_version > "1.1.0": - self._create_targets() + apply_conandata_patches(self) + autotools = Autotools(self) + if self._full_version >= "1.1.0": + self._create_targets() + else: + self._patch_configure() + self._patch_makefile_org() + with self._make_context(): + with chdir(self, self.source_folder): + # workaround for clang-cl not producing .pdb files + if self._is_clangcl: + save(self, "ossl_static.pdb", "") + args = " ".join(self._configure_args) + self.output.info(self._configure_args) + + if self._use_nmake and self._full_version >= "1.1.0": + self._replace_runtime_in_file(os.path.join("Configurations", "10-main.conf")) + + self.run(f'{self._perl} ./Configure {args}') + + self._patch_install_name() + + if not self._use_nmake: + autotools.make() else: - self._patch_configure() - self._patch_makefile_org() - with self._make_context(): - self._make() + if self._full_version >= "1.1.0": + self.run('nmake /F Makefile') + else: # nmake 1.0.2 support + # Note: 1.0.2 should not be used according to the OpenSSL Project + # See https://www.openssl.org/source/ - @property - def _make_program(self): - if self._use_nmake: - return "nmake" - make_program = tools.get_env("CONAN_MAKE_PROGRAM", tools.which("make") or tools.which('mingw32-make')) - make_program = tools.unix_path(make_program) if self._settings_build.os == "Windows" else make_program - if not make_program: - raise Exception('could not find "make" executable. please set "CONAN_MAKE_PROGRAM" environment variable') - return make_program + if not self.options.no_asm and self.settings.arch == "x86": + self.run(r"ms\do_nasm") + else: + self.run(r"ms\do_ms" if self.settings.arch == "x86" else r"ms\do_win64a") + + self._replace_runtime_in_file(os.path.join("ms", "nt.mak")) + self._replace_runtime_in_file(os.path.join("ms", "ntdll.mak")) + if self.settings.arch == "x86": + replace_in_file(self, os.path.join("ms", "nt.mak"), "-WX", "") + replace_in_file(self, os.path.join("ms", "ntdll.mak"), "-WX", "") + + # NMAKE interprets trailing backslash as line continuation + replace_in_file(self, self._nmake_makefile, 'INSTALLTOP=\\', 'INSTALLTOP=/') + + self.run(f'nmake /F {self._nmake_makefile}') def _patch_install_name(self): - if tools.is_apple_os(self.settings.os) and self.options.shared: + if is_apple_os(self) and self.options.shared: old_str = '-install_name $(INSTALLTOP)/$(LIBDIR)/' new_str = '-install_name @rpath/' - makefile = "Makefile" if self._full_version >= "1.1.1" else "Makefile.shared" - tools.replace_in_file(makefile, old_str, new_str, strict=self.in_local_cache) + replace_in_file(self, makefile, old_str, new_str) + if self._use_nmake: + # NMAKE interprets trailing backslash as line continuation + if self._full_version >= "1.1.0": + replace_in_file(self, "Makefile", 'INSTALLTOP_dir=\\', 'INSTALLTOP_dir=/') def _replace_runtime_in_file(self, filename): runtime = msvc_runtime_flag(self) for e in ["MDd", "MTd", "MD", "MT"]: - tools.replace_in_file(filename, "/{} ".format(e), "/{} ".format(runtime), strict=False) - tools.replace_in_file(filename, "/{}\"".format(e), "/{}\"".format(runtime), strict=False) + replace_in_file(self, filename, "/{} ".format(e), "/{} ".format(runtime), strict=False) + replace_in_file(self, filename, "/{}\"".format(e), "/{}\"".format(runtime), strict=False) def package(self): - self.copy(src=self._source_subfolder, pattern="*LICENSE", dst="licenses") - with tools.vcvars(self.settings) if self._use_nmake else tools.no_op(): - self._make_install() - for root, _, files in os.walk(self.package_folder): - for filename in files: - if fnmatch.fnmatch(filename, "*.pdb"): - os.unlink(os.path.join(self.package_folder, root, filename)) + copy(self, "*LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses"), keep_path=False) if self._use_nmake: - if self.settings.build_type == 'Debug' and self._full_version >= "1.1.0": - with tools.chdir(os.path.join(self.package_folder, 'lib')): + args = [] + if self._full_version >= "1.1.0": + target = "install_sw" + args.append(f"DESTDIR={self.package_folder}") + else: # 1.0.2 support + target = "install" + args.append(f"INSTALLTOP={self.package_folder}") + openssldir = self.options.openssldir or self._get_default_openssl_dir() + args.append(f"OPENSSLDIR={os.path.join(self.package_folder, openssldir)}") + + with chdir(self, self.source_folder): + if self._full_version >= "1.1.0": + self.run(f'nmake -f Makefile {target} {" ".join(args)}') + else: # 1.0.2 support + self.run(f'nmake -f {self._nmake_makefile} {target} {" ".join(args)}') + rm(self, "*.pdb", self.package_folder, recursive=True) + if self.settings.build_type == "Debug" and self._full_version >= "1.1.0": + with chdir(self, os.path.join(self.package_folder, "lib")): rename(self, "libssl.lib", "libssld.lib") rename(self, "libcrypto.lib", "libcryptod.lib") - # Old OpenSSL version family has issues with permissions. - # See https://github.com/conan-io/conan/issues/5831 - if self._full_version < "1.1.0" and self.options.shared and self.settings.os in ("Android", "FreeBSD", "Linux"): - with tools.chdir(os.path.join(self.package_folder, "lib")): - os.chmod("libssl.so.1.0.0", 0o755) - os.chmod("libcrypto.so.1.0.0", 0o755) + else: + autotools = Autotools(self) + args = [] + target = "install_sw" + if self._full_version >= "1.1.0": + args.append(f"DESTDIR={unix_path(self, self.package_folder)}") + else: # 1.0.2 support + args.append(f"INSTALL_PREFIX={unix_path(self, self.package_folder)}") + + with chdir(self, self.source_folder): + autotools.make(target=target, args=args) + + # Old OpenSSL version family has issues with permissions. + # See https://github.com/conan-io/conan/issues/5831 + if self._full_version < "1.1.0" and self.options.shared and self.settings.os in ("Android", "FreeBSD", "Linux"): + with chdir(self, os.path.join(self.package_folder, "lib")): + os.chmod("libssl.so.1.0.0", 0o755) + os.chmod("libcrypto.so.1.0.0", 0o755) - if self.options.shared: - libdir = os.path.join(self.package_folder, "lib") - for file in os.listdir(libdir): - if self._is_mingw and file.endswith(".dll.a"): - continue - if file.endswith(".a"): - os.unlink(os.path.join(libdir, file)) + if self.options.shared: + libdir = os.path.join(self.package_folder, "lib") + for file in os.listdir(libdir): + if self._is_mingw and file.endswith(".dll.a"): + continue + if file.endswith(".a"): + os.unlink(os.path.join(libdir, file)) - rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_file_rel_path) ) - @staticmethod - def _create_cmake_module_variables(module_file): + def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ set(OPENSSL_FOUND TRUE) if(DEFINED OpenSSL_INCLUDE_DIR) @@ -834,6 +830,12 @@ def _create_cmake_module_variables(module_file): ${OpenSSL_Crypto_DEPENDENCIES} ${OpenSSL_Crypto_FRAMEWORKS} ${OpenSSL_Crypto_SYSTEM_LIBS}) + elseif(DEFINED openssl_OpenSSL_Crypto_LIBS_%(config)s) + set(OPENSSL_CRYPTO_LIBRARY ${openssl_OpenSSL_Crypto_LIBS_%(config)s}) + set(OPENSSL_CRYPTO_LIBRARIES ${openssl_OpenSSL_Crypto_LIBS_%(config)s} + ${openssl_OpenSSL_Crypto_DEPENDENCIES_%(config)s} + ${openssl_OpenSSL_Crypto_FRAMEWORKS_%(config)s} + ${openssl_OpenSSL_Crypto_SYSTEM_LIBS_%(config)s}) endif() if(DEFINED OpenSSL_SSL_LIBS) set(OPENSSL_SSL_LIBRARY ${OpenSSL_SSL_LIBS}) @@ -841,6 +843,12 @@ def _create_cmake_module_variables(module_file): ${OpenSSL_SSL_DEPENDENCIES} ${OpenSSL_SSL_FRAMEWORKS} ${OpenSSL_SSL_SYSTEM_LIBS}) + elseif(DEFINED openssl_OpenSSL_SSL_LIBS_%(config)s) + set(OPENSSL_SSL_LIBRARY ${openssl_OpenSSL_SSL_LIBS_%(config)s}) + set(OPENSSL_SSL_LIBRARIES ${openssl_OpenSSL_SSL_LIBS_%(config)s} + ${openssl_OpenSSL_SSL_DEPENDENCIES_%(config)s} + ${openssl_OpenSSL_SSL_FRAMEWORKS_%(config)s} + ${openssl_OpenSSL_SSL_SYSTEM_LIBS_%(config)s}) endif() if(DEFINED OpenSSL_LIBRARIES) set(OPENSSL_LIBRARIES ${OpenSSL_LIBRARIES}) @@ -848,12 +856,12 @@ def _create_cmake_module_variables(module_file): if(DEFINED OpenSSL_VERSION) set(OPENSSL_VERSION ${OpenSSL_VERSION}) endif() - """) - tools.save(module_file, content) + """ % {"config":str(self.settings.build_type).upper()}) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") diff --git a/recipes/openssl/1.x.x/test_package/CMakeLists.txt b/recipes/openssl/1.x.x/test_package/CMakeLists.txt index 755a277704a3e..7109d02c5dd32 100644 --- a/recipes/openssl/1.x.x/test_package/CMakeLists.txt +++ b/recipes/openssl/1.x.x/test_package/CMakeLists.txt @@ -1,15 +1,31 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - option(OPENSSL_WITH_ZLIB "OpenSSL with zlib support" ON) +set(OpenSSL_DEBUG 1) find_package(OpenSSL REQUIRED) -add_executable(digest digest.c) -target_link_libraries(digest OpenSSL::SSL) -if(OPENSSL_WITH_ZLIB) - target_compile_definitions(digest PRIVATE WITH_ZLIB) -endif() +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindOpenSSL.html +# are properly defined in conan generators +set(_custom_vars + OPENSSL_FOUND + OPENSSL_INCLUDE_DIR + OPENSSL_CRYPTO_LIBRARY + OPENSSL_CRYPTO_LIBRARIES + OPENSSL_SSL_LIBRARY + OPENSSL_SSL_LIBRARIES + OPENSSL_LIBRARIES + OPENSSL_VERSION +) +foreach(_custom_var ${_custom_vars}) + if(DEFINED _custom_var) + message(STATUS "${_custom_var}: ${${_custom_var}}") + else() + message(FATAL_ERROR "${_custom_var} not defined") + endif() +endforeach() + +add_executable(${PROJECT_NAME} digest.c) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::SSL) +target_compile_definitions(${PROJECT_NAME} PRIVATE $<$:WITH_ZLIB>) diff --git a/recipes/openssl/1.x.x/test_package/conanfile.py b/recipes/openssl/1.x.x/test_package/conanfile.py index 13150b440fe8a..5bbdbb3e0e7bc 100644 --- a/recipes/openssl/1.x.x/test_package/conanfile.py +++ b/recipes/openssl/1.x.x/test_package/conanfile.py @@ -1,42 +1,31 @@ -from conans import CMake, ConanFile -from conan.tools.scm import Version -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) - @property - def _skip_test(self): - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - # Actually the workaround should be to add cmake/3.22.0 to build requires, - # but for the specific case of openssl it fails because it is also a requirement of cmake. - # see https://github.com/conan-io/conan/pull/9839 - return self.settings.os == "Macos" and self.settings.arch == "armv8" \ - and self.options["openssl"].shared + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OPENSSL_WITH_ZLIB"] = not self.dependencies["openssl"].options.get_safe("no_zlib", True) + tc.generate() def build(self): - if not self._skip_test: - cmake = CMake(self) - if self.settings.os == "Android": - cmake.definitions["CONAN_LIBCXX"] = "" - openssl_version = Version(self.deps_cpp_info["openssl"].version) - if openssl_version.major == "1" and openssl_version.minor == "1": - cmake.definitions["OPENSSL_WITH_ZLIB"] = False - else: - cmake.definitions["OPENSSL_WITH_ZLIB"] = not self.options["openssl"].no_zlib - cmake.configure() - cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): - if not self._skip_test and not cross_building(self): - bin_path = os.path.join("bin", "digest") - self.run(bin_path, run_environment=True) - assert os.path.exists(os.path.join(self.deps_cpp_info["openssl"].rootpath, "licenses", "LICENSE")) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openssl/1.x.x/test_package/digest.c b/recipes/openssl/1.x.x/test_package/digest.c index 88a5a900a54a4..e93ed8d778963 100644 --- a/recipes/openssl/1.x.x/test_package/digest.c +++ b/recipes/openssl/1.x.x/test_package/digest.c @@ -7,7 +7,7 @@ #include #include #if defined(WITH_ZLIB) -#include +#include #endif #if defined(_MSC_VER) && _MSC_VER < 1900 @@ -98,7 +98,8 @@ int main() printf("SSL library version: %s\n", OpenSSL_version(OPENSSL_VERSION)); #endif #if defined(WITH_ZLIB) - printf("ZLIB version: %s\n", ZLIB_VERSION); + COMP_METHOD *zlib_comp = COMP_zlib(); + printf("ZLIB compression method is named: %s\n", SSL_COMP_get_name(zlib_comp)); #endif return 0; diff --git a/recipes/openssl/1.x.x/test_v1_package/CMakeLists.txt b/recipes/openssl/1.x.x/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2f6b1a2f7ec79 --- /dev/null +++ b/recipes/openssl/1.x.x/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/openssl/1.x.x/test_v1_package/conanfile.py b/recipes/openssl/1.x.x/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..57b42bea43378 --- /dev/null +++ b/recipes/openssl/1.x.x/test_v1_package/conanfile.py @@ -0,0 +1,25 @@ +from conans import CMake, ConanFile, tools +from conans.errors import ConanException +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def _openssl_option(self, name, default): + try: + return getattr(self.options["openssl"], name, default) + except (AttributeError, ConanException): + return default + + def build(self): + cmake = CMake(self) + cmake.definitions["OPENSSL_WITH_ZLIB"] = not self._openssl_option("no_zlib", True) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/openssl/3.x.x/conandata.yml b/recipes/openssl/3.x.x/conandata.yml index f83e18460ec0f..591e74ccaaac9 100644 --- a/recipes/openssl/3.x.x/conandata.yml +++ b/recipes/openssl/3.x.x/conandata.yml @@ -1,10 +1,14 @@ sources: + 3.0.8: + url: + - "https://www.openssl.org/source/openssl-3.0.8.tar.gz" + - "https://github.com/openssl/openssl/releases/download/openssl-3.0.8/openssl-3.0.8.tar.gz" + sha256: 6c13d2bf38fdf31eac3ce2a347073673f5d63263398f1f69d0df4a41253e4b3e + 3.0.7: + url: + - "https://www.openssl.org/source/openssl-3.0.7.tar.gz" + - "https://github.com/openssl/openssl/releases/download/openssl-3.0.7/openssl-3.0.7.tar.gz" + sha256: 83049d042a260e696f62406ac5c08bf706fd84383f945cf21bd61e9ed95c396e 3.0.5: url: https://www.openssl.org/source/openssl-3.0.5.tar.gz sha256: aa7d8d9bef71ad6525c55ba11e5f4397889ce49c2c9349dcea6d3e4f0b024a7a - 3.0.4: - url: https://www.openssl.org/source/openssl-3.0.4.tar.gz - sha256: 2831843e9a668a0ab478e7020ad63d2d65e51f72977472dc73efcefbafc0c00f - 3.0.3: - url: https://www.openssl.org/source/openssl-3.0.3.tar.gz - sha256: ee0078adcef1de5f003c62c80cc96527721609c6f3bb42b7795df31f8b558c0b diff --git a/recipes/openssl/3.x.x/conanfile.py b/recipes/openssl/3.x.x/conanfile.py index ee14c8c94d4df..beaea42777422 100644 --- a/recipes/openssl/3.x.x/conanfile.py +++ b/recipes/openssl/3.x.x/conanfile.py @@ -120,7 +120,7 @@ def configure(self): def requirements(self): if not self.options.no_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def build_requirements(self): if self._settings_build.os == "Windows": @@ -610,6 +610,7 @@ def build(self): self._create_targets() with self._make_context(): self._make() + self.run("perl source_subfolder/configdata.pm --dump") @property def _win_bash(self): @@ -756,3 +757,10 @@ def package_info(self): self.cpp_info.components["crypto"].names["cmake_find_package_multi"] = "Crypto" self.cpp_info.components["ssl"].names["cmake_find_package"] = "SSL" self.cpp_info.components["ssl"].names["cmake_find_package_multi"] = "SSL" + + openssl_modules_dir = os.path.join(self.package_folder, "lib", "ossl-modules") + self.runenv_info.define_path("OPENSSL_MODULES", openssl_modules_dir) + + # For legacy 1.x downstream consumers, remove once recipe is 2.0 only: + self.env_info.OPENSSL_MODULES = openssl_modules_dir + diff --git a/recipes/openssl/config.yml b/recipes/openssl/config.yml index 5b14d0aab6ab7..f0e160be03021 100644 --- a/recipes/openssl/config.yml +++ b/recipes/openssl/config.yml @@ -1,18 +1,18 @@ versions: # 3.0.x releases - 3.0.5: + 3.0.8: folder: "3.x.x" - 3.0.4: + 3.0.7: folder: "3.x.x" - 3.0.3: + 3.0.5: folder: "3.x.x" # 1.1.1x releases - 1.1.1q: + 1.1.1t: folder: "1.x.x" - 1.1.1p: + 1.1.1s: folder: "1.x.x" - 1.1.1o: + 1.1.1q: folder: "1.x.x" # 1.1.0x releases 1.1.0l: diff --git a/recipes/opensubdiv/all/conandata.yml b/recipes/opensubdiv/all/conandata.yml index c9db5e6f5cfd4..d44ee432a8b6b 100644 --- a/recipes/opensubdiv/all/conandata.yml +++ b/recipes/opensubdiv/all/conandata.yml @@ -2,3 +2,6 @@ sources: "3.4.4": url: "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v3_4_4.zip" sha256: "04b52a67e90a56b18d9ddd0384630f43b5263a8fdee1afae081e32d7b23cd5ec" + "3.5.0": + url: "https://github.com/PixarAnimationStudios/OpenSubdiv/archive/v3_5_0.zip" + sha256: "1b2916d57173ac523acd334fb6e25623ddfed3c342f3c2aadfe4d1d0be6e7657" diff --git a/recipes/opensubdiv/all/conanfile.py b/recipes/opensubdiv/all/conanfile.py index 297736ec83eef..a2f72bc024b2a 100644 --- a/recipes/opensubdiv/all/conanfile.py +++ b/recipes/opensubdiv/all/conanfile.py @@ -3,8 +3,10 @@ from conan import ConanFile from conan.tools.files import get, replace_in_file -from conans import CMake, tools +from conan.tools.build import check_min_cppstd +import conan.tools.scm as tools_scm from conan.errors import ConanInvalidConfiguration +from conans import CMake, tools required_conan_version = ">=1.48.0" @@ -86,18 +88,25 @@ def requirements(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) + check_min_cppstd(self, self._minimum_cpp_standard) min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) if not min_version: - self.output.warn("{} recipe lacks information about the {} compiler support.".format(self.name, self.settings.compiler)) + self.output.warn( + f"{self.name} recipe lacks information about the {self.settings.compiler} compiler support." + ) else: - if tools.Version(self.settings.compiler.version) < min_version: + if tools_scm.Version(self.settings.compiler.version) < min_version: raise ConanInvalidConfiguration( - "{} requires C++{} support. The current compiler {} {} does not support it.".format(self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version) + f"{self.name} requires C++{self._minimum_cpp_standard} support. The current compiler {self.settings.compiler} {self.settings.compiler.version} does not support it." ) def source(self): - get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get( + self, + **self.conan_data["sources"][self.version], + strip_root=True, + destination=self._source_subfolder, + ) @property def _osd_gpu_enabled(self): @@ -114,6 +123,7 @@ def _osd_gpu_enabled(self): @functools.lru_cache(1) def _configure_cmake(self): cmake = CMake(self) + cmake.definitions["CMAKE_CXX_STANDARD"] = self._minimum_cpp_standard cmake.definitions["NO_TBB"] = not self.options.with_tbb cmake.definitions["NO_OPENGL"] = not self.options.with_opengl cmake.definitions["BUILD_SHARED_LIBS"] = self.options.get_safe("shared") @@ -123,7 +133,9 @@ def _configure_cmake(self): cmake.definitions["NO_METAL"] = not self.options.get_safe("with_metal") cmake.definitions["NO_CLEW"] = not self.options.with_clew cmake.definitions["NO_OPENCL"] = not self.options.with_opencl - cmake.definitions["NO_PTEX"] = True # Note: PTEX is for examples only, but we skip them.. + cmake.definitions[ + "NO_PTEX" + ] = True # Note: PTEX is for examples only, but we skip them.. cmake.definitions["NO_DOC"] = True cmake.definitions["NO_EXAMPLES"] = True cmake.definitions["NO_TUTORIALS"] = True @@ -138,7 +150,12 @@ def _configure_cmake(self): def build(self): if self.settings.os == "Macos": path = os.path.join(self._source_subfolder, "opensubdiv", "CMakeLists.txt") - replace_in_file(self, path, "${CMAKE_SOURCE_DIR}/opensubdiv", "${CMAKE_SOURCE_DIR}/source_subfolder/opensubdiv") + replace_in_file( + self, + path, + "${CMAKE_SOURCE_DIR}/opensubdiv", + "${CMAKE_SOURCE_DIR}/source_subfolder/opensubdiv", + ) if not self._osd_gpu_enabled: replace_in_file(self, path, "$", "") cmake = self._configure_cmake() @@ -149,6 +166,17 @@ def package(self): cmake = self._configure_cmake() cmake.install() + for mask in [ + "Find*.cmake", + "*Config*.cmake", + "*-config.cmake", + "*Targets*.cmake", + ]: + tools.remove_files_by_mask(self.package_folder, mask) + + if self.options.get_safe("shared") == True: + tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.a") + def package_info(self): self.cpp_info.set_property("cmake_file_name", "OpenSubdiv") @@ -156,14 +184,18 @@ def package_info(self): self.cpp_info.names["cmake_find_package_multi"] = "OpenSubdiv" self.cpp_info.components["osdcpu"].libs = ["osdCPU"] - self.cpp_info.components["osdcpu"].set_property("cmake_target_name", "OpenSubdiv::osdcpu") + self.cpp_info.components["osdcpu"].set_property( + "cmake_target_name", "OpenSubdiv::osdcpu" + ) if self.options.with_tbb: self.cpp_info.components["osdcpu"].requires = ["onetbb::onetbb"] if self._osd_gpu_enabled: self.cpp_info.components["osdgpu"].libs = ["osdGPU"] - self.cpp_info.components["osdgpu"].set_property("cmake_target_name", "OpenSubdiv::osdgpu") + self.cpp_info.components["osdgpu"].set_property( + "cmake_target_name", "OpenSubdiv::osdgpu" + ) dl_required = self.options.with_opengl or self.options.with_opencl if self.settings.os in ["Linux", "FreeBSD"] and dl_required: self.cpp_info.components["osdgpu"].system_libs = ["dl"] diff --git a/recipes/opensubdiv/config.yml b/recipes/opensubdiv/config.yml index bd356e3c6a168..8c2082f7398cc 100644 --- a/recipes/opensubdiv/config.yml +++ b/recipes/opensubdiv/config.yml @@ -1,3 +1,5 @@ versions: "3.4.4": folder: all + "3.5.0": + folder: all diff --git a/recipes/opentdf-client/all/conandata.yml b/recipes/opentdf-client/all/conandata.yml index 40290f5cad510..b3ede12a6440c 100644 --- a/recipes/opentdf-client/all/conandata.yml +++ b/recipes/opentdf-client/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "1.3.6": + url: "https://github.com/opentdf/client-cpp/archive/1.3.6.tar.gz" + sha256: "e0d4cf1d0b1824d903a2b0ec1da528acb42623e32f3ca36aa28b2e950c3cc7a0" + "1.3.4": + url: "https://github.com/opentdf/client-cpp/archive/1.3.4.tar.gz" + sha256: "4b9836bff368249b709fc40e67c3a8664fed85a5d8247475ca1f741486210409" + "1.3.3": + url: "https://github.com/opentdf/client-cpp/archive/1.3.3.tar.gz" + sha256: "7949e662dc55a425771e5ecf2d96e25295d1e2394e805608aed72d1131896948" + "1.3.2": + url: "https://github.com/opentdf/client-cpp/archive/1.3.2.tar.gz" + sha256: "d9a38d3aa6114159c90e0c254c78ddda921e2d520851e4def57f3cd26c564b16" + "1.2.0": + url: "https://github.com/opentdf/client-cpp/archive/1.2.0.tar.gz" + sha256: "15828038809ed291ff7881206a675abc5162e1175c8b515363b9c584aebb08f7" + "1.1.6": + url: "https://github.com/opentdf/client-cpp/archive/1.1.6.tar.gz" + sha256: "83992c37c9a58ae2152660a4ffbf1784fe63d7a9e7b8466d10ca1074697b3d3a" "1.1.5": url: "https://github.com/opentdf/client-cpp/archive/1.1.5.tar.gz" sha256: "8fd5b22b36b19cd58a18f63cbffe3d538263ef3aecde4802059951c4eb5ce044" diff --git a/recipes/opentdf-client/config.yml b/recipes/opentdf-client/config.yml index 8ccfd97624976..b9d93dc47c8d4 100644 --- a/recipes/opentdf-client/config.yml +++ b/recipes/opentdf-client/config.yml @@ -1,4 +1,16 @@ versions: + "1.3.6": + folder: all + "1.3.4": + folder: all + "1.3.3": + folder: all + "1.3.2": + folder: all + "1.2.0": + folder: all + "1.1.6": + folder: all "1.1.5": folder: all "1.1.3": diff --git a/recipes/opentelemetry-cpp/all/CMakeLists.txt b/recipes/opentelemetry-cpp/all/CMakeLists.txt deleted file mode 100644 index c921d02a0d877..0000000000000 --- a/recipes/opentelemetry-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/opentelemetry-cpp/all/conandata.yml b/recipes/opentelemetry-cpp/all/conandata.yml index d77f0da9d79fd..88ad3e40bea9c 100644 --- a/recipes/opentelemetry-cpp/all/conandata.yml +++ b/recipes/opentelemetry-cpp/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.8.1": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.8.1.tar.gz" + sha256: "3d640201594b07f08dade9cd1017bd0b59674daca26223b560b9bb6bf56264c2" + "1.7.0": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.7.0.tar.gz" + sha256: "2ad0911cdc94fe84a93334773bef4789a38bd1f01e39560cabd4a5c267e823c3" + "1.6.1": + url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.6.1.tar.gz" + sha256: "1fc371be049b3220b8b9571c8b713f03e9a84f3c5684363f64ccc814638391a5" "1.4.1": url: "https://github.com/open-telemetry/opentelemetry-cpp/archive/v1.4.1.tar.gz" sha256: "301b1ab74a664723560f46c29f228360aff1e2d63e930b963755ea077ae67524" @@ -16,12 +25,35 @@ sources: sha256: "32f12ff15ec257e3462883f84bc291c2d5dc30055604c12ec4b46a36dfa3f189" patches: + "1.8.1": + - patch_file: "patches/1.8.1-0001-fix-cmake.patch" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" + "1.7.0": + - patch_file: "patches/1.7.0-0001-fix-cmake.patch" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" + "1.6.1": + - patch_file: "patches/1.6.1-0001-fix-cmake.patch" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" "1.4.1": - patch_file: "patches/1.4.0-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" "1.4.0": - patch_file: "patches/1.4.0-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" "1.3.0": - patch_file: "patches/1.3.0-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" + "1.2.0": + - patch_file: "patches/1.2.0-0001-fix-cmake.patch" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" + "1.0.1": + - patch_file: "patches/1.0.1-0001-fix-cmake.patch" + patch_description: "fix lack of linking libraries due to conan not generating the variables that are expected" + patch_type: "conan" diff --git a/recipes/opentelemetry-cpp/all/conanfile.py b/recipes/opentelemetry-cpp/all/conanfile.py index 432efd2d1ecde..28a5a3dd6a2cd 100644 --- a/recipes/opentelemetry-cpp/all/conanfile.py +++ b/recipes/opentelemetry-cpp/all/conanfile.py @@ -1,12 +1,15 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, replace_in_file, save +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import check_min_vs + import os import textwrap -import functools -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration - - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class OpenTelemetryCppConan(ConanFile): name = "opentelemetry-cpp" @@ -19,52 +22,145 @@ class OpenTelemetryCppConan(ConanFile): options = { "fPIC": [True, False], "shared": [True, False], + "with_no_deprecated_code": [True, False], + "with_stl": [True, False], + "with_gsl": [True, False], + "with_abseil": [True, False], + "with_otlp": [True, False], + "with_otlp_grpc": [True, False], + "with_otlp_http": [True, False], + "with_zipkin": [True, False], + "with_prometheus": [True, False], + "with_elasticsearch": [True, False], + "with_zpages": [True, False], + "with_jaeger": [True, False], + "with_no_getenv": [True, False], + "with_etw": [True, False], + "with_logs_preview": [True, False], + "with_async_export_preview": [True, False], + "with_metrics_exemplar_preview": [True, False], } default_options = { "fPIC": True, "shared": False, + + "with_no_deprecated_code": False, + "with_stl": False, + "with_gsl": False, + "with_abseil": True, + "with_otlp": True, + "with_otlp_grpc": True, + "with_otlp_http": True, + "with_zipkin": True, + "with_prometheus": False, + "with_elasticsearch": False, + "with_zpages": False, + "with_jaeger": True, + "with_no_getenv": False, + "with_etw": False, + "with_logs_preview": False, + "with_async_export_preview": False, + "with_metrics_exemplar_preview": False, } - generators = "cmake", "cmake_find_package_multi" short_paths = True + @property + def _minimum_cpp_standard(self): + return 11 + def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + if not self.options.with_otlp: + self.options.rm_safe("with_otlp_grpc") + self.options.rm_safe("with_otlp_http") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("abseil/20211102.0") - self.requires("grpc/1.45.2") - self.requires("libcurl/7.83.1") - self.requires("nlohmann_json/3.10.5") - self.requires("openssl/1.1.1o") - self.requires("opentelemetry-proto/0.18.0") - self.requires("protobuf/3.21.1") - self.requires("thrift/0.15.0") - if tools.Version(self.version) >= "1.3.0": - self.requires("boost/1.79.0") + if self.options.with_gsl: + self.requires("ms-gsl/4.0.0") - def validate(self): - if self.settings.arch != "x86_64": - raise ConanInvalidConfiguration("Architecture not supported") + if self.options.with_abseil: + self.requires("abseil/20220623.0") + + if self.options.with_otlp: + self.requires("protobuf/3.21.4") + if Version(self.version) <= "1.4.1": + self.requires("opentelemetry-proto/0.11.0") + else: + self.requires("opentelemetry-proto/0.19.0") + + if self.options.get_safe("with_otlp_grpc"): + self.requires("grpc/1.50.1") + + if (self.options.with_zipkin or + self.options.with_elasticsearch or + self.options.get_safe("with_otlp_http") or + self.options.with_etw + ): + self.requires("nlohmann_json/3.11.2") + self.requires("openssl/1.1.1t") + + if (self.options.with_zipkin or + self.options.with_elasticsearch or + self.options.get_safe("with_otlp_http") + ): + self.requires("libcurl/7.87.0") + + if self.options.with_prometheus: + self.requires("prometheus-cpp/1.1.0") - if (self.settings.compiler == "Visual Studio" and - tools.Version(self.settings.compiler.version) < "16"): - raise ConanInvalidConfiguration("Visual Studio 2019 or higher required") + if self.options.with_jaeger: + self.requires("thrift/0.17.0") + + if Version(self.version) >= "1.3.0": + self.requires("boost/1.81.0") + + @property + def _required_boost_components(self): + return ["locale"] if self.options.with_jaeger and Version(self.version) >= "1.3.0" else [] + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, "192") if self.settings.os != "Linux" and self.options.shared: - raise ConanInvalidConfiguration("Building shared libraries is only supported on Linux") + raise ConanInvalidConfiguration(f"{self.ref} supports building shared libraries only on Linux") + + if self.options.get_safe("with_otlp_grpc") and not self.options.with_otlp: + raise ConanInvalidConfiguration("Option 'with_otlp_grpc' requires 'with_otlp'") + + if self.options.get_safe("with_otlp_http") and not self.options.with_otlp: + raise ConanInvalidConfiguration("Option 'with_otlp_http' requires 'with_otlp'") - @staticmethod - def _create_cmake_module_variables(module_file): + if not self.dependencies["grpc"].options.cpp_plugin: + raise ConanInvalidConfiguration(f"{self.ref} requires grpc with cpp_plugin=True") + + boost_required_comp = any(self.dependencies["boost"].options.get_safe(f"without_{boost_comp}", True) + for boost_comp in self._required_boost_components) + + if boost_required_comp: + raise ConanInvalidConfiguration( + f"{self.ref} requires boost with these components: " + f"{', '.join(self._required_boost_components)}" + ) + + def build_requirements(self): + self.tool_requires("protobuf/3.21.4") + self.tool_requires("grpc/1.50.1") + + def _create_cmake_module_variables(self, module_file): content = textwrap.dedent("""\ set(OPENTELEMETRY_CPP_INCLUDE_DIRS ${opentelemetry-cpp_INCLUDE_DIRS} ${opentelemetry-cpp_INCLUDE_DIRS_RELEASE} @@ -73,79 +169,83 @@ def _create_cmake_module_variables(module_file): ${opentelemetry-cpp_INCLUDE_DIRS_DEBUG}) set(OPENTELEMETRY_CPP_LIBRARIES opentelemetry-cpp::opentelemetry-cpp) """) - tools.save(module_file, content) - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + save(self, module_file, content) def source(self): - tools.get( - **self.conan_data["sources"][self.version], - destination=self._source_subfolder, - strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - defs = { - "BUILD_TESTING": False, - "WITH_ABSEIL": True, - "WITH_ETW": True, - "WITH_EXAMPLES": False, - "WITH_JAEGER": True, - "WITH_OTLP": True, - "WITH_ZIPKIN": True, - } - cmake.configure(defs=defs, build_folder=self._build_subfolder) - return cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + + tc.variables["BUILD_TESTING"] = False + tc.variables["BUILD_BENCHMARK"] = False + + tc.variables["WITH_NO_DEPRECATED_CODE"] = self.options.with_no_deprecated_code + tc.variables["WITH_STL"] = self.options.with_stl + tc.variables["WITH_GSL"] = self.options.with_gsl + tc.variables["WITH_ABSEIL"] = self.options.with_abseil + tc.variables["WITH_OTLP"] = self.options.with_otlp + tc.variables["WITH_OTLP_GRPC"] = self.options.get_safe("with_otlp_grpc") + tc.variables["WITH_OTLP_HTTP"] = self.options.get_safe("with_otlp_http") + tc.variables["WITH_ZIPKIN"] = self.options.with_zipkin + tc.variables["WITH_PROMETHEUS"] = self.options.with_prometheus + tc.variables["WITH_ELASTICSEARCH"] = self.options.with_elasticsearch + tc.variables["WITH_ZPAGES"] = self.options.with_zpages + tc.variables["WITH_JAEGER"] = self.options.with_jaeger + tc.variables["WITH_NO_GETENV"] = self.options.with_no_getenv + tc.variables["WITH_ETW"] = self.options.with_etw + tc.variables["WITH_LOGS_PREVIEW"] = self.options.with_logs_preview + tc.variables["WITH_ASYNC_EXPORT_PREVIEW"] = self.options.with_async_export_preview + tc.variables["WITH_METRICS_EXEMPLAR_PREVIEW"] = self.options.with_metrics_exemplar_preview + + tc.generate() + + tc = CMakeDeps(self) + tc.generate() def _patch_sources(self): protos_path = self.deps_user_info["opentelemetry-proto"].proto_root.replace("\\", "/") protos_cmake_path = os.path.join( - self._source_subfolder, + self.source_folder, "cmake", "opentelemetry-proto.cmake") - if tools.Version(self.version) >= "1.1.0": - tools.replace_in_file( + if Version(self.version) >= "1.1.0": + replace_in_file(self, protos_cmake_path, "if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git)", "if(1)") - tools.replace_in_file( + replace_in_file(self, protos_cmake_path, "set(PROTO_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto\")", f"set(PROTO_PATH \"{protos_path}\")") - tools.rmdir(os.path.join(self._source_subfolder, "api", "include", "opentelemetry", "nostd", "absl")) + rmdir(self, os.path.join(self.source_folder, "api", "include", "opentelemetry", "nostd", "absl")) - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) self._create_cmake_module_variables( os.path.join(self.package_folder, self._otel_cmake_variables_path) ) @property def _module_subfolder(self): - return os.path.join("lib", "cmake") + return os.path.join(self.package_folder, "lib", "cmake") @property def _otel_cmake_variables_path(self): return os.path.join(self._module_subfolder, - "conan-official-{}-variables.cmake".format(self.name)) + f"conan-official-{self.name}-variables.cmake") @property def _otel_build_modules(self): @@ -153,7 +253,7 @@ def _otel_build_modules(self): @property def _http_client_name(self): - return "http_client_curl" if tools.Version(self.version) < "1.3.0" else "opentelemetry_http_client_curl" + return "http_client_curl" if Version(self.version) < "1.3.0" else "opentelemetry_http_client_curl" @property def _otel_libraries(self): @@ -161,21 +261,69 @@ def _otel_libraries(self): self._http_client_name, "opentelemetry_common", "opentelemetry_exporter_in_memory", - "opentelemetry_exporter_jaeger_trace", "opentelemetry_exporter_ostream_span", - "opentelemetry_exporter_otlp_grpc", - "opentelemetry_exporter_otlp_http", - "opentelemetry_exporter_zipkin_trace", - "opentelemetry_otlp_recordable", - "opentelemetry_proto", "opentelemetry_resources", "opentelemetry_trace", "opentelemetry_version", ] - if self.settings.os == "Windows": + + if self.options.with_otlp: libraries.extend([ - "opentelemetry_exporter_etw", + "opentelemetry_proto", + "opentelemetry_otlp_recordable", + ]) + + if self.options.get_safe("with_otlp_grpc"): + libraries.append("opentelemetry_exporter_otlp_grpc") + + if Version(self.version) >= "1.5.0": + libraries.append("opentelemetry_exporter_otlp_grpc_metrics") + + if Version(self.version) >= "1.7.0": + libraries.append("opentelemetry_exporter_otlp_grpc_client") + + if self.options.with_logs_preview: + libraries.append("opentelemetry_exporter_otlp_grpc_log") + + if self.options.get_safe("with_otlp_http"): + libraries.append("opentelemetry_exporter_otlp_http") + + if Version(self.version) >= "1.1.0": + libraries.append("opentelemetry_exporter_otlp_http_client") + + if Version(self.version) >= "1.5.0": + libraries.append("opentelemetry_exporter_otlp_http_metric") + + if self.options.with_logs_preview: + libraries.append("opentelemetry_exporter_otlp_http_log") + + if self.options.with_prometheus: + libraries.append("opentelemetry_exporter_prometheus") + + if self.options.with_elasticsearch and self.options.with_logs_preview: + libraries.append("opentelemetry_exporter_elasticsearch_logs") + + if self.options.with_zipkin: + libraries.append("opentelemetry_exporter_zipkin_trace") + + if self.options.with_jaeger: + libraries.append("opentelemetry_exporter_jaeger_trace") + + if Version(self.version) >= "1.2.0": + libraries.append("opentelemetry_metrics") + + if Version(self.version) >= "1.4.0": + libraries.append("opentelemetry_exporter_ostream_metrics") + + if self.options.with_logs_preview: + libraries.extend([ + "opentelemetry_logs", + "opentelemetry_exporter_ostream_logs", ]) + + if self.settings.os == "Windows" and self.options.with_etw: + libraries.append("opentelemetry_exporter_etw") + return libraries def package_info(self): @@ -185,73 +333,145 @@ def package_info(self): self.cpp_info.components[lib].build_modules["cmake_find_package"] = self._otel_build_modules self.cpp_info.components[lib].build_modules["cmake_find_package_multi"] = self._otel_build_modules - self.cpp_info.components[self._http_client_name].requires.extend(["libcurl::libcurl"]) + self.cpp_info.components["opentelemetry_resources"].requires.extend([ + "opentelemetry_common", + ]) - self.cpp_info.components["opentelemetry_common"].defines.append("HAVE_ABSEIL") - self.cpp_info.components["opentelemetry_common"].requires.extend([ - "abseil::abseil", + self.cpp_info.components["opentelemetry_trace"].requires.extend([ + "opentelemetry_common", + "opentelemetry_resources", ]) - if self.settings.os == "Windows": - self.cpp_info.components["opentelemetry_exporter_etw"].libs = [] - self.cpp_info.components["opentelemetry_exporter_etw"].requires.extend([ - "nlohmann_json::nlohmann_json", - ]) + self.cpp_info.components["opentelemetry_exporter_ostream_span"].requires.append( + "opentelemetry_trace", + ) self.cpp_info.components["opentelemetry_exporter_in_memory"].libs = [] - self.cpp_info.components["opentelemetry_exporter_jaeger_trace"].requires.extend([ - self._http_client_name, - "openssl::openssl", - "opentelemetry_resources", - "thrift::thrift", - ]) - if tools.Version(self.version) >= "1.3.0": - self.cpp_info.components["opentelemetry_exporter_jaeger_trace"].requires.extend([ - "boost::locale", + if self.options.with_logs_preview: + self.cpp_info.components["opentelemetry_logs"].requires.extend([ + "opentelemetry_resources", + "opentelemetry_common", ]) - self.cpp_info.components["opentelemetry_exporter_ostream_span"].requires.extend([ - "opentelemetry_trace", - ]) + self.cpp_info.components["opentelemetry_exporter_ostream_logs"].requires.append( + "opentelemetry_logs", + ) - self.cpp_info.components["opentelemetry_exporter_otlp_grpc"].requires.extend([ - "grpc::grpc++", - "opentelemetry_otlp_recordable", - "protobuf::protobuf", - ]) + if self.settings.os in ("Linux", "FreeBSD"): + self.cpp_info.components["opentelemetry_common"].system_libs.extend(["pthread"]) - self.cpp_info.components["opentelemetry_exporter_otlp_http"].requires.extend([ - self._http_client_name, - "nlohmann_json::nlohmann_json", - "opentelemetry_otlp_recordable", - ]) + if self.options.with_stl: + self.cpp_info.components["opentelemetry_common"].defines.append("HAVE_CPP_STDLIB") - self.cpp_info.components["opentelemetry_exporter_zipkin_trace"].requires.extend([ - self._http_client_name, - "nlohmann_json::nlohmann_json", - "opentelemetry_trace", - ]) + if self.options.with_gsl: + self.cpp_info.components["opentelemetry_common"].defines.append("HAVE_GSL") + self.cpp_info.components["opentelemetry_common"].requires.append("ms-gsl::_ms-gsl") - self.cpp_info.components["opentelemetry_otlp_recordable"].requires.extend([ - "opentelemetry_proto", - "opentelemetry_resources", - "opentelemetry_trace", - ]) + if self.options.with_abseil: + self.cpp_info.components["opentelemetry_common"].defines.append("HAVE_ABSEIL") + self.cpp_info.components["opentelemetry_common"].requires.append("abseil::abseil") - self.cpp_info.components["opentelemetry_proto"].requires.extend([ - "opentelemetry-proto::opentelemetry-proto", - "protobuf::protobuf", - ]) + if self.options.with_otlp: + self.cpp_info.components["opentelemetry_proto"].requires.extend([ + "opentelemetry-proto::opentelemetry-proto", + "protobuf::protobuf", + ]) - self.cpp_info.components["opentelemetry_resources"].requires.extend([ - "opentelemetry_common", - ]) + self.cpp_info.components["opentelemetry_otlp_recordable"].requires.extend([ + "opentelemetry_proto", + "opentelemetry_resources", + "opentelemetry_trace", + ]) - self.cpp_info.components["opentelemetry_trace"].requires.extend([ - "opentelemetry_common", - "opentelemetry_resources", - ]) + if self.options.get_safe("with_otlp_grpc"): + if Version(self.version) >= "1.5.0" and Version(self.version) < "1.7.0": + self.cpp_info.components["opentelemetry_exporter_otlp_grpc_metrics"].requires.extend([ + "grpc::grpc++", + "opentelemetry_otlp_recordable", + ]) + + if Version(self.version) <= "1.7.0": + self.cpp_info.components["opentelemetry_exporter_otlp_grpc"].requires.extend([ + "grpc::grpc++", + "opentelemetry_otlp_recordable", + ]) + + if Version(self.version) >= "1.7.0": + self.cpp_info.components["opentelemetry_exporter_otlp_grpc_client"].requires.extend([ + "grpc::grpc++", + "opentelemetry_proto", + ]) + + self.cpp_info.components["opentelemetry_exporter_otlp_grpc"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_grpc_client" + ]) + + self.cpp_info.components["opentelemetry_exporter_otlp_grpc_metrics"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_grpc_client" + ]) + + if self.options.with_logs_preview: + self.cpp_info.components["opentelemetry_exporter_otlp_grpc_log"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_grpc_client", + ]) + + if (self.options.get_safe("with_otlp_http") or + self.options.with_zipkin or + self.options.with_elasticsearch + ): + self.cpp_info.components[self._http_client_name].requires.append("libcurl::libcurl") + + if self.options.get_safe("with_otlp_http"): + self.cpp_info.components["opentelemetry_exporter_otlp_http_client"].requires.extend([ + self._http_client_name, + "nlohmann_json::nlohmann_json", + "opentelemetry_proto", + ]) + + self.cpp_info.components["opentelemetry_exporter_otlp_http"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_http_client", + ]) + + if Version(self.version) >= "1.5.0": + self.cpp_info.components["opentelemetry_exporter_otlp_http_metric"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_http_client" + ]) + + if self.options.with_logs_preview: + self.cpp_info.components["opentelemetry_exporter_otlp_http_log"].requires.extend([ + "opentelemetry_otlp_recordable", + "opentelemetry_exporter_otlp_http_client", + ]) + + if self.options.with_zipkin: + self.cpp_info.components["opentelemetry_exporter_zipkin_trace"].requires.extend([ + self._http_client_name, + "nlohmann_json::nlohmann_json", + "opentelemetry_trace", + ]) + + if self.options.with_jaeger: + self.cpp_info.components["opentelemetry_exporter_jaeger_trace"].requires.extend([ + self._http_client_name, + "openssl::openssl", + "opentelemetry_resources", + "thrift::thrift", + ]) + + if Version(self.version) >= "1.3.0": + self.cpp_info.components["opentelemetry_exporter_jaeger_trace"].requires.append( + "boost::locale" + ) + + if self.settings.os == "Windows" and self.options.with_etw: + self.cpp_info.components["opentelemetry_exporter_etw"].libs = [] + self.cpp_info.components["opentelemetry_exporter_etw"].requires.append( + "nlohmann_json::nlohmann_json", + ) - if self.settings.os in ("Linux", "FreeBSD"): - self.cpp_info.components["opentelemetry_common"].system_libs.extend(["pthread"]) diff --git a/recipes/opentelemetry-cpp/all/patches/1.0.1-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.0.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..ecdbb0cf0f9fc --- /dev/null +++ b/recipes/opentelemetry-cpp/all/patches/1.0.1-0001-fix-cmake.patch @@ -0,0 +1,28 @@ +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 9fb6f49..1f1547e 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -162,6 +162,10 @@ else() # cmake 3.8 or lower + target_link_libraries(opentelemetry_proto INTERFACE ${Protobuf_LIBRARIES}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(BUILD_SHARED_LIBS) + set_property(TARGET opentelemetry_proto PROPERTY POSITION_INDEPENDENT_CODE ON) + endif() +diff --git a/exporters/zipkin/CMakeLists.txt b/exporters/zipkin/CMakeLists.txt +index 2316860..8995b31 100644 +--- a/exporters/zipkin/CMakeLists.txt ++++ b/exporters/zipkin/CMakeLists.txt +@@ -21,7 +21,7 @@ add_library(opentelemetry_exporter_zipkin_trace src/zipkin_exporter.cc + src/recordable.cc) + + target_link_libraries(opentelemetry_exporter_zipkin_trace +- PUBLIC opentelemetry_trace http_client_curl) ++ PUBLIC opentelemetry_trace http_client_curl nlohmann_json::nlohmann_json) + + install( + TARGETS opentelemetry_exporter_zipkin_trace diff --git a/recipes/opentelemetry-cpp/all/patches/1.2.0-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.2.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..275e2c9b44a66 --- /dev/null +++ b/recipes/opentelemetry-cpp/all/patches/1.2.0-0001-fix-cmake.patch @@ -0,0 +1,15 @@ +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 8d8f868..2a78f98 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -214,6 +214,10 @@ else() + ${METRICS_SERVICE_PB_CPP_FILE}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(needs_proto_download) + add_dependencies(opentelemetry_proto opentelemetry-proto) + endif() diff --git a/recipes/opentelemetry-cpp/all/patches/1.3.0-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.3.0-0001-fix-cmake.patch index cca97cf74351f..ce868fbedca22 100644 --- a/recipes/opentelemetry-cpp/all/patches/1.3.0-0001-fix-cmake.patch +++ b/recipes/opentelemetry-cpp/all/patches/1.3.0-0001-fix-cmake.patch @@ -1,7 +1,7 @@ -diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt -index 09c21fd..a8d7d16 100644 ---- a/a/CMakeLists.txt -+++ b/b/CMakeLists.txt +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 09c21fd..a8d7d16 100755 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt @@ -203,7 +203,6 @@ if(WITH_JAEGER) find_package(Thrift QUIET) if(Thrift_FOUND) @@ -10,3 +10,18 @@ index 09c21fd..a8d7d16 100644 else() # Install Thrift and propagate via vcpkg toolchain file if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 8d8f868..2a78f98 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -214,6 +214,10 @@ else() + ${METRICS_SERVICE_PB_CPP_FILE}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(needs_proto_download) + add_dependencies(opentelemetry_proto opentelemetry-proto) + endif() diff --git a/recipes/opentelemetry-cpp/all/patches/1.4.0-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.4.0-0001-fix-cmake.patch index de56d2c7118c6..1fcf5a0427738 100644 --- a/recipes/opentelemetry-cpp/all/patches/1.4.0-0001-fix-cmake.patch +++ b/recipes/opentelemetry-cpp/all/patches/1.4.0-0001-fix-cmake.patch @@ -10,3 +10,18 @@ index 6d2b274..4611a6b 100755 else() # Install Thrift and propagate via vcpkg toolchain file if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 37d45da..89395c0 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -215,6 +215,10 @@ else() + ${METRICS_SERVICE_PB_CPP_FILE}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(needs_proto_download) + add_dependencies(opentelemetry_proto opentelemetry-proto) + endif() diff --git a/recipes/opentelemetry-cpp/all/patches/1.6.1-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.6.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..b3391855652c4 --- /dev/null +++ b/recipes/opentelemetry-cpp/all/patches/1.6.1-0001-fix-cmake.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index a1b6934..d4f5251 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -209,7 +209,6 @@ if(WITH_JAEGER) + find_package(Thrift QUIET) + if(Thrift_FOUND) + find_package(Boost REQUIRED) +- include_directories(${Boost_INCLUDE_DIR}) + else() + # Install Thrift and propagate via vcpkg toolchain file + if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 629ea81..3b09b92 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -242,6 +242,10 @@ else() # cmake 3.8 or lower + target_link_libraries(opentelemetry_proto INTERFACE ${Protobuf_LIBRARIES}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(BUILD_SHARED_LIBS) + set_property(TARGET opentelemetry_proto PROPERTY POSITION_INDEPENDENT_CODE ON) + endif() diff --git a/recipes/opentelemetry-cpp/all/patches/1.7.0-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.7.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..e5e3898386303 --- /dev/null +++ b/recipes/opentelemetry-cpp/all/patches/1.7.0-0001-fix-cmake.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index e7597fc8..d880a90d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -217,7 +217,6 @@ if(WITH_JAEGER) + find_package(Thrift QUIET) + if(Thrift_FOUND) + find_package(Boost REQUIRED) +- include_directories(${Boost_INCLUDE_DIR}) + else() + # Install Thrift and propagate via vcpkg toolchain file + if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 629ea815..3b09b92e 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -242,6 +242,10 @@ else() # cmake 3.8 or lower + target_link_libraries(opentelemetry_proto INTERFACE ${Protobuf_LIBRARIES}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(BUILD_SHARED_LIBS) + set_property(TARGET opentelemetry_proto PROPERTY POSITION_INDEPENDENT_CODE ON) + endif() diff --git a/recipes/opentelemetry-cpp/all/patches/1.8.1-0001-fix-cmake.patch b/recipes/opentelemetry-cpp/all/patches/1.8.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..5c4fcae46b11b --- /dev/null +++ b/recipes/opentelemetry-cpp/all/patches/1.8.1-0001-fix-cmake.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 9b9710d..6eb42bb 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -222,7 +222,6 @@ if(WITH_JAEGER) + find_package(Thrift QUIET) + if(Thrift_FOUND) + find_package(Boost REQUIRED) +- include_directories(${Boost_INCLUDE_DIR}) + else() + # Install Thrift and propagate via vcpkg toolchain file + if(WIN32 AND (NOT DEFINED CMAKE_TOOLCHAIN_FILE)) +diff --git a/cmake/opentelemetry-proto.cmake b/cmake/opentelemetry-proto.cmake +index 47f57a6..ebf5869 100644 +--- a/cmake/opentelemetry-proto.cmake ++++ b/cmake/opentelemetry-proto.cmake +@@ -280,6 +280,10 @@ else() # cmake 3.8 or lower + target_link_libraries(opentelemetry_proto INTERFACE ${Protobuf_LIBRARIES}) + endif() + ++if(TARGET gRPC::grpc++) ++ target_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++) ++endif() ++ + if(BUILD_SHARED_LIBS) + set_property(TARGET opentelemetry_proto PROPERTY POSITION_INDEPENDENT_CODE ON) + endif() diff --git a/recipes/opentelemetry-cpp/all/test_package/CMakeLists.txt b/recipes/opentelemetry-cpp/all/test_package/CMakeLists.txt index 85330da09a2aa..53dd5c5a1c6f7 100644 --- a/recipes/opentelemetry-cpp/all/test_package/CMakeLists.txt +++ b/recipes/opentelemetry-cpp/all/test_package/CMakeLists.txt @@ -1,13 +1,9 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(opentelemetry-cpp REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_include_directories(${CMAKE_PROJECT_NAME} PRIVATE ${OPENTELEMETRY_CPP_INCLUDE_DIRS}) -target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE ${OPENTELEMETRY_CPP_LIBRARIES}) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE opentelemetry-cpp::opentelemetry-cpp) target_compile_features(${CMAKE_PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/opentelemetry-cpp/all/test_package/conanfile.py b/recipes/opentelemetry-cpp/all/test_package/conanfile.py index 1bf1c7e26255d..a9fb96656f203 100644 --- a/recipes/opentelemetry-cpp/all/test_package/conanfile.py +++ b/recipes/opentelemetry-cpp/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt b/recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..432e5d7c64ed4 --- /dev/null +++ b/recipes/opentelemetry-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(opentelemetry-cpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE opentelemetry-cpp::opentelemetry-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/opentelemetry-cpp/all/test_v1_package/conanfile.py b/recipes/opentelemetry-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/opentelemetry-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opentelemetry-cpp/config.yml b/recipes/opentelemetry-cpp/config.yml index 8a2917f453076..4dd7c49be1a03 100644 --- a/recipes/opentelemetry-cpp/config.yml +++ b/recipes/opentelemetry-cpp/config.yml @@ -1,4 +1,10 @@ versions: + "1.8.1": + folder: all + "1.7.0": + folder: all + "1.6.1": + folder: all "1.4.1": folder: all "1.4.0": diff --git a/recipes/openxlsx/all/conandata.yml b/recipes/openxlsx/all/conandata.yml new file mode 100644 index 0000000000000..b863f248b7ed4 --- /dev/null +++ b/recipes/openxlsx/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.4.1": + url: "https://github.com/troldal/OpenXLSX/archive/b80da42d1454f361c29117095ebe1989437db390.zip" + sha256: "feb03e603aebec3d901dc32c8bf0b3e5df63f6db9ad4bbe187aa4c1633cfd44b" diff --git a/recipes/openxlsx/all/conanfile.py b/recipes/openxlsx/all/conanfile.py new file mode 100644 index 0000000000000..47998aed0e084 --- /dev/null +++ b/recipes/openxlsx/all/conanfile.py @@ -0,0 +1,102 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + +required_conan_version = ">=1.53.0" + +class OpenXlsxConan(ConanFile): + name = "openxlsx" + description = "reading, writing, creating and modifying Microsoft Excel® (.xlsx) files." + license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/troldal/OpenXLSX" + topics = ("excel", "spreadsheet", "xlsx") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "9", + "clang": "9", + "apple-clang": "12", + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OPENXLSX_CREATE_DOCS"] = False + tc.variables["OPENXLSX_BUILD_SAMPLES"] = False + tc.variables["OPENXLSX_BUILD_TESTS"] = False + tc.variables["OPENXLSX_BUILD_BENCHMARKS"] = False + tc.variables["OPENXLSX_LIBRARY_TYPE"] = "SHARED" if self.options.shared else "STATIC" + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + lib_suffix = "d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [f"OpenXLSX{lib_suffix}"] + + self.cpp_info.set_property("cmake_file_name", "OpenXLSX") + self.cpp_info.set_property("cmake_target_name", "OpenXLSX::OpenXLSX") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("dl") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "OpenXLSX" + self.cpp_info.filenames["cmake_find_package_multi"] = "OpenXLSX" + self.cpp_info.names["cmake_find_package"] = "OpenXLSX" + self.cpp_info.names["cmake_find_package_multi"] = "OpenXLSX" diff --git a/recipes/openxlsx/all/test_package/CMakeLists.txt b/recipes/openxlsx/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..63dbcb0eff0ef --- /dev/null +++ b/recipes/openxlsx/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(OpenXLSX REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE OpenXLSX::OpenXLSX) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/openxlsx/all/test_package/conanfile.py b/recipes/openxlsx/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/openxlsx/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/openxlsx/all/test_package/test_package.cpp b/recipes/openxlsx/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c717bd551aae3 --- /dev/null +++ b/recipes/openxlsx/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include + +#include "OpenXLSX/OpenXLSX.hpp" + +using namespace std; +using namespace OpenXLSX; + +int main(void) { + XLDocument doc; + doc.close(); + + return 0; +} diff --git a/recipes/openxlsx/all/test_v1_package/CMakeLists.txt b/recipes/openxlsx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/openxlsx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/openxlsx/all/test_v1_package/conanfile.py b/recipes/openxlsx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/openxlsx/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/openxlsx/config.yml b/recipes/openxlsx/config.yml new file mode 100644 index 0000000000000..3a9d5538921fc --- /dev/null +++ b/recipes/openxlsx/config.yml @@ -0,0 +1,3 @@ +versions: + "0.4.1": + folder: all diff --git a/recipes/optional-lite/all/conanfile.py b/recipes/optional-lite/all/conanfile.py index 5761d46d53213..f70e5bfcb8e65 100644 --- a/recipes/optional-lite/all/conanfile.py +++ b/recipes/optional-lite/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class OptionalLiteConan(ConanFile): @@ -14,24 +16,29 @@ class OptionalLiteConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "optional-lite") self.cpp_info.set_property("cmake_target_name", "nonstd::optional-lite") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "optional-lite" @@ -41,3 +48,6 @@ def package_info(self): self.cpp_info.components["optionallite"].names["cmake_find_package"] = "optional-lite" self.cpp_info.components["optionallite"].names["cmake_find_package_multi"] = "optional-lite" self.cpp_info.components["optionallite"].set_property("cmake_target_name", "nonstd::optional-lite") + self.cpp_info.components["optionallite"].bindirs = [] + self.cpp_info.components["optionallite"].libdirs = [] + self.cpp_info.components["optionallite"].resdirs = [] diff --git a/recipes/optional-lite/all/test_package/CMakeLists.txt b/recipes/optional-lite/all/test_package/CMakeLists.txt index 7d6c9b6cca813..cc0865d43e169 100644 --- a/recipes/optional-lite/all/test_package/CMakeLists.txt +++ b/recipes/optional-lite/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(optional-lite REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} nonstd::optional-lite) +target_link_libraries(${PROJECT_NAME} PRIVATE nonstd::optional-lite) diff --git a/recipes/optional-lite/all/test_package/conanfile.py b/recipes/optional-lite/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/optional-lite/all/test_package/conanfile.py +++ b/recipes/optional-lite/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/optional-lite/all/test_v1_package/CMakeLists.txt b/recipes/optional-lite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..381a5d41cbb1b --- /dev/null +++ b/recipes/optional-lite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(optional-lite REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE nonstd::optional-lite) diff --git a/recipes/optional-lite/all/test_v1_package/conanfile.py b/recipes/optional-lite/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/optional-lite/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/opus/all/conanfile.py b/recipes/opus/all/conanfile.py index cc0e188c8d90f..548f3227f6d6e 100644 --- a/recipes/opus/all/conanfile.py +++ b/recipes/opus/all/conanfile.py @@ -1,11 +1,10 @@ from conan import ConanFile -from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir -from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import check_min_vs import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class OpusConan(ConanFile): @@ -29,33 +28,24 @@ class OpusConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass - - def validate(self): - if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < "14": - raise ConanInvalidConfiguration("On Windows, the opus package can only be built with " - "Visual Studio 2015 or higher.") + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + check_min_vs(self, 190) + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) diff --git a/recipes/opus/all/test_package/conanfile.py b/recipes/opus/all/test_package/conanfile.py index eff49aeb41ba6..642aa7eed877c 100644 --- a/recipes/opus/all/test_package/conanfile.py +++ b/recipes/opus/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,20 +7,21 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") pcm_path = os.path.join(self.source_folder, "test.pcm") self.run(f"{bin_path} {pcm_path} out.pcm", env="conanrun") diff --git a/recipes/opus/all/test_v1_package/CMakeLists.txt b/recipes/opus/all/test_v1_package/CMakeLists.txt index a1410ba86a324..0d20897301b68 100644 --- a/recipes/opus/all/test_v1_package/CMakeLists.txt +++ b/recipes/opus/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Opus REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE Opus::opus) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opus/all/test_v1_package/conanfile.py b/recipes/opus/all/test_v1_package/conanfile.py index d19e8601deb35..9534054c99e3c 100644 --- a/recipes/opus/all/test_v1_package/conanfile.py +++ b/recipes/opus/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/opusfile/all/conandata.yml b/recipes/opusfile/all/conandata.yml index eebd6b1e0a89c..6248280777374 100644 --- a/recipes/opusfile/all/conandata.yml +++ b/recipes/opusfile/all/conandata.yml @@ -8,7 +8,11 @@ sources: patches: "0.12": - patch_file: "patches/001-disable-cert-store-integration.patch" - base_path: "source_subfolder" + patch_description: "Allow to build with OpenSSL 1.1" + patch_type: "portability" + patch_source: "https://github.com/xiph/opusfile/issues/13#issuecomment-425349836" "0.11": - patch_file: "patches/001-disable-cert-store-integration.patch" - base_path: "source_subfolder" + patch_description: "Allow to build with OpenSSL 1.1" + patch_type: "portability" + patch_source: "https://github.com/xiph/opusfile/issues/13#issuecomment-425349836" diff --git a/recipes/opusfile/all/conanfile.py b/recipes/opusfile/all/conanfile.py index be6dba78da278..c7c9a6ee8b4e2 100644 --- a/recipes/opusfile/all/conanfile.py +++ b/recipes/opusfile/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, MSBuild, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, MSBuild, MSBuildDeps, MSBuildToolchain import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class OpusFileConan(ConanFile): @@ -24,118 +30,144 @@ class OpusFileConan(ConanFile): "http": True, } - generators = "pkg_config" - exports_sources = "patches/*" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @property - def _is_msvc(self): - return self.settings.compiler == "Visual Studio" + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def validate(self): - if self._is_msvc and self.options.shared: - raise ConanInvalidConfiguration("Opusfile doesn't support building as shared with Visual Studio") + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("ogg/1.3.5") self.requires("opus/1.3.1") if self.options.http: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") + + def validate(self): + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} doesn't support building as shared with Visual Studio") def build_requirements(self): - if not self._is_msvc: - self.build_requires("libtool/2.4.6") - self.build_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not is_msvc(self): + self.tool_requires("libtool/2.4.7") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() + deps = MSBuildDeps(self) + deps.configuration = self._msbuild_configuration + deps.generate() + else: + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + f"--enable-http={yes_no(self.options.http)}", + "--disable-examples", + ]) + tc.generate() + PkgConfigDeps(self).generate() - def _build_vs(self): - includedir = os.path.abspath(os.path.join(self._source_subfolder, "include")) - with tools.chdir(os.path.join(self._source_subfolder, "win32", "VS2015")): - msbuild = MSBuild(self) - build_type = str(self.settings.build_type) + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + sln_folder = os.path.join(self.source_folder, "win32", "VS2015") + vcxproj = os.path.join(sln_folder, "opusfile.vcxproj") if not self.options.http: - build_type += "-NoHTTP" - msbuild.build_env.include_paths.append(includedir) - msbuild.build(project_file="opusfile.sln", targets=["opusfile"], - platforms={"x86": "Win32"}, build_type=build_type, - upgrade_project=False) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--enable-http={}".format(yes_no(self.options.http)), - "--disable-examples", - ] - self._autotools.configure(args=args, configure_dir=self._source_subfolder) - return self._autotools + replace_in_file(self, vcxproj, "OP_ENABLE_HTTP;", "") + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + replace_in_file( + self, vcxproj, + "true", + "", + ) + replace_in_file( + self, vcxproj, + "v140", + f"{MSBuildToolchain(self).toolset}", + ) + import_conan_generators = "" + for props_file in [MSBuildToolchain.filename, "conandeps.props"]: + props_path = os.path.join(self.generators_folder, props_file) + if os.path.exists(props_path): + import_conan_generators += f"" + replace_in_file( + self, vcxproj, + "", + f"{import_conan_generators}", + ) + #============================== - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if self._is_msvc: - self._build_vs() + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(sln_folder, "opusfile.sln"), targets=["opusfile"]) else: - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows, run_environment=True) - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern="*", dst=os.path.join("include", "opus"), src=include_folder) - self.copy(pattern="*.dll", dst="bin", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + include_folder = os.path.join(self.source_folder, "include") + copy(self, "*", src=include_folder, dst=os.path.join(self.package_folder, "include", "opus")) + copy(self, "*.dll", src=self.source_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + copy(self, "*.lib", src=self.source_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): - self.cpp_info.components["libopusfile"].names["pkg_config"] = "opusfile" + self.cpp_info.components["libopusfile"].set_property("pkg_config_name", "opusfile") self.cpp_info.components["libopusfile"].libs = ["opusfile"] self.cpp_info.components["libopusfile"].includedirs.append(os.path.join("include", "opus")) self.cpp_info.components["libopusfile"].requires = ["ogg::ogg", "opus::opus"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.components["libopusfile"].system_libs = ["m", "dl", "pthread"] - if self._is_msvc: + if is_msvc(self): if self.options.http: self.cpp_info.components["libopusfile"].requires.append("openssl::openssl") else: - self.cpp_info.components["opusurl"].names["pkg_config"] = "opusurl" + self.cpp_info.set_property("pkg_config_name", "opusfile-do-not-use") + self.cpp_info.components["opusurl"].set_property("pkg_config_name", "opusurl") self.cpp_info.components["opusurl"].libs = ["opusurl"] self.cpp_info.components["opusurl"].requires = ["libopusfile"] if self.options.http: diff --git a/recipes/opusfile/all/patches/001-disable-cert-store-integration.patch b/recipes/opusfile/all/patches/001-disable-cert-store-integration.patch index 72a77fc47f380..d6aaf58d662c6 100644 --- a/recipes/opusfile/all/patches/001-disable-cert-store-integration.patch +++ b/recipes/opusfile/all/patches/001-disable-cert-store-integration.patch @@ -1,5 +1,3 @@ -patch taken from https://github.com/xiph/opusfile/issues/13#issuecomment-425349836 for OpenSSL 1.1.1 support - diff -Nur opusfile-0.11/src/http.c opusfile-0.11-patched/src/http.c --- a/src/http.c 2018-09-14 23:25:45.000000000 +0200 +++ b/src/http.c 2018-09-27 15:42:55.161531800 +0200 diff --git a/recipes/opusfile/all/test_package/CMakeLists.txt b/recipes/opusfile/all/test_package/CMakeLists.txt index 7b9b613cbb24a..70e83b74bb91b 100644 --- a/recipes/opusfile/all/test_package/CMakeLists.txt +++ b/recipes/opusfile/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(opusfile REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE opusfile::opusfile) diff --git a/recipes/opusfile/all/test_package/conanfile.py b/recipes/opusfile/all/test_package/conanfile.py index d4128b0450777..98ab55852ad56 100644 --- a/recipes/opusfile/all/test_package/conanfile.py +++ b/recipes/opusfile/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/opusfile/all/test_v1_package/CMakeLists.txt b/recipes/opusfile/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/opusfile/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/opusfile/all/test_v1_package/conanfile.py b/recipes/opusfile/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/opusfile/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/orcania/all/conandata.yml b/recipes/orcania/all/conandata.yml new file mode 100644 index 0000000000000..a6c92d3317bea --- /dev/null +++ b/recipes/orcania/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + "2.3.1": + url: "https://github.com/babelouest/orcania/archive/refs/tags/v2.3.1.tar.gz" + sha256: "bbf08d563528b8ab88dd4b0e67aeb4e7c4fc9f19dcd1a0346b773cf492f7612b" +patches: + "2.3.1": + - patch_file: "patches/2.3.1-0001-mingw-fix-Werror=stringop-truncation.patch" + patch_description: "Fixes -Werror=stringop-truncation error when building with MinGW@Linux" + patch_type: "conan" + - patch_file: "patches/2.3.1-0002-no-m.patch" + patch_description: "m math library is not really needed" + patch_type: "conan" + - patch_file: "patches/2.3.1-0003-shared-static-conan.patch" + patch_description: "Build shared and static libraries + fix MSVC support" + patch_type: "conan" diff --git a/recipes/orcania/all/conanfile.py b/recipes/orcania/all/conanfile.py new file mode 100644 index 0000000000000..610d680187019 --- /dev/null +++ b/recipes/orcania/all/conanfile.py @@ -0,0 +1,144 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +import os +import textwrap + +required_conan_version = ">=1.52.0" + + +class OrcaniaConan(ConanFile): + name = "orcania" + description = "Potluck with different functions for different purposes that can be shared among C programs" + homepage = "https://github.com/babelouest/orcania" + topics = ("utility", "functions", ) + license = "LGPL-2.1-or-later" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "enable_base64url": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "enable_base64url": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def requirements(self): + if is_msvc(self) and self.options.enable_base64url: + self.requires("getopt-for-visual-studio/20200201") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_BASE64URL"] = self.options.enable_base64url + tc.variables["BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", os.path.join(self.source_folder), os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + save(self, os.path.join(self.package_folder, self._variable_file_rel_path), + textwrap.dedent(f"""\ + set(ORCANIA_VERSION_STRING "{self.version}") + """)) + + # TODO: to remove in conan v2 once cmake_find_package* generators removed + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {} if self.options.shared else {"Orcania::Orcania-static": "Orcania::Orcania"} + ) + + def _create_cmake_module_alias_targets(self, module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent(f"""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + + @property + def _variable_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + + def package_info(self): + libname = "orcania" + if is_msvc(self) and not self.options.shared: + libname += "-static" + self.cpp_info.libs = [libname] + + target_name = "Orcania::Orcania" if self.options.shared else "Orcania::Orcania-static" + self.cpp_info.set_property("cmake_file_name", "Orcania") + self.cpp_info.set_property("cmake_target_name", target_name) + self.cpp_info.set_property("cmake_module_file_name", "Orcania") + self.cpp_info.set_property("cmake_module_target_name", target_name) + self.cpp_info.set_property("pkg_config_name", "liborcania") + self.cpp_info.set_property("cmake_build_modules", [self._variable_file_rel_path]) + + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "Orcania" + self.cpp_info.filenames["cmake_find_package_multi"] = "Orcania" + self.cpp_info.names["cmake_find_package"] = "Orcania" + self.cpp_info.names["cmake_find_package_multi"] = "Orcania" + self.cpp_info.names["pkg_config"] = "liborcania" + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path, self._variable_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path, self._variable_file_rel_path] diff --git a/recipes/orcania/all/patches/2.3.1-0001-mingw-fix-Werror=stringop-truncation.patch b/recipes/orcania/all/patches/2.3.1-0001-mingw-fix-Werror=stringop-truncation.patch new file mode 100644 index 0000000000000..d44e1abf5481a --- /dev/null +++ b/recipes/orcania/all/patches/2.3.1-0001-mingw-fix-Werror=stringop-truncation.patch @@ -0,0 +1,25 @@ +Fixes: +In function 'o_strncpy', + inlined from 'mstrcatf' at /home/maarten/programming/orcania/src/orcania.c:131:11: +/home/maarten/programming/orcania/src/orcania.c:208:12: error: 'strncpy' output truncated before terminating nul copying as many bytes from a string as its length [-Werror=stringop-truncation] + 208 | return strncpy(p1, p2, n); + | ^~~~~~~~~~~~~~~~~~ +/home/maarten/programming/orcania/src/orcania.c: In function 'mstrcatf': +/home/maarten/programming/orcania/src/orcania.c:343:12: note: length computed here + 343 | return strlen(s); + | ^~~~~~~~~ + + +--- src/orcania.c ++++ src/src/orcania.c +@@ -148,8 +148,8 @@ char * mstrcatf(char * source, const char * message, ...) { + out = o_malloc(source_len+message_formatted_len+sizeof(char)); + vsnprintf(message_formatted, (message_formatted_len+sizeof(char)), message, argp_cpy); + if (out != NULL) { +- o_strncpy(out, source, source_len); +- o_strncpy(out+source_len, message_formatted, message_formatted_len); ++ memcpy(out, source, source_len); ++ memcpy(out+source_len, message_formatted, message_formatted_len); + out[source_len+message_formatted_len] = '\0'; + } + o_free(message_formatted); diff --git a/recipes/orcania/all/patches/2.3.1-0002-no-m.patch b/recipes/orcania/all/patches/2.3.1-0002-no-m.patch new file mode 100644 index 0000000000000..30c401f4a359d --- /dev/null +++ b/recipes/orcania/all/patches/2.3.1-0002-no-m.patch @@ -0,0 +1,9 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -34,1 +34,1 @@ +-set(LIBS "-lm") ++set(LIBS ) +--- src/base64.c ++++ src/base64.c +@@ -10,1 +11,0 @@ +-#include diff --git a/recipes/orcania/all/patches/2.3.1-0003-shared-static-conan.patch b/recipes/orcania/all/patches/2.3.1-0003-shared-static-conan.patch new file mode 100644 index 0000000000000..ff2311a44bd70 --- /dev/null +++ b/recipes/orcania/all/patches/2.3.1-0003-shared-static-conan.patch @@ -0,0 +1,156 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -112,29 +112,47 @@ + + # static library + ++option(BUILD_SHARED "Build shared library." ON) + option(BUILD_STATIC "Build static library." OFF) + ++if (NOT BUILD_STATIC AND NOT BUILD_SHARED) ++ message(FATAL_ERROR "BUILD_SHAREDand BUILD_STATIC cannot be both disabled") ++endif () ++ + if (BUILD_STATIC) + add_library(orcania_static STATIC ${LIB_SRC}) ++ set_target_properties(orcania_static PROPERTIES ++ PUBLIC_HEADER "${INC_DIR}/orcania.h;${PROJECT_BINARY_DIR}/orcania-cfg.h") + target_compile_definitions(orcania_static PUBLIC -DO_STATIC_LIBRARY) + set_target_properties(orcania_static PROPERTIES + OUTPUT_NAME orcania) ++ if (MSVC) ++ set_target_properties(orcania_static PROPERTIES ++ OUTPUT_NAME orcania-static) ++ endif () ++ set(orcania_lib orcania_static) + endif () + + # shared library + +-add_library(orcania SHARED ${LIB_SRC}) +-if (NOT MSVC) ++if (BUILD_SHARED) ++ add_library(orcania SHARED ${LIB_SRC}) + set_target_properties(orcania PROPERTIES +- COMPILE_OPTIONS -Wextra +- PUBLIC_HEADER "${INC_DIR}/orcania.h;${PROJECT_BINARY_DIR}/orcania-cfg.h" +- VERSION "${LIBRARY_VERSION}" +- SOVERSION "${LIBRARY_SOVERSION}") +-endif() +-if (WIN32) +- set_target_properties(orcania PROPERTIES SUFFIX "-${LIBRARY_VERSION_MAJOR}.dll") ++ PUBLIC_HEADER "${INC_DIR}/orcania.h;${PROJECT_BINARY_DIR}/orcania-cfg.h") ++ if (NOT MSVC) ++ set_target_properties(orcania PROPERTIES ++ COMPILE_OPTIONS -Wextra ++ VERSION "${LIBRARY_VERSION}" ++ SOVERSION "${LIBRARY_SOVERSION}") ++ endif() ++ if (WIN32) ++ set_target_properties(orcania PROPERTIES ++ SUFFIX "-${LIBRARY_VERSION_MAJOR}.dll" ++ WINDOWS_EXPORT_ALL_SYMBOLS TRUE) ++ endif () ++ target_link_libraries(orcania ${LIBS}) ++ set(orcania_lib orcania) + endif () +-target_link_libraries(orcania ${LIBS}) + + # documentation + +@@ -165,10 +183,14 @@ + if (BUILD_BASE64URL) + add_executable(base64url ${BASE64URL_DIR}/base64url.c ${INC_DIR}/orcania.h ${PROJECT_BINARY_DIR}/orcania-cfg.h) + set_target_properties(base64url PROPERTIES SKIP_BUILD_RPATH TRUE) +- add_dependencies(base64url orcania) +- target_link_libraries(base64url orcania ${LIBS}) ++ add_dependencies(base64url ${orcania_lib}) ++ target_link_libraries(base64url ${orcania_lib} ${LIBS}) + install(TARGETS base64url RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + install(FILES ${BASE64URL_DIR}/base64url.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT runtime) ++ if(MSVC) ++ find_package(getopt-for-visual-studio REQUIRED) ++ target_link_libraries(base64url getopt-for-visual-studio::getopt-for-visual-studio) ++ endif() + endif () + + # tests +@@ -244,9 +266,12 @@ + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/liborcania.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + +-set(TARGETS orcania) ++set(TARGETS ) ++if (BUILD_SHARED) ++ list(APPEND TARGETS orcania) ++endif () + if (BUILD_STATIC) +- set(TARGETS ${TARGETS} orcania_static) ++ list(APPEND TARGETS orcania_static) + endif () + + if (INSTALL_HEADER) +@@ -320,6 +345,7 @@ + COMMAND ${CMAKE_MAKE_PROGRAM} package_source) + + message(STATUS "Force inline implementation of strstr: ${WITH_STRSTR}") ++message(STATUS "Build shared library: ${BUILD_SHARED}") + message(STATUS "Build static library: ${BUILD_STATIC}") + message(STATUS "Build testing tree: ${BUILD_ORCANIA_TESTING}") + message(STATUS "Install the header files: ${INSTALL_HEADER}") +--- src/orcania.c ++++ src/orcania.c +@@ -38,6 +38,13 @@ + #define strcasecmp _stricmp + #endif + ++#ifdef _MSC_VER ++#include ++typedef SSIZE_T ssize_t; ++#else ++#include ++#endif ++ + /** + * + * Orcania library +--- tools/base64url/base64url.c ++++ tools/base64url/base64url.c +@@ -19,13 +19,20 @@ + * + */ + +-#include + #include + #include + #include + #include + #include + ++#ifdef _MSC_VER ++#include ++#include ++typedef SSIZE_T ssize_t; ++#else ++#include ++#endif ++ + #define _BASE64URL_VERSION "0.9" + + #define ACTION_ENCODE 0 +@@ -98,12 +105,12 @@ + } + + static unsigned char * get_stdin_content(size_t * length) { +- int size = 100; +- unsigned char * out = NULL, buffer[size]; ++#define SIZE 100 ++ unsigned char * out = NULL, buffer[SIZE]; + ssize_t read_length; + + *length = 0; +- while ((read_length = read(0, buffer, size)) > 0) { ++ while ((read_length = read(0, buffer, SIZE)) > 0) { + out = o_realloc(out, (*length)+read_length+1); + memcpy(out+(*length), buffer, read_length); + (*length) += read_length; diff --git a/recipes/orcania/all/test_package/CMakeLists.txt b/recipes/orcania/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3fa9c9d5af35f --- /dev/null +++ b/recipes/orcania/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(Orcania REQUIRED CONFIG) + +option(ORCANIA_SHARED "Orcania is built as a shared library") + +add_executable(${PROJECT_NAME} test_package.c) +if(ORCANIA_SHARED) + target_link_libraries(${PROJECT_NAME} PRIVATE Orcania::Orcania) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE Orcania::Orcania-static) +endif() diff --git a/recipes/orcania/all/test_package/conanfile.py b/recipes/orcania/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0fc1e7b663eaf --- /dev/null +++ b/recipes/orcania/all/test_package/conanfile.py @@ -0,0 +1,31 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ORCANIA_SHARED"] = self.dependencies["orcania"].options.shared + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/orcania/all/test_package/test_package.c b/recipes/orcania/all/test_package/test_package.c new file mode 100644 index 0000000000000..f8bd394a51f33 --- /dev/null +++ b/recipes/orcania/all/test_package/test_package.c @@ -0,0 +1,11 @@ +#include +#include +#include + +int main() { + const char *mystring = "Hello world!"; + char* str2 = o_strdup(mystring); + puts(str2); + free(str2); + return 0; +} diff --git a/recipes/orcania/all/test_v1_package/CMakeLists.txt b/recipes/orcania/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..08501e6ccb845 --- /dev/null +++ b/recipes/orcania/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(Orcania REQUIRED CONFIG) + +option(ORCANIA_SHARED "Orcania is built as a shared library") + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +if(ORCANIA_SHARED) + target_link_libraries(${PROJECT_NAME} PRIVATE Orcania::Orcania) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE Orcania::Orcania-static) +endif() diff --git a/recipes/orcania/all/test_v1_package/conanfile.py b/recipes/orcania/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..79db5a07b9c06 --- /dev/null +++ b/recipes/orcania/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["ORCANIA_SHARED"] = self.options["orcania"].shared + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/orcania/config.yml b/recipes/orcania/config.yml new file mode 100644 index 0000000000000..215bc57fe4993 --- /dev/null +++ b/recipes/orcania/config.yml @@ -0,0 +1,3 @@ +versions: + "2.3.1": + folder: all diff --git a/recipes/osmanip/all/CMakeLists.txt b/recipes/osmanip/all/CMakeLists.txt index d2b860e0e9996..ae515532d7df7 100644 --- a/recipes/osmanip/all/CMakeLists.txt +++ b/recipes/osmanip/all/CMakeLists.txt @@ -1,28 +1,33 @@ cmake_minimum_required(VERSION 3.13) project(osmanip LANGUAGES CXX) -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - find_package(arsenalgear REQUIRED CONFIG) add_library(osmanip) target_sources(osmanip PRIVATE - source_subfolder/src/graphics/canvas.cpp - source_subfolder/src/graphics/plot_2D.cpp + ${OSMANIP_SRC_DIR}/src/graphics/canvas.cpp + ${OSMANIP_SRC_DIR}/src/graphics/plot_2D.cpp + $<$: + ${OSMANIP_SRC_DIR}/src/manipulators/colsty.cpp + ${OSMANIP_SRC_DIR}/src/manipulators/common.cpp + ${OSMANIP_SRC_DIR}/src/manipulators/cursor.cpp + ${OSMANIP_SRC_DIR}/src/manipulators/decorator.cpp + > + $<$,$>: + ${OSMANIP_SRC_DIR}/src/manipulators/colsty.cpp + ${OSMANIP_SRC_DIR}/src/manipulators/common.cpp + ${OSMANIP_SRC_DIR}/src/manipulators/cursor.cpp + ${OSMANIP_SRC_DIR}/src/manipulators/printer.cpp + > $<$: - source_subfolder/src/manipulators/csmanip.cpp + ${OSMANIP_SRC_DIR}/src/manipulators/csmanip.cpp > - $<$: - source_subfolder/src/manipulators/printer.cpp - source_subfolder/src/manipulators/cursor.cpp - source_subfolder/src/manipulators/common.cpp - source_subfolder/src/manipulators/colsty.cpp + $<$: + ${OSMANIP_SRC_DIR}/src/progressbar/progress_bar.cpp > - source_subfolder/src/progressbar/progress_bar.cpp - source_subfolder/src/utility/windows.cpp + ${OSMANIP_SRC_DIR}/src/utility/windows.cpp ) -target_include_directories(osmanip PUBLIC source_subfolder/include/) +target_include_directories(osmanip PUBLIC ${OSMANIP_SRC_DIR}/include/) target_compile_features(osmanip PUBLIC cxx_std_17) set_target_properties(osmanip PROPERTIES PUBLIC_HEADER "${osmanip_inc}" @@ -44,6 +49,6 @@ install( ) install( - DIRECTORY source_subfolder/include/ + DIRECTORY ${OSMANIP_SRC_DIR}/include/ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/osmanip ) diff --git a/recipes/osmanip/all/conandata.yml b/recipes/osmanip/all/conandata.yml index 0006776795ddd..02c907a3fa56b 100644 --- a/recipes/osmanip/all/conandata.yml +++ b/recipes/osmanip/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "4.4.0": + url: "https://github.com/JustWhit3/osmanip/archive/v4.3.0.tar.gz" + sha256: "e0d982d19792c3e438e3be99f789434b66788f9a7114f217b3c5f28d0121af7f" + "4.3.0": + url: "https://github.com/JustWhit3/osmanip/archive/v4.3.0.tar.gz" + sha256: "e0d982d19792c3e438e3be99f789434b66788f9a7114f217b3c5f28d0121af7f" + "4.2.2": + url: "https://github.com/JustWhit3/osmanip/archive/v4.2.2.tar.gz" + sha256: "841b76bb4f44b66d714858e62661cee75c4fef553300b6da2a6720509421a5fe" + "4.2.1": + url: "https://github.com/JustWhit3/osmanip/archive/refs/tags/v4.2.1.tar.gz" + sha256: "1d1ba3fac66edc7a7e4c480a0c080493d19193f9b63b70d417e2683f8741bf1c" "4.1.0": url: "https://github.com/JustWhit3/osmanip/archive/refs/tags/v4.1.0.tar.gz" sha256: "9830316fea29300aeebadb0cd6cddd6f291a8fa04c397bca9666d045815d1d53" @@ -8,6 +20,6 @@ sources: patches: "4.0.0": - # This patch is for function renaming on arsenalgear/1.2.2. - patch_file: "patches/0001-replace-runtime_error_func.patch" - base_path: "source_subfolder" + patch_description: "following function renaming on arsenalgear/1.2.2" + patch_type: "conan" diff --git a/recipes/osmanip/all/conanfile.py b/recipes/osmanip/all/conanfile.py index b15545e08eb49..ccea62899d710 100644 --- a/recipes/osmanip/all/conanfile.py +++ b/recipes/osmanip/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -required_conan_version = ">=1.33.0" +import os + +required_conan_version = ">=1.53.0" class OsmanipConan(ConanFile): name = "osmanip" @@ -20,16 +25,10 @@ class OsmanipConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,52 +36,65 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - self.requires("boost/1.79.0") - self.requires("arsenalgear/1.2.2") + self.requires("boost/1.81.0") + if Version(self.version) < "4.2.0": + self.requires("arsenalgear/1.2.2") + else: + self.requires("arsenalgear/2.0.1") + + @property + def _minimum_cpp_standard(self): + return 17 @property def _compiler_required_cpp17(self): return { "Visual Studio": "16", + "msvc": "191", "gcc": "8", "clang": "7", "apple-clang": "12.0", } def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + if self.info.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) + minimum_version = self._compiler_required_cpp17.get(str(self.info.settings.compiler), False) if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) + if Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") else: - self.output.warn("{0} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + self.output.warn(f"{self.ref} requires C++{self._minimum_cpp_standard}. Your compiler is unknown. Assuming it supports C++{self._minimum_cpp_standard}") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["OSMANIP_VERSION"] = str(self.version) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["OSMANIP_VERSION"] = str(self.version) + tc.variables["OSMANIP_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/osmanip/all/test_package/CMakeLists.txt b/recipes/osmanip/all/test_package/CMakeLists.txt index a8ff5f965b314..02a74d2349c2e 100644 --- a/recipes/osmanip/all/test_package/CMakeLists.txt +++ b/recipes/osmanip/all/test_package/CMakeLists.txt @@ -2,11 +2,8 @@ cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(osmanip REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} osmanip::osmanip) +target_link_libraries(${PROJECT_NAME} PRIVATE osmanip::osmanip) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/osmanip/all/test_package/conanfile.py b/recipes/osmanip/all/test_package/conanfile.py index a500b98343c74..a9fbb7f543162 100644 --- a/recipes/osmanip/all/test_package/conanfile.py +++ b/recipes/osmanip/all/test_package/conanfile.py @@ -1,9 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/osmanip/all/test_v1_package/CMakeLists.txt b/recipes/osmanip/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..426dbc1aa18df --- /dev/null +++ b/recipes/osmanip/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/osmanip/all/test_v1_package/conanfile.py b/recipes/osmanip/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/osmanip/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/osmanip/config.yml b/recipes/osmanip/config.yml index 12265c7300e2e..50f7633ad31f3 100644 --- a/recipes/osmanip/config.yml +++ b/recipes/osmanip/config.yml @@ -1,4 +1,12 @@ versions: + "4.4.0": + folder: all + "4.3.0": + folder: all + "4.2.2": + folder: all + "4.2.1": + folder: all "4.1.0": folder: all "4.0.0": diff --git a/recipes/p7zip/all/conandata.yml b/recipes/p7zip/all/conandata.yml new file mode 100644 index 0000000000000..5693cc1e321ba --- /dev/null +++ b/recipes/p7zip/all/conandata.yml @@ -0,0 +1,24 @@ +sources: + "16.02": + url: https://downloads.sourceforge.net/project/p7zip/p7zip/16.02/p7zip_16.02_src_all.tar.bz2 + sha256: "5eb20ac0e2944f6cb9c2d51dd6c4518941c185347d4089ea89087ffdd6e2341f" +patches: + "16.02": + - patch_file: "patches/12-CVE-2016-9296.patch" + patch_source: "https://github.com/conda-forge/p7zip-feedstock/tree/main/recipe" + patch_description: "Addresses CVE-2016-9296: null pointer check for the variable folders.PackPositions in function CInArchive::ReadAndDecodePackedStreams" + - patch_file: "patches/13-CVE-2017-17969.patch" + patch_source: "https://sourceforge.net/p/p7zip/bugs/_discuss/thread/0920f369/27d7" + patch_description: "Addresses CVE-2017-17969: Heap-based buffer overflow in the NCompress::NShrink::CDecoder::CodeReal method" + - patch_file: "patches/14-Fix-g++-warning.patch" + patch_source: "https://github.com/conda-forge/p7zip-feedstock/tree/main/recipe" + patch_description: "Addresses gcc warning: use of an operand of type 'bool' in 'operator++' is deprecated" + - patch_file: "patches/clang.diff" + patch_source: "https://github.com/conda-forge/p7zip-feedstock/tree/main/recipe" + patch_description: "Addresses clang 6.x error: case value evaluates to -2147024809" + - patch_file: "patches/06-CVE-2018-5996.patch" + patch_source: "https://salsa.debian.org/debian/p7zip-rar/-/tree/debian/16.02-3/debian/patches" + patch_description: "Addresses CVE-2018-5996: RAR memory corruptions fix" + - patch_file: "patches/CVE-2018-10115.patch" + patch_source: "https://salsa.debian.org/debian/p7zip-rar/-/tree/debian/16.02-3/debian/patches" + patch_description: "Addresses CVE-2018-10115: Incorrect initialization logic of RAR decoder objects" diff --git a/recipes/p7zip/all/conanfile.py b/recipes/p7zip/all/conanfile.py new file mode 100644 index 0000000000000..0923c8b9413a3 --- /dev/null +++ b/recipes/p7zip/all/conanfile.py @@ -0,0 +1,86 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, replace_in_file, chdir +from conan.tools.layout import basic_layout +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.apple import is_apple_os, to_apple_arch +import os + + +required_conan_version = ">=1.52.0" + + +class PSevenZipConan(ConanFile): + name = "p7zip" + url = "https://github.com/conan-io/conan-center-index" + description = "p7zip is a quick port of 7z.exe and 7za.exe (command line version of 7zip, see www.7-zip.org) for Unix" + license = ("LGPL-2.1", "Unrar") + homepage = "https://sourceforge.net/projects/p7zip/" + topics = ("7zip", "zip", "compression", "decompression") + settings = "os", "arch", "compiler", "build_type" + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + del self.info.settings.compiler + + def validate(self): + if self.info.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} is not supported on Windows - use `7zip` instead") + if self.info.settings.arch not in ("armv8", "x86_64"): + raise ConanInvalidConfiguration(f"{self.ref} is only supported by x86_64 and armv8") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() + + def _patch_compiler(self): + optflags = '' + if is_apple_os(self): + optflags = '-arch ' + to_apple_arch(self) + cc = "clang" if "clang" in str(self.settings.compiler) else str(self.settings.compiler) + cxx = "clang++" if "clang" in str(self.settings.compiler) else str(self.settings.compiler) + if self.settings.compiler == "gcc": + cxx = "g++" + # Replace the hard-coded compilers instead of using the 40 different Makefile permutations + replace_in_file(self, os.path.join(self.source_folder, "makefile.machine"), + "CC=gcc", f"CC={cc}") + replace_in_file(self, os.path.join(self.source_folder, "makefile.machine"), + "CXX=g++", f"CXX={cxx}") + # Manually modify the -O flag here based on the build type + optflags += " -O2" if self.settings.build_type == "Release" else " -O0" + # Silence the warning about `-s` not being valid on clang + if cc != "clang": + optflags += ' -s' + replace_in_file(self, os.path.join(self.source_folder, "makefile.machine"), + "OPTFLAGS=-O -s", "OPTFLAGS=" + optflags) + + def _patch_sources(self): + apply_conandata_patches(self) + self._patch_compiler() + + def build(self): + self._patch_sources() + with chdir(self, self.source_folder): + autotools = Autotools(self) + autotools.make() + + def package(self): + copy(self, "License.txt", src=os.path.join(self.source_folder, "DOC"), dst=os.path.join(self.package_folder, "licenses")) + copy(self, "unRarLicense.txt", src=os.path.join(self.source_folder, "DOC"), dst=os.path.join(self.package_folder, "licenses")) + copy(self, "7za", src=os.path.join(self.source_folder, "bin"), dst=os.path.join(self.package_folder, "bin")) + + def package_info(self): + bin_path = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH environment variable: {bin_path}") + self.env_info.PATH.append(bin_path) + + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/p7zip/all/patches/06-CVE-2018-5996.patch b/recipes/p7zip/all/patches/06-CVE-2018-5996.patch new file mode 100644 index 0000000000000..6733bff918956 --- /dev/null +++ b/recipes/p7zip/all/patches/06-CVE-2018-5996.patch @@ -0,0 +1,221 @@ +From: Robert Luberda +Date: Sun, 28 Jan 2018 23:47:40 +0100 +Subject: CVE-2018-5996 + +Hopefully fix Memory Corruptions via RAR PPMd (CVE-2018-5996) by +applying a few changes from 7Zip 18.00-beta. + +Bug-Debian: https://bugs.debian.org/#888314 +--- + CPP/7zip/Compress/Rar1Decoder.cpp | 13 +++++++++---- + CPP/7zip/Compress/Rar1Decoder.h | 1 + + CPP/7zip/Compress/Rar2Decoder.cpp | 10 +++++++++- + CPP/7zip/Compress/Rar2Decoder.h | 1 + + CPP/7zip/Compress/Rar3Decoder.cpp | 23 ++++++++++++++++++++--- + CPP/7zip/Compress/Rar3Decoder.h | 2 ++ + 6 files changed, 42 insertions(+), 8 deletions(-) + +diff --git a/CPP/7zip/Compress/Rar1Decoder.cpp b/CPP/7zip/Compress/Rar1Decoder.cpp +index 1aaedcc..68030c7 100644 +--- a/CPP/7zip/Compress/Rar1Decoder.cpp ++++ b/CPP/7zip/Compress/Rar1Decoder.cpp +@@ -29,7 +29,7 @@ public: + }; + */ + +-CDecoder::CDecoder(): m_IsSolid(false) { } ++CDecoder::CDecoder(): m_IsSolid(false), _errorMode(false) { } + + void CDecoder::InitStructures() + { +@@ -406,9 +406,14 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream * + InitData(); + if (!m_IsSolid) + { ++ _errorMode = false; + InitStructures(); + InitHuff(); + } ++ ++ if (_errorMode) ++ return S_FALSE; ++ + if (m_UnpackSize > 0) + { + GetFlagsBuf(); +@@ -477,9 +482,9 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream + const UInt64 *inSize, const UInt64 *outSize, ICompressProgressInfo *progress) + { + try { return CodeReal(inStream, outStream, inSize, outSize, progress); } +- catch(const CInBufferException &e) { return e.ErrorCode; } +- catch(const CLzOutWindowException &e) { return e.ErrorCode; } +- catch(...) { return S_FALSE; } ++ catch(const CInBufferException &e) { _errorMode = true; return e.ErrorCode; } ++ catch(const CLzOutWindowException &e) { _errorMode = true; return e.ErrorCode; } ++ catch(...) { _errorMode = true; return S_FALSE; } + } + + STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size) +diff --git a/CPP/7zip/Compress/Rar1Decoder.h b/CPP/7zip/Compress/Rar1Decoder.h +index 630f089..01b606b 100644 +--- a/CPP/7zip/Compress/Rar1Decoder.h ++++ b/CPP/7zip/Compress/Rar1Decoder.h +@@ -39,6 +39,7 @@ public: + + Int64 m_UnpackSize; + bool m_IsSolid; ++ bool _errorMode; + + UInt32 ReadBits(int numBits); + HRESULT CopyBlock(UInt32 distance, UInt32 len); +diff --git a/CPP/7zip/Compress/Rar2Decoder.cpp b/CPP/7zip/Compress/Rar2Decoder.cpp +index b3f2b4b..0580c8d 100644 +--- a/CPP/7zip/Compress/Rar2Decoder.cpp ++++ b/CPP/7zip/Compress/Rar2Decoder.cpp +@@ -80,7 +80,8 @@ static const UInt32 kHistorySize = 1 << 20; + static const UInt32 kWindowReservSize = (1 << 22) + 256; + + CDecoder::CDecoder(): +- m_IsSolid(false) ++ m_IsSolid(false), ++ m_TablesOK(false) + { + } + +@@ -100,6 +101,8 @@ UInt32 CDecoder::ReadBits(unsigned numBits) { return m_InBitStream.ReadBits(numB + + bool CDecoder::ReadTables(void) + { ++ m_TablesOK = false; ++ + Byte levelLevels[kLevelTableSize]; + Byte newLevels[kMaxTableSize]; + m_AudioMode = (ReadBits(1) == 1); +@@ -170,6 +173,8 @@ bool CDecoder::ReadTables(void) + } + + memcpy(m_LastLevels, newLevels, kMaxTableSize); ++ m_TablesOK = true; ++ + return true; + } + +@@ -344,6 +349,9 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream * + return S_FALSE; + } + ++ if (!m_TablesOK) ++ return S_FALSE; ++ + UInt64 startPos = m_OutWindowStream.GetProcessedSize(); + while (pos < unPackSize) + { +diff --git a/CPP/7zip/Compress/Rar2Decoder.h b/CPP/7zip/Compress/Rar2Decoder.h +index 3a0535c..0e9005f 100644 +--- a/CPP/7zip/Compress/Rar2Decoder.h ++++ b/CPP/7zip/Compress/Rar2Decoder.h +@@ -139,6 +139,7 @@ class CDecoder : + + UInt64 m_PackSize; + bool m_IsSolid; ++ bool m_TablesOK; + + void InitStructures(); + UInt32 ReadBits(unsigned numBits); +diff --git a/CPP/7zip/Compress/Rar3Decoder.cpp b/CPP/7zip/Compress/Rar3Decoder.cpp +index 3bf2513..6cb8a6a 100644 +--- a/CPP/7zip/Compress/Rar3Decoder.cpp ++++ b/CPP/7zip/Compress/Rar3Decoder.cpp +@@ -92,7 +92,8 @@ CDecoder::CDecoder(): + _writtenFileSize(0), + _vmData(0), + _vmCode(0), +- m_IsSolid(false) ++ m_IsSolid(false), ++ _errorMode(false) + { + Ppmd7_Construct(&_ppmd); + } +@@ -545,6 +546,9 @@ HRESULT CDecoder::ReadTables(bool &keepDecompressing) + return InitPPM(); + } + ++ TablesRead = false; ++ TablesOK = false; ++ + _lzMode = true; + PrevAlignBits = 0; + PrevAlignCount = 0; +@@ -606,6 +610,9 @@ HRESULT CDecoder::ReadTables(bool &keepDecompressing) + } + } + } ++ if (InputEofError()) ++ return S_FALSE; ++ + TablesRead = true; + + // original code has check here: +@@ -623,6 +630,9 @@ HRESULT CDecoder::ReadTables(bool &keepDecompressing) + RIF(m_LenDecoder.Build(&newLevels[kMainTableSize + kDistTableSize + kAlignTableSize])); + + memcpy(m_LastLevels, newLevels, kTablesSizesSum); ++ ++ TablesOK = true; ++ + return S_OK; + } + +@@ -824,7 +834,12 @@ HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress) + PpmEscChar = 2; + PpmError = true; + InitFilters(); ++ _errorMode = false; + } ++ ++ if (_errorMode) ++ return S_FALSE; ++ + if (!m_IsSolid || !TablesRead) + { + bool keepDecompressing; +@@ -838,6 +853,8 @@ HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress) + bool keepDecompressing; + if (_lzMode) + { ++ if (!TablesOK) ++ return S_FALSE; + RINOK(DecodeLZ(keepDecompressing)) + } + else +@@ -901,8 +918,8 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream + _unpackSize = outSize ? *outSize : (UInt64)(Int64)-1; + return CodeReal(progress); + } +- catch(const CInBufferException &e) { return e.ErrorCode; } +- catch(...) { return S_FALSE; } ++ catch(const CInBufferException &e) { _errorMode = true; return e.ErrorCode; } ++ catch(...) { _errorMode = true; return S_FALSE; } + // CNewException is possible here. But probably CNewException is caused + // by error in data stream. + } +diff --git a/CPP/7zip/Compress/Rar3Decoder.h b/CPP/7zip/Compress/Rar3Decoder.h +index c130cec..2f72d7d 100644 +--- a/CPP/7zip/Compress/Rar3Decoder.h ++++ b/CPP/7zip/Compress/Rar3Decoder.h +@@ -192,6 +192,7 @@ class CDecoder: + UInt32 _lastFilter; + + bool m_IsSolid; ++ bool _errorMode; + + bool _lzMode; + bool _unsupportedFilter; +@@ -200,6 +201,7 @@ class CDecoder: + UInt32 PrevAlignCount; + + bool TablesRead; ++ bool TablesOK; + + CPpmd7 _ppmd; + int PpmEscChar; diff --git a/recipes/p7zip/all/patches/12-CVE-2016-9296.patch b/recipes/p7zip/all/patches/12-CVE-2016-9296.patch new file mode 100644 index 0000000000000..42245c92c0aae --- /dev/null +++ b/recipes/p7zip/all/patches/12-CVE-2016-9296.patch @@ -0,0 +1,23 @@ +From: Robert Luberda +Date: Sat, 19 Nov 2016 08:48:08 +0100 +Subject: Fix nullptr dereference (CVE-2016-9296) + +Patch taken from https://sourceforge.net/p/p7zip/bugs/185/ +--- + CPP/7zip/Archive/7z/7zIn.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +diff --git a/CPP/7zip/Archive/7z/7zIn.cpp b/CPP/7zip/Archive/7z/7zIn.cpp +index b0c6b98..7c6dde2 100644 +--- a/CPP/7zip/Archive/7z/7zIn.cpp ++++ b/CPP/7zip/Archive/7z/7zIn.cpp +@@ -1097,7 +1097,8 @@ HRESULT CInArchive::ReadAndDecodePackedStreams( + if (CrcCalc(data, unpackSize) != folders.FolderCRCs.Vals[i]) + ThrowIncorrect(); + } +- HeadersSize += folders.PackPositions[folders.NumPackStreams]; ++ if (folders.PackPositions) ++ HeadersSize += folders.PackPositions[folders.NumPackStreams]; + return S_OK; + } + diff --git a/recipes/p7zip/all/patches/13-CVE-2017-17969.patch b/recipes/p7zip/all/patches/13-CVE-2017-17969.patch new file mode 100644 index 0000000000000..a9787c4a90886 --- /dev/null +++ b/recipes/p7zip/all/patches/13-CVE-2017-17969.patch @@ -0,0 +1,35 @@ +From: =?utf-8?q?Antoine_Beaupr=C3=A9?= +Date: Fri, 2 Feb 2018 11:11:41 +0100 +Subject: Heap-based buffer overflow in 7zip/Compress/ShrinkDecoder.cpp + +Origin: vendor, https://sourceforge.net/p/p7zip/bugs/_discuss/thread/0920f369/27d7/attachment/CVE-2017-17969.patch +Forwarded: https://sourceforge.net/p/p7zip/bugs/_discuss/thread/0920f369/#27d7 +Bug: https://sourceforge.net/p/p7zip/bugs/204/ +Bug-Debian: https://bugs.debian.org/888297 +Bug-Debian-Security: https://security-tracker.debian.org/tracker/CVE-2017-17969 +Reviewed-by: Salvatore Bonaccorso +Last-Update: 2018-02-01 +Applied-Upstream: 18.00-beta +--- + CPP/7zip/Compress/ShrinkDecoder.cpp | 7 ++++++- + 1 file changed, 6 insertions(+), 1 deletion(-) + +diff --git a/CPP/7zip/Compress/ShrinkDecoder.cpp b/CPP/7zip/Compress/ShrinkDecoder.cpp +index 80b7e67..ca37764 100644 +--- a/CPP/7zip/Compress/ShrinkDecoder.cpp ++++ b/CPP/7zip/Compress/ShrinkDecoder.cpp +@@ -121,8 +121,13 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream * + { + _stack[i++] = _suffixes[cur]; + cur = _parents[cur]; ++ if (cur >= kNumItems || i >= kNumItems) ++ break; + } +- ++ ++ if (cur >= kNumItems || i >= kNumItems) ++ break; ++ + _stack[i++] = (Byte)cur; + lastChar2 = (Byte)cur; + diff --git a/recipes/p7zip/all/patches/14-Fix-g++-warning.patch b/recipes/p7zip/all/patches/14-Fix-g++-warning.patch new file mode 100644 index 0000000000000..226e239ee990d --- /dev/null +++ b/recipes/p7zip/all/patches/14-Fix-g++-warning.patch @@ -0,0 +1,24 @@ +From: Robert Luberda +Date: Sun, 28 Jan 2018 22:19:13 +0100 +Subject: Fix g++ warning + +Fix for "use of an operand of type 'bool' in 'operator++' +is deprecated [-Wdeprecated]" warning taken from 7zip 18.00.beta +package. +--- + CPP/7zip/Archive/Wim/WimHandler.cpp | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/CPP/7zip/Archive/Wim/WimHandler.cpp b/CPP/7zip/Archive/Wim/WimHandler.cpp +index 27d3298..4ff5cfe 100644 +--- a/CPP/7zip/Archive/Wim/WimHandler.cpp ++++ b/CPP/7zip/Archive/Wim/WimHandler.cpp +@@ -298,7 +298,7 @@ STDMETHODIMP CHandler::GetArchiveProperty(PROPID propID, PROPVARIANT *value) + + AString res; + +- bool numMethods = 0; ++ unsigned numMethods = 0; + for (unsigned i = 0; i < ARRAY_SIZE(k_Methods); i++) + { + if (methodMask & ((UInt32)1 << i)) diff --git a/recipes/p7zip/all/patches/CVE-2018-10115.patch b/recipes/p7zip/all/patches/CVE-2018-10115.patch new file mode 100644 index 0000000000000..7d9c4bf81f000 --- /dev/null +++ b/recipes/p7zip/all/patches/CVE-2018-10115.patch @@ -0,0 +1,311 @@ +From: Robert Luberda +Date: Tue, 29 May 2018 23:59:09 +0200 +Subject: Fix CVE-2018-10115 + +Apply "patch" taken from https://landave.io/files/patch_7zip_CVE-2018-10115.txt + + +Bugs-Debian: https://bugs.debian.org/897674 +--- + CPP/7zip/Compress/Rar1Decoder.cpp | 16 +++++++++++----- + CPP/7zip/Compress/Rar1Decoder.h | 3 ++- + CPP/7zip/Compress/Rar2Decoder.cpp | 17 +++++++++++++---- + CPP/7zip/Compress/Rar2Decoder.h | 3 ++- + CPP/7zip/Compress/Rar3Decoder.cpp | 19 +++++++++++++++---- + CPP/7zip/Compress/Rar3Decoder.h | 3 ++- + CPP/7zip/Compress/Rar5Decoder.cpp | 8 ++++++++ + CPP/7zip/Compress/Rar5Decoder.h | 1 + + 8 files changed, 54 insertions(+), 16 deletions(-) + +diff --git a/CPP/7zip/Compress/Rar1Decoder.cpp b/CPP/7zip/Compress/Rar1Decoder.cpp +index 68030c7..8c890c8 100644 +--- a/CPP/7zip/Compress/Rar1Decoder.cpp ++++ b/CPP/7zip/Compress/Rar1Decoder.cpp +@@ -29,7 +29,7 @@ public: + }; + */ + +-CDecoder::CDecoder(): m_IsSolid(false), _errorMode(false) { } ++CDecoder::CDecoder(): _isSolid(false), _solidAllowed(false), _errorMode(false) { } + + void CDecoder::InitStructures() + { +@@ -345,7 +345,7 @@ void CDecoder::GetFlagsBuf() + + void CDecoder::InitData() + { +- if (!m_IsSolid) ++ if (!_isSolid) + { + AvrPlcB = AvrLn1 = AvrLn2 = AvrLn3 = NumHuf = Buf60 = 0; + AvrPlc = 0x3500; +@@ -391,6 +391,11 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream * + if (inSize == NULL || outSize == NULL) + return E_INVALIDARG; + ++ if (_isSolid && !_solidAllowed) ++ return S_FALSE; ++ ++ _solidAllowed = false; ++ + if (!m_OutWindowStream.Create(kHistorySize)) + return E_OUTOFMEMORY; + if (!m_InBitStream.Create(1 << 20)) +@@ -398,13 +403,13 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream * + + m_UnpackSize = (Int64)*outSize; + m_OutWindowStream.SetStream(outStream); +- m_OutWindowStream.Init(m_IsSolid); ++ m_OutWindowStream.Init(_isSolid); + m_InBitStream.SetStream(inStream); + m_InBitStream.Init(); + + // CCoderReleaser coderReleaser(this); + InitData(); +- if (!m_IsSolid) ++ if (!_isSolid) + { + _errorMode = false; + InitStructures(); +@@ -475,6 +480,7 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream * + } + if (m_UnpackSize < 0) + return S_FALSE; ++ _solidAllowed = true; + return m_OutWindowStream.Flush(); + } + +@@ -491,7 +497,7 @@ STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size) + { + if (size < 1) + return E_INVALIDARG; +- m_IsSolid = ((data[0] & 1) != 0); ++ _isSolid = ((data[0] & 1) != 0); + return S_OK; + } + +diff --git a/CPP/7zip/Compress/Rar1Decoder.h b/CPP/7zip/Compress/Rar1Decoder.h +index 01b606b..8abb3a3 100644 +--- a/CPP/7zip/Compress/Rar1Decoder.h ++++ b/CPP/7zip/Compress/Rar1Decoder.h +@@ -38,7 +38,8 @@ public: + UInt32 LastLength; + + Int64 m_UnpackSize; +- bool m_IsSolid; ++ bool _isSolid; ++ bool _solidAllowed; + bool _errorMode; + + UInt32 ReadBits(int numBits); +diff --git a/CPP/7zip/Compress/Rar2Decoder.cpp b/CPP/7zip/Compress/Rar2Decoder.cpp +index 0580c8d..be8d842 100644 +--- a/CPP/7zip/Compress/Rar2Decoder.cpp ++++ b/CPP/7zip/Compress/Rar2Decoder.cpp +@@ -80,7 +80,8 @@ static const UInt32 kHistorySize = 1 << 20; + static const UInt32 kWindowReservSize = (1 << 22) + 256; + + CDecoder::CDecoder(): +- m_IsSolid(false), ++ _isSolid(false), ++ _solidAllowed(false), + m_TablesOK(false) + { + } +@@ -320,6 +321,10 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream * + if (inSize == NULL || outSize == NULL) + return E_INVALIDARG; + ++ if (_isSolid && !_solidAllowed) ++ return S_FALSE; ++ _solidAllowed = false; ++ + if (!m_OutWindowStream.Create(kHistorySize)) + return E_OUTOFMEMORY; + if (!m_InBitStream.Create(1 << 20)) +@@ -330,12 +335,12 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream * + UInt64 pos = 0, unPackSize = *outSize; + + m_OutWindowStream.SetStream(outStream); +- m_OutWindowStream.Init(m_IsSolid); ++ m_OutWindowStream.Init(_isSolid); + m_InBitStream.SetStream(inStream); + m_InBitStream.Init(); + + // CCoderReleaser coderReleaser(this); +- if (!m_IsSolid) ++ if (!_isSolid) + { + InitStructures(); + if (unPackSize == 0) +@@ -343,6 +348,7 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream * + if (m_InBitStream.GetProcessedSize() + 2 <= m_PackSize) // test it: probably incorrect; + if (!ReadTables()) + return S_FALSE; ++ _solidAllowed = true; + return S_OK; + } + if (!ReadTables()) +@@ -386,6 +392,9 @@ HRESULT CDecoder::CodeReal(ISequentialInStream *inStream, ISequentialOutStream * + + if (!ReadLastTables()) + return S_FALSE; ++ ++ _solidAllowed = true; ++ + return m_OutWindowStream.Flush(); + } + +@@ -402,7 +411,7 @@ STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size) + { + if (size < 1) + return E_INVALIDARG; +- m_IsSolid = ((data[0] & 1) != 0); ++ _isSolid = ((data[0] & 1) != 0); + return S_OK; + } + +diff --git a/CPP/7zip/Compress/Rar2Decoder.h b/CPP/7zip/Compress/Rar2Decoder.h +index 0e9005f..370bce2 100644 +--- a/CPP/7zip/Compress/Rar2Decoder.h ++++ b/CPP/7zip/Compress/Rar2Decoder.h +@@ -138,7 +138,8 @@ class CDecoder : + Byte m_LastLevels[kMaxTableSize]; + + UInt64 m_PackSize; +- bool m_IsSolid; ++ bool _isSolid; ++ bool _solidAllowed; + bool m_TablesOK; + + void InitStructures(); +diff --git a/CPP/7zip/Compress/Rar3Decoder.cpp b/CPP/7zip/Compress/Rar3Decoder.cpp +index 6cb8a6a..7b85833 100644 +--- a/CPP/7zip/Compress/Rar3Decoder.cpp ++++ b/CPP/7zip/Compress/Rar3Decoder.cpp +@@ -92,7 +92,8 @@ CDecoder::CDecoder(): + _writtenFileSize(0), + _vmData(0), + _vmCode(0), +- m_IsSolid(false), ++ _isSolid(false), ++ _solidAllowed(false), + _errorMode(false) + { + Ppmd7_Construct(&_ppmd); +@@ -821,7 +822,7 @@ HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress) + { + _writtenFileSize = 0; + _unsupportedFilter = false; +- if (!m_IsSolid) ++ if (!_isSolid) + { + _lzSize = 0; + _winPos = 0; +@@ -840,12 +841,15 @@ HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress) + if (_errorMode) + return S_FALSE; + +- if (!m_IsSolid || !TablesRead) ++ if (!_isSolid || !TablesRead) + { + bool keepDecompressing; + RINOK(ReadTables(keepDecompressing)); + if (!keepDecompressing) ++ { ++ _solidAllowed = true; + return S_OK; ++ } + } + + for (;;) +@@ -870,6 +874,9 @@ HRESULT CDecoder::CodeReal(ICompressProgressInfo *progress) + if (!keepDecompressing) + break; + } ++ ++ _solidAllowed = true; ++ + RINOK(WriteBuf()); + UInt64 packSize = m_InBitStream.BitDecoder.GetProcessedSize(); + RINOK(progress->SetRatioInfo(&packSize, &_writtenFileSize)); +@@ -890,6 +897,10 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream + if (!inSize) + return E_INVALIDARG; + ++ if (_isSolid && !_solidAllowed) ++ return S_FALSE; ++ _solidAllowed = false; ++ + if (!_vmData) + { + _vmData = (Byte *)::MidAlloc(kVmDataSizeMax + kVmCodeSizeMax); +@@ -928,7 +939,7 @@ STDMETHODIMP CDecoder::SetDecoderProperties2(const Byte *data, UInt32 size) + { + if (size < 1) + return E_INVALIDARG; +- m_IsSolid = ((data[0] & 1) != 0); ++ _isSolid = ((data[0] & 1) != 0); + return S_OK; + } + +diff --git a/CPP/7zip/Compress/Rar3Decoder.h b/CPP/7zip/Compress/Rar3Decoder.h +index 2f72d7d..32c8943 100644 +--- a/CPP/7zip/Compress/Rar3Decoder.h ++++ b/CPP/7zip/Compress/Rar3Decoder.h +@@ -191,7 +191,8 @@ class CDecoder: + CRecordVector _tempFilters; + UInt32 _lastFilter; + +- bool m_IsSolid; ++ bool _isSolid; ++ bool _solidAllowed; + bool _errorMode; + + bool _lzMode; +diff --git a/CPP/7zip/Compress/Rar5Decoder.cpp b/CPP/7zip/Compress/Rar5Decoder.cpp +index dc8830f..a826d5a 100644 +--- a/CPP/7zip/Compress/Rar5Decoder.cpp ++++ b/CPP/7zip/Compress/Rar5Decoder.cpp +@@ -72,6 +72,7 @@ CDecoder::CDecoder(): + _writtenFileSize(0), + _dictSizeLog(0), + _isSolid(false), ++ _solidAllowed(false), + _wasInit(false), + _inputBuf(NULL) + { +@@ -801,7 +802,10 @@ HRESULT CDecoder::CodeReal() + */ + + if (res == S_OK) ++ { ++ _solidAllowed = true; + res = res2; ++ } + + if (res == S_OK && _unpackSize_Defined && _writtenFileSize != _unpackSize) + return S_FALSE; +@@ -821,6 +825,10 @@ STDMETHODIMP CDecoder::Code(ISequentialInStream *inStream, ISequentialOutStream + { + try + { ++ if (_isSolid && !_solidAllowed) ++ return S_FALSE; ++ _solidAllowed = false; ++ + if (_dictSizeLog >= sizeof(size_t) * 8) + return E_NOTIMPL; + +diff --git a/CPP/7zip/Compress/Rar5Decoder.h b/CPP/7zip/Compress/Rar5Decoder.h +index b0a4dd1..3db5018 100644 +--- a/CPP/7zip/Compress/Rar5Decoder.h ++++ b/CPP/7zip/Compress/Rar5Decoder.h +@@ -271,6 +271,7 @@ class CDecoder: + Byte _dictSizeLog; + bool _tableWasFilled; + bool _isSolid; ++ bool _solidAllowed; + bool _wasInit; + + UInt32 _reps[kNumReps]; diff --git a/recipes/p7zip/all/patches/clang.diff b/recipes/p7zip/all/patches/clang.diff new file mode 100644 index 0000000000000..38056ac99eefe --- /dev/null +++ b/recipes/p7zip/all/patches/clang.diff @@ -0,0 +1,49 @@ +From b6b1782af4aa7f9084d32e4144738dc2535c8d6f Mon Sep 17 00:00:00 2001 +From: Khem Raj +Date: Mon, 23 Apr 2018 23:07:21 -0700 +Subject: [PATCH] Fix narrowing errors -Wc++11-narrowing + +Clang 6.x finds these errors + + ../../../../CPP/Windows/ErrorMsg.cpp:24:10: error: case value evaluates to -2147024809, which cannot be narrowed to type 'DWORD' (aka 'unsigned int') +[-Wc++11-arrowing] + case E_INVALIDARG : txt = "E_INVALIDARG"; break ; + ^ + +HRESULT causes the macro to be parsed as a signed long, so we need to force it +to be checked as an unsigned long instead. + +also reported here https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=224930 + +Upstream-Status: Pending + +Signed-off-by: Khem Raj +--- + CPP/Windows/ErrorMsg.cpp | 14 +++++++------- + 1 file changed, 7 insertions(+), 7 deletions(-) + +diff --git a/CPP/Windows/ErrorMsg.cpp b/CPP/Windows/ErrorMsg.cpp +index 99684ae..78a64ba 100644 +--- a/CPP/Windows/ErrorMsg.cpp ++++ b/CPP/Windows/ErrorMsg.cpp +@@ -15,13 +15,13 @@ UString MyFormatMessage(DWORD errorCode) + + switch(errorCode) { + case ERROR_NO_MORE_FILES : txt = "No more files"; break ; +- case E_NOTIMPL : txt = "E_NOTIMPL"; break ; +- case E_NOINTERFACE : txt = "E_NOINTERFACE"; break ; +- case E_ABORT : txt = "E_ABORT"; break ; +- case E_FAIL : txt = "E_FAIL"; break ; +- case STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ; +- case E_OUTOFMEMORY : txt = "E_OUTOFMEMORY"; break ; +- case E_INVALIDARG : txt = "E_INVALIDARG"; break ; ++ case (DWORD) E_NOTIMPL : txt = "E_NOTIMPL"; break ; ++ case (DWORD) E_NOINTERFACE : txt = "E_NOINTERFACE"; break ; ++ case (DWORD) E_ABORT : txt = "E_ABORT"; break ; ++ case (DWORD) E_FAIL : txt = "E_FAIL"; break ; ++ case (DWORD) STG_E_INVALIDFUNCTION : txt = "STG_E_INVALIDFUNCTION"; break ; ++ case (DWORD) E_OUTOFMEMORY : txt = "E_OUTOFMEMORY"; break ; ++ case (DWORD) E_INVALIDARG : txt = "E_INVALIDARG"; break ; + case ERROR_DIRECTORY : txt = "Error Directory"; break ; + default: + txt = strerror(errorCode); diff --git a/recipes/p7zip/all/test_package/conanfile.py b/recipes/p7zip/all/test_package/conanfile.py new file mode 100644 index 0000000000000..45e5a32aba828 --- /dev/null +++ b/recipes/p7zip/all/test_package/conanfile.py @@ -0,0 +1,15 @@ +from conan import ConanFile +from conan.tools.build import can_run + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualRunEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def test(self): + if can_run(self): + self.run("7za", env="conanrun") diff --git a/recipes/p7zip/all/test_v1_package/conanfile.py b/recipes/p7zip/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..58d9c6f21e0ce --- /dev/null +++ b/recipes/p7zip/all/test_v1_package/conanfile.py @@ -0,0 +1,9 @@ +from conans import ConanFile, tools + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not tools.cross_building(self): + self.run("7za", run_environment=True) diff --git a/recipes/p7zip/config.yml b/recipes/p7zip/config.yml new file mode 100644 index 0000000000000..cd6dd6982cb15 --- /dev/null +++ b/recipes/p7zip/config.yml @@ -0,0 +1,3 @@ +versions: + "16.02": + folder: "all" diff --git a/recipes/packio/all/conandata.yml b/recipes/packio/all/conandata.yml index 6e87f4c19f689..409d2af8af9cf 100644 --- a/recipes/packio/all/conandata.yml +++ b/recipes/packio/all/conandata.yml @@ -32,3 +32,6 @@ sources: "2.2.0": url: "https://github.com/qchateau/packio/archive/2.2.0.tar.gz" sha256: "ac9f33d5e8dd92bd3cdec106e10453424060bae9c4cd97281aa5d20fb20476f7" + "2.3.0": + url: "https://github.com/qchateau/packio/archive/2.3.0.tar.gz" + sha256: "4ef3bc76934855cc1a17eb00311bb42f5f14f616c75d4d1cc35151efcc988358" diff --git a/recipes/packio/config.yml b/recipes/packio/config.yml index 1ee2ce354c532..84901be3d2175 100644 --- a/recipes/packio/config.yml +++ b/recipes/packio/config.yml @@ -21,3 +21,5 @@ versions: folder: all "2.2.0": folder: all + "2.3.0": + folder: all diff --git a/recipes/paho-mqtt-c/all/CMakeLists.txt b/recipes/paho-mqtt-c/all/CMakeLists.txt deleted file mode 100644 index d17aaff199b4a..0000000000000 --- a/recipes/paho-mqtt-c/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/paho-mqtt-c/all/conandata.yml b/recipes/paho-mqtt-c/all/conandata.yml index e4387aa400019..3cbc11b2a30de 100644 --- a/recipes/paho-mqtt-c/all/conandata.yml +++ b/recipes/paho-mqtt-c/all/conandata.yml @@ -1,51 +1,66 @@ sources: - "1.3.0": - sha256: 87cf846b02dde6328b84832287d8725d91f12f41366eecb4d59eeda1d6c7efdf - url: https://github.com/eclipse/paho.mqtt.c/archive/v1.3.0.tar.gz - "1.3.1": - sha256: 7b4eed66ae3df3613629139c0df28b16abfa4e0927bd17360027d936784aa55e - url: https://github.com/eclipse/paho.mqtt.c/archive/v1.3.1.tar.gz - "1.3.4": - sha256: 1ae9b657b693254ed0710350df3dcf5232d1f479409a52861b5e5bb5cc3da046 - url: https://github.com/eclipse/paho.mqtt.c/archive/v1.3.4.tar.gz - "1.3.5": - sha256: 996eef9e498519da79108f58a887a34abc50cd76770b19b0300b27783706c71f - url: https://github.com/eclipse/paho.mqtt.c/archive/v1.3.5.tar.gz - "1.3.6": - sha256: ecbc2c2000c6d8dcf1a76325312c61ed29db0b010acbd40cb92fcd4c014cd017 - url: https://github.com/eclipse/paho.mqtt.c/archive/v1.3.6.tar.gz - "1.3.8": - sha256: 4920ff685344cdb0272568bc4414dcf48fcdfc4a98c78b1f3ca49c38417bf391 - url: https://github.com/eclipse/paho.mqtt.c/archive/v1.3.8.tar.gz - "1.3.9": - url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.9.tar.gz" - sha256: "386c9b5fa1cf6d0d516db12d57fd8f6a410dd0fdc5e9a2da870aae437a2535ed" + "1.3.12": + url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.12.tar.gz" + sha256: "6a70a664ed3bbcc1eafdc45a5dc11f3ad70c9bac12a54c2f8cef15c0e7d0a93b" + "1.3.11": + url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.11.tar.gz" + sha256: "d7bba3f8b8978802e11e2b1f28e96e6b7f4ed5d8a268af52a4d3b1bcbd1db16b" "1.3.10": url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.10.tar.gz" sha256: "c70db96e66adacae411d5d875fbb08bca6ff9945de3d215b3af93cbd22792db5" -patches: - "1.3.0": - - patch_file: "patches/0001-fix-MinGW-and-OSX-builds-for-1-3-0.patch" - base_path: "source_subfolder" - - patch_file: "patches/0004-fix-cmake-find-openssl.patch" - base_path: "source_subfolder" - "1.3.1": - - patch_file: "patches/0002-fix-MinGW-and-OSX-builds-for-1-3-1.patch" - base_path: "source_subfolder" - - patch_file: "patches/0004-fix-cmake-find-openssl.patch" - base_path: "source_subfolder" - "1.3.4": - - patch_file: "patches/0002-fix-MinGW-and-OSX-builds-for-1-3-4.patch" - base_path: "source_subfolder" - "1.3.5": - - patch_file: "patches/0003-allow-static-windows-runtimes.patch" - base_path: "source_subfolder" + "1.3.9": + url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.9.tar.gz" + sha256: "386c9b5fa1cf6d0d516db12d57fd8f6a410dd0fdc5e9a2da870aae437a2535ed" + "1.3.8": + url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.8.tar.gz" + sha256: "4920ff685344cdb0272568bc4414dcf48fcdfc4a98c78b1f3ca49c38417bf391" "1.3.6": + url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.6.tar.gz" + sha256: "ecbc2c2000c6d8dcf1a76325312c61ed29db0b010acbd40cb92fcd4c014cd017" + "1.3.5": + url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.5.tar.gz" + sha256: "996eef9e498519da79108f58a887a34abc50cd76770b19b0300b27783706c71f" + "1.3.4": + url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.4.tar.gz" + sha256: "1ae9b657b693254ed0710350df3dcf5232d1f479409a52861b5e5bb5cc3da046" + "1.3.1": + url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.1.tar.gz" + sha256: "7b4eed66ae3df3613629139c0df28b16abfa4e0927bd17360027d936784aa55e" + "1.3.0": + url: "https://github.com/eclipse/paho.mqtt.c/archive/v1.3.0.tar.gz" + sha256: "87cf846b02dde6328b84832287d8725d91f12f41366eecb4d59eeda1d6c7efdf" +patches: + "1.3.9": - patch_file: "patches/0003-allow-static-windows-runtimes.patch" - base_path: "source_subfolder" + patch_description: "disable forced multi threaded DLL(-MD)" + patch_type: "conan" "1.3.8": - patch_file: "patches/0003-allow-static-windows-runtimes.patch" - base_path: "source_subfolder" - "1.3.9": + patch_description: "disable forced multi threaded DLL(-MD)" + patch_type: "conan" + "1.3.6": - patch_file: "patches/0003-allow-static-windows-runtimes.patch" - base_path: "source_subfolder" + patch_description: "disable forced multi threaded DLL(-MD)" + patch_type: "conan" + "1.3.5": + - patch_file: "patches/0003-allow-static-windows-runtimes.patch" + patch_description: "disable forced multi threaded DLL(-MD)" + patch_type: "conan" + "1.3.4": + - patch_file: "patches/0002-fix-MinGW-and-OSX-builds-for-1-3-4.patch" + patch_description: "disable cpack, link win32 libs more, source patches for MinGW/OSX" + patch_type: "conan" + "1.3.1": + - patch_file: "patches/0002-fix-MinGW-and-OSX-builds-for-1-3-1.patch" + patch_description: "disable cpack, link win32 libs more, source patches for MinGW/OSX" + patch_type: "conan" + - patch_file: "patches/0004-fix-cmake-find-openssl.patch" + patch_description: "use cci openssl" + patch_type: "conan" + "1.3.0": + - patch_file: "patches/0001-fix-MinGW-and-OSX-builds-for-1-3-0.patch" + patch_description: "disable cpack, link win32 libs more, source patches for MinGW/OSX" + patch_type: "conan" + - patch_file: "patches/0004-fix-cmake-find-openssl.patch" + patch_description: "use cci openssl" + patch_type: "conan" diff --git a/recipes/paho-mqtt-c/all/conanfile.py b/recipes/paho-mqtt-c/all/conanfile.py index c0dc647af2b3b..43127f2a1c960 100644 --- a/recipes/paho-mqtt-c/all/conanfile.py +++ b/recipes/paho-mqtt-c/all/conanfile.py @@ -1,47 +1,41 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, replace_in_file +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.53.0" class PahoMqttcConan(ConanFile): name = "paho-mqtt-c" + description = "Eclipse Paho MQTT C client library for Linux, Windows and MacOS" + license = "EPL-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/eclipse/paho.mqtt.c" - topics = ("mqtt", "iot", "eclipse", "ssl", "tls", "paho", "c") - license = "EPL-2.0" - description = "Eclipse Paho MQTT C client library for Linux, Windows and MacOS" - + topics = ("mqtt", "iot", "eclipse", "ssl", "tls", "paho") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "ssl": [True, False], "asynchronous": [True, False], - "samples": [True, False, "deprecated"], - "high_performance": [True, False] + "high_performance": [True, False], } default_options = { "shared": False, "fPIC": True, "ssl": True, "asynchronous": True, - "samples": "deprecated", - "high_performance": False + "high_performance": False, } - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _has_high_performance_option(self): - return tools.Version(self.version) >= "1.3.2" + return Version(self.version) >= "1.3.2" + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -52,80 +46,86 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") - if self.options.samples != "deprecated": - self.output.warn("samples option is deprecated and they are no longer provided in the package.") + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.ssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") def validate(self): - if not self.options.shared and tools.Version(self.version) < "1.3.4": - raise ConanInvalidConfiguration("{}/{} does not support static linking".format(self.name, self.version)) + if not self.options.shared and Version(self.version) < "1.3.4": + raise ConanInvalidConfiguration(f"{self.ref} does not support static linking") def package_id(self): del self.info.options.samples def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["PAHO_ENABLE_TESTING"] = False - self._cmake.definitions["PAHO_BUILD_DOCUMENTATION"] = False - self._cmake.definitions["PAHO_ENABLE_CPACK"] = False - self._cmake.definitions["PAHO_BUILD_DEB_PACKAGE"] = False - self._cmake.definitions["PAHO_BUILD_ASYNC"] = self.options.asynchronous - self._cmake.definitions["PAHO_BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["PAHO_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["PAHO_BUILD_SAMPLES"] = False - self._cmake.definitions["PAHO_WITH_SSL"] = self.options.ssl + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PAHO_ENABLE_TESTING"] = False + tc.variables["PAHO_BUILD_DOCUMENTATION"] = False + tc.variables["PAHO_ENABLE_CPACK"] = False + tc.variables["PAHO_BUILD_DEB_PACKAGE"] = False + tc.variables["PAHO_BUILD_ASYNC"] = self.options.asynchronous + tc.variables["PAHO_BUILD_STATIC"] = not self.options.shared + tc.variables["PAHO_BUILD_SHARED"] = self.options.shared + tc.variables["PAHO_BUILD_SAMPLES"] = False + tc.variables["PAHO_WITH_SSL"] = self.options.ssl if self.options.ssl: - self._cmake.definitions["OPENSSL_SEARCH_PATH"] = self.deps_cpp_info["openssl"].rootpath.replace("\\", "/") - self._cmake.definitions["OPENSSL_ROOT_DIR"] = self.deps_cpp_info["openssl"].rootpath.replace("\\", "/") + tc.cache_variables["OPENSSL_SEARCH_PATH"] = self.dependencies["openssl"].package_folder.replace("\\", "/") + tc.cache_variables["OPENSSL_ROOT_DIR"] = self.dependencies["openssl"].package_folder.replace("\\", "/") if self._has_high_performance_option: - self._cmake.definitions["PAHO_HIGH_PERFORMANCE"] = self.options.high_performance - self._cmake.configure() - return self._cmake + tc.variables["PAHO_HIGH_PERFORMANCE"] = self.options.high_performance + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_source(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "SET(CMAKE_MODULE_PATH \"${CMAKE_SOURCE_DIR}/cmake/modules\")", - "LIST(APPEND CMAKE_MODULE_PATH \"${CMAKE_SOURCE_DIR}/cmake/modules\")") + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "SET(CMAKE_MODULE_PATH \"${CMAKE_SOURCE_DIR}/cmake/modules\")", + "LIST(APPEND CMAKE_MODULE_PATH \"${CMAKE_SOURCE_DIR}/cmake/modules\")") if not self.options.get_safe("fPIC", True): - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "CMakeLists.txt"), "POSITION_INDEPENDENT_CODE ON", "") + replace_in_file(self, os.path.join(self.source_folder, "src", "CMakeLists.txt"), "POSITION_INDEPENDENT_CODE ON", "") def build(self): self._patch_source() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build(target=self._cmake_target) def package(self): - self.copy("edl-v10", src=self._source_subfolder, dst="licenses") - self.copy(self._epl_file, src=self._source_subfolder, dst="licenses") - self.copy("notice.html", src=self._source_subfolder, dst="licenses") + copy(self, "edl-v10", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, self._epl_file, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "notice.html", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + # Manually copy since the CMake installs everything - self.copy(pattern="MQTT*.h", src=os.path.join(self._source_subfolder, "src"), dst="include") - self.copy(os.path.join("lib", "*{}.*".format(self._lib_target)), dst="lib", keep_path=False) - self.copy(os.path.join("bin", "*{}.*".format(self._lib_target)), dst="bin", keep_path=False) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.pdb") - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + copy(self, pattern="MQTT*.h", src=os.path.join(self.source_folder, "src"), dst=os.path.join(self.package_folder, "include")) + + for suffix in ["lib", "a", "dylib"]: + copy(self, pattern=f"*.{suffix}", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, pattern=f"*{self._lib_target}.so*", src=self.build_folder, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, pattern=f"*{self._lib_target}.dll", src=self.build_folder, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rm(self, "*.cmake", os.path.join(self.package_folder, "lib")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "eclipse-paho-mqtt-c" - self.cpp_info.names["cmake_find_package_multi"] = "eclipse-paho-mqtt-c" - self.cpp_info.components["_paho-mqtt-c"].names["cmake_find_package"] = self._cmake_target - self.cpp_info.components["_paho-mqtt-c"].names["cmake_find_package_multi"] = self._cmake_target self.cpp_info.components["_paho-mqtt-c"].libs = [self._lib_target] + + self.cpp_info.set_property("cmake_file_name", "eclipse-paho-mqtt-c") + + self.cpp_info.components["_paho-mqtt-c"].set_property("cmake_target_name", f"eclipse-paho-mqtt-c::{self._cmake_target}") + if self.settings.os == "Windows": if not self.options.shared: self.cpp_info.components["_paho-mqtt-c"].system_libs.append("ws2_32") @@ -145,6 +145,12 @@ def package_info(self): if self.options.ssl: self.cpp_info.components["_paho-mqtt-c"].requires = ["openssl::openssl"] + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "eclipse-paho-mqtt-c" + self.cpp_info.names["cmake_find_package_multi"] = "eclipse-paho-mqtt-c" + self.cpp_info.components["_paho-mqtt-c"].names["cmake_find_package"] = self._cmake_target + self.cpp_info.components["_paho-mqtt-c"].names["cmake_find_package_multi"] = self._cmake_target + @property def _epl_file(self): return "epl-v10" if self.version in ['1.3.0', '1.3.1'] else "epl-v20" # EPL changed to V2 @@ -167,6 +173,6 @@ def _lib_target(self): target += "s" if not self.options.shared: # https://github.com/eclipse/paho.mqtt.c/blob/317fb008e1541838d1c29076d2bc5c3e4b6c4f53/src/CMakeLists.txt#L154 - if tools.Version(self.version) < "1.3.2" or self.settings.os == "Windows": + if Version(self.version) < "1.3.2" or self.settings.os == "Windows": target += "-static" return target diff --git a/recipes/paho-mqtt-c/all/patches/0004-fix-cmake-find-openssl.patch b/recipes/paho-mqtt-c/all/patches/0004-fix-cmake-find-openssl.patch index 55186be096e0f..54de70390b304 100644 --- a/recipes/paho-mqtt-c/all/patches/0004-fix-cmake-find-openssl.patch +++ b/recipes/paho-mqtt-c/all/patches/0004-fix-cmake-find-openssl.patch @@ -1,14 +1,5 @@ -From 3deb6cb1fe233e321b32d86b17016122d6f82ee7 Mon Sep 17 00:00:00 2001 -From: Chris Mc -Date: Mon, 19 Apr 2021 22:14:02 -0400 -Subject: [PATCH] to allow linking with openssl on windows since it overrides the path - ---- - src/CMakeLists.txt | 27 ++++----------------------- - 1 file changed, 4 insertions(+), 23 deletions(-) - diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index b46eaca0..93ade4fb 100644 +index 399b37d..55fee4f 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -108,29 +108,10 @@ INSTALL(FILES MQTTAsync.h MQTTClient.h MQTTClientPersistence.h MQTTProperties.h @@ -38,10 +29,19 @@ index b46eaca0..93ade4fb 100644 - HINTS ${OPENSSL_SEARCH_PATH}/lib ${OPENSSL_SEARCH_LIB_PATH}) - FIND_LIBRARY(OPENSSLCRYPTO_LIB NAMES crypto libcrypto libeay32 - HINTS ${OPENSSL_SEARCH_PATH}/lib ${OPENSSL_SEARCH_LIB_PATH}) -+ find_package(OpenSSL REQUIRED) ++ find_package(OpenSSL REQUIRED CONFIG) + + SET(OPENSSL_LIB ${OPENSSL_SSL_LIBRARY}) + SET(OPENSSLCRYPTO_LIB ${OPENSSL_CRYPTO_LIBRARY}) MESSAGE(STATUS "OpenSSL hints: ${OPENSSL_SEARCH_PATH}") MESSAGE(STATUS "OpenSSL headers found at ${OPENSSL_INCLUDE_DIR}") +@@ -151,6 +132,8 @@ IF (PAHO_WITH_SSL) + + TARGET_LINK_LIBRARIES(paho-mqtt3cs ${OPENSSL_LIB} ${OPENSSLCRYPTO_LIB} ${LIBS_SYSTEM}) + TARGET_LINK_LIBRARIES(paho-mqtt3as ${OPENSSL_LIB} ${OPENSSLCRYPTO_LIB} ${LIBS_SYSTEM}) ++ target_link_directories(paho-mqtt3cs PRIVATE "${OPENSSL_ROOT_DIR}/lib") ++ target_link_directories(paho-mqtt3as PRIVATE "${OPENSSL_ROOT_DIR}/lib") + SET_TARGET_PROPERTIES( + paho-mqtt3cs paho-mqtt3as PROPERTIES + VERSION ${CLIENT_VERSION} diff --git a/recipes/paho-mqtt-c/all/test_package/CMakeLists.txt b/recipes/paho-mqtt-c/all/test_package/CMakeLists.txt index 8485528ba1100..d1e82b16d05ff 100644 --- a/recipes/paho-mqtt-c/all/test_package/CMakeLists.txt +++ b/recipes/paho-mqtt-c/all/test_package/CMakeLists.txt @@ -1,39 +1,36 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - find_package(eclipse-paho-mqtt-c REQUIRED CONFIG) if(PAHO_MQTT_C_ASYNC) add_executable(${PROJECT_NAME} test_package_async.c) if(PAHO_MQTT_C_WITH_SSL) - if(PAHO_MQTT_C_SHARED) - target_link_libraries(${PROJECT_NAME} eclipse-paho-mqtt-c::paho-mqtt3as) + if(TARGET eclipse-paho-mqtt-c::paho-mqtt3as) + target_link_libraries(${PROJECT_NAME} PRIVATE eclipse-paho-mqtt-c::paho-mqtt3as) else() - target_link_libraries(${PROJECT_NAME} eclipse-paho-mqtt-c::paho-mqtt3as-static) + target_link_libraries(${PROJECT_NAME} PRIVATE eclipse-paho-mqtt-c::paho-mqtt3as-static) endif() else() - if(PAHO_MQTT_C_SHARED) - target_link_libraries(${PROJECT_NAME} eclipse-paho-mqtt-c::paho-mqtt3a) + if(TARGET eclipse-paho-mqtt-c::paho-mqtt3a) + target_link_libraries(${PROJECT_NAME} PRIVATE eclipse-paho-mqtt-c::paho-mqtt3a) else() - target_link_libraries(${PROJECT_NAME} eclipse-paho-mqtt-c::paho-mqtt3a-static) + target_link_libraries(${PROJECT_NAME} PRIVATE eclipse-paho-mqtt-c::paho-mqtt3a-static) endif() endif() else() add_executable(${PROJECT_NAME} test_package_client.c) if(PAHO_MQTT_C_WITH_SSL) - if(PAHO_MQTT_C_SHARED) - target_link_libraries(${PROJECT_NAME} eclipse-paho-mqtt-c::paho-mqtt3cs) + if(TARGET eclipse-paho-mqtt-c::paho-mqtt3cs) + target_link_libraries(${PROJECT_NAME} PRIVATE eclipse-paho-mqtt-c::paho-mqtt3cs) else() - target_link_libraries(${PROJECT_NAME} eclipse-paho-mqtt-c::paho-mqtt3cs-static) + target_link_libraries(${PROJECT_NAME} PRIVATE eclipse-paho-mqtt-c::paho-mqtt3cs-static) endif() else() - if(PAHO_MQTT_C_SHARED) - target_link_libraries(${PROJECT_NAME} eclipse-paho-mqtt-c::paho-mqtt3c) + if(TARGET eclipse-paho-mqtt-c::paho-mqtt3c) + target_link_libraries(${PROJECT_NAME} PRIVATE eclipse-paho-mqtt-c::paho-mqtt3c) else() - target_link_libraries(${PROJECT_NAME} eclipse-paho-mqtt-c::paho-mqtt3c-static) + target_link_libraries(${PROJECT_NAME} PRIVATE eclipse-paho-mqtt-c::paho-mqtt3c-static) endif() endif() endif() diff --git a/recipes/paho-mqtt-c/all/test_package/conanfile.py b/recipes/paho-mqtt-c/all/test_package/conanfile.py index 31b2c987ce031..21ac10a6aa501 100644 --- a/recipes/paho-mqtt-c/all/test_package/conanfile.py +++ b/recipes/paho-mqtt-c/all/test_package/conanfile.py @@ -1,20 +1,31 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PAHO_MQTT_C_ASYNC"] = self.options["paho-mqtt-c"].asynchronous + tc.variables["PAHO_MQTT_C_WITH_SSL"] = self.options["paho-mqtt-c"].ssl + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["PAHO_MQTT_C_ASYNC"] = self.options["paho-mqtt-c"].asynchronous - cmake.definitions["PAHO_MQTT_C_SHARED"] = self.options["paho-mqtt-c"].shared - cmake.definitions["PAHO_MQTT_C_WITH_SSL"] = self.options["paho-mqtt-c"].ssl cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/paho-mqtt-c/all/test_v1_package/CMakeLists.txt b/recipes/paho-mqtt-c/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/paho-mqtt-c/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/paho-mqtt-c/all/test_v1_package/conanfile.py b/recipes/paho-mqtt-c/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d8c4480cdc666 --- /dev/null +++ b/recipes/paho-mqtt-c/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["PAHO_MQTT_C_ASYNC"] = self.options["paho-mqtt-c"].asynchronous + cmake.definitions["PAHO_MQTT_C_WITH_SSL"] = self.options["paho-mqtt-c"].ssl + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/paho-mqtt-c/config.yml b/recipes/paho-mqtt-c/config.yml index 6c3ccc6001750..bb19e3738404a 100644 --- a/recipes/paho-mqtt-c/config.yml +++ b/recipes/paho-mqtt-c/config.yml @@ -1,17 +1,21 @@ versions: - "1.3.0": + "1.3.12": folder: "all" - "1.3.1": + "1.3.11": folder: "all" - "1.3.4": + "1.3.10": folder: "all" - "1.3.5": + "1.3.9": + folder: "all" + "1.3.8": folder: "all" "1.3.6": folder: "all" - "1.3.8": + "1.3.5": folder: "all" - "1.3.9": + "1.3.4": folder: "all" - "1.3.10": + "1.3.1": + folder: "all" + "1.3.0": folder: "all" diff --git a/recipes/pango/all/conandata.yml b/recipes/pango/all/conandata.yml index cd350d2b24ed1..1d8c33548e913 100644 --- a/recipes/pango/all/conandata.yml +++ b/recipes/pango/all/conandata.yml @@ -1,28 +1,4 @@ sources: -# "1.48.0": -# sha256: "d76513ac89341883320bd5ea063ec7005e70d962deedc064c62d6f17f6769b88" -# url: "https://github.com/GNOME/pango/archive/1.48.0.tar.gz" -# "1.48.1": -# sha256: "766ef4da466eb9a2a6d75278d769795a9c229fce5593d4e735039a05b155199c" -# url: "https://github.com/GNOME/pango/archive/1.48.1.tar.gz" -# "1.48.2": -# url: "https://github.com/GNOME/pango/archive/1.48.2.tar.gz" -# sha256: "19ea06742d9b8da590fed3c2bea018258609c18718a6deedd46cab957d3be9cf" -## "1.48.3": -# url: "https://github.com/GNOME/pango/archive/1.48.3.tar.gz" -# sha256: "63318b75bdd510b11fc960dbcdff9bc8b744fb3e45583acbb3410ef36bacc054" -# "1.48.4": -# url: "https://github.com/GNOME/pango/archive/1.48.4.tar.gz" -# sha256: "2c7e92f2430ae2ab91d6156488f41dfb0fd1ea787fbfb807dfe53a4f361a9d1a" -# "1.48.5": -# url: "https://github.com/GNOME/pango/archive/1.48.5.tar.gz" -# sha256: "9eccf148a4ca4727ed7d31ea1a2b7c77e8a8a286fc87967fb216669939e86eee" -# "1.48.6": -# url: "https://github.com/GNOME/pango/archive/1.48.6.tar.gz" -# sha256: "2ca6020ded58aee9bd10a8a547cad06204e28c36539598f2030cc672e5dfeab8" -# "1.48.7": -# url: "https://github.com/GNOME/pango/archive/1.48.7.tar.gz" -# sha256: "8783c82927582437d3a224eb18ea90d195b7451ff2effdffba16039df5346170" "1.48.9": url: "https://github.com/GNOME/pango/archive/1.48.9.tar.gz" sha256: "6c78162507debd3389dab9f045cfa0b03cb44c432fb21979d4acf45db1b93781" @@ -35,3 +11,6 @@ sources: "1.50.8": url: "https://download.gnome.org/sources/pango/1.50/pango-1.50.8.tar.xz" sha256: "cf626f59dd146c023174c4034920e9667f1d25ac2c1569516d63136c311255fa" + "1.50.10": + url: "https://download.gnome.org/sources/pango/1.50/pango-1.50.10.tar.xz" + sha256: "7e5d2f1e40854d24a9a2c4d093bafe75dcdbeccdf1de43e4437332eabed64966" diff --git a/recipes/pango/all/conanfile.py b/recipes/pango/all/conanfile.py index 1e054908ec7bc..7c23b65c48a80 100644 --- a/recipes/pango/all/conanfile.py +++ b/recipes/pango/all/conanfile.py @@ -1,12 +1,14 @@ import os -import shutil import glob -from conans import ConanFile, tools, Meson, VisualStudioBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conans import tools, Meson, VisualStudioBuildEnvironment +from conan import ConanFile +from conan.tools.scm import Version +from conan.tools.files import get, replace_in_file, chdir, rmdir, rm, rename +from conan.errors import ConanInvalidConfiguration from conan.tools.microsoft import is_msvc -required_conan_version = ">=1.32.0" +required_conan_version = ">=1.51.3" class PangoConan(ConanFile): name = "pango" @@ -30,7 +32,7 @@ def _build_subfolder(self): return "build_subfolder" def validate(self): - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": raise ConanInvalidConfiguration("this recipe does not support GCC before version 5. contributions are welcome") if self.options.with_xft and not self.settings.os in ["Linux", "FreeBSD"]: raise ConanInvalidConfiguration("Xft can only be used on Linux and FreeBSD") @@ -72,7 +74,7 @@ def configure(self): def build_requirements(self): self.build_requires("pkgconf/1.7.4") - self.build_requires("meson/0.62.1") + self.build_requires("meson/0.63.2") def requirements(self): if self.options.with_freetype: @@ -86,16 +88,16 @@ def requirements(self): self.requires("xorg/system") # for xorg::xrender if self.options.with_cairo: self.requires("cairo/1.17.4") - self.requires("harfbuzz/4.3.0") - self.requires("glib/2.73.0") + self.requires("harfbuzz/5.1.0") + self.requires("glib/2.73.3") self.requires("fribidi/1.0.12") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def _configure_meson(self): - defs = dict() + defs = {} defs["introspection"] = "disabled" defs["libthai"] = "enabled" if self.options.with_libthai else "disabled" @@ -110,10 +112,10 @@ def _configure_meson(self): def build(self): meson_build = os.path.join(self._source_subfolder, "meson.build") - tools.replace_in_file(meson_build, "subdir('tests')", "") - tools.replace_in_file(meson_build, "subdir('tools')", "") - tools.replace_in_file(meson_build, "subdir('utils')", "") - tools.replace_in_file(meson_build, "subdir('examples')", "") + replace_in_file(self, meson_build, "subdir('tests')", "") + replace_in_file(self, meson_build, "subdir('tools')", "") + replace_in_file(self, meson_build, "subdir('utils')", "") + replace_in_file(self, meson_build, "subdir('examples')", "") with tools.environment_append(VisualStudioBuildEnvironment(self).vars) if is_msvc(self) else tools.no_op(): meson = self._configure_meson() meson.build() @@ -124,13 +126,13 @@ def package(self): meson = self._configure_meson() meson.install() if is_msvc(self): - with tools.chdir(os.path.join(self.package_folder, "lib")): + with chdir(self, os.path.join(self.package_folder, "lib")): for filename_old in glob.glob("*.a"): filename_new = filename_old[3:-2] + ".lib" - self.output.info("rename %s into %s" % (filename_old, filename_new)) - shutil.move(filename_old, filename_new) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(self.package_folder, "*.pdb") + self.output.info(f"rename {filename_old} into {filename_new}") + rename(self, filename_old, filename_new) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.pdb", self.package_folder, recursive=True) def package_info(self): self.cpp_info.components['pango_'].libs = ['pango-1.0'] @@ -197,7 +199,9 @@ def package_info(self): self.env_info.PATH.append(os.path.join(self.package_folder, 'bin')) def package_id(self): - self.info.requires["glib"].full_package_mode() - self.info.requires["harfbuzz"].full_package_mode() - if self.options.with_cairo: + if not self.options["glib"].shared: + self.info.requires["glib"].full_package_mode() + if not self.options["harfbuzz"].shared: + self.info.requires["harfbuzz"].full_package_mode() + if self.options.with_cairo and not self.options["cairo"].shared: self.info.requires["cairo"].full_package_mode() diff --git a/recipes/pango/config.yml b/recipes/pango/config.yml index 21ce9306cfcb9..40891312baffc 100644 --- a/recipes/pango/config.yml +++ b/recipes/pango/config.yml @@ -1,20 +1,4 @@ versions: -# "1.48.0": -# folder: all -# "1.48.1": -# folder: all -# "1.48.2": -# folder: all -# "1.48.3": -# folder: all -# "1.48.4": -# folder: all -# "1.48.5": -# folder: all -# "1.48.6": -# folder: all -# "1.48.7": -# folder: all "1.48.9": folder: all "1.49.3": @@ -23,3 +7,5 @@ versions: folder: all "1.50.8": folder: all + "1.50.10": + folder: all diff --git a/recipes/parallel-hashmap/all/conandata.yml b/recipes/parallel-hashmap/all/conandata.yml index cd12ac5c65f5c..41fe3e31571e0 100644 --- a/recipes/parallel-hashmap/all/conandata.yml +++ b/recipes/parallel-hashmap/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.3.8": + url: "https://github.com/greg7mdp/parallel-hashmap/archive/v1.3.8.tar.gz" + sha256: "c4562ea360dc1dcaddd96a0494c753400364a52c7aa9750de49d8e6a222d28d3" + "1.37": + url: "https://github.com/greg7mdp/parallel-hashmap/archive/1.37.tar.gz" + sha256: "2ac652be0552fcb53a1163c08c1f28f29f0756594fcc587eebb4d8b363153709" + "1.36": + url: "https://github.com/greg7mdp/parallel-hashmap/archive/refs/tags/1.36.tar.gz" + sha256: "33acf44158a9661a9d630d13f9250a2aa27a770cb3771df77b1ba1a661c0b766" "1.35": url: "https://github.com/greg7mdp/parallel-hashmap/archive/1.35.tar.gz" sha256: "308ab6f92e4c6f49304562e352890cf7140de85ce723c097e74fbdec88e0e1ce" diff --git a/recipes/parallel-hashmap/config.yml b/recipes/parallel-hashmap/config.yml index 5f1ab385db344..2115f091019fe 100644 --- a/recipes/parallel-hashmap/config.yml +++ b/recipes/parallel-hashmap/config.yml @@ -1,4 +1,10 @@ versions: + "1.3.8": + folder: all + "1.37": + folder: all + "1.36": + folder: all "1.35": folder: all "1.34": diff --git a/recipes/parson/all/conandata.yml b/recipes/parson/all/conandata.yml new file mode 100644 index 0000000000000..a375832975a4d --- /dev/null +++ b/recipes/parson/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.4.0": + url: "https://github.com/kgabis/parson/archive/a34e72528224fe2a97fa89d8115fedc870df6fd3.tar.gz" + sha256: "ab37b30396e621246d05bdaafb2ab178adb92f5c599f9723cf1c9fbec6a8f037" diff --git a/recipes/parson/all/conanfile.py b/recipes/parson/all/conanfile.py new file mode 100644 index 0000000000000..029c0fb72bae0 --- /dev/null +++ b/recipes/parson/all/conanfile.py @@ -0,0 +1,63 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +import os + +required_conan_version = ">=1.53.0" + + +class ParsonConan(ConanFile): + name = "parson" + description = "Lightweight JSON library written in C." + license = "MIT" + topics = ("json", "parser") + homepage = "https://github.com/kgabis/parson" + url = "https://github.com/conan-io/conan-center-index" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "parson") + self.cpp_info.set_property("cmake_target_name", "parson::parson") + self.cpp_info.libs = ["parson"] diff --git a/recipes/parson/all/test_package/CMakeLists.txt b/recipes/parson/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b79634dc14200 --- /dev/null +++ b/recipes/parson/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(parson REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE parson::parson) diff --git a/recipes/parson/all/test_package/conanfile.py b/recipes/parson/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/parson/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/parson/all/test_package/test_package.c b/recipes/parson/all/test_package/test_package.c new file mode 100644 index 0000000000000..3ed5534e94a9d --- /dev/null +++ b/recipes/parson/all/test_package/test_package.c @@ -0,0 +1,19 @@ +#include + +#include + +int main() { + JSON_Value *root_value = json_value_init_object(); + JSON_Object *root_object = json_value_get_object(root_value); + json_object_set_string(root_object, "name", "John Smith"); + json_object_set_number(root_object, "age", 25); + json_object_dotset_string(root_object, "address.city", "Cupertino"); + json_object_dotset_value(root_object, "contact.emails", json_parse_string("[\"email@example.com\",\"email2@example.com\"]")); + char *serialized_string = json_serialize_to_string_pretty(root_value); + printf("%s\n", serialized_string); + + json_free_serialized_string(serialized_string); + json_value_free(root_value); + + return 0; +} diff --git a/recipes/parson/all/test_v1_package/CMakeLists.txt b/recipes/parson/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/parson/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/parson/all/test_v1_package/conanfile.py b/recipes/parson/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/parson/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/parson/config.yml b/recipes/parson/config.yml new file mode 100644 index 0000000000000..c957e4bc2d3c7 --- /dev/null +++ b/recipes/parson/config.yml @@ -0,0 +1,3 @@ +versions: + "1.4.0": + folder: all diff --git a/recipes/pcapplusplus/all/conandata.yml b/recipes/pcapplusplus/all/conandata.yml index 1151fcbdcc93d..ff3d1d4847765 100644 --- a/recipes/pcapplusplus/all/conandata.yml +++ b/recipes/pcapplusplus/all/conandata.yml @@ -8,13 +8,54 @@ sources: "22.05": url: "https://github.com/seladb/PcapPlusPlus/archive/v22.05.tar.gz" sha256: "5f299c4503bf5d3c29f82b8d876a19be7dea29c2aadcb52f2f3b394846c21da9" + "22.11": + url: "https://github.com/seladb/PcapPlusPlus/archive/v22.11.tar.gz" + sha256: "3172f12f2f8a8902ae1ad6be5d65c3059c42c49c1a28e97e5d8d25a48b05e44f" patches: "21.05": - patch_file: "patches/0001-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch" + patch_description: Pass CXXFLAGS and CPPFLAGS when-compiling 3rd party source + patch_type: conan base_path: "source_subfolder" + - patch_file: "patches/0003-Use-pthreads4w.patch" + patch_description: Use pthreads4w from conan center + patch_type: conan + base_path: "source_subfolder" + - patch_file: patches/0004-Fix-md5-include.patch + patch_description: Fix md5 include configuration + patch_type: conan + base_path: source_subfolder + "21.11": - patch_file: "patches/0001-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch" + patch_description: Pass CXXFLAGS and CPPFLAGS when-compiling 3rd party source + patch_type: conan + base_path: "source_subfolder" + - patch_file: "patches/0003-Use-pthreads4w.patch" + patch_description: Use pthreads4w from conan center + patch_type: conan base_path: "source_subfolder" + - patch_file: patches/0005-Fix-md5-include.patch + patch_description: Fix md5 include configuration + patch_type: conan + base_path: source_subfolder + "22.05": - patch_file: "patches/0002-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch" + patch_description: Pass CXXFLAGS and CPPFLAGS when-compiling 3rd party source + patch_type: conan + base_path: "source_subfolder" + - patch_file: "patches/0003-Use-pthreads4w.patch" + patch_description: Use pthreads4w from conan center + patch_type: conan + base_path: "source_subfolder" + - patch_file: patches/0006-Fix-md5-include.patch + patch_description: Fix md5 include configuration + patch_type: conan + base_path: source_subfolder + + "22.11": + - patch_file: "patches/0002-Pass-CXXFLAGS-CPPFLAGS-when-compiling-3rd-party-sour.patch" + patch_description: Pass CXXFLAGS and CPPFLAGS when-compiling 3rd party source + patch_type: conan base_path: "source_subfolder" diff --git a/recipes/pcapplusplus/all/conanfile.py b/recipes/pcapplusplus/all/conanfile.py index fc609f1bf6207..680bbfb33f9d8 100644 --- a/recipes/pcapplusplus/all/conanfile.py +++ b/recipes/pcapplusplus/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools import files +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration +from conans import AutoToolsBuildEnvironment, tools +# It has to be this one, the one from conan.tools.microsoft does not pass toolset +from conans import MSBuild import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" class PcapplusplusConan(ConanFile): @@ -34,19 +39,25 @@ def config_options(self): del self.options.fPIC def requirements(self): - if self.settings.os != "Windows": + if self.settings.os == "Windows": + self.requires("npcap/1.70") + if self.version < "22.11": + self.requires("pthreads4w/3.0.0") + else: self.requires("libpcap/1.9.1") + # TODO: use conan recipe instead of embedded one + # self.requires("hash-library/8.0") + def validate(self): - if self.settings.os == "Windows": - # FIXME: missing winpcap recipe (https://github.com/bincrafters/community/pull/1395) - raise ConanInvalidConfiguration("Can not build on Windows: Winpcap is not available on cci (yet).") - if self.settings.os not in ("FreeBSD", "Linux", "Macos"): - raise ConanInvalidConfiguration("%s is not supported" % self.settings.os) + if self.settings.os == "Windows" and not is_msvc(self): + raise ConanInvalidConfiguration("Can not build on Windows: only msvc compiler is supported.") + if self.settings.os not in ("FreeBSD", "Linux", "Macos", "Windows"): + raise ConanInvalidConfiguration(f"{self.settings.os} is not supported") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + files.get(self, **self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) @property def _configure_sh_script(self): @@ -58,15 +69,35 @@ def _configure_sh_script(self): }[str(self.settings.os)] def _patch_sources(self): - if not self.options.get_safe("fPIC"): - tools.replace_in_file(os.path.join(self._source_subfolder, "PcapPlusPlus.mk.common"), + if not self.options.get_safe("fPIC") and self.settings.os != "Windows": + files.replace_in_file(self, os.path.join(self._source_subfolder, "PcapPlusPlus.mk.common"), "-fPIC", "") for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + files.patch(self, **patch) def build(self): self._patch_sources() - with tools.chdir(self._source_subfolder): + if self.settings.os == "Windows": + self._build_windows() + else: + self._build_posix() + + def _build_windows(self): + with files.chdir(self, self._source_subfolder): + config_args = [ + "configure-windows-visual-studio.bat", + "--pcap-sdk", self.deps_cpp_info["npcap"].rootpath, + "--vs-version", "vs2015", + ] + if self.version < "22.11": + config_args += ["--pthreads-home", self.deps_cpp_info["pthreads4w"].rootpath] + self.run(" ".join(config_args), run_environment=True) + msbuild = MSBuild(self) + targets = ['Common++', 'Packet++', 'Pcap++'] + msbuild.build("mk/vs2015/PcapPlusPlus.sln", targets=targets) + + def _build_posix(self): + with files.chdir(self, self._source_subfolder): config_args = [ "./{}".format(self._configure_sh_script), "--libpcap-include-dir", tools.unix_path(self.deps_cpp_info["libpcap"].include_paths[0]), @@ -87,10 +118,13 @@ def package(self): self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder, keep_path=False) self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "Dist", "header")) self.copy("*.a", dst="lib", src=os.path.join(self._source_subfolder, "Dist"), keep_path=False) + self.copy("*.lib", dst="lib", src=os.path.join(self._source_subfolder, "Dist"), keep_path=False) def package_info(self): self.cpp_info.libs = ["Pcap++", "Packet++", "Common++"] - if self.settings.os in ("FreeBSD", "Linux"): + if self.version < "22.11" and self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs.append("pthread") if self.settings.os == "Macos": self.cpp_info.frameworks.extend(["CoreFoundation", "Security", "SystemConfiguration"]) + if self.settings.os == "Windows": + self.cpp_info.system_libs = ["ws2_32"] diff --git a/recipes/pcapplusplus/all/patches/0003-Use-pthreads4w.patch b/recipes/pcapplusplus/all/patches/0003-Use-pthreads4w.patch new file mode 100644 index 0000000000000..d44a98ef07be3 --- /dev/null +++ b/recipes/pcapplusplus/all/patches/0003-Use-pthreads4w.patch @@ -0,0 +1,18 @@ +--- mk/vs/PcapPlusPlusPropertySheet.props.template ++++ mk/vs/PcapPlusPlusPropertySheet.props.template +@@ -23,12 +23,11 @@ + + + +- $(PThreadWin32Home)\Pre-built.2\include;%(AdditionalIncludeDirectories) ++ $(PThreadWin32Home)\include;%(AdditionalIncludeDirectories) + HAVE_STRUCT_TIMESPEC;%(PreprocessorDefinitions) + + +- $(PThreadWin32Home)\Pre-built.2\lib\x86;%(AdditionalLibraryDirectories) +- $(PThreadWin32Home)\Pre-built.2\lib\x64;%(AdditionalLibraryDirectories) ++ $(PThreadWin32Home)\lib;%(AdditionalLibraryDirectories) +- pthreadVC2.lib;%(AdditionalDependencies) ++ pthreadVC3.lib;%(AdditionalDependencies) + + diff --git a/recipes/pcapplusplus/all/patches/0004-Fix-md5-include.patch b/recipes/pcapplusplus/all/patches/0004-Fix-md5-include.patch new file mode 100644 index 0000000000000..4232648a089d4 --- /dev/null +++ b/recipes/pcapplusplus/all/patches/0004-Fix-md5-include.patch @@ -0,0 +1,11 @@ +--- mk/vs/Packet++.vcxproj.template ++++ mk/vs/Packet++.vcxproj.template +@@ -271,7 +271,7 @@ + + + +- ++ + + + diff --git a/recipes/pcapplusplus/all/patches/0005-Fix-md5-include.patch b/recipes/pcapplusplus/all/patches/0005-Fix-md5-include.patch new file mode 100644 index 0000000000000..4bb47fbc85d17 --- /dev/null +++ b/recipes/pcapplusplus/all/patches/0005-Fix-md5-include.patch @@ -0,0 +1,11 @@ +--- mk/vs/Packet++.vcxproj.template ++++ mk/vs/Packet++.vcxproj.template +@@ -273,7 +273,7 @@ + + + +- ++ + + + diff --git a/recipes/pcapplusplus/all/patches/0006-Fix-md5-include.patch b/recipes/pcapplusplus/all/patches/0006-Fix-md5-include.patch new file mode 100644 index 0000000000000..115ab8bfc2026 --- /dev/null +++ b/recipes/pcapplusplus/all/patches/0006-Fix-md5-include.patch @@ -0,0 +1,11 @@ +--- mk/vs/Packet++.vcxproj.template ++++ mk/vs/Packet++.vcxproj.template +@@ -275,7 +275,7 @@ + + + +- ++ + + + diff --git a/recipes/pcapplusplus/all/test_package/1_packet.pcap b/recipes/pcapplusplus/all/test_package/1_packet.pcap deleted file mode 100644 index b3aa1e0fed771..0000000000000 Binary files a/recipes/pcapplusplus/all/test_package/1_packet.pcap and /dev/null differ diff --git a/recipes/pcapplusplus/all/test_package/CMakeLists.txt b/recipes/pcapplusplus/all/test_package/CMakeLists.txt index 196188113685c..8c5f8b3c73c1f 100644 --- a/recipes/pcapplusplus/all/test_package/CMakeLists.txt +++ b/recipes/pcapplusplus/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(pcapplusplus REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} pcapplusplus::pcapplusplus) diff --git a/recipes/pcapplusplus/all/test_package/conanfile.py b/recipes/pcapplusplus/all/test_package/conanfile.py index 83cd7c3b3fe37..a9fb96656f203 100644 --- a/recipes/pcapplusplus/all/test_package/conanfile.py +++ b/recipes/pcapplusplus/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -class PcapplusplusTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - pcap_file_path = os.path.join(self.source_folder, "1_packet.pcap") - self.run("{0} {1}".format(bin_path, pcap_file_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pcapplusplus/all/test_package/test_package.cpp b/recipes/pcapplusplus/all/test_package/test_package.cpp index a379087d0db28..a39e3bf39bee1 100644 --- a/recipes/pcapplusplus/all/test_package/test_package.cpp +++ b/recipes/pcapplusplus/all/test_package/test_package.cpp @@ -1,43 +1,8 @@ +#include #include -#include -#include -#include +#include -int main(int argc, char **argv) { - if (argc < 2) { - std::cerr << "ERROR: Need at least one argument" << std::endl; - return 1; - } - - // open a pcap file for reading - pcpp::PcapFileReaderDevice reader(argv[1]); - if (!reader.open()) { - std::cerr << "ERROR: Error opening the pcap file" << std::endl; - return 1; - } - - // read the first (and only) packet from the file - pcpp::RawPacket rawPacket; - if (!reader.getNextPacket(rawPacket)) { - std::cerr << "ERROR: Couldn't read the first packet in the file" << std::endl; - return 1; - } - - // parse the raw packet into a parsed packet - pcpp::Packet parsedPacket(&rawPacket); - - // verify the packet is IPv4 - if (parsedPacket.isPacketOfType(pcpp::IPv4)) { - // extract source and dest IPs - pcpp::IPv4Address srcIP = parsedPacket.getLayerOfType()->getSrcIPv4Address(); - pcpp::IPv4Address destIP = parsedPacket.getLayerOfType()->getDstIPv4Address(); - - // print source and dest IPs - std::cout << "Source IP is '" << srcIP.toString() << "'; Dest IP is '" << destIP.toString() << "'" << std::endl; - } - - // close the file - reader.close(); - - return 0; +int main() { + std::cout << "PCAP++ VERSION: " << pcpp::getPcapPlusPlusVersionFull() << std::endl; + return EXIT_SUCCESS; } diff --git a/recipes/pcapplusplus/all/test_v1_package/CMakeLists.txt b/recipes/pcapplusplus/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/pcapplusplus/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/pcapplusplus/all/test_v1_package/conanfile.py b/recipes/pcapplusplus/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/pcapplusplus/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/pcapplusplus/config.yml b/recipes/pcapplusplus/config.yml index 5a01a9fd55268..26e119bb00764 100644 --- a/recipes/pcapplusplus/config.yml +++ b/recipes/pcapplusplus/config.yml @@ -5,3 +5,5 @@ versions: folder: all "22.05": folder: all + "22.11": + folder: all diff --git a/recipes/pcre/all/conanfile.py b/recipes/pcre/all/conanfile.py index 1298f3df04c72..8d0c74976c81b 100644 --- a/recipes/pcre/all/conanfile.py +++ b/recipes/pcre/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class PCREConan(ConanFile): @@ -16,6 +16,7 @@ class PCREConan(ConanFile): topics = ("regex", "regexp", "PCRE") license = "BSD-3-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -49,8 +50,7 @@ class PCREConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -58,42 +58,35 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.build_pcrecpp: - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if not self.options.build_pcregrep: del self.options.with_bzip2 del self.options.with_zlib if self.options.with_unicode_properties: self.options.with_utf = True + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.get_safe("with_bzip2"): self.requires("bzip2/1.0.8") if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): - if not self.info.options.build_pcre_8 and not self.info.options.build_pcre_16 and not self.info.options.build_pcre_32: + if not self.options.build_pcre_8 and not self.options.build_pcre_16 and not self.options.build_pcre_32: raise ConanInvalidConfiguration("At least one of build_pcre_8, build_pcre_16 or build_pcre_32 must be enabled") - if self.info.options.build_pcrecpp and not self.info.options.build_pcre_8: + if self.options.build_pcrecpp and not self.options.build_pcre_8: raise ConanInvalidConfiguration("build_pcre_8 must be enabled for the C++ library support") - if self.info.options.build_pcregrep and not self.info.options.build_pcre_8: + if self.options.build_pcregrep and not self.options.build_pcre_8: raise ConanInvalidConfiguration("build_pcre_8 must be enabled for the pcregrep program") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -186,9 +179,7 @@ def package_info(self): self.cpp_info.components["libpcre32"].defines.append("PCRE_STATIC=1") if self.options.build_pcregrep: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bin_path}") - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) # FIXME: This is a workaround to avoid ConanException. zlib and bzip2 # are optional requirements of pcregrep executable, not of any pcre lib. if self.options.with_bzip2: diff --git a/recipes/pcre/all/test_package/conanfile.py b/recipes/pcre/all/test_package/conanfile.py index d1d20e75e45b5..931afd6db544f 100644 --- a/recipes/pcre/all/test_package/conanfile.py +++ b/recipes/pcre/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/pcre2/all/conandata.yml b/recipes/pcre2/all/conandata.yml index dd96870544fa5..344830544b429 100644 --- a/recipes/pcre2/all/conandata.yml +++ b/recipes/pcre2/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "10.42": + url: "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.42/pcre2-10.42.tar.bz2" + sha256: "8d36cd8cb6ea2a4c2bb358ff6411b0c788633a2a45dabbf1aeb4b701d1b5e840" "10.40": url: "https://github.com/PCRE2Project/pcre2/releases/download/pcre2-10.40/pcre2-10.40.tar.bz2" sha256: "14e4b83c4783933dc17e964318e6324f7cae1bc75d8f3c79bc6969f00c159d68" @@ -34,35 +37,35 @@ patches: "10.40": - patch_file: "patches/0001-fix-cmake-1.39.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" "10.39": - patch_file: "patches/0001-fix-cmake-1.39.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" "10.37": - patch_file: "patches/0001-fix-cmake-1.36.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" "10.36": - patch_file: "patches/0001-fix-cmake-1.36.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" "10.35": - patch_file: "patches/0001-fix-cmake-1.35.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" "10.33": - patch_file: "patches/0001-fix-cmake-1.33.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" "10.32": - patch_file: "patches/0001-fix-cmake-1.32.patch" patch_description: "correct the order of cmake_minimum_required() and project()" - patch_type: "backport" + patch_type: "conan" patch_source: "https://github.com/PCRE2Project/pcre2/pull/142" diff --git a/recipes/pcre2/all/conanfile.py b/recipes/pcre2/all/conanfile.py index 6b04391177a90..5982290e7cdbe 100644 --- a/recipes/pcre2/all/conanfile.py +++ b/recipes/pcre2/all/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.microsoft import is_msvc, is_msvc_static_runtime from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class PCRE2Conan(ConanFile): @@ -44,8 +44,7 @@ class PCRE2Conan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,35 +52,29 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") if not self.options.build_pcre2grep: del self.options.with_zlib del self.options.with_bzip2 del self.options.grep_support_callout_fork + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.options.get_safe("with_zlib"): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.get_safe("with_bzip2"): self.requires("bzip2/1.0.8") def validate(self): - if not self.info.options.build_pcre2_8 and not self.info.options.build_pcre2_16 and not self.info.options.build_pcre2_32: + if not self.options.build_pcre2_8 and not self.options.build_pcre2_16 and not self.options.build_pcre2_32: raise ConanInvalidConfiguration("At least one of build_pcre2_8, build_pcre2_16 or build_pcre2_32 must be enabled") - if self.info.options.build_pcre2grep and not self.info.options.build_pcre2_8: + if self.options.build_pcre2grep and not self.options.build_pcre2_8: raise ConanInvalidConfiguration("build_pcre2_8 must be enabled for the pcre2grep program") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) diff --git a/recipes/pcre2/all/test_package/conanfile.py b/recipes/pcre2/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/pcre2/all/test_package/conanfile.py +++ b/recipes/pcre2/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/pcre2/all/test_v1_package/CMakeLists.txt b/recipes/pcre2/all/test_v1_package/CMakeLists.txt index e362ee08875db..0d20897301b68 100644 --- a/recipes/pcre2/all/test_v1_package/CMakeLists.txt +++ b/recipes/pcre2/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(PCRE2 REQUIRED 8BIT CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE PCRE2::8BIT) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/pcre2/all/test_v1_package/conanfile.py b/recipes/pcre2/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/pcre2/all/test_v1_package/conanfile.py +++ b/recipes/pcre2/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/pcre2/config.yml b/recipes/pcre2/config.yml index 7ad15f550bc8d..f488a0ecff8cb 100644 --- a/recipes/pcre2/config.yml +++ b/recipes/pcre2/config.yml @@ -1,4 +1,6 @@ versions: + "10.42": + folder: all "10.40": folder: all "10.39": diff --git a/recipes/perfetto/all/CMakeLists.txt b/recipes/perfetto/all/CMakeLists.txt index b8e1d87131bc9..9fc76922c46c1 100644 --- a/recipes/perfetto/all/CMakeLists.txt +++ b/recipes/perfetto/all/CMakeLists.txt @@ -1,32 +1,24 @@ cmake_minimum_required(VERSION 3.8) -project(perfetto CXX) +project(perfetto LANGUAGES CXX) -include(conanbuildinfo.cmake) -conan_basic_setup() +set(PUBLIC_HEADERS ${PERFETTO_SRC_DIR}/sdk/perfetto.h) -set(PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/sdk/perfetto.h) - -add_library(perfetto source_subfolder/sdk/perfetto.cc) -target_compile_features(perfetto PRIVATE cxx_std_11 cxx_constexpr) -set_target_properties(perfetto PROPERTIES PUBLIC_HEADER "${PUBLIC_HEADERS}") - -install( - TARGETS perfetto - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +add_library(perfetto ${PERFETTO_SRC_DIR}/sdk/perfetto.cc) +target_compile_features(perfetto PRIVATE ${PERFETTO_CXX_STANDARD}) +set_target_properties(perfetto PROPERTIES + PUBLIC_HEADER "${PUBLIC_HEADERS}" + WINDOWS_EXPORT_ALL_SYMBOLS TRUE ) -if (PERFETTO_DISABLE_LOGGING) - add_definitions(-DPERFETTO_DISABLE_LOG) -endif (PERFETTO_DISABLE_LOGGING) +if(PERFETTO_DISABLE_LOGGING) + target_compile_definitions(perfetto PUBLIC PERFETTO_DISABLE_LOG) +endif() if (WIN32) # Disable legacy features in windows.h. - add_definitions(-DWIN32_LEAN_AND_MEAN -DNOMINMAX) + target_compile_definitions(perfetto PRIVATE WIN32_LEAN_AND_MEAN NOMINMAX) # On Windows we should link to WinSock2. - target_link_libraries(perfetto ws2_32) + target_link_libraries(perfetto PRIVATE ws2_32) endif (WIN32) if (MSVC) @@ -35,6 +27,15 @@ if (MSVC) target_compile_options(perfetto PRIVATE "/bigobj") # The perfetto library needs permissive flag on MSVC target_compile_options(perfetto PRIVATE "/permissive-") - # The perfetto library doesn't export symbols by default - set_target_properties(perfetto PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE) + # https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ + target_compile_options(perfetto PRIVATE "/Zc:__cplusplus") endif (MSVC) + +include(GNUInstallDirs) +install( + TARGETS perfetto + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) diff --git a/recipes/perfetto/all/conandata.yml b/recipes/perfetto/all/conandata.yml index 97d1f0a4be081..2748dc3d8f117 100644 --- a/recipes/perfetto/all/conandata.yml +++ b/recipes/perfetto/all/conandata.yml @@ -1,48 +1,57 @@ sources: - "20.1": - url: https://github.com/google/perfetto/archive/refs/tags/v20.1.tar.gz - sha256: d681bb76e2b73e6ba46db53c1502f31f4f16c36cd6e91d4ae839a3b44272f646 - "21.0": - url: https://github.com/google/perfetto/archive/refs/tags/v21.0.tar.gz - sha256: 8ce7d7c3dd8a2edd6d37092eb139e11bbf9c7e33a9964bab96c0505def6e1ad4 - "22.0": - url: https://github.com/google/perfetto/archive/refs/tags/v22.0.tar.gz - sha256: c62e9059a566136665b0c69e1f9901fc747b1eca813cd59a76e941bc2772340c - "22.1": - url: https://github.com/google/perfetto/archive/refs/tags/v22.1.tar.gz - sha256: 013ba743019a1ca04627f7ce8bf424b60ed7f0f57e232eff719ae879be4c90fd - "23.0": - url: https://github.com/google/perfetto/archive/refs/tags/v23.0.tar.gz - sha256: 9d2955736ce9d234e0f5153acfefea8facfa762c9167024902ea98f9010207aa - "24.2": - url: https://github.com/google/perfetto/archive/refs/tags/v24.2.tar.gz - sha256: b296d0a939e694fd2e73ed6c6418b774b5ef6809ddf60988989416e5cbf90b41 - "25.0": - url: https://github.com/google/perfetto/archive/refs/tags/v25.0.tar.gz - sha256: 73a4b895df9222ddb231b8d903099d6da08cd079f27983f540e89156fa88ba67 - "26.1": - url: https://github.com/google/perfetto/archive/refs/tags/v26.1.tar.gz - sha256: cce387e82e2a137fce2eba927f80f20407764b77637a1a92b9b24065a500ce6d - "27.0": - url: https://github.com/google/perfetto/archive/refs/tags/v27.0.tar.gz - sha256: c22750dd21419cf58132d55d634b88d9947bd0c7244dd98854b0248c7637a98c + "32.1": + url: "https://github.com/google/perfetto/archive/refs/tags/v32.1.tar.gz" + sha256: "0d1088b4758b3d5f3813178c6de22386329d42407d23aa1479f20dce96e49d78" + "31.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v31.0.tar.gz" + sha256: "544c68293590f53391ea4267d5a9b1a4594e1c8216fc5f5ce9d0f1227797922e" + "30.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v30.0.tar.gz" + sha256: "d1883793a2adb2a4105fc083478bf781badd566d72da45caa99095b61f938a2e" "27.1": - url: https://github.com/google/perfetto/archive/refs/tags/v27.1.tar.gz - sha256: 9edbafd6e2d9feaced4c0153e2f48dbb1da38429c5b1b17dfee70a91fd3101b2 - -patches: - "20.1": - - patch_file: "patches/v20.1/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch" - base_path: "source_subfolder" - "21.0": - - patch_file: "patches/v21.x/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch" - base_path: "source_subfolder" - "22.0": - - patch_file: "patches/v22.x/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch" - base_path: "source_subfolder" + url: "https://github.com/google/perfetto/archive/refs/tags/v27.1.tar.gz" + sha256: "9edbafd6e2d9feaced4c0153e2f48dbb1da38429c5b1b17dfee70a91fd3101b2" + "27.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v27.0.tar.gz" + sha256: "c22750dd21419cf58132d55d634b88d9947bd0c7244dd98854b0248c7637a98c" + "26.1": + url: "https://github.com/google/perfetto/archive/refs/tags/v26.1.tar.gz" + sha256: "cce387e82e2a137fce2eba927f80f20407764b77637a1a92b9b24065a500ce6d" + "25.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v25.0.tar.gz" + sha256: "73a4b895df9222ddb231b8d903099d6da08cd079f27983f540e89156fa88ba67" + "24.2": + url: "https://github.com/google/perfetto/archive/refs/tags/v24.2.tar.gz" + sha256: "b296d0a939e694fd2e73ed6c6418b774b5ef6809ddf60988989416e5cbf90b41" + "23.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v23.0.tar.gz" + sha256: "9d2955736ce9d234e0f5153acfefea8facfa762c9167024902ea98f9010207aa" "22.1": - - patch_file: "patches/v22.x/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch" - base_path: "source_subfolder" + url: "https://github.com/google/perfetto/archive/refs/tags/v22.1.tar.gz" + sha256: "013ba743019a1ca04627f7ce8bf424b60ed7f0f57e232eff719ae879be4c90fd" + "22.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v22.0.tar.gz" + sha256: "c62e9059a566136665b0c69e1f9901fc747b1eca813cd59a76e941bc2772340c" + "21.0": + url: "https://github.com/google/perfetto/archive/refs/tags/v21.0.tar.gz" + sha256: "8ce7d7c3dd8a2edd6d37092eb139e11bbf9c7e33a9964bab96c0505def6e1ad4" + "20.1": + url: "https://github.com/google/perfetto/archive/refs/tags/v20.1.tar.gz" + sha256: "d681bb76e2b73e6ba46db53c1502f31f4f16c36cd6e91d4ae839a3b44272f646" +patches: + "31.0": + - patch_file: "patches/v31.0/0001-tracing-fix-compile-on-MSVC.patch" + patch_description: "Fix compilation on MSVC" + patch_type: "backport" + patch_source: "https://android-review.googlesource.com/c/platform/external/perfetto/+/2355222" + sha256: "ad253a9bba3941bd8d1f206422d60eb1c06cb6d75d60eff5b5b8ae0f2ec7e15c" "25.0": - patch_file: "patches/v25.0/0001-MSVC-Fix-narrowing-conversion-error.patch" - base_path: "source_subfolder" + "22.1": + - patch_file: "patches/v22.x/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch" + "22.0": + - patch_file: "patches/v22.x/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch" + "21.0": + - patch_file: "patches/v21.x/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch" + "20.1": + - patch_file: "patches/v20.1/0001-Fix-perfetto-logging-when-PERFETTO_DISABLE_LOG-activ.patch" diff --git a/recipes/perfetto/all/conanfile.py b/recipes/perfetto/all/conanfile.py index 0a53ada1dcf71..44d0edf055cd6 100644 --- a/recipes/perfetto/all/conanfile.py +++ b/recipes/perfetto/all/conanfile.py @@ -1,9 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration - +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" + class PerfettoConan(ConanFile): name = "perfetto" @@ -12,25 +17,37 @@ class PerfettoConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" description = "Performance instrumentation and tracing for Android, Linux and Chrome" topics = ("linux", "profiling", "tracing") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { - "shared": [True, False], - "fPIC": [True, False], - "disable_logging": [True, False], # switches PERFETTO_DISABLE_LOG + "shared": [True, False], + "fPIC": [True, False], + "disable_logging": [True, False], # switches PERFETTO_DISABLE_LOG } default_options = { - "shared": False, - "fPIC": True, - "disable_logging": False, + "shared": False, + "fPIC": True, + "disable_logging": False, } short_paths = True - generators = "cmake" - _cmake = None @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 if Version(self.version) < "31.0" else 17 + + @property + def _minimum_compilers_version(self): + return { + "Visual Studio": "15" if Version(self.version) < "31.0" else "16", + "msvc": "190", + "gcc": "7", + "clang": "3.3" if Version(self.version) < "31.0" else "5", + "apple-clang": "5.0" if Version(self.version) < "31.0" else "9.1", + } + + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,50 +55,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < 7: - raise ConanInvalidConfiguration ("perfetto requires gcc >= 7") - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + compiler = self.info.settings.compiler + min_version = self._minimum_compilers_version.get(str(compiler)) + if min_version and loose_lt_semver(str(compiler.version), min_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires {compiler} {min_version}. The current compiler is {compiler} {compiler.version}." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - if self.options.get_safe("disable_logging", False) == True: - self._cmake.definitions["PERFETTO_DISABLE_LOGGING"] = True - self._cmake.configure() - return self._cmake - - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PERFETTO_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["PERFETTO_DISABLE_LOGGING"] = self.options.disable_logging + tc.variables["PERFETTO_CXX_STANDARD"] = f"cxx_std_{self._minimum_cpp_standard}" + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["perfetto"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") if self.settings.os == "Windows": self.cpp_info.system_libs.append("ws2_32") + if is_msvc(self): + self.cpp_info.cxxflags.append("/Zc:__cplusplus") diff --git a/recipes/perfetto/all/patches/v31.0/0001-tracing-fix-compile-on-MSVC.patch b/recipes/perfetto/all/patches/v31.0/0001-tracing-fix-compile-on-MSVC.patch new file mode 100644 index 0000000000000..0ad8e6cb604c6 --- /dev/null +++ b/recipes/perfetto/all/patches/v31.0/0001-tracing-fix-compile-on-MSVC.patch @@ -0,0 +1,19 @@ +diff --git a/sdk/perfetto.h b/sdk/perfetto.h +index 175c092..682cea7 100644 +--- a/sdk/perfetto.h ++++ b/sdk/perfetto.h +@@ -18090,8 +18090,9 @@ class TrackEventDataSource + } while (false) + + // C++17 doesn't like a move constructor being defined for the EventFinalizer +-// class but C++11 doesn't compile without it being defined so support both. +-#if PERFETTO_IS_AT_LEAST_CPP17() ++// class but C++11 and MSVC doesn't compile without it being defined so support ++// both. ++#if PERFETTO_IS_AT_LEAST_CPP17() && !PERFETTO_BUILDFLAG(PERFETTO_COMPILER_MSVC) + #define PERFETTO_INTERNAL_EVENT_FINALIZER_KEYWORD delete + #else + #define PERFETTO_INTERNAL_EVENT_FINALIZER_KEYWORD default +-- +2.24.3 (Apple Git-128) + diff --git a/recipes/perfetto/all/test_package/CMakeLists.txt b/recipes/perfetto/all/test_package/CMakeLists.txt index 3ef3ba5495cb6..ad42eab5529ea 100644 --- a/recipes/perfetto/all/test_package/CMakeLists.txt +++ b/recipes/perfetto/all/test_package/CMakeLists.txt @@ -1,11 +1,12 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(perfetto REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_compile_features(test_package PRIVATE cxx_std_11 cxx_constexpr) -target_link_libraries(${PROJECT_NAME} perfetto::perfetto) +if(perfetto_VERSION VERSION_LESS "31.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() +target_link_libraries(${PROJECT_NAME} PRIVATE perfetto::perfetto) diff --git a/recipes/perfetto/all/test_package/conanfile.py b/recipes/perfetto/all/test_package/conanfile.py index a8c92dea63335..0a6bc68712d90 100644 --- a/recipes/perfetto/all/test_package/conanfile.py +++ b/recipes/perfetto/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/perfetto/all/test_v1_package/CMakeLists.txt b/recipes/perfetto/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/perfetto/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/perfetto/all/test_v1_package/conanfile.py b/recipes/perfetto/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/perfetto/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/perfetto/config.yml b/recipes/perfetto/config.yml index 8e798e3d0b667..dbeb493c74c3d 100644 --- a/recipes/perfetto/config.yml +++ b/recipes/perfetto/config.yml @@ -1,21 +1,27 @@ versions: - "20.1": + "32.1": folder: all - "21.0": + "31.0": folder: all - "22.0": + "30.0": folder: all - "22.1": + "27.1": folder: all - "23.0": + "27.0": folder: all - "24.2": + "26.1": folder: all "25.0": folder: all - "26.1": + "24.2": folder: all - "27.0": + "23.0": folder: all - "27.1": + "22.1": + folder: all + "22.0": + folder: all + "21.0": + folder: all + "20.1": folder: all diff --git a/recipes/perlinnoise/all/conandata.yml b/recipes/perlinnoise/all/conandata.yml new file mode 100644 index 0000000000000..9b1218cce4fb3 --- /dev/null +++ b/recipes/perlinnoise/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "3.0.0": + url: "https://github.com/Reputeless/PerlinNoise/archive/refs/tags/v3.0.0.tar.gz" + sha256: "1fea1e7ebeb3c66b79d60c2c398aa83ccfadcef343bd396c0f0a684380e827fc" diff --git a/recipes/perlinnoise/all/conanfile.py b/recipes/perlinnoise/all/conanfile.py new file mode 100644 index 0000000000000..5c27415325d35 --- /dev/null +++ b/recipes/perlinnoise/all/conanfile.py @@ -0,0 +1,79 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class PerlinnoiseConan(ConanFile): + name = "perlinnoise" + description = "Header-only Perlin noise library for modern C++ " + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/Reputeless/PerlinNoise/" + topics = ("noise", "perlin", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compiler_required_cpp(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12.0", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compiler_required_cpp.get(str(self.settings.compiler), False) + if minimum_version: + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") + else: + self.output.warn(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "PerlinNoise") + self.cpp_info.set_property("cmake_target_name", "siv::PerlinNoise") + + self.cpp_info.components["siv"].set_property("cmake_target_name", "siv::PerlinNoise") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "PerlinNoise" + self.cpp_info.filenames["cmake_find_package_multi"] = "PerlinNoise" + self.cpp_info.names["cmake_find_package"] = "siv" + self.cpp_info.names["cmake_find_package_multi"] = "siv" + + self.cpp_info.components["siv"].names["cmake_find_package"] = "PerlinNoise" + self.cpp_info.components["siv"].names["cmake_find_package_multi"] = "PerlinNoise" diff --git a/recipes/perlinnoise/all/test_package/CMakeLists.txt b/recipes/perlinnoise/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..18878f56fc9d5 --- /dev/null +++ b/recipes/perlinnoise/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(PerlinNoise REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE siv::PerlinNoise) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/perlinnoise/all/test_package/conanfile.py b/recipes/perlinnoise/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/perlinnoise/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/perlinnoise/all/test_package/test_package.cpp b/recipes/perlinnoise/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..082d3dfe07931 --- /dev/null +++ b/recipes/perlinnoise/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include + +#include "PerlinNoise.hpp" + +int main(int argc, const char** argv) { + auto frequency = 32.f; + auto octaves = 9; + auto seed = siv::PerlinNoise::seed_type{74524}; + + auto generator = siv::PerlinNoise{seed}; + + auto width = 32; + auto height = 16; + + auto fx = width / frequency; + auto fy = height / frequency; + + for (auto y = 0; y < height; ++y) { + for (auto x = 0; x < width; ++x) { + auto color = generator.octave2D(x / fx, y / fy, octaves); + std::cout << color << " "; + } + std::cout << std::endl; + } + + return 0; +} diff --git a/recipes/perlinnoise/all/test_v1_package/CMakeLists.txt b/recipes/perlinnoise/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/perlinnoise/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/perlinnoise/all/test_v1_package/conanfile.py b/recipes/perlinnoise/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/perlinnoise/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/perlinnoise/config.yml b/recipes/perlinnoise/config.yml new file mode 100644 index 0000000000000..c6ac749e0b234 --- /dev/null +++ b/recipes/perlinnoise/config.yml @@ -0,0 +1,3 @@ +versions: + "3.0.0": + folder: all diff --git a/recipes/pffft/all/CMakeLists.txt b/recipes/pffft/all/CMakeLists.txt index 3818b1658dd03..d32357140dd71 100644 --- a/recipes/pffft/all/CMakeLists.txt +++ b/recipes/pffft/all/CMakeLists.txt @@ -13,9 +13,10 @@ if(MSVC) target_compile_definitions(pffft PRIVATE _USE_MATH_DEFINES) set_property(TARGET pffft PROPERTY WINDOWS_EXPORT_ALL_SYMBOLS TRUE) endif() -find_library(MATH_LIBRARY m) -if(MATH_LIBRARY) - target_link_libraries(pffft PRIVATE ${MATH_LIBRARY}) +include(CheckFunctionExists) +check_function_exists(round HAVE_MATH_SYSTEM) +if(NOT HAVE_MATH_SYSTEM) + target_link_libraries(pffft PRIVATE m) endif() install( diff --git a/recipes/pffft/all/conanfile.py b/recipes/pffft/all/conanfile.py index 0141195a3d72a..a9e20b61b7a16 100644 --- a/recipes/pffft/all/conanfile.py +++ b/recipes/pffft/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import get, load, save import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" class PffftConan(ConanFile): @@ -14,6 +14,7 @@ class PffftConan(ConanFile): topics = ("fft", "pffft") license = "BSD-like (FFTPACK license)" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,22 +35,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/pffft/all/test_package/conanfile.py b/recipes/pffft/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/pffft/all/test_package/conanfile.py +++ b/recipes/pffft/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/pffft/all/test_v1_package/CMakeLists.txt b/recipes/pffft/all/test_v1_package/CMakeLists.txt index a40c41c1c0047..0d20897301b68 100644 --- a/recipes/pffft/all/test_v1_package/CMakeLists.txt +++ b/recipes/pffft/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(pffft REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE pffft::pffft) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/pfr/all/conandata.yml b/recipes/pfr/all/conandata.yml index f42355817b056..dd8ef2bef04e2 100644 --- a/recipes/pfr/all/conandata.yml +++ b/recipes/pfr/all/conandata.yml @@ -1,14 +1,13 @@ sources: "1.0.4": - - url: "https://github.com/boostorg/pfr/archive/refs/tags/1.0.4.tar.gz" - sha256: "01ecb27c850f50c589bad9a741ec9af6b06fe07ed673946c4bbb1960eb0f126e" + url: "https://github.com/boostorg/pfr/archive/refs/tags/1.0.4.tar.gz" + sha256: "01ecb27c850f50c589bad9a741ec9af6b06fe07ed673946c4bbb1960eb0f126e" "2.0.2": - - url: "https://github.com/boostorg/pfr/archive/refs/tags/2.0.2.tar.gz" - sha256: "1f03ebd3728d7df166d40d992ac071927d483474aa0f947e78a573c4ca288c04" + url: "https://github.com/boostorg/pfr/archive/refs/tags/2.0.2.tar.gz" + sha256: "1f03ebd3728d7df166d40d992ac071927d483474aa0f947e78a573c4ca288c04" "2.0.3": - - url: "https://github.com/boostorg/pfr/archive/refs/tags/2.0.3.tar.gz" - sha256: "c7d1950b56a07678423759f0bcdf37312f9861e3e9e59c45331903891213e2f2" + url: "https://github.com/boostorg/pfr/archive/refs/tags/2.0.3.tar.gz" + sha256: "c7d1950b56a07678423759f0bcdf37312f9861e3e9e59c45331903891213e2f2" patches: "1.0.4": - patch_file: "patches/50_add_license.patch" - base_path: "source_subfolder" diff --git a/recipes/pfr/all/conanfile.py b/recipes/pfr/all/conanfile.py index f8a18e182f99d..06c6ea4370d7e 100644 --- a/recipes/pfr/all/conanfile.py +++ b/recipes/pfr/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.files import rename +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches +from conan.tools.scm import Version +from conan.tools.layout import basic_layout + import os +required_conan_version = ">=1.52.0" + class PfrConan(ConanFile): name = "pfr" @@ -12,11 +18,6 @@ class PfrConan(ConanFile): homepage = "https://github.com/boostorg/pfr" license = "BSL-1.0" settings = "os", "compiler", "build_type", "arch" - exports_sources = "patches/**" - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _minimum_cpp_standard(self): @@ -31,14 +32,20 @@ def _minimum_compilers_version(self): "Visual Studio": "14", } - def configure(self): + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self) + + def validate(self): if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) + check_min_cppstd(self, self._minimum_cpp_standard) compiler = self.settings.compiler try: min_version = self._minimum_compilers_version[str(compiler)] - if tools.Version(compiler.version) < min_version: + if Version(compiler.version) < min_version: msg = ( "{} requires C++{} features which are not supported by compiler {} {}." ).format(self.name, self._minimum_cpp_standard, compiler, compiler.version) @@ -51,19 +58,16 @@ def configure(self): self.output.warn(msg) def source(self): - tools.get(**self.conan_data["sources"][self.version][0]) - extracted_dir = self.name + "-" + self.version - rename(self, extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def package(self): - include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern=os.path.join(self._source_subfolder, - "LICENSE_1_0.txt"), dst="licenses", src=self.source_folder) - self.copy(pattern="*", dst="include", src=include_folder) + copy(self, pattern="LICENSE_1_0.txt", dst=os.path.join(self.package_folder, "licenses"), + src=self.source_folder) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) def package_id(self): - self.info.header_only() + self.info.clear() diff --git a/recipes/pfr/all/test_package/CMakeLists.txt b/recipes/pfr/all/test_package/CMakeLists.txt index 596bfe0ade164..d786461ba037e 100644 --- a/recipes/pfr/all/test_package/CMakeLists.txt +++ b/recipes/pfr/all/test_package/CMakeLists.txt @@ -1,11 +1,10 @@ -cmake_minimum_required(VERSION 3.1.0) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(pfr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package_${PfrMajorVersion}.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE pfr::pfr) # PFR 1.0.4 doesn't support Visual Studio in C++14 mode, requires C++17. # Otherwise, at least C++14 is required. diff --git a/recipes/pfr/all/test_package/conanfile.py b/recipes/pfr/all/test_package/conanfile.py index c19c0fb30c8a4..55a69638597a2 100644 --- a/recipes/pfr/all/test_package/conanfile.py +++ b/recipes/pfr/all/test_package/conanfile.py @@ -1,20 +1,32 @@ -from conans import ConanFile, CMake, tools -from conans.tools import Version +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain +from conan.tools.scm import Version import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def generate(self): + ct = CMakeToolchain(self) + ct.variables["PfrMajorVersion"] = Version(self.dependencies["pfr"].ref.version).major + ct.generate() + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) - cmake.definitions["PfrMajorVersion"] = Version( - self.deps_cpp_info["pfr"].version).major cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pfr/all/test_v1_package/CMakeLists.txt b/recipes/pfr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..700251d5bc8f3 --- /dev/null +++ b/recipes/pfr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1.0) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/pfr/all/test_v1_package/conanfile.py b/recipes/pfr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c3a9c315455ca --- /dev/null +++ b/recipes/pfr/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +from conans.tools import Version +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["PfrMajorVersion"] = Version( + self.deps_cpp_info["pfr"].version).major + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/pgm-index/all/conandata.yml b/recipes/pgm-index/all/conandata.yml new file mode 100644 index 0000000000000..80ff098e39ad7 --- /dev/null +++ b/recipes/pgm-index/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20220801": + url: "https://github.com/gvinciguerra/PGM-index/archive/0d4567e7a643f8f967636b9cdc44756f6a8e7cc6.tar.gz" + sha256: "f6d44f90150087423b9e6699162c79ebe9c1e3905f208f4e773d511f9ae4e014" diff --git a/recipes/pgm-index/all/conanfile.py b/recipes/pgm-index/all/conanfile.py new file mode 100644 index 0000000000000..0169b4f5c8cc9 --- /dev/null +++ b/recipes/pgm-index/all/conanfile.py @@ -0,0 +1,70 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.50.0" + + +class PgmIndexConan(ConanFile): + name = "pgm-index" + description = ( + "State-of-the-art learned data structure that enables fast lookup, " + "predecessor, range searches and updates in arrays" + ) + license = "Apache-2.0" + topics = ("data-structure", "spatial-index", "b-tree", "compression", "database", "machine-learning") + homepage = "https://pgm.di.unipi.it" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return "17" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "5", + "apple-clang": "10", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if is_msvc(self): + # see https://github.com/gvinciguerra/PGM-index/issues/19 + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Visual Studio") + + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/pgm-index/all/test_package/CMakeLists.txt b/recipes/pgm-index/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3edd6e9dffe4c --- /dev/null +++ b/recipes/pgm-index/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(pgm-index REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE pgm-index::pgm-index) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/pgm-index/all/test_package/conanfile.py b/recipes/pgm-index/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/pgm-index/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pgm-index/all/test_package/test_package.cpp b/recipes/pgm-index/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..a1a5a55b7c88c --- /dev/null +++ b/recipes/pgm-index/all/test_package/test_package.cpp @@ -0,0 +1,27 @@ +#include + +#include +#include +#include +#include + +int main() { + // Generate some random data + std::vector data(1000000); + std::generate(data.begin(), data.end(), std::rand); + data.push_back(42); + std::sort(data.begin(), data.end()); + + // Construct the PGM-index + const int epsilon = 128; // space-time trade-off parameter + pgm::PGMIndex index(data); + + // Query the PGM-index + auto q = 42; + auto range = index.search(q); + auto lo = data.begin() + range.lo; + auto hi = data.begin() + range.hi; + std::cout << *std::lower_bound(lo, hi, q) << std::endl; + + return 0; +} diff --git a/recipes/pgm-index/all/test_v1_package/CMakeLists.txt b/recipes/pgm-index/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/pgm-index/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/pgm-index/all/test_v1_package/conanfile.py b/recipes/pgm-index/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/pgm-index/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/pgm-index/config.yml b/recipes/pgm-index/config.yml new file mode 100644 index 0000000000000..2499184dd3f4b --- /dev/null +++ b/recipes/pgm-index/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20220801": + folder: all diff --git a/recipes/physfs/all/conanfile.py b/recipes/physfs/all/conanfile.py index cf3dc0b2a76db..995258a27fa05 100644 --- a/recipes/physfs/all/conanfile.py +++ b/recipes/physfs/all/conanfile.py @@ -1,12 +1,12 @@ from conan import ConanFile from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import is_msvc import os import textwrap -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class PhysfsConan(ConanFile): @@ -16,10 +16,11 @@ class PhysfsConan(ConanFile): "archives. It is intended for use in video games." ) license = "Zlib" - topics = ("physfs", "physicsfs", "file", "filesystem", "io") + topics = ("physicsfs", "file", "filesystem", "io") homepage = "https://icculus.org/physfs" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -51,8 +52,7 @@ class PhysfsConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -60,22 +60,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -116,17 +109,17 @@ def package(self): def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) + """) save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property def _physfs_target(self): @@ -137,7 +130,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", self._physfs_target) self.cpp_info.set_property("pkg_config_name", "physfs") suffix = "-static" if is_msvc(self) and not self.options.shared else "" - self.cpp_info.libs = ["physfs{}".format(suffix)] + self.cpp_info.libs = [f"physfs{suffix}"] if self.options.shared: self.cpp_info.defines.append("PHYSFS_SHARED") else: diff --git a/recipes/physfs/all/test_package/conanfile.py b/recipes/physfs/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/physfs/all/test_package/conanfile.py +++ b/recipes/physfs/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/physfs/all/test_v1_package/CMakeLists.txt b/recipes/physfs/all/test_v1_package/CMakeLists.txt index 8d8ae306e90ae..0d20897301b68 100644 --- a/recipes/physfs/all/test_v1_package/CMakeLists.txt +++ b/recipes/physfs/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(PhysFS REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -if(TARGET physfs-static) - target_link_libraries(${PROJECT_NAME} PRIVATE physfs-static) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE physfs) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/physfs/all/test_v1_package/conanfile.py b/recipes/physfs/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/physfs/all/test_v1_package/conanfile.py +++ b/recipes/physfs/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/picobench/all/CMakeLists.txt b/recipes/picobench/all/CMakeLists.txt deleted file mode 100644 index 0a7c18edd3478..0000000000000 --- a/recipes/picobench/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper CXX) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/picobench/all/conandata.yml b/recipes/picobench/all/conandata.yml index da3763c90a6bf..8377ab1b2c676 100644 --- a/recipes/picobench/all/conandata.yml +++ b/recipes/picobench/all/conandata.yml @@ -6,4 +6,3 @@ sources: patches: "2.01": - patch_file: "patches/2.01-0001-add-install.patch" - base_path: "source_subfolder" diff --git a/recipes/picobench/all/conanfile.py b/recipes/picobench/all/conanfile.py index 6b7aa525d33b5..f71d6aab09dbb 100644 --- a/recipes/picobench/all/conanfile.py +++ b/recipes/picobench/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import CMake, ConanFile, tools -import functools +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches +from conan.tools.build import check_min_cppstd import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" + class PicobenchConan(ConanFile): name = "picobench" @@ -18,54 +21,47 @@ class PicobenchConan(ConanFile): default_options = { "with_cli": False, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PICOBENCH_BUILD_TOOLS"] = self.options.with_cli + tc.generate() + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.settings.compiler.cppstd: + check_min_cppstd(self, 11) def package_id(self): if self.options.with_cli: del self.info.settings.compiler else: - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): + apply_conandata_patches(self) cmake = CMake(self) - cmake.definitions["PICOBENCH_BUILD_TOOLS"] = self.options.with_cli cmake.configure() - return cmake - - def build(self): - self._patch_sources() - cmake = self._configure_cmake() cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.configure() cmake.install() def package_info(self): if self.options.with_cli: + # TODO: Legacy, to be removed on Conan 2.0 binpath = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH env var: {}".format(binpath)) self.env_info.PATH.append(binpath) diff --git a/recipes/picobench/all/test_package/CMakeLists.txt b/recipes/picobench/all/test_package/CMakeLists.txt index 24afec503cc8e..9a9856af9c67e 100644 --- a/recipes/picobench/all/test_package/CMakeLists.txt +++ b/recipes/picobench/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ cmake_minimum_required(VERSION 3.8) - -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(picobench REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} picobench::picobench) +target_link_libraries(${PROJECT_NAME} PRIVATE picobench::picobench) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/picobench/all/test_package/conanfile.py b/recipes/picobench/all/test_package/conanfile.py index 38f4483872d47..48499fa0989d9 100644 --- a/recipes/picobench/all/test_package/conanfile.py +++ b/recipes/picobench/all/test_package/conanfile.py @@ -1,10 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/picobench/all/test_v1_package/CMakeLists.txt b/recipes/picobench/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..426dbc1aa18df --- /dev/null +++ b/recipes/picobench/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/picobench/all/test_v1_package/conanfile.py b/recipes/picobench/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/picobench/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/picojson/all/conandata.yml b/recipes/picojson/all/conandata.yml index 8fc39d2b5d249..64e533b3e850a 100644 --- a/recipes/picojson/all/conandata.yml +++ b/recipes/picojson/all/conandata.yml @@ -1,7 +1,7 @@ sources: - "cci.20210117": - url: "https://github.com/kazuho/picojson/archive/111c9be5188f7350c2eac9ddaedd8cca3d7bf394.zip" - sha256: 9937fc918d32a2e802a32e1565f48b04850ece0389ce22e8e3acba54aee13c99 - "1.3.0": - url: "https://github.com/kazuho/picojson/archive/v1.3.0.zip" - sha256: 58fff34589d93b0cef208a456788b9de6c7d04cfa9a7be576328ca7b48f10069 + "cci.20210117": + url: "https://github.com/kazuho/picojson/archive/111c9be5188f7350c2eac9ddaedd8cca3d7bf394.zip" + sha256: "9937fc918d32a2e802a32e1565f48b04850ece0389ce22e8e3acba54aee13c99" + "1.3.0": + url: "https://github.com/kazuho/picojson/archive/v1.3.0.zip" + sha256: "58fff34589d93b0cef208a456788b9de6c7d04cfa9a7be576328ca7b48f10069" diff --git a/recipes/picojson/all/conanfile.py b/recipes/picojson/all/conanfile.py index fbc4acf3394f7..d6af3be3fb2be 100644 --- a/recipes/picojson/all/conanfile.py +++ b/recipes/picojson/all/conanfile.py @@ -1,5 +1,9 @@ -from conans import ConanFile, tools -import os, glob +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" class PicoJSONConan(ConanFile): @@ -8,18 +12,28 @@ class PicoJSONConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/kazuho/picojson" description = "A C++ JSON parser/serializer" - topics = ("picojson", "json", "header-only", "conan-recipe") + topics = ("picojson", "json", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - _source_subfolder = "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename(glob.glob("picojson-*")[0], self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("{}.h".format(self.name), dst="include", src=self._source_subfolder) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "picojson.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) def package_info(self): - self.info.header_only() + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/picojson/all/test_package/CMakeLists.txt b/recipes/picojson/all/test_package/CMakeLists.txt index e84da4689b1cb..26a59553dbe52 100644 --- a/recipes/picojson/all/test_package/CMakeLists.txt +++ b/recipes/picojson/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -find_package(picojson REQUIRED) +find_package(picojson REQUIRED CONFIG) -add_executable(example example.cpp) -set_property(TARGET example PROPERTY CXX_STANDARD 11) - -target_link_libraries(example picojson::picojson) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE picojson::picojson) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/picojson/all/test_package/conanfile.py b/recipes/picojson/all/test_package/conanfile.py index 446a5dff1281a..0a6bc68712d90 100644 --- a/recipes/picojson/all/test_package/conanfile.py +++ b/recipes/picojson/all/test_package/conanfile.py @@ -1,26 +1,26 @@ -from conans import ConanFile, CMake, tools - +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -class PicoJSONTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake_find_package" - @property - def _is_multi_configuration(self): - cmake = CMake(self) - return cmake.is_multi_configuration +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) - # Current dir is "test_package/build/" and CMakeLists.txt is - # in "test_package" cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = "example" - if self._is_multi_configuration: - bin_path = os.path.join(str(self.settings.build_type), bin_path) - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/picojson/all/test_package/example.cpp b/recipes/picojson/all/test_package/test_package.cpp similarity index 100% rename from recipes/picojson/all/test_package/example.cpp rename to recipes/picojson/all/test_package/test_package.cpp diff --git a/recipes/picojson/all/test_v1_package/CMakeLists.txt b/recipes/picojson/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..76b4af39af45d --- /dev/null +++ b/recipes/picojson/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(picojson REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE picojson::picojson) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/picojson/all/test_v1_package/conanfile.py b/recipes/picojson/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/picojson/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/picojson/config.yml b/recipes/picojson/config.yml index 8c6ed9e6ba8aa..3bca60b62a2dc 100644 --- a/recipes/picojson/config.yml +++ b/recipes/picojson/config.yml @@ -1,5 +1,5 @@ versions: - "cci.20210117": - folder: all - "1.3.0": - folder: all + "cci.20210117": + folder: all + "1.3.0": + folder: all diff --git a/recipes/picosha2/all/conandata.yml b/recipes/picosha2/all/conandata.yml new file mode 100644 index 0000000000000..22dc3aff4c7d2 --- /dev/null +++ b/recipes/picosha2/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "cci.20220808": + url: "https://github.com/okdshin/PicoSHA2/archive/27fcf6979298949e8a462e16d09a0351c18fcaf2.tar.gz" + sha256: "18d82bb79c021ccf4ce58125b64691accef54237ba5194462740bacf8b39d8a9" + "1.0.0": + url: "https://github.com/okdshin/PicoSHA2/archive/refs/tags/v1.0.0.tar.gz" + sha256: "dec99b43440157847cf5dadfad060b9154749523da28eb1599872f87d1ea8e4b" diff --git a/recipes/picosha2/all/conanfile.py b/recipes/picosha2/all/conanfile.py new file mode 100644 index 0000000000000..dbbe31f41d82d --- /dev/null +++ b/recipes/picosha2/all/conanfile.py @@ -0,0 +1,59 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, load, save +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class PicoSHA2Conan(ConanFile): + name = "picosha2" + description = "a header-file-only, SHA256 hash generator in C++ " + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/okdshin/PicoSHA2" + topics = ("sha256", "hash", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 11 + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + if Version(self.version) == "1.0.0": + filename = os.path.join(self.source_folder, self.source_folder, "picosha2.h") + file_content = load(save, filename) + license_start = "/*" + license_end = "*/" + license_contents = file_content[file_content.find(license_start)+len(license_start):file_content.find(license_end)] + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + else: + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/picosha2/all/test_package/CMakeLists.txt b/recipes/picosha2/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..9a40eed23da8b --- /dev/null +++ b/recipes/picosha2/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(picosha2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE picosha2::picosha2) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/picosha2/all/test_package/conanfile.py b/recipes/picosha2/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/picosha2/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/picosha2/all/test_package/test_package.cpp b/recipes/picosha2/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..8c12c7c779d20 --- /dev/null +++ b/recipes/picosha2/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include +#include "picosha2.h" + +void CalcAndOutput(const std::string& src){ + std::cout << "src : \"" << src << "\"\n"; + std::cout << "hash: " << picosha2::hash256_hex_string(src) << "\n" << std::endl; +} + +int main(int argc, char* argv[]) +{ + CalcAndOutput(""); + + return 0; +} diff --git a/recipes/picosha2/all/test_v1_package/CMakeLists.txt b/recipes/picosha2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..145dcc03e0f3d --- /dev/null +++ b/recipes/picosha2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/picosha2/all/test_v1_package/conanfile.py b/recipes/picosha2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/picosha2/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/picosha2/config.yml b/recipes/picosha2/config.yml new file mode 100644 index 0000000000000..ce51ba5c3a9f5 --- /dev/null +++ b/recipes/picosha2/config.yml @@ -0,0 +1,5 @@ +versions: + "cci.20220808": + folder: all + "1.0.0": + folder: all diff --git a/recipes/pistache/all/CMakeLists.txt b/recipes/pistache/all/CMakeLists.txt deleted file mode 100644 index 8fbc72a2683e3..0000000000000 --- a/recipes/pistache/all/CMakeLists.txt +++ /dev/null @@ -1,8 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup() - - -add_subdirectory(source_subfolder) diff --git a/recipes/pistache/all/conandata.yml b/recipes/pistache/all/conandata.yml index d454d35200e30..4badc3fded984 100644 --- a/recipes/pistache/all/conandata.yml +++ b/recipes/pistache/all/conandata.yml @@ -1,10 +1,15 @@ sources: + "0.0.5": + url: "https://github.com/pistacheio/pistache/archive/refs/tags/0.0.5.tar.gz" + sha256: "e2da87ebc01367e33bd8d7800cb2bf5c23e9fb4e6f49dce2cab5f8756df8dca0" "cci.20201127": - url: https://github.com/pistacheio/pistache/archive/a3c5c68e0f08e19331d53d12846079ad761fe974.tar.gz - sha256: f1abb9e43ff847ebff8edb72623c9942162df134bccfb571af9c7817d3261fae + url: "https://github.com/pistacheio/pistache/archive/a3c5c68e0f08e19331d53d12846079ad761fe974.tar.gz" + sha256: "f1abb9e43ff847ebff8edb72623c9942162df134bccfb571af9c7817d3261fae" patches: "cci.20201127": - patch_file: "patches/0001-remove-fpic.patch" - base_path: "source_subfolder" + patch_description: "disable fPIC" + patch_type: "conan" - patch_file: "patches/0002-include-stddef.patch" - base_path: "source_subfolder" + patch_description: "include " + patch_type: "portability" diff --git a/recipes/pistache/all/conanfile.py b/recipes/pistache/all/conanfile.py index 9152b1d421a18..f80811935c92f 100644 --- a/recipes/pistache/all/conanfile.py +++ b/recipes/pistache/all/conanfile.py @@ -1,9 +1,18 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file, collect_libs +from conan.tools.build import check_min_cppstd +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.layout import basic_layout +from conan.tools.gnu import PkgConfigDeps -required_conan_version = ">=1.33.0" +import os +required_conan_version = ">=1.53.0" class PistacheConan(ConanFile): name = "pistache" @@ -25,30 +34,29 @@ class PistacheConan(ConanFile): "with_ssl": False, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + if self.version == "cci.20201127": + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def requirements(self): - self.requires("rapidjson/1.1.0") + self.requires("rapidjson/cci.20220822") if self.options.with_ssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") + if self.version != "cci.20201127": + self.requires("date/3.0.1") def validate(self): compilers = { @@ -56,63 +64,106 @@ def validate(self): "clang": "6", } if self.settings.os != "Linux": - raise ConanInvalidConfiguration("Pistache is only support by Linux.") + raise ConanInvalidConfiguration(f"{self.ref} is only support on Linux.") if self.settings.compiler == "clang": raise ConanInvalidConfiguration("Clang support is broken. See pistacheio/pistache#835.") if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 17) + check_min_cppstd(self, 17) minimum_compiler = compilers.get(str(self.settings.compiler)) if minimum_compiler: - if tools.Version(self.settings.compiler.version) < minimum_compiler: - raise ConanInvalidConfiguration("Pistache requires c++17, which your compiler does not support.") + if Version(self.settings.compiler.version) < minimum_compiler: + raise ConanInvalidConfiguration(f"{self.ref} requires c++17, which your compiler does not support.") else: - self.output.warn("Pistache requires c++17, but this compiler is unknown to this recipe. Assuming your compiler supports c++17.") + self.output.warn(f"{self.ref} requires c++17, but this compiler is unknown to this recipe. Assuming your compiler supports c++17.") + + def build_requirements(self): + if self.version != "cci.20201127": + self.tool_requires("meson/1.0.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["PISTACHE_ENABLE_NETWORK_TESTS"] = False - self._cmake.definitions["PISTACHE_USE_SSL"] = self.options.with_ssl - # pistache requires explicit value for fPIC - self._cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if self.version == "cci.20201127": + tc = CMakeToolchain(self) + tc.variables["PISTACHE_ENABLE_NETWORK_TESTS"] = False + tc.variables["PISTACHE_USE_SSL"] = self.options.with_ssl + # pistache requires explicit value for fPIC + tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) + tc.generate() + + tc = CMakeDeps(self) + tc.generate() + else: + tc = MesonToolchain(self) + tc.project_options["PISTACHE_USE_SSL"] = self.options.with_ssl + tc.project_options["PISTACHE_BUILD_EXAMPLES"] = False + tc.project_options["PISTACHE_BUILD_TESTS"] = False + tc.project_options["PISTACHE_BUILD_DOCS"] = False + tc.generate() + + tc = PkgConfigDeps(self) + tc.generate() + + env = VirtualBuildEnv(self) + env.generate(scope="build") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() - cmake.build() + apply_conandata_patches(self) + if self.version != "cci.20201127": + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), + "dependency('RapidJSON', fallback: ['rapidjson', 'rapidjson_dep']),", + "dependency('rapidjson', fallback: ['rapidjson', 'rapidjson_dep']),") + + if self.version == "cci.20201127": + cmake = CMake(self) + cmake.configure() + cmake.build() + else: + meson = Meson(self) + meson.configure() + meson.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() - cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + if self.version == "cci.20201127": + cmake = CMake(self) + cmake.install() + else: + meson = Meson(self) + meson.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.a") + rm(self, "*.a", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): # TODO: Pistache does not use namespace # TODO: Pistache variables are CamelCase e.g Pistache_BUILD_DIRS - self.cpp_info.filenames["cmake_find_package"] = "Pistache" - self.cpp_info.filenames["cmake_find_package_multi"] = "Pistache" - self.cpp_info.names["pkg_config"] = "libpistache" - suffix = "_{}".format("shared" if self.options.shared else "static") - self.cpp_info.components["libpistache"].names["cmake_find_package"] = "pistache" + suffix - self.cpp_info.components["libpistache"].names["cmake_find_package_multi"] = "pistache" + suffix - self.cpp_info.components["libpistache"].libs = tools.collect_libs(self) + self.cpp_info.set_property("cmake_file_name", "Pistache") + self.cpp_info.set_property("cmake_target_name", "Pistache::Pistache") + # if package provides a pkgconfig file (package.pc, usually installed in /lib/pkgconfig/) + self.cpp_info.set_property("pkg_config_name", "libpistache") + + self.cpp_info.components["libpistache"].libs = collect_libs(self) self.cpp_info.components["libpistache"].requires = ["rapidjson::rapidjson"] if self.options.with_ssl: self.cpp_info.components["libpistache"].requires.append("openssl::openssl") self.cpp_info.components["libpistache"].defines = ["PISTACHE_USE_SSL=1"] if self.settings.os == "Linux": self.cpp_info.components["libpistache"].system_libs = ["pthread"] + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "Pistache" + self.cpp_info.filenames["cmake_find_package_multi"] = "Pistache" + self.cpp_info.names["cmake_find_package"] = "Pistache" + self.cpp_info.names["cmake_find_package_multi"] = "Pistache" + self.cpp_info.names["pkg_config"] = "libpistache" + suffix = "_{}".format("shared" if self.options.shared else "static") + self.cpp_info.components["libpistache"].names["cmake_find_package"] = "pistache" + suffix + self.cpp_info.components["libpistache"].names["cmake_find_package_multi"] = "pistache" + suffix diff --git a/recipes/pistache/all/test_package/CMakeLists.txt b/recipes/pistache/all/test_package/CMakeLists.txt index bf65e85023c4f..879baa5c03bf1 100644 --- a/recipes/pistache/all/test_package/CMakeLists.txt +++ b/recipes/pistache/all/test_package/CMakeLists.txt @@ -1,11 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Pistache REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} pistache::pistache) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} Pistache::Pistache) +if(Pistache_VERSION EQUAL "cci.20201127") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/pistache/all/test_package/conanfile.py b/recipes/pistache/all/test_package/conanfile.py index 38f4483872d47..a9fbb7f543162 100644 --- a/recipes/pistache/all/test_package/conanfile.py +++ b/recipes/pistache/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pistache/all/test_package/test_package.cpp b/recipes/pistache/all/test_package/test_package.cpp index 9b8304785e543..f29b0d71a6edb 100644 --- a/recipes/pistache/all/test_package/test_package.cpp +++ b/recipes/pistache/all/test_package/test_package.cpp @@ -8,7 +8,6 @@ class HelloHandler : public Http::Handler { HTTP_PROTOTYPE(HelloHandler) void onRequest(const Http::Request& request, Http::ResponseWriter response) override{ - UNUSED(request); response.send(Pistache::Http::Code::Ok, "Hello World\n"); } }; diff --git a/recipes/pistache/all/test_v1_package/CMakeLists.txt b/recipes/pistache/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/pistache/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/pistache/all/test_v1_package/conanfile.py b/recipes/pistache/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/pistache/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/pistache/config.yml b/recipes/pistache/config.yml index 594dd65b1589f..7515a206bd537 100644 --- a/recipes/pistache/config.yml +++ b/recipes/pistache/config.yml @@ -1,3 +1,5 @@ versions: + "0.0.5": + folder: all "cci.20201127": folder: all diff --git a/recipes/pixman/all/conandata.yml b/recipes/pixman/all/conandata.yml index a4b924188fcf5..1f4279689a6c3 100644 --- a/recipes/pixman/all/conandata.yml +++ b/recipes/pixman/all/conandata.yml @@ -1,7 +1,18 @@ -"sources": +sources: "0.40.0": - "url": "https://www.cairographics.org/releases/pixman-0.40.0.tar.gz" - "sha256": "6d200dec3740d9ec4ec8d1180e25779c00bc749f94278c8b9021f5534db223fc" + url: "https://www.cairographics.org/releases/pixman-0.40.0.tar.gz" + sha256: "6d200dec3740d9ec4ec8d1180e25779c00bc749f94278c8b9021f5534db223fc" "0.38.4": - "url": "https://www.cairographics.org/releases/pixman-0.38.4.tar.gz" - "sha256": "da66d6fd6e40aee70f7bd02e4f8f76fc3f006ec879d346bae6a723025cfbdde7" + url: "https://www.cairographics.org/releases/pixman-0.38.4.tar.gz" + sha256: "da66d6fd6e40aee70f7bd02e4f8f76fc3f006ec879d346bae6a723025cfbdde7" +patches: + "0.40.0": + - patch_file: "patches/0001-incompatible-pointer-types.patch" + patch_description: "backport fix for clang build" + patch_type: "portability" + patch_source: "https://gitlab.freedesktop.org/pixman/pixman/-/merge_requests/48" + "0.38.4": + - patch_file: "patches/0002-meson-build.patch" + patch_description: "backport meson build files from 0.40.0 to fix windows build" + patch_type: "portability" + patch_source: "https://gitlab.freedesktop.org/pixman/pixman/-/tree/pixman-0.40.0" diff --git a/recipes/pixman/all/conanfile.py b/recipes/pixman/all/conanfile.py index ce1294aecf05b..94146c6c721b7 100644 --- a/recipes/pixman/all/conanfile.py +++ b/recipes/pixman/all/conanfile.py @@ -1,17 +1,28 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import ( + apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, + rename, replace_in_file, rm, rmdir +) +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc + +required_conan_version = ">=1.53.0" class PixmanConan(ConanFile): name = "pixman" description = "Pixman is a low-level software library for pixel manipulation" - topics = ("pixman", "graphics", "compositing", "rasterization") + topics = ("graphics", "compositing", "rasterization") url = "https://github.com/conan-io/conan-center-index" homepage = "https://cairographics.org/" license = ("LGPL-2.1-only", "MPL-1.1") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,19 +33,8 @@ class PixmanConan(ConanFile): "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - - @property - def _includedir(self): - return os.path.join("include", "pixman-1") + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -42,84 +42,59 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + def layout(self): + basic_layout(self, src_folder="src") def validate(self): if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("pixman can only be built as a static library on Windows") + def build_requirements(self): + self.tool_requires("meson/1.0.0") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) + tc.project_options.update({ + "libpng": "disabled", + "gtk": "disabled" + }) + tc.generate() def _patch_sources(self): - if self.settings.compiler == "Visual Studio": - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.win32.common"), - "-MDd ", "-{} ".format(str(self.settings.compiler.runtime))) - tools.replace_in_file(os.path.join(self._source_subfolder, "Makefile.win32.common"), - "-MD ", "-{} ".format(str(self.settings.compiler.runtime))) - if tools.is_apple_os(self.settings.os): - # https://lists.freedesktop.org/archives/pixman/2014-November/003461.html - test_makefile = os.path.join(self._source_subfolder, "test", "Makefile.in") - tools.replace_in_file(test_makefile, - "region_test_OBJECTS = region-test.$(OBJEXT)", - "region_test_OBJECTS = region-test.$(OBJEXT) utils.$(OBJEXT)") - tools.replace_in_file(test_makefile, - "scaling_helpers_test_OBJECTS = scaling-helpers-test.$(OBJEXT)", - "scaling_helpers_test_OBJECTS = scaling-helpers-test.$(OBJEXT) utils.$(OBJEXT)") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--disable-libpng", - "--disable-gtk", - ] - self._autotools.configure(configure_dir=self._source_subfolder, args=args) - return self._autotools + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('test')", "") + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('demos')", "") def build(self): self._patch_sources() - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - make_vars = { - "MMX": "on" if self.settings.arch == "x86" else "off", - "SSE2": "on", - "SSSE3": "on", - "CFG": str(self.settings.build_type).lower(), - } - var_args = " ".join("{}={}".format(k, v) for k, v in make_vars.items()) - self.run("make -C {}/pixman -f Makefile.win32 {}".format(self._source_subfolder, var_args), - win_bash=True) - else: - autotools = self._configure_autotools() - autotools.make(target="pixman") + meson = Meson(self) + meson.configure() + meson.build() def package(self): - self.copy(os.path.join(self._source_subfolder, "COPYING"), dst="licenses") - if self.settings.compiler == "Visual Studio": - self.copy(pattern="*.lib", dst="lib", keep_path=False) - self.copy(pattern="*{}pixman.h".format(os.sep), dst=self._includedir, keep_path=False) - self.copy(pattern="*{}pixman-version.h".format(os.sep), dst=self._includedir, keep_path=False) - else: - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + meson = Meson(self) + meson.install() + lib_folder = os.path.join(self.package_folder, "lib") + rmdir(self, os.path.join(lib_folder, "pkgconfig")) + rm(self, "*.la", lib_folder) + fix_apple_shared_install_name(self) + if is_msvc(self): + prefix = "libpixman-1" + rename(self, os.path.join(lib_folder, f"{prefix}.a"), os.path.join(lib_folder, f"{prefix}.lib")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - self.cpp_info.includedirs.append(self._includedir) - self.cpp_info.names["pkg_config"] = "pixman-1" + self.cpp_info.libs = collect_libs(self) + self.cpp_info.includedirs.append(os.path.join("include", "pixman-1")) + self.cpp_info.set_property("pkg_config_name", "pixman-1") if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["pthread", "m"] diff --git a/recipes/pixman/all/patches/0001-incompatible-pointer-types.patch b/recipes/pixman/all/patches/0001-incompatible-pointer-types.patch new file mode 100644 index 0000000000000..ee95a8b091433 --- /dev/null +++ b/recipes/pixman/all/patches/0001-incompatible-pointer-types.patch @@ -0,0 +1,21 @@ +diff --git a/pixman/pixman-bits-image.c b/pixman/pixman-bits-image.c +index 4cfabe3..3832e2b 100644 +--- a/pixman/pixman-bits-image.c ++++ b/pixman/pixman-bits-image.c +@@ -1051,14 +1051,14 @@ dest_write_back_narrow (pixman_iter_t *iter) + iter->y++; + } + +-static const float ++static float + dither_factor_blue_noise_64 (int x, int y) + { + float m = dither_blue_noise_64x64[((y & 0x3f) << 6) | (x & 0x3f)]; + return m * (1. / 4096.f) + (1. / 8192.f); + } + +-static const float ++static float + dither_factor_bayer_8 (int x, int y) + { + uint32_t m; diff --git a/recipes/pixman/all/patches/0002-meson-build.patch b/recipes/pixman/all/patches/0002-meson-build.patch new file mode 100644 index 0000000000000..6063b377301a8 --- /dev/null +++ b/recipes/pixman/all/patches/0002-meson-build.patch @@ -0,0 +1,253 @@ +diff --git a/meson.build b/meson.build +index fad22ee..519441b 100644 +--- a/meson.build ++++ b/meson.build +@@ -23,7 +23,7 @@ project( + ['c'], + version : '0.38.4', + license : 'MIT', +- meson_version : '>= 0.47.2', ++ meson_version : '>= 0.50.0', + default_options : ['buildtype=debugoptimized'], + ) + +@@ -36,6 +36,7 @@ add_project_arguments( + '-Wdeclaration-after-statement', + '-fno-strict-aliasing', + '-fvisibility=hidden', ++ '-Wundef', + ]), + language : ['c'] + ) +@@ -50,7 +51,7 @@ endforeach + + use_loongson_mmi = get_option('loongson-mmi') + have_loongson_mmi = false +-loongson_mmi_flags = ['-march=loongson2f'] ++loongson_mmi_flags = ['-mloongson-mmi'] + if not use_loongson_mmi.disabled() + if host_machine.cpu_family() == 'mips64' and cc.compiles(''' + #ifndef __mips_loongson_vector_rev +@@ -84,9 +85,17 @@ endif + + use_mmx = get_option('mmx') + have_mmx = false +-mmx_flags = ['-mmmx', '-Winline'] ++mmx_flags = [] ++ ++if cc.get_id() == 'msvc' ++ mmx_flags = ['/w14710', '/w14714', '/wd4244'] ++elif cc.get_id() == 'sun' ++ mmx_flags = ['-xarch=sse'] ++else ++ mmx_flags = ['-mmmx', '-Winline'] ++endif + if not use_mmx.disabled() +- if host_machine.cpu_family() == 'x86_64' ++ if host_machine.cpu_family() == 'x86_64' or cc.get_id() == 'msvc' + have_mmx = true + elif host_machine.cpu_family() == 'x86' and cc.compiles(''' + #include +@@ -127,14 +136,23 @@ if not use_mmx.disabled() + endif + + if have_mmx +- config.set10('USE_X86_MMX', true) ++ # Inline assembly do not work on X64 MSVC, so we use ++ # compatibility intrinsics there ++ if cc.get_id() != 'msvc' or host_machine.cpu_family() != 'x86_64' ++ config.set10('USE_X86_MMX', true) ++ endif + elif use_mmx.enabled() + error('MMX Support unavailable, but required') + endif + + use_sse2 = get_option('sse2') + have_sse2 = false +-sse2_flags = ['-msse2', '-Winline'] ++sse2_flags = [] ++if cc.get_id() == 'sun' ++ sse2_flags = ['-xarch=sse2'] ++elif cc.get_id() != 'msvc' ++ sse2_flags = ['-msse2', '-Winline'] ++endif + if not use_sse2.disabled() + if host_machine.cpu_family() == 'x86' + if cc.compiles(''' +@@ -169,8 +187,13 @@ endif + + use_ssse3 = get_option('ssse3') + have_ssse3 = false +-ssse3_flags =['-mssse3', '-Winline'] +-if not use_ssse3.disabled() ++ssse3_flags = [] ++if cc.get_id() != 'msvc' ++ ssse3_flags = ['-mssse3', '-Winline'] ++endif ++ ++# x64 pre-2010 MSVC compilers crashes when building the ssse3 code ++if not use_ssse3.disabled() and not (cc.get_id() == 'msvc' and cc.version().version_compare('<16') and host_machine.cpu_family() == 'x86_64') + if host_machine.cpu_family().startswith('x86') + if cc.compiles(''' + #include +@@ -349,14 +372,21 @@ if get_option('gnuplot') + config.set('PIXMAN_GNUPLOT', 1) + endif + +-dep_openmp = dependency('openmp', required : get_option('openmp')) +-if dep_openmp.found() +- config.set10('USE_OPENMP', true) +-elif meson.version().version_compare('<0.51.0') +-# In versions of meson before 0.51 the openmp dependency can still +-# inject arguments in the the auto case when it is not found, the +-# detection does work correctly in that case however, so we just +-# replace dep_openmp with null_dep to work around this. ++if cc.get_id() != 'msvc' ++ dep_openmp = dependency('openmp', required : get_option('openmp')) ++ if dep_openmp.found() ++ config.set10('USE_OPENMP', true) ++ elif meson.version().version_compare('<0.51.0') ++ # In versions of meson before 0.51 the openmp dependency can still ++ # inject arguments in the the auto case when it is not found, the ++ # detection does work correctly in that case however, so we just ++ # replace dep_openmp with null_dep to work around this. ++ dep_openmp = null_dep ++ endif ++else ++ # the MSVC implementation of openmp is not compliant enough for our ++ # uses here, so we disable it here. ++ # Please see: https://stackoverflow.com/questions/12560243/using-threadprivate-directive-in-visual-studio + dep_openmp = null_dep + endif + +@@ -364,17 +394,56 @@ dep_gtk = dependency('gtk+-2.0', version : '>= 2.16', required : get_option('gtk + dep_glib = dependency('glib-2.0', required : get_option('gtk')) + dep_pixman = dependency('pixman-1', required : get_option('gtk'), + version : '>= ' + meson.project_version()) +-dep_png = dependency('libpng', required : get_option('libpng')) ++ ++dep_png = null_dep ++if not get_option('libpng').disabled() ++ dep_png = dependency('libpng', required : false) ++ ++ # We need to look for the right library to link to for libpng, ++ # when looking for libpng manually ++ foreach png_ver : [ '16', '15', '14', '13', '12', '10' ] ++ if not dep_png.found() ++ dep_png = cc.find_library('libpng@0@'.format(png_ver), has_headers : ['png.h'], required : false) ++ endif ++ endforeach ++ ++ if get_option('libpng').enabled() and not dep_png.found() ++ error('libpng support requested but libpng library not found') ++ endif ++endif ++ + if dep_png.found() + config.set('HAVE_LIBPNG', 1) + endif + dep_m = cc.find_library('m', required : false) + dep_threads = dependency('threads') +-if dep_threads.found() ++ ++# MSVC-style compilers do not come with pthreads, so we must link ++# to it explicitly, currently pthreads-win32 is supported ++pthreads_found = false ++ ++if dep_threads.found() and cc.has_header('pthread.h') ++ if cc.get_argument_syntax() == 'msvc' ++ pthread_lib = null_dep ++ foreach pthread_type : ['VC3', 'VSE3', 'VCE3', 'VC2', 'VSE2', 'VCE2'] ++ if not pthread_lib.found() ++ pthread_lib = cc.find_library('pthread@0@'.format(pthread_type), required : false) ++ endif ++ endforeach ++ if pthread_lib.found() ++ pthreads_found = true ++ dep_threads = pthread_lib ++ endif ++ else ++ pthreads_found = true ++ endif ++endif ++ ++if pthreads_found + config.set('HAVE_PTHREADS', 1) + endif + +-funcs = ['sigaction', 'alarm', 'mprotect', 'getpagesize', 'mmap'] ++funcs = ['sigaction', 'alarm', 'mprotect', 'getpagesize', 'mmap', 'getisax', 'gettimeofday'] + # mingw claimes to have posix_memalign, but it doesn't + if host_machine.system() != 'windows' + funcs += 'posix_memalign' +@@ -386,10 +455,6 @@ foreach f : funcs + endif + endforeach + +-if cc.has_function('gettimeofday') +- config.set('HAVE_GETTIMEOFDAY', 1) +-endif +- + # This is only used in one test, that defines _GNU_SOURCE + if cc.has_function('feenableexcept', + prefix : '#define _GNU_SOURCE\n#include ', +@@ -407,8 +472,12 @@ foreach h : ['sys/mman.h', 'fenv.h', 'unistd.h'] + endif + endforeach + ++# gcc on Windows only warns that __declspec(thread) isn't supported, ++# passing -Werror=attributes makes it fail. + if (host_machine.system() == 'windows' and +- cc.compiles('int __declspec(thread) foo;', name : 'TLS via __declspec(thread)')) ++ cc.compiles('int __declspec(thread) foo;', ++ args : cc.get_supported_arguments(['-Werror=attributes']), ++ name : 'TLS via __declspec(thread)')) + config.set('TLS', '__declspec(thread)') + elif cc.compiles('int __thread foo;', name : 'TLS via __thread') + config.set('TLS', '__thread') +@@ -445,6 +514,8 @@ if host_machine.endian() == 'big' + config.set('WORDS_BIGENDIAN', 1) + endif + ++config.set('SIZEOF_LONG', cc.sizeof('long')) ++ + # Required to make pixman-private.h + config.set('PACKAGE', 'foo') + +diff --git a/pixman/meson.build b/pixman/meson.build +index 6ce87e7..f48357f 100644 +--- a/pixman/meson.build ++++ b/pixman/meson.build +@@ -30,6 +30,11 @@ version_h = configure_file( + install_dir : join_paths(get_option('prefix'), get_option('includedir'), 'pixman-1') + ) + ++libpixman_extra_cargs = [] ++if cc.has_function_attribute('dllexport') ++ libpixman_extra_cargs = ['-DPIXMAN_API=__declspec(dllexport)'] ++endif ++ + pixman_simd_libs = [] + simds = [ + # the mmx library can be compiled with mmx on x86/x86_64, iwmmxt on +@@ -97,10 +102,18 @@ pixman_files = files( + 'pixman-utils.c', + ) + +-libpixman = shared_library( ++# We cannot use 'link_with' or 'link_whole' because meson wont do the right ++# thing for static archives. ++_obs = [] ++foreach l : pixman_simd_libs ++ _obs += l.extract_all_objects() ++endforeach ++ ++libpixman = library( + 'pixman-1', + [pixman_files, config_h, version_h], +- link_with : [pixman_simd_libs], ++ objects : _obs, ++ c_args : libpixman_extra_cargs, + dependencies : [dep_m, dep_threads], + version : meson.project_version(), + install : true, diff --git a/recipes/pixman/all/test_package/CMakeLists.txt b/recipes/pixman/all/test_package/CMakeLists.txt index 7b9b613cbb24a..f938457c94703 100644 --- a/recipes/pixman/all/test_package/CMakeLists.txt +++ b/recipes/pixman/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(pixman CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE pixman::pixman) diff --git a/recipes/pixman/all/test_package/conanfile.py b/recipes/pixman/all/test_package/conanfile.py index d4128b0450777..e2fd2bc866104 100644 --- a/recipes/pixman/all/test_package/conanfile.py +++ b/recipes/pixman/all/test_package/conanfile.py @@ -1,10 +1,20 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pixman/all/test_v1_package/CMakeLists.txt b/recipes/pixman/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/pixman/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/pixman/all/test_v1_package/conanfile.py b/recipes/pixman/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/pixman/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/pixman/config.yml b/recipes/pixman/config.yml index 055ba303907d4..b237af91644c9 100644 --- a/recipes/pixman/config.yml +++ b/recipes/pixman/config.yml @@ -1,5 +1,5 @@ -"versions": +versions: "0.40.0": - "folder": "all" + folder: "all" "0.38.4": - "folder": "all" + folder: "all" diff --git a/recipes/pkgconf/all/conandata.yml b/recipes/pkgconf/all/conandata.yml index 6d3e3854ac1ed..e18df3ec61ad1 100644 --- a/recipes/pkgconf/all/conandata.yml +++ b/recipes/pkgconf/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.9.3": + url: "https://distfiles.dereferenced.org/pkgconf/pkgconf-1.9.3.tar.xz" + sha256: "5fb355b487d54fb6d341e4f18d4e2f7e813a6622cf03a9e87affa6a40565699d" "1.7.4": url: "https://distfiles.dereferenced.org/pkgconf/pkgconf-1.7.4.tar.xz" sha256: "d73f32c248a4591139a6b17777c80d4deab6b414ec2b3d21d0a24be348c476ab" @@ -6,19 +9,14 @@ sources: url: "https://distfiles.dereferenced.org/pkgconf/pkgconf-1.7.3.tar.xz" sha256: "b846aea51cf696c3392a0ae58bef93e2e72f8e7073ca6ad1ed8b01c85871f9c0" patches: + "1.9.3": + - patch_file: "patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch" "1.7.4": - patch_file: "patches/1.7.4-0001-clang-12-strndup-not-in-string-h.patch" - base_path: "source_subfolder" - patch_file: "patches/1.7.4-0002-fix-static-link.patch" - base_path: "source_subfolder" - patch_file: "patches/1.7.4-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch" - base_path: "source_subfolder" "1.7.3": - patch_file: "patches/1.7.3-0001-meson-use-declare-dependencies.patch" - base_path: "source_subfolder" - patch_file: "patches/1.7.3-0002-clang-12-strndup-not-in-string-h.patch" - base_path: "source_subfolder" - patch_file: "patches/1.7.3-0003-meson-use-library.patch" - base_path: "source_subfolder" - patch_file: "patches/1.7.3-0004-PKG_CONF_PATH-allow-colon+semicolon-separator.patch" - base_path: "source_subfolder" diff --git a/recipes/pkgconf/all/conanfile.py b/recipes/pkgconf/all/conanfile.py index 1f673458b8918..33928609ef2e5 100644 --- a/recipes/pkgconf/all/conanfile.py +++ b/recipes/pkgconf/all/conanfile.py @@ -1,19 +1,25 @@ -from conans import ConanFile, Meson, tools -from conans.errors import ConanInvalidConfiguration -import functools import os -required_conan_version = ">= 1.36.0" +from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, rm, rmdir, replace_in_file +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.microsoft import is_msvc, unix_path_package_info_legacy +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + + +required_conan_version = ">=1.57.0" class PkgConfConan(ConanFile): name = "pkgconf" url = "https://github.com/conan-io/conan-center-index" + topics = ("build", "configuration") homepage = "https://git.sr.ht/~kaniini/pkgconf" - topics = ("pkgconf") license = "ISC" description = "package compiler and linker metadata toolkit" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,26 +32,11 @@ class PkgConfConan(ConanFile): "enable_lib": False, } - @property - def _is_clang_cl(self): - return self.settings.compiler == "clang" and self.settings.os == "Windows" - - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + def layout(self): + basic_layout(self, src_folder="src") def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,84 +44,78 @@ def config_options(self): def configure(self): if not self.options.enable_lib: - del self.options.fPIC - del self.options.shared + self.options.rm_safe("fPIC") + self.options.rm_safe("shared") elif self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - - def validate(self): - if hasattr(self, "settings_build") and tools.cross_building(self): - raise ConanInvalidConfiguration("Cross-building is not implemented in the recipe") + self.options.rm_safe("fPIC") + + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def build_requirements(self): - self.build_requires("meson/0.62.1") + self.tool_requires("meson/1.0.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - @property - def _sharedstatedir(self): - return os.path.join(self.package_folder, "bin", "share") - - @functools.lru_cache(1) - def _configure_meson(self): - meson = Meson(self) - meson.options["tests"] = False - meson.options["sharedstatedir"] = self._sharedstatedir - if not self.options.enable_lib: - meson.options["default_library"] = "static" - meson.configure(source_folder=self._source_subfolder, build_folder=self._build_subfolder) - return meson + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) + if not self.options.get_safe("shared", False): - tools.replace_in_file(os.path.join(self._source_subfolder, "meson.build"), + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "'-DLIBPKGCONF_EXPORT'", "'-DPKGCONFIG_IS_STATIC'") - tools.replace_in_file(os.path.join(self._source_subfolder, "meson.build"), + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "project('pkgconf', 'c',", "project('pkgconf', 'c',\ndefault_options : ['c_std=gnu99'],") + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = MesonToolchain(self) + tc.project_options["tests"] = False + if not self.options.enable_lib: + tc.project_options["default_library"] = "static" + tc.generate() + def build(self): self._patch_sources() - with tools.vcvars(self) if self._is_clang_cl else tools.no_op(): - meson = self._configure_meson() - meson.build() + meson = Meson(self) + meson.configure() + meson.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - with tools.vcvars(self) if self._is_clang_cl else tools.no_op(): - meson = self._configure_meson() - meson.install() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder,"licenses")) + + meson = Meson(self) + meson.install() - if self._is_msvc: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + if is_msvc(self): + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) if self.options.enable_lib and not self.options.shared: - os.rename(os.path.join(self.package_folder, "lib", "libpkgconf.a"), + rename(self, os.path.join(self.package_folder, "lib", "libpkgconf.a"), os.path.join(self.package_folder, "lib", "pkgconf.lib"),) if not self.options.enable_lib: - tools.rmdir(os.path.join(self.package_folder, "lib")) - tools.rmdir(os.path.join(self.package_folder, "include")) + rmdir(self, os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "include")) - tools.rmdir(os.path.join(self.package_folder, "share", "man")) - os.rename(os.path.join(self.package_folder, "share", "aclocal"), + + rmdir(self, os.path.join(self.package_folder, "share", "man")) + rename(self, os.path.join(self.package_folder, "share", "aclocal"), os.path.join(self.package_folder, "bin", "aclocal")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_id(self): - if not self.options.enable_lib: + if not self.info.options.enable_lib: del self.info.settings.compiler def package_info(self): if self.options.enable_lib: self.cpp_info.set_property("pkg_config_name", "libpkgconf") - if tools.Version(self.version) >= "1.7.4": + if Version(self.version) >= "1.7.4": self.cpp_info.includedirs.append(os.path.join("include", "pkgconf")) self.cpp_info.libs = ["pkgconf"] if not self.options.shared: @@ -147,12 +132,17 @@ def package_info(self): pkg_config = os.path.join(bindir, "pkgconf" + exesuffix).replace("\\", "/") self.output.info("Setting PKG_CONFIG env var: {}".format(pkg_config)) self.buildenv_info.define_path("PKG_CONFIG", pkg_config) - self.env_info.PKG_CONFIG = pkg_config # remove in conan v2? - automake_extra_includes = tools.unix_path(os.path.join(self.package_folder , "bin", "aclocal").replace("\\", "/")) + pkgconf_aclocal = os.path.join(self.package_folder, "bin", "aclocal") + self.buildenv_info.prepend_path("ACLOCAL_PATH", pkgconf_aclocal) + # TODO: evaluate if `ACLOCAL_PATH` is enough and we can stop using `AUTOMAKE_CONAN_INCLUDES` + self.buildenv_info.prepend_path("AUTOMAKE_CONAN_INCLUDES", pkgconf_aclocal) + + # TODO: remove in conanv2 + automake_extra_includes = unix_path_package_info_legacy(self, pkgconf_aclocal.replace("\\", "/")) self.output.info("Appending AUTOMAKE_CONAN_INCLUDES env var: {}".format(automake_extra_includes)) - self.buildenv_info.prepend_path("AUTOMAKE_CONAN_INCLUDES", automake_extra_includes) - self.env_info.AUTOMAKE_CONAN_INCLUDES.append(automake_extra_includes) # remove in conan v2? + self.env_info.PKG_CONFIG = pkg_config + self.env_info.AUTOMAKE_CONAN_INCLUDES.append(automake_extra_includes) # TODO: to remove in conan v2 once pkg_config generator removed if self.options.enable_lib: diff --git a/recipes/pkgconf/all/patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch b/recipes/pkgconf/all/patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch new file mode 100644 index 0000000000000..8c6738a233a52 --- /dev/null +++ b/recipes/pkgconf/all/patches/1.9.3-0003-PKG_CONF_PATH-allow-colon+semicolon-separator.patch @@ -0,0 +1,11 @@ +--- libpkgconf/path.c ++++ libpkgconf/path.c +@@ -138,7 +138,7 @@ + return 0; + + iter = workbuf = strdup(text); +- while ((p = strtok(iter, PKG_CONFIG_PATH_SEP_S)) != NULL) ++ while ((p = strtok(iter, ":;")) != NULL) + { + pkgconf_path_add(p, dirlist, filter); + diff --git a/recipes/pkgconf/all/test_package/conanfile.py b/recipes/pkgconf/all/test_package/conanfile.py index b2a27f28edf88..bf269283d5b1b 100644 --- a/recipes/pkgconf/all/test_package/conanfile.py +++ b/recipes/pkgconf/all/test_package/conanfile.py @@ -1,56 +1,92 @@ -from conans import AutoToolsBuildEnvironment, CMake, ConanFile, tools, RunEnvironment -from conans.errors import ConanException +from io import StringIO import os -import shutil +from pathlib import Path +import re +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeDeps, CMakeToolchain +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.microsoft import unix_path + +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" test_type = "explicit" + win_bash = True @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def requirements(self): - self.requires(self.tested_reference_str) + self.requires(self.tested_reference_str) # for the library def build_requirements(self): - self.build_requires(self.tested_reference_str) - self.build_requires("automake/1.16.3") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires(self.tested_reference_str) # for the executable + self.tool_requires("automake/1.16.5") + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + # Autotools project to test integration pkgconfig works + # during an Autotools configure run + at = AutotoolsToolchain(self) + at.generate() + + # Expose `PKG_CONFIG_PATH` to be able to find libexample1.pc + env = Environment() + self.output.warning(f"Source folder: {self.source_folder}") + env.prepend_path("PKG_CONFIG_PATH", self.source_folder) + env.vars(self, scope="build").save_script("pkgconf-config-path") + buildenv = VirtualBuildEnv(self) + buildenv.generate() + + # CMake project to test that we can link against the library, + # when the library is built + if self.dependencies[self.tested_reference_str].options.enable_lib: + ct = CMakeToolchain(self) + ct.generate() + deps = CMakeDeps(self) + deps.generate() + + @property + def _testing_library(self): + # Workaround, in Conan >=2.0 we should be able to remove this in favour of: + # self.dependencies[self.tested_reference_str].options.enable_lib + has_toolchain = sorted(Path(self.build_folder).rglob('conan_toolchain.cmake')) + return has_toolchain + def build(self): - # Test pkg.m4 integration into automake - shutil.copy(os.path.join(self.source_folder, "configure.ac"), - os.path.join(self.build_folder, "configure.ac")) - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True, win_bash=tools.os_info.is_windows) - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - with tools.environment_append(RunEnvironment(self).vars): - autotools.configure() - - if self.options["pkgconf"].enable_lib: + # Test that configure doesn't fail, we are not building the + # autotools project + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + + if self._testing_library: cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - if self.options["pkgconf"].enable_lib: - self.run(os.path.join("bin", "test_package"), run_environment=True) - - pkg_config = tools.get_env("PKG_CONFIG") - self.output.info("Read environment variable PKG_CONFIG='{}'".format(pkg_config)) - if not pkg_config or not pkg_config.startswith(self.deps_cpp_info["pkgconf"].rootpath.replace("\\", "/")): - raise ConanException("PKG_CONFIG variable incorrect") - - pkgconf_path = tools.which("pkgconf").replace("\\", "/") - self.output.info("Found pkgconf at '{}'".format(pkgconf_path)) - if not pkgconf_path or not pkgconf_path.startswith(self.deps_cpp_info["pkgconf"].rootpath.replace("\\", "/")): - raise ConanException("pkgconf executable not found") - - with tools.environment_append({"PKG_CONFIG_PATH": self.source_folder}): - self.run("{} libexample1 --libs".format(os.environ["PKG_CONFIG"]), run_environment=True) - self.run("{} libexample1 --cflags".format(os.environ["PKG_CONFIG"]), run_environment=True) + # Check that we can find pkgconf in build environment + # and that it is the expected version + output = StringIO() + self.run("pkgconf --about", output, env="conanbuild") + # TODO: When recipe is Conan 2+ only, this can be simplified + # to: self.dependencies['pkgconf'].ref.version + tokens = re.split('[@#]', self.tested_reference_str) + pkgconf_expected_version = tokens[0].split("/", 1)[1] + assert f"pkgconf {pkgconf_expected_version}" in output.getvalue() + + # Test that executable linked against library runs as expected + if can_run(self) and self._testing_library: + test_executable = unix_path(self, os.path.join(self.cpp.build.bindirs[0], "test_package")) + self.run(test_executable, env="conanrun") diff --git a/recipes/pkgconf/all/test_package/src/CMakeLists.txt b/recipes/pkgconf/all/test_package/src/CMakeLists.txt new file mode 100644 index 0000000000000..04e3aa2d2e36a --- /dev/null +++ b/recipes/pkgconf/all/test_package/src/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(pkgconf REQUIRED) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE pkgconf::pkgconf) diff --git a/recipes/pkgconf/all/test_package/src/configure.ac b/recipes/pkgconf/all/test_package/src/configure.ac new file mode 100644 index 0000000000000..9b58503d96f4d --- /dev/null +++ b/recipes/pkgconf/all/test_package/src/configure.ac @@ -0,0 +1,9 @@ +AC_INIT([test_package_pkgconf],[1.0]) +AC_PREREQ([2.69]) + +PKG_PREREQ([0.29]) +PKG_PROG_PKG_CONFIG +[echo pkg-config executable found at $PKG_CONFIG!] +PKG_CHECK_EXISTS([libexample1], + [echo "found libexample1 :D"], + [echo "libexample1 not found :("]) diff --git a/recipes/pkgconf/all/test_package/libexample1.pc b/recipes/pkgconf/all/test_package/src/libexample1.pc similarity index 100% rename from recipes/pkgconf/all/test_package/libexample1.pc rename to recipes/pkgconf/all/test_package/src/libexample1.pc diff --git a/recipes/pkgconf/all/test_package/test_package.c b/recipes/pkgconf/all/test_package/src/test_package.c similarity index 100% rename from recipes/pkgconf/all/test_package/test_package.c rename to recipes/pkgconf/all/test_package/src/test_package.c diff --git a/recipes/pkgconf/all/test_package/CMakeLists.txt b/recipes/pkgconf/all/test_v1_package/CMakeLists.txt similarity index 100% rename from recipes/pkgconf/all/test_package/CMakeLists.txt rename to recipes/pkgconf/all/test_v1_package/CMakeLists.txt diff --git a/recipes/pkgconf/all/test_v1_package/conanfile.py b/recipes/pkgconf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b2a27f28edf88 --- /dev/null +++ b/recipes/pkgconf/all/test_v1_package/conanfile.py @@ -0,0 +1,56 @@ +from conans import AutoToolsBuildEnvironment, CMake, ConanFile, tools, RunEnvironment +from conans.errors import ConanException +import os +import shutil + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + test_type = "explicit" + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + self.build_requires("automake/1.16.3") + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + def build(self): + # Test pkg.m4 integration into automake + shutil.copy(os.path.join(self.source_folder, "configure.ac"), + os.path.join(self.build_folder, "configure.ac")) + self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True, win_bash=tools.os_info.is_windows) + autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) + with tools.environment_append(RunEnvironment(self).vars): + autotools.configure() + + if self.options["pkgconf"].enable_lib: + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + if self.options["pkgconf"].enable_lib: + self.run(os.path.join("bin", "test_package"), run_environment=True) + + pkg_config = tools.get_env("PKG_CONFIG") + self.output.info("Read environment variable PKG_CONFIG='{}'".format(pkg_config)) + if not pkg_config or not pkg_config.startswith(self.deps_cpp_info["pkgconf"].rootpath.replace("\\", "/")): + raise ConanException("PKG_CONFIG variable incorrect") + + pkgconf_path = tools.which("pkgconf").replace("\\", "/") + self.output.info("Found pkgconf at '{}'".format(pkgconf_path)) + if not pkgconf_path or not pkgconf_path.startswith(self.deps_cpp_info["pkgconf"].rootpath.replace("\\", "/")): + raise ConanException("pkgconf executable not found") + + with tools.environment_append({"PKG_CONFIG_PATH": self.source_folder}): + self.run("{} libexample1 --libs".format(os.environ["PKG_CONFIG"]), run_environment=True) + self.run("{} libexample1 --cflags".format(os.environ["PKG_CONFIG"]), run_environment=True) diff --git a/recipes/pkgconf/all/test_package/configure.ac b/recipes/pkgconf/all/test_v1_package/configure.ac similarity index 100% rename from recipes/pkgconf/all/test_package/configure.ac rename to recipes/pkgconf/all/test_v1_package/configure.ac diff --git a/recipes/pkgconf/all/test_v1_package/libexample1.pc b/recipes/pkgconf/all/test_v1_package/libexample1.pc new file mode 100644 index 0000000000000..5fc1beac53aac --- /dev/null +++ b/recipes/pkgconf/all/test_v1_package/libexample1.pc @@ -0,0 +1,6 @@ +Name: libexample1 +Description: This is a description of libexample1. +Requires: +Version: 0.42 +Libs: -L/usr/lib -lexample1 +Cflags: -I/usr/include/libexample1 -I/usr/include -DEXAMPLE1_STATIC diff --git a/recipes/pkgconf/all/test_v1_package/test_package.c b/recipes/pkgconf/all/test_v1_package/test_package.c new file mode 100644 index 0000000000000..f8fd8ee550059 --- /dev/null +++ b/recipes/pkgconf/all/test_v1_package/test_package.c @@ -0,0 +1,24 @@ +#include "libpkgconf/libpkgconf.h" + +#include +#include +#include + +bool error_callback(const char *msg, const pkgconf_client_t *client, const void *data) { + printf("error callback: %s\n", msg); + fflush(stdout); + return 1; // 1/true means message handled +} + +int main() { + pkgconf_client_t client; + memset(&client, 0, sizeof(client)); + + pkgconf_client_init(&client, error_callback, NULL, pkgconf_cross_personality_default()); + + pkgconf_error(&client, "%s:%d %s: %s", __FILE__, __LINE__, __FUNCTION__, "test error"); + + pkgconf_client_deinit(&client); + + return 0; +} diff --git a/recipes/pkgconf/config.yml b/recipes/pkgconf/config.yml index abd512535e029..9816b088e4d7b 100644 --- a/recipes/pkgconf/config.yml +++ b/recipes/pkgconf/config.yml @@ -1,5 +1,7 @@ versions: - "1.7.3": + "1.9.3": folder: "all" "1.7.4": folder: "all" + "1.7.3": + folder: "all" diff --git a/recipes/platform.hashing/all/conandata.yml b/recipes/platform.hashing/all/conandata.yml index 2fb29007be33f..82435a6d7e4a8 100644 --- a/recipes/platform.hashing/all/conandata.yml +++ b/recipes/platform.hashing/all/conandata.yml @@ -5,4 +5,6 @@ sources: "0.3.0": url: https://github.com/linksplatform/Hashing/archive/refs/tags/cpp_0.3.0.zip sha256: 8f7d6d401eaec1a78d1f10bfa3783b31ac6189a6ea8edf1ef7f300c47c0e5cb1 - + "0.4.0": + url: https://github.com/linksplatform/Hashing/archive/refs/tags/cpp_0.4.0.zip + sha256: afb8a27a483f636515ca4289f2bfa80fbd37c8416631f0b3ff7001d17a054320 diff --git a/recipes/platform.hashing/all/conanfile.py b/recipes/platform.hashing/all/conanfile.py index 062281a69a3ba..7e465451b8a23 100644 --- a/recipes/platform.hashing/all/conanfile.py +++ b/recipes/platform.hashing/all/conanfile.py @@ -4,7 +4,6 @@ except ImportError: from conans.tools import check_min_cppstd # FIXME : not in 1.49 from conan.tools.files import get -from conan.tools.cmake import CMake from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration import os @@ -47,10 +46,6 @@ def _compilers_minimum_version(self): def _minimum_cpp_standard(self): return 20 - def requirements(self): - if Version(self.version) >= "0.3.0": - self.requires("platform.delegates/0.2.7") - def validate(self): minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler)) diff --git a/recipes/platform.hashing/config.yml b/recipes/platform.hashing/config.yml index 0906286bf1225..ee25f0e067a38 100644 --- a/recipes/platform.hashing/config.yml +++ b/recipes/platform.hashing/config.yml @@ -3,3 +3,5 @@ versions: folder: all "0.3.0": folder: all + "0.4.0": + folder: all diff --git a/recipes/platform.interfaces/all/conandata.yml b/recipes/platform.interfaces/all/conandata.yml index e6bc2843d3697..25b51e862badd 100644 --- a/recipes/platform.interfaces/all/conandata.yml +++ b/recipes/platform.interfaces/all/conandata.yml @@ -1,4 +1,12 @@ sources: + "0.3.41": + source: + url: "https://github.com/linksplatform/Interfaces/releases/download/cpp_0.3.41/platform.interfaces_0.3.41.zip" + sha256: "26bfb96f8918db86390cf326eba5c76cfc29f06a785d30c789445fe59371bab4" + license: + url: "https://raw.githubusercontent.com/linksplatform/Interfaces/cpp_0.3.41/LICENSE" + sha256: "79d0fc44716007dddc375601bca8879ad45bc1165bf9342b7a16572b4f41abe8" "0.1.2": - url: https://github.com/linksplatform/Interfaces/archive/refs/tags/0.4.0_0.1.2.zip - sha256: 317c29e7ac6122af14e8b1cc8e674a71ba0969c0391ee54d9e045a88d25b5739 + source: + url: "https://github.com/linksplatform/Interfaces/archive/refs/tags/0.4.0_0.1.2.tar.gz" + sha256: "61283bf6488b9051e9f9e80e89ab0d1f85b76a1dbee3fd27f193e678f23903e2" diff --git a/recipes/platform.interfaces/all/conanfile.py b/recipes/platform.interfaces/all/conanfile.py index 4b44a9f82e9bd..b269b0438ae49 100644 --- a/recipes/platform.interfaces/all/conanfile.py +++ b/recipes/platform.interfaces/all/conanfile.py @@ -1,60 +1,93 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy, download +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration - -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.52.0" class PlatformInterfacesConan(ConanFile): name = "platform.interfaces" - license = "Unlicense" - homepage = "https://github.com/linksplatform/Interfaces" - url = "https://github.com/conan-io/conan-center-index" description = """platform.interfaces is one of the libraries of the LinksPlatform modular framework, which uses innovations from the C++20 standard, for easier use of static polymorphism. It also includes some auxiliary structures for more convenient work with containers.""" + license = "Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/linksplatform/Interfaces" topics = ("platform", "concepts", "header-only") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _subfolder_sources(self): + return os.path.join(self.source_folder, "cpp", "Platform.Interfaces") @property - def _subfolder_sources(self): - return os.path.join(self._source_subfolder, "cpp", "Platform.Interfaces") + def _min_cppstd(self): + return "20" @property def _compilers_minimum_version(self): return { - "gcc": "10", + "gcc": "11", "Visual Studio": "16", - "clang": "11", - "apple-clang": "11" + "msvc": "193", + "clang": "13", } + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + def validate(self): - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("platform.interfaces/{} " - "requires C++20 with {}, " + if self.settings.compiler == "apple-clang": + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, " "which is not supported " - "by {} {}.".format(self.version, self.settings.compiler, self.settings.compiler, self.settings.compiler.version)) + f"by {self.settings.compiler}.") + if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 20) + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, " + "which is not supported " + "by {self.settings.compiler} {self.settings.compiler.version}.") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version]["source"], strip_root=True) + if Version(self.version) >= "0.3.41": + download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE") def package(self): - self.copy("*.h", dst="include", src=self._subfolder_sources) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) - def package_id(self): - self.info.header_only() + if Version(self.version) < "0.3.41": + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "cpp", "Platform.Interfaces"), + ) + else: + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "Platform.Interfaces") + self.cpp_info.set_property("cmake_target_name", "Platform.Interfaces::Platform.Interfaces") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "Platform.Interfaces" self.cpp_info.names["cmake_find_package_multi"] = "Platform.Interfaces" diff --git a/recipes/platform.interfaces/all/test_package/CMakeLists.txt b/recipes/platform.interfaces/all/test_package/CMakeLists.txt index d7e44f864ad88..b54dd14513b95 100644 --- a/recipes/platform.interfaces/all/test_package/CMakeLists.txt +++ b/recipes/platform.interfaces/all/test_package/CMakeLists.txt @@ -1,9 +1,12 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(Platform.Interfaces REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} CONAN_PKG::platform.interfaces) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 20) +target_link_libraries(${PROJECT_NAME} PRIVATE Platform.Interfaces::Platform.Interfaces) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) + +if(Platform.Interfaces_VERSION VERSION_GREATER_EQUAL "0.2.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE -DPLATFORM_INTERFACES_0_2_0_LATER) +endif() diff --git a/recipes/platform.interfaces/all/test_package/conanfile.py b/recipes/platform.interfaces/all/test_package/conanfile.py index bd7165a553cf4..e845ae751a301 100644 --- a/recipes/platform.interfaces/all/test_package/conanfile.py +++ b/recipes/platform.interfaces/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/platform.interfaces/all/test_package/test_package.cpp b/recipes/platform.interfaces/all/test_package/test_package.cpp index e7eb9119d9793..58843ae8a5fa9 100644 --- a/recipes/platform.interfaces/all/test_package/test_package.cpp +++ b/recipes/platform.interfaces/all/test_package/test_package.cpp @@ -7,6 +7,8 @@ using namespace Platform::Interfaces; +#if not defined (PLATFORM_INTERFACES_0_2_0_LATER) + void print(IEnumerable auto&& enumerable) { auto size = std::ranges::size(enumerable); @@ -42,6 +44,45 @@ void add(Collection& collection, const std::same_as auto& item) } } +#else + +void print(CEnumerable auto&& enumerable) +{ + auto size = std::ranges::size(enumerable); + + std::cout << '['; + for (int i = 0; auto&& item : enumerable) + { + std::cout << item; + if (i < size - 1) + { + std::cout << ", "; + } + + i++; + } + std::cout << ']' << std::endl; +} + +template::Item> +requires + CList || + CSet || + CDictionary +void add(Collection& collection, const std::same_as auto& item) +{ + if constexpr (CList) + { + collection.push_back(item); + } + else + { + collection.insert(item); + } +} + +#endif + int main() { std::vector v { 1, 2, 3 }; diff --git a/recipes/platform.interfaces/all/test_v1_package/CMakeLists.txt b/recipes/platform.interfaces/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/platform.interfaces/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/platform.interfaces/all/test_v1_package/conanfile.py b/recipes/platform.interfaces/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/platform.interfaces/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/platform.interfaces/config.yml b/recipes/platform.interfaces/config.yml index b3c71bd313abc..6293fc3390096 100644 --- a/recipes/platform.interfaces/config.yml +++ b/recipes/platform.interfaces/config.yml @@ -1,3 +1,5 @@ versions: + "0.3.41": + folder: all "0.1.2": folder: all diff --git a/recipes/plf_colony/all/conandata.yml b/recipes/plf_colony/all/conandata.yml index 4344d38b83b8c..7d323fe98a8c9 100644 --- a/recipes/plf_colony/all/conandata.yml +++ b/recipes/plf_colony/all/conandata.yml @@ -1,7 +1,26 @@ sources: + "7.06": + url: "https://github.com/mattreecebentley/plf_colony/archive/348174f0da2ea65b7a561b08412e81ce1f5e6161.tar.gz" + sha256: "c6a34d08d4946f0ce54a9836b564b329afffc7ce173720282c7e2b0b57cbc484" + "7.03": + url: "https://github.com/mattreecebentley/plf_colony/archive/f182529ea6f125fc9cee5ca57f499284c777cecb.tar.gz" + sha256: "8fa98993283a158779596f0de17217bd7ef2923fbfc116861172f4ba20f4bc81" "7.00": url: "https://github.com/mattreecebentley/plf_colony/archive/b648c57dab032d326d1487f812e6dbda23b42d20.tar.gz" sha256: "6faae2a68c49ac237c0dff3b1abc2d9b0ebf936ea883d3553c6e6adb6eaa2b4d" "6.25": url: "https://github.com/mattreecebentley/plf_colony/archive/848305c2f83fbd5407e6e3fdb9c3e3e8dcfa2ea6.tar.gz" sha256: "4d298dbd9266201be9733ef276046e9a55d7f35a8c16378fc1dcb687ca8ab4ad" +patches: + "7.06": + - patch_file: "patches/7.06-0001-disable-cxx20-from-apple-clang14.patch" + patch_description: "apple-clang 14 defaults C++ 20, but it doesn't support C++20 features little" + patch_type: "portability" + "7.03": + - patch_file: "patches/7.00-0001-disable-cxx20-from-apple-clang14.patch" + patch_description: "apple-clang 14 defaults C++ 20, but it doesn't support C++20 features little" + patch_type: "portability" + "7.00": + - patch_file: "patches/7.00-0001-disable-cxx20-from-apple-clang14.patch" + patch_description: "apple-clang 14 defaults C++ 20, but it doesn't support C++20 features little" + patch_type: "portability" diff --git a/recipes/plf_colony/all/conanfile.py b/recipes/plf_colony/all/conanfile.py index 85f4d597b18e9..888ed08055ad9 100644 --- a/recipes/plf_colony/all/conanfile.py +++ b/recipes/plf_colony/all/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.files import copy, get +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches from conan.tools.layout import basic_layout import os @@ -11,11 +11,13 @@ class PlfcolonyConan(ConanFile): description = "An unordered data container providing fast iteration/insertion/erasure " \ "while maintaining pointer/iterator/reference validity to non-erased elements." license = "Zlib" - topics = ("plf_colony", "container", "bucket", "unordered") + topics = ("container", "bucket", "unordered", "header-only") homepage = "https://github.com/mattreecebentley/plf_colony" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - no_copy_source = True + + def export_sources(self): + export_conandata_patches(self) def package_id(self): self.info.clear() @@ -28,7 +30,7 @@ def source(self): destination=self.source_folder, strip_root=True) def build(self): - pass + apply_conandata_patches(self) def package(self): copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) diff --git a/recipes/plf_colony/all/patches/7.00-0001-disable-cxx20-from-apple-clang14.patch b/recipes/plf_colony/all/patches/7.00-0001-disable-cxx20-from-apple-clang14.patch new file mode 100644 index 0000000000000..cba605fff0fbf --- /dev/null +++ b/recipes/plf_colony/all/patches/7.00-0001-disable-cxx20-from-apple-clang14.patch @@ -0,0 +1,13 @@ +diff --git a/plf_colony.h b/plf_colony.h +index a9911f3..c707edc 100644 +--- a/plf_colony.h ++++ b/plf_colony.h +@@ -165,7 +165,7 @@ + #define PLF_CONSTEXPR constexpr + #endif + +- #if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && ((defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__))) ++ #if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && ((!defined(__APPLE_CC__) && defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__))) + #define PLF_CPP20_SUPPORT + #undef PLF_CONSTFUNC + #define PLF_CONSTFUNC constexpr diff --git a/recipes/plf_colony/all/patches/7.06-0001-disable-cxx20-from-apple-clang14.patch b/recipes/plf_colony/all/patches/7.06-0001-disable-cxx20-from-apple-clang14.patch new file mode 100644 index 0000000000000..3992b1b8c3069 --- /dev/null +++ b/recipes/plf_colony/all/patches/7.06-0001-disable-cxx20-from-apple-clang14.patch @@ -0,0 +1,13 @@ +diff --git a/plf_colony.h b/plf_colony.h +index e789331..2e2005b 100644 +--- a/plf_colony.h ++++ b/plf_colony.h +@@ -176,7 +176,7 @@ + #define PLF_CONSTEXPR constexpr + #endif + +- #if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && ((defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__))) ++ #if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && ((!defined(__APPLE_CC__) && defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__))) + #define PLF_CPP20_SUPPORT + #undef PLF_CONSTFUNC + #define PLF_CONSTFUNC constexpr diff --git a/recipes/plf_colony/all/test_v1_package/CMakeLists.txt b/recipes/plf_colony/all/test_v1_package/CMakeLists.txt index 481e5ac100c65..925ecbe19e448 100644 --- a/recipes/plf_colony/all/test_v1_package/CMakeLists.txt +++ b/recipes/plf_colony/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(plf_colony REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE plf_colony::plf_colony) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/plf_colony/config.yml b/recipes/plf_colony/config.yml index 7e019a19d6be2..d7dde26d155d4 100644 --- a/recipes/plf_colony/config.yml +++ b/recipes/plf_colony/config.yml @@ -1,4 +1,8 @@ versions: + "7.06": + folder: all + "7.03": + folder: all "7.00": folder: all "6.25": diff --git a/recipes/plf_indiesort/all/conandata.yml b/recipes/plf_indiesort/all/conandata.yml index 52221cecba4f6..8b79bf367fbc1 100644 --- a/recipes/plf_indiesort/all/conandata.yml +++ b/recipes/plf_indiesort/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.18": + url: "https://github.com/mattreecebentley/plf_indiesort/archive/1999a3017b3a3699f426608841a5a66e0849880d.tar.gz" + sha256: "1c035243adbd63d89a61f8a0e8bbea1911ab9421467da9e5d618c30f10f16f91" "1.15": url: "https://github.com/mattreecebentley/plf_indiesort/archive/b28d376cda4b3c06201a04e9a1698f8b98687ec3.tar.gz" sha256: "607afcec499c9a1ed097f0cdc0c9b4ea3af6b3db675d3b873c9e4e5827a5bc0e" diff --git a/recipes/plf_indiesort/all/conanfile.py b/recipes/plf_indiesort/all/conanfile.py index d11b6831d94fc..c13c8aaa71120 100644 --- a/recipes/plf_indiesort/all/conanfile.py +++ b/recipes/plf_indiesort/all/conanfile.py @@ -13,7 +13,7 @@ class PlfindiesortConan(ConanFile): "access containers, and increased performance for the sorting of large types." ) license = "Zlib" - topics = ("plf_indiesort", "algorithm", "sort") + topics = ("algorithm", "sort", "header-only") homepage = "https://plflib.org/indiesort.htm" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" diff --git a/recipes/plf_indiesort/all/test_v1_package/CMakeLists.txt b/recipes/plf_indiesort/all/test_v1_package/CMakeLists.txt index fa0de89fb25f2..925ecbe19e448 100644 --- a/recipes/plf_indiesort/all/test_v1_package/CMakeLists.txt +++ b/recipes/plf_indiesort/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(plf_indiesort REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE plf_indiesort::plf_indiesort) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/plf_indiesort/config.yml b/recipes/plf_indiesort/config.yml index 31ab4c7136787..5b4c7706184cf 100644 --- a/recipes/plf_indiesort/config.yml +++ b/recipes/plf_indiesort/config.yml @@ -1,3 +1,5 @@ versions: + "1.18": + folder: all "1.15": folder: all diff --git a/recipes/plf_list/all/conandata.yml b/recipes/plf_list/all/conandata.yml index b39f43243cee6..69ea21b761e16 100644 --- a/recipes/plf_list/all/conandata.yml +++ b/recipes/plf_list/all/conandata.yml @@ -1,7 +1,26 @@ sources: + "2.57": + url: "https://github.com/mattreecebentley/plf_list/archive/d7a06d7497dc01261dd2c2fe675a8b605acb7a56.tar.gz" + sha256: "4297c7578fe5ea2c6346541b28a57d87ec311522fa55bc8a5ab069921fc073e9" + "2.52": + url: "https://github.com/mattreecebentley/plf_list/archive/76115adac11a5f362b7a8eea8362314d547284df.tar.gz" + sha256: "897ff5309c399ec0f7c875b398c7eb07ebe3cd80a75ce337a0bd70456668116b" "2.50": url: "https://github.com/mattreecebentley/plf_list/archive/b520008d5d076402da2344994dd2c1e3cc097460.tar.gz" sha256: "086a1ecad544202c93a3fa4bb7d26cf4140db7ebc2bb39af3e75620050c78f23" "2.03": url: "https://github.com/mattreecebentley/plf_list/archive/cc579a5cc828d8a0da6715ef075d560e4de89901.tar.gz" sha256: "4ab3f7ca41e3567710a64ede3a9f708b388f3ae52e09b3ee1a45d6b4fd89dd09" +patches: + "2.57": + - patch_file: "patches/2.57-0001-disable-cxx20-from-apple-clang14.patch" + patch_description: "apple-clang 14 defaults C++ 20, but it doesn't support C++20 features little" + patch_type: "portability" + "2.52": + - patch_file: "patches/2.50-0001-disable-cxx20-from-apple-clang14.patch" + patch_description: "apple-clang 14 defaults C++ 20, but it doesn't support C++20 features little" + patch_type: "portability" + "2.50": + - patch_file: "patches/2.50-0001-disable-cxx20-from-apple-clang14.patch" + patch_description: "apple-clang 14 defaults C++ 20, but it doesn't support C++20 features little" + patch_type: "portability" diff --git a/recipes/plf_list/all/conanfile.py b/recipes/plf_list/all/conanfile.py index d99d3d682d0c5..93c3eafa9a2e2 100644 --- a/recipes/plf_list/all/conanfile.py +++ b/recipes/plf_list/all/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.files import copy, get +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches from conan.tools.layout import basic_layout import os @@ -10,11 +10,13 @@ class PlflistConan(ConanFile): name = "plf_list" description = "plf::list is a drop-in higher-performance replacement for std::list" license = "Zlib" - topics = ("plf_list", "container", "linked-list", "list") - homepage = "https://github.com/mattreecebentley/plf_list" + topics = ("container", "linked-list", "list", "header-only") url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mattreecebentley/plf_list" settings = "os", "arch", "compiler", "build_type" - no_copy_source = True + + def export_sources(self): + export_conandata_patches(self) def package_id(self): self.info.clear() @@ -27,7 +29,7 @@ def source(self): destination=self.source_folder, strip_root=True) def build(self): - pass + apply_conandata_patches(self) def package(self): copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) diff --git a/recipes/plf_list/all/patches/2.50-0001-disable-cxx20-from-apple-clang14.patch b/recipes/plf_list/all/patches/2.50-0001-disable-cxx20-from-apple-clang14.patch new file mode 100644 index 0000000000000..27e0ab94b61af --- /dev/null +++ b/recipes/plf_list/all/patches/2.50-0001-disable-cxx20-from-apple-clang14.patch @@ -0,0 +1,13 @@ +diff --git a/plf_list.h b/plf_list.h +index a9e3711..8357582 100644 +--- a/plf_list.h ++++ b/plf_list.h +@@ -168,7 +168,7 @@ + #define PLF_CONSTEXPR constexpr + #endif + +- #if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && ((defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__))) ++ #if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && (!defined(__APPLE_CC__) && (defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__))) + #define PLF_CPP20_SUPPORT + #undef PLF_CONSTFUNC + #define PLF_CONSTFUNC constexpr diff --git a/recipes/plf_list/all/patches/2.57-0001-disable-cxx20-from-apple-clang14.patch b/recipes/plf_list/all/patches/2.57-0001-disable-cxx20-from-apple-clang14.patch new file mode 100644 index 0000000000000..6d93f43be4b9a --- /dev/null +++ b/recipes/plf_list/all/patches/2.57-0001-disable-cxx20-from-apple-clang14.patch @@ -0,0 +1,13 @@ +diff --git a/plf_list.h b/plf_list.h +index c729efe..1d0eb67 100644 +--- a/plf_list.h ++++ b/plf_list.h +@@ -176,7 +176,7 @@ + #define PLF_CONSTEXPR constexpr + #endif + +- #if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && ((defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__))) ++ #if __cplusplus > 201704L && ((defined(_LIBCPP_VERSION) && _LIBCPP_VERSION >= 13) || !defined(_LIBCPP_VERSION)) && (!defined(__APPLE_CC__) && (defined(__clang__) && (__clang_major__ >= 13)) || (defined(__GNUC__) && __GNUC__ >= 10) || (!defined(__clang__) && !defined(__GNUC__))) + #define PLF_CPP20_SUPPORT + #undef PLF_CONSTFUNC + #define PLF_CONSTFUNC constexpr diff --git a/recipes/plf_list/all/test_v1_package/CMakeLists.txt b/recipes/plf_list/all/test_v1_package/CMakeLists.txt index d2d98c1106955..925ecbe19e448 100644 --- a/recipes/plf_list/all/test_v1_package/CMakeLists.txt +++ b/recipes/plf_list/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(plf_list REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE plf_list::plf_list) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/plf_list/config.yml b/recipes/plf_list/config.yml index f5a353305c680..ca1f4fbf159c4 100644 --- a/recipes/plf_list/config.yml +++ b/recipes/plf_list/config.yml @@ -1,4 +1,8 @@ versions: + "2.57": + folder: all + "2.52": + folder: all "2.50": folder: all "2.03": diff --git a/recipes/plf_queue/all/conandata.yml b/recipes/plf_queue/all/conandata.yml index 31ccdbb5e7773..c563552517b10 100644 --- a/recipes/plf_queue/all/conandata.yml +++ b/recipes/plf_queue/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.22": + url: "https://github.com/mattreecebentley/plf_queue/archive/bef2bda67cb4cadfd5dceaaf2c8f037c540a12bc.tar.gz" + sha256: "96da3d7f27c62b39a147bc38a8d9f3a1a5f1cb0bfcc3b37d5ee2c7c056ad368e" + "1.21": + url: "https://github.com/mattreecebentley/plf_queue/archive/67c5de0cc2c21a865dd1fae180eb765d39f2d2c5.tar.gz" + sha256: "baa01a5b0709e5742b87b1bcd7ddbb116e0c841beb22c4553f0d64f54e5a829d" "1.19": url: "https://github.com/mattreecebentley/plf_queue/archive/991661f3674ff30c3f469120f6973556804b8a00.tar.gz" sha256: "7e9a36c0fde9c131c4552d61bd4cf3a71dc78536fba4dc60d8f33b92bf5f4e8d" diff --git a/recipes/plf_queue/all/conanfile.py b/recipes/plf_queue/all/conanfile.py index 3ba6a0533a44e..eb89a396e2710 100644 --- a/recipes/plf_queue/all/conanfile.py +++ b/recipes/plf_queue/all/conanfile.py @@ -10,7 +10,7 @@ class PlfqueueConan(ConanFile): name = "plf_queue" description = "A C++ data container replicating std::queue functionality but with better performance." license = "Zlib" - topics = ("plf_queue", "container", "queue") + topics = ("container", "queue", "header-only") homepage = "https://plflib.org/queue.htm" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" diff --git a/recipes/plf_queue/all/test_v1_package/CMakeLists.txt b/recipes/plf_queue/all/test_v1_package/CMakeLists.txt index 8af48537374c6..925ecbe19e448 100644 --- a/recipes/plf_queue/all/test_v1_package/CMakeLists.txt +++ b/recipes/plf_queue/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(plf_queue REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE plf_queue::plf_queue) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/plf_queue/config.yml b/recipes/plf_queue/config.yml index 71aadeff7d8a0..60c525e6c3382 100644 --- a/recipes/plf_queue/config.yml +++ b/recipes/plf_queue/config.yml @@ -1,3 +1,7 @@ versions: + "1.22": + folder: all + "1.21": + folder: all "1.19": folder: all diff --git a/recipes/plf_stack/all/conandata.yml b/recipes/plf_stack/all/conandata.yml index bedf75de4ef79..cf7e7157c6209 100644 --- a/recipes/plf_stack/all/conandata.yml +++ b/recipes/plf_stack/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.64": + url: "https://github.com/mattreecebentley/plf_stack/archive/c9d8fae0a66d1d0a19c3d0bf690a2776710511fe.tar.gz" + sha256: "8dcca43043a3c5e91a642a3ae84f3acca657c3775536569302bbccc6b70d24e6" + "1.63": + url: "https://github.com/mattreecebentley/plf_stack/archive/96184693b8dcc904b07cf4e97e848be9fe8b2c4e.tar.gz" + sha256: "8789f97d217e9f97ffefc700f14b87f960aaaad25d0c9a27e6d8577d7a52a939" "1.60": url: "https://github.com/mattreecebentley/plf_stack/archive/775456d32a0919bc2a6df9ab9b2b5e96b76c6c24.tar.gz" sha256: "ac09619bef8aa1c946ccf8bebbf623187627b7bb31ad85c60384ad450f0dd0fa" diff --git a/recipes/plf_stack/all/conanfile.py b/recipes/plf_stack/all/conanfile.py index 3b8774da0c6dd..c8872d80acc3f 100644 --- a/recipes/plf_stack/all/conanfile.py +++ b/recipes/plf_stack/all/conanfile.py @@ -13,7 +13,7 @@ class PlfstackConan(ConanFile): "better performance than standard library containers in a stack context." ) license = "Zlib" - topics = ("plf_stack", "container", "stack") + topics = ("container", "stack", "header-only") homepage = "https://plflib.org/stack.htm" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" diff --git a/recipes/plf_stack/all/test_v1_package/CMakeLists.txt b/recipes/plf_stack/all/test_v1_package/CMakeLists.txt index db6f3423c973d..925ecbe19e448 100644 --- a/recipes/plf_stack/all/test_v1_package/CMakeLists.txt +++ b/recipes/plf_stack/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(plf_stack REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE plf_stack::plf_stack) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/plf_stack/config.yml b/recipes/plf_stack/config.yml index 1b1859918eba2..88575a7de5458 100644 --- a/recipes/plf_stack/config.yml +++ b/recipes/plf_stack/config.yml @@ -1,3 +1,7 @@ versions: + "1.64": + folder: all + "1.63": + folder: all "1.60": folder: all diff --git a/recipes/plog/all/conandata.yml b/recipes/plog/all/conandata.yml index 62dac8352bca6..a2d1cb2b746a6 100644 --- a/recipes/plog/all/conandata.yml +++ b/recipes/plog/all/conandata.yml @@ -1,5 +1,7 @@ sources: + "1.1.9": + url: "https://github.com/SergiusTheBest/plog/archive/1.1.9.tar.gz" + sha256: "058315b9ec9611b659337d4333519ab4783fad3f2f23b1cc7bb84d977ea38055" "1.1.5": url: "https://github.com/SergiusTheBest/plog/archive/1.1.5.tar.gz" sha256: "6c80b4701183d2415bec927e1f5ca9b1761b3b5c65d3e09fb29c743e016d5609" - diff --git a/recipes/plog/all/conanfile.py b/recipes/plog/all/conanfile.py index 0837c0bceb43b..791d275909919 100644 --- a/recipes/plog/all/conanfile.py +++ b/recipes/plog/all/conanfile.py @@ -1,28 +1,37 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout import os -from conans import ConanFile, tools +required_conan_version = ">=1.52.0" class PlogConan(ConanFile): name = "plog" description = "Pretty powerful logging library in about 1000 lines of code" - homepage = "https://github.com/SergiusTheBest/plog" - url = "https://github.com/conan-io/conan-center-index" license = "MPL-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/SergiusTheBest/plog" topics = ("logging", "header-only", "portable") no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", src=os.path.join(self._source_subfolder, "include"), dst=os.path.join("include")) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/plog/all/test_package/CMakeLists.txt b/recipes/plog/all/test_package/CMakeLists.txt index 945696beb2efc..690cbc43fe694 100644 --- a/recipes/plog/all/test_package/CMakeLists.txt +++ b/recipes/plog/all/test_package/CMakeLists.txt @@ -1,8 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(plog REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE plog::plog) + +if(plog_VERSION VERSION_GREATER_EQUAL "1.1.6") + target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE -DPLOG_EXPLICIT_INIT) +endif() diff --git a/recipes/plog/all/test_package/conanfile.py b/recipes/plog/all/test_package/conanfile.py index 07847b3d9465f..e845ae751a301 100644 --- a/recipes/plog/all/test_package/conanfile.py +++ b/recipes/plog/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) - + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/plog/all/test_package/test_package.cpp b/recipes/plog/all/test_package/test_package.cpp index 3013bd6609769..7f43b93383455 100644 --- a/recipes/plog/all/test_package/test_package.cpp +++ b/recipes/plog/all/test_package/test_package.cpp @@ -1,6 +1,9 @@ #include #include +#ifdef PLOG_EXPLICIT_INIT +# include +#endif int main() { plog::init(plog::debug, "log.txt"); diff --git a/recipes/plog/all/test_v1_package/CMakeLists.txt b/recipes/plog/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/plog/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/plog/all/test_v1_package/conanfile.py b/recipes/plog/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/plog/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/plog/config.yml b/recipes/plog/config.yml index e48685771bd64..c3432fc6b2f2a 100644 --- a/recipes/plog/config.yml +++ b/recipes/plog/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.9": + folder: all "1.1.5": folder: all diff --git a/recipes/plutovg/all/CMakeLists.txt b/recipes/plutovg/all/CMakeLists.txt deleted file mode 100644 index 5c311fb812b13..0000000000000 --- a/recipes/plutovg/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper LANGUAGES C) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/plutovg/all/conandata.yml b/recipes/plutovg/all/conandata.yml index a27d529c6106c..dbcdf0e92b441 100644 --- a/recipes/plutovg/all/conandata.yml +++ b/recipes/plutovg/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20221030": + url: "https://github.com/sammycage/plutovg/archive/4d0eee77ce7d1850aac4d90e20ddaaa313d83e6a.tar.gz" + sha256: "bb44b1107d1cd41032fecdf3e16cff59a1a06f15a92527029aacb73c5c4d059e" "cci.20220103": url: "https://github.com/sammycage/plutovg/archive/51f1a79e04fbb42ec9e93499a18869eea06f3054.tar.gz" sha256: "c2ce39b8085e0a8795263666f62af15239c36964330865fd54b9db25c67e063b" diff --git a/recipes/plutovg/all/conanfile.py b/recipes/plutovg/all/conanfile.py index 31d141acec985..13289c4f9dd84 100644 --- a/recipes/plutovg/all/conanfile.py +++ b/recipes/plutovg/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import get, copy, replace_in_file +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout + import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class PlutoVGConan(ConanFile): name = "plutovg" @@ -21,52 +24,53 @@ class PlutoVGConan(ConanFile): "fPIC": True, } - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() def build(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_library(plutovg STATIC)", "add_library(plutovg)") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "add_subdirectory(example)", "") - - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy(pattern="*.a", dst="lib", src="lib", keep_path=False) - self.copy(pattern="*.so", dst="lib", src="lib", keep_path=False) - self.copy(pattern="*.lib", dst="lib", src="lib", keep_path=False) - self.copy(pattern="*.dll", dst="bin", src="bin", keep_path=False) - self.copy(pattern="*.dylib", dst="lib", src="lib", keep_path=False) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + copy(self, pattern="*.a", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.so", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.dll", dst=os.path.join(self.package_folder, "bin"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.dylib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) def package_info(self): self.cpp_info.libs = ["plutovg"] diff --git a/recipes/plutovg/all/test_package/CMakeLists.txt b/recipes/plutovg/all/test_package/CMakeLists.txt index 98f8122ae693b..05f05dd40b2ba 100644 --- a/recipes/plutovg/all/test_package/CMakeLists.txt +++ b/recipes/plutovg/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(plutovg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} plutovg::plutovg) +target_link_libraries(${PROJECT_NAME} PRIVATE plutovg::plutovg) diff --git a/recipes/plutovg/all/test_package/conanfile.py b/recipes/plutovg/all/test_package/conanfile.py index a500b98343c74..a9fbb7f543162 100644 --- a/recipes/plutovg/all/test_package/conanfile.py +++ b/recipes/plutovg/all/test_package/conanfile.py @@ -1,9 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/plutovg/all/test_v1_package/CMakeLists.txt b/recipes/plutovg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de3b75d9538de --- /dev/null +++ b/recipes/plutovg/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/plutovg/all/test_v1_package/conanfile.py b/recipes/plutovg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/plutovg/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/plutovg/config.yml b/recipes/plutovg/config.yml index d334d7a80bf72..b7f8945df864d 100644 --- a/recipes/plutovg/config.yml +++ b/recipes/plutovg/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20221030": + folder: all "cci.20220103": folder: all diff --git a/recipes/pngpp/all/conandata.yml b/recipes/pngpp/all/conandata.yml index 8f572862e9a9d..02dc7457e1b89 100644 --- a/recipes/pngpp/all/conandata.yml +++ b/recipes/pngpp/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "0.2.10": - patch_file: "patches/0001-fix-windows.patch" - base_path: "source_subfolder" diff --git a/recipes/pngpp/all/conanfile.py b/recipes/pngpp/all/conanfile.py index bd480790a26cd..9693d59416e60 100644 --- a/recipes/pngpp/all/conanfile.py +++ b/recipes/pngpp/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class PngppConan(ConanFile): @@ -11,26 +13,31 @@ class PngppConan(ConanFile): topics = ("png++", "png") homepage = "https://www.nongnu.org/pngpp" url = "https://github.com/conan-io/conan-center-index" - exports_sources = "patches/**" + settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.38") def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - self.copy("*.hpp", dst=os.path.join("include", "png++"), src=self._source_subfolder) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", src=self.source_folder, dst=os.path.join(self.package_folder, "include", "png++")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/pngpp/all/test_package/CMakeLists.txt b/recipes/pngpp/all/test_package/CMakeLists.txt index 196188113685c..f5ee715eea307 100644 --- a/recipes/pngpp/all/test_package/CMakeLists.txt +++ b/recipes/pngpp/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(pngpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE pngpp::pngpp) diff --git a/recipes/pngpp/all/test_package/conanfile.py b/recipes/pngpp/all/test_package/conanfile.py index 5216332f39f5c..0a6bc68712d90 100644 --- a/recipes/pngpp/all/test_package/conanfile.py +++ b/recipes/pngpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pngpp/all/test_v1_package/CMakeLists.txt b/recipes/pngpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..abf75b3c1f51a --- /dev/null +++ b/recipes/pngpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(pngpp REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE pngpp::pngpp) diff --git a/recipes/pngpp/all/test_v1_package/conanfile.py b/recipes/pngpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/pngpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/poco/all/CMakeLists.txt b/recipes/poco/all/CMakeLists.txt deleted file mode 100644 index 4568af6253394..0000000000000 --- a/recipes/poco/all/CMakeLists.txt +++ /dev/null @@ -1,26 +0,0 @@ -cmake_minimum_required(VERSION 3.5.0) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(MYSQL_ROOT_DIR) - find_package(MySQL REQUIRED) - add_library(MySQL::client INTERFACE IMPORTED) - target_link_libraries(MySQL::client INTERFACE MySQL::MySQL) -endif() -if(PostgreSQL_ROOT_DIR) - find_package(PostgreSQL REQUIRED) - add_library(PostgreSQL::client INTERFACE IMPORTED) - target_link_libraries(PostgreSQL::client INTERFACE PostgreSQL::PostgreSQL) -endif() - -# Disable automatic linking on MSVC -add_definitions(-DPOCO_NO_AUTOMATIC_LIBS) - -if ("${CONAN_PACKAGE_VERSION}" VERSION_GREATER "1.10") - add_definitions(-DXML_DTD) -endif() - - -add_subdirectory(src) diff --git a/recipes/poco/all/conandata.yml b/recipes/poco/all/conandata.yml index d703b99d41fba..c1b33d73bc83f 100644 --- a/recipes/poco/all/conandata.yml +++ b/recipes/poco/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.12.4": + url: "https://github.com/pocoproject/poco/archive/poco-1.12.4-release.tar.gz" + sha256: "71ef96c35fced367d6da74da294510ad2c912563f12cd716ab02b6ed10a733ef" + "1.12.3": + url: "https://github.com/pocoproject/poco/archive/poco-1.12.3-release.tar.gz" + sha256: "3b2056ddef17164b896cda0613e2f2b3d6b857f49c3e464b5d0f655017f2231d" "1.12.2": url: "https://github.com/pocoproject/poco/archive/poco-1.12.2-release.tar.gz" sha256: "30442ccb097a0074133f699213a59d6f8c77db5b2c98a7c1ad9c5eeb3a2b06f3" @@ -36,59 +42,41 @@ sources: url: "https://github.com/pocoproject/poco/archive/poco-1.8.1-release.tar.gz" sha256: "43cc469c01d1f799efc51e2bfde6ffdf467b98a8a0901e6b33db86958619b3af" patches: + "1.12.4": + - patch_file: patches/1.12.4.patch + - patch_file: patches/0002-mysql-include.patch + "1.12.3": + - patch_file: patches/1.12.3.patch + - patch_file: patches/0002-mysql-include.patch "1.12.2": - patch_file: patches/1.12.2.patch - base_path: src - patch_file: patches/0002-mysql-include.patch - base_path: src "1.12.1": - patch_file: patches/1.12.1.patch - base_path: src - patch_file: patches/0002-mysql-include.patch - base_path: src "1.12.0": - patch_file: patches/1.12.0.patch - base_path: src - patch_file: patches/0002-mysql-include.patch - base_path: src "1.11.3": - - patch_file: patches/1.11.3.patch - base_path: src + - patch_file: patches/1.11.1.patch - patch_file: patches/0002-mysql-include.patch - base_path: src "1.11.2": - - patch_file: patches/1.11.2.patch - base_path: src + - patch_file: patches/1.11.1.patch - patch_file: patches/0002-mysql-include.patch - base_path: src "1.11.1": - patch_file: patches/1.11.1.patch - base_path: src - patch_file: patches/0002-mysql-include.patch - base_path: src "1.11.0": - patch_file: patches/1.11.0.patch - base_path: src - patch_file: patches/0002-mysql-include.patch - base_path: src "1.10.1": - patch_file: patches/1.10.1.patch - base_path: src "1.10.0": - patch_file: patches/1.10.0.patch - base_path: src - patch_file: patches/1.10.0-set-missing-cmake-variable.patch - base_path: src "1.9.4": - patch_file: patches/1.9.2.patch - base_path: src - - patch_file: patches/1.9.2-2.patch - base_path: src "1.9.3": - patch_file: patches/1.9.2.patch - base_path: src - - patch_file: patches/1.9.2-2.patch - base_path: src "1.8.1": - patch_file: patches/1.8.1.patch - base_path: src diff --git a/recipes/poco/all/conanfile.py b/recipes/poco/all/conanfile.py index e1b9d2b9a307d..4c42e9050c2aa 100644 --- a/recipes/poco/all/conanfile.py +++ b/recipes/poco/all/conanfile.py @@ -1,17 +1,13 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.microsoft import msvc_runtime_flag, is_msvc +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, msvc_runtime_flag, VCVars from conan.tools.scm import Version -from conan.tools.files import get, patch, rmdir - -from conans import CMake, tools - from collections import namedtuple -import functools import os - -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.54.0" class PocoConan(ConanFile): @@ -26,6 +22,7 @@ class PocoConan(ConanFile): "mobile and embedded systems." ) + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -80,20 +77,8 @@ class PocoConan(ConanFile): default_options[comp.option] = comp.default_option del comp - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "src" - - @property - def _build_subfolder(self): - return "build" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -101,61 +86,67 @@ def config_options(self): del self.options.enable_fork else: del self.options.enable_netssl_win - if Version(self.version) < "1.9": + if Version(self.version) < "1.9.0": del self.options.enable_encodings - if Version(self.version) < "1.10": + if Version(self.version) < "1.10.0": del self.options.enable_data_mysql del self.options.enable_data_postgresql del self.options.enable_jwt - if Version(self.version) < "1.11": + if Version(self.version) < "1.11.0": del self.options.enable_activerecord del self.options.enable_activerecord_compiler - if Version(self.version) < "1.12": + if Version(self.version) < "1.12.0": del self.options.enable_prometheus def configure(self): if self.options.enable_active_record != "deprecated": - self.output.warn("enable_active_record option is deprecated, use 'enable_activerecord' instead") + self.output.warning("enable_active_record option is deprecated, use 'enable_activerecord' instead") if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.enable_xml: util_dependencies = self._poco_component_tree["Util"].dependencies self._poco_component_tree["Util"] = self._poco_component_tree["Util"]._replace(dependencies = [x for x in util_dependencies if x != "XML"]) if not self.options.enable_json: util_dependencies = self._poco_component_tree["Util"].dependencies self._poco_component_tree["Util"] = self._poco_component_tree["Util"]._replace(dependencies = [x for x in util_dependencies if x != "JSON"]) - if Version(self.version) >= "1.12": + if Version(self.version) >= "1.12.0": foundation_external_dependencies = self._poco_component_tree["Foundation"].external_dependencies self._poco_component_tree["Foundation"] = self._poco_component_tree["Foundation"]._replace(external_dependencies = list(map(lambda x: 'pcre2::pcre2' if x == 'pcre::pcre' else x, foundation_external_dependencies))) + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - if Version(self.version) < "1.12": + if Version(self.version) < "1.12.0": self.requires("pcre/8.45") else: - self.requires("pcre2/10.40") - self.requires("zlib/1.2.12") + self.requires("pcre2/10.42") + self.requires("zlib/1.2.13") if self.options.enable_xml: - self.requires("expat/2.4.8") + self.requires("expat/2.5.0") if self.options.enable_data_sqlite: - self.requires("sqlite3/3.39.2") + self.requires("sqlite3/3.40.1") if self.options.enable_apacheconnector: self.requires("apr/1.7.0") self.requires("apr-util/1.6.1") if self.options.enable_netssl or self.options.enable_crypto or \ self.options.get_safe("enable_jwt"): - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1t", transitive_headers=True) if self.options.enable_data_odbc and self.settings.os != "Windows": - self.requires("odbc/2.3.9") + self.requires("odbc/2.3.11") if self.options.get_safe("enable_data_postgresql"): - self.requires("libpq/14.2") + self.requires("libpq/14.5") if self.options.get_safe("enable_data_mysql"): - self.requires("libmysqlclient/8.0.29") + self.requires("libmysqlclient/8.0.31") + + def package_id(self): + del self.info.options.enable_active_record def validate(self): if self.options.enable_apacheconnector: # FIXME: missing apache2 recipe + few issues raise ConanInvalidConfiguration("Apache connector not supported: https://github.com/pocoproject/poco/issues/1764") - if is_msvc(self) and self.options.shared and "MT" in msvc_runtime_flag(self): + if is_msvc(self) and self.options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Cannot build shared poco libraries with MT(d) runtime") for compopt in self._poco_component_tree.values(): if not compopt.option: @@ -165,74 +156,127 @@ def validate(self): if not self._poco_component_tree[compdep].option: continue if not self.options.get_safe(self._poco_component_tree[compdep].option, False): - raise ConanInvalidConfiguration("option {} requires also option {}".format(compopt.option, self._poco_component_tree[compdep].option)) + raise ConanInvalidConfiguration(f"option {compopt.option} requires also option {self._poco_component_tree[compdep].option}") if self.options.enable_data_sqlite: - if self.options["sqlite3"].threadsafe == 0: + if self.dependencies["sqlite3"].options.threadsafe == 0: raise ConanInvalidConfiguration("sqlite3 must be built with threadsafe enabled") if self.options.enable_netssl and self.options.get_safe("enable_netssl_win", False): raise ConanInvalidConfiguration("Conflicting enable_netssl[_win] settings") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _patch_sources(self): - for data in self.conan_data.get("patches", {}).get(self.version, []): - patch(self, **data) + def _dep_include_paths(self, dep_name): + dep = self.dependencies[dep_name] + dep_cpp_info = dep.cpp_info.aggregated_components() + return [os.path.join(dep.package_folder, dir).replace("\\", "/") for dir in dep_cpp_info.includedirs] - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["CMAKE_BUILD_TYPE"] = self.settings.build_type + def _dep_lib_paths(self, dep_name): + dep = self.dependencies[dep_name] + dep_cpp_info = dep.cpp_info.aggregated_components() + return [os.path.join(dep.package_folder, dir).replace("\\", "/") for dir in dep_cpp_info.libdirs] + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_BUILD_TYPE"] = self.settings.build_type if Version(self.version) < "1.10.1": - cmake.definitions["POCO_STATIC"] = not self.options.shared + tc.variables["POCO_STATIC"] = not self.options.shared for comp in self._poco_component_tree.values(): if comp.option: - cmake.definitions[comp.option.upper()] = self.options.get_safe(comp.option, False) - cmake.definitions["POCO_UNBUNDLED"] = True - cmake.definitions["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True + tc.variables[comp.option.upper()] = self.options.get_safe(comp.option, False) + tc.variables["POCO_UNBUNDLED"] = True + tc.variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True if is_msvc(self): - cmake.definitions["POCO_MT"] = "MT" in msvc_runtime_flag(self) + tc.variables["POCO_MT"] = is_msvc_static_runtime(self) if self.options.get_safe("enable_data_postgresql", False): - cmake.definitions["PostgreSQL_ROOT_DIR"] = self.deps_cpp_info["libpq"].rootpath - cmake.definitions["PostgreSQL_ROOT_INCLUDE_DIRS"] = ";".join(self.deps_cpp_info["libpq"].include_paths) - cmake.definitions["PostgreSQL_ROOT_LIBRARY_DIRS"] = ";".join(self.deps_cpp_info["libpq"].lib_paths) + tc.variables["PostgreSQL_ROOT_DIR"] = self.dependencies["libpq"].package_folder.replace("\\", "/") + tc.variables["PostgreSQL_ROOT_INCLUDE_DIRS"] = ";".join(self._dep_include_paths("libpq")) + tc.variables["PostgreSQL_ROOT_LIBRARY_DIRS"] = ";".join(self._dep_lib_paths("libpq")) if self.options.get_safe("enable_data_mysql", False): - cmake.definitions["MYSQL_ROOT_DIR"] = self.deps_cpp_info["libmysqlclient"].rootpath - cmake.definitions["MYSQL_ROOT_INCLUDE_DIRS"] = ";".join(self.deps_cpp_info["libmysqlclient"].include_paths) - cmake.definitions["MYSQL_INCLUDE_DIR"] = ";".join(self.deps_cpp_info["libmysqlclient"].include_paths) - cmake.definitions["MYSQL_ROOT_LIBRARY_DIRS"] = ";".join(self.deps_cpp_info["libmysqlclient"].lib_paths) + tc.variables["MYSQL_ROOT_DIR"] = self.dependencies["libmysqlclient"].package_folder.replace("\\", "/") + tc.variables["MYSQL_ROOT_INCLUDE_DIRS"] = ";".join(self._dep_include_paths("libmysqlclient")) + tc.variables["MYSQL_INCLUDE_DIR"] = ";".join(self._dep_include_paths("libmysqlclient")) + tc.variables["MYSQL_ROOT_LIBRARY_DIRS"] = ";".join(self._dep_lib_paths("libmysqlclient")) if self.options.enable_apacheconnector: - cmake.definitions["APR_ROOT_DIR"] = self.deps_cpp_info["apr"].rootpath - cmake.definitions["APR_ROOT_INCLUDE_DIRS"] = ";".join(self.deps_cpp_info["apr"].include_paths) - cmake.definitions["APR_ROOT_LIBRARY_DIRS"] = ";".join(self.deps_cpp_info["apr"].lib_paths) - cmake.definitions["APRUTIL_ROOT_DIR"] = self.deps_cpp_info["apr-util"].rootpath - cmake.definitions["APRUTIL_ROOT_INCLUDE_DIRS"] = ";".join(self.deps_cpp_info["apr-util"].include_paths) - cmake.definitions["APRUTIL_ROOT_LIBRARY_DIRS"] = ";".join(self.deps_cpp_info["apr-util"].lib_paths) - + tc.variables["APR_ROOT_DIR"] = self.dependencies["apr"].package_folder.replace("\\", "/") + tc.variables["APR_ROOT_INCLUDE_DIRS"] = ";".join(self._dep_include_paths("apr")) + tc.variables["APR_ROOT_LIBRARY_DIRS"] = ";".join(self._dep_lib_paths("apr")) + tc.variables["APRUTIL_ROOT_DIR"] = self.dependencies["apr-util"].package_folder.replace("\\", "/") + tc.variables["APRUTIL_ROOT_INCLUDE_DIRS"] = ";".join(self._dep_include_paths("apr-util")) + tc.variables["APRUTIL_ROOT_LIBRARY_DIRS"] = ";".join(self._dep_lib_paths("apr-util")) # Disable fork if not self.options.get_safe("enable_fork", True): - cmake.definitions["POCO_NO_FORK_EXEC"] = True - # On Windows, Poco needs a message (MC) compiler. - with tools.vcvars(self.settings) if is_msvc(self) else tools.no_op(): - cmake.configure(build_dir=self._build_subfolder) - return cmake + tc.variables["POCO_NO_FORK_EXEC"] = True + # Disable automatic linking on MSVC + tc.preprocessor_definitions["POCO_NO_AUTOMATIC_LIBS"] = "1" + # Picked up from conan v1 CMake wrapper, don't know the rationale + if Version(self.version) >= "1.11.0": + tc.preprocessor_definitions["XML_DTD"] = "1" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + if is_msvc(self): + # On Windows, Poco needs a message (MC) compiler. + vcvars = VCVars(self) + vcvars.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # mysql + if self.options.get_safe("enable_data_mysql"): + mysql_cpp_info = self.dependencies["libmysqlclient"].cpp_info + mysql_config_file = mysql_cpp_info.get_property("cmake_file_name") or "libmysqlclient" + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), + "find_package(MySQL REQUIRED)", + f"find_package({mysql_config_file} REQUIRED CONFIG)\nset(MYSQL_FOUND TRUE)", + ) + mysql_target_name = mysql_cpp_info.get_property("cmake_target_name") or "libmysqlclient::libmysqlclient" + replace_in_file( + self, + os.path.join(self.source_folder, "Data", "MySQL", "CMakeLists.txt"), + "MySQL::client", + mysql_target_name, + ) + # libpq + if self.options.get_safe("enable_data_postgresql"): + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), + "find_package(PostgreSQL REQUIRED)", + "find_package(PostgreSQL REQUIRED)\nset(POSTGRESQL_FOUND TRUE)", + ) + replace_in_file( + self, + os.path.join(self.source_folder, "Data", "PostgreSQL", "CMakeLists.txt"), + "PostgreSQL::client", + "PostgreSQL::PostgreSQL", + ) + # Ensure to use FindEXPAT.cmake instead of expat-config.cmake + # (side effect of CMAKE_FIND_PACKAGE_PREFER_CONFIG ON, see https://github.com/conan-io/conan/issues/10387) + replace_in_file( + self, + os.path.join(self.source_folder, "XML", "CMakeLists.txt"), + "find_package(EXPAT REQUIRED)", + "find_package(EXPAT REQUIRED MODULE)", + ) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() - def package_id(self): - del self.info.options.enable_active_record - def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) rmdir(self, os.path.join(self.package_folder, "cmake")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Poco") @@ -249,14 +293,14 @@ def package_info(self): for compname, comp in self._poco_component_tree.items(): if comp.option is None or self.options.get_safe(comp.option): - conan_component = "poco_{}".format(compname.lower()) - requires = ["poco_{}".format(dependency.lower()) for dependency in comp.dependencies] + comp.external_dependencies - self.cpp_info.components[conan_component].set_property("cmake_target_name", "Poco::{}".format(compname)) + conan_component = f"poco_{compname.lower()}" + requires = [f"poco_{dependency.lower()}" for dependency in comp.dependencies] + comp.external_dependencies + self.cpp_info.components[conan_component].set_property("cmake_target_name", f"Poco::{compname}") self.cpp_info.components[conan_component].set_property("cmake_file_name", compname) self.cpp_info.components[conan_component].names["cmake_find_package"] = compname self.cpp_info.components[conan_component].names["cmake_find_package_multi"] = compname if comp.is_lib: - self.cpp_info.components[conan_component].libs = ["Poco{}{}".format(compname, suffix)] + self.cpp_info.components[conan_component].libs = [f"Poco{compname}{suffix}"] self.cpp_info.components[conan_component].requires = requires if self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/poco/all/patches/1.10.0.patch b/recipes/poco/all/patches/1.10.0.patch index 8d3a1c5ec9d9a..a293b75b06fea 100644 --- a/recipes/poco/all/patches/1.10.0.patch +++ b/recipes/poco/all/patches/1.10.0.patch @@ -1,5 +1,5 @@ ---- cmake/PocoMacros.cmake -+++ cmake/PocoMacros.cmake +--- a/cmake/PocoMacros.cmake ++++ b/cmake/PocoMacros.cmake @@ -40,7 +40,7 @@ if(WIN32) endforeach() endif (X64) @@ -18,19 +18,28 @@ endif() endmacro() ---- Foundation/CMakeLists.txt -+++ Foundation/CMakeLists.txt -@@ -101,7 +101,7 @@ +--- a/Foundation/CMakeLists.txt ++++ b/Foundation/CMakeLists.txt +@@ -35,7 +35,7 @@ POCO_MESSAGES( SRCS Logging src/pocomsg.mc) + # If POCO_UNBUNDLED is enabled we try to find the required packages + # The configuration will fail if the packages are not found + if (POCO_UNBUNDLED) +- find_package(PCRE REQUIRED) ++ find_package(pcre REQUIRED CONFIG) + find_package(ZLIB REQUIRED) + + #HACK: Unicode.cpp requires functions from these files. The can't be taken from the library +@@ -101,7 +101,7 @@ set_target_properties(Foundation ) if (POCO_UNBUNDLED) - target_link_libraries(Foundation PUBLIC Pcre::Pcre ZLIB::ZLIB) -+ target_link_libraries(Foundation PUBLIC PCRE::PCRE ZLIB::ZLIB) ++ target_link_libraries(Foundation PUBLIC pcre::libpcre ZLIB::ZLIB) target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) endif (POCO_UNBUNDLED) ---- NetSSL_Win/CMakeLists.txt -+++ NetSSL_Win/CMakeLists.txt +--- a/NetSSL_Win/CMakeLists.txt ++++ b/NetSSL_Win/CMakeLists.txt @@ -21,7 +21,7 @@ DEFINE_SYMBOL NetSSL_Win_EXPORTS ) diff --git a/recipes/poco/all/patches/1.10.1.patch b/recipes/poco/all/patches/1.10.1.patch index eced959820559..60675d563d9b5 100644 --- a/recipes/poco/all/patches/1.10.1.patch +++ b/recipes/poco/all/patches/1.10.1.patch @@ -1,5 +1,5 @@ ---- cmake/PocoMacros.cmake -+++ cmake/PocoMacros.cmake +--- a/cmake/PocoMacros.cmake ++++ b/cmake/PocoMacros.cmake @@ -40,7 +40,7 @@ if(WIN32) endforeach() endif(X64) @@ -18,19 +18,28 @@ endif() endmacro() ---- Foundation/CMakeLists.txt -+++ Foundation/CMakeLists.txt -@@ -101,7 +101,7 @@ +--- a/Foundation/CMakeLists.txt ++++ b/Foundation/CMakeLists.txt +@@ -35,7 +35,7 @@ POCO_MESSAGES(SRCS Logging src/pocomsg.mc) + # If POCO_UNBUNDLED is enabled we try to find the required packages + # The configuration will fail if the packages are not found + if(POCO_UNBUNDLED) +- find_package(PCRE REQUIRED) ++ find_package(pcre REQUIRED CONFIG) + find_package(ZLIB REQUIRED) + + #HACK: Unicode.cpp requires functions from these files. The can't be taken from the library +@@ -101,7 +101,7 @@ set_target_properties(Foundation ) if(POCO_UNBUNDLED) - target_link_libraries(Foundation PUBLIC Pcre::Pcre ZLIB::ZLIB) -+ target_link_libraries(Foundation PUBLIC PCRE::PCRE ZLIB::ZLIB) ++ target_link_libraries(Foundation PUBLIC pcre::libpcre ZLIB::ZLIB) target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) endif(POCO_UNBUNDLED) ---- NetSSL_Win/CMakeLists.txt -+++ NetSSL_Win/CMakeLists.txt +--- a/NetSSL_Win/CMakeLists.txt ++++ b/NetSSL_Win/CMakeLists.txt @@ -21,7 +21,7 @@ DEFINE_SYMBOL NetSSL_Win_EXPORTS ) diff --git a/recipes/poco/all/patches/1.11.0.patch b/recipes/poco/all/patches/1.11.0.patch index 3674bba4e7e39..1e07c041d0c68 100644 --- a/recipes/poco/all/patches/1.11.0.patch +++ b/recipes/poco/all/patches/1.11.0.patch @@ -21,15 +21,24 @@ index 97eecfe..fa4e85b 100644 INCLUDES DESTINATION include ) diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt -index 6b276be..81cb8b7 100644 +index 6b276bef5..92ea97727 100644 --- a/Foundation/CMakeLists.txt +++ b/Foundation/CMakeLists.txt +@@ -35,7 +35,7 @@ POCO_MESSAGES(SRCS Logging src/pocomsg.mc) + # If POCO_UNBUNDLED is enabled we try to find the required packages + # The configuration will fail if the packages are not found + if(POCO_UNBUNDLED) +- find_package(PCRE REQUIRED) ++ find_package(pcre REQUIRED CONFIG) + find_package(ZLIB REQUIRED) + + #HACK: Unicode.cpp requires functions from these files. The can't be taken from the library @@ -101,7 +101,7 @@ set_target_properties(Foundation ) if(POCO_UNBUNDLED) - target_link_libraries(Foundation PUBLIC Pcre::Pcre ZLIB::ZLIB) -+ target_link_libraries(Foundation PUBLIC PCRE::PCRE ZLIB::ZLIB) ++ target_link_libraries(Foundation PUBLIC pcre::libpcre ZLIB::ZLIB) target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) endif(POCO_UNBUNDLED) diff --git a/recipes/poco/all/patches/1.11.1.patch b/recipes/poco/all/patches/1.11.1.patch index 16729af37dce3..e5f552582596d 100644 --- a/recipes/poco/all/patches/1.11.1.patch +++ b/recipes/poco/all/patches/1.11.1.patch @@ -1,13 +1,22 @@ diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt -index 6b276be..81cb8b7 100644 +index 6b276bef5..92ea97727 100644 --- a/Foundation/CMakeLists.txt +++ b/Foundation/CMakeLists.txt +@@ -35,7 +35,7 @@ POCO_MESSAGES(SRCS Logging src/pocomsg.mc) + # If POCO_UNBUNDLED is enabled we try to find the required packages + # The configuration will fail if the packages are not found + if(POCO_UNBUNDLED) +- find_package(PCRE REQUIRED) ++ find_package(pcre REQUIRED CONFIG) + find_package(ZLIB REQUIRED) + + #HACK: Unicode.cpp requires functions from these files. The can't be taken from the library @@ -101,7 +101,7 @@ set_target_properties(Foundation ) if(POCO_UNBUNDLED) - target_link_libraries(Foundation PUBLIC Pcre::Pcre ZLIB::ZLIB) -+ target_link_libraries(Foundation PUBLIC PCRE::PCRE ZLIB::ZLIB) ++ target_link_libraries(Foundation PUBLIC pcre::libpcre ZLIB::ZLIB) target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) endif(POCO_UNBUNDLED) diff --git a/recipes/poco/all/patches/1.11.2.patch b/recipes/poco/all/patches/1.11.2.patch deleted file mode 100644 index 16729af37dce3..0000000000000 --- a/recipes/poco/all/patches/1.11.2.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt -index 6b276be..81cb8b7 100644 ---- a/Foundation/CMakeLists.txt -+++ b/Foundation/CMakeLists.txt -@@ -101,7 +101,7 @@ set_target_properties(Foundation - ) - - if(POCO_UNBUNDLED) -- target_link_libraries(Foundation PUBLIC Pcre::Pcre ZLIB::ZLIB) -+ target_link_libraries(Foundation PUBLIC PCRE::PCRE ZLIB::ZLIB) - target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) - endif(POCO_UNBUNDLED) - -diff --git a/NetSSL_Win/CMakeLists.txt b/NetSSL_Win/CMakeLists.txt -index 3e2b5ff..2ab7590 100644 ---- a/NetSSL_Win/CMakeLists.txt -+++ b/NetSSL_Win/CMakeLists.txt -@@ -21,7 +21,7 @@ set_target_properties(NetSSLWin - DEFINE_SYMBOL NetSSL_Win_EXPORTS - ) - --target_link_libraries(NetSSLWin PUBLIC Poco::Net Poco::Util Crypt32.lib) -+target_link_libraries(NetSSLWin PUBLIC Poco::Net Poco::Util crypt32 ws2_32) - target_include_directories(NetSSLWin - PUBLIC - $ - -diff --git a/cmake/PocoMacros.cmake b/cmake/PocoMacros.cmake -index 038779ec9..fa7afdb1b 100644 ---- a/cmake/PocoMacros.cmake -+++ b/cmake/PocoMacros.cmake -@@ -40,7 +40,7 @@ if(WIN32) - endforeach() - endif(X64) - endif() -- find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir} -+ find_program(CMAKE_MC_COMPILER NAMES mc.exe windmc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir} - DOC "path to message compiler") - if(NOT CMAKE_MC_COMPILER) - message(FATAL_ERROR "message compiler not found: required to build") - diff --git a/recipes/poco/all/patches/1.11.3.patch b/recipes/poco/all/patches/1.11.3.patch deleted file mode 100644 index 16729af37dce3..0000000000000 --- a/recipes/poco/all/patches/1.11.3.patch +++ /dev/null @@ -1,41 +0,0 @@ -diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt -index 6b276be..81cb8b7 100644 ---- a/Foundation/CMakeLists.txt -+++ b/Foundation/CMakeLists.txt -@@ -101,7 +101,7 @@ set_target_properties(Foundation - ) - - if(POCO_UNBUNDLED) -- target_link_libraries(Foundation PUBLIC Pcre::Pcre ZLIB::ZLIB) -+ target_link_libraries(Foundation PUBLIC PCRE::PCRE ZLIB::ZLIB) - target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) - endif(POCO_UNBUNDLED) - -diff --git a/NetSSL_Win/CMakeLists.txt b/NetSSL_Win/CMakeLists.txt -index 3e2b5ff..2ab7590 100644 ---- a/NetSSL_Win/CMakeLists.txt -+++ b/NetSSL_Win/CMakeLists.txt -@@ -21,7 +21,7 @@ set_target_properties(NetSSLWin - DEFINE_SYMBOL NetSSL_Win_EXPORTS - ) - --target_link_libraries(NetSSLWin PUBLIC Poco::Net Poco::Util Crypt32.lib) -+target_link_libraries(NetSSLWin PUBLIC Poco::Net Poco::Util crypt32 ws2_32) - target_include_directories(NetSSLWin - PUBLIC - $ - -diff --git a/cmake/PocoMacros.cmake b/cmake/PocoMacros.cmake -index 038779ec9..fa7afdb1b 100644 ---- a/cmake/PocoMacros.cmake -+++ b/cmake/PocoMacros.cmake -@@ -40,7 +40,7 @@ if(WIN32) - endforeach() - endif(X64) - endif() -- find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir} -+ find_program(CMAKE_MC_COMPILER NAMES mc.exe windmc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir} - DOC "path to message compiler") - if(NOT CMAKE_MC_COMPILER) - message(FATAL_ERROR "message compiler not found: required to build") - diff --git a/recipes/poco/all/patches/1.12.0.patch b/recipes/poco/all/patches/1.12.0.patch index 44db78fbbb6ad..0f5458cd155b5 100644 --- a/recipes/poco/all/patches/1.12.0.patch +++ b/recipes/poco/all/patches/1.12.0.patch @@ -18,7 +18,7 @@ diff -ruN a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt if(POCO_UNBUNDLED) - target_link_libraries(Foundation PUBLIC Pcre2::Pcre2 ZLIB::ZLIB) -+ target_link_libraries(Foundation PUBLIC PCRE2::PCRE2 ZLIB::ZLIB) ++ target_link_libraries(Foundation PUBLIC PCRE2::8BIT ZLIB::ZLIB) target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) endif(POCO_UNBUNDLED) diff --git a/recipes/poco/all/patches/1.12.1.patch b/recipes/poco/all/patches/1.12.1.patch index 44db78fbbb6ad..0f5458cd155b5 100644 --- a/recipes/poco/all/patches/1.12.1.patch +++ b/recipes/poco/all/patches/1.12.1.patch @@ -18,7 +18,7 @@ diff -ruN a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt if(POCO_UNBUNDLED) - target_link_libraries(Foundation PUBLIC Pcre2::Pcre2 ZLIB::ZLIB) -+ target_link_libraries(Foundation PUBLIC PCRE2::PCRE2 ZLIB::ZLIB) ++ target_link_libraries(Foundation PUBLIC PCRE2::8BIT ZLIB::ZLIB) target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) endif(POCO_UNBUNDLED) diff --git a/recipes/poco/all/patches/1.12.2.patch b/recipes/poco/all/patches/1.12.2.patch index 44db78fbbb6ad..0f5458cd155b5 100644 --- a/recipes/poco/all/patches/1.12.2.patch +++ b/recipes/poco/all/patches/1.12.2.patch @@ -18,7 +18,7 @@ diff -ruN a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt if(POCO_UNBUNDLED) - target_link_libraries(Foundation PUBLIC Pcre2::Pcre2 ZLIB::ZLIB) -+ target_link_libraries(Foundation PUBLIC PCRE2::PCRE2 ZLIB::ZLIB) ++ target_link_libraries(Foundation PUBLIC PCRE2::8BIT ZLIB::ZLIB) target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) endif(POCO_UNBUNDLED) diff --git a/recipes/poco/all/patches/1.12.3.patch b/recipes/poco/all/patches/1.12.3.patch new file mode 100644 index 0000000000000..f1fb7b37a7386 --- /dev/null +++ b/recipes/poco/all/patches/1.12.3.patch @@ -0,0 +1,39 @@ +diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt +index f504bc1a3..8fe9acf37 100644 +--- a/Foundation/CMakeLists.txt ++++ b/Foundation/CMakeLists.txt +@@ -107,7 +107,7 @@ set_target_properties(Foundation + ) + + if(POCO_UNBUNDLED) +- target_link_libraries(Foundation PUBLIC Pcre2::Pcre2 ZLIB::ZLIB) ++ target_link_libraries(Foundation PUBLIC PCRE2::8BIT ZLIB::ZLIB) + target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) + endif(POCO_UNBUNDLED) + +diff --git a/NetSSL_Win/CMakeLists.txt b/NetSSL_Win/CMakeLists.txt +index c6325eb4f..8541ffcb5 100644 +--- a/NetSSL_Win/CMakeLists.txt ++++ b/NetSSL_Win/CMakeLists.txt +@@ -21,7 +21,7 @@ set_target_properties(NetSSLWin + DEFINE_SYMBOL NetSSL_Win_EXPORTS + ) + +-target_link_libraries(NetSSLWin PUBLIC Poco::Net Poco::Util Crypt32.lib) ++target_link_libraries(NetSSLWin PUBLIC Poco::Net Poco::Util crypt32 ws2_32) + target_include_directories(NetSSLWin + PUBLIC + $ +diff --git a/cmake/PocoMacros.cmake b/cmake/PocoMacros.cmake +index 0ef354e9e..f57e39c3c 100644 +--- a/cmake/PocoMacros.cmake ++++ b/cmake/PocoMacros.cmake +@@ -40,7 +40,7 @@ if(WIN32) + endforeach() + endif(X64) + endif() +- find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir} ++ find_program(CMAKE_MC_COMPILER NAMES mc.exe windmc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir} + DOC "path to message compiler") + if(NOT CMAKE_MC_COMPILER) + message(FATAL_ERROR "message compiler not found: required to build") diff --git a/recipes/poco/all/patches/1.12.4.patch b/recipes/poco/all/patches/1.12.4.patch new file mode 100644 index 0000000000000..f1fb7b37a7386 --- /dev/null +++ b/recipes/poco/all/patches/1.12.4.patch @@ -0,0 +1,39 @@ +diff --git a/Foundation/CMakeLists.txt b/Foundation/CMakeLists.txt +index f504bc1a3..8fe9acf37 100644 +--- a/Foundation/CMakeLists.txt ++++ b/Foundation/CMakeLists.txt +@@ -107,7 +107,7 @@ set_target_properties(Foundation + ) + + if(POCO_UNBUNDLED) +- target_link_libraries(Foundation PUBLIC Pcre2::Pcre2 ZLIB::ZLIB) ++ target_link_libraries(Foundation PUBLIC PCRE2::8BIT ZLIB::ZLIB) + target_compile_definitions(Foundation PUBLIC POCO_UNBUNDLED) + endif(POCO_UNBUNDLED) + +diff --git a/NetSSL_Win/CMakeLists.txt b/NetSSL_Win/CMakeLists.txt +index c6325eb4f..8541ffcb5 100644 +--- a/NetSSL_Win/CMakeLists.txt ++++ b/NetSSL_Win/CMakeLists.txt +@@ -21,7 +21,7 @@ set_target_properties(NetSSLWin + DEFINE_SYMBOL NetSSL_Win_EXPORTS + ) + +-target_link_libraries(NetSSLWin PUBLIC Poco::Net Poco::Util Crypt32.lib) ++target_link_libraries(NetSSLWin PUBLIC Poco::Net Poco::Util crypt32 ws2_32) + target_include_directories(NetSSLWin + PUBLIC + $ +diff --git a/cmake/PocoMacros.cmake b/cmake/PocoMacros.cmake +index 0ef354e9e..f57e39c3c 100644 +--- a/cmake/PocoMacros.cmake ++++ b/cmake/PocoMacros.cmake +@@ -40,7 +40,7 @@ if(WIN32) + endforeach() + endif(X64) + endif() +- find_program(CMAKE_MC_COMPILER mc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir} ++ find_program(CMAKE_MC_COMPILER NAMES mc.exe windmc.exe HINTS "${sdk_bindir}" "${kit_bindir}" "${kit81_bindir}" ${kit10_bindir} + DOC "path to message compiler") + if(NOT CMAKE_MC_COMPILER) + message(FATAL_ERROR "message compiler not found: required to build") diff --git a/recipes/poco/all/patches/1.8.1.patch b/recipes/poco/all/patches/1.8.1.patch index 4321893d263ce..a13cf433b0cbd 100644 --- a/recipes/poco/all/patches/1.8.1.patch +++ b/recipes/poco/all/patches/1.8.1.patch @@ -1,5 +1,5 @@ ---- cmake/PocoMacros.cmake -+++ cmake/PocoMacros.cmake +--- a/cmake/PocoMacros.cmake ++++ b/cmake/PocoMacros.cmake @@ -265,7 +265,7 @@ if (MSVC) @@ -9,30 +9,19 @@ endif() endmacro() ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -204,7 +204,7 @@ - - find_package(OpenSSL) - if(OPENSSL_FOUND) -- include_directories("${OPENSSL_INCLUDE_DIR}") -+ #include_directories("${OPENSSL_INCLUDE_DIR}") - if(EXISTS ${PROJECT_SOURCE_DIR}/NetSSL_OpenSSL AND ENABLE_NETSSL) - add_subdirectory(NetSSL_OpenSSL) - list(APPEND Poco_COMPONENTS "NetSSL_OpenSSL") ---- Crypto/CMakeLists.txt -+++ Crypto/CMakeLists.txt +--- a/Crypto/CMakeLists.txt ++++ b/Crypto/CMakeLists.txt @@ -20,7 +20,7 @@ DEFINE_SYMBOL Crypto_EXPORTS ) -target_link_libraries( "${LIBNAME}" Foundation ${OPENSSL_LIBRARIES} ) -+target_link_libraries( "${LIBNAME}" Foundation OpenSSL::OpenSSL ) ++target_link_libraries( "${LIBNAME}" Foundation OpenSSL::SSL OpenSSL::Crypto) target_include_directories( "${LIBNAME}" PUBLIC $ ---- Data/SQLite/CMakeLists.txt -+++ Data/SQLite/CMakeLists.txt +--- a/Data/SQLite/CMakeLists.txt ++++ b/Data/SQLite/CMakeLists.txt @@ -10,9 +10,9 @@ POCO_HEADERS_AUTO( SQLITE_SRCS ${HDRS_G}) @@ -46,8 +35,41 @@ else() # sqlite3 POCO_SOURCES( SQLITE_SRCS sqlite3 ---- NetSSL_Win/CMakeLists.txt -+++ NetSSL_Win/CMakeLists.txt +--- a/Foundation/CMakeLists.txt ++++ b/Foundation/CMakeLists.txt +@@ -32,9 +32,8 @@ POCO_MESSAGES( SRCS Logging src/pocomsg.mc) + # If POCO_UNBUNDLED is enabled we try to find the required packages + # The configuration will fail if the packages are not found + if (POCO_UNBUNDLED) +- find_package(PCRE REQUIRED) +- set(SYSLIBS ${SYSLIBS} ${PCRE_LIBRARIES}) +- include_directories(${PCRE_INCLUDE_DIRS}) ++ find_package(pcre REQUIRED CONFIG) ++ set(SYSLIBS ${SYSLIBS} pcre::libpcre) + + #HACK: Unicode.cpp requires functions from these files. The can't be taken from the library + POCO_SOURCES( SRCS RegExp +@@ -106,7 +105,6 @@ if(ANDROID) + endif(ANDROID) + + # TODO: Why is this here? +-add_definitions( -DPCRE_STATIC) + + # For SetAffinity + if(UNIX AND NOT APPLE) +--- a/NetSSL_OpenSSL/CMakeLists.txt ++++ b/NetSSL_OpenSSL/CMakeLists.txt +@@ -18,7 +18,7 @@ set_target_properties( "${LIBNAME}" + DEFINE_SYMBOL NetSSL_EXPORTS + ) + +-target_link_libraries( "${LIBNAME}" Crypto Net Util Foundation ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ) ++target_link_libraries( "${LIBNAME}" Crypto Net Util Foundation OpenSSL::SSL OpenSSL::Crypto ) + target_include_directories( "${LIBNAME}" + PUBLIC + $ +--- a/NetSSL_Win/CMakeLists.txt ++++ b/NetSSL_Win/CMakeLists.txt @@ -18,7 +18,7 @@ DEFINE_SYMBOL NetSSL_Win_EXPORTS ) diff --git a/recipes/poco/all/patches/1.9.2-2.patch b/recipes/poco/all/patches/1.9.2-2.patch deleted file mode 100644 index 8e7bec383a908..0000000000000 --- a/recipes/poco/all/patches/1.9.2-2.patch +++ /dev/null @@ -1,273 +0,0 @@ ---- ApacheConnector/CMakeLists.txt -+++ ApacheConnector/CMakeLists.txt -@@ -10,8 +10,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_library( "${LIBNAME}" SHARED ${SRCS} ) ---- CppParser/CMakeLists.txt -+++ CppParser/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) ---- CppUnit/WinTestRunner/CMakeLists.txt -+++ CppUnit/WinTestRunner/CMakeLists.txt -@@ -13,8 +13,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - # TODO: Is this flag always required? ---- Crypto/CMakeLists.txt -+++ Crypto/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) ---- Data/CMakeLists.txt -+++ Data/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - if (NOT POCO_STATIC) ---- Data/MySQL/CMakeLists.txt -+++ Data/MySQL/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND MYSQL_SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND MYSQL_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_definitions(-DTHREADSAFE -DNO_TCL) ---- Data/ODBC/CMakeLists.txt -+++ Data/ODBC/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND ODBC_SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND ODBC_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_definitions( ${ODBC_CFLAGS} -DTHREADSAFE) ---- Data/SQLite/CMakeLists.txt -+++ Data/SQLite/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SQLITE_SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SQLITE_SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - if (POCO_UNBUNDLED) ---- Encodings/CMakeLists.txt -+++ Encodings/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) ---- Foundation/CMakeLists.txt -+++ Foundation/CMakeLists.txt -@@ -28,8 +28,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - # Messages ---- JSON/CMakeLists.txt -+++ JSON/CMakeLists.txt -@@ -19,8 +19,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) ---- MongoDB/CMakeLists.txt -+++ MongoDB/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) ---- Net/CMakeLists.txt -+++ Net/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - # Windows and WindowsCE need additional libraries ---- NetSSL_OpenSSL/CMakeLists.txt -+++ NetSSL_OpenSSL/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) ---- NetSSL_Win/CMakeLists.txt -+++ NetSSL_Win/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) ---- PDF/CMakeLists.txt -+++ PDF/CMakeLists.txt -@@ -120,8 +120,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - #TODO: Can we put this with the below includes? PRIVAT eg. ---- Redis/CMakeLists.txt -+++ Redis/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) ---- SevenZip/CMakeLists.txt -+++ SevenZip/CMakeLists.txt -@@ -52,8 +52,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) ---- Util/CMakeLists.txt -+++ Util/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - POCO_SOURCES_AUTO_PLAT( SRCS WIN32 ---- XML/CMakeLists.txt -+++ XML/CMakeLists.txt -@@ -16,8 +16,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - # If POCO_UNBUNDLED is enabled we try to find the required packages ---- Zip/CMakeLists.txt -+++ Zip/CMakeLists.txt -@@ -11,8 +11,8 @@ - - # Version Resource - if(MSVC AND NOT POCO_STATIC) -- source_group("Resources" FILES ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -- list(APPEND SRCS ${CMAKE_SOURCE_DIR}/DLLVersion.rc) -+ source_group("Resources" FILES ${PROJECT_SOURCE_DIR}/DLLVersion.rc) -+ list(APPEND SRCS ${PROJECT_SOURCE_DIR}/DLLVersion.rc) - endif() - - add_library( "${LIBNAME}" ${LIB_MODE} ${SRCS} ) diff --git a/recipes/poco/all/patches/1.9.2.patch b/recipes/poco/all/patches/1.9.2.patch index 3cc515ebe11a5..2eab9fab22f69 100644 --- a/recipes/poco/all/patches/1.9.2.patch +++ b/recipes/poco/all/patches/1.9.2.patch @@ -1,5 +1,5 @@ ---- cmake/PocoMacros.cmake -+++ cmake/PocoMacros.cmake +--- a/cmake/PocoMacros.cmake ++++ b/cmake/PocoMacros.cmake @@ -278,7 +278,7 @@ if (MSVC) @@ -9,30 +9,19 @@ endif() endmacro() ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -211,7 +211,7 @@ - - find_package(OpenSSL) - if(OPENSSL_FOUND) -- include_directories("${OPENSSL_INCLUDE_DIR}") -+ include_directories("${OpenSSL_INCLUDE_DIR}") - if(EXISTS ${PROJECT_SOURCE_DIR}/NetSSL_OpenSSL AND ENABLE_NETSSL) - add_subdirectory(NetSSL_OpenSSL) - list(APPEND Poco_COMPONENTS "NetSSL_OpenSSL") ---- Crypto/CMakeLists.txt -+++ Crypto/CMakeLists.txt +--- a/Crypto/CMakeLists.txt ++++ b/Crypto/CMakeLists.txt @@ -24,7 +24,7 @@ DEFINE_SYMBOL Crypto_EXPORTS ) -target_link_libraries( "${LIBNAME}" Foundation ${OPENSSL_LIBRARIES} ) -+target_link_libraries( "${LIBNAME}" Foundation OpenSSL::OpenSSL ) ++target_link_libraries( "${LIBNAME}" Foundation OpenSSL::SSL OpenSSL::Crypto) target_include_directories( "${LIBNAME}" PUBLIC $ ---- Data/SQLite/CMakeLists.txt -+++ Data/SQLite/CMakeLists.txt +--- a/Data/SQLite/CMakeLists.txt ++++ b/Data/SQLite/CMakeLists.txt @@ -16,9 +16,9 @@ endif() @@ -46,8 +35,41 @@ else() # sqlite3 POCO_SOURCES( SQLITE_SRCS sqlite3 ---- NetSSL_Win/CMakeLists.txt -+++ NetSSL_Win/CMakeLists.txt +--- a/Foundation/CMakeLists.txt ++++ b/Foundation/CMakeLists.txt +@@ -38,9 +38,8 @@ POCO_MESSAGES( SRCS Logging src/pocomsg.mc) + # If POCO_UNBUNDLED is enabled we try to find the required packages + # The configuration will fail if the packages are not found + if (POCO_UNBUNDLED) +- find_package(PCRE REQUIRED) +- set(SYSLIBS ${SYSLIBS} ${PCRE_LIBRARIES}) +- include_directories(${PCRE_INCLUDE_DIRS}) ++ find_package(pcre REQUIRED CONFIG) ++ set(SYSLIBS ${SYSLIBS} pcre::libpcre) + + #HACK: Unicode.cpp requires functions from these files. The can't be taken from the library + POCO_SOURCES( SRCS RegExp +@@ -112,7 +111,6 @@ if(ANDROID) + endif(ANDROID) + + # TODO: Why is this here? +-add_definitions( -DPCRE_STATIC) + + # For SetAffinity + if(UNIX AND NOT APPLE) +--- a/NetSSL_OpenSSL/CMakeLists.txt ++++ b/NetSSL_OpenSSL/CMakeLists.txt +@@ -24,7 +24,7 @@ set_target_properties( "${LIBNAME}" + DEFINE_SYMBOL NetSSL_EXPORTS + ) + +-target_link_libraries( "${LIBNAME}" Crypto Net Util Foundation ${OPENSSL_SSL_LIBRARY} ${OPENSSL_CRYPTO_LIBRARY} ) ++target_link_libraries( "${LIBNAME}" Crypto Net Util Foundation OpenSSL::SSL OpenSSL::Crypto ) + target_include_directories( "${LIBNAME}" + PUBLIC + $ +--- a/NetSSL_Win/CMakeLists.txt ++++ b/NetSSL_Win/CMakeLists.txt @@ -24,7 +24,7 @@ DEFINE_SYMBOL NetSSL_Win_EXPORTS ) diff --git a/recipes/poco/all/test_package/CMakeLists.txt b/recipes/poco/all/test_package/CMakeLists.txt index 076daa24fb2e9..42eba4251a7ef 100644 --- a/recipes/poco/all/test_package/CMakeLists.txt +++ b/recipes/poco/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +enable_testing() option(TEST_UTIL "Test Util" ON) option(TEST_CRYPTO "Test crypto" ON) @@ -13,8 +12,6 @@ option(TEST_ENCODINGS "Test Encodings" ON) option(TEST_JWT "Test JWT" ON) option(TEST_PROMETHEUS "Test Prometheus" ON) -set(CMAKE_CXX_STANDARD 11) - set(POCO_COMPONENTS Foundation) if(TEST_UTIL) list(APPEND POCO_COMPONENTS Util) @@ -44,53 +41,71 @@ endif() find_package(Poco REQUIRED ${POCO_COMPONENTS} CONFIG) add_executable(core test_core.cpp) -target_link_libraries(core Poco::Foundation) +target_link_libraries(core PRIVATE Poco::Foundation) +target_compile_features(core PRIVATE cxx_std_11) if(TEST_UTIL) add_executable(util test_util.cpp) - target_link_libraries(util Poco::Util) + target_link_libraries(util PRIVATE Poco::Util) + target_compile_features(util PRIVATE cxx_std_11) if(MINGW) target_link_options(util PRIVATE -municode) endif() + add_test(NAME util COMMAND util) endif() if(TEST_CRYPTO) add_executable(tcrypto test_crypto.cpp) - target_link_libraries(tcrypto Poco::Crypto) - set_property(TARGET tcrypto PROPERTY OUTPUT_NAME "crypto") + target_link_libraries(tcrypto PRIVATE Poco::Crypto) + target_compile_features(tcrypto PRIVATE cxx_std_11) + add_test(NAME tcrypto COMMAND tcrypto ${CMAKE_CURRENT_SOURCE_DIR}/conanfile.py) endif() if(TEST_NET) add_executable(net test_net.cpp) - target_link_libraries(net Poco::Net) + target_link_libraries(net PRIVATE Poco::Net) + target_compile_features(net PRIVATE cxx_std_11) + add_test(NAME net COMMAND net) if(TEST_UTIL) add_executable(net_2 test_net_2.cpp) - target_link_libraries(net_2 Poco::Net Poco::Util) + target_link_libraries(net_2 PRIVATE Poco::Net Poco::Util) + target_compile_features(net_2 PRIVATE cxx_std_11) + add_test(NAME net_2 COMMAND net_2) endif() endif() if(TEST_NETSSL) add_executable(netssl test_netssl.cpp) - target_link_libraries(netssl Poco::NetSSL) + target_link_libraries(netssl PRIVATE Poco::NetSSL) + target_compile_features(netssl PRIVATE cxx_std_11) + add_test(NAME netssl COMMAND netssl) endif() if(TEST_SQLITE) add_executable(sqlite test_sqlite.cpp) - target_link_libraries(sqlite Poco::DataSQLite) + target_link_libraries(sqlite PRIVATE Poco::DataSQLite) + target_compile_features(sqlite PRIVATE cxx_std_11) + add_test(NAME sqlite COMMAND sqlite) endif() if(TEST_ENCODINGS) add_executable(encodings test_encodings.cpp) - target_link_libraries(encodings Poco::Encodings) + target_link_libraries(encodings PRIVATE Poco::Encodings) + target_compile_features(encodings PRIVATE cxx_std_11) + add_test(NAME encodings COMMAND encodings) endif() if(TEST_JWT) add_executable(jwt test_jwt.cpp) - target_link_libraries(jwt Poco::JWT) + target_link_libraries(jwt PRIVATE Poco::JWT) + target_compile_features(jwt PRIVATE cxx_std_11) + add_test(NAME jwt COMMAND jwt) endif() if(TEST_PROMETHEUS) add_executable(prometheus test_prometheus.cpp) - target_link_libraries(prometheus Poco::Prometheus) + target_link_libraries(prometheus PRIVATE Poco::Prometheus) + target_compile_features(prometheus PRIVATE cxx_std_11) + add_test(NAME prometheus COMMAND prometheus) endif() diff --git a/recipes/poco/all/test_package/conanfile.py b/recipes/poco/all/test_package/conanfile.py index 7bc5c2eea133d..db2773f5ca2c2 100644 --- a/recipes/poco/all/test_package/conanfile.py +++ b/recipes/poco/all/test_package/conanfile.py @@ -1,62 +1,39 @@ -from conans import CMake, ConanFile -from conan.tools.build import cross_building -import os +from conan import ConanFile +from conan.tools.build import build_jobs, can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import chdir class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" - - @property - def _with_netssl(self): - return ( - ("enable_netssl" in self.options["poco"] and self.options["poco"].enable_netssl) or - ("enable_netssl_win" in self.options["poco"] and self.options["poco"].enable_netssl_win) - ) - - @property - def _with_encodings(self): - return "enable_encodings" in self.options["poco"] and self.options["poco"].enable_encodings - - @property - def _with_jwt(self): - return "enable_jwt" in self.options["poco"] and self.options["poco"].enable_jwt - - @property - def _with_prometheus(self): - return "enable_prometheus" in self.options["poco"] and self.options["poco"].enable_prometheus + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + poco_options = self.dependencies["poco"].options + tc.variables["TEST_CRYPTO"] = poco_options.enable_crypto + tc.variables["TEST_UTIL"] = poco_options.enable_util + tc.variables["TEST_NET"] = poco_options.enable_net + tc.variables["TEST_NETSSL"] = poco_options.get_safe("enable_netssl") or poco_options.get_safe("enable_netssl_win") + tc.variables["TEST_SQLITE"] = poco_options.enable_data_sqlite + tc.variables["TEST_ENCODINGS"] = poco_options.get_safe("enable_encodings", False) + tc.variables["TEST_JWT"] = poco_options.get_safe("enable_jwt", False) + tc.variables["TEST_PROMETHEUS"] = poco_options.get_safe("enable_prometheus", False) + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["TEST_CRYPTO"] = self.options["poco"].enable_crypto - cmake.definitions["TEST_UTIL"] = self.options["poco"].enable_util - cmake.definitions["TEST_NET"] = self.options["poco"].enable_net - cmake.definitions["TEST_NETSSL"] = self._with_netssl - cmake.definitions["TEST_SQLITE"] = self.options["poco"].enable_data_sqlite - cmake.definitions["TEST_ENCODINGS"] = self._with_encodings - cmake.definitions["TEST_JWT"] = self._with_jwt - cmake.definitions["TEST_PROMETHEUS"] = self._with_prometheus cmake.configure() cmake.build() def test(self): - if not cross_building(self, skip_x64_x86=True): - self.run(os.path.join("bin", "core"), run_environment=True) - if self.options["poco"].enable_util: - self.run(os.path.join("bin", "util"), run_environment=True) - if self.options["poco"].enable_crypto: - self.run("{} {}".format(os.path.join("bin", "crypto"), os.path.join(self.source_folder, "conanfile.py")), run_environment=True) - if self.options["poco"].enable_net: - self.run(os.path.join("bin", "net"), run_environment=True) - if self.options["poco"].enable_util: - self.run(os.path.join("bin", "net_2"), run_environment=True) - if self._with_netssl: - self.run(os.path.join("bin", "netssl"), run_environment=True) - if self.options["poco"].enable_data_sqlite: - self.run(os.path.join("bin", "sqlite"), run_environment=True) - if self._with_encodings: - self.run(os.path.join("bin", "encodings"), run_environment=True) - if self._with_jwt: - self.run(os.path.join("bin", "jwt"), run_environment=True) - if self._with_prometheus: - self.run(os.path.join("bin", "prometheus"), run_environment=True) + if can_run(self): + with chdir(self, self.build_folder): + self.run(f"ctest --output-on-failure -C {self.settings.build_type} -j {build_jobs(self)}", env="conanrun") diff --git a/recipes/poco/all/test_v1_package/CMakeLists.txt b/recipes/poco/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..c23ed5cfe6d98 --- /dev/null +++ b/recipes/poco/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_v1_package) + +enable_testing() + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/poco/all/test_v1_package/conanfile.py b/recipes/poco/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3bca6441d5a9a --- /dev/null +++ b/recipes/poco/all/test_v1_package/conanfile.py @@ -0,0 +1,30 @@ +from conans import CMake, ConanFile, tools +from conans.errors import ConanException + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def _poco_option(self, name, default): + try: + return getattr(self.options["poco"], name, default) + except (AttributeError, ConanException): + return default + + def build(self): + cmake = CMake(self) + cmake.definitions["TEST_CRYPTO"] = self.options["poco"].enable_crypto + cmake.definitions["TEST_UTIL"] = self.options["poco"].enable_util + cmake.definitions["TEST_NET"] = self.options["poco"].enable_net + cmake.definitions["TEST_NETSSL"] = self._poco_option("enable_netssl", False) or self._poco_option("enable_netssl_win", False) + cmake.definitions["TEST_SQLITE"] = self.options["poco"].enable_data_sqlite + cmake.definitions["TEST_ENCODINGS"] = self._poco_option("enable_encodings", False) + cmake.definitions["TEST_JWT"] = self._poco_option("enable_jwt", False) + cmake.definitions["TEST_PROMETHEUS"] = self._poco_option("enable_prometheus", False) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(f"ctest --output-on-failure -C {self.settings.build_type} -j {tools.cpu_count()}", run_environment=True) diff --git a/recipes/poco/config.yml b/recipes/poco/config.yml index 7897e326488e5..a8a61444c2607 100644 --- a/recipes/poco/config.yml +++ b/recipes/poco/config.yml @@ -1,4 +1,8 @@ versions: + "1.12.4": + folder: all + "1.12.3": + folder: all "1.12.2": folder: all "1.12.1": diff --git a/recipes/podofo/all/conanfile.py b/recipes/podofo/all/conanfile.py index a26c14d06ca68..5046d4d4b8974 100644 --- a/recipes/podofo/all/conanfile.py +++ b/recipes/podofo/all/conanfile.py @@ -1,13 +1,12 @@ -import os from conan import ConanFile -from conan.errors import ConanInvalidConfiguration -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, valid_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.microsoft import is_msvc from conan.tools.scm import Version +import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class PodofoConan(ConanFile): @@ -16,7 +15,7 @@ class PodofoConan(ConanFile): homepage = "http://podofo.sourceforge.net" url = "https://github.com/conan-io/conan-center-index" description = "PoDoFo is a library to work with the PDF file format." - topics = ("PDF", "PoDoFo", "podofo") + topics = ("pdf") settings = "os", "arch", "compiler", "build_type" options = { @@ -45,8 +44,7 @@ class PodofoConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -58,23 +56,26 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("freetype/2.12.1") - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.settings.os != "Windows": self.requires("fontconfig/2.13.93") if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.with_libidn: self.requires("libidn/1.36") if self.options.with_jpeg: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") if self.options.with_tiff: self.requires("libtiff/4.4.0") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.38") if self.options.with_unistring: self.requires("libunistring/0.9.10") @@ -82,9 +83,6 @@ def validate(self): if self.info.settings.compiler.get_safe("cppstd") and Version(self.version) >= "0.9.7": check_min_cppstd(self, 11) - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -96,11 +94,8 @@ def generate(self): tc.variables["PODOFO_BUILD_STATIC"] = not self.options.shared if not self.options.threadsafe: tc.variables["PODOFO_NO_MULTITHREAD"] = True - try: - check_min_cppstd(self, 11) - except ConanInvalidConfiguration: - if Version(self.version) >= "0.9.7": - tc.cache_variables["CMAKE_CXX_STANDARD"] = 11 + if Version(self.version) >= "0.9.7" and not valid_min_cppstd(self, 11): + tc.cache_variables["CMAKE_CXX_STANDARD"] = 11 # To install relocatable shared lib on Macos tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" @@ -112,9 +107,9 @@ def generate(self): tc.variables["PODOFO_WITH_TIFF"] = self.options.with_tiff tc.variables["PODOFO_WITH_PNG"] = self.options.with_png tc.variables["PODOFO_WITH_UNISTRING"] = self.options.with_unistring - tc.variables["PODOFO_HAVE_OPENSSL_1_1"] = Version(self.deps_cpp_info["openssl"].version) >= "1.1" - if self.options.with_openssl and ("no_rc4" in self.options["openssl"]): - tc.variables["PODOFO_HAVE_OPENSSL_NO_RC4"] = self.options["openssl"].no_rc4 + tc.variables["PODOFO_HAVE_OPENSSL_1_1"] = Version(self.dependencies["openssl"].ref.version) >= "1.1" + if self.options.with_openssl and ("no_rc4" in self.dependencies["openssl"].options): + tc.variables["PODOFO_HAVE_OPENSSL_NO_RC4"] = self.dependencies["openssl"].options.no_rc4 tc.generate() deps = CMakeDeps(self) @@ -127,7 +122,7 @@ def build(self): cmake.build() def package(self): - self.copy("COPYING", src=self.source_folder, dst="licenses") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) @@ -136,7 +131,6 @@ def package_info(self): podofo_version = Version(self.version) pkg_config_name = f"libpodofo-{podofo_version.major}" if podofo_version < "0.9.7" else "libpodofo" self.cpp_info.set_property("pkg_config_name", pkg_config_name) - self.cpp_info.names["pkg_config"] = pkg_config_name self.cpp_info.libs = ["podofo"] if self.settings.os == "Windows" and self.options.shared: self.cpp_info.defines.append("USING_SHARED_PODOFO") diff --git a/recipes/podofo/all/patches/0001-fix-cmake-0.9.6.patch b/recipes/podofo/all/patches/0001-fix-cmake-0.9.6.patch index a896a6b032b0b..5667931589e54 100644 --- a/recipes/podofo/all/patches/0001-fix-cmake-0.9.6.patch +++ b/recipes/podofo/all/patches/0001-fix-cmake-0.9.6.patch @@ -123,8 +123,8 @@ -FIND_PACKAGE(FREETYPE REQUIRED) -MESSAGE("Found freetype library at ${FREETYPE_LIBRARIES}, headers ${FREETYPE_INCLUDE_DIR}") -+FIND_PACKAGE(Freetype REQUIRED) -+LINK_LIBRARIES(freetype) ++FIND_PACKAGE(Freetype REQUIRED MODULE) ++LINK_LIBRARIES(Freetype::Freetype) +if(0) FIND_PACKAGE(LIBSTLPORT) diff --git a/recipes/podofo/all/patches/0001-fix-cmake-0.9.7.patch b/recipes/podofo/all/patches/0001-fix-cmake-0.9.7.patch index 7e3424be58930..043b4089a12c7 100644 --- a/recipes/podofo/all/patches/0001-fix-cmake-0.9.7.patch +++ b/recipes/podofo/all/patches/0001-fix-cmake-0.9.7.patch @@ -123,8 +123,8 @@ -FIND_PACKAGE(FREETYPE REQUIRED) -MESSAGE("Found freetype library at ${FREETYPE_LIBRARIES}, headers ${FREETYPE_INCLUDE_DIR}") -+FIND_PACKAGE(Freetype REQUIRED) -+LINK_LIBRARIES(freetype) ++FIND_PACKAGE(Freetype REQUIRED MODULE) ++LINK_LIBRARIES(Freetype::Freetype) +if(0) FIND_PACKAGE(LIBSTLPORT) diff --git a/recipes/podofo/all/test_package/CMakeLists.txt b/recipes/podofo/all/test_package/CMakeLists.txt index 318a5e6967f69..447fbc933a4fb 100644 --- a/recipes/podofo/all/test_package/CMakeLists.txt +++ b/recipes/podofo/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(podofo REQUIRED) +find_package(podofo REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) - -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) - target_link_libraries(${PROJECT_NAME} PRIVATE podofo::podofo) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/podofo/all/test_package/conanfile.py b/recipes/podofo/all/test_package/conanfile.py index 9c1e7678fcfcb..0a6bc68712d90 100644 --- a/recipes/podofo/all/test_package/conanfile.py +++ b/recipes/podofo/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" -class OatppSwaggerTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/podofo/all/test_v1_package/CMakeLists.txt b/recipes/podofo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/podofo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/podofo/all/test_v1_package/conanfile.py b/recipes/podofo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/podofo/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/poly2tri/all/conanfile.py b/recipes/poly2tri/all/conanfile.py index d1ceb49ce5b12..d43ae54e6e9c6 100644 --- a/recipes/poly2tri/all/conanfile.py +++ b/recipes/poly2tri/all/conanfile.py @@ -3,17 +3,18 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class Poly2triConan(ConanFile): name = "poly2tri" description = "Poly2Tri is a sweepline constrained Delaunay Polygon Triangulation Library." license = "BSD-3-Clause" - topics = ("poly2tri", "triangulation", "delaunay", "polygon") + topics = ("triangulation", "delaunay", "polygon") homepage = "https://github.com/greenm01/poly2tri" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,14 +33,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/poly2tri/all/test_package/conanfile.py b/recipes/poly2tri/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/poly2tri/all/test_package/conanfile.py +++ b/recipes/poly2tri/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/poly2tri/all/test_v1_package/CMakeLists.txt b/recipes/poly2tri/all/test_v1_package/CMakeLists.txt index de44542bdbe98..0d20897301b68 100644 --- a/recipes/poly2tri/all/test_v1_package/CMakeLists.txt +++ b/recipes/poly2tri/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(poly2tri REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE poly2tri::poly2tri) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/poly2tri/all/test_v1_package/conanfile.py b/recipes/poly2tri/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/poly2tri/all/test_v1_package/conanfile.py +++ b/recipes/poly2tri/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/polylabel/all/conanfile.py b/recipes/polylabel/all/conanfile.py index 8f59111f5d944..402d5fbafc219 100644 --- a/recipes/polylabel/all/conanfile.py +++ b/recipes/polylabel/all/conanfile.py @@ -1,6 +1,11 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.52.0" + class PolylabelConan(ConanFile): name = "polylabel" @@ -12,24 +17,30 @@ class PolylabelConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("mapbox-geometry/2.0.3") + self.requires("mapbox-geometry/2.0.3", transitive_headers=True) def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/polylabel/all/test_package/CMakeLists.txt b/recipes/polylabel/all/test_package/CMakeLists.txt index a9d16d1f28818..90669593bc3f0 100644 --- a/recipes/polylabel/all/test_package/CMakeLists.txt +++ b/recipes/polylabel/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(polylabel REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} polylabel::polylabel) +target_link_libraries(${PROJECT_NAME} PRIVATE polylabel::polylabel) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/polylabel/all/test_package/conanfile.py b/recipes/polylabel/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/polylabel/all/test_package/conanfile.py +++ b/recipes/polylabel/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/polylabel/all/test_v1_package/CMakeLists.txt b/recipes/polylabel/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0c0d215f97b42 --- /dev/null +++ b/recipes/polylabel/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(polylabel REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE polylabel::polylabel) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/polylabel/all/test_v1_package/conanfile.py b/recipes/polylabel/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/polylabel/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/polylineencoder/all/conanfile.py b/recipes/polylineencoder/all/conanfile.py index a15d46e640ff8..679878a309f30 100644 --- a/recipes/polylineencoder/all/conanfile.py +++ b/recipes/polylineencoder/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class PolylineencoderConan(ConanFile): @@ -25,8 +25,7 @@ class PolylineencoderConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -34,25 +33,26 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def package_id(self): - if Version(self.version) >= "1.1.2": - self.info.clear() - - def generate(self): - toolchain = CMakeToolchain(self) - toolchain.variables["BUILD_TESTING"] = False - if self.settings.os == "Windows" and self.options.shared: - toolchain.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = "ON" - toolchain.generate() + self.options.rm_safe("fPIC") + if Version(self.version) >= "1.1.1": + self.options.rm_safe("fPIC") + self.options.rm_safe("shared") def layout(self): cmake_layout(self, src_folder="src") + def package_id(self): + if Version(self.version) >= "1.1.1": + self.info.clear() + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTING"] = False + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = "ON" + tc.generate() def build(self): apply_conandata_patches(self) @@ -66,7 +66,10 @@ def package(self): cmake.install() def package_info(self): - if Version(self.version) == "1.0.0": - self.cpp_info.libs.append("polylineencoder") + if Version(self.version) < "1.1.1": + self.cpp_info.libs = ["polylineencoder"] if self.settings.os in ["Linux", "FreeBSD"] and self.options.shared: self.cpp_info.system_libs.append("m") + else: + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/polylineencoder/all/test_package/conanfile.py b/recipes/polylineencoder/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/polylineencoder/all/test_package/conanfile.py +++ b/recipes/polylineencoder/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/polylineencoder/all/test_v1_package/CMakeLists.txt b/recipes/polylineencoder/all/test_v1_package/CMakeLists.txt index 18c9e345b3f09..0d20897301b68 100644 --- a/recipes/polylineencoder/all/test_v1_package/CMakeLists.txt +++ b/recipes/polylineencoder/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(polylineencoder REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE polylineencoder::polylineencoder) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/polylineencoder/all/test_v1_package/conanfile.py b/recipes/polylineencoder/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/polylineencoder/all/test_v1_package/conanfile.py +++ b/recipes/polylineencoder/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/polymorphic_value/all/conanfile.py b/recipes/polymorphic_value/all/conanfile.py index 35b3d5c67ce80..a500ed7dae408 100644 --- a/recipes/polymorphic_value/all/conanfile.py +++ b/recipes/polymorphic_value/all/conanfile.py @@ -1,7 +1,13 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +import os -required_conan_version = ">=1.43.0" +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.50.0" class PolymorphictValueConan(ConanFile): @@ -14,10 +20,6 @@ class PolymorphictValueConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _minimum_cpp_standard(self): return 17 @@ -32,16 +34,16 @@ def _minimum_compilers_version(self): } def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) min_version = self._minimum_compilers_version.get( str(self.settings.compiler)) if not min_version: - self.output.warn("{} recipe lacks information about the {} " - "compiler support.".format( - self.name, self.settings.compiler)) + self.output.warning("{} recipe lacks information about the {} " + "compiler support.".format( + self.name, self.settings.compiler)) else: - if tools.Version(self.settings.compiler.version) < min_version: + if Version(self.settings.compiler.version) < min_version: raise ConanInvalidConfiguration( "{} requires C++{} support. " "The current compiler {} {} does not support it.".format( @@ -50,20 +52,24 @@ def validate(self): self.settings.compiler.version)) def package_id(self): - self.info.header_only() + self.info.clear() + + def layout(self): + basic_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy(pattern="polymorphic_value.*", dst="include", - src=self._source_subfolder) - self.copy("*LICENSE*", dst="licenses", keep_path=False) + copy(self, "polymorphic_value.*", self.source_folder, + os.path.join(self.package_folder, "include")) + copy(self, "*LICENSE*", self.source_folder, + os.path.join(self.package_folder, "licenses"), keep_path=False) def package_info(self): self.cpp_info.set_property("cmake_file_name", "polymorphic_value") - self.cpp_info.set_property("cmake_target_name", "polymorphic_value::polymorphic_value") + self.cpp_info.set_property( + "cmake_target_name", "polymorphic_value::polymorphic_value") self.cpp_info.names["cmake_find_package"] = "polymorphic_value" self.cpp_info.names["cmake_find_package_multi"] = "polymorphic_value" diff --git a/recipes/polymorphic_value/all/test_package/CMakeLists.txt b/recipes/polymorphic_value/all/test_package/CMakeLists.txt index e5843eef344a8..e6cc8838b8f43 100644 --- a/recipes/polymorphic_value/all/test_package/CMakeLists.txt +++ b/recipes/polymorphic_value/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.12) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(polymorphic_value REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/polymorphic_value/all/test_package/conanfile.py b/recipes/polymorphic_value/all/test_package/conanfile.py index 9b63bd176646b..e418ee7701960 100644 --- a/recipes/polymorphic_value/all/test_package/conanfile.py +++ b/recipes/polymorphic_value/all/test_package/conanfile.py @@ -1,10 +1,20 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,5 +22,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/polymorphic_value/all/test_v1_package/CMakeLists.txt b/recipes/polymorphic_value/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8e2bfa718d864 --- /dev/null +++ b/recipes/polymorphic_value/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(polymorphic_value REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE polymorphic_value::polymorphic_value) +target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_20) diff --git a/recipes/polymorphic_value/all/test_v1_package/conanfile.py b/recipes/polymorphic_value/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..fa6afacf5620e --- /dev/null +++ b/recipes/polymorphic_value/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +import os + +from conan.tools.build import cross_building +from conans import CMake, ConanFile + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/poppler-data/all/CMakeLists.txt b/recipes/poppler-data/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/poppler-data/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/poppler-data/all/conandata.yml b/recipes/poppler-data/all/conandata.yml index 687f86f421862..77bee83d512e5 100644 --- a/recipes/poppler-data/all/conandata.yml +++ b/recipes/poppler-data/all/conandata.yml @@ -2,9 +2,6 @@ sources: "0.4.11": url: "https://poppler.freedesktop.org/poppler-data-0.4.11.tar.gz" sha256: "2cec05cd1bb03af98a8b06a1e22f6e6e1a65b1e2f3816cb3069bb0874825f08c" - "0.4.9": - url: "https://poppler.freedesktop.org/poppler-data-0.4.9.tar.gz" - sha256: "1f9c7e7de9ecd0db6ab287349e31bf815ca108a5a175cf906a90163bdbe32012" "0.4.10": url: "https://poppler.freedesktop.org/poppler-data-0.4.10.tar.gz" sha256: "6e2fcef66ec8c44625f94292ccf8af9f1d918b410d5aa69c274ce67387967b30" @@ -13,11 +10,8 @@ sources: sha256: "1f9c7e7de9ecd0db6ab287349e31bf815ca108a5a175cf906a90163bdbe32012" patches: "0.4.11": - - base_path: "source_subfolder" - patch_file: "patches/0001-cmake-use-GNUInstallDirs.patch" + - patch_file: "patches/0001-cmake-use-GNUInstallDirs.patch" "0.4.10": - - base_path: "source_subfolder" - patch_file: "patches/0001-cmake-use-GNUInstallDirs.patch" + - patch_file: "patches/0001-cmake-use-GNUInstallDirs.patch" "0.4.9": - - base_path: "source_subfolder" - patch_file: "patches/0001-cmake-use-GNUInstallDirs.patch" + - patch_file: "patches/0001-cmake-use-GNUInstallDirs.patch" diff --git a/recipes/poppler-data/all/conanfile.py b/recipes/poppler-data/all/conanfile.py index a71db99dc6085..e414a6fa6dc4b 100644 --- a/recipes/poppler-data/all/conanfile.py +++ b/recipes/poppler-data/all/conanfile.py @@ -1,70 +1,66 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os +required_conan_version = ">=1.52.0" + class PopplerDataConan(ConanFile): name = "poppler-data" description = "encoding files for use with poppler, enable CJK and Cyrrilic" homepage = "https://poppler.freedesktop.org/" - topics = "conan", "poppler", "pdf", "rendering" + topics = "poppler", "pdf", "rendering" license = "BSD-3-Clause", "GPL-2.0-or-later", "MIT" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" # Added to avoid hook warnings while building - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" - _cmake = None + def export_sources(self): + export_conandata_patches(self) - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _build_subfolder(self): - return "build_subfolder" + def package_id(self): + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("poppler-data-{}".format(self.version), self._source_subfolder) - - def package_id(self): - self.info.header_only() + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) @property def _datadir(self): - return os.path.join(self.package_folder, "bin") - - def _configure_cmake(self): - # FIXME: USE_CMS - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["datadir"] = self._datadir - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + return os.path.join(self.package_folder, "res") - def _patch_sources(self): - for patchdata in self.conan_data["patches"][self.version]: - tools.patch(**patchdata) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["datadir"] = self._datadir.replace("\\", "/") + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING*", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self._datadir, "pkgconfig")) + rmdir(self, os.path.join(self._datadir, "pkgconfig")) @property def _poppler_datadir(self): return os.path.join(self._datadir, "poppler") def package_info(self): - self.cpp_info.names["pkg_config"] = "poppler-data" + self.cpp_info.set_property("pkg_config_name", "poppler-data") self.cpp_info.bindirs = [] self.cpp_info.includedirs = [] - self.user_info.datadir = self._poppler_datadir + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = ["res"] self.cpp_info.defines = ["POPPLER_DATADIR={}".format(self._poppler_datadir.replace("\\", "//"))] + self.conf_info.define("user.poppler-data:datadir", self._poppler_datadir) + + # TODO: to remove in conan v2 + self.user_info.datadir = self._poppler_datadir diff --git a/recipes/poppler-data/all/test_package/conanfile.py b/recipes/poppler-data/all/test_package/conanfile.py index 5e1ecefcd1e18..87a69bb15fafe 100644 --- a/recipes/poppler-data/all/test_package/conanfile.py +++ b/recipes/poppler-data/all/test_package/conanfile.py @@ -1,9 +1,14 @@ -from conans import ConanFile +from conan import ConanFile import os class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not os.path.isdir(self.deps_user_info["poppler-data"].datadir): + if not os.path.isdir(self.conf.get("user.poppler-data:datadir", check_type=str)): raise AssertionError("datadir is not a directory") diff --git a/recipes/poppler-data/all/test_v1_package/conanfile.py b/recipes/poppler-data/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8a2bb2447ea7b --- /dev/null +++ b/recipes/poppler-data/all/test_v1_package/conanfile.py @@ -0,0 +1,10 @@ +from conans import ConanFile +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not os.path.isdir(self.deps_user_info["poppler-data"].datadir): + raise AssertionError("datadir is not a directory") diff --git a/recipes/proj/all/CMakeLists.txt b/recipes/proj/all/CMakeLists.txt deleted file mode 100644 index 7df5947f8f3f6..0000000000000 --- a/recipes/proj/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS NO_OUTPUT_DIRS KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/proj/all/conandata.yml b/recipes/proj/all/conandata.yml index cccd0f0602103..6a5d57f6c5cd3 100644 --- a/recipes/proj/all/conandata.yml +++ b/recipes/proj/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "9.1.1": + url: "https://github.com/OSGeo/PROJ/releases/download/9.1.1/proj-9.1.1.tar.gz" + sha256: "003cd4010e52bb5eb8f7de1c143753aa830c8902b6ed01209f294846e40e6d39" + "9.1.0": + url: "https://github.com/OSGeo/PROJ/releases/download/9.1.0/proj-9.1.0.tar.gz" + sha256: "81b2239b94cad0886222cde4f53cb49d34905aad2a1317244a0c30a553db2315" "9.0.1": url: "https://github.com/OSGeo/PROJ/releases/download/9.0.1/proj-9.0.1.tar.gz" sha256: "737eaacbe7906d0d6ff43f0d9ebedc5c734cccc9e6b8d7beefdec3ab22d9a6a3" @@ -8,21 +14,6 @@ sources: "8.2.1": url: "https://github.com/OSGeo/PROJ/releases/download/8.2.1/proj-8.2.1.tar.gz" sha256: "76ed3d0c3a348a6693dfae535e5658bbfd47f71cb7ff7eb96d9f12f7e068b1cf" - "8.2.0": - url: "https://github.com/OSGeo/PROJ/releases/download/8.2.0/proj-8.2.0.tar.gz" - sha256: "de93df9a4aa88d09459ead791f2dbc874b897bf67a5bbb3e4b68de7b1bdef13c" - "8.1.1": - url: "https://github.com/OSGeo/PROJ/releases/download/8.1.1/proj-8.1.1.tar.gz" - sha256: "82f1345e5fa530c407cb1fc0752e83f8d08d2b98772941bbdc7820241f7fada2" - "8.1.0": - url: "https://github.com/OSGeo/PROJ/releases/download/8.1.0/proj-8.1.0.tar.gz" - sha256: "22c5cdc5aa0832077b16c95ebeec748a0942811c1c3438c33d43c8d2ead59f48" - "8.0.1": - url: "https://github.com/OSGeo/PROJ/releases/download/8.0.1/proj-8.0.1.tar.gz" - sha256: "e0463a8068898785ca75dd49a261d3d28b07d0a88f3b657e8e0089e16a0375fa" - "8.0.0": - url: "https://github.com/OSGeo/PROJ/releases/download/8.0.0/proj-8.0.0.tar.gz" - sha256: "aa5d4b934450149a350aed7e5fbac880e2f7d3fa2f251c26cb64228f96a2109e" "7.2.1": url: "https://github.com/OSGeo/PROJ/releases/download/7.2.1/proj-7.2.1.tar.gz" sha256: "b384f42e5fb9c6d01fe5fa4d31da2e91329668863a684f97be5d4760dbbf0a14" @@ -30,35 +21,35 @@ sources: url: "https://github.com/OSGeo/PROJ/releases/download/6.3.1/proj-6.3.1.tar.gz" sha256: "6de0112778438dcae30fcc6942dee472ce31399b9e5a2b67e8642529868c86f8" patches: + "9.1.1": + - patch_file: "patches/0001-use-cmake-targets-9.1.0.patch" + patch_type: "conan" + patch_description: "Use cmake targets" + "9.1.0": + - patch_file: "patches/0001-use-cmake-targets-9.1.0.patch" + patch_type: "conan" + patch_description: "Use cmake targets" "9.0.1": - patch_file: "patches/0001-use-cmake-targets-9.0.1.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" "9.0.0": - patch_file: "patches/0001-use-cmake-targets-9.0.0.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" - patch_file: "patches/0002-cmake-configure-proj-pc.patch" - base_path: "source_subfolder" + patch_type: "portability" + patch_description: "cmake configure proj pc" + patch_source: "https://github.com/OSGeo/PROJ/pull/3087" "8.2.1": - patch_file: "patches/0001-use-cmake-targets-8.2.0.patch" - base_path: "source_subfolder" - "8.2.0": - - patch_file: "patches/0001-use-cmake-targets-8.2.0.patch" - base_path: "source_subfolder" - "8.1.1": - - patch_file: "patches/0001-use-cmake-targets-8.1.1.patch" - base_path: "source_subfolder" - "8.1.0": - - patch_file: "patches/0001-use-cmake-targets-8.1.0.patch" - base_path: "source_subfolder" - "8.0.1": - - patch_file: "patches/0001-use-cmake-targets-8.0.0.patch" - base_path: "source_subfolder" - "8.0.0": - - patch_file: "patches/0001-use-cmake-targets-8.0.0.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" "7.2.1": - patch_file: "patches/0001-use-cmake-targets-7.2.1.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" "6.3.1": - patch_file: "patches/0001-use-cmake-targets-6.x.x.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Use cmake targets" diff --git a/recipes/proj/all/conanfile.py b/recipes/proj/all/conanfile.py index 7ad34317e533e..5d3402d7cc5db 100644 --- a/recipes/proj/all/conanfile.py +++ b/recipes/proj/all/conanfile.py @@ -1,14 +1,22 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.build import cross_building, stdcpp_library +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, replace_in_file, collect_libs, rm, rename +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" + +required_conan_version = ">=1.54.0" class ProjConan(ConanFile): name = "proj" description = "Cartographic Projections and Coordinate Transformations Library." license = "MIT" - topics = ("dsp", "proj", "proj4", "projections", "gis", "geospatial") + topics = "dsp", "proj", "proj4", "projections", "gis", "geospatial" homepage = "https://proj.org" url = "https://github.com/conan-io/conan-center-index" @@ -30,162 +38,149 @@ class ProjConan(ConanFile): "build_executables": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) < "7.0.0": + if Version(self.version) < "7.0.0": del self.options.with_tiff del self.options.with_curl def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("nlohmann_json/3.10.5") - self.requires("sqlite3/3.38.5") + self.requires("nlohmann_json/3.11.2") + self.requires("sqlite3/3.40.1") if self.options.get_safe("with_tiff"): - self.requires("libtiff/4.3.0") + self.requires("libtiff/4.4.0") if self.options.get_safe("with_curl"): - self.requires("libcurl/7.83.1") + self.requires("libcurl/7.87.0") def build_requirements(self): - if hasattr(self, "settings_build"): - self.build_requires("sqlite3/3.38.5") + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires("sqlite3/3.40.1") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def build(self): - self._patch_sources() - # we should inject build env vars if 2 profile, here it's host env vars ! - with tools.run_environment(self): - cmake = self._configure_cmake() - cmake.build() + def generate(self): + if hasattr(self, "settings_build") and cross_building(self): + env = VirtualBuildEnv(self) + env.generate() + else: + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = CMakeToolchain(self) + tc.variables["USE_THREAD"] = self.options.threadsafe + tc.variables["BUILD_CCT"] = self.options.build_executables + tc.variables["BUILD_CS2CS"] = self.options.build_executables + tc.variables["BUILD_GEOD"] = self.options.build_executables + tc.variables["BUILD_GIE"] = self.options.build_executables + tc.variables["BUILD_PROJ"] = self.options.build_executables + tc.variables["BUILD_PROJINFO"] = self.options.build_executables + if Version(self.version) < "9.1.0": + tc.variables["PROJ_DATA_SUBDIR"] = "res" + if Version(self.version) < "7.0.0": + tc.variables["PROJ_TESTS"] = False + tc.variables["BUILD_LIBPROJ_SHARED"] = self.options.shared + tc.variables["ENABLE_LTO"] = False + tc.variables["JNI_SUPPORT"] = False + else: + tc.variables["ENABLE_TIFF"] = self.options.with_tiff + tc.variables["ENABLE_CURL"] = self.options.with_curl + tc.variables["BUILD_TESTING"] = False + tc.variables["ENABLE_IPO"] = False + tc.variables["BUILD_PROJSYNC"] = self.options.build_executables and self.options.with_curl + if Version(self.version) >= "8.1.0": + tc.variables["NLOHMANN_JSON_ORIGIN"] = "external" + tc.variables["CMAKE_MACOSX_BUNDLE"] = False + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakelists, "/W4", "") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "/W4", "") + + # Fix up usage of SQLite3 finder outputs + rm(self, "FindSqlite3.cmake", os.path.join(self.source_folder, "cmake")) + replace_in_file(self, cmakelists, "SQLITE3_FOUND", "SQLite3_FOUND") + replace_in_file(self, cmakelists, "SQLITE3_VERSION", "SQLite3_VERSION") + replace_in_file(self, cmakelists, "find_package(Sqlite3 REQUIRED)", "find_package(SQLite3 REQUIRED)") # Let CMake install shared lib with a clean rpath ! - if tools.Version(self.version) >= "7.1.0" and tools.Version(self.version) < "9.0.0": - tools.replace_in_file(cmakelists, + if Version(self.version) >= "7.1.0" and Version(self.version) < "9.0.0": + replace_in_file(self, cmakelists, "set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)", "") - # Trick to find sqlite3 executable for build machine - # TODO: shouldn't be necessary in conan v2 with VirtualBuildEnv? - sqlite3_exe = " ".join("\"{}\"".format(path.replace("\\", "/")) for path in self.deps_env_info["sqlite3"].PATH) - tools.replace_in_file( - cmakelists, - "find_program(EXE_SQLITE3 sqlite3)", - "find_program(EXE_SQLITE3 sqlite3 PATHS {} NO_DEFAULT_PATH)".format(sqlite3_exe), - ) - - # Agressive workaround against SIP on macOS, to handle sqlite3 executable + # Aggressive workaround against SIP on macOS, to handle sqlite3 executable # linked to shared sqlite3 lib - if tools.is_apple_os(self._settings_build.os): - # TODO: no hope for 2 profiles, wait for stable self.dependencies - # because we want absolute lib paths of build profile actually - if not hasattr(self, "settings_build"): - if tools.Version(self.version) < "8.1.0": - cmake_sqlite_call = "CMakeLists.txt" - pattern = "${EXE_SQLITE3}" - else: - cmake_sqlite_call = "generate_proj_db.cmake" - pattern = "\"${EXE_SQLITE3}\"" - lib_paths = self.deps_cpp_info["sqlite3"].lib_paths - tools.replace_in_file( - os.path.join(self._source_subfolder, "data", cmake_sqlite_call), - "COMMAND {}".format(pattern), - "COMMAND ${{CMAKE_COMMAND}} -E env \"DYLD_LIBRARY_PATH={}\" {}".format( - ":".join(lib_paths), pattern - ), - ) + if is_apple_os(self): + if Version(self.version) < "8.1.0": + cmake_sqlite_call = "CMakeLists.txt" + pattern = "${EXE_SQLITE3}" + else: + cmake_sqlite_call = "generate_proj_db.cmake" + pattern = "\"${EXE_SQLITE3}\"" + if hasattr(self, "settings_build") and cross_building(self): + lib_paths = self.dependencies.build["sqlite3"].cpp_info.libdirs + else: + lib_paths = self.dependencies["sqlite3"].cpp_info.libdirs + replace_in_file(self, + os.path.join(self.source_folder, "data", cmake_sqlite_call), + f"COMMAND {pattern}", + f"COMMAND ${{CMAKE_COMMAND}} -E env \"DYLD_LIBRARY_PATH={':'.join(lib_paths)}\" {pattern}" + ) # unvendor nlohmann_json - if tools.Version(self.version) < "8.1.0": - tools.rmdir(os.path.join(self._source_subfolder, "include", "proj", "internal", "nlohmann")) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USE_THREAD"] = self.options.threadsafe - self._cmake.definitions["BUILD_CCT"] = self.options.build_executables - self._cmake.definitions["BUILD_CS2CS"] = self.options.build_executables - self._cmake.definitions["BUILD_GEOD"] = self.options.build_executables - self._cmake.definitions["BUILD_GIE"] = self.options.build_executables - self._cmake.definitions["BUILD_PROJ"] = self.options.build_executables - self._cmake.definitions["BUILD_PROJINFO"] = self.options.build_executables - self._cmake.definitions["PROJ_DATA_SUBDIR"] = "res" - if tools.Version(self.version) < "7.0.0": - self._cmake.definitions["PROJ_TESTS"] = False - self._cmake.definitions["BUILD_LIBPROJ_SHARED"] = self.options.shared - self._cmake.definitions["ENABLE_LTO"] = False - self._cmake.definitions["JNI_SUPPORT"] = False - else: - self._cmake.definitions["ENABLE_TIFF"] = self.options.with_tiff - self._cmake.definitions["ENABLE_CURL"] = self.options.with_curl - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["ENABLE_IPO"] = False - self._cmake.definitions["BUILD_PROJSYNC"] = self.options.build_executables and self.options.with_curl - if tools.Version(self.version) >= "8.1.0": - self._cmake.definitions["NLOHMANN_JSON_ORIGIN"] = "external" - self._cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False - self._cmake.configure() - return self._cmake + if Version(self.version) < "8.1.0": + rmdir(self, os.path.join(self.source_folder, "include", "proj", "internal", "nlohmann")) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + # recover the data ... 9.1.0 saves into share/proj rather than res directly + # the new PROJ_DATA_PATH can't seem to be controlled from conan. + if Version(self.version) >= "9.1.0": + rename(self, src=os.path.join(self.package_folder, "share", "proj"), dst=os.path.join(self.package_folder, "res")) + # delete the rest of the deployed data + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + def package_info(self): - proj_version = tools.Version(self.version) + proj_version = Version(self.version) cmake_config_filename = "proj" if proj_version >= "7.0.0" else "proj4" cmake_namespace = "PROJ" if proj_version >= "7.0.0" else "PROJ4" self.cpp_info.set_property("cmake_file_name", cmake_config_filename) - self.cpp_info.set_property("cmake_target_name", "{}::proj".format(cmake_namespace)) + self.cpp_info.set_property("cmake_target_name", f"{cmake_namespace}::proj") self.cpp_info.set_property("pkg_config_name", "proj") - self.cpp_info.components["projlib"].set_property("cmake_target_name", "{}::proj".format(cmake_namespace)) + self.cpp_info.components["projlib"].set_property("cmake_target_name", f"{cmake_namespace}::proj") self.cpp_info.components["projlib"].set_property("pkg_config_name", "proj") - self.cpp_info.filenames["cmake_find_package"] = cmake_config_filename - self.cpp_info.filenames["cmake_find_package_multi"] = cmake_config_filename - self.cpp_info.names["cmake_find_package"] = cmake_namespace - self.cpp_info.names["cmake_find_package_multi"] = cmake_namespace - self.cpp_info.components["projlib"].names["cmake_find_package"] = "proj" - self.cpp_info.components["projlib"].names["cmake_find_package_multi"] = "proj" - - self.cpp_info.components["projlib"].libs = tools.collect_libs(self) + self.cpp_info.components["projlib"].libs = collect_libs(self) if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["projlib"].system_libs.append("m") if self.options.threadsafe: @@ -194,29 +189,40 @@ def package_info(self): if proj_version >= "7.0.0": self.cpp_info.components["projlib"].system_libs.append("shell32") if proj_version >= "7.1.0": - self.cpp_info.components["projlib"].system_libs.append("Ole32") - if not self.options.shared and tools.stdcpp_library(self): - self.cpp_info.components["projlib"].system_libs.append(tools.stdcpp_library(self)) + self.cpp_info.components["projlib"].system_libs.append("ole32") + if not self.options.shared: + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.components["projlib"].system_libs.append(libcxx) self.cpp_info.components["projlib"].requires.extend(["nlohmann_json::nlohmann_json", "sqlite3::sqlite3"]) if self.options.get_safe("with_tiff"): self.cpp_info.components["projlib"].requires.append("libtiff::libtiff") if self.options.get_safe("with_curl"): self.cpp_info.components["projlib"].requires.append("libcurl::libcurl") - if tools.Version(self.version) < "8.2.0": - if self.options.shared and self._is_msvc: + if Version(self.version) < "8.2.0": + if self.options.shared and is_msvc(self): self.cpp_info.components["projlib"].defines.append("PROJ_MSVC_DLL_IMPORT") else: if not self.options.shared: self.cpp_info.components["projlib"].defines.append("PROJ_DLL=") + # see https://proj.org/usage/environmentvars.html#envvar-PROJ_DATA + proj_data_env_var_name = "PROJ_LIB" if Version(self.version) < "9.1.0" else "PROJ_DATA" res_path = os.path.join(self.package_folder, "res") - self.output.info("Prepending to PROJ_LIB environment variable: {}".format(res_path)) - self.runenv_info.prepend_path("PROJ_LIB", res_path) - # TODO: to remove after conan v2, it allows to not break consumers still relying on virtualenv generator - self.env_info.PROJ_LIB = res_path + self.runenv_info.prepend_path(proj_data_env_var_name, res_path) + if self.options.build_executables: + self.buildenv_info.prepend_path(proj_data_env_var_name, res_path) + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = cmake_config_filename + self.cpp_info.filenames["cmake_find_package_multi"] = cmake_config_filename + self.cpp_info.names["cmake_find_package"] = cmake_namespace + self.cpp_info.names["cmake_find_package_multi"] = cmake_namespace + self.cpp_info.components["projlib"].names["cmake_find_package"] = "proj" + self.cpp_info.components["projlib"].names["cmake_find_package_multi"] = "proj" + if Version(self.version) < "9.1.0": + self.env_info.PROJ_LIB.append(res_path) + else: + self.env_info.PROJ_DATA.append(res_path) if self.options.build_executables: - self.buildenv_info.prepend_path("PROJ_LIB", res_path) - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-6.x.x.patch b/recipes/proj/all/patches/0001-use-cmake-targets-6.x.x.patch index 7f0ee8cc37587..6bec96d49f9b3 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-6.x.x.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-6.x.x.patch @@ -1,6 +1,19 @@ ---- a/src/lib_proj.cmake -+++ b/src/lib_proj.cmake -@@ -311,7 +311,7 @@ source_group("Source Files\\Transformations" +diff -ru a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2020-02-10 17:29:51.000000000 +0800 ++++ b/CMakeLists.txt 2022-12-14 21:05:09.821289235 +0800 +@@ -114,6 +114,8 @@ + include(ProjMac) + include(policies) + ++find_package(nlohmann_json REQUIRED) ++ + ################################################################################ + # Check for sqlite3 + ################################################################################ +diff -ru a/src/lib_proj.cmake b/src/lib_proj.cmake +--- a/src/lib_proj.cmake 2019-12-29 06:23:06.000000000 +0800 ++++ b/src/lib_proj.cmake 2022-12-14 20:58:56.856752193 +0800 +@@ -311,7 +311,7 @@ source_group("Source Files\\ISO19111" FILES ${SRC_LIBPROJ_ISO19111}) @@ -9,13 +22,13 @@ include_directories(${CMAKE_CURRENT_BINARY_DIR}) source_group("CMake Files" FILES CMakeLists.txt) -@@ -440,8 +440,7 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) +@@ -440,8 +440,7 @@ target_link_libraries(${PROJ_CORE_TARGET} ${CMAKE_THREAD_LIBS_INIT}) endif() -include_directories(${SQLITE3_INCLUDE_DIR}) -target_link_libraries(${PROJ_CORE_TARGET} ${SQLITE3_LIBRARY}) -+target_link_libraries(${PROJ_CORE_TARGET} CONAN_PKG::nlohmann_json CONAN_PKG::sqlite3) ++target_link_libraries(${PROJ_CORE_TARGET} nlohmann_json::nlohmann_json SQLite::SQLite3) if(MSVC AND BUILD_LIBPROJ_SHARED) target_compile_definitions(${PROJ_CORE_TARGET} diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-7.2.1.patch b/recipes/proj/all/patches/0001-use-cmake-targets-7.2.1.patch index d23ded7d7b170..6ee348ac9ddd0 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-7.2.1.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-7.2.1.patch @@ -1,3 +1,15 @@ +diff -ru a/CMakeLists.txt b/CMakeLists.txt +--- a/CMakeLists.txt 2020-12-27 02:57:21.000000000 +0800 ++++ b/CMakeLists.txt 2022-12-14 21:21:31.516729458 +0800 +@@ -121,6 +121,8 @@ + include(ProjMac) + include(policies) + ++find_package(nlohmann_json REQUIRED) ++ + ################################################################################ + # Check for sqlite3 + ################################################################################ --- a/src/lib_proj.cmake +++ b/src/lib_proj.cmake @@ -414,19 +414,16 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) @@ -6,7 +18,7 @@ -target_include_directories(${PROJ_CORE_TARGET} PRIVATE ${SQLITE3_INCLUDE_DIR}) -target_link_libraries(${PROJ_CORE_TARGET} ${SQLITE3_LIBRARY}) -+target_link_libraries(${PROJ_CORE_TARGET} CONAN_PKG::nlohmann_json CONAN_PKG::sqlite3) ++target_link_libraries(${PROJ_CORE_TARGET} nlohmann_json::nlohmann_json SQLite::SQLite3) if(TIFF_ENABLED) target_compile_definitions(${PROJ_CORE_TARGET} PRIVATE -DTIFF_ENABLED) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-8.0.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-8.0.0.patch deleted file mode 100644 index fd68813a7e77c..0000000000000 --- a/recipes/proj/all/patches/0001-use-cmake-targets-8.0.0.patch +++ /dev/null @@ -1,27 +0,0 @@ ---- a/src/lib_proj.cmake -+++ b/src/lib_proj.cmake -@@ -394,21 +394,18 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) - target_link_libraries(proj PRIVATE ${CMAKE_THREAD_LIBS_INIT}) - endif() - --target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) --target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PUBLIC CONAN_PKG::nlohmann_json PRIVATE CONAN_PKG::sqlite3) - - if(TIFF_ENABLED) - target_compile_definitions(proj PRIVATE -DTIFF_ENABLED) -- target_include_directories(proj PRIVATE ${TIFF_INCLUDE_DIR}) -- target_link_libraries(proj PRIVATE ${TIFF_LIBRARY}) -+ target_link_libraries(proj PRIVATE TIFF::TIFF) - endif() - - if(CURL_ENABLED) - target_compile_definitions(proj PRIVATE -DCURL_ENABLED) -- target_include_directories(proj PRIVATE ${CURL_INCLUDE_DIR}) - target_link_libraries(proj - PRIVATE -- ${CURL_LIBRARY} -+ CURL::libcurl - $<$:ws2_32> - $<$:wldap32> - $<$:advapi32> diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-8.1.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-8.1.0.patch deleted file mode 100644 index 55848a7fbed02..0000000000000 --- a/recipes/proj/all/patches/0001-use-cmake-targets-8.1.0.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/src/lib_proj.cmake -+++ b/src/lib_proj.cmake -@@ -393,8 +393,7 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) - target_link_libraries(proj PRIVATE ${CMAKE_THREAD_LIBS_INIT}) - endif() - --target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) --target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PRIVATE CONAN_PKG::sqlite3) - - if(NLOHMANN_JSON STREQUAL "external") - target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) -@@ -403,16 +402,14 @@ endif() - - if(TIFF_ENABLED) - target_compile_definitions(proj PRIVATE -DTIFF_ENABLED) -- target_include_directories(proj PRIVATE ${TIFF_INCLUDE_DIR}) -- target_link_libraries(proj PRIVATE ${TIFF_LIBRARY}) -+ target_link_libraries(proj PRIVATE TIFF::TIFF) - endif() - - if(CURL_ENABLED) - target_compile_definitions(proj PRIVATE -DCURL_ENABLED) -- target_include_directories(proj PRIVATE ${CURL_INCLUDE_DIR}) - target_link_libraries(proj - PRIVATE -- ${CURL_LIBRARY} -+ CURL::libcurl - $<$:ws2_32> - $<$:wldap32> - $<$:advapi32> diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-8.1.1.patch b/recipes/proj/all/patches/0001-use-cmake-targets-8.1.1.patch deleted file mode 100644 index a94324460a6f8..0000000000000 --- a/recipes/proj/all/patches/0001-use-cmake-targets-8.1.1.patch +++ /dev/null @@ -1,31 +0,0 @@ ---- a/src/lib_proj.cmake -+++ b/src/lib_proj.cmake -@@ -393,8 +393,7 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) - target_link_libraries(proj PRIVATE ${CMAKE_THREAD_LIBS_INIT}) - endif() - --target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) --target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PRIVATE CONAN_PKG::sqlite3) - - if(NLOHMANN_JSON STREQUAL "external") - target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) -@@ -404,16 +403,14 @@ endif() - - if(TIFF_ENABLED) - target_compile_definitions(proj PRIVATE -DTIFF_ENABLED) -- target_include_directories(proj PRIVATE ${TIFF_INCLUDE_DIR}) -- target_link_libraries(proj PRIVATE ${TIFF_LIBRARY}) -+ target_link_libraries(proj PRIVATE TIFF::TIFF) - endif() - - if(CURL_ENABLED) - target_compile_definitions(proj PRIVATE -DCURL_ENABLED) -- target_include_directories(proj PRIVATE ${CURL_INCLUDE_DIR}) - target_link_libraries(proj - PRIVATE -- ${CURL_LIBRARY} -+ CURL::libcurl - $<$:ws2_32> - $<$:wldap32> - $<$:advapi32> diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-8.2.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-8.2.0.patch index f7c146f168e4f..8ce7c1895ee22 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-8.2.0.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-8.2.0.patch @@ -6,7 +6,7 @@ -target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) -target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PRIVATE CONAN_PKG::sqlite3) ++target_link_libraries(proj PRIVATE SQLite::SQLite3) if(NLOHMANN_JSON STREQUAL "external") target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-9.0.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-9.0.0.patch index 41f18cc8cd4e2..c7cf8eab51037 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-9.0.0.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-9.0.0.patch @@ -6,7 +6,7 @@ -target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) -target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PRIVATE CONAN_PKG::sqlite3) ++target_link_libraries(proj PRIVATE SQLite::SQLite3) if(NLOHMANN_JSON STREQUAL "external") target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-9.0.1.patch b/recipes/proj/all/patches/0001-use-cmake-targets-9.0.1.patch index 87519f3785407..6920410551838 100644 --- a/recipes/proj/all/patches/0001-use-cmake-targets-9.0.1.patch +++ b/recipes/proj/all/patches/0001-use-cmake-targets-9.0.1.patch @@ -6,7 +6,7 @@ -target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) -target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) -+target_link_libraries(proj PRIVATE CONAN_PKG::sqlite3) ++target_link_libraries(proj PRIVATE SQLite::SQLite3) if(NLOHMANN_JSON STREQUAL "external") target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) diff --git a/recipes/proj/all/patches/0001-use-cmake-targets-9.1.0.patch b/recipes/proj/all/patches/0001-use-cmake-targets-9.1.0.patch new file mode 100644 index 0000000000000..ddd144b4ef122 --- /dev/null +++ b/recipes/proj/all/patches/0001-use-cmake-targets-9.1.0.patch @@ -0,0 +1,31 @@ +--- a/src/lib_proj.cmake ++++ b/src/lib_proj.cmake +@@ -447,8 +447,7 @@ if(USE_THREAD AND Threads_FOUND AND CMAKE_USE_PTHREADS_INIT) + target_link_libraries(proj PRIVATE ${CMAKE_THREAD_LIBS_INIT}) + endif() + +-target_include_directories(proj PRIVATE ${SQLITE3_INCLUDE_DIR}) +-target_link_libraries(proj PRIVATE ${SQLITE3_LIBRARY}) ++target_link_libraries(proj PRIVATE SQLite::SQLite3) + + if(NLOHMANN_JSON STREQUAL "external") + target_compile_definitions(proj PRIVATE EXTERNAL_NLOHMANN_JSON) +@@ -458,16 +457,14 @@ endif() + + if(TIFF_ENABLED) + target_compile_definitions(proj PRIVATE -DTIFF_ENABLED) +- target_include_directories(proj PRIVATE ${TIFF_INCLUDE_DIR}) +- target_link_libraries(proj PRIVATE ${TIFF_LIBRARY}) ++ target_link_libraries(proj PRIVATE TIFF::TIFF) + endif() + + if(CURL_ENABLED) + target_compile_definitions(proj PRIVATE -DCURL_ENABLED) +- target_include_directories(proj PRIVATE ${CURL_INCLUDE_DIRS}) + target_link_libraries(proj + PRIVATE +- ${CURL_LIBRARIES} ++ CURL::libcurl + $<$:ws2_32> + $<$:wldap32> + $<$:advapi32> diff --git a/recipes/proj/all/test_package/CMakeLists.txt b/recipes/proj/all/test_package/CMakeLists.txt index 80dae0a82c9f8..68d47d66efc39 100644 --- a/recipes/proj/all/test_package/CMakeLists.txt +++ b/recipes/proj/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - add_executable(test_package test_package.c) if(PROJ_VERSION_GE_7) find_package(proj REQUIRED CONFIG) - target_link_libraries(test_package PROJ::proj) + target_link_libraries(test_package PRIVATE PROJ::proj) else() find_package(proj4 REQUIRED CONFIG) - target_link_libraries(test_package PROJ4::proj) + target_link_libraries(test_package PRIVATE PROJ4::proj) endif() diff --git a/recipes/proj/all/test_package/conanfile.py b/recipes/proj/all/test_package/conanfile.py index a5ba3b6be2376..69dbaead1cf8c 100644 --- a/recipes/proj/all/test_package/conanfile.py +++ b/recipes/proj/all/test_package/conanfile.py @@ -1,27 +1,32 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain +from conan.tools.scm import Version import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PROJ_VERSION_GE_7"] = Version(self.dependencies["proj"].ref.version) >= "7.0.0" + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["PROJ_VERSION_GE_7"] = tools.Version(self.deps_cpp_info["proj"].version) >= "7.0.0" cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/proj/all/test_v1_package/CMakeLists.txt b/recipes/proj/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/proj/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/proj/all/test_v1_package/conanfile.py b/recipes/proj/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0a0d55e2ef660 --- /dev/null +++ b/recipes/proj/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["PROJ_VERSION_GE_7"] = tools.Version(self.deps_cpp_info["proj"].version) >= "7.0.0" + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/proj/config.yml b/recipes/proj/config.yml index 31de4855ab6b1..b8b070a608bed 100644 --- a/recipes/proj/config.yml +++ b/recipes/proj/config.yml @@ -1,20 +1,14 @@ versions: + "9.1.1": + folder: "all" + "9.1.0": + folder: "all" "9.0.1": folder: "all" "9.0.0": folder: "all" "8.2.1": folder: "all" - "8.2.0": - folder: "all" - "8.1.1": - folder: "all" - "8.1.0": - folder: "all" - "8.0.1": - folder: "all" - "8.0.0": - folder: "all" "7.2.1": folder: "all" "6.3.1": diff --git a/recipes/prometheus-cpp/all/CMakeLists.txt b/recipes/prometheus-cpp/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/prometheus-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/prometheus-cpp/all/conandata.yml b/recipes/prometheus-cpp/all/conandata.yml index b6f621817e3ac..a1e0c249c424c 100644 --- a/recipes/prometheus-cpp/all/conandata.yml +++ b/recipes/prometheus-cpp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.0": + url: "https://github.com/jupp0r/prometheus-cpp/archive/v1.1.0.tar.gz" + sha256: "397544fe91e183029120b4eebcfab24ed9ec833d15850aae78fd5db19062d13a" "1.0.1": url: "https://github.com/jupp0r/prometheus-cpp/archive/v1.0.1.tar.gz" sha256: "593e028d401d3298eada804d252bc38d8cab3ea1c9e88bcd72095281f85e6d16" @@ -17,4 +20,3 @@ sources: patches: "0.11.0": - patch_file: "patches/0001-include-limits.patch" - base_path: "source_subfolder" diff --git a/recipes/prometheus-cpp/all/conanfile.py b/recipes/prometheus-cpp/all/conanfile.py index 06e3d95cc9539..413fb7b3f847a 100644 --- a/recipes/prometheus-cpp/all/conanfile.py +++ b/recipes/prometheus-cpp/all/conanfile.py @@ -1,19 +1,24 @@ -from conans import ConanFile, CMake, tools -import functools -import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd, valid_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc, check_min_vs -required_conan_version = ">=1.43.0" +import os +required_conan_version = ">=1.53.0" class PrometheusCppConan(ConanFile): name = "prometheus-cpp" description = "Prometheus Client Library for Modern C++" + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/jupp0r/prometheus-cpp" - license = "MIT" topics = ("metrics", "prometheus", "networking") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -29,20 +34,20 @@ class PrometheusCppConan(ConanFile): "with_compression": True, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 if Version(self.version) < "1.1.0" else 14 @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -50,52 +55,65 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.with_pull: - del self.options.with_compression + self.options.rm_safe("with_compression") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_pull: self.requires("civetweb/1.15") if self.options.with_push: - self.requires("libcurl/7.80.0") + self.requires("libcurl/7.86.0") if self.options.get_safe("with_compression"): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + if Version(self.version) < "1.1.0": + return + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["USE_THIRDPARTY_LIBRARIES"] = False - cmake.definitions["ENABLE_TESTING"] = False - cmake.definitions["OVERRIDE_CXX_STANDARD_FLAGS"] = not tools.valid_min_cppstd(self, 11) - cmake.definitions["ENABLE_PULL"] = self.options.with_pull - cmake.definitions["ENABLE_PUSH"] = self.options.with_push + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_THIRDPARTY_LIBRARIES"] = False + tc.variables["ENABLE_TESTING"] = False + tc.variables["OVERRIDE_CXX_STANDARD_FLAGS"] = not valid_min_cppstd(self, self._min_cppstd) + tc.variables["ENABLE_PULL"] = self.options.with_pull + tc.variables["ENABLE_PUSH"] = self.options.with_push if self.options.with_pull: - cmake.definitions["ENABLE_COMPRESSION"] = self.options.with_compression + tc.variables["ENABLE_COMPRESSION"] = self.options.with_compression + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() - cmake.configure(build_folder=self._build_subfolder) - return cmake + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(os.path.join(self._source_subfolder, "LICENSE"), dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "prometheus-cpp") diff --git a/recipes/prometheus-cpp/all/test_package/CMakeLists.txt b/recipes/prometheus-cpp/all/test_package/CMakeLists.txt index 976f0e00a6813..0df7da5ba0a1f 100644 --- a/recipes/prometheus-cpp/all/test_package/CMakeLists.txt +++ b/recipes/prometheus-cpp/all/test_package/CMakeLists.txt @@ -1,12 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -set(CMAKE_CXX_STANDARD 11) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(prometheus-cpp CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} prometheus-cpp::push prometheus-cpp::pull) +target_link_libraries(${PROJECT_NAME} PRIVATE prometheus-cpp::push prometheus-cpp::pull) +if(${prometheus-cpp_VERSION} VERSION_LESS "1.1.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +endif() diff --git a/recipes/prometheus-cpp/all/test_package/conanfile.py b/recipes/prometheus-cpp/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/prometheus-cpp/all/test_package/conanfile.py +++ b/recipes/prometheus-cpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/prometheus-cpp/all/test_v1_package/CMakeLists.txt b/recipes/prometheus-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/prometheus-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/prometheus-cpp/all/test_v1_package/conanfile.py b/recipes/prometheus-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/prometheus-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/prometheus-cpp/config.yml b/recipes/prometheus-cpp/config.yml index 372fd59dc7a34..3bfa3902dafa5 100644 --- a/recipes/prometheus-cpp/config.yml +++ b/recipes/prometheus-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.0": + folder: all "1.0.1": folder: all "1.0.0": diff --git a/recipes/proposal/all/conandata.yml b/recipes/proposal/all/conandata.yml index 19eb61c93267d..8565075961d2c 100644 --- a/recipes/proposal/all/conandata.yml +++ b/recipes/proposal/all/conandata.yml @@ -32,3 +32,9 @@ sources: "7.4.1": url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.4.1.tar.gz" sha256: "e6ff9749f402dd77f320a2a28b77a45636cbe186f926d9b5a7b54ea6ee631ada" + "7.4.2": + url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.4.2.tar.gz" + sha256: "f0db44c96a80a6ce3dda02c598574f5f0209376bd2c6c176797710da8eb3e108" + "7.5.0": + url: "https://github.com/tudo-astroparticlephysics/PROPOSAL/archive/refs/tags/7.5.0.tar.gz" + sha256: "ba31bd0a2337f3717a1ad88a3b3f7fefa3f1e4dae4fc922e72144cfecffe5e94" diff --git a/recipes/proposal/config.yml b/recipes/proposal/config.yml index 92c637b05e3a2..a200f922017df 100644 --- a/recipes/proposal/config.yml +++ b/recipes/proposal/config.yml @@ -21,3 +21,7 @@ versions: folder: all "7.4.1": folder: all + "7.4.2": + folder: all + "7.5.0": + folder: all diff --git a/recipes/protobuf/all/CMakeLists.txt b/recipes/protobuf/all/CMakeLists.txt deleted file mode 100644 index 70bacbfbf8f9a..0000000000000 --- a/recipes/protobuf/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory(source_subfolder/cmake) diff --git a/recipes/protobuf/all/conandata.yml b/recipes/protobuf/all/conandata.yml index bf497f2b2f364..d37db5fc4d5ca 100644 --- a/recipes/protobuf/all/conandata.yml +++ b/recipes/protobuf/all/conandata.yml @@ -1,10 +1,16 @@ sources: + "3.21.9": + url: "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.21.9.tar.gz" + sha256: "1add10f9bd92775b91f326da259f243881e904dd509367d5031d4c782ba82810" "3.21.4": url: "https://github.com/protocolbuffers/protobuf/archive/v3.21.4.tar.gz" sha256: "85d42d4485f36f8cec3e475a3b9e841d7d78523cd775de3a86dba77081f4ca25" "3.20.0": url: "https://github.com/protocolbuffers/protobuf/archive/v3.20.0.tar.gz" sha256: "b07772d38ab07e55eca4d50f4b53da2d998bb221575c60a4f81100242d4b4889" + "3.19.6": + url: "https://github.com/protocolbuffers/protobuf/archive/v3.19.6.tar.gz" + sha256: "9a301cf94a8ddcb380b901e7aac852780b826595075577bb967004050c835056" "3.19.4": url: "https://github.com/protocolbuffers/protobuf/archive/v3.19.4.tar.gz" sha256: "3bd7828aa5af4b13b99c191e8b1e884ebfa9ad371b0ce264605d347f135d2568" @@ -12,9 +18,16 @@ sources: url: "https://github.com/protocolbuffers/protobuf/archive/v3.18.1.tar.gz" sha256: "9111bf0b542b631165fadbd80aa60e7fb25b25311c532139ed2089d76ddf6dd7" "3.17.1": - url: "https://github.com/protocolbuffers/protobuf/archive/v3.17.1.tar.gz" + url: "https://github.com/protocolbuffers/protobuf/archive/refs/tags/v3.17.1.tar.gz" sha256: "036d66d6eec216160dd898cfb162e9d82c1904627642667cc32b104d407bb411" patches: + "3.19.6": + - patch_file: "patches/upstream-pr-9437-msvc-runtime.patch" + patch_description: "Properly handle CMAKE_MSVC_RUNTIME_LIBRARY when using CMake >= 3.15" + patch_type: "portability" + patch_source: "https://github.com/protocolbuffers/protobuf/pull/9437" "3.19.4": - - patch_file: "patches/upstream-pr-9153-msvc-runtime.patch" - base_path: "source_subfolder" + - patch_file: "patches/upstream-pr-9437-msvc-runtime.patch" + patch_description: "Properly handle CMAKE_MSVC_RUNTIME_LIBRARY when using CMake >= 3.15" + patch_type: "portability" + patch_source: "https://github.com/protocolbuffers/protobuf/pull/9437" diff --git a/recipes/protobuf/all/conanfile.py b/recipes/protobuf/all/conanfile.py index 7dc7627cb9068..d12aca6f2317c 100644 --- a/recipes/protobuf/all/conanfile.py +++ b/recipes/protobuf/all/conanfile.py @@ -1,17 +1,15 @@ -from conan.tools.files import rename, get, apply_conandata_patches, replace_in_file, rmdir, rm -from conan.tools.microsoft import msvc_runtime_flag, is_msvc -from conan.tools.scm import Version -from conan.tools.build import cross_building -from conan.errors import ConanInvalidConfiguration from conan import ConanFile -from conans import CMake +from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, rename, get, apply_conandata_patches, export_conandata_patches, replace_in_file, rmdir, rm +from conan.tools.microsoft import check_min_vs, msvc_runtime_flag, is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version -import functools import os import textwrap -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53" class ProtobufConan(ConanFile): @@ -41,19 +39,10 @@ class ProtobufConan(ConanFile): } short_paths = True - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" @property def _is_clang_cl(self): - return self.settings.compiler == 'clang' and self.settings.os == 'Windows' + return self.settings.compiler == "clang" and self.settings.os == "Windows" @property def _is_clang_x86(self): @@ -64,9 +53,7 @@ def _can_disable_rtti(self): return Version(self.version) >= "3.15.4" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -76,60 +63,56 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): - if self.options.shared and str(self.settings.compiler.get_safe("runtime")) in ["MT", "MTd", "static"]: + if self.options.shared and is_msvc_static_runtime(self): raise ConanInvalidConfiguration("Protobuf can't be built with shared + MT(d) runtimes") - if self.settings.compiler == "Visual Studio": - if Version(self.settings.compiler.version) < "14": - raise ConanInvalidConfiguration("On Windows Protobuf can only be built with " - "Visual Studio 2015 or higher.") + check_min_vs(self, "190") if self.settings.compiler == "clang": if Version(self.version) >= "3.15.4" and Version(self.settings.compiler.version) < "4": - raise ConanInvalidConfiguration("protobuf {} doesn't support clang < 4".format(self.version)) - - if hasattr(self, "settings_build") and cross_building(self) and \ - self.settings.os == "Macos" and self.options.shared: - # FIXME: should be allowed, actually build succeeds but it fails at build time of test package due to SIP - raise ConanInvalidConfiguration("protobuf shared not supported yet in CCI while cross-building on Macos") + raise ConanInvalidConfiguration(f"{self.ref} doesn't support clang < 4") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _cmake_install_base_path(self): return os.path.join("lib", "cmake", "protobuf") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["CMAKE_INSTALL_CMAKEDIR"] = self._cmake_install_base_path.replace("\\", "/") - cmake.definitions["protobuf_WITH_ZLIB"] = self.options.with_zlib - cmake.definitions["protobuf_BUILD_TESTS"] = False - cmake.definitions["protobuf_BUILD_PROTOC_BINARIES"] = True + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["CMAKE_INSTALL_CMAKEDIR"] = self._cmake_install_base_path.replace("\\", "/") + tc.cache_variables["protobuf_WITH_ZLIB"] = self.options.with_zlib + tc.cache_variables["protobuf_BUILD_TESTS"] = False + tc.cache_variables["protobuf_BUILD_PROTOC_BINARIES"] = self.settings.os != "tvOS" if not self.options.debug_suffix: - cmake.definitions["protobuf_DEBUG_POSTFIX"] = "" + tc.cache_variables["protobuf_DEBUG_POSTFIX"] = "" if Version(self.version) >= "3.14.0": - cmake.definitions["protobuf_BUILD_LIBPROTOC"] = True + tc.cache_variables["protobuf_BUILD_LIBPROTOC"] = self.settings.os != "tvOS" if self._can_disable_rtti: - cmake.definitions["protobuf_DISABLE_RTTI"] = not self.options.with_rtti + tc.cache_variables["protobuf_DISABLE_RTTI"] = not self.options.with_rtti if is_msvc(self) or self._is_clang_cl: runtime = msvc_runtime_flag(self) if not runtime: runtime = self.settings.get_safe("compiler.runtime") - cmake.definitions["protobuf_MSVC_STATIC_RUNTIME"] = "MT" in runtime - if Version(self.version) < "3.18.0" and self._is_clang_cl: - cmake.definitions["CMAKE_RC_COMPILER"] = os.environ.get("RC", "llvm-rc") - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.cache_variables["protobuf_MSVC_STATIC_RUNTIME"] = "MT" in runtime + if is_apple_os(self) and self.options.shared: + # Workaround against SIP on macOS for consumers while invoking protoc when protobuf lib is shared + tc.variables["CMAKE_INSTALL_RPATH"] = "@loader_path/../lib" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): apply_conandata_patches(self) @@ -137,7 +120,7 @@ def _patch_sources(self): # Provide relocatable protobuf::protoc target and Protobuf_PROTOC_EXECUTABLE cache variable # TODO: some of the following logic might be disabled when conan will # allow to create executable imported targets in package_info() - protobuf_config_cmake = os.path.join(self._source_subfolder, "cmake", "protobuf-config.cmake.in") + protobuf_config_cmake = os.path.join(self.source_folder, "cmake", "protobuf-config.cmake.in") replace_in_file(self, protobuf_config_cmake, @@ -169,27 +152,9 @@ def _patch_sources(self): protoc_target ) - # Set DYLD_LIBRARY_PATH in command line to avoid issues with shared protobuf - # (even with virtualrunenv, this fix might be required due to SIP) - # Only works with cmake, cmake_find_package or cmake_find_package_multi generators - if is_apple_os(self): - replace_in_file(self, - protobuf_config_cmake, - "add_custom_command(", - ("set(CUSTOM_DYLD_LIBRARY_PATH ${CONAN_LIB_DIRS} ${Protobuf_LIB_DIRS} ${Protobuf_LIB_DIRS_RELEASE} ${Protobuf_LIB_DIRS_DEBUG} ${Protobuf_LIB_DIRS_RELWITHDEBINFO} ${Protobuf_LIB_DIRS_MINSIZEREL})\n" - "string(REPLACE \";\" \":\" CUSTOM_DYLD_LIBRARY_PATH \"${CUSTOM_DYLD_LIBRARY_PATH}\")\n" - "add_custom_command(") - ) - cmd_str = "COMMAND protobuf::protoc" if Version(self.version) < "3.20.0" else "COMMAND protobuf::protoc" - replace_in_file(self, - protobuf_config_cmake, - cmd_str, - "COMMAND ${CMAKE_COMMAND} -E env \"DYLD_LIBRARY_PATH=${CUSTOM_DYLD_LIBRARY_PATH}\" $" - ) - # Disable a potential warning in protobuf-module.cmake.in # TODO: remove this patch? Is it really useful? - protobuf_module_cmake = os.path.join(self._source_subfolder, "cmake", "protobuf-module.cmake.in") + protobuf_module_cmake = os.path.join(self.source_folder, "cmake", "protobuf-module.cmake.in") replace_in_file(self, protobuf_module_cmake, "if(DEFINED Protobuf_SRC_ROOT_FOLDER)", @@ -204,18 +169,20 @@ def _patch_sources(self): # https://github.com/protocolbuffers/protobuf/issues/9916 # it will be solved in protobuf 3.21.0 if Version(self.version) == "3.20.0": - replace_in_file(self, os.path.join(self._source_subfolder, "src", "google", "protobuf", "port_def.inc"), + replace_in_file(self, os.path.join(self.source_folder, "src", "google", "protobuf", "port_def.inc"), "#elif PROTOBUF_GNUC_MIN(12, 0)", "#elif PROTOBUF_GNUC_MIN(12, 2)") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake_root = "cmake" if Version(self.version) < "3.21" else None + cmake.configure(build_script_folder=cmake_root) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) os.unlink(os.path.join(self.package_folder, self._cmake_install_base_path, "protobuf-config-version.cmake")) @@ -225,8 +192,8 @@ def package(self): os.path.join(self.package_folder, self._cmake_install_base_path, "protobuf-generate.cmake")) if not self.options.lite: - rm(self, "libprotobuf-lite.*", os.path.join(self.package_folder, "lib")) - rm(self, "libprotobuf-lite.*", os.path.join(self.package_folder, "bin")) + rm(self, "libprotobuf-lite*", os.path.join(self.package_folder, "lib")) + rm(self, "libprotobuf-lite*", os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -252,7 +219,7 @@ def package_info(self): if self.options.with_zlib: self.cpp_info.components["libprotobuf"].requires = ["zlib::zlib"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["libprotobuf"].system_libs.append("pthread") + self.cpp_info.components["libprotobuf"].system_libs.extend(["m", "pthread"]) if self._is_clang_x86 or "arm" in str(self.settings.arch): self.cpp_info.components["libprotobuf"].system_libs.append("atomic") if self.settings.os == "Android": @@ -262,9 +229,10 @@ def package_info(self): self.cpp_info.components["libprotobuf"].defines = ["PROTOBUF_USE_DLLS"] # libprotoc - self.cpp_info.components["libprotoc"].set_property("cmake_target_name", "protobuf::libprotoc") - self.cpp_info.components["libprotoc"].libs = [lib_prefix + "protoc" + lib_suffix] - self.cpp_info.components["libprotoc"].requires = ["libprotobuf"] + if self.settings.os != "tvOS": + self.cpp_info.components["libprotoc"].set_property("cmake_target_name", "protobuf::libprotoc") + self.cpp_info.components["libprotoc"].libs = [lib_prefix + "protoc" + lib_suffix] + self.cpp_info.components["libprotoc"].requires = ["libprotobuf"] # libprotobuf-lite if self.options.lite: @@ -273,7 +241,7 @@ def package_info(self): self.cpp_info.components["libprotobuf-lite"].builddirs.append(self._cmake_install_base_path) self.cpp_info.components["libprotobuf-lite"].libs = [lib_prefix + "protobuf-lite" + lib_suffix] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["libprotobuf-lite"].system_libs.append("pthread") + self.cpp_info.components["libprotobuf-lite"].system_libs.extend(["m", "pthread"]) if self._is_clang_x86 or "arm" in str(self.settings.arch): self.cpp_info.components["libprotobuf-lite"].system_libs.append("atomic") if self.settings.os == "Windows": @@ -282,10 +250,6 @@ def package_info(self): if self.settings.os == "Android": self.cpp_info.components["libprotobuf-lite"].system_libs.append("log") - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) - # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.filenames["cmake_find_package"] = "Protobuf" self.cpp_info.filenames["cmake_find_package_multi"] = "protobuf" @@ -295,3 +259,4 @@ def package_info(self): if self.options.lite: for generator in ["cmake_find_package", "cmake_find_package_multi"]: self.cpp_info.components["libprotobuf-lite"].build_modules[generator] = build_modules + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/protobuf/all/patches/upstream-pr-9437-msvc-runtime.patch b/recipes/protobuf/all/patches/upstream-pr-9437-msvc-runtime.patch new file mode 100644 index 0000000000000..06cb0a97681d1 --- /dev/null +++ b/recipes/protobuf/all/patches/upstream-pr-9437-msvc-runtime.patch @@ -0,0 +1,17 @@ +Fix from Protobuf PR: https://github.com/protocolbuffers/protobuf/pull/9437 + +--- a/cmake/CMakeLists.txt ++++ b/cmake/CMakeLists.txt +@@ -182,7 +182,11 @@ else (protobuf_BUILD_SHARED_LIBS) + # making programmatic control difficult. Prefer the functionality in newer + # CMake versions when available. + if(CMAKE_VERSION VERSION_GREATER 3.15 OR CMAKE_VERSION VERSION_EQUAL 3.15) +- set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>) ++ if (protobuf_MSVC_STATIC_RUNTIME) ++ set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>) ++ else() ++ set(CMAKE_MSVC_RUNTIME_LIBRARY MultiThreaded$<$:Debug>DLL) ++ endif() + else() + # In case we are building static libraries, link also the runtime library statically + # so that MSVCR*.DLL is not required at runtime. diff --git a/recipes/protobuf/all/test_package/CMakeLists.txt b/recipes/protobuf/all/test_package/CMakeLists.txt index ca3bf5d188169..a5240f3215abb 100644 --- a/recipes/protobuf/all/test_package/CMakeLists.txt +++ b/recipes/protobuf/all/test_package/CMakeLists.txt @@ -1,21 +1,21 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) +cmake_minimum_required(VERSION 3.15) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(protobuf CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp addressbook.proto) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_BINARY_DIR}") +target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") if (protobuf_LITE) - target_link_libraries(${PROJECT_NAME} protobuf::libprotobuf-lite) + target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf-lite) else() - target_link_libraries(${PROJECT_NAME} protobuf::libprotobuf) + target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotobuf) endif() -target_link_libraries(${PROJECT_NAME} protobuf::libprotoc) +if(TARGET protobuf::libprotoc) + target_link_libraries(${PROJECT_NAME} PRIVATE protobuf::libprotoc) +endif() protobuf_generate_cpp(PROTO_SRCS PROTO_HDRS TARGET ${PROJECT_NAME}) protobuf_generate(LANGUAGE cpp TARGET ${PROJECT_NAME} PROTOS addressbook.proto) diff --git a/recipes/protobuf/all/test_package/conanfile.py b/recipes/protobuf/all/test_package/conanfile.py index 06d5305cf8a67..3823d923c4684 100644 --- a/recipes/protobuf/all/test_package/conanfile.py +++ b/recipes/protobuf/all/test_package/conanfile.py @@ -1,24 +1,41 @@ from conan import ConanFile -from conan.tools.build import cross_building -from conans import CMake +from conan.tools.build import can_run, cross_building +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - if hasattr(self, "settings_build") and cross_building(self): - self.build_requires(str(self.requires["protobuf"])) + if cross_building(self) and hasattr(self, "settings_build"): + self.tool_requires(self.tested_reference_str) + + def generate(self): + VirtualRunEnv(self).generate() + if cross_building(self) and hasattr(self, "settings_build"): + VirtualBuildEnv(self).generate() + else: + VirtualRunEnv(self).generate(scope="build") + tc = CMakeToolchain(self) + tc.cache_variables["protobuf_LITE"] = self.dependencies[self.tested_reference_str].options.lite + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["protobuf_LITE"] = self.options["protobuf"].lite cmake.configure() cmake.build() def test(self): - if not cross_building(self): - self.run("protoc --version", run_environment=True) - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/protobuf/all/test_v1_package/CMakeLists.txt b/recipes/protobuf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..f16bc97992e86 --- /dev/null +++ b/recipes/protobuf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_v1_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/protobuf/all/test_v1_package/conanfile.py b/recipes/protobuf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..f31e33d3b0ff4 --- /dev/null +++ b/recipes/protobuf/all/test_v1_package/conanfile.py @@ -0,0 +1,27 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + if hasattr(self, "settings_build"): + self.build_requires(self.tested_reference_str) + + def build(self): + with tools.no_op() if hasattr(self, "settings_build") else tools.run_environment(self): + cmake = CMake(self) + cmake.definitions["protobuf_LITE"] = self.options["protobuf"].lite + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run("protoc --version", run_environment=True) + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/protobuf/config.yml b/recipes/protobuf/config.yml index ad95acbdb1bfe..c22211a7a9d4e 100644 --- a/recipes/protobuf/config.yml +++ b/recipes/protobuf/config.yml @@ -1,8 +1,12 @@ versions: + "3.21.9": + folder: all "3.21.4": folder: all "3.20.0": folder: all + "3.19.6": + folder: all "3.19.4": folder: all "3.18.1": diff --git a/recipes/protopuf/all/conandata.yml b/recipes/protopuf/all/conandata.yml new file mode 100644 index 0000000000000..e3a4a402d6c55 --- /dev/null +++ b/recipes/protopuf/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "2.2.1": + url: "https://github.com/PragmaTwice/protopuf/archive/v2.2.1.tar.gz" + sha256: "8d4940206d8e8664f75ae1cdfff8c14fa9a196c03967d520725284429744c19c" + "2.2.0": + url: "https://github.com/PragmaTwice/protopuf/archive/refs/tags/v2.2.0.tar.gz" + sha256: "f19aed66c7ff44fee2ae980f869746e2000fb484893f53f2e4ea021352444ea9" diff --git a/recipes/protopuf/all/conanfile.py b/recipes/protopuf/all/conanfile.py new file mode 100644 index 0000000000000..0bd58c86f61b8 --- /dev/null +++ b/recipes/protopuf/all/conanfile.py @@ -0,0 +1,75 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.50.0" + + +class ProtopufConan(ConanFile): + name = "protopuf" + description = "Protocol Puffers: A little, highly templated, and protobuf-compatible serialization/deserialization header-only library written in C++20" + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/PragmaTwice/protopuf" + topics = ("serialization", "protobuf", "metaprogramming", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _minimum_cpp_standard(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "10", + "clang": "12", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler == "apple-clang": + raise ConanInvalidConfiguration( + f"{self.ref} does not yet support apple-clang." + ) + + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.get_safe("compiler.version")) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/protopuf/all/test_package/CMakeLists.txt b/recipes/protopuf/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..c049a9a330ddf --- /dev/null +++ b/recipes/protopuf/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.12) + +project(test_package CXX) + +find_package(protopuf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE protopuf::protopuf) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/protopuf/all/test_package/conanfile.py b/recipes/protopuf/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/protopuf/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/protopuf/all/test_package/test_package.cpp b/recipes/protopuf/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..4204c6dc97e2a --- /dev/null +++ b/recipes/protopuf/all/test_package/test_package.cpp @@ -0,0 +1,32 @@ +#include + +#include "protopuf/message.h" + +using namespace pp; +using namespace std; + +using Student = message< + uint32_field<"id", 1>, + string_field<"name", 3> +>; + +using Class = message< + string_field<"name", 8>, + message_field<"students", 3, Student, repeated> +>; + +int main() { + // serialization + Student twice{123, "twice"}, tom{456, "tom"}, jerry{123456, "jerry"}; + Class myClass{"class 101", {tom, jerry}}; + myClass["students"_f].push_back(twice); + + array buffer{}; + auto bufferEnd = message_coder::encode(myClass, buffer); + + // deserialization + auto [yourClass, bufferEnd2] = message_coder::decode(buffer); + + + return 0; +} diff --git a/recipes/protopuf/all/test_v1_package/CMakeLists.txt b/recipes/protopuf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..4bda6274e3037 --- /dev/null +++ b/recipes/protopuf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.12) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(protopuf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE protopuf::protopuf) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/protopuf/all/test_v1_package/conanfile.py b/recipes/protopuf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/protopuf/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/protopuf/config.yml b/recipes/protopuf/config.yml new file mode 100644 index 0000000000000..346088b2bbe5f --- /dev/null +++ b/recipes/protopuf/config.yml @@ -0,0 +1,5 @@ +versions: + "2.2.1": + folder: all + "2.2.0": + folder: all diff --git a/recipes/psimd/all/conanfile.py b/recipes/psimd/all/conanfile.py index 99979718ffba1..138520809226b 100644 --- a/recipes/psimd/all/conanfile.py +++ b/recipes/psimd/all/conanfile.py @@ -1,30 +1,38 @@ -from conans import ConanFile, tools -import glob +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.50.0" + class PsimdConan(ConanFile): name = "psimd" description = "Portable 128-bit SIMD intrinsics." license = "MIT" - topics = ("conan", "psimd", "simd") + topics = ("psimd", "simd") homepage = "https://github.com/Maratyszcza/psimd" url = "https://github.com/conan-io/conan-center-index" - + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("psimd-*")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/psimd/all/test_package/CMakeLists.txt b/recipes/psimd/all/test_package/CMakeLists.txt index 7b9b613cbb24a..05b88bb3a3986 100644 --- a/recipes/psimd/all/test_package/CMakeLists.txt +++ b/recipes/psimd/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(psimd REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE psimd::psimd) diff --git a/recipes/psimd/all/test_package/conanfile.py b/recipes/psimd/all/test_package/conanfile.py index 5216332f39f5c..0a6bc68712d90 100644 --- a/recipes/psimd/all/test_package/conanfile.py +++ b/recipes/psimd/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/psimd/all/test_package/test_package.c b/recipes/psimd/all/test_package/test_package.c index 27f0a6e9339c6..df931cf110b83 100644 --- a/recipes/psimd/all/test_package/test_package.c +++ b/recipes/psimd/all/test_package/test_package.c @@ -3,6 +3,8 @@ #include int main() { +#if defined(__GNUC__) || defined(__clang__) psimd_u32 a = psimd_splat_u32(UINT32_C(0x80000000)); +#endif return 0; } diff --git a/recipes/psimd/all/test_v1_package/CMakeLists.txt b/recipes/psimd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..e8cb47d9d69b7 --- /dev/null +++ b/recipes/psimd/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(psimd REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE psimd::psimd) diff --git a/recipes/psimd/all/test_v1_package/conanfile.py b/recipes/psimd/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/psimd/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/psyinf-gmtl/all/conandata.yml b/recipes/psyinf-gmtl/all/conandata.yml new file mode 100644 index 0000000000000..42931963c125d --- /dev/null +++ b/recipes/psyinf-gmtl/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.7.1": + url: "https://github.com/psyinf/gmtl/archive/refs/tags/0.7.1.tar.gz" + sha256: "e7fbc98d8714251655c1f2ab60d35500ca6c1c57e4887419c99ffb4a49fc5030" diff --git a/recipes/psyinf-gmtl/all/conanfile.py b/recipes/psyinf-gmtl/all/conanfile.py new file mode 100644 index 0000000000000..11203a16c2294 --- /dev/null +++ b/recipes/psyinf-gmtl/all/conanfile.py @@ -0,0 +1,49 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.50.0" + + +class PackageConan(ConanFile): + name = "psyinf-gmtl" + description = "The Generic Math Template Library. A math library designed to be high-performance, extensible, and generic." + license = "LGPL-2.1-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/psyinf/gmtl" + topics = ("linear-algebra", "collision", "vector", "matrix", "template", "math", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.names["cmake_find_package"] = "gmtl" + self.cpp_info.names["cmake_find_package_multi"] = "gmtl" + + self.cpp_info.set_property("cmake_file_name", "gmtl") + self.cpp_info.set_property("cmake_target_name", "gmtl::gmtl") + self.cpp_info.set_property("pkg_config_name", "gmtl") + + diff --git a/recipes/psyinf-gmtl/all/test_package/CMakeLists.txt b/recipes/psyinf-gmtl/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5bb1ba95fb7cc --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(gmtl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gmtl::gmtl) diff --git a/recipes/psyinf-gmtl/all/test_package/conanfile.py b/recipes/psyinf-gmtl/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/psyinf-gmtl/all/test_package/test_package.cpp b/recipes/psyinf-gmtl/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..221f6d72428d5 --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_package/test_package.cpp @@ -0,0 +1,16 @@ +#include +#include +#include "gmtl/gmtl.h" + + +int main(void) { + + gmtl::Vec4f homogeneousVec; + gmtl::Vec4f homogeneousVec2; + gmtl::Matrix44f mat; + + homogeneousVec2 = mat * homogeneousVec; + + gmtl::xform(homogeneousVec2, mat, homogeneousVec); + return EXIT_SUCCESS; +} diff --git a/recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt b/recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..de05e55dc1517 --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(gmtl REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE gmtl::gmtl) diff --git a/recipes/psyinf-gmtl/all/test_v1_package/conanfile.py b/recipes/psyinf-gmtl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/psyinf-gmtl/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/psyinf-gmtl/config.yml b/recipes/psyinf-gmtl/config.yml new file mode 100644 index 0000000000000..5232c857fcc80 --- /dev/null +++ b/recipes/psyinf-gmtl/config.yml @@ -0,0 +1,3 @@ +versions: + "0.7.1": + folder: all diff --git a/recipes/ptex/all/conanfile.py b/recipes/ptex/all/conanfile.py index 8f5a87303940f..f8059fec65c6b 100644 --- a/recipes/ptex/all/conanfile.py +++ b/recipes/ptex/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class PtexConan(ConanFile): @@ -11,7 +11,7 @@ class PtexConan(ConanFile): description = "Ptex is a texture mapping system developed by Walt Disney " \ "Animation Studios for production-quality rendering." license = "BSD-3-Clause" - topics = ("ptex", "texture-mapping") + topics = ("texture-mapping") homepage = "https://ptex.us" url = "https://github.com/conan-io/conan-center-index" @@ -26,8 +26,7 @@ class PtexConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,14 +34,14 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def requirements(self): - self.requires("zlib/1.2.12") + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def requirements(self): + self.requires("zlib/1.2.13") + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -70,7 +69,7 @@ def package(self): def package_info(self): cmake_target = "Ptex_dynamic" if self.options.shared else "Ptex_static" self.cpp_info.set_property("cmake_file_name", "ptex") - self.cpp_info.set_property("cmake_target_name", "Ptex::{}".format(cmake_target)) + self.cpp_info.set_property("cmake_target_name", f"Ptex::{cmake_target}") # TODO: back to global scope once cmake_find_package* generators removed self.cpp_info.components["_ptex"].libs = ["Ptex"] if not self.options.shared: @@ -84,6 +83,6 @@ def package_info(self): self.cpp_info.filenames["cmake_find_package_multi"] = "ptex" self.cpp_info.names["cmake_find_package"] = "Ptex" self.cpp_info.names["cmake_find_package_multi"] = "Ptex" - self.cpp_info.components["_ptex"].set_property("cmake_target_name", "Ptex::{}".format(cmake_target)) + self.cpp_info.components["_ptex"].set_property("cmake_target_name", f"Ptex::{cmake_target}") self.cpp_info.components["_ptex"].names["cmake_find_package"] = cmake_target self.cpp_info.components["_ptex"].names["cmake_find_package_multi"] = cmake_target diff --git a/recipes/ptex/all/test_package/conanfile.py b/recipes/ptex/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/ptex/all/test_package/conanfile.py +++ b/recipes/ptex/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/ptex/all/test_v1_package/CMakeLists.txt b/recipes/ptex/all/test_v1_package/CMakeLists.txt index 5fae512895c4a..0d20897301b68 100644 --- a/recipes/ptex/all/test_v1_package/CMakeLists.txt +++ b/recipes/ptex/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(ptex REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -if(TARGET Ptex::Ptex_static) - target_link_libraries(${PROJECT_NAME} PRIVATE Ptex::Ptex_static) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE Ptex::Ptex_dynamic) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/ptex/all/test_v1_package/conanfile.py b/recipes/ptex/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/ptex/all/test_v1_package/conanfile.py +++ b/recipes/ptex/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/pthreadpool/all/CMakeLists.txt b/recipes/pthreadpool/all/CMakeLists.txt index a42d7ed679ae9..4a9151537d740 100644 --- a/recipes/pthreadpool/all/CMakeLists.txt +++ b/recipes/pthreadpool/all/CMakeLists.txt @@ -1,14 +1,10 @@ cmake_minimum_required(VERSION 3.4) project(cmake_wrapper) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_library(fxdiv INTERFACE) -target_link_libraries(fxdiv INTERFACE CONAN_PKG::fxdiv) - -if(MSVC AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +find_package(fxdiv REQUIRED CONFIG) +if(NOT TARGET fxdiv) + add_library(fxdiv INTERFACE IMPORTED) + set_property(TARGET fxdiv PROPERTY INTERFACE_LINK_LIBRARIES fxdiv::fxdiv) endif() -add_subdirectory(source_subfolder) +add_subdirectory(src) diff --git a/recipes/pthreadpool/all/conanfile.py b/recipes/pthreadpool/all/conanfile.py index 25b3858097bf3..026fed28423d8 100644 --- a/recipes/pthreadpool/all/conanfile.py +++ b/recipes/pthreadpool/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, CMake, tools -import glob +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file import os +required_conan_version = ">=1.51.1" + class PthreadpoolConan(ConanFile): name = "pthreadpool" @@ -9,8 +12,7 @@ class PthreadpoolConan(ConanFile): "implementation. It provides similar functionality to " \ "#pragma omp parallel for, but with additional features." license = "BSD-2-Clause" - topics = ("conan", "pthreadpool", "multi-threading", "pthreads", - "multi-core", "threadpool") + topics = ("multi-threading", "pthreads", "multi-core", "threadpool") homepage = "https://github.com/Maratyszcza/pthreadpool" url = "https://github.com/conan-io/conan-center-index" @@ -27,12 +29,6 @@ class PthreadpoolConan(ConanFile): } exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -40,47 +36,60 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("fxdiv/cci.20200417") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("pthreadpool-*")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["PTHREADPOOL_LIBRARY_TYPE"] = "default" + tc.variables["PTHREADPOOL_ALLOW_DEPRECATED_API"] = True + # TODO: remove str cast in conan 1.53.0 (see https://github.com/conan-io/conan/pull/12086) + tc.cache_variables["PTHREADPOOL_SYNC_PRIMITIVE"] = str(self.options.sync_primitive) + tc.variables["PTHREADPOOL_BUILD_TESTS"] = False + tc.variables["PTHREADPOOL_BUILD_BENCHMARKS"] = False + tc.cache_variables["FXDIV_SOURCE_DIR"] = "dummy" # this value doesn't really matter, it's just to avoid a download + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}", "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["PTHREADPOOL_LIBRARY_TYPE"] = "default" - self._cmake.definitions["PTHREADPOOL_ALLOW_DEPRECATED_API"] = True - self._cmake.definitions["PTHREADPOOL_SYNC_PRIMITIVE"] = self.options.sync_primitive - self._cmake.definitions["PTHREADPOOL_BUILD_TESTS"] = False - self._cmake.definitions["PTHREADPOOL_BUILD_BENCHMARKS"] = False - self._cmake.definitions["FXDIV_SOURCE_DIR"] = "dummy" # this value doesn't really matter, it's just to avoid a download - self._cmake.configure() - return self._cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["pthreadpool"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] diff --git a/recipes/pthreadpool/all/test_package/CMakeLists.txt b/recipes/pthreadpool/all/test_package/CMakeLists.txt index fd126a732c403..722ec454f1c79 100644 --- a/recipes/pthreadpool/all/test_package/CMakeLists.txt +++ b/recipes/pthreadpool/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(pthreadpool REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE pthreadpool::pthreadpool) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/pthreadpool/all/test_package/conanfile.py b/recipes/pthreadpool/all/test_package/conanfile.py index 5216332f39f5c..0a6bc68712d90 100644 --- a/recipes/pthreadpool/all/test_package/conanfile.py +++ b/recipes/pthreadpool/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pthreadpool/all/test_v1_package/CMakeLists.txt b/recipes/pthreadpool/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..c45c97cc93d2c --- /dev/null +++ b/recipes/pthreadpool/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(pthreadpool REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE pthreadpool::pthreadpool) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/pthreadpool/all/test_v1_package/conanfile.py b/recipes/pthreadpool/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/pthreadpool/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/pugixml/all/CMakeLists.txt b/recipes/pugixml/all/CMakeLists.txt deleted file mode 100644 index f68c6e827bd09..0000000000000 --- a/recipes/pugixml/all/CMakeLists.txt +++ /dev/null @@ -1,10 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -message(STATUS "Conan CMake Wrapper") -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory("source_subfolder") diff --git a/recipes/pugixml/all/conandata.yml b/recipes/pugixml/all/conandata.yml index 1dde7e2947c39..0e56e7f953dbc 100644 --- a/recipes/pugixml/all/conandata.yml +++ b/recipes/pugixml/all/conandata.yml @@ -1,10 +1,13 @@ sources: + "1.13": + url: "https://github.com/zeux/pugixml/releases/download/v1.13/pugixml-1.13.tar.gz" + sha256: "40c0b3914ec131485640fa57e55bf1136446026b41db91c1bef678186a12abbe" "1.12.1": - url: "https://github.com/zeux/pugixml/archive/v1.12.1.tar.gz" - sha256: "1e28ab24b6e04e013d96f45d25e9f2d04c921dc68c613fd010ecaaad3892c14d" + url: "https://github.com/zeux/pugixml/releases/download/v1.12.1/pugixml-1.12.1.tar.gz" + sha256: "dcf671a919cc4051210f08ffd3edf9e4247f79ad583c61577a13ee93af33afc7" "1.11": - url: "https://github.com/zeux/pugixml/archive/v1.11.tar.gz" - sha256: "79b5e3a50dca0c150ab5fd282e23dd1da00760073a7040ca8dde4e031330add2" + url: "https://github.com/zeux/pugixml/releases/download/v1.11/pugixml-1.11.tar.gz" + sha256: "26913d3e63b9c07431401cf826df17ed832a20d19333d043991e611d23beaa2c" "1.10": url: "https://github.com/zeux/pugixml/releases/download/v1.10/pugixml-1.10.tar.gz" sha256: "55f399fbb470942410d348584dc953bcaec926415d3462f471ef350f29b5870a" diff --git a/recipes/pugixml/all/conanfile.py b/recipes/pugixml/all/conanfile.py index c660cebda0b32..c5890f6dbab55 100644 --- a/recipes/pugixml/all/conanfile.py +++ b/recipes/pugixml/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import collect_libs, copy, get, load, replace_in_file, rmdir, save +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" + class PugiXmlConan(ConanFile): name = "pugixml" @@ -11,92 +15,90 @@ class PugiXmlConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://pugixml.org/" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - settings = ("os", "arch", "compiler", "build_type") + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "header_only": [True, False], "wchar_mode": [True, False], - "no_exceptions": [True, False] + "no_exceptions": [True, False], } default_options = { - 'shared': False, - 'fPIC': True, - 'header_only': False, - 'wchar_mode': False, - 'no_exceptions': False + "shared": False, + "fPIC": True, + "header_only": False, + "wchar_mode": False, + "no_exceptions": False, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): - if self.settings.os == 'Windows': + if self.settings.os == "Windows": del self.options.fPIC def configure(self): - if self.options.shared: - del self.options.fPIC + if self.options.shared or self.options.header_only: + self.options.rm_safe("fPIC") if self.options.header_only: - if self.settings.os != 'Windows': - del self.options.fPIC del self.options.shared + def layout(self): + if self.options.header_only: + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") + + def package_id(self): + if self.info.options.header_only: + self.info.clear() + def validate(self): if self.options.get_safe("shared") and self.options.wchar_mode: # The app crashes with error "The procedure entry point ... could not be located in the dynamic link library" raise ConanInvalidConfiguration("Combination of 'shared' and 'wchar_mode' options is not supported") - def package_id(self): - if self.options.header_only: - self.info.header_only() - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + if not self.options.header_only: + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + # For msvc shared + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() def build(self): if not self.options.header_only: - header_file = os.path.join(self._source_subfolder, "src", "pugiconfig.hpp") + header_file = os.path.join(self.source_folder, "src", "pugiconfig.hpp") # For the library build mode, options applied via change the configuration file if self.options.wchar_mode: - tools.replace_in_file(header_file, "// #define PUGIXML_WCHAR_MODE", '''#define PUGIXML_WCHAR_MODE''') + replace_in_file(self, header_file, "// #define PUGIXML_WCHAR_MODE", "#define PUGIXML_WCHAR_MODE") if self.options.no_exceptions: - tools.replace_in_file(header_file, "// #define PUGIXML_NO_EXCEPTIONS", '''#define PUGIXML_NO_EXCEPTIONS''') - cmake = self._configure_cmake() + replace_in_file(self, header_file, "// #define PUGIXML_NO_EXCEPTIONS", "#define PUGIXML_NO_EXCEPTIONS") + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - readme_contents = tools.load(os.path.join(self._source_subfolder, "readme.txt")) + readme_contents = load(self, os.path.join(self.source_folder, "readme.txt")) license_contents = readme_contents[readme_contents.find("This library is"):] - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) if self.options.header_only: - source_dir = os.path.join(self._source_subfolder, "src") - self.copy(pattern="*", dst="include", src=source_dir) + source_dir = os.path.join(self.source_folder, "src") + copy(self, "*", src=source_dir, dst=os.path.join(self.package_folder, "include")) else: - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, 'lib', 'cmake')) - tools.rmdir(os.path.join(self.package_folder, 'lib', 'pkgconfig')) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "pugixml") + self.cpp_info.set_property("cmake_target_name", "pugixml::pugixml") + self.cpp_info.set_property("pkg_config_name", "pugixml") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") if self.options.header_only: # For the "header_only" mode, options applied via global definitions self.cpp_info.defines.append("PUGIXML_HEADER_ONLY") @@ -104,5 +106,11 @@ def package_info(self): self.cpp_info.defines.append("PUGIXML_WCHAR_MODE") if self.options.no_exceptions: self.cpp_info.defines.append("PUGIXML_NO_EXCEPTIONS") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] else: - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.set_property( + "cmake_target_aliases", + ["pugixml::shared"] if self.options.shared else ["pugixml::static"], + ) + self.cpp_info.libs = collect_libs(self) diff --git a/recipes/pugixml/all/test_package/CMakeLists.txt b/recipes/pugixml/all/test_package/CMakeLists.txt index e692ba57d06c2..793d1941f61be 100644 --- a/recipes/pugixml/all/test_package/CMakeLists.txt +++ b/recipes/pugixml/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(pugixml CONFIG REQUIRED) +find_package(pugixml REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} pugixml::pugixml) +target_link_libraries(${PROJECT_NAME} PRIVATE pugixml::pugixml) diff --git a/recipes/pugixml/all/test_package/conanfile.py b/recipes/pugixml/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/pugixml/all/test_package/conanfile.py +++ b/recipes/pugixml/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/pugixml/all/test_v1_package/CMakeLists.txt b/recipes/pugixml/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/pugixml/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/pugixml/all/test_v1_package/conanfile.py b/recipes/pugixml/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/pugixml/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/pugixml/config.yml b/recipes/pugixml/config.yml index a6d64718bc738..191cc957e0c3b 100644 --- a/recipes/pugixml/config.yml +++ b/recipes/pugixml/config.yml @@ -1,4 +1,6 @@ versions: + "1.13": + folder: "all" "1.12.1": folder: "all" "1.11": diff --git a/recipes/pulseaudio/all/conanfile.py b/recipes/pulseaudio/all/conanfile.py index 8f2092db76bbf..0d15b07fe2fd8 100644 --- a/recipes/pulseaudio/all/conanfile.py +++ b/recipes/pulseaudio/all/conanfile.py @@ -6,17 +6,18 @@ from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class PulseAudioConan(ConanFile): name = "pulseaudio" description = "PulseAudio is a sound system for POSIX OSes, meaning that it is a proxy for sound applications." - topics = "sound", + topics = ("sound",) url = "https://github.com/conan-io/conan-center-index" homepage = "http://pulseaudio.org/" license = "LGPL-2.1" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -45,15 +46,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") if not self.options.with_dbus: del self.options.with_fftw diff --git a/recipes/pulseaudio/all/test_package/conanfile.py b/recipes/pulseaudio/all/test_package/conanfile.py index d120a992c06a6..8a5bb47f50c4c 100644 --- a/recipes/pulseaudio/all/test_package/conanfile.py +++ b/recipes/pulseaudio/all/test_package/conanfile.py @@ -7,6 +7,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/pulseaudio/all/test_v1_package/CMakeLists.txt b/recipes/pulseaudio/all/test_v1_package/CMakeLists.txt index 4947b7dda15bc..925ecbe19e448 100644 --- a/recipes/pulseaudio/all/test_v1_package/CMakeLists.txt +++ b/recipes/pulseaudio/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(pulseaudio REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE pulseaudio::pulseaudio) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/pybind11/all/CMakeLists.txt b/recipes/pybind11/all/CMakeLists.txt deleted file mode 100644 index 97030501e5bd7..0000000000000 --- a/recipes/pybind11/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/pybind11/all/conandata.yml b/recipes/pybind11/all/conandata.yml index 8fa07bb017f1f..d2814f09ff728 100644 --- a/recipes/pybind11/all/conandata.yml +++ b/recipes/pybind11/all/conandata.yml @@ -14,3 +14,6 @@ sources: "2.10.0": url: "https://github.com/pybind/pybind11/archive/v2.10.0.tar.gz" sha256: "eacf582fa8f696227988d08cfc46121770823839fe9e301a20fbce67e7cd70ec" + 2.10.1: + url: "https://github.com/pybind/pybind11/archive/v2.10.1.tar.gz" + sha256: "111014b516b625083bef701df7880f78c2243835abdb263065b6b59b960b6bad" diff --git a/recipes/pybind11/all/conanfile.py b/recipes/pybind11/all/conanfile.py index f7a211fab9108..4ca688fce0b2b 100644 --- a/recipes/pybind11/all/conanfile.py +++ b/recipes/pybind11/all/conanfile.py @@ -1,12 +1,11 @@ -from conans import ConanFile, CMake -from conan.errors import ConanInvalidConfiguration -from conan.tools.files import get, copy, replace_in_file -from conan.tools.scm import Version +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.layout import basic_layout +from conan.tools.files import get, copy, replace_in_file, rm, rmdir import os -import functools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class PyBind11Conan(ConanFile): @@ -16,83 +15,64 @@ class PyBind11Conan(ConanFile): homepage = "https://github.com/pybind/pybind11" license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" - exports_sources = "CMakeLists.txt" settings = "os", "arch", "compiler", "build_type" - generators = "cmake" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def validate(self): - if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) >= "11.0": - raise ConanInvalidConfiguration("OSX support is bugged. Check https://github.com/pybind/pybind11/issues/3081") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["PYBIND11_INSTALL"] = True + tc.variables["PYBIND11_TEST"] = False + tc.variables["PYBIND11_CMAKECONFIG_INSTALL_DIR"] = "lib/cmake/pybind11" + tc.generate() - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): cmake = CMake(self) - cmake.definitions["PYBIND11_INSTALL"] = True - cmake.definitions["PYBIND11_TEST"] = False - cmake.definitions["PYBIND11_CMAKECONFIG_INSTALL_DIR"] = "lib/cmake/pybind11" cmake.configure() - return cmake - - def build(self): - cmake = self._configure_cmake() cmake.build() def package(self): - copy(self, "LICENSE", src=os.path.join(self.source_folder, self._source_subfolder), dst=os.path.join(self.package_folder, "licenses")) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() for filename in ["pybind11Targets.cmake", "pybind11Config.cmake", "pybind11ConfigVersion.cmake"]: - try: - os.unlink(os.path.join(self.package_folder, "lib", "cmake", "pybind11", filename)) - except: - pass - if Version(self.version) >= "2.6.0": - replace_in_file(self, os.path.join(self.package_folder, "lib", "cmake", "pybind11", "pybind11Common.cmake"), - "if(TARGET pybind11::lto)", - "if(FALSE)") - replace_in_file(self, os.path.join(self.package_folder, "lib", "cmake", "pybind11", "pybind11Common.cmake"), - "add_library(", - "# add_library(") + rm(self, filename, os.path.join(self.package_folder, "lib", "cmake", "pybind11")) + + rmdir(self, os.path.join(self.package_folder, "share")) + + replace_in_file(self, os.path.join(self.package_folder, "lib", "cmake", "pybind11", "pybind11Common.cmake"), + "if(TARGET pybind11::lto)", + "if(FALSE)") + replace_in_file(self, os.path.join(self.package_folder, "lib", "cmake", "pybind11", "pybind11Common.cmake"), + "add_library(", + "# add_library(") def package_id(self): self.info.clear() def package_info(self): cmake_base_path = os.path.join("lib", "cmake", "pybind11") - if Version(self.version) >= "2.6.0": - self.cpp_info.components["main"].set_property("cmake_module_file_name", "pybind11") - self.cpp_info.components["main"].names["cmake_find_package"] = "pybind11" - self.cpp_info.components["main"].builddirs = [cmake_base_path] - cmake_file = os.path.join(cmake_base_path, "pybind11Common.cmake") - self.cpp_info.set_property("cmake_build_modules", [cmake_file]) - for generator in ["cmake_find_package", "cmake_find_package_multi"]: - self.cpp_info.components["main"].build_modules[generator].append(cmake_file) - self.cpp_info.components["headers"].includedirs = [os.path.join("include", "pybind11")] - self.cpp_info.components["headers"].requires = ["main"] - self.cpp_info.components["embed"].requires = ["main"] - self.cpp_info.components["module"].requires = ["main"] - self.cpp_info.components["python_link_helper"].requires = ["main"] - self.cpp_info.components["windows_extras"].requires = ["main"] - self.cpp_info.components["lto"].requires = ["main"] - self.cpp_info.components["thin_lto"].requires = ["main"] - self.cpp_info.components["opt_size"].requires = ["main"] - self.cpp_info.components["python2_no_register"].requires = ["main"] - else: - self.cpp_info.includedirs.append(os.path.join( - self.package_folder, "include", "pybind11")) - - self.cpp_info.builddirs = [cmake_base_path] - - cmake_files = [os.path.join(cmake_base_path, "FindPythonLibsNew.cmake"), - os.path.join(cmake_base_path, "pybind11Tools.cmake")] - self.cpp_info.set_property("cmake_build_modules", cmake_files) - for generator in ["cmake", "cmake_multi", "cmake_find_package", "cmake_find_package_multi"]: - self.cpp_info.build_modules[generator] = cmake_files + self.cpp_info.set_property("cmake_target_name", "pybind11_all_do_not_use") + self.cpp_info.components["headers"].includedirs = ["include"] + self.cpp_info.components["pybind11_"].set_property("cmake_target_name", "pybind11::pybind11") + self.cpp_info.components["pybind11_"].set_property("cmake_module_file_name", "pybind11") + self.cpp_info.components["pybind11_"].names["cmake_find_package"] = "pybind11" + self.cpp_info.components["pybind11_"].builddirs = [cmake_base_path] + self.cpp_info.components["pybind11_"].requires = ["headers"] + cmake_file = os.path.join(cmake_base_path, "pybind11Common.cmake") + self.cpp_info.set_property("cmake_build_modules", [cmake_file]) + for generator in ["cmake_find_package", "cmake_find_package_multi"]: + self.cpp_info.components["pybind11_"].build_modules[generator].append(cmake_file) + self.cpp_info.components["embed"].requires = ["pybind11_"] + self.cpp_info.components["module"].requires = ["pybind11_"] + self.cpp_info.components["python_link_helper"].requires = ["pybind11_"] + self.cpp_info.components["windows_extras"].requires = ["pybind11_"] + self.cpp_info.components["lto"].requires = ["pybind11_"] + self.cpp_info.components["thin_lto"].requires = ["pybind11_"] + self.cpp_info.components["opt_size"].requires = ["pybind11_"] + self.cpp_info.components["python2_no_register"].requires = ["pybind11_"] diff --git a/recipes/pybind11/all/test_package/CMakeLists.txt b/recipes/pybind11/all/test_package/CMakeLists.txt index 7912a22ff7b4f..d142acb135035 100644 --- a/recipes/pybind11/all/test_package/CMakeLists.txt +++ b/recipes/pybind11/all/test_package/CMakeLists.txt @@ -1,16 +1,5 @@ cmake_minimum_required(VERSION 3.4) project(test_package CXX) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_output_dirs_setup() -conan_set_rpath() -conan_set_std() -conan_set_fpic() -conan_check_compiler() -conan_set_libcxx() -conan_set_vs_runtime() - find_package(pybind11 REQUIRED CONFIG) - pybind11_add_module(test_package MODULE test_package.cpp) set_property(TARGET test_package PROPERTY CXX_STANDARD 11) diff --git a/recipes/pybind11/all/test_package/conanfile.py b/recipes/pybind11/all/test_package/conanfile.py index 844a7165c3fbe..8c98920d26587 100644 --- a/recipes/pybind11/all/test_package/conanfile.py +++ b/recipes/pybind11/all/test_package/conanfile.py @@ -1,16 +1,40 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import Environment, VirtualRunEnv +from conan.tools.build import can_run + import os +from pathlib import PurePath import sys -from platform import python_version class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + deps = CMakeDeps(self) + deps.generate() + + toolchain = CMakeToolchain(self) + toolchain.variables["PYTHON_EXECUTABLE"] = PurePath(self._python_interpreter).as_posix() + toolchain.generate() + + env = Environment() + env.append_path("PYTHONPATH", os.path.join(self.build_folder, self.cpp.build.libdirs[0])) + env.vars(self, scope="run").save_script("testrun") + + run = VirtualRunEnv(self) + run.generate() + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) - cmake.definitions["PYTHON_EXECUTABLE"] = self._python_interpreter cmake.configure() cmake.build() @@ -21,7 +45,6 @@ def _python_interpreter(self): return sys.executable def test(self): - if not tools.cross_building(self): - with tools.environment_append({"PYTHONPATH": "lib"}): - self.run("{} {}".format(self._python_interpreter, os.path.join( - self.source_folder, "test.py")), run_environment=True) + if can_run(self): + module_path = os.path.join(self.source_folder, "test.py") + self.run(f"{self._python_interpreter} {module_path}", env="conanrun") diff --git a/recipes/pybind11/all/test_v1_package/CMakeLists.txt b/recipes/pybind11/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..3cee2617c4143 --- /dev/null +++ b/recipes/pybind11/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.4) +project(test_package CXX) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_output_dirs_setup() +conan_set_rpath() +conan_set_std() +conan_set_fpic() +conan_check_compiler() +conan_set_libcxx() +conan_set_vs_runtime() + +find_package(Python COMPONENTS Interpreter Development) +find_package(pybind11 REQUIRED CONFIG) + +Python_add_library(test_package ../test_package/test_package.cpp) +target_link_libraries(test_package PRIVATE pybind11::headers) +set_property(TARGET test_package PROPERTY CXX_STANDARD 11) diff --git a/recipes/pybind11/all/test_v1_package/conanfile.py b/recipes/pybind11/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..922ac10548541 --- /dev/null +++ b/recipes/pybind11/all/test_v1_package/conanfile.py @@ -0,0 +1,27 @@ +from conans import ConanFile, CMake, tools +import os +import sys +from platform import python_version + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["PYTHON_EXECUTABLE"] = self._python_interpreter + cmake.configure() + cmake.build() + + @property + def _python_interpreter(self): + if getattr(sys, "frozen", False): + return "python" + return sys.executable + + def test(self): + if not tools.cross_building(self): + with tools.environment_append({"PYTHONPATH": "lib"}): + python_module = os.path.join(self.source_folder, "..", "test_package", "test.py") + self.run(f"{self._python_interpreter} {python_module}", run_environment=True) diff --git a/recipes/pybind11/config.yml b/recipes/pybind11/config.yml index 4e03e90bbfa2e..d015836d04db4 100644 --- a/recipes/pybind11/config.yml +++ b/recipes/pybind11/config.yml @@ -9,3 +9,5 @@ versions: folder: all "2.10.0": folder: all + "2.10.1": + folder: all diff --git a/recipes/pybind11_json/all/conandata.yml b/recipes/pybind11_json/all/conandata.yml index 64febf91be27f..58e86b8427d45 100644 --- a/recipes/pybind11_json/all/conandata.yml +++ b/recipes/pybind11_json/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.2.13": + url: "https://github.com/pybind/pybind11_json/archive/0.2.13.tar.gz" + sha256: "6b12ddb4930a3135322890318fc15c4a69134f21120ea82163827c11411107a3" "0.2.12": url: "https://github.com/pybind/pybind11_json/archive/0.2.12.tar.gz" sha256: "a9e308d4cf3de16d192cd0baf641bfe17a3a3046e8652e6724204afa3e736db7" diff --git a/recipes/pybind11_json/config.yml b/recipes/pybind11_json/config.yml index e4bc47aa25d0c..d889e66f48c37 100644 --- a/recipes/pybind11_json/config.yml +++ b/recipes/pybind11_json/config.yml @@ -1,4 +1,6 @@ versions: + "0.2.13": + folder: all "0.2.12": folder: all "0.2.11": diff --git a/recipes/pystring/all/conandata.yml b/recipes/pystring/all/conandata.yml index 9954fce4e61c8..38de0bc9db7af 100644 --- a/recipes/pystring/all/conandata.yml +++ b/recipes/pystring/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.4": + url: "https://github.com/imageworks/pystring/archive/refs/tags/v1.1.4.tar.gz" + sha256: "49da0fe2a049340d3c45cce530df63a2278af936003642330287b68cefd788fb" "1.1.3": url: "https://github.com/imageworks/pystring/archive/refs/tags/v1.1.3.tar.gz" sha256: "358a56e756e701836b69a31c75d3d9d41c34d447cf7b3775bbd5620dcd3203d9" diff --git a/recipes/pystring/all/conanfile.py b/recipes/pystring/all/conanfile.py index 15149dd2319cf..aae1b97c58843 100644 --- a/recipes/pystring/all/conanfile.py +++ b/recipes/pystring/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class PystringConan(ConanFile): @@ -33,7 +33,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/pystring/all/test_package/conanfile.py b/recipes/pystring/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/pystring/all/test_package/conanfile.py +++ b/recipes/pystring/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/pystring/all/test_v1_package/CMakeLists.txt b/recipes/pystring/all/test_v1_package/CMakeLists.txt index 2083f8e07beb9..0d20897301b68 100644 --- a/recipes/pystring/all/test_v1_package/CMakeLists.txt +++ b/recipes/pystring/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(pystring REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE pystring::pystring) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/pystring/all/test_v1_package/conanfile.py b/recipes/pystring/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/pystring/all/test_v1_package/conanfile.py +++ b/recipes/pystring/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/pystring/config.yml b/recipes/pystring/config.yml index e1c4f3be24983..7f3d713ab8481 100644 --- a/recipes/pystring/config.yml +++ b/recipes/pystring/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.4": + folder: all "1.1.3": folder: all diff --git a/recipes/qarchive/all/CMakeLists.txt b/recipes/qarchive/all/CMakeLists.txt deleted file mode 100644 index 21270aca7f428..0000000000000 --- a/recipes/qarchive/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/qarchive/all/conandata.yml b/recipes/qarchive/all/conandata.yml index 953df9977dc0c..da2432b9b6e33 100644 --- a/recipes/qarchive/all/conandata.yml +++ b/recipes/qarchive/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "2.2.4": + url: "https://github.com/antony-jr/QArchive/archive/v2.2.4.tar.gz" + sha256: "7c7f0e3bf3d6fb5130aa4632201873511944cd98ab16b273da5072198f53ad7b" + "2.2.3": + url: "https://github.com/antony-jr/QArchive/archive/v2.2.3.tar.gz" + sha256: "2ada10efda34fe96c25744dd67e74ec68587d30ab01cc20be25cbcfb1e6262c4" + "2.1.1": + url: "https://github.com/antony-jr/QArchive/archive/v2.1.1.tar.gz" + sha256: "4ed51121a5bc9b5981d2fa3927f951a6a91ccca233d6b6dc4fef55b4ca5a2d92" "2.0.2": url: "https://github.com/antony-jr/QArchive/archive/v2.0.2.tar.gz" sha256: "f59207c0da2d68bbbdaca79751f08018226d3b587e3f97156b3aee994db018f6" @@ -6,13 +15,12 @@ sources: url: "https://github.com/antony-jr/QArchive/archive/v2.0.1.tar.gz" sha256: "ee8e259795f4f991c0465c3d95cf018bea2a72e9a31f744f2344aaa43201f369" patches: + "2.1.1": + - patch_file: "patches/0001-cmake-conan-compatibility.patch" + - patch_file: "patches/0002-export-symbols.patch" "2.0.2": - patch_file: "patches/0001-cmake-conan-compatibility.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-export-symbols.patch" - base_path: "source_subfolder" "2.0.1": - patch_file: "patches/0001-cmake-conan-compatibility.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-export-symbols.patch" - base_path: "source_subfolder" diff --git a/recipes/qarchive/all/conanfile.py b/recipes/qarchive/all/conanfile.py index 7f628c0084e94..5cf8969c4ade0 100644 --- a/recipes/qarchive/all/conanfile.py +++ b/recipes/qarchive/all/conanfile.py @@ -1,9 +1,11 @@ -from conans import ConanFile, tools, CMake -import functools +from conan import ConanFile +from conan.tools.files import get, apply_conandata_patches, rmdir, save, export_conandata_patches +from conan.tools.cmake import CMakeToolchain, CMake, cmake_layout, CMakeDeps +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class QarchiveConan(ConanFile): @@ -27,16 +29,12 @@ class QarchiveConan(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package" - @property - def _source_subfolder(self): - return "source_subfolder" + def _qt_major(self): + return Version(self.dependencies["qt"].ref.version).major def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -47,34 +45,39 @@ def configure(self): del self.options.fPIC def requirements(self): - self.requires("libarchive/3.6.0") - self.requires("qt/5.15.3") + self.requires("libarchive/3.6.1") + self.requires("qt/5.15.7") def build_requirements(self): - self.build_requires("cmake/3.23.1") + self.tool_requires("cmake/3.24.2") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["QARCHIVE_QT_VERSION_MAJOR"] = self._qt_major + tc.generate() + + cd = CMakeDeps(self) + cd.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + self.copy("LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # TODO: to remove in conan v2 once cmake_find_package_* generators removed self._create_cmake_module_alias_targets( @@ -82,21 +85,20 @@ def package(self): {"QArchive": "QArchive::QArchive"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "QArchive") diff --git a/recipes/qarchive/all/patches/0002-export-symbols.patch b/recipes/qarchive/all/patches/0002-export-symbols.patch index 10ea378156b7a..1ca6edf716eac 100644 --- a/recipes/qarchive/all/patches/0002-export-symbols.patch +++ b/recipes/qarchive/all/patches/0002-export-symbols.patch @@ -1,6 +1,6 @@ --- a/include/qarchive_enums.hpp +++ b/include/qarchive_enums.hpp -@@ -1,11 +1,12 @@ +@@ -1,10 +1,11 @@ #ifndef QARCHIVE_ENUMS_HPP_INCLUDED #define QARCHIVE_ENUMS_HPP_INCLUDED +#include "qarchive_global.hpp" @@ -13,4 +13,3 @@ +QARCHIVE_EXPORT QString errorCodeToString(short); /* - * Common error codes , these are most likely will be diff --git a/recipes/qarchive/all/test_package/CMakeLists.txt b/recipes/qarchive/all/test_package/CMakeLists.txt index 9dc31fe18035d..eb399371778cf 100644 --- a/recipes/qarchive/all/test_package/CMakeLists.txt +++ b/recipes/qarchive/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(QArchive REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/qarchive/all/test_package/conanfile.py b/recipes/qarchive/all/test_package/conanfile.py index 38f4483872d47..0a318ba85a952 100644 --- a/recipes/qarchive/all/test_package/conanfile.py +++ b/recipes/qarchive/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools import os - +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake +from conan.tools.layout import cmake_layout class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qarchive/all/test_package/test_package.cpp b/recipes/qarchive/all/test_package/test_package.cpp index d0ca93ec0653e..7ab801d5a5a15 100644 --- a/recipes/qarchive/all/test_package/test_package.cpp +++ b/recipes/qarchive/all/test_package/test_package.cpp @@ -1,17 +1,8 @@ -#include #include int main(int argc, char **argv) { - using QArchive::DiskExtractor; - QCoreApplication app(argc, argv); - DiskExtractor Extractor("Test.7z"); - - /* Connect Signals and Slots. */ - QObject::connect(&Extractor , - &DiskExtractor::finished , - &app , - &QCoreApplication::quit); + QArchive::DiskExtractor Extractor("Test.7z"); Extractor.start(); Extractor.cancel(); diff --git a/recipes/qarchive/all/test_v1_package/CMakeLists.txt b/recipes/qarchive/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..cf1b8efc8c833 --- /dev/null +++ b/recipes/qarchive/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(QArchive REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} QArchive) +# Must compile with "-fPIC" since Qt was built with -reduce-relocations. +target_compile_options(${PROJECT_NAME} PRIVATE -fPIC) +set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) diff --git a/recipes/qarchive/all/test_v1_package/conanfile.py b/recipes/qarchive/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/qarchive/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/qarchive/config.yml b/recipes/qarchive/config.yml index 45be05c3784b4..3db8c0c3676e9 100644 --- a/recipes/qarchive/config.yml +++ b/recipes/qarchive/config.yml @@ -1,4 +1,10 @@ versions: + "2.2.4": + folder: all + "2.2.3": + folder: all + "2.1.1": + folder: all "2.0.2": folder: all "2.0.1": diff --git a/recipes/qcbor/all/CMakeLists.txt b/recipes/qcbor/all/CMakeLists.txt deleted file mode 100644 index 221b59e4281f8..0000000000000 --- a/recipes/qcbor/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include("conanbuildinfo.cmake") -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/qcbor/all/conandata.yml b/recipes/qcbor/all/conandata.yml index 61a8ef6901f17..5b5b4f359cdd2 100644 --- a/recipes/qcbor/all/conandata.yml +++ b/recipes/qcbor/all/conandata.yml @@ -1,8 +1,23 @@ sources: + "1.2": + url: "https://github.com/laurencelundblade/QCBOR/archive/refs/tags/v1.2.tar.gz" + sha256: "0f706ad90ada600bd1ddbdf8dc6f2f5910e11de355bb4454b9b4123f0e4ff525" + "1.1": + url: "https://github.com/laurencelundblade/QCBOR/archive/refs/tags/v1.1.tar.gz" + sha256: "1e7e8986bf918eafb11f5373df9b80fd56811d2cd39c7630d8171130802199b6" "1.0": url: "https://github.com/laurencelundblade/QCBOR/archive/refs/tags/v1.0.tar.gz" sha256: "961a46eb5a599cc040bfce4f4fade4427e046f1748f37ba4ebbc097fb9cdf1d3" patches: + "1.2": + - patch_file: "patches/1.2-0001-fix-cmake.patch" + patch_description: "disable fix fPIC and add installation" + patch_type: "conan" + "1.1": + - patch_file: "patches/1.1-0001-fix-cmake.patch" + patch_description: "link mathlib and add installation" + patch_type: "conan" "1.0": - patch_file: "patches/1.0-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "link mathlib and add installation" + patch_type: "conan" diff --git a/recipes/qcbor/all/conanfile.py b/recipes/qcbor/all/conanfile.py index 4bf44f9907f16..7d87de4445169 100644 --- a/recipes/qcbor/all/conanfile.py +++ b/recipes/qcbor/all/conanfile.py @@ -1,10 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rmdir, load, save +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.scm import Version + import os -import functools import re -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class QCBORConan(ConanFile): name = "qcbor" @@ -17,59 +19,64 @@ class QCBORConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "disable_float": [False, "HW_USE", "PREFERRED", "ALL"], } default_options = { "shared": False, "fPIC": True, + "disable_float": False, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "1.2": + del self.options.disable_float + def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) >= "1.2": + tc.variables["QCBOR_OPT_DISABLE_FLOAT_HW_USE"] = self.options.disable_float in ["HW_USE", "PREFERRED", "ALL"] + tc.variables["QCBOR_OPT_DISABLE_FLOAT_PREFERRED"] = self.options.disable_float in ["PREFERRED", "ALL"] + tc.variables["QCBOR_OPT_DISABLE_FLOAT_ALL"] = self.options.disable_float == "ALL" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # Extract the License/s from README.md to a file - tmp = tools.load(os.path.join(self._source_subfolder, "inc", "qcbor", "qcbor.h")) + tmp = load(self, os.path.join(self.source_folder, "inc", "qcbor", "qcbor.h")) license_contents = re.search("( Copyright.*) =====", tmp, re.DOTALL)[1] - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) def package_info(self): self.cpp_info.libs = ["qcbor"] - if self.settings.os in ["Linux", "FreeBSD"]: + if self.settings.os in ["Linux", "FreeBSD"] and \ + (Version(self.version) < "1.2" or self.options.disable_float == False): self.cpp_info.system_libs.append("m") diff --git a/recipes/qcbor/all/patches/1.1-0001-fix-cmake.patch b/recipes/qcbor/all/patches/1.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..e5969488c2420 --- /dev/null +++ b/recipes/qcbor/all/patches/1.1-0001-fix-cmake.patch @@ -0,0 +1,24 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f0b67b9..4b00b8b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -17,3 +17,19 @@ set(SOURCE + add_library(qcbor ${SOURCE}) + + target_include_directories(qcbor PUBLIC inc) ++ ++set_target_properties(qcbor PROPERTIES ++ WINDOWS_EXPORT_ALL_SYMBOLS ON ++) ++ ++find_library(LIBM m) ++target_link_libraries(qcbor PRIVATE $<$:${LIBM}>) ++ ++include(GNUInstallDirs) ++install(TARGETS qcbor ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") ++ ++install(DIRECTORY "inc/qcbor" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") diff --git a/recipes/qcbor/all/patches/1.2-0001-fix-cmake.patch b/recipes/qcbor/all/patches/1.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..8b659e24ca0a3 --- /dev/null +++ b/recipes/qcbor/all/patches/1.2-0001-fix-cmake.patch @@ -0,0 +1,33 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 486946c..4234a59 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,10 +58,14 @@ target_compile_definitions(qcbor + $<$:USEFULBUF_DISABLE_ALL_FLOAT> + ) + +-if (BUILD_SHARED_LIBS) ++if (0) + target_compile_options(qcbor PRIVATE -Os -fPIC) + endif() + ++set_target_properties(qcbor PROPERTIES ++ WINDOWS_EXPORT_ALL_SYMBOLS ON ++) ++ + # The math library is needed for floating-point support. + # To avoid need for it #define QCBOR_DISABLE_FLOAT_HW_USE + if (CMAKE_C_COMPILER_ID STREQUAL "GNU") +@@ -75,3 +79,12 @@ endif() + if (NOT BUILD_QCBOR_TEST STREQUAL "OFF") + add_subdirectory(test) + endif() ++ ++include(GNUInstallDirs) ++install(TARGETS qcbor ++ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ++ RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" ++ PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") ++ ++install(DIRECTORY "inc/qcbor" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") diff --git a/recipes/qcbor/all/test_package/CMakeLists.txt b/recipes/qcbor/all/test_package/CMakeLists.txt index c047a44489253..bc1e8dfcced62 100644 --- a/recipes/qcbor/all/test_package/CMakeLists.txt +++ b/recipes/qcbor/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package C) find_package(qcbor REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} qcbor::qcbor) +target_link_libraries(${PROJECT_NAME} PRIVATE qcbor::qcbor) diff --git a/recipes/qcbor/all/test_package/conanfile.py b/recipes/qcbor/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/qcbor/all/test_package/conanfile.py +++ b/recipes/qcbor/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qcbor/all/test_v1_package/CMakeLists.txt b/recipes/qcbor/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..46fc5f986a893 --- /dev/null +++ b/recipes/qcbor/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_packages) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/qcbor/all/test_v1_package/conanfile.py b/recipes/qcbor/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/qcbor/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/qcbor/config.yml b/recipes/qcbor/config.yml index edab1ee152d36..db25e2b16686a 100644 --- a/recipes/qcbor/config.yml +++ b/recipes/qcbor/config.yml @@ -1,3 +1,7 @@ versions: + "1.2": + folder: all + "1.1": + folder: all "1.0": folder: all diff --git a/recipes/qcustomplot/all/CMakeLists.txt b/recipes/qcustomplot/all/CMakeLists.txt index de077ce79626a..108a85b9380f1 100644 --- a/recipes/qcustomplot/all/CMakeLists.txt +++ b/recipes/qcustomplot/all/CMakeLists.txt @@ -31,7 +31,7 @@ if(QCUSTOMPLOT_USE_OPENGL) # QCustomPlot does not use the QOpenGLFunctions class, and instead needs to link directly # to OpenGL32.lib on Windows, regardless of whether qt:opengl is 'dynamic' or 'desktop' - if(WIN32) + if(CMAKE_SYSTEM_NAME STREQUAL "Windows") find_package(OpenGL REQUIRED) target_link_libraries(${PROJECT_NAME} PRIVATE OpenGL::GL) endif() @@ -51,6 +51,7 @@ else() message(FATAL_ERROR "Qt < 5 not yet supported in this recipe") endif() +include(GNUInstallDirs) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/recipes/qcustomplot/all/conandata.yml b/recipes/qcustomplot/all/conandata.yml index 817a87b4a3253..9655ef7e13aab 100644 --- a/recipes/qcustomplot/all/conandata.yml +++ b/recipes/qcustomplot/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.1.1": + url: "https://www.qcustomplot.com/release/2.1.1/QCustomPlot-source.tar.gz" + sha256: "5e2d22dec779db8f01f357cbdb25e54fbcf971adaee75eae8d7ad2444487182f" "2.1.0": url: "https://www.qcustomplot.com/release/2.1.0fixed/QCustomPlot-source.tar.gz" sha256: "357b78be0f52b2d01c17ec3e2e1271255761810af7e8a9476cef51fccf1a0f44" diff --git a/recipes/qcustomplot/all/conanfile.py b/recipes/qcustomplot/all/conanfile.py index c33e4be280fd7..067cd911c84e9 100644 --- a/recipes/qcustomplot/all/conanfile.py +++ b/recipes/qcustomplot/all/conanfile.py @@ -2,21 +2,20 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file +from conan.tools.files import apply_conandata_patches, copy, get, export_conandata_patches, replace_in_file from conan.tools.scm import Version import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.53.0" -class QcustomplotConan(ConanFile): +class QCustomPlotConan(ConanFile): name = "qcustomplot" description = "QCustomPlot is a Qt C++ widget for plotting and data visualization." license = "GPL-3.0-only" - topics = ("qcustomplot", "qt", "chart", "plot", "data-visualization") + topics = ("chart", "data-visualization", "graph", "plot", "qt") homepage = "https://www.qcustomplot.com" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -31,8 +30,7 @@ class QcustomplotConan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -40,16 +38,16 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") # FIXME: we shouldn't have to force shared in qt, but config file # generated by conan in qt static is likely broken, or maybe env vars. self.options["qt"].shared = True def requirements(self): if Version(self.version) >= "2.0.0": - self.requires("qt/6.3.0") + self.requires("qt/6.4.1") else: - self.requires("qt/5.15.3") + self.requires("qt/5.15.7") if self.options.with_opengl and self.settings.os == "Windows": self.requires("opengl/system") @@ -58,9 +56,9 @@ def validate(self): min_cppstd = "11" if Version(self.dependencies["qt"].ref.version) < "6.0.0" else "17" check_min_cppstd(self, min_cppstd) if not (self.dependencies["qt"].options.gui and self.dependencies["qt"].options.widgets): - raise ConanInvalidConfiguration("qcustomplot requires qt gui and widgets") + raise ConanInvalidConfiguration(f"{self.ref} requires qt gui and widgets") if self.info.options.with_opengl and self.dependencies["qt"].options.opengl == "no": - raise ConanInvalidConfiguration("qcustomplot with opengl requires Qt with opengl enabled") + raise ConanInvalidConfiguration(f"{self.ref} with opengl requires Qt with opengl enabled") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/qcustomplot/all/test_package/conanfile.py b/recipes/qcustomplot/all/test_package/conanfile.py index 5c787bba8a5a4..82919b2651add 100644 --- a/recipes/qcustomplot/all/test_package/conanfile.py +++ b/recipes/qcustomplot/all/test_package/conanfile.py @@ -7,6 +7,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/qcustomplot/all/test_v1_package/CMakeLists.txt b/recipes/qcustomplot/all/test_v1_package/CMakeLists.txt index 664457fc1607f..925ecbe19e448 100644 --- a/recipes/qcustomplot/all/test_v1_package/CMakeLists.txt +++ b/recipes/qcustomplot/all/test_v1_package/CMakeLists.txt @@ -1,22 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) - -find_package(qcustomplot REQUIRED CONFIG) -target_link_libraries(${PROJECT_NAME} PRIVATE qcustomplot::qcustomplot) - -if(QT_VERSION VERSION_GREATER_EQUAL "6.0.0") - find_package(Qt6 COMPONENTS Core Widgets REQUIRED CONFIG) - target_link_libraries(${PROJECT_NAME} PRIVATE Qt6::Core Qt6::Widgets) - target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) -elseif(QT_VERSION VERSION_GREATER_EQUAL "5.0.0") - find_package(Qt5 COMPONENTS Core Widgets REQUIRED CONFIG) - target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Widgets) - target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_11) -else() - message(FATAL_ERROR "Qt < 5 not yet supported in this recipe") -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/qcustomplot/config.yml b/recipes/qcustomplot/config.yml index 7d0ad87c0d0d8..a7d0cc4f0654b 100644 --- a/recipes/qcustomplot/config.yml +++ b/recipes/qcustomplot/config.yml @@ -1,4 +1,6 @@ versions: + "2.1.1": + folder: all "2.1.0": folder: all "1.3.2": diff --git a/recipes/qpdf/all/conandata.yml b/recipes/qpdf/all/conandata.yml new file mode 100644 index 0000000000000..6a5e7ead04475 --- /dev/null +++ b/recipes/qpdf/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "11.1.1": + url: "https://github.com/qpdf/qpdf/archive/refs/tags/v11.1.1.tar.gz" + sha256: "785edab622a1bc7e25e1537ad2c325005d48c5c7957f7abedff405deb80fa59a" +patches: + "11.1.1": + - patch_file: "patches/0001-libqpdf-cmake-deps-jpeg-zlib.patch" + patch_description: "Inject Conan Deps, disable qpdf-dep handling: update libqpdf/CMakeLists.txt by disabling cmake fails, caused by pkg_config fail to find dependencies. Add conan generated cmake dependencies instead." + patch_type: "conan" + - patch_file: "patches/0002-exclude-unnecessary-cmake-subprojects.patch" + patch_description: "Exclude unnecessary targets: update CMakeLists.txt removing subdir includes for binaries, tests, examples, docs and fuzzing" + patch_type: "conan" diff --git a/recipes/qpdf/all/conanfile.py b/recipes/qpdf/all/conanfile.py new file mode 100644 index 0000000000000..9f7b0876a9bbc --- /dev/null +++ b/recipes/qpdf/all/conanfile.py @@ -0,0 +1,175 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.files import replace_in_file, apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import check_min_vs +from conan.tools.env import VirtualBuildEnv +import os + +required_conan_version = ">=1.53.0" + +class PackageConan(ConanFile): + name = "qpdf" + description = "QPDF is a command-line tool and C++ library that performs content-preserving transformations on PDF files." + license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/qpdf/qpdf" + topics = ("pdf") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_ssl": ["internal", "openssl", "gnutls"], + "with_jpeg": ["libjpeg", "libjpeg-turbo", "mozjpeg"], + } + default_options = { + "shared": False, + "fPIC": True, + "with_ssl": "openssl", + "with_jpeg": "libjpeg", + } + + @property + def _minimum_cpp_standard(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + "clang": "3.4", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + # https://qpdf.readthedocs.io/en/stable/installation.html#basic-dependencies + self.requires("zlib/1.2.13") + if self.options.with_ssl == "openssl": + self.requires("openssl/1.1.1s") + elif self.options.with_ssl == "gnutls": + raise ConanInvalidConfiguration("GnuTLS is not available in Conan Center yet.") + if self.options.with_jpeg == "libjpeg": + self.requires("libjpeg/9e") + elif self.options.with_jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "mozjpeg": + self.requires("mozjpeg/4.1.1") + + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, "150") + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") + + def build_requirements(self): + self.tool_requires("cmake/3.24.1") + self.tool_requires("pkgconf/1.9.3") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared + # https://qpdf.readthedocs.io/en/latest/installation.html#build-time-crypto-selection + tc.variables["USE_IMPLICIT_CRYPTO"] = False + tc.cache_variables["CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS_SKIP"] = True + if self.options.with_ssl == "internal": + tc.variables["REQUIRE_CRYPTO_NATIVE"] = True + tc.variables["REQUIRE_CRYPTO_GNUTLS"] = False + tc.variables["REQUIRE_CRYPTO_OPENSSL"] = False + if self.options.with_ssl == "openssl": + tc.variables["REQUIRE_CRYPTO_NATIVE"] = False + tc.variables["REQUIRE_CRYPTO_GNUTLS"] = False + tc.variables["REQUIRE_CRYPTO_OPENSSL"] = True + if self.options.with_ssl == "gnutls": + tc.variables["REQUIRE_CRYPTO_NATIVE"] = False + tc.variables["REQUIRE_CRYPTO_GNUTLS"] = True + tc.variables["REQUIRE_CRYPTO_OPENSSL"] = False + tc.generate() + # TODO: after https://github.com/conan-io/conan/issues/11962 is solved + # we might obsolete here cmake deps generation and cmake patching and get + # the possibility to go for to pkg_config based dependency discovery instead. + # At the moment, even with the linked work-around, the linkage is mixed-up + tc = CMakeDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate(scope="build") + + def _patch_sources(self): + apply_conandata_patches(self) + # we generally expect to have one crypto in-place, but need to patch the found mechanics + # since we avoid currently the correct pkg_config + replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"), + "set(FOUND_CRYPTO OFF)", "set(FOUND_CRYPTO ON)") + if self.options.with_ssl == "openssl": + replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"), + "set(USE_CRYPTO_OPENSSL OFF)", "set(USE_CRYPTO_OPENSSL ON)") + replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"), + "find_package(ZLIB REQUIRED)", + "find_package(ZLIB REQUIRED)\nfind_package(OpenSSL REQUIRED)\n") + replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"), + "PUBLIC JPEG::JPEG ZLIB::ZLIB", "PUBLIC JPEG::JPEG ZLIB::ZLIB OpenSSL::SSL") + if self.options.with_ssl == "gnutls": + replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"), + "set(USE_CRYPTO_GNUTLS OFF)", "set(USE_CRYPTO_GNUTLS ON)") + if self.options.with_ssl == "internal": + replace_in_file(self, os.path.join(self.source_folder, "libqpdf", "CMakeLists.txt"), + "set(USE_CRYPTO_NATIVE OFF)", "set(USE_CRYPTO_NATIVE ON)") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "qpdf") + + self.cpp_info.components["libqpdf"].libs = ["qpdf"] + self.cpp_info.components["libqpdf"].set_property("pkg_config_name", "libqpdf") + self.cpp_info.components["libqpdf"].set_property("cmake_target_name", "qpdf::libqpdf") + self.cpp_info.components["libqpdf"].requires.append("zlib::zlib") + self.cpp_info.components["libqpdf"].requires.append(f"{self.options.with_jpeg}::{self.options.with_jpeg}") + + if self.options.with_ssl == "openssl": + self.cpp_info.components["libqpdf"].requires.append("openssl::openssl") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libqpdf"].system_libs.append("m") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "qpdf" + self.cpp_info.filenames["cmake_find_package_multi"] = "qpdf" + self.cpp_info.names["cmake_find_package"] = "qpdf" + self.cpp_info.names["cmake_find_package_multi"] = "qpdf" + self.cpp_info.components["libqpdf"].names["cmake_find_package"] = "libqpdf" + self.cpp_info.components["libqpdf"].names["cmake_find_package_multi"] = "libqpdf" diff --git a/recipes/qpdf/all/patches/0001-libqpdf-cmake-deps-jpeg-zlib.patch b/recipes/qpdf/all/patches/0001-libqpdf-cmake-deps-jpeg-zlib.patch new file mode 100644 index 0000000000000..0d8edceb557a6 --- /dev/null +++ b/recipes/qpdf/all/patches/0001-libqpdf-cmake-deps-jpeg-zlib.patch @@ -0,0 +1,113 @@ +diff --git a/libqpdf/CMakeLists.txt b/libqpdf/CMakeLists.txt +index 7053e205..9f5962f7 100644 +--- a/libqpdf/CMakeLists.txt ++++ b/libqpdf/CMakeLists.txt +@@ -128,13 +128,8 @@ include(CheckSymbolExists) + set(dep_include_directories) + set(dep_link_directories) + set(dep_link_libraries) +-set(ANYTHING_MISSING 0) + +-if(WIN32 AND (EXISTS ${qpdf_SOURCE_DIR}/external-libs)) +- set(EXTERNAL_LIBS 1) +-else() +- set(EXTERNAL_LIBS 0) +-endif() ++set(EXTERNAL_LIBS 0) + + if(EXTERNAL_LIBS) + set(EXTLIBDIR ${qpdf_SOURCE_DIR}/external-libs) +@@ -161,9 +156,6 @@ if(NOT EXTERNAL_LIBS) + if(ZLIB_H_PATH AND ZLIB_LIB_PATH) + list(APPEND dep_include_directories ${ZLIB_H_PATH}) + list(APPEND dep_link_libraries ${ZLIB_LIB_PATH}) +- else() +- message(SEND_ERROR "zlib not found") +- set(ANYTHING_MISSING 1) + endif() + endif() + endif() +@@ -182,9 +174,6 @@ if(NOT EXTERNAL_LIBS) + list(APPEND dep_include_directories ${LIBJPEG_H_PATH}) + list(APPEND dep_link_libraries ${LIBJPEG_LIB_PATH}) + set(JPEG_INCLUDE ${LIBJPEG_H_PATH}) +- else() +- message(SEND_ERROR "libjpeg not found") +- set(ANYTHING_MISSING 1) + endif() + endif() + endif() +@@ -220,9 +209,6 @@ if(USE_IMPLICIT_CRYPTO OR REQUIRE_CRYPTO_OPENSSL) + list(APPEND dep_link_libraries ${OPENSSL_LIB_PATH}) + set(USE_CRYPTO_OPENSSL ON) + set(FOUND_CRYPTO ON) +- elseif(REQUIRE_CRYPTO_OPENSSL) +- message(SEND_ERROR "openssl not found") +- set(ANYTHING_MISSING 1) + endif() + endif() + endif() +@@ -241,9 +227,6 @@ if(USE_IMPLICIT_CRYPTO OR REQUIRE_CRYPTO_GNUTLS) + list(APPEND dep_link_libraries ${GNUTLS_LIB_PATH}) + set(USE_CRYPTO_GNUTLS ON) + set(FOUND_CRYPTO ON) +- elseif(REQUIRE_CRYPTO_GNUTLS) +- message(SEND_ERROR "gnutls not found") +- set(ANYTHING_MISSING 1) + endif() + endif() + endif() +@@ -268,14 +251,9 @@ if(FOUND_CRYPTO) + set(DEFAULT_CRYPTO "native") + endif() + endif() +-else() +- message(SEND_ERROR "no crypto provider is available") +- set(ANYTHING_MISSING 1) +-endif() +-if(ANYTHING_MISSING) +- message(FATAL_ERROR "Missing dependencies; unable to continue") + endif() + ++ + message(STATUS "") + message(STATUS "*** Crypto Summary ***") + message(STATUS " GNU TLS crypto enabled: " ${USE_CRYPTO_GNUTLS}) +@@ -403,6 +381,10 @@ endif() + # use PIC for the object library so we don't have to compile twice. + set(OBJECT_LIB libqpdf_object) + add_library(${OBJECT_LIB} OBJECT ${libqpdf_SOURCES}) ++find_package(JPEG REQUIRED) ++find_package(ZLIB REQUIRED) ++target_link_libraries(${OBJECT_LIB} PUBLIC JPEG::JPEG ZLIB::ZLIB) ++ + if(OBJECT_LIB_IS_PIC) + target_compile_definitions(${OBJECT_LIB} PRIVATE libqpdf_EXPORTS) + endif() +@@ -498,8 +480,6 @@ if(BUILD_SHARED_LIBS) + PUBLIC + $ + $) +- target_link_directories(${SHARED_LIB} PRIVATE ${dep_link_directories}) +- target_link_libraries(${SHARED_LIB} PRIVATE ${dep_link_libraries}) + if(ATOMIC_LIBRARY) + target_link_libraries(${SHARED_LIB} PRIVATE ${ATOMIC_LIBRARY}) + endif() +@@ -507,6 +487,8 @@ if(BUILD_SHARED_LIBS) + target_link_options(${SHARED_LIB} PRIVATE ${LD_VERSION_FLAGS}) + endif() + ++ target_link_libraries(${SHARED_LIB} PUBLIC JPEG::JPEG ZLIB::ZLIB) ++ + target_include_directories(${SHARED_LIB} + PRIVATE ${qpdf_SOURCE_DIR}/libqpdf ${CMAKE_CURRENT_BINARY_DIR}) + +@@ -544,6 +526,8 @@ if(BUILD_STATIC_LIBS) + target_link_libraries(${STATIC_LIB} INTERFACE ${ATOMIC_LIBRARY}) + endif() + ++ target_link_libraries(${STATIC_LIB} PUBLIC JPEG::JPEG ZLIB::ZLIB) ++ + # Avoid name clashes on Windows with the the DLL import library. + if(NOT DEFINED STATIC_SUFFIX AND BUILD_SHARED_LIBS) + if (WIN32) diff --git a/recipes/qpdf/all/patches/0002-exclude-unnecessary-cmake-subprojects.patch b/recipes/qpdf/all/patches/0002-exclude-unnecessary-cmake-subprojects.patch new file mode 100644 index 0000000000000..2e40ca26d687e --- /dev/null +++ b/recipes/qpdf/all/patches/0002-exclude-unnecessary-cmake-subprojects.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 5c0915f3..6c4945d3 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -323,12 +323,6 @@ add_test( + # add_subdirectory order affects test order + add_subdirectory(include) + add_subdirectory(libqpdf) +-add_subdirectory(qpdf) +-add_subdirectory(libtests) +-add_subdirectory(examples) +-add_subdirectory(zlib-flate) +-add_subdirectory(manual) +-add_subdirectory(fuzz) + + # We don't need to show everything -- just the things that we really + # need to be sure are right or that are turned on or off with complex diff --git a/recipes/qpdf/all/test_package/CMakeLists.txt b/recipes/qpdf/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2892d11ff1f83 --- /dev/null +++ b/recipes/qpdf/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(qpdf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE qpdf::libqpdf) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +# msvc has problems consuming #warning macro +# therefore we need a code-path in the include avoiding this warning https://github.com/qpdf/qpdf/issues/804 +target_compile_definitions(${PROJECT_NAME} PUBLIC POINTERHOLDER_TRANSITION=4) diff --git a/recipes/qpdf/all/test_package/conanfile.py b/recipes/qpdf/all/test_package/conanfile.py new file mode 100644 index 0000000000000..57b63cfec4d16 --- /dev/null +++ b/recipes/qpdf/all/test_package/conanfile.py @@ -0,0 +1,24 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/qpdf/all/test_package/test_package.cpp b/recipes/qpdf/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..f79386dd766bb --- /dev/null +++ b/recipes/qpdf/all/test_package/test_package.cpp @@ -0,0 +1,21 @@ +#include +#include +#include +#include + +int main(int argc, char* argv[]) +{ + std::cout << "QPDF_VERSION " << QPDF_VERSION << "\n"; + + try { + QPDF pdf; + pdf.emptyPDF(); + QPDFWriter w(pdf, "empty_example.pdf"); + w.write(); + } catch (std::exception& e) { + std::cerr << e.what() << "\n"; + exit(2); + } + + return 0; +} diff --git a/recipes/qpdf/all/test_v1_package/CMakeLists.txt b/recipes/qpdf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..ccb1cc676af03 --- /dev/null +++ b/recipes/qpdf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(qpdf REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE qpdf::libqpdf) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +# msvc has problems consuming #warning macro +# therefore we need a code-path in the include avoiding this warning https://github.com/qpdf/qpdf/issues/804 +target_compile_definitions(${PROJECT_NAME} PUBLIC POINTERHOLDER_TRANSITION=4) diff --git a/recipes/qpdf/all/test_v1_package/conanfile.py b/recipes/qpdf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/qpdf/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/qpdf/config.yml b/recipes/qpdf/config.yml new file mode 100644 index 0000000000000..35a13df3f72ef --- /dev/null +++ b/recipes/qpdf/config.yml @@ -0,0 +1,3 @@ +versions: + "11.1.1": + folder: all diff --git a/recipes/qpoases/all/CMakeLists.txt b/recipes/qpoases/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/qpoases/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/qpoases/all/conanfile.py b/recipes/qpoases/all/conanfile.py index 1b1c363f97808..3f8123bb2aabd 100644 --- a/recipes/qpoases/all/conanfile.py +++ b/recipes/qpoases/all/conanfile.py @@ -1,59 +1,52 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get import os -from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.46.0" class ConanRecipe(ConanFile): name = "qpoases" - description = "Open-source C++ implementation of the recently proposed online active set strategy." - topics = ("conan", "container", "parametric", "quadratic", "programming") - + topics = ("container", "parametric", "quadratic", "programming") homepage = "https://github.com/coin-or/qpOASES" url = "https://github.com/conan-io/conan-center-index" - license = "LGPL-2.1" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - settings = "os", "arch", "compiler", "build_type" - options = {"fPIC": [True, False]} - default_options = {"fPIC": True} - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + options = { + "fPIC": [True, False], + } + default_options = { + "fPIC": True, + } def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") + def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "qpOASES-releases-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["QPOASES_BUILD_EXAMPLES"] = False - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["QPOASES_BUILD_EXAMPLES"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.names["cmake_find_package"] = "qpOASES" - self.cpp_info.names["cmake_find_package_multi"] = "qpOASES" - - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["qpOASES"] diff --git a/recipes/qpoases/all/test_package/CMakeLists.txt b/recipes/qpoases/all/test_package/CMakeLists.txt index 8ed5cd5c3e757..0b4cf698456e7 100644 --- a/recipes/qpoases/all/test_package/CMakeLists.txt +++ b/recipes/qpoases/all/test_package/CMakeLists.txt @@ -1,13 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +project(test_package LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 11) +find_package(qpoases REQUIRED CONFIG) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) - -find_package(qpOASES REQUIRED) - -add_executable(test_package test_package.cpp) - -target_link_libraries(test_package PRIVATE qpOASES::qpOASES) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE qpoases::qpoases) diff --git a/recipes/qpoases/all/test_package/conanfile.py b/recipes/qpoases/all/test_package/conanfile.py index 1df900244a291..0a6bc68712d90 100644 --- a/recipes/qpoases/all/test_package/conanfile.py +++ b/recipes/qpoases/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qpoases/all/test_v1_package/CMakeLists.txt b/recipes/qpoases/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/qpoases/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/qpoases/all/test_v1_package/conanfile.py b/recipes/qpoases/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/qpoases/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/qr-code-generator/all/CMakeLists.txt b/recipes/qr-code-generator/all/CMakeLists.txt index fe596e9b51aaa..60ddaa9f6b380 100644 --- a/recipes/qr-code-generator/all/CMakeLists.txt +++ b/recipes/qr-code-generator/all/CMakeLists.txt @@ -1,36 +1,9 @@ -cmake_minimum_required (VERSION 3.4) -set(CMAKE_OSX_DEPLOYMENT_TARGET "10.9" CACHE STRING "Minimum OS X deployment version") -project (QR-Code-Generator) +cmake_minimum_required(VERSION 3.15) +project(QR-Code-Generator) -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -if(MSVC) - add_definitions (-D_WIN32_WINNT=0x0601) - add_definitions (-D_SCL_SECURE_NO_WARNINGS=1) - add_definitions (-D_CRT_SECURE_NO_WARNINGS=1) - - set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD 1) - - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc /utf-8") -endif() - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - set(CMAKE_VS_INCLUDE_INSTALL_TO_DEFAULT_BUILD TRUE) -endif() - -include(files.cmake) +include(src/files.cmake) add_library(${LIBRARY_NAME} ${SRC}) -INSTALL(TARGETS ${LIBRARY_NAME} - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) - -INSTALL(FILES ${HEADERS} DESTINATION include/qrcodegen) +set_target_properties(${LIBRARY_NAME} PROPERTIES PUBLIC_HEADER "${HEADERS}") +install(TARGETS ${LIBRARY_NAME} RUNTIME LIBRARY ARCHIVE PUBLIC_HEADER DESTINATION include/qrcodegen) diff --git a/recipes/qr-code-generator/all/conandata.yml b/recipes/qr-code-generator/all/conandata.yml index ffd2cd9e51e8c..d6af66ca5f3e4 100644 --- a/recipes/qr-code-generator/all/conandata.yml +++ b/recipes/qr-code-generator/all/conandata.yml @@ -16,19 +16,26 @@ sources: sha256: "fcdf9fd69fde07ae4dca2351d84271a9de8093002f733b77c70f52f1630f6e4a" patches: "1.8.0": - - base_path: "." - patch_file: "patches/004-cmake-1.7.patch" + - patch_file: "patches/004-cmake-1.7.patch" + patch_description: "add library name and list of source files" + patch_type: conan "1.7.0": - - base_path: "." - patch_file: "patches/004-cmake-1.7.patch" + - patch_file: "patches/004-cmake-1.7.patch" + patch_description: "add library name and list of source files" + patch_type: conan "1.6.0": - - base_path: "." - patch_file: "patches/003-cmake-1.6.patch" + - patch_file: "patches/003-cmake-1.6.patch" + patch_description: "add library name and list of source files" + patch_type: conan "1.5.0": - - base_path: "." - patch_file: "patches/002-cmake-pre-1.6.patch" + - patch_file: "patches/002-cmake-pre-1.6.patch" + patch_description: "add library name and list of source files" + patch_type: conan "1.4.0": - - base_path: "source_subfolder" - patch_file: "patches/001-qrcode-1_4.patch" - - base_path: "." - patch_file: "patches/002-cmake-pre-1.6.patch" + - patch_file: "patches/001-qrcode-1_4.patch" + patch_description: "add missing include" + patch_type: backport + patch_source: "https://github.com/nayuki/QR-Code-generator/commit/ec729bf2695300691f4b3a96ba5eaba083ebec00" + - patch_file: "patches/002-cmake-pre-1.6.patch" + patch_description: "add library name and list of source files" + patch_type: conan diff --git a/recipes/qr-code-generator/all/conanfile.py b/recipes/qr-code-generator/all/conanfile.py index 64bf396188800..84430d69ae1d0 100644 --- a/recipes/qr-code-generator/all/conanfile.py +++ b/recipes/qr-code-generator/all/conanfile.py @@ -1,8 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd, valid_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import ( + apply_conandata_patches, + copy, + export_conandata_patches, + get, + load, + save, +) +from conan.tools.scm import Version import os -import functools -required_conan_version = ">=1.33.0" + +required_conan_version = ">=1.53.0" class QrCodeGeneratorConan(ConanFile): @@ -11,7 +22,7 @@ class QrCodeGeneratorConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/nayuki/QR-Code-generator" - topics = ["qr-code", "qr-generator", "c-plus-plus"] + topics = ("qr", "qr-code", "qr-generator") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -21,20 +32,19 @@ class QrCodeGeneratorConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy( + self, + "CMakeLists.txt", + src=self.recipe_folder, + dst=self.export_sources_folder, + ) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -42,48 +52,57 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure(build_folder=self._build_subfolder) - return cmake - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get( + self, + **self.conan_data["sources"][self.version], + destination=self.source_folder, + strip_root=True + ) + + def generate(self): + tc = CMakeToolchain(self) + if self.settings.os == "Windows" and self.options.shared: + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if not valid_min_cppstd(self, self._min_cppstd): + tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd + tc.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def _extract_license(self): - header_name = ("QrCode.hpp" if tools.Version(self.version) < "1.7.0" - else "qrcodegen.hpp") - header = tools.load(os.path.join( - self._source_subfolder, "cpp", header_name)) - license_contents = header[2:header.find("*/", 1)] + header_name = ( + "QrCode.hpp" if Version(self.version) < "1.7.0" else "qrcodegen.hpp" + ) + header = load(self, os.path.join(self.source_folder, "cpp", header_name)) + license_contents = header[2 : header.find("*/", 1)] return license_contents def package(self): - cmake = self._configure_cmake() + save( + self, + os.path.join(self.package_folder, "licenses", "LICENSE"), + self._extract_license(), + ) + cmake = CMake(self) cmake.install() - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), - self._extract_license()) def package_info(self): - library_name = ("qrcodegen" if tools.Version(self.version) < "1.7.0" - else "qrcodegencpp") - self.cpp_info.libs.append(library_name) + self.cpp_info.libs = [ + "qrcodegen" if Version(self.version) < "1.7.0" else "qrcodegencpp" + ] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/qr-code-generator/all/patches/002-cmake-pre-1.6.patch b/recipes/qr-code-generator/all/patches/002-cmake-pre-1.6.patch index 67b8e3c4a685b..6ddcd335e9d9b 100644 --- a/recipes/qr-code-generator/all/patches/002-cmake-pre-1.6.patch +++ b/recipes/qr-code-generator/all/patches/002-cmake-pre-1.6.patch @@ -1,6 +1,6 @@ --- /dev/null +++ b/files.cmake @@ -0,0 +1,3 @@ -+set(SRC source_subfolder/cpp/QrCode.cpp source_subfolder/cpp/QrSegment.cpp source_subfolder/cpp/BitBuffer.cpp) -+set(HEADERS source_subfolder/cpp/QrCode.hpp source_subfolder/cpp/QrSegment.hpp source_subfolder/cpp/BitBuffer.hpp) ++set(SRC src/cpp/QrCode.cpp src/cpp/QrSegment.cpp src/cpp/BitBuffer.cpp) ++set(HEADERS src/cpp/QrCode.hpp src/cpp/QrSegment.hpp src/cpp/BitBuffer.hpp) +set(LIBRARY_NAME qrcodegen) diff --git a/recipes/qr-code-generator/all/patches/003-cmake-1.6.patch b/recipes/qr-code-generator/all/patches/003-cmake-1.6.patch index 96f6a99ca1549..f568f008c5f58 100644 --- a/recipes/qr-code-generator/all/patches/003-cmake-1.6.patch +++ b/recipes/qr-code-generator/all/patches/003-cmake-1.6.patch @@ -1,6 +1,6 @@ --- /dev/null +++ b/files.cmake @@ -0,0 +1,3 @@ -+set(SRC source_subfolder/cpp/QrCode.cpp) -+set(HEADERS source_subfolder/cpp/QrCode.hpp) ++set(SRC src/cpp/QrCode.cpp) ++set(HEADERS src/cpp/QrCode.hpp) +set(LIBRARY_NAME qrcodegen) diff --git a/recipes/qr-code-generator/all/patches/004-cmake-1.7.patch b/recipes/qr-code-generator/all/patches/004-cmake-1.7.patch index 9fddc31eb7168..d7ed7f6baa7c3 100644 --- a/recipes/qr-code-generator/all/patches/004-cmake-1.7.patch +++ b/recipes/qr-code-generator/all/patches/004-cmake-1.7.patch @@ -1,6 +1,6 @@ --- /dev/null +++ b/files.cmake @@ -0,0 +1,3 @@ -+set(SRC source_subfolder/cpp/qrcodegen.cpp) -+set(HEADERS source_subfolder/cpp/qrcodegen.hpp) ++set(SRC src/cpp/qrcodegen.cpp) ++set(HEADERS src/cpp/qrcodegen.hpp) +set(LIBRARY_NAME qrcodegencpp) diff --git a/recipes/qr-code-generator/all/test_package/CMakeLists.txt b/recipes/qr-code-generator/all/test_package/CMakeLists.txt index 7e046e4fc6e24..f7fc3218bd3f1 100644 --- a/recipes/qr-code-generator/all/test_package/CMakeLists.txt +++ b/recipes/qr-code-generator/all/test_package/CMakeLists.txt @@ -1,14 +1,13 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) +cmake_minimum_required(VERSION 3.1) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package CXX) find_package(qr-code-generator REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} qr-code-generator::qr-code-generator) +target_link_libraries(${PROJECT_NAME} PRIVATE qr-code-generator::qr-code-generator) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) + if (qr-code-generator_VERSION VERSION_LESS "1.7.0") target_compile_definitions(${PROJECT_NAME} PRIVATE QR_USE_OLD_INCLUDE) endif() -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/qr-code-generator/all/test_package/conanfile.py b/recipes/qr-code-generator/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/qr-code-generator/all/test_package/conanfile.py +++ b/recipes/qr-code-generator/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qr-code-generator/all/test_v1_package/CMakeLists.txt b/recipes/qr-code-generator/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/qr-code-generator/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/qr-code-generator/all/test_v1_package/conanfile.py b/recipes/qr-code-generator/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/qr-code-generator/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/qt-advanced-docking-system/all/conandata.yml b/recipes/qt-advanced-docking-system/all/conandata.yml index 7a2ff50f47cd8..4dc01c8789b06 100644 --- a/recipes/qt-advanced-docking-system/all/conandata.yml +++ b/recipes/qt-advanced-docking-system/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.8.3": + url: "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/archive/refs/tags/3.8.3.tar.gz" + sha256: "bd5a9469b755bedf33baefd0b3dda6d167b7917a2888e2794eed5abee7d78f74" "3.8.2": url: "https://github.com/githubuser0xFFFF/Qt-Advanced-Docking-System/archive/refs/tags/3.8.2.tar.gz" sha256: "e56811228fb4d5f5703c31cd83cb39ab2d5a849f581719d383db72f9322ec7f2" diff --git a/recipes/qt-advanced-docking-system/all/conanfile.py b/recipes/qt-advanced-docking-system/all/conanfile.py index ff22ebfa3d3ef..332361aaf6862 100644 --- a/recipes/qt-advanced-docking-system/all/conanfile.py +++ b/recipes/qt-advanced-docking-system/all/conanfile.py @@ -1,6 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import copy, get, apply_conandata_patches, export_conandata_patches, replace_in_file, rmdir +from conans import CMake import os +required_conan_version = ">=1.52.0" class QtADS(ConanFile): name = "qt-advanced-docking-system" @@ -23,16 +26,19 @@ class QtADS(ConanFile): "shared": False, "fPIC": True, } - exports_sources = ["CMakeLists.txt", "patches/**"] generators = "cmake", "cmake_find_package", "cmake_find_package_multi" _cmake = None - _qt_version = "5.15.2" + _qt_version = "5.15.6" @property def _source_subfolder(self): return "source_subfolder" + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) + def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -45,7 +51,7 @@ def requirements(self): self.requires(f"qt/{self._qt_version}") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) def _configure_cmake(self): @@ -61,10 +67,9 @@ def _configure_cmake(self): return self._cmake def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) - tools.replace_in_file( + replace_in_file(self, f"{self.source_folder}/{self._source_subfolder}/src/ads_globals.cpp", "#include ", f"#include <{self._qt_version}/QtGui/qpa/qplatformnativeinterface.h>" @@ -79,8 +84,8 @@ def package(self): cmake = self._configure_cmake() cmake.install() self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - tools.rmdir(os.path.join(self.package_folder, "license")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "license")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): if self.options.shared: diff --git a/recipes/qt-advanced-docking-system/config.yml b/recipes/qt-advanced-docking-system/config.yml index 6cd510297f45c..63dc53b34436f 100644 --- a/recipes/qt-advanced-docking-system/config.yml +++ b/recipes/qt-advanced-docking-system/config.yml @@ -1,3 +1,5 @@ versions: + "3.8.3": + folder: "all" "3.8.2": folder: "all" diff --git a/recipes/qt/5.x.x/conandata.yml b/recipes/qt/5.x.x/conandata.yml index 7119ff4959228..b156686dc16e7 100644 --- a/recipes/qt/5.x.x/conandata.yml +++ b/recipes/qt/5.x.x/conandata.yml @@ -1,27 +1,25 @@ sources: - "5.15.2": + "5.15.8": url: - - "https://download.qt.io/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz" - - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/5.15/5.15.2/single/qt-everywhere-src-5.15.2.tar.xz" - sha256: "3a530d1b243b5dec00bc54937455471aaa3e56849d2593edb8ded07228202240" - "5.15.3": + - "https://download.qt.io/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.8/single/qt-everywhere-opensource-src-5.15.8.tar.xz" + sha256: "776a9302c336671f9406a53bd30b8e36f825742b2ec44a57c08217bff0fa86b9" + "5.15.7": url: - - "https://download.qt.io/archive/qt/5.15/5.15.3/single/qt-everywhere-opensource-src-5.15.3.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.3/single/qt-everywhere-opensource-src-5.15.3.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.3/single/qt-everywhere-opensource-src-5.15.3.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.3/single/qt-everywhere-opensource-src-5.15.3.tar.xz" - - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/5.15/5.15.3/single/qt-everywhere-opensource-src-5.15.3.tar.xz" - sha256: "b7412734698a87f4a0ae20751bab32b1b07fdc351476ad8e35328dbe10efdedb" - "5.15.4": + - "https://download.qt.io/archive/qt/5.15/5.15.7/single/qt-everywhere-opensource-src-5.15.7.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.7/single/qt-everywhere-opensource-src-5.15.7.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.7/single/qt-everywhere-opensource-src-5.15.7.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.7/single/qt-everywhere-opensource-src-5.15.7.tar.xz" + sha256: "8a71986676a3f37a198a9113acedbfd5bc5606a459b6b85816d951458adbe9a0" + "5.15.6": url: - - "https://download.qt.io/archive/qt/5.15/5.15.4/single/qt-everywhere-opensource-src-5.15.4.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.4/single/qt-everywhere-opensource-src-5.15.4.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.4/single/qt-everywhere-opensource-src-5.15.4.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.4/single/qt-everywhere-opensource-src-5.15.4.tar.xz" - sha256: "615ff68d7af8eef3167de1fd15eac1b150e1fd69d1e2f4239e54447e7797253b" + - "https://download.qt.io/archive/qt/5.15/5.15.6/single/qt-everywhere-opensource-src-5.15.6.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/5.15/5.15.6/single/qt-everywhere-opensource-src-5.15.6.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/5.15/5.15.6/single/qt-everywhere-opensource-src-5.15.6.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.6/single/qt-everywhere-opensource-src-5.15.6.tar.xz" + sha256: "ebc77d27934b70b25b3dc34fbec7c4471eb451848e891c42b32409ea30fe309f" "5.15.5": url: - "https://download.qt.io/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" @@ -30,40 +28,32 @@ sources: - "https://ftp.fau.de/qtproject/archive/qt/5.15/5.15.5/single/qt-everywhere-opensource-src-5.15.5.tar.xz" sha256: "5a97827bdf9fd515f43bc7651defaf64fecb7a55e051c79b8f80510d0e990f06" patches: - "5.15.2": + "5.15.8": - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" - patch_file: "patches/c72097e.diff" base_path: "qt5/qtwebengine" - patch_file: "patches/fix-macdeployqt.diff" base_path: "qt5/qttools" - - patch_file: "patches/QTBUG-88625.diff" - base_path: "qt5/qtwebengine" - - patch_file: "patches/7371d3a.diff" - base_path: "qt5/qtbase" - - patch_file: "patches/QTBUG-90395.diff" - base_path: "qt5/qtbase" - - patch_file: "patches/declarative_missing_header.diff" - base_path: "qt5/qtdeclarative" - - patch_file: "patches/f830b86.diff" + - patch_file: "patches/chromium-v8-missing-constexpr.patch" + base_path: "qt5/qtwebengine/src/3rdparty/chromium/v8" + - patch_file: "patches/chromium-skia-missing-iterator-include.patch" base_path: "qt5/qtwebengine/src/3rdparty" - - patch_file: "patches/fix-gcc-11.diff" + - patch_file: "patches/skia-cd397f3.diff" + base_path: "qt5/qtwebengine/src/3rdparty/chromium/third_party/skia" + - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" base_path: "qt5/qtwebengine/src/3rdparty" - - patch_file: "patches/dece6f5.diff" + - patch_file: "patches/337f28c9ab-5.15.8.patch" + base_path: "qt5/qtbase" + "5.15.7": + - patch_file: "patches/337f28c9ab.patch" base_path: "qt5/qtbase" - - patch_file: "patches/QTBUG-98813.patch" - base_path: "qt5/qtwebengine/src/3rdparty" - "5.15.3": - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" - patch_file: "patches/c72097e.diff" base_path: "qt5/qtwebengine" - patch_file: "patches/fix-macdeployqt.diff" base_path: "qt5/qttools" - - patch_file: "patches/QTBUG-90395.diff" - base_path: "qt5/qtbase" - - patch_file: "patches/declarative_missing_header.diff" - base_path: "qt5/qtdeclarative" - patch_file: "patches/dece6f5.diff" base_path: "qt5/qtbase" - patch_file: "patches/QTBUG-98813.patch" @@ -72,25 +62,23 @@ patches: base_path: "qt5/qtwebengine/src/3rdparty" - patch_file: "patches/107ed30ec5.patch" base_path: "qt5/qtwebengine/src/3rdparty" - - patch_file: "patches/b498f4ce3f.patch" - base_path: "qt5/qtwebengine/src/3rdparty" - patch_file: "patches/chromium-v8-missing-constexpr.patch" base_path: "qt5/qtwebengine/src/3rdparty/chromium/v8" - patch_file: "patches/chromium-skia-missing-iterator-include.patch" base_path: "qt5/qtwebengine/src/3rdparty" - patch_file: "patches/skia-cd397f3.diff" base_path: "qt5/qtwebengine/src/3rdparty/chromium/third_party/skia" - "5.15.4": + - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" + base_path: "qt5/qtwebengine/src/3rdparty" + "5.15.6": + - patch_file: "patches/337f28c9ab.patch" + base_path: "qt5/qtbase" - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" - patch_file: "patches/c72097e.diff" base_path: "qt5/qtwebengine" - patch_file: "patches/fix-macdeployqt.diff" base_path: "qt5/qttools" - - patch_file: "patches/QTBUG-90395.diff" - base_path: "qt5/qtbase" - - patch_file: "patches/declarative_missing_header.diff" - base_path: "qt5/qtdeclarative" - patch_file: "patches/dece6f5.diff" base_path: "qt5/qtbase" - patch_file: "patches/QTBUG-98813.patch" @@ -99,8 +87,6 @@ patches: base_path: "qt5/qtwebengine/src/3rdparty" - patch_file: "patches/107ed30ec5.patch" base_path: "qt5/qtwebengine/src/3rdparty" - - patch_file: "patches/b498f4ce3f.patch" - base_path: "qt5/qtwebengine/src/3rdparty" - patch_file: "patches/chromium-v8-missing-constexpr.patch" base_path: "qt5/qtwebengine/src/3rdparty/chromium/v8" - patch_file: "patches/chromium-skia-missing-iterator-include.patch" @@ -110,6 +96,8 @@ patches: - patch_file: "patches/0001-Find-fontconfig-using-pkg-config.patch" base_path: "qt5/qtwebengine/src/3rdparty" "5.15.5": + - patch_file: "patches/337f28c9ab-5.15.5.patch" + base_path: "qt5/qtbase" - patch_file: "patches/aa2a39dea5.diff" base_path: "qt5/qtbase" - patch_file: "patches/c72097e.diff" diff --git a/recipes/qt/5.x.x/conanfile.py b/recipes/qt/5.x.x/conanfile.py index 022fd2270e0a5..d761c194504bb 100644 --- a/recipes/qt/5.x.x/conanfile.py +++ b/recipes/qt/5.x.x/conanfile.py @@ -2,8 +2,8 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os from conan.tools.build import build_jobs, check_min_cppstd, cross_building -from conan.tools.files import chdir, get, load, patch, replace_in_file, rm, rmdir, save -from conan.tools.microsoft import msvc_runtime_flag +from conan.tools.files import chdir, copy, get, load, replace_in_file, rm, rmdir, save, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import msvc_runtime_flag, is_msvc from conan.tools.scm import Version from conans import tools, RunEnvironment from conans.model import Generator @@ -13,7 +13,7 @@ import os import textwrap -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.52.0" class qt(Generator): @@ -49,10 +49,10 @@ class QtConan(ConanFile): name = "qt" description = "Qt is a cross-platform framework for graphical user interfaces." - topics = ("qt", "ui") + topics = ("ui", "framework") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.qt.io" - license = "LGPL-3.0" + license = "LGPL-3.0-only" settings = "os", "arch", "compiler", "build_type" options = { @@ -85,6 +85,7 @@ class QtConan(ConanFile): "with_gssapi": [True, False], "with_atspi": [True, False], "with_md4c": [True, False], + "with_x11": [True, False], "gui": [True, False], "widgets": [True, False], @@ -126,6 +127,7 @@ class QtConan(ConanFile): "with_gssapi": False, "with_atspi": False, "with_md4c": True, + "with_x11": True, "gui": True, "widgets": True, @@ -136,40 +138,35 @@ class QtConan(ConanFile): "config": None, "multiconfiguration": False } - default_options.update({module: False for module in _submodules}) + default_options.update({module: (module in ["qttools", "qttranslations"]) for module in _submodules}) no_copy_source = True short_paths = True generators = "pkg_config" - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) def export(self): - self.copy("qtmodules%s.conf" % self.version) + copy(self, f"qtmodules{self.version}.conf", self.recipe_folder, self.export_folder) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def build_requirements(self): - if self._settings_build.os == "Windows" and self._is_msvc: - self.build_requires("jom/1.1.3") + if self._settings_build.os == "Windows" and is_msvc(self): + self.tool_requires("jom/1.1.3") if self.options.qtwebengine: - self.build_requires("ninja/1.11.0") - self.build_requires("nodejs/16.3.0") - self.build_requires("gperf/3.1") + self.tool_requires("ninja/1.11.1") + self.tool_requires("nodejs/16.3.0") + self.tool_requires("gperf/3.1") # gperf, bison, flex, python >= 2.7.5 & < 3 if self.settings.os != "Windows": - self.build_requires("bison/3.7.6") - self.build_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") else: - self.build_requires("winflexbison/2.5.24") + self.tool_requires("winflexbison/2.5.24") # Check if a valid python2 is available in PATH or it will failflex # Start by checking if python2 can be found @@ -186,7 +183,7 @@ def build_requirements(self): # In any case, check its actual version for compatibility from six import StringIO # Python 2 and 3 compatible mybuf = StringIO() - cmd_v = "\"{}\" --version".format(python_exe) + cmd_v = f"\"{python_exe}\" --version" self.run(cmd_v, output=mybuf) verstr = mybuf.getvalue().strip().split("Python ")[1] if verstr.endswith("+"): @@ -197,23 +194,25 @@ def build_requirements(self): v_max = "3.0.0" if (version >= v_min) and (version < v_max): msg = ("Found valid Python 2 required for QtWebengine:" - " version={}, path={}".format(mybuf.getvalue(), python_exe)) + f" version={mybuf.getvalue()}, path={python_exe}") self.output.success(msg) else: - msg = ("Found Python 2 in path, but with invalid version {}" - " (QtWebEngine requires >= {} & < " - "{})\nIf you have both Python 2 and 3 installed, copy the python 2 executable to" - "python2(.exe)".format(verstr, v_min, v_max)) + msg = (f"Found Python 2 in path, but with invalid version {verstr}" + f" (QtWebEngine requires >= {v_min} & < {v_max})\n" + "If you have both Python 2 and 3 installed, copy the python 2 executable to" + "python2(.exe)") raise ConanInvalidConfiguration(msg) if self.options.qtwayland: - self.build_requires("wayland/1.21.0") + self.tool_requires("wayland/1.21.0") def config_options(self): if self.settings.os not in ["Linux", "FreeBSD"]: del self.options.with_icu del self.options.with_fontconfig del self.options.with_libalsa + del self.options.with_x11 + del self.options.qtx11extras if self.settings.compiler == "apple-clang": if Version(self.settings.compiler.version) < "10.0": raise ConanInvalidConfiguration("Old versions of apple sdk are not supported by Qt (QTBUG-76777)") @@ -230,6 +229,13 @@ def config_options(self): self.options.qtwayland = False self.options.with_atspi = False + if self.settings.os != "Windows": + del self.options.qtwinextras + del self.options.qtactiveqt + + if self.settings.os != "Macos": + del self.options.qtmacextras + def configure(self): # if self.settings.os != "Linux": # self.options.with_libiconv = False # QTBUG-84708 @@ -243,7 +249,8 @@ def configure(self): del self.options.with_libjpeg del self.options.with_libpng del self.options.with_md4c - + del self.options.with_x11 + if not self.options.with_dbus: del self.options.with_atspi @@ -256,23 +263,21 @@ def configure(self): if self.settings.os in ("FreeBSD", "Linux"): if self.options.qtwebengine: self.options.with_fontconfig = True - else: - del self.options.qtx11extras if self.options.multiconfiguration: del self.settings.build_type config = configparser.ConfigParser() - config.read(os.path.join(self.recipe_folder, "qtmodules%s.conf" % self.version)) + config.read(os.path.join(self.recipe_folder, f"qtmodules{self.version}.conf")) submodules_tree = {} - assert config.sections() + assert config.sections(), f"no qtmodules.conf file for version {self.version}" for s in config.sections(): section = str(s) assert section.startswith("submodule ") assert section.count('"') == 2 modulename = section[section.find('"') + 1: section.rfind('"')] status = str(config.get(section, "status")) - if status != "obsolete" and status != "ignore": + if status not in ("obsolete", "ignore"): submodules_tree[modulename] = {"status": status, "path": str(config.get(section, "path")), "depends": []} if config.has_option(section, "depends"): @@ -341,81 +346,94 @@ def validate(self): if self.options.get_safe("with_pulseaudio", default=False) and not self.options["pulseaudio"].with_glib: # https://bugreports.qt.io/browse/QTBUG-95952 raise ConanInvalidConfiguration("Pulseaudio needs to be built with glib option or qt's configure script won't detect it") - - if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi: - raise ConanInvalidConfiguration("gssapi cannot be enabled until conan-io/conan-center-index#4102 is closed") + + if self.settings.os in ['Linux', 'FreeBSD']: + if self.options.with_gssapi: + raise ConanInvalidConfiguration("gssapi cannot be enabled until conan-io/conan-center-index#4102 is closed") + + if self.options.get_safe("with_x11", False) and not self.dependencies.direct_host["xkbcommon"].options.with_x11: + raise ConanInvalidConfiguration("The 'with_x11' option for the 'xkbcommon' package must be enabled when the 'with_x11' option is enabled") + if self.options.get_safe("qtwayland", False) and not self.dependencies.direct_host["xkbcommon"].options.with_wayland: + raise ConanInvalidConfiguration("The 'with_wayland' option for the 'xkbcommon' package must be enabled when the 'qtwayland' option is enabled") + + if cross_building(self) and self.options.cross_compile == "None" and not is_apple_os(self): + raise ConanInvalidConfiguration("option cross_compile must be set for cross compilation " + "cf https://doc.qt.io/qt-5/configure-options.html#cross-compilation-options") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.with_pcre2: self.requires("pcre2/10.40") if self.options.get_safe("with_vulkan"): - self.requires("vulkan-loader/1.3.221") + self.requires("vulkan-loader/1.3.224.0") if is_apple_os(self): self.requires("moltenvk/1.1.10") if self.options.with_glib: - self.requires("glib/2.73.2") + self.requires("glib/2.75.2") # if self.options.with_libiconv: # QTBUG-84708 # self.requires("libiconv/1.16")# QTBUG-84708 - if self.options.with_doubleconversion: - self.requires("double-conversion/3.2.0") - if self.options.get_safe("with_freetype", False): + if self.options.with_doubleconversion and not self.options.multiconfiguration: + self.requires("double-conversion/3.2.1") + if self.options.get_safe("with_freetype", False) and not self.options.multiconfiguration: self.requires("freetype/2.12.1") if self.options.get_safe("with_fontconfig", False): self.requires("fontconfig/2.13.93") if self.options.get_safe("with_icu", False): self.requires("icu/71.1") - if self.options.get_safe("with_harfbuzz", False): - self.requires("harfbuzz/4.4.1") - if self.options.get_safe("with_libjpeg", False): + if self.options.get_safe("with_harfbuzz", False) and not self.options.multiconfiguration: + self.requires("harfbuzz/5.3.1") + if self.options.get_safe("with_libjpeg", False) and not self.options.multiconfiguration: if self.options.with_libjpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.3") + self.requires("libjpeg-turbo/2.1.4") else: - self.requires("libjpeg/9d") - if self.options.get_safe("with_libpng", False): - self.requires("libpng/1.6.37") - if self.options.with_sqlite3: - self.requires("sqlite3/3.39.2") + self.requires("libjpeg/9e") + if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration: + self.requires("libpng/1.6.39") + if self.options.with_sqlite3 and not self.options.multiconfiguration: + self.requires("sqlite3/3.39.4") self.options["sqlite3"].enable_column_metadata = True if self.options.get_safe("with_mysql", False): - self.requires("libmysqlclient/8.0.29") + self.requires("libmysqlclient/8.0.30") if self.options.with_pq: - self.requires("libpq/14.2") + self.requires("libpq/14.5") if self.options.with_odbc: if self.settings.os != "Windows": - self.requires("odbc/2.3.9") + self.requires("odbc/2.3.11") if self.options.get_safe("with_openal", False): self.requires("openal/1.22.2") if self.options.get_safe("with_libalsa", False): self.requires("libalsa/1.2.7.2") - if self.options.gui and self.settings.os in ["Linux", "FreeBSD"]: + if self.options.get_safe("with_x11", False): + self.requires("xkbcommon/1.5.0") self.requires("xorg/system") - self.requires("xkbcommon/1.4.1") if self.options.get_safe("opengl", "no") != "no": self.requires("opengl/system") if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.qtwebengine and self.settings.os in ["Linux", "FreeBSD"]: - self.requires("expat/2.4.8") + self.requires("expat/2.4.9") self.requires("opus/1.3.1") - self.requires("xorg-proto/2021.4") + if not self.options.qtwayland: + self.requires("xorg-proto/2022.2") self.requires("libxshmfence/1.3") - self.requires("nss/3.77") + self.requires("nss/3.84") self.requires("libdrm/2.4.109") + self.requires("egl/system") if self.options.get_safe("with_gstreamer", False): self.requires("gst-plugins-base/1.19.2") if self.options.get_safe("with_pulseaudio", False): self.requires("pulseaudio/14.2") if self.options.with_dbus: - self.requires("dbus/1.12.20") + self.requires("dbus/1.15.2") if self.options.qtwayland: self.requires("wayland/1.21.0") + self.requires("xkbcommon/1.5.0") if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi: self.requires("krb5/1.18.3") # conan-io/conan-center-index#4102 if self.options.get_safe("with_atspi"): - self.requires("at-spi2-core/2.45.1") + self.requires("at-spi2-core/2.46.0") if self.options.get_safe("with_md4c", False): self.requires("md4c/0.4.8") @@ -423,8 +441,7 @@ def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True, destination="qt5") - for data in self.conan_data.get("patches", {}).get(self.version, []): - patch(self, **data) + apply_conandata_patches(self) for f in ["renderer", os.path.join("renderer", "core"), os.path.join("renderer", "platform")]: replace_in_file(self, os.path.join(self.source_folder, "qt5", "qtwebengine", "src", "3rdparty", "chromium", "third_party", "blink", f, "BUILD.gn"), " if (enable_precompiled_headers) {\n if (is_win) {", @@ -434,11 +451,12 @@ def source(self): "-ldbus-1d", "-ldbus-1" ) + save(self, os.path.join(self.source_folder, "qt5", "qtbase", "mkspecs", "features", "uikit", "bitcode.prf"), "") def _make_program(self): - if self._is_msvc: + if is_msvc(self): return "jom" - elif tools.os_info.is_windows: + elif self._settings_build.os == "Windows": return "mingw32-make" else: return "make" @@ -487,7 +505,7 @@ def _xplatform(self): }.get(str(self.settings.compiler)) elif self.settings.os == "WindowsStore": - if self._is_msvc: + if is_msvc(self): if self.settings.compiler == "Visual Studio": msvc_version = str(self.settings.compiler.version) else: @@ -543,7 +561,9 @@ def _xplatform(self): def build(self): args = ["-confirm-license", "-silent", "-nomake examples", "-nomake tests", - "-prefix %s" % self.package_folder] + f"-prefix {self.package_folder}"] + if cross_building(self): + args.append(f"-extprefix {self.package_folder}") args.append("-v") args.append("-archdatadir %s" % os.path.join(self.package_folder, "bin", "archdatadir")) args.append("-datadir %s" % os.path.join(self.package_folder, "bin", "datadir")) @@ -558,7 +578,7 @@ def build(self): args.append("-no-widgets") if not self.options.shared: args.insert(0, "-static") - if self._is_msvc and "MT" in msvc_runtime_flag(self): + if is_msvc(self) and "MT" in msvc_runtime_flag(self): args.append("-static-runtime") else: args.insert(0, "-shared") @@ -626,7 +646,7 @@ def build(self): args.append("-dbus-linked") else: args.append("-no-dbus") - + args.append("-feature-gssapi" if self.options.get_safe("with_gssapi", False) else "-no-feature-gssapi") for opt, conf_arg in [ @@ -676,10 +696,11 @@ def build(self): args.append("\"%s_LIBS=%s\"" % (var, " ".join(self._gather_libs(package)))) for package in self.deps_cpp_info.deps: - args += ["-I \"%s\"" % s for s in self.deps_cpp_info[package].include_paths] - args += ["-D %s" % s for s in self.deps_cpp_info[package].defines] + args += [f"-I \"{s}\"" for s in self.deps_cpp_info[package].include_paths] + args += [f"-D {s}" for s in self.deps_cpp_info[package].defines] args.append("QMAKE_LIBDIR+=\"%s\"" % " ".join(l for package in self.deps_cpp_info.deps for l in self.deps_cpp_info[package].lib_paths)) - args.append("QMAKE_RPATHLINKDIR+=\"%s\"" % ":".join(l for package in self.deps_cpp_info.deps for l in self.deps_cpp_info[package].lib_paths)) + if not is_msvc(self): + args.append("QMAKE_RPATHLINKDIR+=\"%s\"" % ":".join(l for package in self.deps_cpp_info.deps for l in self.deps_cpp_info[package].lib_paths)) if "libmysqlclient" in self.deps_cpp_info.deps: args.append("-mysql_config \"%s\"" % os.path.join(self.deps_cpp_info["libmysqlclient"].rootpath, "bin", "mysql_config")) @@ -690,7 +711,7 @@ def build(self): if self.settings.arch == "armv8": args.append('QMAKE_APPLE_DEVICE_ARCHS="arm64"') elif self.settings.os == "Android": - args += ["-android-ndk-platform android-%s" % self.settings.os.api_level] + args += [f"-android-ndk-platform android-{self.settings.os.api_level}"] args += ["-android-abis %s" % {"armv7": "armeabi-v7a", "armv8": "arm64-v8a", "x86": "x86", @@ -702,32 +723,32 @@ def build(self): args += ["-D_GLIBCXX_USE_CXX11_ABI=1"] if self.options.sysroot: - args += ["-sysroot %s" % self.options.sysroot] + args += [f"-sysroot {self.options.sysroot}"] if self.options.device: - args += ["-device %s" % self.options.device] + args += [f"-device {self.options.device}"] else: xplatform_val = self._xplatform() if xplatform_val: if not cross_building(self, skip_x64_x86=True): - args += ["-platform %s" % xplatform_val] + args += [f"-platform {xplatform_val}"] else: - args += ["-xplatform %s" % xplatform_val] + args += [f"-xplatform {xplatform_val}"] else: self.output.warn("host not supported: %s %s %s %s" % (self.settings.os, self.settings.compiler, self.settings.compiler.version, self.settings.arch)) if self.options.cross_compile: - args += ["-device-option CROSS_COMPILE=%s" % self.options.cross_compile] + args += [f"-device-option CROSS_COMPILE={self.options.cross_compile}"] def _getenvpath(var): val = os.getenv(var) - if val and tools.os_info.is_windows: + if val and self._settings_build.os == "Windows": val = val.replace("\\", "/") os.environ[var] = val return val - if not self._is_msvc: + if not is_msvc(self): value = _getenvpath("CC") if value: args += ['QMAKE_CC="' + value + '"', @@ -740,7 +761,7 @@ def _getenvpath(var): 'QMAKE_LINK="' + value + '"', 'QMAKE_LINK_SHLIB="' + value + '"'] - if tools.os_info.is_linux and self.settings.compiler == "clang": + if self._settings_build.os == "Linux" and self.settings.compiler == "clang": args += ['QMAKE_CXXFLAGS+="-ftemplate-depth=1024"'] if self.options.qtwebengine and self.settings.os in ["Linux", "FreeBSD"]: @@ -753,23 +774,23 @@ def _getenvpath(var): os.mkdir("build_folder") with chdir(self, "build_folder"): - with tools.vcvars(self) if self._is_msvc else tools.no_op(): - build_env = {"MAKEFLAGS": "j%d" % build_jobs(self), "PKG_CONFIG_PATH": [self.build_folder]} + with tools.vcvars(self) if is_msvc(self) else tools.no_op(): + build_env = {"MAKEFLAGS": f"j{build_jobs(self)}", "PKG_CONFIG_PATH": [self.build_folder]} if self.settings.os == "Windows": build_env["PATH"] = [os.path.join(self.source_folder, "qt5", "gnuwin32", "bin")] with tools.environment_append(build_env): - if tools.os_info.is_macos: + if self._settings_build.os == "Macos": save(self, ".qmake.stash" , "") save(self, ".qmake.super" , "") - self.run("%s/qt5/configure %s" % (self.source_folder, " ".join(args)), run_environment=True) - if tools.os_info.is_macos: + self.run("%s %s" % (os.path.join(self.source_folder, "qt5", "configure"), " ".join(args)), run_environment=True) + if self._settings_build.os == "Macos": save(self, "bash_env", 'export DYLD_LIBRARY_PATH="%s"' % ":".join(RunEnvironment(self).vars["DYLD_LIBRARY_PATH"])) with tools.environment_append({ "BASH_ENV": os.path.abspath("bash_env") - }) if tools.os_info.is_macos else tools.no_op(): + }) if self._settings_build.os == "Macos" else tools.no_op(): self.run(self._make_program(), run_environment=True) @property @@ -777,11 +798,11 @@ def _cmake_core_extras_file(self): return os.path.join("lib", "cmake", "Qt5Core", "conan_qt_core_extras.cmake") def _cmake_qt5_private_file(self, module): - return os.path.join("lib", "cmake", "Qt5{0}".format(module), "conan_qt_qt5_{0}private.cmake".format(module.lower())) + return os.path.join("lib", "cmake", f"Qt5{module}", f"conan_qt_qt5_{module.lower()}private.cmake") def package(self): with chdir(self, "build_folder"): - self.run("%s install" % self._make_program()) + self.run(f"{self._make_program()} install") save(self, os.path.join(self.package_folder, "bin", "qt.conf"), """[Paths] Prefix = .. ArchData = bin/archdatadir @@ -795,7 +816,7 @@ def package(self): Translations = bin/datadir/translations Documentation = bin/datadir/doc Examples = bin/datadir/examples""") - self.copy("*LICENSE*", src="qt5/", dst="licenses") + copy(self, "*LICENSE*", os.path.join(self.source_folder, "qt5/"), os.path.join(self.package_folder, "licenses")) for module in self._submodules: if not self.options.get_safe(module): rmdir(self, os.path.join(self.package_folder, "licenses", module)) @@ -811,20 +832,20 @@ def package(self): os.remove(fl) for m in os.listdir(os.path.join(self.package_folder, "lib", "cmake")): - module = os.path.join(self.package_folder, "lib", "cmake", m, "%sMacros.cmake" % m) + module = os.path.join(self.package_folder, "lib", "cmake", m, f"{m}Macros.cmake") if not os.path.isfile(module): rmdir(self, os.path.join(self.package_folder, "lib", "cmake", m)) extension = "" - if self.settings.os == "Windows": + if self._settings_build.os == "Windows": extension = ".exe" v = Version(self.version) - filecontents = textwrap.dedent("""\ + filecontents = textwrap.dedent(f"""\ set(QT_CMAKE_EXPORT_NAMESPACE Qt5) - set(QT_VERSION_MAJOR {major}) - set(QT_VERSION_MINOR {minor}) - set(QT_VERSION_PATCH {patch}) - """.format(major=v.major, minor=v.minor, patch=v.patch)) + set(QT_VERSION_MAJOR {v.major}) + set(QT_VERSION_MINOR {v.minor}) + set(QT_VERSION_PATCH {v.patch}) + """) targets = {} targets["Core"] = ["moc", "rcc", "qmake"] targets["DBus"] = ["qdbuscpp2xml", "qdbusxml2cpp"] @@ -866,18 +887,18 @@ def package(self): endif() """) - filecontents += textwrap.dedent("""\ + filecontents += textwrap.dedent(f"""\ if(NOT DEFINED QT_DEFAULT_MAJOR_VERSION) - set(QT_DEFAULT_MAJOR_VERSION %s) + set(QT_DEFAULT_MAJOR_VERSION {v.major}) endif() - """ % v.major) + """) filecontents += 'set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_GADGET_EXPORT" "Q_NAMESPACE" "Q_NAMESPACE_EXPORT")\n' save(self, os.path.join(self.package_folder, self._cmake_core_extras_file), filecontents) def _create_private_module(module, dependencies=[]): if "Core" not in dependencies: dependencies.append("Core") - dependencies_string = ';'.join('Qt5::%s' % dependency for dependency in dependencies) + dependencies_string = ';'.join(f'Qt5::{dependency}' for dependency in dependencies) contents = textwrap.dedent("""\ if(NOT TARGET Qt5::{0}Private) add_library(Qt5::{0}Private INTERFACE IMPORTED) @@ -909,7 +930,7 @@ def _create_private_module(module, dependencies=[]): def package_id(self): del self.info.options.cross_compile del self.info.options.sysroot - if self.options.multiconfiguration and self._is_msvc: + if self.options.multiconfiguration and is_msvc(self): if self.settings.compiler == "Visual Studio": if "MD" in self.settings.compiler.runtime: self.info.settings.compiler.runtime = "MD/MDd" @@ -924,12 +945,19 @@ def package_info(self): self.cpp_info.names["cmake_find_package"] = "Qt5" self.cpp_info.names["cmake_find_package_multi"] = "Qt5" - build_modules = [] + build_modules = {} + + def _add_build_module(component, module): + if component not in build_modules: + build_modules[component] = [] + build_modules[component].append(module) + self.cpp_info.components[component].build_modules["cmake_find_package"].append(module) + self.cpp_info.components[component].build_modules["cmake_find_package_multi"].append(module) libsuffix = "" if not self.options.multiconfiguration: if self.settings.build_type == "Debug": - if self.settings.os == "Windows": + if self.settings.os == "Windows" and is_msvc(self): libsuffix = "d" elif is_apple_os(self): libsuffix = "_debug" @@ -937,31 +965,36 @@ def package_info(self): def _get_corrected_reqs(requires): reqs = [] for r in requires: - reqs.append(r if "::" in r else "qt%s" % r) + if "::" in r: + corrected_req = r + else: + corrected_req = f"qt{r}" + assert corrected_req in self.cpp_info.components, f"{corrected_req} required but not yet present in self.cpp_info.components" + reqs.append(corrected_req) return reqs def _create_module(module, requires=[], has_include_dir=True): - componentname = "qt%s" % module - assert componentname not in self.cpp_info.components, "Module %s already present in self.cpp_info.components" % module - self.cpp_info.components[componentname].set_property("cmake_target_name", "Qt5::{}".format(module)) + componentname = f"qt{module}" + assert componentname not in self.cpp_info.components, f"Module {module} already present in self.cpp_info.components" + self.cpp_info.components[componentname].set_property("cmake_target_name", f"Qt5::{module}") self.cpp_info.components[componentname].names["cmake_find_package"] = module self.cpp_info.components[componentname].names["cmake_find_package_multi"] = module if module.endswith("Private"): libname = module[:-7] else: libname = module - self.cpp_info.components[componentname].libs = ["Qt5%s%s" % (libname, libsuffix)] + self.cpp_info.components[componentname].libs = [f"Qt5{libname}{libsuffix}"] if has_include_dir: - self.cpp_info.components[componentname].includedirs = ["include", os.path.join("include", "Qt%s" % module)] - self.cpp_info.components[componentname].defines = ["QT_%s_LIB" % module.upper()] + self.cpp_info.components[componentname].includedirs = ["include", os.path.join("include", f"Qt{module}")] + self.cpp_info.components[componentname].defines = [f"QT_{module.upper()}_LIB"] if module != "Core" and "Core" not in requires: requires.append("Core") self.cpp_info.components[componentname].requires = _get_corrected_reqs(requires) def _create_plugin(pluginname, libname, plugintype, requires): - componentname = "qt%s" % pluginname - assert componentname not in self.cpp_info.components, "Plugin %s already present in self.cpp_info.components" % pluginname - self.cpp_info.components[componentname].set_property("cmake_target_name", "Qt5::{}".format(pluginname)) + componentname = f"qt{pluginname}" + assert componentname not in self.cpp_info.components, f"Plugin {pluginname} already present in self.cpp_info.components" + self.cpp_info.components[componentname].set_property("cmake_target_name", f"Qt5::{pluginname}") self.cpp_info.components[componentname].names["cmake_find_package"] = pluginname self.cpp_info.components[componentname].names["cmake_find_package_multi"] = pluginname if not self.options.shared: @@ -987,11 +1020,11 @@ def _create_plugin(pluginname, libname, plugintype, requires): _create_module("Core", core_reqs) if self.settings.os == "Windows": module = "WinMain" - componentname = "qt%s" % module - self.cpp_info.components[componentname].set_property("cmake_target_name", "Qt5::{}".format(module)) + componentname = f"qt{module}" + self.cpp_info.components[componentname].set_property("cmake_target_name", f"Qt5::{module}") self.cpp_info.components[componentname].names["cmake_find_package"] = module self.cpp_info.components[componentname].names["cmake_find_package_multi"] = module - self.cpp_info.components[componentname].libs = ["qtmain%s" % libsuffix] + self.cpp_info.components[componentname].libs = [f"qtmain{libsuffix}"] self.cpp_info.components[componentname].includedirs = [] self.cpp_info.components[componentname].defines = [] @@ -1006,7 +1039,10 @@ def _create_plugin(pluginname, libname, plugintype, requires): if self.options.get_safe("with_fontconfig", False): gui_reqs.append("fontconfig::fontconfig") if self.settings.os in ["Linux", "FreeBSD"]: - gui_reqs.extend(["xorg::xorg", "xkbcommon::xkbcommon"]) + if self.options.qtwayland or self.options.get_safe("with_x11", False): + gui_reqs.append("xkbcommon::xkbcommon") + if self.options.get_safe("with_x11", False): + gui_reqs.append("xorg::xorg") if self.options.get_safe("opengl", "no") != "no": gui_reqs.append("opengl::opengl") if self.options.get_safe("with_vulkan", False): @@ -1022,9 +1058,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): if self.options.with_md4c: gui_reqs.append("md4c::md4c") _create_module("Gui", gui_reqs) - build_modules.append(self._cmake_qt5_private_file("Gui")) - self.cpp_info.components["qtGui"].build_modules["cmake_find_package"].append(self._cmake_qt5_private_file("Gui")) - self.cpp_info.components["qtGui"].build_modules["cmake_find_package_multi"].append(self._cmake_qt5_private_file("Gui")) + _add_build_module("qtGui", self._cmake_qt5_private_file("Gui")) event_dispatcher_reqs = ["Core", "Gui"] if self.options.with_glib: @@ -1040,13 +1074,21 @@ def _create_plugin(pluginname, libname, plugintype, requires): self.cpp_info.components["qtFontDatabaseSupport"].requires.append("fontconfig::fontconfig") if self.options.get_safe("with_freetype"): self.cpp_info.components["qtFontDatabaseSupport"].requires.append("freetype::freetype") - - + + _create_module("ThemeSupport", ["Core", "Gui"]) _create_module("AccessibilitySupport", ["Core", "Gui"]) if self.options.get_safe("with_vulkan"): _create_module("VulkanSupport", ["Core", "Gui"]) + if self.options.widgets: + _create_module("Widgets", ["Gui"]) + _add_build_module("qtWidgets", self._cmake_qt5_private_file("Widgets")) + if self.settings.os not in ["iOS", "watchOS", "tvOS"]: + _create_module("PrintSupport", ["Gui", "Widgets"]) + if self.settings.os == "Macos" and not self.options.shared: + self.cpp_info.components["qtPrintSupport"].system_libs.append("cups") + if is_apple_os(self): _create_module("ClipboardSupport", ["Core", "Gui"]) self.cpp_info.components["qtClipboardSupport"].frameworks = ["ImageIO"] @@ -1056,7 +1098,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): if self.settings.os in ["Android", "Emscripten"]: _create_module("EglSupport", ["Core", "Gui"]) - + if self.settings.os == "Windows": windows_reqs = ["Core", "Gui"] windows_reqs.extend(["EventDispatcherSupport", "FontDatabaseSupport", "ThemeSupport", "AccessibilitySupport"]) @@ -1075,11 +1117,11 @@ def _create_plugin(pluginname, libname, plugintype, requires): _create_plugin("QAndroidIntegrationPlugin", "qtforandroid", "platforms", android_reqs) self.cpp_info.components["qtQAndroidIntegrationPlugin"].system_libs = ["android", "jnigraphics"] elif self.settings.os == "Macos": - cocoa_reqs = ["Core", "Gui", "ClipboardSupport", "ThemeSupport", "FontDatabaseSupport", "GraphicsSupport"] + cocoa_reqs = ["Core", "Gui", "ClipboardSupport", "ThemeSupport", "FontDatabaseSupport", "GraphicsSupport", "AccessibilitySupport"] if self.options.get_safe("with_vulkan"): cocoa_reqs.append("VulkanSupport") if self.options.widgets: - cocoa_reqs.append("PrintSupport") + cocoa_reqs.append("PrintSupport") _create_plugin("QCocoaIntegrationPlugin", "qcocoa", "platforms", cocoa_reqs) _create_plugin("QMacStylePlugin", "qmacstyle", "styles", cocoa_reqs) self.cpp_info.components["QCocoaIntegrationPlugin"].frameworks = ["AppKit", "Carbon", "CoreServices", "CoreVideo", @@ -1087,26 +1129,30 @@ def _create_plugin(pluginname, libname, plugintype, requires): elif self.settings.os in ["iOS", "tvOS"]: _create_plugin("QIOSIntegrationPlugin", "qios", "platforms", ["ClipboardSupport", "FontDatabaseSupport", "GraphicsSupport"]) self.cpp_info.components["QIOSIntegrationPlugin"].frameworks = ["AudioToolbox", "Foundation", "Metal", - "QuartzCore", "UIKit"] + "MobileCoreServices", "OpenGLES", "QuartzCore", "UIKit"] elif self.settings.os == "watchOS": _create_plugin("QMinimalIntegrationPlugin", "qminimal", "platforms", ["EventDispatcherSupport", "FontDatabaseSupport"]) elif self.settings.os == "Emscripten": _create_plugin("QWasmIntegrationPlugin", "qwasm", "platforms", ["Core", "Gui", "EventDispatcherSupport", "FontDatabaseSupport", "EglSupport"]) elif self.settings.os in ["Linux", "FreeBSD"]: - service_support_reqs = ["Core", "Gui"] + service_support_reqs = ["Core", "Gui"] if self.options.with_dbus: service_support_reqs.append("DBus") _create_module("ServiceSupport", service_support_reqs) _create_module("EdidSupport") - _create_module("XkbCommonSupport", ["Core", "Gui", "xkbcommon::libxkbcommon-x11"]) - xcb_qpa_reqs = ["Core", "Gui", "ServiceSupport", "ThemeSupport", "FontDatabaseSupport", "EdidSupport", "XkbCommonSupport", "xorg::xorg"] + if self.options.get_safe("with_x11", False): + _create_module("XkbCommonSupport", ["Core", "Gui", "xkbcommon::libxkbcommon-x11"]) + xcb_qpa_reqs = ["Core", "Gui", "ServiceSupport", "ThemeSupport", "FontDatabaseSupport", "EdidSupport", "XkbCommonSupport", "xorg::xorg"] + elif self.options.qtwayland: + _create_module("XkbCommonSupport", ["Core", "Gui", "xkbcommon::libxkbcommon"]) if self.options.with_dbus and self.options.with_atspi: _create_module("LinuxAccessibilitySupport", ["Core", "DBus", "Gui", "AccessibilitySupport", "at-spi2-core::at-spi2-core"]) xcb_qpa_reqs.append("LinuxAccessibilitySupport") if self.options.get_safe("with_vulkan"): xcb_qpa_reqs.append("VulkanSupport") - _create_module("XcbQpa", xcb_qpa_reqs, has_include_dir=False) - _create_plugin("QXcbIntegrationPlugin", "qxcb", "platforms", ["Core", "Gui", "XcbQpa"]) + if self.options.get_safe("with_x11", False): + _create_module("XcbQpa", xcb_qpa_reqs, has_include_dir=False) + _create_plugin("QXcbIntegrationPlugin", "qxcb", "platforms", ["Core", "Gui", "XcbQpa"]) if self.options.with_sqlite3: _create_plugin("QSQLiteDriverPlugin", "qsqlite", "sqldrivers", ["sqlite3::sqlite3"]) @@ -1125,13 +1171,6 @@ def _create_plugin(pluginname, libname, plugintype, requires): _create_module("Network", networkReqs) _create_module("Sql") _create_module("Test") - if self.options.widgets: - _create_module("Widgets", ["Gui"]) - build_modules.append(self._cmake_qt5_private_file("Widgets")) - self.cpp_info.components["qtWidgets"].build_modules["cmake_find_package"].append(self._cmake_qt5_private_file("Widgets")) - self.cpp_info.components["qtWidgets"].build_modules["cmake_find_package_multi"].append(self._cmake_qt5_private_file("Widgets")) - if self.options.gui and self.options.widgets: - _create_module("PrintSupport", ["Gui", "Widgets"]) if self.options.get_safe("opengl", "no") != "no" and self.options.gui: _create_module("OpenGL", ["Gui"]) if self.options.widgets and self.options.get_safe("opengl", "no") != "no": @@ -1143,9 +1182,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): if self.options.qtdeclarative: _create_module("Qml", ["Network"]) - build_modules.append(self._cmake_qt5_private_file("Qml")) - self.cpp_info.components["qtQml"].build_modules["cmake_find_package"].append(self._cmake_qt5_private_file("Qml")) - self.cpp_info.components["qtQml"].build_modules["cmake_find_package_multi"].append(self._cmake_qt5_private_file("Qml")) + _add_build_module("qtQml", self._cmake_qt5_private_file("Qml")) _create_module("QmlModels", ["Qml"]) self.cpp_info.components["qtQmlImportScanner"].set_property("cmake_target_name", "Qt5::QmlImportScanner") self.cpp_info.components["qtQmlImportScanner"].names["cmake_find_package"] = "QmlImportScanner" # this is an alias for Qml and there to integrate with existing consumers @@ -1210,7 +1247,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): webenginereqs = ["Gui", "Quick", "WebChannel", "Positioning"] if self.settings.os in ["Linux", "FreeBSD"]: webenginereqs.extend(["expat::expat", "opus::libopus", "xorg-proto::xorg-proto", "libxshmfence::libxshmfence", \ - "nss::nss", "libdrm::libdrm"]) + "nss::nss", "libdrm::libdrm", "egl::egl"]) _create_module("WebEngineCore", webenginereqs) if self.settings.os != "Windows": self.cpp_info.components["WebEngineCore"].system_libs.append("resolv") @@ -1221,7 +1258,7 @@ def _create_plugin(pluginname, libname, plugintype, requires): _create_module("SerialPort") if self.options.qtserialbus: - _create_module("SerialBus", ["SerialPort"]) + _create_module("SerialBus", ["SerialPort"] if self.options.get_safe("qtserialport") else []) _create_plugin("PassThruCanBusPlugin", "qtpassthrucanbus", "canbus", []) _create_plugin("PeakCanBusPlugin", "qtpeakcanbus", "canbus", []) _create_plugin("SocketCanBusPlugin", "qtsocketcanbus", "canbus", []) @@ -1330,16 +1367,16 @@ def _create_plugin(pluginname, libname, plugintype, requires): if self.options.qtremoteobjects: _create_module("RemoteObjects") - if self.options.qtwinextras: + if self.options.get_safe("qtwinextras"): _create_module("WinExtras") - if self.options.qtmacextras: + if self.options.get_safe("qtmacextras"): _create_module("MacExtras") if self.options.qtxmlpatterns: _create_module("XmlPatterns", ["Network"]) - if self.options.qtactiveqt: + if self.options.get_safe("qtactiveqt"): _create_module("AxBase", ["Gui", "Widgets"]) self.cpp_info.components["qtAxBase"].includedirs = ["include", os.path.join("include", "ActiveQt")] self.cpp_info.components["qtAxBase"].system_libs.extend(["ole32", "oleaut32", "user32", "gdi32", "advapi32"]) @@ -1380,33 +1417,30 @@ def _create_plugin(pluginname, libname, plugintype, requires): if self.options.widgets: self.cpp_info.components["qtWidgets"].system_libs.append("UxTheme") self.cpp_info.components["qtWidgets"].system_libs.append("dwmapi") - if self.options.qtwinextras: + if self.options.get_safe("qtwinextras"): self.cpp_info.components["qtWinExtras"].system_libs.append("dwmapi") # qtwinextras requires "DwmGetColorizationColor" which is in "dwmapi.lib" library - + if is_apple_os(self): + self.cpp_info.components["qtCore"].frameworks.append("CoreServices" if self.settings.os == "Macos" else "MobileCoreServices") + self.cpp_info.components["qtNetwork"].frameworks.append("SystemConfiguration") + if self.options.with_gssapi: + self.cpp_info.components["qtNetwork"].frameworks.append("GSS") + if not self.options.openssl: # with SecureTransport + self.cpp_info.components["qtNetwork"].frameworks.append("Security") if self.settings.os == "Macos": self.cpp_info.components["qtCore"].frameworks.append("IOKit") # qtcore requires "_IORegistryEntryCreateCFProperty", "_IOServiceGetMatchingService" and much more which are in "IOKit" framework self.cpp_info.components["qtCore"].frameworks.append("Cocoa") # qtcore requires "_OBJC_CLASS_$_NSApplication" and more, which are in "Cocoa" framework self.cpp_info.components["qtCore"].frameworks.append("Security") # qtcore requires "_SecRequirementCreateWithString" and more, which are in "Security" framework - self.cpp_info.components["qtNetwork"].frameworks.append("SystemConfiguration") - if self.options.with_gssapi: - self.cpp_info.components["qtNetwork"].frameworks.append("GSS") self.cpp_info.components["qtCore"].builddirs.append(os.path.join("bin","archdatadir","bin")) - build_modules.append(self._cmake_core_extras_file) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package"].append(self._cmake_core_extras_file) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package_multi"].append(self._cmake_core_extras_file) - build_modules.append(self._cmake_qt5_private_file("Core")) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package"].append(self._cmake_qt5_private_file("Core")) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package_multi"].append(self._cmake_qt5_private_file("Core")) + _add_build_module("qtCore", self._cmake_core_extras_file) + _add_build_module("qtCore", self._cmake_qt5_private_file("Core")) for m in os.listdir(os.path.join("lib", "cmake")): - module = os.path.join("lib", "cmake", m, "%sMacros.cmake" % m) + module = os.path.join("lib", "cmake", m, f"{m}Macros.cmake") component_name = m.replace("Qt5", "qt") if os.path.isfile(module): - build_modules.append(module) - self.cpp_info.components[component_name].build_modules["cmake_find_package"].append(module) - self.cpp_info.components[component_name].build_modules["cmake_find_package_multi"].append(module) + _add_build_module(component_name, module) self.cpp_info.components[component_name].builddirs.append(os.path.join("lib", "cmake", m)) qt5core_config_extras_mkspec_dir_cmake = load(self, @@ -1431,7 +1465,19 @@ def _create_plugin(pluginname, libname, plugintype, requires): self.cpp_info.components[component].exelinkflags.extend(obj_files) self.cpp_info.components[component].sharedlinkflags.extend(obj_files) - self.cpp_info.set_property("cmake_build_modules", build_modules) + build_modules_list = [] + + def _add_build_modules_for_component(component): + for req in self.cpp_info.components[component].requires: + if "::" in req: # not a qt component + continue + _add_build_modules_for_component(req) + build_modules_list.extend(build_modules.pop(component, [])) + + for c in self.cpp_info.components: + _add_build_modules_for_component(c) + + self.cpp_info.set_property("cmake_build_modules", build_modules_list) @staticmethod def _remove_duplicate(l): @@ -1442,7 +1488,7 @@ def _remove_duplicate(l): yield element def _gather_libs(self, p): - if not p in self.deps_cpp_info.deps: + if p not in self.deps_cpp_info.deps: return [] libs = ["-l" + i for i in self.deps_cpp_info[p].libs + self.deps_cpp_info[p].system_libs] if is_apple_os(self): diff --git a/recipes/qt/5.x.x/patches/337f28c9ab-5.15.5.patch b/recipes/qt/5.x.x/patches/337f28c9ab-5.15.5.patch new file mode 100644 index 0000000000000..a2ea249c1db5f --- /dev/null +++ b/recipes/qt/5.x.x/patches/337f28c9ab-5.15.5.patch @@ -0,0 +1,40 @@ +From 337f28c9abb12f28538cfe2f49e5afc460578b32 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= +Date: Tue, 5 Jul 2022 15:38:33 +0200 +Subject: Darwin: Replace deprecated symbol kIOMasterPortDefault with + equivalent + +We can't use the replacement kIOMainPortDefault yet, as it's not +available in operating system versions we still support, but the +kIOMasterPortDefault documentation explicitly says that passing +NULL as a port argument indicates "use the default". + +As the underlying type of a mach_port_t is potentially either +a pointer or an unsigned int, we initialize the default to 0. + +Pick-to: 6.2 6.3 6.4 5.15 +Change-Id: I288aa94b8f2fbda47fd1cbaf329799db7ab988a0 +Reviewed-by: Alexandru Croitor +--- + src/corelib/global/qglobal.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +(limited to 'src/corelib/global/qglobal.cpp') + +diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp +index 738e39658f..c894471ad6 100644 +--- a/src/corelib/global/qglobal.cpp ++++ b/src/corelib/global/qglobal.cpp +@@ -3059,7 +3059,8 @@ QByteArray QSysInfo::machineUniqueId() + { + #if defined(Q_OS_DARWIN) && __has_include() + char uuid[UuidStringLen + 1]; +- io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); ++ static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault ++ io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice")); + QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); + return QByteArray(uuid); +-- +cgit v1.2.1 + diff --git a/recipes/qt/5.x.x/patches/337f28c9ab-5.15.8.patch b/recipes/qt/5.x.x/patches/337f28c9ab-5.15.8.patch new file mode 100644 index 0000000000000..053e6afa62e83 --- /dev/null +++ b/recipes/qt/5.x.x/patches/337f28c9ab-5.15.8.patch @@ -0,0 +1,39 @@ +From 337f28c9abb12f28538cfe2f49e5afc460578b32 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= +Date: Tue, 5 Jul 2022 15:38:33 +0200 +Subject: Darwin: Replace deprecated symbol kIOMasterPortDefault with + equivalent + +We can't use the replacement kIOMainPortDefault yet, as it's not +available in operating system versions we still support, but the +kIOMasterPortDefault documentation explicitly says that passing +NULL as a port argument indicates "use the default". + +As the underlying type of a mach_port_t is potentially either +a pointer or an unsigned int, we initialize the default to 0. + +Pick-to: 6.2 6.3 6.4 5.15 +Change-Id: I288aa94b8f2fbda47fd1cbaf329799db7ab988a0 +Reviewed-by: Alexandru Croitor +--- + src/corelib/global/qglobal.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +(limited to 'src/corelib/global/qglobal.cpp') + +diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp +index 738e39658f..c894471ad6 100644 +--- a/src/corelib/global/qglobal.cpp ++++ b/src/corelib/global/qglobal.cpp +@@ -3077,7 +3077,8 @@ QByteArray QSysInfo::machineUniqueId() + { + #if defined(Q_OS_DARWIN) && __has_include() + char uuid[UuidStringLen + 1]; +- io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); ++ static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault ++ io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice")); + QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); + return QByteArray(uuid); +-- +cgit v1.2.1 diff --git a/recipes/qt/5.x.x/patches/337f28c9ab.patch b/recipes/qt/5.x.x/patches/337f28c9ab.patch new file mode 100644 index 0000000000000..6784be15b8cfe --- /dev/null +++ b/recipes/qt/5.x.x/patches/337f28c9ab.patch @@ -0,0 +1,40 @@ +From 337f28c9abb12f28538cfe2f49e5afc460578b32 Mon Sep 17 00:00:00 2001 +From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= +Date: Tue, 5 Jul 2022 15:38:33 +0200 +Subject: Darwin: Replace deprecated symbol kIOMasterPortDefault with + equivalent + +We can't use the replacement kIOMainPortDefault yet, as it's not +available in operating system versions we still support, but the +kIOMasterPortDefault documentation explicitly says that passing +NULL as a port argument indicates "use the default". + +As the underlying type of a mach_port_t is potentially either +a pointer or an unsigned int, we initialize the default to 0. + +Pick-to: 6.2 6.3 6.4 5.15 +Change-Id: I288aa94b8f2fbda47fd1cbaf329799db7ab988a0 +Reviewed-by: Alexandru Croitor +--- + src/corelib/global/qglobal.cpp | 3 ++- + 1 file changed, 2 insertions(+), 1 deletion(-) + +(limited to 'src/corelib/global/qglobal.cpp') + +diff --git a/src/corelib/global/qglobal.cpp b/src/corelib/global/qglobal.cpp +index 738e39658f..c894471ad6 100644 +--- a/src/corelib/global/qglobal.cpp ++++ b/src/corelib/global/qglobal.cpp +@@ -3067,7 +3067,8 @@ QByteArray QSysInfo::machineUniqueId() + { + #if defined(Q_OS_DARWIN) && __has_include() + char uuid[UuidStringLen + 1]; +- io_service_t service = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice")); ++ static const mach_port_t defaultPort = 0; // Effectively kIOMasterPortDefault/kIOMainPortDefault ++ io_service_t service = IOServiceGetMatchingService(defaultPort, IOServiceMatching("IOPlatformExpertDevice")); + QCFString stringRef = (CFStringRef)IORegistryEntryCreateCFProperty(service, CFSTR(kIOPlatformUUIDKey), kCFAllocatorDefault, 0); + CFStringGetCString(stringRef, uuid, sizeof(uuid), kCFStringEncodingMacRoman); + return QByteArray(uuid); +-- +cgit v1.2.1 + diff --git a/recipes/qt/5.x.x/patches/7371d3a.diff b/recipes/qt/5.x.x/patches/7371d3a.diff deleted file mode 100644 index 9488a6aec87ec..0000000000000 --- a/recipes/qt/5.x.x/patches/7371d3a.diff +++ /dev/null @@ -1,38 +0,0 @@ -Parent: 30151e20 (Fix misidentification of some shearing QTransforms as only rotating) -Author: Zhang Yu -AuthorDate: 2020-11-17 21:05:39 +0800 -Commit: Zhang Yu -CommitDate: 2020-11-18 07:41:48 +0000 - -Fix QGraphicsItem crash if click right button of mouse - -In this case, the 'parent' is QGraphicsTextItem which isn't a object -inheriting from QWidget. Converting QGraphicsTextItem to QWidget -by static_cast and using it as QWidget leads to crash. - -Fixes: QTBUG-88309 -Change-Id: I3c583f43125eb36841848434d1fa9a135b0e9f57 -Reviewed-by: Volker Hilsheimer -(cherry picked from commit 4df5f93018344f6cdc6cd5a08a084b1c61e0c076) - -diff --git a/src/widgets/widgets/qwidgettextcontrol.cpp b/src/widgets/widgets/qwidgettextcontrol.cpp -index 40b8af6..e2a07c0 100644 ---- a/src/widgets/widgets/qwidgettextcontrol.cpp -+++ b/src/widgets/widgets/qwidgettextcontrol.cpp -@@ -1942,10 +1942,14 @@ - if (!menu) - return; - menu->setAttribute(Qt::WA_DeleteOnClose); -- if (auto *window = static_cast(parent)->window()->windowHandle()) { -- QMenuPrivate::get(menu)->topData()->initialScreenIndex = -+ -+ if (auto *widget = qobject_cast(parent)) { -+ if (auto *window = widget->window()->windowHandle()) { -+ QMenuPrivate::get(menu)->topData()->initialScreenIndex = - QGuiApplication::screens().indexOf(window->screen()); -+ } - } -+ - menu->popup(screenPos); - #endif - } diff --git a/recipes/qt/5.x.x/patches/QTBUG-88625.diff b/recipes/qt/5.x.x/patches/QTBUG-88625.diff deleted file mode 100644 index ed0c1fd48d82c..0000000000000 --- a/recipes/qt/5.x.x/patches/QTBUG-88625.diff +++ /dev/null @@ -1,58 +0,0 @@ -Fix compile errors in QtWebEngine when building with VS2019 >= 16.8.0 . -See https://bugreports.qt.io/browse/QTBUG-88625 and -https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/321741 . - -diff -u -r a/src/3rdparty/chromium/third_party/angle/src/common/mathutil.cpp b/src/3rdparty/chromium/third_party/angle/src/common/mathutil.cpp ---- a/src/3rdparty/chromium/third_party/angle/src/common/mathutil.cpp 2021-05-20 13:38:32.243947800 +0200 -+++ b/src/3rdparty/chromium/third_party/angle/src/common/mathutil.cpp 2021-05-20 12:25:30.392900700 +0200 -@@ -72,11 +72,11 @@ - const RGB9E5Data *inputData = reinterpret_cast(&input); - - *red = -- inputData->R * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits); -+ inputData->R * (float)pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits); - *green = -- inputData->G * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits); -+ inputData->G * (float)pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits); - *blue = -- inputData->B * pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits); -+ inputData->B * (float)pow(2.0f, (int)inputData->E - g_sharedexp_bias - g_sharedexp_mantissabits); - } - - } // namespace gl -diff -u -r a/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/lab_color_space.h b/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/lab_color_space.h ---- a/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/lab_color_space.h 2020-11-07 02:22:36.000000000 +0100 -+++ b/src/3rdparty/chromium/third_party/blink/renderer/platform/graphics/lab_color_space.h 2021-05-20 13:39:42.890109500 +0200 -@@ -130,7 +130,7 @@ - // https://en.wikipedia.org/wiki/CIELAB_color_space#Forward_transformation. - FloatPoint3D toXYZ(const FloatPoint3D& lab) const { - auto invf = [](float x) { -- return x > kSigma ? pow(x, 3) : 3 * kSigma2 * (x - 4.0f / 29.0f); -+ return x > kSigma ? (float)pow(x, 3) : 3 * kSigma2 * (x - 4.0f / 29.0f); - }; - - FloatPoint3D v = {clamp(lab.X(), 0.0f, 100.0f), -diff -u -r a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/timestamped_trace_piece.h b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/timestamped_trace_piece.h ---- a/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/timestamped_trace_piece.h 2020-11-07 02:22:36.000000000 +0100 -+++ b/src/3rdparty/chromium/third_party/perfetto/src/trace_processor/timestamped_trace_piece.h 2021-05-20 13:41:08.983902900 +0200 -@@ -197,6 +197,20 @@ - } - return *this; - } -+ -+ #if PERFETTO_BUILDFLAG(PERFETTO_COMPILER_MSVC) -+ TimestampedTracePiece& operator=(TimestampedTracePiece&& ttp) const -+ { -+ if (this != &ttp) { -+ // First invoke the destructor and then invoke the move constructor -+ // inline via placement-new to implement move-assignment. -+ this->~TimestampedTracePiece(); -+ new (const_cast(this)) TimestampedTracePiece(std::move(ttp)); -+ } -+ -+ return const_cast(*this); -+ } -+#endif // PERFETTO_BUILDFLAG(PERFETTO_COMPILER_MSVC) - - ~TimestampedTracePiece() { - switch (type) { diff --git a/recipes/qt/5.x.x/patches/QTBUG-90395.diff b/recipes/qt/5.x.x/patches/QTBUG-90395.diff deleted file mode 100644 index 9d391311c3455..0000000000000 --- a/recipes/qt/5.x.x/patches/QTBUG-90395.diff +++ /dev/null @@ -1,38 +0,0 @@ -Description: include to fix some GCC 11 build issues -Origin: upstream, commits: - https://code.qt.io/cgit/qt/qtbase.git/commit/?id=813a928c7c3cf986 - https://code.qt.io/cgit/qt/qtbase.git/commit/?id=9c56d4da2ff631a8 -Last-Update: 2021-01-26 - ---- a/src/corelib/global/qendian.h -+++ b/src/corelib/global/qendian.h -@@ -44,6 +44,8 @@ - #include - #include - -+#include -+ - // include stdlib.h and hope that it defines __GLIBC__ for glibc-based systems - #include - #include ---- a/src/corelib/global/qfloat16.h -+++ b/src/corelib/global/qfloat16.h -@@ -43,6 +43,7 @@ - - #include - #include -+#include - #include - - #if defined(QT_COMPILER_SUPPORTS_F16C) && defined(__AVX2__) && !defined(__F16C__) ---- a/src/corelib/text/qbytearraymatcher.h -+++ b/src/corelib/text/qbytearraymatcher.h -@@ -42,6 +42,8 @@ - - #include - -+#include -+ - QT_BEGIN_NAMESPACE - - diff --git a/recipes/qt/5.x.x/patches/b498f4ce3f.patch b/recipes/qt/5.x.x/patches/b498f4ce3f.patch deleted file mode 100644 index 60ad749a0917d..0000000000000 --- a/recipes/qt/5.x.x/patches/b498f4ce3f.patch +++ /dev/null @@ -1,37 +0,0 @@ -From b498f4ce3f542882767238ea9f01eb85de6c6fda Mon Sep 17 00:00:00 2001 -From: Peter Varga -Date: Tue, 18 May 2021 09:11:49 +0200 -Subject: [PATCH] Fix build with GCC 11 - -Change-Id: Ifc73421768e2c6123225064314d39d8479ea4ed8 -Fixes: QTBUG-93824 -Reviewed-by: Allan Sandfeld Jensen ---- - .../abseil-cpp/absl/synchronization/internal/graphcycles.cc | 1 + - .../perfetto/src/trace_processor/containers/string_pool.h | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/chromium/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc b/chromium/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc -index 19f9aab5b1a..27fec21681d 100644 ---- a/chromium/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc -+++ b/chromium/third_party/abseil-cpp/absl/synchronization/internal/graphcycles.cc -@@ -37,6 +37,7 @@ - - #include - #include -+#include - #include "absl/base/internal/hide_ptr.h" - #include "absl/base/internal/raw_logging.h" - #include "absl/base/internal/spinlock.h" -diff --git a/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h b/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h -index 11ae91cfeca..6b76b74c91b 100644 ---- a/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h -+++ b/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h -@@ -17,6 +17,7 @@ - #ifndef SRC_TRACE_PROCESSOR_CONTAINERS_STRING_POOL_H_ - #define SRC_TRACE_PROCESSOR_CONTAINERS_STRING_POOL_H_ - -+#include - #include - #include - diff --git a/recipes/qt/5.x.x/patches/declarative_missing_header.diff b/recipes/qt/5.x.x/patches/declarative_missing_header.diff deleted file mode 100644 index 3422534c423c6..0000000000000 --- a/recipes/qt/5.x.x/patches/declarative_missing_header.diff +++ /dev/null @@ -1,11 +0,0 @@ ---- a/src/qmldebug/qqmlprofilerevent_p.h -+++ b/src/qmldebug/qqmlprofilerevent_p.h -@@ -49,7 +49,7 @@ - - #include - #include -- -+#include - // - // W A R N I N G - // ------------- diff --git a/recipes/qt/5.x.x/patches/f830b86.diff b/recipes/qt/5.x.x/patches/f830b86.diff deleted file mode 100644 index 3b0d18134fe2d..0000000000000 --- a/recipes/qt/5.x.x/patches/f830b86.diff +++ /dev/null @@ -1,51 +0,0 @@ -From f830b86ef770100f6e3fa234ac3e00eee7a1cd70 Mon Sep 17 00:00:00 2001 -From: Peter Varga -Date: Mon, 16 Nov 2020 11:11:13 +0100 -Subject: [PATCH] [Backport] mac: make find_sdk.py work when the sdk goes to 11 - -Bug: 1098738 -Change-Id: I25b84537a445ecb8f80241c98d4753932f5f7c90 -Commit-Queue: Nico Weber -Commit-Queue: Mark Mentovai -Auto-Submit: Nico Weber -Reviewed-by: Mark Mentovai -Cr-Commit-Position: refs/heads/master@{#781835} -Reviewed-by: Allan Sandfeld Jensen ---- - -diff --git a/chromium/build/mac/find_sdk.py b/chromium/build/mac/find_sdk.py -index 38c2883..a2f7455 100755 ---- a/chromium/build/mac/find_sdk.py -+++ b/chromium/build/mac/find_sdk.py -@@ -2,8 +2,7 @@ - # Copyright (c) 2012 The Chromium Authors. All rights reserved. - # Use of this source code is governed by a BSD-style license that can be - # found in the LICENSE file. -- --"""Prints the lowest locally available SDK version greater than or equal to a -+r"""Prints the lowest locally available SDK version greater than or equal to a - given minimum sdk version to standard output. - - If --developer_dir is passed, then the script will use the Xcode toolchain -@@ -14,8 +13,10 @@ - toolchain bin dir. - - Usage: -- python find_sdk.py [--developer_dir DEVELOPER_DIR] [--print_sdk_path] \ -- [--print_bin_path] 10.6 # Ignores SDKs < 10.6 -+ python find_sdk.py \ -+ [--print_sdk_path] \ -+ [--print_bin_path] \ -+ 10.6 # Ignores SDKs < 10.6 - - Sample Output: - /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -@@ -88,7 +89,7 @@ - raise SdkError('Install Xcode, launch it, accept the license ' + - 'agreement, and run `sudo xcode-select -s /path/to/Xcode.app` ' + - 'to continue.') -- sdks = [re.findall('^MacOSX(10\.\d+)\.sdk$', s) for s in os.listdir(sdk_dir)] -+ sdks = [re.findall('^MacOSX(\d+\.\d+)\.sdk$', s) for s in os.listdir(sdk_dir)] - sdks = [s[0] for s in sdks if s] # [['10.5'], ['10.6']] => ['10.5', '10.6'] - sdks = [s for s in sdks # ['10.5', '10.6'] => ['10.6'] - if parse_version(s) >= parse_version(min_sdk_version)] diff --git a/recipes/qt/5.x.x/patches/fix-gcc-11.diff b/recipes/qt/5.x.x/patches/fix-gcc-11.diff deleted file mode 100644 index 5818509732180..0000000000000 --- a/recipes/qt/5.x.x/patches/fix-gcc-11.diff +++ /dev/null @@ -1,10 +0,0 @@ ---- a/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h -+++ b/chromium/third_party/perfetto/src/trace_processor/containers/string_pool.h -@@ -19,6 +19,7 @@ - - #include - #include -+#include - - #include - #include \ No newline at end of file diff --git a/recipes/qt/5.x.x/qtmodules5.15.2.conf b/recipes/qt/5.x.x/qtmodules5.15.2.conf deleted file mode 100644 index 788b31c881415..0000000000000 --- a/recipes/qt/5.x.x/qtmodules5.15.2.conf +++ /dev/null @@ -1,284 +0,0 @@ -[submodule "qtbase"] - path = qtbase - url = ../qtbase.git - status = essential -[submodule "qtsvg"] - depends = qtbase - path = qtsvg - url = ../qtsvg.git - status = addon -[submodule "qtdeclarative"] - depends = qtbase - recommends = qtsvg - path = qtdeclarative - url = ../qtdeclarative.git - status = essential -[submodule "qtactiveqt"] - depends = qtbase - path = qtactiveqt - url = ../qtactiveqt.git - status = addon -[submodule "qtscript"] - depends = qtbase - recommends = qttools - path = qtscript - url = ../qtscript.git - status = deprecated -[submodule "qtmultimedia"] - depends = qtbase - recommends = qtdeclarative - path = qtmultimedia - url = ../qtmultimedia.git - status = essential -[submodule "qttools"] - depends = qtbase - recommends = qtdeclarative qtactiveqt - path = qttools - url = ../qttools.git - status = essential -[submodule "qtxmlpatterns"] - depends = qtbase - recommends = qtdeclarative - path = qtxmlpatterns - url = ../qtxmlpatterns.git - status = deprecated -[submodule "qttranslations"] - depends = qttools - path = qttranslations - url = ../qttranslations.git - status = essential - priority = 30 -[submodule "qtdoc"] - depends = qtdeclarative qttools - recommends = qtmultimedia qtquickcontrols qtquickcontrols2 - path = qtdoc - url = ../qtdoc.git - status = essential - priority = 40 -[submodule "qtrepotools"] - path = qtrepotools - url = ../qtrepotools.git - branch = master - status = essential - project = - -[submodule "qtqa"] - depends = qtbase - path = qtqa - url = ../qtqa.git - branch = master - status = essential - priority = 50 -[submodule "qtlocation"] - depends = qtbase - recommends = qtdeclarative qtquickcontrols qtquickcontrols2 qtserialport - path = qtlocation - url = ../qtlocation.git - status = addon -[submodule "qtsensors"] - depends = qtbase - recommends = qtdeclarative - path = qtsensors - url = ../qtsensors.git - status = addon -[submodule "qtsystems"] - depends = qtbase - recommends = qtdeclarative - path = qtsystems - url = ../qtsystems.git - branch = dev - status = ignore -[submodule "qtfeedback"] - depends = qtdeclarative - recommends = qtmultimedia - path = qtfeedback - url = ../qtfeedback.git - branch = master - status = ignore -[submodule "qtdocgallery"] - depends = qtdeclarative - path = qtdocgallery - url = ../qtdocgallery.git - branch = master - status = ignore -[submodule "qtpim"] - depends = qtdeclarative - path = qtpim - url = ../qtpim.git - branch = dev - status = ignore -[submodule "qtconnectivity"] - depends = qtbase - recommends = qtdeclarative qtandroidextras - path = qtconnectivity - url = ../qtconnectivity.git - status = addon -[submodule "qtwayland"] - depends = qtbase - recommends = qtdeclarative - path = qtwayland - url = ../qtwayland.git - status = addon -[submodule "qt3d"] - depends = qtbase - recommends = qtdeclarative qtimageformats qtgamepad - path = qt3d - url = ../qt3d.git - status = addon -[submodule "qtimageformats"] - depends = qtbase - path = qtimageformats - url = ../qtimageformats.git - status = addon -[submodule "qtgraphicaleffects"] - depends = qtdeclarative - path = qtgraphicaleffects - url = ../qtgraphicaleffects.git - status = essential -[submodule "qtquickcontrols"] - depends = qtdeclarative - recommends = qtgraphicaleffects - path = qtquickcontrols - url = ../qtquickcontrols.git - status = addon -[submodule "qtserialbus"] - depends = qtbase - recommends = qtserialport - path = qtserialbus - url = ../qtserialbus.git - status = addon -[submodule "qtserialport"] - depends = qtbase - path = qtserialport - url = ../qtserialport.git - status = addon -[submodule "qtx11extras"] - depends = qtbase - path = qtx11extras - url = ../qtx11extras.git - status = addon -[submodule "qtmacextras"] - depends = qtbase - path = qtmacextras - url = ../qtmacextras.git - status = addon -[submodule "qtwinextras"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtwinextras - url = ../qtwinextras.git - status = addon -[submodule "qtandroidextras"] - depends = qtbase - path = qtandroidextras - url = ../qtandroidextras.git - status = addon -[submodule "qtwebsockets"] - depends = qtbase - recommends = qtdeclarative - path = qtwebsockets - url = ../qtwebsockets.git - status = addon -[submodule "qtwebchannel"] - depends = qtbase - recommends = qtdeclarative qtwebsockets - path = qtwebchannel - url = ../qtwebchannel.git - status = addon -[submodule "qtwebengine"] - depends = qtdeclarative - recommends = qtquickcontrols qtquickcontrols2 qtlocation qtwebchannel qttools - path = qtwebengine - url = ../qtwebengine.git - status = addon - priority = 10 -[submodule "qtcanvas3d"] - depends = qtdeclarative - path = qtcanvas3d - url = ../qtcanvas3d.git - branch = dev - status = ignore -[submodule "qtwebview"] - depends = qtdeclarative - recommends = qtwebengine - path = qtwebview - url = ../qtwebview.git - status = addon -[submodule "qtquickcontrols2"] - depends = qtgraphicaleffects - recommends = qtimageformats - path = qtquickcontrols2 - url = ../qtquickcontrols2.git - status = essential -[submodule "qtpurchasing"] - depends = qtbase - recommends = qtdeclarative qtandroidextras - path = qtpurchasing - url = ../qtpurchasing.git - status = addon -[submodule "qtcharts"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtcharts - url = ../qtcharts.git - status = addon -[submodule "qtdatavis3d"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtdatavis3d - url = ../qtdatavis3d.git - status = addon -[submodule "qtvirtualkeyboard"] - depends = qtbase qtdeclarative qtsvg - recommends = qtmultimedia qtquickcontrols - path = qtvirtualkeyboard - url = ../qtvirtualkeyboard.git - status = addon -[submodule "qtgamepad"] - depends = qtbase - recommends = qtdeclarative - path = qtgamepad - url = ../qtgamepad.git - status = addon -[submodule "qtscxml"] - depends = qtbase qtdeclarative - path = qtscxml - url = ../qtscxml.git - status = addon -[submodule "qtspeech"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtspeech - url = ../qtspeech.git - status = addon -[submodule "qtnetworkauth"] - depends = qtbase - path = qtnetworkauth - url = ../qtnetworkauth.git - status = addon -[submodule "qtremoteobjects"] - depends = qtbase - recommends = qtdeclarative - path = qtremoteobjects - url = ../qtremoteobjects.git - status = addon -[submodule "qtwebglplugin"] - depends = qtbase qtwebsockets - recommends = qtdeclarative - path = qtwebglplugin - url = ../qtwebglplugin.git - status = addon -[submodule "qtlottie"] - depends = qtbase qtdeclarative - path = qtlottie - url = ../qtlottie.git - status = addon -[submodule "qtquicktimeline"] - depends = qtbase qtdeclarative - path = qtquicktimeline - url = ../qtquicktimeline - status = addon -[submodule "qtquick3d"] - depends = qtbase qtdeclarative - path = qtquick3d - url = ../qtquick3d.git - status = addon diff --git a/recipes/qt/5.x.x/qtmodules5.15.3.conf b/recipes/qt/5.x.x/qtmodules5.15.3.conf deleted file mode 100644 index c1074189daf23..0000000000000 --- a/recipes/qt/5.x.x/qtmodules5.15.3.conf +++ /dev/null @@ -1,438 +0,0 @@ -[submodule "qtbase"] - path = qtbase - url = ../tqtc-qtbase.git - alias = qt/qtbase - branch = tqtc/lts-5.15-opensource - status = essential - repoType = replaced -[submodule "qtsvg"] - depends = qtbase - path = qtsvg - url = ../tqtc-qtsvg.git - alias = qt/qtsvg - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtdeclarative"] - depends = qtbase - recommends = qtsvg - path = qtdeclarative - url = ../tqtc-qtdeclarative.git - alias = qt/qtdeclarative - branch = tqtc/lts-5.15-opensource - status = essential - repoType = replaced -[submodule "qtactiveqt"] - depends = qtbase - path = qtactiveqt - url = ../tqtc-qtactiveqt.git - alias = qt/qtactiveqt - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtscript"] - depends = qtbase - recommends = qttools - path = qtscript - url = ../qtscript.git - branch = 5.15.3 - status = deprecated - repoType = replaced -[submodule "qtmultimedia"] - depends = qtbase - recommends = qtdeclarative - path = qtmultimedia - url = ../tqtc-qtmultimedia.git - alias = qt/qtmultimedia - branch = tqtc/lts-5.15-opensource - status = essential - repoType = replaced -[submodule "qttools"] - depends = qtbase - recommends = qtdeclarative qtactiveqt - path = qttools - url = ../tqtc-qttools.git - alias = qt/qttools - branch = tqtc/lts-5.15-opensource - status = essential - repoType = replaced -[submodule "qtxmlpatterns"] - depends = qtbase - recommends = qtdeclarative - path = qtxmlpatterns - url = ../tqtc-qtxmlpatterns.git - alias = qt/qtxmlpatterns - branch = tqtc/lts-5.15-opensource - status = deprecated - repoType = replaced -[submodule "qttranslations"] - depends = qttools - path = qttranslations - url = ../tqtc-qttranslations.git - alias = qt/qttranslations - branch = tqtc/lts-5.15-opensource - status = essential - priority = 30 - repoType = replaced -[submodule "qtdoc"] - depends = qtdeclarative qttools - recommends = qtmultimedia qtquickcontrols qtquickcontrols2 - path = qtdoc - url = ../tqtc-qtdoc.git - alias = qt/qtdoc - branch = tqtc/lts-5.15-opensource - status = essential - priority = 40 - repoType = replaced -[submodule "qtrepotools"] - path = qtrepotools - url = ../qtrepotools.git - branch = master - status = essential - project = - - repoType = inherited -[submodule "qtqa"] - depends = qtbase - path = qtqa - url = ../qtqa.git - branch = master - status = essential - priority = 50 - repoType = inherited -[submodule "qtlocation"] - depends = qtbase - recommends = qtdeclarative qtquickcontrols qtquickcontrols2 qtserialport - path = qtlocation - url = ../tqtc-qtlocation.git - alias = qt/qtlocation - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtsensors"] - depends = qtbase - recommends = qtdeclarative - path = qtsensors - url = ../tqtc-qtsensors.git - alias = qt/qtsensors - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtsystems"] - depends = qtbase - recommends = qtdeclarative - path = qtsystems - url = ../qtsystems.git - branch = dev - status = ignore - repoType = inherited -[submodule "qtfeedback"] - depends = qtdeclarative - recommends = qtmultimedia - path = qtfeedback - url = ../qtfeedback.git - branch = master - status = ignore - repoType = inherited -[submodule "qtpim"] - depends = qtdeclarative - path = qtpim - url = ../qtpim.git - branch = dev - status = ignore - repoType = inherited -[submodule "qtconnectivity"] - depends = qtbase - recommends = qtdeclarative qtandroidextras - path = qtconnectivity - url = ../tqtc-qtconnectivity.git - alias = qt/qtconnectivity - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtwayland"] - depends = qtbase - recommends = qtdeclarative - path = qtwayland - url = ../tqtc-qtwayland.git - alias = qt/qtwayland - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qt3d"] - depends = qtbase - recommends = qtdeclarative qtimageformats qtgamepad - path = qt3d - url = ../tqtc-qt3d.git - alias = qt/qt3d - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtimageformats"] - depends = qtbase - path = qtimageformats - url = ../tqtc-qtimageformats.git - alias = qt/qtimageformats - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtgraphicaleffects"] - depends = qtdeclarative - path = qtgraphicaleffects - url = ../tqtc-qtgraphicaleffects.git - alias = qt/qtgraphicaleffects - branch = tqtc/lts-5.15-opensource - status = essential - repoType = replaced -[submodule "qtquickcontrols"] - depends = qtdeclarative - recommends = qtgraphicaleffects - path = qtquickcontrols - url = ../tqtc-qtquickcontrols.git - alias = qt/qtquickcontrols - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtserialbus"] - depends = qtbase - recommends = qtserialport - path = qtserialbus - url = ../tqtc-qtserialbus.git - alias = qt/qtserialbus - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtserialport"] - depends = qtbase - path = qtserialport - url = ../tqtc-qtserialport.git - alias = qt/qtserialport - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtx11extras"] - depends = qtbase - path = qtx11extras - url = ../tqtc-qtx11extras.git - alias = qt/qtx11extras - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtmacextras"] - depends = qtbase - path = qtmacextras - url = ../tqtc-qtmacextras.git - alias = qt/qtmacextras - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtwinextras"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtwinextras - url = ../tqtc-qtwinextras.git - alias = qt/qtwinextras - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtandroidextras"] - depends = qtbase - path = qtandroidextras - url = ../tqtc-qtandroidextras.git - alias = qt/qtandroidextras - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtwebsockets"] - depends = qtbase - recommends = qtdeclarative - path = qtwebsockets - url = ../tqtc-qtwebsockets.git - alias = qt/qtwebsockets - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtwebchannel"] - depends = qtbase - recommends = qtdeclarative qtwebsockets - path = qtwebchannel - url = ../tqtc-qtwebchannel.git - alias = qt/qtwebchannel - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtwebengine"] - depends = qtdeclarative - recommends = qtquickcontrols qtquickcontrols2 qtlocation qtwebchannel qttools - path = qtwebengine - url = ../qtwebengine.git - branch = 5.15.3 - status = addon - priority = 10 - repoType = replaced -[submodule "qtcanvas3d"] - depends = qtdeclarative - path = qtcanvas3d - url = ../qtcanvas3d.git - branch = dev - status = ignore -[submodule "qtwebview"] - depends = qtdeclarative - recommends = qtwebengine - path = qtwebview - url = ../tqtc-qtwebview.git - alias = qt/qtwebview - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtquickcontrols2"] - depends = qtgraphicaleffects - recommends = qtimageformats - path = qtquickcontrols2 - url = ../tqtc-qtquickcontrols2.git - alias = qt/qtquickcontrols2 - branch = tqtc/lts-5.15-opensource - status = essential - repoType = replaced -[submodule "qtpurchasing"] - depends = qtbase - recommends = qtdeclarative qtandroidextras - path = qtpurchasing - url = ../tqtc-qtpurchasing.git - alias = qt/qtpurchasing - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtcharts"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtcharts - url = ../tqtc-qtcharts.git - alias = qt/qtcharts - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtdatavis3d"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtdatavis3d - url = ../tqtc-qtdatavis3d.git - alias = qt/qtdatavis3d - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtvirtualkeyboard"] - depends = qtbase qtdeclarative qtsvg - recommends = qtmultimedia qtquickcontrols - path = qtvirtualkeyboard - url = ../tqtc-qtvirtualkeyboard.git - alias = qt/qtvirtualkeyboard - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtgamepad"] - depends = qtbase - recommends = qtdeclarative - path = qtgamepad - url = ../tqtc-qtgamepad.git - alias = qt/qtgamepad - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtscxml"] - depends = qtbase qtdeclarative - path = qtscxml - url = ../tqtc-qtscxml.git - alias = qt/qtscxml - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtspeech"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtspeech - url = ../tqtc-qtspeech.git - alias = qt/qtspeech - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtnetworkauth"] - depends = qtbase - path = qtnetworkauth - url = ../tqtc-qtnetworkauth.git - alias = qt/qtnetworkauth - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtremoteobjects"] - depends = qtbase - recommends = qtdeclarative - path = qtremoteobjects - url = ../tqtc-qtremoteobjects.git - alias = qt/qtremoteobjects - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtwebglplugin"] - depends = qtbase qtwebsockets - recommends = qtdeclarative - path = qtwebglplugin - url = ../tqtc-qtwebglplugin.git - alias = qt/qtwebglplugin - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtlottie"] - depends = qtbase qtdeclarative - path = qtlottie - url = ../tqtc-qtlottie.git - alias = qt/qtlottie - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtquicktimeline"] - depends = qtbase qtdeclarative - path = qtquicktimeline - url = ../tqtc-qtquicktimeline - alias = qt/qtquicktimeline - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtquick3d"] - depends = qtbase qtdeclarative - path = qtquick3d - url = ../tqtc-qtquick3d.git - alias = qt/qtquick3d - branch = tqtc/lts-5.15-opensource - status = addon - repoType = replaced -[submodule "qtknx"] - depends = qtbase - recommends = qtdeclarative - path = qtknx - url = ../tqtc-qtknx.git - alias = qt/qtknx - branch = tqtc/lts-5.15-opensource - status = addon - project = qtknx.pro -[submodule "qtmqtt"] - depends = qtbase - path = qtmqtt - url = ../tqtc-qtmqtt.git - alias = qt/qtmqtt - branch = tqtc/lts-5.15-opensource - status = addon - project = qtmqtt.pro -[submodule "qtopcua"] - depends = qtbase qtdeclarative - path = qtopcua - url = ../tqtc-qtopcua.git - alias = qt/qtopcua - branch = tqtc/lts-5.15-opensource - status = preview -[submodule "qtcoap"] - depends = qtbase - path = qtcoap - url = ../tqtc-qtcoap.git - alias = qt/qtcoap - branch = tqtc/lts-5.15-opensource - status = addon diff --git a/recipes/qt/5.x.x/qtmodules5.15.4.conf b/recipes/qt/5.x.x/qtmodules5.15.6.conf similarity index 100% rename from recipes/qt/5.x.x/qtmodules5.15.4.conf rename to recipes/qt/5.x.x/qtmodules5.15.6.conf diff --git a/recipes/qt/5.x.x/qtmodules5.15.7.conf b/recipes/qt/5.x.x/qtmodules5.15.7.conf new file mode 100644 index 0000000000000..452233655f279 --- /dev/null +++ b/recipes/qt/5.x.x/qtmodules5.15.7.conf @@ -0,0 +1,326 @@ +[submodule "qtbase"] + path = qtbase + url = ../qtbase.git + branch = 5.15 + status = essential +[submodule "qtsvg"] + depends = qtbase + path = qtsvg + url = ../qtsvg.git + branch = 5.15 + status = addon +[submodule "qtdeclarative"] + depends = qtbase + recommends = qtsvg + path = qtdeclarative + url = ../qtdeclarative.git + branch = 5.15 + status = essential +[submodule "qtactiveqt"] + depends = qtbase + path = qtactiveqt + url = ../qtactiveqt.git + branch = 5.15 + status = addon +[submodule "qtscript"] + depends = qtbase + recommends = qttools + path = qtscript + url = ../qtscript.git + branch = 5.15 + status = deprecated +[submodule "qtmultimedia"] + depends = qtbase + recommends = qtdeclarative + path = qtmultimedia + url = ../qtmultimedia.git + branch = 5.15 + status = essential +[submodule "qttools"] + depends = qtbase + recommends = qtdeclarative qtactiveqt + path = qttools + url = ../qttools.git + branch = 5.15 + status = essential +[submodule "qtxmlpatterns"] + depends = qtbase + recommends = qtdeclarative + path = qtxmlpatterns + url = ../qtxmlpatterns.git + branch = 5.15 + status = deprecated +[submodule "qttranslations"] + depends = qttools + path = qttranslations + url = ../qttranslations.git + branch = 5.15 + status = essential + priority = 30 +[submodule "qtdoc"] + depends = qtdeclarative qttools + recommends = qtmultimedia qtquickcontrols qtquickcontrols2 + path = qtdoc + url = ../qtdoc.git + branch = 5.15 + status = essential + priority = 40 +[submodule "qtrepotools"] + path = qtrepotools + url = ../qtrepotools.git + branch = master + status = essential + project = - +[submodule "qtqa"] + depends = qtbase + path = qtqa + url = ../qtqa.git + branch = master + status = essential + priority = 50 +[submodule "qtlocation"] + depends = qtbase + recommends = qtdeclarative qtquickcontrols qtquickcontrols2 qtserialport + path = qtlocation + url = ../qtlocation.git + branch = 5.15 + status = addon +[submodule "qtsensors"] + depends = qtbase + recommends = qtdeclarative + path = qtsensors + url = ../qtsensors.git + branch = 5.15 + status = addon +[submodule "qtsystems"] + depends = qtbase + recommends = qtdeclarative + path = qtsystems + url = ../qtsystems.git + branch = dev + status = ignore +[submodule "qtfeedback"] + depends = qtdeclarative + recommends = qtmultimedia + path = qtfeedback + url = ../qtfeedback.git + branch = master + status = ignore +[submodule "qtdocgallery"] + depends = qtdeclarative + path = qtdocgallery + url = ../qtdocgallery.git + branch = master + status = ignore +[submodule "qtpim"] + depends = qtdeclarative + path = qtpim + url = ../qtpim.git + branch = dev + status = ignore +[submodule "qtconnectivity"] + depends = qtbase + recommends = qtdeclarative qtandroidextras + path = qtconnectivity + url = ../qtconnectivity.git + branch = 5.15 + status = addon +[submodule "qtwayland"] + depends = qtbase + recommends = qtdeclarative + path = qtwayland + url = ../qtwayland.git + branch = 5.15 + status = addon +[submodule "qt3d"] + depends = qtbase + recommends = qtdeclarative qtimageformats qtgamepad + path = qt3d + url = ../qt3d.git + branch = 5.15 + status = addon +[submodule "qtimageformats"] + depends = qtbase + path = qtimageformats + url = ../qtimageformats.git + branch = 5.15 + status = addon +[submodule "qtgraphicaleffects"] + depends = qtdeclarative + path = qtgraphicaleffects + url = ../qtgraphicaleffects.git + branch = 5.15 + status = essential +[submodule "qtquickcontrols"] + depends = qtdeclarative + recommends = qtgraphicaleffects + path = qtquickcontrols + url = ../qtquickcontrols.git + branch = 5.15 + status = addon +[submodule "qtserialbus"] + depends = qtbase + recommends = qtserialport + path = qtserialbus + url = ../qtserialbus.git + branch = 5.15 + status = addon +[submodule "qtserialport"] + depends = qtbase + path = qtserialport + url = ../qtserialport.git + branch = 5.15 + status = addon +[submodule "qtx11extras"] + depends = qtbase + path = qtx11extras + url = ../qtx11extras.git + branch = 5.15 + status = addon +[submodule "qtmacextras"] + depends = qtbase + path = qtmacextras + url = ../qtmacextras.git + branch = 5.15 + status = addon +[submodule "qtwinextras"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtwinextras + url = ../qtwinextras.git + branch = 5.15 + status = addon +[submodule "qtandroidextras"] + depends = qtbase + path = qtandroidextras + url = ../qtandroidextras.git + branch = 5.15 + status = addon +[submodule "qtwebsockets"] + depends = qtbase + recommends = qtdeclarative + path = qtwebsockets + url = ../qtwebsockets.git + branch = 5.15 + status = addon +[submodule "qtwebchannel"] + depends = qtbase + recommends = qtdeclarative qtwebsockets + path = qtwebchannel + url = ../qtwebchannel.git + branch = 5.15 + status = addon +[submodule "qtwebengine"] + depends = qtdeclarative + recommends = qtquickcontrols qtquickcontrols2 qtlocation qtwebchannel qttools + path = qtwebengine + url = ../qtwebengine.git + branch = 5.15 + status = addon + priority = 10 +[submodule "qtcanvas3d"] + depends = qtdeclarative + path = qtcanvas3d + url = ../qtcanvas3d.git + branch = dev + status = ignore +[submodule "qtwebview"] + depends = qtdeclarative + recommends = qtwebengine + path = qtwebview + url = ../qtwebview.git + branch = 5.15 + status = addon +[submodule "qtquickcontrols2"] + depends = qtgraphicaleffects + recommends = qtimageformats + path = qtquickcontrols2 + url = ../qtquickcontrols2.git + branch = 5.15 + status = essential +[submodule "qtpurchasing"] + depends = qtbase + recommends = qtdeclarative qtandroidextras + path = qtpurchasing + url = ../qtpurchasing.git + branch = 5.15 + status = addon +[submodule "qtcharts"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtcharts + url = ../qtcharts.git + branch = 5.15 + status = addon +[submodule "qtdatavis3d"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtdatavis3d + url = ../qtdatavis3d.git + branch = 5.15 + status = addon +[submodule "qtvirtualkeyboard"] + depends = qtbase qtdeclarative qtsvg + recommends = qtmultimedia qtquickcontrols + path = qtvirtualkeyboard + url = ../qtvirtualkeyboard.git + branch = 5.15 + status = addon +[submodule "qtgamepad"] + depends = qtbase + recommends = qtdeclarative + path = qtgamepad + url = ../qtgamepad.git + branch = 5.15 + status = addon +[submodule "qtscxml"] + depends = qtbase qtdeclarative + path = qtscxml + url = ../qtscxml.git + branch = 5.15 + status = addon +[submodule "qtspeech"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtspeech + url = ../qtspeech.git + branch = 5.15 + status = addon +[submodule "qtnetworkauth"] + depends = qtbase + path = qtnetworkauth + url = ../qtnetworkauth.git + branch = 5.15 + status = addon +[submodule "qtremoteobjects"] + depends = qtbase + recommends = qtdeclarative + path = qtremoteobjects + url = ../qtremoteobjects.git + branch = 5.15 + status = addon +[submodule "qtwebglplugin"] + depends = qtbase qtwebsockets + recommends = qtdeclarative + path = qtwebglplugin + url = ../qtwebglplugin.git + branch = 5.15 + status = addon +[submodule "qtlottie"] + depends = qtbase qtdeclarative + path = qtlottie + url = ../qtlottie.git + branch = 5.15 + status = addon +[submodule "qtquicktimeline"] + depends = qtbase qtdeclarative + path = qtquicktimeline + url = ../qtquicktimeline + branch = 5.15 + status = addon +[submodule "qtquick3d"] + depends = qtbase qtdeclarative + path = qtquick3d + url = ../qtquick3d.git + branch = 5.15 + status = addon diff --git a/recipes/qt/5.x.x/qtmodules5.15.8.conf b/recipes/qt/5.x.x/qtmodules5.15.8.conf new file mode 100644 index 0000000000000..452233655f279 --- /dev/null +++ b/recipes/qt/5.x.x/qtmodules5.15.8.conf @@ -0,0 +1,326 @@ +[submodule "qtbase"] + path = qtbase + url = ../qtbase.git + branch = 5.15 + status = essential +[submodule "qtsvg"] + depends = qtbase + path = qtsvg + url = ../qtsvg.git + branch = 5.15 + status = addon +[submodule "qtdeclarative"] + depends = qtbase + recommends = qtsvg + path = qtdeclarative + url = ../qtdeclarative.git + branch = 5.15 + status = essential +[submodule "qtactiveqt"] + depends = qtbase + path = qtactiveqt + url = ../qtactiveqt.git + branch = 5.15 + status = addon +[submodule "qtscript"] + depends = qtbase + recommends = qttools + path = qtscript + url = ../qtscript.git + branch = 5.15 + status = deprecated +[submodule "qtmultimedia"] + depends = qtbase + recommends = qtdeclarative + path = qtmultimedia + url = ../qtmultimedia.git + branch = 5.15 + status = essential +[submodule "qttools"] + depends = qtbase + recommends = qtdeclarative qtactiveqt + path = qttools + url = ../qttools.git + branch = 5.15 + status = essential +[submodule "qtxmlpatterns"] + depends = qtbase + recommends = qtdeclarative + path = qtxmlpatterns + url = ../qtxmlpatterns.git + branch = 5.15 + status = deprecated +[submodule "qttranslations"] + depends = qttools + path = qttranslations + url = ../qttranslations.git + branch = 5.15 + status = essential + priority = 30 +[submodule "qtdoc"] + depends = qtdeclarative qttools + recommends = qtmultimedia qtquickcontrols qtquickcontrols2 + path = qtdoc + url = ../qtdoc.git + branch = 5.15 + status = essential + priority = 40 +[submodule "qtrepotools"] + path = qtrepotools + url = ../qtrepotools.git + branch = master + status = essential + project = - +[submodule "qtqa"] + depends = qtbase + path = qtqa + url = ../qtqa.git + branch = master + status = essential + priority = 50 +[submodule "qtlocation"] + depends = qtbase + recommends = qtdeclarative qtquickcontrols qtquickcontrols2 qtserialport + path = qtlocation + url = ../qtlocation.git + branch = 5.15 + status = addon +[submodule "qtsensors"] + depends = qtbase + recommends = qtdeclarative + path = qtsensors + url = ../qtsensors.git + branch = 5.15 + status = addon +[submodule "qtsystems"] + depends = qtbase + recommends = qtdeclarative + path = qtsystems + url = ../qtsystems.git + branch = dev + status = ignore +[submodule "qtfeedback"] + depends = qtdeclarative + recommends = qtmultimedia + path = qtfeedback + url = ../qtfeedback.git + branch = master + status = ignore +[submodule "qtdocgallery"] + depends = qtdeclarative + path = qtdocgallery + url = ../qtdocgallery.git + branch = master + status = ignore +[submodule "qtpim"] + depends = qtdeclarative + path = qtpim + url = ../qtpim.git + branch = dev + status = ignore +[submodule "qtconnectivity"] + depends = qtbase + recommends = qtdeclarative qtandroidextras + path = qtconnectivity + url = ../qtconnectivity.git + branch = 5.15 + status = addon +[submodule "qtwayland"] + depends = qtbase + recommends = qtdeclarative + path = qtwayland + url = ../qtwayland.git + branch = 5.15 + status = addon +[submodule "qt3d"] + depends = qtbase + recommends = qtdeclarative qtimageformats qtgamepad + path = qt3d + url = ../qt3d.git + branch = 5.15 + status = addon +[submodule "qtimageformats"] + depends = qtbase + path = qtimageformats + url = ../qtimageformats.git + branch = 5.15 + status = addon +[submodule "qtgraphicaleffects"] + depends = qtdeclarative + path = qtgraphicaleffects + url = ../qtgraphicaleffects.git + branch = 5.15 + status = essential +[submodule "qtquickcontrols"] + depends = qtdeclarative + recommends = qtgraphicaleffects + path = qtquickcontrols + url = ../qtquickcontrols.git + branch = 5.15 + status = addon +[submodule "qtserialbus"] + depends = qtbase + recommends = qtserialport + path = qtserialbus + url = ../qtserialbus.git + branch = 5.15 + status = addon +[submodule "qtserialport"] + depends = qtbase + path = qtserialport + url = ../qtserialport.git + branch = 5.15 + status = addon +[submodule "qtx11extras"] + depends = qtbase + path = qtx11extras + url = ../qtx11extras.git + branch = 5.15 + status = addon +[submodule "qtmacextras"] + depends = qtbase + path = qtmacextras + url = ../qtmacextras.git + branch = 5.15 + status = addon +[submodule "qtwinextras"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtwinextras + url = ../qtwinextras.git + branch = 5.15 + status = addon +[submodule "qtandroidextras"] + depends = qtbase + path = qtandroidextras + url = ../qtandroidextras.git + branch = 5.15 + status = addon +[submodule "qtwebsockets"] + depends = qtbase + recommends = qtdeclarative + path = qtwebsockets + url = ../qtwebsockets.git + branch = 5.15 + status = addon +[submodule "qtwebchannel"] + depends = qtbase + recommends = qtdeclarative qtwebsockets + path = qtwebchannel + url = ../qtwebchannel.git + branch = 5.15 + status = addon +[submodule "qtwebengine"] + depends = qtdeclarative + recommends = qtquickcontrols qtquickcontrols2 qtlocation qtwebchannel qttools + path = qtwebengine + url = ../qtwebengine.git + branch = 5.15 + status = addon + priority = 10 +[submodule "qtcanvas3d"] + depends = qtdeclarative + path = qtcanvas3d + url = ../qtcanvas3d.git + branch = dev + status = ignore +[submodule "qtwebview"] + depends = qtdeclarative + recommends = qtwebengine + path = qtwebview + url = ../qtwebview.git + branch = 5.15 + status = addon +[submodule "qtquickcontrols2"] + depends = qtgraphicaleffects + recommends = qtimageformats + path = qtquickcontrols2 + url = ../qtquickcontrols2.git + branch = 5.15 + status = essential +[submodule "qtpurchasing"] + depends = qtbase + recommends = qtdeclarative qtandroidextras + path = qtpurchasing + url = ../qtpurchasing.git + branch = 5.15 + status = addon +[submodule "qtcharts"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtcharts + url = ../qtcharts.git + branch = 5.15 + status = addon +[submodule "qtdatavis3d"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtdatavis3d + url = ../qtdatavis3d.git + branch = 5.15 + status = addon +[submodule "qtvirtualkeyboard"] + depends = qtbase qtdeclarative qtsvg + recommends = qtmultimedia qtquickcontrols + path = qtvirtualkeyboard + url = ../qtvirtualkeyboard.git + branch = 5.15 + status = addon +[submodule "qtgamepad"] + depends = qtbase + recommends = qtdeclarative + path = qtgamepad + url = ../qtgamepad.git + branch = 5.15 + status = addon +[submodule "qtscxml"] + depends = qtbase qtdeclarative + path = qtscxml + url = ../qtscxml.git + branch = 5.15 + status = addon +[submodule "qtspeech"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtspeech + url = ../qtspeech.git + branch = 5.15 + status = addon +[submodule "qtnetworkauth"] + depends = qtbase + path = qtnetworkauth + url = ../qtnetworkauth.git + branch = 5.15 + status = addon +[submodule "qtremoteobjects"] + depends = qtbase + recommends = qtdeclarative + path = qtremoteobjects + url = ../qtremoteobjects.git + branch = 5.15 + status = addon +[submodule "qtwebglplugin"] + depends = qtbase qtwebsockets + recommends = qtdeclarative + path = qtwebglplugin + url = ../qtwebglplugin.git + branch = 5.15 + status = addon +[submodule "qtlottie"] + depends = qtbase qtdeclarative + path = qtlottie + url = ../qtlottie.git + branch = 5.15 + status = addon +[submodule "qtquicktimeline"] + depends = qtbase qtdeclarative + path = qtquicktimeline + url = ../qtquicktimeline + branch = 5.15 + status = addon +[submodule "qtquick3d"] + depends = qtbase qtdeclarative + path = qtquick3d + url = ../qtquick3d.git + branch = 5.15 + status = addon diff --git a/recipes/qt/5.x.x/test_package/conanfile.py b/recipes/qt/5.x.x/test_package/conanfile.py index bb73f38aa0625..427887bd514f2 100644 --- a/recipes/qt/5.x.x/test_package/conanfile.py +++ b/recipes/qt/5.x.x/test_package/conanfile.py @@ -1,8 +1,11 @@ import os import shutil -from conans import ConanFile, tools, Meson, RunEnvironment, CMake -from conans.errors import ConanException +from conan import ConanFile +from conans import tools, Meson, RunEnvironment, CMake +from conan.tools.build import cross_building +from conan.errors import ConanInvalidConfiguration + class TestPackageConan(ConanFile): @@ -24,11 +27,16 @@ def _is_mingw(self): def _meson_supported(self): return self.options["qt"].shared and\ - not tools.cross_building(self) and\ + not cross_building(self) and\ not tools.os_info.is_macos and\ not self._is_mingw() + def _qmake_supported(self): + return self.options["qt"].shared + def _build_with_qmake(self): + if not self._qmake_supported(): + return tools.mkdir("qmake_folder") with tools.chdir("qmake_folder"): self.output.info("Building with qmake") @@ -72,7 +80,7 @@ def _build_with_meson(self): meson = Meson(self) try: meson.configure(build_folder="meson_folder", defs={"cpp_std": "c++11"}) - except ConanException: + except ConanInvalidConfiguration: self.output.info(open("meson_folder/meson-logs/meson-log.txt", 'r').read()) raise meson.build() @@ -94,6 +102,8 @@ def build(self): self._build_with_cmake_find_package_multi() def _test_with_qmake(self): + if not self._qmake_supported(): + return self.output.info("Testing qmake") bin_path = os.path.join("qmake_folder", "bin") if tools.os_info.is_macos: @@ -113,7 +123,7 @@ def _test_with_cmake_find_package_multi(self): self.run(os.path.join("bin", "test_package"), run_environment=True) def test(self): - if not tools.cross_building(self, skip_x64_x86=True): + if not cross_building(self, skip_x64_x86=True): self._test_with_qmake() self._test_with_meson() self._test_with_cmake_find_package_multi() diff --git a/recipes/qt/6.x.x/conandata.yml b/recipes/qt/6.x.x/conandata.yml index 5df64e614dfb2..fa3f6c751ce19 100644 --- a/recipes/qt/6.x.x/conandata.yml +++ b/recipes/qt/6.x.x/conandata.yml @@ -1,20 +1,28 @@ sources: - "6.0.4": + "6.4.2": url: - - "https://download.qt.io/archive/qt/6.0/6.0.4/single/qt-everywhere-src-6.0.4.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/6.0/6.0.4/single/qt-everywhere-src-6.0.4.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.0/6.0.4/single/qt-everywhere-src-6.0.4.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/6.0/6.0.4/single/qt-everywhere-src-6.0.4.tar.xz" - - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.0/6.0.4/single/qt-everywhere-src-6.0.4.tar.xz" - sha256: "677db6472420f9046b16f7c0d0aa15c4f11f344462a6374feb860625c12fc72b" - "6.1.3": + - "https://download.qt.io/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.4/6.4.2/single/qt-everywhere-src-6.4.2.tar.xz" + sha256: "689f53e6652da82fccf7c2ab58066787487339f28d1ec66a8765ad357f4976be" + "6.4.1": url: - - "https://download.qt.io/archive/qt/6.1/6.1.3/single/qt-everywhere-src-6.1.3.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/6.1/6.1.3/single/qt-everywhere-src-6.1.3.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.1/6.1.3/single/qt-everywhere-src-6.1.3.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/6.1/6.1.3/single/qt-everywhere-src-6.1.3.tar.xz" - - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.1/6.1.3/single/qt-everywhere-src-6.1.3.tar.xz" - sha256: "552342a81fa76967656b0301233b4b586d36967fad5cd110765347aebe07413c" + - "https://download.qt.io/archive/qt/6.4/6.4.1/single/qt-everywhere-src-6.4.1.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/6.4/6.4.1/single/qt-everywhere-src-6.4.1.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.4/6.4.1/single/qt-everywhere-src-6.4.1.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/6.4/6.4.1/single/qt-everywhere-src-6.4.1.tar.xz" + - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.4/6.4.1/single/qt-everywhere-src-6.4.1.tar.xz" + sha256: "e20b850b6134098a7f2e7701cfddfb213c6cf394b9e848e6fbc5b0e89dcfcc09" + "6.3.2": + url: + - "https://download.qt.io/archive/qt/6.3/6.3.2/single/qt-everywhere-src-6.3.2.tar.xz" + - "https://qt-mirror.dannhauer.de/archive/qt/6.3/6.3.2/single/qt-everywhere-src-6.3.2.tar.xz" + - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.3/6.3.2/single/qt-everywhere-src-6.3.2.tar.xz" + - "https://ftp.fau.de/qtproject/archive/qt/6.3/6.3.2/single/qt-everywhere-src-6.3.2.tar.xz" + - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.3/6.3.2/single/qt-everywhere-src-6.3.2.tar.xz" + sha256: "b90524f686224a0e5a945c1d65307e16a375348dbe275c9ac11de171fe31374a" "6.2.4": url: - "https://download.qt.io/archive/qt/6.2/6.2.4/single/qt-everywhere-src-6.2.4.tar.xz" @@ -23,55 +31,53 @@ sources: - "https://ftp.fau.de/qtproject/archive/qt/6.2/6.2.4/single/qt-everywhere-src-6.2.4.tar.xz" - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.2/6.2.4/single/qt-everywhere-src-6.2.4.tar.xz" sha256: "cfe41905b6bde3712c65b102ea3d46fc80a44c9d1487669f14e4a6ee82ebb8fd" - "6.3.0": - url: - - "https://download.qt.io/archive/qt/6.3/6.3.0/single/qt-everywhere-src-6.3.0.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/6.3/6.3.0/single/qt-everywhere-src-6.3.0.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.3/6.3.0/single/qt-everywhere-src-6.3.0.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/6.3/6.3.0/single/qt-everywhere-src-6.3.0.tar.xz" - - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.3/6.3.0/single/qt-everywhere-src-6.3.0.tar.xz" - sha256: "cd2789cade3e865690f3c18df58ffbff8af74cc5f01faae50634c12eb52dd85b" - "6.3.1": - url: - - "https://download.qt.io/archive/qt/6.3/6.3.1/single/qt-everywhere-src-6.3.1.tar.xz" - - "https://qt-mirror.dannhauer.de/archive/qt/6.3/6.3.1/single/qt-everywhere-src-6.3.1.tar.xz" - - "https://www.funet.fi/pub/mirrors/download.qt-project.org/archive/qt/6.3/6.3.1/single/qt-everywhere-src-6.3.1.tar.xz" - - "https://ftp.fau.de/qtproject/archive/qt/6.3/6.3.1/single/qt-everywhere-src-6.3.1.tar.xz" - - "https://mirrors.ustc.edu.cn/qtproject/archive/qt/6.3/6.3.1/single/qt-everywhere-src-6.3.1.tar.xz" - sha256: "51114e789485fdb6b35d112dfd7c7abb38326325ac51221b6341564a1c3cc726" patches: - "6.0.4": - - base_path: "qt6/qtbase/cmake" + "6.4.2": + - base_path: "qtbase/cmake" patch_file: "patches/qt6-pri-helpers-fix.diff" - "6.1.3": - - base_path: "qt6/qtdeclarative" - patch_file: "patches/32451d5.diff" - - base_path: "qt6/qtbase/cmake" + - patch_file: "patches/c72097e.diff" + base_path: "qtwebengine" + - patch_file: "patches/d13958d.diff" + base_path: "qtbase" + patch_description: "Fix PCRE2 detection" + patch_type: "bugfix" + patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/445885" + "6.4.1": + - base_path: "qtbase/cmake" + patch_file: "patches/qt6-pri-helpers-fix.diff" + - patch_file: "patches/c72097e.diff" + base_path: "qtwebengine" + - patch_file: "patches/d13958d.diff" + base_path: "qtbase" + patch_description: "Fix PCRE2 detection" + patch_type: "bugfix" + patch_source: "https://codereview.qt-project.org/c/qt/qtbase/+/445885" + - patch_file: "patches/3801bba82.patch" + base_path: "qtwebengine/src/3rdparty" + patch_description: "fix qtwebengine with MSVC2022" + patch_type: "portability" + patch_source: "https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/444132" + "6.3.2": + - base_path: "qtbase/cmake" patch_file: "patches/qt6-pri-helpers-fix.diff" + - patch_file: "patches/c72097e.diff" + base_path: "qtwebengine" + - patch_file: "patches/d13958d.diff" + base_path: "qtbase" "6.2.4": - - base_path: "qt6/qtdeclarative" + - base_path: "qtdeclarative" patch_file: "patches/32451d5.diff" - - base_path: "qt6/qtbase/cmake" + - base_path: "qtbase/cmake" patch_file: "patches/qt6-pri-helpers-fix.diff" - patch_file: "patches/c72097e.diff" - base_path: "qt6/qtwebengine" + base_path: "qtwebengine" - patch_file: "patches/138a720.diff" - base_path: "qt6/qtwebengine/src/3rdparty" + base_path: "qtwebengine/src/3rdparty" - patch_file: "patches/CVE-2022-1096-qtwebengine-6.2.diff" - base_path: "qt6/qtwebengine" + base_path: "qtwebengine" - patch_file: "patches/CVE-2022-25255-qprocess6-2.diff" - base_path: "qt6/qtbase" + base_path: "qtbase" - patch_file: "patches/CVE-2022-25643-6.2.diff" - base_path: "qt6/qtbase" - "6.3.0": - - base_path: "qt6/qtbase/cmake" - patch_file: "patches/qt6-pri-helpers-fix.diff" - - patch_file: "patches/c72097e.diff" - base_path: "qt6/qtwebengine" - - patch_file: "patches/CVE-2022-1096-qtwebengine-6.3.diff" - base_path: "qt6/qtwebengine" - "6.3.1": - - base_path: "qt6/qtbase/cmake" - patch_file: "patches/qt6-pri-helpers-fix.diff" - - patch_file: "patches/c72097e.diff" - base_path: "qt6/qtwebengine" + base_path: "qtbase" + - patch_file: "patches/d13958d_.diff" + base_path: "qtbase" diff --git a/recipes/qt/6.x.x/conanfile.py b/recipes/qt/6.x.x/conanfile.py index 4231c65927261..9e368533d2047 100644 --- a/recipes/qt/6.x.x/conanfile.py +++ b/recipes/qt/6.x.x/conanfile.py @@ -1,19 +1,24 @@ from contextlib import contextmanager import configparser -import functools import glob import os import textwrap from conan import ConanFile -from conan.tools.build import cross_building -from conan.tools.microsoft import msvc_runtime_flag -from conans import tools, RunEnvironment, CMake -from conans.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.build import cross_building, check_min_cppstd, build_jobs, default_cppstd +from conan.tools.env import VirtualBuildEnv, Environment +from conan.tools.files import copy, get, replace_in_file, apply_conandata_patches, save, rm, rmdir, export_conandata_patches +from conan.tools.gnu import PkgConfigDeps +from conan.tools.microsoft import msvc_runtime_flag, is_msvc +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +from conans import RunEnvironment, tools from conans.model import Generator -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.55.0" class qt(Generator): @@ -55,15 +60,15 @@ class QtConan(ConanFile): "qt3d", "qtimageformats", "qtnetworkauth", "qtcoap", "qtmqtt", "qtopcua", "qtmultimedia", "qtlocation", "qtsensors", "qtconnectivity", "qtserialbus", "qtserialport", "qtwebsockets", "qtwebchannel", "qtwebengine", "qtwebview", - "qtremoteobjects", "qtpositioning", "qtlanguageserver"] + "qtremoteobjects", "qtpositioning", "qtlanguageserver", + "qtspeech", "qthttpserver", "qtquick3dphysics"] - generators = "pkg_config", "cmake_find_package", "cmake" name = "qt" description = "Qt is a cross-platform framework for graphical user interfaces." - topics = ("qt", "ui") + topics = ("framework", "ui") url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.qt.io" - license = "LGPL-3.0" + license = "LGPL-3.0-only" settings = "os", "arch", "compiler", "build_type" options = { @@ -93,6 +98,7 @@ class QtConan(ConanFile): "with_pulseaudio": [True, False], "with_gssapi": [True, False], "with_md4c": [True, False], + "with_x11": [True, False], "gui": [True, False], "widgets": [True, False], @@ -135,6 +141,7 @@ class QtConan(ConanFile): "with_pulseaudio": False, "with_gssapi": False, "with_md4c": True, + "with_x11": True, "gui": True, "widgets": True, @@ -151,10 +158,6 @@ class QtConan(ConanFile): _submodules_tree = None - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _get_module_tree(self): if self._submodules_tree: @@ -162,7 +165,7 @@ def _get_module_tree(self): config = configparser.ConfigParser() config.read(os.path.join(self.recipe_folder, "qtmodules%s.conf" % self.version)) self._submodules_tree = {} - assert config.sections() + assert config.sections(), f"no qtmodules.conf file for version {self.version}" for s in config.sections(): section = str(s) assert section.startswith("submodule ") @@ -181,11 +184,10 @@ def _get_module_tree(self): return self._submodules_tree def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def export(self): - self.copy("qtmodules%s.conf" % self.version) + copy(self, f"qtmodules{self.version}.conf", self.recipe_folder, self.export_folder) def config_options(self): if self.settings.os not in ["Linux", "FreeBSD"]: @@ -193,6 +195,7 @@ def config_options(self): del self.options.with_fontconfig self.options.with_glib = False del self.options.with_libalsa + del self.options.with_x11 if self.settings.os == "Windows": self.options.opengl = "dynamic" @@ -224,6 +227,7 @@ def configure(self): del self.options.with_libjpeg del self.options.with_libpng del self.options.with_md4c + del self.options.with_x11 if not self.options.get_safe("qtmultimedia"): del self.options.with_libalsa @@ -249,17 +253,29 @@ def _enablemodule(mod): _enablemodule(module) def validate(self): + if os.getenv('NOT_ON_C3I', '0') == '0': + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) >= "11" or \ + self.info.settings.compiler == "clang" and Version(self.info.settings.compiler.version) >= "12": + raise ConanInvalidConfiguration("qt is not supported on gcc11 and clang >= 12 on C3I until conan-io/conan-center-index#13472 is fixed\n"\ + "If your distro is modern enough (xcb >= 1.12), set environment variable NOT_ON_C3I=1") + # C++ minimum standard required if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + check_min_cppstd(self, 17) minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) if not minimum_version: self.output.warn("C++17 support required. Your compiler is unknown. Assuming it supports C++17.") - elif tools.Version(self.settings.compiler.version) < minimum_version: + elif Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration("C++17 support required, which your compiler does not support.") - if tools.Version(self.version) >= "6.3.0" and self.settings.compiler == "clang" and "libstdc++" in str(self.settings.compiler.libcxx): - raise ConanInvalidConfiguration("Qt needs recent libstdc++, with charconv. please switch to gcc, of to libc++") + if Version(self.version) >= "6.4.0" and self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "12": + raise ConanInvalidConfiguration("apple-clang >= 12 required by qt >= 6.4.0") + + if Version(self.version) >= "6.3.0" and self.settings.compiler == "clang" and "libstdc++" in str(self.settings.compiler.libcxx): + raise ConanInvalidConfiguration("Qt needs recent libstdc++, with charconv. please switch to gcc, or to libc++") + + if Version(self.version) < "6.3.0" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) >= "11": + raise ConanInvalidConfiguration("Qt lower then 6.3.0 needs to be compiled for gcc with a version lower then 11") if self.options.get_safe("qtwebengine"): if not self.options.shared: @@ -267,11 +283,13 @@ def validate(self): if not (self.options.gui and self.options.qtdeclarative and self.options.qtwebchannel): raise ConanInvalidConfiguration("option qt:qtwebengine requires also qt:gui, qt:qtdeclarative and qt:qtwebchannel") + if not self.options.with_dbus and self.settings.os == "Linux": + raise ConanInvalidConfiguration("option qt:webengine requires also qt:with_dbus on Linux") if hasattr(self, "settings_build") and cross_building(self, skip_x64_x86=True): raise ConanInvalidConfiguration("Cross compiling Qt WebEngine is not supported") - if tools.Version(self.version) < "6.3.0": + if Version(self.version) < "6.3.0": # Check if a valid python2 is available in PATH or it will failflex # Start by checking if python2 can be found python_exe = tools.which("python2") @@ -292,7 +310,7 @@ def validate(self): verstr = mybuf.getvalue().strip().split("Python ")[1] if verstr.endswith("+"): verstr = verstr[:-1] - version = tools.Version(verstr) + version = Version(verstr) # >= 2.7.5 & < 3 v_min = "2.7.5" v_max = "3.0.0" @@ -330,136 +348,318 @@ def validate(self): if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi: raise ConanInvalidConfiguration("gssapi cannot be enabled until conan-io/conan-center-index#4102 is closed") + if self.options.get_safe("with_x11", False) and not self.dependencies.direct_host["xkbcommon"].options.with_x11: + raise ConanInvalidConfiguration("The 'with_x11' option for the 'xkbcommon' package must be enabled when the 'with_x11' option is enabled") + if self.options.get_safe("qtwayland", False) and not self.dependencies.direct_host["xkbcommon"].options.with_wayland: + raise ConanInvalidConfiguration("The 'with_wayland' option for the 'xkbcommon' package must be enabled when the 'qtwayland' option is enabled") + + if cross_building(self): + raise ConanInvalidConfiguration("cross compiling qt 6 is not yet supported. Contributions are welcome") + + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.with_pcre2: - self.requires("pcre2/10.37") # needs to be < 10.38 or qt fails to detect visual studio static library + self.requires("pcre2/10.40") if self.options.get_safe("with_vulkan"): - self.requires("vulkan-loader/1.3.221.0") - if tools.is_apple_os(self.settings.os): - self.requires("moltenvk/1.1.10") + self.requires("vulkan-loader/1.3.231.0") + if is_apple_os(self): + self.requires("moltenvk/1.2.0") if self.options.with_glib: - self.requires("glib/2.73.2") + self.requires("glib/2.75.1") if self.options.with_doubleconversion and not self.options.multiconfiguration: - self.requires("double-conversion/3.2.0") + self.requires("double-conversion/3.2.1") if self.options.get_safe("with_freetype", False) and not self.options.multiconfiguration: self.requires("freetype/2.12.1") if self.options.get_safe("with_fontconfig", False): self.requires("fontconfig/2.13.93") if self.options.get_safe("with_icu", False): - self.requires("icu/71.1") + self.requires("icu/72.1") if self.options.get_safe("with_harfbuzz", False) and not self.options.multiconfiguration: - self.requires("harfbuzz/4.4.1") + self.requires("harfbuzz/5.3.1") if self.options.get_safe("with_libjpeg", False) and not self.options.multiconfiguration: if self.options.with_libjpeg == "libjpeg-turbo": - self.requires("libjpeg-turbo/2.1.3") + self.requires("libjpeg-turbo/2.1.4") else: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") if self.options.get_safe("with_libpng", False) and not self.options.multiconfiguration: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_sqlite3 and not self.options.multiconfiguration: - self.requires("sqlite3/3.39.2") + self.requires("sqlite3/3.40.0") self.options["sqlite3"].enable_column_metadata = True if self.options.get_safe("with_mysql", False): - self.requires("libmysqlclient/8.0.29") + self.requires("libmysqlclient/8.0.30") if self.options.with_pq: - self.requires("libpq/14.2") + self.requires("libpq/14.5") if self.options.with_odbc: if self.settings.os != "Windows": - self.requires("odbc/2.3.9") + self.requires("odbc/2.3.11") if self.options.get_safe("with_openal", False): - self.requires("openal/1.22.1") + self.requires("openal/1.22.2") if self.options.get_safe("with_libalsa", False): self.requires("libalsa/1.2.7.2") - if self.options.gui and self.settings.os in ["Linux", "FreeBSD"]: - self.requires("xorg/system") + if self.options.get_safe("with_x11", False): self.requires("xkbcommon/1.4.1") + self.requires("xorg/system") if self.settings.os != "Windows" and self.options.get_safe("opengl", "no") != "no": self.requires("opengl/system") if self.options.with_zstd: self.requires("zstd/1.5.2") if self.options.qtwayland: + self.requires("xkbcommon/1.4.1") self.requires("wayland/1.21.0") if self.options.with_brotli: self.requires("brotli/1.0.9") if self.options.get_safe("qtwebengine") and self.settings.os == "Linux": - self.requires("expat/2.4.8") + self.requires("expat/2.5.0") self.requires("opus/1.3.1") - self.requires("xorg-proto/2021.4") + self.requires("xorg-proto/2022.2") self.requires("libxshmfence/1.3") - self.requires("nss/3.77") - self.requires("libdrm/2.4.109") + self.requires("nss/3.85") + self.requires("libdrm/2.4.114") if self.options.get_safe("with_gstreamer", False): self.requires("gst-plugins-base/1.19.2") if self.options.get_safe("with_pulseaudio", False): self.requires("pulseaudio/14.2") if self.options.with_dbus: - self.requires("dbus/1.12.20") + self.requires("dbus/1.15.2") if self.settings.os in ['Linux', 'FreeBSD'] and self.options.with_gssapi: self.requires("krb5/1.18.3") # conan-io/conan-center-index#4102 if self.options.get_safe("with_md4c", False): self.requires("md4c/0.4.8") def build_requirements(self): - self.build_requires("cmake/3.23.2") - self.build_requires("ninja/1.11.0") - self.build_requires("pkgconf/1.7.4") + self.tool_requires("cmake/3.25.2") + self.tool_requires("ninja/1.11.1") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") if self.settings.os == "Windows": - self.build_requires('strawberryperl/5.30.0.1') + self.tool_requires('strawberryperl/5.32.1.1') if self.options.get_safe("qtwebengine"): - self.build_requires("nodejs/16.3.0") - self.build_requires("gperf/3.1") + self.tool_requires("nodejs/16.3.0") + self.tool_requires("gperf/3.1") # gperf, bison, flex, python >= 2.7.5 & < 3 if self.settings.os != "Windows": - self.build_requires("bison/3.7.6") - self.build_requires("flex/2.6.4") + self.tool_requires("bison/3.8.2") + self.tool_requires("flex/2.6.4") else: - self.build_requires("winflexbison/2.5.24") + self.tool_requires("winflexbison/2.5.24") if self.options.qtwayland: - self.build_requires("wayland/1.21.0") + self.tool_requires("wayland/1.21.0") + if cross_building(self): + self.tool_requires(f"qt/{self.version}") + + def generate(self): + ms = VirtualBuildEnv(self) + ms.generate() + + tc = CMakeDeps(self) + tc.set_property("libdrm", "cmake_file_name", "Libdrm") + tc.set_property("libdrm::libdrm_libdrm", "cmake_target_name", "Libdrm::Libdrm") + tc.set_property("wayland", "cmake_file_name", "Wayland") + tc.set_property("wayland::wayland-client", "cmake_target_name", "Wayland::Client") + tc.set_property("wayland::wayland-server", "cmake_target_name", "Wayland::Server") + tc.set_property("wayland::wayland-cursor", "cmake_target_name", "Wayland::Cursor") + tc.set_property("wayland::wayland-egl", "cmake_target_name", "Wayland::Egl") + tc.generate() + + for f in glob.glob("*.cmake"): + replace_in_file(self, f, + " IMPORTED)\n", + " IMPORTED GLOBAL)\n", strict=False) + + pc = PkgConfigDeps(self) + pc.generate() + + # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) + env = Environment() + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + env.vars(self).save_script("conanbuildenv_pkg_config_path") + + tc = CMakeToolchain(self, generator="Ninja") + + package_folder = self.package_folder.replace('\\', '/') + tc.variables["INSTALL_MKSPECSDIR"] = f"{package_folder}/res/archdatadir/mkspecs" + tc.variables["INSTALL_ARCHDATADIR"] = f"{package_folder}/res/archdatadir" + tc.variables["INSTALL_LIBEXECDIR"] = f"{package_folder}/bin" + tc.variables["INSTALL_DATADIR"] = f"{package_folder}/res/datadir" + tc.variables["INSTALL_SYSCONFDIR"] = f"{package_folder}/res/sysconfdir" + + tc.variables["QT_BUILD_TESTS"] = "OFF" + tc.variables["QT_BUILD_EXAMPLES"] = "OFF" + + if is_msvc(self) and "MT" in msvc_runtime_flag(self): + tc.variables["FEATURE_static_runtime"] = "ON" + + if self.options.multiconfiguration: + tc.variables["CMAKE_CONFIGURATION_TYPES"] = "Release;Debug" + tc.variables["FEATURE_optimize_size"] = ("ON" if self.settings.build_type == "MinSizeRel" else "OFF") + + for module in self._get_module_tree: + if module != 'qtbase': + tc.variables["BUILD_%s" % module] = ("ON" if self.options.get_safe(module) else "OFF") + + tc.variables["FEATURE_system_zlib"] = "ON" + + tc.variables["INPUT_opengl"] = self.options.get_safe("opengl", "no") + + # openSSL + if not self.options.openssl: + tc.variables["INPUT_openssl"] = "no" + else: + tc.variables["HAVE_openssl"] = "ON" + if self.options["openssl"].shared: + tc.variables["INPUT_openssl"] = "runtime" + else: + tc.variables["INPUT_openssl"] = "linked" + + if self.options.with_dbus: + tc.variables["INPUT_dbus"] = "linked" + else: + tc.variables["FEATURE_dbus"] = "OFF" + tc.variables["CMAKE_FIND_DEBUG_MODE"] = "FALSE" + + + for opt, conf_arg in [("with_glib", "glib"), + ("with_icu", "icu"), + ("with_fontconfig", "fontconfig"), + ("with_mysql", "sql_mysql"), + ("with_pq", "sql_psql"), + ("with_odbc", "sql_odbc"), + ("gui", "gui"), + ("widgets", "widgets"), + ("with_zstd", "zstd"), + ("with_vulkan", "vulkan"), + ("with_brotli", "brotli"), + ("with_gssapi", "gssapi")]: + tc.variables["FEATURE_%s" % conf_arg] = ("ON" if self.options.get_safe(opt, False) else "OFF") + + + for opt, conf_arg in [ + ("with_doubleconversion", "doubleconversion"), + ("with_freetype", "freetype"), + ("with_harfbuzz", "harfbuzz"), + ("with_libjpeg", "jpeg"), + ("with_libpng", "png"), + ("with_sqlite3", "sqlite"), + ("with_pcre2", "pcre2"),]: + if self.options.get_safe(opt, False): + if self.options.multiconfiguration: + tc.variables["FEATURE_%s" % conf_arg] = "ON" + else: + tc.variables["FEATURE_system_%s" % conf_arg] = "ON" + else: + tc.variables["FEATURE_%s" % conf_arg] = "OFF" + tc.variables["FEATURE_system_%s" % conf_arg] = "OFF" + + for opt, conf_arg in [ + ("with_doubleconversion", "doubleconversion"), + ("with_freetype", "freetype"), + ("with_harfbuzz", "harfbuzz"), + ("with_libjpeg", "libjpeg"), + ("with_libpng", "libpng"), + ("with_md4c", "libmd4c"), + ("with_pcre2", "pcre"),]: + if self.options.get_safe(opt, False): + if self.options.multiconfiguration: + tc.variables["INPUT_%s" % conf_arg] = "qt" + else: + tc.variables["INPUT_%s" % conf_arg] = "system" + else: + tc.variables["INPUT_%s" % conf_arg] = "no" + + for feature in str(self.options.disabled_features).split(): + tc.variables["FEATURE_%s" % feature] = "OFF" + + if self.settings.os == "Macos": + tc.variables["FEATURE_framework"] = "OFF" + elif self.settings.os == "Android": + tc.variables["CMAKE_ANDROID_NATIVE_API_LEVEL"] = self.settings.os.api_level + tc.variables["ANDROID_ABI"] = {"armv7": "armeabi-v7a", + "armv8": "arm64-v8a", + "x86": "x86", + "x86_64": "x86_64"}.get(str(self.settings.arch)) + + if self.options.sysroot: + tc.variables["CMAKE_SYSROOT"] = self.options.sysroot + + if self.options.device: + tc.variables["QT_QMAKE_TARGET_MKSPEC"] = f"devices/{self.options.device}" + else: + xplatform_val = self._xplatform() + if xplatform_val: + tc.variables["QT_QMAKE_TARGET_MKSPEC"] = xplatform_val + else: + self.output.warn("host not supported: %s %s %s %s" % + (self.settings.os, self.settings.compiler, + self.settings.compiler.version, self.settings.arch)) + if self.options.cross_compile: + tc.variables["QT_QMAKE_DEVICE_OPTIONS"] = "CROSS_COMPILE=%s" % self.options.cross_compile + + tc.variables["FEATURE_pkg_config"] = "ON" + if self.settings.compiler == "gcc" and self.settings.build_type == "Debug" and not self.options.shared: + tc.variables["BUILD_WITH_PCH"]= "OFF" # disabling PCH to save disk space + + if self.settings.os == "Windows": + tc.variables["HOST_PERL"] = getattr(self, "user_info_build", self.deps_user_info)["strawberryperl"].perl + #"set(QT_EXTRA_INCLUDEPATHS ${CONAN_INCLUDE_DIRS})\n" + #"set(QT_EXTRA_DEFINES ${CONAN_DEFINES})\n" + #"set(QT_EXTRA_LIBDIRS ${CONAN_LIB_DIRS})\n" + + current_cpp_std = self.settings.get_safe("compiler.cppstd", default_cppstd(self)) + current_cpp_std = str(current_cpp_std).replace("gnu", "") + cpp_std_map = { + "20": "FEATURE_cxx20" + } + if Version(self.version) >= "6.5.0": + cpp_std_map["23"] = "FEATURE_cxx2b" + + tc.variables[cpp_std_map.get(current_cpp_std, "FEATURE_cxx17")] = "ON" + + tc.generate() def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination="qt6") + destination = self.source_folder + if self.settings.os == "Windows": + # Don't use os.path.join, or it removes the \\?\ prefix, which enables long paths + destination = f"\\\\?\\{self.source_folder}" + get(self, **self.conan_data["sources"][self.version], + strip_root=True, destination=destination) # patching in source method because of no_copy_source attribute - tools.replace_in_file(os.path.join("qt6", "CMakeLists.txt"), - "enable_testing()", - "include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)\nconan_basic_setup(KEEP_RPATHS)\n" - "set(QT_EXTRA_INCLUDEPATHS ${CONAN_INCLUDE_DIRS})\n" - "set(QT_EXTRA_DEFINES ${CONAN_DEFINES})\n" - "set(QT_EXTRA_LIBDIRS ${CONAN_LIB_DIRS})\n" - "enable_testing()") - - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) >= "6.2.0": + apply_conandata_patches(self) + if Version(self.version) >= "6.2.0": for f in ["renderer", os.path.join("renderer", "core"), os.path.join("renderer", "platform")]: - tools.replace_in_file(os.path.join(self.source_folder, "qt6", "qtwebengine", "src", "3rdparty", "chromium", "third_party", "blink", f, "BUILD.gn"), + replace_in_file(self, os.path.join(self.source_folder, "qtwebengine", "src", "3rdparty", "chromium", "third_party", "blink", f, "BUILD.gn"), " if (enable_precompiled_headers) {\n if (is_win) {", " if (enable_precompiled_headers) {\n if (false) {" ) - tools.replace_in_file(os.path.join("qt6", "qtbase", "cmake", "QtInternalTargets.cmake"), + replace_in_file(self, os.path.join(self.source_folder, "qtbase", "cmake", "QtInternalTargets.cmake"), "-Zc:wchar_t", "-Zc:wchar_t -Zc:twoPhase-") for f in ["FindPostgreSQL.cmake"]: - file = os.path.join("qt6", "qtbase", "cmake", f) + file = os.path.join(self.source_folder, "qtbase", "cmake", f) if os.path.isfile(file): os.remove(file) # workaround QTBUG-94356 - if tools.Version(self.version) >= "6.1.1": - zlib_file_name = "FindWrapSystemZLIB.cmake" if tools.Version(self.version) >= "6.3.1" else "FindWrapZLIB.cmake" - tools.replace_in_file(os.path.join("qt6", "qtbase", "cmake", zlib_file_name), '"-lz"', 'ZLIB::ZLIB') - tools.replace_in_file(os.path.join("qt6", "qtbase", "configure.cmake"), + if Version(self.version) >= "6.1.1": + zlib_file_name = "FindWrapSystemZLIB.cmake" if Version(self.version) >= "6.3.1" else "FindWrapZLIB.cmake" + replace_in_file(self, os.path.join(self.source_folder, "qtbase", "cmake", zlib_file_name), '"-lz"', 'ZLIB::ZLIB') + replace_in_file(self, os.path.join(self.source_folder, "qtbase", "configure.cmake"), "set_property(TARGET ZLIB::ZLIB PROPERTY IMPORTED_GLOBAL TRUE)", "") + if Version(self.version) <= "6.4.0": + # use official variable name https://cmake.org/cmake/help/latest/module/FindFontconfig.html + replace_in_file(self, os.path.join(self.source_folder, "qtbase", "src", "gui", "configure.cmake"), "FONTCONFIG_FOUND", "Fontconfig_FOUND") def _xplatform(self): if self.settings.os == "Linux": @@ -505,7 +705,7 @@ def _xplatform(self): }.get(str(self.settings.compiler)) elif self.settings.os == "WindowsStore": - if self._is_msvc: + if is_msvc(self): if self.settings.compiler == "Visual Studio": msvc_version = str(self.settings.compiler.version) else: @@ -561,193 +761,35 @@ def _xplatform(self): @contextmanager def _build_context(self): - with tools.vcvars(self) if self._is_msvc else tools.no_op(): + with tools.vcvars(self) if is_msvc(self) else tools.no_op(): # next lines force cmake package to be in PATH before the one provided by visual studio (vcvars) - build_env = tools.RunEnvironment(self).vars if self._is_msvc else {} - build_env["MAKEFLAGS"] = "j%d" % tools.cpu_count() + build_env = tools.RunEnvironment(self).vars if is_msvc(self) else {} + build_env["MAKEFLAGS"] = "j%d" % build_jobs(self) build_env["PKG_CONFIG_PATH"] = [self.build_folder] if self.settings.os == "Windows": if "PATH" not in build_env: build_env["PATH"] = [] - build_env["PATH"].append(os.path.join(self.source_folder, "qt6", "gnuwin32", "bin")) - if self._is_msvc: + build_env["PATH"].append(os.path.join(self.source_folder, "gnuwin32", "bin")) + if is_msvc(self): # this avoids cmake using gcc from strawberryperl build_env["CC"] = "cl" build_env["CXX"] = "cl" with tools.environment_append(build_env): - if tools.os_info.is_macos: - tools.save(".qmake.stash" , "") - tools.save(".qmake.super" , "") + if self.settings.os == "Macos": + save(self, ".qmake.stash" , "") + save(self, ".qmake.super" , "") yield - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self, generator="Ninja") - - cmake.definitions["INSTALL_MKSPECSDIR"] = os.path.join(self.package_folder, "res", "archdatadir", "mkspecs") - cmake.definitions["INSTALL_ARCHDATADIR"] = os.path.join(self.package_folder, "res", "archdatadir") - cmake.definitions["INSTALL_LIBEXECDIR"] = os.path.join(self.package_folder, "bin") - cmake.definitions["INSTALL_DATADIR"] = os.path.join(self.package_folder, "res", "datadir") - cmake.definitions["INSTALL_SYSCONFDIR"] = os.path.join(self.package_folder, "res", "sysconfdir") - - cmake.definitions["QT_BUILD_TESTS"] = "OFF" - cmake.definitions["QT_BUILD_EXAMPLES"] = "OFF" - - if self._is_msvc and "MT" in msvc_runtime_flag(self): - cmake.definitions["FEATURE_static_runtime"] = "ON" - - if self.options.multiconfiguration: - cmake.generator = "Ninja Multi-Config" - cmake.definitions["CMAKE_CONFIGURATION_TYPES"] = "Release;Debug" - cmake.definitions["FEATURE_optimize_size"] = ("ON" if self.settings.build_type == "MinSizeRel" else "OFF") - - for module in self._get_module_tree: - if module != 'qtbase': - cmake.definitions["BUILD_%s" % module] = ("ON" if self.options.get_safe(module) else "OFF") - - cmake.definitions["FEATURE_system_zlib"] = "ON" - - cmake.definitions["INPUT_opengl"] = self.options.get_safe("opengl", "no") - - # openSSL - if not self.options.openssl: - cmake.definitions["INPUT_openssl"] = "no" - else: - if self.options["openssl"].shared: - cmake.definitions["INPUT_openssl"] = "runtime" - else: - cmake.definitions["INPUT_openssl"] = "linked" - - if self.options.with_dbus: - cmake.definitions["INPUT_dbus"] = "linked" - else: - cmake.definitions["FEATURE_dbus"] = "OFF" - - - for opt, conf_arg in [("with_glib", "glib"), - ("with_icu", "icu"), - ("with_fontconfig", "fontconfig"), - ("with_mysql", "sql_mysql"), - ("with_pq", "sql_psql"), - ("with_odbc", "sql_odbc"), - ("gui", "gui"), - ("widgets", "widgets"), - ("with_zstd", "zstd"), - ("with_vulkan", "vulkan"), - ("with_brotli", "brotli"), - ("with_gssapi", "gssapi")]: - cmake.definitions["FEATURE_%s" % conf_arg] = ("ON" if self.options.get_safe(opt, False) else "OFF") - - - for opt, conf_arg in [ - ("with_doubleconversion", "doubleconversion"), - ("with_freetype", "freetype"), - ("with_harfbuzz", "harfbuzz"), - ("with_libjpeg", "jpeg"), - ("with_libpng", "png"), - ("with_sqlite3", "sqlite"), - ("with_pcre2", "pcre2"),]: - if self.options.get_safe(opt, False): - if self.options.multiconfiguration: - cmake.definitions["FEATURE_%s" % conf_arg] = "ON" - else: - cmake.definitions["FEATURE_system_%s" % conf_arg] = "ON" - else: - cmake.definitions["FEATURE_%s" % conf_arg] = "OFF" - cmake.definitions["FEATURE_system_%s" % conf_arg] = "OFF" - - for opt, conf_arg in [ - ("with_doubleconversion", "doubleconversion"), - ("with_freetype", "freetype"), - ("with_harfbuzz", "harfbuzz"), - ("with_libjpeg", "libjpeg"), - ("with_libpng", "libpng"), - ("with_md4c", "libmd4c"), - ("with_pcre2", "pcre"),]: - if self.options.get_safe(opt, False): - if self.options.multiconfiguration: - cmake.definitions["INPUT_%s" % conf_arg] = "qt" - else: - cmake.definitions["INPUT_%s" % conf_arg] = "system" - else: - cmake.definitions["INPUT_%s" % conf_arg] = "no" - - for feature in str(self.options.disabled_features).split(): - cmake.definitions["FEATURE_%s" % feature] = "OFF" - - if self.settings.os == "Macos": - cmake.definitions["FEATURE_framework"] = "OFF" - elif self.settings.os == "Android": - cmake.definitions["CMAKE_ANDROID_NATIVE_API_LEVEL"] = self.settings.os.api_level - cmake.definitions["ANDROID_ABI"] = {"armv7": "armeabi-v7a", - "armv8": "arm64-v8a", - "x86": "x86", - "x86_64": "x86_64"}.get(str(self.settings.arch)) - - if self.options.sysroot: - cmake.definitions["CMAKE_SYSROOT"] = self.options.sysroot - - if self.options.device: - cmake.definitions["QT_QMAKE_TARGET_MKSPEC"] = os.path.join("devices", self.options.device) - else: - xplatform_val = self._xplatform() - if xplatform_val: - cmake.definitions["QT_QMAKE_TARGET_MKSPEC"] = xplatform_val - else: - self.output.warn("host not supported: %s %s %s %s" % - (self.settings.os, self.settings.compiler, - self.settings.compiler.version, self.settings.arch)) - if self.options.cross_compile: - cmake.definitions["QT_QMAKE_DEVICE_OPTIONS"] = "CROSS_COMPILE=%s" % self.options.cross_compile - - cmake.definitions["FEATURE_pkg_config"] = "ON" - if self.settings.compiler == "gcc" and self.settings.build_type == "Debug" and not self.options.shared: - cmake.definitions["BUILD_WITH_PCH"]= "OFF" # disabling PCH to save disk space - - if self.settings.os == "Windows": - cmake.definitions["HOST_PERL"] = getattr(self, "user_info_build", self.deps_user_info)["strawberryperl"].perl - - try: - cmake.configure(source_folder="qt6") - except: - cmake_err_log = os.path.join(self.build_folder, "CMakeFiles", "CMakeError.log") - cmake_out_log = os.path.join(self.build_folder, "CMakeFiles", "CMakeOutput.log") - if os.path.isfile(cmake_err_log): - self.output.info(tools.load(cmake_err_log)) - if os.path.isfile(cmake_out_log): - self.output.info(tools.load(cmake_out_log)) - raise - return cmake - def build(self): - for f in glob.glob("*.cmake"): - tools.replace_in_file(f, - "$<$,SHARED_LIBRARY>:>", - "", strict=False) - tools.replace_in_file(f, - "$<$,MODULE_LIBRARY>:>", - "", strict=False) - tools.replace_in_file(f, - "$<$,EXECUTABLE>:>", - "", strict=False) - tools.replace_in_file(f, - "$<$,SHARED_LIBRARY>:-Wl,--export-dynamic>", - "", strict=False) - tools.replace_in_file(f, - "$<$,MODULE_LIBRARY>:-Wl,--export-dynamic>", - "", strict=False) - tools.replace_in_file(f, - " IMPORTED)\n", - " IMPORTED GLOBAL)\n", strict=False) - with self._build_context(): - cmake = self._configure_cmake() - if tools.os_info.is_macos: - tools.save("bash_env", 'export DYLD_LIBRARY_PATH="%s"' % ":".join(RunEnvironment(self).vars["DYLD_LIBRARY_PATH"])) + cmake = CMake(self) + cmake.configure() + if self.settings.os == "Macos": + save(self, "bash_env", 'export DYLD_LIBRARY_PATH="%s"' % ":".join(RunEnvironment(self).vars["DYLD_LIBRARY_PATH"])) with tools.environment_append({ "BASH_ENV": os.path.abspath("bash_env") - }) if tools.os_info.is_macos else tools.no_op(): + }) if self.settings.os == "Macos" else tools.no_op(): with tools.run_environment(self): with tools.remove_from_path("perl") if self.settings.os == "Windows" else tools.no_op(): cmake.build() @@ -765,32 +807,32 @@ def _cmake_qt6_private_file(self, module): def package(self): with self._build_context(): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.save(os.path.join(self.package_folder, "bin", "qt.conf"), qt.content_template("..", "res", self.settings.os)) - self.copy("*LICENSE*", src="qt6/", dst="licenses") + save(self, os.path.join(self.package_folder, "bin", "qt.conf"), qt.content_template("..", "res", self.settings.os)) + copy(self, "*LICENSE*", self.source_folder, os.path.join(self.package_folder, "licenses")) for module in self._get_module_tree: if module != "qtbase" and not self.options.get_safe(module): - tools.rmdir(os.path.join(self.package_folder, "licenses", module)) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "licenses", module)) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) for mask in ["Find*.cmake", "*Config.cmake", "*-config.cmake"]: - tools.remove_files_by_mask(self.package_folder, mask) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la*") - tools.remove_files_by_mask(self.package_folder, "*.pdb*") - tools.remove_files_by_mask(self.package_folder, "ensure_pro_file.cmake") + rm(self, mask, self.package_folder, recursive=True) + rm(self, "*.la*", os.path.join(self.package_folder, "lib"), recursive=True) + rm(self, "*.pdb*", self.package_folder, recursive=True) + rm(self, "ensure_pro_file.cmake", self.package_folder, recursive=True) os.remove(os.path.join(self.package_folder, "bin", "qt-cmake-private-install.cmake")) for m in os.listdir(os.path.join(self.package_folder, "lib", "cmake")): module = os.path.join(self.package_folder, "lib", "cmake", m, "%sMacros.cmake" % m) helper_modules = glob.glob(os.path.join(self.package_folder, "lib", "cmake", m, "QtPublic*Helpers.cmake")) if not os.path.isfile(module) and not helper_modules: - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake", m)) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake", m)) extension = "" if self.settings.os == "Windows": extension = ".exe" filecontents = "set(QT_CMAKE_EXPORT_NAMESPACE Qt6)\n" - ver = tools.Version(self.version) + ver = Version(self.version) filecontents += "set(QT_VERSION_MAJOR %s)\n" % ver.major filecontents += "set(QT_VERSION_MINOR %s)\n" % ver.minor filecontents += "set(QT_VERSION_PATCH %s)\n" % ver.patch @@ -835,7 +877,7 @@ def package(self): endif() """ % ver.major) filecontents += 'set(CMAKE_AUTOMOC_MACRO_NAMES "Q_OBJECT" "Q_GADGET" "Q_GADGET_EXPORT" "Q_NAMESPACE" "Q_NAMESPACE_EXPORT")\n' - tools.save(os.path.join(self.package_folder, self._cmake_executables_file), filecontents) + save(self, os.path.join(self.package_folder, self._cmake_executables_file), filecontents) def _create_private_module(module, dependencies=[]): dependencies_string = ';'.join('Qt6::%s' % dependency for dependency in dependencies) @@ -855,7 +897,7 @@ def _create_private_module(module, dependencies=[]): ) endif()""".format(module, self.version, dependencies_string)) - tools.save(os.path.join(self.package_folder, self._cmake_qt6_private_file(module)), contents) + save(self, os.path.join(self.package_folder, self._cmake_qt6_private_file(module)), contents) _create_private_module("Core", ["Core"]) @@ -881,12 +923,12 @@ def _create_private_module(module, dependencies=[]): TARGET ${QT_CMAKE_EXPORT_NAMESPACE}::Core APPEND PROPERTY INTERFACE_LINK_LIBRARIES "$<${entrypoint_conditions}:${QT_CMAKE_EXPORT_NAMESPACE}::EntryPointPrivate>" )""") - tools.save(os.path.join(self.package_folder, self._cmake_entry_point_file), contents) + save(self, os.path.join(self.package_folder, self._cmake_entry_point_file), contents) def package_id(self): del self.info.options.cross_compile del self.info.options.sysroot - if self.options.multiconfiguration and self._is_msvc: + if self.options.multiconfiguration and is_msvc(self): if self.settings.compiler == "Visual Studio": if "MD" in self.settings.compiler.runtime: self.info.settings.compiler.runtime = "MD/MDd" @@ -895,6 +937,11 @@ def package_id(self): else: self.info.settings.compiler.runtime_type = "Release/Debug" + @property + def _has_positioning(self): + return (self.options.get_safe("qtlocation") and Version(self.version) < "6.2.2") or \ + (self.options.get_safe("qtpositioning") and Version(self.version) >= "6.2.2") + def package_info(self): self.cpp_info.set_property("cmake_file_name", "Qt6") @@ -905,19 +952,32 @@ def package_info(self): self.runenv_info.define("QT_PLUGIN_PATH", os.path.join(self.package_folder, "res", "archdatadir", "plugins")) self.buildenv_info.define("QT_PLUGIN_PATH", os.path.join(self.package_folder, "res", "archdatadir", "plugins")) - build_modules = [] + self.buildenv_info.define("QT_HOST_PATH", self.package_folder) + + build_modules = {} + def _add_build_module(component, module): + if component not in build_modules: + build_modules[component] = [] + build_modules[component].append(module) + self.cpp_info.components[component].build_modules["cmake_find_package"].append(module) + self.cpp_info.components[component].build_modules["cmake_find_package_multi"].append(module) libsuffix = "" if self.settings.build_type == "Debug": - if self.settings.os == "Windows": + if is_msvc(self): libsuffix = "d" - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): libsuffix = "_debug" def _get_corrected_reqs(requires): reqs = [] for r in requires: - reqs.append(r if "::" in r else "qt%s" % r) + if "::" in r: + corrected_req = r + else: + corrected_req = f"qt{r}" + assert corrected_req in self.cpp_info.components, f"{corrected_req} required but not yet present in self.cpp_info.components" + reqs.append(corrected_req) return reqs def _create_module(module, requires=[], has_include_dir=True): @@ -966,22 +1026,24 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("Core", core_reqs) if self.settings.os == "Windows": - if tools.Version(self.version) >= "6.3.0": + if Version(self.version) >= "6.3.0": self.cpp_info.components["qtCore"].system_libs.append("authz") - if self._is_msvc: - if tools.Version(self.version) >= "6.3.0": + if is_msvc(self): + if Version(self.version) >= "6.3.0": self.cpp_info.components["qtCore"].cxxflags.append("-permissive-") - if tools.Version(self.version) >= "6.2.0": + if Version(self.version) >= "6.2.0": self.cpp_info.components["qtCore"].cxxflags.append("-Zc:__cplusplus") self.cpp_info.components["qtCore"].system_libs.append("synchronization") - if tools.Version(self.version) >= "6.2.1": + if Version(self.version) >= "6.2.1": self.cpp_info.components["qtCore"].system_libs.append("runtimeobject") self.cpp_info.components["qtPlatform"].set_property("cmake_target_name", "Qt6::Platform") self.cpp_info.components["qtPlatform"].names["cmake_find_package"] = "Platform" self.cpp_info.components["qtPlatform"].names["cmake_find_package_multi"] = "Platform" self.cpp_info.components["qtPlatform"].includedirs = [os.path.join("res", "archdatadir", "mkspecs", self._xplatform())] - if tools.Version(self.version) < "6.1.0": + if Version(self.version) < "6.1.0": self.cpp_info.components["qtCore"].libs.append("Qt6Core_qobject%s" % libsuffix) + if self.options.with_dbus: + _create_module("DBus", ["dbus::dbus"]) if self.options.gui: gui_reqs = [] if self.options.with_dbus: @@ -993,12 +1055,15 @@ def _create_plugin(pluginname, libname, type, requires): if self.options.get_safe("with_fontconfig", False): gui_reqs.append("fontconfig::fontconfig") if self.settings.os in ["Linux", "FreeBSD"]: - gui_reqs.extend(["xorg::xorg", "xkbcommon::xkbcommon"]) + if self.options.qtwayland or self.options.get_safe("with_x11", False): + gui_reqs.append("xkbcommon::xkbcommon") + if self.options.get_safe("with_x11", False): + gui_reqs.append("xorg::xorg") if self.settings.os != "Windows" and self.options.get_safe("opengl", "no") != "no": gui_reqs.append("opengl::opengl") if self.options.get_safe("with_vulkan", False): gui_reqs.append("vulkan-loader::vulkan-loader") - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): gui_reqs.append("moltenvk::moltenvk") if self.options.with_harfbuzz: gui_reqs.append("harfbuzz::harfbuzz") @@ -1008,11 +1073,13 @@ def _create_plugin(pluginname, libname, type, requires): gui_reqs.append("md4c::md4c") _create_module("Gui", gui_reqs) - build_modules.append(self._cmake_qt6_private_file("Gui")) - self.cpp_info.components["qtGui"].build_modules["cmake_find_package"].append(self._cmake_qt6_private_file("Gui")) - self.cpp_info.components["qtGui"].build_modules["cmake_find_package_multi"].append(self._cmake_qt6_private_file("Gui")) + _add_build_module("qtGui", self._cmake_qt6_private_file("Gui")) if self.settings.os == "Windows": + self.cpp_info.components["qtGui"].system_libs = ["advapi32", "gdi32", "ole32", "shell32", "user32", "d3d11", + "dxgi", "dxguid", "d2d1", "dwrite"] + if self.settings.compiler == "gcc": + self.cpp_info.components["qtGui"].system_libs.append("uuid") _create_plugin("QWindowsIntegrationPlugin", "qwindows", "platforms", ["Core", "Gui"]) _create_plugin("QWindowsVistaStylePlugin", "qwindowsvistastyle", "styles", ["Core", "Gui"]) self.cpp_info.components["qtQWindowsIntegrationPlugin"].system_libs = ["advapi32", "dwmapi", "gdi32", "imm32", @@ -1032,7 +1099,7 @@ def _create_plugin(pluginname, libname, type, requires): _create_plugin("QMinimalIntegrationPlugin", "qminimal", "platforms", []) elif self.settings.os == "Emscripten": _create_plugin("QWasmIntegrationPlugin", "qwasm", "platforms", ["Core", "Gui"]) - elif self.settings.os in ["Linux", "FreeBSD"]: + elif self.options.get_safe("with_x11", False): _create_module("XcbQpaPrivate", ["xkbcommon::libxkbcommon-x11", "xorg::xorg"], has_include_dir=False) _create_plugin("QXcbIntegrationPlugin", "qxcb", "platforms", ["Core", "Gui", "XcbQpaPrivate"]) @@ -1040,10 +1107,10 @@ def _create_plugin(pluginname, libname, type, requires): _create_plugin("QIcoPlugin", "qico", "imageformats", ["Gui"]) if self.options.get_safe("with_libjpeg"): jpeg_reqs = ["Gui"] - if self.options.with_libjpeg == "libjpeg-turbo": - jpeg_reqs.append("libjpeg-turbo::libjpeg-turbo") - if self.options.with_libjpeg == "libjpeg": - jpeg_reqs.append("libjpeg::libjpeg") + if self.options.with_libjpeg == "libjpeg-turbo": + jpeg_reqs.append("libjpeg-turbo::libjpeg-turbo") + if self.options.with_libjpeg == "libjpeg": + jpeg_reqs.append("libjpeg::libjpeg") _create_plugin("QJpegPlugin", "qjpeg", "imageformats", jpeg_reqs) if self.options.with_sqlite3: @@ -1065,17 +1132,13 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("Test") if self.options.widgets: _create_module("Widgets", ["Gui"]) - build_modules.append(self._cmake_qt6_private_file("Widgets")) - self.cpp_info.components["qtWidgets"].build_modules["cmake_find_package"].append(self._cmake_qt6_private_file("Widgets")) - self.cpp_info.components["qtWidgets"].build_modules["cmake_find_package_multi"].append(self._cmake_qt6_private_file("Widgets")) + _add_build_module("qtWidgets", self._cmake_qt6_private_file("Widgets")) if self.options.gui and self.options.widgets: _create_module("PrintSupport", ["Gui", "Widgets"]) if self.options.get_safe("opengl", "no") != "no" and self.options.gui: _create_module("OpenGL", ["Gui"]) if self.options.widgets and self.options.get_safe("opengl", "no") != "no": _create_module("OpenGLWidgets", ["OpenGL", "Widgets"]) - if self.options.with_dbus: - _create_module("DBus", ["dbus::dbus"]) _create_module("Concurrent") _create_module("Xml") @@ -1083,13 +1146,11 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("Core5Compat") # since https://github.com/qt/qtdeclarative/commit/4fb84137f1c0a49d64b8bef66fef8a4384cc2a68 - qt_quick_enabled = self.options.gui and (tools.Version(self.version) < "6.2.0" or self.options.qtshadertools) + qt_quick_enabled = self.options.gui and (Version(self.version) < "6.2.0" or self.options.qtshadertools) if self.options.qtdeclarative: _create_module("Qml", ["Network"]) - build_modules.append(self._cmake_qt6_private_file("Qml")) - self.cpp_info.components["qtQml"].build_modules["cmake_find_package"].append(self._cmake_qt6_private_file("Qml")) - self.cpp_info.components["qtQml"].build_modules["cmake_find_package_multi"].append(self._cmake_qt6_private_file("Qml")) + _add_build_module("qtQml", self._cmake_qt6_private_file("Qml")) _create_module("QmlModels", ["Qml"]) self.cpp_info.components["qtQmlImportScanner"].set_property("cmake_target_name", "Qt6::QmlImportScanner") self.cpp_info.components["qtQmlImportScanner"].names["cmake_find_package"] = "QmlImportScanner" # this is an alias for Qml and there to integrate with existing consumers @@ -1113,6 +1174,9 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("Designer", ["Gui", "UiPlugin", "Widgets", "Xml"]) _create_module("Help", ["Gui", "Sql", "Widgets"]) + if self.options.qtshadertools and self.options.gui: + _create_module("ShaderTools", ["Gui"]) + if self.options.qtquick3d and qt_quick_enabled: _create_module("Quick3DUtils", ["Gui"]) _create_module("Quick3DAssetImport", ["Gui", "Qml", "Quick3DUtils"]) @@ -1120,13 +1184,10 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("Quick3D", ["Gui", "Qml", "Quick", "Quick3DRuntimeRender"]) if (self.options.get_safe("qtquickcontrols2") or \ - (self.options.qtdeclarative and tools.Version(self.version) >= "6.2.0")) and qt_quick_enabled: + (self.options.qtdeclarative and Version(self.version) >= "6.2.0")) and qt_quick_enabled: _create_module("QuickControls2", ["Gui", "Quick"]) _create_module("QuickTemplates2", ["Gui", "Quick"]) - if self.options.qtshadertools and self.options.gui: - _create_module("ShaderTools", ["Gui"]) - if self.options.qtsvg and self.options.gui: _create_module("Svg", ["Gui"]) if self.options.widgets: @@ -1228,8 +1289,7 @@ def _create_plugin(pluginname, libname, type, requires): _create_plugin("AVFServicePlugin", "qavfcamera", "mediaservice", []) _create_plugin("CoreAudioPlugin", "qtaudio_coreaudio", "audio", []) - if (self.options.get_safe("qtlocation") and tools.Version(self.version) < "6.2.2") or \ - (self.options.get_safe("qtpositioning") and tools.Version(self.version) >= "6.2.2"): + if self._has_positioning: _create_module("Positioning") _create_plugin("QGeoPositionInfoSourceFactoryGeoclue2", "qtposition_geoclue2", "position", []) _create_plugin("QGeoPositionInfoSourceFactoryPoll", "qtposition_positionpoll", "position", []) @@ -1251,7 +1311,7 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("SerialPort") if self.options.get_safe("qtserialbus"): - _create_module("SerialBus", ["SerialPort"]) + _create_module("SerialBus", ["SerialPort"] if self.options.get_safe("qtserialport") else []) _create_plugin("PassThruCanBusPlugin", "qtpassthrucanbus", "canbus", []) _create_plugin("PeakCanBusPlugin", "qtpeakcanbus", "canbus", []) _create_plugin("SocketCanBusPlugin", "qtsocketcanbus", "canbus", []) @@ -1265,7 +1325,9 @@ def _create_plugin(pluginname, libname, type, requires): _create_module("WebChannel", ["Qml"]) if self.options.get_safe("qtwebengine") and qt_quick_enabled: - webenginereqs = ["Gui", "Quick", "WebChannel", "Positioning"] + webenginereqs = ["Gui", "Quick", "WebChannel"] + if self._has_positioning: + webenginereqs.append("Positioning") if self.settings.os == "Linux": webenginereqs.extend(["expat::expat", "opus::libopus", "xorg-proto::xorg-proto", "libxshmfence::libxshmfence", \ "nss::nss", "libdrm::libdrm"]) @@ -1332,16 +1394,10 @@ def _create_plugin(pluginname, libname, type, requires): self.cpp_info.components["qtPrintSupport"].system_libs.append("cups") self.cpp_info.components["qtCore"].builddirs.append(os.path.join("res","archdatadir","bin")) - build_modules.append(self._cmake_executables_file) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package"].append(self._cmake_executables_file) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package_multi"].append(self._cmake_executables_file) - build_modules.append(self._cmake_qt6_private_file("Core")) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package"].append(self._cmake_qt6_private_file("Core")) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package_multi"].append(self._cmake_qt6_private_file("Core")) + _add_build_module("qtCore", self._cmake_executables_file) + _add_build_module("qtCore", self._cmake_qt6_private_file("Core")) if self.settings.os in ["Windows", "iOS"]: - build_modules.append(self._cmake_entry_point_file) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package"].append(self._cmake_entry_point_file) - self.cpp_info.components["qtCore"].build_modules["cmake_find_package_multi"].append(self._cmake_entry_point_file) + _add_build_module("qtCore", self._cmake_entry_point_file) for m in os.listdir(os.path.join("lib", "cmake")): module = os.path.join("lib", "cmake", m, "%sMacros.cmake" % m) @@ -1349,14 +1405,10 @@ def _create_plugin(pluginname, libname, type, requires): if component_name == "qt": component_name = "qtCore" if os.path.isfile(module): - build_modules.append(module) - self.cpp_info.components[component_name].build_modules["cmake_find_package"].append(module) - self.cpp_info.components[component_name].build_modules["cmake_find_package_multi"].append(module) + _add_build_module(component_name, module) - helper_modules = glob.glob(os.path.join(self.package_folder, "lib", "cmake", m, "QtPublic*Helpers.cmake")) - build_modules.extend(helper_modules) - self.cpp_info.components[component_name].build_modules["cmake_find_package"].extend(helper_modules) - self.cpp_info.components[component_name].build_modules["cmake_find_package_multi"].extend(helper_modules) + for helper_modules in glob.glob(os.path.join(self.package_folder, "lib", "cmake", m, "QtPublic*Helpers.cmake")): + _add_build_module(component_name, helper_modules) self.cpp_info.components[component_name].builddirs.append(os.path.join("lib", "cmake", m)) objects_dirs = glob.glob(os.path.join(self.package_folder, "lib", "objects-*/")) @@ -1372,4 +1424,16 @@ def _create_plugin(pluginname, libname, type, requires): self.cpp_info.components[component].exelinkflags.extend(obj_files) self.cpp_info.components[component].sharedlinkflags.extend(obj_files) - self.cpp_info.set_property("cmake_build_modules", build_modules) + build_modules_list = [] + + def _add_build_modules_for_component(component): + for req in self.cpp_info.components[component].requires: + if "::" in req: # not a qt component + continue + _add_build_modules_for_component(req) + build_modules_list.extend(build_modules.pop(component, [])) + + for c in self.cpp_info.components: + _add_build_modules_for_component(c) + + self.cpp_info.set_property("cmake_build_modules", build_modules_list) diff --git a/recipes/qt/6.x.x/patches/311d29d.patch b/recipes/qt/6.x.x/patches/311d29d.patch new file mode 100644 index 0000000000000..600bcca81e265 --- /dev/null +++ b/recipes/qt/6.x.x/patches/311d29d.patch @@ -0,0 +1,30 @@ +From bb01fe6bdf2e52939698de928a1fbeaf3cce4259 Mon Sep 17 00:00:00 2001 +From: Ilya Fedin +Date: Tue, 12 Apr 2022 14:02:36 +0400 +Subject: [PATCH] Fix build on CentOS 7 + +This little change fixes the build on CentOS 7 + +Pick-to: 6.3 +Change-Id: Ic9717147c10ca78e36d6311944de417c6420211d +Reviewed-by: Thiago Macieira +--- + src/corelib/plugin/qelfparser_p.cpp | 2 ++ + 1 file changed, 2 insertions(+) + +diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp +index c6ccda92fb..def1e2494a 100644 +--- a/src/corelib/plugin/qelfparser_p.cpp ++++ b/src/corelib/plugin/qelfparser_p.cpp +@@ -409,7 +409,9 @@ Q_DECL_UNUSED Q_DECL_COLD_FUNCTION static QDebug &operator<<(QDebug &d, ElfHeade + case EM_NONE: d << ", no machine"; break; + case EM_ARM: d << ", ARM"; break; + case EM_AARCH64: d << ", AArch64"; break; ++#ifdef EM_BLACKFIN + case EM_BLACKFIN: d << ", Blackfin"; break; ++#endif + case EM_IA_64: d << ", IA-64"; break; + case EM_MIPS: d << ", MIPS"; break; + case EM_PPC: d << ", PowerPC"; break; +-- +2.34.1 diff --git a/recipes/qt/6.x.x/patches/3801bba82.patch b/recipes/qt/6.x.x/patches/3801bba82.patch new file mode 100644 index 0000000000000..79b347ce90a23 --- /dev/null +++ b/recipes/qt/6.x.x/patches/3801bba82.patch @@ -0,0 +1,27 @@ +From 3801bba822bf88c202a348d3e01dd493c0ca0551 Mon Sep 17 00:00:00 2001 +From: Nadim Asaduzzaman +Date: Fri, 18 Nov 2022 04:34:38 -0700 +Subject: [PATCH] skia: fix compilation with MSVC2022 + +compilation with MSVC2022 failed due to missing string definition within std namespace + +Fixes: QTBUG-108532 +Change-Id: I2119952d5809895e2511ce1c2c262022af3ba191 +Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/444132 +Reviewed-by: Allan Sandfeld Jensen +--- + chromium/third_party/skia/src/core/SkShaderCodeDictionary.h | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/chromium/third_party/skia/src/core/SkShaderCodeDictionary.h b/chromium/third_party/skia/src/core/SkShaderCodeDictionary.h +index 3a54bbe22e7..8612a469862 100644 +--- a/chromium/third_party/skia/src/core/SkShaderCodeDictionary.h ++++ b/chromium/third_party/skia/src/core/SkShaderCodeDictionary.h +@@ -9,6 +9,7 @@ + #define SkShaderCodeDictionary_DEFINED + + #include ++#include + #include + #include + #include "include/core/SkSpan.h" diff --git a/recipes/qt/6.x.x/patches/CVE-2022-1096-qtwebengine-6.3.diff b/recipes/qt/6.x.x/patches/CVE-2022-1096-qtwebengine-6.3.diff deleted file mode 100644 index e4ce50e78ddee..0000000000000 --- a/recipes/qt/6.x.x/patches/CVE-2022-1096-qtwebengine-6.3.diff +++ /dev/null @@ -1,27 +0,0 @@ ---- a/src/3rdparty/chromium/v8/src/objects/objects.cc -+++ b/src/3rdparty/chromium/v8/src/objects/objects.cc -@@ -2491,6 +2491,12 @@ Maybe Object::SetPropertyInternal(LookupIterator* it, - Maybe result = - JSObject::SetPropertyWithInterceptor(it, should_throw, value); - if (result.IsNothing() || result.FromJust()) return result; -+ // Assuming that the callback have side effects, we use -+ // Object::SetSuperProperty() which works properly regardless on -+ // whether the property was present on the receiver or not when -+ // storing to the receiver. -+ // Proceed lookup from the next state. -+ it->Next(); - } else { - Maybe maybe_attributes = - JSObject::GetPropertyAttributesWithInterceptor(it); -@@ -2511,10 +2517,8 @@ Maybe Object::SetPropertyInternal(LookupIterator* it, - // property to the receiver. - it->NotFound(); - } -- return Object::SetSuperProperty(it, value, store_origin, -- should_throw); - } -- break; -+ return Object::SetSuperProperty(it, value, store_origin, should_throw); - } - - case LookupIterator::ACCESSOR: { diff --git a/recipes/qt/6.x.x/patches/d13958d.diff b/recipes/qt/6.x.x/patches/d13958d.diff new file mode 100644 index 0000000000000..1da1b661fd733 --- /dev/null +++ b/recipes/qt/6.x.x/patches/d13958d.diff @@ -0,0 +1,26 @@ +From d13958dabb9f5542d772c6312cd33e4960bf1137 Mon Sep 17 00:00:00 2001 +From: Eric Lemanissier +Date: Tue, 29 Nov 2022 09:15:58 +0000 +Subject: [PATCH] fix pcre2 detection + +Pick-to: 6.3 +Change-Id: I89f167e11bf1c72c9fae474ddd12380636ac5df8 +--- + +diff --git a/cmake/FindWrapSystemPCRE2.cmake b/cmake/FindWrapSystemPCRE2.cmake +index f8516d3..3ac04b8 100644 +--- a/cmake/FindWrapSystemPCRE2.cmake ++++ b/cmake/FindWrapSystemPCRE2.cmake +@@ -6,11 +6,7 @@ + + find_package(PCRE2 ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} COMPONENTS 16BIT QUIET) + +-# TODO: pcre2-16 is not the target name provided by the upstream Config file. It is PCRE2::16BIT. +-# https://github.com/PCRE2Project/pcre2/blob/2410fbe3869cab403f02b94caa9ab37ee9f5854b/cmake/pcre2-config.cmake.in#L122 +-# We don't strictly need to handle that though, because the pkg-config code path below still +-# finds the correct libraries. +-set(__pcre2_target_name "PCRE2::pcre2-16") ++set(__pcre2_target_name "PCRE2::16BIT") + if(PCRE2_FOUND AND TARGET "${__pcre2_target_name}") + # Hunter case. + set(__pcre2_found TRUE) diff --git a/recipes/qt/6.x.x/patches/d13958d_.diff b/recipes/qt/6.x.x/patches/d13958d_.diff new file mode 100644 index 0000000000000..2e9d40bd0efc0 --- /dev/null +++ b/recipes/qt/6.x.x/patches/d13958d_.diff @@ -0,0 +1,23 @@ +From d13958dabb9f5542d772c6312cd33e4960bf1137 Mon Sep 17 00:00:00 2001 +From: Eric Lemanissier +Date: Tue, 29 Nov 2022 09:15:58 +0000 +Subject: [PATCH] fix pcre2 detection + +Pick-to: 6.3 +Change-Id: I89f167e11bf1c72c9fae474ddd12380636ac5df8 +--- + +diff --git a/cmake/FindWrapSystemPCRE2.cmake b/cmake/FindWrapSystemPCRE2.cmake +index f8516d3..3ac04b8 100644 +--- a/cmake/FindWrapSystemPCRE2.cmake ++++ b/cmake/FindWrapSystemPCRE2.cmake +@@ -6,7 +6,7 @@ + +-find_package(PCRE2 ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} CONFIG QUIET) ++find_package(PCRE2 ${${CMAKE_FIND_PACKAGE_NAME}_FIND_VERSION} COMPONENTS 16BIT QUIET) + +-set(__pcre2_target_name "PCRE2::pcre2-16") ++set(__pcre2_target_name "PCRE2::16BIT") + if(PCRE2_FOUND AND TARGET "${__pcre2_target_name}") + # Hunter case. + set(__pcre2_found TRUE) diff --git a/recipes/qt/6.x.x/qtmodules6.0.4.conf b/recipes/qt/6.x.x/qtmodules6.0.4.conf deleted file mode 100644 index 653b6f1fcb95c..0000000000000 --- a/recipes/qt/6.x.x/qtmodules6.0.4.conf +++ /dev/null @@ -1,343 +0,0 @@ -[submodule "qtbase"] - path = qtbase - url = ../qtbase.git - branch = 6.0 - status = essential -[submodule "qtsvg"] - depends = qtbase - path = qtsvg - url = ../qtsvg.git - branch = 6.0 - status = addon -[submodule "qtdeclarative"] - depends = qtbase - recommends = qtsvg - path = qtdeclarative - url = ../qtdeclarative.git - branch = 6.0 - status = essential -[submodule "qtactiveqt"] - depends = qtbase - path = qtactiveqt - url = ../qtactiveqt.git - branch = dev - status = ignore -[submodule "qtmultimedia"] - depends = qtbase - recommends = qtdeclarative - path = qtmultimedia - url = ../qtmultimedia.git - branch = dev - status = ignore -[submodule "qttools"] - depends = qtbase - recommends = qtdeclarative qtactiveqt - path = qttools - url = ../qttools.git - branch = 6.0 - status = essential -[submodule "qtxmlpatterns"] - depends = qtbase - recommends = qtdeclarative - path = qtxmlpatterns - url = ../qtxmlpatterns.git - branch = dev - status = ignore -[submodule "qttranslations"] - depends = qttools - path = qttranslations - url = ../qttranslations.git - branch = 6.0 - status = essential - priority = 30 -[submodule "qtdoc"] - depends = qtdeclarative qttools - recommends = qtmultimedia qtquickcontrols qtquickcontrols2 - path = qtdoc - url = ../qtdoc.git - branch = 6.0 - status = essential - priority = 40 -[submodule "qtrepotools"] - path = qtrepotools - url = ../qtrepotools.git - branch = master - status = essential - project = - -[submodule "qtqa"] - depends = qtbase - path = qtqa - url = ../qtqa.git - branch = dev - status = essential - priority = 50 -[submodule "qtlocation"] - depends = qtbase - recommends = qtdeclarative qtquickcontrols qtquickcontrols2 qtserialport - path = qtlocation - url = ../qtlocation.git - branch = dev - status = ignore -[submodule "qtsensors"] - depends = qtbase - recommends = qtdeclarative - path = qtsensors - url = ../qtsensors.git - branch = dev - status = ignore -[submodule "qtsystems"] - depends = qtbase - recommends = qtdeclarative - path = qtsystems - url = ../qtsystems.git - branch = dev - status = ignore -[submodule "qtfeedback"] - depends = qtdeclarative - recommends = qtmultimedia - path = qtfeedback - url = ../qtfeedback.git - branch = master - status = ignore -[submodule "qtpim"] - depends = qtdeclarative - path = qtpim - url = ../qtpim.git - branch = dev - status = ignore -[submodule "qtconnectivity"] - depends = qtbase - recommends = qtdeclarative qtandroidextras - path = qtconnectivity - url = ../qtconnectivity.git - branch = dev - status = ignore -[submodule "qtwayland"] - depends = qtbase - recommends = qtdeclarative - path = qtwayland - url = ../qtwayland.git - branch = 6.0 - status = addon -[submodule "qt3d"] - depends = qtbase - recommends = qtdeclarative qtshadertools - path = qt3d - url = ../qt3d.git - branch = 6.0 - status = additionalLibrary -[submodule "qtimageformats"] - depends = qtbase - path = qtimageformats - url = ../qtimageformats.git - branch = 6.0 - status = additionalLibrary -[submodule "qtgraphicaleffects"] - depends = qtdeclarative - path = qtgraphicaleffects - url = ../qtgraphicaleffects.git - branch = dev - status = ignore -[submodule "qtquickcontrols"] - depends = qtdeclarative - recommends = qtgraphicaleffects - path = qtquickcontrols - url = ../qtquickcontrols.git - branch = dev - status = ignore -[submodule "qtserialbus"] - depends = qtbase - recommends = qtserialport - path = qtserialbus - url = ../qtserialbus.git - branch = dev - status = ignore -[submodule "qtserialport"] - depends = qtbase - path = qtserialport - url = ../qtserialport.git - branch = dev - status = ignore -[submodule "qtx11extras"] - depends = qtbase - path = qtx11extras - url = ../qtx11extras.git - branch = dev - status = ignore -[submodule "qtmacextras"] - depends = qtbase - path = qtmacextras - url = ../qtmacextras.git - branch = dev - status = ignore -[submodule "qtwinextras"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtwinextras - url = ../qtwinextras.git - branch = dev - status = ignore -[submodule "qtandroidextras"] - depends = qtbase - path = qtandroidextras - url = ../qtandroidextras.git - branch = dev - status = ignore -[submodule "qtwebsockets"] - depends = qtbase - recommends = qtdeclarative - path = qtwebsockets - url = ../qtwebsockets.git - branch = dev - status = ignore -[submodule "qtwebchannel"] - depends = qtbase - recommends = qtdeclarative qtwebsockets - path = qtwebchannel - url = ../qtwebchannel.git - branch = dev - status = ignore -[submodule "qtwebengine"] - depends = qtdeclarative - recommends = qtquickcontrols qtquickcontrols2 qtlocation qtwebchannel qttools - path = qtwebengine - url = ../qtwebengine.git - branch = dev - status = ignore - priority = 10 -[submodule "qtcanvas3d"] - depends = qtdeclarative - path = qtcanvas3d - url = ../qtcanvas3d.git - branch = dev - status = ignore -[submodule "qtwebview"] - depends = qtdeclarative - recommends = qtwebengine - path = qtwebview - url = ../qtwebview.git - branch = dev - status = ignore -[submodule "qtquickcontrols2"] - depends = qtdeclarative - recommends = qtimageformats qtgraphicaleffects - path = qtquickcontrols2 - url = ../qtquickcontrols2.git - branch = 6.0 - status = essential -[submodule "qtpurchasing"] - depends = qtbase - recommends = qtdeclarative qtandroidextras - path = qtpurchasing - url = ../qtpurchasing.git - branch = dev - status = ignore -[submodule "qtcharts"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtcharts - url = ../qtcharts.git - branch = dev - status = ignore -[submodule "qtdatavis3d"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtdatavis3d - url = ../qtdatavis3d.git - branch = dev - status = ignore -[submodule "qtvirtualkeyboard"] - depends = qtbase qtdeclarative qtsvg - recommends = qtmultimedia qtquickcontrols - path = qtvirtualkeyboard - url = ../qtvirtualkeyboard.git - branch = dev - status = ignore -[submodule "qtgamepad"] - depends = qtbase - recommends = qtdeclarative - path = qtgamepad - url = ../qtgamepad.git - branch = dev - status = ignore -[submodule "qtscxml"] - depends = qtbase qtdeclarative - path = qtscxml - url = ../qtscxml.git - branch = dev - status = ignore -[submodule "qtspeech"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtspeech - url = ../qtspeech.git - branch = dev - status = ignore -[submodule "qtnetworkauth"] - depends = qtbase - path = qtnetworkauth - url = ../qtnetworkauth.git - branch = 6.0 - status = additionalLibrary -[submodule "qtremoteobjects"] - depends = qtbase - recommends = qtdeclarative - path = qtremoteobjects - url = ../qtremoteobjects.git - branch = dev - status = ignore -[submodule "qtwebglplugin"] - depends = qtbase qtwebsockets - recommends = qtdeclarative - path = qtwebglplugin - url = ../qtwebglplugin.git - branch = dev - status = ignore -[submodule "qtlottie"] - depends = qtbase qtdeclarative - path = qtlottie - url = ../qtlottie.git - branch = dev - status = ignore -[submodule "qtquicktimeline"] - depends = qtbase qtdeclarative - path = qtquicktimeline - url = ../qtquicktimeline - branch = 6.0 - status = addon -[submodule "qtquick3d"] - depends = qtbase qtdeclarative qtshadertools - path = qtquick3d - url = ../qtquick3d.git - branch = 6.0 - status = addon -[submodule "qtshadertools"] - depends = qtbase - path = qtshadertools - url = ../qtshadertools.git - branch = 6.0 - status = addon -[submodule "qt5compat"] - depends = qtbase - path = qt5compat - url = ../qt5compat.git - branch = 6.0 - status = deprecated -[submodule "qtcoap"] - depends = qtbase qttools - path = qtcoap - url = ../qtcoap.git - branch = 6.0 - status = additionalLibrary -[submodule "qtmqtt"] - depends = qtbase qtdeclarative qttools - path = qtmqtt - url = ../qtmqtt.git - branch = 6.0 - status = additionalLibrary -[submodule "qtopcua"] - depends = qtbase qtdeclarative qtquickcontrols2 qttools - path = qtopcua - url = ../qtopcua.git - branch = 6.0 - status = additionalLibrary diff --git a/recipes/qt/6.x.x/qtmodules6.1.3.conf b/recipes/qt/6.x.x/qtmodules6.1.3.conf deleted file mode 100644 index 1c6405c4bc77e..0000000000000 --- a/recipes/qt/6.x.x/qtmodules6.1.3.conf +++ /dev/null @@ -1,343 +0,0 @@ -[submodule "qtbase"] - path = qtbase - url = ../qtbase.git - branch = 6.1.3 - status = essential -[submodule "qtsvg"] - depends = qtbase - path = qtsvg - url = ../qtsvg.git - branch = 6.1.3 - status = addon -[submodule "qtdeclarative"] - depends = qtbase - recommends = qtsvg - path = qtdeclarative - url = ../qtdeclarative.git - branch = 6.1.3 - status = essential -[submodule "qtactiveqt"] - depends = qtbase - path = qtactiveqt - url = ../qtactiveqt.git - branch = 6.1.3 - status = addon -[submodule "qtmultimedia"] - depends = qtbase - recommends = qtdeclarative - path = qtmultimedia - url = ../qtmultimedia.git - branch = dev - status = ignore -[submodule "qttools"] - depends = qtbase - recommends = qtdeclarative qtactiveqt - path = qttools - url = ../qttools.git - branch = 6.1.3 - status = essential -[submodule "qtxmlpatterns"] - depends = qtbase - recommends = qtdeclarative - path = qtxmlpatterns - url = ../qtxmlpatterns.git - branch = dev - status = ignore -[submodule "qttranslations"] - depends = qttools - path = qttranslations - url = ../qttranslations.git - branch = 6.1.3 - status = essential - priority = 30 -[submodule "qtdoc"] - depends = qtdeclarative qttools - recommends = qtmultimedia qtquickcontrols qtquickcontrols2 - path = qtdoc - url = ../qtdoc.git - branch = 6.1.3 - status = essential - priority = 40 -[submodule "qtrepotools"] - path = qtrepotools - url = ../qtrepotools.git - branch = master - status = essential - project = - -[submodule "qtqa"] - depends = qtbase - path = qtqa - url = ../qtqa.git - branch = dev - status = essential - priority = 50 -[submodule "qtlocation"] - depends = qtbase - recommends = qtdeclarative qtquickcontrols qtquickcontrols2 qtserialport - path = qtlocation - url = ../qtlocation.git - branch = dev - status = ignore -[submodule "qtsensors"] - depends = qtbase - recommends = qtdeclarative - path = qtsensors - url = ../qtsensors.git - branch = dev - status = ignore -[submodule "qtsystems"] - depends = qtbase - recommends = qtdeclarative - path = qtsystems - url = ../qtsystems.git - branch = dev - status = ignore -[submodule "qtfeedback"] - depends = qtdeclarative - recommends = qtmultimedia - path = qtfeedback - url = ../qtfeedback.git - branch = master - status = ignore -[submodule "qtpim"] - depends = qtdeclarative - path = qtpim - url = ../qtpim.git - branch = dev - status = ignore -[submodule "qtconnectivity"] - depends = qtbase - recommends = qtdeclarative qtandroidextras - path = qtconnectivity - url = ../qtconnectivity.git - branch = dev - status = ignore -[submodule "qtwayland"] - depends = qtbase - recommends = qtdeclarative - path = qtwayland - url = ../qtwayland.git - branch = 6.1.3 - status = addon -[submodule "qt3d"] - depends = qtbase - recommends = qtdeclarative qtshadertools - path = qt3d - url = ../qt3d.git - branch = 6.1.3 - status = addon -[submodule "qtimageformats"] - depends = qtbase - path = qtimageformats - url = ../qtimageformats.git - branch = 6.1.3 - status = addon -[submodule "qtgraphicaleffects"] - depends = qtdeclarative - path = qtgraphicaleffects - url = ../qtgraphicaleffects.git - branch = dev - status = ignore -[submodule "qtquickcontrols"] - depends = qtdeclarative - recommends = qtgraphicaleffects - path = qtquickcontrols - url = ../qtquickcontrols.git - branch = dev - status = ignore -[submodule "qtserialbus"] - depends = qtbase - recommends = qtserialport - path = qtserialbus - url = ../qtserialbus.git - branch = dev - status = ignore -[submodule "qtserialport"] - depends = qtbase - path = qtserialport - url = ../qtserialport.git - branch = dev - status = ignore -[submodule "qtx11extras"] - depends = qtbase - path = qtx11extras - url = ../qtx11extras.git - branch = dev - status = ignore -[submodule "qtmacextras"] - depends = qtbase - path = qtmacextras - url = ../qtmacextras.git - branch = dev - status = ignore -[submodule "qtwinextras"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtwinextras - url = ../qtwinextras.git - branch = dev - status = ignore -[submodule "qtandroidextras"] - depends = qtbase - path = qtandroidextras - url = ../qtandroidextras.git - branch = dev - status = ignore -[submodule "qtwebsockets"] - depends = qtbase - recommends = qtdeclarative - path = qtwebsockets - url = ../qtwebsockets.git - branch = dev - status = ignore -[submodule "qtwebchannel"] - depends = qtbase - recommends = qtdeclarative qtwebsockets - path = qtwebchannel - url = ../qtwebchannel.git - branch = dev - status = ignore -[submodule "qtwebengine"] - depends = qtdeclarative - recommends = qtquickcontrols qtquickcontrols2 qtlocation qtwebchannel qttools - path = qtwebengine - url = ../qtwebengine.git - branch = dev - status = ignore - priority = 10 -[submodule "qtcanvas3d"] - depends = qtdeclarative - path = qtcanvas3d - url = ../qtcanvas3d.git - branch = dev - status = ignore -[submodule "qtwebview"] - depends = qtdeclarative - recommends = qtwebengine - path = qtwebview - url = ../qtwebview.git - branch = dev - status = ignore -[submodule "qtquickcontrols2"] - depends = qtdeclarative - recommends = qtimageformats qtgraphicaleffects - path = qtquickcontrols2 - url = ../qtquickcontrols2.git - branch = 6.1.3 - status = essential -[submodule "qtpurchasing"] - depends = qtbase - recommends = qtdeclarative qtandroidextras - path = qtpurchasing - url = ../qtpurchasing.git - branch = dev - status = ignore -[submodule "qtcharts"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtcharts - url = ../qtcharts.git - branch = 6.1.3 - status = addon -[submodule "qtdatavis3d"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtdatavis3d - url = ../qtdatavis3d.git - branch = 6.1.3 - status = addon -[submodule "qtvirtualkeyboard"] - depends = qtbase qtdeclarative qtsvg - recommends = qtmultimedia qtquickcontrols - path = qtvirtualkeyboard - url = ../qtvirtualkeyboard.git - branch = 6.1.3 - status = addon -[submodule "qtgamepad"] - depends = qtbase - recommends = qtdeclarative - path = qtgamepad - url = ../qtgamepad.git - branch = dev - status = ignore -[submodule "qtscxml"] - depends = qtbase qtdeclarative - path = qtscxml - url = ../qtscxml.git - branch = 6.1.3 - status = addon -[submodule "qtspeech"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtspeech - url = ../qtspeech.git - branch = dev - status = ignore -[submodule "qtnetworkauth"] - depends = qtbase - path = qtnetworkauth - url = ../qtnetworkauth.git - branch = 6.1.3 - status = addon -[submodule "qtremoteobjects"] - depends = qtbase - recommends = qtdeclarative - path = qtremoteobjects - url = ../qtremoteobjects.git - branch = dev - status = ignore -[submodule "qtwebglplugin"] - depends = qtbase qtwebsockets - recommends = qtdeclarative - path = qtwebglplugin - url = ../qtwebglplugin.git - branch = dev - status = ignore -[submodule "qtlottie"] - depends = qtbase qtdeclarative - path = qtlottie - url = ../qtlottie.git - branch = 6.1.3 - status = addon -[submodule "qtquicktimeline"] - depends = qtbase qtdeclarative - path = qtquicktimeline - url = ../qtquicktimeline - branch = 6.1.3 - status = addon -[submodule "qtquick3d"] - depends = qtbase qtdeclarative qtshadertools - path = qtquick3d - url = ../qtquick3d.git - branch = 6.1.3 - status = addon -[submodule "qtshadertools"] - depends = qtbase - path = qtshadertools - url = ../qtshadertools.git - branch = 6.1.3 - status = addon -[submodule "qt5compat"] - depends = qtbase qtdeclarative - path = qt5compat - url = ../qt5compat.git - branch = 6.1.3 - status = deprecated -[submodule "qtcoap"] - depends = qtbase qttools - path = qtcoap - url = ../qtcoap.git - branch = 6.1.3 - status = addon -[submodule "qtmqtt"] - depends = qtbase qtdeclarative qttools - path = qtmqtt - url = ../qtmqtt.git - branch = 6.1.3 - status = addon -[submodule "qtopcua"] - depends = qtbase qtdeclarative qtquickcontrols2 qttools - path = qtopcua - url = ../qtopcua.git - branch = 6.1.3 - status = addon diff --git a/recipes/qt/6.x.x/qtmodules6.3.0.conf b/recipes/qt/6.x.x/qtmodules6.3.0.conf deleted file mode 100644 index 1811e0a68249b..0000000000000 --- a/recipes/qt/6.x.x/qtmodules6.3.0.conf +++ /dev/null @@ -1,305 +0,0 @@ -[submodule "qtbase"] - path = qtbase - url = ../qtbase.git - branch = 6.3.0 - status = essential -[submodule "qtsvg"] - depends = qtbase - path = qtsvg - url = ../qtsvg.git - branch = 6.3.0 - status = addon -[submodule "qtdeclarative"] - depends = qtbase - recommends = qtimageformats qtshadertools qtsvg qtlanguageserver - path = qtdeclarative - url = ../qtdeclarative.git - branch = 6.3.0 - status = essential -[submodule "qtactiveqt"] - depends = qtbase - path = qtactiveqt - url = ../qtactiveqt.git - branch = 6.3.0 - status = addon -[submodule "qtmultimedia"] - depends = qtbase qtshadertools - recommends = qtdeclarative - path = qtmultimedia - url = ../qtmultimedia.git - branch = 6.3.0 - status = addon -[submodule "qttools"] - depends = qtbase - recommends = qtdeclarative qtactiveqt - path = qttools - url = ../qttools.git - branch = 6.3.0 - status = essential -[submodule "qtxmlpatterns"] - depends = qtbase - recommends = qtdeclarative - path = qtxmlpatterns - url = ../qtxmlpatterns.git - branch = 6.3.0 - status = ignore -[submodule "qttranslations"] - depends = qttools - path = qttranslations - url = ../qttranslations.git - branch = 6.3.0 - status = essential - priority = 30 -[submodule "qtdoc"] - depends = qtdeclarative qttools - recommends = qtmultimedia - path = qtdoc - url = ../qtdoc.git - branch = 6.3.0 - status = essential - priority = 40 -[submodule "qtrepotools"] - path = qtrepotools - url = ../qtrepotools.git - branch = master - status = essential - project = - -[submodule "qtqa"] - depends = qtbase - path = qtqa - url = ../qtqa.git - branch = dev - status = essential - priority = 50 -[submodule "qtlocation"] - depends = qtbase qtpositioning - recommends = qtdeclarative - path = qtlocation - url = ../qtlocation.git - branch = 6.3.0 - status = ignore -[submodule "qtpositioning"] - depends = qtbase - recommends = qtdeclarative qtserialport - path = qtpositioning - url = ../qtpositioning.git - branch = 6.3.0 - status = addon -[submodule "qtsensors"] - depends = qtbase - recommends = qtdeclarative - path = qtsensors - url = ../qtsensors.git - branch = 6.3.0 - status = addon -[submodule "qtsystems"] - depends = qtbase - recommends = qtdeclarative - path = qtsystems - url = ../qtsystems.git - branch = dev - status = ignore -[submodule "qtfeedback"] - depends = qtdeclarative - recommends = qtmultimedia - path = qtfeedback - url = ../qtfeedback.git - branch = master - status = ignore -[submodule "qtpim"] - depends = qtdeclarative - path = qtpim - url = ../qtpim.git - branch = dev - status = ignore -[submodule "qtconnectivity"] - depends = qtbase - recommends = qtdeclarative - path = qtconnectivity - url = ../qtconnectivity.git - branch = 6.3.0 - status = addon -[submodule "qtwayland"] - depends = qtbase - recommends = qtdeclarative - path = qtwayland - url = ../qtwayland.git - branch = 6.3.0 - status = addon -[submodule "qt3d"] - depends = qtbase - recommends = qtdeclarative qtshadertools - path = qt3d - url = ../qt3d.git - branch = 6.3.0 - status = addon -[submodule "qtimageformats"] - depends = qtbase - path = qtimageformats - url = ../qtimageformats.git - branch = 6.3.0 - status = addon -[submodule "qtserialbus"] - depends = qtbase - recommends = qtserialport - path = qtserialbus - url = ../qtserialbus.git - branch = 6.3.0 - status = addon -[submodule "qtserialport"] - depends = qtbase - path = qtserialport - url = ../qtserialport.git - branch = 6.3.0 - status = addon -[submodule "qtwebsockets"] - depends = qtbase - recommends = qtdeclarative - path = qtwebsockets - url = ../qtwebsockets.git - branch = 6.3.0 - status = addon -[submodule "qtwebchannel"] - depends = qtbase - recommends = qtdeclarative qtwebsockets - path = qtwebchannel - url = ../qtwebchannel.git - branch = 6.3.0 - status = addon -[submodule "qtwebengine"] - depends = qtdeclarative - recommends = qtwebchannel qttools qtpositioning - path = qtwebengine - url = ../qtwebengine.git - branch = 6.3.0 - status = addon - priority = 10 -[submodule "qtcanvas3d"] - depends = qtdeclarative - path = qtcanvas3d - url = ../qtcanvas3d.git - branch = 6.3.0 - status = ignore -[submodule "qtwebview"] - depends = qtdeclarative - recommends = qtwebengine - path = qtwebview - url = ../qtwebview.git - branch = 6.3.0 - status = addon -[submodule "qtcharts"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtcharts - url = ../qtcharts.git - branch = 6.3.0 - status = addon -[submodule "qtdatavis3d"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtdatavis3d - url = ../qtdatavis3d.git - branch = 6.3.0 - status = addon -[submodule "qtvirtualkeyboard"] - depends = qtbase qtdeclarative qtsvg - recommends = qtmultimedia - path = qtvirtualkeyboard - url = ../qtvirtualkeyboard.git - branch = 6.3.0 - status = addon -[submodule "qtgamepad"] - depends = qtbase - recommends = qtdeclarative - path = qtgamepad - url = ../qtgamepad.git - branch = 6.3.0 - status = ignore -[submodule "qtscxml"] - depends = qtbase qtdeclarative - path = qtscxml - url = ../qtscxml.git - branch = 6.3.0 - status = addon -[submodule "qtspeech"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtspeech - url = ../qtspeech.git - branch = 6.3.0 - status = ignore -[submodule "qtnetworkauth"] - depends = qtbase - path = qtnetworkauth - url = ../qtnetworkauth.git - branch = 6.3.0 - status = addon -[submodule "qtremoteobjects"] - depends = qtbase - recommends = qtdeclarative - path = qtremoteobjects - url = ../qtremoteobjects.git - branch = 6.3.0 - status = addon -[submodule "qtwebglplugin"] - depends = qtbase qtwebsockets - recommends = qtdeclarative - path = qtwebglplugin - url = ../qtwebglplugin.git - branch = 6.3.0 - status = ignore -[submodule "qtlottie"] - depends = qtbase qtdeclarative - path = qtlottie - url = ../qtlottie.git - branch = 6.3.0 - status = addon -[submodule "qtquicktimeline"] - depends = qtbase qtdeclarative - path = qtquicktimeline - url = ../qtquicktimeline - branch = 6.3.0 - status = addon -[submodule "qtquick3d"] - depends = qtbase qtdeclarative qtshadertools - recommends = qtquicktimeline - path = qtquick3d - url = ../qtquick3d.git - branch = 6.3.0 - status = addon -[submodule "qtshadertools"] - depends = qtbase - path = qtshadertools - url = ../qtshadertools.git - branch = 6.3.0 - status = addon -[submodule "qt5compat"] - depends = qtbase qtdeclarative - path = qt5compat - url = ../qt5compat.git - branch = 6.3.0 - status = deprecated -[submodule "qtcoap"] - depends = qtbase - path = qtcoap - url = ../qtcoap.git - branch = 6.3.0 - status = addon -[submodule "qtmqtt"] - depends = qtbase qtdeclarative - path = qtmqtt - url = ../qtmqtt.git - branch = 6.3.0 - status = addon -[submodule "qtopcua"] - depends = qtbase qtdeclarative - path = qtopcua - url = ../qtopcua.git - branch = 6.3.0 - status = addon -[submodule "qtlanguageserver"] - depends = qtbase - path = qtlanguageserver - url = ../qtlanguageserver.git - branch = 6.3.0 - status = preview diff --git a/recipes/qt/6.x.x/qtmodules6.3.1.conf b/recipes/qt/6.x.x/qtmodules6.3.1.conf deleted file mode 100644 index 3d9bda713b80f..0000000000000 --- a/recipes/qt/6.x.x/qtmodules6.3.1.conf +++ /dev/null @@ -1,305 +0,0 @@ -[submodule "qtbase"] - path = qtbase - url = ../qtbase.git - branch = 6.3.1 - status = essential -[submodule "qtsvg"] - depends = qtbase - path = qtsvg - url = ../qtsvg.git - branch = 6.3.1 - status = addon -[submodule "qtdeclarative"] - depends = qtbase - recommends = qtimageformats qtshadertools qtsvg qtlanguageserver - path = qtdeclarative - url = ../qtdeclarative.git - branch = 6.3.1 - status = essential -[submodule "qtactiveqt"] - depends = qtbase - path = qtactiveqt - url = ../qtactiveqt.git - branch = 6.3.1 - status = addon -[submodule "qtmultimedia"] - depends = qtbase qtshadertools - recommends = qtdeclarative - path = qtmultimedia - url = ../qtmultimedia.git - branch = 6.3.1 - status = addon -[submodule "qttools"] - depends = qtbase - recommends = qtdeclarative qtactiveqt - path = qttools - url = ../qttools.git - branch = 6.3.1 - status = essential -[submodule "qtxmlpatterns"] - depends = qtbase - recommends = qtdeclarative - path = qtxmlpatterns - url = ../qtxmlpatterns.git - branch = 6.3 - status = ignore -[submodule "qttranslations"] - depends = qttools - path = qttranslations - url = ../qttranslations.git - branch = 6.3.1 - status = essential - priority = 30 -[submodule "qtdoc"] - depends = qtdeclarative qttools - recommends = qtmultimedia - path = qtdoc - url = ../qtdoc.git - branch = 6.3.1 - status = essential - priority = 40 -[submodule "qtrepotools"] - path = qtrepotools - url = ../qtrepotools.git - branch = master - status = essential - project = - -[submodule "qtqa"] - depends = qtbase - path = qtqa - url = ../qtqa.git - branch = dev - status = essential - priority = 50 -[submodule "qtlocation"] - depends = qtbase qtpositioning - recommends = qtdeclarative - path = qtlocation - url = ../qtlocation.git - branch = 6.3 - status = ignore -[submodule "qtpositioning"] - depends = qtbase - recommends = qtdeclarative qtserialport - path = qtpositioning - url = ../qtpositioning.git - branch = 6.3.1 - status = addon -[submodule "qtsensors"] - depends = qtbase - recommends = qtdeclarative - path = qtsensors - url = ../qtsensors.git - branch = 6.3.1 - status = addon -[submodule "qtsystems"] - depends = qtbase - recommends = qtdeclarative - path = qtsystems - url = ../qtsystems.git - branch = dev - status = ignore -[submodule "qtfeedback"] - depends = qtdeclarative - recommends = qtmultimedia - path = qtfeedback - url = ../qtfeedback.git - branch = master - status = ignore -[submodule "qtpim"] - depends = qtdeclarative - path = qtpim - url = ../qtpim.git - branch = dev - status = ignore -[submodule "qtconnectivity"] - depends = qtbase - recommends = qtdeclarative - path = qtconnectivity - url = ../qtconnectivity.git - branch = 6.3.1 - status = addon -[submodule "qtwayland"] - depends = qtbase - recommends = qtdeclarative - path = qtwayland - url = ../qtwayland.git - branch = 6.3.1 - status = addon -[submodule "qt3d"] - depends = qtbase - recommends = qtdeclarative qtshadertools - path = qt3d - url = ../qt3d.git - branch = 6.3.1 - status = addon -[submodule "qtimageformats"] - depends = qtbase - path = qtimageformats - url = ../qtimageformats.git - branch = 6.3.1 - status = addon -[submodule "qtserialbus"] - depends = qtbase - recommends = qtserialport - path = qtserialbus - url = ../qtserialbus.git - branch = 6.3.1 - status = addon -[submodule "qtserialport"] - depends = qtbase - path = qtserialport - url = ../qtserialport.git - branch = 6.3.1 - status = addon -[submodule "qtwebsockets"] - depends = qtbase - recommends = qtdeclarative - path = qtwebsockets - url = ../qtwebsockets.git - branch = 6.3.1 - status = addon -[submodule "qtwebchannel"] - depends = qtbase - recommends = qtdeclarative qtwebsockets - path = qtwebchannel - url = ../qtwebchannel.git - branch = 6.3.1 - status = addon -[submodule "qtwebengine"] - depends = qtdeclarative - recommends = qtwebchannel qttools qtpositioning - path = qtwebengine - url = ../qtwebengine.git - branch = 6.3.1 - status = addon - priority = 10 -[submodule "qtcanvas3d"] - depends = qtdeclarative - path = qtcanvas3d - url = ../qtcanvas3d.git - branch = 6.3 - status = ignore -[submodule "qtwebview"] - depends = qtdeclarative - recommends = qtwebengine - path = qtwebview - url = ../qtwebview.git - branch = 6.3.1 - status = addon -[submodule "qtcharts"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtcharts - url = ../qtcharts.git - branch = 6.3.1 - status = addon -[submodule "qtdatavis3d"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtdatavis3d - url = ../qtdatavis3d.git - branch = 6.3.1 - status = addon -[submodule "qtvirtualkeyboard"] - depends = qtbase qtdeclarative qtsvg - recommends = qtmultimedia - path = qtvirtualkeyboard - url = ../qtvirtualkeyboard.git - branch = 6.3.1 - status = addon -[submodule "qtgamepad"] - depends = qtbase - recommends = qtdeclarative - path = qtgamepad - url = ../qtgamepad.git - branch = 6.3 - status = ignore -[submodule "qtscxml"] - depends = qtbase qtdeclarative - path = qtscxml - url = ../qtscxml.git - branch = 6.3.1 - status = addon -[submodule "qtspeech"] - depends = qtbase - recommends = qtdeclarative qtmultimedia - path = qtspeech - url = ../qtspeech.git - branch = 6.3 - status = ignore -[submodule "qtnetworkauth"] - depends = qtbase - path = qtnetworkauth - url = ../qtnetworkauth.git - branch = 6.3.1 - status = addon -[submodule "qtremoteobjects"] - depends = qtbase - recommends = qtdeclarative - path = qtremoteobjects - url = ../qtremoteobjects.git - branch = 6.3.1 - status = addon -[submodule "qtwebglplugin"] - depends = qtbase qtwebsockets - recommends = qtdeclarative - path = qtwebglplugin - url = ../qtwebglplugin.git - branch = 6.3 - status = ignore -[submodule "qtlottie"] - depends = qtbase qtdeclarative - path = qtlottie - url = ../qtlottie.git - branch = 6.3.1 - status = addon -[submodule "qtquicktimeline"] - depends = qtbase qtdeclarative - path = qtquicktimeline - url = ../qtquicktimeline - branch = 6.3.1 - status = addon -[submodule "qtquick3d"] - depends = qtbase qtdeclarative qtshadertools - recommends = qtquicktimeline - path = qtquick3d - url = ../qtquick3d.git - branch = 6.3.1 - status = addon -[submodule "qtshadertools"] - depends = qtbase - path = qtshadertools - url = ../qtshadertools.git - branch = 6.3.1 - status = addon -[submodule "qt5compat"] - depends = qtbase qtdeclarative - path = qt5compat - url = ../qt5compat.git - branch = 6.3.1 - status = deprecated -[submodule "qtcoap"] - depends = qtbase - path = qtcoap - url = ../qtcoap.git - branch = 6.3.1 - status = addon -[submodule "qtmqtt"] - depends = qtbase qtdeclarative - path = qtmqtt - url = ../qtmqtt.git - branch = 6.3.1 - status = addon -[submodule "qtopcua"] - depends = qtbase qtdeclarative - path = qtopcua - url = ../qtopcua.git - branch = 6.3.1 - status = addon -[submodule "qtlanguageserver"] - depends = qtbase - path = qtlanguageserver - url = ../qtlanguageserver.git - branch = 6.3.1 - status = preview diff --git a/recipes/qt/6.x.x/qtmodules6.3.2.conf b/recipes/qt/6.x.x/qtmodules6.3.2.conf new file mode 100644 index 0000000000000..b0e0878e68e97 --- /dev/null +++ b/recipes/qt/6.x.x/qtmodules6.3.2.conf @@ -0,0 +1,305 @@ +[submodule "qtbase"] + path = qtbase + url = ../qtbase.git + branch = 6.3.2 + status = essential +[submodule "qtsvg"] + depends = qtbase + path = qtsvg + url = ../qtsvg.git + branch = 6.3.2 + status = addon +[submodule "qtdeclarative"] + depends = qtbase + recommends = qtimageformats qtshadertools qtsvg qtlanguageserver + path = qtdeclarative + url = ../qtdeclarative.git + branch = 6.3.2 + status = essential +[submodule "qtactiveqt"] + depends = qtbase + path = qtactiveqt + url = ../qtactiveqt.git + branch = 6.3.2 + status = addon +[submodule "qtmultimedia"] + depends = qtbase qtshadertools + recommends = qtdeclarative + path = qtmultimedia + url = ../qtmultimedia.git + branch = 6.3.2 + status = addon +[submodule "qttools"] + depends = qtbase + recommends = qtdeclarative qtactiveqt + path = qttools + url = ../qttools.git + branch = 6.3.2 + status = essential +[submodule "qtxmlpatterns"] + depends = qtbase + recommends = qtdeclarative + path = qtxmlpatterns + url = ../qtxmlpatterns.git + branch = 6.3 + status = ignore +[submodule "qttranslations"] + depends = qttools + path = qttranslations + url = ../qttranslations.git + branch = 6.3.2 + status = essential + priority = 30 +[submodule "qtdoc"] + depends = qtdeclarative qttools + recommends = qtmultimedia + path = qtdoc + url = ../qtdoc.git + branch = 6.3.2 + status = essential + priority = 40 +[submodule "qtrepotools"] + path = qtrepotools + url = ../qtrepotools.git + branch = master + status = essential + project = - +[submodule "qtqa"] + depends = qtbase + path = qtqa + url = ../qtqa.git + branch = dev + status = essential + priority = 50 +[submodule "qtlocation"] + depends = qtbase qtpositioning + recommends = qtdeclarative + path = qtlocation + url = ../qtlocation.git + branch = 6.3 + status = ignore +[submodule "qtpositioning"] + depends = qtbase + recommends = qtdeclarative qtserialport + path = qtpositioning + url = ../qtpositioning.git + branch = 6.3.2 + status = addon +[submodule "qtsensors"] + depends = qtbase + recommends = qtdeclarative + path = qtsensors + url = ../qtsensors.git + branch = 6.3.2 + status = addon +[submodule "qtsystems"] + depends = qtbase + recommends = qtdeclarative + path = qtsystems + url = ../qtsystems.git + branch = dev + status = ignore +[submodule "qtfeedback"] + depends = qtdeclarative + recommends = qtmultimedia + path = qtfeedback + url = ../qtfeedback.git + branch = master + status = ignore +[submodule "qtpim"] + depends = qtdeclarative + path = qtpim + url = ../qtpim.git + branch = dev + status = ignore +[submodule "qtconnectivity"] + depends = qtbase + recommends = qtdeclarative + path = qtconnectivity + url = ../qtconnectivity.git + branch = 6.3.2 + status = addon +[submodule "qtwayland"] + depends = qtbase + recommends = qtdeclarative + path = qtwayland + url = ../qtwayland.git + branch = 6.3.2 + status = addon +[submodule "qt3d"] + depends = qtbase + recommends = qtdeclarative qtshadertools + path = qt3d + url = ../qt3d.git + branch = 6.3.2 + status = addon +[submodule "qtimageformats"] + depends = qtbase + path = qtimageformats + url = ../qtimageformats.git + branch = 6.3.2 + status = addon +[submodule "qtserialbus"] + depends = qtbase + recommends = qtserialport + path = qtserialbus + url = ../qtserialbus.git + branch = 6.3.2 + status = addon +[submodule "qtserialport"] + depends = qtbase + path = qtserialport + url = ../qtserialport.git + branch = 6.3.2 + status = addon +[submodule "qtwebsockets"] + depends = qtbase + recommends = qtdeclarative + path = qtwebsockets + url = ../qtwebsockets.git + branch = 6.3.2 + status = addon +[submodule "qtwebchannel"] + depends = qtbase + recommends = qtdeclarative qtwebsockets + path = qtwebchannel + url = ../qtwebchannel.git + branch = 6.3.2 + status = addon +[submodule "qtwebengine"] + depends = qtdeclarative + recommends = qtwebchannel qttools qtpositioning + path = qtwebengine + url = ../qtwebengine.git + branch = 6.3.2 + status = addon + priority = 10 +[submodule "qtcanvas3d"] + depends = qtdeclarative + path = qtcanvas3d + url = ../qtcanvas3d.git + branch = 6.3 + status = ignore +[submodule "qtwebview"] + depends = qtdeclarative + recommends = qtwebengine + path = qtwebview + url = ../qtwebview.git + branch = 6.3.2 + status = addon +[submodule "qtcharts"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtcharts + url = ../qtcharts.git + branch = 6.3.2 + status = addon +[submodule "qtdatavis3d"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtdatavis3d + url = ../qtdatavis3d.git + branch = 6.3.2 + status = addon +[submodule "qtvirtualkeyboard"] + depends = qtbase qtdeclarative qtsvg + recommends = qtmultimedia + path = qtvirtualkeyboard + url = ../qtvirtualkeyboard.git + branch = 6.3.2 + status = addon +[submodule "qtgamepad"] + depends = qtbase + recommends = qtdeclarative + path = qtgamepad + url = ../qtgamepad.git + branch = 6.3 + status = ignore +[submodule "qtscxml"] + depends = qtbase qtdeclarative + path = qtscxml + url = ../qtscxml.git + branch = 6.3.2 + status = addon +[submodule "qtspeech"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtspeech + url = ../qtspeech.git + branch = 6.3.2 + status = ignore +[submodule "qtnetworkauth"] + depends = qtbase + path = qtnetworkauth + url = ../qtnetworkauth.git + branch = 6.3.2 + status = addon +[submodule "qtremoteobjects"] + depends = qtbase + recommends = qtdeclarative + path = qtremoteobjects + url = ../qtremoteobjects.git + branch = 6.3.2 + status = addon +[submodule "qtwebglplugin"] + depends = qtbase qtwebsockets + recommends = qtdeclarative + path = qtwebglplugin + url = ../qtwebglplugin.git + branch = 6.3 + status = ignore +[submodule "qtlottie"] + depends = qtbase qtdeclarative + path = qtlottie + url = ../qtlottie.git + branch = 6.3.2 + status = addon +[submodule "qtquicktimeline"] + depends = qtbase qtdeclarative + path = qtquicktimeline + url = ../qtquicktimeline + branch = 6.3.2 + status = addon +[submodule "qtquick3d"] + depends = qtbase qtdeclarative qtshadertools + recommends = qtquicktimeline + path = qtquick3d + url = ../qtquick3d.git + branch = 6.3.2 + status = addon +[submodule "qtshadertools"] + depends = qtbase + path = qtshadertools + url = ../qtshadertools.git + branch = 6.3.2 + status = addon +[submodule "qt5compat"] + depends = qtbase qtdeclarative + path = qt5compat + url = ../qt5compat.git + branch = 6.3.2 + status = deprecated +[submodule "qtcoap"] + depends = qtbase + path = qtcoap + url = ../qtcoap.git + branch = 6.3.2 + status = addon +[submodule "qtmqtt"] + depends = qtbase qtdeclarative + path = qtmqtt + url = ../qtmqtt.git + branch = 6.3.2 + status = addon +[submodule "qtopcua"] + depends = qtbase qtdeclarative + path = qtopcua + url = ../qtopcua.git + branch = 6.3.2 + status = addon +[submodule "qtlanguageserver"] + depends = qtbase + path = qtlanguageserver + url = ../qtlanguageserver.git + branch = 6.3.2 + status = preview diff --git a/recipes/qt/6.x.x/qtmodules6.4.1.conf b/recipes/qt/6.x.x/qtmodules6.4.1.conf new file mode 100644 index 0000000000000..0ab0c4ef10277 --- /dev/null +++ b/recipes/qt/6.x.x/qtmodules6.4.1.conf @@ -0,0 +1,318 @@ +[submodule "qtbase"] + path = qtbase + url = ../qtbase.git + branch = 6.4.1 + status = essential +[submodule "qtsvg"] + depends = qtbase + path = qtsvg + url = ../qtsvg.git + branch = 6.4.1 + status = addon +[submodule "qtdeclarative"] + depends = qtbase + recommends = qtimageformats qtshadertools qtsvg qtlanguageserver + path = qtdeclarative + url = ../qtdeclarative.git + branch = 6.4.1 + status = essential +[submodule "qtactiveqt"] + depends = qtbase + path = qtactiveqt + url = ../qtactiveqt.git + branch = 6.4.1 + status = addon +[submodule "qtmultimedia"] + depends = qtbase qtshadertools + recommends = qtdeclarative qtquick3d + path = qtmultimedia + url = ../qtmultimedia.git + branch = 6.4.1 + status = addon +[submodule "qttools"] + depends = qtbase + recommends = qtdeclarative qtactiveqt + path = qttools + url = ../qttools.git + branch = 6.4.1 + status = essential +[submodule "qtxmlpatterns"] + depends = qtbase + recommends = qtdeclarative + path = qtxmlpatterns + url = ../qtxmlpatterns.git + branch = dev + status = ignore +[submodule "qttranslations"] + depends = qttools + path = qttranslations + url = ../qttranslations.git + branch = 6.4.1 + status = essential + priority = 30 +[submodule "qtdoc"] + depends = qtdeclarative qttools + recommends = qtmultimedia + path = qtdoc + url = ../qtdoc.git + branch = 6.4.1 + status = essential + priority = 40 +[submodule "qtrepotools"] + path = qtrepotools + url = ../qtrepotools.git + branch = master + status = essential + project = - +[submodule "qtqa"] + depends = qtbase + path = qtqa + url = ../qtqa.git + branch = dev + status = essential + priority = 50 +[submodule "qtlocation"] + depends = qtbase qtpositioning + recommends = qtdeclarative + path = qtlocation + url = ../qtlocation.git + branch = dev + status = ignore +[submodule "qtpositioning"] + depends = qtbase + recommends = qtdeclarative qtserialport + path = qtpositioning + url = ../qtpositioning.git + branch = 6.4.1 + status = addon +[submodule "qtsensors"] + depends = qtbase + recommends = qtdeclarative + path = qtsensors + url = ../qtsensors.git + branch = 6.4.1 + status = addon +[submodule "qtsystems"] + depends = qtbase + recommends = qtdeclarative + path = qtsystems + url = ../qtsystems.git + branch = dev + status = ignore +[submodule "qtfeedback"] + depends = qtdeclarative + recommends = qtmultimedia + path = qtfeedback + url = ../qtfeedback.git + branch = master + status = ignore +[submodule "qtpim"] + depends = qtdeclarative + path = qtpim + url = ../qtpim.git + branch = dev + status = ignore +[submodule "qtconnectivity"] + depends = qtbase + recommends = qtdeclarative + path = qtconnectivity + url = ../qtconnectivity.git + branch = 6.4.1 + status = addon +[submodule "qtwayland"] + depends = qtbase + recommends = qtdeclarative + path = qtwayland + url = ../qtwayland.git + branch = 6.4.1 + status = addon +[submodule "qt3d"] + depends = qtbase + recommends = qtdeclarative qtshadertools + path = qt3d + url = ../qt3d.git + branch = 6.4.1 + status = addon +[submodule "qtimageformats"] + depends = qtbase + path = qtimageformats + url = ../qtimageformats.git + branch = 6.4.1 + status = addon +[submodule "qtserialbus"] + depends = qtbase + recommends = qtserialport + path = qtserialbus + url = ../qtserialbus.git + branch = 6.4.1 + status = addon +[submodule "qtserialport"] + depends = qtbase + path = qtserialport + url = ../qtserialport.git + branch = 6.4.1 + status = addon +[submodule "qtwebsockets"] + depends = qtbase + recommends = qtdeclarative + path = qtwebsockets + url = ../qtwebsockets.git + branch = 6.4.1 + status = addon +[submodule "qtwebchannel"] + depends = qtbase + recommends = qtdeclarative qtwebsockets + path = qtwebchannel + url = ../qtwebchannel.git + branch = 6.4.1 + status = addon +[submodule "qtwebengine"] + depends = qtdeclarative + recommends = qtwebchannel qttools qtpositioning + path = qtwebengine + url = ../qtwebengine.git + branch = 6.4.1 + status = addon + priority = 10 +[submodule "qtcanvas3d"] + depends = qtdeclarative + path = qtcanvas3d + url = ../qtcanvas3d.git + branch = dev + status = ignore +[submodule "qtwebview"] + depends = qtdeclarative + recommends = qtwebengine + path = qtwebview + url = ../qtwebview.git + branch = 6.4.1 + status = addon +[submodule "qtcharts"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtcharts + url = ../qtcharts.git + branch = 6.4.1 + status = addon +[submodule "qtdatavis3d"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtdatavis3d + url = ../qtdatavis3d.git + branch = 6.4.1 + status = addon +[submodule "qtvirtualkeyboard"] + depends = qtbase qtdeclarative qtsvg + recommends = qtmultimedia + path = qtvirtualkeyboard + url = ../qtvirtualkeyboard.git + branch = 6.4.1 + status = addon +[submodule "qtgamepad"] + depends = qtbase + recommends = qtdeclarative + path = qtgamepad + url = ../qtgamepad.git + branch = dev + status = ignore +[submodule "qtscxml"] + depends = qtbase qtdeclarative + path = qtscxml + url = ../qtscxml.git + branch = 6.4.1 + status = addon +[submodule "qtspeech"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtspeech + url = ../qtspeech.git + branch = 6.4.1 + status = addon +[submodule "qtnetworkauth"] + depends = qtbase + path = qtnetworkauth + url = ../qtnetworkauth.git + branch = 6.4.1 + status = addon +[submodule "qtremoteobjects"] + depends = qtbase + recommends = qtdeclarative + path = qtremoteobjects + url = ../qtremoteobjects.git + branch = 6.4.1 + status = addon +[submodule "qtwebglplugin"] + depends = qtbase qtwebsockets + recommends = qtdeclarative + path = qtwebglplugin + url = ../qtwebglplugin.git + branch = dev + status = ignore +[submodule "qtlottie"] + depends = qtbase qtdeclarative + path = qtlottie + url = ../qtlottie.git + branch = 6.4.1 + status = addon +[submodule "qtquicktimeline"] + depends = qtbase qtdeclarative + path = qtquicktimeline + url = ../qtquicktimeline + branch = 6.4.1 + status = addon +[submodule "qtquick3d"] + depends = qtbase qtdeclarative qtshadertools + recommends = qtquicktimeline + path = qtquick3d + url = ../qtquick3d.git + branch = 6.4.1 + status = addon +[submodule "qtshadertools"] + depends = qtbase + path = qtshadertools + url = ../qtshadertools.git + branch = 6.4.1 + status = addon +[submodule "qt5compat"] + depends = qtbase qtdeclarative + path = qt5compat + url = ../qt5compat.git + branch = 6.4.1 + status = deprecated +[submodule "qtcoap"] + depends = qtbase + path = qtcoap + url = ../qtcoap.git + branch = 6.4.1 + status = addon +[submodule "qtmqtt"] + depends = qtbase qtdeclarative + path = qtmqtt + url = ../qtmqtt.git + branch = 6.4.1 + status = addon +[submodule "qtopcua"] + depends = qtbase qtdeclarative + path = qtopcua + url = ../qtopcua.git + branch = 6.4.1 + status = addon +[submodule "qtlanguageserver"] + depends = qtbase + path = qtlanguageserver + url = ../qtlanguageserver.git + branch = 6.4.1 + status = preview +[submodule "qthttpserver"] + depends = qtbase + recommends = qtwebsockets + path = qthttpserver + url = ../qthttpserver.git + branch = 6.4.1 + status = preview +[submodule "qtquick3dphysics"] + depends = qtbase qtdeclarative qtquick3d qtshadertools + path = qtquick3dphysics + url = ../qtquick3dphysics.git + branch = 6.4.1 + status = preview diff --git a/recipes/qt/6.x.x/qtmodules6.4.2.conf b/recipes/qt/6.x.x/qtmodules6.4.2.conf new file mode 100644 index 0000000000000..10324ecab234b --- /dev/null +++ b/recipes/qt/6.x.x/qtmodules6.4.2.conf @@ -0,0 +1,318 @@ +[submodule "qtbase"] + path = qtbase + url = ../qtbase.git + branch = 6.4.2 + status = essential +[submodule "qtsvg"] + depends = qtbase + path = qtsvg + url = ../qtsvg.git + branch = 6.4.2 + status = addon +[submodule "qtdeclarative"] + depends = qtbase + recommends = qtimageformats qtshadertools qtsvg qtlanguageserver + path = qtdeclarative + url = ../qtdeclarative.git + branch = 6.4.2 + status = essential +[submodule "qtactiveqt"] + depends = qtbase + path = qtactiveqt + url = ../qtactiveqt.git + branch = 6.4.2 + status = addon +[submodule "qtmultimedia"] + depends = qtbase qtshadertools + recommends = qtdeclarative qtquick3d + path = qtmultimedia + url = ../qtmultimedia.git + branch = 6.4.2 + status = addon +[submodule "qttools"] + depends = qtbase + recommends = qtdeclarative qtactiveqt + path = qttools + url = ../qttools.git + branch = 6.4.2 + status = essential +[submodule "qtxmlpatterns"] + depends = qtbase + recommends = qtdeclarative + path = qtxmlpatterns + url = ../qtxmlpatterns.git + branch = dev + status = ignore +[submodule "qttranslations"] + depends = qttools + path = qttranslations + url = ../qttranslations.git + branch = 6.4.2 + status = essential + priority = 30 +[submodule "qtdoc"] + depends = qtdeclarative qttools + recommends = qtmultimedia + path = qtdoc + url = ../qtdoc.git + branch = 6.4.2 + status = essential + priority = 40 +[submodule "qtrepotools"] + path = qtrepotools + url = ../qtrepotools.git + branch = master + status = essential + project = - +[submodule "qtqa"] + depends = qtbase + path = qtqa + url = ../qtqa.git + branch = dev + status = essential + priority = 50 +[submodule "qtlocation"] + depends = qtbase qtpositioning + recommends = qtdeclarative + path = qtlocation + url = ../qtlocation.git + branch = dev + status = ignore +[submodule "qtpositioning"] + depends = qtbase + recommends = qtdeclarative qtserialport + path = qtpositioning + url = ../qtpositioning.git + branch = 6.4.2 + status = addon +[submodule "qtsensors"] + depends = qtbase + recommends = qtdeclarative + path = qtsensors + url = ../qtsensors.git + branch = 6.4.2 + status = addon +[submodule "qtsystems"] + depends = qtbase + recommends = qtdeclarative + path = qtsystems + url = ../qtsystems.git + branch = dev + status = ignore +[submodule "qtfeedback"] + depends = qtdeclarative + recommends = qtmultimedia + path = qtfeedback + url = ../qtfeedback.git + branch = master + status = ignore +[submodule "qtpim"] + depends = qtdeclarative + path = qtpim + url = ../qtpim.git + branch = dev + status = ignore +[submodule "qtconnectivity"] + depends = qtbase + recommends = qtdeclarative + path = qtconnectivity + url = ../qtconnectivity.git + branch = 6.4.2 + status = addon +[submodule "qtwayland"] + depends = qtbase + recommends = qtdeclarative + path = qtwayland + url = ../qtwayland.git + branch = 6.4.2 + status = addon +[submodule "qt3d"] + depends = qtbase + recommends = qtdeclarative qtshadertools + path = qt3d + url = ../qt3d.git + branch = 6.4.2 + status = addon +[submodule "qtimageformats"] + depends = qtbase + path = qtimageformats + url = ../qtimageformats.git + branch = 6.4.2 + status = addon +[submodule "qtserialbus"] + depends = qtbase + recommends = qtserialport + path = qtserialbus + url = ../qtserialbus.git + branch = 6.4.2 + status = addon +[submodule "qtserialport"] + depends = qtbase + path = qtserialport + url = ../qtserialport.git + branch = 6.4.2 + status = addon +[submodule "qtwebsockets"] + depends = qtbase + recommends = qtdeclarative + path = qtwebsockets + url = ../qtwebsockets.git + branch = 6.4.2 + status = addon +[submodule "qtwebchannel"] + depends = qtbase + recommends = qtdeclarative qtwebsockets + path = qtwebchannel + url = ../qtwebchannel.git + branch = 6.4.2 + status = addon +[submodule "qtwebengine"] + depends = qtdeclarative + recommends = qtwebchannel qttools qtpositioning + path = qtwebengine + url = ../qtwebengine.git + branch = 6.4.2 + status = addon + priority = 10 +[submodule "qtcanvas3d"] + depends = qtdeclarative + path = qtcanvas3d + url = ../qtcanvas3d.git + branch = dev + status = ignore +[submodule "qtwebview"] + depends = qtdeclarative + recommends = qtwebengine + path = qtwebview + url = ../qtwebview.git + branch = 6.4.2 + status = addon +[submodule "qtcharts"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtcharts + url = ../qtcharts.git + branch = 6.4.2 + status = addon +[submodule "qtdatavis3d"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtdatavis3d + url = ../qtdatavis3d.git + branch = 6.4.2 + status = addon +[submodule "qtvirtualkeyboard"] + depends = qtbase qtdeclarative qtsvg + recommends = qtmultimedia + path = qtvirtualkeyboard + url = ../qtvirtualkeyboard.git + branch = 6.4.2 + status = addon +[submodule "qtgamepad"] + depends = qtbase + recommends = qtdeclarative + path = qtgamepad + url = ../qtgamepad.git + branch = dev + status = ignore +[submodule "qtscxml"] + depends = qtbase qtdeclarative + path = qtscxml + url = ../qtscxml.git + branch = 6.4.2 + status = addon +[submodule "qtspeech"] + depends = qtbase + recommends = qtdeclarative qtmultimedia + path = qtspeech + url = ../qtspeech.git + branch = 6.4.2 + status = addon +[submodule "qtnetworkauth"] + depends = qtbase + path = qtnetworkauth + url = ../qtnetworkauth.git + branch = 6.4.2 + status = addon +[submodule "qtremoteobjects"] + depends = qtbase + recommends = qtdeclarative + path = qtremoteobjects + url = ../qtremoteobjects.git + branch = 6.4.2 + status = addon +[submodule "qtwebglplugin"] + depends = qtbase qtwebsockets + recommends = qtdeclarative + path = qtwebglplugin + url = ../qtwebglplugin.git + branch = dev + status = ignore +[submodule "qtlottie"] + depends = qtbase qtdeclarative + path = qtlottie + url = ../qtlottie.git + branch = 6.4.2 + status = addon +[submodule "qtquicktimeline"] + depends = qtbase qtdeclarative + path = qtquicktimeline + url = ../qtquicktimeline + branch = 6.4.2 + status = addon +[submodule "qtquick3d"] + depends = qtbase qtdeclarative qtshadertools + recommends = qtquicktimeline + path = qtquick3d + url = ../qtquick3d.git + branch = 6.4.2 + status = addon +[submodule "qtshadertools"] + depends = qtbase + path = qtshadertools + url = ../qtshadertools.git + branch = 6.4.2 + status = addon +[submodule "qt5compat"] + depends = qtbase qtdeclarative + path = qt5compat + url = ../qt5compat.git + branch = 6.4.2 + status = deprecated +[submodule "qtcoap"] + depends = qtbase + path = qtcoap + url = ../qtcoap.git + branch = 6.4.2 + status = addon +[submodule "qtmqtt"] + depends = qtbase qtdeclarative + path = qtmqtt + url = ../qtmqtt.git + branch = 6.4.2 + status = addon +[submodule "qtopcua"] + depends = qtbase qtdeclarative + path = qtopcua + url = ../qtopcua.git + branch = 6.4.2 + status = addon +[submodule "qtlanguageserver"] + depends = qtbase + path = qtlanguageserver + url = ../qtlanguageserver.git + branch = 6.4.2 + status = preview +[submodule "qthttpserver"] + depends = qtbase + recommends = qtwebsockets + path = qthttpserver + url = ../qthttpserver.git + branch = 6.4.2 + status = preview +[submodule "qtquick3dphysics"] + depends = qtbase qtdeclarative qtquick3d qtshadertools + path = qtquick3dphysics + url = ../qtquick3dphysics.git + branch = 6.4.2 + status = preview diff --git a/recipes/qt/6.x.x/test_package/conanfile.py b/recipes/qt/6.x.x/test_package/conanfile.py index 173462e5a7e86..fd00ecad1f71c 100644 --- a/recipes/qt/6.x.x/test_package/conanfile.py +++ b/recipes/qt/6.x.x/test_package/conanfile.py @@ -3,6 +3,8 @@ from conan import ConanFile from conan.tools.build import cross_building +from conan.tools.files import mkdir, chdir +from conan.tools.microsoft import is_msvc from conans import tools, Meson, RunEnvironment, CMake from conan.errors import ConanException @@ -13,9 +15,9 @@ class TestPackageConan(ConanFile): generators = "qt", "cmake", "cmake_find_package_multi", "cmake_find_package", "pkg_config", "qmake" def build_requirements(self): - self.build_requires("cmake/3.23.2") + self.tool_requires("cmake/3.25.0") if self._meson_supported(): - self.build_requires("meson/0.60.2") + self.tool_requires("meson/0.60.2") def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" @@ -23,23 +25,20 @@ def _is_mingw(self): def _meson_supported(self): return False and self.options["qt"].shared and\ not cross_building(self) and\ - not tools.os_info.is_macos and\ + not self.settings.os == "Macos" and\ not self._is_mingw() def _qmake_supported(self): - return self.settings.compiler != "Visual Studio" or self.options["qt"].shared - - def _cmake_multi_supported(self): - return True + return self.options["qt"].shared def _build_with_qmake(self): if not self._qmake_supported(): return - tools.mkdir("qmake_folder") - with tools.chdir("qmake_folder"): + mkdir(self, "qmake_folder") + with chdir(self, "qmake_folder"): self.output.info("Building with qmake") - with tools.vcvars(self.settings) if self.settings.compiler == "Visual Studio" else tools.no_op(): + with tools.vcvars(self.settings) if is_msvc(self) else tools.no_op(): args = [self.source_folder, "DESTDIR=bin"] def _getenvpath(var): @@ -66,7 +65,7 @@ def _getenvpath(var): self.run("qmake %s" % " ".join(args), run_environment=True) if tools.os_info.is_windows: - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.run("nmake", run_environment=True) else: self.run("mingw32-make", run_environment=True) @@ -76,7 +75,7 @@ def _getenvpath(var): def _build_with_meson(self): if self._meson_supported(): self.output.info("Building with Meson") - tools.mkdir("meson_folder") + mkdir(self, "meson_folder") with tools.environment_append(RunEnvironment(self).vars): meson = Meson(self) try: @@ -87,8 +86,6 @@ def _build_with_meson(self): meson.build() def _build_with_cmake_find_package_multi(self): - if not self._cmake_multi_supported(): - return self.output.info("Building with cmake_find_package_multi") env_build = RunEnvironment(self) with tools.environment_append(env_build.vars): @@ -109,7 +106,7 @@ def _test_with_qmake(self): return self.output.info("Testing qmake") bin_path = os.path.join("qmake_folder", "bin") - if tools.os_info.is_macos: + if self.settings.os == "Macos": bin_path = os.path.join(bin_path, "test_package.app", "Contents", "MacOS") shutil.copy("qt.conf", bin_path) self.run(os.path.join(bin_path, "test_package"), run_environment=True) @@ -121,8 +118,6 @@ def _test_with_meson(self): self.run(os.path.join("meson_folder", "test_package"), run_environment=True) def _test_with_cmake_find_package_multi(self): - if not self._cmake_multi_supported(): - return self.output.info("Testing CMake_find_package_multi") shutil.copy("qt.conf", "bin") self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/qt/config.yml b/recipes/qt/config.yml index dade712c351cb..c0a8dca335737 100644 --- a/recipes/qt/config.yml +++ b/recipes/qt/config.yml @@ -1,19 +1,17 @@ versions: - "5.15.2": + "6.4.2": + folder: 6.x.x + "6.4.1": + folder: 6.x.x + "6.3.2": + folder: 6.x.x + "6.2.4": + folder: 6.x.x + "5.15.8": folder: 5.x.x - "5.15.3": + "5.15.7": folder: 5.x.x - "5.15.4": + "5.15.6": folder: 5.x.x "5.15.5": folder: 5.x.x - "6.0.4": - folder: 6.x.x - "6.1.3": - folder: 6.x.x - "6.2.4": - folder: 6.x.x - "6.3.0": - folder: 6.x.x - "6.3.1": - folder: 6.x.x diff --git a/recipes/qtxlsxwriter/all/CMakeLists.txt b/recipes/qtxlsxwriter/all/CMakeLists.txt index 2e87c1aa790e7..ff829c64bd1d9 100644 --- a/recipes/qtxlsxwriter/all/CMakeLists.txt +++ b/recipes/qtxlsxwriter/all/CMakeLists.txt @@ -1,86 +1,39 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.12) +project(qtxlsxwriter LANGUAGES CXX) -project(qtxlsxwriter) +find_package(Qt${QT_VERSION_MAJOR} REQUIRED Core Gui CONFIG) -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -set(QTXLSXWRITER_TARGET_NAME qtxlsxwriter) - -include(conan_qt_executables_variables) -set(CMAKE_AUTOMOC ON) - -file(GLOB QTXLSXWRITER_HEADERS LIST_DIRECTORIES=false source_subfolder/src/xlsx/*.h) -file(GLOB QTXLSXWRITER_SOURCES LIST_DIRECTORIES=false source_subfolder/src/xlsx/*.cpp) - -add_library(${QTXLSXWRITER_TARGET_NAME} - ${QTXLSXWRITER_HEADERS} - ${QTXLSXWRITER_SOURCES} -) - -set(QT_VERSION "${QT_VERSION_MAJOR}.${QT_VERSION_MINOR}.${QT_VERSION_PATCH}") -target_include_directories(${QTXLSXWRITER_TARGET_NAME} - PRIVATE - $ - # qtxlsxwriter uses qt private headers - $ - $ - $ - INTERFACE - $ - $ -) +file(GLOB QTXLSXWRITER_SOURCES ${QTXLSXWRITER_SRC_DIR}/src/xlsx/*.cpp) +file(GLOB QTXLSXWRITER_PRIVATE_HEADERS ${QTXLSXWRITER_SRC_DIR}/src/xlsx/*_p.h) +file(GLOB QTXLSXWRITER_PUBLIC_HEADERS ${QTXLSXWRITER_SRC_DIR}/src/xlsx/*.h) +list(REMOVE_ITEM QTXLSXWRITER_PUBLIC_HEADERS ${QTXLSXWRITER_PRIVATE_HEADERS}) -target_compile_features(${QTXLSXWRITER_TARGET_NAME} - PRIVATE - cxx_range_for +add_library(qtxlsxwriter ${QTXLSXWRITER_SOURCES}) +target_include_directories(qtxlsxwriter + PUBLIC + ${QTXLSXWRITER_SRC_DIR}/src/xlsx> + PRIVATE + # qtxlsxwriter uses qt private headers + ${QT_ROOT}/include/QtCore/${Qt${QT_VERSION_MAJOR}_VERSION} + ${QT_ROOT}/include/QtGui/${Qt${QT_VERSION_MAJOR}_VERSION} + ${QT_ROOT}/include/QtGui/${Qt${QT_VERSION_MAJOR}_VERSION}/QtGui ) - -# TODO: remove when the qt recipe is fixed -# and this package is linked to the target for qt -target_include_directories(${PROJECT_NAME} PRIVATE ${CONAN_INCLUDE_DIRS}) -target_link_directories(${PROJECT_NAME} PRIVATE ${CONAN_LIB_DIRS}) -target_compile_definitions(${PROJECT_NAME} PRIVATE ${CONAN_DEFINES_QTXLSXWRITER}) - -# get the actual library file name of the Qt GUI module (for ex. it can be `Qt5Gui_debug`) -foreach(lib ${CONAN_LIBS}) - string(FIND ${lib} "Qt5Gui" qtgui_found) - if(NOT (qtgui_found EQUAL -1)) - set(qtgui_name ${lib}) - break() - endif() -endforeach() - -# place qt::Gui before qt::Core (important for some toolchains) -# since the current qt recipe provides an incorrect order of libraries -# TODO: link to the target when the qt recipe is fixed -target_link_libraries(${QTXLSXWRITER_TARGET_NAME} - ${qtgui_name} - ${CONAN_LIBS} +target_compile_features(qtxlsxwriter PRIVATE cxx_range_for) +target_link_libraries(qtxlsxwriter PUBLIC Qt${QT_VERSION_MAJOR}::Core Qt${QT_VERSION_MAJOR}::Gui) +set_target_properties(qtxlsxwriter PROPERTIES + PUBLIC_HEADER "${QTXLSXWRITER_PUBLIC_HEADERS}" + DEFINE_SYMBOL QT_BUILD_XLSX_LIB + AUTOMOC ON ) - -get_target_property(target_type ${QTXLSXWRITER_TARGET_NAME} TYPE) -if (target_type STREQUAL "STATIC_LIBRARY") - target_compile_definitions(${QTXLSXWRITER_TARGET_NAME} - PUBLIC - QTXLSX_STATIC - ) +if(NOT BUILD_SHARED_LIBS) + target_compile_definitions(qtxlsxwriter PUBLIC QTXLSX_STATIC) endif() -set_target_properties(${QTXLSXWRITER_TARGET_NAME} PROPERTIES - DEFINE_SYMBOL QT_BUILD_XLSX_LIB +include(GNUInstallDirs) +install( + TARGETS qtxlsxwriter + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} ) - -file(GLOB QTXLSXWRITER_PRIVATE_HEADERS LIST_DIRECTORIES=false source_subfolder/src/xlsx/*_p.h) -set(QTXLSXWRITER_PUBLIC_HEADERS ${QTXLSXWRITER_HEADERS}) -list(REMOVE_ITEM QTXLSXWRITER_PUBLIC_HEADERS ${QTXLSXWRITER_PRIVATE_HEADERS}) -set_property(TARGET ${QTXLSXWRITER_TARGET_NAME} PROPERTY - PUBLIC_HEADER ${QTXLSXWRITER_PUBLIC_HEADERS} -) - -# define installing rules for target files -install(TARGETS ${QTXLSXWRITER_TARGET_NAME} - PUBLIC_HEADER DESTINATION include -) - -set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "Generated Files") diff --git a/recipes/qtxlsxwriter/all/conandata.yml b/recipes/qtxlsxwriter/all/conandata.yml index 53f8961b58d93..324be919abbe3 100644 --- a/recipes/qtxlsxwriter/all/conandata.yml +++ b/recipes/qtxlsxwriter/all/conandata.yml @@ -1,10 +1,11 @@ sources: "0.3.0": - - url: "https://github.com/dbzhang800/QtXlsxWriter/archive/v0.3.0.zip" + source: + url: "https://github.com/dbzhang800/QtXlsxWriter/archive/v0.3.0.zip" sha256: "e665317de4f1551936d519781ab8f96b6738926595f3f26ecb6c50db4ff0419e" - - url: "https://raw.githubusercontent.com/dbzhang800/QtXlsxWriter/d013edc9cf39b450f035528114b349a70b1507ba/LICENSE" + license: + url: "https://raw.githubusercontent.com/dbzhang800/QtXlsxWriter/d013edc9cf39b450f035528114b349a70b1507ba/LICENSE" sha256: "b89e97a417a8061f438c437d0485e3e4d135a6c25d976cc457a9a23281ee5f51" patches: "0.3.0": - - base_path: "source_subfolder" - patch_file: "patches/0.3.0/fix-export-macro.patch" + - patch_file: "patches/0.3.0/fix-export-macro.patch" diff --git a/recipes/qtxlsxwriter/all/conanfile.py b/recipes/qtxlsxwriter/all/conanfile.py index 1a5097bcfd400..a67db1337017f 100644 --- a/recipes/qtxlsxwriter/all/conanfile.py +++ b/recipes/qtxlsxwriter/all/conanfile.py @@ -1,5 +1,13 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, download, export_conandata_patches, get +from conan.tools.scm import Version import os -from conans import CMake, ConanFile, tools + +required_conan_version = ">=1.53.0" class QtXlsxWriterConan(ConanFile): @@ -8,34 +16,21 @@ class QtXlsxWriterConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/dbzhang800/QtXlsxWriter" description = ".xlsx file reader and writer for Qt5" - topics = ("qtxlsxwriter", "excel", "xlsx", "conan-recipe") + topics = ("excel", "xlsx") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "fPIC": [True, False] + "fPIC": [True, False], } default_options = { "shared": False, - "fPIC": True + "fPIC": True, } - generators = "cmake" - exports_sources = "CMakeLists.txt", "patches/**" - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["QT_ROOT"] = self.deps_cpp_info["qt"].rootpath.replace("\\", "/") - self._cmake.configure() - return self._cmake + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,30 +38,59 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("qt/5.15.2") + self.requires("qt/5.15.7") + + def validate(self): + if not self.dependencies["qt"].options.gui: + raise ConanInvalidConfiguration(f"{self.ref} requires qt gui") + # FIXME: to remove once https://github.com/conan-io/conan/issues/11385 fixed + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration(f"{self.ref} recipe does not support cross-compilation yet") + + def build_requirements(self): + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires("qt/5.15.7") def source(self): - for source in self.conan_data["sources"][self.version]: - url = source["url"] - filename = url.rsplit("/", 1)[-1] - tools.download(url, filename, sha256=source["sha256"]) - tools.unzip(os.path.join(self.source_folder, "v0.3.0.zip"), self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version]["source"], + destination=self.source_folder, strip_root=True) + download(self, **self.conan_data["sources"][self.version]["license"], filename="LICENSE") + + def generate(self): + if hasattr(self, "settings_build") and cross_building(self): + env = VirtualBuildEnv(self) + env.generate() + else: + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = CMakeToolchain(self) + tc.variables["QTXLSXWRITER_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["QT_VERSION_MAJOR"] = str(Version(self.dependencies["qt"].ref.version).major) + tc.variables["QT_ROOT"] = self.dependencies["qt"].package_folder.replace("\\", "/") + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("LICENSE", dst="licenses") def package_info(self): + self.cpp_info.libs = ["qtxlsxwriter"] if not self.options.shared: self.cpp_info.defines = ["QTXLSX_STATIC"] - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.requires = ["qt::qtCore", "qt::qtGui"] diff --git a/recipes/qtxlsxwriter/all/test_package/CMakeLists.txt b/recipes/qtxlsxwriter/all/test_package/CMakeLists.txt index 73ad95d57c209..e2353a278197b 100644 --- a/recipes/qtxlsxwriter/all/test_package/CMakeLists.txt +++ b/recipes/qtxlsxwriter/all/test_package/CMakeLists.txt @@ -1,37 +1,10 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_executable(${PROJECT_NAME} example.cpp) - -# workaround to deal with the error: -# "Qt requires a C++11 compiler and yours does not seem to be that." -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) - -# TODO: remove when the qt recipe is fixed -# and the test package is linked to the target -target_include_directories(${PROJECT_NAME} PRIVATE ${CONAN_INCLUDE_DIRS}) -target_link_directories(${PROJECT_NAME} PRIVATE ${CONAN_LIB_DIRS}) -target_compile_definitions(${PROJECT_NAME} PRIVATE ${CONAN_DEFINES_QTXLSXWRITER}) - -# get the actual library file name of the Qt GUI module (for ex. it can be `Qt5Gui_debug`) -foreach(lib ${CONAN_LIBS}) - string(FIND ${lib} "Qt5Gui" qtgui_found) - if(NOT (qtgui_found EQUAL -1)) - set(qtgui_name ${lib}) - break() - endif() -endforeach() - -# place qt::Gui before qt::Core (important for some toolchains) -# since the current qt recipe provides an incorrect order of libraries -# TODO: link to the target when the qt recipe is fixed -target_link_libraries(${PROJECT_NAME} - ${qtgui_name} - ${CONAN_LIBS} -) +find_package(qtxlsxwriter REQUIRED CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE qtxlsxwriter::qtxlsxwriter) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) # `fPIC` option must be used because qt was built with `reduce-relocations` target_compile_options(${PROJECT_NAME} PRIVATE -fPIC) diff --git a/recipes/qtxlsxwriter/all/test_package/conanfile.py b/recipes/qtxlsxwriter/all/test_package/conanfile.py index 77d6a0f32925a..e845ae751a301 100644 --- a/recipes/qtxlsxwriter/all/test_package/conanfile.py +++ b/recipes/qtxlsxwriter/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools -class QtXlsxWriterTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qtxlsxwriter/all/test_package/example.cpp b/recipes/qtxlsxwriter/all/test_package/test_package.cpp similarity index 100% rename from recipes/qtxlsxwriter/all/test_package/example.cpp rename to recipes/qtxlsxwriter/all/test_package/test_package.cpp diff --git a/recipes/qtxlsxwriter/all/test_v1_package/CMakeLists.txt b/recipes/qtxlsxwriter/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/qtxlsxwriter/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/qtxlsxwriter/all/test_v1_package/conanfile.py b/recipes/qtxlsxwriter/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/qtxlsxwriter/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/quantlib/all/CMakeLists.txt b/recipes/quantlib/all/CMakeLists.txt deleted file mode 100644 index af7cd55f3e626..0000000000000 --- a/recipes/quantlib/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - -add_subdirectory(source_subfolder) diff --git a/recipes/quantlib/all/conandata.yml b/recipes/quantlib/all/conandata.yml index 47464581d2d33..92d444f47a0c7 100644 --- a/recipes/quantlib/all/conandata.yml +++ b/recipes/quantlib/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "1.22": - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" diff --git a/recipes/quantlib/all/conanfile.py b/recipes/quantlib/all/conanfile.py index f290d96d45c23..33792726d5185 100644 --- a/recipes/quantlib/all/conanfile.py +++ b/recipes/quantlib/all/conanfile.py @@ -1,14 +1,20 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime +from conan.tools.scm import Version +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class QuantlibConan(ConanFile): name = "quantlib" description = "QuantLib is a free/open-source library for modeling, trading, and risk management in real-life." license = "BSD-3-Clause" - topics = ("quantlib", "quantitative-finance") + topics = ("quantitative-finance") homepage = "https://www.quantlib.org" url = "https://github.com/conan-io/conan-center-index" @@ -22,13 +28,8 @@ class QuantlibConan(ConanFile): "fPIC": True, } - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -36,42 +37,55 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("boost/1.76.0") + self.requires("boost/1.80.0") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": raise ConanInvalidConfiguration("gcc < 5 not supported") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["USE_BOOST_DYNAMIC_LIBRARIES"] = False # even if boost shared, the underlying upstream logic doesn't matter for conan - if self.settings.compiler == "Visual Studio": - self._cmake.definitions["MSVC_RUNTIME"] = "dynamic" if "MD" in str(self.settings.compiler.runtime) else "static" - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_BOOST_DYNAMIC_LIBRARIES"] = False # even if boost shared, the underlying upstream logic doesn't matter for conan + if is_msvc(self): + tc.variables["MSVC_RUNTIME"] = "static" if is_msvc_static_runtime(self) else "dynamic" + # Export symbols for msvc shared + tc.cache_variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.TXT", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.TXT", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.names["pkg_config"] = "quantlib" - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.set_property("cmake_file_name", "QuantLib") + self.cpp_info.set_property("cmake_target_name", "QuantLib::QuantLib") + self.cpp_info.set_property("pkg_config_name", "quantlib") + self.cpp_info.libs = collect_libs(self) + self.cpp_info.requires = ["boost::headers"] + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "QuantLib" + self.cpp_info.names["cmake_find_package_multi"] = "QuantLib" diff --git a/recipes/quantlib/all/test_package/CMakeLists.txt b/recipes/quantlib/all/test_package/CMakeLists.txt index 33ae887aa6aea..8fdec262bfc09 100644 --- a/recipes/quantlib/all/test_package/CMakeLists.txt +++ b/recipes/quantlib/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(QuantLib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE QuantLib::QuantLib) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/quantlib/all/test_package/conanfile.py b/recipes/quantlib/all/test_package/conanfile.py index 5216332f39f5c..0a6bc68712d90 100644 --- a/recipes/quantlib/all/test_package/conanfile.py +++ b/recipes/quantlib/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/quantlib/all/test_v1_package/CMakeLists.txt b/recipes/quantlib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/quantlib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/quantlib/all/test_v1_package/conanfile.py b/recipes/quantlib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/quantlib/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/quazip/all/CMakeLists.txt b/recipes/quazip/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/quazip/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/quazip/all/conandata.yml b/recipes/quazip/all/conandata.yml index a45eceeb53298..e1e86960ccb10 100644 --- a/recipes/quazip/all/conandata.yml +++ b/recipes/quazip/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4": + url: "https://github.com/stachenov/quazip/archive/v1.4.tar.gz" + sha256: "79633fd3a18e2d11a7d5c40c4c79c1786ba0c74b59ad752e8429746fe1781dd6" "1.3": url: "https://github.com/stachenov/quazip/archive/v1.3.tar.gz" sha256: "c1239559cd6860cab80a0fd81f4204e606f9324f702dab6166b0960676ee1754" @@ -11,4 +14,3 @@ sources: patches: "1.3": - patch_file: "patches/1.3-0001-use-cpp17-for-qt6.patch" - base_path: "source_subfolder" diff --git a/recipes/quazip/all/conanfile.py b/recipes/quazip/all/conanfile.py index 83ca68e042854..9dd3d5245caaa 100644 --- a/recipes/quazip/all/conanfile.py +++ b/recipes/quazip/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -import functools +from conan import ConanFile +from conan.tools.microsoft import is_msvc_static_runtime, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class QuaZIPConan(ConanFile): @@ -26,24 +30,12 @@ class QuaZIPConan(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _qt_major(self): - return tools.Version(self.deps_cpp_info["qt"].version).major + return Version(self.deps_cpp_info["qt"].version).major def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -51,38 +43,47 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") - self.requires("qt/5.15.4") + self.requires("zlib/1.2.13") + self.requires("qt/5.15.8") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["QUAZIP_QT_MAJOR_VERSION"] = self._qt_major + if is_msvc(self): + tc.variables["USE_MSVC_RUNTIME_LIBRARY_DLL"] = not is_msvc_static_runtime(self) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + tc = CMakeDeps(self) + tc.generate() + tc = VirtualBuildEnv(self) + tc.generate(scope="build") - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): + apply_conandata_patches(self) cmake = CMake(self) - cmake.definitions["QUAZIP_QT_MAJOR_VERSION"] = self._qt_major cmake.configure() - return cmake - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="COPYING", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - quazip_major = tools.Version(self.version).major + quazip_major = Version(self.version).major self.cpp_info.set_property("cmake_file_name", f"QuaZip-Qt{self._qt_major}") self.cpp_info.set_property("cmake_target_name", "QuaZip::QuaZip") self.cpp_info.set_property("pkg_config_name", f"quazip{quazip_major}-qt{self._qt_major}") diff --git a/recipes/quazip/all/test_package/CMakeLists.txt b/recipes/quazip/all/test_package/CMakeLists.txt index c8d229bae1b33..8479196b3ebe4 100644 --- a/recipes/quazip/all/test_package/CMakeLists.txt +++ b/recipes/quazip/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(QuaZip-Qt${QT_VERSION_MAJOR} REQUIRED CONFIG) +find_package(QuaZip-Qt5 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) -target_link_libraries(${PROJECT_NAME} QuaZip::QuaZip) +target_link_libraries(${PROJECT_NAME} PRIVATE QuaZip::QuaZip) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) # Must compile with "-fPIC" since Qt was built with -reduce-relocations. target_compile_options(${PROJECT_NAME} PRIVATE -fPIC) diff --git a/recipes/quazip/all/test_package/conanfile.py b/recipes/quazip/all/test_package/conanfile.py index 30555adf0cb64..88a043dccbe68 100644 --- a/recipes/quazip/all/test_package/conanfile.py +++ b/recipes/quazip/all/test_package/conanfile.py @@ -1,19 +1,27 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) - cmake.definitions["QT_VERSION_MAJOR"] = tools.Version(self.deps_cpp_info["qt"].version).major cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): zipFile_path = os.path.join(self.source_folder, "zipFile.zip") - bin_path = os.path.join("bin", "test_package") - self.run(bin_path + " " + zipFile_path, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path + " " + zipFile_path, env="conanrun") diff --git a/recipes/quazip/all/test_v1_package/CMakeLists.txt b/recipes/quazip/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/quazip/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/quazip/all/test_v1_package/conanfile.py b/recipes/quazip/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..97418087b1f8d --- /dev/null +++ b/recipes/quazip/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + zipFile_path = os.path.join(self.source_folder, "zipFile.zip") + bin_path = os.path.join("bin", "test_package") + self.run(bin_path + " " + zipFile_path, run_environment=True) diff --git a/recipes/quazip/config.yml b/recipes/quazip/config.yml index 6a1ab98d02ce1..889c86eb7e377 100644 --- a/recipes/quazip/config.yml +++ b/recipes/quazip/config.yml @@ -1,4 +1,6 @@ versions: + "1.4": + folder: all "1.3": folder: all "1.2": diff --git a/recipes/quickjs/all/CMakeLists.txt b/recipes/quickjs/all/CMakeLists.txt new file mode 100644 index 0000000000000..bd4c048f85e13 --- /dev/null +++ b/recipes/quickjs/all/CMakeLists.txt @@ -0,0 +1,62 @@ +cmake_minimum_required(VERSION 3.4) +project(quickjs C) + +option(USE_BIGNUM "Use bignum" ON) +option(DUMP_LEAKS "dump leaks" OFF) + +file(STRINGS ${QUICKJS_SRC_DIR}/VERSION version) +set(cdef CONFIG_VERSION="${version}" _GNU_SOURCE) + +set(QUICKJS_SRC + ${QUICKJS_SRC_DIR}/quickjs.c + ${QUICKJS_SRC_DIR}/libbf.c + ${QUICKJS_SRC_DIR}/libregexp.c + ${QUICKJS_SRC_DIR}/libunicode.c + ${QUICKJS_SRC_DIR}/cutils.c + ${QUICKJS_SRC_DIR}/quickjs-libc.c +) + +set(QUICKJS_INC + ${QUICKJS_SRC_DIR}/cutils.h + ${QUICKJS_SRC_DIR}/libregexp-opcode.h + ${QUICKJS_SRC_DIR}/libregexp.h + ${QUICKJS_SRC_DIR}/libunicode-table.h + ${QUICKJS_SRC_DIR}/libunicode.h + ${QUICKJS_SRC_DIR}/list.h + ${QUICKJS_SRC_DIR}/quickjs-atom.h + ${QUICKJS_SRC_DIR}/quickjs-libc.h + ${QUICKJS_SRC_DIR}/quickjs-opcode.h + ${QUICKJS_SRC_DIR}/quickjs.h + ${QUICKJS_SRC_DIR}/unicode_gen_def.h +) + +if(USE_BIGNUM) + list(APPEND QUICKJS_SRC ${QUICKJS_SRC_DIR}/libbf.c) + list(APPEND QUICKJS_INC ${QUICKJS_SRC_DIR}/libbf.h) +endif() + +add_library(quickjs ${QUICKJS_SRC}) +target_include_directories(quickjs PRIVATE ${QUICKJS_SRC_DIR}) +set_target_properties(quickjs PROPERTIES + PUBLIC_HEADER "${QUICKJS_INC}" + WINDOWS_EXPORT_ALL_SYMBOLS ON +) + +find_library(LIBM m) +target_link_libraries(quickjs PRIVATE $<$:${LIBM}>) + +if(DUMP_LEAKS) + target_compile_definitions(quickjs PRIVATE ${cdef} DUMP_LEAKS) +else() + target_compile_definitions(quickjs PRIVATE ${cdef}) +endif() + +include(GNUInstallDirs) + +install( + TARGETS quickjs + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/quickjs +) diff --git a/recipes/quickjs/all/conandata.yml b/recipes/quickjs/all/conandata.yml new file mode 100644 index 0000000000000..b6c326416c7bf --- /dev/null +++ b/recipes/quickjs/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2021-03-27": + url: "https://bellard.org/quickjs/quickjs-2021-03-27.tar.xz" + sha256: "a45bface4c3379538dea8533878d694e289330488ea7028b105f72572fe7fe1a" diff --git a/recipes/quickjs/all/conanfile.py b/recipes/quickjs/all/conanfile.py new file mode 100644 index 0000000000000..8e68a544366f1 --- /dev/null +++ b/recipes/quickjs/all/conanfile.py @@ -0,0 +1,91 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration + +import os + +required_conan_version = ">=1.47.0" + +class QuickJSConan(ConanFile): + name = "quickjs" + description = "QuickJS is a small and embeddable Javascript engine." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://bellard.org/quickjs/" + topics = ("Javascript", "embeddable", "ES2020", "asynchronous") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "use_bignum": [True, False], + "dump_leaks": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "use_bignum" : True, + "dump_leaks": False, + } + + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def validate(self): + # TODO: there are forked repository to support MSVC. (https://github.com/c-smile/quickjspp) + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} can not be built on Visual Studio and msvc.") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["QUICKJS_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["USE_BIGNUM"] = self.options.use_bignum + tc.variables["DUMP_LEAKS"] = self.options.dump_leaks + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() + + def package(self): + copy(self, "LICENSE", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["quickjs"] + + if self.options.use_bignum == True: + self.cpp_info.defines.append("CONFIG_BIGNUM") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("dl") + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/quickjs/all/test_package/CMakeLists.txt b/recipes/quickjs/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..e6ebd1f3afdc4 --- /dev/null +++ b/recipes/quickjs/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.0) +project(test_package C) + +find_package(quickjs REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE quickjs::quickjs) diff --git a/recipes/quickjs/all/test_package/conanfile.py b/recipes/quickjs/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/quickjs/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/quickjs/all/test_package/test_package.c b/recipes/quickjs/all/test_package/test_package.c new file mode 100644 index 0000000000000..25a64b9418971 --- /dev/null +++ b/recipes/quickjs/all/test_package/test_package.c @@ -0,0 +1,9 @@ +#include "quickjs/quickjs.h" + +int main() { + struct JSRuntime* rt = JS_NewRuntime(); + + JS_FreeRuntime(rt); + + return 0; +} diff --git a/recipes/quickjs/all/test_v1_package/CMakeLists.txt b/recipes/quickjs/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..4c0436c623e76 --- /dev/null +++ b/recipes/quickjs/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.0) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(quickjs REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE quickjs::quickjs) diff --git a/recipes/quickjs/all/test_v1_package/conanfile.py b/recipes/quickjs/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/quickjs/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/quickjs/config.yml b/recipes/quickjs/config.yml new file mode 100644 index 0000000000000..4110c6ceb7c0f --- /dev/null +++ b/recipes/quickjs/config.yml @@ -0,0 +1,3 @@ +versions: + "2021-03-27": + folder: "all" diff --git a/recipes/quill/all/CMakeLists.txt b/recipes/quill/all/CMakeLists.txt deleted file mode 100644 index 7d5ba25565b0a..0000000000000 --- a/recipes/quill/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/quill/all/conandata.yml b/recipes/quill/all/conandata.yml index be5ac14cbcc40..bacec03cf029c 100644 --- a/recipes/quill/all/conandata.yml +++ b/recipes/quill/all/conandata.yml @@ -1,19 +1,28 @@ sources: + "2.7.0": + url: "https://github.com/odygrd/quill/archive/v2.7.0.tar.gz" + sha256: "10b8912e4c463a3a86b809076b95bec49aa08393d9ae6b92196cd46314236b87" + "2.6.0": + url: "https://github.com/odygrd/quill/archive/v2.6.0.tar.gz" + sha256: "d72fd5a01bf8d3e59ed93a789a8f103bc31efe0fb3c09182c74036a2e3a8451b" + "2.5.1": + url: "https://github.com/odygrd/quill/archive/v2.5.1.tar.gz" + sha256: "62227595cc2b4c0c42ed35f17ef5b7487d8231aca9e75234a4c0e346cea19928" + "2.4.2": + url: "https://github.com/odygrd/quill/archive/v2.4.2.tar.gz" + sha256: "4771dc08c0ff01cea9081d645ed7cae27cfa073185c986177ef3ce13743136af" + "2.3.4": + url: "https://github.com/odygrd/quill/archive/v2.3.4.tar.gz" + sha256: "b44d345c07b3023fcd1b88fd9d2554429bb8cccb6285d703d0b0907d9aa85fa1" + "2.2.0": + url: "https://github.com/odygrd/quill/archive/v2.2.0.tar.gz" + sha256: "6b123b60b16d41009228d907851f025c8be974d5fcf41af0b6afbe48edebbf73" "2.1.0": url: "https://github.com/odygrd/quill/archive/v2.1.0.tar.gz" sha256: "66c59501ad827207e7d4682ccba0f1c33ca215269aa13a388df4d59ca195ee76" "2.0.2": url: "https://github.com/odygrd/quill/archive/v2.0.2.tar.gz" sha256: "d2dc9004886b787f8357e97d2f2d0c74a460259f7f95d65ab49d060fe34a9b5c" - "2.0.1": - url: "https://github.com/odygrd/quill/archive/v2.0.1.tar.gz" - sha256: "39527aca74edd02d9df0bba62211df9f6d53984d4f6cca470734e19c4d8b69fb" "1.7.3": url: "https://github.com/odygrd/quill/archive/v1.7.3.tar.gz" sha256: "3fff0c5ffb19bbde5429369079741f84a6acce3a781b504cec5e677b05461208" - "1.6.3": - url: "https://github.com/odygrd/quill/archive/v1.6.3.tar.gz" - sha256: "886120b084db952aafe651c64f459e69fec481b4e189c14daa8c4108afebcba3" - "1.5.2": - url: "https://github.com/odygrd/quill/archive/v1.5.2.tar.gz" - sha256: "e409fda0bd949e997f63de4d422a8f17ccc9cb0d58f11403bd309c7a93aa0d6b" diff --git a/recipes/quill/all/conanfile.py b/recipes/quill/all/conanfile.py index 1be0543d1ad3b..4151f27f06788 100644 --- a/recipes/quill/all/conanfile.py +++ b/recipes/quill/all/conanfile.py @@ -1,18 +1,22 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc + import os -import functools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class QuillConan(ConanFile): name = "quill" description = "Asynchronous Low Latency C++ Logging Library" - topics = ("quill", "logging", "log", "async") license = "MIT" - homepage = "https://github.com/odygrd/quill/" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt"] + homepage = "https://github.com/odygrd/quill/" + topics = ("quill", "logging", "log", "async") settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -24,15 +28,6 @@ class QuillConan(ConanFile): "with_bounded_queue": False, "with_no_exceptions": False, } - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" @property def _compilers_minimum_versions(self): @@ -57,79 +52,102 @@ def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if Version(self.version) >= "1.6.3": + self.requires("fmt/9.1.0") + else: + self.requires("fmt/7.1.3") + def validate(self): supported_archs = ["x86", "x86_64", "armv6", "armv7", "armv7hf", "armv8"] if not any(arch in str(self.settings.arch) for arch in supported_archs): - raise ConanInvalidConfiguration("{} is not supported by {}".format(self.settings.arch, self.name)) + raise ConanInvalidConfiguration(f"{self.settings.arch} is not supported by {self.ref}") - cxx_std = "17" if tools.Version(self.version) >= "2.0.0" else "14" + cxx_std = "17" if Version(self.version) >= "2.0.0" else "14" if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, cxx_std) + check_min_cppstd(self, cxx_std) compilers_minimum_version = self._compilers_minimum_versions[cxx_std] minimum_version = compilers_minimum_version.get(str(self.settings.compiler), False) if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++{}, which your compiler does not support.".format(self.name, cxx_std)) + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{cxx_std}, which your compiler does not support.") else: - self.output.warn("{} requires C++{}. Your compiler is unknown. Assuming it supports C++{}.".format(self.name, cxx_std, cxx_std)) + self.output.warning(f"{self.ref} requires C++{cxx_std}. Your compiler is unknown. Assuming it supports C++{cxx_std}.") - if tools.Version(self.version) >= "2.0.0" and \ - self.settings.compiler== "clang" and tools.Version(self.settings.compiler.version).major == "11" and \ + if Version(self.version) >= "2.0.0" and \ + self.settings.compiler== "clang" and Version(self.settings.compiler.version).major == "11" and \ self.settings.compiler.libcxx == "libstdc++": - raise ConanInvalidConfiguration("{}/{} requires C++ filesystem library, which your compiler doesn't support.".format(self.name, self.version)) - - def requirements(self): - if tools.Version(self.version) >= "1.6.3": - self.requires("fmt/9.0.0") - else: - self.requires("fmt/7.1.3") + raise ConanInvalidConfiguration(f"{self.ref} requires C++ filesystem library, which your compiler doesn't support.") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["QUILL_FMT_EXTERNAL"] = True - cmake.definitions["QUILL_ENABLE_INSTALL"] = True - cmake.definitions["QUILL_USE_BOUNDED_QUEUE"] = self.options.with_bounded_queue - cmake.definitions["QUILL_NO_EXCEPTIONS"] = self.options.with_no_exceptions - cmake.configure(build_folder=self._build_subfolder) - - return cmake + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def is_quilll_x86_arch(self): + if Version(self.version) < "2.7.0": + return False + if self.settings.arch not in ("x86", "x86_64"): + return False + if self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libc++": + return False + if is_msvc(self): + return False + return True + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["QUILL_FMT_EXTERNAL"] = True + tc.variables["QUILL_ENABLE_INSTALL"] = True + tc.variables["QUILL_USE_BOUNDED_QUEUE"] = self.options.with_bounded_queue + tc.variables["QUILL_NO_EXCEPTIONS"] = self.options.with_no_exceptions + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if self.is_quilll_x86_arch(): + tc.variables["QUILL_X86ARCH"] = True + tc.variables["CMAKE_CXX_FLAGS"] = "-mclflushopt" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + # remove bundled fmt + rmdir(self, os.path.join(self.source_folder, "quill", "quill", "include", "quill", "bundled", "fmt")) + rmdir(self, os.path.join(self.source_folder, "quill", "quill", "src", "bundled", "fmt")) - def build(self): - if tools.Version(self.version) >= "2.0.0": - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + if Version(self.version) >= "2.0.0": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), """set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/quill/cmake" CACHE STRING "Modules for CMake" FORCE)""", """set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_LIST_DIR}/quill/cmake")""" ) - # remove bundled fmt - tools.rmdir(os.path.join(self._source_subfolder, "quill", "quill", "include", "quill", "bundled", "fmt")) - tools.rmdir(os.path.join(self._source_subfolder, "quill", "quill", "src", "bundled", "fmt")) - - cmake = self._configure_cmake() + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) - self.cpp_info.defines = ["QUILL_FMT_EXTERNAL"] + self.cpp_info.libs = ["quill"] + self.cpp_info.defines.append("QUILL_FMT_EXTERNAL") + if self.is_quilll_x86_arch(): + self.cpp_info.defines.append("QUILL_X86ARCH") + self.cpp_info.cxxflags.append("-mclflushopt") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") - if tools.Version(self.version) >= "2.0.0" and \ - self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version).major == "8": + if Version(self.version) >= "2.0.0" and \ + self.settings.compiler == "gcc" and Version(self.settings.compiler.version).major == "8": self.cpp_info.system_libs.append("stdc++fs") diff --git a/recipes/quill/all/test_package/CMakeLists.txt b/recipes/quill/all/test_package/CMakeLists.txt index a2b17a0999cc0..d53c2b924044a 100644 --- a/recipes/quill/all/test_package/CMakeLists.txt +++ b/recipes/quill/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(quill REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} quill::quill) +target_link_libraries(${PROJECT_NAME} PRIVATE quill::quill) if(quill_VERSION VERSION_GREATER_EQUAL "2.0.0") target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) else() diff --git a/recipes/quill/all/test_package/conanfile.py b/recipes/quill/all/test_package/conanfile.py index a33d6d420c7f9..a9fb96656f203 100644 --- a/recipes/quill/all/test_package/conanfile.py +++ b/recipes/quill/all/test_package/conanfile.py @@ -1,9 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,7 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - tools.mkdir("logs/") - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/quill/all/test_package/test_package.cpp b/recipes/quill/all/test_package/test_package.cpp index 57c1adcf3ec97..db27c1e9dc225 100644 --- a/recipes/quill/all/test_package/test_package.cpp +++ b/recipes/quill/all/test_package/test_package.cpp @@ -3,7 +3,7 @@ int main() { quill::start(); - quill::Handler *file_handler = quill::file_handler("logs/logfile.log", "w"); + quill::Handler *file_handler = quill::file_handler("logfile.log", "w"); quill::Logger *my_logger = quill::create_logger("my_logger", file_handler); LOG_INFO(my_logger, "Hello from {}", "Quill"); diff --git a/recipes/quill/all/test_v1_package/CMakeLists.txt b/recipes/quill/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/quill/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/quill/all/test_v1_package/conanfile.py b/recipes/quill/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/quill/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/quill/config.yml b/recipes/quill/config.yml index 57285066d2137..f181f5c050b7e 100644 --- a/recipes/quill/config.yml +++ b/recipes/quill/config.yml @@ -1,13 +1,19 @@ versions: - "2.1.0": + "2.7.0": folder: "all" - "2.0.2": + "2.6.0": folder: "all" - "2.0.1": + "2.5.1": folder: "all" - "1.7.3": + "2.4.2": folder: "all" - "1.6.3": + "2.3.4": folder: "all" - "1.5.2": + "2.2.0": + folder: "all" + "2.1.0": + folder: "all" + "2.0.2": + folder: "all" + "1.7.3": folder: "all" diff --git a/recipes/quirc/all/conanfile.py b/recipes/quirc/all/conanfile.py index ecf7c55f369ff..fae8ea08285f2 100644 --- a/recipes/quirc/all/conanfile.py +++ b/recipes/quirc/all/conanfile.py @@ -1,16 +1,16 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class QuircConan(ConanFile): name = "quirc" description = "QR decoder library" license = "ISC" - topics = ("quirc", "qr", "decoder") + topics = ("qr", "decoder") homepage = "https://github.com/dlbeer/quirc" url = "https://github.com/conan-io/conan-center-index" @@ -28,8 +28,7 @@ class QuircConan(ConanFile): def export_sources(self): copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,15 +36,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/quirc/all/test_package/conanfile.py b/recipes/quirc/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/quirc/all/test_package/conanfile.py +++ b/recipes/quirc/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/quirc/all/test_v1_package/CMakeLists.txt b/recipes/quirc/all/test_v1_package/CMakeLists.txt index 41bc2a9f4573b..0d20897301b68 100644 --- a/recipes/quirc/all/test_v1_package/CMakeLists.txt +++ b/recipes/quirc/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(quirc REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE quirc::quirc) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/quirc/all/test_v1_package/conanfile.py b/recipes/quirc/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/quirc/all/test_v1_package/conanfile.py +++ b/recipes/quirc/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/qwt/all/conandata.yml b/recipes/qwt/all/conandata.yml index 634726952e06e..31f56157576c0 100644 --- a/recipes/qwt/all/conandata.yml +++ b/recipes/qwt/all/conandata.yml @@ -1,7 +1,9 @@ sources: - "6.1.6": - url: "https://sourceforge.net/projects/qwt/files/qwt/6.1.6/qwt-6.1.6.zip" - sha256: "4b2452662ae64656aca92f1bef44a281229f77056689100af62c4b9f24462873" "6.2.0": url: "https://sourceforge.net/projects/qwt/files/qwt/6.2.0/qwt-6.2.0.zip" sha256: "3e9632a9be6a883db5c496e42ce74cbbf8da02cc3328faa89e2c43e434a2eb76" +patches: + "6.2.0": + - patch_file: "patches/cmake-support.patch" + patch_source: "https://github.com/MehdiChinoune/qwt/blob/cmake/CMakeLists.txt" + - patch_file: "patches/cmake-support-patch.patch" diff --git a/recipes/qwt/all/conanfile.py b/recipes/qwt/all/conanfile.py index 0160ac03050f1..e2134db89385f 100644 --- a/recipes/qwt/all/conanfile.py +++ b/recipes/qwt/all/conanfile.py @@ -1,20 +1,27 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version import os -from conans import ConanFile, tools -required_conan_version = ">=1.40.1" # For https://github.com/conan-io/conan/pull/9568 +required_conan_version = ">=1.53.0" + class QwtConan(ConanFile): name = "qwt" license = "LGPL-2.1-or-later" url = "https://github.com/conan-io/conan-center-index" homepage = "https://qwt.sourceforge.io/" - topics = ("conan", "archive", "compression") + topics = ("archive", "compression") description = ( "The Qwt library contains GUI Components and utility classes which are primarily useful for programs " "with a technical background. Beside a framework for 2D plots it provides scales, sliders, dials, compasses, " "thermometers, wheels and knobs to control or display values, arrays, or ranges of type double." ) - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,29 +29,22 @@ class QwtConan(ConanFile): "widgets": [True, False], "svg": [True, False], "opengl": [True, False], - "mathml": [True, False], - "designer": [True, False] + "designer": [True, False], + "polar": [True, False], } default_options = { "shared": False, "fPIC": True, "plot": True, "widgets": True, + "svg": False, "opengl": True, - "designer": True, - "mathml": False, - "svg": False - + "designer": False, + "polar": True, } - generators = "qmake" - @property - def _source_subfolder(self): - return "source_subfolder" - - def build_requirements(self): - if self.settings.os == "Windows" and self.settings.compiler == "Visual Studio": - self.build_requires("jom/1.1.3") + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -52,69 +52,104 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("qt/5.15.2") + self.requires("qt/5.15.7") - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _patch_qwt_config_files(self): - # qwtconfig.pri - qwtconfig_path = os.path.join(self.source_folder, self._source_subfolder, "qwtconfig.pri") - qwtconfig = tools.load(qwtconfig_path) - - qwtconfig = "CONFIG += conan_basic_setup\ninclude(../conanbuildinfo.pri)\n" + qwtconfig - qwtconfig += "QWT_CONFIG {}= QwtDll\n".format("+" if self.options.shared else "-") - qwtconfig += "QWT_CONFIG {}= QwtPlot\n".format("+" if self.options.plot else "-") - qwtconfig += "QWT_CONFIG {}= QwtWidgets\n".format("+" if self.options.widgets else "-") - qwtconfig += "QWT_CONFIG {}= QwtSvg\n".format("+" if self.options.svg else "-") - qwtconfig += "QWT_CONFIG {}= QwtOpenGL\n".format("+" if self.options.opengl else "-") - qwtconfig += "QWT_CONFIG {}= QwtMathML\n".format("+" if self.options.mathml else "-") - qwtconfig += "QWT_CONFIG {}= QwtDesigner\n".format("+" if self.options.designer else "-") - tools.save(qwtconfig_path, qwtconfig) - - # qwtbuild.pri - qwtbuild_path = os.path.join(self.source_folder, self._source_subfolder, "qwtbuild.pri") - qwtbuild = tools.load(qwtbuild_path) - # set build type - qwtbuild += "CONFIG -= debug_and_release\n" - qwtbuild += "CONFIG -= build_all\n" - qwtbuild += "CONFIG -= release\n" - qwtbuild += "CONFIG += {}\n".format("debug" if self.settings.build_type == "Debug" else "release") - if self.settings.build_type == "RelWithDebInfo": - qwtbuild += "CONFIG += force_debug_info\n" - tools.save(qwtbuild_path, qwtbuild) + def validate(self): + if hasattr(self, "settings_build") and cross_building(self): + raise ConanInvalidConfiguration("Qwt recipe does not support cross-compilation yet") + qt_options = self.dependencies["qt"].options + if self.info.options.widgets and not qt_options.widgets: + raise ConanInvalidConfiguration("qwt:widgets=True requires qt:widgets=True") + if self.info.options.svg and not qt_options.qtsvg: + raise ConanInvalidConfiguration("qwt:svg=True requires qt:qtsvg=True") + if self.info.options.opengl and qt_options.opengl == "no": + raise ConanInvalidConfiguration("qwt:opengl=True is not compatible with qt:opengl=no") + if self.info.options.designer and not (qt_options.qttools and qt_options.gui and qt_options.widgets): + raise ConanInvalidConfiguration("qwt:designer=True requires qt:qttools=True, qt::gui=True and qt::widgets=True") - def build(self): - self._patch_qwt_config_files() + def build_requirements(self): + if hasattr(self, "settings_build") and cross_building(self): + self.tool_requires("qt/5.15.7") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - if self.settings.compiler == "Visual Studio": - vcvars = tools.vcvars_command(self.settings) - self.run("{} && qmake {}".format(vcvars, self._source_subfolder), run_environment=True) - self.run("{} && jom".format(vcvars)) + def generate(self): + if hasattr(self, "settings_build") and cross_building(self): + env = VirtualBuildEnv(self) + env.generate() else: - self.run("qmake {}".format(self._source_subfolder), run_environment=True) - self.run("make -j {}".format(tools.cpu_count())) + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = CMakeToolchain(self) + tc.variables["QWT_DLL"] = self.options.shared + tc.variables["QWT_STATIC "] = not self.options.shared + tc.variables["QWT_PLOT"] = self.options.plot + tc.variables["QWT_WIDGETS"] = self.options.widgets + tc.variables["QWT_SVG"] = self.options.svg + tc.variables["QWT_OPENGL"] =self.options.opengl + tc.variables["QWT_DESIGNER"] = self.options.designer + tc.variables["QWT_POLAR"] = self.options.polar + tc.variables["QWT_BUILD_PLAYGROUND"] = False + tc.variables["QWT_BUILD_EXAMPLES"] = False + tc.variables["QWT_BUILD_TESTS"] = False + tc.variables["QWT_FRAMEWORK"] = False + tc.variables["CMAKE_INSTALL_DATADIR"] = "res" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("COPYING", src=os.path.join(self._source_subfolder), dst="licenses") - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "src")) - self.copy("*.dll", dst="bin", keep_path=False) - self.copy("*.lib", dst="lib", keep_path=False) - self.copy("*.so*", dst="lib", keep_path=False, symlinks=True) - self.copy("*.dylib", dst="lib", keep_path=False) - self.copy("*.a", dst="lib", keep_path=False) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - postfix = "" - if self.settings.build_type == "Debug": - if self.settings.os == "Windows": - postfix += "d" - elif self.settings.os == "Macos": - postfix += "_debug" - self.cpp_info.libs = ["qwt" + postfix] - self.env_info.QT_PLUGIN_PATH.append(os.path.join(self.package_folder, 'bin')) - self.env_info.QT_PLUGIN_PATH.append(os.path.join(self.package_folder, 'lib')) - self.cpp_info.defines = ['HAVE_QWT', 'QWT_DLL'] if self.options.shared else ['HAVE_QWT'] + self.cpp_info.libs = ["qwt"] + self.cpp_info.requires = ["qt::qtCore", "qt::qtConcurrent", "qt::qtPrintSupport"] + if self.settings.os == "Windows" and self.options.shared: + self.cpp_info.defines.append("QWT_DLL") + if not self.options.plot: + self.cpp_info.defines.append("NO_QWT_PLOT") + if not self.options.polar: + self.cpp_info.defines.append("NO_QWT_POLAR") + if self.options.widgets: + self.cpp_info.requires.append("qt::qtWidgets") + else: + self.cpp_info.defines.append("NO_QWT_WIDGETS") + if self.options.opengl: + self.cpp_info.requires.append("qt::qtOpenGL") + if Version(self.dependencies["qt"].ref.version).major >= "6": + self.cpp_info.requires.append("qt::qtOpenGLWidgets") + else: + self.cpp_info.defines.append("QWT_NO_OPENGL") + if self.options.svg: + self.cpp_info.requires.append("qt::qtSvg") + else: + self.cpp_info.defines.append("QWT_NO_SVG") + + if self.options.designer: + qt_plugin_path = os.path.join( + self.package_folder, "res" if self.settings.os == "Windows" else "lib", + f"qt{Version(self.dependencies['qt'].ref.version).major}", "plugins", + ) + self.runenv_info.prepend_path("QT_PLUGIN_PATH", qt_plugin_path) + + # TODO: to remove in conan v2 + self.env_info.QT_PLUGIN_PATH.append(qt_plugin_path) diff --git a/recipes/qwt/all/patches/cmake-support-patch.patch b/recipes/qwt/all/patches/cmake-support-patch.patch new file mode 100644 index 0000000000000..af0f2ec3e1b37 --- /dev/null +++ b/recipes/qwt/all/patches/cmake-support-patch.patch @@ -0,0 +1,32 @@ +From fb0e2add3354cdf39dee7b58e6f6c88aba5d6793 Mon Sep 17 00:00:00 2001 +From: Esteban Dugueperoux + <43169544+EstebanDugueperoux2@users.noreply.github.com> +Date: Thu, 8 Sep 2022 11:10:47 +0000 +Subject: [PATCH] conan: Remove qwt include prefix + + - Remove qwt include prefix to be + compatible with current consumption + of 6.2.0 release through conan center. +--- + src/CMakeLists.txt | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index a6a4bf2..760f84c 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -419,10 +419,10 @@ install(FILES + ) + + install(FILES ${HEADERS} +- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qwt${QWT_NAME_SUFFIX} ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${QWT_NAME_SUFFIX} + ) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/classincludes/ +- DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qwt${QWT_NAME_SUFFIX} ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${QWT_NAME_SUFFIX} + PATTERN "classincludes.pro" EXCLUDE + ) + +-- +2.37.2 diff --git a/recipes/qwt/all/patches/cmake-support.patch b/recipes/qwt/all/patches/cmake-support.patch new file mode 100644 index 0000000000000..c303f0f00d8e7 --- /dev/null +++ b/recipes/qwt/all/patches/cmake-support.patch @@ -0,0 +1,1439 @@ +From eeda942e335afb509f297a1778b654e34d5e4c2b Mon Sep 17 00:00:00 2001 +From: Mehdi Chinoune +Date: Sun, 22 Aug 2021 16:14:37 +0100 +Subject: [PATCH] Support CMake buildsystem + +--- + CMakeLists.txt | 127 +++++++ + designer/CMakeLists.txt | 35 ++ + examples/CMakeLists.txt | 41 +++ + examples/animation/CMakeLists.txt | 8 + + examples/barchart/CMakeLists.txt | 8 + + examples/bode/CMakeLists.txt | 11 + + examples/controls/CMakeLists.txt | 22 ++ + examples/cpuplot/CMakeLists.txt | 12 + + examples/curvedemo/CMakeLists.txt | 4 + + examples/dials/CMakeLists.txt | 14 + + examples/distrowatch/CMakeLists.txt | 8 + + examples/friedberg/CMakeLists.txt | 10 + + examples/itemeditor/CMakeLists.txt | 12 + + examples/legends/CMakeLists.txt | 13 + + examples/oscilloscope/CMakeLists.txt | 18 + + examples/polardemo/CMakeLists.txt | 13 + + examples/polarspectrogram/CMakeLists.txt | 10 + + examples/radio/CMakeLists.txt | 10 + + examples/rasterview/CMakeLists.txt | 8 + + examples/realtime/CMakeLists.txt | 16 + + examples/refreshtest/CMakeLists.txt | 15 + + examples/scatterplot/CMakeLists.txt | 8 + + examples/simpleplot/CMakeLists.txt | 4 + + examples/sinusplot/CMakeLists.txt | 4 + + examples/spectrogram/CMakeLists.txt | 8 + + examples/splineeditor/CMakeLists.txt | 12 + + examples/stockchart/CMakeLists.txt | 14 + + examples/sysinfo/CMakeLists.txt | 4 + + examples/tvplot/CMakeLists.txt | 8 + + playground/CMakeLists.txt | 19 + + playground/curvetracker/CMakeLists.txt | 10 + + playground/graphicscale/CMakeLists.txt | 10 + + playground/plotmatrix/CMakeLists.txt | 8 + + playground/rescaler/CMakeLists.txt | 10 + + playground/scaleengine/CMakeLists.txt | 12 + + playground/shapes/CMakeLists.txt | 4 + + playground/svgmap/CMakeLists.txt | 9 + + playground/symbols/CMakeLists.txt | 4 + + playground/timescale/CMakeLists.txt | 13 + + playground/vectorfield/CMakeLists.txt | 4 + + src/CMakeLists.txt | 439 +++++++++++++++++++++++ + src/qwt-config.cmake.in | 17 + + src/qwt.pc.in | 12 + + tests/CMakeLists.txt | 4 + + tests/splineprof/CMakeLists.txt | 4 + + tests/splinetest/CMakeLists.txt | 4 + + 46 files changed, 1060 insertions(+) + create mode 100644 CMakeLists.txt + create mode 100644 designer/CMakeLists.txt + create mode 100644 examples/CMakeLists.txt + create mode 100644 examples/animation/CMakeLists.txt + create mode 100644 examples/barchart/CMakeLists.txt + create mode 100644 examples/bode/CMakeLists.txt + create mode 100644 examples/controls/CMakeLists.txt + create mode 100644 examples/cpuplot/CMakeLists.txt + create mode 100644 examples/curvedemo/CMakeLists.txt + create mode 100644 examples/dials/CMakeLists.txt + create mode 100644 examples/distrowatch/CMakeLists.txt + create mode 100644 examples/friedberg/CMakeLists.txt + create mode 100644 examples/itemeditor/CMakeLists.txt + create mode 100644 examples/legends/CMakeLists.txt + create mode 100644 examples/oscilloscope/CMakeLists.txt + create mode 100644 examples/polardemo/CMakeLists.txt + create mode 100644 examples/polarspectrogram/CMakeLists.txt + create mode 100644 examples/radio/CMakeLists.txt + create mode 100644 examples/rasterview/CMakeLists.txt + create mode 100644 examples/realtime/CMakeLists.txt + create mode 100644 examples/refreshtest/CMakeLists.txt + create mode 100644 examples/scatterplot/CMakeLists.txt + create mode 100644 examples/simpleplot/CMakeLists.txt + create mode 100644 examples/sinusplot/CMakeLists.txt + create mode 100644 examples/spectrogram/CMakeLists.txt + create mode 100644 examples/splineeditor/CMakeLists.txt + create mode 100644 examples/stockchart/CMakeLists.txt + create mode 100644 examples/sysinfo/CMakeLists.txt + create mode 100644 examples/tvplot/CMakeLists.txt + create mode 100644 playground/CMakeLists.txt + create mode 100644 playground/curvetracker/CMakeLists.txt + create mode 100644 playground/graphicscale/CMakeLists.txt + create mode 100644 playground/plotmatrix/CMakeLists.txt + create mode 100644 playground/rescaler/CMakeLists.txt + create mode 100644 playground/scaleengine/CMakeLists.txt + create mode 100644 playground/shapes/CMakeLists.txt + create mode 100644 playground/svgmap/CMakeLists.txt + create mode 100644 playground/symbols/CMakeLists.txt + create mode 100644 playground/timescale/CMakeLists.txt + create mode 100644 playground/vectorfield/CMakeLists.txt + create mode 100644 src/CMakeLists.txt + create mode 100644 src/qwt-config.cmake.in + create mode 100644 src/qwt.pc.in + create mode 100644 tests/CMakeLists.txt + create mode 100644 tests/splineprof/CMakeLists.txt + create mode 100644 tests/splinetest/CMakeLists.txt + +diff --git a/CMakeLists.txt b/CMakeLists.txt +new file mode 100644 +index 0000000..004d4a3 +--- /dev/null ++++ b/CMakeLists.txt +@@ -0,0 +1,127 @@ ++cmake_minimum_required(VERSION 3.15) ++ ++project(Qwt ++ VERSION 6.2.0 ++ DESCRIPTION "Qt Widgets for Technical Applications" ++ HOMEPAGE_URL "https://qwt.sourceforge.io" ++ LANGUAGES CXX ++) ++ ++set(CMAKE_CXX_STANDARD 11) ++set(CMAKE_CXX_STANDARD_REQUIRED TRUE) ++set(CMAKE_CXX_EXTENSIONS OFF) ++ ++if(MSVC) ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4 /permissive-") ++else() ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic -Wcast-qual \ ++ -Wcast-align -Wredundant-decls -Wformat -Wshadow -Woverloaded-virtual \ ++ -fno-math-errno -funsafe-math-optimizations") ++ if(CMAKE_COMPILER_ID STREQUAL "GNU") ++ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wlogical-op") ++ endif() ++ add_compile_definitions(QT_STRICT_ITERATORS) ++endif() ++ ++include(CheckPIESupported) ++check_pie_supported(OUTPUT_VARIABLE PIE_MESSAGE LANGUAGES CXX) ++if(CMAKE_CXX_LINK_PIE_SUPPORTED) ++ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE) ++endif() ++ ++include(GNUInstallDirs) ++ ++set(QWT_NAME_SUFFIX "" CACHE STRING "Qwt Name Suffix") ++ ++set(QWT_QT_VERSION_MAJOR "A" CACHE ++ STRING "Expected Qt major version. Valid values are A (auto-select), 5, 6.") ++set(SUPPORTED_QT_VERSIONS "A" 5 6) ++set_property(CACHE QWT_QT_VERSION_MAJOR PROPERTY STRINGS ${SUPPORTED_QT_VERSIONS}) ++if(NOT QWT_QT_VERSION_MAJOR STREQUAL "A") ++ if(NOT QWT_QT_VERSION_MAJOR IN_LIST SUPPORTED_QT_VERSIONS) ++ message(FATAL_ERROR "Supported Qt versions are \"${SUPPORTED_QT_VERSIONS}\"." ++ " But QWT_QT_VERSION_MAJOR is set to ${QWT_QT_VERSION_MAJOR}.") ++ endif() ++endif() ++ ++option(QWT_DLL "Build shared library" ON) ++ ++option(QWT_STATIC "Build static library" OFF) ++ ++if(NOT (QWT_DLL OR QWT_STATIC)) ++ message(FATAL_ERROR "QWT_DLL and QWT_STATIC are both set to OFF") ++endif() ++ ++option(QWT_PLOT "Enable QwtPlot widget" ON) ++ ++option(QWT_POLAR "Enable QwtPolar classes" ON) ++ ++option(QWT_WIDGETS "Enables other widgets (sliders, dials, ...), beside QwtPlot" ON) ++ ++option(QWT_SVG "Enable SVG Support (Displaying & Exporting)" ON) ++ ++option(QWT_OPENGL "Enable OpenGL Plot Canvas" ON) ++ ++option(QWT_DESIGNER "Build Qwt Designer plugin" ON) ++ ++if(WIN32) ++ option(QWT_DESIGNER_SELF_CONTAINED "Build a self-contained designer plugin" ON) ++endif() ++ ++if(APPLE) ++ option(QWT_FRAMEWORK "Build Qwt as a framework" ON) ++endif() ++ ++option(QWT_BUILD_PLAYGROUND "Build the applications in playground" OFF) ++ ++option(QWT_BUILD_TESTS "Build Tests" OFF) ++ ++option(QWT_BUILD_EXAMPLES "Build Examples" OFF) ++ ++if(QWT_QT_VERSION_MAJOR STREQUAL "A") ++ find_package(Qt6 COMPONENTS Core QUIET) ++ if(Qt6_FOUND) ++ set(QT_VERSION ${Qt6_VERSION}) ++ set(QT_VERSION_MAJOR 6) ++ else() ++ find_package(Qt5 COMPONENTS Core REQUIRED) ++ set(QT_VERSION ${Qt5_VERSION}) ++ set(QT_VERSION_MAJOR 5) ++ endif() ++else() ++ find_package(Qt${QWT_QT_VERSION_MAJOR} COMPONENTS Core REQUIRED) ++ set(QT_VERSION ${Qt${QWT_QT_VERSION_MAJOR}_VERSION}) ++ set(QT_VERSION_MAJOR ${QWT_QT_VERSION_MAJOR}) ++endif() ++ ++find_package(Qt${QT_VERSION_MAJOR} COMPONENTS PrintSupport Concurrent Widgets REQUIRED) ++ ++if(QWT_OPENGL) ++ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGL REQUIRED) ++ if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) ++ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS OpenGLWidgets REQUIRED) ++ endif() ++endif() ++ ++if(QWT_SVG) ++ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Svg REQUIRED) ++endif() ++ ++add_subdirectory(src) ++ ++if(QWT_DESIGNER) ++ find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Designer) ++ add_subdirectory(designer) ++endif() ++ ++if(QWT_BUILD_PLAYGROUND) ++ add_subdirectory(playground) ++endif() ++ ++if(QWT_BUILD_TESTS) ++ add_subdirectory(tests) ++endif() ++ ++if(QWT_BUILD_EXAMPLES) ++ add_subdirectory(examples) ++endif() +diff --git a/designer/CMakeLists.txt b/designer/CMakeLists.txt +new file mode 100644 +index 0000000..aa81efd +--- /dev/null ++++ b/designer/CMakeLists.txt +@@ -0,0 +1,35 @@ ++if(QWT_DESIGNER_SELF_CONTAINED) ++ add_library(qwt_designer_plugin SHARED ++ qwt_designer_plugin.cpp ++ qwt_designer_plugin.qrc ++ $ ++ ) ++ target_link_libraries(qwt_designer_plugin PRIVATE qwt_objects) ++ target_compile_definitions(qwt_designer_plugin PRIVATE ++ QWT_MAKEDLL ++ QT_NO_KEYWORDS ++ QWT_MOC_INCLUDE ++ ) ++else() ++ add_library(qwt_designer_plugin SHARED ++ qwt_designer_plugin.cpp ++ qwt_designer_plugin.qrc ++ ) ++ target_link_libraries(qwt_designer_plugin PRIVATE qwt) ++endif() ++ ++target_link_libraries(qwt_designer_plugin PUBLIC Qt${QT_VERSION_MAJOR}::Designer) ++ ++set_target_properties(qwt_designer_plugin PROPERTIES ++ AUTOMOC ON ++ AUTORCC ON ++) ++ ++if(MINGW) ++ set_target_properties(qwt_designer_plugin PROPERTIES PREFIX "") ++endif() ++ ++install(TARGETS qwt_designer_plugin ++ RUNTIME DESTINATION ${CMAKE_INSTALL_DATADIR}/qt${QT_VERSION_MAJOR}/plugins/designer ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}/qt${QT_VERSION_MAJOR}/plugins/designer ++) +diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt +new file mode 100644 +index 0000000..522436c +--- /dev/null ++++ b/examples/CMakeLists.txt +@@ -0,0 +1,41 @@ ++ ++set(CMAKE_AUTOMOC ON) ++ ++if(QWT_PLOT) ++ add_subdirectory(animation) ++ add_subdirectory(barchart) ++ add_subdirectory(cpuplot) ++ add_subdirectory(curvedemo) ++ add_subdirectory(distrowatch) ++ add_subdirectory(friedberg) ++ add_subdirectory(itemeditor) ++ add_subdirectory(legends) ++ add_subdirectory(stockchart) ++ add_subdirectory(simpleplot) ++ add_subdirectory(sinusplot) ++ add_subdirectory(realtime) ++ add_subdirectory(refreshtest) ++ add_subdirectory(scatterplot) ++ add_subdirectory(spectrogram) ++ add_subdirectory(rasterview) ++ add_subdirectory(tvplot) ++ ++ if(QWT_WIDGETS) ++ add_subdirectory(bode) ++ add_subdirectory(splineeditor) ++ add_subdirectory(oscilloscope) ++ endif() ++ ++ if(QWT_POLAR) ++ add_subdirectory(polardemo) ++ add_subdirectory(polarspectrogram) ++ endif() ++ ++endif() ++ ++if(QWT_WIDGETS) ++ add_subdirectory(sysinfo) ++ add_subdirectory(radio) ++ add_subdirectory(dials) ++ add_subdirectory(controls) ++endif() +diff --git a/examples/animation/CMakeLists.txt b/examples/animation/CMakeLists.txt +new file mode 100644 +index 0000000..b5559c6 +--- /dev/null ++++ b/examples/animation/CMakeLists.txt +@@ -0,0 +1,8 @@ ++ ++add_executable(animation ++ main.cpp ++ Plot.cpp ++ Plot.h ++) ++ ++target_link_libraries(animation qwt) +diff --git a/examples/barchart/CMakeLists.txt b/examples/barchart/CMakeLists.txt +new file mode 100644 +index 0000000..e09a78a +--- /dev/null ++++ b/examples/barchart/CMakeLists.txt +@@ -0,0 +1,8 @@ ++ ++add_executable(barchart ++ main.cpp ++ BarChart.cpp ++ BarChart.h ++) ++ ++target_link_libraries(barchart qwt) +diff --git a/examples/bode/CMakeLists.txt b/examples/bode/CMakeLists.txt +new file mode 100644 +index 0000000..d0a7d77 +--- /dev/null ++++ b/examples/bode/CMakeLists.txt +@@ -0,0 +1,11 @@ ++ ++add_executable(bode ++ main.cpp ++ MainWindow.cpp ++ MainWindow.h ++ Pixmaps.h ++ Plot.cpp ++ Plot.h ++) ++ ++target_link_libraries(bode qwt) +diff --git a/examples/controls/CMakeLists.txt b/examples/controls/CMakeLists.txt +new file mode 100644 +index 0000000..c6467ed +--- /dev/null ++++ b/examples/controls/CMakeLists.txt +@@ -0,0 +1,22 @@ ++ ++add_executable(controls ++ main.cpp ++ SliderBox.h ++ SliderTab.h ++ WheelBox.h ++ WheelTab.h ++ KnobBox.h ++ KnobTab.h ++ DialBox.h ++ DialTab.h ++ SliderBox.cpp ++ SliderTab.cpp ++ WheelBox.cpp ++ WheelTab.cpp ++ KnobBox.cpp ++ KnobTab.cpp ++ DialBox.cpp ++ DialTab.cpp ++) ++ ++target_link_libraries(controls qwt) +diff --git a/examples/cpuplot/CMakeLists.txt b/examples/cpuplot/CMakeLists.txt +new file mode 100644 +index 0000000..9eecb0a +--- /dev/null ++++ b/examples/cpuplot/CMakeLists.txt +@@ -0,0 +1,12 @@ ++ ++add_executable(cpuplot ++ main.cpp ++ CpuPieMarker.cpp ++ CpuPieMarker.h ++ CpuPlot.cpp ++ CpuPlot.h ++ CpuStat.cpp ++ CpuStat.h ++) ++ ++target_link_libraries(cpuplot qwt) +diff --git a/examples/curvedemo/CMakeLists.txt b/examples/curvedemo/CMakeLists.txt +new file mode 100644 +index 0000000..75b6514 +--- /dev/null ++++ b/examples/curvedemo/CMakeLists.txt +@@ -0,0 +1,4 @@ ++ ++add_executable(curvedemo main.cpp) ++ ++target_link_libraries(curvedemo qwt) +diff --git a/examples/dials/CMakeLists.txt b/examples/dials/CMakeLists.txt +new file mode 100644 +index 0000000..5f2ca85 +--- /dev/null ++++ b/examples/dials/CMakeLists.txt +@@ -0,0 +1,14 @@ ++ ++add_executable(dials ++ main.cpp ++ AttitudeIndicator.h ++ SpeedoMeter.h ++ CockpitGrid.h ++ CompassGrid.h ++ AttitudeIndicator.cpp ++ SpeedoMeter.cpp ++ CockpitGrid.cpp ++ CompassGrid.cpp ++) ++ ++target_link_libraries(dials qwt) +diff --git a/examples/distrowatch/CMakeLists.txt b/examples/distrowatch/CMakeLists.txt +new file mode 100644 +index 0000000..c9b7e02 +--- /dev/null ++++ b/examples/distrowatch/CMakeLists.txt +@@ -0,0 +1,8 @@ ++ ++add_executable(distrowatch ++ main.cpp ++ BarChart.cpp ++ BarChart.h ++) ++ ++target_link_libraries(distrowatch qwt) +diff --git a/examples/friedberg/CMakeLists.txt b/examples/friedberg/CMakeLists.txt +new file mode 100644 +index 0000000..322b631 +--- /dev/null ++++ b/examples/friedberg/CMakeLists.txt +@@ -0,0 +1,10 @@ ++ ++add_executable(friedberg ++ main.cpp ++ Friedberg2007.h ++ Friedberg2007.cpp ++ Plot.h ++ Plot.cpp ++) ++ ++target_link_libraries(friedberg qwt) +diff --git a/examples/itemeditor/CMakeLists.txt b/examples/itemeditor/CMakeLists.txt +new file mode 100644 +index 0000000..0d2df52 +--- /dev/null ++++ b/examples/itemeditor/CMakeLists.txt +@@ -0,0 +1,12 @@ ++ ++add_executable(itemeditor ++ main.cpp ++ Editor.h ++ ShapeFactory.h ++ Plot.h ++ Editor.cpp ++ ShapeFactory.cpp ++ Plot.cpp ++) ++ ++target_link_libraries(itemeditor qwt) +diff --git a/examples/legends/CMakeLists.txt b/examples/legends/CMakeLists.txt +new file mode 100644 +index 0000000..7ad01b3 +--- /dev/null ++++ b/examples/legends/CMakeLists.txt +@@ -0,0 +1,13 @@ ++ ++add_executable(legends ++ main.cpp ++ MainWindow.h ++ Panel.h ++ Settings.h ++ Plot.h ++ MainWindow.cpp ++ Panel.cpp ++ Plot.cpp ++) ++ ++target_link_libraries(legends qwt) +diff --git a/examples/oscilloscope/CMakeLists.txt b/examples/oscilloscope/CMakeLists.txt +new file mode 100644 +index 0000000..828b8fe +--- /dev/null ++++ b/examples/oscilloscope/CMakeLists.txt +@@ -0,0 +1,18 @@ ++ ++add_executable(oscilloscope ++ main.cpp ++ SignalData.h ++ Plot.h ++ Knob.h ++ WheelBox.h ++ SamplingThread.h ++ MainWindow.h ++ SignalData.cpp ++ Plot.cpp ++ Knob.cpp ++ WheelBox.cpp ++ SamplingThread.cpp ++ MainWindow.cpp ++) ++ ++target_link_libraries(oscilloscope qwt) +diff --git a/examples/polardemo/CMakeLists.txt b/examples/polardemo/CMakeLists.txt +new file mode 100644 +index 0000000..3683dfd +--- /dev/null ++++ b/examples/polardemo/CMakeLists.txt +@@ -0,0 +1,13 @@ ++ ++add_executable(polardemo ++ main.cpp ++ Pixmaps.h ++ PlotBox.h ++ Plot.h ++ SettingsEditor.h ++ PlotBox.cpp ++ Plot.cpp ++ SettingsEditor.cpp ++) ++ ++target_link_libraries(polardemo qwt) +diff --git a/examples/polarspectrogram/CMakeLists.txt b/examples/polarspectrogram/CMakeLists.txt +new file mode 100644 +index 0000000..e4a1c22 +--- /dev/null ++++ b/examples/polarspectrogram/CMakeLists.txt +@@ -0,0 +1,10 @@ ++ ++add_executable(polarspectrogram ++ main.cpp ++ Plot.h ++ PlotWindow.h ++ Plot.cpp ++ PlotWindow.cpp ++) ++ ++target_link_libraries(polarspectrogram qwt) +diff --git a/examples/radio/CMakeLists.txt b/examples/radio/CMakeLists.txt +new file mode 100644 +index 0000000..00ed82c +--- /dev/null ++++ b/examples/radio/CMakeLists.txt +@@ -0,0 +1,10 @@ ++ ++add_executable(radio ++ main.cpp ++ AmplifierBox.h ++ TunerBox.h ++ AmplifierBox.cpp ++ TunerBox.cpp ++) ++ ++target_link_libraries(radio qwt) +diff --git a/examples/rasterview/CMakeLists.txt b/examples/rasterview/CMakeLists.txt +new file mode 100644 +index 0000000..7c21eb8 +--- /dev/null ++++ b/examples/rasterview/CMakeLists.txt +@@ -0,0 +1,8 @@ ++ ++add_executable(rasterview ++ main.cpp ++ Plot.h ++ Plot.cpp ++) ++ ++target_link_libraries(rasterview qwt) +diff --git a/examples/realtime/CMakeLists.txt b/examples/realtime/CMakeLists.txt +new file mode 100644 +index 0000000..8a01943 +--- /dev/null ++++ b/examples/realtime/CMakeLists.txt +@@ -0,0 +1,16 @@ ++ ++add_executable(realtime ++ main.cpp ++ ScrollZoomer.h ++ ScrollBar.h ++ IncrementalPlot.h ++ RandomPlot.h ++ MainWindow.h ++ ScrollZoomer.cpp ++ ScrollBar.cpp ++ IncrementalPlot.cpp ++ RandomPlot.cpp ++ MainWindow.cpp ++) ++ ++target_link_libraries(realtime qwt) +diff --git a/examples/refreshtest/CMakeLists.txt b/examples/refreshtest/CMakeLists.txt +new file mode 100644 +index 0000000..7100f79 +--- /dev/null ++++ b/examples/refreshtest/CMakeLists.txt +@@ -0,0 +1,15 @@ ++ ++add_executable(refreshtest ++ main.cpp ++ Settings.h ++ CircularBuffer.h ++ Panel.h ++ Plot.h ++ MainWindow.h ++ CircularBuffer.cpp ++ Panel.cpp ++ Plot.cpp ++ MainWindow.cpp ++) ++ ++target_link_libraries(refreshtest qwt) +diff --git a/examples/scatterplot/CMakeLists.txt b/examples/scatterplot/CMakeLists.txt +new file mode 100644 +index 0000000..02b5efb +--- /dev/null ++++ b/examples/scatterplot/CMakeLists.txt +@@ -0,0 +1,8 @@ ++ ++add_executable(scatterplot ++ main.cpp ++ Plot.h ++ Plot.cpp ++) ++ ++target_link_libraries(scatterplot qwt) +diff --git a/examples/simpleplot/CMakeLists.txt b/examples/simpleplot/CMakeLists.txt +new file mode 100644 +index 0000000..27fdfb8 +--- /dev/null ++++ b/examples/simpleplot/CMakeLists.txt +@@ -0,0 +1,4 @@ ++ ++add_executable(simpleplot main.cpp) ++ ++target_link_libraries(simpleplot qwt) +diff --git a/examples/sinusplot/CMakeLists.txt b/examples/sinusplot/CMakeLists.txt +new file mode 100644 +index 0000000..a6ce2be +--- /dev/null ++++ b/examples/sinusplot/CMakeLists.txt +@@ -0,0 +1,4 @@ ++ ++add_executable(sinusplot main.cpp) ++ ++target_link_libraries(sinusplot qwt) +diff --git a/examples/spectrogram/CMakeLists.txt b/examples/spectrogram/CMakeLists.txt +new file mode 100644 +index 0000000..134be44 +--- /dev/null ++++ b/examples/spectrogram/CMakeLists.txt +@@ -0,0 +1,8 @@ ++ ++add_executable(spectrogram ++ main.cpp ++ Plot.h ++ Plot.cpp ++) ++ ++target_link_libraries(spectrogram qwt) +diff --git a/examples/splineeditor/CMakeLists.txt b/examples/splineeditor/CMakeLists.txt +new file mode 100644 +index 0000000..2231f64 +--- /dev/null ++++ b/examples/splineeditor/CMakeLists.txt +@@ -0,0 +1,12 @@ ++ ++add_executable(splineeditor ++ main.cpp ++ ScalePicker.h ++ CanvasPicker.h ++ Plot.h ++ ScalePicker.cpp ++ CanvasPicker.cpp ++ Plot.cpp ++) ++ ++target_link_libraries(splineeditor qwt) +diff --git a/examples/stockchart/CMakeLists.txt b/examples/stockchart/CMakeLists.txt +new file mode 100644 +index 0000000..ca4f4c8 +--- /dev/null ++++ b/examples/stockchart/CMakeLists.txt +@@ -0,0 +1,14 @@ ++ ++add_executable(stockchart ++ main.cpp ++ Legend.h ++ GridItem.h ++ Plot.h ++ QuoteFactory.h ++ Legend.cpp ++ GridItem.cpp ++ Plot.cpp ++ QuoteFactory.cpp ++) ++ ++target_link_libraries(stockchart qwt) +diff --git a/examples/sysinfo/CMakeLists.txt b/examples/sysinfo/CMakeLists.txt +new file mode 100644 +index 0000000..954e9f0 +--- /dev/null ++++ b/examples/sysinfo/CMakeLists.txt +@@ -0,0 +1,4 @@ ++ ++add_executable(sysinfo main.cpp) ++ ++target_link_libraries(sysinfo qwt) +diff --git a/examples/tvplot/CMakeLists.txt b/examples/tvplot/CMakeLists.txt +new file mode 100644 +index 0000000..8224c3b +--- /dev/null ++++ b/examples/tvplot/CMakeLists.txt +@@ -0,0 +1,8 @@ ++ ++add_executable(tvplot ++ main.cpp ++ TVPlot.h ++ TVPlot.cpp ++) ++ ++target_link_libraries(tvplot qwt) +diff --git a/playground/CMakeLists.txt b/playground/CMakeLists.txt +new file mode 100644 +index 0000000..8384661 +--- /dev/null ++++ b/playground/CMakeLists.txt +@@ -0,0 +1,19 @@ ++ ++set(CMAKE_AUTOMOC ON) ++ ++if(QWT_PLOT) ++ add_subdirectory(plotmatrix) ++ add_subdirectory(timescale) ++ add_subdirectory(scaleengine) ++ add_subdirectory(rescaler) ++ add_subdirectory(shapes) ++ add_subdirectory(curvetracker) ++ add_subdirectory(vectorfield) ++ add_subdirectory(symbols) ++ ++ if(QWT_SVG) ++ add_subdirectory(svgmap) ++ add_subdirectory(graphicscale) ++ endif() ++ ++endif() +diff --git a/playground/curvetracker/CMakeLists.txt b/playground/curvetracker/CMakeLists.txt +new file mode 100644 +index 0000000..9440612 +--- /dev/null ++++ b/playground/curvetracker/CMakeLists.txt +@@ -0,0 +1,10 @@ ++ ++add_executable(curvetracker ++ main.cpp ++ CurveTracker.cpp ++ CurveTracker.h ++ Plot.cpp ++ Plot.h ++) ++ ++target_link_libraries(curvetracker qwt) +diff --git a/playground/graphicscale/CMakeLists.txt b/playground/graphicscale/CMakeLists.txt +new file mode 100644 +index 0000000..32c580b +--- /dev/null ++++ b/playground/graphicscale/CMakeLists.txt +@@ -0,0 +1,10 @@ ++ ++add_executable(graphicscale ++ main.cpp ++ Canvas.cpp ++ Canvas.h ++ MainWindow.cpp ++ MainWindow.h ++) ++ ++target_link_libraries(graphicscale qwt) +diff --git a/playground/plotmatrix/CMakeLists.txt b/playground/plotmatrix/CMakeLists.txt +new file mode 100644 +index 0000000..d85a098 +--- /dev/null ++++ b/playground/plotmatrix/CMakeLists.txt +@@ -0,0 +1,8 @@ ++ ++add_executable(plotmatrix ++ main.cpp ++ PlotMatrix.cpp ++ PlotMatrix.h ++) ++ ++target_link_libraries(plotmatrix qwt) +diff --git a/playground/rescaler/CMakeLists.txt b/playground/rescaler/CMakeLists.txt +new file mode 100644 +index 0000000..34d1ca7 +--- /dev/null ++++ b/playground/rescaler/CMakeLists.txt +@@ -0,0 +1,10 @@ ++ ++add_executable(rescaler ++ main.cpp ++ MainWindow.cpp ++ MainWindow.h ++ Plot.cpp ++ Plot.h ++) ++ ++target_link_libraries(rescaler qwt) +diff --git a/playground/scaleengine/CMakeLists.txt b/playground/scaleengine/CMakeLists.txt +new file mode 100644 +index 0000000..07ff410 +--- /dev/null ++++ b/playground/scaleengine/CMakeLists.txt +@@ -0,0 +1,12 @@ ++ ++add_executable(scaleengine ++ main.cpp ++ MainWindow.cpp ++ MainWindow.h ++ Plot.cpp ++ Plot.h ++ TransformPlot.cpp ++ TransformPlot.h ++) ++ ++target_link_libraries(scaleengine qwt) +diff --git a/playground/shapes/CMakeLists.txt b/playground/shapes/CMakeLists.txt +new file mode 100644 +index 0000000..bd25989 +--- /dev/null ++++ b/playground/shapes/CMakeLists.txt +@@ -0,0 +1,4 @@ ++ ++add_executable(shapes main.cpp) ++ ++target_link_libraries(shapes qwt) +diff --git a/playground/svgmap/CMakeLists.txt b/playground/svgmap/CMakeLists.txt +new file mode 100644 +index 0000000..0306537 +--- /dev/null ++++ b/playground/svgmap/CMakeLists.txt +@@ -0,0 +1,9 @@ ++ ++add_executable(svgmap ++ main.cpp ++ Plot.cpp ++ Plot.h ++ svgmap.qrc ++) ++ ++target_link_libraries(svgmap qwt) +diff --git a/playground/symbols/CMakeLists.txt b/playground/symbols/CMakeLists.txt +new file mode 100644 +index 0000000..77084a0 +--- /dev/null ++++ b/playground/symbols/CMakeLists.txt +@@ -0,0 +1,4 @@ ++ ++add_executable(symbols main.cpp) ++ ++target_link_libraries(symbols qwt) +diff --git a/playground/timescale/CMakeLists.txt b/playground/timescale/CMakeLists.txt +new file mode 100644 +index 0000000..cfd8968 +--- /dev/null ++++ b/playground/timescale/CMakeLists.txt +@@ -0,0 +1,13 @@ ++ ++add_executable(timescale ++ main.cpp ++ MainWindow.cpp ++ MainWindow.h ++ Panel.cpp ++ Panel.h ++ Plot.cpp ++ Plot.h ++ Settings.h ++) ++ ++target_link_libraries(timescale qwt) +diff --git a/playground/vectorfield/CMakeLists.txt b/playground/vectorfield/CMakeLists.txt +new file mode 100644 +index 0000000..ea78d87 +--- /dev/null ++++ b/playground/vectorfield/CMakeLists.txt +@@ -0,0 +1,4 @@ ++ ++add_executable(vectorfield main.cpp) ++ ++target_link_libraries(vectorfield qwt) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +new file mode 100644 +index 0000000..a6a4bf2 +--- /dev/null ++++ b/src/CMakeLists.txt +@@ -0,0 +1,439 @@ ++set(HEADERS ++ qwt.h ++ qwt_abstract_scale_draw.h ++ qwt_bezier.h ++ qwt_clipper.h ++ qwt_color_map.h ++ qwt_column_symbol.h ++ qwt_date.h ++ qwt_date_scale_draw.h ++ qwt_date_scale_engine.h ++ qwt_dyngrid_layout.h ++ qwt_global.h ++ qwt_graphic.h ++ qwt_interval.h ++ qwt_interval_symbol.h ++ qwt_math.h ++ qwt_magnifier.h ++ qwt_null_paintdevice.h ++ qwt_painter.h ++ qwt_painter_command.h ++ qwt_panner.h ++ qwt_picker.h ++ qwt_picker_machine.h ++ qwt_pixel_matrix.h ++ qwt_point_3d.h ++ qwt_point_polar.h ++ qwt_round_scale_draw.h ++ qwt_scale_div.h ++ qwt_scale_draw.h ++ qwt_scale_engine.h ++ qwt_scale_map.h ++ qwt_spline.h ++ qwt_spline_basis.h ++ qwt_spline_parametrization.h ++ qwt_spline_local.h ++ qwt_spline_cubic.h ++ qwt_spline_pleasing.h ++ qwt_spline_polynomial.h ++ qwt_symbol.h ++ qwt_system_clock.h ++ qwt_text_engine.h ++ qwt_text_label.h ++ qwt_text.h ++ qwt_transform.h ++ qwt_widget_overlay.h ++) ++set(SOURCES ++ qwt.cpp ++ qwt_abstract_scale_draw.cpp ++ qwt_bezier.cpp ++ qwt_clipper.cpp ++ qwt_color_map.cpp ++ qwt_column_symbol.cpp ++ qwt_date.cpp ++ qwt_date_scale_draw.cpp ++ qwt_date_scale_engine.cpp ++ qwt_dyngrid_layout.cpp ++ qwt_event_pattern.cpp ++ qwt_graphic.cpp ++ qwt_interval.cpp ++ qwt_interval_symbol.cpp ++ qwt_math.cpp ++ qwt_magnifier.cpp ++ qwt_null_paintdevice.cpp ++ qwt_painter.cpp ++ qwt_painter_command.cpp ++ qwt_panner.cpp ++ qwt_picker.cpp ++ qwt_picker_machine.cpp ++ qwt_pixel_matrix.cpp ++ qwt_point_3d.cpp ++ qwt_point_polar.cpp ++ qwt_round_scale_draw.cpp ++ qwt_scale_div.cpp ++ qwt_scale_draw.cpp ++ qwt_scale_map.cpp ++ qwt_scale_engine.cpp ++ qwt_spline.cpp ++ qwt_spline_basis.cpp ++ qwt_spline_parametrization.cpp ++ qwt_spline_local.cpp ++ qwt_spline_cubic.cpp ++ qwt_spline_pleasing.cpp ++ qwt_spline_polynomial.cpp ++ qwt_symbol.cpp ++ qwt_system_clock.cpp ++ qwt_text_engine.cpp ++ qwt_text_label.cpp ++ qwt_text.cpp ++ qwt_transform.cpp ++ qwt_widget_overlay.cpp ++) ++ ++if(QWT_PLOT) ++ list(APPEND HEADERS ++ qwt_axis.h ++ qwt_axis_id.h ++ qwt_curve_fitter.h ++ qwt_spline_curve_fitter.h ++ qwt_weeding_curve_fitter.h ++ qwt_event_pattern.h ++ qwt_abstract_legend.h ++ qwt_legend.h ++ qwt_legend_data.h ++ qwt_legend_label.h ++ qwt_plot.h ++ qwt_plot_renderer.h ++ qwt_plot_curve.h ++ qwt_plot_dict.h ++ qwt_plot_directpainter.h ++ qwt_plot_graphicitem.h ++ qwt_plot_grid.h ++ qwt_plot_histogram.h ++ qwt_plot_item.h ++ qwt_plot_abstract_barchart.h ++ qwt_plot_barchart.h ++ qwt_plot_multi_barchart.h ++ qwt_plot_intervalcurve.h ++ qwt_plot_tradingcurve.h ++ qwt_plot_layout.h ++ qwt_plot_marker.h ++ qwt_plot_zoneitem.h ++ qwt_plot_textlabel.h ++ qwt_plot_rasteritem.h ++ qwt_plot_spectrogram.h ++ qwt_plot_spectrocurve.h ++ qwt_plot_scaleitem.h ++ qwt_plot_legenditem.h ++ qwt_plot_seriesitem.h ++ qwt_plot_shapeitem.h ++ qwt_plot_vectorfield.h ++ qwt_plot_abstract_canvas.h ++ qwt_plot_canvas.h ++ qwt_plot_panner.h ++ qwt_plot_picker.h ++ qwt_plot_zoomer.h ++ qwt_plot_magnifier.h ++ qwt_plot_rescaler.h ++ qwt_point_mapper.h ++ qwt_raster_data.h ++ qwt_matrix_raster_data.h ++ qwt_vectorfield_symbol.h ++ qwt_sampling_thread.h ++ qwt_samples.h ++ qwt_series_data.h ++ qwt_series_store.h ++ qwt_point_data.h ++ qwt_scale_widget.h ++ ) ++ list(APPEND SOURCES ++ qwt_curve_fitter.cpp ++ qwt_spline_curve_fitter.cpp ++ qwt_weeding_curve_fitter.cpp ++ qwt_abstract_legend.cpp ++ qwt_legend.cpp ++ qwt_legend_data.cpp ++ qwt_legend_label.cpp ++ qwt_plot.cpp ++ qwt_plot_renderer.cpp ++ qwt_plot_axis.cpp ++ qwt_plot_curve.cpp ++ qwt_plot_dict.cpp ++ qwt_plot_directpainter.cpp ++ qwt_plot_graphicitem.cpp ++ qwt_plot_grid.cpp ++ qwt_plot_histogram.cpp ++ qwt_plot_item.cpp ++ qwt_plot_abstract_barchart.cpp ++ qwt_plot_barchart.cpp ++ qwt_plot_multi_barchart.cpp ++ qwt_plot_intervalcurve.cpp ++ qwt_plot_zoneitem.cpp ++ qwt_plot_tradingcurve.cpp ++ qwt_plot_spectrogram.cpp ++ qwt_plot_spectrocurve.cpp ++ qwt_plot_scaleitem.cpp ++ qwt_plot_legenditem.cpp ++ qwt_plot_seriesitem.cpp ++ qwt_plot_shapeitem.cpp ++ qwt_plot_vectorfield.cpp ++ qwt_plot_marker.cpp ++ qwt_plot_textlabel.cpp ++ qwt_plot_layout.cpp ++ qwt_plot_abstract_canvas.cpp ++ qwt_plot_canvas.cpp ++ qwt_plot_panner.cpp ++ qwt_plot_rasteritem.cpp ++ qwt_plot_picker.cpp ++ qwt_plot_zoomer.cpp ++ qwt_plot_magnifier.cpp ++ qwt_plot_rescaler.cpp ++ qwt_point_mapper.cpp ++ qwt_raster_data.cpp ++ qwt_matrix_raster_data.cpp ++ qwt_vectorfield_symbol.cpp ++ qwt_sampling_thread.cpp ++ qwt_series_data.cpp ++ qwt_point_data.cpp ++ qwt_scale_widget.cpp ++ ) ++endif() ++ ++if(QWT_OPENGL) ++ list(APPEND HEADERS qwt_plot_opengl_canvas.h) ++ list(APPEND SOURCES qwt_plot_opengl_canvas.cpp) ++ if(QT_VERSION_MAJOR VERSION_LESS 6) ++ list(APPEND HEADERS qwt_plot_glcanvas.h) ++ list(APPEND SOURCES qwt_plot_glcanvas.cpp) ++ endif() ++endif() ++ ++if(QWT_SVG) ++ list(APPEND HEADERS qwt_plot_svgitem.h) ++ list(APPEND SOURCES qwt_plot_svgitem.cpp) ++endif() ++ ++if(QWT_POLAR) ++ list( APPEND HEADERS ++ qwt_polar.h ++ qwt_polar_canvas.h ++ qwt_polar_curve.h ++ qwt_polar_fitter.h ++ qwt_polar_grid.h ++ qwt_polar_itemdict.h ++ qwt_polar_item.h ++ qwt_polar_layout.h ++ qwt_polar_magnifier.h ++ qwt_polar_marker.h ++ qwt_polar_panner.h ++ qwt_polar_picker.h ++ qwt_polar_plot.h ++ qwt_polar_renderer.h ++ qwt_polar_spectrogram.h ++ ) ++ list(APPEND SOURCES ++ qwt_polar_canvas.cpp ++ qwt_polar_curve.cpp ++ qwt_polar_fitter.cpp ++ qwt_polar_grid.cpp ++ qwt_polar_item.cpp ++ qwt_polar_itemdict.cpp ++ qwt_polar_layout.cpp ++ qwt_polar_magnifier.cpp ++ qwt_polar_marker.cpp ++ qwt_polar_panner.cpp ++ qwt_polar_picker.cpp ++ qwt_polar_plot.cpp ++ qwt_polar_renderer.cpp ++ qwt_polar_spectrogram.cpp ++ ) ++endif() ++ ++if(QWT_WIDGETS) ++ list(APPEND HEADERS ++ qwt_abstract_slider.h ++ qwt_abstract_scale.h ++ qwt_arrow_button.h ++ qwt_analog_clock.h ++ qwt_compass.h ++ qwt_compass_rose.h ++ qwt_counter.h ++ qwt_dial.h ++ qwt_dial_needle.h ++ qwt_knob.h ++ qwt_slider.h ++ qwt_thermo.h ++ qwt_wheel.h ++ ) ++ list(APPEND SOURCES ++ qwt_abstract_slider.cpp ++ qwt_abstract_scale.cpp ++ qwt_arrow_button.cpp ++ qwt_analog_clock.cpp ++ qwt_compass.cpp ++ qwt_compass_rose.cpp ++ qwt_counter.cpp ++ qwt_dial.cpp ++ qwt_dial_needle.cpp ++ qwt_knob.cpp ++ qwt_slider.cpp ++ qwt_thermo.cpp ++ qwt_wheel.cpp ++ ) ++endif() ++ ++add_library(qwt_objects OBJECT ${SOURCES} ${HEADERS}) ++ ++target_include_directories(qwt_objects INTERFACE ++ $ ++ $ ++ $ ++) ++ ++target_link_libraries(qwt_objects PUBLIC ++ Qt${QT_VERSION_MAJOR}::Core ++ Qt${QT_VERSION_MAJOR}::Concurrent ++ Qt${QT_VERSION_MAJOR}::PrintSupport ++) ++ ++target_compile_definitions(qwt_objects PRIVATE ++ QT_NO_KEYWORDS ++ QWT_MOC_INCLUDE ++) ++ ++set_target_properties(qwt_objects PROPERTIES AUTOMOC ON) ++ ++if(NOT QWT_PLOT) ++ target_compile_definitions(qwt_objects PUBLIC NO_QWT_PLOT) ++endif() ++ ++if(NOT QWT_POLAR) ++ target_compile_definitions(qwt_objects PUBLIC NO_QWT_POLAR) ++endif() ++ ++if(QWT_WIDGETS) ++ target_link_libraries(qwt_objects PUBLIC Qt${QT_VERSION_MAJOR}::Widgets) ++else() ++ target_compile_definitions(qwt_objects PUBLIC NO_QWT_WIDGETS) ++endif() ++ ++if(QWT_OPENGL) ++ target_link_libraries(qwt_objects PUBLIC Qt${QT_VERSION_MAJOR}::OpenGL) ++ if(QT_VERSION_MAJOR VERSION_GREATER_EQUAL 6) ++ target_link_libraries(qwt_objects PUBLIC Qt${QT_VERSION_MAJOR}::OpenGLWidgets) ++ endif() ++else() ++ target_compile_definitions(qwt_objects PUBLIC QWT_NO_OPENGL) ++endif() ++ ++if(QWT_SVG) ++ target_link_libraries(qwt_objects PUBLIC Qt${QT_VERSION_MAJOR}::Svg) ++else() ++ target_compile_definitions(qwt_objects PUBLIC QWT_NO_SVG) ++endif() ++ ++ ++if(WIN32 AND QWT_DLL) ++ target_compile_definitions(qwt_objects ++ PUBLIC QWT_DLL ++ PRIVATE QWT_MAKEDLL ++ ) ++endif() ++ ++set(QWT_LIBS "") ++ ++if(QWT_DLL) ++ add_library(qwt_shared SHARED) ++ target_link_libraries(qwt_shared PUBLIC qwt_objects) ++ list(APPEND QWT_LIBS qwt_shared) ++ set_target_properties(qwt_shared PROPERTIES EXPORT_NAME "Qwt_SHARED") ++ set_target_properties(qwt_shared PROPERTIES OUTPUT_NAME "qwt${QWT_NAME_SUFFIX}") ++endif() ++ ++if(QWT_STATIC) ++ add_library(qwt_static STATIC) ++ target_link_libraries(qwt_static PUBLIC qwt_objects) ++ list(APPEND QWT_LIBS qwt_static) ++ set_target_properties(qwt_static PROPERTIES EXPORT_NAME "Qwt_STATIC") ++ if((MSVC OR (APPLE AND QWT_FRAMEWORK)) AND QWT_DLL) ++ set_target_properties(qwt_static PROPERTIES OUTPUT_NAME "qwt${QWT_NAME_SUFFIX}-static") ++ else() ++ set_target_properties(qwt_static PROPERTIES OUTPUT_NAME "qwt${QWT_NAME_SUFFIX}") ++ endif() ++endif() ++ ++if(QWT_DLL) ++ add_library(qwt ALIAS qwt_shared) ++else() ++ add_library(qwt ALIAS qwt_static) ++endif() ++ ++if(QWT_DLL AND NOT APPLE AND NOT MSVC) ++ set_target_properties(qwt_shared PROPERTIES ++ VERSION ${PROJECT_VERSION} ++ SOVERSION ${PROJECT_VERSION_MAJOR} ++ ) ++endif() ++ ++if(APPLE AND QWT_FRAMEWORK) ++ set_target_properties(${QWT_LIBS} PROPERTIES FRAMEWORK TRUE) ++endif() ++ ++install(TARGETS ${QWT_LIBS} qwt_objects ++ EXPORT QwtTargets ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR} ++) ++ ++set(QWT_CONFIG_NAME "Qt${QT_VERSION_MAJOR}Qwt6") ++ ++install(EXPORT QwtTargets ++ FILE ${QWT_CONFIG_NAME}Targets.cmake ++ NAMESPACE "Qwt::" ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${QWT_CONFIG_NAME} ++) ++include(CMakePackageConfigHelpers) ++ ++get_target_property(QT_LIBRARIES qwt_objects INTERFACE_LINK_LIBRARIES) ++string(JOIN " " QT_LIBRARIES ${QT_LIBRARIES}) ++string(REPLACE "::" "" QT_LIBRARIES ${QT_LIBRARIES}) ++ ++configure_package_config_file(${CMAKE_CURRENT_SOURCE_DIR}/qwt-config.cmake.in ++ "${CMAKE_CURRENT_BINARY_DIR}/${QWT_CONFIG_NAME}Config.cmake" ++ INSTALL_DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/${QWT_CONFIG_NAME}" ++ NO_SET_AND_CHECK_MACRO ++ NO_CHECK_REQUIRED_COMPONENTS_MACRO ++) ++write_basic_package_version_file( ++ "${CMAKE_CURRENT_BINARY_DIR}/${QWT_CONFIG_NAME}ConfigVersion.cmake" ++ VERSION "${Qwt_VERSION}" ++ COMPATIBILITY AnyNewerVersion ++) ++install(FILES ++ ${CMAKE_CURRENT_BINARY_DIR}/${QWT_CONFIG_NAME}Config.cmake ++ ${CMAKE_CURRENT_BINARY_DIR}/${QWT_CONFIG_NAME}ConfigVersion.cmake ++ DESTINATION lib/cmake/${QWT_CONFIG_NAME} ++) ++ ++install(FILES ${HEADERS} ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qwt${QWT_NAME_SUFFIX} ++) ++install(DIRECTORY ${CMAKE_SOURCE_DIR}/classincludes/ ++ DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/qwt${QWT_NAME_SUFFIX} ++ PATTERN "classincludes.pro" EXCLUDE ++) ++ ++get_target_property(QWT_COMPILE_DEFINITIONS qwt_objects INTERFACE_COMPILE_DEFINITIONS) ++string(JOIN " -D" QWT_COMPILE_DEFINITIONS ${QWT_COMPILE_DEFINITIONS}) ++string(PREPEND QWT_COMPILE_DEFINITIONS "-D") ++ ++set(QWT_PKGCONFIG_FILE ${QWT_CONFIG_NAME}.pc) ++ ++configure_file(qwt.pc.in ${QWT_PKGCONFIG_FILE} @ONLY) ++ ++install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${QWT_PKGCONFIG_FILE} ++ DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig ++) +diff --git a/src/qwt-config.cmake.in b/src/qwt-config.cmake.in +new file mode 100644 +index 0000000..cdd79d1 +--- /dev/null ++++ b/src/qwt-config.cmake.in +@@ -0,0 +1,17 @@ ++ ++@PACKAGE_INIT@ ++ ++include ( "${CMAKE_CURRENT_LIST_DIR}/@QWT_CONFIG_NAME@Targets.cmake" ) ++ ++set(QWT_INCLUDE_DIRS ${PACKAGE_PREFIX_DIR}/include/qwt@QWT_NAME_SUFFIX@) ++ ++if(TARGET Qwt::Qwt_SHARED) ++ add_library(Qwt::Qwt ALIAS Qwt::Qwt_SHARED) ++else() ++ add_library(Qwt::Qwt ALIAS Qwt::Qwt_STATIC) ++endif() ++ ++set(QT_LIBRARIES @QT_LIBRARIES@) ++foreach(qt_lib ${QT_LIBRARIES}) ++ find_package(${qt_lib} @QT_VERSION@ REQUIRED) ++endforeach() +diff --git a/src/qwt.pc.in b/src/qwt.pc.in +new file mode 100644 +index 0000000..05be4e4 +--- /dev/null ++++ b/src/qwt.pc.in +@@ -0,0 +1,12 @@ ++prefix=@CMAKE_INSTALL_PREFIX@ ++exec_prefix=${prefix} ++libdir=${prefix}/@CMAKE_INSTALL_LIBDIR@ ++includedir=${prefix}/@CMAKE_INSTALL_INCLUDEDIR@ ++ ++Name: @PROJECT_NAME@ ++Description: @PROJECT_DESCRIPTION@ ++Version: @PROJECT_VERSION@ ++ ++Libs: -L${libdir} -lqwt@QWT_NAME_SUFFIX@ ++Cflags: -I${includedir}/qwt@QWT_NAME_SUFFIX@ @QWT_COMPILE_DEFINITIONS@ ++Requires: @QT_LIBRARIES@ +diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt +new file mode 100644 +index 0000000..c530d58 +--- /dev/null ++++ b/tests/CMakeLists.txt +@@ -0,0 +1,4 @@ ++ ++add_subdirectory(splinetest) ++ ++add_subdirectory(splineprof) +diff --git a/tests/splineprof/CMakeLists.txt b/tests/splineprof/CMakeLists.txt +new file mode 100644 +index 0000000..821b725 +--- /dev/null ++++ b/tests/splineprof/CMakeLists.txt +@@ -0,0 +1,4 @@ ++ ++add_executable(splineprof main.cpp) ++ ++target_link_libraries(splineprof qwt) +diff --git a/tests/splinetest/CMakeLists.txt b/tests/splinetest/CMakeLists.txt +new file mode 100644 +index 0000000..a08f9f6 +--- /dev/null ++++ b/tests/splinetest/CMakeLists.txt +@@ -0,0 +1,4 @@ ++ ++add_executable(splinetest main.cpp) ++ ++target_link_libraries(splinetest qwt) +-- +2.36.1 + diff --git a/recipes/qwt/all/test_package/CMakeLists.txt b/recipes/qwt/all/test_package/CMakeLists.txt index 79d3544c480ff..162eed68d6d65 100644 --- a/recipes/qwt/all/test_package/CMakeLists.txt +++ b/recipes/qwt/all/test_package/CMakeLists.txt @@ -1,12 +1,13 @@ -cmake_minimum_required(VERSION 3.5) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_executable(example example.cpp) -# Must compile with "-fPIC" since Qt was built with -reduce-relocations. -target_compile_options(example PRIVATE -fPIC) -target_link_libraries(example CONAN_PKG::qt CONAN_PKG::qwt) -set_property(TARGET example PROPERTY CXX_STANDARD 11) +find_package(qwt REQUIRED CONFIG) +find_package(Qt5 REQUIRED Core CONFIG) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE qwt::qwt Qt5::Core) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if(NOT WIN32) + # Must compile with "-fPIC" since Qt was built with -reduce-relocations. + target_compile_options(${PROJECT_NAME} PRIVATE -fPIC) +endif() diff --git a/recipes/qwt/all/test_package/conanfile.py b/recipes/qwt/all/test_package/conanfile.py index 47c78f875835e..0a6bc68712d90 100644 --- a/recipes/qwt/all/test_package/conanfile.py +++ b/recipes/qwt/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -class QwtTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/qwt/all/test_package/example.cpp b/recipes/qwt/all/test_package/test_package.cpp similarity index 100% rename from recipes/qwt/all/test_package/example.cpp rename to recipes/qwt/all/test_package/test_package.cpp diff --git a/recipes/qwt/all/test_v1_package/CMakeLists.txt b/recipes/qwt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/qwt/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/qwt/all/test_v1_package/conanfile.py b/recipes/qwt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/qwt/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/qwt/config.yml b/recipes/qwt/config.yml index 77f21f3888e6f..d0d954ac2ed4c 100644 --- a/recipes/qwt/config.yml +++ b/recipes/qwt/config.yml @@ -1,5 +1,3 @@ versions: - "6.1.6": - folder: "all" "6.2.0": folder: "all" diff --git a/recipes/qxlsx/all/conandata.yml b/recipes/qxlsx/all/conandata.yml index 7e3a5bc31390d..68d91ea6c0831 100644 --- a/recipes/qxlsx/all/conandata.yml +++ b/recipes/qxlsx/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4.5": + url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.5.zip" + sha256: "eadcad2718335673f86fe20fd91e822e6c1e3624483be9d79cf79254e5426067" "1.4.4": url: "https://github.com/QtExcel/QXlsx/archive/refs/tags/v1.4.4.zip" sha256: "3efbd6f63a1ffd521c535dce7b5a5a7e9ebd23db51e6ae8e3e2eb89796e57675" @@ -7,5 +10,9 @@ sources: sha256: "d2f7c6aff71f2f30ade8d8020682e36a3d63f422a5d2f1c5831b55573241bd4a" patches: "1.4.3": - - patch_file: "patches/0001-allow-shared.patch" - - patch_file: "patches/0002-add-install-target.patch" + - patch_file: "patches/1.4.3/0001-allow-shared.patch" + patch_type: "conan" + patch_source: "https://github.com/QtExcel/QXlsx/pull/197" + - patch_file: "patches/1.4.3/0002-add-install-target.patch" + patch_type: "conan" + patch_source: "https://github.com/QtExcel/QXlsx/pull/197" diff --git a/recipes/qxlsx/all/conanfile.py b/recipes/qxlsx/all/conanfile.py index 2323a1dec48f6..2db27dce4134a 100644 --- a/recipes/qxlsx/all/conanfile.py +++ b/recipes/qxlsx/all/conanfile.py @@ -1,10 +1,11 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class QXlsxConan(ConanFile): @@ -25,9 +26,12 @@ class QXlsxConan(ConanFile): "fPIC": True } + @property + def _qt_version(self): + return Version(self.dependencies["qt"].ref.version).major + def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,13 +39,28 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - self.requires("qt/5.15.5") + self.requires("qt/5.15.7") def layout(self): - cmake_layout(self) + cmake_layout(self, src_folder="src") + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r"cmake version (\d+\.\d+\.\d+)", output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "1.4.4" and not self._cmake_new_enough("3.16"): + self.tool_requires("cmake/3.25.0") def source(self): get(self, **self.conan_data["sources"][self.version], @@ -49,10 +68,12 @@ def source(self): def generate(self): tc = CMakeToolchain(self) - tc.variables["QT_VERSION_MAJOR"] = Version(self.deps_cpp_info["qt"].version).major + tc.variables["QT_VERSION_MAJOR"] = self._qt_version tc.generate() tc = CMakeDeps(self) tc.generate() + tc = VirtualBuildEnv(self) + tc.generate(scope="build") def build(self): apply_conandata_patches(self) @@ -63,6 +84,7 @@ def build(self): def package(self): copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) + cmake.configure(build_script_folder="QXlsx") cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) @@ -70,7 +92,10 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "QXlsx") self.cpp_info.set_property("cmake_target_name", "QXlsx::Core") # TODO: back to global scope in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["qxlsx_core"].libs = ["QXlsx"] + if Version(self.version) <= "1.4.4": + self.cpp_info.components["qxlsx_core"].libs = ["QXlsx"] + else: + self.cpp_info.components["qxlsx_core"].libs = [f"QXlsxQt{self._qt_version}"] self.cpp_info.components["qxlsx_core"].includedirs = [os.path.join("include", "QXlsx")] self.cpp_info.components["qxlsx_core"].requires = ["qt::qtCore", "qt::qtGui"] diff --git a/recipes/qxlsx/all/patches/0001-allow-shared.patch b/recipes/qxlsx/all/patches/1.4.3/0001-allow-shared.patch similarity index 100% rename from recipes/qxlsx/all/patches/0001-allow-shared.patch rename to recipes/qxlsx/all/patches/1.4.3/0001-allow-shared.patch diff --git a/recipes/qxlsx/all/patches/0002-add-install-target.patch b/recipes/qxlsx/all/patches/1.4.3/0002-add-install-target.patch similarity index 100% rename from recipes/qxlsx/all/patches/0002-add-install-target.patch rename to recipes/qxlsx/all/patches/1.4.3/0002-add-install-target.patch diff --git a/recipes/qxlsx/config.yml b/recipes/qxlsx/config.yml index c3a2585d47075..c1105e1540729 100644 --- a/recipes/qxlsx/config.yml +++ b/recipes/qxlsx/config.yml @@ -1,4 +1,6 @@ versions: + "1.4.5": + folder: "all" "1.4.4": folder: "all" "1.4.3": diff --git a/recipes/qxmpp/all/conanfile.py b/recipes/qxmpp/all/conanfile.py index 2a16e110b6e1c..b89c7627065d2 100644 --- a/recipes/qxmpp/all/conanfile.py +++ b/recipes/qxmpp/all/conanfile.py @@ -1,5 +1,6 @@ -from conan.tools.files import rename -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools import files +from conans import CMake import functools import os @@ -46,13 +47,13 @@ def configure(self): del self.options.fPIC def requirements(self): - self.requires("qt/6.2.3") + self.requires("qt/6.2.4") if self.options.with_gstreamer: self.requires("gstreamer/1.19.2") self.requires("glib/2.70.1") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + files.get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) @functools.lru_cache(1) def _configure_cmake(self): @@ -67,7 +68,7 @@ def _configure_cmake(self): def build(self): for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + files.patch(self, **patch) cmake = self._configure_cmake() cmake.build() @@ -75,12 +76,12 @@ def package(self): self.copy("LICENSE.LGPL", dst="licenses", src=self._source_subfolder) cmake = self._configure_cmake() cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + files.rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) if self.options.shared and self.settings.os == "Windows": - tools.mkdir(os.path.join(self.package_folder, "bin")) - rename(self, os.path.join(self.package_folder, "lib", "qxmpp.dll"), + files.mkdir(self, os.path.join(self.package_folder, "bin")) + files.rename(self, os.path.join(self.package_folder, "lib", "qxmpp.dll"), os.path.join(self.package_folder, "bin", "qxmpp.dll")) def package_info(self): diff --git a/recipes/r8brain-free-src/all/CMakeLists.txt b/recipes/r8brain-free-src/all/CMakeLists.txt index 4d2e7a864fd92..1956775589e86 100644 --- a/recipes/r8brain-free-src/all/CMakeLists.txt +++ b/recipes/r8brain-free-src/all/CMakeLists.txt @@ -1,17 +1,47 @@ -cmake_minimum_required(VERSION 3.1) -project(r8brain-free-src CXX) +cmake_minimum_required(VERSION 3.4) +project(r8brain-free-src LANGUAGES C CXX) -include(conanbuildinfo.cmake) -conan_basic_setup() +add_library(r8brain) -add_library(r8brain source_subfolder/r8bbase.cpp) +target_sources(r8brain PRIVATE ${R8BRAIN_SRC_DIR}/r8bbase.cpp) +if(R8BRAIN_WITH_PFFFT) + target_compile_definitions(r8brain PUBLIC R8B_PFFFT) + find_package(pffft REQUIRED CONFIG) + target_link_libraries(r8brain pffft::pffft) +endif() +if(R8BRAIN_WITH_PFFFT_DOUBLE) + target_compile_definitions(r8brain PUBLIC R8B_PFFFT_DOUBLE) + target_sources(r8brain PRIVATE ${R8BRAIN_SRC_DIR}/pffft_double/pffft_double.c) +endif() + +set_target_properties(r8brain PROPERTIES + WINDOWS_EXPORT_ALL_SYMBOLS ON +) + +include(GNUInstallDirs) install( TARGETS r8brain - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) -file(GLOB PUBLIC_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/*.h) -install(FILES ${PUBLIC_HEADERS} DESTINATION include) +file(GLOB PUBLIC_HEADERS ${R8BRAIN_SRC_DIR}/*.h ${R8BRAIN_SRC_DIR}/*.inc) +install(FILES ${PUBLIC_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +if(R8BRAIN_WITH_PFFFT_DOUBLE) + list(APPEND PFFFT_DOUBLE_HEADERS + ${R8BRAIN_SRC_DIR}/pffft_double/pffft_double.h + ) + install(FILES ${PFFFT_DOUBLE_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pffft_double) + + list(APPEND PFFFT_DOUBLE_SIMD_HEADERS + ${R8BRAIN_SRC_DIR}/pffft_double/simd/pf_avx_double.h + ${R8BRAIN_SRC_DIR}/pffft_double/simd/pf_double.h + ${R8BRAIN_SRC_DIR}/pffft_double/simd/pf_neon_double.h + ${R8BRAIN_SRC_DIR}/pffft_double/simd/pf_neon_double_from_avx.h + ${R8BRAIN_SRC_DIR}/pffft_double/simd/pf_scalar_double.h + ${R8BRAIN_SRC_DIR}/pffft_double/simd/pf_sse2_double.h + ) + install(FILES ${PFFFT_DOUBLE_SIMD_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/pffft_double/simd) +endif() diff --git a/recipes/r8brain-free-src/all/conandata.yml b/recipes/r8brain-free-src/all/conandata.yml index 4aef290351a32..27ad749e21214 100644 --- a/recipes/r8brain-free-src/all/conandata.yml +++ b/recipes/r8brain-free-src/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "6.2": + url: "https://github.com/avaneev/r8brain-free-src/archive/refs/tags/version-6.2.tar.gz" + sha256: "5e576ec8cb6ae3969c4bcacb630ddc957fc20f60a6b08593681d16e06942597d" "4.6": - sha256: 9a0d66c3a04954359ef9f69168b58fcdf11e8975821181ee7d1e3b42e8a2cf0e - url: https://github.com/avaneev/r8brain-free-src/archive/version-4.6.tar.gz + url: "https://github.com/avaneev/r8brain-free-src/archive/version-4.6.tar.gz" + sha256: "9a0d66c3a04954359ef9f69168b58fcdf11e8975821181ee7d1e3b42e8a2cf0e" diff --git a/recipes/r8brain-free-src/all/conanfile.py b/recipes/r8brain-free-src/all/conanfile.py index c1835617dff0a..c6a956008c5c7 100644 --- a/recipes/r8brain-free-src/all/conanfile.py +++ b/recipes/r8brain-free-src/all/conanfile.py @@ -1,27 +1,32 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc +from conan.tools.files import get, copy +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration - +required_conan_version = ">=1.53.0" class R8brainFreeSrcConan(ConanFile): name = "r8brain-free-src" + description = "High-quality pro audio sample rate converter / resampler C++ library" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/avaneev/r8brain-free-src" - description = "High-quality pro audio sample rate converter / resampler C++ library" topics = ("audio", "sample-rate", "conversion", "audio-processing", "resampler") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "fft": ["ooura", "pffft", "pffft_double", ] + } + default_options = { + "shared": False, + "fPIC": True, + "fft": "ooura", + } exports_sources = ["CMakeLists.txt"] - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -29,33 +34,53 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - if self.settings.compiler == "Visual Studio" and self.options.shared: - raise ConanInvalidConfiguration("Shared r8brain-free-src cannot be built with Visual Studio") + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.options.fft == "pffft": + self.requires("pffft/cci.20210511") + # TODO: use pffft_double package when possible + + def validate(self): + if self.options.fft == "ooura" and is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} cannot be built shared with Visual Studio") + + if self.options.fft == "pffft_double" and Version(self.version) < "4.10": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support pffft_double") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_folder = "r8brain-free-src-version-{}".format(self.version) - os.rename(extracted_folder, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["R8BRAIN_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["R8BRAIN_WITH_PFFFT"] = self.options.fft == "pffft" + tc.variables["R8BRAIN_WITH_PFFFT_DOUBLE"] = self.options.fft == "pffft_double" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["r8brain"] - - if self.settings.os == "Linux": + + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") + + if self.options.fft == "pffft": + self.cpp_info.defines.append("R8B_PFFFT") + if self.options.fft == "pffft_double": + self.cpp_info.defines.append("R8B_PFFFT_DOUBLE") diff --git a/recipes/r8brain-free-src/all/test_package/CMakeLists.txt b/recipes/r8brain-free-src/all/test_package/CMakeLists.txt index d4fdee1a8a79c..ce5f00cec2e35 100644 --- a/recipes/r8brain-free-src/all/test_package/CMakeLists.txt +++ b/recipes/r8brain-free-src/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(r8brain-free-src REQUIRED CONFIG) -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE r8brain-free-src::r8brain-free-src) diff --git a/recipes/r8brain-free-src/all/test_package/conanfile.py b/recipes/r8brain-free-src/all/test_package/conanfile.py index ade921dacaaa8..a9fbb7f543162 100644 --- a/recipes/r8brain-free-src/all/test_package/conanfile.py +++ b/recipes/r8brain-free-src/all/test_package/conanfile.py @@ -1,11 +1,18 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + def requirements(self): + self.requires(self.tested_reference_str) -class R8brainFreeSrcTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/r8brain-free-src/all/test_package/example.cpp b/recipes/r8brain-free-src/all/test_package/test_package.cpp similarity index 100% rename from recipes/r8brain-free-src/all/test_package/example.cpp rename to recipes/r8brain-free-src/all/test_package/test_package.cpp diff --git a/recipes/r8brain-free-src/all/test_v1_package/CMakeLists.txt b/recipes/r8brain-free-src/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/r8brain-free-src/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/r8brain-free-src/all/test_v1_package/conanfile.py b/recipes/r8brain-free-src/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/r8brain-free-src/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/r8brain-free-src/config.yml b/recipes/r8brain-free-src/config.yml index 7c0f106ec1bec..541a5f21084de 100644 --- a/recipes/r8brain-free-src/config.yml +++ b/recipes/r8brain-free-src/config.yml @@ -1,3 +1,5 @@ versions: + "6.2": + folder: all "4.6": folder: all diff --git a/recipes/rabbitmq-c/all/conandata.yml b/recipes/rabbitmq-c/all/conandata.yml index e51679437c772..4a93aef8c8422 100755 --- a/recipes/rabbitmq-c/all/conandata.yml +++ b/recipes/rabbitmq-c/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.13.0": + url: "https://github.com/alanxz/rabbitmq-c/archive/v0.13.0.tar.gz" + sha256: "8b224e41bba504fc52b02f918d8df7e4bf5359d493cbbff36c06078655c676e6" "0.11.0": url: "https://github.com/alanxz/rabbitmq-c/archive/v0.11.0.tar.gz" sha256: "437d45e0e35c18cf3e59bcfe5dfe37566547eb121e69fca64b98f5d2c1c2d424" diff --git a/recipes/rabbitmq-c/all/conanfile.py b/recipes/rabbitmq-c/all/conanfile.py index 87b49a26da365..f604b1a30b71d 100755 --- a/recipes/rabbitmq-c/all/conanfile.py +++ b/recipes/rabbitmq-c/all/conanfile.py @@ -1,9 +1,10 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class RabbitmqcConan(ConanFile): @@ -12,7 +13,7 @@ class RabbitmqcConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/alanxz/rabbitmq-c" description = "This is a C-language AMQP client library for use with v2.0+ of the RabbitMQ broker." - topics = ("rabbitmq-c", "rabbitmq", "message queue") + topics = ("rabbitmq", "message queue") settings = "os", "arch", "compiler", "build_type" options = { @@ -32,19 +33,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def requirements(self): if self.options.ssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") def layout(self): cmake_layout(self, src_folder="src") @@ -58,7 +53,10 @@ def generate(self): tc.variables["BUILD_EXAMPLES"] = False tc.variables["BUILD_SHARED_LIBS"] = self.options.shared tc.variables["BUILD_STATIC_LIBS"] = not self.options.shared - tc.variables["BUILD_TESTS"] = False + if Version(self.version) < "0.12.0": + tc.variables["BUILD_TESTS"] = False + else: + tc.variables["BUILD_TESTING"] = False tc.variables["BUILD_TOOLS"] = False tc.variables["BUILD_TOOLS_DOCS"] = False tc.variables["ENABLE_SSL_SUPPORT"] = self.options.ssl @@ -77,6 +75,7 @@ def build(self): def package(self): copy(self, "LICENSE-MIT", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) @@ -101,6 +100,9 @@ def package_info(self): if not self.options.shared: self.cpp_info.components["rabbitmq"].defines.append("AMQP_STATIC") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("rt") + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "rabbitmq-c" self.cpp_info.filenames["cmake_find_package_multi"] = "rabbitmq-c" diff --git a/recipes/rabbitmq-c/all/test_package/CMakeLists.txt b/recipes/rabbitmq-c/all/test_package/CMakeLists.txt index 28907bba64116..2033457172e80 100644 --- a/recipes/rabbitmq-c/all/test_package/CMakeLists.txt +++ b/recipes/rabbitmq-c/all/test_package/CMakeLists.txt @@ -1,9 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(rabbitmq-c REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) +add_executable(${PROJECT_NAME} test_package.c) if(RABBITMQ_SHARED) target_link_libraries(${PROJECT_NAME} PRIVATE rabbitmq::rabbitmq) else() @@ -13,3 +13,8 @@ endif() if(WITH_SSL) target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_SSL) endif() + +IF (rabbitmq-c_VERSION VERSION_GREATER_EQUAL "0.12.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE RABBITMQ_C_0_12_0_LATER) + target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) +endif() diff --git a/recipes/rabbitmq-c/all/test_package/test_package.c b/recipes/rabbitmq-c/all/test_package/test_package.c new file mode 100644 index 0000000000000..c159db025fa8f --- /dev/null +++ b/recipes/rabbitmq-c/all/test_package/test_package.c @@ -0,0 +1,42 @@ +#include + +/* Public headers have moved to rabbitmq-c/ directory since 0.12.0 */ +#if !defined(RABBITMQ_C_0_12_0_LATER) + #include + #include + + #ifdef WITH_SSL + #include + #else + #include + #endif +#else + #include + #include + + #ifdef WITH_SSL + #include + #else + #include + #endif +#endif + +int main(int argc, char const *argv[]) { + amqp_connection_state_t conn = amqp_new_connection(); + amqp_socket_t *socket = NULL; +#ifdef WITH_SSL + socket = amqp_ssl_socket_new(conn); +#else + socket = amqp_tcp_socket_new(conn); +#endif + + printf( + "\n" + "----------------->Tests are done.<---------------------\n" + "Using version %s\n" + "///////////////////////////////////////////////////////\n", + amqp_version() + ); + + return 0; +} diff --git a/recipes/rabbitmq-c/all/test_package/test_package.cpp b/recipes/rabbitmq-c/all/test_package/test_package.cpp deleted file mode 100644 index 668dd16b6ab8e..0000000000000 --- a/recipes/rabbitmq-c/all/test_package/test_package.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - -#ifdef WITH_SSL -#include -#else -#include -#endif - -int main(int argc, char const *argv[]) { - amqp_connection_state_t conn = amqp_new_connection(); - amqp_socket_t *socket = NULL; -#ifdef WITH_SSL - socket = amqp_ssl_socket_new(conn); -#else - socket = amqp_tcp_socket_new(conn); -#endif - std::cout << std::endl - << "----------------->Tests are done.<---------------------" << std::endl - << "Using version " << amqp_version() << std::endl - << "///////////////////////////////////////////////////////" << std::endl; - return 0; -} diff --git a/recipes/rabbitmq-c/all/test_v1_package/CMakeLists.txt b/recipes/rabbitmq-c/all/test_v1_package/CMakeLists.txt index 7f7244e3675e7..925ecbe19e448 100644 --- a/recipes/rabbitmq-c/all/test_v1_package/CMakeLists.txt +++ b/recipes/rabbitmq-c/all/test_v1_package/CMakeLists.txt @@ -1,18 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(rabbitmq-c REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -if(RABBITMQ_SHARED) - target_link_libraries(${PROJECT_NAME} PRIVATE rabbitmq::rabbitmq) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE rabbitmq::rabbitmq-static) -endif() - -if(WITH_SSL) - target_compile_definitions(${PROJECT_NAME} PRIVATE WITH_SSL) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/rabbitmq-c/config.yml b/recipes/rabbitmq-c/config.yml index 9be4a2a8a723f..5d590dc0b2c3b 100644 --- a/recipes/rabbitmq-c/config.yml +++ b/recipes/rabbitmq-c/config.yml @@ -1,8 +1,9 @@ versions: + "0.13.0": + folder: all "0.11.0": folder: all "0.10.0": folder: all "0.9.0": folder: all - diff --git a/recipes/range-v3/all/conandata.yml b/recipes/range-v3/all/conandata.yml index a9d0e69463291..1e7ea8c024212 100644 --- a/recipes/range-v3/all/conandata.yml +++ b/recipes/range-v3/all/conandata.yml @@ -1,22 +1,22 @@ sources: - "0.3.7": - url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.3.7.tar.gz - sha256: e6b0fb33bfd07ec32d54bcddd3e8d62e995a3cf0b64b34788ec264da62581207 - "0.4.0": - url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.4.0.tar.gz - sha256: 5dbc878b7dfc500fb04b6b9f99d63993a2731ea34b0a4b8d5f670a5a71a18e39 - "0.5.0": - url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.5.0.tar.gz - sha256: 32e30b3be042246030f31d40394115b751431d9d2b4e0f6d58834b2fd5594280 - "0.9.1": - url: https://github.com/ericniebler/range-v3/archive/0.9.1.tar.gz - sha256: 2b5b442d572b5978ea51c650adfaf0796f39f326404d09b83d846e04f571876b - "0.10.0": - url: https://github.com/ericniebler/range-v3/archive/0.10.0.tar.gz - sha256: 5a1cd44e7315d0e8dcb1eee4df6802221456a9d1dbeac53da02ac7bd4ea150cd - "0.11.0": - url: https://github.com/ericniebler/range-v3/archive/0.11.0.tar.gz - sha256: 376376615dbba43d3bef75aa590931431ecb49eb36d07bb726a19f680c75e20c "0.12.0": url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.12.0.tar.gz sha256: 015adb2300a98edfceaf0725beec3337f542af4915cec4d0b89fa0886f4ba9cb + "0.11.0": + url: https://github.com/ericniebler/range-v3/archive/0.11.0.tar.gz + sha256: 376376615dbba43d3bef75aa590931431ecb49eb36d07bb726a19f680c75e20c + "0.10.0": + url: https://github.com/ericniebler/range-v3/archive/0.10.0.tar.gz + sha256: 5a1cd44e7315d0e8dcb1eee4df6802221456a9d1dbeac53da02ac7bd4ea150cd + "0.9.1": + url: https://github.com/ericniebler/range-v3/archive/0.9.1.tar.gz + sha256: 2b5b442d572b5978ea51c650adfaf0796f39f326404d09b83d846e04f571876b + "0.5.0": + url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.5.0.tar.gz + sha256: 32e30b3be042246030f31d40394115b751431d9d2b4e0f6d58834b2fd5594280 + "0.4.0": + url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.4.0.tar.gz + sha256: 5dbc878b7dfc500fb04b6b9f99d63993a2731ea34b0a4b8d5f670a5a71a18e39 + "0.3.7": + url: https://github.com/ericniebler/range-v3/archive/refs/tags/0.3.7.tar.gz + sha256: e6b0fb33bfd07ec32d54bcddd3e8d62e995a3cf0b64b34788ec264da62581207 diff --git a/recipes/range-v3/all/conanfile.py b/recipes/range-v3/all/conanfile.py index 676535e01f13b..4f9a2a5174d9a 100644 --- a/recipes/range-v3/all/conanfile.py +++ b/recipes/range-v3/all/conanfile.py @@ -1,6 +1,14 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +from conan.tools.layout import basic_layout +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration + + +required_conan_version = ">=1.50.0" class Rangev3Conan(ConanFile): @@ -13,60 +21,60 @@ class Rangev3Conan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _compilers_minimum_version(self): - rangev3_version = tools.Version(self.version) return { - "gcc": "5" if rangev3_version < "0.10.0" else "6.5", - "Visual Studio": "16", - "clang": "3.6" if rangev3_version < "0.10.0" else "3.9" + "gcc": "5" if Version(self.version) < "0.10.0" else "6.5", + "msvc": "192", + "Visual Studio": "16", # TODO: remove when only Conan2 is supported + "clang": "3.6" if Version(self.version) < "0.10.0" else "3.9" } @property def _min_cppstd(self): - if self.settings.compiler == "Visual Studio": + if is_msvc(self): return "17" else: return "14" + + def layout(self): + basic_layout(self) - def configure(self): + def package_id(self): + self.info.clear() + + def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._min_cppstd) - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get( + str(self.settings.compiler), False) if not minimum_version: - self.output.warn("{0} {1} support for range-v3 is unknown, assuming it is supported." - .format(self.settings.compiler, self.settings.compiler.version)) - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("range-v3 {0} requires C++{1} with {2}, which is not supported by {2} {3}" - .format(self.version, - self._min_cppstd, - self.settings.compiler, - self.settings.compiler.version)) + self.output.warning( + f"{self.settings.compiler} {self.settings.compiler.version} support for range-v3 is unknown, assuming it is supported.") + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"range-v3 {self.version} requires C++{self._min_cppstd} with {self.settings.compiler}, which is not supported by {self.settings.compiler} {self.settings.compiler.version}") - def package_id(self): - self.info.header_only() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_folder = self.name + "-" + self.version - os.rename(extracted_folder, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def package(self): - self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) + copy(self, "*", dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, "LICENSE.txt", dst=os.path.join( + self.package_folder, "licenses"), src=self.source_folder) def package_info(self): self.cpp_info.components["range-v3-meta"].names["cmake_find_package"] = "meta" self.cpp_info.components["range-v3-meta"].names["cmake_find_package_multi"] = "meta" - if self.settings.compiler == "Visual Studio": + if is_msvc(self): self.cpp_info.components["range-v3-meta"].cxxflags = ["/permissive-"] - version = tools.Version(self.version) - if "0.9.0" <= version and version < "0.11.0": - self.cpp_info.components["range-v3-meta"].cxxflags.append("/experimental:preprocessor") + + if "0.9.0" <= Version(self.version) < "0.11.0": + self.cpp_info.components["range-v3-meta"].cxxflags.append( + "/experimental:preprocessor") self.cpp_info.components["range-v3-concepts"].names["cmake_find_package"] = "concepts" self.cpp_info.components["range-v3-concepts"].names["cmake_find_package_multi"] = "concepts" self.cpp_info.components["range-v3-concepts"].requires = ["range-v3-meta"] diff --git a/recipes/range-v3/all/test_package/CMakeLists.txt b/recipes/range-v3/all/test_package/CMakeLists.txt index da44aa6041cc2..bee80f9c757e8 100644 --- a/recipes/range-v3/all/test_package/CMakeLists.txt +++ b/recipes/range-v3/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ cmake_minimum_required(VERSION 3.8) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(range-v3 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} range-v3::range-v3) -if(MSVC AND ${VERSION} STREQUAL "0.10.0") +if(MSVC AND range-v3_VERSION STREQUAL "0.10.0") set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 20) else() set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) diff --git a/recipes/range-v3/all/test_package/conanfile.py b/recipes/range-v3/all/test_package/conanfile.py index 4454ee38d4f7d..2a9cace728280 100644 --- a/recipes/range-v3/all/test_package/conanfile.py +++ b/recipes/range-v3/all/test_package/conanfile.py @@ -1,18 +1,26 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) - cmake.definitions["VERSION"] = self.deps_cpp_info["range-v3"].version cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/range-v3/all/test_package/test_package.cpp b/recipes/range-v3/all/test_package/test_package.cpp index 775ca205da6d6..bf050370682ec 100644 --- a/recipes/range-v3/all/test_package/test_package.cpp +++ b/recipes/range-v3/all/test_package/test_package.cpp @@ -1,5 +1,6 @@ #include #include +#include using namespace ranges; diff --git a/recipes/range-v3/all/test_v1_package/CMakeLists.txt b/recipes/range-v3/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/range-v3/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/range-v3/all/test_v1_package/conanfile.py b/recipes/range-v3/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..647a78dd80032 --- /dev/null +++ b/recipes/range-v3/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["VERSION"] = self.deps_cpp_info["range-v3"].version + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/range-v3/config.yml b/recipes/range-v3/config.yml index 557dc2ab0564d..5ed235c09031b 100644 --- a/recipes/range-v3/config.yml +++ b/recipes/range-v3/config.yml @@ -1,15 +1,15 @@ versions: - "0.3.7": + "0.12.0": folder: all - "0.4.0": + "0.11.0": folder: all - "0.5.0": + "0.10.0": folder: all "0.9.1": folder: all - "0.10.0": + "0.5.0": folder: all - "0.11.0": + "0.4.0": folder: all - "0.12.0": + "0.3.7": folder: all diff --git a/recipes/rapidcsv/all/conandata.yml b/recipes/rapidcsv/all/conandata.yml index 1cab273fd5038..4a94a5cab704f 100644 --- a/recipes/rapidcsv/all/conandata.yml +++ b/recipes/rapidcsv/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "8.69": + url: "https://github.com/d99kris/rapidcsv/archive/v8.69.tar.gz" + sha256: "b63e58b1d18277f0331e211bbe6740587069fcd3e5b5a5fb63be7d2f17250d54" "8.64": url: "https://github.com/d99kris/rapidcsv/archive/v8.64.tar.gz" sha256: "e2ab5231b6e65f1e168dc279bbba2e34afd43c7bc6e2522726b107bcc4e8ebac" diff --git a/recipes/rapidcsv/all/conanfile.py b/recipes/rapidcsv/all/conanfile.py index cc5590d743532..a9d964b6536a3 100644 --- a/recipes/rapidcsv/all/conanfile.py +++ b/recipes/rapidcsv/all/conanfile.py @@ -1,28 +1,47 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.52.0" class RapidcsvConan(ConanFile): name = "rapidcsv" description = "C++ CSV parser library" - topics = ("csv", "parser") + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/d99kris/rapidcsv" - license = "BSD-3-Clause" + topics = ("csv", "parser", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="rapidcsv.h", dst="include", src=os.path.join(self._source_subfolder, "src")) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src"), + ) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/rapidcsv/all/test_package/CMakeLists.txt b/recipes/rapidcsv/all/test_package/CMakeLists.txt index d9d85dd378817..30d340fa95be7 100644 --- a/recipes/rapidcsv/all/test_package/CMakeLists.txt +++ b/recipes/rapidcsv/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(rapidcsv REQUIRED) +find_package(rapidcsv REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE rapidcsv::rapidcsv) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/rapidcsv/all/test_package/conanfile.py b/recipes/rapidcsv/all/test_package/conanfile.py index 49a3a66ea5bad..e845ae751a301 100644 --- a/recipes/rapidcsv/all/test_package/conanfile.py +++ b/recipes/rapidcsv/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rapidcsv/all/test_v1_package/CMakeLists.txt b/recipes/rapidcsv/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/rapidcsv/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/rapidcsv/all/test_v1_package/conanfile.py b/recipes/rapidcsv/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/rapidcsv/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/rapidcsv/config.yml b/recipes/rapidcsv/config.yml index 4ce50b4cd62f5..fa4a806018292 100644 --- a/recipes/rapidcsv/config.yml +++ b/recipes/rapidcsv/config.yml @@ -1,4 +1,6 @@ versions: + "8.69": + folder: "all" "8.64": folder: "all" "8.62": diff --git a/recipes/rapidjson/all/conandata.yml b/recipes/rapidjson/all/conandata.yml index 55339d9202d0f..dd7649f2b814f 100644 --- a/recipes/rapidjson/all/conandata.yml +++ b/recipes/rapidjson/all/conandata.yml @@ -2,9 +2,13 @@ sources: "1.1.0": url: "https://github.com/Tencent/rapidjson/archive/v1.1.0.tar.gz" sha256: bf7ced29704a1e696fbccf2a2b4ea068e7774fa37f6d7dd4039d0787f8bed98e - "cci.20200410": - url: "https://github.com/Tencent/rapidjson/archive/8f4c021fa2f1e001d2376095928fc0532adf2ae6.zip" - sha256: e6fc99c7df7f29995838a764dd68df87b71db360f7727ace467b21b82c85efda + # More recent unofficial releases based on commits + "cci.20220822": + url: "https://github.com/Tencent/rapidjson/archive/06d58b9e848c650114556a23294d0b6440078c61.tar.gz" + sha256: 30d28bbe0bfff9d8dc5d3cf62799b6ee550499cc1520e44bdece81e002480d19 "cci.20211112": url: "https://github.com/Tencent/rapidjson/archive/0d4517f15a8d7167ba9ae67f3f22a559ca841e3b.tar.gz" sha256: 3697fdcea30dc7c2b2bb68d2521a6b8793f4d3269de751eed2c5fd477ff329ce + "cci.20200410": + url: "https://github.com/Tencent/rapidjson/archive/8f4c021fa2f1e001d2376095928fc0532adf2ae6.zip" + sha256: e6fc99c7df7f29995838a764dd68df87b71db360f7727ace467b21b82c85efda diff --git a/recipes/rapidjson/all/conanfile.py b/recipes/rapidjson/all/conanfile.py index 828301cb40897..01002651291b6 100644 --- a/recipes/rapidjson/all/conanfile.py +++ b/recipes/rapidjson/all/conanfile.py @@ -1,32 +1,39 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" class RapidjsonConan(ConanFile): name = "rapidjson" description = "A fast JSON parser/generator for C++ with both SAX/DOM style API" - topics = ("conan", "rapidjson", "json", "parser", "generator") + topics = ("rapidjson", "json", "parser", "generator") url = "https://github.com/conan-io/conan-center-index" homepage = "http://rapidjson.org" license = "MIT" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self) def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True, + destination=self.source_folder) def package(self): - self.copy(pattern="license.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, pattern="license.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_id(self): - self.info.header_only() + self.info.clear() def package_info(self): + self.cpp_info.set_property("cmake_file_name", "RapidJSON") + self.cpp_info.set_property("cmake_target_name", "rapidjson") + + # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "RapidJSON" self.cpp_info.names["cmake_find_package_multi"] = "RapidJSON" diff --git a/recipes/rapidjson/all/test_package/CMakeLists.txt b/recipes/rapidjson/all/test_package/CMakeLists.txt index 196188113685c..30b669a758f42 100644 --- a/recipes/rapidjson/all/test_package/CMakeLists.txt +++ b/recipes/rapidjson/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(RapidJSON CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE rapidjson) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/rapidjson/all/test_package/conanfile.py b/recipes/rapidjson/all/test_package/conanfile.py index bd7165a553cf4..081c97abefb38 100644 --- a/recipes/rapidjson/all/test_package/conanfile.py +++ b/recipes/rapidjson/all/test_package/conanfile.py @@ -1,10 +1,20 @@ -from conans import ConanFile, CMake, tools import os +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +required_conan_version = ">=1.50.0" class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +22,5 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + self.run(os.path.join(self.cpp.build.bindirs[0], "test_package"), env="conanrun") diff --git a/recipes/rapidjson/all/test_v1_package/CMakeLists.txt b/recipes/rapidjson/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a694a0d382f57 --- /dev/null +++ b/recipes/rapidjson/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(RapidJSON CONFIG REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE RapidJSON::RapidJSON) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/rapidjson/all/test_v1_package/conanfile.py b/recipes/rapidjson/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/rapidjson/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/rapidjson/config.yml b/recipes/rapidjson/config.yml index 1ef1c1e46ed25..82e5350012d0b 100644 --- a/recipes/rapidjson/config.yml +++ b/recipes/rapidjson/config.yml @@ -1,7 +1,9 @@ versions: "1.1.0": folder: "all" - "cci.20200410": + "cci.20220822": folder: "all" "cci.20211112": folder: "all" + "cci.20200410": + folder: "all" diff --git a/recipes/rapidyaml/all/CMakeLists.txt b/recipes/rapidyaml/all/CMakeLists.txt deleted file mode 100644 index 205ebe3efea98..0000000000000 --- a/recipes/rapidyaml/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper LANGUAGES CXX) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/rapidyaml/all/conandata.yml b/recipes/rapidyaml/all/conandata.yml index 9ff2ab225f75a..dd5074af2a9b9 100644 --- a/recipes/rapidyaml/all/conandata.yml +++ b/recipes/rapidyaml/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.5.0": + url: "https://github.com/biojppm/rapidyaml/releases/download/v0.5.0/rapidyaml-0.5.0-src.tgz" + sha256: "6493557778791a3a2375510ce6c0ecd70163fc8ce4f8ed683acc36e3e55ee881" "0.4.1": url: "https://github.com/biojppm/rapidyaml/releases/download/v0.4.1/rapidyaml-0.4.1-src.tgz" sha256: "3c0a671a7a5aab972f7d259736d14beb9f428c4441f0c220dc0717a4946b495c" @@ -9,12 +12,19 @@ sources: url: "https://github.com/biojppm/rapidyaml/releases/download/v0.3.0/rapidyaml-0.3.0-src.tgz" sha256: "38854b8359eaf42cc27352f4b7321f509f6775445a3e2746cc8cd1e468a52aa9" patches: + "0.5.0": + - patch_file: "patches/0.5.0-001-remove-internal-c4core.patch" + patch_description: "disable using internal c4core" + patch_type: "conan" "0.4.1": - patch_file: "patches/0.4.1-001-remove-internal-c4core.patch" - base_path: "source_subfolder" + patch_description: "disable using internal c4core" + patch_type: "conan" "0.4.0": - patch_file: "patches/0.4.0-001-remove-internal-c4core.patch" - base_path: "source_subfolder" + patch_description: "disable using internal c4core" + patch_type: "conan" "0.3.0": - patch_file: "patches/0.3.0-001-remove-internal-c4core.patch" - base_path: "source_subfolder" + patch_description: "disable using internal c4core" + patch_type: "conan" diff --git a/recipes/rapidyaml/all/conanfile.py b/recipes/rapidyaml/all/conanfile.py index a66b93f7411bc..9b33134d2e034 100644 --- a/recipes/rapidyaml/all/conanfile.py +++ b/recipes/rapidyaml/all/conanfile.py @@ -1,17 +1,20 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.microsoft import check_min_vs +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class RapidYAMLConan(ConanFile): name = "rapidyaml" description = "a library to parse and emit YAML, and do it fast." - topics = ("yaml", "parser", "emitter") license = "MIT", url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/biojppm/rapidyaml" + topics = ("yaml", "parser", "emitter") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -25,73 +28,61 @@ class RapidYAMLConan(ConanFile): "with_default_callbacks": True, "with_tab_tokens": False, } - generators = "cmake", "cmake_find_package_multi" - - _compiler_required_cpp11 = { - "Visual Studio": "13", - "gcc": "6", - "clang": "4", - } @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) < "0.4.0": + if Version(self.version) < "0.4.0": del self.options.with_tab_tokens def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("c4core/0.1.9") + self.requires("c4core/0.1.11") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - minimum_version = self._compiler_required_cpp11.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++11, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{0} requires C++11. Your compiler is unknown. Assuming it supports C++11.".format(self.name)) + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, 190) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["RYML_DEFAULT_CALLBACKS"] = self.options.with_default_callbacks - if tools.Version(self.version) >= "0.4.0": - cmake.definitions["RYML_WITH_TAB_TOKENS"] = self.options.with_tab_tokens - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RYML_DEFAULT_CALLBACKS"] = self.options.with_default_callbacks + if Version(self.version) >= "0.4.0": + tc.variables["RYML_WITH_TAB_TOKENS"] = self.options.with_tab_tokens + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "include"), "*.natvis") + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.natvis", os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "ryml") diff --git a/recipes/rapidyaml/all/patches/0.3.0-001-remove-internal-c4core.patch b/recipes/rapidyaml/all/patches/0.3.0-001-remove-internal-c4core.patch index e9fdf4bb8cbc8..124d310efbad6 100644 --- a/recipes/rapidyaml/all/patches/0.3.0-001-remove-internal-c4core.patch +++ b/recipes/rapidyaml/all/patches/0.3.0-001-remove-internal-c4core.patch @@ -1,5 +1,5 @@ diff --git a/CMakeLists.txt b/CMakeLists.txt -index a75251a..a55654e 100644 +index a75251a..3a5d087 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(ryml @@ -11,7 +11,17 @@ index a75251a..a55654e 100644 AUTHOR "Joao Paulo Magalhaes ") -@@ -52,8 +52,7 @@ c4_add_library(ryml +@@ -17,8 +17,7 @@ option(RYML_DBG "Enable (very verbose) ryml debug prints." OFF) + + #------------------------------------------------------- + +-c4_require_subproject(c4core INCORPORATE +- SUBDIRECTORY ${RYML_EXT_DIR}/c4core) ++find_package(c4core REQUIRED CONFIG) + + c4_add_library(ryml + SOURCES +@@ -52,8 +51,7 @@ c4_add_library(ryml INC_DIRS $ $ @@ -21,7 +31,7 @@ index a75251a..a55654e 100644 ) if(NOT RYML_DEFAULT_CALLBACKS) -@@ -68,7 +67,6 @@ endif() +@@ -68,7 +66,6 @@ endif() #------------------------------------------------------- c4_install_target(ryml) diff --git a/recipes/rapidyaml/all/patches/0.5.0-001-remove-internal-c4core.patch b/recipes/rapidyaml/all/patches/0.5.0-001-remove-internal-c4core.patch new file mode 100644 index 0000000000000..b9735434a58e1 --- /dev/null +++ b/recipes/rapidyaml/all/patches/0.5.0-001-remove-internal-c4core.patch @@ -0,0 +1,43 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 11c52e0..e79d144 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -6,7 +6,7 @@ project(ryml + LANGUAGES CXX) + include(./compat.cmake) + +-c4_project(VERSION 0.5.0 STANDALONE ++c4_project(VERSION 0.5.0 + AUTHOR "Joao Paulo Magalhaes ") + + +@@ -21,8 +21,7 @@ option(RYML_DBG "Enable (very verbose) ryml debug prints." OFF) + + #------------------------------------------------------- + +-c4_require_subproject(c4core INCORPORATE +- SUBDIRECTORY ${RYML_EXT_DIR}/c4core) ++find_package(c4core REQUIRED CONFIG) + + c4_add_library(ryml + SOURCES +@@ -56,9 +55,8 @@ c4_add_library(ryml + INC_DIRS + $ + $ +- LIBS c4core +- INCORPORATE c4core +- ) ++ LIBS c4core::c4core ++) + + if(RYML_WITH_TAB_TOKENS) + target_compile_definitions(ryml PUBLIC RYML_WITH_TAB_TOKENS) +@@ -76,7 +74,6 @@ endif() + #------------------------------------------------------- + + c4_install_target(ryml) +-c4_install_exports(DEPENDENCIES c4core) + c4_pack_project() + + diff --git a/recipes/rapidyaml/all/test_package/CMakeLists.txt b/recipes/rapidyaml/all/test_package/CMakeLists.txt index 41b3142802c8c..bc844b7829375 100644 --- a/recipes/rapidyaml/all/test_package/CMakeLists.txt +++ b/recipes/rapidyaml/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(ryml REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ryml::ryml) +target_link_libraries(${PROJECT_NAME} PRIVATE ryml::ryml) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) if(ryml_VERSION VERSION_GREATER_EQUAL "0.4.0") target_compile_definitions(${PROJECT_NAME} PRIVATE RYML_USE_PARSE_IN_ARENA) diff --git a/recipes/rapidyaml/all/test_package/conanfile.py b/recipes/rapidyaml/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/rapidyaml/all/test_package/conanfile.py +++ b/recipes/rapidyaml/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt b/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..bc541ea90b512 --- /dev/null +++ b/recipes/rapidyaml/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/rapidyaml/all/test_v1_package/conanfile.py b/recipes/rapidyaml/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/rapidyaml/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/rapidyaml/config.yml b/recipes/rapidyaml/config.yml index 0c5f8691c06f8..a10a27debb1f0 100644 --- a/recipes/rapidyaml/config.yml +++ b/recipes/rapidyaml/config.yml @@ -1,4 +1,6 @@ versions: + "0.5.0": + folder: all "0.4.1": folder: all "0.4.0": diff --git a/recipes/re2/all/conandata.yml b/recipes/re2/all/conandata.yml index 15ba52699710a..6f79311a0e803 100644 --- a/recipes/re2/all/conandata.yml +++ b/recipes/re2/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "20230201": + url: "https://github.com/google/re2/archive/refs/tags/2023-02-01.tar.gz" + sha256: "cbce8b7803e856827201a132862e41af386e7afd9cc6d9a9bc7a4fa4d8ddbdde" + "20221201": + url: "https://github.com/google/re2/archive/refs/tags/2022-12-01.tar.gz" + sha256: "665b65b6668156db2b46dddd33405cd422bd611352c5052ab3dae6a5fbac5506" "20220601": url: "https://github.com/google/re2/archive/refs/tags/2022-06-01.tar.gz" sha256: "f89c61410a072e5cbcf8c27e3a778da7d6fd2f2b5b1445cd4f4508bee946ab0f" @@ -23,27 +29,3 @@ sources: "20201101": url: "https://github.com/google/re2/archive/2020-11-01.tar.gz" sha256: "8903cc66c9d34c72e2bc91722288ebc7e3ec37787ecfef44d204b2d6281954d7" - "20201001": - url: "https://github.com/google/re2/archive/2020-10-01.tar.gz" - sha256: "0915741f524ad87debb9eb0429fe6016772a1569e21dc6d492039562308fcb0f" - "20200801": - url: "https://github.com/google/re2/archive/2020-08-01.tar.gz" - sha256: "6f4c8514249cd65b9e85d3e6f4c35595809a63ad71c5d93083e4d1dcdf9e0cd6" - "20200701": - url: "https://github.com/google/re2/archive/2020-07-01.tar.gz" - sha256: "116c74f4490b5d348492bc3822292320c9e5effe18c87bcafb616be464043321" - "20200601": - url: "https://github.com/google/re2/archive/2020-06-01.tar.gz" - sha256: "fb8e0f4ed7a212e3420507f27933ef5a8c01aec70e5148c6a35313573269fae6" - "20200501": - url: "https://github.com/google/re2/archive/2020-05-01.tar.gz" - sha256: "88864d7f5126bb17daa1aa8f41b05599aa6e3222e7b28a90e372db53c1c49aeb" - "20200401": - url: "https://github.com/google/re2/archive/2020-04-01.tar.gz" - sha256: "98794bc5416326817498384a9c43cbb5a406bab8da9f84f83c39ecad43ed5cea" - "20200301": - url: "https://github.com/google/re2/archive/2020-03-01.tar.gz" - sha256: "192a2855e9853091ad3f4c40c03b56d6f5d1fd4cb98ba07101c92f313d0398dc" - "20191101": - url: "https://github.com/google/re2/archive/2019-11-01.tar.gz" - sha256: "5229d7e801bdb3d62a1b9d82de7c74eda223cb5e264d5bd04bcf31a933245d27" diff --git a/recipes/re2/all/conanfile.py b/recipes/re2/all/conanfile.py index fa0b9e1fcd233..a4b44532b5660 100644 --- a/recipes/re2/all/conanfile.py +++ b/recipes/re2/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class Re2Conan(ConanFile): @@ -18,11 +18,11 @@ class Re2Conan(ConanFile): settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], - "fPIC": [True, False] + "fPIC": [True, False], } default_options = { "shared": False, - "fPIC": True + "fPIC": True, } def config_options(self): @@ -31,15 +31,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -61,10 +61,12 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "re2") self.cpp_info.set_property("cmake_target_name", "re2::re2") + self.cpp_info.set_property("pkg_config_name", "re2") self.cpp_info.libs = ["re2"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m", "pthread"] diff --git a/recipes/re2/all/test_package/conanfile.py b/recipes/re2/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/re2/all/test_package/conanfile.py +++ b/recipes/re2/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/re2/all/test_v1_package/CMakeLists.txt b/recipes/re2/all/test_v1_package/CMakeLists.txt index 40160fdcc3440..0d20897301b68 100644 --- a/recipes/re2/all/test_v1_package/CMakeLists.txt +++ b/recipes/re2/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(re2 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE re2::re2) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/re2/all/test_v1_package/conanfile.py b/recipes/re2/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/re2/all/test_v1_package/conanfile.py +++ b/recipes/re2/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/re2/config.yml b/recipes/re2/config.yml index d4ddea306645e..f8cd0a4310747 100644 --- a/recipes/re2/config.yml +++ b/recipes/re2/config.yml @@ -1,4 +1,8 @@ versions: + "20230201": + folder: all + "20221201": + folder: all "20220601": folder: all "20220201": @@ -15,19 +19,3 @@ versions: folder: all "20201101": folder: all - "20201001": - folder: all - "20200801": - folder: all - "20200701": - folder: all - "20200601": - folder: all - "20200501": - folder: all - "20200401": - folder: all - "20200301": - folder: all - "20191101": - folder: all diff --git a/recipes/reactiveplusplus/all/conandata.yml b/recipes/reactiveplusplus/all/conandata.yml new file mode 100644 index 0000000000000..b01e397208475 --- /dev/null +++ b/recipes/reactiveplusplus/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "0.2.1": + url: "https://github.com/victimsnino/ReactivePlusPlus/archive/refs/tags/v0.2.1.tar.gz" + sha256: "c41f9a0b727d5bdbc92390b3f075bfa280fd4f6f2aa7db51428fc30023b518d0" + "0.1.2": + url: "https://github.com/victimsnino/ReactivePlusPlus/archive/refs/tags/v0.1.2.tar.gz" + sha256: "daa16d8258d811bfc6848829ea1afa6f4a72b68ad8978d55ea4e1cf809ae6d52" diff --git a/recipes/reactiveplusplus/all/conanfile.py b/recipes/reactiveplusplus/all/conanfile.py new file mode 100644 index 0000000000000..d8d1eb5567b3d --- /dev/null +++ b/recipes/reactiveplusplus/all/conanfile.py @@ -0,0 +1,87 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.50.0" + + +class ReactivePlusPlusConan(ConanFile): + name = "reactiveplusplus" + description = ( + "ReactivePlusPlus is library for building asynchronous event-driven " + "streams of data with help of sequences of primitive operators in the " + "declarative form." + ) + license = "BSL-1.0" + topics = ("reactivex", "asynchronous", "event", "observable", "values-distributed-in-time") + homepage = "https://github.com/victimsnino/ReactivePlusPlus" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return "20" + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "16.10", + "msvc": "192", + "gcc": "10", + "clang": "12", + "apple-clang": "14", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", + src=os.path.join(self.source_folder, "src", "rpp", "rpp"), + dst=os.path.join(self.package_folder, "include", "rpp")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "RPP") + self.cpp_info.set_property("cmake_target_name", "RPP::rpp") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.names["cmake_find_package"] = "RPP" + self.cpp_info.names["cmake_find_package_multi"] = "RPP" + self.cpp_info.components["_reactiveplusplus"].names["cmake_find_package"] = "rpp" + self.cpp_info.components["_reactiveplusplus"].names["cmake_find_package_multi"] = "rpp" + self.cpp_info.components["_reactiveplusplus"].set_property("cmake_target_name", "RPP::rpp") + self.cpp_info.components["_reactiveplusplus"].bindirs = [] + self.cpp_info.components["_reactiveplusplus"].libdirs = [] diff --git a/recipes/reactiveplusplus/all/test_package/CMakeLists.txt b/recipes/reactiveplusplus/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..96e89147f81a9 --- /dev/null +++ b/recipes/reactiveplusplus/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(RPP REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE RPP::rpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/reactiveplusplus/all/test_package/conanfile.py b/recipes/reactiveplusplus/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/reactiveplusplus/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/reactiveplusplus/all/test_package/test_package.cpp b/recipes/reactiveplusplus/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..cbca58fc39109 --- /dev/null +++ b/recipes/reactiveplusplus/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include + +#include +#include + +int main() +{ + auto observable = rpp::source::from_callable(&::getchar) + .repeat() + .take_while([](char v) { return v != '0'; }) + .filter(std::not_fn(&::isdigit)) + .map(&::toupper); + return 0; +} diff --git a/recipes/reactiveplusplus/all/test_v1_package/CMakeLists.txt b/recipes/reactiveplusplus/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/reactiveplusplus/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/reactiveplusplus/all/test_v1_package/conanfile.py b/recipes/reactiveplusplus/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/reactiveplusplus/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/reactiveplusplus/config.yml b/recipes/reactiveplusplus/config.yml new file mode 100644 index 0000000000000..4fec465c4ccad --- /dev/null +++ b/recipes/reactiveplusplus/config.yml @@ -0,0 +1,5 @@ +versions: + "0.2.1": + folder: all + "0.1.2": + folder: all diff --git a/recipes/read-excel/all/conandata.yml b/recipes/read-excel/all/conandata.yml index 60d02b8ef24cb..e92cf97bbd387 100644 --- a/recipes/read-excel/all/conandata.yml +++ b/recipes/read-excel/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.8": + url: "https://github.com/igormironchik/read-excel/archive/refs/tags/1.2.8.tar.gz" + sha256: "26859a7262500bfb7703197bb2726ea9bca33455f3102eb3e15e4ddfc97c6a07" "1.2.7": url: "https://github.com/igormironchik/read-excel/archive/refs/tags/1.2.7.tar.gz" sha256: "9ed9518e796167c1c121bb20c2d395c8c8ae52cf469613914254d55ca517ab34" diff --git a/recipes/read-excel/all/conanfile.py b/recipes/read-excel/all/conanfile.py index be087afee96b9..11abb986cdd31 100644 --- a/recipes/read-excel/all/conanfile.py +++ b/recipes/read-excel/all/conanfile.py @@ -1,7 +1,12 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -import textwrap + +required_conan_version = ">=1.50.0" class ReadExcelConan(ConanFile): @@ -15,8 +20,8 @@ class ReadExcelConan(ConanFile): no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" @property def _compilers_minimum_version(self): @@ -29,28 +34,32 @@ def _compilers_minimum_version(self): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") - - compiler = str(self.settings.compiler) - if compiler not in self._compilers_minimum_version: - self.output.warn("Unknown compiler, assuming it supports at least C++14") - return + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", + ) - version = tools.Version(self.settings.compiler.version) - if version < self._compilers_minimum_version[compiler]: - raise ConanInvalidConfiguration("args-parser requires a compiler that supports at least C++14") + def layout(self): + basic_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy("*.hpp", src=os.path.join(self._source_subfolder, "read-excel"), dst=os.path.join("include", "read-excel")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "read-excel"), dst=os.path.join(self.package_folder, "include", "read-excel")) def package_id(self): - self.info.header_only() + self.info.clear() def package_info(self): - self.cpp_info.names["cmake_find_package"] = "read-excel" - self.cpp_info.names["cmake_find_package_multi"] = "read-excel" - self.cpp_info.includedirs.append(os.path.join("include", "read-excel")) + self.cpp_info.set_property("cmake_file_name", "read-excel") + self.cpp_info.set_property("cmake_target_name", "read-excel::read-excel") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/read-excel/all/test_package/CMakeLists.txt b/recipes/read-excel/all/test_package/CMakeLists.txt index d8e0866953600..a5298e30eba45 100644 --- a/recipes/read-excel/all/test_package/CMakeLists.txt +++ b/recipes/read-excel/all/test_package/CMakeLists.txt @@ -1,18 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -project(read-excel.test) +find_package(read-excel REQUIRED CONFIG) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - -conan_basic_setup(TARGETS) - -find_package(read-excel REQUIRED) - -add_executable(${PROJECT_NAME} example.cpp) - -target_link_libraries(${PROJECT_NAME} read-excel::read-excel) - -set_target_properties(${PROJECT_NAME} PROPERTIES - CXX_STANDARD 14 - CXX_STANDARD_REQUIRED ON -) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE read-excel::read-excel) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/read-excel/all/test_package/conanfile.py b/recipes/read-excel/all/test_package/conanfile.py index 9c4e599a17f72..bddb5e263d5d6 100644 --- a/recipes/read-excel/all/test_package/conanfile.py +++ b/recipes/read-excel/all/test_package/conanfile.py @@ -1,8 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -class ReadExcelTestConan(ConanFile): - generators = "cmake", "cmake_find_package" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -10,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "read-excel.test") - xls_path = os.path.join(self.source_folder, "sample.xls"); - self.run("{} \"{}\"".format(bin_path, xls_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + xls_path = os.path.join(self.source_folder, "sample.xls") + self.run("{} \"{}\"".format(bin_path, xls_path), env="conanrun") diff --git a/recipes/read-excel/all/test_package/example.cpp b/recipes/read-excel/all/test_package/test_package.cpp similarity index 100% rename from recipes/read-excel/all/test_package/example.cpp rename to recipes/read-excel/all/test_package/test_package.cpp diff --git a/recipes/read-excel/all/test_v1_package/CMakeLists.txt b/recipes/read-excel/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8af52c8273805 --- /dev/null +++ b/recipes/read-excel/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/read-excel/all/test_v1_package/conanfile.py b/recipes/read-excel/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3524db189d6f0 --- /dev/null +++ b/recipes/read-excel/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + xls_path = os.path.join(self.source_folder, os.pardir, "test_package", "sample.xls") + self.run("{} \"{}\"".format(bin_path, xls_path), run_environment=True) diff --git a/recipes/read-excel/config.yml b/recipes/read-excel/config.yml index 41cc43a4d480b..e85e4f8b47c32 100644 --- a/recipes/read-excel/config.yml +++ b/recipes/read-excel/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.8": + folder: "all" "1.2.7": folder: "all" "1.2.6": diff --git a/recipes/recastnavigation/all/CMakeLists.txt b/recipes/recastnavigation/all/CMakeLists.txt deleted file mode 100644 index 07ec7f05275cb..0000000000000 --- a/recipes/recastnavigation/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/recastnavigation/all/conandata.yml b/recipes/recastnavigation/all/conandata.yml index fbfd982ff8b37..eeea285038775 100644 --- a/recipes/recastnavigation/all/conandata.yml +++ b/recipes/recastnavigation/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "cci.20200511": - patch_file: "patches/001_fix_shared_option.patch" - base_path: "source_subfolder" diff --git a/recipes/recastnavigation/all/conanfile.py b/recipes/recastnavigation/all/conanfile.py index 8340de036cff1..cc3eb12118665 100644 --- a/recipes/recastnavigation/all/conanfile.py +++ b/recipes/recastnavigation/all/conanfile.py @@ -1,19 +1,20 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class RecastNavigationConan(ConanFile): name = "recastnavigation" homepage = "https://github.com/recastnavigation/recastnavigation" description = " Navigation-mesh Toolset for Games" - topics = ("conan", "navmesh", "recast", "navigation", "crowd") + topics = ("navmesh", "recast", "navigation", "crowd") url = "https://github.com/conan-io/conan-center-index" license = "Zlib" - exports_sources = ["CMakeLists.txt", "patches/*"] - generators = "cmake" - settings = "os", "compiler", "build_type", "arch" + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -22,17 +23,11 @@ class RecastNavigationConan(ConanFile): "shared": False, "fPIC": True, } - short_paths = True - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + short_paths = True - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -40,54 +35,70 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["RECASTNAVIGATION_DEMO"] = False - self._cmake.definitions["RECASTNAVIGATION_TESTS"] = False - self._cmake.definitions["RECASTNAVIGATION_EXAMPLES"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RECASTNAVIGATION_DEMO"] = False + tc.variables["RECASTNAVIGATION_TESTS"] = False + tc.variables["RECASTNAVIGATION_EXAMPLES"] = False + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("License.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "License.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.names["cmake_find_package"] = "recastnavigation" - self.cpp_info.names["cmake_find_package_multi"] = "recastnavigation" - self.cpp_info.components["Recast"].names["cmake_find_package"] = "Recast" - self.cpp_info.components["Recast"].names["cmake_find_package_multi"] = "Recast" + self.cpp_info.set_property("cmake_file_name", "recastnavigation") + self.cpp_info.set_property("pkg_config_name", "recastnavigation") + + self.cpp_info.components["Recast"].set_property("cmake_target_name", "RecastNavigation::Recast") self.cpp_info.components["Recast"].libs = ["Recast"] - self.cpp_info.components["Detour"].names["cmake_find_package"] = "Detour" - self.cpp_info.components["Detour"].names["cmake_find_package_multi"] = "Detour" + self.cpp_info.components["Detour"].set_property("cmake_target_name", "RecastNavigation::Detour") self.cpp_info.components["Detour"].libs = ["Detour"] - self.cpp_info.components["DetourCrowd"].names["cmake_find_package"] = "DetourCrowd" - self.cpp_info.components["DetourCrowd"].names["cmake_find_package_multi"] = "DetourCrowd" + self.cpp_info.components["DetourCrowd"].set_property("cmake_target_name", "RecastNavigation::DetourCrowd") self.cpp_info.components["DetourCrowd"].libs = ["DetourCrowd"] self.cpp_info.components["DetourCrowd"].requires = ["Detour"] - self.cpp_info.components["DetourTileCache"].names["cmake_find_package"] = "DetourTileCache" - self.cpp_info.components["DetourTileCache"].names["cmake_find_package_multi"] = "DetourTileCache" + self.cpp_info.components["DetourTileCache"].set_property("cmake_target_name", "RecastNavigation::DetourTileCache") self.cpp_info.components["DetourTileCache"].libs = ["DetourTileCache"] self.cpp_info.components["DetourTileCache"].requires = ["Detour"] - self.cpp_info.components["DebugUtils"].names["cmake_find_package"] = "DebugUtils" - self.cpp_info.components["DebugUtils"].names["cmake_find_package_multi"] = "DebugUtils" + self.cpp_info.components["DebugUtils"].set_property("cmake_target_name", "RecastNavigation::DebugUtils") self.cpp_info.components["DebugUtils"].libs = ["DebugUtils"] self.cpp_info.components["DebugUtils"].requires = ["Recast", "Detour", "DetourTileCache"] + + # TODO: to remove in conan v2 + self.cpp_info.filenames["cmake_find_package"] = "recastnavigation" + self.cpp_info.filenames["cmake_find_package_multi"] = "recastnavigation" + self.cpp_info.names["cmake_find_package"] = "RecastNavigation" + self.cpp_info.names["cmake_find_package_multi"] = "RecastNavigation" + self.cpp_info.components["Recast"].names["cmake_find_package"] = "Recast" + self.cpp_info.components["Recast"].names["cmake_find_package_multi"] = "Recast" + self.cpp_info.components["Detour"].names["cmake_find_package"] = "Detour" + self.cpp_info.components["Detour"].names["cmake_find_package_multi"] = "Detour" + self.cpp_info.components["DetourCrowd"].names["cmake_find_package"] = "DetourCrowd" + self.cpp_info.components["DetourCrowd"].names["cmake_find_package_multi"] = "DetourCrowd" + self.cpp_info.components["DetourTileCache"].names["cmake_find_package"] = "DetourTileCache" + self.cpp_info.components["DetourTileCache"].names["cmake_find_package_multi"] = "DetourTileCache" + self.cpp_info.components["DebugUtils"].names["cmake_find_package"] = "DebugUtils" + self.cpp_info.components["DebugUtils"].names["cmake_find_package_multi"] = "DebugUtils" diff --git a/recipes/recastnavigation/all/test_package/CMakeLists.txt b/recipes/recastnavigation/all/test_package/CMakeLists.txt index 945696beb2efc..e3ac85f3e748b 100644 --- a/recipes/recastnavigation/all/test_package/CMakeLists.txt +++ b/recipes/recastnavigation/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(recastnavigation REQUIRED CONFIG) add_executable(${CMAKE_PROJECT_NAME} test_package.cpp) -target_link_libraries(${CMAKE_PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${CMAKE_PROJECT_NAME} PRIVATE RecastNavigation::Recast) diff --git a/recipes/recastnavigation/all/test_package/conanfile.py b/recipes/recastnavigation/all/test_package/conanfile.py index 12dd810a6ab3b..0a6bc68712d90 100644 --- a/recipes/recastnavigation/all/test_package/conanfile.py +++ b/recipes/recastnavigation/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/recastnavigation/all/test_v1_package/CMakeLists.txt b/recipes/recastnavigation/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/recastnavigation/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/recastnavigation/all/test_v1_package/conanfile.py b/recipes/recastnavigation/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/recastnavigation/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/reckless/all/CMakeLists.txt b/recipes/reckless/all/CMakeLists.txt deleted file mode 100644 index 3db0dfa8d7442..0000000000000 --- a/recipes/reckless/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/reckless/all/conandata.yml b/recipes/reckless/all/conandata.yml index 04a7a6a7709ce..665e1d59c75b6 100644 --- a/recipes/reckless/all/conandata.yml +++ b/recipes/reckless/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "3.0.3": - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" diff --git a/recipes/reckless/all/conanfile.py b/recipes/reckless/all/conanfile.py index 95a9371039747..a52137d87d9c7 100644 --- a/recipes/reckless/all/conanfile.py +++ b/recipes/reckless/all/conanfile.py @@ -1,14 +1,19 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.microsoft import is_msvc +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class RecklessConan(ConanFile): name = "reckless" description = "Reckless is an extremely low-latency, high-throughput logging library." license = "MIT" - topics = ("reckless", "logging") + topics = ("logging") homepage = "https://github.com/mattiasflodin/reckless" url = "https://github.com/conan-io/conan-center-index" @@ -22,13 +27,8 @@ class RecklessConan(ConanFile): "fPIC": True, } - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -36,41 +36,44 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - if self.settings.os not in ["Windows", "Linux"]: - raise ConanInvalidConfiguration("reckless only supports Windows and Linux") - if self.settings.os == "Windows" and self.settings.compiler != "Visual Studio": - raise ConanInvalidConfiguration("reckless only supports Visual Studio on Windows") - if self.settings.compiler == "Visual Studio" and self.options.shared: - raise ConanInvalidConfiguration("reckless shared not supported by Visual Studio") - if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": - raise ConanInvalidConfiguration("reckless doesn't support clang with libc++") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if self.info.settings.os not in ["Windows", "Linux"]: + raise ConanInvalidConfiguration(f"{self.ref} only supports Windows and Linux") + if self.info.settings.os == "Windows" and not is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} only supports Visual Studio on Windows") + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") + if self.info.settings.compiler == "clang" and self.info.settings.compiler.get_safe("libcxx") == "libc++": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support clang with libc++") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["RECKLESS_BUILD_EXAMPLES"] = False - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RECKLESS_BUILD_EXAMPLES"] = False + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/reckless/all/test_package/CMakeLists.txt b/recipes/reckless/all/test_package/CMakeLists.txt index 55a397656bcd0..7923780072c36 100644 --- a/recipes/reckless/all/test_package/CMakeLists.txt +++ b/recipes/reckless/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(reckless REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} reckless::reckless) +target_link_libraries(${PROJECT_NAME} PRIVATE reckless::reckless) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/reckless/all/test_package/conanfile.py b/recipes/reckless/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/reckless/all/test_package/conanfile.py +++ b/recipes/reckless/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/reckless/all/test_v1_package/CMakeLists.txt b/recipes/reckless/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/reckless/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/reckless/all/test_v1_package/conanfile.py b/recipes/reckless/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/reckless/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/redis-plus-plus/all/CMakeLists.txt b/recipes/redis-plus-plus/all/CMakeLists.txt deleted file mode 100644 index c921d02a0d877..0000000000000 --- a/recipes/redis-plus-plus/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/redis-plus-plus/all/conandata.yml b/recipes/redis-plus-plus/all/conandata.yml index 10a29df613c4d..2437f2fe67b15 100644 --- a/recipes/redis-plus-plus/all/conandata.yml +++ b/recipes/redis-plus-plus/all/conandata.yml @@ -1,26 +1,40 @@ sources: + "1.3.7": + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.7.tar.gz" + sha256: "89cb83b0a23ac5825300c301814eab74aa3cdcfcd12e87d443c2692e367768ba" "1.3.3": - sha256: 23689059b7ba50fcd8fa673c5dbb7bdb010b896b14abad5aa80a5ec48eb64f26 - url: https://github.com/sewenew/redis-plus-plus/archive/1.3.3.tar.gz + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.3.tar.gz" + sha256: "23689059b7ba50fcd8fa673c5dbb7bdb010b896b14abad5aa80a5ec48eb64f26" "1.3.2": - sha256: e172cd8dcfeaf649e20a2d24537f8676c7cabed5c24182d73be189e53a013289 - url: https://github.com/sewenew/redis-plus-plus/archive/1.3.2.tar.gz + url: "https://github.com/sewenew/redis-plus-plus/archive/1.3.2.tar.gz" + sha256: "e172cd8dcfeaf649e20a2d24537f8676c7cabed5c24182d73be189e53a013289" "1.2.3": - sha256: 1a3336752133019c963e06c28667b96690d6395b804e5e326671777ff88982ea - url: https://github.com/sewenew/redis-plus-plus/archive/1.2.3.tar.gz + url: "https://github.com/sewenew/redis-plus-plus/archive/1.2.3.tar.gz" + sha256: "1a3336752133019c963e06c28667b96690d6395b804e5e326671777ff88982ea" "1.2.1": - sha256: f09c9fcc362955edb887632cd008102887278c94934d7e8c9d0acb8707671902 - url: https://github.com/sewenew/redis-plus-plus/archive/1.2.1.tar.gz + url: "https://github.com/sewenew/redis-plus-plus/archive/1.2.1.tar.gz" + sha256: "f09c9fcc362955edb887632cd008102887278c94934d7e8c9d0acb8707671902" patches: + "1.3.7": + - patch_file: "patches/1.3.7-0001-fix-dependencies-injection.patch" + patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" + patch_type: "conan" "1.3.3": - - patch_file: "patches/1.3.3-fix-conan-cmake-package.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.3.3-0001-fix-dependencies-injection.patch" + patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" + patch_type: "conan" "1.3.2": - - patch_file: "patches/1.3.2-fix-conan-cmake-package.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.3.2-0001-fix-dependencies-injection.patch" + patch_description: "Robust discovery & injection of dependencies, and handle missing hiredis_ssl-config.cmake" + patch_type: "conan" "1.2.3": - - patch_file: "patches/1.2.3-fix-conan-cmake-package.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.2.3-0001-fix-conan-cmake-package.patch" + patch_description: "Robust discovery & injection of dependencies" + patch_type: "conan" "1.2.1": - - patch_file: "patches/fix-hiredis-consumption.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.2.1-0001-fix-hiredis-consumption.patch" + patch_description: "Robust discovery & injection of dependencies" + patch_type: "conan" + - patch_file: "patches/1.2.1-0002-cmake-minimum-required.patch" + patch_description: "CMake: move cmake_minimum_required() before project()" + patch_type: "conan" diff --git a/recipes/redis-plus-plus/all/conanfile.py b/recipes/redis-plus-plus/all/conanfile.py index 2ccfad418117b..b10c66e4f7f94 100644 --- a/recipes/redis-plus-plus/all/conanfile.py +++ b/recipes/redis-plus-plus/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" + class RedisPlusPlusConan(ConanFile): name = "redis-plus-plus" @@ -11,129 +16,138 @@ class RedisPlusPlusConan(ConanFile): topics = ("database", "redis", "client", "tls") url = "https://github.com/conan-io/conan-center-index" license = "Apache-2.0" - generators = "cmake", "cmake_find_package_multi" - settings = "os", "compiler", "build_type", "arch" + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], "with_tls": [True, False], - "build_async": [True, False] + "build_async": [True, False], } default_options = { "shared": False, "fPIC": True, "with_tls": False, - "build_async": False - } - - _cmake = None - - _compiler_required_cpp17 = { - "Visual Studio": "16", - "gcc": "8", - "clang": "7", - "apple-clang": "12.0", + "build_async": False, } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "11" if Version(self.version) < "1.3.0" else "17" @property - def _build_subfolder(self): - return "build_subfolder" + def _compilers_minimum_version(self): + if Version(self.version) < "1.3.0": + return {} + return { + "Visual Studio": "16", + "msvc": "192", + "gcc": "8", + "clang": "7", + "apple-clang": "12", + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "1.3.0": + del self.options.build_async def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("hiredis/1.0.2") - if self.options.build_async: - self.requires("libuv/1.44.1") + self.requires("hiredis/1.1.0") + if self.options.get_safe("build_async"): + self.requires("libuv/1.44.2") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - if tools.Version(self.version) >= "1.3.0": - tools.check_min_cppstd(self, 17) - else: - tools.check_min_cppstd(self, 11) - - if tools.Version(self.version) >= "1.3.0": - minimum_version = self._compiler_required_cpp17.get(str(self.settings.compiler), False) - if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not support.".format(self.name)) - else: - self.output.warn("{0} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) - - if self.options.with_tls != self.options["hiredis"].with_ssl: - raise ConanInvalidConfiguration("with_tls must match hiredis.with_ssl option") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + if self.info.options.with_tls and not self.dependencies["hiredis"].options.with_ssl: + raise ConanInvalidConfiguration(f"{self.name}:with_tls=True requires hiredis:with_ssl=True") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _configure_cmake(self): - if not self._cmake: - self._cmake = CMake(self) - self._cmake.definitions["REDIS_PLUS_PLUS_USE_TLS"] = self.options.with_tls - if self.options.build_async: - self._cmake.definitions["REDIS_PLUS_PLUS_BUILD_ASYNC"] = "libuv" - self._cmake.definitions["REDIS_PLUS_PLUS_BUILD_TEST"] = False - self._cmake.definitions["REDIS_PLUS_PLUS_BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["REDIS_PLUS_PLUS_BUILD_SHARED"] = self.options.shared - if tools.Version(self.version) >= "1.2.3": - self._cmake.definitions["REDIS_PLUS_PLUS_BUILD_STATIC_WITH_PIC"] = self.options.shared - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if self.settings.compiler.get_safe("cppstd"): + cppstd = str(self.settings.compiler.cppstd) + if cppstd.startswith("gnu"): + cppstd = cppstd[3:] + tc.cache_variables["REDIS_PLUS_PLUS_CXX_STANDARD"] = cppstd + tc.variables["REDIS_PLUS_PLUS_USE_TLS"] = self.options.with_tls + if self.options.get_safe("build_async"): + tc.cache_variables["REDIS_PLUS_PLUS_BUILD_ASYNC"] = "libuv" + tc.variables["REDIS_PLUS_PLUS_BUILD_TEST"] = False + tc.variables["REDIS_PLUS_PLUS_BUILD_STATIC"] = not self.options.shared + tc.variables["REDIS_PLUS_PLUS_BUILD_SHARED"] = self.options.shared + if Version(self.version) >= "1.2.3": + tc.variables["REDIS_PLUS_PLUS_BUILD_STATIC_WITH_PIC"] = self.options.shared + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) < "1.2.3": - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + apply_conandata_patches(self) + if Version(self.version) < "1.2.3": + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set_target_properties(${STATIC_LIB} PROPERTIES POSITION_INDEPENDENT_CODE ON)", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "redis++") - self.cpp_info.set_property("cmake_target_name", "redis++::redis++" + "_static" if not self.options.shared else "") - self.cpp_info.components["redis++lib"].set_property("cmake_target_name", "redis++" + "_static" if not self.options.shared else "") - self.cpp_info.components["redis++lib"].set_property("pkg_config_name", "redis++" + "_static" if not self.options.shared else "") - - self.cpp_info.names["cmake_find_package"] = "redis++" - self.cpp_info.names["cmake_find_package_multi"] = "redis++" - self.cpp_info.names["pkg_config"] = "redis++" - self.cpp_info.components["redis++lib"].names["cmake_find_package"] = "redis++" + "_static" if not self.options.shared else "" - self.cpp_info.components["redis++lib"].names["cmake_find_package_multi"] = "redis++" + "_static" if not self.options.shared else "" - - suffix = "_static" if self.settings.os == "Windows" and not self.options.shared else "" - self.cpp_info.components["redis++lib"].libs = ["redis++" + suffix] + target_suffix = "" if self.options.shared else "_static" + self.cpp_info.set_property("cmake_target_name", f"redis++::redis++{target_suffix}") + self.cpp_info.set_property("pkg_config_name", "redis++") + # TODO: back to global scope in conan v2 + lib_suffix = "_static" if self.settings.os == "Windows" and not self.options.shared else "" + self.cpp_info.components["redis++lib"].libs = [f"redis++{lib_suffix}"] self.cpp_info.components["redis++lib"].requires = ["hiredis::hiredis"] if self.options.with_tls: self.cpp_info.components["redis++lib"].requires.append("hiredis::hiredis_ssl") + if self.options.get_safe("build_async"): + self.cpp_info.components["redis++lib"].requires.append("libuv::libuv") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["redis++lib"].system_libs.append("pthread") + self.cpp_info.components["redis++lib"].system_libs.append("m") + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "redis++" + self.cpp_info.names["cmake_find_package_multi"] = "redis++" + self.cpp_info.components["redis++lib"].names["cmake_find_package"] = f"redis++{target_suffix}" + self.cpp_info.components["redis++lib"].names["cmake_find_package_multi"] = f"redis++{target_suffix}" + self.cpp_info.components["redis++lib"].set_property("cmake_target_name", f"redis++::redis++{target_suffix}") + self.cpp_info.components["redis++lib"].set_property("pkg_config_name", "redis++") diff --git a/recipes/redis-plus-plus/all/patches/fix-hiredis-consumption.patch b/recipes/redis-plus-plus/all/patches/1.2.1-0001-fix-hiredis-consumption.patch similarity index 100% rename from recipes/redis-plus-plus/all/patches/fix-hiredis-consumption.patch rename to recipes/redis-plus-plus/all/patches/1.2.1-0001-fix-hiredis-consumption.patch diff --git a/recipes/redis-plus-plus/all/patches/1.2.1-0002-cmake-minimum-required.patch b/recipes/redis-plus-plus/all/patches/1.2.1-0002-cmake-minimum-required.patch new file mode 100644 index 0000000000000..d00f3b331f4ab --- /dev/null +++ b/recipes/redis-plus-plus/all/patches/1.2.1-0002-cmake-minimum-required.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,10 +1,10 @@ +-project(redis++) + + if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin") + cmake_minimum_required(VERSION 3.0.0) + else() +- cmake_minimum_required(VERSION 2.8.0) ++ cmake_minimum_required(VERSION 3.0.0) + endif() ++project(redis++) + + if (NOT DEFINED REDIS_PLUS_PLUS_CXX_STANDARD) + set(REDIS_PLUS_PLUS_CXX_STANDARD 11) diff --git a/recipes/redis-plus-plus/all/patches/1.2.3-fix-conan-cmake-package.patch b/recipes/redis-plus-plus/all/patches/1.2.3-0001-fix-conan-cmake-package.patch similarity index 100% rename from recipes/redis-plus-plus/all/patches/1.2.3-fix-conan-cmake-package.patch rename to recipes/redis-plus-plus/all/patches/1.2.3-0001-fix-conan-cmake-package.patch diff --git a/recipes/redis-plus-plus/all/patches/1.3.2-0001-fix-dependencies-injection.patch b/recipes/redis-plus-plus/all/patches/1.3.2-0001-fix-dependencies-injection.patch new file mode 100644 index 0000000000000..27a7e92866036 --- /dev/null +++ b/recipes/redis-plus-plus/all/patches/1.3.2-0001-fix-dependencies-injection.patch @@ -0,0 +1,39 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -30,8 +30,7 @@ if(REDIS_PLUS_PLUS_BUILD_ASYNC) + message(STATUS "redis-plus-plus build async interface with libuv") + + # libuv dependency +- find_path(REDIS_PLUS_PLUS_ASYNC_LIB_HEADER NAMES uv.h) +- find_library(REDIS_PLUS_PLUS_ASYNC_LIB uv) ++ find_package(libuv REQUIRED CONFIG) + else() + message(FATAL_ERROR "invalid REDIS_PLUS_PLUS_BUILD_ASYNC") + endif() +@@ -111,7 +110,6 @@ if(hiredis_FOUND) + list(APPEND REDIS_PLUS_PLUS_HIREDIS_LIBS hiredis::hiredis) + + if(REDIS_PLUS_PLUS_USE_TLS) +- find_package(hiredis_ssl REQUIRED) + list(APPEND REDIS_PLUS_PLUS_HIREDIS_LIBS hiredis::hiredis_ssl) + endif() + else() +@@ -150,7 +148,7 @@ if(REDIS_PLUS_PLUS_BUILD_STATIC) + + if(REDIS_PLUS_PLUS_BUILD_ASYNC) + target_include_directories(${STATIC_LIB} PUBLIC $) +- target_include_directories(${STATIC_LIB} PUBLIC $) ++ target_link_libraries(${STATIC_LIB} PUBLIC $,uv,uv_a>) + if(REDIS_PLUS_PLUS_ASYNC_FUTURE STREQUAL "boost") + target_include_directories(${STATIC_LIB} SYSTEM PUBLIC $) + endif() +@@ -202,8 +200,7 @@ if(REDIS_PLUS_PLUS_BUILD_SHARED) + + if(REDIS_PLUS_PLUS_BUILD_ASYNC) + target_include_directories(${SHARED_LIB} PUBLIC $) +- target_include_directories(${SHARED_LIB} PUBLIC $) +- target_link_libraries(${SHARED_LIB} PUBLIC ${REDIS_PLUS_PLUS_ASYNC_LIB}) ++ target_link_libraries(${SHARED_LIB} PUBLIC $,uv,uv_a>) + if(REDIS_PLUS_PLUS_ASYNC_FUTURE STREQUAL "boost") + target_include_directories(${SHARED_LIB} SYSTEM PUBLIC $) + endif() diff --git a/recipes/redis-plus-plus/all/patches/1.3.2-fix-conan-cmake-package.patch b/recipes/redis-plus-plus/all/patches/1.3.2-fix-conan-cmake-package.patch deleted file mode 100644 index 01cf9c7921864..0000000000000 --- a/recipes/redis-plus-plus/all/patches/1.3.2-fix-conan-cmake-package.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index a2780cd..a4d0fa3 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -111,7 +111,6 @@ if(hiredis_FOUND) - list(APPEND REDIS_PLUS_PLUS_HIREDIS_LIBS hiredis::hiredis) - - if(REDIS_PLUS_PLUS_USE_TLS) -- find_package(hiredis_ssl REQUIRED) - list(APPEND REDIS_PLUS_PLUS_HIREDIS_LIBS hiredis::hiredis_ssl) - endif() - else() diff --git a/recipes/redis-plus-plus/all/patches/1.3.3-0001-fix-dependencies-injection.patch b/recipes/redis-plus-plus/all/patches/1.3.3-0001-fix-dependencies-injection.patch new file mode 100644 index 0000000000000..90500520116b4 --- /dev/null +++ b/recipes/redis-plus-plus/all/patches/1.3.3-0001-fix-dependencies-injection.patch @@ -0,0 +1,39 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -34,8 +34,7 @@ if(REDIS_PLUS_PLUS_BUILD_ASYNC) + message(STATUS "redis-plus-plus build async interface with libuv") + + # libuv dependency +- find_path(REDIS_PLUS_PLUS_ASYNC_LIB_HEADER NAMES uv.h) +- find_library(REDIS_PLUS_PLUS_ASYNC_LIB uv) ++ find_package(libuv REQUIRED CONFIG) + else() + message(FATAL_ERROR "invalid REDIS_PLUS_PLUS_BUILD_ASYNC") + endif() +@@ -115,7 +114,6 @@ if(hiredis_FOUND) + list(APPEND REDIS_PLUS_PLUS_HIREDIS_LIBS hiredis::hiredis) + + if(REDIS_PLUS_PLUS_USE_TLS) +- find_package(hiredis_ssl REQUIRED) + list(APPEND REDIS_PLUS_PLUS_HIREDIS_LIBS hiredis::hiredis_ssl) + endif() + else() +@@ -155,7 +153,7 @@ if(REDIS_PLUS_PLUS_BUILD_STATIC) + + if(REDIS_PLUS_PLUS_BUILD_ASYNC) + target_include_directories(${STATIC_LIB} PUBLIC $) +- target_include_directories(${STATIC_LIB} PUBLIC $) ++ target_link_libraries(${STATIC_LIB} PUBLIC $,uv,uv_a>) + if(REDIS_PLUS_PLUS_ASYNC_FUTURE STREQUAL "boost") + target_include_directories(${STATIC_LIB} SYSTEM PUBLIC $) + endif() +@@ -208,8 +206,7 @@ if(REDIS_PLUS_PLUS_BUILD_SHARED) + + if(REDIS_PLUS_PLUS_BUILD_ASYNC) + target_include_directories(${SHARED_LIB} PUBLIC $) +- target_include_directories(${SHARED_LIB} PUBLIC $) +- target_link_libraries(${SHARED_LIB} PUBLIC ${REDIS_PLUS_PLUS_ASYNC_LIB}) ++ target_link_libraries(${SHARED_LIB} PUBLIC $,uv,uv_a>) + if(REDIS_PLUS_PLUS_ASYNC_FUTURE STREQUAL "boost") + target_include_directories(${SHARED_LIB} SYSTEM PUBLIC $) + endif() diff --git a/recipes/redis-plus-plus/all/patches/1.3.3-fix-conan-cmake-package.patch b/recipes/redis-plus-plus/all/patches/1.3.3-fix-conan-cmake-package.patch deleted file mode 100644 index 13d32af6c5388..0000000000000 --- a/recipes/redis-plus-plus/all/patches/1.3.3-fix-conan-cmake-package.patch +++ /dev/null @@ -1,12 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index 29b8bfe..547c88f 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -115,7 +115,6 @@ if(hiredis_FOUND) - list(APPEND REDIS_PLUS_PLUS_HIREDIS_LIBS hiredis::hiredis) - - if(REDIS_PLUS_PLUS_USE_TLS) -- find_package(hiredis_ssl REQUIRED) - list(APPEND REDIS_PLUS_PLUS_HIREDIS_LIBS hiredis::hiredis_ssl) - endif() - else() diff --git a/recipes/redis-plus-plus/all/patches/1.3.7-0001-fix-dependencies-injection.patch b/recipes/redis-plus-plus/all/patches/1.3.7-0001-fix-dependencies-injection.patch new file mode 100644 index 0000000000000..19ec65facf381 --- /dev/null +++ b/recipes/redis-plus-plus/all/patches/1.3.7-0001-fix-dependencies-injection.patch @@ -0,0 +1,33 @@ +diff --git a/a/CMakeLists.txt b/b/CMakeLists.txt +index 69794d9..fbb75b7 100644 +--- a/a/CMakeLists.txt ++++ b/b/CMakeLists.txt +@@ -34,8 +34,7 @@ if(REDIS_PLUS_PLUS_BUILD_ASYNC) + message(STATUS "redis-plus-plus build async interface with libuv") + + # libuv dependency +- find_path(REDIS_PLUS_PLUS_ASYNC_LIB_HEADER NAMES uv.h) +- find_library(REDIS_PLUS_PLUS_ASYNC_LIB uv) ++ find_package(libuv REQUIRED CONFIG) + else() + message(FATAL_ERROR "invalid REDIS_PLUS_PLUS_BUILD_ASYNC") + endif() +@@ -191,7 +190,7 @@ if(REDIS_PLUS_PLUS_BUILD_STATIC) + + if(REDIS_PLUS_PLUS_BUILD_ASYNC) + target_include_directories(${STATIC_LIB} PUBLIC $) +- target_include_directories(${STATIC_LIB} PUBLIC $) ++ target_link_libraries(${STATIC_LIB} PUBLIC $,uv,uv_a>) + if(REDIS_PLUS_PLUS_ASYNC_FUTURE STREQUAL "boost") + target_include_directories(${STATIC_LIB} SYSTEM PUBLIC $) + endif() +@@ -245,8 +244,7 @@ if(REDIS_PLUS_PLUS_BUILD_SHARED) + + if(REDIS_PLUS_PLUS_BUILD_ASYNC) + target_include_directories(${SHARED_LIB} PUBLIC $) +- target_include_directories(${SHARED_LIB} PUBLIC $) +- target_link_libraries(${SHARED_LIB} PUBLIC ${REDIS_PLUS_PLUS_ASYNC_LIB}) ++ target_link_libraries(${SHARED_LIB} PUBLIC $,uv,uv_a>) + if(REDIS_PLUS_PLUS_ASYNC_FUTURE STREQUAL "boost") + target_include_directories(${SHARED_LIB} SYSTEM PUBLIC $) + endif() diff --git a/recipes/redis-plus-plus/all/test_package/CMakeLists.txt b/recipes/redis-plus-plus/all/test_package/CMakeLists.txt index 7e86ed9b21b3a..df9a8c785c48c 100644 --- a/recipes/redis-plus-plus/all/test_package/CMakeLists.txt +++ b/recipes/redis-plus-plus/all/test_package/CMakeLists.txt @@ -1,14 +1,18 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -find_package(redis++ REQUIRED) +find_package(redis++ REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -if(BUILDING_SHARED) - target_link_libraries(${PROJECT_NAME} redis++::redis++) +if(TARGET redis++::redis++_static) + target_link_libraries(${PROJECT_NAME} PRIVATE redis++::redis++_static) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE redis++::redis++) +endif() +if(redis++_VERSION VERSION_GREATER_EQUAL "1.3.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) else() - target_link_libraries(${PROJECT_NAME} redis++::redis++_static) + # no target_compile_features here because redis-plus-plus < 1.3.0 is built + # with C++11 by default and is not ABI compatible if consumed with C++17... + set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) endif() diff --git a/recipes/redis-plus-plus/all/test_package/conanfile.py b/recipes/redis-plus-plus/all/test_package/conanfile.py index e4f979e800b01..0a6bc68712d90 100644 --- a/recipes/redis-plus-plus/all/test_package/conanfile.py +++ b/recipes/redis-plus-plus/all/test_package/conanfile.py @@ -1,21 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) - cmake.definitions["BUILDING_SHARED"] = self.options["redis-plus-plus"].shared - if tools.Version(self.deps_cpp_info["redis-plus-plus"].version) < "1.3.0": - cmake.definitions["CMAKE_CXX_STANDARD"] = 11 - else: - cmake.definitions["CMAKE_CXX_STANDARD"] = 17 cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/redis-plus-plus/all/test_v1_package/CMakeLists.txt b/recipes/redis-plus-plus/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/redis-plus-plus/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/redis-plus-plus/all/test_v1_package/conanfile.py b/recipes/redis-plus-plus/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/redis-plus-plus/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/redis-plus-plus/config.yml b/recipes/redis-plus-plus/config.yml index c4181ae02bba7..923fc0f3c1acb 100644 --- a/recipes/redis-plus-plus/config.yml +++ b/recipes/redis-plus-plus/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.7": + folder: all "1.3.3": folder: all "1.3.2": diff --git a/recipes/refl-cpp/all/conandata.yml b/recipes/refl-cpp/all/conandata.yml index b37904d918fdf..fbf28e3cdca2f 100644 --- a/recipes/refl-cpp/all/conandata.yml +++ b/recipes/refl-cpp/all/conandata.yml @@ -1,4 +1,14 @@ sources: + "0.12.4": + url: "https://github.com/veselink1/refl-cpp/archive/refs/tags/v0.12.4.tar.gz" + sha256: "8f6e02535ac3d1e51c1d8288d755378b914bb72f817020d2dec261de33f78b5c" "0.12.1": url: "https://github.com/veselink1/refl-cpp/archive/refs/tags/v0.12.1.tar.gz" sha256: "dcc740271645597fe882bf43a7006d232f5be622b4cb97a143925eb1fd3946ae" + +patches: + "0.12.1": + - patch_file: "patches/0.12.1-0001-remove-memory-fwd.patch" + patch_description: "remove xxx_ptr forward declaration" + patch_type: "portability" + patch_source: "https://github.com/veselink1/refl-cpp/pull/76" diff --git a/recipes/refl-cpp/all/conanfile.py b/recipes/refl-cpp/all/conanfile.py index a779bfbf4f7f9..7ba2308354522 100644 --- a/recipes/refl-cpp/all/conanfile.py +++ b/recipes/refl-cpp/all/conanfile.py @@ -1,52 +1,71 @@ -from conans import ConanFile, tools, errors +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os +required_conan_version = ">=1.52.0" class ReflCppConan(ConanFile): name = "refl-cpp" + description = "A modern compile-time reflection library for C++ with support for overloads, templates, attributes and proxies" license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/veselink1/refl-cpp" - description = "A modern compile-time reflection library for C++ with support for overloads, templates, attributes and proxies " topics = ("header", "header-only", "reflection", "modern", "metaprogramming") - no_copy_source = True - settings = "compiler" + settings = "os", "arch", "compiler", "build_type" @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 17 - @property - def _source_subfolder(self): - return "source_subfolder" - - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) - - def package(self): - include_folder = self._source_subfolder - self.copy(pattern="*.hpp", dst="include", src=include_folder) - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - - def package_id(self): - self.info.header_only() - @property def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "8", - "clang": "8", + "clang": "7", + "apple-clang": "12", } + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) + check_min_cppstd(self, self._min_cppstd) min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) if not min_version: - self.output.warn("{} recipe lacks information about the {} compiler support.".format( - self.name, self.settings.compiler)) + self.output.warn(f"{self.ref} recipe lacks information about the {self.settings.compiler} compiler support.") else: - if tools.Version(self.settings.compiler.version) < min_version: - raise errors.ConanInvalidConfiguration("{} requires C++{} support. The current compiler {} {} does not support it.".format( - self.name, self._minimum_cpp_standard, self.settings.compiler, self.settings.compiler.version)) + if Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd} support. " + f"The current compiler {self.settings.compiler} {self.settings.compiler.version} does not support it." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + apply_conandata_patches(self) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + if Version(self.version) < "0.12.2": + copy(self, pattern="*.hpp", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + else: + copy(self, pattern="*.hpp", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/refl-cpp/all/patches/0.12.1-0001-remove-memory-fwd.patch b/recipes/refl-cpp/all/patches/0.12.1-0001-remove-memory-fwd.patch new file mode 100644 index 0000000000000..460de696f03e3 --- /dev/null +++ b/recipes/refl-cpp/all/patches/0.12.1-0001-remove-memory-fwd.patch @@ -0,0 +1,27 @@ +diff --git a/a/refl.hpp b/b/refl.hpp +index 7099200..c6580cf 100644 +--- a/a/refl.hpp ++++ b/b/refl.hpp +@@ -34,20 +34,8 @@ + #include + #include // std::quoted + +-namespace std +-{ +- template +- class unique_ptr; +- +- template +- class shared_ptr; +- +- template +- class weak_ptr; +- +- template +- class complex; +-} // namespace std ++#include ++#include + + #ifdef _MSC_VER + // Disable VS warning for "Not enough arguments for macro" diff --git a/recipes/refl-cpp/all/test_package/CMakeLists.txt b/recipes/refl-cpp/all/test_package/CMakeLists.txt index db8edbb5a5825..f30f3345a4439 100644 --- a/recipes/refl-cpp/all/test_package/CMakeLists.txt +++ b/recipes/refl-cpp/all/test_package/CMakeLists.txt @@ -1,13 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(refl-cpp REQUIRED CONFIG) -find_package(refl-cpp CONFIG REQUIRED) - -add_executable(example example.cpp) - -target_link_libraries(example refl-cpp::refl-cpp) - -target_compile_features(example PUBLIC cxx_std_17) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE refl-cpp::refl-cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/refl-cpp/all/test_package/conanfile.py b/recipes/refl-cpp/all/test_package/conanfile.py index adbb98652a54f..d6e715375232f 100644 --- a/recipes/refl-cpp/all/test_package/conanfile.py +++ b/recipes/refl-cpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/refl-cpp/all/test_package/example.cpp b/recipes/refl-cpp/all/test_package/test_package.cpp similarity index 100% rename from recipes/refl-cpp/all/test_package/example.cpp rename to recipes/refl-cpp/all/test_package/test_package.cpp diff --git a/recipes/refl-cpp/all/test_v1_package/CMakeLists.txt b/recipes/refl-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/refl-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/refl-cpp/all/test_v1_package/conanfile.py b/recipes/refl-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/refl-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/refl-cpp/config.yml b/recipes/refl-cpp/config.yml index bdb42f221e3bd..7422455329b65 100644 --- a/recipes/refl-cpp/config.yml +++ b/recipes/refl-cpp/config.yml @@ -1,3 +1,5 @@ versions: + "0.12.4": + folder: all "0.12.1": folder: all diff --git a/recipes/restbed/all/conandata.yml b/recipes/restbed/all/conandata.yml new file mode 100644 index 0000000000000..6e0b42fcccc44 --- /dev/null +++ b/recipes/restbed/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "4.8": + url: "https://github.com/Corvusoft/restbed/archive/refs/tags/4.8.tar.gz" + sha256: "4801833f86a67b8a123c2c01203e259eb81157e1e9ef144a3b6395cb2d838a42" +patches: + "4.8": + - patch_file: "patches/4.8-0001-cmake-conan.patch" + patch_description: "Use CMake targets + separate static/shared" + patch_type: "conan" + - patch_file: "patches/4.8-0002-mingw-deprecated-fix.patch" + patch_description: "MinGW apparently does not support deprecated and __declspec in the same line" + patch_type: "portability" diff --git a/recipes/restbed/all/conanfile.py b/recipes/restbed/all/conanfile.py new file mode 100644 index 0000000000000..0a5e2d6cfc925 --- /dev/null +++ b/recipes/restbed/all/conanfile.py @@ -0,0 +1,128 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, rm, save +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import os +import re + +required_conan_version = ">=1.52.0" + + +class RestbedConan(ConanFile): + name = "restbed" + homepage = "https://github.com/Corvusoft/restbed" + description = "Corvusoft's Restbed framework brings asynchronous RESTful functionality to C++14 applications." + topics = ("restful", "server", "client", "json", "http", "ssl", "tls") + url = "https://github.com/conan-io/conan-center-index" + license = "AGPL-3.0-or-later", "LicenseRef-CPL" # Corvusoft Permissive License (CPL) + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "ipc": [True, False], + "with_openssl": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "ipc": False, + "with_openssl": True, + } + + @property + def _minimum_cpp_standard(self): + return 14 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "5", + "clang": "7", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + if self.settings.os in ("Windows", ): + del self.options.ipc + + def validate(self): + if getattr(self.info.settings.compiler, "cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("asio/1.24.0") + if self.options.with_openssl: + self.requires("openssl/3.0.5") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_SSL"] = self.options.with_openssl + tc.variables["BUILD_IPC"] = self.options.get_safe("ipc", False) + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + if not self.options.shared: + # Remove __declspec(dllexport) and __declspec(dllimport) + for root, _, files in os.walk(self.source_folder): + for file in files: + if os.path.splitext(file)[1] in (".hpp", ".h"): + full_path = os.path.join(root, file) + data = load(self, full_path) + data, _ = re.subn(r"__declspec\((dllexport|dllimport)\)", "", data) + save(self, full_path, data) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + def package_info(self): + libname = "restbed" + if self.settings.os in ("Windows", ) and self.options.shared: + libname += "-shared" + self.cpp_info.libs = [libname] + + if self.settings.os in ("FreeBSD", "Linux", ): + self.cpp_info.system_libs.extend(["dl", "m"]) + elif self.settings.os in ("Windows", ): + self.cpp_info.system_libs.append("mswsock") diff --git a/recipes/restbed/all/patches/4.8-0001-cmake-conan.patch b/recipes/restbed/all/patches/4.8-0001-cmake-conan.patch new file mode 100644 index 0000000000000..e239976a0dfce --- /dev/null +++ b/recipes/restbed/all/patches/4.8-0001-cmake-conan.patch @@ -0,0 +1,84 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -19,7 +19,7 @@ + option( BUILD_TESTS "Build unit tests." ON ) + option( BUILD_SSL "Build secure socket layer support." ON ) + option( BUILD_IPC "Build unix domain socket layer support." OFF ) +- ++set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + # + # Configuration + # +@@ -57,7 +57,7 @@ find_package( asio REQUIRED ) + + if ( BUILD_SSL ) + add_definitions( "-DBUILD_SSL" ) +- find_package( openssl REQUIRED ) ++ find_package( OpenSSL REQUIRED ) + endif ( ) + + include_directories( ${INCLUDE_DIR} SYSTEM ${asio_INCLUDE} ${ssl_INCLUDE} ) +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -68,7 +68,7 @@ + + if ( WIN32 ) + add_definitions( -DWIN_DLL_EXPORT ) +- set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251" ) ++ #set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4251" ) + endif ( ) + + # +@@ -75,13 +75,14 @@ + # Build + # + file( GLOB_RECURSE MANIFEST "${SOURCE_DIR}/*.cpp" ) +- ++if(NOT BUILD_SHARED_LIBS) + set( STATIC_LIBRARY_NAME "${PROJECT_NAME}-static" ) + add_library( ${STATIC_LIBRARY_NAME} STATIC ${MANIFEST} ) + set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD 14 ) + set_property( TARGET ${STATIC_LIBRARY_NAME} PROPERTY CXX_STANDARD_REQUIRED ON ) + set_target_properties( ${STATIC_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} ) +- ++target_link_libraries( ${STATIC_LIBRARY_NAME} LINK_PRIVATE asio::asio ) ++else() + set( SHARED_LIBRARY_NAME "${PROJECT_NAME}-shared" ) + add_library( ${SHARED_LIBRARY_NAME} SHARED ${MANIFEST} ) + set_property( TARGET ${SHARED_LIBRARY_NAME} PROPERTY CXX_STANDARD 14 ) +@@ -93,13 +94,20 @@ + set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES OUTPUT_NAME ${PROJECT_NAME} ) + endif ( ) + set_target_properties( ${SHARED_LIBRARY_NAME} PROPERTIES SOVERSION ${PROJECT_VERSION_MAJOR} VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR} ) +- ++target_link_libraries( ${SHARED_LIBRARY_NAME} LINK_PRIVATE asio::asio ) ++endif() + if ( BUILD_SSL ) +- target_link_libraries( ${SHARED_LIBRARY_NAME} LINK_PRIVATE ${ssl_LIBRARY_SHARED} ${crypto_LIBRARY_SHARED} ) +- target_link_libraries( ${STATIC_LIBRARY_NAME} LINK_PRIVATE ${ssl_LIBRARY_STATIC} ${crypto_LIBRARY_STATIC} ${CMAKE_DL_LIBS} ) ++if(BUILD_SHARED_LIBS) ++ target_link_libraries( ${SHARED_LIBRARY_NAME} LINK_PRIVATE OpenSSL::SSL $<$:mswsock>) ++else() ++ target_link_libraries( ${STATIC_LIBRARY_NAME} LINK_PRIVATE OpenSSL::SSL ${CMAKE_DL_LIBS} $<$:mswsock>) ++endif() + else ( ) ++if(BUILD_SHARED_LIBS) +- target_link_libraries( ${SHARED_LIBRARY_NAME} ) ++ target_link_libraries( ${SHARED_LIBRARY_NAME} OpenSSL::SSL $<$:mswsock>) ++else() +- target_link_libraries( ${STATIC_LIBRARY_NAME} ${CMAKE_DL_LIBS} ) ++ target_link_libraries( ${STATIC_LIBRARY_NAME} ${CMAKE_DL_LIBS} OpenSSL::SSL $<$:mswsock>) ++endif() + endif ( ) + + if ( BUILD_TESTS ) +@@ -119,5 +127,8 @@ + + install( FILES "${INCLUDE_DIR}/${PROJECT_NAME}" DESTINATION "${CMAKE_INSTALL_PREFIX}/include" ) + install( FILES ${ARTIFACTS} DESTINATION "${CMAKE_INSTALL_PREFIX}/include/corvusoft/${PROJECT_NAME}" ) ++if(NOT BUILD_SHARED_LIBS) + install( TARGETS ${STATIC_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) ++else() +-install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} COMPONENT library ) ++install( TARGETS ${SHARED_LIBRARY_NAME} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT library ) ++endif() diff --git a/recipes/restbed/all/patches/4.8-0002-mingw-deprecated-fix.patch b/recipes/restbed/all/patches/4.8-0002-mingw-deprecated-fix.patch new file mode 100644 index 0000000000000..98f35027afdd1 --- /dev/null +++ b/recipes/restbed/all/patches/4.8-0002-mingw-deprecated-fix.patch @@ -0,0 +1,12 @@ +--- source/corvusoft/restbed/http.hpp ++++ source/corvusoft/restbed/http.hpp +@@ -40,7 +40,7 @@ + class Response; + class Settings; +- +- class [[deprecated("HTTP client is deprecated; we will release a complimentary client framework at a future date.")]] HTTP_EXPORT Http ++ class HTTP_EXPORT Http; ++ class [[deprecated("HTTP client is deprecated; we will release a complimentary client framework at a future date.")]] Http + { + public: + //Friends diff --git a/recipes/restbed/all/test_package/CMakeLists.txt b/recipes/restbed/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3bad6b5f5053d --- /dev/null +++ b/recipes/restbed/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(restbed REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE restbed::restbed) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/restbed/all/test_package/conanfile.py b/recipes/restbed/all/test_package/conanfile.py new file mode 100644 index 0000000000000..f72d1f660e19f --- /dev/null +++ b/recipes/restbed/all/test_package/conanfile.py @@ -0,0 +1,30 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/restbed/all/test_package/test_package.cpp b/recipes/restbed/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..d4731f4f97f74 --- /dev/null +++ b/recipes/restbed/all/test_package/test_package.cpp @@ -0,0 +1,40 @@ +#include + +#include +#include +#include +#include + +static void post_method_handler( const std::shared_ptr< restbed::Session > session ) +{ + const auto request = session->get_request( ); + + int content_length = request->get_header( "Content-Length", 0 ); + + session->fetch( content_length, [ ]( const std::shared_ptr< restbed::Session > session, const restbed::Bytes & body ) + { + fprintf( stdout, "%.*s\n", ( int ) body.size( ), body.data( ) ); + session->close( restbed::OK, "Hello, World!", { { "Content-Length", "13" } } ); + } ); +} + +int main(int argc, char *argv[]) +{ + auto resource = std::make_shared< restbed::Resource >( ); + resource->set_path( "/resource" ); + resource->set_method_handler( "POST", post_method_handler ); + + auto settings = std::make_shared< restbed::Settings >( ); + settings->set_port( 1984 ); + settings->set_default_header( "Connection", "close" ); + + restbed::Service service; + service.publish( resource ); + + if (argc > 1 && strcmp(argv[1], "run") == 0) { + // Don't start the service to avoid blocking + service.start( settings ); + } + + return EXIT_SUCCESS; +} diff --git a/recipes/restbed/all/test_v1_package/CMakeLists.txt b/recipes/restbed/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..87b1318ff1676 --- /dev/null +++ b/recipes/restbed/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(restbed REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE restbed::restbed) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/restbed/all/test_v1_package/conanfile.py b/recipes/restbed/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/restbed/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/restbed/config.yml b/recipes/restbed/config.yml new file mode 100644 index 0000000000000..5a6e56bf2599d --- /dev/null +++ b/recipes/restbed/config.yml @@ -0,0 +1,3 @@ +versions: + "4.8": + folder: all diff --git a/recipes/restinio/all/CMakeLists.txt b/recipes/restinio/all/CMakeLists.txt deleted file mode 100644 index 5ba180246ce0e..0000000000000 --- a/recipes/restinio/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder/dev/restinio) diff --git a/recipes/restinio/all/conandata.yml b/recipes/restinio/all/conandata.yml index b4a2e1e8e8118..b680851d1b67a 100644 --- a/recipes/restinio/all/conandata.yml +++ b/recipes/restinio/all/conandata.yml @@ -1,34 +1,34 @@ sources: - "0.6.8": - url: https://github.com/Stiffstream/restinio/archive/v.0.6.8.tar.gz - sha256: 92ab0faa9f9de582df787e133acf5c10fb6ab7cecbd96c128997554d8ceda0cd - "0.6.8.1": - url: https://github.com/Stiffstream/restinio/archive/v.0.6.8.1.tar.gz - sha256: 6a365ce645fc7188c287602886eba1a99c797e01b734f0c69bcb370b3494b54c - "0.6.9": - url: https://github.com/Stiffstream/restinio/archive/v.0.6.9.tar.gz - sha256: fcb05e15a346b4ff27757b89741289864f82f71affe61364325ce70dddefe31f - "0.6.10": - url: https://github.com/Stiffstream/restinio/archive/v.0.6.10.tar.gz - sha256: dc9cad7e19f1bc255532cee53ab2027c93108c79e27f9fbe971f3ea0b10274a5 - "0.6.11": - url: https://github.com/Stiffstream/restinio/archive/v.0.6.11.tar.gz - sha256: 66c25c19efd9dc9683d60f540e9ac09b66245c5afde096fc05ec69cbb502fc5d - "0.6.12": - url: https://github.com/Stiffstream/restinio/archive/v.0.6.12.tar.gz - sha256: 7176d608afb8e5cd29eec2216e747be262215f5b3ab3df2b3c86e691f1cec79e - "0.6.13": - url: https://github.com/Stiffstream/restinio/archive/v.0.6.13.tar.gz - sha256: 72d7ad40c8d34e69cd79f42145b4059e8a7356114fb13864c3c0ad5a5607b44f - "0.6.14": - url: https://github.com/Stiffstream/restinio/archive/v.0.6.14.tar.gz - sha256: 9742c051e7199d826697f86e6ba4a9fcb7f00c71a408b5c172134b2206404c4e - "0.6.15": - url: "https://github.com/Stiffstream/restinio/archive/v.0.6.15.tar.gz" - sha256: "5977e7a21064a42dc690a644adc7ba03037eb4007bfbc36586faf715583967bd" - "0.6.16": - url: "https://github.com/Stiffstream/restinio/archive/v.0.6.16.tar.gz" - sha256: "b3208d746087ba979f51b3a32e08463718c33d58720247d53ffb5bda99f4f92a" "0.6.17": url: "https://github.com/Stiffstream/restinio/archive/v.0.6.17.tar.gz" sha256: "0140b23f50bb964f6917d1f99205476eba92203dc586673bdf2ea48d7406f2c4" + "0.6.16": + url: "https://github.com/Stiffstream/restinio/archive/v.0.6.16.tar.gz" + sha256: "b3208d746087ba979f51b3a32e08463718c33d58720247d53ffb5bda99f4f92a" + "0.6.15": + url: "https://github.com/Stiffstream/restinio/archive/v.0.6.15.tar.gz" + sha256: "5977e7a21064a42dc690a644adc7ba03037eb4007bfbc36586faf715583967bd" + "0.6.14": + url: https://github.com/Stiffstream/restinio/archive/v.0.6.14.tar.gz + sha256: 9742c051e7199d826697f86e6ba4a9fcb7f00c71a408b5c172134b2206404c4e + "0.6.13": + url: https://github.com/Stiffstream/restinio/archive/v.0.6.13.tar.gz + sha256: 72d7ad40c8d34e69cd79f42145b4059e8a7356114fb13864c3c0ad5a5607b44f + "0.6.12": + url: https://github.com/Stiffstream/restinio/archive/v.0.6.12.tar.gz + sha256: 7176d608afb8e5cd29eec2216e747be262215f5b3ab3df2b3c86e691f1cec79e + "0.6.11": + url: https://github.com/Stiffstream/restinio/archive/v.0.6.11.tar.gz + sha256: 66c25c19efd9dc9683d60f540e9ac09b66245c5afde096fc05ec69cbb502fc5d + "0.6.10": + url: https://github.com/Stiffstream/restinio/archive/v.0.6.10.tar.gz + sha256: dc9cad7e19f1bc255532cee53ab2027c93108c79e27f9fbe971f3ea0b10274a5 + "0.6.9": + url: https://github.com/Stiffstream/restinio/archive/v.0.6.9.tar.gz + sha256: fcb05e15a346b4ff27757b89741289864f82f71affe61364325ce70dddefe31f + "0.6.8.1": + url: https://github.com/Stiffstream/restinio/archive/v.0.6.8.1.tar.gz + sha256: 6a365ce645fc7188c287602886eba1a99c797e01b734f0c69bcb370b3494b54c + "0.6.8": + url: https://github.com/Stiffstream/restinio/archive/v.0.6.8.tar.gz + sha256: 92ab0faa9f9de582df787e133acf5c10fb6ab7cecbd96c128997554d8ceda0cd diff --git a/recipes/restinio/all/conanfile.py b/recipes/restinio/all/conanfile.py index 65cf395c7d3c3..a9df43d526e76 100644 --- a/recipes/restinio/all/conanfile.py +++ b/recipes/restinio/all/conanfile.py @@ -1,9 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps +from conan.tools.files import get, copy, rmdir +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class RestinioConan(ConanFile): @@ -28,21 +33,13 @@ class RestinioConan(ConanFile): "with_pcre": None, } - generators = "cmake" - exports_sources = ["CMakeLists.txt"] - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def layout(self): + basic_layout(self) def requirements(self): self.requires("http_parser/2.9.4") - if tools.Version(self.version) >= "0.6.16": + if Version(self.version) >= "0.6.16": self.requires("fmt/9.0.0") else: self.requires("fmt/8.1.1") @@ -53,12 +50,12 @@ def requirements(self): self.requires("variant-lite/2.0.0") if self.options.asio == "standalone": - if tools.Version(self.version) >= "0.6.9": + if Version(self.version) >= "0.6.9": self.requires("asio/1.22.1") else: self.requires("asio/1.16.1") else: - if tools.Version(self.version) >= "0.6.9": + if Version(self.version) >= "0.6.9": self.requires("boost/1.78.0") else: self.requires("boost/1.73.0") @@ -75,51 +72,53 @@ def requirements(self): self.requires("pcre2/10.40") def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): minimal_cpp_standard = "14" - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, minimal_cpp_standard) + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, minimal_cpp_standard) minimal_version = { "gcc": "5", "clang": "3.4", "apple-clang": "10", - "Visual Studio": "15" } - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) - self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) - return - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + check_min_vs(self, 190) + if not is_msvc(self): + minimum_version = minimal_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{minimal_cpp_standard}, which your compiler does not support." + ) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RESTINIO_INSTALL"] = True + tc.variables["RESTINIO_FIND_DEPS"] = False + tc.variables["RESTINIO_USE_EXTERNAL_EXPECTED_LITE"] = True + tc.variables["RESTINIO_USE_EXTERNAL_OPTIONAL_LITE"] = True + tc.variables["RESTINIO_USE_EXTERNAL_STRING_VIEW_LITE"] = True + tc.variables["RESTINIO_USE_EXTERNAL_VARIANT_LITE"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["RESTINIO_INSTALL"] = True - cmake.definitions["RESTINIO_FIND_DEPS"] = False - cmake.definitions["RESTINIO_USE_EXTERNAL_EXPECTED_LITE"] = True - cmake.definitions["RESTINIO_USE_EXTERNAL_OPTIONAL_LITE"] = True - cmake.definitions["RESTINIO_USE_EXTERNAL_STRING_VIEW_LITE"] = True - cmake.definitions["RESTINIO_USE_EXTERNAL_VARIANT_LITE"] = True - cmake.configure(build_folder=self._build_subfolder) - return cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "dev", "restinio")) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] self.cpp_info.set_property("cmake_file_name", "restinio") self.cpp_info.set_property("cmake_target_name", "restinio::restinio") self.cpp_info.defines.extend(["RESTINIO_EXTERNAL_EXPECTED_LITE", "RESTINIO_EXTERNAL_OPTIONAL_LITE", diff --git a/recipes/restinio/all/test_package/CMakeLists.txt b/recipes/restinio/all/test_package/CMakeLists.txt index d1fbedb5ea13c..742ee15cf57c4 100644 --- a/recipes/restinio/all/test_package/CMakeLists.txt +++ b/recipes/restinio/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(restinio REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/restinio/all/test_package/conanfile.py b/recipes/restinio/all/test_package/conanfile.py index 9b63bd176646b..a9fb96656f203 100644 --- a/recipes/restinio/all/test_package/conanfile.py +++ b/recipes/restinio/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/restinio/all/test_v1_package/CMakeLists.txt b/recipes/restinio/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..259507f226840 --- /dev/null +++ b/recipes/restinio/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(restinio REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} restinio::restinio) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/restinio/all/test_v1_package/conanfile.py b/recipes/restinio/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..9b63bd176646b --- /dev/null +++ b/recipes/restinio/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join("bin", "test_package"), run_environment=True) diff --git a/recipes/restinio/config.yml b/recipes/restinio/config.yml index 29781bb078232..b071e4e40bed7 100644 --- a/recipes/restinio/config.yml +++ b/recipes/restinio/config.yml @@ -1,23 +1,23 @@ versions: - "0.6.8": + "0.6.17": folder: all - "0.6.8.1": + "0.6.16": folder: all - "0.6.9": + "0.6.15": folder: all - "0.6.10": + "0.6.14": folder: all - "0.6.11": + "0.6.13": folder: all "0.6.12": folder: all - "0.6.13": + "0.6.11": folder: all - "0.6.14": + "0.6.10": folder: all - "0.6.15": + "0.6.9": folder: all - "0.6.16": + "0.6.8.1": folder: all - "0.6.17": + "0.6.8": folder: all diff --git a/recipes/roaring/all/CMakeLists.txt b/recipes/roaring/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/roaring/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/roaring/all/conandata.yml b/recipes/roaring/all/conandata.yml index c37388de9682a..38a9717102897 100644 --- a/recipes/roaring/all/conandata.yml +++ b/recipes/roaring/all/conandata.yml @@ -1,4 +1,25 @@ sources: + "0.9.8": + url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.9.8.tar.gz" + sha256: "d83ea18ded541a49f792951a6e71cd20136171ca0a4c15c77ec5cd5b83ca8e63" + "0.9.6": + url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.9.6.tar.gz" + sha256: "6d410750eb4ce70db2fa3dc25b7bc33fd4a91a85ef7dff595200d0acef99b1ee" + "0.9.3": + url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.9.3.tar.gz" + sha256: "b7534adebf50a554e86b81a2b39459c9921c504e9a876abe00bd741d0a4bc85d" + "0.9.0": + url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.9.0.tar.gz" + sha256: "52c1f56e1f84ffb9ff6cb90fd1d23cfe04926f696ae57e796d0b056fff572693" + "0.8.1": + url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.8.1.tar.gz" + sha256: "5359f2a051f10e42cea5edc3cb3650fd272e9125e6a0538901cf30619939d4f8" + "0.8.0": + url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.8.0.tar.gz" + sha256: "cd6c4770baccfea385c0c6891a8a80133ba26093209740ca0a3eea348aff1a20" + "0.7.3": + url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.7.3.tar.gz" + sha256: "e3f8115ba44ef0e1eb7b982dc3c3233f08f5f95ec1260169c2ad0ca50e56b656" "0.6.0": url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v0.6.0.tar.gz" sha256: "b8e2499ca9ac6ba0d18dbbcde4bae3752acf81f08ea6309ea2a88d27972dffcf" @@ -11,9 +32,3 @@ sources: "0.3.4": url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v0.3.4.tar.gz" sha256: "ddc5899823c46707d7dbf4e4c117a811b0428bdcb84978d9e65ceaefe6f59595" - "0.3.3": - url: "https://github.com/RoaringBitmap/CRoaring/archive/refs/tags/v0.3.3.tar.gz" - sha256: "10ae2c0e681bda7a0d3974196d2150cc68beda0fb64b24e87251eaa83d08d07e" - "0.2.66": - url: "https://github.com/RoaringBitmap/CRoaring/archive/v0.2.66.tar.gz" - sha256: "df98bd8f6ff09097ada529a004af758ff4d33faf6a06fadf8fad9a6533afc241" diff --git a/recipes/roaring/all/conanfile.py b/recipes/roaring/all/conanfile.py index f439f6e660dd8..a8bc29f6453db 100644 --- a/recipes/roaring/all/conanfile.py +++ b/recipes/roaring/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.scm import Version import os -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" + class RoaringConan(ConanFile): name = "roaring" @@ -27,18 +31,6 @@ class RoaringConan(ConanFile): "with_neon": True, "native_optimization": False, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - - def export_sources(self): - self.copy("CMakeLists.txt") def config_options(self): if self.settings.os == "Windows": @@ -50,50 +42,48 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") - if tools.Version(self.version) >= "0.3.0": - if self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) < "11": - raise ConanInvalidConfiguration("roaring >= 3.0.0 requires at least apple-clang 11 to support runtime dispatching.") + check_min_cppstd(self, "11") + if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "11": + raise ConanInvalidConfiguration( + f"{self.ref} requires at least apple-clang 11 to support runtime dispatching.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["ROARING_DISABLE_AVX"] = not self.options.get_safe("with_avx", False) - cmake.definitions["ROARING_DISABLE_NEON"] = not self.options.get_safe("with_neon", False) - cmake.definitions["ROARING_DISABLE_NATIVE"] = not self.options.native_optimization - cmake.definitions["ROARING_BUILD_STATIC"] = not self.options.shared - cmake.definitions["ENABLE_ROARING_TESTS"] = False + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ROARING_DISABLE_AVX"] = not self.options.get_safe("with_avx", False) + tc.variables["ROARING_DISABLE_NEON"] = not self.options.get_safe("with_neon", False) + tc.variables["ROARING_DISABLE_NATIVE"] = not self.options.native_optimization + tc.variables["ROARING_BUILD_STATIC"] = not self.options.shared + tc.variables["ENABLE_ROARING_TESTS"] = False # Relocatable shared lib on Macos - cmake.definitions["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() def build(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), "set(CMAKE_MACOSX_RPATH OFF)", "") - cmake = self._configure_cmake() + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set(CMAKE_MACOSX_RPATH OFF)", "") + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.libs = ["roaring"] - + self.cpp_info.set_property("cmake_file_name", "roaring") self.cpp_info.set_property("cmake_target_name", "roaring::roaring") self.cpp_info.set_property("pkg_config_name", "roaring") - - self.cpp_info.names["cmake_find_package"] = "roaring" - self.cpp_info.names["cmake_find_package_multi"] = "roaring" - self.cpp_info.names["pkg_config"] = "roaring" + self.cpp_info.libs = ["roaring"] diff --git a/recipes/roaring/all/test_package/CMakeLists.txt b/recipes/roaring/all/test_package/CMakeLists.txt index 4990692f7097a..60d328135f926 100644 --- a/recipes/roaring/all/test_package/CMakeLists.txt +++ b/recipes/roaring/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(roaring REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} roaring::roaring) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE roaring::roaring) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) if(roaring_VERSION VERSION_LESS "0.3.0") - target_compile_definitions(${PROJECT_NAME} PRIVATE "ROARING_NO_NAMESPACE") + target_compile_definitions(${PROJECT_NAME} PRIVATE "ROARING_NO_NAMESPACE") endif() diff --git a/recipes/roaring/all/test_package/conanfile.py b/recipes/roaring/all/test_package/conanfile.py index 1d4478bedc297..0a6bc68712d90 100644 --- a/recipes/roaring/all/test_package/conanfile.py +++ b/recipes/roaring/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "arch", "compiler", "build_type", - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/roaring/all/test_v1_package/CMakeLists.txt b/recipes/roaring/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/roaring/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/roaring/all/test_v1_package/conanfile.py b/recipes/roaring/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1d4478bedc297 --- /dev/null +++ b/recipes/roaring/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type", + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/roaring/config.yml b/recipes/roaring/config.yml index 0ecb98589cf3a..1770fb643352e 100644 --- a/recipes/roaring/config.yml +++ b/recipes/roaring/config.yml @@ -1,4 +1,18 @@ versions: + "0.9.8": + folder: all + "0.9.6": + folder: all + "0.9.3": + folder: all + "0.9.0": + folder: all + "0.8.1": + folder: all + "0.8.0": + folder: all + "0.7.3": + folder: all "0.6.0": folder: all "0.5.0": @@ -7,7 +21,3 @@ versions: folder: all "0.3.4": folder: all - "0.3.3": - folder: all - "0.2.66": - folder: all diff --git a/recipes/rocksdb/all/conandata.yml b/recipes/rocksdb/all/conandata.yml index 1e7bb33dbcc27..2e0d65d48f078 100644 --- a/recipes/rocksdb/all/conandata.yml +++ b/recipes/rocksdb/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "6.29.5": + url: "https://github.com/facebook/rocksdb/archive/v6.29.5.tar.gz" + sha256: "ddbf84791f0980c0bbce3902feb93a2c7006f6f53bfd798926143e31d4d756f0" + "6.27.3": + url: "https://github.com/facebook/rocksdb/archive/v6.27.3.tar.gz" + sha256: "ee29901749b9132692b26f0a6c1d693f47d1a9ed8e3771e60556afe80282bf58" "6.20.3": url: "https://github.com/facebook/rocksdb/archive/v6.20.3.tar.gz" sha256: "c6502c7aae641b7e20fafa6c2b92273d935d2b7b2707135ebd9a67b092169dca" @@ -12,6 +18,12 @@ sources: url: "https://github.com/facebook/rocksdb/archive/v6.0.2.tar.gz" sha256: "89e0832f1fb00ac240a9438d4bbdae37dd3e52f7c15c3f646dc26887da16f342" patches: + "6.29.5": + - patch_file: "patches/6.29.5/0001-Rename-jemalloc-according-to-conan-packages.patch" + base_path: "source_subfolder" + "6.27.3": + - patch_file: "patches/6.27.3/0001-Rename-jemalloc-according-to-conan-packages.patch" + base_path: "source_subfolder" "6.20.3": - patch_file: "patches/6.20.3/0001-Rename-jemalloc-according-to-conan-packages.patch" base_path: "source_subfolder" diff --git a/recipes/rocksdb/all/patches/6.27.3/0001-Rename-jemalloc-according-to-conan-packages.patch b/recipes/rocksdb/all/patches/6.27.3/0001-Rename-jemalloc-according-to-conan-packages.patch new file mode 100644 index 0000000000000..862805a12fdf1 --- /dev/null +++ b/recipes/rocksdb/all/patches/6.27.3/0001-Rename-jemalloc-according-to-conan-packages.patch @@ -0,0 +1,14 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -108,9 +108,9 @@ else() + set(WITH_JEMALLOC ON) + else() + if(WITH_JEMALLOC) +- find_package(JeMalloc REQUIRED) ++ find_package(jemalloc REQUIRED) + add_definitions(-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE) +- list(APPEND THIRDPARTY_LIBS JeMalloc::JeMalloc) ++ list(APPEND THIRDPARTY_LIBS jemalloc::jemalloc) + endif() + endif() + diff --git a/recipes/rocksdb/all/patches/6.29.5/0001-Rename-jemalloc-according-to-conan-packages.patch b/recipes/rocksdb/all/patches/6.29.5/0001-Rename-jemalloc-according-to-conan-packages.patch new file mode 100644 index 0000000000000..862805a12fdf1 --- /dev/null +++ b/recipes/rocksdb/all/patches/6.29.5/0001-Rename-jemalloc-according-to-conan-packages.patch @@ -0,0 +1,14 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -108,9 +108,9 @@ else() + set(WITH_JEMALLOC ON) + else() + if(WITH_JEMALLOC) +- find_package(JeMalloc REQUIRED) ++ find_package(jemalloc REQUIRED) + add_definitions(-DROCKSDB_JEMALLOC -DJEMALLOC_NO_DEMANGLE) +- list(APPEND THIRDPARTY_LIBS JeMalloc::JeMalloc) ++ list(APPEND THIRDPARTY_LIBS jemalloc::jemalloc) + endif() + endif() + diff --git a/recipes/rocksdb/config.yml b/recipes/rocksdb/config.yml index 7417a5aaa20ed..51a8046980930 100644 --- a/recipes/rocksdb/config.yml +++ b/recipes/rocksdb/config.yml @@ -1,4 +1,8 @@ versions: + "6.29.5": + folder: all + "6.27.3": + folder: all "6.20.3": folder: all "6.10.2": diff --git a/recipes/rotor/all/conandata.yml b/recipes/rotor/all/conandata.yml index 89c8d3a93a7f8..b1d2937ec9c70 100644 --- a/recipes/rotor/all/conandata.yml +++ b/recipes/rotor/all/conandata.yml @@ -8,3 +8,6 @@ sources: "0.24": url: "https://github.com/basiliscos/cpp-rotor/archive/refs/tags/v0.24.tar.gz" sha256: "3a360d6ce7c743b740b9c6c4063493f67298690fc51e29efa19811bb3d11fa86" + "0.25": + url: "https://github.com/basiliscos/cpp-rotor/archive/refs/tags/v0.25.tar.gz" + sha256: "b1de95937adb8d7a9beb93bc4956d8e28ff64a6c0a898e7ce12b22a224bb8f6f" diff --git a/recipes/rotor/all/conanfile.py b/recipes/rotor/all/conanfile.py index df5b949027913..373e87fb89eb0 100644 --- a/recipes/rotor/all/conanfile.py +++ b/recipes/rotor/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration import os +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rmdir, copy +from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class RotorConan(ConanFile): name = "rotor" @@ -30,17 +34,8 @@ class RotorConan(ConanFile): "multithreading": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -48,16 +43,31 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass def requirements(self): - self.requires("boost/1.79.0") + self.requires("boost/1.81.0") + + def layout(self): + cmake_layout(self, src_folder="src") + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_BOOST_ASIO"] = self.options.enable_asio + tc.variables["BUILD_THREAD"] = self.options.enable_thread + tc.variables["BUILD_THREAD_UNSAFE"] = not self.options.multithreading + tc.variables["BUILD_TESTING"] = False + tc.generate() + tc = CMakeDeps(self) + tc.generate() def validate(self): minimal_cpp_standard = "17" if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, minimal_cpp_standard) + check_min_cppstd(self, minimal_cpp_standard) minimal_version = { "gcc": "7", "clang": "6", @@ -67,52 +77,39 @@ def validate(self): compiler = str(self.settings.compiler) if compiler not in minimal_version: self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) + f"{self.ref} recipe lacks information about the {compiler} compiler standard version support") self.output.warn( - "%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + f"{self.ref} requires a compiler that supports at least C++{minimal_cpp_standard}") return - compiler_version = tools.Version(self.settings.compiler.version) + compiler_version = Version(self.settings.compiler.version) if compiler_version < minimal_version[compiler]: - raise ConanInvalidConfiguration("%s requires a compiler that supports at least C++%s" % (self.name, minimal_cpp_standard)) + raise ConanInvalidConfiguration(f"{self.ref} requires a compiler that supports at least C++{minimal_cpp_standard}") - if self.options.shared and tools.Version(self.version) < "0.23": + if self.options.shared and Version(self.version) < "0.23": raise ConanInvalidConfiguration("shared option is available from v0.23") - def _configure_cmake(self): - if self._cmake: - return self._cmake - - self._cmake = CMake(self) - self._cmake.definitions["BUILD_BOOST_ASIO"] = self.options.enable_asio - self._cmake.definitions["BUILD_THREAD"] = self.options.enable_thread - self._cmake.definitions["BUILD_THREAD_UNSAFE"] = not self.options.multithreading - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def package(self): - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - self.copy("license*", src=self._source_subfolder, dst="licenses", ignore_case=True, keep_path=False) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.components["core"].libs = ["rotor"] self.cpp_info.components["core"].requires = ["boost::date_time", "boost::system", "boost::regex"] - if not self.options.multithreading: self.cpp_info.components["core"].defines.append("BUILD_THREAD_UNSAFE") @@ -126,4 +123,3 @@ def package_info(self): # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "rotor" - diff --git a/recipes/rotor/config.yml b/recipes/rotor/config.yml index 79c6911176994..1dfb74272e8cc 100644 --- a/recipes/rotor/config.yml +++ b/recipes/rotor/config.yml @@ -5,3 +5,5 @@ versions: folder: all "0.24": folder: all + "0.25": + folder: all diff --git a/recipes/rply/all/CMakeLists.txt b/recipes/rply/all/CMakeLists.txt new file mode 100644 index 0000000000000..b354602f83650 --- /dev/null +++ b/recipes/rply/all/CMakeLists.txt @@ -0,0 +1,18 @@ +cmake_minimum_required(VERSION 3.4) +project(rply LANGUAGES C) + +add_library(rply ${RPLY_SRC_DIR}/rply.c) +target_include_directories(rply PUBLIC ${RPLY_SRC_DIR}) +set_target_properties(rply PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) + +include(GNUInstallDirs) +install( + TARGETS rply + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) +install( + FILES ${RPLY_SRC_DIR}/rply.h ${RPLY_SRC_DIR}/rplyfile.h + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} +) diff --git a/recipes/rply/all/conandata.yml b/recipes/rply/all/conandata.yml new file mode 100644 index 0000000000000..2c48d7c782b77 --- /dev/null +++ b/recipes/rply/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.1.4": + url: "https://w3.impa.br/~diego/software/rply/rply-1.1.4.tar.gz" + sha256: "daf0b060fe701adf72aab0d525323d2e2e1bde9aa6aa9713ff1a5ef1e768d703" diff --git a/recipes/rply/all/conanfile.py b/recipes/rply/all/conanfile.py new file mode 100644 index 0000000000000..7ec833263602a --- /dev/null +++ b/recipes/rply/all/conanfile.py @@ -0,0 +1,62 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +import os + +required_conan_version = ">=1.53.0" + + +class RplyConan(ConanFile): + name = "rply" + description = "ANSI C Library for PLY file format input and output" + license = "MIT" + topics = ("ply", "3d", "reader", "writer") + homepage = "https://w3.impa.br/~diego/software/rply" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + exports_sources = "CMakeLists.txt" + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RPLY_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["rply"] diff --git a/recipes/rply/all/test_package/CMakeLists.txt b/recipes/rply/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5de7de58218bf --- /dev/null +++ b/recipes/rply/all/test_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(rply REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE rply::rply) diff --git a/recipes/rply/all/test_package/conanfile.py b/recipes/rply/all/test_package/conanfile.py new file mode 100644 index 0000000000000..b1cd2f951eab3 --- /dev/null +++ b/recipes/rply/all/test_package/conanfile.py @@ -0,0 +1,27 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + ply_file = os.path.join(self.source_folder, "triangle.ply") + self.run(f"{bin_path} {ply_file}", env="conanrun") diff --git a/recipes/rply/all/test_package/test_package.c b/recipes/rply/all/test_package/test_package.c new file mode 100644 index 0000000000000..6b98b23e1b4f3 --- /dev/null +++ b/recipes/rply/all/test_package/test_package.c @@ -0,0 +1,47 @@ +#include +#include + +static int vertex_cb(p_ply_argument argument) { + long eol; + ply_get_argument_user_data(argument, NULL, &eol); + printf("%g", ply_get_argument_value(argument)); + if (eol) printf("\n"); + else printf(" "); + return 1; +} + +static int face_cb(p_ply_argument argument) { + long length, value_index; + ply_get_argument_property(argument, NULL, &length, &value_index); + switch (value_index) { + case 0: + case 1: + printf("%g ", ply_get_argument_value(argument)); + break; + case 2: + printf("%g\n", ply_get_argument_value(argument)); + break; + default: + break; + } + return 1; +} + +int main(int argc, char **argv) { + if (argc < 2) { + printf("Need at least one argument\n"); + return 1; + } + long nvertices, ntriangles; + p_ply ply = ply_open(argv[1], NULL, 0, NULL); + if (!ply) return 1; + if (!ply_read_header(ply)) return 1; + nvertices = ply_set_read_cb(ply, "vertex", "x", vertex_cb, NULL, 0); + ply_set_read_cb(ply, "vertex", "y", vertex_cb, NULL, 0); + ply_set_read_cb(ply, "vertex", "z", vertex_cb, NULL, 1); + ntriangles = ply_set_read_cb(ply, "face", "vertex_indices", face_cb, NULL, 0); + printf("%ld\n%ld\n", nvertices, ntriangles); + if (!ply_read(ply)) return 1; + ply_close(ply); + return 0; +} diff --git a/recipes/rply/all/test_package/triangle.ply b/recipes/rply/all/test_package/triangle.ply new file mode 100644 index 0000000000000..a9a950416c055 --- /dev/null +++ b/recipes/rply/all/test_package/triangle.ply @@ -0,0 +1,15 @@ +ply +format ascii 1.0 +comment this is a simple file +obj_info any data, in one line of free form text +element vertex 3 +property float x +property float y +property float z +element face 1 +property list uchar int vertex_indices +end_header +-1 0 0 + 0 1 0 + 1 0 0 +3 0 1 2 diff --git a/recipes/rply/all/test_v1_package/CMakeLists.txt b/recipes/rply/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/rply/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/rply/all/test_v1_package/conanfile.py b/recipes/rply/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8c7d6ccfd145d --- /dev/null +++ b/recipes/rply/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + ply_file = os.path.join(self.source_folder, os.pardir, "test_package", "triangle.ply") + self.run(f"{bin_path} {ply_file}", run_environment=True) diff --git a/recipes/rply/config.yml b/recipes/rply/config.yml new file mode 100644 index 0000000000000..f7bc2bb892fbd --- /dev/null +++ b/recipes/rply/config.yml @@ -0,0 +1,3 @@ +versions: + "1.1.4": + folder: all diff --git a/recipes/rtmidi/all/CMakeLists.txt b/recipes/rtmidi/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/rtmidi/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/rtmidi/all/conandata.yml b/recipes/rtmidi/all/conandata.yml index 75f25b7e567a0..53cfe6b111167 100644 --- a/recipes/rtmidi/all/conandata.yml +++ b/recipes/rtmidi/all/conandata.yml @@ -8,6 +8,7 @@ sources: patches: "4.0.0": - patch_file: "patches/4.0.0-0001-add-a-separate-licence-file-0b5d67c.patch" - base_path: "source_subfolder" - patch_file: "patches/4.0.0-0002-rtmidiconfig-install-location-da51f21.patch" - base_path: "source_subfolder" + - patch_file: "patches/4.0.0-0003-relocatable-macos.patch" + patch_description: "Relocatable shared lib on macOS" + patch_type: "conan" diff --git a/recipes/rtmidi/all/conanfile.py b/recipes/rtmidi/all/conanfile.py index dddecdb71bc7b..a347f4bbefb6f 100644 --- a/recipes/rtmidi/all/conanfile.py +++ b/recipes/rtmidi/all/conanfile.py @@ -1,7 +1,11 @@ +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, replace_in_file, rmdir +from conan.tools.scm import Version import os -from conans import ConanFile, CMake, tools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class RtMidiConan(ConanFile): @@ -9,92 +13,96 @@ class RtMidiConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.music.mcgill.ca/~gary/rtmidi/" description = "Realtime MIDI input/output" - topics = ("midi") + topics = ("midi",) license = "MIT+send-patches-upstream" - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "pkg_config" - exports_sources = "CMakeLists.txt", "patches/*" + package_type = "library" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - } + } default_options = { "shared": False, "fPIC": True, - } - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + } @property def _with_alsa(self): return self.settings.os == "Linux" + def export_sources(self): + export_conandata_patches(self) + def config_options(self): if self.settings.os == 'Windows': del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def requirements(self): - if self._with_alsa: - self.requires("libalsa/1.2.4") + def layout(self): + cmake_layout(self, src_folder="src") - def build_requirements(self): + def requirements(self): if self._with_alsa: - self.build_requires("pkgconf/1.7.4") + self.requires("libalsa/1.2.7.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["RTMIDI_BUILD_TESTING"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["RTMIDI_BUILD_TESTING"] = False - self._cmake.configure() - return self._cmake + def _patch_sources(self): + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "${ALSA_LIBRARY}", "ALSA::ALSA") def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + if Version(self.version) < "5.0.0": + os.makedirs(os.path.join(self.package_folder, "include", "rtmidi")) + os.rename( + os.path.join(self.package_folder, "include", "RtMidi.h"), + os.path.join(self.package_folder, "include", "rtmidi", "RtMidi.h"), + ) def package_info(self): - if tools.Version(self.version) >= "5.0.0": - self.cpp_info.components["librtmidi"].includedirs = [os.path.join("include", "rtmidi")] - self.cpp_info.set_property("cmake_file_name", "RtMidi") self.cpp_info.set_property("cmake_target_name", "RtMidi::rtmidi") - self.cpp_info.components["librtmidi"].set_property("cmake_target_name", "RtMidi::rtmidi") self.cpp_info.set_property("pkg_config_name", "rtmidi") - self.cpp_info.components["librtmidi"].set_property("pkg_config_name", "rtmidi") - self.cpp_info.names["cmake_find_package"] = "RtMidi" - self.cpp_info.names["cmake_find_package_multi"] = "RtMidi" - self.cpp_info.components["librtmidi"].names["cmake_find_package"] = "rtmidi" - self.cpp_info.components["librtmidi"].names["cmake_find_package_multi"] = "rtmidi" + # TODO: back to global scope in conan v2 + self.cpp_info.components["librtmidi"].includedirs = [os.path.join("include", "rtmidi")] self.cpp_info.components["librtmidi"].libs = ["rtmidi"] - if self._with_alsa: - self.cpp_info.components["librtmidi"].requires.append("libalsa::libalsa") - if self.settings.os == "Macos": + if is_apple_os(self): self.cpp_info.components["librtmidi"].frameworks.extend( - ["CoreFoundation", "CoreAudio", "CoreMidi"] + ["CoreFoundation", "CoreAudio", "CoreMIDI", "CoreServices"] ) - if self.settings.os == "Windows": + elif self.settings.os == "Windows": self.cpp_info.components["librtmidi"].system_libs.append("winmm") elif self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.components["librtmidi"].system_libs.append("pthread") + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "RtMidi" + self.cpp_info.names["cmake_find_package_multi"] = "RtMidi" + self.cpp_info.components["librtmidi"].names["cmake_find_package"] = "rtmidi" + self.cpp_info.components["librtmidi"].names["cmake_find_package_multi"] = "rtmidi" + self.cpp_info.components["librtmidi"].set_property("cmake_target_name", "RtMidi::rtmidi") + self.cpp_info.components["librtmidi"].set_property("pkg_config_name", "rtmidi") + if self._with_alsa: + self.cpp_info.components["librtmidi"].requires.append("libalsa::libalsa") diff --git a/recipes/rtmidi/all/patches/4.0.0-0003-relocatable-macos.patch b/recipes/rtmidi/all/patches/4.0.0-0003-relocatable-macos.patch new file mode 100644 index 0000000000000..3eaf88b202b08 --- /dev/null +++ b/recipes/rtmidi/all/patches/4.0.0-0003-relocatable-macos.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -151,7 +151,6 @@ if (NEED_PTHREAD) + endif() + + # Create library targets. +-cmake_policy(SET CMP0042 OLD) + set(LIB_TARGETS) + + # Use RTMIDI_BUILD_SHARED_LIBS / RTMIDI_BUILD_STATIC_LIBS if they diff --git a/recipes/rtmidi/all/test_package/CMakeLists.txt b/recipes/rtmidi/all/test_package/CMakeLists.txt index e474ccf055e35..6e185f98e410d 100644 --- a/recipes/rtmidi/all/test_package/CMakeLists.txt +++ b/recipes/rtmidi/all/test_package/CMakeLists.txt @@ -1,13 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package CXX) find_package(RtMidi REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} RtMidi::rtmidi) +target_link_libraries(${PROJECT_NAME} PRIVATE RtMidi::rtmidi) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/rtmidi/all/test_package/conanfile.py b/recipes/rtmidi/all/test_package/conanfile.py index 7e2dfe859bb27..a9fb96656f203 100644 --- a/recipes/rtmidi/all/test_package/conanfile.py +++ b/recipes/rtmidi/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/rtmidi/all/test_v1_package/CMakeLists.txt b/recipes/rtmidi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/rtmidi/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/rtmidi/all/test_v1_package/conanfile.py b/recipes/rtmidi/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c492184eec19c --- /dev/null +++ b/recipes/rtmidi/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +# legacy validation with Conan 1.x +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/runtimeqml/all/CMakeLists.txt b/recipes/runtimeqml/all/CMakeLists.txt new file mode 100644 index 0000000000000..3180817c845da --- /dev/null +++ b/recipes/runtimeqml/all/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.13) + +project(runtimeqml LANGUAGES CXX) + +set(CMAKE_CXX_STANDARD 17) + +set(CMAKE_AUTOUIC ON) +set(CMAKE_AUTOMOC ON) +set(CMAKE_AUTORCC ON) +set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) + + +find_package(Qt5 CONFIG) +find_package(Qt6 CONFIG) +if (Qt6_FOUND) + set(HEADERS runtimeqml.hpp) + add_library(${PROJECT_NAME} runtimeqml.hpp runtimeqml.cpp) +elseif(Qt5_FOUND) + set(HEADERS runtimeqml.h) + add_library(${PROJECT_NAME} runtimeqml.h runtimeqml.cpp) +else() + message(FATAL_ERROR "Qt was not found") +endif() + +target_link_libraries(${PROJECT_NAME} PUBLIC qt::qt) +set_target_properties(${PROJECT_NAME} PROPERTIES PUBLIC_HEADER "${HEADERS}" C_VISIBILITY_PRESET hidden) +target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) + +include(GNUInstallDirs) +install(TARGETS ${PROJECT_NAME} + PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) diff --git a/recipes/runtimeqml/all/conandata.yml b/recipes/runtimeqml/all/conandata.yml new file mode 100644 index 0000000000000..a3ea3f95e8682 --- /dev/null +++ b/recipes/runtimeqml/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "cci.20220923": + url: https://github.com/GIPdA/runtimeqml/archive/3ae5dadcf6548a2e59e83c21d84fd50575df79bf.zip + sha256: "18bf63ab2692e6cb8ed6e0dbfcd2390dc65769eaed43b66c4da9dd7a55598603" + "cci.20211220": + url: https://github.com/GIPdA/runtimeqml/archive/ac0cbfc49ae215dd0df5ac8ecb79ca7008de5486.zip + sha256: "57c6d50f0fd281c0984daae65f3559942f58d11de8ff406c150d54fd7ff0d076" diff --git a/recipes/runtimeqml/all/conanfile.py b/recipes/runtimeqml/all/conanfile.py new file mode 100644 index 0000000000000..8ed18efdf54c9 --- /dev/null +++ b/recipes/runtimeqml/all/conanfile.py @@ -0,0 +1,105 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.microsoft import is_msvc, check_min_vs +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.files import get, copy +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.50.0" + + +class RuntimeQml(ConanFile): + name = "runtimeqml" + homepage = "https://github.com/GIPdA/runtimeqml" + description = "Enables hot-reloading qml files" + topics = ("qt", "hot-reload", "qml", "gui") + url = "https://github.com/conan-io/conan-center-index" + license = "BSD-3-Clause" + settings = "os", "arch", "compiler", "build_type" + + options = { + "shared": [True, False], + "fPIC": [True, False] + } + default_options = { + "shared": False, + "fPIC": True + } + + @property + def _minimum_cpp_standard(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } + + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, + self.export_sources_folder) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self) + + def requirements(self): + if Version(self.version) <= "cci.20211220": + self.requires("qt/5.15.5") + else: + self.requires("qt/6.3.1") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get( + str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) + qt = self.dependencies["qt"] + if not qt.options.qtdeclarative: + raise ConanInvalidConfiguration( + f"{self.ref} requires option qt:qtdeclarative=True") + + def source(self): + get(self, **self.conan_data["sources"][str(self.version)], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + tc = CMakeDeps(self) + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), keep_path=False) + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ["runtimeqml"] diff --git a/recipes/runtimeqml/all/test_package/CMakeLists.txt b/recipes/runtimeqml/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0abdc1edf18c8 --- /dev/null +++ b/recipes/runtimeqml/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +find_package(runtimeqml REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE runtimeqml::runtimeqml) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/runtimeqml/all/test_package/conanfile.py b/recipes/runtimeqml/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fbb7f543162 --- /dev/null +++ b/recipes/runtimeqml/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/runtimeqml/all/test_package/test_package.cpp b/recipes/runtimeqml/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..091aa9a194536 --- /dev/null +++ b/recipes/runtimeqml/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include + +#include + +int main(int argc, char* argv[]) { + QApplication app(argc, argv); + QQmlApplicationEngine engine; + + RuntimeQml rt{ &engine }; + return app.exec(); +} diff --git a/recipes/runtimeqml/all/test_v1_package/CMakeLists.txt b/recipes/runtimeqml/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/runtimeqml/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/runtimeqml/all/test_v1_package/conanfile.py b/recipes/runtimeqml/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..f44ea85fbe3eb --- /dev/null +++ b/recipes/runtimeqml/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/runtimeqml/config.yml b/recipes/runtimeqml/config.yml new file mode 100644 index 0000000000000..4efb187195976 --- /dev/null +++ b/recipes/runtimeqml/config.yml @@ -0,0 +1,5 @@ +versions: + "cci.20220923": + folder: "all" + "cci.20211220": + folder: "all" diff --git a/recipes/s2n/all/conandata.yml b/recipes/s2n/all/conandata.yml index 9b9a8f645b4ea..119cdd4f58eb5 100644 --- a/recipes/s2n/all/conandata.yml +++ b/recipes/s2n/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.3.31": + url: "https://github.com/aws/s2n-tls/archive/v1.3.31.tar.gz" + sha256: "23cfb42f82cbe1ce94b59f3b1c1c8eb9d24af2a1ae4c8f854209ff88fddd3900" "1.3.15": url: "https://github.com/aws/s2n-tls/archive/v1.3.15.tar.gz" sha256: "e3fc3405bb56334cbec90c35cbdf0e8a0f53199749a3f4b8fddb8d8a41e6db8b" diff --git a/recipes/s2n/all/conanfile.py b/recipes/s2n/all/conanfile.py index 0f993fa227516..ab4c2448a8e94 100644 --- a/recipes/s2n/all/conanfile.py +++ b/recipes/s2n/all/conanfile.py @@ -1,6 +1,7 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -from conan.tools.files import apply_conandata_patches +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, get, rmdir +from conans import CMake import os required_conan_version = ">=1.43.0" @@ -42,14 +43,14 @@ def configure(self): del self.settings.compiler.libcxx def requirements(self): - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("Not supported (yet)") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _configure_cmake(self): @@ -70,7 +71,7 @@ def package(self): self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) cmake = self._configure_cmake() cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "s2n")) + rmdir(self, os.path.join(self.package_folder, "lib", "s2n")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "s2n") diff --git a/recipes/s2n/config.yml b/recipes/s2n/config.yml index c944c2b90155a..611e0f7be0d88 100644 --- a/recipes/s2n/config.yml +++ b/recipes/s2n/config.yml @@ -1,4 +1,6 @@ versions: + "1.3.31": + folder: all "1.3.15": folder: all "1.3.9": diff --git a/recipes/safeint/all/conandata.yml b/recipes/safeint/all/conandata.yml index a813b97cd4e7d..4a9ad7617a715 100644 --- a/recipes/safeint/all/conandata.yml +++ b/recipes/safeint/all/conandata.yml @@ -1,7 +1,10 @@ sources: - "3.24": - url: "https://github.com/dcleblanc/SafeInt/archive/3.24.tar.gz" - sha256: "af6c7222a8420f6f87e198dc94791c28da75fe7241b605342c333fd03fd9dea6" + "3.0.27": + url: "https://github.com/dcleblanc/SafeInt/archive/refs/tags/3.0.27.tar.gz" + sha256: "489abb253514f819adb7e3aab3273b184c484dfe082fbe2166de2fd3a88dfb2b" "3.0.26": url: "https://github.com/dcleblanc/SafeInt/archive/refs/tags/3.0.26.tar.gz" sha256: "62fef99873ad975ddd8356923b3d51ed316209c1a05ac85814219373a13ae4d5" + "3.24": + url: "https://github.com/dcleblanc/SafeInt/archive/3.24.tar.gz" + sha256: "af6c7222a8420f6f87e198dc94791c28da75fe7241b605342c333fd03fd9dea6" diff --git a/recipes/safeint/all/conanfile.py b/recipes/safeint/all/conanfile.py index 5a9aa867bf18e..4130a0caf6073 100644 --- a/recipes/safeint/all/conanfile.py +++ b/recipes/safeint/all/conanfile.py @@ -11,12 +11,15 @@ class SafeintConan(ConanFile): name = "safeint" description = "SafeInt is a class library for C++ that manages integer overflows." license = "MIT" - topics = ("safeint", "integer", "overflow") + topics = ("integer", "overflow") homepage = "https://github.com/dcleblanc/SafeInt" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" no_copy_source = True + def layout(self): + basic_layout(self, src_folder="src") + def package_id(self): self.info.clear() @@ -24,9 +27,6 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - def layout(self): - basic_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -40,6 +40,4 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/safeint/all/test_package/conanfile.py b/recipes/safeint/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/safeint/all/test_package/conanfile.py +++ b/recipes/safeint/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/safeint/all/test_v1_package/CMakeLists.txt b/recipes/safeint/all/test_v1_package/CMakeLists.txt index e2ce73f44562c..0d20897301b68 100644 --- a/recipes/safeint/all/test_v1_package/CMakeLists.txt +++ b/recipes/safeint/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(safeint REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE safeint::safeint) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/safeint/config.yml b/recipes/safeint/config.yml index df1076f0d71c5..375ce5296b1af 100644 --- a/recipes/safeint/config.yml +++ b/recipes/safeint/config.yml @@ -1,5 +1,7 @@ versions: - "3.24": + "3.0.27": folder: all "3.0.26": folder: all + "3.24": + folder: all diff --git a/recipes/sail/all/CMakeLists.txt b/recipes/sail/all/CMakeLists.txt deleted file mode 100644 index 58945903045ba..0000000000000 --- a/recipes/sail/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(cmake_wrapper C CXX) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(src) diff --git a/recipes/sail/all/conandata.yml b/recipes/sail/all/conandata.yml index 8c052944241b6..3233a1960c7bf 100644 --- a/recipes/sail/all/conandata.yml +++ b/recipes/sail/all/conandata.yml @@ -1,8 +1,9 @@ sources: - "0.9.0-pre23": - url: "https://github.com/smoked-herring/sail/archive/v0.9.0-pre23.tar.gz" - sha256: "6c5314561fda3d388b4653e7424cdf2ae2c65767e79203576804ca41fc930a6b" + "0.9.0-rc2": + url: "https://github.com/smoked-herring/sail/archive/v0.9.0-rc2.tar.gz" + sha256: "988d318fd4cfbc77ccbda49f4ac751d1998b990db157aef32b0dbd32d11f8fd6" patches: - "0.9.0-pre23": - - patch_file: "patches/0.9.0-pre23-avif-find-package.patch" - base_path: "src" + "0.9.0-rc2": + - patch_file: "patches/0.9.0-rc2-avif-find-package.patch" + patch_type: "conan" + patch_description: "Make the AVIF codec use find_package()" diff --git a/recipes/sail/all/conanfile.py b/recipes/sail/all/conanfile.py index ad93abfe3ed64..6832bd1f1a055 100644 --- a/recipes/sail/all/conanfile.py +++ b/recipes/sail/all/conanfile.py @@ -1,9 +1,10 @@ -from conan.tools.files import rename -from conans import ConanFile, CMake, tools -import functools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rename, rmdir +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class SAILConan(ConanFile): name = "sail" @@ -20,7 +21,7 @@ class SAILConan(ConanFile): "with_avif": [True, False], "with_gif": [True, False], "with_jpeg2000": [True, False], - "with_jpeg": [True, False], + "with_jpeg": ["libjpeg", "libjpeg-turbo", False], "with_png": [True, False], "with_tiff": [True, False], "with_webp": [True, False], @@ -32,101 +33,105 @@ class SAILConan(ConanFile): "with_avif": True, "with_gif": True, "with_jpeg2000": True, - "with_jpeg": True, + "with_jpeg": "libjpeg", "with_png": True, "with_tiff": True, "with_webp": True, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "src" - - @property - def _build_subfolder(self): - return "build" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": - del self.options.fPIC + self.options.rm_safe("fPIC") def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): if self.options.with_avif: - self.requires("libavif/0.9.3") + self.requires("libavif/0.11.1") if self.options.with_gif: self.requires("giflib/5.2.1") if self.options.with_jpeg2000: self.requires("jasper/2.0.33") - if self.options.with_jpeg: - self.requires("libjpeg/9d") + if self.options.with_jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + elif self.options.with_jpeg == "libjpeg": + self.requires("libjpeg/9e") if self.options.with_png: - self.requires("libpng/1.6.37") + self.requires("libpng/1.6.39") if self.options.with_tiff: - self.requires("libtiff/4.3.0") + self.requires("libtiff/4.4.0") if self.options.with_webp: - self.requires("libwebp/1.2.2") + self.requires("libwebp/1.2.4") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) - - @functools.lru_cache(1) - def _configure_cmake(self): - except_codecs = [] - - if not self.options.with_avif: - except_codecs.append("AVIF") - if not self.options.with_gif: - except_codecs.append("GIF") - if not self.options.with_jpeg2000: - except_codecs.append("JPEG2000") - if not self.options.with_jpeg: - except_codecs.append("JPEG") - if not self.options.with_png: - except_codecs.append("PNG") - if not self.options.with_tiff: - except_codecs.append("TIFF") - if not self.options.with_webp: - except_codecs.append("WEBP") + get(self, **self.conan_data["sources"][self.version], + strip_root=True, destination=self.source_folder) - cmake = CMake(self) - cmake.definitions["SAIL_BUILD_APPS"] = False - cmake.definitions["SAIL_BUILD_EXAMPLES"] = False - cmake.definitions["SAIL_BUILD_TESTS"] = False - cmake.definitions["SAIL_COMBINE_CODECS"] = True - cmake.definitions["SAIL_EXCEPT_CODECS"] = ";".join(except_codecs) - cmake.definitions["SAIL_INSTALL_PDB"] = False - cmake.definitions["SAIL_THREAD_SAFE"] = self.options.thread_safe - cmake.configure(build_folder=self._build_subfolder) + def generate(self): + enable_codecs = [] - return cmake + if self.options.with_avif: + enable_codecs.append("avif") + if self.options.with_gif: + enable_codecs.append("gif") + if self.options.with_jpeg2000: + enable_codecs.append("jpeg2000") + if self.options.with_jpeg: + enable_codecs.append("jpeg") + if self.options.with_png: + enable_codecs.append("png") + if self.options.with_tiff: + enable_codecs.append("tiff") + if self.options.with_webp: + enable_codecs.append("webp") + + tc = CMakeToolchain(self) + tc.variables["SAIL_BUILD_APPS"] = False + tc.variables["SAIL_BUILD_EXAMPLES"] = False + tc.variables["SAIL_BUILD_TESTS"] = False + tc.variables["SAIL_COMBINE_CODECS"] = True + tc.variables["SAIL_ENABLE_CODECS"] = ";".join(enable_codecs) + tc.variables["SAIL_INSTALL_PDB"] = False + tc.variables["SAIL_THREAD_SAFE"] = self.options.thread_safe + # TODO: Remove after fixing https://github.com/conan-io/conan/issues/12012 + if is_msvc(self): + tc.cache_variables["CMAKE_TRY_COMPILE_CONFIGURATION"] = str(self.settings.build_type) + # TODO: Remove after fixing https://github.com/conan-io/conan-center-index/issues/13159 + # C3I workaround to force CMake to choose the highest version of + # the windows SDK available in the system + if is_msvc(self) and not self.conf.get("tools.cmake.cmaketoolchain:system_version"): + tc.variables["CMAKE_SYSTEM_VERSION"] = "10.0" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - self.copy("LICENSE.INIH.txt", src=self._source_subfolder, dst="licenses") - self.copy("LICENSE.MUNIT.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE.INIH.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE.MUNIT.txt", self.source_folder, os.path.join(self.package_folder, "licenses")) + + cmake = CMake(self) cmake.install() + # Remove CMake and pkg-config rules - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # Move icons rename(self, os.path.join(self.package_folder, "share"), os.path.join(self.package_folder, "res")) @@ -158,7 +163,7 @@ def package_info(self): if self.options.with_jpeg2000: self.cpp_info.components["sail-codecs"].requires.append("jasper::jasper") if self.options.with_jpeg: - self.cpp_info.components["sail-codecs"].requires.append("libjpeg::libjpeg") + self.cpp_info.components["sail-codecs"].requires.append("{0}::{0}".format(self.options.with_jpeg)) if self.options.with_png: self.cpp_info.components["sail-codecs"].requires.append("libpng::libpng") if self.options.with_tiff: diff --git a/recipes/sail/all/patches/0.9.0-pre23-avif-find-package.patch b/recipes/sail/all/patches/0.9.0-pre23-avif-find-package.patch deleted file mode 100644 index 3004739a6cda7..0000000000000 --- a/recipes/sail/all/patches/0.9.0-pre23-avif-find-package.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/src/sail-codecs/avif/CMakeLists.txt b/src/sail-codecs/avif/CMakeLists.txt -index 870de541..1fe5a7e7 100644 ---- a/src/sail-codecs/avif/CMakeLists.txt -+++ b/src/sail-codecs/avif/CMakeLists.txt -@@ -1,7 +1,6 @@ --find_library(AVIF_LIBRARY avif) --find_path(AVIF_INCLUDE_DIRS avif/avif.h) -+find_package(libavif CONFIG) - --if (NOT AVIF_LIBRARY OR NOT AVIF_INCLUDE_DIRS) -+if (NOT libavif_FOUND) - return() - endif() - -@@ -18,5 +17,5 @@ set(SAIL_CODECS_FIND_DEPENDENCIES ${SAIL_CODECS_FIND_DEPENDENCIES} "find_depende - sail_codec(NAME avif - SOURCES helpers.h helpers.c io.h io.c avif.c - ICON avif.png -- DEPENDENCY_INCLUDE_DIRS ${AVIF_INCLUDE_DIRS} -- DEPENDENCY_LIBS ${AVIF_LIBRARY}) -+ DEPENDENCY_INCLUDE_DIRS ${avif_INCLUDE_DIRS} -+ DEPENDENCY_LIBS avif) diff --git a/recipes/sail/all/patches/0.9.0-rc2-avif-find-package.patch b/recipes/sail/all/patches/0.9.0-rc2-avif-find-package.patch new file mode 100644 index 0000000000000..98ec3b23d5ae9 --- /dev/null +++ b/recipes/sail/all/patches/0.9.0-rc2-avif-find-package.patch @@ -0,0 +1,22 @@ +diff --git a/src/sail-codecs/avif/CMakeLists.txt b/src/sail-codecs/avif/CMakeLists.txt +index 3f36e0c8..1e31be83 100644 +--- a/src/sail-codecs/avif/CMakeLists.txt ++++ b/src/sail-codecs/avif/CMakeLists.txt +@@ -1,7 +1,6 @@ +-find_library(AVIF_LIBRARY avif ${SAIL_CODEC_AVIF_REQUIRED_OPTION}) +-find_path(AVIF_INCLUDE_DIRS avif/avif.h ${SAIL_CODEC_AVIF_REQUIRED_OPTION}) ++find_package(libavif ${SAIL_CODEC_AVIF_REQUIRED_OPTION}) + +-if (NOT AVIF_LIBRARY OR NOT AVIF_INCLUDE_DIRS) ++if (NOT libavif_FOUND) + return() + endif() + +@@ -18,5 +17,5 @@ set(SAIL_CODECS_FIND_DEPENDENCIES ${SAIL_CODECS_FIND_DEPENDENCIES} "find_depende + sail_codec(NAME avif + SOURCES helpers.h helpers.c io.h io.c avif.c + ICON avif.png +- DEPENDENCY_INCLUDE_DIRS ${AVIF_INCLUDE_DIRS} +- DEPENDENCY_LIBS ${AVIF_LIBRARY}) ++ DEPENDENCY_INCLUDE_DIRS ${avif_INCLUDE_DIRS} ++ DEPENDENCY_LIBS avif) diff --git a/recipes/sail/all/test_package/CMakeLists.txt b/recipes/sail/all/test_package/CMakeLists.txt index 63838b328e8e7..79614592c76dc 100644 --- a/recipes/sail/all/test_package/CMakeLists.txt +++ b/recipes/sail/all/test_package/CMakeLists.txt @@ -7,17 +7,14 @@ set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(Sail REQUIRED CONFIG) # C API add_executable(test_package_c test_package.c) -target_compile_definitions(test_package_c PRIVATE SAIL_DEMO_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/png.png") +target_compile_definitions(test_package_c PRIVATE SAIL_DEMO_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/bmp.bmp") target_link_libraries(test_package_c PRIVATE SAIL::Sail) # C++ API add_executable(test_package_cxx test_package.cpp) -target_compile_definitions(test_package_cxx PRIVATE SAIL_DEMO_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/png.png") +target_compile_definitions(test_package_cxx PRIVATE SAIL_DEMO_FILE_PATH="${CMAKE_CURRENT_SOURCE_DIR}/bmp.bmp") target_link_libraries(test_package_cxx PRIVATE SAIL::SailC++) diff --git a/recipes/sail/all/test_package/bmp.bmp b/recipes/sail/all/test_package/bmp.bmp new file mode 100644 index 0000000000000..74d4973a3b13c Binary files /dev/null and b/recipes/sail/all/test_package/bmp.bmp differ diff --git a/recipes/sail/all/test_package/conanfile.py b/recipes/sail/all/test_package/conanfile.py index e1256a3fd44fe..00e3064a021c0 100644 --- a/recipes/sail/all/test_package/conanfile.py +++ b/recipes/sail/all/test_package/conanfile.py @@ -1,10 +1,18 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,9 +20,9 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package_c") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package_c") + self.run(bin_path, env="conanrun") - bin_path = os.path.join("bin", "test_package_cxx") - self.run(bin_path, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package_cxx") + self.run(bin_path, env="conanrun") diff --git a/recipes/sail/all/test_package/png.png b/recipes/sail/all/test_package/png.png deleted file mode 100644 index 28a719d048562..0000000000000 Binary files a/recipes/sail/all/test_package/png.png and /dev/null differ diff --git a/recipes/sail/all/test_package/test_package.c b/recipes/sail/all/test_package/test_package.c index 3b6c3b66b46a6..eba9d786722c4 100644 --- a/recipes/sail/all/test_package/test_package.c +++ b/recipes/sail/all/test_package/test_package.c @@ -9,7 +9,7 @@ int main(int argc, char *argv[]) struct sail_image *image; - SAIL_TRY_OR_EXECUTE(sail_load_image_from_file(SAIL_DEMO_FILE_PATH, &image), + SAIL_TRY_OR_EXECUTE(sail_load_from_file(SAIL_DEMO_FILE_PATH, &image), /* on error */ return 1); printf("Size: %ux%u, bytes per line: %u, " diff --git a/recipes/sail/all/test_v1_package/CMakeLists.txt b/recipes/sail/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..dbf35d5521717 --- /dev/null +++ b/recipes/sail/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/sail/all/test_v1_package/bmp.bmp b/recipes/sail/all/test_v1_package/bmp.bmp new file mode 100644 index 0000000000000..74d4973a3b13c Binary files /dev/null and b/recipes/sail/all/test_v1_package/bmp.bmp differ diff --git a/recipes/sail/all/test_v1_package/conanfile.py b/recipes/sail/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e1256a3fd44fe --- /dev/null +++ b/recipes/sail/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +import os + +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package_c") + self.run(bin_path, run_environment=True) + + bin_path = os.path.join("bin", "test_package_cxx") + self.run(bin_path, run_environment=True) diff --git a/recipes/sail/config.yml b/recipes/sail/config.yml index 1ce318b79e80e..4b9680ce33efb 100644 --- a/recipes/sail/config.yml +++ b/recipes/sail/config.yml @@ -1,3 +1,3 @@ versions: - "0.9.0-pre23": + "0.9.0-rc2": folder: all diff --git a/recipes/sassc/all/conanfile.py b/recipes/sassc/all/conanfile.py index 34bbfc8292e30..b9452a96ffc40 100644 --- a/recipes/sassc/all/conanfile.py +++ b/recipes/sassc/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, AutoToolsBuildEnvironment, tools, MSBuild -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, replace_in_file, chdir, save +from conan.tools.microsoft import is_msvc +from conans import AutoToolsBuildEnvironment, tools, MSBuild import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class SasscConan(ConanFile): @@ -21,31 +24,30 @@ class SasscConan(ConanFile): def _source_subfolder(self): return "source_subfolder" - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - def config_options(self): del self.settings.compiler.libcxx del self.settings.compiler.cppstd - def configure(self): - if not self._is_msvc and self.settings.os not in ["Linux", "FreeBSD", "Macos"]: + def package_id(self): + del self.info.settings.compiler + + def validate(self): + if not is_msvc(self) and self.info.settings.os not in ["Linux", "FreeBSD", "Macos"]: raise ConanInvalidConfiguration("sassc supports only Linux, FreeBSD, Macos and Windows Visual Studio at this time, contributions are welcomed") def requirements(self): - self.requires("libsass/3.6.4") + self.requires("libsass/3.6.5") def build_requirements(self): - if not self._is_msvc: - self.build_requires("libtool/2.4.6") + if not is_msvc(self): + self.tool_requires("libtool/2.4.7") def source(self): - tools.get(**self.conan_data["sources"][self.version], + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _patch_sources(self): - tools.replace_in_file( + replace_in_file(self, os.path.join(self.build_folder, self._source_subfolder, "win", "sassc.vcxproj"), "$(LIBSASS_DIR)\\win\\libsass.targets", os.path.join(self.build_folder, "conanbuildinfo.props")) @@ -67,18 +69,18 @@ def _build_msbuild(self): def build(self): self._patch_sources() - with tools.chdir(self._source_subfolder): - if self._is_msvc: + with chdir(self, self._source_subfolder): + if is_msvc(self): self._build_msbuild() else: self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True) - tools.save(path="VERSION", content="%s" % self.version) + save(self, path="VERSION", content=f"{self.version}") autotools = self._configure_autotools() autotools.make() def package(self): - with tools.chdir(self._source_subfolder): - if self._is_msvc: + with chdir(self, self._source_subfolder): + if is_msvc(self): self.copy("*.exe", dst="bin", src=os.path.join(self._source_subfolder, "bin"), keep_path=False) else: autotools = self._configure_autotools() @@ -86,6 +88,11 @@ def package(self): self.copy("LICENSE", src=self._source_subfolder, dst="licenses") def package_info(self): - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var with : {}".format(bin_path)) - self.env_info.PATH.append(bin_path) + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + self.cpp_info.includedirs = [] + + bin_folder = os.path.join(self.package_folder, "bin") + # TODO: Legacy, to be removed on Conan 2.0 + self.env_info.PATH.append(bin_folder) diff --git a/recipes/scnlib/all/CMakeLists.txt b/recipes/scnlib/all/CMakeLists.txt deleted file mode 100644 index f9a34052e0036..0000000000000 --- a/recipes/scnlib/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) - -add_subdirectory(source_subfolder) diff --git a/recipes/scnlib/all/conandata.yml b/recipes/scnlib/all/conandata.yml index 1eda7afef2e2d..3a41a75a21f73 100644 --- a/recipes/scnlib/all/conandata.yml +++ b/recipes/scnlib/all/conandata.yml @@ -11,14 +11,25 @@ sources: patches: "1.1.2": - patch_file: "patches/1.1.2-0001-install-dll-windows.patch" - base_path: "source_subfolder" + patch_description: "add runtime destination path on install" + patch_type: "portability" - patch_file: "patches/1.1.2-0002-remove-header-only-target.patch" - base_path: "source_subfolder" + patch_description: "prevent to generate header only target for conan package" + patch_type: "conan" + - patch_file: "patches/1.1.2-0003-fix-link-keyword.patch" + patch_description: "use PRIVATE instead of INTERFACE" + patch_type: "conan" "1.0": - patch_file: "patches/1.0-0001-install-dll-windows.patch" - base_path: "source_subfolder" + patch_description: "add runtime destination path on install" + patch_type: "portability" - patch_file: "patches/1.0-0002-remove-header-only-target.patch" - base_path: "source_subfolder" + patch_description: "prevent to generate header only target for conan package" + patch_type: "conan" + - patch_file: "patches/1.0-0003-use-conan-package.patch" + patch_description: "use conan package of fast-float" + patch_type: "conan" "0.4": - patch_file: "patches/0.4-0001-install-dll-windows.patch" - base_path: "source_subfolder" + patch_description: "add runtime destination path on install" + patch_type: "portability" diff --git a/recipes/scnlib/all/conanfile.py b/recipes/scnlib/all/conanfile.py index 535022e87b7a6..bcd539ad6e965 100644 --- a/recipes/scnlib/all/conanfile.py +++ b/recipes/scnlib/all/conanfile.py @@ -1,18 +1,22 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import os +from conan import ConanFile +from conan.tools.microsoft import check_min_vs +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.layout import basic_layout +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -required_conan_version = ">=1.43.0" +import os +required_conan_version = ">=1.53.0" class ScnlibConan(ConanFile): name = "scnlib" description = "scanf for modern C++" license = "Apache-2.0" - topics = ("scnlib", "parsing", "io", "scanf") - homepage = "https://github.com/eliaskosunen/scnlib" url = "https://github.com/conan-io/conan-center-index" - + homepage = "https://github.com/eliaskosunen/scnlib" + topics = ("parsing", "io", "scanf") settings = "os", "arch", "compiler", "build_type" options = { "header_only": [True, False], @@ -25,18 +29,12 @@ class ScnlibConan(ConanFile): "fPIC": True, } - # required cmake_find_package_multi since scnlib>=1.1 uses `find_package(fast_float)` - generators = "cmake", "cmake_find_package_multi" - _cmake = None - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,79 +42,77 @@ def config_options(self): def configure(self): if self.options.header_only or self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.header_only: del self.options.shared - @property - def _compilers_minimum_version(self): - return { - "gcc": "5", - "clang": "6.0", - "Visual Studio": "16" if tools.Version(self.version) >= "1.0" else "15", - } + def layout(self): + if self.options.header_only: + basic_layout(self, src_folder="src") + else: + cmake_layout(self, src_folder="src") def requirements(self): - if tools.Version(self.version) >= "1.0": - self.requires("fast_float/3.4.0") + if Version(self.version) >= "1.0": + self.requires("fast_float/3.9.0") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if minimum_version and tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration( - "{} {} requires several C++11 features, which your compiler does not support.".format( - self.name, self.version, - ) - ) + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 192 if Version(self.version) >= "1.0" else 191) def package_id(self): if self.options.header_only: - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["SCN_INSTALL"] = True - if tools.Version(self.version) >= "1.0": - self._cmake.definitions["SCN_USE_BUNDLED_FAST_FLOAT"] = False - self._cmake.definitions["SCN_INSTALL"] = True - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + if self.options.header_only: + return + + tc = CMakeToolchain(self) + tc.variables["SCN_TESTS"] = False + tc.variables["SCN_EXAMPLES"] = False + tc.variables["SCN_BENCHMARKS"] = False + tc.variables["SCN_DOCS"] = False + tc.variables["SCN_INSTALL"] = True + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if Version(self.version) >= "1.0": + tc.variables["SCN_USE_BUNDLED_FAST_FLOAT"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if not self.options.header_only: - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) if self.options.header_only: - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) - if tools.Version(self.version) >= "1.0": - self.copy("reader_*.cpp", dst=os.path.join("include", "scn", "reader"), src=os.path.join(self._source_subfolder, "src")) - self.copy("vscan.cpp", dst=os.path.join("include", "scn", "scan"), src=os.path.join(self._source_subfolder, "src")) - self.copy("locale.cpp", dst=os.path.join("include", "scn", "detail"), src=os.path.join(self._source_subfolder, "src")) - self.copy("file.cpp", dst=os.path.join("include", "scn", "detail"), src=os.path.join(self._source_subfolder, "src")) + copy(self, "*", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + if Version(self.version) >= "1.0": + self.copy("reader_*.cpp", dst=os.path.join(self.package_folder, "include", "scn", "reader"), src=os.path.join(self.source_folder, "src")) + self.copy("vscan.cpp", dst=os.path.join(self.package_folder, "include", "scn", "scan"), src=os.path.join(self.source_folder, "src")) + self.copy("locale.cpp", dst=os.path.join(self.package_folder, "include", "scn", "detail"), src=os.path.join(self.source_folder, "src")) + self.copy("file.cpp", dst=os.path.join(self.package_folder, "include", "scn", "detail"), src=os.path.join(self.source_folder, "src")) else: - self.copy("*.cpp", dst=os.path.join("include", "scn", "detail"), src=os.path.join(self._source_subfolder, "src")) + self.copy("*.cpp", dst=os.path.join(self.package_folder, "include", "scn", "detail"), src=os.path.join(self.source_folder, "src")) else: - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) - if tools.Version(self.version) >= "1.0": - tools.remove_files_by_mask(os.path.join(self.package_folder, "include", "scn", "detail"), "*.cmake") - tools.rmdir(os.path.join(self.package_folder, "include", "scn", "detail", "CMakeFiles")) - tools.rmdir(os.path.join(self.package_folder, "include", "scn", "detail", "deps", "CMakeFiles")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + if Version(self.version) >= "1.0": + rm(self, "*.cmake", os.path.join(self.package_folder, "include", "scn", "detail")) + rmdir(self, os.path.join(self.package_folder, "include", "scn", "detail", "CMakeFiles")) + rmdir(self, os.path.join(self.package_folder, "include", "scn", "detail", "deps", "CMakeFiles")) def package_info(self): target = "scn-header-only" if self.options.header_only else "scn" @@ -128,9 +124,12 @@ def package_info(self): else: self.cpp_info.components["_scnlib"].defines = ["SCN_HEADER_ONLY=0"] self.cpp_info.components["_scnlib"].libs = ["scn"] - if tools.Version(self.version) >= "1.0": + if Version(self.version) >= "1.0": self.cpp_info.components["_scnlib"].requires = ["fast_float::fast_float"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["_scnlib"].system_libs.append("m") + # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "scn" self.cpp_info.names["cmake_find_package_multi"] = "scn" diff --git a/recipes/scnlib/all/patches/1.0-0003-use-conan-package.patch b/recipes/scnlib/all/patches/1.0-0003-use-conan-package.patch new file mode 100644 index 0000000000000..5b5354a04f783 --- /dev/null +++ b/recipes/scnlib/all/patches/1.0-0003-use-conan-package.patch @@ -0,0 +1,35 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 1aba404..f0c4b94 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -48,6 +48,8 @@ if (NOT (${CMAKE_VERSION} VERSION_LESS "3.9.0")) + cmake_policy(SET CMP0069 NEW) + endif () + ++find_package(FastFloat REQUIRED) ++ + include(sanitizers) + include(flags) + +@@ -83,8 +85,8 @@ function(generate_library_target target_name) + target_include_directories(${target_name} PRIVATE + $) + else () +- target_link_libraries(${target_name} INTERFACE +- fast_float) ++ target_link_libraries(${target_name} PRIVATE ++ FastFloat::fast_float) + endif () + endfunction() + function(generate_header_only_target target_name) +@@ -100,8 +102,8 @@ function(generate_header_only_target target_name) + target_include_directories(${target_name} INTERFACE + $) + else () +- target_link_libraries(${target_name} INTERFACE +- fast_float) ++ target_link_libraries(${target_name} PRIVATE ++ FastFloat::fast_float) + endif () + endfunction() + diff --git a/recipes/scnlib/all/patches/1.1.2-0003-fix-link-keyword.patch b/recipes/scnlib/all/patches/1.1.2-0003-fix-link-keyword.patch new file mode 100644 index 0000000000000..9fedf6c33071c --- /dev/null +++ b/recipes/scnlib/all/patches/1.1.2-0003-fix-link-keyword.patch @@ -0,0 +1,22 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 87cb1f7..4524490 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -87,7 +87,7 @@ function(generate_library_target target_name) + target_include_directories(${target_name} PRIVATE + $) + else () +- target_link_libraries(${target_name} INTERFACE ++ target_link_libraries(${target_name} PRIVATE + FastFloat::fast_float) + endif () + endfunction() +@@ -104,7 +104,7 @@ function(generate_header_only_target target_name) + target_include_directories(${target_name} INTERFACE + $) + else () +- target_link_libraries(${target_name} INTERFACE ++ target_link_libraries(${target_name} PRIVATE + FastFloat::fast_float) + endif () + endfunction() diff --git a/recipes/scnlib/all/test_package/CMakeLists.txt b/recipes/scnlib/all/test_package/CMakeLists.txt index 162694934e5fb..0c68330d44cd3 100644 --- a/recipes/scnlib/all/test_package/CMakeLists.txt +++ b/recipes/scnlib/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(scn REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) if(TARGET scn::scn-header-only) - target_link_libraries(${PROJECT_NAME} scn::scn-header-only) + target_link_libraries(${PROJECT_NAME} PRIVATE scn::scn-header-only) else() - target_link_libraries(${PROJECT_NAME} scn::scn) + target_link_libraries(${PROJECT_NAME} PRIVATE scn::scn) endif() +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/scnlib/all/test_package/conanfile.py b/recipes/scnlib/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/scnlib/all/test_package/conanfile.py +++ b/recipes/scnlib/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/scnlib/all/test_v1_package/CMakeLists.txt b/recipes/scnlib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/scnlib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/scnlib/all/test_v1_package/conanfile.py b/recipes/scnlib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/scnlib/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/screen_capture_lite/all/conandata.yml b/recipes/screen_capture_lite/all/conandata.yml new file mode 100644 index 0000000000000..ebf387ff02ee5 --- /dev/null +++ b/recipes/screen_capture_lite/all/conandata.yml @@ -0,0 +1,20 @@ +sources: + "17.1.613": + url: "https://github.com/smasherprog/screen_capture_lite/archive/refs/tags/17.1.613.tar.gz" + sha256: "ab111e52379fc4bca852b9a79535329e12dca9b25a0b87a2ef84ab7348a64064" + "17.1.462": + url: "https://github.com/smasherprog/screen_capture_lite/archive/refs/tags/17.1.462.tar.gz" + sha256: "4c7d9b23a458645534c4e2a7315eb12fc7d6dc0fb914f1d6787ee9d5d16e6dfd" + "17.1.439": + url: "https://github.com/smasherprog/screen_capture_lite/archive/refs/tags/17.1.439.tar.gz" + sha256: "c6e6eead72114dc7ba9f3fb17eeff01b4b53bb3ad3b71a55ebe08b61bbff9dea" + +patches: + "17.1.462": + - patch_file: "patches/17.1.462-0001-fix-cmake.patch" + patch_description: "specify build library static or shared" + patch_type: "conan" + "17.1.439": + - patch_file: "patches/17.1.439-0001-fix-cmake.patch" + patch_description: "specify build library static or shared" + patch_type: "conan" diff --git a/recipes/screen_capture_lite/all/conanfile.py b/recipes/screen_capture_lite/all/conanfile.py new file mode 100644 index 0000000000000..b435b4fa5fdfb --- /dev/null +++ b/recipes/screen_capture_lite/all/conanfile.py @@ -0,0 +1,158 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import check_min_vs, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.apple import is_apple_os +import os + +required_conan_version = ">=1.52.0" + +class ScreenCaptureLiteConan(ConanFile): + name = "screen_capture_lite" + license = "MIT" + description = "cross platform screen/window capturing library " + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/smasherprog/screen_capture_lite" + topics = ("screen-capture", "screen-ercorder") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _minimum_cpp_standard(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "10", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + if self.settings.os in ["Linux", "FreeBSD"]: + self.requires("xorg/system") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + check_min_vs(self, 192) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) + + if self.info.settings.compiler == "clang" and self.info.settings.compiler.get_safe("libcxx") == "libstdc++": + raise ConanInvalidConfiguration(f"{self.ref} does not support clang with libstdc++") + + # Since 17.1.451, screen_capture_lite uses CGPreflightScreenCaptureAccess which is provided by macOS SDK 11 later. + if Version(self.version) >= "17.1.451" and \ + is_apple_os(self) and Version(self.info.settings.compiler.version) <= "11": + raise ConanInvalidConfiguration(f"{self.ref} requires CGPreflightScreenCaptureAccess which support macOS SDK 11 later.") + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if Version(self.version) >= "17.1.596" and not self._cmake_new_enough("3.16"): + self.tool_requires("cmake/3.25.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_EXAMPLE"] = False + if is_msvc(self): + # fix "error C2039: 'CheckForDuplicateEntries': is not a member of 'Microsoft::WRL::Details'" + tc.variables["CMAKE_SYSTEM_VERSION"] = "10.0.18362.0" + if Version(self.version) >= "17.1.613": + tc.variables["BUILD_CSHARP"] = False + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + + def package_info(self): + self.cpp_info.libs = ["screen_capture_lite_shared" if self.options.shared else "screen_capture_lite_static"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("pthread") + self.cpp_info.requires.extend([ + "xorg::x11", + "xorg::xinerama", + "xorg::xext", + "xorg::xfixes", + ]) + elif self.settings.os == "Windows": + self.cpp_info.system_libs.extend([ + "dwmapi", + "d3d11", + "dxgi", + ]) + elif self.settings.os == "Macos": + self.cpp_info.frameworks.extend([ + "AppKit", + "AVFoundation", + "Carbon", + "Cocoa", + "CoreFoundation", + "CoreGraphics", + "CoreMedia", + "CoreVideo", + "Foundation", + "ImageIO", + ]) diff --git a/recipes/screen_capture_lite/all/patches/17.1.439-0001-fix-cmake.patch b/recipes/screen_capture_lite/all/patches/17.1.439-0001-fix-cmake.patch new file mode 100644 index 0000000000000..af4ad9b62d58b --- /dev/null +++ b/recipes/screen_capture_lite/all/patches/17.1.439-0001-fix-cmake.patch @@ -0,0 +1,69 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d646b23..23742b8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,11 +1,10 @@ +-cmake_minimum_required(VERSION 3.20) ++cmake_minimum_required(VERSION 3.12) + project(screen_capture_lite_build) + + set(CMAKE_CXX_STANDARD 20) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) + option(BUILD_EXAMPLE "Build example" ON) +-set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Build shared libraries") + set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + +@@ -22,13 +21,20 @@ else() + endif() + + add_subdirectory(src_cpp) +-add_subdirectory(src_csharp) + +-install (TARGETS screen_capture_lite_static screen_capture_lite_shared +- RUNTIME DESTINATION bin +- ARCHIVE DESTINATION lib +- LIBRARY DESTINATION lib +-) ++if(BUILD_SHARED_LIBS) ++ install (TARGETS screen_capture_lite_shared ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++else() ++ install (TARGETS screen_capture_lite_static ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++endif() + + install (FILES + include/ScreenCapture.h +diff --git a/src_cpp/CMakeLists.txt b/src_cpp/CMakeLists.txt +index bc59c0b..1c4a1b4 100644 +--- a/src_cpp/CMakeLists.txt ++++ b/src_cpp/CMakeLists.txt +@@ -75,10 +75,12 @@ set(libsrc + ThreadManager.cpp + ${SCREEN_CAPTURE_PLATFORM_SRC} + ) +- ++ ++if(NOT BUILD_SHARED_LIBS) + message("Building STATIC Library") + add_library(${PROJECT_NAME}_static STATIC ${libsrc}) + ++else() + message("Building SHARED Library") + + add_library(${PROJECT_NAME}_shared SHARED ${libsrc}) +@@ -124,4 +126,4 @@ add_library(${PROJECT_NAME}_static STATIC ${libsrc}) + ${CMAKE_THREAD_LIBS_INIT} + ) + endif() +- +\ No newline at end of file ++endif() diff --git a/recipes/screen_capture_lite/all/patches/17.1.462-0001-fix-cmake.patch b/recipes/screen_capture_lite/all/patches/17.1.462-0001-fix-cmake.patch new file mode 100644 index 0000000000000..7591b9453fc49 --- /dev/null +++ b/recipes/screen_capture_lite/all/patches/17.1.462-0001-fix-cmake.patch @@ -0,0 +1,66 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index d646b23..23742b8 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,11 +1,10 @@ +-cmake_minimum_required(VERSION 3.20) ++cmake_minimum_required(VERSION 3.12) + project(screen_capture_lite_build) + + set(CMAKE_CXX_STANDARD 20) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) + option(BUILD_EXAMPLE "Build example" ON) +-set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "Build shared libraries") + set (CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + set (CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) + +@@ -22,13 +21,20 @@ else() + endif() + + add_subdirectory(src_cpp) +-add_subdirectory(src_csharp) + +-install (TARGETS screen_capture_lite_static screen_capture_lite_shared +- RUNTIME DESTINATION bin +- ARCHIVE DESTINATION lib +- LIBRARY DESTINATION lib +-) ++if(BUILD_SHARED_LIBS) ++ install (TARGETS screen_capture_lite_shared ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++else() ++ install (TARGETS screen_capture_lite_static ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ ) ++endif() + + install (FILES + include/ScreenCapture.h +diff --git a/src_cpp/CMakeLists.txt b/src_cpp/CMakeLists.txt +index 9d1ecc8..2933b97 100644 +--- a/src_cpp/CMakeLists.txt ++++ b/src_cpp/CMakeLists.txt +@@ -77,9 +77,11 @@ set(libsrc + ${SCREEN_CAPTURE_PLATFORM_SRC} + ) + ++if(NOT BUILD_SHARED_LIBS) + message("Building STATIC Library") + add_library(${PROJECT_NAME}_static STATIC ${libsrc}) + ++else() + message("Building SHARED Library") + + add_library(${PROJECT_NAME}_shared SHARED ${libsrc} ../include/ScreenCapture_C_API.h) +@@ -127,4 +129,4 @@ add_library(${PROJECT_NAME}_static STATIC ${libsrc}) + ${CMAKE_THREAD_LIBS_INIT} + ) + endif() +- ++endif() diff --git a/recipes/screen_capture_lite/all/test_package/CMakeLists.txt b/recipes/screen_capture_lite/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..920e6c9d22764 --- /dev/null +++ b/recipes/screen_capture_lite/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(screen_capture_lite REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE screen_capture_lite::screen_capture_lite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/screen_capture_lite/all/test_package/conanfile.py b/recipes/screen_capture_lite/all/test_package/conanfile.py new file mode 100644 index 0000000000000..d60b533632ddd --- /dev/null +++ b/recipes/screen_capture_lite/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/screen_capture_lite/all/test_package/test_package.cpp b/recipes/screen_capture_lite/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..0b39c636788c9 --- /dev/null +++ b/recipes/screen_capture_lite/all/test_package/test_package.cpp @@ -0,0 +1,8 @@ +#include +#include "ScreenCapture.h" + +int main() { + SL::Screen_Capture::CreateCaptureConfiguration([](){ + return SL::Screen_Capture::GetMonitors(); + }); +} diff --git a/recipes/screen_capture_lite/all/test_v1_package/CMakeLists.txt b/recipes/screen_capture_lite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/screen_capture_lite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/screen_capture_lite/all/test_v1_package/conanfile.py b/recipes/screen_capture_lite/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..132c03950e167 --- /dev/null +++ b/recipes/screen_capture_lite/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +from conan.tools.microsoft import is_msvc +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/screen_capture_lite/config.yml b/recipes/screen_capture_lite/config.yml new file mode 100644 index 0000000000000..f8e73a4caff7b --- /dev/null +++ b/recipes/screen_capture_lite/config.yml @@ -0,0 +1,7 @@ +versions: + "17.1.613": + folder: "all" + "17.1.462": + folder: "all" + "17.1.439": + folder: "all" diff --git a/recipes/sdf/all/conanfile.py b/recipes/sdf/all/conanfile.py index 96b6a01437b37..2e95da6861e3d 100644 --- a/recipes/sdf/all/conanfile.py +++ b/recipes/sdf/all/conanfile.py @@ -1,6 +1,9 @@ +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -import glob -from conans import ConanFile, tools + +required_conan_version = ">=1.50.0" class SdfConan(ConanFile): @@ -9,26 +12,30 @@ class SdfConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/memononen/SDF" - topics = ("conan", "sdf", "signed", "distance", "field", "contour") - settings = "os" + topics = ("sdf", "signed", "distance", "field", "contour") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return os.path.join(self.source_folder, "source_subfolder") + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob('SDF-*/')[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - self.copy("*.h", src=os.path.join(self._source_subfolder, "src"), dst="include") + def build(self): + pass - def package_id(self): - self.info.header_only() + def package(self): + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "src"), dst=os.path.join(self.package_folder, "include")) def package_info(self): - if self.settings.os == "Linux": + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/sdf/all/test_package/CMakeLists.txt b/recipes/sdf/all/test_package/CMakeLists.txt index 34af13462f44f..afcf11bbd8776 100644 --- a/recipes/sdf/all/test_package/CMakeLists.txt +++ b/recipes/sdf/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(sdf REQUIRED CONFIG) +find_package(stb REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE sdf::sdf stb::stb) diff --git a/recipes/sdf/all/test_package/conanfile.py b/recipes/sdf/all/test_package/conanfile.py index f0f5021b597ee..ad5b8f9465ed6 100644 --- a/recipes/sdf/all/test_package/conanfile.py +++ b/recipes/sdf/all/test_package/conanfile.py @@ -1,13 +1,20 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) def requirements(self): - self.requires("stb/20200203") + self.requires(self.tested_reference_str) + self.requires("stb/cci.20210910") def build(self): cmake = CMake(self) @@ -15,7 +22,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") img_path = os.path.join(self.source_folder, "test.png") - self.run("{0} {1}".format(bin_path, img_path), run_environment=True) + self.run(f"{bin_path} {img_path}", env="conanrun") diff --git a/recipes/sdf/all/test_v1_package/CMakeLists.txt b/recipes/sdf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..ee4e3e06a56c5 --- /dev/null +++ b/recipes/sdf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(sdf REQUIRED CONFIG) +find_package(stb REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE sdf::sdf stb::stb) diff --git a/recipes/sdf/all/test_v1_package/conanfile.py b/recipes/sdf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..855f0ca3462a1 --- /dev/null +++ b/recipes/sdf/all/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def requirements(self): + self.requires("stb/cci.20210910") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_path = os.path.join(self.source_folder, os.pardir, "test_package", "test.png") + self.run(f"{bin_path} {img_path}", run_environment=True) diff --git a/recipes/sdl/all/CMakeLists.txt b/recipes/sdl/all/CMakeLists.txt deleted file mode 100644 index 94daaf65016d8..0000000000000 --- a/recipes/sdl/all/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 3.0) -project(cmake_wrapper) - -include(${CONAN_INSTALL_FOLDER}/conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(UNIX AND NOT APPLE) - if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU") - if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0) - add_definitions("-DGBM_BO_USE_CURSOR=2") - endif() - endif() -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/sdl/all/conandata.yml b/recipes/sdl/all/conandata.yml index c22695db16adc..24d42d4c8fad2 100644 --- a/recipes/sdl/all/conandata.yml +++ b/recipes/sdl/all/conandata.yml @@ -1,30 +1,44 @@ sources: + "2.26.1": + url: "https://www.libsdl.org/release/SDL2-2.26.1.tar.gz" + sha256: "02537cc7ebd74071631038b237ec4bfbb3f4830ba019e569434da33f42373e04" + "2.26.0": + url: "https://www.libsdl.org/release/SDL2-2.26.0.tar.gz" + sha256: "8000d7169febce93c84b6bdf376631f8179132fd69f7015d4dadb8b9c2bdb295" + "2.24.1": + url: "https://www.libsdl.org/release/SDL2-2.24.1.tar.gz" + sha256: "bc121588b1105065598ce38078026a414c28ea95e66ed2adab4c44d80b309e1b" "2.24.0": url: "https://www.libsdl.org/release/SDL2-2.24.0.tar.gz" - sha256: 91e4c34b1768f92d399b078e171448c6af18cafda743987ed2064a28954d6d97 + sha256: "91e4c34b1768f92d399b078e171448c6af18cafda743987ed2064a28954d6d97" "2.0.20": url: "https://www.libsdl.org/release/SDL2-2.0.20.tar.gz" - sha256: c56aba1d7b5b0e7e999e4a7698c70b63a3394ff9704b5f6e1c57e0c16f04dd06 + sha256: "c56aba1d7b5b0e7e999e4a7698c70b63a3394ff9704b5f6e1c57e0c16f04dd06" "2.0.18": url: "https://www.libsdl.org/release/SDL2-2.0.18.tar.gz" - sha256: 94d40cd73dbfa10bb6eadfbc28f355992bb2d6ef6761ad9d4074eff95ee5711c + sha256: "94d40cd73dbfa10bb6eadfbc28f355992bb2d6ef6761ad9d4074eff95ee5711c" "2.0.16": url: "https://www.libsdl.org/release/SDL2-2.0.16.tar.gz" - sha256: 65be9ff6004034b5b2ce9927b5a4db1814930f169c4b2dae0a1e4697075f287b + sha256: "65be9ff6004034b5b2ce9927b5a4db1814930f169c4b2dae0a1e4697075f287b" "2.0.14": url: "https://www.libsdl.org/release/SDL2-2.0.14.tar.gz" - sha256: d8215b571a581be1332d2106f8036fcb03d12a70bae01e20f424976d275432bc + sha256: "d8215b571a581be1332d2106f8036fcb03d12a70bae01e20f424976d275432bc" patches: "2.0.20": - patch_file: "patches/0004-2.0.20-ndk.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "ndk patch" "2.0.16": - patch_file: "patches/0003-2.0.16-wayland-scanner-buildrequires.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "wayland scanner buildrequires" "2.0.14": - patch_file: "patches/0001-fix-cmake-ios-tvos.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "fix cmake ios tvos" - patch_file: "patches/0002-mingw-improvements.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "mingw improvements" - patch_file: "patches/0003-2.0.14-wayland-scanner-buildrequires.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "wayland scanner buildrequires" diff --git a/recipes/sdl/all/conanfile.py b/recipes/sdl/all/conanfile.py index 698a088fe228a..3e8e5233fd108 100644 --- a/recipes/sdl/all/conanfile.py +++ b/recipes/sdl/all/conanfile.py @@ -1,15 +1,16 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.apple import is_apple_os -from conan.tools.files import apply_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, replace_in_file, rm, rmdir, copy from conan.tools.microsoft import is_msvc from conan.tools.build import cross_building from conan.tools.scm import Version -from conans import CMake, tools -import functools +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import Environment + import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class SDLConan(ConanFile): @@ -21,6 +22,9 @@ class SDLConan(ConanFile): license = "Zlib" settings = "os", "arch", "compiler", "build_type" + + generators = "CMakeDeps", "PkgConfigDeps", "VirtualBuildEnv" + options = { "shared": [True, False], "fPIC": [True, False], @@ -80,20 +84,23 @@ class SDLConan(ConanFile): "libunwind": True, } - generators = ["cmake", "pkg_config"] + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _source_subfolder(self): - return "source_subfolder" + def generate(self): + self.define_toolchain() + lib_paths = [lib for _, dep in self.dependencies.items() for lib in dep.cpp_info.libdirs] + env = Environment() + env.define_path("LIBRARY_PATH", os.pathsep.join(lib_paths)) - @property - def _build_subfolder(self): - return "build_subfolder" + # FIXME: remove and raise required_conan_version to 1.55 once it's on c3i + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + + env = env.vars(self, scope="build") + env.save_script("sdl_env") def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -125,9 +132,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def requirements(self): if self.options.get_safe("iconv", False): @@ -178,19 +185,19 @@ def build_requirements(self): # or because CMake's platform configuration is corrupt. # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. self.build_requires("cmake/3.22.0") - if self.settings.os == "Linux": - self.build_requires("pkgconf/1.7.4") + if self.settings.os == "Linux" and not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") if hasattr(self, "settings_build") and self.options.get_safe("wayland"): self.build_requires("wayland/1.20.0") # Provides wayland-scanner def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) + destination=self.source_folder) def _patch_sources(self): apply_conandata_patches(self) - replace_in_file(self, os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), 'check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)', '# check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)') @@ -198,184 +205,192 @@ def _patch_sources(self): if self.options.get_safe("wayland") and Version(self.version) >= "2.0.18": wayland_bin_path = " ".join("\"{}\"".format(path) for path in self.deps_env_info["wayland"].PATH) replace_in_file(self, - os.path.join(self._source_subfolder, "cmake", "sdlchecks.cmake"), - "find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED)", - "find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED PATHS {} NO_DEFAULT_PATH)".format(wayland_bin_path), - ) + os.path.join(self.source_folder, "cmake", "sdlchecks.cmake"), + "find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED)", + "find_program(WAYLAND_SCANNER NAMES wayland-scanner REQUIRED PATHS {} NO_DEFAULT_PATH)".format(wayland_bin_path), + ) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["SDL2_DISABLE_INSTALL"] = False # SDL2_* options will get renamed to SDL_ options in the next SDL release + def define_toolchain(self): + tc = CMakeToolchain(self) + if self.settings.os == "Linux" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < 5.0: + tc.preprocessor_definitions["GBM_BO_USE_CURSOR"] = 2 + + tc.variables["SDL2_DISABLE_INSTALL"] = False # SDL2_* options will get renamed to SDL_ options in the next SDL release if is_apple_os(self): - cmake.definitions["CMAKE_OSX_ARCHITECTURES"] = { + tc.variables["CMAKE_OSX_ARCHITECTURES"] = { "armv8": "arm64", }.get(str(self.settings.arch), str(self.settings.arch)) cmake_required_includes = [] # List of directories used by CheckIncludeFile (https://cmake.org/cmake/help/latest/module/CheckIncludeFile.html) cmake_extra_ldflags = [] - # FIXME: self.install_folder not defined? Neccessary? - cmake.definitions["CONAN_INSTALL_FOLDER"] = self.install_folder + cmake_extra_libs = [] + if self.settings.os != "Windows" and not self.options.shared: - cmake.definitions["SDL_STATIC_PIC"] = self.options.fPIC + tc.variables["SDL_STATIC_PIC"] = self.options.fPIC if is_msvc(self) and not self.options.shared: - cmake.definitions["HAVE_LIBC"] = True - cmake.definitions["SDL_SHARED"] = self.options.shared - cmake.definitions["SDL_STATIC"] = not self.options.shared + tc.variables["HAVE_LIBC"] = True + tc.variables["SDL_SHARED"] = self.options.shared + tc.variables["SDL_STATIC"] = not self.options.shared if Version(self.version) < "2.0.18": - cmake.definitions["VIDEO_OPENGL"] = self.options.opengl - cmake.definitions["VIDEO_OPENGLES"] = self.options.opengles - cmake.definitions["VIDEO_VULKAN"] = self.options.vulkan + tc.variables["VIDEO_OPENGL"] = self.options.opengl + tc.variables["VIDEO_OPENGLES"] = self.options.opengles + tc.variables["VIDEO_VULKAN"] = self.options.vulkan if self.settings.os == "Linux": # See https://github.com/bincrafters/community/issues/696 - cmake.definitions["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 + tc.variables["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 - cmake.definitions["ALSA"] = self.options.alsa + tc.variables["ALSA"] = self.options.alsa if self.options.alsa: - cmake.definitions["ALSA_SHARED"] = self.deps_cpp_info["libalsa"].shared - cmake.definitions["HAVE_ASOUNDLIB_H"] = True - cmake.definitions["HAVE_LIBASOUND"] = True - cmake.definitions["JACK"] = self.options.jack + tc.variables["ALSA_SHARED"] = self.options["libalsa"].shared + tc.variables["HAVE_ASOUNDLIB_H"] = True + tc.variables["HAVE_LIBASOUND"] = True + tc.variables["JACK"] = self.options.jack if self.options.jack: - cmake.definitions["JACK_SHARED"] = self.deps_cpp_info["jack"].shared - cmake.definitions["ESD"] = self.options.esd + tc.variables["JACK_SHARED"] = self.options["jack"].shared + tc.variables["ESD"] = self.options.esd if self.options.esd: - cmake.definitions["ESD_SHARED"] = self.deps_cpp_info["esd"].shared - cmake.definitions["PULSEAUDIO"] = self.options.pulse + tc.variables["ESD_SHARED"] = self.options["esd"].shared + tc.variables["PULSEAUDIO"] = self.options.pulse if self.options.pulse: - cmake.definitions["PULSEAUDIO_SHARED"] = self.deps_cpp_info["pulseaudio"].shared - cmake.definitions["SNDIO"] = self.options.sndio + tc.variables["PULSEAUDIO_SHARED"] = self.options["pulseaudio"].shared + tc.variables["SNDIO"] = self.options.sndio if self.options.sndio: - cmake.definitions["SNDIO_SHARED"] = self.deps_cpp_info["sndio"].shared - cmake.definitions["NAS"] = self.options.nas + tc.variables["SNDIO_SHARED"] = self.options["sndio"].shared + tc.variables["NAS"] = self.options.nas if self.options.nas: cmake_extra_ldflags += ["-lXau"] # FIXME: SDL sources doesn't take into account transitive dependencies - cmake_required_includes += [os.path.join(self.deps_cpp_info["nas"].rootpath, str(it)) for it in self.deps_cpp_info["nas"].includedirs] - cmake.definitions["NAS_SHARED"] = self.options["nas"].shared - cmake.definitions["VIDEO_X11"] = self.options.x11 + cmake_required_includes += self.dependencies["nas"].cpp_info.includedirs + tc.variables["NAS_SHARED"] = self.options["nas"].shared + tc.variables["VIDEO_X11"] = self.options.x11 if self.options.x11: - cmake.definitions["HAVE_XEXT_H"] = True - cmake.definitions["VIDEO_X11_XCURSOR"] = self.options.xcursor + tc.variables["HAVE_XEXT_H"] = True + tc.variables["VIDEO_X11_XCURSOR"] = self.options.xcursor if self.options.xcursor: - cmake.definitions["HAVE_XCURSOR_H"] = True - cmake.definitions["VIDEO_X11_XINERAMA"] = self.options.xinerama + tc.variables["HAVE_XCURSOR_H"] = True + tc.variables["VIDEO_X11_XINERAMA"] = self.options.xinerama if self.options.xinerama: - cmake.definitions["HAVE_XINERAMA_H"] = True - cmake.definitions["VIDEO_X11_XINPUT"] = self.options.xinput + tc.variables["HAVE_XINERAMA_H"] = True + tc.variables["VIDEO_X11_XINPUT"] = self.options.xinput if self.options.xinput: - cmake.definitions["HAVE_XINPUT_H"] = True - cmake.definitions["VIDEO_X11_XRANDR"] = self.options.xrandr + tc.variables["HAVE_XINPUT_H"] = True + tc.variables["VIDEO_X11_XRANDR"] = self.options.xrandr if self.options.xrandr: - cmake.definitions["HAVE_XRANDR_H"] = True - cmake.definitions["VIDEO_X11_XSCRNSAVER"] = self.options.xscrnsaver + tc.variables["HAVE_XRANDR_H"] = True + tc.variables["VIDEO_X11_XSCRNSAVER"] = self.options.xscrnsaver if self.options.xscrnsaver: - cmake.definitions["HAVE_XSS_H"] = True - cmake.definitions["VIDEO_X11_XSHAPE"] = self.options.xshape + tc.variables["HAVE_XSS_H"] = True + tc.variables["VIDEO_X11_XSHAPE"] = self.options.xshape if self.options.xshape: - cmake.definitions["HAVE_XSHAPE_H"] = True - cmake.definitions["VIDEO_X11_XVM"] = self.options.xvm + tc.variables["HAVE_XSHAPE_H"] = True + tc.variables["VIDEO_X11_XVM"] = self.options.xvm if self.options.xvm: - cmake.definitions["HAVE_XF86VM_H"] = True - cmake.definitions["VIDEO_WAYLAND"] = self.options.wayland + tc.variables["HAVE_XF86VM_H"] = True + tc.variables["VIDEO_WAYLAND"] = self.options.wayland if self.options.wayland: # FIXME: Otherwise 2.0.16 links with system wayland (from egl/system requirement) - cmake_extra_ldflags += ["-L{}".format(os.path.join(self.deps_cpp_info["wayland"].rootpath, it)) for it in self.deps_cpp_info["wayland"].libdirs] - cmake.definitions["WAYLAND_SHARED"] = self.options["wayland"].shared - cmake.definitions["WAYLAND_SCANNER_1_15_FOUND"] = 1 # FIXME: Check actual build-requires version + cmake_extra_ldflags += ["-L{}".format(it) for it in self.dependencies["wayland"].cpp_info.libdirs] + tc.variables["WAYLAND_SHARED"] = self.options["wayland"].shared + tc.variables["WAYLAND_SCANNER_1_15_FOUND"] = 1 # FIXME: Check actual build-requires version - cmake.definitions["VIDEO_DIRECTFB"] = self.options.directfb - cmake.definitions["VIDEO_RPI"] = self.options.video_rpi - cmake.definitions["HAVE_LIBUNWIND_H"] = self.options.libunwind + tc.variables["VIDEO_DIRECTFB"] = self.options.directfb + tc.variables["VIDEO_RPI"] = self.options.video_rpi + tc.variables["HAVE_LIBUNWIND_H"] = self.options.libunwind elif self.settings.os == "Windows": - cmake.definitions["DIRECTX"] = self.options.directx + tc.variables["DIRECTX"] = self.options.directx else: - cmake.definitions["SDL_OPENGL"] = self.options.opengl - cmake.definitions["SDL_OPENGLES"] = self.options.opengles - cmake.definitions["SDL_VULKAN"] = self.options.vulkan + tc.variables["SDL_OPENGL"] = self.options.opengl + tc.variables["SDL_OPENGLES"] = self.options.opengles + tc.variables["SDL_VULKAN"] = self.options.vulkan if self.settings.os == "Linux": # See https://github.com/bincrafters/community/issues/696 - cmake.definitions["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 + tc.variables["SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS"] = 1 - cmake.definitions["SDL_ALSA"] = self.options.alsa + tc.variables["SDL_ALSA"] = self.options.alsa if self.options.alsa: - cmake.definitions["SDL_ALSA_SHARED"] = self.deps_cpp_info["libalsa"].shared - cmake.definitions["HAVE_ASOUNDLIB_H"] = True - cmake.definitions["HAVE_LIBASOUND"] = True - cmake.definitions["SDL_JACK"] = self.options.jack + tc.variables["SDL_ALSA_SHARED"] = self.options["libalsa"].shared + tc.variables["HAVE_ASOUNDLIB_H"] = True + tc.variables["HAVE_LIBASOUND"] = True + tc.variables["SDL_JACK"] = self.options.jack if self.options.jack: - cmake.definitions["SDL_JACK_SHARED"] = self.deps_cpp_info["jack"].shared - cmake.definitions["SDL_ESD"] = self.options.esd + tc.variables["SDL_JACK_SHARED"] = self.options["jack"].shared + tc.variables["SDL_ESD"] = self.options.esd if self.options.esd: - cmake.definitions["SDL_ESD_SHARED"] = self.deps_cpp_info["esd"].shared - cmake.definitions["SDL_PULSEAUDIO"] = self.options.pulse + tc.variables["SDL_ESD_SHARED"] = self.options["esd"].shared + tc.variables["SDL_PULSEAUDIO"] = self.options.pulse if self.options.pulse: - cmake.definitions["SDL_PULSEAUDIO_SHARED"] = self.deps_cpp_info["pulseaudio"].shared - cmake.definitions["SDL_SNDIO"] = self.options.sndio + tc.variables["SDL_PULSEAUDIO_SHARED"] = self.options["pulseaudio"].shared + for component in self.dependencies["pulseaudio"].cpp_info.components: + if self.dependencies["pulseaudio"].cpp_info.components[component].libs: + cmake_extra_libs += self.dependencies["pulseaudio"].cpp_info.components[component].libs + cmake_extra_ldflags += ["-L{}".format(it) for it in self.dependencies["pulseaudio"].cpp_info.components[component].libdirs] + cmake_extra_ldflags += ["-lxcb", "-lrt"] # FIXME: SDL sources doesn't take into account transitive dependencies + tc.variables["SDL_SNDIO"] = self.options.sndio if self.options.sndio: - cmake.definitions["SDL_SNDIO_SHARED"] = self.deps_cpp_info["sndio"].shared - cmake.definitions["SDL_NAS"] = self.options.nas + tc.variables["SDL_SNDIO_SHARED"] = self.options["sndio"].shared + tc.variables["SDL_NAS"] = self.options.nas if self.options.nas: cmake_extra_ldflags += ["-lXau"] # FIXME: SDL sources doesn't take into account transitive dependencies - cmake_required_includes += [os.path.join(self.deps_cpp_info["nas"].rootpath, str(it)) for it in self.deps_cpp_info["nas"].includedirs] - cmake.definitions["SDL_NAS_SHARED"] = self.options["nas"].shared - cmake.definitions["SDL_X11"] = self.options.x11 + cmake_required_includes += self.dependencies["nas"].cpp_info.includedirs + tc.variables["SDL_NAS_SHARED"] = self.options["nas"].shared + tc.variables["SDL_X11"] = self.options.x11 if self.options.x11: - cmake.definitions["HAVE_XEXT_H"] = True - cmake.definitions["SDL_X11_XCURSOR"] = self.options.xcursor + tc.variables["HAVE_XEXT_H"] = True + tc.variables["SDL_X11_XCURSOR"] = self.options.xcursor if self.options.xcursor: - cmake.definitions["HAVE_XCURSOR_H"] = True - cmake.definitions["SDL_X11_XINERAMA"] = self.options.xinerama + tc.variables["HAVE_XCURSOR_H"] = True + tc.variables["SDL_X11_XINERAMA"] = self.options.xinerama if self.options.xinerama: - cmake.definitions["HAVE_XINERAMA_H"] = True - cmake.definitions["SDL_X11_XINPUT"] = self.options.xinput + tc.variables["HAVE_XINERAMA_H"] = True + tc.variables["SDL_X11_XINPUT"] = self.options.xinput if self.options.xinput: - cmake.definitions["HAVE_XINPUT_H"] = True - cmake.definitions["SDL_X11_XRANDR"] = self.options.xrandr + tc.variables["HAVE_XINPUT_H"] = True + tc.variables["SDL_X11_XRANDR"] = self.options.xrandr if self.options.xrandr: - cmake.definitions["HAVE_XRANDR_H"] = True - cmake.definitions["SDL_X11_XSCRNSAVER"] = self.options.xscrnsaver + tc.variables["HAVE_XRANDR_H"] = True + tc.variables["SDL_X11_XSCRNSAVER"] = self.options.xscrnsaver if self.options.xscrnsaver: - cmake.definitions["HAVE_XSS_H"] = True - cmake.definitions["SDL_X11_XSHAPE"] = self.options.xshape + tc.variables["HAVE_XSS_H"] = True + tc.variables["SDL_X11_XSHAPE"] = self.options.xshape if self.options.xshape: - cmake.definitions["HAVE_XSHAPE_H"] = True - cmake.definitions["SDL_X11_XVM"] = self.options.xvm + tc.variables["HAVE_XSHAPE_H"] = True + tc.variables["SDL_X11_XVM"] = self.options.xvm if self.options.xvm: - cmake.definitions["HAVE_XF86VM_H"] = True - cmake.definitions["SDL_WAYLAND"] = self.options.wayland + tc.variables["HAVE_XF86VM_H"] = True + tc.variables["SDL_WAYLAND"] = self.options.wayland if self.options.wayland: # FIXME: Otherwise 2.0.16 links with system wayland (from egl/system requirement) - cmake_extra_ldflags += ["-L{}".format(os.path.join(self.deps_cpp_info["wayland"].rootpath, it)) for it in self.deps_cpp_info["wayland"].libdirs] - cmake.definitions["SDL_WAYLAND_SHARED"] = self.options["wayland"].shared + cmake_extra_ldflags += ["-L{}".format(it) for it in self.dependencies["wayland"].cpp_info.libdirs] + tc.variables["SDL_WAYLAND_SHARED"] = self.options["wayland"].shared - cmake.definitions["SDL_DIRECTFB"] = self.options.directfb - cmake.definitions["SDL_RPI"] = self.options.video_rpi - cmake.definitions["HAVE_LIBUNWIND_H"] = self.options.libunwind + tc.variables["SDL_DIRECTFB"] = self.options.directfb + tc.variables["SDL_RPI"] = self.options.video_rpi + tc.variables["HAVE_LIBUNWIND_H"] = self.options.libunwind elif self.settings.os == "Windows": - cmake.definitions["SDL_DIRECTX"] = self.options.directx + tc.variables["SDL_DIRECTX"] = self.options.directx if Version(self.version) >= "2.0.22": - cmake.definitions["SDL2_DISABLE_SDL2MAIN"] = not self.options.sdl2main + tc.variables["SDL2_DISABLE_SDL2MAIN"] = not self.options.sdl2main # Add extra information collected from the deps - cmake.definitions["EXTRA_LDFLAGS"] = " ".join(cmake_extra_ldflags) - cmake.definitions["CMAKE_REQUIRED_INCLUDES"] = ";".join(cmake_required_includes) - cmake.configure(build_dir=self._build_subfolder) - return cmake + tc.variables["EXTRA_LDFLAGS"] = ";".join(cmake_extra_ldflags) + tc.variables["CMAKE_REQUIRED_INCLUDES"] = ";".join(cmake_required_includes) + cmake_extra_cflags = ["-I{}".format(path) for _, dep in self.dependencies.items() for path in dep.cpp_info.includedirs] + tc.variables["EXTRA_CFLAGS"] = ";".join(cmake_extra_cflags) + tc.variables["EXTRA_LIBS"] = ";".join(cmake_extra_libs) + tc.generate() def build(self): self._patch_sources() - lib_paths = [lib for dep in self.deps_cpp_info.deps for lib in self.deps_cpp_info[dep].lib_paths] - with tools.environment_append({"LIBRARY_PATH": os.pathsep.join(lib_paths)}): - cmake = self._configure_cmake() - cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): + cmake = CMake(self) if self.version >= "2.0.16": - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) + copy(self, pattern="LICENSE.txt", src=os.path.join(self.source_folder), dst=os.path.join(self.package_folder, "licenses")) else: - self.copy(pattern="COPYING.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="COPYING.txt", src=os.path.join(self.source_folder), dst=os.path.join(self.package_folder, "licenses")) cmake.install() rm(self, "sdl2-config", os.path.join(self.package_folder, "bin")) rmdir(self, os.path.join(self.package_folder, "cmake")) @@ -471,6 +486,12 @@ def package_info(self): self.cpp_info.components["libsdl2"].system_libs = ["user32", "gdi32", "winmm", "imm32", "ole32", "oleaut32", "version", "uuid", "advapi32", "setupapi", "shell32"] if self.settings.compiler == "gcc": self.cpp_info.components["libsdl2"].system_libs.append("mingw32") + elif self.settings.os == "Android" and not self.options.shared: + self.cpp_info.components["libsdl2"].system_libs.extend(["android", "dl", "log"]) + if self.options.opengles: + self.cpp_info.components["libsdl2"].system_libs.extend(["GLESv1_CM", "GLESv2"]) + if Version(self.version) >= "2.0.16": + self.cpp_info.components["libsdl2"].system_libs.append("OpenSLES") # SDL2main if self.options.sdl2main: diff --git a/recipes/sdl/all/test_package/CMakeLists.txt b/recipes/sdl/all/test_package/CMakeLists.txt index 429003c689829..4195ae0c9ad32 100644 --- a/recipes/sdl/all/test_package/CMakeLists.txt +++ b/recipes/sdl/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.15) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(SDL2 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) @@ -14,16 +11,3 @@ else() target_link_libraries(${PROJECT_NAME} SDL2::SDL2) endif() -function(add_option option) - if(${option}) - target_compile_definitions(${CMAKE_PROJECT_NAME} PRIVATE "${option}") - endif() -endfunction() - -add_option(WITH_X11) -add_option(WITH_ALSA) -add_option(WITH_PULSE) -add_option(WITH_ESD) -add_option(WITH_ARTS) -add_option(WITH_DIRECTFB) -add_option(WITH_DIRECTX) diff --git a/recipes/sdl/all/test_package/conanfile.py b/recipes/sdl/all/test_package/conanfile.py index 0de69e86ca9df..956346bb80854 100644 --- a/recipes/sdl/all/test_package/conanfile.py +++ b/recipes/sdl/all/test_package/conanfile.py @@ -1,27 +1,32 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain import os +# It will become the standard on Conan 2.x class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + def build(self): cmake = CMake(self) - if self.settings.os == "Linux": - cmake.definitions["WITH_X11"] = self.options["sdl"].x11 - cmake.definitions["WITH_ALSA"] = self.options["sdl"].alsa - cmake.definitions["WITH_PULSE"] = self.options["sdl"].pulse - cmake.definitions["WITH_ESD"] = self.options["sdl"].esd - cmake.definitions["WITH_ARTS"] = self.options["sdl"].arts - cmake.definitions["WITH_DIRECTFB"] = self.options["sdl"].directfb - if self.settings.os == "Windows": - cmake.definitions["WITH_DIRECTX"] = self.options["sdl"].directx cmake.configure() cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sdl/all/test_package/test_package.cpp b/recipes/sdl/all/test_package/test_package.cpp index 62a211f91d303..69868e55398de 100644 --- a/recipes/sdl/all/test_package/test_package.cpp +++ b/recipes/sdl/all/test_package/test_package.cpp @@ -1,81 +1,9 @@ #include -#include -#include -#include #include -#include -static void throw_exception(const char * message, const char * name) -{ - std::stringstream s; - s << message << " - " << name; - throw std::runtime_error(s.str().c_str()); -} - -static void check_audio_driver(const char * name) -{ - std::cout << "checking for audio driver " << name << " ... "; - bool found = false; - int count = SDL_GetNumAudioDrivers(); - for (int i = 0; i < count; ++i) { - if (0 == strcmp(name, SDL_GetAudioDriver(i))) { - found = true; - break; - } - } - if (!found) - throw_exception("audio driver wasn't found", name); - std::cout << "OK!" << std::endl; -} - -static void check_video_driver(const char * name) -{ - std::cout << "checking for video driver " << name << " ... "; - bool found = false; - int count = SDL_GetNumVideoDrivers(); - for (int i = 0; i < count; ++i) { - if (0 == strcmp(name, SDL_GetVideoDriver(i))) { - found = true; - break; - } - } - if (!found) - throw_exception("video driver wasn't found", name); - std::cout << "OK!" << std::endl; -} - - -int main(int argc, char *argv[]) try -{ +int main(int argc, char* args[]) { SDL_version v; SDL_GetVersion(&v); std::cout << "SDL version " << int(v.major) << "." << int(v.minor) << "." << int(v.patch) << std::endl; -#ifdef WITH_X11 - check_video_driver("x11"); -#endif -#ifdef WITH_ALSA - check_audio_driver("alsa"); -#endif -#ifdef WITH_PULSE - check_audio_driver("pulseaudio"); -#endif -#ifdef WITH_ESD - check_audio_driver("esd"); -#endif -#ifdef WITH_ARTS - check_audio_driver("arts"); -#endif -#ifdef WITH_DIRECTFB - check_video_driver("directfb"); -#endif -#ifdef WITH_DIRECTX - check_audio_driver("directsound"); -#endif - return EXIT_SUCCESS; -} -catch (std::runtime_error & e) -{ - std::cout << "FAIL!" << std::endl; - std::cerr << e.what() << std::endl; - return EXIT_FAILURE; + return 0; } diff --git a/recipes/sdl/all/test_v1_package/CMakeLists.txt b/recipes/sdl/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b272a5b739303 --- /dev/null +++ b/recipes/sdl/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(SDL2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} SDL2::SDL2main) +if(TARGET SDL2::SDL2-static) + target_link_libraries(${PROJECT_NAME} SDL2::SDL2-static) +else() + target_link_libraries(${PROJECT_NAME} SDL2::SDL2) +endif() diff --git a/recipes/sdl/all/test_v1_package/conanfile.py b/recipes/sdl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..8037a9296cc42 --- /dev/null +++ b/recipes/sdl/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/sdl/all/test_v1_package/test_package.cpp b/recipes/sdl/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..69868e55398de --- /dev/null +++ b/recipes/sdl/all/test_v1_package/test_package.cpp @@ -0,0 +1,9 @@ +#include +#include + +int main(int argc, char* args[]) { + SDL_version v; + SDL_GetVersion(&v); + std::cout << "SDL version " << int(v.major) << "." << int(v.minor) << "." << int(v.patch) << std::endl; + return 0; +} diff --git a/recipes/sdl/config.yml b/recipes/sdl/config.yml index e1345d5d7df9a..130fce619991a 100644 --- a/recipes/sdl/config.yml +++ b/recipes/sdl/config.yml @@ -1,4 +1,10 @@ versions: + "2.26.1": + folder: all + "2.26.0": + folder: all + "2.24.1": + folder: all "2.24.0": folder: all "2.0.20": diff --git a/recipes/sdl_image/all/CMakeLists.txt b/recipes/sdl_image/all/CMakeLists.txt index 8d9baff2eea9f..0a8d9782df248 100644 --- a/recipes/sdl_image/all/CMakeLists.txt +++ b/recipes/sdl_image/all/CMakeLists.txt @@ -14,7 +14,7 @@ macro(add_image_option type) endmacro() if(APPLE) - option(IMAGEIO "use native Mac OS X frameworks for loading images" ON) + option(IMAGEIO "use native Apple frameworks for loading images" ON) if(IMAGEIO) set(IMAGEIO_SOURCE "${SDL_IMAGE_SRC_DIR}/IMG_ImageIO.m") else() @@ -93,6 +93,26 @@ if(WEBP) target_link_libraries(${PROJECT_NAME} PRIVATE WebP::webp) endif() +if(APPLE AND IMAGEIO AND BUILD_SHARED_LIBS) + if(${CMAKE_SYSTEM_NAME} STREQUAL Darwin) + set(extraFrameworks + "-framework ApplicationServices" + ) + else() + set(extraFrameworks + "-framework MobileCoreServices" + "-framework UIKit" + ) + endif() + target_link_libraries(${PROJECT_NAME} PRIVATE + "-framework CoreFoundation" + "-framework CoreGraphics" + "-framework Foundation" + "-framework ImageIO" + ${extraFrameworks} + ) +endif() + install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION "lib" LIBRARY DESTINATION "lib" diff --git a/recipes/sdl_image/all/conanfile.py b/recipes/sdl_image/all/conanfile.py index 23e77d83a0637..b297bb8f25f5a 100644 --- a/recipes/sdl_image/all/conanfile.py +++ b/recipes/sdl_image/all/conanfile.py @@ -1,10 +1,11 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.51.3" class SDLImageConan(ConanFile): @@ -60,7 +61,7 @@ class SDLImageConan(ConanFile): def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.os != "Macos": + if not is_apple_os(self): del self.options.imageio def configure(self): @@ -83,7 +84,7 @@ def requirements(self): if self.options.with_libtiff: self.requires("libtiff/4.4.0") if self.options.with_libjpeg: - self.requires("libjpeg/9d") + self.requires("libjpeg/9e") if self.options.with_libpng: self.requires("libpng/1.6.37") if self.options.with_libwebp: @@ -167,3 +168,17 @@ def package_info(self): self.cpp_info.components["_sdl_image"].requires.append("libpng::libpng") if self.options.with_libwebp: self.cpp_info.components["_sdl_image"].requires.append("libwebp::libwebp") + if self.options.get_safe("imageio") and not self.options.shared: + self.cpp_info.components["_sdl_image"].frameworks = [ + "CoreFoundation", + "CoreGraphics", + "Foundation", + "ImageIO", + ] + if self.settings.os == "Macos": + self.cpp_info.components["_sdl_image"].frameworks.append("ApplicationServices") + else: + self.cpp_info.components["_sdl_image"].frameworks.extend([ + "MobileCoreServices", + "UIKit", + ]) diff --git a/recipes/sdl_net/all/CMakeLists.txt b/recipes/sdl_net/all/CMakeLists.txt index c509f171ce922..2b17dca170dfa 100644 --- a/recipes/sdl_net/all/CMakeLists.txt +++ b/recipes/sdl_net/all/CMakeLists.txt @@ -1,39 +1,31 @@ -cmake_minimum_required(VERSION 2.8.12) -project(SDL2_net C) +cmake_minimum_required(VERSION 3.1) +project(SDL2_net LANGUAGES C) -include(conanbuildinfo.cmake) -conan_basic_setup() +find_package(SDL2 REQUIRED CONFIG) -find_package(SDL2 REQUIRED) - -set(SOURCES - source_subfolder/SDLnet.c - source_subfolder/SDLnetselect.c - source_subfolder/SDLnetTCP.c - source_subfolder/SDLnetUDP.c -) - -set(HEADERS - source_subfolder/SDL_net.h - source_subfolder/SDLnetsys.h +add_library(SDL2_net + ${SDL_NET_SRC_DIR}/SDLnet.c + ${SDL_NET_SRC_DIR}/SDLnetselect.c + ${SDL_NET_SRC_DIR}/SDLnetTCP.c + ${SDL_NET_SRC_DIR}/SDLnetUDP.c ) - -add_library(${PROJECT_NAME} ${SOURCES} ${HEADERS}) - -target_include_directories(${PROJECT_NAME} PRIVATE "source_subfolder") - -target_link_libraries(${PROJECT_NAME} SDL2::SDL2) +target_include_directories(SDL2_net PUBLIC ${SDL_NET_SRC_DIR}) +target_link_libraries(SDL2_net PUBLIC SDL2::SDL2) if(WIN32) - target_link_libraries(${PROJECT_NAME} ws2_32 iphlpapi) + target_link_libraries(SDL2_net PRIVATE ws2_32 iphlpapi) + target_compile_definitions(SDL2_net PRIVATE "DECLSPEC=__declspec(dllexport)") +else() + target_compile_definitions(SDL2_net PRIVATE "DECLSPEC=__attribute__((visibility(\"default\")))") endif() -set_target_properties(${PROJECT_NAME} PROPERTIES - DEFINE_SYMBOL DLL_EXPORT - PUBLIC_HEADER source_subfolder/SDL_net.h +set_target_properties(SDL2_net PROPERTIES + PUBLIC_HEADER ${SDL_NET_SRC_DIR}/SDL_net.h + C_VISIBILITY_PRESET hidden ) -install(TARGETS ${PROJECT_NAME} +include(GNUInstallDirs) +install(TARGETS SDL2_net ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} diff --git a/recipes/sdl_net/all/conanfile.py b/recipes/sdl_net/all/conanfile.py index e66c1e150008e..c899c658f21bc 100644 --- a/recipes/sdl_net/all/conanfile.py +++ b/recipes/sdl_net/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class SdlnetConan(ConanFile): @@ -24,16 +27,6 @@ class SdlnetConan(ConanFile): } exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -41,50 +34,52 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("sdl/2.0.16") + self.requires("sdl/2.26.0") def validate(self): - if self.settings.compiler == "Visual Studio" and self.options.shared: - raise ConanInvalidConfiguration("sdl_net is not supported with Visual Studio") + if Version(self.version).major != Version(self.dependencies["sdl"].ref.version).major: + raise ConanInvalidConfiguration(f"The major versions of {self.name} and sdl must be the same") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SDL_NET_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - # FIXME: check that major version of sdl_net is the same than sdl (not possible yet in validate()) - if tools.Version(self.deps_cpp_info["sdl"].version).major != tools.Version(self.version).major: - raise ConanInvalidConfiguration(f"The major versions of {self.name} and sdl must be the same") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("COPYING.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): + self.cpp_info.set_property("cmake_file_name", "SDL2_net") + self.cpp_info.set_property("cmake_target_name", "SDL2_net::SDL2_net") + self.cpp_info.set_property("pkg_config_name", "SDL2_net") self.cpp_info.libs = ["SDL2_net"] - self.cpp_info.names["cmake_find_package"] = "SDL2_net" - self.cpp_info.names["cmake_find_package_multi"] = "SDL2_net" - self.cpp_info.names["pkg_config"] = "SDL2_net" self.cpp_info.includedirs.append(os.path.join("include", "SDL2")) if self.settings.os == "Windows": self.cpp_info.system_libs.extend(["ws2_32", "iphlpapi"]) + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "SDL2_net" + self.cpp_info.names["cmake_find_package_multi"] = "SDL2_net" + self.cpp_info.names["pkg_config"] = "SDL2_net" diff --git a/recipes/sdl_net/all/test_package/CMakeLists.txt b/recipes/sdl_net/all/test_package/CMakeLists.txt index 6e07283a43f40..2337a1a3efdef 100644 --- a/recipes/sdl_net/all/test_package/CMakeLists.txt +++ b/recipes/sdl_net/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(SDL2_net REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} SDL2_net::SDL2_net) +target_link_libraries(${PROJECT_NAME} PRIVATE SDL2_net::SDL2_net) diff --git a/recipes/sdl_net/all/test_package/conanfile.py b/recipes/sdl_net/all/test_package/conanfile.py index 354bff8ba58f7..744f9cf00c80f 100644 --- a/recipes/sdl_net/all/test_package/conanfile.py +++ b/recipes/sdl_net/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") test_ip = "127.0.0.1" - self.run("{} {}".format(bin_path, test_ip), run_environment=True) + self.run(f"{bin_path} {test_ip}", env="conanrun") diff --git a/recipes/sdl_net/all/test_v1_package/CMakeLists.txt b/recipes/sdl_net/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/sdl_net/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sdl_net/all/test_v1_package/conanfile.py b/recipes/sdl_net/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..cb4e97ea795b6 --- /dev/null +++ b/recipes/sdl_net/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + test_ip = "127.0.0.1" + self.run(f"{bin_path} {test_ip}", run_environment=True) diff --git a/recipes/sdl_ttf/all/CMakeLists.txt b/recipes/sdl_ttf/all/CMakeLists.txt deleted file mode 100644 index 2a122ebfa3606..0000000000000 --- a/recipes/sdl_ttf/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/sdl_ttf/all/conandata.yml b/recipes/sdl_ttf/all/conandata.yml index 94fb96cd47f23..ac34ee3b6fceb 100644 --- a/recipes/sdl_ttf/all/conandata.yml +++ b/recipes/sdl_ttf/all/conandata.yml @@ -1,15 +1,26 @@ sources: + "2.20.1": + url: "https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.20.1/SDL2_ttf-2.20.1.tar.gz" + sha256: "78cdad51f3cc3ada6932b1bb6e914b33798ab970a1e817763f22ddbfd97d0c57" "2.0.18": url: "https://github.com/libsdl-org/SDL_ttf/archive/refs/tags/release-2.0.18.tar.gz" sha256: "6b61544441b72bdfa1ced89034c6396fe80228eff201eb72c5f78e500bb80bd0" "2.0.15": - url: "https://github.com/libsdl-org/SDL_ttf/archive/refs/tags/release-2.0.15.tar.gz" - sha256: "02e887b560faf398cbd60f56ce0a1cbaf96012dd4ddaa455f8307cb4911c86cc" - + url: "https://github.com/libsdl-org/SDL_ttf/releases/download/release-2.0.15/SDL2_ttf-2.0.15.tar.gz" + sha256: "a9eceb1ad88c1f1545cd7bd28e7cbc0b2c14191d40238f531a15b01b1b22cd33" patches: + "2.20.1": + - patch_file: "patches/2.20.1-0001-fix-cmake-min-version.patch" + patch_description: "Disable useless .pc file install to avoid relying on CMake 3.21 features" + patch_type: "conan" "2.0.18": - - patch_file: "patches/cmake-fix-link-target-2.0.18.patch" - base_path: "source_subfolder" + - patch_file: "patches/2.0.18-0001-cmake-fix-link-target.patch" + patch_description: "correct target name, disable PIC fixed" + patch_type: "portability" + - patch_file: "patches/2.0.18-0002-fix-android.patch" + patch_description: "Fix Android build" + patch_type: "portability" "2.0.15": - - patch_file: "patches/cmake-fix-link-target-2.0.15.patch" - base_path: "source_subfolder" + - patch_file: "patches/2.0.15-0001-cmake-fix-link-target.patch" + patch_description: "correct target name" + patch_type: "portability" diff --git a/recipes/sdl_ttf/all/conanfile.py b/recipes/sdl_ttf/all/conanfile.py index 5f8f9511dc662..984ebd5896713 100644 --- a/recipes/sdl_ttf/all/conanfile.py +++ b/recipes/sdl_ttf/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" class SdlttfConan(ConanFile): @@ -17,88 +21,109 @@ class SdlttfConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], + "with_harfbuzz": [True, False], } default_options = { "shared": False, "fPIC": True, + "with_harfbuzz": False, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + if Version(self.version) < "2.20.0": + del self.options.with_harfbuzz def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + if Version(self.version) >= "2.20.0": + self.options["sdl"].shared = self.options.shared + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("freetype/2.11.1") - self.requires("sdl/2.0.18") + self.requires("freetype/2.12.1") + self.requires("sdl/2.26.1") + if self.options.get_safe("with_harfbuzz"): + self.requires("harfbuzz/6.0.0") def validate(self): - if self.settings.compiler == "Visual Studio" and self.options.shared: - raise ConanInvalidConfiguration("sdl_ttf shared is not supported with Visual Studio") - # TODO: check that major version of sdl_tff is the same than sdl (not possible yet in validate()) + if Version(self.version).major != Version(self.dependencies["sdl"].ref.version).major: + raise ConanInvalidConfiguration("sdl & sdl_ttf must have the same major version") + + if Version(self.version) >= "2.20.0": + if self.options.shared != self.dependencies["sdl"].options.shared: + raise ConanInvalidConfiguration("sdl & sdl_ttf must be built with the same 'shared' option value") + else: + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared is not supported with Visual Studio") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) >= "2.20.0": + tc.variables["SDL2TTF_SAMPLES"] = False + tc.variables["SDL2TTF_VENDORED"] = False + tc.variables["SDL2TTF_HARFBUZZ"] = self.options.with_harfbuzz + tc.variables["SDL2TTF_DEBUG_POSTFIX"] = "" + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # missing from distribution (only in 2.0.15?) - tools.save(os.path.join(self._source_subfolder, "SDL2_ttfConfig.cmake"), "") + save(self, os.path.join(self.source_folder, "SDL2_ttfConfig.cmake"), "") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + # workaround for a side effect of CMAKE_FIND_PACKAGE_PREFER_CONFIG ON in conan toolchain + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "find_package(Freetype REQUIRED)", + "find_package(Freetype REQUIRED MODULE)") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "SDL2_ttf.framework")) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "SDL2_ttf.framework")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + suffix = "-static" if Version(self.version) >= "2.20.0" and not self.options.shared else "" + self.cpp_info.set_property("cmake_file_name", "SDL2_ttf") - self.cpp_info.set_property("cmake_target_name", "SDL2_ttf::SDL2_ttf") self.cpp_info.set_property("pkg_config_name", "SDL2_ttf") + self.cpp_info.components["_sdl2_ttf"].set_property("cmake_target_name",f"SDL2_ttf::SDL2_ttf{suffix}") + self.cpp_info.components["_sdl2_ttf"].includedirs.append(os.path.join("include", "SDL2")) + self.cpp_info.components["_sdl2_ttf"].libs = [f"SDL2_ttf"] + self.cpp_info.components["_sdl2_ttf"].requires = ["freetype::freetype", "sdl::libsdl2"] + if self.options.get_safe("with_harfbuzz"): + self.cpp_info.components["_sdl2_ttf"].requires.append("harfbuzz::harfbuzz") + + # TODO: to remove in conan v2 self.cpp_info.names["cmake_find_package"] = "SDL2_ttf" self.cpp_info.names["cmake_find_package_multi"] = "SDL2_ttf" - self.cpp_info.names["pkg_config"] = "SDL2_ttf" - - self.cpp_info.includedirs.append(os.path.join("include", "SDL2")) - self.cpp_info.libs = ["SDL2_ttf"] - self.cpp_info.requires = ["freetype::freetype", "sdl::libsdl2"] + self.cpp_info.components["_sdl2_ttf"].names["cmake_find_package"] = f"SDL2_ttf{suffix}" + self.cpp_info.components["_sdl2_ttf"].names["cmake_find_package_multi"] = f"SDL2_ttf{suffix}" diff --git a/recipes/sdl_ttf/all/patches/cmake-fix-link-target-2.0.15.patch b/recipes/sdl_ttf/all/patches/2.0.15-0001-cmake-fix-link-target.patch similarity index 100% rename from recipes/sdl_ttf/all/patches/cmake-fix-link-target-2.0.15.patch rename to recipes/sdl_ttf/all/patches/2.0.15-0001-cmake-fix-link-target.patch diff --git a/recipes/sdl_ttf/all/patches/cmake-fix-link-target-2.0.18.patch b/recipes/sdl_ttf/all/patches/2.0.18-0001-cmake-fix-link-target.patch similarity index 100% rename from recipes/sdl_ttf/all/patches/cmake-fix-link-target-2.0.18.patch rename to recipes/sdl_ttf/all/patches/2.0.18-0001-cmake-fix-link-target.patch diff --git a/recipes/sdl_ttf/all/patches/2.0.18-0002-fix-android.patch b/recipes/sdl_ttf/all/patches/2.0.18-0002-fix-android.patch new file mode 100644 index 0000000000000..5007f133c4a18 --- /dev/null +++ b/recipes/sdl_ttf/all/patches/2.0.18-0002-fix-android.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -12,7 +12,7 @@ endif() + cmake_minimum_required(VERSION 3.0) + project(SDL_ttf C) + +-if (ANDROID) ++if (0) + option(TTF_WITH_HARFBUZZ "use harfbuzz to improve text shaping" OFF) + + add_library(SDL2_ttf SHARED) diff --git a/recipes/sdl_ttf/all/patches/2.20.1-0001-fix-cmake-min-version.patch b/recipes/sdl_ttf/all/patches/2.20.1-0001-fix-cmake-min-version.patch new file mode 100644 index 0000000000000..68cbd1fdeda66 --- /dev/null +++ b/recipes/sdl_ttf/all/patches/2.20.1-0001-fix-cmake-min-version.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -325,7 +325,7 @@ if(SDL2TTF_INSTALL) + COMPONENT devel + ) + +- if(SDL2TTF_BUILD_SHARED_LIBS) ++ if(0) + # Only create a .pc file for a shared SDL2_ttf + set(prefix "${CMAKE_INSTALL_PREFIX}") + set(exec_prefix "\${prefix}") diff --git a/recipes/sdl_ttf/all/test_package/CMakeLists.txt b/recipes/sdl_ttf/all/test_package/CMakeLists.txt index 1231bd8cf4d34..a17e98d94db30 100644 --- a/recipes/sdl_ttf/all/test_package/CMakeLists.txt +++ b/recipes/sdl_ttf/all/test_package/CMakeLists.txt @@ -1,10 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(SDL2_ttf REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} SDL2_ttf::SDL2_ttf) +if(TARGET SDL2_ttf::SDL2_ttf) + target_link_libraries(${PROJECT_NAME} PRIVATE SDL2_ttf::SDL2_ttf) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE SDL2_ttf::SDL2_ttf-static) +endif() diff --git a/recipes/sdl_ttf/all/test_package/conanfile.py b/recipes/sdl_ttf/all/test_package/conanfile.py index 16d6b682e155b..c4fdfb4dbdc98 100644 --- a/recipes/sdl_ttf/all/test_package/conanfile.py +++ b/recipes/sdl_ttf/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") ttf_path = os.path.join(self.source_folder, "OpenSans-Bold.ttf") - self.run("{} {}".format(bin_path, ttf_path), run_environment=True) + self.run(f"{bin_path} {ttf_path}", env="conanrun") diff --git a/recipes/sdl_ttf/all/test_v1_package/CMakeLists.txt b/recipes/sdl_ttf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/sdl_ttf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sdl_ttf/all/test_v1_package/conanfile.py b/recipes/sdl_ttf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7b775db727c08 --- /dev/null +++ b/recipes/sdl_ttf/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + ttf_path = os.path.join(self.source_folder, os.pardir, "test_package", "OpenSans-Bold.ttf") + self.run(f"{bin_path} {ttf_path}", run_environment=True) diff --git a/recipes/sdl_ttf/config.yml b/recipes/sdl_ttf/config.yml index 3340e30c9939c..0db264b704044 100644 --- a/recipes/sdl_ttf/config.yml +++ b/recipes/sdl_ttf/config.yml @@ -1,4 +1,6 @@ versions: + "2.20.1": + folder: all "2.0.18": folder: all "2.0.15": diff --git a/recipes/seasocks/all/conandata.yml b/recipes/seasocks/all/conandata.yml index 1cc1c6a9f403a..8ea105850a8ba 100644 --- a/recipes/seasocks/all/conandata.yml +++ b/recipes/seasocks/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.4.5": + url: "https://github.com/mattgodbolt/seasocks/archive/v1.4.5.tar.gz" + sha256: "82211959cf8aabc85b300358c5f68cf9c56dfdf4eaa09e548580fce908acfc1b" "1.4.4": url: "https://github.com/mattgodbolt/seasocks/archive/v1.4.4.tar.gz" sha256: "5ec016ee87d4985a031212fa23a00de3de5f0fa1ceb82d7b9a3d1c189356bf8d" diff --git a/recipes/seasocks/all/conanfile.py b/recipes/seasocks/all/conanfile.py index 5ae4859a7dc8d..5a35a2a904c83 100644 --- a/recipes/seasocks/all/conanfile.py +++ b/recipes/seasocks/all/conanfile.py @@ -1,19 +1,20 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class SeasocksConan(ConanFile): name = "seasocks" description = "A tiny embeddable C++ HTTP and WebSocket server for Linux" - topics = ("seasocks", "embeddable", "webserver", "websockets") - homepage = "https://github.com/mattgodbolt/seasocks" - url = "https://github.com/conan-io/conan-center-index" license = "BSD-2-Clause" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/mattgodbolt/seasocks" + topics = ("embeddable", "webserver", "websockets") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,12 +27,22 @@ class SeasocksConan(ConanFile): "with_zlib": True, } - generators = "cmake", "cmake_find_package" - exports_sources = "CMakeLists.txt" + @property + def _min_cppstd(self): + return 11 if Version(self.version) < "1.4.5" else 17 @property - def _source_subfolder(self): - return "source_subfolder" + def _compilers_minimum_version(self): + if Version(self.version) < "1.4.5": + return {} + else: + return { + "Visual Studio": "16", + "msvc": "191", + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } def config_options(self): if self.settings.os == "Windows": @@ -39,47 +50,60 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if self.settings.os not in ["Linux", "FreeBSD"]: - raise ConanInvalidConfiguration(f"Seasocks {self.version} doesn't support this os") + raise ConanInvalidConfiguration(f"{self.ref} doesn't support this os") + + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def _patch_sources(self): # No warnings as errors - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakelists, "-Werror", "") - tools.replace_in_file(cmakelists, "-pedantic-errors", "") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "-Werror", "") + replace_in_file(self, cmakelists, "-pedantic-errors", "") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["DEFLATE_SUPPORT"] = self.options.with_zlib - cmake.definitions["SEASOCKS_SHARED"] = self.options.shared - cmake.definitions["SEASOCKS_EXAMPLE_APP"] = False - cmake.definitions["UNITTESTS"] = False - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DEFLATE_SUPPORT"] = self.options.with_zlib + tc.variables["SEASOCKS_SHARED"] = self.options.shared + tc.variables["SEASOCKS_EXAMPLE_APP"] = False + tc.variables["UNITTESTS"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "share")) + + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Seasocks") @@ -88,7 +112,7 @@ def package_info(self): # TODO: back to global scope in conan v2 once cmake_find_package* generators removed self.cpp_info.components["libseasocks"].libs = ["seasocks"] if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.components["libseasocks"].system_libs.append("pthread") + self.cpp_info.components["libseasocks"].system_libs.extend(["pthread", "m"]) # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "Seasocks" diff --git a/recipes/seasocks/all/test_package/CMakeLists.txt b/recipes/seasocks/all/test_package/CMakeLists.txt index 0010361a5592e..f005fadc41716 100644 --- a/recipes/seasocks/all/test_package/CMakeLists.txt +++ b/recipes/seasocks/all/test_package/CMakeLists.txt @@ -1,12 +1,13 @@ -cmake_minimum_required(VERSION 3.3) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Seasocks REQUIRED CONFIG) find_package(Threads REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE Seasocks::seasocks Threads::Threads) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +if(Seasocks_VERSION VERSION_LESS "1.4.5") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/seasocks/all/test_package/conanfile.py b/recipes/seasocks/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/seasocks/all/test_package/conanfile.py +++ b/recipes/seasocks/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/seasocks/all/test_v1_package/CMakeLists.txt b/recipes/seasocks/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/seasocks/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/seasocks/all/test_v1_package/conanfile.py b/recipes/seasocks/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/seasocks/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/seasocks/config.yml b/recipes/seasocks/config.yml index c381a7e142401..bcda68af0d12d 100644 --- a/recipes/seasocks/config.yml +++ b/recipes/seasocks/config.yml @@ -1,3 +1,5 @@ versions: + "1.4.5": + folder: "all" "1.4.4": folder: "all" diff --git a/recipes/semver.c/all/conanfile.py b/recipes/semver.c/all/conanfile.py index 1885f928bac50..53dd5bf5bddd1 100644 --- a/recipes/semver.c/all/conanfile.py +++ b/recipes/semver.c/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class SemverCConan(ConanFile): @@ -14,6 +14,7 @@ class SemverCConan(ConanFile): description = "Semantic versioning for c" topics = ("versioning", "semver", "semantic", "versioning") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,22 +33,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/semver.c/all/test_package/conanfile.py b/recipes/semver.c/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/semver.c/all/test_package/conanfile.py +++ b/recipes/semver.c/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/semver.c/all/test_v1_package/CMakeLists.txt b/recipes/semver.c/all/test_v1_package/CMakeLists.txt index 47201e1bfa0f7..0d20897301b68 100644 --- a/recipes/semver.c/all/test_v1_package/CMakeLists.txt +++ b/recipes/semver.c/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(semver.c REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE semver.c::semver.c) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sentry-breakpad/all/CMakeLists.txt b/recipes/sentry-breakpad/all/CMakeLists.txt index b5c2c034eeea6..1032c96e32553 100644 --- a/recipes/sentry-breakpad/all/CMakeLists.txt +++ b/recipes/sentry-breakpad/all/CMakeLists.txt @@ -1,14 +1,4 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(cmake_wrapper) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() - -if(CMAKE_SYSTEM_NAME MATCHES "Linux") - set(LINUX ON) -endif() - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_C_STANDARD 11) - -add_subdirectory(source_subfolder/external) +add_subdirectory(src/external) diff --git a/recipes/sentry-breakpad/all/conandata.yml b/recipes/sentry-breakpad/all/conandata.yml index 3c7fe86d983af..51dea688da300 100644 --- a/recipes/sentry-breakpad/all/conandata.yml +++ b/recipes/sentry-breakpad/all/conandata.yml @@ -1,20 +1,10 @@ sources: - "0.5.0": - url: "https://github.com/getsentry/sentry-native/releases/download/0.5.0/sentry-native.zip" - sha256: "1a65767a7c6c368a6dea44125eb268ed8374100f33168829f21df78cbfa8632b" + "0.6.0": + url: "https://github.com/getsentry/sentry-native/releases/download/0.6.0/sentry-native.zip" + sha256: "ae03c9c8487794cd0f6d7fb7bb9b3c13e1a253190b290eaf752e2b4f007fd089" + "0.5.4": + url: "https://github.com/getsentry/sentry-native/releases/download/0.5.4/sentry-native.zip" + sha256: "e151bdc76894eb964ba4637361b2a96b7447fb04212053cf695fd7f72b636e4d" "0.4.18": url: "https://github.com/getsentry/sentry-native/releases/download/0.4.18/sentry-native.zip" sha256: "41fdf6499cd8576142beb03104badcc9e0b80b8ef27080ca71cd4408cc1d7ece" - "0.4.17": - url: "https://github.com/getsentry/sentry-native/releases/download/0.4.17/sentry-native.zip" - sha256: "38c9e180c29b6561c5f91ada154e191eabe9d7c270734cff81e55532878ec273" - "0.4.15": - url: "https://github.com/getsentry/sentry-native/releases/download/0.4.15/sentry-native.zip" - sha256: "ae3ac4efa76d431d8734d7b0b1bf9bbedaf2cbdb18dfc5c95e2411a67808cf29" - "0.4.13": - url: "https://github.com/getsentry/sentry-native/releases/download/0.4.13/sentry-native.zip" - sha256: "85e0e15d7fb51388d967ab09e7ee1b95f82330a469a93c65d964ea1afd5e6127" - "0.2.6": - url: "https://github.com/getsentry/sentry-native/releases/download/0.2.6/sentry-native-0.2.6.zip" - sha256: "0d93bd77f70a64f3681d4928dfca6b327374218a84d33ee31489114d8e4716c0" -#patches: diff --git a/recipes/sentry-breakpad/all/conanfile.py b/recipes/sentry-breakpad/all/conanfile.py index be30e6c723ff0..9bece555fae30 100644 --- a/recipes/sentry-breakpad/all/conanfile.py +++ b/recipes/sentry-breakpad/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, save +from conan.tools.scm import Version import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.51.3" class SentryBreakpadConan(ConanFile): @@ -12,7 +16,7 @@ class SentryBreakpadConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/getsentry/breakpad" license = "Apache-2.0" - topics = ("conan", "breakpad", "error-reporting", "crash-reporting") + topics = ("breakpad", "error-reporting", "crash-reporting") provides = "breakpad" settings = "os", "arch", "compiler", "build_type" options = { @@ -21,45 +25,54 @@ class SentryBreakpadConan(ConanFile): default_options = { "fPIC": True, } - exports_sources = "CMakeLists.txt", "patches/*" - generators = "cmake" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 if Version(self.version) < "0.5.4" else 17 + + @property + def _compilers_minimum_version(self): + return {} if Version(self.version) < "0.5.4" else { + "gcc": "7", + "clang": "7", + "apple-clang": "10", + "Visual Studio": "15", + "msvc": "191", + } + + def export_sources(self): + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): if self.settings.os in ("FreeBSD", "Linux"): self.requires("linux-syscall-support/cci.20200813") def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) - - if tools.Version(self.version) <= "0.4.1": - if self.settings.os == "Android" or tools.is_apple_os(self.settings.os): - raise ConanInvalidConfiguration("Versions <=0.4.1 do not support Apple or Android") - if tools.Version(self.version) <= "0.2.6": - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("Versions <=0.2.6 do not support Windows") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version]) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + if self.settings.os in ["Linux", "FreeBSD"]: + tc.variables["LINUX"] = True + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # FIXME: convert to patches import textwrap @@ -86,14 +99,19 @@ def _patch_sources(self): ] for file in files_to_patch: - tools.replace_in_file( - os.path.join(self._source_subfolder, "external", "breakpad", file), + replace_in_file(self, + os.path.join(self.source_folder, "external", "breakpad", file), "#include \"third_party/lss/linux_syscall_support.h\"", "#include " ) - tools.save(os.path.join(self._source_subfolder, "external", "CMakeLists.txt"), + save(self, os.path.join(self.source_folder, "external", "CMakeLists.txt"), textwrap.dedent("""\ + target_compile_features(breakpad_client PUBLIC cxx_std_11) + if(CMAKE_SYSTEM_NAME STREQUAL "Linux" OR CMAKE_SYSTEM_NAME STREQUAL "FreeBSD") + find_path(LINUX_SYSCALL_INCLUDE_DIR NAMES linux_syscall_support.h) + target_include_directories(breakpad_client PRIVATE ${LINUX_SYSCALL_INCLUDE_DIR}) + endif() install(TARGETS breakpad_client ARCHIVE DESTINATION lib LIBRARY DESTINATION lib @@ -132,19 +150,21 @@ def _patch_sources(self): def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=os.path.join(self._source_subfolder, "external", "breakpad")) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=os.path.join(self.source_folder, "external", "breakpad"), + dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.names["pkg_config"] = "breakpad-client" + self.cpp_info.set_property("pkg_config_name", "breakpad-client") self.cpp_info.libs = ["breakpad_client"] self.cpp_info.includedirs.append(os.path.join("include", "breakpad")) - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.frameworks.append("CoreFoundation") - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") diff --git a/recipes/sentry-breakpad/all/test_package/CMakeLists.txt b/recipes/sentry-breakpad/all/test_package/CMakeLists.txt index 92af6d7b7f2c2..c1914e41dc58f 100644 --- a/recipes/sentry-breakpad/all/test_package/CMakeLists.txt +++ b/recipes/sentry-breakpad/all/test_package/CMakeLists.txt @@ -1,12 +1,9 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(PkgConfig REQUIRED) pkg_check_modules(BREAKPAD REQUIRED IMPORTED_TARGET breakpad-client) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE PkgConfig::BREAKPAD) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/sentry-breakpad/all/test_package/conanfile.py b/recipes/sentry-breakpad/all/test_package/conanfile.py index 6605d353d5c93..ad98cc168c24b 100644 --- a/recipes/sentry-breakpad/all/test_package/conanfile.py +++ b/recipes/sentry-breakpad/all/test_package/conanfile.py @@ -1,13 +1,23 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "pkg_config" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "PkgConfigDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build_requirements(self): - self.build_requires("pkgconf/1.7.3") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") def build(self): cmake = CMake(self) @@ -15,6 +25,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sentry-breakpad/all/test_v1_package/CMakeLists.txt b/recipes/sentry-breakpad/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/sentry-breakpad/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sentry-breakpad/all/test_v1_package/conanfile.py b/recipes/sentry-breakpad/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e6b0fdb8110e8 --- /dev/null +++ b/recipes/sentry-breakpad/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "pkg_config" + + def build_requirements(self): + self.build_requires("pkgconf/1.9.3") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/sentry-breakpad/config.yml b/recipes/sentry-breakpad/config.yml index 69f2362e8a2a3..dbd6711a7be30 100644 --- a/recipes/sentry-breakpad/config.yml +++ b/recipes/sentry-breakpad/config.yml @@ -1,13 +1,7 @@ versions: - "0.5.0": + "0.6.0": folder: all - "0.4.18": - folder: all - "0.4.17": - folder: all - "0.4.15": + "0.5.4": folder: all - "0.4.13": - folder: all - "0.2.6": + "0.4.18": folder: all diff --git a/recipes/sentry-crashpad/all/CMakeLists.txt b/recipes/sentry-crashpad/all/CMakeLists.txt deleted file mode 100644 index 0d619e8290789..0000000000000 --- a/recipes/sentry-crashpad/all/CMakeLists.txt +++ /dev/null @@ -1,22 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -if(MINGW) - find_program(JWASM_FOUND jwasm) - if (JWASM_FOUND) - set(CMAKE_ASM_MASM_COMPILER ${JWASM_FOUND}) - execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE COMPILER_VERSION_OUTPUT) - if (COMPILER_VERSION_OUTPUT) - if (COMPILER_VERSION_OUTPUT MATCHES "x86_64") - set(JWASM_FLAGS -win64) - else() - set(JWASM_FLAGS -coff) - endif() - endif() - endif() -endif() - -add_subdirectory(source_subfolder/external/crashpad) diff --git a/recipes/sentry-crashpad/all/conandata.yml b/recipes/sentry-crashpad/all/conandata.yml index f38fb6b1f4316..51dea688da300 100644 --- a/recipes/sentry-crashpad/all/conandata.yml +++ b/recipes/sentry-crashpad/all/conandata.yml @@ -1,23 +1,10 @@ sources: - "0.5.0": - url: "https://github.com/getsentry/sentry-native/releases/download/0.5.0/sentry-native.zip" - sha256: "1a65767a7c6c368a6dea44125eb268ed8374100f33168829f21df78cbfa8632b" + "0.6.0": + url: "https://github.com/getsentry/sentry-native/releases/download/0.6.0/sentry-native.zip" + sha256: "ae03c9c8487794cd0f6d7fb7bb9b3c13e1a253190b290eaf752e2b4f007fd089" + "0.5.4": + url: "https://github.com/getsentry/sentry-native/releases/download/0.5.4/sentry-native.zip" + sha256: "e151bdc76894eb964ba4637361b2a96b7447fb04212053cf695fd7f72b636e4d" "0.4.18": url: "https://github.com/getsentry/sentry-native/releases/download/0.4.18/sentry-native.zip" sha256: "41fdf6499cd8576142beb03104badcc9e0b80b8ef27080ca71cd4408cc1d7ece" - "0.4.17": - url: "https://github.com/getsentry/sentry-native/releases/download/0.4.17/sentry-native.zip" - sha256: "38c9e180c29b6561c5f91ada154e191eabe9d7c270734cff81e55532878ec273" - "0.4.15": - url: "https://github.com/getsentry/sentry-native/releases/download/0.4.15/sentry-native.zip" - sha256: "ae3ac4efa76d431d8734d7b0b1bf9bbedaf2cbdb18dfc5c95e2411a67808cf29" - "0.4.13": - url: "https://github.com/getsentry/sentry-native/releases/download/0.4.13/sentry-native.zip" - sha256: "85e0e15d7fb51388d967ab09e7ee1b95f82330a469a93c65d964ea1afd5e6127" - "0.2.6": - url: "https://github.com/getsentry/sentry-native/releases/download/0.2.6/sentry-native-0.2.6.zip" - sha256: "0d93bd77f70a64f3681d4928dfca6b327374218a84d33ee31489114d8e4716c0" -patches: - "0.2.6": - - patch_file: "patches/0.2.6-0001-missing-installed-headers.patch" - base_path: "source_subfolder" diff --git a/recipes/sentry-crashpad/all/conanfile.py b/recipes/sentry-crashpad/all/conanfile.py index 502e2bdfac30e..e225043731b97 100644 --- a/recipes/sentry-crashpad/all/conanfile.py +++ b/recipes/sentry-crashpad/all/conanfile.py @@ -1,8 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import get, apply_conandata_patches, copy, export_conandata_patches, rmdir, rm, replace_in_file +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.3" class SentryCrashpadConan(ConanFile): @@ -26,96 +32,83 @@ class SentryCrashpadConan(ConanFile): } short_paths = True - generators = "cmake" - _cmake = None @property def _is_mingw(self): return self.settings.os == "Windows" and self.settings.compiler == "gcc" - @property - def _build_subfolder(self): - return "build_subfolder" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _minimum_compilers_version(self): return { - "Visual Studio": "15" if tools.Version(self.version) < "0.4.16" else "16", + "Visual Studio": "16", "gcc": "6", "clang": "3.4", "apple-clang": "5.1", } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if self.settings.os not in ("Linux", "Android") or tools.Version(self.version) < "0.4": + if self.settings.os not in ("Linux", "Android"): del self.options.with_tls def build_requirements(self): if self._is_mingw: - self.build_requires("jwasm/2.13") + self.tool_requires("jwasm/2.13") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("libcurl/7.87.0") + self.requires("zlib/1.2.13") if self.options.get_safe("with_tls"): - self.requires("openssl/1.1.1n") + self.requires("openssl/1.1.1s") def validate(self): if self.settings.compiler.get_safe("cppstd"): # Set as required in crashpad CMake file. # See https://github.com/getsentry/crashpad/blob/71bcaad4cf30294b8de1bfa02064ab629437163b/CMakeLists.txt#L67 - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, 14) minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) if not minimum_version: self.output.warn("Compiler is unknown. Assuming it supports C++14.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("Build requires support for C++14. Minimum version for {} is {}" - .format(str(self.settings.compiler), minimum_version)) - if tools.Version(self.version) < "0.4.7" and self.settings.os == "Macos" and self.settings.arch == "armv8": - raise ConanInvalidConfiguration("This version doesn't support ARM compilation") + elif Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"Build requires support for C++14. Minimum version for {self.settings.compiler} is {minimum_version}") - def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder) + def layout(self): + cmake_layout(self, src_folder="src") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CRASHPAD_ENABLE_INSTALL"] = True - self._cmake.definitions["CRASHPAD_ENABLE_INSTALL_DEV"] = True - self._cmake.definitions["CRASHPAD_ZLIB_SYSTEM"] = True + def source(self): + get(self, **self.conan_data["sources"][str(self.version)]) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CRASHPAD_ENABLE_INSTALL"] = True + tc.variables["CRASHPAD_ENABLE_INSTALL_DEV"] = True + tc.variables["CRASHPAD_ZLIB_SYSTEM"] = True + tc.generate() + tc = CMakeDeps(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - if tools.Version(self.version) > "0.4": - openssl_repl = "find_package(OpenSSL REQUIRED)" if self.options.get_safe("with_tls") else "" - tools.replace_in_file(os.path.join(self._source_subfolder, "external", "crashpad", "CMakeLists.txt"), - "find_package(OpenSSL)", openssl_repl) - cmake = self._configure_cmake() + apply_conandata_patches(self) + openssl_repl = "find_package(OpenSSL REQUIRED)" if self.options.get_safe("with_tls") else "" + replace_in_file(self, os.path.join(self.source_folder, "external", "crashpad", "CMakeLists.txt"), + "find_package(OpenSSL)", openssl_repl) + cmake = CMake(self) + cmake.configure(build_script_folder="external/crashpad") cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=os.path.join(self._source_subfolder, "external", "crashpad")) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.configure(build_script_folder="external/crashpad") cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "crashpad") @@ -126,7 +119,7 @@ def package_info(self): self.cpp_info.components["crashpad_mini_chromium"].libs = ["mini_chromium"] if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.components["crashpad_mini_chromium"].system_libs.append("pthread") - elif tools.is_apple_os(self.settings.os): + elif is_apple_os(self): self.cpp_info.components["crashpad_mini_chromium"].frameworks = ["CoreFoundation", "Foundation", "Security"] if self.settings.os == "Macos": self.cpp_info.components["crashpad_mini_chromium"].frameworks.extend(["ApplicationServices", "IOKit"]) @@ -137,7 +130,7 @@ def package_info(self): self.cpp_info.components["crashpad_compat"].set_property("cmake_target_name", "crashpad::compat") self.cpp_info.components["crashpad_compat"].includedirs.append(os.path.join("include", "crashpad")) # On Apple crashpad_compat is an interface library - if not tools.is_apple_os(self.settings.os): + if not is_apple_os(self): self.cpp_info.components["crashpad_compat"].libs = ["crashpad_compat"] if self.settings.os in ("Linux", "FreeBSD"): self.cpp_info.components["crashpad_compat"].system_libs.append("dl") @@ -179,28 +172,27 @@ def package_info(self): "crashpad_util", "crashpad_mini_chromium", ] - if tools.Version(self.version) > "0.3": - if self.settings.os == "Windows": - # getopt - self.cpp_info.components["crashpad_getopt"].set_property("cmake_target_name", "crashpad::getopt") - self.cpp_info.components["crashpad_getopt"].libs = ["crashpad_getopt"] - - # handler - self.cpp_info.components["crashpad_handler"].set_property("cmake_target_name", "crashpad::handler") - self.cpp_info.components["crashpad_handler"].libs = ["crashpad_handler_lib"] - self.cpp_info.components["crashpad_handler"].requires = [ - "crashpad_compat", "crashpad_minidump", "crashpad_snapshot", - "crashpad_util", "crashpad_mini_chromium", - ] - if self.settings.os == "Windows": - self.cpp_info.components["crashpad_handler"].requires.append("crashpad_getopt") + if self.settings.os == "Windows": + # getopt + self.cpp_info.components["crashpad_getopt"].set_property("cmake_target_name", "crashpad::getopt") + self.cpp_info.components["crashpad_getopt"].libs = ["crashpad_getopt"] + + # handler + self.cpp_info.components["crashpad_handler"].set_property("cmake_target_name", "crashpad::handler") + self.cpp_info.components["crashpad_handler"].libs = ["crashpad_handler_lib"] + self.cpp_info.components["crashpad_handler"].requires = [ + "crashpad_compat", "crashpad_minidump", "crashpad_snapshot", + "crashpad_util", "crashpad_mini_chromium", + ] + if self.settings.os == "Windows": + self.cpp_info.components["crashpad_handler"].requires.append("crashpad_getopt") # tools self.cpp_info.components["crashpad_tools"].set_property("cmake_target_name", "crashpad::tools") self.cpp_info.components["crashpad_tools"].libs = ["crashpad_tools"] bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) # TODO: to remove in conan v2 once cmake_find_package* generators removed @@ -218,11 +210,10 @@ def package_info(self): self.cpp_info.components["crashpad_snapshot"].names["cmake_find_package_multi"] = "snapshot" self.cpp_info.components["crashpad_minidump"].names["cmake_find_package"] = "minidump" self.cpp_info.components["crashpad_minidump"].names["cmake_find_package_multi"] = "minidump" - if tools.Version(self.version) > "0.3": - if self.settings.os == "Windows": - self.cpp_info.components["crashpad_getopt"].names["cmake_find_package"] = "getopt" - self.cpp_info.components["crashpad_getopt"].names["cmake_find_package_multi"] = "getopt" - self.cpp_info.components["crashpad_handler"].names["cmake_find_package"] = "handler" - self.cpp_info.components["crashpad_handler"].names["cmake_find_package_multi"] = "handler" + if self.settings.os == "Windows": + self.cpp_info.components["crashpad_getopt"].names["cmake_find_package"] = "getopt" + self.cpp_info.components["crashpad_getopt"].names["cmake_find_package_multi"] = "getopt" + self.cpp_info.components["crashpad_handler"].names["cmake_find_package"] = "handler" + self.cpp_info.components["crashpad_handler"].names["cmake_find_package_multi"] = "handler" self.cpp_info.components["crashpad_tools"].names["cmake_find_package"] = "tools" self.cpp_info.components["crashpad_tools"].names["cmake_find_package_multi"] = "tools" diff --git a/recipes/sentry-crashpad/all/test_package/CMakeLists.txt b/recipes/sentry-crashpad/all/test_package/CMakeLists.txt index e918f75812c63..a9feb3cd284f7 100644 --- a/recipes/sentry-crashpad/all/test_package/CMakeLists.txt +++ b/recipes/sentry-crashpad/all/test_package/CMakeLists.txt @@ -1,11 +1,9 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package CXX) find_package(crashpad REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE crashpad::client) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/sentry-crashpad/all/test_package/conanfile.py b/recipes/sentry-crashpad/all/test_package/conanfile.py index a8b1104b7289c..3a9d92c6be51d 100644 --- a/recipes/sentry-crashpad/all/test_package/conanfile.py +++ b/recipes/sentry-crashpad/all/test_package/conanfile.py @@ -1,10 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.files import mkdir +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,10 +22,10 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): test_env_dir = "test_env" - tools.mkdir(test_env_dir) - bin_path = os.path.join("bin", "test_package") + mkdir(self, test_env_dir) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler" - handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].rootpath, "bin", handler_exe) - self.run("%s %s/db %s" % (bin_path, test_env_dir, handler_bin_path), run_environment=True) + handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].bin_paths[0], handler_exe) + self.run(f"{bin_path} {test_env_dir} {handler_bin_path}", run_environment=True) diff --git a/recipes/sentry-crashpad/all/test_v1_package/CMakeLists.txt b/recipes/sentry-crashpad/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/sentry-crashpad/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/sentry-crashpad/all/test_v1_package/conanfile.py b/recipes/sentry-crashpad/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..07143b37b946f --- /dev/null +++ b/recipes/sentry-crashpad/all/test_v1_package/conanfile.py @@ -0,0 +1,23 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +from conan.tools.files import mkdir +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + test_env_dir = "test_env" + mkdir(self, test_env_dir) + bin_path = os.path.join("bin", "test_package") + handler_exe = "crashpad_handler.exe" if self.settings.os == "Windows" else "crashpad_handler" + handler_bin_path = os.path.join(self.deps_cpp_info["sentry-crashpad"].rootpath, "bin", handler_exe) + self.run(f"{bin_path} {test_env_dir} {handler_bin_path}", run_environment=True) diff --git a/recipes/sentry-crashpad/config.yml b/recipes/sentry-crashpad/config.yml index 69f2362e8a2a3..dbd6711a7be30 100644 --- a/recipes/sentry-crashpad/config.yml +++ b/recipes/sentry-crashpad/config.yml @@ -1,13 +1,7 @@ versions: - "0.5.0": + "0.6.0": folder: all - "0.4.18": - folder: all - "0.4.17": - folder: all - "0.4.15": + "0.5.4": folder: all - "0.4.13": - folder: all - "0.2.6": + "0.4.18": folder: all diff --git a/recipes/sentry-native/all/CMakeLists.txt b/recipes/sentry-native/all/CMakeLists.txt deleted file mode 100644 index 23966423158f7..0000000000000 --- a/recipes/sentry-native/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/sentry-native/all/conandata.yml b/recipes/sentry-native/all/conandata.yml index 50a4d6caf333c..8901b1cad06ac 100644 --- a/recipes/sentry-native/all/conandata.yml +++ b/recipes/sentry-native/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.5.4": + url: "https://github.com/getsentry/sentry-native/releases/download/0.5.4/sentry-native.zip" + sha256: "e151bdc76894eb964ba4637361b2a96b7447fb04212053cf695fd7f72b636e4d" + "0.5.3": + url: "https://github.com/getsentry/sentry-native/releases/download/0.5.3/sentry-native.zip" + sha256: "d9a2434783e558bc9e074518ce155bda129bfa12d376dde939e6a732c92f9757" "0.5.0": url: "https://github.com/getsentry/sentry-native/releases/download/0.5.0/sentry-native.zip" sha256: "1a65767a7c6c368a6dea44125eb268ed8374100f33168829f21df78cbfa8632b" @@ -14,12 +20,3 @@ sources: "0.4.13": url: "https://github.com/getsentry/sentry-native/releases/download/0.4.13/sentry-native.zip" sha256: "85e0e15d7fb51388d967ab09e7ee1b95f82330a469a93c65d964ea1afd5e6127" - "0.2.6": - url: "https://github.com/getsentry/sentry-native/releases/download/0.2.6/sentry-native-0.2.6.zip" - sha256: "0d93bd77f70a64f3681d4928dfca6b327374218a84d33ee31489114d8e4716c0" -patches: - "0.2.6": - - patch_file: "patches/0.2.6-0001-remove-sentry-handler-dependency.patch" - base_path: "source_subfolder" - - patch_file: "patches/0.2.6-0002-set-cmake-cxx-standard-14.patch" - base_path: "source_subfolder" diff --git a/recipes/sentry-native/all/conanfile.py b/recipes/sentry-native/all/conanfile.py index 83f02115c148a..909535f261872 100644 --- a/recipes/sentry-native/all/conanfile.py +++ b/recipes/sentry-native/all/conanfile.py @@ -1,9 +1,15 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, rm, rmdir +from conan.tools.gnu import PkgConfigDeps +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.55.0" class SentryNativeConan(ConanFile): @@ -18,6 +24,7 @@ class SentryNativeConan(ConanFile): license = "MIT" topics = ("breakpad", "crashpad", "error-reporting", "crash-reporting") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -40,26 +47,20 @@ class SentryNativeConan(ConanFile): "performance": False, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi", "pkg_config" - @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" @property def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "5", "clang": "3.4", "apple-clang": "5.1", } - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC @@ -85,89 +86,100 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.backend != "crashpad": - del self.options.with_crashpad + self.options.rm_safe("with_crashpad") if self.options.backend != "breakpad": - del self.options.with_breakpad + self.options.rm_safe("with_breakpad") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.transport == "curl": - self.requires("libcurl/7.80.0") + self.requires("libcurl/7.87.0") if self.options.backend == "crashpad": if self.options.with_crashpad == "sentry": - self.requires("sentry-crashpad/{}".format(self.version)) + self.requires(f"sentry-crashpad/{self.version}") if self.options.with_crashpad == "google": - self.requires("crashpad/cci.20210507") + self.requires("crashpad/cci.20220219") elif self.options.backend == "breakpad": if self.options.with_breakpad == "sentry": - self.requires("sentry-breakpad/{}".format(self.version)) + self.requires(f"sentry-breakpad/{self.version}") if self.options.with_breakpad == "google": self.requires("breakpad/cci.20210521") - if self.options.qt: - self.requires("qt/5.15.3") - self.requires("openssl/1.1.1n") - if tools.Version(self.version) < "0.4.5": - raise ConanInvalidConfiguration("Qt integration available from version 0.4.5") + if self.options.get_safe("qt"): + self.requires("qt/5.15.8") + self.requires("openssl/1.1.1t") def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 14) + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("Compiler is unknown. Assuming it supports C++14.") - elif tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("Build requires support for C++14. Minimum version for {} is {}" - .format(str(self.settings.compiler), minimum_version)) - if self.options.backend == "inproc" and self.settings.os == "Windows" and tools.Version(self.version) < "0.4": - raise ConanInvalidConfiguration("The in-process backend is not supported on Windows") + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler doesn't support." + ) if self.options.transport == "winhttp" and self.settings.os != "Windows": raise ConanInvalidConfiguration("The winhttp transport is only supported on Windows") - if tools.Version(self.version) >= "0.4.7" and self.settings.compiler == "apple-clang" and tools.Version(self.settings.compiler.version) < "10.0": + if self.settings.compiler == "apple-clang" and Version(self.settings.compiler.version) < "10.0": raise ConanInvalidConfiguration("apple-clang < 10.0 not supported") - if self.options.backend == "crashpad" and tools.Version(self.version) < "0.4.7" and self.settings.os == "Macos" and self.settings.arch == "armv8": + if self.options.backend == "crashpad" and self.settings.os == "Macos" and self.settings.arch == "armv8": raise ConanInvalidConfiguration("This version doesn't support ARM compilation") if self.options.performance: - if tools.Version(self.version) < "0.4.14" or tools.Version(self.version) > "0.4.15": + if Version(self.version) < "0.4.14" or Version(self.version) > "0.4.15": raise ConanInvalidConfiguration("Performance monitoring is only valid in 0.4.14 and 0.4.15") + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output) + m = re.search(r"cmake version (\d+\.\d+\.\d+)", output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + def build_requirements(self): - if tools.Version(self.version) >= "0.4.0" and self.settings.os == "Windows": - self.build_requires("cmake/3.22.0") + if self.settings.os == "Windows" and not self._cmake_new_enough("3.16.4"): + self.tool_requires("cmake/3.25.2") if self.options.backend == "breakpad": - self.build_requires("pkgconf/1.7.4") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version]) + + def generate(self): + VirtualBuildEnv(self).generate() + tc = CMakeToolchain(self) + tc.variables["SENTRY_BACKEND"] = self.options.backend + tc.variables["SENTRY_CRASHPAD_SYSTEM"] = True + tc.variables["SENTRY_BREAKPAD_SYSTEM"] = True + tc.variables["SENTRY_ENABLE_INSTALL"] = True + tc.variables["SENTRY_TRANSPORT"] = self.options.transport + tc.variables["SENTRY_PIC"] = self.options.get_safe("fPIC", True) + tc.variables["SENTRY_INTEGRATION_QT"] = self.options.qt + tc.variables["SENTRY_PERFORMANCE_MONITORING"] = self.options.performance + tc.generate() + CMakeDeps(self).generate() + if self.options.backend == "breakpad": + PkgConfigDeps(self).generate() - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): cmake = CMake(self) - cmake.definitions["SENTRY_BACKEND"] = self.options.backend - cmake.definitions["SENTRY_CRASHPAD_SYSTEM"] = True - cmake.definitions["SENTRY_BREAKPAD_SYSTEM"] = True - cmake.definitions["SENTRY_ENABLE_INSTALL"] = True - cmake.definitions["SENTRY_TRANSPORT"] = self.options.transport - cmake.definitions["SENTRY_PIC"] = self.options.get_safe("fPIC", True) - cmake.definitions["SENTRY_INTEGRATION_QT"] = self.options.qt - cmake.definitions["SENTRY_PERFORMANCE_MONITORING"] = self.options.performance cmake.configure() - return cmake - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*pdb") + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*pdb", os.path.join(self.package_folder, "bin")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "sentry") @@ -178,12 +190,12 @@ def package_info(self): self.cpp_info.sharedlinkflags = ["-Wl,-E,--build-id=sha1"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["pthread", "dl"] + elif is_apple_os(self): + self.cpp_info.frameworks = ["CoreGraphics", "CoreText"] elif self.settings.os == "Android": self.cpp_info.system_libs = ["dl", "log"] elif self.settings.os == "Windows": - self.cpp_info.system_libs = ["shlwapi", "dbghelp"] - if tools.Version(self.version) >= "0.4.7": - self.cpp_info.system_libs.append("Version") + self.cpp_info.system_libs = ["shlwapi", "dbghelp", "version"] if self.options.transport == "winhttp": self.cpp_info.system_libs.append("winhttp") diff --git a/recipes/sentry-native/all/patches/0.2.6-0001-remove-sentry-handler-dependency.patch b/recipes/sentry-native/all/patches/0.2.6-0001-remove-sentry-handler-dependency.patch deleted file mode 100644 index 7ef5e04d63069..0000000000000 --- a/recipes/sentry-native/all/patches/0.2.6-0001-remove-sentry-handler-dependency.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- CMakeLists.txt -+++ CMakeLists.txt -@@ -307,7 +307,7 @@ - DESTINATION "${CMAKE_INSTALL_CMAKEDIR}" - ) - endif() -- add_dependencies(sentry crashpad::handler) -+ # add_dependencies(sentry crashpad::handler) - elseif(SENTRY_BACKEND_BREAKPAD) - add_subdirectory(external) - target_include_directories(sentry PRIVATE diff --git a/recipes/sentry-native/all/patches/0.2.6-0002-set-cmake-cxx-standard-14.patch b/recipes/sentry-native/all/patches/0.2.6-0002-set-cmake-cxx-standard-14.patch deleted file mode 100644 index c6ec8ddfc9472..0000000000000 --- a/recipes/sentry-native/all/patches/0.2.6-0002-set-cmake-cxx-standard-14.patch +++ /dev/null @@ -1,15 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c41d902..4793e9b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -10,6 +10,10 @@ if(NOT CMAKE_C_STANDARD) - set(CMAKE_C_STANDARD 11) - endif() - -+if(NOT CMAKE_CXX_STANDARD) -+ set(CMAKE_CXX_STANDARD 14) -+endif() -+ - include(GNUInstallDirs) - set(CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/sentry") - diff --git a/recipes/sentry-native/all/test_package/CMakeLists.txt b/recipes/sentry-native/all/test_package/CMakeLists.txt index 43a4482dbca77..8b84ac464d998 100644 --- a/recipes/sentry-native/all/test_package/CMakeLists.txt +++ b/recipes/sentry-native/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(sentry REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} sentry::sentry) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE sentry::sentry) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/sentry-native/all/test_package/conanfile.py b/recipes/sentry-native/all/test_package/conanfile.py index 697dfef261b53..0a6bc68712d90 100644 --- a/recipes/sentry-native/all/test_package/conanfile.py +++ b/recipes/sentry-native/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sentry-native/all/test_v1_package/CMakeLists.txt b/recipes/sentry-native/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/sentry-native/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sentry-native/all/test_v1_package/conanfile.py b/recipes/sentry-native/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/sentry-native/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/sentry-native/config.yml b/recipes/sentry-native/config.yml index 69f2362e8a2a3..a607451035515 100644 --- a/recipes/sentry-native/config.yml +++ b/recipes/sentry-native/config.yml @@ -1,4 +1,8 @@ versions: + "0.5.4": + folder: all + "0.5.3": + folder: all "0.5.0": folder: all "0.4.18": @@ -9,5 +13,3 @@ versions: folder: all "0.4.13": folder: all - "0.2.6": - folder: all diff --git a/recipes/serd/all/conandata.yml b/recipes/serd/all/conandata.yml index 2ddae1a9b1130..b401b2ad15e33 100644 --- a/recipes/serd/all/conandata.yml +++ b/recipes/serd/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.30.16": + url: "https://gitlab.com/drobilla/serd/-/archive/v0.30.16/serd-v0.30.16.tar.gz" + sha256: "c139e02af039e277fb1b7deb2a687477bf6ec46cd6348bbb1232c2727a1dd744" "0.30.14": url: "https://gitlab.com/drobilla/serd/-/archive/v0.30.14/serd-v0.30.14.tar.gz" sha256: "5b8d620afda474861f159b18af5e49d0ea1a9d48ff7879b23b92a058ce7aad68" diff --git a/recipes/serd/all/test_v1_package/conanfile.py b/recipes/serd/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/serd/all/test_v1_package/conanfile.py +++ b/recipes/serd/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/serd/config.yml b/recipes/serd/config.yml index b19122c5d123f..9877695aeb2f5 100644 --- a/recipes/serd/config.yml +++ b/recipes/serd/config.yml @@ -1,3 +1,5 @@ versions: + "0.30.16": + folder: all "0.30.14": folder: all diff --git a/recipes/sfml/all/CMakeLists.txt b/recipes/sfml/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/sfml/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/sfml/all/conandata.yml b/recipes/sfml/all/conandata.yml index 64dd59ed97e61..58f8c7d9b6cc4 100644 --- a/recipes/sfml/all/conandata.yml +++ b/recipes/sfml/all/conandata.yml @@ -5,10 +5,18 @@ sources: patches: "2.5.1": - patch_file: "patches/0001-cmake-robust-find-deps.patch" - base_path: "source_subfolder" + patch_description: "Robust discovery of dependencies" + patch_type: "conan" - patch_file: "patches/0002-allow-non-x86-64-macos.patch" - base_path: "source_subfolder" + patch_description: "Allow compilation for macOS arm" + patch_type: "portability" - patch_file: "patches/0003-allow-shared-MT.patch" - base_path: "source_subfolder" + patch_description: "Allow to build shared SFML with MT runtime" + patch_type: "portability" - patch_file: "patches/0004-fix-ios.patch" - base_path: "source_subfolder" + patch_description: "Fix iOS detection logic in CMakeLists" + patch_type: "portability" + - patch_file: "patches/0005-remove-auto-ptr.patch" + patch_description: "Remove usage of auto_ptr to allow compilation with C++17 standard" + patch_type: "portability" + patch_source: "https://github.com/SFML/SFML/commit/bf92efe9a4035fee0258386173d53556aa196e49" diff --git a/recipes/sfml/all/conanfile.py b/recipes/sfml/all/conanfile.py index 55652e00fcd95..32bcab86eaacb 100644 --- a/recipes/sfml/all/conanfile.py +++ b/recipes/sfml/all/conanfile.py @@ -1,18 +1,20 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools import os import textwrap -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" class SfmlConan(ConanFile): name = "sfml" description = "Simple and Fast Multimedia Library." license = "Zlib" - topics = ("sfml", "multimedia", "games", "graphics", "audio") + topics = ("multimedia", "games", "graphics", "audio") homepage = "https://www.sfml-dev.org" url = "https://github.com/conan-io/conan-center-index" @@ -34,20 +36,8 @@ class SfmlConan(ConanFile): "audio": True, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -55,7 +45,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.window: @@ -65,73 +58,72 @@ def requirements(self): self.requires("libudev/system") self.requires("xorg/system") if self.options.graphics: - self.requires("freetype/2.11.1") - self.requires("stb/cci.20210910") + self.requires("freetype/2.12.1") + self.requires("stb/cci.20220909") if self.options.audio: self.requires("flac/1.3.3") - self.requires("openal/1.21.1") + self.requires("openal/1.22.2") self.requires("vorbis/1.3.7") def validate(self): if self.settings.os not in ["Windows", "Linux", "FreeBSD", "Android", "Macos", "iOS"]: - raise ConanInvalidConfiguration("SFML not supported on {}".format(self.settings.os)) + raise ConanInvalidConfiguration(f"{self.ref} not supported on {self.settings.os}") if self.options.graphics and not self.options.window: raise ConanInvalidConfiguration("sfml:graphics=True requires sfml:window=True") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - tools.rmdir(os.path.join(self._source_subfolder, "extlibs")) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["SFML_DEPENDENCIES_INSTALL_PREFIX"] = self.package_folder - cmake.definitions["SFML_MISC_INSTALL_PREFIX"] = os.path.join(self.package_folder, "licenses").replace("\\", "/") - cmake.definitions["SFML_BUILD_WINDOW"] = self.options.window - cmake.definitions["SFML_BUILD_GRAPHICS"] = self.options.graphics - cmake.definitions["SFML_BUILD_NETWORK"] = self.options.network - cmake.definitions["SFML_BUILD_AUDIO"] = self.options.audio - cmake.definitions["SFML_INSTALL_PKGCONFIG_FILES"] = False - cmake.definitions["SFML_GENERATE_PDB"] = False - cmake.definitions["SFML_USE_SYSTEM_DEPS"] = True + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + rmdir(self, os.path.join(self.source_folder, "extlibs")) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["SFML_DEPENDENCIES_INSTALL_PREFIX"] = self.package_folder.replace("\\", "/") + tc.cache_variables["SFML_MISC_INSTALL_PREFIX"] = os.path.join(self.package_folder, "licenses").replace("\\", "/") + tc.variables["SFML_BUILD_WINDOW"] = self.options.window + tc.variables["SFML_BUILD_GRAPHICS"] = self.options.graphics + tc.variables["SFML_BUILD_NETWORK"] = self.options.network + tc.variables["SFML_BUILD_AUDIO"] = self.options.audio + tc.variables["SFML_INSTALL_PKGCONFIG_FILES"] = False + tc.variables["SFML_GENERATE_PDB"] = False + tc.variables["SFML_USE_SYSTEM_DEPS"] = True if is_msvc(self): - cmake.definitions["SFML_USE_STATIC_STD_LIBS"] = is_msvc_static_runtime(self) - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["SFML_USE_STATIC_STD_LIBS"] = is_msvc_static_runtime(self) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {values["target"]: "SFML::{}".format(component) for component, values in self._sfml_components.items()} + {values["target"]: f"SFML::{component}" for component, values in self._sfml_components.items()} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property def _sfml_components(self): @@ -166,7 +158,7 @@ def log(): return ["log"] if self.settings.os == "Android" else [] def foundation(): - return ["Foundation"] if tools.is_apple_os(self.settings.os) else [] + return ["Foundation"] if is_apple_os(self) else [] def appkit(): return ["AppKit"] if self.settings.os == "Macos" else [] @@ -204,15 +196,15 @@ def opengles_ios(): sfml_components = { "system": { "target": "sfml-system", - "libs": ["sfml-system{}".format(suffix)], + "libs": [f"sfml-system{suffix}"], "system_libs": winmm() + pthread() + rt() + android() + log(), }, } if self.settings.os in ["Windows", "Android", "iOS"]: sfml_main_suffix = "-d" if self.settings.build_type == "Debug" else "" - sfmlmain_libs = ["sfml-main{}".format(sfml_main_suffix)] + sfmlmain_libs = [f"sfml-main{sfml_main_suffix}"] if self.settings.os == "Android": - sfmlmain_libs.append("sfml-activity{}".format(suffix)) + sfmlmain_libs.append(f"sfml-activity{suffix}") sfml_components.update({ "main": { "target": "sfml-main", @@ -224,7 +216,7 @@ def opengles_ios(): sfml_components.update({ "window": { "target": "sfml-window", - "libs": ["sfml-window{}".format(suffix)], + "libs": [f"sfml-window{suffix}"], "requires": ["system"] + opengl() + xorg() + libudev(), "system_libs": gdi32() + winmm() + usbhid() + android() + opengles_android(), "frameworks": foundation() + appkit() + iokit() + carbon() + @@ -236,7 +228,7 @@ def opengles_ios(): sfml_components.update({ "graphics": { "target": "sfml-graphics", - "libs": ["sfml-graphics{}".format(suffix)], + "libs": [f"sfml-graphics{suffix}"], "requires": ["window", "freetype::freetype", "stb::stb"], }, }) @@ -244,7 +236,7 @@ def opengles_ios(): sfml_components.update({ "network": { "target": "sfml-network", - "libs": ["sfml-network{}".format(suffix)], + "libs": [f"sfml-network{suffix}"], "requires": ["system"], "system_libs": ws2_32(), }, @@ -253,7 +245,7 @@ def opengles_ios(): sfml_components.update({ "audio": { "target": "sfml-audio", - "libs": ["sfml-audio{}".format(suffix)], + "libs": [f"sfml-audio{suffix}"], "requires": ["system", "flac::flac", "openal::openal", "vorbis::vorbis"], "system_libs": android(), }, diff --git a/recipes/sfml/all/patches/0001-cmake-robust-find-deps.patch b/recipes/sfml/all/patches/0001-cmake-robust-find-deps.patch index 118af3f23f384..b2a851662076d 100644 --- a/recipes/sfml/all/patches/0001-cmake-robust-find-deps.patch +++ b/recipes/sfml/all/patches/0001-cmake-robust-find-deps.patch @@ -66,13 +66,23 @@ set(LIBRARY_OUTPUT_PATH "${PROJECT_BINARY_DIR}/lib") --- a/src/SFML/Graphics/CMakeLists.txt +++ b/src/SFML/Graphics/CMakeLists.txt -@@ -134,8 +134,8 @@ if(SFML_OS_ANDROID) +@@ -97,7 +97,8 @@ sfml_add_library(sfml-graphics + target_link_libraries(sfml-graphics PUBLIC sfml-window) + + # stb_image sources +-target_include_directories(sfml-graphics PRIVATE "${PROJECT_SOURCE_DIR}/extlibs/headers/stb_image") ++find_package(stb REQUIRED CONFIG) ++target_link_libraries(sfml-graphics PRIVATE stb::stb) + + # let CMake know about our additional graphics libraries paths + if(SFML_OS_WINDOWS) +@@ -134,8 +135,8 @@ if(SFML_OS_ANDROID) target_link_libraries(sfml-graphics PRIVATE z EGL GLESv1_CM) endif() -sfml_find_package(Freetype INCLUDE "FREETYPE_INCLUDE_DIRS" LINK "FREETYPE_LIBRARY") -target_link_libraries(sfml-graphics PRIVATE Freetype) -+find_package(Freetype REQUIRED) ++find_package(Freetype REQUIRED MODULE) +target_link_libraries(sfml-graphics PRIVATE Freetype::Freetype) # add preprocessor symbols diff --git a/recipes/sfml/all/patches/0005-remove-auto-ptr.patch b/recipes/sfml/all/patches/0005-remove-auto-ptr.patch new file mode 100644 index 0000000000000..63069f1d9cab4 --- /dev/null +++ b/recipes/sfml/all/patches/0005-remove-auto-ptr.patch @@ -0,0 +1,43 @@ +--- a/src/SFML/Audio/AudioDevice.cpp ++++ b/src/SFML/Audio/AudioDevice.cpp +@@ -29,7 +29,7 @@ + #include + #include + #include +-#include ++#include + + + namespace +@@ -107,9 +107,13 @@ bool AudioDevice::isExtensionSupported(const std::string& extension) + // This device will not be used in this function and merely + // makes sure there is a valid OpenAL device for extension + // queries if none has been created yet. +- std::auto_ptr device; ++ // ++ // Using an std::vector for this since auto_ptr is deprecated ++ // and we have no better STL facility for dynamically allocating ++ // a temporary instance with strong exception guarantee. ++ std::vector device; + if (!audioDevice) +- device.reset(new AudioDevice); ++ device.resize(1); + + if ((extension.length() > 2) && (extension.substr(0, 3) == "ALC")) + return alcIsExtensionPresent(audioDevice, extension.c_str()) != AL_FALSE; +@@ -125,9 +129,13 @@ int AudioDevice::getFormatFromChannelCount(unsigned int channelCount) + // This device will not be used in this function and merely + // makes sure there is a valid OpenAL device for format + // queries if none has been created yet. +- std::auto_ptr device; ++ // ++ // Using an std::vector for this since auto_ptr is deprecated ++ // and we have no better STL facility for dynamically allocating ++ // a temporary instance with strong exception guarantee. ++ std::vector device; + if (!audioDevice) +- device.reset(new AudioDevice); ++ device.resize(1); + + // Find the good format according to the number of channels + int format = 0; diff --git a/recipes/sfml/all/test_package/CMakeLists.txt b/recipes/sfml/all/test_package/CMakeLists.txt index 4eae723c4335e..b5272094f7cb4 100644 --- a/recipes/sfml/all/test_package/CMakeLists.txt +++ b/recipes/sfml/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) add_executable(${PROJECT_NAME} test_package.cpp) @@ -30,4 +27,4 @@ if(SFML_WITH_AUDIO) endif() find_package(SFML REQUIRED ${SFML_COMPONENTS} CONFIG) -target_link_libraries(${PROJECT_NAME} ${SFML_TARGETS}) +target_link_libraries(${PROJECT_NAME} PRIVATE ${SFML_TARGETS}) diff --git a/recipes/sfml/all/test_package/conanfile.py b/recipes/sfml/all/test_package/conanfile.py index d431379ec6c21..166801a7f9deb 100644 --- a/recipes/sfml/all/test_package/conanfile.py +++ b/recipes/sfml/all/test_package/conanfile.py @@ -1,21 +1,34 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SFML_WITH_WINDOW"] = self.dependencies["sfml"].options.window + tc.variables["SFML_WITH_GRAPHICS"] = self.dependencies["sfml"].options.graphics + tc.variables["SFML_WITH_NETWORK"] = self.dependencies["sfml"].options.network + tc.variables["SFML_WITH_AUDIO"] = self.dependencies["sfml"].options.audio + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["SFML_WITH_WINDOW"] = self.options["sfml"].window - cmake.definitions["SFML_WITH_GRAPHICS"] = self.options["sfml"].graphics - cmake.definitions["SFML_WITH_NETWORK"] = self.options["sfml"].network - cmake.definitions["SFML_WITH_AUDIO"] = self.options["sfml"].audio cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sfml/all/test_v1_package/CMakeLists.txt b/recipes/sfml/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/sfml/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sfml/all/test_v1_package/conanfile.py b/recipes/sfml/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..d431379ec6c21 --- /dev/null +++ b/recipes/sfml/all/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["SFML_WITH_WINDOW"] = self.options["sfml"].window + cmake.definitions["SFML_WITH_GRAPHICS"] = self.options["sfml"].graphics + cmake.definitions["SFML_WITH_NETWORK"] = self.options["sfml"].network + cmake.definitions["SFML_WITH_AUDIO"] = self.options["sfml"].audio + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/shapelib/all/CMakeLists.txt b/recipes/shapelib/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/shapelib/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/shapelib/all/conandata.yml b/recipes/shapelib/all/conandata.yml index 8b9c86049a8b3..5dde0cb6bfee1 100644 --- a/recipes/shapelib/all/conandata.yml +++ b/recipes/shapelib/all/conandata.yml @@ -2,3 +2,13 @@ sources: "1.5.0": url: "https://github.com/OSGeo/shapelib/archive/v1.5.0.zip" sha256: "673b00ef6caef254fe16d831b982e6bbed7397615c57b9ed92cf8b59017dd06b" +patches: + "1.5.0": + - patch_file: "patches/0001-cmake-minimum-required.patch" + patch_description: "Place the cmake_minimum_required call before the project command" + patch_source: "https://github.com/OSGeo/shapelib/pull/45" + patch_type: "portability" + - patch_file: "patches/0002-build-testing.patch" + patch_description: "Use the standard BUILD_TESTING variable to control building tests" + patch_source: "https://github.com/OSGeo/shapelib/pull/46" + patch_type: "portability" diff --git a/recipes/shapelib/all/conanfile.py b/recipes/shapelib/all/conanfile.py index 3ebe445bae662..19059022ab189 100644 --- a/recipes/shapelib/all/conanfile.py +++ b/recipes/shapelib/all/conanfile.py @@ -1,17 +1,19 @@ -from conans import ConanFile, CMake, tools import os -required_conan_version = ">=1.43.0" +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout, CMakeToolchain +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir + +required_conan_version = ">=1.53.0" class ShapelibConan(ConanFile): name = "shapelib" description = "C library for reading and writing ESRI Shapefiles" license = "LGPL-2.0-or-later" - topics = ("shapelib", "osgeo", "shapefile", "esri", "geospatial") + topics = ("osgeo", "shapefile", "esri", "geospatial") homepage = "https://github.com/OSGeo/shapelib" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,51 +24,44 @@ class ShapelibConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.compiler.rm_safe("cppstd") + self.settings.compiler.rm_safe("libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") + + def export_sources(self): + export_conandata_patches(self) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.variables["BUILD_TESTING"] = False + tc.variables["USE_RPATH"] = False + tc.generate() def build(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "set(BUILD_TEST ON)", "") + apply_conandata_patches(self) cmake = CMake(self) - cmake.definitions["USE_RPATH"] = False - cmake.configure(build_folder=self._build_subfolder) - cmake.build(target="shp") + cmake.configure() + cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - - self.copy("shapefil.h", dst="include", src=self._source_subfolder) - - build_lib_dir = os.path.join(self._build_subfolder, "lib") - build_bin_dir = os.path.join(self._build_subfolder, "bin") - self.copy(pattern="*.a", dst="lib", src=build_lib_dir, keep_path=False) - self.copy(pattern="*.lib", dst="lib", src=build_lib_dir, keep_path=False) - self.copy(pattern="*.dylib", dst="lib", src=build_lib_dir, keep_path=False, symlinks=True) - self.copy(pattern="*.so*", dst="lib", src=build_lib_dir, keep_path=False, symlinks=True) - self.copy(pattern="*.dll", dst="bin", src=build_bin_dir, keep_path=False) + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rm(self, "*.exe", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "shapelib") diff --git a/recipes/shapelib/all/patches/0001-cmake-minimum-required.patch b/recipes/shapelib/all/patches/0001-cmake-minimum-required.patch new file mode 100644 index 0000000000000..6e8c152618159 --- /dev/null +++ b/recipes/shapelib/all/patches/0001-cmake-minimum-required.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 7ae7f5d..0a5662f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -20,14 +20,15 @@ + + # It is a fatal error if no working C compiler is available to build + # the shapelib library and utilities ++ ++# Version 3.7 or above of cmake is currently required for all platforms. ++cmake_minimum_required(VERSION 3.7) ++ + project(shapelib C) + + message(STATUS "CMake version = ${CMAKE_VERSION}") + message(STATUS "CMAKE_SYSTEM_NAME = ${CMAKE_SYSTEM_NAME}") + +-# Version 2.8.5 or above of cmake is currently required for all platforms. +-cmake_minimum_required(VERSION 2.8.5 FATAL_ERROR) +- + # libraries are all shared by default. + option(BUILD_SHARED_LIBS "Build shared libraries" ON) + diff --git a/recipes/shapelib/all/patches/0002-build-testing.patch b/recipes/shapelib/all/patches/0002-build-testing.patch new file mode 100644 index 0000000000000..b86e9d5682d90 --- /dev/null +++ b/recipes/shapelib/all/patches/0002-build-testing.patch @@ -0,0 +1,57 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 0a5662f..6214dec 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -149,7 +149,7 @@ set(executables + find_program(BASH_EXECUTABLE bash) + find_program(SED_EXECUTABLE sed) + if(BASH_EXECUTABLE AND SED_EXECUTABLE) +- set(BUILD_TEST ON) ++ set(BUILD_TESTING ON CACHE BOOL "") + else(BASH_EXECUTABLE AND SED_EXECUTABLE) + message(STATUS "WARNING: sed or bash not available so disabling testing") + endif(BASH_EXECUTABLE AND SED_EXECUTABLE) +@@ -158,14 +158,14 @@ endif(BASH_EXECUTABLE AND SED_EXECUTABLE) + # from http://dl.maptools.org/dl/shapelib/shape_eg_data.zip, unpacked + # that file, and specified the location of that directory with + # the cmake option, -DEG_DATA:PATH=whatever +-if(BUILD_TEST) ++if(BUILD_TESTING) + if(EG_DATA) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/script.sed "s?/u/www/projects/shapelib/eg_data?${EG_DATA}?\n") + else(EG_DATA) + file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/script.sed "") + message(STATUS "WARNING: EG_DATA:PATH not set to point to downloaded eg_data directory so the eg_data part of testing will be ignored.") + endif(EG_DATA) +-endif(BUILD_TEST) ++endif() + + foreach(executable ${executables}) + add_executable(${executable} ${executable}.c) +@@ -176,17 +176,17 @@ foreach(executable ${executables}) + INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}" + ) + endif(USE_RPATH) +- if(BUILD_TEST) ++ if(BUILD_TESTING) + get_target_property(${executable}_LOC ${executable} LOCATION) + file(APPEND ${CMAKE_CURRENT_BINARY_DIR}/script.sed "s?\\./${executable}?${${executable}_LOC}?\n") +- endif(BUILD_TEST) ++ endif() + install(TARGETS ${executable} DESTINATION ${CMAKE_INSTALL_BINDIR}) + endforeach(executable ${executables}) + + # Install header + install(FILES shapefil.h DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) + +-if(BUILD_TEST) ++if(BUILD_TESTING) + # Set up tests: + + enable_testing() +@@ -235,4 +235,4 @@ if(BUILD_TEST) + NAME test3 + COMMAND ${BASH_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/sed_scripted_test3.sh + ) +-endif(BUILD_TEST) ++endif() diff --git a/recipes/shapelib/all/test_package/CMakeLists.txt b/recipes/shapelib/all/test_package/CMakeLists.txt index 199ed9ec00c6d..30289c1a8112b 100644 --- a/recipes/shapelib/all/test_package/CMakeLists.txt +++ b/recipes/shapelib/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(shapelib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} shapelib::shp) +target_link_libraries(${PROJECT_NAME} PRIVATE shapelib::shp) diff --git a/recipes/shapelib/all/test_package/conanfile.py b/recipes/shapelib/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/shapelib/all/test_package/conanfile.py +++ b/recipes/shapelib/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/shapelib/all/test_v1_package/CMakeLists.txt b/recipes/shapelib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/shapelib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/shapelib/all/test_v1_package/conanfile.py b/recipes/shapelib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/shapelib/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/shield/all/conandata.yml b/recipes/shield/all/conandata.yml index d5b1899d245a1..7af74449cf6b7 100644 --- a/recipes/shield/all/conandata.yml +++ b/recipes/shield/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.3": + url: "https://github.com/holoplot/shield/archive/0.3.tar.gz" + sha256: "125767e64c84e701f87eb52d7882b5214db375aa19798a5fda23eacce50bd564" "0.2": url: "https://github.com/holoplot/shield/archive/0.2.tar.gz" sha256: "bbc22d122a73467715074a92cbcd31c51adacf03256e5d24e304613f8f72197e" diff --git a/recipes/shield/config.yml b/recipes/shield/config.yml index 1d955fec74cce..3ff0a59a3da7e 100644 --- a/recipes/shield/config.yml +++ b/recipes/shield/config.yml @@ -1,4 +1,6 @@ versions: + "0.3": + folder: all "0.2": folder: all "0.1": diff --git a/recipes/si/all/conandata.yml b/recipes/si/all/conandata.yml index b0a9147ca711e..5576f1491e1a5 100644 --- a/recipes/si/all/conandata.yml +++ b/recipes/si/all/conandata.yml @@ -23,3 +23,6 @@ sources: 2.5.0: url: https://github.com/bernedom/SI/archive/2.5.0.tar.gz sha256: dc00eb8cfaa32e19c83595b238726188d2b857f8999dae08fe3001d0107ba276 + 2.5.1: + url: https://github.com/bernedom/SI/archive/2.5.1.tar.gz + sha256: b7b977c04c220a47a2bd3b8e2b6acfd640d286dfe1ae609f20e184cfec998798 diff --git a/recipes/si/config.yml b/recipes/si/config.yml index 9d68036737ef8..8530898d2c4b5 100644 --- a/recipes/si/config.yml +++ b/recipes/si/config.yml @@ -15,3 +15,5 @@ versions: folder: all 2.5.0: folder: all + 2.5.1: + folder: all diff --git a/recipes/simdjson/all/conandata.yml b/recipes/simdjson/all/conandata.yml index 954bb312b61ec..f3f6ef3de5dc4 100644 --- a/recipes/simdjson/all/conandata.yml +++ b/recipes/simdjson/all/conandata.yml @@ -1,22 +1,25 @@ sources: - "2.2.2": - url: "https://github.com/simdjson/simdjson/archive/v2.2.2.tar.gz" - sha256: "b0e36beab240bd827c1103b4c66672491595930067871e20946d67b07758c010" - "2.2.0": - url: "https://github.com/simdjson/simdjson/archive/v2.2.0.tar.gz" - sha256: "011974352049e986bdcdf64fc807cf3ab901865240f4ae8e3de670dd42aab099" + "3.1.1": + url: "https://github.com/simdjson/simdjson/archive/v3.1.1.tar.gz" + sha256: "4fcb1c9b1944e2eb8a4a4a22c979e2827165216f859e94d93c846c1261e0e432" + "3.1.0": + url: "https://github.com/simdjson/simdjson/archive/refs/tags/3.1.0.tar.gz" + sha256: "14d17ba7139d27c1e1bf01e765f5c26e84cc9e9be6a316c977638e01c7de85fa" + "3.0.1": + url: "https://github.com/simdjson/simdjson/archive/v3.0.1.tar.gz" + sha256: "156b1bc5eb0561b2bd166b46d191fd3d95a3e709cc63761477d3b7aec2b6e9ed" + "3.0.0": + url: "https://github.com/simdjson/simdjson/archive/v3.0.0.tar.gz" + sha256: "e6dd4bfaad2fd9599e6a026476db39a3bb9529436d3508ac3ae643bc663526c5" + "2.2.3": + url: "https://github.com/simdjson/simdjson/archive/v2.2.3.tar.gz" + sha256: "4c62f2d82edec3dbc63650c10453dc471de9f1be689eb5b4bde89efed89db5d8" "2.1.0": url: "https://github.com/simdjson/simdjson/archive/v2.1.0.tar.gz" sha256: "051b90427ddd1eac319f4eb34b973592728a6d8608fbac61e8aaa5a2dee4b693" "2.0.4": url: "https://github.com/simdjson/simdjson/archive/v2.0.4.tar.gz" sha256: "c8a12cf60f6ce8c0e556f68bd80e7bd9f11f5876e198ed3637da8ccf182eaa24" - "2.0.3": - url: "https://github.com/simdjson/simdjson/archive/v2.0.3.tar.gz" - sha256: "c1bcf65b3bd830bf8f747b8dd7126edd4bb7562bebb92698c1750acf4c979df6" - "2.0.1": - url: "https://github.com/simdjson/simdjson/archive/v2.0.1.tar.gz" - sha256: "581e508210614a5024edf79e0b65db943ab5711cc42163826bcbf3df6a5e34d1" "1.1.0": url: "https://github.com/simdjson/simdjson/archive/v1.1.0.tar.gz" sha256: "9effcb21fe48e4bcc9b96031e60c3911c58aa656ad8c78212d269c0db9e0133e" diff --git a/recipes/simdjson/all/conanfile.py b/recipes/simdjson/all/conanfile.py index 9ae45e679d546..2c915245a6822 100644 --- a/recipes/simdjson/all/conanfile.py +++ b/recipes/simdjson/all/conanfile.py @@ -7,7 +7,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.50.2 <1.51.0 || >=1.51.2" +required_conan_version = ">=1.53" class SimdjsonConan(ConanFile): @@ -33,9 +33,9 @@ class SimdjsonConan(ConanFile): @property def _compilers_minimum_version(self): return { - # In simdjson/2.0.1, several AVX-512 instructions are not support by GCC < 9.0 - "gcc": "8" if Version(self.version) != "2.0.1" else "9", + "gcc": "8", "Visual Studio": "16", + "msvc": "192", "clang": "6", "apple-clang": "9.4", } @@ -46,7 +46,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): if self.info.settings.compiler.cppstd: @@ -60,17 +60,17 @@ def loose_lt_semver(v1, v2): minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) if not minimum_version: - self.output.warn("{} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name)) + self.output.warn(f"{self.ref} requires C++17. Your compiler is unknown. Assuming it supports C++17.") elif loose_lt_semver(str(self.info.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("{} requires C++17, which your compiler does not fully support.".format(self.name)) + raise ConanInvalidConfiguration(f"{self.ref} requires C++17, which your compiler does not fully support.") if Version(self.version) >= "2.0.0" and \ self.info.settings.compiler == "gcc" and \ Version(self.info.settings.compiler.version).major == "9": if self.settings.compiler.get_safe("libcxx") == "libstdc++11": - raise ConanInvalidConfiguration("{}/{} doesn't support GCC 9 with libstdc++11.".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support GCC 9 with libstdc++11.") if self.info.settings.build_type == "Debug": - raise ConanInvalidConfiguration("{}/{} doesn't support GCC 9 with Debug build type.".format(self.name, self.version)) + raise ConanInvalidConfiguration(f"{self.ref} doesn't support GCC 9 with Debug build type.") def layout(self): cmake_layout(self, src_folder="src") @@ -115,10 +115,14 @@ def package(self): cmake = CMake(self) cmake.install() rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "simdjson") self.cpp_info.set_property("cmake_target_name", "simdjson::simdjson") + if Version(self.version) >= "2.2.3": + self.cpp_info.set_property("pkg_config_name", "simdjson") + self.cpp_info.libs = ["simdjson"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/simdjson/all/test_v1_package/CMakeLists.txt b/recipes/simdjson/all/test_v1_package/CMakeLists.txt index 88b5f3a330d2f..be00a8c7f57c7 100644 --- a/recipes/simdjson/all/test_v1_package/CMakeLists.txt +++ b/recipes/simdjson/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(simdjson REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE simdjson::simdjson) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/simdjson/config.yml b/recipes/simdjson/config.yml index 16afc75b1f4cf..cc1513cead6fc 100644 --- a/recipes/simdjson/config.yml +++ b/recipes/simdjson/config.yml @@ -1,15 +1,17 @@ versions: - "2.2.2": + "3.1.1": folder: all - "2.2.0": + "3.1.0": folder: all - "2.1.0": + "3.0.1": folder: all - "2.0.4": + "3.0.0": folder: all - "2.0.3": + "2.2.3": folder: all - "2.0.1": + "2.1.0": + folder: all + "2.0.4": folder: all "1.1.0": folder: all diff --git a/recipes/simdutf/all/CMakeLists.txt b/recipes/simdutf/all/CMakeLists.txt deleted file mode 100644 index 7d5ba25565b0a..0000000000000 --- a/recipes/simdutf/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/simdutf/all/conandata.yml b/recipes/simdutf/all/conandata.yml index 806e62129d6cf..9db35b4146b1a 100644 --- a/recipes/simdutf/all/conandata.yml +++ b/recipes/simdutf/all/conandata.yml @@ -1,10 +1,71 @@ sources: + "3.2.0": + url: "https://github.com/simdutf/simdutf/archive/v3.2.0.tar.gz" + sha256: "0d9f63e2f308b6b54f399ebbe3a02776b902a2670c88c28de2d75ea2197dc4e9" + "3.1.0": + url: "https://github.com/simdutf/simdutf/archive/v3.1.0.tar.gz" + sha256: "9757a04085ad3ebab9fe933d9198ec6b84a857632a540418b6cfeb7b889a8017" + "3.0.0": + url: "https://github.com/simdutf/simdutf/archive/v3.0.0.tar.gz" + sha256: "cc23b47fd0caf9018fc0dcf49ebeff2676654fff997f9f6ce50fa93cd36f661f" + "2.2.0": + url: "https://github.com/simdutf/simdutf/archive/v2.2.0.tar.gz" + sha256: "b0b8527e194700363cc47e75a7b8d58c88798b0dc31671f5ae5c8803d8678fe6" + "2.1.0": + url: "https://github.com/simdutf/simdutf/archive/v2.1.0.tar.gz" + sha256: "a8a8bbd71c8d8be1f7da16722776988d0640758fe0a46066eb3129868dad08da" + "2.0.9": + url: "https://github.com/simdutf/simdutf/archive/v2.0.9.tar.gz" + sha256: "ff6a19de4c23671e7f1077cf6c0f60bc01197f29c6e4f56fa485c9cd732576ac" + "2.0.8": + url: "https://github.com/simdutf/simdutf/archive/v2.0.8.tar.gz" + sha256: "bd7aa550a8d9a1aba2c0b4eb2088f90c964375b13394f9076f7ba49f51dc40b5" + "2.0.6": + url: "https://github.com/simdutf/simdutf/archive/v2.0.6.tar.gz" + sha256: "40f1f9a4403f81c2c3d736ef9c73662835b2241871caa262fcd654e0898f9e4e" "1.0.1": - url: "https://github.com/simdutf/simdutf/archive/refs/tags/v1.0.1.tar.gz" + url: "https://github.com/simdutf/simdutf/archive/v1.0.1.tar.gz" sha256: "e7832ba58fb95fe00de76dbbb2f17d844a7ad02a6f5e3e9e5ce9520e820049a0" patches: + "3.2.0": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "3.1.0": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "3.0.0": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "2.2.0": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "2.1.0": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "2.0.9": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "2.0.8": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + "2.0.6": + - patch_file: "patches/2.0.3-0001-fix-cmake.patch" + patch_description: "remove static build, enable rpath on macOS" + patch_type: "conan" + - patch_file: "patches/2.0.6-0002-add-workaround-gcc9.patch" + patch_description: "apply gcc8 workaround to gcc9" + patch_type: "portability" "1.0.1": - patch_file: "patches/1.0.1-0001-fix-cmake.patch" - base_path: "source_subfolder" + patch_description: "disable test and benchmark build and enable rpath on macOS" + patch_type: "conan" - patch_file: "patches/1.0.1-0002-remove-static.patch" - base_path: "source_subfolder" + patch_description: "remove static build only" + patch_type: "conan" diff --git a/recipes/simdutf/all/conanfile.py b/recipes/simdutf/all/conanfile.py index 13ae8e7b6b61e..6bdedd0dd5b54 100644 --- a/recipes/simdutf/all/conanfile.py +++ b/recipes/simdutf/all/conanfile.py @@ -1,16 +1,20 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version + import os -import functools -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class SimdutfConan(ConanFile): name = "simdutf" description = "Unicode routines (UTF8, UTF16): billions of characters per second." license = ("Apache-2.0", "MIT") - topics = ("unicode", "transcoding", "neon", "simd", "avx2", "sse2", "utf8", "utf16", ) - homepage = "https://github.com/simdutf/simdutf" url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/simdutf/simdutf" + topics = ("unicode", "transcoding", "neon", "simd", "avx2", "sse2", "utf8", "utf16", ) settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -20,16 +24,13 @@ class SimdutfConan(ConanFile): "shared": False, "fPIC": True, } - generators = "cmake", @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,33 +38,45 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SIMDUTF_BENCHMARKS"] = False + tc.variables["BUILD_TESTING"] = False + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) == "8": + tc.variables["CMAKE_CXX_FLAGS"] = " -mavx512f" + if Version(self.version) >= "2.0.3": + tc.variables["SIMDUTF_TOOLS"] = False + tc.generate() + + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE*", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.libs = ["simdutf"] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/simdutf/all/patches/2.0.3-0001-fix-cmake.patch b/recipes/simdutf/all/patches/2.0.3-0001-fix-cmake.patch new file mode 100644 index 0000000000000..6bedd6c48eb5d --- /dev/null +++ b/recipes/simdutf/all/patches/2.0.3-0001-fix-cmake.patch @@ -0,0 +1,23 @@ +diff --git a/cmake/simdutf-flags.cmake b/cmake/simdutf-flags.cmake +index 9263a7f..39f5a8c 100644 +--- a/cmake/simdutf-flags.cmake ++++ b/cmake/simdutf-flags.cmake +@@ -16,4 +16,4 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/tools/cmake") + set(CMAKE_CXX_STANDARD 11) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) +-set(CMAKE_MACOSX_RPATH OFF) ++set(CMAKE_MACOSX_RPATH ON) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index f3ede1e..91a1bdd 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -3,6 +3,6 @@ target_include_directories(simdutf-include-source INTERFACE $/simdutf.cpp) + target_link_libraries(simdutf-source INTERFACE simdutf-include-source) +-add_library(simdutf STATIC simdutf.cpp) ++add_library(simdutf simdutf.cpp) + target_include_directories(simdutf PRIVATE $ ) + target_include_directories(simdutf PUBLIC "$") + diff --git a/recipes/simdutf/all/patches/2.0.6-0002-add-workaround-gcc9.patch b/recipes/simdutf/all/patches/2.0.6-0002-add-workaround-gcc9.patch new file mode 100644 index 0000000000000..957a9759ee2fa --- /dev/null +++ b/recipes/simdutf/all/patches/2.0.6-0002-add-workaround-gcc9.patch @@ -0,0 +1,42 @@ +diff --git a/src/icelake/icelake_utf8_common.inl.cpp b/src/icelake/icelake_utf8_common.inl.cpp +index 962700b..a192a18 100644 +--- a/src/icelake/icelake_utf8_common.inl.cpp ++++ b/src/icelake/icelake_utf8_common.inl.cpp +@@ -448,12 +448,12 @@ __m512i prev(__m512i input, __m512i previous) { + static_assert(N<=32, "N must be no larger than 32"); + const __m512i movemask = _mm512_setr_epi32(28,29,30,31,0,1,2,3,4,5,6,7,8,9,10,11); + const __m512i rotated = _mm512_permutex2var_epi32(input, movemask, previous); +-#if SIMDUTF_GCC8 +- constexpr int shift = 16-N; // workaround for GCC8 ++#if SIMDUTF_GCC8 || SIMDUTF_GCC9 ++ constexpr int shift = 16-N; // workaround for GCC8,9 + return _mm512_alignr_epi8(input, rotated, shift); + #else + return _mm512_alignr_epi8(input, rotated, 16-N); +-#endif // SIMDUTF_GCC8 ++#endif // SIMDUTF_GCC8 || SIMDUTF_GCC9 + } + + template +diff --git a/src/simdutf/icelake/intrinsics.h b/src/simdutf/icelake/intrinsics.h +index c71a085..edcd289 100644 +--- a/src/simdutf/icelake/intrinsics.h ++++ b/src/simdutf/icelake/intrinsics.h +@@ -64,7 +64,9 @@ + #if defined(__GNUC__) && !defined(__clang__) + #if __GNUC__ == 8 + #define SIMDUTF_GCC8 1 +-#endif // __GNUC__ == 8 ++#elif __GNUC__ == 9 ++#define SIMDUTF_GCC9 1 ++#endif // __GNUC__ == 8 || __GNUC__ == 9 + #endif // defined(__GNUC__) && !defined(__clang__) + + #if SIMDUTF_GCC8 +@@ -83,4 +85,4 @@ inline __m512i _mm512_set_epi8(uint8_t a0, uint8_t a1, uint8_t a2, uint8_t a3, u + } + #endif // SIMDUTF_GCC8 + +-#endif // SIMDUTF_HASWELL_INTRINSICS_H +\ No newline at end of file ++#endif // SIMDUTF_HASWELL_INTRINSICS_H diff --git a/recipes/simdutf/all/test_package/CMakeLists.txt b/recipes/simdutf/all/test_package/CMakeLists.txt index 1760e67432f8e..ac41d27abf2c8 100644 --- a/recipes/simdutf/all/test_package/CMakeLists.txt +++ b/recipes/simdutf/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(simdutf REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} simdutf::simdutf) +target_link_libraries(${PROJECT_NAME} PRIVATE simdutf::simdutf) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/simdutf/all/test_package/conanfile.py b/recipes/simdutf/all/test_package/conanfile.py index 38f4483872d47..a9fbb7f543162 100644 --- a/recipes/simdutf/all/test_package/conanfile.py +++ b/recipes/simdutf/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/simdutf/all/test_v1_package/CMakeLists.txt b/recipes/simdutf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b4c2f89fe6420 --- /dev/null +++ b/recipes/simdutf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(simdutf REQUIRED CONFIG) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/simdutf/all/test_v1_package/conanfile.py b/recipes/simdutf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/simdutf/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/simdutf/config.yml b/recipes/simdutf/config.yml index 715e55357a17b..2bfb3edf51407 100644 --- a/recipes/simdutf/config.yml +++ b/recipes/simdutf/config.yml @@ -1,3 +1,19 @@ versions: + "3.2.0": + folder: all + "3.1.0": + folder: all + "3.0.0": + folder: all + "2.2.0": + folder: all + "2.1.0": + folder: all + "2.0.9": + folder: all + "2.0.8": + folder: all + "2.0.6": + folder: all "1.0.1": folder: all diff --git a/recipes/sml/all/conandata.yml b/recipes/sml/all/conandata.yml index 422f62dead663..cfb630a1d7b27 100644 --- a/recipes/sml/all/conandata.yml +++ b/recipes/sml/all/conandata.yml @@ -1,11 +1,13 @@ sources: + "1.1.6": + url: "https://github.com/boost-ext/sml/archive/refs/tags/v1.1.6.tar.gz" + sha256: "08a6d80eb9aa6ee4e462c1b802b9d7db8a39758746565f13cc4d2459ed49a29e" "1.1.5": - url: https://github.com/boost-ext/sml/archive/v1.1.5.tar.gz - sha256: b8106a28a275a9be7aa6ae49eb58396cc1b4e3c20afb472be8801af556e59cba + url: "https://github.com/boost-ext/sml/archive/v1.1.5.tar.gz" + sha256: "b8106a28a275a9be7aa6ae49eb58396cc1b4e3c20afb472be8801af556e59cba" "1.1.4": - url: https://github.com/boost-ext/sml/archive/v1.1.4.tar.gz - sha256: 897c78077f5a4d22b0de253b8689a8ea6d8adfba8d7b4877d6f5c76277e00976 + url: "https://github.com/boost-ext/sml/archive/v1.1.4.tar.gz" + sha256: "897c78077f5a4d22b0de253b8689a8ea6d8adfba8d7b4877d6f5c76277e00976" patches: "1.1.4": - patch_file: "patches/0001-fix-clang12-error.patch" - base_path: "source_subfolder" diff --git a/recipes/sml/all/conanfile.py b/recipes/sml/all/conanfile.py index 4d900fb0aa739..ba7c5897722f0 100644 --- a/recipes/sml/all/conanfile.py +++ b/recipes/sml/all/conanfile.py @@ -1,7 +1,13 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os +required_conan_version = ">=1.50.0" + class SMLConan(ConanFile): name = "sml" @@ -10,47 +16,55 @@ class SMLConan(ConanFile): topics = ("state-machine", "metaprogramming", "design-patterns", "sml") license = "BSL-1.0" url = "https://github.com/conan-io/conan-center-index" - settings = "compiler" - exports_sources = "patches/*" + settings = "os", "arch", "compiler", "build_type" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" @property def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "191", "gcc": "5", "clang": "5", "apple-clang": "5.1", } - def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + def export_sources(self): + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def validate(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "14") - minimum_version = self._minimum_compilers_version.get( - str(self.settings.compiler), False) - if not minimum_version: - self.output.warn( - "SML requires C++14. Your compiler is unknown. Assuming it supports C++14.") - elif tools.Version(self.settings.compiler.version) < minimum_version: + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, "14") + minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - "SML requires C++14, which your compiler does not support.") + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - # tools.patch(patch_file="patches/0001-fix-clang12-error.patch") + apply_conandata_patches(self) def package(self): - self.copy(pattern="*", dst="include", - src=os.path.join(self._source_subfolder, "include")) - self.copy("*LICENSE.md", dst="licenses", keep_path=False) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "sml") + self.cpp_info.set_property("cmake_target_name", "sml::sml") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/sml/all/test_package/CMakeLists.txt b/recipes/sml/all/test_package/CMakeLists.txt index 8c0f24c3fa7f3..ab67ff60b5680 100644 --- a/recipes/sml/all/test_package/CMakeLists.txt +++ b/recipes/sml/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.5) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(sml REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE CONAN_PKG::sml) -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_14) +target_link_libraries(${PROJECT_NAME} PRIVATE sml::sml) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/sml/all/test_package/conanfile.py b/recipes/sml/all/test_package/conanfile.py index b06dd6800dcf0..0a6bc68712d90 100644 --- a/recipes/sml/all/test_package/conanfile.py +++ b/recipes/sml/all/test_package/conanfile.py @@ -1,16 +1,26 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sml/all/test_v1_package/CMakeLists.txt b/recipes/sml/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2ecfffc8e29bc --- /dev/null +++ b/recipes/sml/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(sml REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE sml::sml) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/sml/all/test_v1_package/conanfile.py b/recipes/sml/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/sml/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/sml/config.yml b/recipes/sml/config.yml index 953d7e8cb96d8..fa8612a6d0ffa 100644 --- a/recipes/sml/config.yml +++ b/recipes/sml/config.yml @@ -1,4 +1,6 @@ versions: + "1.1.6": + folder: all "1.1.5": folder: all "1.1.4": diff --git a/recipes/snappy/all/conanfile.py b/recipes/snappy/all/conanfile.py index e4b1a8a763fb0..ecf8494270b89 100644 --- a/recipes/snappy/all/conanfile.py +++ b/recipes/snappy/all/conanfile.py @@ -1,22 +1,22 @@ from conan import ConanFile -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, stdcpp_library from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version -from conans import tools as tools_legacy import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class SnappyConan(ConanFile): name = "snappy" description = "A fast compressor/decompressor" - topics = ("snappy", "google", "compressor", "decompressor") + topics = ("google", "compressor", "decompressor") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/google/snappy" license = "BSD-3-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,8 +28,7 @@ class SnappyConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == 'Windows': @@ -37,18 +36,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def validate(self): - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -60,8 +58,6 @@ def generate(self): tc.variables["SNAPPY_INSTALL"] = True if Version(self.version) >= "1.1.9": tc.variables["SNAPPY_BUILD_BENCHMARKS"] = False - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): @@ -82,7 +78,9 @@ def package_info(self): # TODO: back to global scope in conan v2 once cmake_find_package* generators removed self.cpp_info.components["snappylib"].libs = ["snappy"] if not self.options.shared: - libcxx = tools_legacy.stdcpp_library(self) + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["snappylib"].system_libs.append("m") + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.components["snappylib"].system_libs.append(libcxx) diff --git a/recipes/snappy/all/test_package/conanfile.py b/recipes/snappy/all/test_package/conanfile.py index d86c0f488035c..543039a6ab53c 100644 --- a/recipes/snappy/all/test_package/conanfile.py +++ b/recipes/snappy/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,20 +7,21 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") bin_path_c = os.path.join(self.cpp.build.bindirs[0], "test_package_c") diff --git a/recipes/snappy/all/test_v1_package/CMakeLists.txt b/recipes/snappy/all/test_v1_package/CMakeLists.txt index a49ae559e8835..0d20897301b68 100644 --- a/recipes/snappy/all/test_v1_package/CMakeLists.txt +++ b/recipes/snappy/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Snappy REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Snappy::snappy) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) - -add_executable(${PROJECT_NAME}_c ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME}_c PRIVATE Snappy::snappy) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sofa/all/conanfile.py b/recipes/sofa/all/conanfile.py index f94a556a8dddd..353c0e47abe0e 100644 --- a/recipes/sofa/all/conanfile.py +++ b/recipes/sofa/all/conanfile.py @@ -3,17 +3,18 @@ from conan.tools.files import get, load, save import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" class SofaConan(ConanFile): name = "sofa" description = "IAU Standards of Fundamental Astronomy (SOFA) C Library." license = "SOFA Software License" - topics = ("sofa", "iau", "astronomy") + topics = ("iau", "astronomy") homepage = "http://www.iausofa.org" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,22 +37,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/sofa/all/test_package/conanfile.py b/recipes/sofa/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/sofa/all/test_package/conanfile.py +++ b/recipes/sofa/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/sofa/all/test_v1_package/CMakeLists.txt b/recipes/sofa/all/test_v1_package/CMakeLists.txt index 2371e488733df..0d20897301b68 100644 --- a/recipes/sofa/all/test_v1_package/CMakeLists.txt +++ b/recipes/sofa/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(sofa REQUIRED CONFIG) - -add_executable(test_package ../test_package/test_package.c) -target_link_libraries(test_package PRIVATE sofa::sofa) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sofa/all/test_v1_package/conanfile.py b/recipes/sofa/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/sofa/all/test_v1_package/conanfile.py +++ b/recipes/sofa/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/sokol/all/conanfile.py b/recipes/sokol/all/conanfile.py index e66d47c74fe0d..e51b5f383cb38 100644 --- a/recipes/sokol/all/conanfile.py +++ b/recipes/sokol/all/conanfile.py @@ -1,6 +1,9 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -import glob + +required_conan_version = ">=1.50.0" class SokolConan(ConanFile): @@ -10,20 +13,26 @@ class SokolConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/floooh/sokol" license = "Zlib" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob(self.name + "-*/")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src=self._source_subfolder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/sokol/all/test_package/CMakeLists.txt b/recipes/sokol/all/test_package/CMakeLists.txt index 3e933ce337ad7..ecaa904d9733e 100644 --- a/recipes/sokol/all/test_package/CMakeLists.txt +++ b/recipes/sokol/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(sokol REQUIRED CONFIG) add_executable(test_package test_package.c) -target_link_libraries(test_package sokol::sokol) +target_link_libraries(test_package PRIVATE sokol::sokol) diff --git a/recipes/sokol/all/test_package/conanfile.py b/recipes/sokol/all/test_package/conanfile.py index 7e2dfe859bb27..0a6bc68712d90 100644 --- a/recipes/sokol/all/test_package/conanfile.py +++ b/recipes/sokol/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sokol/all/test_v1_package/CMakeLists.txt b/recipes/sokol/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..4999ac8ba67d0 --- /dev/null +++ b/recipes/sokol/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(sokol REQUIRED CONFIG) + +add_executable(test_package ../test_package/test_package.c) +target_link_libraries(test_package PRIVATE sokol::sokol) diff --git a/recipes/sokol/all/test_v1_package/conanfile.py b/recipes/sokol/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/sokol/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/sol2/2.x.x/conandata.yml b/recipes/sol2/2.x.x/conandata.yml deleted file mode 100644 index 557238ad0c235..0000000000000 --- a/recipes/sol2/2.x.x/conandata.yml +++ /dev/null @@ -1,4 +0,0 @@ -sources: - "2.20.6": - url: "https://github.com/ThePhD/sol2/archive/v2.20.6.tar.gz" - sha256: "90c72e120cdd67d516434b51fdcff2d63cc25afe06fb7866fcf7f5bc85366808" diff --git a/recipes/sol2/2.x.x/conanfile.py b/recipes/sol2/2.x.x/conanfile.py deleted file mode 100644 index 0cf3b0170efee..0000000000000 --- a/recipes/sol2/2.x.x/conanfile.py +++ /dev/null @@ -1,69 +0,0 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration, ConanException -import os - - -class Sol2Conan(ConanFile): - name = "sol2" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/ThePhD/sol2" - description = "C++17 Lua bindings" - topics = ("conan", "lua", "c++", "bindings") - settings = "os", "compiler", "build_type", "arch" - license = "MIT" - requires = ["lua/5.3.5"] - - _source_subfolder = "source_subfolder" - _build_subfolder = "build_subfolder" - _cmake = None - - def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure( - source_folder=self._source_subfolder, - build_folder=self._build_subfolder - ) - return self._cmake - - def configure(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") - compiler = str(self.settings.compiler) - comp_version = tools.Version(self.settings.compiler.version) - compilers = {"Visual Studio": "14", "gcc": "5", - "clang": "3.2", "apple-clang": "4.3"} - min_version = compilers.get(compiler) - if not min_version: - self.output.warn( - "sol2 recipe lacks information about the %s compiler support".format(compiler)) - elif comp_version < min_version: - raise ConanInvalidConfiguration("sol2 requires C++14 or higher support standard." - " {} {} is not supported." - .format(compiler, comp_version)) - - def build(self): - cmake = self._configure_cmake() - cmake.build() - - def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() - cmake.install() - # constains just # , "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - # constains just # , "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib")) - - def package_id(self): - self.info.header_only() - - def package_info(self): - if self.options["lua"].compile_as_cpp: - self.cpp_info.defines.append("SOL_USING_CXX_LUA=1") diff --git a/recipes/sol2/2.x.x/test_package/CMakeLists.txt b/recipes/sol2/2.x.x/test_package/CMakeLists.txt deleted file mode 100644 index 52b3a5659a0bb..0000000000000 --- a/recipes/sol2/2.x.x/test_package/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) - -enable_testing() - -add_test(NAME ${PROJECT_NAME} COMMAND ${PROJECT_NAME}) - - diff --git a/recipes/sol2/2.x.x/test_package/conanfile.py b/recipes/sol2/2.x.x/test_package/conanfile.py deleted file mode 100644 index e209e5d26e439..0000000000000 --- a/recipes/sol2/2.x.x/test_package/conanfile.py +++ /dev/null @@ -1,21 +0,0 @@ -from conans import ConanFile, CMake, tools -import os - - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" - - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake - - def build(self): - cmake = self._configure_cmake() - cmake.build() - - def test(self): - if not tools.cross_building(self.settings) or tools.os_info.is_windows: - cmake = self._configure_cmake() - cmake.test() diff --git a/recipes/sol2/2.x.x/test_package/test_package.cpp b/recipes/sol2/2.x.x/test_package/test_package.cpp deleted file mode 100644 index bd0b957b11da6..0000000000000 --- a/recipes/sol2/2.x.x/test_package/test_package.cpp +++ /dev/null @@ -1,45 +0,0 @@ - - -#include -#include - -struct test_stack_guard { - lua_State* L; - int& begintop; - int& endtop; - test_stack_guard(lua_State* L, int& begintop, int& endtop) - : L(L), begintop(begintop), endtop(endtop) { - begintop = lua_gettop(L); - } - - void check() { - if (begintop != endtop) { - std::abort(); - } - } - - ~test_stack_guard() { - endtop = lua_gettop(L); - } -}; - -#define REQUIRE(x) if (!(x)) throw "bad" ; -#define REQUIRE_FALSE(x) if (x) throw "bad" ; - -int main() { - - sol::state lua; - lua.open_libraries(); - lua.set_function("f", [&](bool num) { - REQUIRE(num == true); - return num; - }); - auto result1 = lua.safe_script("x = f(true)\n" - "assert(x == true)", sol::script_pass_on_error); - REQUIRE(result1.valid()); - sol::object x = lua["x"]; - REQUIRE(x.is()); - REQUIRE(x.as() == true); - REQUIRE_FALSE(x.is()); - -} diff --git a/recipes/sol2/3.x.x/conandata.yml b/recipes/sol2/3.x.x/conandata.yml deleted file mode 100644 index 50a2646061989..0000000000000 --- a/recipes/sol2/3.x.x/conandata.yml +++ /dev/null @@ -1,19 +0,0 @@ -sources: - "3.3.0": - url: "https://github.com/ThePhD/sol2/archive/v3.3.0.tar.gz" - sha256: "b82c5de030e18cb2bcbcefcd5f45afd526920c517a96413f0b59b4332d752a1e" - "3.2.3": - url: "https://github.com/ThePhD/sol2/archive/v3.2.3.tar.gz" - sha256: "f74158f92996f476786be9c9e83f8275129bb1da2a8d517d050421ac160a4b9e" - "3.2.2": - url: "https://github.com/ThePhD/sol2/archive/v3.2.2.tar.gz" - sha256: "141790dae0c1821dd2dbac3595433de49ba72545845efc3ec7d88de8b0a3b2da" - "3.2.1": - url: "https://github.com/ThePhD/sol2/archive/v3.2.1.tar.gz" - sha256: "b10f88dc1246f74a10348faef7d2c06e2784693307df74dcd87c4641cf6a6828" - "3.2.0": - url: "https://github.com/ThePhD/sol2/archive/v3.2.0.tar.gz" - sha256: "733f03d82df6e0e8a15967831840d240dcb2c606982bec753bd173a9cc1b3435" - "3.0.3": - url: "https://github.com/ThePhD/sol2/archive/v3.0.3.tar.gz" - sha256: "bf089e50387edfc70063e24fd7fbb693cceba4a50147d864fabedd1b33483582" diff --git a/recipes/sol2/3.x.x/conanfile.py b/recipes/sol2/3.x.x/conanfile.py deleted file mode 100644 index d12e6df5494fc..0000000000000 --- a/recipes/sol2/3.x.x/conanfile.py +++ /dev/null @@ -1,69 +0,0 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import os - -required_conan_version = ">=1.33.0" - -class Sol2Conan(ConanFile): - name = "sol2" - description = "a C++ <-> Lua API wrapper with advanced features and top notch performance" - license = "MIT" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/ThePhD/sol2" - topics = ("lua", "c++", "bindings") - settings = "os", "arch", "compiler", "build_type" - no_copy_source = True - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _compilers_minimum_version(self): - return { - "gcc": "7", - "Visual Studio": "15.7" if tools.Version(self.version) < "3.3.0" else "16", - "clang": "6", - "apple-clang": "10", - } - - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - - def lazy_lt_semver(v1, v2): - lv1 = [int(v) for v in v1.split(".")] - lv2 = [int(v) for v in v2.split(".")] - min_length = min(len(lv1), len(lv2)) - return lv1[:min_length] < lv2[:min_length] - - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("sol2 requires C++17. Your compiler is unknown. Assuming it supports C++17.") - elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("sol2 requires C++17 or higher support standard." - " {} {} is not supported." - .format(self.settings.compiler, - self.settings.compiler.version)) - - def requirements(self): - if tools.Version(self.version) < "3.2.0": - self.requires("lua/5.3.5") - else: - self.requires("lua/5.4.4") - - def package_id(self): - self.info.header_only() - - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def package(self): - self.copy("LICENSE.txt", src=self._source_subfolder, dst="licenses") - self.copy("*.h", src=os.path.join(self._source_subfolder, "include"), dst="include") - self.copy("*.hpp", src=os.path.join(self._source_subfolder, "include"), dst="include") - - def package_info(self): - if self.options["lua"].compile_as_cpp: - self.cpp_info.defines.append("SOL_USING_CXX_LUA=1") diff --git a/recipes/sol2/3.x.x/test_package/CMakeLists.txt b/recipes/sol2/3.x.x/test_package/CMakeLists.txt deleted file mode 100644 index 4bba4f17aa534..0000000000000 --- a/recipes/sol2/3.x.x/test_package/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(sol2 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) -target_link_libraries(${PROJECT_NAME} sol2::sol2) diff --git a/recipes/sol2/3.x.x/test_package/sol_test.hpp b/recipes/sol2/3.x.x/test_package/sol_test.hpp deleted file mode 100644 index ac753eb6eed51..0000000000000 --- a/recipes/sol2/3.x.x/test_package/sol_test.hpp +++ /dev/null @@ -1,75 +0,0 @@ -// sol3 - -// The MIT License (MIT) - -// Copyright (c) 2013-2019 Rapptz, ThePhD and contributors - -// Permission is hereby granted, free of charge, to any person obtaining a copy of -// this software and associated documentation files (the "Software"), to deal in -// the Software without restriction, including without limitation the rights to -// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -// the Software, and to permit persons to whom the Software is furnished to do so, -// subject to the following conditions: - -// The above copyright notice and this permission notice shall be included in all -// copies or substantial portions of the Software. - -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -// COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -// IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -// CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -#ifndef SOL_TESTS_SOL_TEST_HPP -#define SOL_TESTS_SOL_TEST_HPP - -#if !defined(SOL_ALL_SAFETIES_ON) - #define SOL_ALL_SAFETIES_ON 1 -#endif // SOL_ALL_SAFETIES_ON -#if !defined(SOL_PRINT_ERRORS) - #define SOL_PRINT_ERRORS 1 -#endif // SOL_ALL_SAFETIES_ON -#if !defined(SOL_ENABLE_INTEROP) - #define SOL_ENABLE_INTEROP 1 -#endif // SOL_ENABLE_INTEROP - -// Can't activate until all script/safe_script calls are vetted... -/*#ifndef SOL_DEFAULT_PASS_ON_ERROR -#define SOL_DEFAULT_PASS_ON_ERROR 1 -#endif // SOL_DEFAULT_PASS_ON_ERROR -*/ - -#include -#include - -#include -#include - -struct test_stack_guard { - lua_State* L; - int& begintop; - int& endtop; - test_stack_guard(lua_State* L, int& begintop, int& endtop) : L(L), begintop(begintop), endtop(endtop) { - begintop = lua_gettop(L); - } - - void check() { - if (begintop != endtop) { - std::abort(); - } - } - - ~test_stack_guard() { - endtop = lua_gettop(L); - } -}; - -struct no_delete { - template - void operator()(P) const noexcept { - - } -}; - -#endif // SOL_TESTS_SOL_TEST_HPP diff --git a/recipes/sol2/3.x.x/test_package/test_package.cpp b/recipes/sol2/3.x.x/test_package/test_package.cpp deleted file mode 100644 index c5f3df015b3ad..0000000000000 --- a/recipes/sol2/3.x.x/test_package/test_package.cpp +++ /dev/null @@ -1,21 +0,0 @@ - -#include "sol_test.hpp" -#include - -int main() { - - sol::state lua; - - auto bob_table = lua.create_table("bob"); - bob_table.set("is_set", 42); - - int is_set = bob_table.get_or("is_set", 3); - int is_not_set = bob_table.get_or("is_not_set", 22); - - if (is_set != 42 || is_not_set != 22) { - return EXIT_FAILURE ; - } - - return EXIT_SUCCESS ; - -} diff --git a/recipes/sol2/all/conandata.yml b/recipes/sol2/all/conandata.yml new file mode 100644 index 0000000000000..aa516653323cf --- /dev/null +++ b/recipes/sol2/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "3.3.0": + url: "https://github.com/ThePhD/sol2/archive/v3.3.0.tar.gz" + sha256: "b82c5de030e18cb2bcbcefcd5f45afd526920c517a96413f0b59b4332d752a1e" + "3.2.3": + url: "https://github.com/ThePhD/sol2/archive/v3.2.3.tar.gz" + sha256: "f74158f92996f476786be9c9e83f8275129bb1da2a8d517d050421ac160a4b9e" + "3.0.3": + url: "https://github.com/ThePhD/sol2/archive/v3.0.3.tar.gz" + sha256: "bf089e50387edfc70063e24fd7fbb693cceba4a50147d864fabedd1b33483582" + "2.20.6": + url: "https://github.com/ThePhD/sol2/archive/v2.20.6.tar.gz" + sha256: "90c72e120cdd67d516434b51fdcff2d63cc25afe06fb7866fcf7f5bc85366808" diff --git a/recipes/sol2/all/conanfile.py b/recipes/sol2/all/conanfile.py new file mode 100644 index 0000000000000..93f899011d335 --- /dev/null +++ b/recipes/sol2/all/conanfile.py @@ -0,0 +1,117 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version + +required_conan_version = ">=1.50.0" + + +class Sol2Conan(ConanFile): + name = "sol2" + package_type = "header-library" + description = "a C++ <-> Lua API wrapper with advanced features and top notch performance" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/ThePhD/sol2" + topics = ("lua", "c++", "bindings", "scripting") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + options = { + "with_lua": ["lua", "luajit"], + } + + default_options = { + "with_lua": "lua", + } + + @property + def _min_cppstd(self): + if Version(self.version) < "3.0.0": + # v2.x.x only requires C++14 + return "14" + else: + # v3.x.x and soon v4.x.x requires C++17 + return "17" + + @property + def _compilers_minimum_version(self): + return { + "14": { + "Visual Studio": "14", + "msvc": "190", + "gcc": "5", + "clang": "3.2", + "apple-clang": "4.3", + }, + "17": { + "Visual Studio": "15" if Version(self.version) < "3.3.0" else "16", + "msvc": "191" if Version(self.version) < "3.3.0" else "192", + "gcc": "7", + "clang": "6", + "apple-clang": "10", + }, + }.get(self._min_cppstd, {}) + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + if self.options.with_lua == "lua": + if Version(self.version) < "3.1.0": + # v2.x.x & v3.0.x supports up to Lua 5.3 + self.requires("lua/5.3.6") + else: + self.requires("lua/5.4.4") + elif self.options.with_lua == "luajit": + self.requires("luajit/2.1.0-beta3") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if Version(self.version) < "3.0.0": + copy(self, "*", src=os.path.join(self.source_folder, "sol"), dst=os.path.join(self.package_folder, "include", "sol")) + copy(self, "sol.hpp", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + else: + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.set_property("pkg_config_name", "sol2") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + if self.options.with_lua == "lua": + if self.dependencies["lua"].options.compile_as_cpp: + self.cpp_info.defines.append("SOL_USING_CXX_LUA=1") + self.cpp_info.requires.append("lua::lua") + elif self.options.with_lua == "luajit": + self.cpp_info.defines.append("SOL_LUAJIT") + self.cpp_info.requires.append("luajit::luajit") diff --git a/recipes/sol2/all/test_package/CMakeLists.txt b/recipes/sol2/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..448e42cbd7124 --- /dev/null +++ b/recipes/sol2/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(sol2 REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +target_link_libraries(${PROJECT_NAME} PRIVATE sol2::sol2) + +if(${sol2_CONSIDERED_VERSIONS} VERSION_GREATER_EQUAL "3.0.0") + # include path of sol.hpp is different in v2.x.x + target_compile_definitions(${PROJECT_NAME} PRIVATE SOL2_V3) +endif() diff --git a/recipes/sol2/all/test_package/conanfile.py b/recipes/sol2/all/test_package/conanfile.py new file mode 100644 index 0000000000000..c674a0b897ea4 --- /dev/null +++ b/recipes/sol2/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualRunEnv", "CMakeToolchain", "CMakeDeps" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sol2/all/test_package/test_package.cpp b/recipes/sol2/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..7776234280248 --- /dev/null +++ b/recipes/sol2/all/test_package/test_package.cpp @@ -0,0 +1,25 @@ +#include + +#include + +#ifdef SOL2_V3 +#include +#else +#include +#endif + +int main() { + sol::state lua; + + auto bob_table = lua.create_table("bob"); + bob_table.set("is_set", 42); + + int is_set = bob_table.get_or("is_set", 3); + int is_not_set = bob_table.get_or("is_not_set", 22); + + if (is_set != 42 || is_not_set != 22) { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/recipes/sol2/all/test_v1_package/CMakeLists.txt b/recipes/sol2/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..db5ac2a1312e0 --- /dev/null +++ b/recipes/sol2/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,7 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/sol2/all/test_v1_package/conanfile.py b/recipes/sol2/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/sol2/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/sol2/config.yml b/recipes/sol2/config.yml index 192c933dc9f53..28097c1cf11a2 100644 --- a/recipes/sol2/config.yml +++ b/recipes/sol2/config.yml @@ -1,15 +1,9 @@ versions: "3.3.0": - folder: "3.x.x" + folder: "all" "3.2.3": - folder: "3.x.x" - "3.2.2": - folder: "3.x.x" - "3.2.1": - folder: "3.x.x" - "3.2.0": - folder: "3.x.x" + folder: "all" "3.0.3": - folder: "3.x.x" + folder: "all" "2.20.6": - folder: "2.x.x" + folder: "all" diff --git a/recipes/sole/all/conandata.yml b/recipes/sole/all/conandata.yml index d08464479020e..865e82c642edb 100644 --- a/recipes/sole/all/conandata.yml +++ b/recipes/sole/all/conandata.yml @@ -1,7 +1,17 @@ sources: + "1.0.4": + url: "https://github.com/r-lyeh-archived/sole/archive/1.0.4.tar.gz" + sha256: "2801bd0d275903bfa1086901eb887cfde844bafe5beea6c2a57f28de4e0540cc" "1.0.2": url: "https://github.com/r-lyeh-archived/sole/archive/1.0.2.tar.gz" sha256: "ff82a1d6071cbc9c709864266210ddedecdb2b1e507ac5e7c4290ca6453e89b3" "1.0.1": sha256: 6b65a36df01b10079716288af530642cbe49abb2805ded1984c6564f471296bf url: https://github.com/r-lyeh-archived/sole/archive/refs/tags/1.0.1.tar.gz + +patches: + "1.0.4": + - patch_file: "patches/1.0.4-0001-fix-clang-error.patch" + patch_description: "fix compilation error on clang/apple-clang" + patch_type: "backport" + patch_source: "https://github.com/r-lyeh-archived/sole/issues/42" diff --git a/recipes/sole/all/conanfile.py b/recipes/sole/all/conanfile.py index 2c2c0d5498dab..e15d1c06c6dc1 100644 --- a/recipes/sole/all/conanfile.py +++ b/recipes/sole/all/conanfile.py @@ -1,39 +1,54 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout + import os +required_conan_version = ">=1.52.0" class SoleConan(ConanFile): name = "sole" - homepage = "https://github.com/r-lyeh-archived/sole" description = "Sole is a lightweight C++11 library to generate universally unique identificators (UUID), both v1 and v4." - topics = ("conan", "uuid", "header-only") - url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler" - no_copy_source = True license = "Zlib" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/r-lyeh-archived/sole" + topics = ("uuid", "header-only") + settings = "os", "arch", "compiler", "build_type" + + def export_sources(self): + export_conandata_patches(self) - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") - def configure(self): + def package_id(self): + self.info.clear() + + def validate(self): if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_name = "sole-" + self.version - os.rename(extracted_name, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + apply_conandata_patches(self) def package(self): - self.copy(pattern="LICENSE", dst="licenses", - src=self._source_subfolder) - self.copy(pattern="*.hpp", dst="include", - src=self._source_subfolder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs.append("rt") - - def package_id(self): - self.info.header_only() diff --git a/recipes/sole/all/patches/1.0.4-0001-fix-clang-error.patch b/recipes/sole/all/patches/1.0.4-0001-fix-clang-error.patch new file mode 100644 index 0000000000000..8e11dd3c1348b --- /dev/null +++ b/recipes/sole/all/patches/1.0.4-0001-fix-clang-error.patch @@ -0,0 +1,30 @@ +diff --git a/sole.hpp b/sole.hpp +index 8673774..35f2524 100644 +--- a/sole.hpp ++++ b/sole.hpp +@@ -201,6 +201,14 @@ namespace std { + # define $msvc $yes + #endif + ++#ifdef _MSC_VER ++# define $thread __declspec(thread) ++#elif defined __clang__ ++# define $thread thread_local ++#else ++# define $thread __thread ++#endif ++ + #if defined(__GNUC__) && (__GNUC__ * 10000 + __GNUC_MINOR__ * 100 < 50100) + namespace std + { +@@ -665,8 +673,8 @@ namespace sole { + // UUID implementations + + inline uuid uuid4() { +- static $msvc(__declspec(thread)) $melse(__thread) std::random_device rd; +- static $msvc(__declspec(thread)) $melse(__thread) std::uniform_int_distribution dist(0, (uint64_t)(~0)); ++ static $thread std::random_device rd; ++ static $thread std::uniform_int_distribution dist(0, (uint64_t)(~0)); + + uuid my; + diff --git a/recipes/sole/config.yml b/recipes/sole/config.yml index 58d16eae7aa8f..c97d810195d0f 100644 --- a/recipes/sole/config.yml +++ b/recipes/sole/config.yml @@ -1,4 +1,6 @@ versions: + "1.0.4": + folder: all "1.0.2": folder: all "1.0.1": diff --git a/recipes/sophus/all/conandata.yml b/recipes/sophus/all/conandata.yml index ec1a0a9c4fc2e..cc44a93d24470 100644 --- a/recipes/sophus/all/conandata.yml +++ b/recipes/sophus/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "22.10": + url: "https://github.com/strasdat/Sophus/archive/refs/tags/v22.10.tar.gz" + sha256: "270709b83696da179447cf743357e36a8b9bc8eed5ff4b9d66d33fe691010bad" "22.04.1": url: "https://github.com/strasdat/Sophus/archive/refs/tags/v22.04.1.tar.gz" sha256: "635dc536e7768c91e89d537608226b344eef901b51fbc51c9f220c95feaa0b54" diff --git a/recipes/sophus/all/conanfile.py b/recipes/sophus/all/conanfile.py index de0219b9e8d9a..6b71153ca9340 100644 --- a/recipes/sophus/all/conanfile.py +++ b/recipes/sophus/all/conanfile.py @@ -26,7 +26,9 @@ class SophusConan(ConanFile): def requirements(self): self.requires("eigen/3.4.0") - if self.options.with_fmt and Version(self.version) >= Version("22.04.1"): + if self.options.with_fmt and Version(self.version) >= Version("22.10"): + self.requires("fmt/9.1.0") + elif self.options.with_fmt and Version(self.version) >= Version("22.04.1"): self.requires("fmt/8.1.1") def package_id(self): diff --git a/recipes/sophus/all/test_v1_package/conanfile.py b/recipes/sophus/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/sophus/all/test_v1_package/conanfile.py +++ b/recipes/sophus/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/sophus/config.yml b/recipes/sophus/config.yml index 2994f26022b9b..89d44f82139c3 100644 --- a/recipes/sophus/config.yml +++ b/recipes/sophus/config.yml @@ -1,4 +1,6 @@ versions: + "22.10": + folder: all "22.04.1": folder: all "1.0.0": diff --git a/recipes/soundtouch/all/conandata.yml b/recipes/soundtouch/all/conandata.yml new file mode 100644 index 0000000000000..ed99d82ff219b --- /dev/null +++ b/recipes/soundtouch/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "2.3.2": + url: "https://www.surina.net/soundtouch/soundtouch-2.3.2.tar.gz" + sha256: "3bde8ddbbc3661f04e151f72cf21ca9d8f8c88e265833b65935b8962d12d6b08" diff --git a/recipes/soundtouch/all/conanfile.py b/recipes/soundtouch/all/conanfile.py new file mode 100644 index 0000000000000..dd8ee78498090 --- /dev/null +++ b/recipes/soundtouch/all/conanfile.py @@ -0,0 +1,113 @@ +from conan import ConanFile +from conan.tools.microsoft import is_msvc +from conan.tools.files import get, copy, rm, rmdir +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + +class SoundTouchConan(ConanFile): + name = "soundtouch" + description = "an open-source audio processing library that allows changing the sound tempo, pitch and playback rate parameters independently" + license = "LGPL-2.1-or-later" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://codeberg.org/soundtouch/soundtouch" + topics = ("audio", "processing", "tempo", "pitch", "playback") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "integer_samples": [True, False], + "with_openmp": [True, False], + "with_dll": [True, False], + "with_util": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "integer_samples": False, + "with_openmp": False, + "with_dll": False, + "with_util": False, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["INTEGER_SAMPLES"] = self.options.integer_samples + tc.variables["SOUNDTOUCH_DLL"] = self.options.with_dll + tc.variables["SOUNDSTRETCH"] = self.options.with_util + tc.variables["OPENMP"] = self.options.with_openmp + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="COPYING.TXT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "SoundTouch") + + self.cpp_info.components["_soundtouch"].set_property("cmake_target_name", "SoundTouch::SoundTouch") + self.cpp_info.components["_soundtouch"].set_property("pkg_config_name", "soundtouch") + self.cpp_info.components["_soundtouch"].libs = ["SoundTouch"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["_soundtouch"].system_libs.append("m") + if not self.options.shared and self.options.with_openmp: + openmp_flags = [] + if is_msvc(self): + openmp_flags = ["-openmp"] + elif self.settings.compiler in ("gcc", "clang"): + openmp_flags = ["-fopenmp"] + elif self.settings.compiler == "apple-clang": + openmp_flags = ["-Xpreprocessor", "-fopenmp"] + self.cpp_info.components["_soundtouch"].sharedlinkflags = openmp_flags + self.cpp_info.components["_soundtouch"].exelinkflags = openmp_flags + + if self.options.with_dll: + self.cpp_info.components["SoundTouchDLL"].set_property("cmake_target_name", "SoundTouch::SoundTouchDLL") + self.cpp_info.components["SoundTouchDLL"].libs = ["SoundTouchDLL"] + self.cpp_info.components["SoundTouchDLL"].requires = ["_soundtouch"] + + if self.options.with_util: + bin_path = os.path.join(self.package_folder, "bin") + self.output.info(f"Appending PATH environment variable: {bin_path}") + self.env_info.PATH.append(bin_path) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.names["cmake_find_package"] = "SoundTouch" + self.cpp_info.names["cmake_find_package_multi"] = "SoundTouch" + self.cpp_info.components["_soundtouch"].names["cmake_find_package"] = "SoundTouch" + self.cpp_info.components["_soundtouch"].names["cmake_find_package_multi"] = "SoundTouch" + self.cpp_info.names["pkg_config"] = "SoundTouch" + if self.options.with_dll: + self.cpp_info.components["SoundTouchDLL"].names["cmake_find_package"] = "SoundTouchDLL" + self.cpp_info.components["SoundTouchDLL"].names["cmake_find_package_multi"] = "SoundTouchDLL" + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("mvec") diff --git a/recipes/soundtouch/all/test_package/CMakeLists.txt b/recipes/soundtouch/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..a768ac666be33 --- /dev/null +++ b/recipes/soundtouch/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package LANGUAGES CXX) + +find_package(SoundTouch REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE SoundTouch::SoundTouch) diff --git a/recipes/soundtouch/all/test_package/conanfile.py b/recipes/soundtouch/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/soundtouch/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/soundtouch/all/test_package/test_package.cpp b/recipes/soundtouch/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..adcc0038ccd4c --- /dev/null +++ b/recipes/soundtouch/all/test_package/test_package.cpp @@ -0,0 +1,17 @@ +#include + +#include "soundtouch/SoundTouch.h" + +int main(int argc, char* argv[]) { + std::cout << "SoundTouch: " << soundtouch::SoundTouch::getVersionString() << "\n"; + + soundtouch::SoundTouch soundTouch; + soundTouch.setRate(0.5); + soundTouch.setTempo(1.5); + soundTouch.setPitch(0.8); + soundTouch.setChannels(2); + + soundTouch.flush(); + + return 0; +} diff --git a/recipes/soundtouch/all/test_v1_package/CMakeLists.txt b/recipes/soundtouch/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/soundtouch/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/soundtouch/all/test_v1_package/conanfile.py b/recipes/soundtouch/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/soundtouch/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/soundtouch/config.yml b/recipes/soundtouch/config.yml new file mode 100644 index 0000000000000..aee8de619ec30 --- /dev/null +++ b/recipes/soundtouch/config.yml @@ -0,0 +1,3 @@ +versions: + "2.3.2": + folder: all diff --git a/recipes/soxr/all/CMakeLists.txt b/recipes/soxr/all/CMakeLists.txt deleted file mode 100644 index a8752cbde5db2..0000000000000 --- a/recipes/soxr/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/soxr/all/conandata.yml b/recipes/soxr/all/conandata.yml index 08e976f23c290..0a8d60906029b 100644 --- a/recipes/soxr/all/conandata.yml +++ b/recipes/soxr/all/conandata.yml @@ -4,7 +4,9 @@ sources: sha256: "b111c15fdc8c029989330ff559184198c161100a59312f5dc19ddeb9b5a15889" patches: "0.1.3": - - base_path: source_subfolder - patch_file: "patches/findpackage-openmp.patch" - - base_path: source_subfolder - patch_file: "patches/cmake-source-dir.patch" + - patch_file: "patches/findpackage-openmp.patch" + patch_description: make OpenMP required to fail when not found + patch_type: conan + - patch_file: "patches/cmake-source-dir.patch" + patch_description: point to the right source dir + patch_type: conan diff --git a/recipes/soxr/all/conanfile.py b/recipes/soxr/all/conanfile.py index 78d30ad3efdeb..164b08b7e952d 100644 --- a/recipes/soxr/all/conanfile.py +++ b/recipes/soxr/all/conanfile.py @@ -1,10 +1,12 @@ -import functools import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, save, rmdir from conan.tools.microsoft import msvc_runtime_flag, is_msvc +from conan.tools.scm import Version -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.53.0" class SoxrConan(ConanFile): @@ -27,20 +29,9 @@ class SoxrConan(ConanFile): "with_openmp": False, "with_lsr_bindings": True } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -48,48 +39,58 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + if Version(self.version) < "3.21": + # silence warning + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0115"] = "OLD" if is_msvc(self): - cmake.definitions["BUILD_SHARED_RUNTIME"] = msvc_runtime_flag(self) == "MD" - cmake.definitions["BUILD_TESTS"] = False - cmake.definitions["WITH_OPENMP"] = self.options.with_openmp - cmake.definitions["WITH_LSR_BINDINGS"] = self.options.with_lsr_bindings - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["BUILD_SHARED_RUNTIME"] = msvc_runtime_flag(self) == "MD" + # Disable SIMD based resample engines for Apple Silicon and iOS ARMv8 architecture + if (self.settings.os == "Macos" or self.settings.os == "iOS") and self.settings.arch == "armv8": + tc.variables["WITH_CR32S"] = False + tc.variables["WITH_CR64S"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["WITH_OPENMP"] = self.options.with_openmp + tc.variables["WITH_LSR_BINDINGS"] = self.options.with_lsr_bindings + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def _extract_pffft_license(self): - pffft_c = tools.load(os.path.join(self._source_subfolder, "src", "pffft.c")) + pffft_c = load(self, os.path.join(self.source_folder, "src", "pffft.c")) license_contents = pffft_c[pffft_c.find("/* Copyright")+3:pffft_c.find("modern CPUs.")+13] - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_contents) def package(self): - self.copy("LICENCE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENCE", dst="licenses", src=self.source_folder) self._extract_pffft_license() - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "doc")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "doc")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): # core component - self.cpp_info.components["core"].names["pkg_config"] = "soxr" + self.cpp_info.components["core"].set_property("pkg_config_name", "soxr") self.cpp_info.components["core"].libs = ["soxr"] if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.components["core"].system_libs = ["m"] @@ -108,7 +109,7 @@ def package_info(self): self.cpp_info.components["core"].sharedlinkflags = openmp_flags # lsr component if self.options.with_lsr_bindings: - self.cpp_info.components["lsr"].names["pkg_config"] = "soxr-lsr" + self.cpp_info.components["lsr"].set_property("pkg_config_name", "soxr-lsr") self.cpp_info.components["lsr"].libs = ["soxr-lsr"] if self.settings.os == "Windows" and self.options.shared: self.cpp_info.components["lsr"].defines.append("SOXR_DLL") diff --git a/recipes/soxr/all/test_package/CMakeLists.txt b/recipes/soxr/all/test_package/CMakeLists.txt index 1bade61abc3e3..15fbee53fe227 100644 --- a/recipes/soxr/all/test_package/CMakeLists.txt +++ b/recipes/soxr/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(soxr CONFIG REQUIRED) add_executable(test_package_core test_package_core.c) diff --git a/recipes/soxr/all/test_package/conanfile.py b/recipes/soxr/all/test_package/conanfile.py index f8d479ac7b138..f17b6879e97ea 100644 --- a/recipes/soxr/all/test_package/conanfile.py +++ b/recipes/soxr/all/test_package/conanfile.py @@ -1,9 +1,35 @@ import os -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import yaml + class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + _tests_todo = [] + + @property + def _todos_filename(self): + return os.path.join(self.recipe_folder, self.folders.generators, "soxr_test_to_do.yml") + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + # note: this is required as self.dependencies is not available in test() + self._tests_todo.append("test_package_core") + if self.dependencies[self.tested_reference_str].options.with_lsr_bindings: + self._tests_todo.append("test_package_lsr") + + with open(self._todos_filename, "w", encoding="utf-8") as file: + yaml.dump(self._tests_todo, file) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,11 +37,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - # core component - bin_path = os.path.join("bin", "test_package_core") - self.run(bin_path, run_environment=True) - # lsr component - if self.options["soxr"].with_lsr_bindings: - bin_path = os.path.join("bin", "test_package_lsr") - self.run(bin_path, run_environment=True) + with open(self._todos_filename, "r", encoding="utf-8") as file: + self._tests_todo = yaml.safe_load(file) + if can_run(self): + for test_name in self._tests_todo: + self.run(os.path.join(self.cpp.build.bindirs[0], test_name), env="conanrun") diff --git a/recipes/soxr/all/test_v1_package/CMakeLists.txt b/recipes/soxr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..1bade61abc3e3 --- /dev/null +++ b/recipes/soxr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(soxr CONFIG REQUIRED) + +add_executable(test_package_core test_package_core.c) +target_link_libraries(test_package_core soxr::core) + +if(TARGET soxr::lsr) + add_executable(test_package_lsr test_package_lsr.c) + target_link_libraries(test_package_lsr soxr::lsr) +endif() diff --git a/recipes/soxr/all/test_v1_package/conanfile.py b/recipes/soxr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..f8d479ac7b138 --- /dev/null +++ b/recipes/soxr/all/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +import os +from conans import ConanFile, CMake, tools + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + # core component + bin_path = os.path.join("bin", "test_package_core") + self.run(bin_path, run_environment=True) + # lsr component + if self.options["soxr"].with_lsr_bindings: + bin_path = os.path.join("bin", "test_package_lsr") + self.run(bin_path, run_environment=True) diff --git a/recipes/soxr/all/test_v1_package/test_package_core.c b/recipes/soxr/all/test_v1_package/test_package_core.c new file mode 100644 index 0000000000000..3a249a2ce9e47 --- /dev/null +++ b/recipes/soxr/all/test_v1_package/test_package_core.c @@ -0,0 +1,7 @@ +#include +#include + +int main() { + printf("soxr version: %s\n", soxr_version()); + return 0; +} diff --git a/recipes/soxr/all/test_v1_package/test_package_lsr.c b/recipes/soxr/all/test_v1_package/test_package_lsr.c new file mode 100644 index 0000000000000..bfada78fa0a8c --- /dev/null +++ b/recipes/soxr/all/test_v1_package/test_package_lsr.c @@ -0,0 +1,7 @@ +#include +#include + +int main() { + printf("soxr-lsr version: %s\n", src_get_version()); + return 0; +} diff --git a/recipes/span-lite/all/conanfile.py b/recipes/span-lite/all/conanfile.py index 13ce9fedf5fa1..a3cdfec98fc6a 100644 --- a/recipes/span-lite/all/conanfile.py +++ b/recipes/span-lite/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class SpanLiteConan(ConanFile): @@ -14,24 +16,29 @@ class SpanLiteConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "span-lite") self.cpp_info.set_property("cmake_target_name", "nonstd::span-lite") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "span-lite" @@ -41,3 +48,6 @@ def package_info(self): self.cpp_info.components["spanlite"].names["cmake_find_package"] = "span-lite" self.cpp_info.components["spanlite"].names["cmake_find_package_multi"] = "span-lite" self.cpp_info.components["spanlite"].set_property("cmake_target_name", "nonstd::span-lite") + self.cpp_info.components["spanlite"].bindirs = [] + self.cpp_info.components["spanlite"].libdirs = [] + self.cpp_info.components["spanlite"].resdirs = [] diff --git a/recipes/span-lite/all/test_package/CMakeLists.txt b/recipes/span-lite/all/test_package/CMakeLists.txt index 011059b1a567b..d8392ded7dfb5 100644 --- a/recipes/span-lite/all/test_package/CMakeLists.txt +++ b/recipes/span-lite/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(span-lite REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} nonstd::span-lite) +target_link_libraries(${PROJECT_NAME} PRIVATE nonstd::span-lite) diff --git a/recipes/span-lite/all/test_package/conanfile.py b/recipes/span-lite/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/span-lite/all/test_package/conanfile.py +++ b/recipes/span-lite/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/span-lite/all/test_v1_package/CMakeLists.txt b/recipes/span-lite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b91df846606c0 --- /dev/null +++ b/recipes/span-lite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(span-lite REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE nonstd::span-lite) diff --git a/recipes/span-lite/all/test_v1_package/conanfile.py b/recipes/span-lite/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/span-lite/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/spdlog/all/conandata.yml b/recipes/spdlog/all/conandata.yml index fccb62b7d9c1e..60c6a1f3b520c 100644 --- a/recipes/spdlog/all/conandata.yml +++ b/recipes/spdlog/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.11.0": + url: "https://github.com/gabime/spdlog/archive/v1.11.0.tar.gz" + sha256: "ca5cae8d6cac15dae0ec63b21d6ad3530070650f68076f3a4a862ca293a858bb" "1.10.0": url: "https://github.com/gabime/spdlog/archive/v1.10.0.tar.gz" sha256: "697f91700237dbae2326b90469be32b876b2b44888302afbc7aceb68bcfe8224" diff --git a/recipes/spdlog/all/conanfile.py b/recipes/spdlog/all/conanfile.py index 587094502d41f..2fd0bf83cfde6 100644 --- a/recipes/spdlog/all/conanfile.py +++ b/recipes/spdlog/all/conanfile.py @@ -1,26 +1,22 @@ from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout from conan.tools.files import get, copy, rmdir, replace_in_file -from conan.tools.scm import Version from conan.tools.microsoft import is_msvc_static_runtime -from conan.tools.build import check_min_cppstd -from conan.errors import ConanInvalidConfiguration - -# TODO: Need to be ported for Conan 2.0 -from conans import __version__ as conan_version - +from conan.tools.scm import Version import os - -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class SpdlogConan(ConanFile): name = "spdlog" + package_type = "library" description = "Fast C++ logging library" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/gabime/spdlog" - topics = ("logging", "log-filtering", "header-only") + topics = ("logger", "logging", "log-filtering", "file sink", "header-only") license = "MIT" settings = "os", "arch", "compiler", "build_type" options = { @@ -45,49 +41,43 @@ def config_options(self): del self.options.fPIC def configure(self): - if self.options.shared: - del self.options.fPIC + if self.options.shared or self.options.header_only: + self.options.rm_safe("fPIC") if self.options.header_only: del self.options.shared - del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - # TODO: Remove in Conan 2.0 - 1.x self.requires does not support transitive_headers - requires = lambda ref: self.requires(ref, transitive_headers=True) if Version(conan_version) >= "2.0.0-beta" else self.requires(ref) - if Version(self.version) >= "1.10.0": - requires("fmt/8.1.1") - elif Version(self.version) >= "1.9.0": - requires("fmt/8.0.1") - elif Version(self.version) >= "1.7.0": - requires("fmt/7.1.3") - elif Version(self.version) >= "1.5.0": - requires("fmt/6.2.1") - else: - requires("fmt/6.0.0") + self_version = Version(self.version) + fmt_version = "7.1.3" + + if self_version >= "1.11.0": + fmt_version = "9.1.0" + elif self_version >= "1.10.0": + fmt_version = "8.1.1" + elif self_version >= "1.9.0": + fmt_version = "8.0.1" + elif self_version >= "1.7.0": + fmt_version = "7.1.3" + + self.requires(f"fmt/{fmt_version}", transitive_headers=True, transitive_libs=True) def package_id(self): if self.info.options.header_only: self.info.clear() def validate(self): - # FIXME: Conan 1.x is not able to parse self.info.xxx as Conan 2.x when is header-only - if Version(conan_version) >= "2.0.0-beta": - if self.info.settings.compiler.cppstd: - check_min_cppstd(self, 11) - if self.info.settings.os != "Windows" and (self.info.options.wchar_support or self.info.options.wchar_filenames): - raise ConanInvalidConfiguration("wchar is only supported under windows") - if not self.info.options.header_only and self.info.options.shared and is_msvc_static_runtime(self): - raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") - else: - if self.settings.compiler.cppstd: - check_min_cppstd(self, 11) - if self.settings.os != "Windows" and (self.options.wchar_support or self.options.wchar_filenames): - raise ConanInvalidConfiguration("wchar is only supported under windows") - if self.options.get_safe("shared") and is_msvc_static_runtime(self): - raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, 11) + if self.settings.os != "Windows" and (self.options.wchar_support or self.options.wchar_filenames): + raise ConanInvalidConfiguration("wchar is only supported under windows") + if self.options.get_safe("shared") and is_msvc_static_runtime(self): + raise ConanInvalidConfiguration("Visual Studio build for shared library with MT runtime is not supported") def source(self): - get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): if not self.options.header_only: @@ -98,7 +88,7 @@ def generate(self): tc.variables["SPDLOG_BUILD_TESTS"] = False tc.variables["SPDLOG_BUILD_TESTS_HO"] = False tc.variables["SPDLOG_BUILD_BENCH"] = False - tc.variables["SPDLOG_FMT_EXTERNAL"] = True + tc.variables["SPDLOG_FMT_EXTERNAL"] = not fmt.options.header_only tc.variables["SPDLOG_FMT_EXTERNAL_HO"] = fmt.options.header_only tc.variables["SPDLOG_BUILD_SHARED"] = not self.options.header_only and self.options.shared tc.variables["SPDLOG_WCHAR_SUPPORT"] = self.options.wchar_support @@ -112,9 +102,6 @@ def generate(self): cmake_deps = CMakeDeps(self) cmake_deps.generate() - def layout(self): - cmake_layout(self, src_folder="src") - def _disable_werror(self): replace_in_file(self, os.path.join(self.source_folder, "cmake", "utils.cmake"), "/WX", "") @@ -137,21 +124,13 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "lib", "spdlog", "cmake")) def package_info(self): - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.names["cmake_find_package"] = "spdlog" - self.cpp_info.names["cmake_find_package_multi"] = "spdlog" - target = "spdlog_header_only" if self.options.header_only else "spdlog" self.cpp_info.set_property("cmake_file_name", "spdlog") self.cpp_info.set_property("cmake_target_name", f"spdlog::{target}") self.cpp_info.set_property("pkg_config_name", "spdlog") - # TODO: to remove in conan v2 once cmake_find_package* generators removed - self.cpp_info.components["libspdlog"].names["cmake_find_package"] = target - self.cpp_info.components["libspdlog"].names["cmake_find_package_multi"] = target - + # TODO: back to global scope in conan v2 once legacy generators removed self.cpp_info.components["libspdlog"].set_property("cmake_target_name", f"spdlog::{target}") - self.cpp_info.components["libspdlog"].defines.append("SPDLOG_FMT_EXTERNAL") self.cpp_info.components["libspdlog"].requires = ["fmt::fmt"] @@ -169,3 +148,8 @@ def package_info(self): self.cpp_info.components["libspdlog"].system_libs = ["pthread"] if self.options.header_only and self.settings.os in ("iOS", "tvOS", "watchOS"): self.cpp_info.components["libspdlog"].defines.append("SPDLOG_NO_TLS") + + self.cpp_info.names["cmake_find_package"] = "spdlog" + self.cpp_info.names["cmake_find_package_multi"] = "spdlog" + self.cpp_info.components["libspdlog"].names["cmake_find_package"] = target + self.cpp_info.components["libspdlog"].names["cmake_find_package_multi"] = target diff --git a/recipes/spdlog/all/test_package/CMakeLists.txt b/recipes/spdlog/all/test_package/CMakeLists.txt index ea09f0379c1df..d31b151d6390c 100644 --- a/recipes/spdlog/all/test_package/CMakeLists.txt +++ b/recipes/spdlog/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(spdlog REQUIRED CONFIG) @@ -9,4 +9,4 @@ if(SPDLOG_HEADER_ONLY) else() target_link_libraries(${PROJECT_NAME} PUBLIC spdlog::spdlog) endif() -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/spdlog/all/test_package/conanfile.py b/recipes/spdlog/all/test_package/conanfile.py index 955c3ad982c55..81d7c956cf9d2 100644 --- a/recipes/spdlog/all/test_package/conanfile.py +++ b/recipes/spdlog/all/test_package/conanfile.py @@ -7,9 +7,12 @@ class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv" + generators = "CMakeDeps", "VirtualRunEnv" test_type = "explicit" + def layout(self): + cmake_layout(self) + def requirements(self): self.requires(self.tested_reference_str) @@ -18,9 +21,6 @@ def generate(self): tc.variables["SPDLOG_HEADER_ONLY"] = self.dependencies["spdlog"].options.header_only tc.generate() - def layout(self): - cmake_layout(self) - def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/spdlog/all/test_v1_package/CMakeLists.txt b/recipes/spdlog/all/test_v1_package/CMakeLists.txt index cd849cdc0106b..0d20897301b68 100644 --- a/recipes/spdlog/all/test_v1_package/CMakeLists.txt +++ b/recipes/spdlog/all/test_v1_package/CMakeLists.txt @@ -1,15 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(spdlog REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -if(TARGET spdlog::spdlog_header_only) - target_link_libraries(${PROJECT_NAME} spdlog::spdlog_header_only) -else() - target_link_libraries(${PROJECT_NAME} spdlog::spdlog) -endif() -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/spdlog/all/test_v1_package/conanfile.py b/recipes/spdlog/all/test_v1_package/conanfile.py index 7f150735d0b8a..30ca1d12b0933 100644 --- a/recipes/spdlog/all/test_v1_package/conanfile.py +++ b/recipes/spdlog/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/spdlog/config.yml b/recipes/spdlog/config.yml index 24e67aae83c2a..2efd56b833781 100644 --- a/recipes/spdlog/config.yml +++ b/recipes/spdlog/config.yml @@ -1,4 +1,6 @@ versions: + "1.11.0": + folder: "all" "1.10.0": folder: "all" "1.9.2": diff --git a/recipes/spectra/all/conanfile.py b/recipes/spectra/all/conanfile.py index e12330a0bf9d0..084f85d8c4950 100644 --- a/recipes/spectra/all/conanfile.py +++ b/recipes/spectra/all/conanfile.py @@ -1,45 +1,53 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" class SpectraConan(ConanFile): name = "spectra" description = "A header-only C++ library for large scale eigenvalue problems." license = "MPL-2.0" - topics = ("spectra", "eigenvalue", "header-only") + topics = ("eigenvalue", "header-only") homepage = "https://spectralib.org" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("eigen/3.4.0") + def package_id(self): + self.info.clear() + def validate(self): - if tools.Version(self.version) >= "1.0.0": + if Version(self.version) >= "1.0.0": if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "spectra") self.cpp_info.set_property("cmake_target_name", "Spectra::Spectra") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") diff --git a/recipes/spectra/all/test_package/CMakeLists.txt b/recipes/spectra/all/test_package/CMakeLists.txt index 9bd0484914641..c68917e8a8c64 100644 --- a/recipes/spectra/all/test_package/CMakeLists.txt +++ b/recipes/spectra/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(spectra REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Spectra::Spectra) +target_link_libraries(${PROJECT_NAME} PRIVATE Spectra::Spectra) if(spectra_VERSION VERSION_LESS "1.0.0") target_compile_definitions(${PROJECT_NAME} PRIVATE "SPECTRA_LESS_1_0_0") else() - set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) endif() diff --git a/recipes/spectra/all/test_package/conanfile.py b/recipes/spectra/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/spectra/all/test_package/conanfile.py +++ b/recipes/spectra/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/spectra/all/test_v1_package/CMakeLists.txt b/recipes/spectra/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/spectra/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/spectra/all/test_v1_package/conanfile.py b/recipes/spectra/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/spectra/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/spirv-cross/all/conandata.yml b/recipes/spirv-cross/all/conandata.yml index 775d8d9eb7bd0..d26a37df30e55 100644 --- a/recipes/spirv-cross/all/conandata.yml +++ b/recipes/spirv-cross/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "1.3.239.0": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.239.0.tar.gz" + sha256: "a1695022880e7ef3c2d407647f79876045dc2a3ed012753adc71ead5cc5178ba" + "1.3.236.0": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "8140a2b53d1e218e9be1f8d5e2749b1ebe854d456e5cb356218fd288747d5438" + "1.3.231.1": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "3b42f5b6e46b45600e09fd55234f59edb7cfca803e49d7830dc6fb5a086143b1" + "1.3.224.0": + url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.224.0.tar.gz" + sha256: "00256c33e235c5b9f0fc4b531fb9058d3cf1ff53e21e2db62cd8db848525536c" "1.3.216.0": url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/refs/tags/sdk-1.3.216.0.tar.gz" sha256: "dd66ce2f9e6d3b9b8055662ac25172fa5559603f2f23c1a178c74f1602de8732" @@ -36,6 +48,11 @@ sources: url: "https://github.com/KhronosGroup/SPIRV-Cross/archive/2020-04-03.tar.gz" sha256: "93f3a6dfad17c9ca0bf4d2d80809e90118e13b47502eb395baba8784025d7e97" patches: + "1.3.236.0": + - patch_file: "patches/1.3.236.0-0001-fix-gcc5.patch" + patch_description: "Fix compilation with gcc-5" + patch_type: "portability" + base_path: "source_subfolder" "cci.20210621": - patch_file: "patches/0001-fix-bundle-install-cci.20210621.patch" base_path: "source_subfolder" diff --git a/recipes/spirv-cross/all/conanfile.py b/recipes/spirv-cross/all/conanfile.py index 293e94489d389..30a688b542978 100644 --- a/recipes/spirv-cross/all/conanfile.py +++ b/recipes/spirv-cross/all/conanfile.py @@ -1,9 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rm, rmdir, save +from conans import CMake, tools as tools_legacy import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class SpirvCrossConan(ConanFile): @@ -57,9 +59,8 @@ def _build_subfolder(self): return "build_subfolder" def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -72,18 +73,20 @@ def configure(self): del self.options.c_api del self.options.util + def layout(self): + pass + def validate(self): - if not self.options.glsl and \ - (self.options.hlsl or self.options.msl or self.options.cpp or self.options.reflect): + if not self.info.options.glsl and \ + (self.info.options.hlsl or self.info.options.msl or self.info.options.cpp or self.info.options.reflect): raise ConanInvalidConfiguration("hlsl, msl, cpp and reflect require glsl enabled") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) cmake = self._configure_cmake() cmake.build() if self.options.build_executable and not self._are_proper_binaries_available_for_executable: @@ -137,40 +140,36 @@ def _build_exe(self): cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", src=os.path.join(self.build_folder, self._source_subfolder), dst=os.path.join(self.package_folder, "licenses")) cmake = self._configure_cmake() cmake.install() if self.options.build_executable and not self._are_proper_binaries_available_for_executable: - self.copy(pattern="spirv-cross*", dst="bin", src=os.path.join("build_subfolder_exe", "bin")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.ilk") - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + copy(self, "spirv-cross*", src=os.path.join(self.build_folder, "build_subfolder_exe", "bin"), dst=os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.ilk", os.path.join(self.package_folder, "bin")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + # TODO: to remove in conan v2 once legacy generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {target: "spirv-cross::{}".format(target) for target in self._spirv_cross_components.keys()} + {target: f"spirv-cross::{target}" for target in self._spirv_cross_components.keys()}, ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) - - @property - def _module_subfolder(self): - return os.path.join("lib", "cmake") + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join(self._module_subfolder, - "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property def _spirv_cross_components(self): @@ -210,29 +209,31 @@ def package_info(self): # FIXME: we should provide one CMake config file per target (waiting for an implementation of https://github.com/conan-io/conan/issues/9000) def _register_component(target_lib, requires): self.cpp_info.components[target_lib].set_property("cmake_target_name", target_lib) - self.cpp_info.components[target_lib].builddirs.append(self._module_subfolder) - - self.cpp_info.components[target_lib].names["cmake_find_package"] = target_lib - self.cpp_info.components[target_lib].names["cmake_find_package_multi"] = target_lib - self.cpp_info.components[target_lib].build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.components[target_lib].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - if self.options.shared: self.cpp_info.components[target_lib].set_property("pkg_config_name", target_lib) prefix = "d" if self.settings.os == "Windows" and self.settings.build_type == "Debug" else "" - self.cpp_info.components[target_lib].libs = ["{}{}".format(target_lib, prefix)] + self.cpp_info.components[target_lib].libs = [f"{target_lib}{prefix}"] self.cpp_info.components[target_lib].includedirs.append(os.path.join("include", "spirv_cross")) - self.cpp_info.components[target_lib].defines.append("SPIRV_CROSS_NAMESPACE_OVERRIDE={}".format(self.options.namespace)) + self.cpp_info.components[target_lib].defines.append(f"SPIRV_CROSS_NAMESPACE_OVERRIDE={self.options.namespace}") self.cpp_info.components[target_lib].requires = requires if self.settings.os in ["Linux", "FreeBSD"] and self.options.glsl: self.cpp_info.components[target_lib].system_libs.append("m") - if not self.options.shared and self.options.c_api and tools.stdcpp_library(self): - self.cpp_info.components[target_lib].system_libs.append(tools.stdcpp_library(self)) + if not self.options.shared and self.options.c_api: + libcxx = tools_legacy.stdcpp_library(self) + if libcxx: + self.cpp_info.components[target_lib].system_libs.append(libcxx) + + # TODO: to remove in conan v2 once legacy generators removed + self.cpp_info.components[target_lib].names["cmake_find_package"] = target_lib + self.cpp_info.components[target_lib].names["cmake_find_package_multi"] = target_lib + self.cpp_info.components[target_lib].build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.components[target_lib].build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] for target_lib, requires in self._spirv_cross_components.items(): _register_component(target_lib, requires) + # TODO: to remove in conan v2 once legacy generators removed if self.options.build_executable: bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/spirv-cross/all/patches/1.3.236.0-0001-fix-gcc5.patch b/recipes/spirv-cross/all/patches/1.3.236.0-0001-fix-gcc5.patch new file mode 100644 index 0000000000000..70c5857924141 --- /dev/null +++ b/recipes/spirv-cross/all/patches/1.3.236.0-0001-fix-gcc5.patch @@ -0,0 +1,14 @@ +--- a/spirv_glsl.cpp ++++ b/spirv_glsl.cpp +@@ -4955,9 +4955,9 @@ SmallVector CompilerGLSL::get_composite_constant_ids(ConstantID cons + if (is_array(type) || type.basetype == SPIRType::Struct) + return constant->subconstants; + if (is_matrix(type)) +- return constant->m.id; ++ return SmallVector(constant->m.id); + if (is_vector(type)) +- return constant->m.c[0].id; ++ return SmallVector(constant->m.c[0].id); + SPIRV_CROSS_THROW("Unexpected scalar constant!"); + } + if (!const_composite_insert_ids.count(const_id)) diff --git a/recipes/spirv-cross/all/test_package/CMakeLists.txt b/recipes/spirv-cross/all/test_package/CMakeLists.txt index 587f4d76d9d98..a40c4a736880a 100644 --- a/recipes/spirv-cross/all/test_package/CMakeLists.txt +++ b/recipes/spirv-cross/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) # FIXME: this is not the official way to find spirv-cross components find_package(spirv-cross REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) if(TARGET spirv-cross-c) - target_link_libraries(${PROJECT_NAME} spirv-cross-c) + target_link_libraries(${PROJECT_NAME} PRIVATE spirv-cross-c) elseif(TARGET spirv-cross-c-shared) - target_link_libraries(${PROJECT_NAME} spirv-cross-c-shared) + target_link_libraries(${PROJECT_NAME} PRIVATE spirv-cross-c-shared) endif() diff --git a/recipes/spirv-cross/all/test_package/conanfile.py b/recipes/spirv-cross/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/spirv-cross/all/test_package/conanfile.py +++ b/recipes/spirv-cross/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/spirv-cross/all/test_v1_package/CMakeLists.txt b/recipes/spirv-cross/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/spirv-cross/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/spirv-cross/all/test_v1_package/conanfile.py b/recipes/spirv-cross/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/spirv-cross/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/spirv-cross/config.yml b/recipes/spirv-cross/config.yml index 85861b575c14b..551baf7be854f 100644 --- a/recipes/spirv-cross/config.yml +++ b/recipes/spirv-cross/config.yml @@ -1,4 +1,12 @@ versions: + "1.3.239.0": + folder: all + "1.3.236.0": + folder: all + "1.3.231.1": + folder: all + "1.3.224.0": + folder: all "1.3.216.0": folder: all "1.3.211.0": diff --git a/recipes/spirv-headers/all/conandata.yml b/recipes/spirv-headers/all/conandata.yml index 196ff31da7ba7..3835feb535abd 100644 --- a/recipes/spirv-headers/all/conandata.yml +++ b/recipes/spirv-headers/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.3.239.0": + url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.239.0.tar.gz" + sha256: "fdaf6670e311cd1c08ae90bf813e89dd31630205bc60030ffd25fb0af39b51fe" + "1.3.236.0": + url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "4d74c685fdd74469eba7c224dd671a0cb27df45fc9aa43cdd90e53bd4f2b2b78" + "1.3.231.1": + url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "fc340700b005e9a2adc98475b5afbbabd1bc931f789a2afd02d54ebc22522af3" "1.3.224.0": url: "https://github.com/KhronosGroup/SPIRV-Headers/archive/refs/tags/sdk-1.3.224.0.tar.gz" sha256: "2fb1039ec6cec8943400e9b4d01d8bfe8c62a0bd1fafb7c39c56469aa247b838" diff --git a/recipes/spirv-headers/all/conanfile.py b/recipes/spirv-headers/all/conanfile.py index 63222a94c5092..852af3d493684 100644 --- a/recipes/spirv-headers/all/conanfile.py +++ b/recipes/spirv-headers/all/conanfile.py @@ -15,12 +15,12 @@ class SpirvheadersConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - def package_id(self): - self.info.clear() - def layout(self): cmake_layout(self, src_folder="src") + def package_id(self): + self.info.clear() + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -47,9 +47,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "SPIRV-Headers::SPIRV-Headers") self.cpp_info.set_property("pkg_config_name", "SPIRV-Headers") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "SPIRV-Headers" diff --git a/recipes/spirv-headers/all/test_package/conanfile.py b/recipes/spirv-headers/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/spirv-headers/all/test_package/conanfile.py +++ b/recipes/spirv-headers/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/spirv-headers/all/test_v1_package/CMakeLists.txt b/recipes/spirv-headers/all/test_v1_package/CMakeLists.txt index 0aed8ae7f92dc..0d20897301b68 100644 --- a/recipes/spirv-headers/all/test_v1_package/CMakeLists.txt +++ b/recipes/spirv-headers/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(SPIRV-Headers REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE SPIRV-Headers::SPIRV-Headers) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/spirv-headers/config.yml b/recipes/spirv-headers/config.yml index 503d23699f2be..f674ab0da7488 100644 --- a/recipes/spirv-headers/config.yml +++ b/recipes/spirv-headers/config.yml @@ -1,4 +1,10 @@ versions: + "1.3.239.0": + folder: all + "1.3.236.0": + folder: all + "1.3.231.1": + folder: all "1.3.224.0": folder: all "1.3.216.0": diff --git a/recipes/spirv-tools/all/conandata.yml b/recipes/spirv-tools/all/conandata.yml index 803c2f4c4cf9f..c55703cf513a4 100644 --- a/recipes/spirv-tools/all/conandata.yml +++ b/recipes/spirv-tools/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.3.239.0": + url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.239.0.tar.gz" + sha256: "327b2dba4515646eee28c1a5fe1332891e81c8b6ff289363f52877f3e67c2d81" + "1.3.236.0": + url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "6789c782a8ba8fa127c3d579f9362f0cdde7a9ccc2e8513cdf217bba579dfda9" + "1.3.231.1": + url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "b97df7fdac617878668762ab452ae2ae425a0f36e29711b4cc6c4ae216e32309" "1.3.224.0": url: "https://github.com/KhronosGroup/SPIRV-Tools/archive/refs/tags/sdk-1.3.224.0.tar.gz" sha256: "428b83f2710c07123cf2ec21934389f893aa0b570d1fe4aba6e38718c9a6ea69" diff --git a/recipes/spirv-tools/all/conanfile.py b/recipes/spirv-tools/all/conanfile.py index 7f8d2a0bea0dc..19f68c479aa7c 100644 --- a/recipes/spirv-tools/all/conanfile.py +++ b/recipes/spirv-tools/all/conanfile.py @@ -1,16 +1,16 @@ from conan import ConanFile from conan.errors import ConanException -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, stdcpp_library from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rm, rmdir, save +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir, save from conan.tools.scm import Version -from conans import tools as tools_legacy import functools import os import textwrap import yaml -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class SpirvtoolsConan(ConanFile): @@ -74,8 +74,7 @@ def export(self): copy(self, f"dependencies/{self._dependencies_filename}", self.recipe_folder, self.export_folder) def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -83,7 +82,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def _require(self, recipe_name): if recipe_name not in self._dependencies_versions: @@ -94,17 +96,33 @@ def requirements(self): self.requires(self._require("spirv-headers")) def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) - def layout(self): - cmake_layout(self, src_folder="src") + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r"cmake version (\d+\.\d+\.\d+)", output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if (Version(self.version) >= "1.3.239" and Version(self.version) < "2016.6") or \ + Version(self.version) >= "2023.1": + if not self._cmake_new_enough("3.17.2"): + self.tool_requires("cmake/3.25.1") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) #==================== @@ -144,7 +162,11 @@ def generate(self): tc.variables["SPIRV_BUILD_FUZZER"] = False tc.variables["SPIRV_SKIP_EXECUTABLES"] = not self.options.build_executables # To install relocatable shared libs on Macos - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + if Version(self.version) < "1.3.239" or \ + (Version(self.version) >= "2016.6" and Version(self.version) < "2023.1"): + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + # For iOS/tvOS/watchOS + tc.variables["CMAKE_MACOSX_BUNDLE"] = False tc.generate() @@ -174,6 +196,7 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "SPIRV-Tools-reduce")) rmdir(self, os.path.join(self.package_folder, "SPIRV-Tools-lint")) rmdir(self, os.path.join(self.package_folder, "SPIRV-Tools-diff")) + rmdir(self, os.path.join(self.package_folder, "SPIRV-Tools-tools")) if self.options.shared: for file_name in [ "*SPIRV-Tools", "*SPIRV-Tools-opt", "*SPIRV-Tools-link", @@ -237,7 +260,7 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.components["spirv-tools-core"].system_libs.extend(["m", "rt"]) if not self.options.shared: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.components["spirv-tools-core"].system_libs.append(libcxx) @@ -273,9 +296,7 @@ def package_info(self): self.cpp_info.components["spirv-tools-diff"].requires = ["spirv-tools-core", "spirv-tools-opt"] if self.options.build_executables: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bin_path}") - self.env_info.path.append(bin_path) + self.env_info.path.append(os.path.join(self.package_folder, "bin")) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.filenames["cmake_find_package"] = "SPIRV-Tools" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-1.3.231.1.yml b/recipes/spirv-tools/all/dependencies/dependencies-1.3.231.1.yml new file mode 100644 index 0000000000000..c7958b90b620e --- /dev/null +++ b/recipes/spirv-tools/all/dependencies/dependencies-1.3.231.1.yml @@ -0,0 +1 @@ +spirv-headers: "1.3.231.1" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-1.3.236.0.yml b/recipes/spirv-tools/all/dependencies/dependencies-1.3.236.0.yml new file mode 100644 index 0000000000000..f9007ad197d24 --- /dev/null +++ b/recipes/spirv-tools/all/dependencies/dependencies-1.3.236.0.yml @@ -0,0 +1 @@ +spirv-headers: "1.3.236.0" diff --git a/recipes/spirv-tools/all/dependencies/dependencies-1.3.239.0.yml b/recipes/spirv-tools/all/dependencies/dependencies-1.3.239.0.yml new file mode 100644 index 0000000000000..3c764cd3e9ecc --- /dev/null +++ b/recipes/spirv-tools/all/dependencies/dependencies-1.3.239.0.yml @@ -0,0 +1 @@ +spirv-headers: "1.3.239.0" diff --git a/recipes/spirv-tools/all/test_package/conanfile.py b/recipes/spirv-tools/all/test_package/conanfile.py index 1235aa2253cef..d8eaf2ab17123 100644 --- a/recipes/spirv-tools/all/test_package/conanfile.py +++ b/recipes/spirv-tools/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/spirv-tools/all/test_v1_package/CMakeLists.txt b/recipes/spirv-tools/all/test_v1_package/CMakeLists.txt index 28cb54d7435c5..0d20897301b68 100644 --- a/recipes/spirv-tools/all/test_v1_package/CMakeLists.txt +++ b/recipes/spirv-tools/all/test_v1_package/CMakeLists.txt @@ -1,23 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(SPIRV-Tools REQUIRED CONFIG) - -add_executable(${PROJECT_NAME}_c ../test_package/test_package.c) -if(TARGET SPIRV-Tools-shared) - target_link_libraries(${PROJECT_NAME}_c PRIVATE SPIRV-Tools-shared) -elseif(TARGET SPIRV-Tools-static) - target_link_libraries(${PROJECT_NAME}_c PRIVATE SPIRV-Tools-static) -else() - target_link_libraries(${PROJECT_NAME}_c PRIVATE SPIRV-Tools) -endif() - -# TODO: we should call find_package(SPIRV-Tools-opt REQUIRED CONFIG), but not modeled right now -if(TARGET SPIRV-Tools-opt) - add_executable(${PROJECT_NAME}_cpp ../test_package/test_package.cpp) - target_link_libraries(${PROJECT_NAME}_cpp PRIVATE SPIRV-Tools-opt) - target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_11) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/spirv-tools/config.yml b/recipes/spirv-tools/config.yml index 0b673c62a4f58..3f8a11ce755c7 100644 --- a/recipes/spirv-tools/config.yml +++ b/recipes/spirv-tools/config.yml @@ -1,4 +1,10 @@ versions: + "1.3.239.0": + folder: all + "1.3.236.0": + folder: all + "1.3.231.1": + folder: all "1.3.224.0": folder: all "1.3.216.0": diff --git a/recipes/spix/all/conandata.yml b/recipes/spix/all/conandata.yml new file mode 100644 index 0000000000000..85ea4e8fd6a62 --- /dev/null +++ b/recipes/spix/all/conandata.yml @@ -0,0 +1,16 @@ +sources: + "0.4": + url: "https://github.com/faaxm/spix/archive/refs/tags/v0.4.tar.gz" + sha256: "e787c08840c37e5b153c0139f3bb613a2729ae8f6ccd0fb450fef92971cd8b53" + "0.5": + url: "https://github.com/faaxm/spix/archive/refs/tags/v0.5.tar.gz" + sha256: "d3fd9bb069aef6ff6c93c69524ed3603afd24e6b52e4bb8d093c80cec255d4dc" +patches: + "0.4": + - patch_file: "patches/0001-use-conan-libs-0.4.patch" + patch_description: "Link to conan libs" + patch_type: "conan" + "0.5": + - patch_file: "patches/0001-use-conan-libs-0.5.patch" + patch_description: "Link to conan libs" + patch_type: "conan" diff --git a/recipes/spix/all/conanfile.py b/recipes/spix/all/conanfile.py new file mode 100644 index 0000000000000..375acd44db4e0 --- /dev/null +++ b/recipes/spix/all/conanfile.py @@ -0,0 +1,130 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rm, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class SpixConan(ConanFile): + name = "spix" + description = "UI test automation library for QtQuick/QML Apps" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/faaxm/spix" + topics = ("automation", "qt", "qml", "qt-quick", "qt5", "qtquick", "automated-testing", "qt-qml", "qml-applications") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _minimum_cpp_standard(self): + return 14 if self.version == "0.4" else 17 + + @property + def _compilers_minimum_version(self): + if self.version == "0.4": + return { + "Visual Studio": "14", + "msvc": "190", + "gcc": "5", + "clang": "3.4", + "apple-clang": "10" + } + else: + return { + "Visual Studio": "15.7", + "msvc": "192", # FIXME: 15.7 is actually 1914 but needs to be tested + "gcc": "7", + "clang": "5", + "apple-clang": "10", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("anyrpc/1.0.2") + self.requires("qt/6.4.2") + + def validate(self): + if self.settings.compiler.cppstd: + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support." + ) + + if Version(self.dependencies["qt"].ref.version).major == 6 and not self.options["qt"].qtshadertools: + raise ConanInvalidConfiguration(f"{self.ref} requires qt:qtshadertools to get the Quick module") + if not (self.options["qt"].gui and self.options["qt"].qtdeclarative): + raise ConanInvalidConfiguration(f"{self.ref} requires qt:gui and qt:qtdeclarative to get the Quick module") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SPIX_BUILD_EXAMPLES"] = False + tc.variables["SPIX_BUILD_TESTS"] = False + tc.variables["SPIX_QT_MAJOR"] = Version(self.dependencies["qt"].ref.version).major + tc.generate() + + deps = CMakeDeps(self) + deps.set_property("anyrpc", "cmake_file_name", "AnyRPC") + deps.set_property("anyrpc", "cmake_target_name", "AnyRPC::anyrpc") + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + if self.version == "0.4" and Version(self.dependencies["qt"].ref.version).major == 6: + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set(CMAKE_CXX_STANDARD 14)", "set(CMAKE_CXX_STANDARD 17)") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + def package_info(self): + self.cpp_info.libs = ["Spix"] + self.cpp_info.set_property("cmake_file_name", "Spix") + self.cpp_info.set_property("cmake_target_name", "Spix::Spix") + + # TODO remove once conan v2 removed cmake_find_package_* + self.cpp_info.names["cmake_find_package"] = "Spix" + self.cpp_info.names["cmake_find_package_multi"] = "Spix" diff --git a/recipes/spix/all/patches/0001-use-conan-libs-0.4.patch b/recipes/spix/all/patches/0001-use-conan-libs-0.4.patch new file mode 100644 index 0000000000000..7d0727e24bbf9 --- /dev/null +++ b/recipes/spix/all/patches/0001-use-conan-libs-0.4.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,7 +5,6 @@ option(SPIX_BUILD_EXAMPLES "Build Spix examples." ON) + option(SPIX_BUILD_TESTS "Build Spix unit tests." OFF) + set(SPIX_QT_MAJOR "6" CACHE STRING "Major Qt version to build Spix against") + +-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/modules") + set(CMAKE_CXX_STANDARD 14) + + # Hide symbols unless explicitly flagged with SPIX_EXPORT diff --git a/recipes/spix/all/patches/0001-use-conan-libs-0.5.patch b/recipes/spix/all/patches/0001-use-conan-libs-0.5.patch new file mode 100644 index 0000000000000..0746373586081 --- /dev/null +++ b/recipes/spix/all/patches/0001-use-conan-libs-0.5.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -5,7 +5,6 @@ option(SPIX_BUILD_EXAMPLES "Build Spix examples." ON) + option(SPIX_BUILD_TESTS "Build Spix unit tests." OFF) + set(SPIX_QT_MAJOR "6" CACHE STRING "Major Qt version to build Spix against") + +-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_LIST_DIR}/cmake/modules") + set(CMAKE_CXX_STANDARD 17) + + # Hide symbols unless explicitly flagged with SPIX_EXPORT diff --git a/recipes/spix/all/test_package/CMakeLists.txt b/recipes/spix/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..8b674ce10f424 --- /dev/null +++ b/recipes/spix/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_spix CXX) + +find_package(Spix REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_spix.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Spix::Spix) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/spix/all/test_package/conanfile.py b/recipes/spix/all/test_package/conanfile.py new file mode 100644 index 0000000000000..ec84e70261ab1 --- /dev/null +++ b/recipes/spix/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestSpixConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_spix") + self.run(bin_path, env="conanrun") diff --git a/recipes/spix/all/test_package/test_spix.cpp b/recipes/spix/all/test_package/test_spix.cpp new file mode 100644 index 0000000000000..ad5547a31aa17 --- /dev/null +++ b/recipes/spix/all/test_package/test_spix.cpp @@ -0,0 +1,30 @@ +#include +#include +#include +#include +#include + +#include "Spix/QtQmlBot.h" + +std::mutex m; +std::condition_variable cv; + +class MyTests : public spix::TestServer +{ +protected: + void executeTest() override { cv.notify_one(); } +}; + +int main(void) +{ + spix::QtQmlBot bot; + MyTests tests; + bot.runTestServer(tests); + + // wait for the test to begin before exiting main, + // destroying the server before the test is launched + std::unique_lock lk(m); + cv.wait(lk); + + return EXIT_SUCCESS; +} diff --git a/recipes/spix/all/test_v1_package/CMakeLists.txt b/recipes/spix/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..8272097b5b3da --- /dev/null +++ b/recipes/spix/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,6 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/spix/all/test_v1_package/conanfile.py b/recipes/spix/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c71bbcebecf4a --- /dev/null +++ b/recipes/spix/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestSpixV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_spix") + self.run(bin_path, run_environment=True) diff --git a/recipes/spix/config.yml b/recipes/spix/config.yml new file mode 100644 index 0000000000000..57a887729c2ab --- /dev/null +++ b/recipes/spix/config.yml @@ -0,0 +1,5 @@ +versions: + "0.4": + folder: all + "0.5": + folder: all diff --git a/recipes/sqlite3/all/CMakeLists.txt b/recipes/sqlite3/all/CMakeLists.txt index e82939d256595..1f1e60b9b2dcf 100644 --- a/recipes/sqlite3/all/CMakeLists.txt +++ b/recipes/sqlite3/all/CMakeLists.txt @@ -31,8 +31,8 @@ option(HAVE_POSIX_FALLOCATE "Use posix_fallocate()") option(HAVE_STRERROR_R "Use strerror_r()") option(HAVE_USLEEP "Use usleep() system call to implement the xSleep method") option(DISABLE_GETHOSTUUID "Disable function gethostuuid") -option(MAX_COLUMN "The maximum number of columns in a table / index / view") -option(MAX_VARIABLE_NUMBER "The maximum value of a ?nnn wildcard that the parser will accept") +set(MAX_COLUMN CACHE STRING "The maximum number of columns in a table / index / view") +set(MAX_VARIABLE_NUMBER CACHE STRING "The maximum value of a ?nnn wildcard that the parser will accept") set(MAX_BLOB_SIZE CACHE STRING "Set the maximum number of bytes in a string or BLOB") option(DISABLE_DEFAULT_VFS "Disable default VFS implementation") option(ENABLE_DBPAGE_VTAB "The SQLITE_DBPAGE extension implements an eponymous-only virtual table that provides direct access to the underlying database file by interacting with the pager. SQLITE_DBPAGE is capable of both reading and writing any page of the database. Because interaction is through the pager layer, all changes are transactional.") @@ -150,9 +150,14 @@ if(NOT OMIT_LOAD_EXTENSION) endif() if(ENABLE_FTS5 OR ENABLE_MATH_FUNCTIONS) - find_library(MATH_LIBRARY m) - if(MATH_LIBRARY) - target_link_libraries(${PROJECT_NAME} PRIVATE ${MATH_LIBRARY}) + include(CheckLibraryExists) + # Check if math functionality is on the separate 'libm' library, + # otherwise assume that it is already part of the C runtime. + # The `m` library is part of the compiler toolchain, this checks + # if the compiler can successfully link against the library. + check_library_exists(m log "" HAVE_MATH_LIBRARY) + if(HAVE_MATH_LIBRARY) + target_link_libraries(${PROJECT_NAME} PRIVATE m) endif() endif() diff --git a/recipes/sqlite3/all/conandata.yml b/recipes/sqlite3/all/conandata.yml index 9cbaf9de69b55..b155ef964565f 100644 --- a/recipes/sqlite3/all/conandata.yml +++ b/recipes/sqlite3/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "3.40.1": + url: "https://sqlite.org/2022/sqlite-amalgamation-3400100.zip" + sha256: "49112cc7328392aa4e3e5dae0b2f6736d0153430143d21f69327788ff4efe734" + "3.40.0": + url: "https://sqlite.org/2022/sqlite-amalgamation-3400000.zip" + sha256: "7c23eb51409315738c930a222cf7cd41518ae5823c41e60a81b93a07070ef22a" + "3.39.4": + url: "https://sqlite.org/2022/sqlite-amalgamation-3390400.zip" + sha256: "9c99955b21d2374f3a385d67a1f64cbacb1d4130947473d25c77ad609c03b4cd" + "3.39.3": + url: "https://sqlite.org/2022/sqlite-amalgamation-3390300.zip" + sha256: "a89db3030d229d860ae56a8bac50ac9761434047ae886e47e7c8f9f428fa98ad" "3.39.2": url: "https://sqlite.org/2022/sqlite-amalgamation-3390200.zip" sha256: "87775784f8b22d0d0f1d7811870d39feaa7896319c7c20b849a4181c5a50609b" @@ -11,27 +23,9 @@ sources: "3.38.5": url: "https://sqlite.org/2022/sqlite-amalgamation-3380500.zip" sha256: "bebb039b748441e3d25d71d11f7a4a33f5df11f318ec18fa7f343d2083755e2c" - "3.38.4": - url: "https://sqlite.org/2022/sqlite-amalgamation-3380400.zip" - sha256: "63525b0e9df9c1df31a12d203dd8dc4c2c306f31834bb740fbf7e7ad5342bc1a" - "3.38.3": - url: "https://sqlite.org/2022/sqlite-amalgamation-3380300.zip" - sha256: "bcbf07443f6b62b2c456ac2404bdfefd7713fd04128602256dd80f8505bd3a6e" - "3.38.1": - url: "https://sqlite.org/2022/sqlite-amalgamation-3380100.zip" - sha256: "6fb55507d4517b5cbc80bd2db57b0cbe1b45880b28f2e4bd6dca4cfe3716a231" - "3.38.0": - url: "https://sqlite.org/2022/sqlite-amalgamation-3380000.zip" - sha256: "e055f6054e97747a135c89e36520c0a423249e8a91c5fc445163f4a6adb20df6" "3.37.2": url: "https://sqlite.org/2022/sqlite-amalgamation-3370200.zip" sha256: "cb25df0fb90b77be6660f6ace641bbea88f3d0441110d394ce418f35f7561bb0" - "3.37.0": - url: "https://sqlite.org/2021/sqlite-amalgamation-3370000.zip" - sha256: "a443aaf5cf345613492efa679ef1c9cc31ba109dcdf37ee377f61ab500d042fe" "3.36.0": url: "https://sqlite.org/2021/sqlite-amalgamation-3360000.zip" sha256: "999826fe4c871f18919fdb8ed7ec9dd8217180854dd1fe21eea96aed36186729" - "3.35.5": - url: "https://sqlite.org/2021/sqlite-amalgamation-3350500.zip" - sha256: "b49409ef123e193e719e2536f9b795482a69e61a9cc728933739b9024f035061" diff --git a/recipes/sqlite3/all/conanfile.py b/recipes/sqlite3/all/conanfile.py index 42908f46bb09a..eddf425a36988 100644 --- a/recipes/sqlite3/all/conanfile.py +++ b/recipes/sqlite3/all/conanfile.py @@ -7,7 +7,7 @@ import os import textwrap -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class Sqlite3Conan(ConanFile): @@ -17,6 +17,7 @@ class Sqlite3Conan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.sqlite.org" topics = ("sqlite", "database", "sql", "serverless") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -40,9 +41,9 @@ class Sqlite3Conan(ConanFile): "enable_unlock_notify": [True, False], "enable_default_secure_delete": [True, False], "disable_gethostuuid": [True, False], - "max_column": "ANY", - "max_variable_number": "ANY", - "max_blob_size": "ANY", + "max_column": [None, "ANY"], + "max_variable_number": [None, "ANY"], + "max_blob_size": [None, "ANY"], "build_executable": [True, False], "enable_default_vfs": [True, False], "enable_dbpage_vtab": [True, False], @@ -91,30 +92,23 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.info.options.build_executable: - if not self.info.options.enable_default_vfs: + if self.options.build_executable: + if not self.options.enable_default_vfs: # Need to provide custom VFS code: https://www.sqlite.org/custombuild.html raise ConanInvalidConfiguration("build_executable=True cannot be combined with enable_default_vfs=False") - if self.info.options.omit_load_extension: + if self.options.omit_load_extension: raise ConanInvalidConfiguration("build_executable=True requires omit_load_extension=True") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -191,7 +185,7 @@ def _create_cmake_module_variables(self, module_file): @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -214,11 +208,6 @@ def package_info(self): if self.options.shared: self.cpp_info.components["sqlite"].defines.append("SQLITE_API=__declspec(dllimport)") - if self.options.build_executable: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var with : {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "SQLite3" self.cpp_info.filenames["cmake_find_package_multi"] = "SQLite3" @@ -230,3 +219,5 @@ def package_info(self): self.cpp_info.components["sqlite"].build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.components["sqlite"].set_property("cmake_target_name", "SQLite::SQLite3") self.cpp_info.components["sqlite"].set_property("pkg_config_name", "sqlite3") + if self.options.build_executable: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/sqlite3/all/test_package/conanfile.py b/recipes/sqlite3/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/sqlite3/all/test_package/conanfile.py +++ b/recipes/sqlite3/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/sqlite3/all/test_v1_package/CMakeLists.txt b/recipes/sqlite3/all/test_v1_package/CMakeLists.txt index dc9346f510d74..0d20897301b68 100644 --- a/recipes/sqlite3/all/test_v1_package/CMakeLists.txt +++ b/recipes/sqlite3/all/test_v1_package/CMakeLists.txt @@ -1,17 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -option(USE_EMPTY_VFS "Using empty SQLite OS interface") - -find_package(SQLite3 REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE SQLite::SQLite3) - -if(USE_EMPTY_VFS) - target_compile_definitions(${PROJECT_NAME} PRIVATE USE_EMPTY_VFS) - target_sources(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../test_package/empty_vfs.c) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/sqlite3/all/test_v1_package/conanfile.py b/recipes/sqlite3/all/test_v1_package/conanfile.py index 03457f792149b..48965a0bd0577 100644 --- a/recipes/sqlite3/all/test_v1_package/conanfile.py +++ b/recipes/sqlite3/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/sqlite3/config.yml b/recipes/sqlite3/config.yml index cc979959bee0e..db730ea2013ea 100644 --- a/recipes/sqlite3/config.yml +++ b/recipes/sqlite3/config.yml @@ -1,25 +1,21 @@ versions: - "3.39.2": + "3.40.1": folder: all - "3.39.1": + "3.40.0": folder: all - "3.39.0": + "3.39.4": folder: all - "3.38.5": + "3.39.3": folder: all - "3.38.4": + "3.39.2": folder: all - "3.38.3": + "3.39.1": folder: all - "3.38.1": + "3.39.0": folder: all - "3.38.0": + "3.38.5": folder: all "3.37.2": folder: all - "3.37.0": - folder: all "3.36.0": folder: all - "3.35.5": - folder: all diff --git a/recipes/sqlite_orm/all/conandata.yml b/recipes/sqlite_orm/all/conandata.yml index 998bcbb3f677e..0e21c35469c88 100644 --- a/recipes/sqlite_orm/all/conandata.yml +++ b/recipes/sqlite_orm/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.8.1": + url: "https://github.com/fnc12/sqlite_orm/archive/v1.8.1.tar.gz" + sha256: "3fbe40d4bb7884a29a9a5764baa27e150ef53940895eb097014202bee3f06644" + "1.8": + url: "https://github.com/fnc12/sqlite_orm/archive/v1.8.tar.gz" + sha256: "90893bb0035daf9803ad9e6d45b3e67f48b5515e69ed3a7577feffed7a9f3309" "1.7.1": url: "https://github.com/fnc12/sqlite_orm/archive/refs/tags/v1.7.1.tar.gz" sha256: "dbf58c2d3c5b1efe295d592799edaa1a5dbe9d591a0bfb1abd22a2843a5123e0" @@ -11,4 +17,6 @@ sources: patches: "1.7": - patch_file: "patches/0001-declare-is-upsert-clause.patch" - base_path: "source_subfolder" + patch_description: "declare is_upsert_clause declaration" + patch_type: "portability" + patch_source: "https://github.com/fnc12/sqlite_orm/pull/821" diff --git a/recipes/sqlite_orm/all/conanfile.py b/recipes/sqlite_orm/all/conanfile.py index 76f1517d72c5d..a3b8fcd9aac81 100644 --- a/recipes/sqlite_orm/all/conanfile.py +++ b/recipes/sqlite_orm/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class SqliteOrmConan(ConanFile): @@ -15,59 +18,63 @@ class SqliteOrmConan(ConanFile): settings = "os", "arch", "compiler", "build_type" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" @property def _compilers_minimum_version(self): return { "gcc": "5", "Visual Studio": "14", + "msvc": "190", "clang": "3.4", "apple-clang": "5.1", } def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("sqlite3/3.37.2") + self.requires("sqlite3/3.39.4", transitive_headers=True, transitive_libs=True) + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) + check_min_cppstd(self, self._min_cppstd) - def lazy_lt_semver(v1, v2): + def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("sqlite_orm requires C++14. Your compiler is unknown. Assuming it supports C++14.") - elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("sqlite_orm requires C++14, which your compiler does not support.") - - def package_id(self): - self.info.header_only() + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "SqliteOrm") self.cpp_info.set_property("cmake_target_name", "sqlite_orm::sqlite_orm") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] self.cpp_info.filenames["cmake_find_package"] = "SqliteOrm" self.cpp_info.filenames["cmake_find_package_multi"] = "SqliteOrm" diff --git a/recipes/sqlite_orm/all/test_package/CMakeLists.txt b/recipes/sqlite_orm/all/test_package/CMakeLists.txt index 971acc2578776..344f40b9c7cdc 100644 --- a/recipes/sqlite_orm/all/test_package/CMakeLists.txt +++ b/recipes/sqlite_orm/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(SqliteOrm REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} sqlite_orm::sqlite_orm) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE sqlite_orm::sqlite_orm) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/sqlite_orm/all/test_package/conanfile.py b/recipes/sqlite_orm/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/sqlite_orm/all/test_package/conanfile.py +++ b/recipes/sqlite_orm/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sqlite_orm/all/test_v1_package/CMakeLists.txt b/recipes/sqlite_orm/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/sqlite_orm/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/sqlite_orm/all/test_v1_package/conanfile.py b/recipes/sqlite_orm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/sqlite_orm/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/sqlite_orm/config.yml b/recipes/sqlite_orm/config.yml index 5c7010078dd99..63772d9d777b3 100644 --- a/recipes/sqlite_orm/config.yml +++ b/recipes/sqlite_orm/config.yml @@ -1,4 +1,8 @@ versions: + "1.8.1": + folder: all + "1.8": + folder: all "1.7.1": folder: all "1.7": diff --git a/recipes/sqlitecpp/all/CMakeLists.txt b/recipes/sqlitecpp/all/CMakeLists.txt deleted file mode 100644 index 4d393c7a86c09..0000000000000 --- a/recipes/sqlitecpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1.2) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory("source_subfolder") diff --git a/recipes/sqlitecpp/all/conandata.yml b/recipes/sqlitecpp/all/conandata.yml index 3170f3f50955c..ee0a68eaa6f16 100644 --- a/recipes/sqlitecpp/all/conandata.yml +++ b/recipes/sqlitecpp/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.2.1": + url: "https://github.com/SRombauts/SQLiteCpp/archive/3.2.1.tar.gz" + sha256: "70c67d5680c47460f82a7abf8e6b0329bf2fb10795a982a6d8abc06adb42d693" + "3.2.0": + url: "https://github.com/SRombauts/SQLiteCpp/archive/3.2.0.tar.gz" + sha256: "57f91ed44ef205fe97b8c6586002fe6031cd02771d1c5d8415d9c515ad1532d1" "3.1.1": url: "https://github.com/SRombauts/SQLiteCpp/archive/3.1.1.tar.gz" sha256: "b00b1efad985dd415c3b62b01252cae20d9f2c32dcac435ddd8a105e9d4ddcde" @@ -10,8 +16,13 @@ sources: sha256: "16bf963619786652a60533bcdc71a0412cad1ce132cd09ce43344af6ed7463d9" patches: "2.5.0": - - base_path: "source_subfolder" - patch_file: "patches/2.5.0/0001-conan.patch" + - patch_file: "patches/2.5.0-0001-cmake-sqlite3.patch" + patch_description: "Fix Sqlite3 CMake target" + patch_type: "conan" "2.4.0": - - base_path: "source_subfolder" - patch_file: "patches/2.4.0/0001-mingw.patch" + - patch_file: "patches/2.4.0-0001-cmake-sqlite3.patch" + patch_description: "Fix Sqlite3 CMake target" + patch_type: "conan" + - patch_file: "patches/2.4.0-0002-mingw-flags.patch" + patch_description: "Fix Mingw compiler flags" + patch_type: "conan" diff --git a/recipes/sqlitecpp/all/conanfile.py b/recipes/sqlitecpp/all/conanfile.py index ed12cc40368ff..70dd5900f9a1a 100644 --- a/recipes/sqlitecpp/all/conanfile.py +++ b/recipes/sqlitecpp/all/conanfile.py @@ -1,19 +1,23 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import copy, get, apply_conandata_patches, replace_in_file, rmdir, save +from conan.tools.scm import Version +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.errors import ConanInvalidConfiguration import os import textwrap -required_conan_version = ">=1.43.0" + +required_conan_version = ">=1.53" class SQLiteCppConan(ConanFile): name = "sqlitecpp" description = "SQLiteCpp is a smart and easy to use C++ sqlite3 wrapper" - topics = ("sqlitecpp", "sqlite3") + topics = ("sqlite", "sqlite3", "data-base") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/SRombauts/SQLiteCpp" license = "MIT" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,21 +30,9 @@ class SQLiteCppConan(ConanFile): "stack_protection": True, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -48,57 +40,61 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - self.requires("sqlite3/3.38.5") + self.requires("sqlite3/3.40.0") def validate(self): - if tools.Version(self.version) >= "3.0.0" and self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - if self.settings.os == "Windows" and self.options.shared: + if Version(self.version) >= "3.0.0" and self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + if self.info.settings.os == "Windows" and self.info.options.shared: raise ConanInvalidConfiguration("SQLiteCpp can not be built as shared lib on Windows") + def layout(self): + cmake_layout(self, src_folder="src") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if self.settings.compiler == "clang" and \ - tools.Version(self.settings.compiler.version) < "6.0" and \ - self.settings.compiler.libcxx == "libc++" and \ - tools.Version(self.version) < "3": - tools.replace_in_file( - os.path.join(self._source_subfolder, "include", "SQLiteCpp", "Utils.h"), + Version(self.settings.compiler.version) < "6.0" and \ + self.settings.compiler.libcxx == "libc++" and \ + Version(self.version) < "3": + replace_in_file(self, + os.path.join(self.source_folder, "include", "SQLiteCpp", "Utils.h"), "const nullptr_t nullptr = {};", "") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["SQLITECPP_INTERNAL_SQLITE"] = False - self._cmake.definitions["SQLITECPP_RUN_CPPLINT"] = False - self._cmake.definitions["SQLITECPP_RUN_CPPCHECK"] = False - self._cmake.definitions["SQLITECPP_RUN_DOXYGEN"] = False - self._cmake.definitions["SQLITECPP_BUILD_EXAMPLES"] = False - self._cmake.definitions["SQLITECPP_BUILD_TESTS"] = False - self._cmake.definitions["SQLITECPP_USE_STACK_PROTECTION"] = self.options.stack_protection - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SQLITECPP_INTERNAL_SQLITE"] = False + tc.variables["SQLITECPP_RUN_CPPLINT"] = False + tc.variables["SQLITECPP_RUN_CPPCHECK"] = False + tc.variables["SQLITECPP_RUN_DOXYGEN"] = False + tc.variables["SQLITECPP_BUILD_EXAMPLES"] = False + tc.variables["SQLITECPP_BUILD_TESTS"] = False + tc.variables["SQLITECPP_USE_STACK_PROTECTION"] = self.options.stack_protection + tc.generate() + + tc = CMakeDeps(self) + tc.generate() def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -106,21 +102,24 @@ def package(self): {"SQLiteCpp": "SQLiteCpp::SQLiteCpp"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + + @property + def _is_mingw(self): + return self.settings.os == "Windows" and self.settings.compiler == "gcc" def package_info(self): self.cpp_info.set_property("cmake_file_name", "SQLiteCpp") @@ -129,6 +128,9 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread", "dl", "m"] + if self._is_mingw: + self.cpp_info.system_libs = ["ssp"] + # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "SQLiteCpp" self.cpp_info.names["cmake_find_package_multi"] = "SQLiteCpp" diff --git a/recipes/sqlitecpp/all/patches/2.4.0-0001-cmake-sqlite3.patch b/recipes/sqlitecpp/all/patches/2.4.0-0001-cmake-sqlite3.patch new file mode 100644 index 0000000000000..dd766533b851d --- /dev/null +++ b/recipes/sqlitecpp/all/patches/2.4.0-0001-cmake-sqlite3.patch @@ -0,0 +1,23 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index c32724b..096818a 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -206,7 +206,7 @@ install(EXPORT ${PROJECT_NAME}Config DESTINATION lib/cmake/${PROJECT_NAME}) + + ## Build provided copy of SQLite3 C library ## + +-# TODO ++# TODO + #find_package(sqlite3) + #if(sqlite3_VERSION VERSION_LESS "3.19") + # set_target_properties(SQLiteCpp PROPERTIES COMPILE_FLAGS "-DSQLITECPP_HAS_MEM_STRUCT") +@@ -230,6 +230,9 @@ if (SQLITECPP_INTERNAL_SQLITE) + add_subdirectory(sqlite3) + target_include_directories(sqlite3 PUBLIC "${PROJECT_SOURCE_DIR}/sqlite3") + target_include_directories(SQLiteCpp PRIVATE "${PROJECT_SOURCE_DIR}/sqlite3") ++else (SQLITECPP_INTERNAL_SQLITE) ++ find_package(SQLite3 REQUIRED) ++ target_link_libraries(SQLiteCpp PRIVATE SQLite::SQLite3) + endif (SQLITECPP_INTERNAL_SQLITE) + + # Optional additional targets: diff --git a/recipes/sqlitecpp/all/patches/2.4.0-0002-mingw-flags.patch b/recipes/sqlitecpp/all/patches/2.4.0-0002-mingw-flags.patch new file mode 100644 index 0000000000000..99fa2af08442e --- /dev/null +++ b/recipes/sqlitecpp/all/patches/2.4.0-0002-mingw-flags.patch @@ -0,0 +1,18 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 096818a..9e40f9f 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -47,7 +47,12 @@ else (MSVC) + set(CPPLINT_ARG_OUTPUT "--output=eclipse") + set(CPPCHECK_ARG_TEMPLATE "--template=gcc") + # Useful compile flags and extra warnings +- add_compile_options(-fstack-protector -Wall -Wextra -Wpedantic -Wno-long-long -Wswitch-enum -Wshadow -Winline) ++ if (MINGW) ++ MESSAGE ( STATUS "Running on MinGW - no -fstack-protector" ) ++ add_compile_options(-Wall -Wextra -Wpedantic -Wno-long-long -Wswitch-enum -Wshadow -Winline) ++ else () ++ add_compile_options(-fstack-protector -Wall -Wextra -Wpedantic -Wno-long-long -Wswitch-enum -Wshadow -Winline) ++ endif () + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++0x-compat") # C++ only + if (CMAKE_COMPILER_IS_GNUCXX) + # GCC flags diff --git a/recipes/sqlitecpp/all/patches/2.4.0/0001-mingw.patch b/recipes/sqlitecpp/all/patches/2.4.0/0001-mingw.patch deleted file mode 100644 index 56019d6df6789..0000000000000 --- a/recipes/sqlitecpp/all/patches/2.4.0/0001-mingw.patch +++ /dev/null @@ -1,27 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index c32724b..efdb43b 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -47,7 +47,12 @@ else (MSVC) - set(CPPLINT_ARG_OUTPUT "--output=eclipse") - set(CPPCHECK_ARG_TEMPLATE "--template=gcc") - # Useful compile flags and extra warnings -- add_compile_options(-fstack-protector -Wall -Wextra -Wpedantic -Wno-long-long -Wswitch-enum -Wshadow -Winline) -+ if (MINGW) -+ MESSAGE ( STATUS "Running on MinGW - no -fstack-protector" ) -+ add_compile_options(-Wall -Wextra -Wpedantic -Wno-long-long -Wswitch-enum -Wshadow -Winline) -+ else () -+ add_compile_options(-fstack-protector -Wall -Wextra -Wpedantic -Wno-long-long -Wswitch-enum -Wshadow -Winline) -+ endif () - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++0x-compat") # C++ only - if (CMAKE_COMPILER_IS_GNUCXX) - # GCC flags -@@ -230,6 +235,8 @@ if (SQLITECPP_INTERNAL_SQLITE) - add_subdirectory(sqlite3) - target_include_directories(sqlite3 PUBLIC "${PROJECT_SOURCE_DIR}/sqlite3") - target_include_directories(SQLiteCpp PRIVATE "${PROJECT_SOURCE_DIR}/sqlite3") -+else (SQLITECPP_INTERNAL_SQLITE) -+ target_link_libraries(SQLiteCpp PUBLIC CONAN_PKG::sqlite3) - endif (SQLITECPP_INTERNAL_SQLITE) - - # Optional additional targets: diff --git a/recipes/sqlitecpp/all/patches/2.5.0-0001-cmake-sqlite3.patch b/recipes/sqlitecpp/all/patches/2.5.0-0001-cmake-sqlite3.patch new file mode 100644 index 0000000000000..d114e32196b48 --- /dev/null +++ b/recipes/sqlitecpp/all/patches/2.5.0-0001-cmake-sqlite3.patch @@ -0,0 +1,25 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f7e0fbd..146ab01 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -184,7 +184,7 @@ endif (SQLITE_ENABLE_ASSERT_HANDLER) + option(SQLITE_HAS_CODEC "Enable database encryption API. Not available in the public release of SQLite." OFF) + if (SQLITE_HAS_CODEC) + # Enable database encryption API. Requires implementations of sqlite3_key & sqlite3_key_v2. +- # Eg. SQLCipher (libsqlcipher-dev) is an SQLite extension that provides 256 bit AES encryption of database files. ++ # Eg. SQLCipher (libsqlcipher-dev) is an SQLite extension that provides 256 bit AES encryption of database files. + target_compile_definitions(SQLiteCpp PUBLIC SQLITE_HAS_CODEC) + endif (SQLITE_HAS_CODEC) + +@@ -247,10 +247,7 @@ if (SQLITECPP_INTERNAL_SQLITE) + target_include_directories(SQLiteCpp PRIVATE "${PROJECT_SOURCE_DIR}/sqlite3") + else (SQLITECPP_INTERNAL_SQLITE) + find_package (SQLite3 REQUIRED) +- if (SQLITE3_FOUND) +- include_directories(${SQLITE3_INCLUDE_DIRS}) +- target_link_libraries (SQLiteCpp ${SQLITE3_LIBRARIES}) +- endif (SQLITE3_FOUND) ++ target_link_libraries(SQLiteCpp PRIVATE SQLite::SQLite3) + endif (SQLITECPP_INTERNAL_SQLITE) + + # Optional additional targets: diff --git a/recipes/sqlitecpp/all/patches/2.5.0/0001-conan.patch b/recipes/sqlitecpp/all/patches/2.5.0/0001-conan.patch deleted file mode 100644 index cba5603bc5014..0000000000000 --- a/recipes/sqlitecpp/all/patches/2.5.0/0001-conan.patch +++ /dev/null @@ -1,17 +0,0 @@ -diff --git a/CMakeLists.txt b/CMakeLists.txt -index f7e0fbd..752d876 100644 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -246,11 +246,7 @@ if (SQLITECPP_INTERNAL_SQLITE) - target_include_directories(sqlite3 PUBLIC "${PROJECT_SOURCE_DIR}/sqlite3") - target_include_directories(SQLiteCpp PRIVATE "${PROJECT_SOURCE_DIR}/sqlite3") - else (SQLITECPP_INTERNAL_SQLITE) -- find_package (SQLite3 REQUIRED) -- if (SQLITE3_FOUND) -- include_directories(${SQLITE3_INCLUDE_DIRS}) -- target_link_libraries (SQLiteCpp ${SQLITE3_LIBRARIES}) -- endif (SQLITE3_FOUND) -+ target_link_libraries(SQLiteCpp PUBLIC CONAN_PKG::sqlite3) - endif (SQLITECPP_INTERNAL_SQLITE) - - # Optional additional targets: diff --git a/recipes/sqlitecpp/all/test_package/CMakeLists.txt b/recipes/sqlitecpp/all/test_package/CMakeLists.txt index 72782b2cc5102..691c4d6d74886 100644 --- a/recipes/sqlitecpp/all/test_package/CMakeLists.txt +++ b/recipes/sqlitecpp/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.4) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(SQLiteCpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} SQLiteCpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE SQLiteCpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/sqlitecpp/all/test_package/conanfile.py b/recipes/sqlitecpp/all/test_package/conanfile.py index 38f4483872d47..31d542d1b6ce3 100644 --- a/recipes/sqlitecpp/all/test_package/conanfile.py +++ b/recipes/sqlitecpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/sqlitecpp/all/test_v1_package/CMakeLists.txt b/recipes/sqlitecpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/sqlitecpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/sqlitecpp/all/test_v1_package/conanfile.py b/recipes/sqlitecpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/sqlitecpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/sqlitecpp/config.yml b/recipes/sqlitecpp/config.yml index 988e83a6e3782..e29442357e51d 100644 --- a/recipes/sqlitecpp/config.yml +++ b/recipes/sqlitecpp/config.yml @@ -1,4 +1,8 @@ versions: + "3.2.1": + folder: all + "3.2.0": + folder: all "3.1.1": folder: all "2.5.0": diff --git a/recipes/squirrel/all/CMakeLists.txt b/recipes/squirrel/all/CMakeLists.txt deleted file mode 100644 index 8977c3f43d6f8..0000000000000 --- a/recipes/squirrel/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/squirrel/all/conandata.yml b/recipes/squirrel/all/conandata.yml index c8c6b8b328293..05364b18d9da3 100644 --- a/recipes/squirrel/all/conandata.yml +++ b/recipes/squirrel/all/conandata.yml @@ -1,8 +1,16 @@ sources: + "3.2": + url: "https://github.com/albertodemichelis/squirrel/archive/v3.2.tar.gz" + sha256: "02805414cfadd5bbb921891d3599b83375a40650abd6404a8ab407dc5e86a996" "3.1": url: "https://github.com/albertodemichelis/squirrel/archive/v3.1.tar.gz" sha256: "51942b8638a97b673e34ecf3ca50304996fa99bbdbfa7fe93d9744e6769b2f95" patches: + "3.2": + - patch_file: "patches/3.2-fix-cmake-static-build.patch" + patch_description: "fix static build issue" + patch_type: "portability" "3.1": - - patch_file: "patches/fix-cmake-static-shared.patch" - base_path: "source_subfolder" + - patch_file: "patches/3.1-fix-cmake-static-shared.patch" + patch_description: "add flag to switch static/shared builds" + patch_type: "conan" diff --git a/recipes/squirrel/all/conanfile.py b/recipes/squirrel/all/conanfile.py index f7561951403de..ea393f79ca89f 100644 --- a/recipes/squirrel/all/conanfile.py +++ b/recipes/squirrel/all/conanfile.py @@ -1,10 +1,12 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class SquirrelConan(ConanFile): name = "squirrel" @@ -12,11 +14,10 @@ class SquirrelConan(ConanFile): "language, designed to be a light-weight scripting language that " \ "fits in the size, memory bandwidth, and real-time requirements " \ "of applications like video games." + license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "http://www.squirrel-lang.org/" - license = "MIT" - topics = ("squirrel", "programming-language", "object-oriented", "scripting") - + topics = ("programming-language", "object-oriented", "scripting") settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,16 +28,8 @@ class SquirrelConan(ConanFile): "fPIC": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,42 +37,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if tools.Version(self.version) <= "3.1": - if self.settings.os == "Macos": - raise ConanInvalidConfiguration("squirrel 3.1 and earlier does not support Macos") + if Version(self.version) <= "3.1": + if is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.ref} and earlier does not support Macos") if self.settings.compiler == "clang": - compiler_version = tools.Version(self.settings.compiler.version) + compiler_version = Version(self.settings.compiler.version) if compiler_version < "9" or compiler_version >= "11": raise ConanInvalidConfiguration( - f"squirrel 3.1 and earlier does not support Clang {compiler_version}" + f"{self.ref} and earlier does not support Clang {compiler_version}" + ) + if self.settings.compiler == "gcc": + compiler_version = Version(self.settings.compiler.version) + if compiler_version >= "12": + raise ConanInvalidConfiguration( + f"{self.ref} and earlier does not support gcc {compiler_version}" ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["DISABLE_DYNAMIC"] = not self.options.shared - cmake.definitions["DISABLE_STATIC"] = self.options.shared - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DISABLE_DYNAMIC"] = not self.options.shared + tc.variables["DISABLE_STATIC"] = self.options.shared + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYRIGHT", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="COPYRIGHT", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + def package_info(self): self.cpp_info.set_property("cmake_file_name", "squirrel") # CMakeDeps generator uses the global target if a downstream recipe depends on squirrel globally, @@ -90,20 +92,22 @@ def package_info(self): suffix = "" if self.options.shared else "_static" # squirrel - self.cpp_info.components["libsquirrel"].set_property("cmake_target_name", "squirrel::squirrel{}".format(suffix)) - self.cpp_info.components["libsquirrel"].libs = ["squirrel{}".format(suffix)] + self.cpp_info.components["libsquirrel"].set_property("cmake_target_name", f"squirrel::squirrel{suffix}") + self.cpp_info.components["libsquirrel"].libs = [f"squirrel{suffix}"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libsquirrel"].system_libs.append("m") # sqstdlib - self.cpp_info.components["sqstdlib"].set_property("cmake_target_name", "squirrel::sqstdlib{}".format(suffix)) - self.cpp_info.components["sqstdlib"].libs = ["sqstdlib{}".format(suffix)] + self.cpp_info.components["sqstdlib"].set_property("cmake_target_name", f"squirrel::sqstdlib{suffix}") + self.cpp_info.components["sqstdlib"].libs = [f"sqstdlib{suffix}"] self.cpp_info.components["sqstdlib"].requires = ["libsquirrel"] binpath = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH env var : {}".format(binpath)) + self.output.info(f"Appending PATH env var : {binpath}") self.env_info.PATH.append(binpath) # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["libsquirrel"].names["cmake_find_package"] = "squirrel{}".format(suffix) - self.cpp_info.components["libsquirrel"].names["cmake_find_package_multi"] = "squirrel{}".format(suffix) - self.cpp_info.components["sqstdlib"].names["cmake_find_package"] = "sqstdlib{}".format(suffix) - self.cpp_info.components["sqstdlib"].names["cmake_find_package_multi"] = "sqstdlib{}".format(suffix) + self.cpp_info.components["libsquirrel"].names["cmake_find_package"] = f"squirrel{suffix}" + self.cpp_info.components["libsquirrel"].names["cmake_find_package_multi"] = f"squirrel{suffix}" + self.cpp_info.components["sqstdlib"].names["cmake_find_package"] = f"sqstdlib{suffix}" + self.cpp_info.components["sqstdlib"].names["cmake_find_package_multi"] = f"sqstdlib{suffix}" diff --git a/recipes/squirrel/all/patches/fix-cmake-static-shared.patch b/recipes/squirrel/all/patches/3.1-fix-cmake-static-shared.patch similarity index 100% rename from recipes/squirrel/all/patches/fix-cmake-static-shared.patch rename to recipes/squirrel/all/patches/3.1-fix-cmake-static-shared.patch diff --git a/recipes/squirrel/all/patches/3.2-fix-cmake-static-build.patch b/recipes/squirrel/all/patches/3.2-fix-cmake-static-build.patch new file mode 100644 index 0000000000000..95706b3133073 --- /dev/null +++ b/recipes/squirrel/all/patches/3.2-fix-cmake-static-build.patch @@ -0,0 +1,13 @@ +diff --git a/sq/CMakeLists.txt b/sq/CMakeLists.txt +index bdea07d..f7629a3 100644 +--- a/sq/CMakeLists.txt ++++ b/sq/CMakeLists.txt +@@ -15,7 +15,7 @@ endif() + + if(NOT DISABLE_STATIC) + add_executable(sq_static sq.c) +- add_executable(squirrel::interpreter_static ALIAS sq) ++ add_executable(squirrel::interpreter_static ALIAS sq_static) + set_target_properties(sq_static PROPERTIES LINKER_LANGUAGE C EXPORT_NAME interpreter_static) + target_link_libraries(sq_static squirrel_static sqstdlib_static) + if(NOT SQ_DISABLE_INSTALLER) diff --git a/recipes/squirrel/all/test_package/CMakeLists.txt b/recipes/squirrel/all/test_package/CMakeLists.txt index 503b882c67cec..13a7e10ca59c7 100644 --- a/recipes/squirrel/all/test_package/CMakeLists.txt +++ b/recipes/squirrel/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(squirrel REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) if(TARGET squirrel::squirrel_static) - target_link_libraries(${PROJECT_NAME} squirrel::squirrel_static squirrel::sqstdlib_static) + target_link_libraries(${PROJECT_NAME} PRIVATE squirrel::squirrel_static squirrel::sqstdlib_static) else() - target_link_libraries(${PROJECT_NAME} squirrel::squirrel squirrel::sqstdlib) + target_link_libraries(${PROJECT_NAME} PRIVATE squirrel::squirrel squirrel::sqstdlib) endif() diff --git a/recipes/squirrel/all/test_package/conanfile.py b/recipes/squirrel/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/squirrel/all/test_package/conanfile.py +++ b/recipes/squirrel/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/squirrel/all/test_v1_package/CMakeLists.txt b/recipes/squirrel/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/squirrel/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/squirrel/all/test_v1_package/conanfile.py b/recipes/squirrel/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/squirrel/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/squirrel/config.yml b/recipes/squirrel/config.yml index 992d10eb37c11..02e8efce1632d 100644 --- a/recipes/squirrel/config.yml +++ b/recipes/squirrel/config.yml @@ -1,3 +1,5 @@ versions: + "3.2": + folder: all "3.1": folder: all diff --git a/recipes/statslib/all/conandata.yml b/recipes/statslib/all/conandata.yml index a820f1f7bcda9..eeb058ec28754 100644 --- a/recipes/statslib/all/conandata.yml +++ b/recipes/statslib/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.0": + url: "https://github.com/kthohr/stats/archive/v3.2.0.tar.gz" + sha256: "1360ba4fbeed96db04e28541b8044daffecdbabc5565944d5cb67136477003ed" "3.1.2": url: "https://github.com/kthohr/stats/archive/v3.1.2.tar.gz" sha256: "fe82c679dbed0cbea284ce077e2c2503afaec745658a3791f9fe5010e438305e" diff --git a/recipes/statslib/config.yml b/recipes/statslib/config.yml index 464e2bade6a07..0b639b7fca8af 100644 --- a/recipes/statslib/config.yml +++ b/recipes/statslib/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.0": + folder: "all" "3.1.2": folder: "all" "3.1.1": diff --git a/recipes/stb/all/conandata.yml b/recipes/stb/all/conandata.yml index acc25a4b6d728..661745efcb3f0 100644 --- a/recipes/stb/all/conandata.yml +++ b/recipes/stb/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20220909": + url: "https://github.com/nothings/stb/archive/8b5f1f37b5b75829fc72d38e7b5d4bcbf8a26d55.zip" + sha256: "93a16ee3e866e719feec459f6f132cce932c5ec751eb38e3ec1975f911353d2e" "cci.20210910": url: "https://github.com/nothings/stb/archive/af1a5bc352164740c1cc1354942b1c6b72eacb8a.zip" sha256: "e3d0edbecd356506d3d69b87419de2f9d180a98099134c6343177885f6c2cbef" diff --git a/recipes/stb/all/conanfile.py b/recipes/stb/all/conanfile.py index 82456b9f2f836..540bdbac942b9 100644 --- a/recipes/stb/all/conanfile.py +++ b/recipes/stb/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import copy, get, rmdir +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" class StbConan(ConanFile): @@ -11,20 +14,17 @@ class StbConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/nothings/stb" license = ("Unlicense", "MIT") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True options = { - "with_deprecated": [True, False] + "with_deprecated": [True, False], } default_options = { - "with_deprecated": True + "with_deprecated": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _version(self): # HACK: Used to circumvent the incompatibility @@ -32,25 +32,36 @@ def _version(self): return str(self.version)[4:] def config_options(self): - if tools.Version(self._version) < "20210713": + if Version(self._version) < "20210713": del self.options.with_deprecated + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - self.copy("*.h", src=self._source_subfolder, dst="include") - self.copy("stb_vorbis.c", src=self._source_subfolder, dst="include") - tools.rmdir(os.path.join(self.package_folder, "include", "tests")) - if tools.Version(self._version) >= "20210713": - tools.rmdir(os.path.join(self.package_folder, "include", "deprecated")) - if self.options.get_safe("with_deprecated", False): - self.copy("*.h", src=os.path.join(self._source_subfolder, "deprecated"), dst="include") - self.copy("stb_image.c", src=os.path.join(self._source_subfolder, "deprecated"), dst="include") + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + copy(self, "stb_vorbis.c", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + rmdir(self, os.path.join(self.package_folder, "include", "tests")) + if Version(self._version) >= "20210713": + rmdir(self, os.path.join(self.package_folder, "include", "deprecated")) + if self.options.get_safe("with_deprecated"): + copy(self, "*.h", src=os.path.join(self.source_folder, "deprecated"), dst=os.path.join(self.package_folder, "include")) + copy(self, "stb_image.c", src=os.path.join(self.source_folder, "deprecated"), dst=os.path.join(self.package_folder, "include")) - def package_id(self): - self.info.header_only() - def package_info(self): - self.cpp_info.defines.append('STB_TEXTEDIT_KEYTYPE=unsigned') + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.defines.append("STB_TEXTEDIT_KEYTYPE=unsigned") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/stb/all/test_package/CMakeLists.txt b/recipes/stb/all/test_package/CMakeLists.txt index 2754a900ab220..0f7be22180d6c 100644 --- a/recipes/stb/all/test_package/CMakeLists.txt +++ b/recipes/stb/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(stb REQUIRED CONFIG) -add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} stb::stb) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE stb::stb) diff --git a/recipes/stb/all/test_package/conanfile.py b/recipes/stb/all/test_package/conanfile.py index 49a3a66ea5bad..0a6bc68712d90 100644 --- a/recipes/stb/all/test_package/conanfile.py +++ b/recipes/stb/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/stb/all/test_package/test_package.cpp b/recipes/stb/all/test_package/test_package.c similarity index 100% rename from recipes/stb/all/test_package/test_package.cpp rename to recipes/stb/all/test_package/test_package.c diff --git a/recipes/stb/all/test_v1_package/CMakeLists.txt b/recipes/stb/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/stb/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/stb/all/test_v1_package/conanfile.py b/recipes/stb/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/stb/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/stb/config.yml b/recipes/stb/config.yml index 6a85793c0ad22..8542dee027505 100644 --- a/recipes/stb/config.yml +++ b/recipes/stb/config.yml @@ -1,4 +1,6 @@ versions: + "cci.20220909": + folder: all "cci.20210910": folder: all "cci.20210713": diff --git a/recipes/stc/all/conandata.yml b/recipes/stc/all/conandata.yml index 730d48a11b46d..a87f93d04cdef 100644 --- a/recipes/stc/all/conandata.yml +++ b/recipes/stc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.1.1": + url: "https://github.com/tylov/STC/archive/refs/tags/v4.1.1.tar.gz" + sha256: "4386f7bc6480ba101f3e71b1adccfff8ccf586a31271d6ddc0f634d727d9f031" "3.9": url: "https://github.com/tylov/STC/archive/v3.9.tar.gz" sha256: "4dde312a8305620d0d5b295f895ed5c66900c9185aec8f79240ea391796da19d" diff --git a/recipes/stc/all/conanfile.py b/recipes/stc/all/conanfile.py index 038a1aa4252eb..7b5788fb609c1 100644 --- a/recipes/stc/all/conanfile.py +++ b/recipes/stc/all/conanfile.py @@ -1,10 +1,18 @@ +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -from conans import ConanFile, tools + +required_conan_version = ">=1.50.0" class StcConan(ConanFile): name = "stc" - description = "A modern, user friendly, generic, type-safe and fast C99 container library: String, Vector, Sorted and Unordered Map and Set, Deque, Forward List, Smart Pointers, Bitset and Random numbers." + description = ( + "A modern, user friendly, generic, type-safe and fast C99 container " + "library: String, Vector, Sorted and Unordered Map and Set, Deque, " + "Forward List, Smart Pointers, Bitset and Random numbers." + ) license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/tylov/STC" @@ -12,20 +20,26 @@ class StcConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - def package_id(self): - self.info.header_only() + def build(self): + pass def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if self.version == "1.0.0-rc1": - self.copy("*.h", dst="include", src=self._source_subfolder, keep_path=True) + src_include = self.source_folder else: - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include"), keep_path=True) + src_include = os.path.join(self.source_folder, "include") + copy(self, "*.h", src=src_include, dst=os.path.join(self.package_folder, "include")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/stc/all/test_package/CMakeLists.txt b/recipes/stc/all/test_package/CMakeLists.txt index 7546a0f95c244..83d4a89b6f090 100644 --- a/recipes/stc/all/test_package/CMakeLists.txt +++ b/recipes/stc/all/test_package/CMakeLists.txt @@ -1,17 +1,13 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(stc REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} stc::stc) +target_link_libraries(${PROJECT_NAME} PRIVATE stc::stc) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) if(${stc_VERSION} STREQUAL "1.0.0-rc1") target_compile_definitions(${PROJECT_NAME} PRIVATE STC_VERSION=1) elseif(${stc_VERSION} VERSION_GREATER_EQUAL "3.0.0") target_compile_definitions(${PROJECT_NAME} PRIVATE STC_VERSION=3) endif() -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD_REQUIRED ON) diff --git a/recipes/stc/all/test_package/conanfile.py b/recipes/stc/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/stc/all/test_package/conanfile.py +++ b/recipes/stc/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/stc/all/test_v1_package/CMakeLists.txt b/recipes/stc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/stc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/stc/all/test_v1_package/conanfile.py b/recipes/stc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/stc/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/stc/config.yml b/recipes/stc/config.yml index 027ba252f62a1..bfb07935d0412 100644 --- a/recipes/stc/config.yml +++ b/recipes/stc/config.yml @@ -1,4 +1,6 @@ versions: + "4.1.1": + folder: "all" "3.9": folder: "all" "3.5.1": diff --git a/recipes/stduuid/all/conandata.yml b/recipes/stduuid/all/conandata.yml index 0bc44aa93786c..cb02ec2f29148 100644 --- a/recipes/stduuid/all/conandata.yml +++ b/recipes/stduuid/all/conandata.yml @@ -1,6 +1,9 @@ sources: + "1.2.3": + url: "https://github.com/mariusbancila/stduuid/archive/v1.2.3.tar.gz" + sha256: "b1176597e789531c38481acbbed2a6894ad419aab0979c10410d59eb0ebf40d3" "1.2.2": - url: https://github.com/mariusbancila/stduuid/archive/v1.2.2.tar.gz + url: "https://github.com/mariusbancila/stduuid/archive/v1.2.2.tar.gz" sha256: "f554f6a9fe4d852fa217de6ab977afbf3f49e4a1dcb263afd61a94253c4c7a48" "1.0": url: "https://github.com/mariusbancila/stduuid/archive/v1.0.tar.gz" diff --git a/recipes/stduuid/all/conanfile.py b/recipes/stduuid/all/conanfile.py index 7e795945780f3..f5148b86a236f 100644 --- a/recipes/stduuid/all/conanfile.py +++ b/recipes/stduuid/all/conanfile.py @@ -1,18 +1,22 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" + class StduuidConan(ConanFile): name = "stduuid" description = "A C++17 cross-platform implementation for UUIDs" - topics = ("uuid", "guid") + topics = ("uuid", "guid", "header-only") license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/mariusbancila/stduuid" - settings = "os", "compiler" + settings = "os", "arch", "compiler", "build_type" options = { "with_cxx20_span": [True, False], } @@ -22,43 +26,54 @@ class StduuidConan(ConanFile): no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "20" if self.options.with_cxx20_span else "17" + + @property + def _compilers_minimum_version(self): + return { + "apple-clang": "10", + "clang": "5", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15", + } + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if not self.options.with_cxx20_span: - self.requires("ms-gsl/2.0.0") - if self.settings.os == "Linux" and tools.Version(self.version) <= "1.0": - self.requires("libuuid/1.0.3") + self.requires("ms-gsl/3.1.0", transitive_headers=True) + if self.settings.os == "Linux" and Version(self.version) <= "1.0": + self.requires("libuuid/1.0.3", transitive_headers=True, transitive_libs=True) def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppsd"): + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def validate(self): - version = Version(self.settings.compiler.version) - compiler = self.settings.compiler - if self.settings.compiler.cppstd and \ - not any([str(self.settings.compiler.cppstd) == std for std in ["17", "20", "gnu17", "gnu20"]]): - raise ConanInvalidConfiguration("stduuid requires at least c++17") - elif compiler == "Visual Studio"and version < "15": - raise ConanInvalidConfiguration("stduuid requires at least Visual Studio version 15") - else: - if ( compiler == "gcc" and version < "7" ) or ( compiler == "clang" and version < "5" ): - raise ConanInvalidConfiguration("stduuid requires a compiler that supports at least C++17") - elif compiler == "apple-clang"and version < "10": - raise ConanInvalidConfiguration("stduuid requires a compiler that supports at least C++17") + def build(self): + pass def package(self): - root_dir = self._source_subfolder - include_dir = os.path.join(root_dir, "include") - self.copy(pattern="LICENSE", dst="licenses", src=root_dir) - self.copy(pattern="uuid.h", dst="include", src=include_dir) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "uuid.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if not self.options.with_cxx20_span: - self.cpp_info.includedirs.append(os.path.join(self.deps_cpp_info["ms-gsl"].include_paths[0], "gsl")) - + self.cpp_info.includedirs.append(os.path.join(self.dependencies["ms-gsl"].cpp_info.includedirs[0], "gsl")) diff --git a/recipes/stduuid/all/test_package/CMakeLists.txt b/recipes/stduuid/all/test_package/CMakeLists.txt index 74fdb7fc70635..f8d4ca0bfacfc 100644 --- a/recipes/stduuid/all/test_package/CMakeLists.txt +++ b/recipes/stduuid/all/test_package/CMakeLists.txt @@ -1,11 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(stduuid REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} stduuid::stduuid) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE stduuid::stduuid) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +if(stduuid_VERSION VERSION_LESS "1.1") + target_compile_definitions(${PROJECT_NAME} PRIVATE STDUUID_LT_1_1) +endif() diff --git a/recipes/stduuid/all/test_package/conanfile.py b/recipes/stduuid/all/test_package/conanfile.py index 28dd8e8061367..98ab55852ad56 100644 --- a/recipes/stduuid/all/test_package/conanfile.py +++ b/recipes/stduuid/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/stduuid/all/test_package/test_package.cpp b/recipes/stduuid/all/test_package/test_package.cpp index 91cbc9798c5e3..160cf9b5db82a 100644 --- a/recipes/stduuid/all/test_package/test_package.cpp +++ b/recipes/stduuid/all/test_package/test_package.cpp @@ -1,15 +1,20 @@ -#include -#include - -#include "uuid.h" +#include -using namespace std::string_literals; +#include +#include +#include +#include +#include int main() { { - auto str = "47183823-2574-4bfd-b411-99ed177d3e43"s; + auto str = "47183823-2574-4bfd-b411-99ed177d3e43"; auto guid = uuids::uuid::from_string(str); +#ifdef STDUUID_LT_1_1 assert(uuids::to_string(guid) == str); +#else + assert(uuids::to_string(guid.value()) == str); +#endif } { @@ -21,7 +26,11 @@ int main() { uuids::uuid const guid = uuids::uuid_random_generator{generator}(); assert(!guid.is_nil()); +#ifdef STDUUID_LT_1_1 assert(guid.size() == 16); +#else + assert(guid.as_bytes().size() == 16); +#endif assert(guid.version() == uuids::uuid_version::random_number_based); assert(guid.variant() == uuids::uuid_variant::rfc); } diff --git a/recipes/stduuid/all/test_v1_package/CMakeLists.txt b/recipes/stduuid/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/stduuid/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/stduuid/all/test_v1_package/conanfile.py b/recipes/stduuid/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/stduuid/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/stduuid/config.yml b/recipes/stduuid/config.yml index ab730a8321d2a..a7bd15477bb57 100644 --- a/recipes/stduuid/config.yml +++ b/recipes/stduuid/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.3": + folder: all "1.2.2": folder: all "1.0": diff --git a/recipes/strawberryperl/all/conandata.yml b/recipes/strawberryperl/all/conandata.yml index dc29ec4938022..5d11e843fb992 100644 --- a/recipes/strawberryperl/all/conandata.yml +++ b/recipes/strawberryperl/all/conandata.yml @@ -1,15 +1,22 @@ sources: + "5.32.1.1": + x86: + url: "https://strawberryperl.com/download/5.32.1.1/strawberry-perl-5.32.1.1-32bit-portable.zip" + sha256: "d9c5711d12573a0f6d977792caa58364b1d46217521ae5c25cf5cc378a7c23c0" + x86_64: + url: "https://strawberryperl.com/download/5.32.1.1/strawberry-perl-5.32.1.1-64bit-portable.zip" + sha256: "692646105b0f5e058198a852dc52a48f1cebcaf676d63bbdeae12f4eaee9bf5c" "5.30.0.1": x86: - url: "http://strawberryperl.com/download/5.30.0.1/strawberry-perl-5.30.0.1-32bit-portable.zip" + url: "https://strawberryperl.com/download/5.30.0.1/strawberry-perl-5.30.0.1-32bit-portable.zip" sha256: "a1d77821c77b7a3298cf3fe381e57cba43f89b9859204398f36d85f33b287837" x86_64: - url: "http://strawberryperl.com/download/5.30.0.1/strawberry-perl-5.30.0.1-64bit-portable.zip" + url: "https://strawberryperl.com/download/5.30.0.1/strawberry-perl-5.30.0.1-64bit-portable.zip" sha256: "9367a64ac1451b21804a224bb6235fe6848dd42f5fa1871583821ac3dfabf013" "5.28.1.1": x86: - url: "http://strawberryperl.com/download/5.28.1.1/strawberry-perl-5.28.1.1-32bit-portable.zip" + url: "https://strawberryperl.com/download/5.28.1.1/strawberry-perl-5.28.1.1-32bit-portable.zip" sha256: "8b15c7c9574989568254a7859e473b7d5f68a1145d2e4418036600a81b13805c" x86_64: - url: "http://strawberryperl.com/download/5.28.1.1/strawberry-perl-5.28.1.1-64bit-portable.zip" + url: "https://strawberryperl.com/download/5.28.1.1/strawberry-perl-5.28.1.1-64bit-portable.zip" sha256: "935c95ba096fa11c4e1b5188732e3832d330a2a79e9882ab7ba8460ddbca810d" diff --git a/recipes/strawberryperl/all/conanfile.py b/recipes/strawberryperl/all/conanfile.py index 5fd7a34327cc3..e5d600869e82f 100644 --- a/recipes/strawberryperl/all/conanfile.py +++ b/recipes/strawberryperl/all/conanfile.py @@ -1,39 +1,54 @@ +from conan import ConanFile, conan_version +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +required_conan_version = ">=1.52.0" -class StrawberryperlConan(ConanFile): + +class StrawberryPerlConan(ConanFile): name = "strawberryperl" - description = "Strawbery Perl for Windows. Useful as build_require" - license = "GNU Public License or the Artistic License" + description = "Strawberry Perl for Windows." + license = ("Artistic-1.0", "GPL-1.0") homepage = "http://strawberryperl.com" url = "https://github.com/conan-io/conan-center-index" - topics = ("conan", "installer", "perl", "windows") - settings = "os", "arch" - short_paths = True + topics = ("perl", "interpreter", "windows") + settings = "os", "arch", "compiler", "build_type" + + def layout(self): + self.folders.build = "build" + + def package_id(self): + del self.info.settings.compiler + del self.info.settings.build_type + + def validate(self): + if self.info.settings.os != "Windows": + raise ConanInvalidConfiguration("Strawberry Perl is only intended to be used on Windows.") - def configure(self): - if self.settings.os != "Windows": - raise ConanInvalidConfiguration("Only windows supported for Strawberry Perl.") + def source(self): + pass def build(self): - arch = str(self.settings.arch) - tools.get(**self.conan_data["sources"][self.version][arch]) + get(self, **self.conan_data["sources"][self.version][str(self.settings.arch)], destination=self.build_folder) def package(self): - self.copy(pattern="License.rtf*", dst="licenses", src="licenses") - self.copy(pattern="*", src=os.path.join("perl", "bin"), dst="bin") - self.copy(pattern="*", src=os.path.join("perl", "lib"), dst="lib") - self.copy(pattern="*", src=os.path.join("perl", "vendor", "lib"), dst="lib") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, pattern="License.rtf*", src=os.path.join(self.build_folder, "licenses"), dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="*", src=os.path.join(self.build_folder, "perl", "bin"), dst=os.path.join(self.package_folder, "bin")) + copy(self, pattern="*", src=os.path.join(self.build_folder, "perl", "lib"), dst=os.path.join(self.package_folder, "lib")) + copy(self, pattern="*", src=os.path.join(self.build_folder, "perl", "vendor", "lib"), dst=os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.includedirs = [] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: %s" % bin_path) - self.env_info.PATH.append(bin_path) + perl_path = os.path.join(self.package_folder, "bin", "perl.exe").replace("\\", "/") + self.conf_info.define("user.strawberryperl:perl", perl_path) - self.user_info.perl = os.path.join(self.package_folder, "bin", "perl.exe").replace("\\", "/") + # TODO remove once conan v2 is the only support and recipes have been migrated + if Version(conan_version).major < 2: + bin_path = os.path.join(self.package_folder, "bin") + self.env_info.PATH.append(bin_path) + self.user_info.perl = perl_path diff --git a/recipes/strawberryperl/all/test_package/conanfile.py b/recipes/strawberryperl/all/test_package/conanfile.py index 397a3d181e121..8cd67438d10ce 100644 --- a/recipes/strawberryperl/all/test_package/conanfile.py +++ b/recipes/strawberryperl/all/test_package/conanfile.py @@ -1,12 +1,16 @@ +from conan import ConanFile import os -from conans import ConanFile, tools -class DefaultNameConan(ConanFile): - settings = "os", "arch" +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - self.run("perl --version", run_environment=True) - perl_script = os.path.join(self.source_folder, "list_files.pl") - self.run("perl {}".format(perl_script), run_environment=True) + self.run("perl --version") + perl_script = os.path.join(self.source_folder, "list_files.pl") + self.run(f"perl {perl_script}") diff --git a/recipes/strawberryperl/all/test_v1_package/conanfile.py b/recipes/strawberryperl/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..641d8fdb8a176 --- /dev/null +++ b/recipes/strawberryperl/all/test_v1_package/conanfile.py @@ -0,0 +1,12 @@ +import os +from conans import ConanFile, tools + + +class DefaultNameConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not tools.cross_building(self): + self.run("perl --version", run_environment=True) + perl_script = os.path.join(self.source_folder, os.pardir, "test_package", "list_files.pl") + self.run(f"perl {perl_script}", run_environment=True) diff --git a/recipes/strawberryperl/config.yml b/recipes/strawberryperl/config.yml index 4efddcd9dd418..11c21ecefe1e6 100644 --- a/recipes/strawberryperl/config.yml +++ b/recipes/strawberryperl/config.yml @@ -1,4 +1,6 @@ versions: + "5.32.1.1": + folder: all "5.30.0.1": folder: all "5.28.1.1": diff --git a/recipes/strong_type/all/conandata.yml b/recipes/strong_type/all/conandata.yml new file mode 100644 index 0000000000000..3e0188fb65a1e --- /dev/null +++ b/recipes/strong_type/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "v7": + url: https://github.com/rollbear/strong_type/archive/refs/tags/v7.tar.gz + sha256: 854365b28dfaaee5c2047dd4d2e746c809b76035191b22a4ce24f4cac49d0891 + "v8": + url: https://github.com/rollbear/strong_type/archive/refs/tags/v8.tar.gz + sha256: 31ee68e097fec2ce65dbf2ed683911c5ee6a7a37808b28d84479ef7e17990fad + "v9": + url: https://github.com/rollbear/strong_type/archive/refs/tags/v9.tar.gz + sha256: 9d71ee02256b99c7f0189295514dd683cc1be8886444d5c04623fd491cf5aa40 + "v10": + url: https://github.com/rollbear/strong_type/archive/refs/tags/v10.tar.gz + sha256: 154e4ceda6cf8fe734deb7eafdf58df5052822d04425dc7c22711ef54cdaeefa diff --git a/recipes/strong_type/all/conanfile.py b/recipes/strong_type/all/conanfile.py new file mode 100644 index 0000000000000..04af76b6e1170 --- /dev/null +++ b/recipes/strong_type/all/conanfile.py @@ -0,0 +1,68 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration +import os + +required_conan_version = ">=1.50.0" + + +class StrongTypeConan(ConanFile): + name = "strong_type" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/rollbear/strong_type" + description = "An additive strong typedef library for C++14/17/20" + topics = ("cpp14", "cpp17", "strong_type") + license = "BSL-1.0" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "7": + raise ConanInvalidConfiguration("GCC < version 7 is not supported") + + def layout(self): + basic_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "*", src=os.path.join(self.source_folder, "include"), + dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE", src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "strong_type") + self.cpp_info.set_property( + "cmake_target_name", "rollbear::strong_type") + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + + # TODO: to remove in conan v2 once cmake_find_package* generators removed + self.cpp_info.filenames["cmake_find_package"] = "strong_type" + self.cpp_info.filenames["cmake_find_package_multi"] = "strong_type" + self.cpp_info.names["cmake_find_package"] = "rollbear" + self.cpp_info.names["cmake_find_package_multi"] = "rollbear" + self.cpp_info.components["strong_type"].names["cmake_find_package"] = "strong_type" + self.cpp_info.components["strong_type"].names["cmake_find_package_multi"] = "strong_type" + self.cpp_info.components["strong_type"].set_property( + "cmake_target_name", "rollbear::strong_type") + self.cpp_info.components["strong_type"].bindirs = [] + self.cpp_info.components["strong_type"].frameworkdirs = [] + self.cpp_info.components["strong_type"].libdirs = [] + self.cpp_info.components["strong_type"].resdirs = [] diff --git a/recipes/strong_type/all/test_package/CMakeLists.txt b/recipes/strong_type/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..d668b94ccc776 --- /dev/null +++ b/recipes/strong_type/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(strong_type REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rollbear::strong_type) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/strong_type/all/test_package/conanfile.py b/recipes/strong_type/all/test_package/conanfile.py new file mode 100644 index 0000000000000..d120a992c06a6 --- /dev/null +++ b/recipes/strong_type/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/strong_type/all/test_package/test_package.cpp b/recipes/strong_type/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..b48e03ab7f9a5 --- /dev/null +++ b/recipes/strong_type/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include + + +int main() { + using myint = strong::type; + + if (value_of(myint{3}) == 3) + return 0; + + return 1; +} diff --git a/recipes/strong_type/all/test_v1_package/CMakeLists.txt b/recipes/strong_type/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..1690306012889 --- /dev/null +++ b/recipes/strong_type/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(strong_type REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE rollbear::strong_type) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/strong_type/all/test_v1_package/conanfile.py b/recipes/strong_type/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a500b98343c74 --- /dev/null +++ b/recipes/strong_type/all/test_v1_package/conanfile.py @@ -0,0 +1,16 @@ +from conans import ConanFile, CMake, tools +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/strong_type/config.yml b/recipes/strong_type/config.yml new file mode 100644 index 0000000000000..a45ecce57a17a --- /dev/null +++ b/recipes/strong_type/config.yml @@ -0,0 +1,9 @@ +versions: + "v7": + folder: all + "v8": + folder: all + "v9": + folder: all + "v10": + folder: all diff --git a/recipes/svector/all/conandata.yml b/recipes/svector/all/conandata.yml new file mode 100644 index 0000000000000..876425a447ec4 --- /dev/null +++ b/recipes/svector/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.2": + url: "https://github.com/martinus/svector/archive/refs/tags/v1.0.2.tar.gz" + sha256: "317743113aff89c7c11682ad7ed504a043885be7497f791cb393ba5a7a8d3c41" diff --git a/recipes/svector/all/conanfile.py b/recipes/svector/all/conanfile.py new file mode 100644 index 0000000000000..68edc50346896 --- /dev/null +++ b/recipes/svector/all/conanfile.py @@ -0,0 +1,65 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.layout import basic_layout + +import os + +required_conan_version = ">=1.52.0" + +class PackageConan(ConanFile): + name = "svector" + description = "Compact SVO optimized vector for C++17 or higher" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/martinus/svector" + topics = ("vector", "container", "small-vector", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _minimum_cpp_standard(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15.7", + "msvc": "191", + "gcc": "7", + "clang": "7", + "apple-clang": "10", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + # FIXME: self.info.settings.compiler does not work with header-only packages + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.get_safe("compiler.version")) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/svector/all/test_package/CMakeLists.txt b/recipes/svector/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..38ea734d2c8a7 --- /dev/null +++ b/recipes/svector/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +find_package(svector REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE svector::svector) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/svector/all/test_package/conanfile.py b/recipes/svector/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/svector/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/svector/all/test_package/test_package.cpp b/recipes/svector/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..3e0125d432c37 --- /dev/null +++ b/recipes/svector/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#include "ankerl/svector.h" + +int main(void) { + auto vec = ankerl::svector(); + for (int i = 0; i < 100; ++i) { + vec.push_back(i); + } + auto data = vec.data(); + + return 0; +} diff --git a/recipes/svector/all/test_v1_package/CMakeLists.txt b/recipes/svector/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..33ce3d62f2939 --- /dev/null +++ b/recipes/svector/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(svector REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE svector::svector) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/svector/all/test_v1_package/conanfile.py b/recipes/svector/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/svector/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/svector/config.yml b/recipes/svector/config.yml new file mode 100644 index 0000000000000..8457ca9a4a8cd --- /dev/null +++ b/recipes/svector/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0.2": + folder: all diff --git a/recipes/swig/all/conandata.yml b/recipes/swig/all/conandata.yml index 639cc9e72797d..7c4f531b134a3 100644 --- a/recipes/swig/all/conandata.yml +++ b/recipes/swig/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "4.1.0": + url: "https://github.com/swig/swig/archive/refs/tags/v4.1.0.tar.gz" + sha256: "5b9313b1af5edfcea158a389520be266f013bc9be4ce933d79a30c5659ba99fe" "4.0.2": url: "https://github.com/swig/swig/archive/rel-4.0.2.tar.gz" sha256: "81d7ce78371f378a3299ddc5aea1da9a6178f325dcabb695d1b742f9e24a0fa6" @@ -6,6 +9,11 @@ sources: url: "https://github.com/swig/swig/archive/rel-4.0.1.tar.gz" sha256: "2eaf6fb89d071d1be280bf995c63360b3729860c0da64948123b5d7e4cfb6cb7" patches: + "4.1.0": + - base_path: "source_subfolder" + patch_file: "patches/0001-4.1.0-swig-linux-library-path.patch" + - base_path: "source_subfolder" + patch_file: "patches/0002-4.1.0-do-not-define-SWIG_LIB_WIN_UNIX.patch" "4.0.2": - base_path: "source_subfolder" patch_file: "patches/0001-swig-linux-library-path.patch" diff --git a/recipes/swig/all/conanfile.py b/recipes/swig/all/conanfile.py index a8493d08a9cb3..432bfb37aeca5 100644 --- a/recipes/swig/all/conanfile.py +++ b/recipes/swig/all/conanfile.py @@ -1,4 +1,6 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment +from conan import ConanFile +from conan.tools.files import get +from conans import AutoToolsBuildEnvironment, tools import contextlib import functools import os @@ -24,8 +26,16 @@ def _source_subfolder(self): def _settings_build(self): return getattr(self, "settings_build", self.settings) + @property + def _use_pcre2(self): + return self.version not in ['4.0.1', '4.0.2'] + + def requirements(self): - self.requires("pcre/8.45") + if self._use_pcre2: + self.requires("pcre2/10.40") + else: + self.requires("pcre/8.45") def build_requirements(self): if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): @@ -33,15 +43,15 @@ def build_requirements(self): if self.settings.compiler == "Visual Studio": self.build_requires("winflexbison/2.5.24") else: - self.build_requires("bison/3.7.6") - self.build_requires("automake/1.16.4") + self.build_requires("bison/3.8.2") + self.build_requires("automake/1.16.5") def package_id(self): del self.info.settings.compiler def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self._source_subfolder, strip_root=True) @property def _user_info_build(self): @@ -81,12 +91,12 @@ def _configure_autotools(self): libargs = list("-L\"{}\"".format(p) for p in deps_libpaths) + list("-l\"{}\"".format(l) for l in deps_libs) args = [ - "PCRE_LIBS={}".format(" ".join(libargs)), - "PCRE_CPPFLAGS={}".format(" ".join("-D{}".format(define) for define in deps_defines)), + "{}_LIBS={}".format("PCRE2" if self._use_pcre2 else "PCRE", " ".join(libargs)), + "{}_CPPFLAGS={}".format("PCRE2" if self._use_pcre2 else "PCRE", " ".join("-D{}".format(define) for define in deps_defines)), "--host={}".format(self.settings.arch), "--with-swiglibdir={}".format(self._swiglibdir), ] - if self.settings.compiler == 'gcc': + if self.settings.os == "Linux": args.append("LIBS=-ldl") host, build = None, None diff --git a/recipes/swig/all/patches/0001-4.1.0-swig-linux-library-path.patch b/recipes/swig/all/patches/0001-4.1.0-swig-linux-library-path.patch new file mode 100644 index 0000000000000..bc66e9d537d4a --- /dev/null +++ b/recipes/swig/all/patches/0001-4.1.0-swig-linux-library-path.patch @@ -0,0 +1,51 @@ +--- Source/Modules/main.cxx ++++ Source/Modules/main.cxx +@@ -886,6 +886,32 @@ static void getoptions(int argc, char *argv[]) { + + static void SWIG_exit_handler(int status); + ++#if defined(HAVE_UNISTD_H) && !defined(_WIN32) ++#include ++#include ++#include ++ ++static String *get_exe_path(void) { ++ Dl_info info; ++ if (dladdr("main", &info)) { ++ char realp_buffer[PATH_MAX]; ++ char* res = NULL; ++ ++ res = realpath(info.dli_fname, realp_buffer); ++ if (!res) { ++ return NewString(SWIG_LIB); ++ } ++ ++ const char* dir = dirname(realp_buffer); ++ char dest_buf[PATH_MAX]; ++ strcpy(dest_buf, dir); ++ strcat(dest_buf, "/swiglib"); ++ return NewStringWithSize(dest_buf, strlen(dest_buf)); ++ } ++ return NewString(SWIG_LIB); ++} ++#endif ++ + int SWIG_main(int argc, char *argv[], const TargetLanguageModule *tlm) { + char *c; + +@@ -935,12 +961,14 @@ int SWIG_main(int argc, char *argv[], const TargetLanguageModule *tlm) { + char *p; + if (!(GetModuleFileName(0, buf, MAX_PATH) == 0 || (p = strrchr(buf, '\\')) == 0)) { + *(p + 1) = '\0'; +- SwigLib = NewStringf("%sLib", buf); // Native windows installation path ++ SwigLib = NewStringf("%sswiglib", buf); // Native windows installation path + } else { + SwigLib = NewStringf(""); // Unexpected error + } + if (Len(SWIG_LIB_WIN_UNIX) > 0) + SwigLibWinUnix = NewString(SWIG_LIB_WIN_UNIX); // Unix installation path using a drive letter (for msys/mingw) ++#elif defined(HAVE_UNISTD_H) && !defined(_WIN32) ++ SwigLib = get_exe_path(); + #else + SwigLib = NewString(SWIG_LIB); + #endif diff --git a/recipes/swig/all/patches/0002-4.1.0-do-not-define-SWIG_LIB_WIN_UNIX.patch b/recipes/swig/all/patches/0002-4.1.0-do-not-define-SWIG_LIB_WIN_UNIX.patch new file mode 100644 index 0000000000000..5c3961363c8dc --- /dev/null +++ b/recipes/swig/all/patches/0002-4.1.0-do-not-define-SWIG_LIB_WIN_UNIX.patch @@ -0,0 +1,11 @@ +--- configure.ac ++++ configure.ac +@@ -2825,7 +2825,7 @@ case $build in + *-*-cygwin*) SWIG_LIB_WIN_UNIX=`cygpath --mixed "$SWIG_LIB"`;; + *) SWIG_LIB_WIN_UNIX="";; + esac +-AC_DEFINE_UNQUOTED(SWIG_LIB_WIN_UNIX, ["$SWIG_LIB_WIN_UNIX"], [Directory for SWIG system-independent libraries (Unix install on native Windows)]) ++AC_DEFINE_UNQUOTED(SWIG_LIB_WIN_UNIX, [""], [Directory for SWIG system-independent libraries (Unix install on native Windows)]) + + SWIG_LIB_PREINST=$ABS_SRCDIR/Lib + AC_SUBST(SWIG_LIB_PREINST) diff --git a/recipes/swig/config.yml b/recipes/swig/config.yml index 1e30a6b6a6a43..543f01b80f536 100644 --- a/recipes/swig/config.yml +++ b/recipes/swig/config.yml @@ -1,4 +1,6 @@ versions: + "4.1.0": + folder: "all" "4.0.2": folder: "all" "4.0.1": diff --git a/recipes/symengine/all/CMakeLists.txt b/recipes/symengine/all/CMakeLists.txt deleted file mode 100644 index 1848ca5a77c35..0000000000000 --- a/recipes/symengine/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/symengine/all/conanfile.py b/recipes/symengine/all/conanfile.py index f562e2020bf8a..fdeeda1c8eefc 100644 --- a/recipes/symengine/all/conanfile.py +++ b/recipes/symengine/all/conanfile.py @@ -1,7 +1,16 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.files import ( + apply_conandata_patches, + collect_libs, + copy, + get, + rm, + rmdir, +) import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class SymengineConan(ConanFile): @@ -12,7 +21,6 @@ class SymengineConan(ConanFile): homepage = "https://symengine.org/" url = "https://github.com/conan-io/conan-center-index" exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" settings = "os", "compiler", "build_type", "arch" options = { "shared": [True, False], @@ -26,66 +34,62 @@ class SymengineConan(ConanFile): } short_paths = True - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def requirements(self): if self.options.integer_class == "boostmp": - self.requires("boost/1.79.0") + self.requires("boost/1.81.0") else: self.requires("gmp/6.2.1") def source(self): - tools.get( + get( + self, **self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder, + destination=self.source_folder, ) - def _configure_cmake(self): - if self._cmake is None: - self._cmake = CMake(self) - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["BUILD_BENCHMARKS"] = False - self._cmake.definitions["INTEGER_CLASS"] = self.options.integer_class - self._cmake.definitions["MSVC_USE_MT"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + tc.variables["BUILD_BENCHMARKS"] = False + tc.variables["INTEGER_CLASS"] = self.options.integer_class + tc.variables["MSVC_USE_MT"] = False + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy( + self, + "LICENSE", + src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses"), + ) + cmake = CMake(self) cmake.install() # [CMAKE-MODULES-CONFIG-FILES (KB-H016)] - tools.remove_files_by_mask(self.package_folder, "*.cmake") + rm(self, "*.cmake", self.package_folder, recursive=True) # [DEFAULT PACKAGE LAYOUT (KB-H013)] - tools.rmdir(os.path.join(self.package_folder, "CMake")) + rmdir(self, os.path.join(self.package_folder, "CMake")) def package_info(self): self.cpp_info.libs = ["symengine"] - if any("teuchos" in v for v in tools.collect_libs(self)): + if any("teuchos" in v for v in collect_libs(self)): self.cpp_info.libs.append("teuchos") + if self.settings.os == "Linux": + self.cpp_info.system_libs.append("m") self.cpp_info.names["cmake_find_package"] = "symengine" # FIXME: symengine exports a non-namespaced `symengine` target. self.cpp_info.names["cmake_find_package_multi"] = "symengine" diff --git a/recipes/symengine/all/test_package/CMakeLists.txt b/recipes/symengine/all/test_package/CMakeLists.txt index 62739795b7eca..7b0ebad6adca2 100644 --- a/recipes/symengine/all/test_package/CMakeLists.txt +++ b/recipes/symengine/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.1) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(symengine REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) diff --git a/recipes/symengine/all/test_package/conanfile.py b/recipes/symengine/all/test_package/conanfile.py index 7e1802f4cdc24..8a86f655664c1 100644 --- a/recipes/symengine/all/test_package/conanfile.py +++ b/recipes/symengine/all/test_package/conanfile.py @@ -1,18 +1,31 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_CXX_STANDARD"] = "11" + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["CMAKE_CXX_STANDARD"] = "11" cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/symengine/all/test_v1_package/CMakeLists.txt b/recipes/symengine/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..62739795b7eca --- /dev/null +++ b/recipes/symengine/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(symengine REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE symengine::symengine) # FIXME: Replace `symengine::symengine` with `symengine` diff --git a/recipes/symengine/all/test_v1_package/conanfile.py b/recipes/symengine/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7e1802f4cdc24 --- /dev/null +++ b/recipes/symengine/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["CMAKE_CXX_STANDARD"] = "11" + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/symengine/all/test_v1_package/test_package.cpp b/recipes/symengine/all/test_v1_package/test_package.cpp new file mode 100644 index 0000000000000..62249dac49da7 --- /dev/null +++ b/recipes/symengine/all/test_v1_package/test_package.cpp @@ -0,0 +1,13 @@ +#include +#include +#include +#include + +#include + +int main() { + SymEngine::Expression pi_by_12 = + SymEngine::div(SymEngine::pi, SymEngine::integer(12)); + std::cout << pi_by_12 << std::endl; + return 0; +} diff --git a/recipes/systemc/all/conandata.yml b/recipes/systemc/all/conandata.yml index bd45a2b685371..db213ca0aa834 100644 --- a/recipes/systemc/all/conandata.yml +++ b/recipes/systemc/all/conandata.yml @@ -2,6 +2,9 @@ sources: "2.3.3": url: https://github.com/accellera-official/systemc/archive/2.3.3.tar.gz sha256: 5781b9a351e5afedabc37d145e5f7edec08f3fd5de00ffeb8fa1f3086b1f7b3f + "2.3.4": + url: https://github.com/accellera-official/systemc/archive/2.3.4.tar.gz + sha256: bfb309485a8ad35a08ee78827d1647a451ec5455767b25136e74522a6f41e0ea patches: "2.3.3": - patch_file: "patches/0001-cmake.patch" @@ -10,3 +13,10 @@ patches: base_path: "source_subfolder" - patch_file: "patches/0003-mingw.patch" base_path: "source_subfolder" + "2.3.4": + - patch_file: "patches/0002-sc_string_view.patch" + base_path: "source_subfolder" + - patch_file: "patches/0003-mingw.patch" + base_path: "source_subfolder" + - patch_file: "patches/0004-cmake.patch" + base_path: "source_subfolder" diff --git a/recipes/systemc/all/patches/0004-cmake.patch b/recipes/systemc/all/patches/0004-cmake.patch new file mode 100644 index 0000000000000..83eead38732bc --- /dev/null +++ b/recipes/systemc/all/patches/0004-cmake.patch @@ -0,0 +1,21 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -277,12 +277,12 @@ + FORCE) + endif (NOT CMAKE_BUILD_TYPE) + +-set (CMAKE_CXX_STANDARD 98 CACHE STRING +- "C++ standard to build all targets. Supported values are 98, 11, 14, and 17.") +-set (CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL +- "The with CMAKE_CXX_STANDARD selected C++ standard is a requirement.") +-mark_as_advanced (CMAKE_CXX_STANDARD_REQUIRED) +- ++#set (CMAKE_CXX_STANDARD 98 CACHE STRING ++# "C++ standard to build all targets. Supported values are 98, 11, 14, and 17.") ++#set (CMAKE_CXX_STANDARD_REQUIRED ON CACHE BOOL ++# "The with CMAKE_CXX_STANDARD selected C++ standard is a requirement.") ++#mark_as_advanced (CMAKE_CXX_STANDARD_REQUIRED) ++# + if (NOT (WIN32 OR CYGWIN)) + option (BUILD_SHARED_LIBS "Build shared libraries." ON) + else (NOT (WIN32 OR CYGWIN)) diff --git a/recipes/systemc/config.yml b/recipes/systemc/config.yml index aecfc131896bc..695969ee424ef 100644 --- a/recipes/systemc/config.yml +++ b/recipes/systemc/config.yml @@ -1,3 +1,5 @@ versions: "2.3.3": folder: "all" + "2.3.4": + folder: "all" diff --git a/recipes/szip/all/CMakeLists.txt b/recipes/szip/all/CMakeLists.txt deleted file mode 100644 index 217b9530b904d..0000000000000 --- a/recipes/szip/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory("source_subfolder") diff --git a/recipes/szip/all/conandata.yml b/recipes/szip/all/conandata.yml index 52d2161a0f0cf..920d26895e800 100644 --- a/recipes/szip/all/conandata.yml +++ b/recipes/szip/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "2.1.1": - patch_file: "patches/fix_unknown_size_t.patch" - base_path: "source_subfolder" - patch_file: "patches/build_either_static_or_shared.patch" - base_path: "source_subfolder" diff --git a/recipes/szip/all/conanfile.py b/recipes/szip/all/conanfile.py index ca722c2adb2c4..b431b4a8bec9e 100644 --- a/recipes/szip/all/conanfile.py +++ b/recipes/szip/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, export_conandata_patches, collect_libs, get, copy, replace_in_file, save +from conan.tools.build import cross_building import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class SzipConan(ConanFile): @@ -10,7 +13,7 @@ class SzipConan(ConanFile): description = "C Implementation of the extended-Rice lossless compression " \ "algorithm, suitable for use with scientific data." license = "Szip License" - topics = ("szip", "compression", "decompression") + topics = "compression", "decompression" homepage = "https://support.hdfgroup.org/doc_resource/SZIP/" url = "https://github.com/conan-io/conan-center-index" @@ -28,21 +31,8 @@ class SzipConan(ConanFile): "enable_large_file": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -50,41 +40,52 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), + apply_conandata_patches(self) + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "set (CMAKE_POSITION_INDEPENDENT_CODE ON)", "") - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["SZIP_ENABLE_ENCODING"] = self.options.enable_encoding - self._cmake.definitions["SZIP_EXTERNALLY_CONFIGURED"] = True - self._cmake.definitions["BUILD_TESTING"] = False - self._cmake.definitions["SZIP_BUILD_FRAMEWORKS"] = False - self._cmake.definitions["SZIP_PACK_MACOSX_FRAMEWORK"] = False - self._cmake.definitions["SZIP_ENABLE_LARGE_FILE"] = self.options.enable_large_file - if tools.cross_building(self, skip_x64_x86=True) and self.options.enable_large_file: + def generate(self): + tc = CMakeToolchain(self) + tc.variables["SZIP_ENABLE_ENCODING"] = self.options.enable_encoding + tc.variables["SZIP_EXTERNALLY_CONFIGURED"] = True + tc.variables["BUILD_TESTING"] = False + tc.variables["SZIP_BUILD_FRAMEWORKS"] = False + tc.variables["SZIP_PACK_MACOSX_FRAMEWORK"] = False + tc.variables["SZIP_ENABLE_LARGE_FILE"] = self.options.enable_large_file + if cross_building(self, skip_x64_x86=True) and self.options.enable_large_file: # Assume it works, otherwise raise in 'validate' function - self._cmake.definitions["TEST_LFS_WORKS_RUN"] = True - self._cmake.definitions["TEST_LFS_WORKS_RUN__TRYRUN_OUTPUT"] = True - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["TEST_LFS_WORKS_RUN"] = True + tc.variables["TEST_LFS_WORKS_RUN__TRYRUN_OUTPUT"] = True + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -92,8 +93,7 @@ def package(self): {"szip-shared" if self.options.shared else "szip-static": "szip::szip"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -102,16 +102,22 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "szip") self.cpp_info.set_property("cmake_target_name", "szip-shared" if self.options.shared else "szip-static") - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.extend(["m"]) + + if self.options.shared: + self.cpp_info.defines.append("SZ_BUILT_AS_DYNAMIC_LIB=1") # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/szip/all/test_package/CMakeLists.txt b/recipes/szip/all/test_package/CMakeLists.txt index 9338e5b029a4d..2cc3f3a2650b9 100644 --- a/recipes/szip/all/test_package/CMakeLists.txt +++ b/recipes/szip/all/test_package/CMakeLists.txt @@ -1,14 +1,12 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package C) find_package(szip REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) if(TARGET szip-shared) target_link_libraries(${PROJECT_NAME} szip-shared) -else() +else () target_link_libraries(${PROJECT_NAME} szip-static) -endif() +endif () diff --git a/recipes/szip/all/test_package/conanfile.py b/recipes/szip/all/test_package/conanfile.py index 38f4483872d47..a9fb96656f203 100644 --- a/recipes/szip/all/test_package/conanfile.py +++ b/recipes/szip/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/szip/all/test_v1_package/CMakeLists.txt b/recipes/szip/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..54dab32a19430 --- /dev/null +++ b/recipes/szip/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + + +find_package(szip REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) + +if(TARGET szip-shared) + target_link_libraries(${PROJECT_NAME} szip-shared) +else () + target_link_libraries(${PROJECT_NAME} szip-static) +endif () diff --git a/recipes/szip/all/test_v1_package/conanfile.py b/recipes/szip/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/szip/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/taglib/all/conandata.yml b/recipes/taglib/all/conandata.yml index fff234108d27d..af90af9573848 100644 --- a/recipes/taglib/all/conandata.yml +++ b/recipes/taglib/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.13": + url: "https://taglib.org/releases/taglib-1.13.tar.gz" + sha256: "58f08b4db3dc31ed152c04896ee9172d22052bc7ef12888028c01d8b1d60ade0" "1.12": url: "https://taglib.org/releases/taglib-1.12.tar.gz" sha256: "7fccd07669a523b07a15bd24c8da1bbb92206cb19e9366c3692af3d79253b703" diff --git a/recipes/taglib/all/conanfile.py b/recipes/taglib/all/conanfile.py index b497dea042ad7..23a0beef8e885 100644 --- a/recipes/taglib/all/conanfile.py +++ b/recipes/taglib/all/conanfile.py @@ -1,20 +1,22 @@ from conan import ConanFile +from conan.tools.build import stdcpp_library from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rm, rmdir -from conans import tools as tools_legacy +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class TaglibConan(ConanFile): name = "taglib" description = "TagLib is a library for reading and editing the metadata of several popular audio formats." license = ("LGPL-2.1-or-later", "MPL-1.1") - topics = ("taglib", "audio", "metadata") + topics = ("audio", "metadata") homepage = "https://taglib.org" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,8 +30,7 @@ class TaglibConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,17 +38,16 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - - def requirements(self): - self.requires("zlib/1.2.12") + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") + def requirements(self): + self.requires("zlib/1.2.13") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -56,8 +56,6 @@ def generate(self): tc.variables["BUILD_TESTS"] = False tc.variables["BUILD_EXAMPLES"] = False tc.variables["BUILD_BINDINGS"] = self.options.bindings - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() cd = CMakeDeps(self) cd.generate() @@ -69,7 +67,10 @@ def _patch_sources(self): os.path.join(self.source_folder, "taglib", "CMakeLists.txt"), os.path.join(self.source_folder, "bindings", "c", "CMakeLists.txt"), ]: - replace_in_file(self, cmakelists, "INSTALL_NAME_DIR ${LIB_INSTALL_DIR}", "") + if Version(self.version) >= "1.13": + replace_in_file(self, cmakelists, "INSTALL_NAME_DIR ${CMAKE_INSTALL_LIBDIR}", "") + else: + replace_in_file(self, cmakelists, "INSTALL_NAME_DIR ${LIB_INSTALL_DIR}", "") def build(self): self._patch_sources() @@ -93,12 +94,14 @@ def package_info(self): self.cpp_info.components["tag"].requires = ["zlib::zlib"] if not self.options.shared: self.cpp_info.components["tag"].defines.append("TAGLIB_STATIC") + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["tag"].system_libs.append("m") if self.options.bindings: self.cpp_info.components["tag_c"].set_property("pkg_config_name", "taglib_c") self.cpp_info.components["tag_c"].libs = ["tag_c"] self.cpp_info.components["tag_c"].requires = ["tag"] if not self.options.shared: - libcxx = tools_legacy.stdcpp_library(self) + libcxx = stdcpp_library(self) if libcxx: self.cpp_info.components["tag"].system_libs.append(libcxx) diff --git a/recipes/taglib/all/test_package/conanfile.py b/recipes/taglib/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/taglib/all/test_package/conanfile.py +++ b/recipes/taglib/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/taglib/all/test_v1_package/CMakeLists.txt b/recipes/taglib/all/test_v1_package/CMakeLists.txt index 080590d88dd86..0d20897301b68 100644 --- a/recipes/taglib/all/test_v1_package/CMakeLists.txt +++ b/recipes/taglib/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(taglib REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE taglib::taglib) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/taglib/config.yml b/recipes/taglib/config.yml index d99e3416a26b3..c171123076114 100644 --- a/recipes/taglib/config.yml +++ b/recipes/taglib/config.yml @@ -1,3 +1,5 @@ versions: + "1.13": + folder: all "1.12": folder: all diff --git a/recipes/taocpp-operators/all/conanfile.py b/recipes/taocpp-operators/all/conanfile.py index 37c32fbd3a48a..fa4f4d82a6924 100644 --- a/recipes/taocpp-operators/all/conanfile.py +++ b/recipes/taocpp-operators/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class TaoCPPOperatorsConan(ConanFile): @@ -14,28 +17,32 @@ class TaoCPPOperatorsConan(ConanFile): no_copy_source = True settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE*", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "taocpp-operators") self.cpp_info.set_property("cmake_target_name", "taocpp::operators") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "taocpp-operators" @@ -45,3 +52,5 @@ def package_info(self): self.cpp_info.components["_taocpp-operators"].names["cmake_find_package"] = "operators" self.cpp_info.components["_taocpp-operators"].names["cmake_find_package_multi"] = "operators" self.cpp_info.components["_taocpp-operators"].set_property("cmake_target_name", "taocpp::operators") + self.cpp_info.components["_taocpp-operators"].bindirs = [] + self.cpp_info.components["_taocpp-operators"].libdirs = [] diff --git a/recipes/taocpp-operators/all/test_package/CMakeLists.txt b/recipes/taocpp-operators/all/test_package/CMakeLists.txt index 4128757a5eb23..f0441a83fe6de 100644 --- a/recipes/taocpp-operators/all/test_package/CMakeLists.txt +++ b/recipes/taocpp-operators/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(taocpp-operators REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} taocpp::operators) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE taocpp::operators) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/taocpp-operators/all/test_package/conanfile.py b/recipes/taocpp-operators/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/taocpp-operators/all/test_package/conanfile.py +++ b/recipes/taocpp-operators/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/taocpp-operators/all/test_v1_package/CMakeLists.txt b/recipes/taocpp-operators/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/taocpp-operators/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/taocpp-operators/all/test_v1_package/conanfile.py b/recipes/taocpp-operators/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/taocpp-operators/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/taocpp-sequences/all/conanfile.py b/recipes/taocpp-sequences/all/conanfile.py index ab79c2745d7c1..8ca3b5e55b754 100644 --- a/recipes/taocpp-sequences/all/conanfile.py +++ b/recipes/taocpp-sequences/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class TaoCPPSequencesonan(ConanFile): @@ -14,28 +17,32 @@ class TaoCPPSequencesonan(ConanFile): no_copy_source = True settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "taocpp-sequences") self.cpp_info.set_property("cmake_target_name", "taocpp::sequences") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "taocpp-sequences" @@ -45,3 +52,5 @@ def package_info(self): self.cpp_info.components["_taocpp-sequences"].names["cmake_find_package"] = "sequences" self.cpp_info.components["_taocpp-sequences"].names["cmake_find_package_multi"] = "sequences" self.cpp_info.components["_taocpp-sequences"].set_property("cmake_target_name", "taocpp::sequences") + self.cpp_info.components["_taocpp-sequences"].bindirs = [] + self.cpp_info.components["_taocpp-sequences"].libdirs = [] diff --git a/recipes/taocpp-sequences/all/test_package/CMakeLists.txt b/recipes/taocpp-sequences/all/test_package/CMakeLists.txt index a8f00edeb9578..4333a397a88de 100644 --- a/recipes/taocpp-sequences/all/test_package/CMakeLists.txt +++ b/recipes/taocpp-sequences/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(taocpp-sequences REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} taocpp::sequences) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE taocpp::sequences) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/taocpp-sequences/all/test_package/conanfile.py b/recipes/taocpp-sequences/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/taocpp-sequences/all/test_package/conanfile.py +++ b/recipes/taocpp-sequences/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/taocpp-sequences/all/test_v1_package/CMakeLists.txt b/recipes/taocpp-sequences/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/taocpp-sequences/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/taocpp-sequences/all/test_v1_package/conanfile.py b/recipes/taocpp-sequences/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/taocpp-sequences/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/taocpp-taopq/all/CMakeLists.txt b/recipes/taocpp-taopq/all/CMakeLists.txt deleted file mode 100644 index 7d5ba25565b0a..0000000000000 --- a/recipes/taocpp-taopq/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/taocpp-taopq/all/conandata.yml b/recipes/taocpp-taopq/all/conandata.yml index 0019bb42bc62c..b825cbd0e993f 100644 --- a/recipes/taocpp-taopq/all/conandata.yml +++ b/recipes/taocpp-taopq/all/conandata.yml @@ -1,7 +1,7 @@ sources: "cci.20210727": - sha256: 7d5b801984f71140a8579989e29b746d56167eccb710d821b2336eac723b51a3 - url: https://github.com/taocpp/taopq/archive/3212b6eb74637277b40095d2ab2db872a76c6d9f.tar.gz + url: "https://github.com/taocpp/taopq/archive/3212b6eb74637277b40095d2ab2db872a76c6d9f.tar.gz" + sha256: "7d5b801984f71140a8579989e29b746d56167eccb710d821b2336eac723b51a3" "cci.20200222": - sha256: d10d29dace4d752484c3174bf07903b471c8746d06e9ca0e3e85c4bed676edaa - url: https://github.com/taocpp/taopq/archive/b7f66c8dbe993cba250c8e9f0878128b1ad74ff9.tar.gz + url: "https://github.com/taocpp/taopq/archive/b7f66c8dbe993cba250c8e9f0878128b1ad74ff9.tar.gz" + sha256: "d10d29dace4d752484c3174bf07903b471c8746d06e9ca0e3e85c4bed676edaa" diff --git a/recipes/taocpp-taopq/all/conanfile.py b/recipes/taocpp-taopq/all/conanfile.py index 29a15d8a46876..4cf5de4b29231 100644 --- a/recipes/taocpp-taopq/all/conanfile.py +++ b/recipes/taocpp-taopq/all/conanfile.py @@ -1,9 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class TaoCPPTaopqConan(ConanFile): @@ -14,7 +17,7 @@ class TaoCPPTaopqConan(ConanFile): description = "C++ client library for PostgreSQL" topics = ("cpp17", "postgresql", "libpq", "data-base", "sql") - settings = "os", "build_type", "compiler", "arch" + settings = "os", "arch", "build_type", "compiler" options = { "shared": [True, False], "fPIC": [True, False], @@ -24,24 +27,18 @@ class TaoCPPTaopqConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def _min_cppstd(self): + return "17" @property - def _min_compilers_version(self): + def _compilers_minimum_version(self): return { "gcc": "7", "clang": "6", "apple-clang": "10", - "Visual Studio": "15" + "Visual Studio": "15", + "msvc": "191", } def config_options(self): @@ -50,48 +47,55 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libpq/14.2") + self.requires("libpq/14.5") def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "17") - min_compiler_version = self._min_compilers_version.get(str(self.settings.compiler), False) - if min_compiler_version: - if tools.Version(self.settings.compiler.version) < min_compiler_version: - raise ConanInvalidConfiguration("taocpp-taopq requires C++17, which your compiler does not support.") - else: - self.output.warn("taocpp-taopq requires C++17. Your compiler is unknown. Assuming it supports C++17.") + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["TAOPQ_BUILD_TESTS"] = False - cmake.definitions["TAOPQ_INSTALL_DOC_DIR"] = "licenses" - cmake.configure(build_folder=self._build_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TAOPQ_BUILD_TESTS"] = False + tc.variables["TAOPQ_INSTALL_DOC_DIR"] = "licenses" + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "taopq") self.cpp_info.set_property("cmake_target_name", "taocpp::taopq") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed self.cpp_info.components["_taocpp-taopq"].libs = ["taopq"] - if self.settings.os == "Windows": - self.cpp_info.components["_taocpp-taopq"].system_libs = ["Ws2_32"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["_taocpp-taopq"].system_libs.append("m") + elif self.settings.os == "Windows": + self.cpp_info.components["_taocpp-taopq"].system_libs.append("ws2_32") # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.filenames["cmake_find_package"] = "taopq" diff --git a/recipes/taocpp-taopq/all/test_package/CMakeLists.txt b/recipes/taocpp-taopq/all/test_package/CMakeLists.txt index 670b0751cce41..6e73a15321e7c 100644 --- a/recipes/taocpp-taopq/all/test_package/CMakeLists.txt +++ b/recipes/taocpp-taopq/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(taopq REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} taocpp::taopq) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE taocpp::taopq) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/taocpp-taopq/all/test_package/conanfile.py b/recipes/taocpp-taopq/all/test_package/conanfile.py index 38f4483872d47..98ab55852ad56 100644 --- a/recipes/taocpp-taopq/all/test_package/conanfile.py +++ b/recipes/taocpp-taopq/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/taocpp-taopq/all/test_v1_package/CMakeLists.txt b/recipes/taocpp-taopq/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/taocpp-taopq/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/taocpp-taopq/all/test_v1_package/conanfile.py b/recipes/taocpp-taopq/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/taocpp-taopq/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/taocpp-tuple/all/conanfile.py b/recipes/taocpp-tuple/all/conanfile.py index 901f53a0bfa76..2fbdbdde10935 100644 --- a/recipes/taocpp-tuple/all/conanfile.py +++ b/recipes/taocpp-tuple/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class TaoCPPTupleConan(ConanFile): @@ -14,28 +17,32 @@ class TaoCPPTupleConan(ConanFile): no_copy_source = True settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "taocpp-tuple") self.cpp_info.set_property("cmake_target_name", "taocpp::tuple") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "taocpp-tuple" @@ -45,3 +52,5 @@ def package_info(self): self.cpp_info.components["_taocpp-tuple"].names["cmake_find_package"] = "tuple" self.cpp_info.components["_taocpp-tuple"].names["cmake_find_package_multi"] = "tuple" self.cpp_info.components["_taocpp-tuple"].set_property("cmake_target_name", "taocpp::tuple") + self.cpp_info.components["_taocpp-tuple"].bindirs = [] + self.cpp_info.components["_taocpp-tuple"].libdirs = [] diff --git a/recipes/taocpp-tuple/all/test_package/CMakeLists.txt b/recipes/taocpp-tuple/all/test_package/CMakeLists.txt index d9a490f809bbc..7758d52fe5e89 100644 --- a/recipes/taocpp-tuple/all/test_package/CMakeLists.txt +++ b/recipes/taocpp-tuple/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(taocpp-tuple REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} taocpp::tuple) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE taocpp::tuple) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/taocpp-tuple/all/test_package/conanfile.py b/recipes/taocpp-tuple/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/taocpp-tuple/all/test_package/conanfile.py +++ b/recipes/taocpp-tuple/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/taocpp-tuple/all/test_v1_package/CMakeLists.txt b/recipes/taocpp-tuple/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/taocpp-tuple/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/taocpp-tuple/all/test_v1_package/conanfile.py b/recipes/taocpp-tuple/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/taocpp-tuple/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/taskflow/all/conandata.yml b/recipes/taskflow/all/conandata.yml index f71b5ca049802..8b83234e329ca 100644 --- a/recipes/taskflow/all/conandata.yml +++ b/recipes/taskflow/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.5.0": + url: "https://github.com/taskflow/taskflow/archive/v3.5.0.tar.gz" + sha256: "33c44e0da7dfda694d2b431724d6c8fd25a889ad0afbb4a32e8da82e2e9c2a92" "3.4.0": url: "https://github.com/taskflow/taskflow/archive/v3.4.0.tar.gz" sha256: "8f449137d3f642b43e905aeacdf1d7c5365037d5e1586103ed4f459f87cecf89" @@ -25,5 +28,6 @@ sources: sha256: "B7016EE3486458AE401D521EA6BC0403DDE975828038B9734621A6A325ACAC1A" patches: "3.3.0": - - base_path: "source_subfolder" - patch_file: "patches/3.3.0-immintrin-guard.patch" + - patch_file: "patches/3.3.0-immintrin-guard.patch" + patch_description: "add condition to check IA architecture" + patch_type: "portability" diff --git a/recipes/taskflow/all/conanfile.py b/recipes/taskflow/all/conanfile.py index 22d7e5ff5dc15..ec7156468a894 100644 --- a/recipes/taskflow/all/conanfile.py +++ b/recipes/taskflow/all/conanfile.py @@ -1,9 +1,14 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.layout import basic_layout from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" + class TaskflowConan(ConanFile): name = "taskflow" @@ -14,69 +19,70 @@ class TaskflowConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/taskflow/taskflow" - topics = ("taskflow", "tasking", "parallelism") + topics = ("tasking", "parallelism") settings = "os", "arch", "compiler", "build_type" short_paths = True - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _min_cppstd(self): - if tools.Version(self.version) >= "3.0.0": + if Version(self.version) >= "3.0.0": return "17" return "14" @property - def _minimum_compiler_version(self): + def _compilers_minimum_version(self): return { "17": { "Visual Studio": "16", "gcc": "7.3", "clang": "6.0", - "apple-clang": "10.0" + "apple-clang": "10.0", }, "14": { "Visual Studio": "15", "gcc": "5", "clang": "4.0", - "apple-clang": "8.0" + "apple-clang": "8.0", }, }[self._min_cppstd] def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, self._min_cppstd) + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] - min_version = self._minimum_compiler_version.get(str(self.settings.compiler)) - if min_version and tools.Version(self.settings.compiler.version) < min_version: + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration( - "{} requires a compiler that supports at least C++{}".format( - self.name, self._min_cppstd, - ) + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", ) - def package_id(self): - self.info.header_only() - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", - dst=os.path.join("include", "taskflow"), - src=os.path.join(self._source_subfolder, "taskflow")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", + src=os.path.join(self.source_folder, "taskflow"), + dst=os.path.join(self.package_folder, "include", "taskflow")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Taskflow") diff --git a/recipes/taskflow/all/test_package/CMakeLists.txt b/recipes/taskflow/all/test_package/CMakeLists.txt index 8d676c82745c6..1f7019bf5d65a 100644 --- a/recipes/taskflow/all/test_package/CMakeLists.txt +++ b/recipes/taskflow/all/test_package/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(Taskflow REQUIRED CONFIG) @@ -13,4 +10,4 @@ endif() add_executable(${PROJECT_NAME} test_package.cpp) target_compile_features(${PROJECT_NAME} PRIVATE ${_CXX_STANDARD}) -target_link_libraries(${PROJECT_NAME} Taskflow::Taskflow) +target_link_libraries(${PROJECT_NAME} PRIVATE Taskflow::Taskflow) diff --git a/recipes/taskflow/all/test_package/conanfile.py b/recipes/taskflow/all/test_package/conanfile.py index a1e008e568f83..e845ae751a301 100644 --- a/recipes/taskflow/all/test_package/conanfile.py +++ b/recipes/taskflow/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, tools, CMake - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/taskflow/all/test_v1_package/CMakeLists.txt b/recipes/taskflow/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/taskflow/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/taskflow/all/test_v1_package/conanfile.py b/recipes/taskflow/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..94b8dc83beff4 --- /dev/null +++ b/recipes/taskflow/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, tools, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/taskflow/config.yml b/recipes/taskflow/config.yml index 943da98e3a4e4..bd7fbbad854e3 100644 --- a/recipes/taskflow/config.yml +++ b/recipes/taskflow/config.yml @@ -1,4 +1,6 @@ versions: + "3.5.0": + folder: all "3.4.0": folder: all "3.3.0": diff --git a/recipes/taywee-args/all/conandata.yml b/recipes/taywee-args/all/conandata.yml index ba4000570e350..c1b7579a8628c 100644 --- a/recipes/taywee-args/all/conandata.yml +++ b/recipes/taywee-args/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "6.4.6": + url: "https://github.com/Taywee/args/archive/6.4.6.tar.gz" + sha256: "41ed136bf9b216bf5f18b1de2a8d22a870381657e8427d6621918520b6e2239c" + "6.4.4": + url: "https://github.com/Taywee/args/archive/6.4.4.tar.gz" + sha256: "7dca5e33148984cf701580324846c6557990a826bd1ab7a97ccdd6d0e486302f" + "6.4.2": + url: "https://github.com/Taywee/args/archive/6.4.2.tar.gz" + sha256: "882adaf179471edf0ac468bab67a0ee53979e4efe91fe4992d5b38422067dd85" "6.4.1": url: "https://github.com/Taywee/args/archive/6.4.1.tar.gz" sha256: "9b3f78208c9cfb06ccbeb7c44903018c8b036b6592a2d9a7d8695d1944060b35" @@ -16,7 +25,7 @@ sources: sha256: "59ed8944c2ff0346e95a2fae55212137512559203b54fc4facbc99206a250500" "6.2.4": url: "https://github.com/Taywee/args/archive/6.2.4.tar.gz" - sha256: "dcc6d0d6b941eb40eeeb5741917d557944f3880e0dea9096147d0bdd89c34654" + sha256: "308eb09a9656315b38c2d1f7526b22b42695b352da316fa4ac17a8b86cdd4663" "6.2.3": url: "https://github.com/Taywee/args/archive/6.2.3.tar.gz" sha256: "c202d15fc4b30519a08bae7df9e6f4fdc40ac2434ba65d83a108ebbf6e4822c2" diff --git a/recipes/taywee-args/all/conanfile.py b/recipes/taywee-args/all/conanfile.py index 6fd83b975144b..3576424832869 100644 --- a/recipes/taywee-args/all/conanfile.py +++ b/recipes/taywee-args/all/conanfile.py @@ -1,41 +1,58 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.28.0" +required_conan_version = ">=1.50.0" + class TayweeArgsConan(ConanFile): name = "taywee-args" description = "A simple, small, flexible, single-header C++11 argument parsing library" - topics = ("conan", "taywee-args", "args", "argument-parser", "header-only") + topics = ("args", "argument-parser", "header-only") license = "MIT" homepage = "https://github.com/Taywee/args" url = "https://github.com/conan-io/conan-center-index" - settings = "compiler" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - - def configure(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("args-" + self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("args.hxx", dst="include", src=self._source_subfolder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "args.hxx", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) def package_info(self): + self.cpp_info.set_property("cmake_file_name", "args") + self.cpp_info.set_property("cmake_target_name", "taywee::args") + self.cpp_info.set_property("pkg_config_name", "args") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + # TODO: to remove in conan v2 self.cpp_info.filenames["cmake_find_package"] = "args" self.cpp_info.filenames["cmake_find_package_multi"] = "args" self.cpp_info.names["cmake_find_package"] = "taywee" self.cpp_info.names["cmake_find_package_multi"] = "taywee" self.cpp_info.components["libargs"].names["cmake_find_package"] = "args" self.cpp_info.components["libargs"].names["cmake_find_package_multi"] = "args" + self.cpp_info.components["libargs"].set_property("cmake_target_name", "taywee::args") + self.cpp_info.components["libargs"].set_property("pkg_config_name", "args") + self.cpp_info.components["libargs"].bindirs = [] + self.cpp_info.components["libargs"].libdirs = [] diff --git a/recipes/taywee-args/all/test_package/CMakeLists.txt b/recipes/taywee-args/all/test_package/CMakeLists.txt index 361c2ecf05829..0a8e53f1264f3 100644 --- a/recipes/taywee-args/all/test_package/CMakeLists.txt +++ b/recipes/taywee-args/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(args REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} taywee::args) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE taywee::args) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/taywee-args/all/test_package/conanfile.py b/recipes/taywee-args/all/test_package/conanfile.py index 1907eb809df0d..44f49e453b57c 100644 --- a/recipes/taywee-args/all/test_package/conanfile.py +++ b/recipes/taywee-args/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run("{} -h".format(bin_path), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(f"{bin_path} -h", env="conanrun") diff --git a/recipes/taywee-args/all/test_v1_package/CMakeLists.txt b/recipes/taywee-args/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/taywee-args/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/taywee-args/all/test_v1_package/conanfile.py b/recipes/taywee-args/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..3e9c09d77df0c --- /dev/null +++ b/recipes/taywee-args/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(f"{bin_path} -h", run_environment=True) diff --git a/recipes/taywee-args/config.yml b/recipes/taywee-args/config.yml index f614345755874..49287304bfe93 100644 --- a/recipes/taywee-args/config.yml +++ b/recipes/taywee-args/config.yml @@ -1,4 +1,10 @@ versions: + "6.4.6": + folder: all + "6.4.4": + folder: all + "6.4.2": + folder: all "6.4.1": folder: all "6.3.0": diff --git a/recipes/tcb-span/all/conandata.yml b/recipes/tcb-span/all/conandata.yml index 05f7484b6046d..d9462a68d3339 100644 --- a/recipes/tcb-span/all/conandata.yml +++ b/recipes/tcb-span/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "cci.20220616": + url: "https://github.com/tcbrindle/span/archive/836dc6a0efd9849cb194e88e4aa2387436bb079b.tar.gz" + sha256: "66650479f85b92c6a6230706e4ac4a1bca18a7c7102fc7e02ad332f86548c9b6" "cci.20200603": url: "https://github.com/tcbrindle/span/archive/5d8d366eca918d0ed3d2d196cbeae6abfd874736.tar.gz" sha256: "c294ec2314eeccbcfe12b549ca6c165fbe9f97d2d52a0ad4c9a28f73fa87861a" diff --git a/recipes/tcb-span/all/conanfile.py b/recipes/tcb-span/all/conanfile.py index 9ede6d7dbfadf..5edd705ca74ca 100644 --- a/recipes/tcb-span/all/conanfile.py +++ b/recipes/tcb-span/all/conanfile.py @@ -1,34 +1,49 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout import os +required_conan_version = ">=1.50.0" class TcbSpanConan(ConanFile): name = "tcb-span" description = "Implementation of C++20's std::span for older C++ standards" - topics = ("conan", "span", "header-only", "tcb-span") - homepage = "https://github.com/tcbrindle/span" - url = "https://github.com/conan-io/conan-center-index" license = "BSL-1.0" - settings = "compiler" - + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/tcbrindle/span" + topics = ("span", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + return 11 - def configure(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.info.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern="LICENSE*.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.hpp", dst="include", src=include_folder) - - def package_id(self): - self.info.header_only() + copy(self, pattern="LICENSE*.txt", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/tcb-span/all/test_package/CMakeLists.txt b/recipes/tcb-span/all/test_package/CMakeLists.txt index 3618b7fc14eb5..858448385983d 100644 --- a/recipes/tcb-span/all/test_package/CMakeLists.txt +++ b/recipes/tcb-span/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(tcb-span REQUIRED CONFIG) -find_package(tcb-span REQUIRED) - -add_executable(test_package test_package.cxx) -target_link_libraries(test_package tcb-span::tcb-span) -set_property(TARGET test_package PROPERTY CXX_STANDARD 17) +add_executable(${PROJECT_NAME} test_package.cxx) +target_link_libraries(${PROJECT_NAME} PRIVATE tcb-span::tcb-span) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tcb-span/all/test_package/conanfile.py b/recipes/tcb-span/all/test_package/conanfile.py index 1d0bdd3779793..a9fb96656f203 100644 --- a/recipes/tcb-span/all/test_package/conanfile.py +++ b/recipes/tcb-span/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tcb-span/all/test_v1_package/CMakeLists.txt b/recipes/tcb-span/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..6930ecd6ea58a --- /dev/null +++ b/recipes/tcb-span/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tcb-span REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cxx) +target_link_libraries(${PROJECT_NAME} PRIVATE tcb-span::tcb-span) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tcb-span/all/test_v1_package/conanfile.py b/recipes/tcb-span/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/tcb-span/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tcb-span/config.yml b/recipes/tcb-span/config.yml index 7208e0ea0a4e0..eb7ad34aa4cc4 100644 --- a/recipes/tcb-span/config.yml +++ b/recipes/tcb-span/config.yml @@ -1,3 +1,5 @@ versions: + "cci.20220616": + folder: all "cci.20200603": folder: all diff --git a/recipes/tcl/all/conanfile.py b/recipes/tcl/all/conanfile.py index 62f11aa121847..d2beb4e9a85e2 100644 --- a/recipes/tcl/all/conanfile.py +++ b/recipes/tcl/all/conanfile.py @@ -1,6 +1,8 @@ +from conans import AutoToolsBuildEnvironment, tools from conan.tools.microsoft import is_msvc, msvc_runtime_flag -from conans import ConanFile, AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan.tools import files +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration import functools import os @@ -48,7 +50,7 @@ def configure(self): del self.settings.compiler.cppstd def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def validate(self): if self.settings.os not in ("FreeBSD", "Linux", "Macos", "Windows"): @@ -59,15 +61,15 @@ def build_requirements(self): self.build_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], + files.get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _get_default_build_system_subdir(self): - return { - "Macos": "macosx", - "Linux": "unix", - "Windows": "win", - }[str(self.settings.os)] + return { + "Macos": "macosx", + "Linux": "unix", + "Windows": "win", + }[str(self.settings.os)] def _get_configure_dir(self, build_system_subdir=None): if build_system_subdir is None: @@ -137,7 +139,8 @@ def _build_nmake(self, targets): @functools.lru_cache(1) def _configure_autotools(self): autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" + def yes_no(v): + return "yes" if v else "no" conf_args = [ "--enable-threads", "--enable-shared={}".format(yes_no(self.options.shared)), @@ -147,8 +150,8 @@ def _configure_autotools(self): autotools.configure(configure_dir=self._get_configure_dir(), args=conf_args, vars={"PKG_CFG_ARGS": " ".join(conf_args)}) # https://core.tcl.tk/tcl/tktview/840660e5a1 - for root, _, files in os.walk(self.build_folder): - if "Makefile" in files: + for root, _, list_of_files in os.walk(self.build_folder): + if "Makefile" in list_of_files: tools.replace_in_file(os.path.join(root, "Makefile"), "-Dstrtod=fixstrtod", "", strict=False) return autotools @@ -169,9 +172,9 @@ def package(self): autotools.install() autotools.make(target="install-private-headers") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "man")) - tools.rmdir(os.path.join(self.package_folder, "share")) + files.rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + files.rmdir(self, os.path.join(self.package_folder, "man")) + files.rmdir(self, os.path.join(self.package_folder, "share")) tclConfigShPath = os.path.join(self.package_folder, "lib", "tclConfig.sh") package_path = self.package_folder diff --git a/recipes/teemo/all/conandata.yml b/recipes/teemo/all/conandata.yml new file mode 100644 index 0000000000000..490c174ebfda5 --- /dev/null +++ b/recipes/teemo/all/conandata.yml @@ -0,0 +1,13 @@ +sources: + "2.7": + url: "https://github.com/winsoft666/teemo/archive/refs/tags/v2.7.tar.gz" + sha256: "97be8ae62cd3e2e92ed0ff405dfaf5e6cb6e323b21c53e798adfa5872a2f7084" + +patches: + "2.7": + - patch_file: "patches/0001-follow-cxx-standards.patch" + patch_description: "include threads header" + patch_type: "portability" + - patch_file: "patches/0002-support-macosx.patch" + patch_description: "support macosx" + patch_type: "portability" diff --git a/recipes/teemo/all/conanfile.py b/recipes/teemo/all/conanfile.py new file mode 100644 index 0000000000000..c34c6cc5a1060 --- /dev/null +++ b/recipes/teemo/all/conanfile.py @@ -0,0 +1,101 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc_static_runtime +from conan.tools.files import get, copy, rm, rmdir, apply_conandata_patches, export_conandata_patches +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.scm import Version +import os + + +required_conan_version = ">=1.53.0" + + +class TeemoConan(ConanFile): + name = "teemo" + description = "C++ File Download Library." + license = "GPL-3.0" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/winsoft666/teemo" + topics = ("downloader", "libcurl", "speed-limit", "ftp", "http") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _min_cppstd(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("libcurl/7.86.0") + + def validate(self): + if self.info.settings.compiler.cppstd: + check_min_cppstd(self, self._min_cppstd) + if self.info.settings.compiler == "apple-clang" and Version(self.info.settings.compiler.version) < "12.0": + raise ConanInvalidConfiguration(f"{self.ref} can not build on apple-clang < 12.0.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TESTS"] = False + tc.variables["USE_STATIC_CRT"] = is_msvc_static_runtime(self) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + # some files extensions and folders are not allowed. Please, read the FAQs to get informed. + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "lib")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + + def package_info(self): + libname = "teemo" if self.options.shared else "teemo-static" + libpostfix = "-d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [f"{libname}{libpostfix}"] + + if self.options.shared: + self.cpp_info.defines.append("TEEMO_EXPORTS") + else: + self.cpp_info.defines.append("TEEMO_STATIC") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") diff --git a/recipes/teemo/all/patches/0001-follow-cxx-standards.patch b/recipes/teemo/all/patches/0001-follow-cxx-standards.patch new file mode 100644 index 0000000000000..ef756c224f890 --- /dev/null +++ b/recipes/teemo/all/patches/0001-follow-cxx-standards.patch @@ -0,0 +1,25 @@ +diff --git a/a/src/entry_handler.cpp b/b/src/entry_handler.cpp +index 9e94b47..f45d954 100644 +--- a/a/src/entry_handler.cpp ++++ b/b/src/entry_handler.cpp +@@ -19,6 +19,7 @@ + #include + #include + #include ++#include + #include "file_util.h" + #include "string_helper.hpp" + #include "string_encode.h" +diff --git a/a/src/md5.cpp b/b/src/md5.cpp +index 9068dea..424c1f2 100644 +--- a/a/src/md5.cpp ++++ b/b/src/md5.cpp +@@ -90,7 +90,7 @@ void byteSwap(UWORD32* buf, unsigned words) { + * the data and converts bytes into longwords for this routine. + */ + void MD5Transform(UWORD32 buf[4], UWORD32 const in[16]) { +- register UWORD32 a, b, c, d; ++ UWORD32 a, b, c, d; + + a = buf[0]; + b = buf[1]; diff --git a/recipes/teemo/all/patches/0002-support-macosx.patch b/recipes/teemo/all/patches/0002-support-macosx.patch new file mode 100644 index 0000000000000..64f500a421a85 --- /dev/null +++ b/recipes/teemo/all/patches/0002-support-macosx.patch @@ -0,0 +1,40 @@ +diff --git a/a/src/file_util.cpp b/b/src/file_util.cpp +index 9cea293..20fb5c6 100644 +--- a/a/src/file_util.cpp ++++ b/b/src/file_util.cpp +@@ -46,6 +46,9 @@ int64_t FileUtil::GetFileSize(FILE* f) { + #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + _fseeki64(f, 0L, SEEK_END); + int64_t fsize = _ftelli64(f); ++#elif defined(__APPLE__) ++ fseeko(f, 0L, SEEK_END); ++ int64_t fsize = ftello(f); + #else + fseeko64(f, 0L, SEEK_END); + int64_t fsize = ftello64(f); +@@ -181,6 +184,8 @@ int FileUtil::Seek(FILE* f, int64_t offset, int origin) { + if (f) { + #if defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__) + return _fseeki64(f, offset, origin); ++#elif defined(__APPLE__) ++ return fseeko(f, offset, origin); + #else + return fseeko64(f, offset, origin); + #endif +@@ -263,6 +268,16 @@ bool FileUtil::CreateFixedSizeFile(const utf8string& path, int64_t fixed_size) { + } + + return prealloc; ++#elif defined(__APPLE__) ++ int fd = open(path.c_str(), O_RDWR | O_CREAT, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); ++ fstore_t store = {F_ALLOCATECONTIG, F_PEOFPOSMODE, 0, fixed_size}; ++ if (fcntl(fd, F_PREALLOCATE, &store) == -1) { ++ store.fst_flags = F_ALLOCATEALL; ++ if (fcntl(fd, F_PREALLOCATE, &store) == -1) { ++ return false; ++ } ++ } ++ return ftruncate(fd, fixed_size) == 0; + #else + int fd = open(path.c_str(), O_RDWR | O_CREAT, + S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); diff --git a/recipes/teemo/all/test_package/CMakeLists.txt b/recipes/teemo/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..caf3475df9376 --- /dev/null +++ b/recipes/teemo/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(teemo REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE teemo::teemo) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/teemo/all/test_package/conanfile.py b/recipes/teemo/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/teemo/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/teemo/all/test_package/test_package.cpp b/recipes/teemo/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..24b78b9a64c3b --- /dev/null +++ b/recipes/teemo/all/test_package/test_package.cpp @@ -0,0 +1,31 @@ +#include + +#include "teemo/teemo.h" + +int main(int argc, char **argv) { + using namespace teemo; + + Teemo::GlobalInit(); + + Teemo efd; + + efd.setThreadNum(10); // Optional + efd.setTmpFileExpiredTime(3600); // Optional + efd.setDiskCacheSize(20 * (2 << 19)); // Optional + efd.setMaxDownloadSpeed(50 * (2 << 19)); // Optional + efd.setHashVerifyPolicy( + ALWAYS, MD5, "6fe294c3ef4765468af4950d44c65525"); // Optional, support + // MD5, CRC32, SHA256 + efd.setVerboseOutput([](const utf8string &verbose) { // Optional + std::cout << verbose << "\n"; + }); + + efd.setHttpHeaders({ + {"Origin", "http://xxx.xxx.com"}, + {"User-Agent", "Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)"}, + }); + + Teemo::GlobalUnInit(); + + return 0; +} diff --git a/recipes/teemo/all/test_v1_package/CMakeLists.txt b/recipes/teemo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/teemo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/teemo/all/test_v1_package/conanfile.py b/recipes/teemo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/teemo/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/teemo/config.yml b/recipes/teemo/config.yml new file mode 100644 index 0000000000000..600f563c61c19 --- /dev/null +++ b/recipes/teemo/config.yml @@ -0,0 +1,3 @@ +versions: + "2.7": + folder: all diff --git a/recipes/tensorflow-lite/all/CMakeLists.txt b/recipes/tensorflow-lite/all/CMakeLists.txt deleted file mode 100644 index 57b8c78f33a5b..0000000000000 --- a/recipes/tensorflow-lite/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(${CMAKE_BINARY_DIR}/../conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("src/tensorflow/lite") diff --git a/recipes/tensorflow-lite/all/conandata.yml b/recipes/tensorflow-lite/all/conandata.yml index 1e50dbd6e75e1..42304f36f76b1 100644 --- a/recipes/tensorflow-lite/all/conandata.yml +++ b/recipes/tensorflow-lite/all/conandata.yml @@ -1,34 +1,14 @@ sources: - "2.6.0": - url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.6.0.tar.gz" - sha256: "41b32eeaddcbc02b0583660bcf508469550e4cd0f86b22d2abe72dfebeacde0f" - "2.6.2": - url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.6.2.tar.gz" - sha256: "e68c1d346fc3d529653530ca346b2c62f5b31bd4fcca7ffc9c65bb39ab2f6ed3" - "2.9.1": - url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.9.1.tar.gz" - sha256: "6eaf86ead73e23988fe192da1db68f4d3828bcdd0f3a9dc195935e339c95dbdc" + "2.10.0": + url: "https://github.com/tensorflow/tensorflow/archive/refs/tags/v2.10.0.tar.gz" + sha256: "b5a1bb04c84b6fe1538377e5a1f649bb5d5f0b2e3625a3c526ff3a8af88633e8" patches: - "2.9.1": - - patch_file: "patches/msvc_fixes.patch" - patch_description: "Fix Windows build: Apply fixes for compatibility with MSVC from master" - patch_source: "https://github.com/tensorflow/tensorflow/pull/56408" - patch_type: "backport" - base_path: "src" - - patch_file: "patches/dependencies_2_9.patch" - patch_description: "Dependency compatibility: Patch CMakeLists.txt, updating package names, target names, etc" - patch_type: "conan" - base_path: "src" + "2.10.0": - patch_file: "patches/remove_simple_memory_arena_debug_dump.patch" patch_description: "Shared build fails on Windows with error LNK2005. Resolve the conflict by removing the conflicting implementation for now." - base_path: "src" - "2.6.0": - - patch_file: "patches/dependencies_2_6.patch" - patch_description: "Dependency compatibility: Patch CMakeLists.txt, updating package names, target names, etc" + - patch_file: "patches/disable_fetch_content.patch" + patch_description: "Fail if the CMake build script tries to fetch external dependencies" patch_type: "conan" - base_path: "src" - "2.6.2": - - patch_file: "patches/dependencies_2_6.patch" + - patch_file: "patches/dependencies_2_10.patch" patch_description: "Dependency compatibility: Patch CMakeLists.txt, updating package names, target names, etc" patch_type: "conan" - base_path: "src" diff --git a/recipes/tensorflow-lite/all/conanfile.py b/recipes/tensorflow-lite/all/conanfile.py index efe5861ad778c..f780e991d21b0 100644 --- a/recipes/tensorflow-lite/all/conanfile.py +++ b/recipes/tensorflow-lite/all/conanfile.py @@ -1,13 +1,13 @@ from conan import ConanFile -from conan.tools import files from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, CMakeDeps, cmake_layout +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, save, copy, export_conandata_patches, apply_conandata_patches from conan.errors import ConanInvalidConfiguration -from conans import CMake, tools -import functools -import os +from os.path import join import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class TensorflowLiteConan(ConanFile): @@ -37,31 +37,19 @@ class TensorflowLiteConan(ConanFile): "with_xnnpack": True } - short_paths = True - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "src" - - @property - def _build_subfolder(self): - return "build" @property def _compilers_minimum_version(self): return { - "gcc": "5", - "Visual Studio": "14", - "clang": "3.4", + "gcc": "8", + "Visual Studio": "15.8", + "clang": "5", "apple-clang": "5.1", } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -76,60 +64,66 @@ def configure(self): del self.options.fPIC def requirements(self): - self.requires("abseil/20211102.0") + self.requires("abseil/20220623.0") self.requires("eigen/3.4.0") self.requires("farmhash/cci.20190513") self.requires("fft/cci.20061228") - self.requires("flatbuffers/2.0.5") + self.requires("flatbuffers/2.0.6") self.requires("gemmlowp/cci.20210928") if self.settings.arch in ("x86", "x86_64"): self.requires("intel-neon2sse/cci.20210225") self.requires("ruy/cci.20220628") if self.options.with_xnnpack: - self.requires("xnnpack/cci.20220621") + self.requires("xnnpack/cci.20220801") if self.options.with_xnnpack or self.options.get_safe("with_nnapi", False): self.requires("fp16/cci.20210320") def build_requirements(self): self.tool_requires("cmake/3.24.0") - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17 if Version(self.version) >= "2.9.1" else 14) - - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn(f"{self.name} requires C++14. Your compiler is unknown. Assuming it supports C++14.") - elif Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration(f"{self.name} requires C++14, which your compiler does not support.") - - def source(self): - files.get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) - - def build(self): - files.apply_conandata_patches(self) - cmake = self._configure_cmake() - cmake.build() + def layout(self): + cmake_layout(self, build_folder=f"build_folder/{self.settings.build_type}") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions.update({ + def generate(self): + tc = CMakeToolchain(self) + tc.variables.update({ "CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS": True, "TFLITE_ENABLE_RUY": self.options.with_ruy, "TFLITE_ENABLE_NNAPI": self.options.get_safe("with_nnapi", False), "TFLITE_ENABLE_GPU": False, "TFLITE_ENABLE_XNNPACK": self.options.with_xnnpack, - "TFLITE_ENABLE_MMAP": self.options.get_safe("with_mmap", False) + "TFLITE_ENABLE_MMAP": self.options.get_safe("with_mmap", False), + "FETCHCONTENT_FULLY_DISCONNECTED": True, + "clog_POPULATED": True, }) if self.settings.arch == "armv8": # Not defined by Conan for Apple Silicon. See https://github.com/conan-io/conan/pull/8026 - cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "arm64" - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["CMAKE_SYSTEM_PROCESSOR"] = "arm64" + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def validate(self): + if self.info.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, 17) + + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if not minimum_version: + self.output.warn(f"{self.name} requires C++17. Your compiler is unknown. Assuming it supports C++17.") + elif Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.name} requires C++17, which your compiler does not support.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True, destination=self.source_folder) + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=join("tensorflow", "lite")) + cmake.build() @staticmethod - def _create_cmake_module_alias_target(module_file): + def _create_cmake_module_alias_target(conanfile, module_file): aliased = "tensorflowlite::tensorflowlite" alias = "tensorflow::tensorflowlite" content = textwrap.dedent(f"""\ @@ -138,21 +132,21 @@ def _create_cmake_module_alias_target(module_file): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """) - tools.save(module_file, content) + save(conanfile, module_file, content) @property def _module_file(self): - return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + return join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst=os.path.join("include", "tensorflow", "lite"), src=os.path.join(self._source_subfolder, "tensorflow", "lite")) - self.copy("*", dst="lib", src=os.path.join(self._build_subfolder, "lib")) - if self.options.shared: - self.copy("*", dst="bin", src=os.path.join(self._build_subfolder, "bin")) - if self.settings.build_type == "Debug": - tools.remove_files_by_mask(self.package_folder, "*.pdb") - self._create_cmake_module_alias_target(os.path.join(self.package_folder, self._module_file)) + copy(self, "LICENSE", self.source_folder, join(self.package_folder, "licenses")) + copy(self, "*.h", join(self.source_folder, "tensorflow", "lite"), join(self.package_folder, "include", "tensorflow", "lite")) + copy(self, "*.a", self.build_folder, join(self.package_folder, "lib")) + copy(self, "*.so", self.build_folder, join(self.package_folder, "lib")) + copy(self, "*.dylib", self.build_folder, join(self.package_folder, "lib")) + copy(self, "*.lib", self.build_folder, join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", self.build_folder, join(self.package_folder, "bin"), keep_path=False) + self._create_cmake_module_alias_target(self, join(self.package_folder, self._module_file)) def package_info(self): self.cpp_info.set_property("cmake_file_name", "tensorflowlite") @@ -170,6 +164,6 @@ def package_info(self): defines.append("TFLITE_WITH_RUY") self.cpp_info.defines = defines - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["tensorflow-lite"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("dl") diff --git a/recipes/tensorflow-lite/all/patches/dependencies_2_10.patch b/recipes/tensorflow-lite/all/patches/dependencies_2_10.patch new file mode 100644 index 0000000000000..a82533faee2e8 --- /dev/null +++ b/recipes/tensorflow-lite/all/patches/dependencies_2_10.patch @@ -0,0 +1,68 @@ +commit fcb02f001504c4060f83233cedc9b8f197fcc607 +Author: talyz +Date: Wed Aug 24 19:09:53 2022 +0200 + + Conan deps + +diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt +index 663f07ab31c..9f05de4ebec 100644 +--- a/tensorflow/lite/CMakeLists.txt ++++ b/tensorflow/lite/CMakeLists.txt +@@ -138,12 +138,11 @@ macro(populate_tf_source_vars RELATIVE_DIR SOURCES_VAR) + endmacro() + # Find TensorFlow Lite dependencies. + find_package(absl REQUIRED) +-find_package(eigen REQUIRED) ++find_package(Eigen3 REQUIRED) + find_package(farmhash REQUIRED) +-find_package(fft2d REQUIRED) +-find_package(flatbuffers REQUIRED) ++find_package(fft REQUIRED) ++find_package(Flatbuffers REQUIRED) + find_package(gemmlowp REQUIRED) +-find_package(neon2sse REQUIRED) + find_package(clog REQUIRED) + find_package(cpuinfo REQUIRED) #CPUINFO is used by XNNPACK and RUY library + find_package(ruy REQUIRED) +@@ -162,6 +161,10 @@ set(TFLITE_TARGET_PUBLIC_OPTIONS "") + set(TFLITE_TARGET_PRIVATE_OPTIONS "") + # Additional library dependencies based upon enabled features. + set(TFLITE_TARGET_DEPENDENCIES "") ++if (NOT CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86") ++ find_package(intel-neon2sse REQUIRED) ++ list(APPEND TFLITE_TARGET_DEPENDENCIES intel-neon2sse::intel-neon2sse) ++endif() + if(CMAKE_CXX_COMPILER_ID MATCHES "Clang$") + # TFLite uses deprecated methods in neon2sse which generates a huge number of + # warnings so surpress these until they're fixed. +@@ -411,7 +414,7 @@ if(TFLITE_ENABLE_XNNPACK) + FILTER ".*(_test|_tester)\\.(cc|h)" + ) + list(APPEND TFLITE_TARGET_DEPENDENCIES +- XNNPACK ++ xnnpack::xnnpack + ) + list(APPEND TFLITE_TARGET_PUBLIC_OPTIONS "-DTFLITE_BUILD_WITH_XNNPACK_DELEGATE") + endif() +@@ -519,17 +522,16 @@ target_include_directories(tensorflow-lite + target_link_libraries(tensorflow-lite + PUBLIC + Eigen3::Eigen +- NEON_2_SSE + absl::flags + absl::hash + absl::status + absl::strings + absl::synchronization + absl::variant +- farmhash +- fft2d_fftsg2d +- flatbuffers +- gemmlowp ++ farmhash::farmhash ++ fft::fft ++ flatbuffers::flatbuffers ++ gemmlowp::eight_bit_int_gemm + ruy::ruy + ${CMAKE_DL_LIBS} + ${TFLITE_TARGET_DEPENDENCIES} diff --git a/recipes/tensorflow-lite/all/patches/dependencies_2_6.patch b/recipes/tensorflow-lite/all/patches/dependencies_2_6.patch deleted file mode 100644 index f5d3dbba999d2..0000000000000 --- a/recipes/tensorflow-lite/all/patches/dependencies_2_6.patch +++ /dev/null @@ -1,81 +0,0 @@ -diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt -index f5cc9b97924..4edc693dd7d 100644 ---- a/tensorflow/lite/CMakeLists.txt -+++ b/tensorflow/lite/CMakeLists.txt -@@ -50,14 +50,8 @@ if(NOT TENSORFLOW_SOURCE_DIR) - endif() - set(TF_SOURCE_DIR "${TENSORFLOW_SOURCE_DIR}/tensorflow") - set(TFLITE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}") --set(CMAKE_MODULE_PATH -- "${TFLITE_SOURCE_DIR}/tools/cmake/modules" -- ${CMAKE_MODULE_PATH} --) --set(CMAKE_PREFIX_PATH -- "${TFLITE_SOURCE_DIR}/tools/cmake/modules" -- ${CMAKE_PREFIX_PATH} --) -+list(APPEND CMAKE_MODULE_PATH "${TFLITE_SOURCE_DIR}/tools/cmake/modules") -+list(APPEND CMAKE_PREFIX_PATH "${TFLITE_SOURCE_DIR}/tools/cmake/modules") - include(CMakeDependentOption) - option(TFLITE_ENABLE_RUY "Enable experimental RUY integration" OFF) - option(TFLITE_ENABLE_RESOURCE "Enable experimental support for resources" ON) -@@ -125,12 +119,11 @@ macro(populate_tf_source_vars RELATIVE_DIR SOURCES_VAR) - endmacro() - # Find TensorFlow Lite dependencies. - find_package(absl REQUIRED) --find_package(eigen REQUIRED) -+find_package(Eigen3 REQUIRED) - find_package(farmhash REQUIRED) --find_package(fft2d REQUIRED) --find_package(flatbuffers REQUIRED) -+find_package(fft REQUIRED) -+find_package(Flatbuffers REQUIRED CONFIG) - find_package(gemmlowp REQUIRED) --find_package(neon2sse REQUIRED) - find_package(ruy REQUIRED) - # Generate TensorFlow Lite FlatBuffer code. - # We used to have an actual compilation logic with flatc but decided to use -@@ -147,6 +140,10 @@ set(TFLITE_TARGET_PUBLIC_OPTIONS "") - set(TFLITE_TARGET_PRIVATE_OPTIONS "") - # Additional library dependencies based upon enabled features. - set(TFLITE_TARGET_DEPENDENCIES "") -+if (NOT CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86") -+ find_package(NEON_2_SSE REQUIRED) -+ list(APPEND TFLITE_TARGET_DEPENDENCIES NEON_2_SSE::NEON_2_SSE) -+endif() - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang$") - # TFLite uses deprecated methods in neon2sse which generates a huge number of - # warnings so surpress these until they're fixed. -@@ -322,7 +319,7 @@ if(TFLITE_ENABLE_XNNPACK) - FILTER ".*(_test|_tester)\\.(cc|h)" - ) - list(APPEND TFLITE_TARGET_DEPENDENCIES -- XNNPACK -+ xnnpack::xnnpack - ) - list(APPEND TFLITE_TARGET_PUBLIC_OPTIONS "-DTFLITE_BUILD_WITH_XNNPACK_DELEGATE") - endif() -@@ -418,18 +415,17 @@ target_include_directories(tensorflow-lite - target_link_libraries(tensorflow-lite - PUBLIC - Eigen3::Eigen -- NEON_2_SSE - absl::flags - absl::hash - absl::status - absl::strings - absl::synchronization - absl::variant -- farmhash -- fft2d_fftsg2d -- flatbuffers -- gemmlowp -- ruy -+ farmhash::farmhash -+ fft::fft -+ flatbuffers::flatbuffers -+ gemmlowp::eight_bit_int_gemm -+ ruy::ruy - ${CMAKE_DL_LIBS} - ${TFLITE_TARGET_DEPENDENCIES} - ) diff --git a/recipes/tensorflow-lite/all/patches/dependencies_2_9.patch b/recipes/tensorflow-lite/all/patches/dependencies_2_9.patch deleted file mode 100644 index 0c15d040912a9..0000000000000 --- a/recipes/tensorflow-lite/all/patches/dependencies_2_9.patch +++ /dev/null @@ -1,81 +0,0 @@ -diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt -index 40f9485b5d6..f184ac5d30d 100644 ---- a/tensorflow/lite/CMakeLists.txt -+++ b/tensorflow/lite/CMakeLists.txt -@@ -50,14 +50,8 @@ if(NOT TENSORFLOW_SOURCE_DIR) - endif() - set(TF_SOURCE_DIR "${TENSORFLOW_SOURCE_DIR}/tensorflow") - set(TFLITE_SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}") --set(CMAKE_MODULE_PATH -- "${TFLITE_SOURCE_DIR}/tools/cmake/modules" -- ${CMAKE_MODULE_PATH} --) --set(CMAKE_PREFIX_PATH -- "${TFLITE_SOURCE_DIR}/tools/cmake/modules" -- ${CMAKE_PREFIX_PATH} --) -+list(APPEND CMAKE_MODULE_PATH "${TFLITE_SOURCE_DIR}/tools/cmake/modules") -+list(APPEND CMAKE_PREFIX_PATH "${TFLITE_SOURCE_DIR}/tools/cmake/modules") - include(CMakeDependentOption) - option(TFLITE_ENABLE_RUY "Enable experimental RUY integration" OFF) - option(TFLITE_ENABLE_RESOURCE "Enable experimental support for resources" ON) -@@ -138,12 +132,11 @@ macro(populate_tf_source_vars RELATIVE_DIR SOURCES_VAR) - endmacro() - # Find TensorFlow Lite dependencies. - find_package(absl REQUIRED) --find_package(eigen REQUIRED) -+find_package(Eigen3 REQUIRED) - find_package(farmhash REQUIRED) --find_package(fft2d REQUIRED) --find_package(flatbuffers REQUIRED) -+find_package(fft REQUIRED) -+find_package(Flatbuffers REQUIRED) - find_package(gemmlowp REQUIRED) --find_package(neon2sse REQUIRED) - find_package(clog REQUIRED) - find_package(cpuinfo REQUIRED) #CPUINFO is used by XNNPACK and RUY library - find_package(ruy REQUIRED) -@@ -162,6 +155,10 @@ set(TFLITE_TARGET_PUBLIC_OPTIONS "") - set(TFLITE_TARGET_PRIVATE_OPTIONS "") - # Additional library dependencies based upon enabled features. - set(TFLITE_TARGET_DEPENDENCIES "") -+if (NOT CMAKE_SYSTEM_PROCESSOR OR CMAKE_SYSTEM_PROCESSOR MATCHES "x86") -+ find_package(NEON_2_SSE REQUIRED) -+ list(APPEND TFLITE_TARGET_DEPENDENCIES NEON_2_SSE::NEON_2_SSE) -+endif() - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang$") - # TFLite uses deprecated methods in neon2sse which generates a huge number of - # warnings so surpress these until they're fixed. -@@ -395,7 +392,7 @@ if(TFLITE_ENABLE_XNNPACK) - FILTER ".*(_test|_tester)\\.(cc|h)" - ) - list(APPEND TFLITE_TARGET_DEPENDENCIES -- XNNPACK -+ xnnpack::xnnpack - ) - list(APPEND TFLITE_TARGET_PUBLIC_OPTIONS "-DTFLITE_BUILD_WITH_XNNPACK_DELEGATE") - endif() -@@ -499,18 +496,17 @@ target_include_directories(tensorflow-lite - target_link_libraries(tensorflow-lite - PUBLIC - Eigen3::Eigen -- NEON_2_SSE - absl::flags - absl::hash - absl::status - absl::strings - absl::synchronization - absl::variant -- farmhash -- fft2d_fftsg2d -- flatbuffers -- gemmlowp -- ruy -+ farmhash::farmhash -+ fft::fft -+ flatbuffers::flatbuffers -+ gemmlowp::eight_bit_int_gemm -+ ruy::ruy - ${CMAKE_DL_LIBS} - ${TFLITE_TARGET_DEPENDENCIES} - ) diff --git a/recipes/tensorflow-lite/all/patches/disable_fetch_content.patch b/recipes/tensorflow-lite/all/patches/disable_fetch_content.patch new file mode 100644 index 0000000000000..adc6f0561afef --- /dev/null +++ b/recipes/tensorflow-lite/all/patches/disable_fetch_content.patch @@ -0,0 +1,12 @@ +diff --git a/tensorflow/lite/tools/cmake/modules/OverridableFetchContent.cmake b/tensorflow/lite/tools/cmake/modules/OverridableFetchContent.cmake +index 9ed95109ba9..4ddf322b95f 100644 +--- a/tensorflow/lite/tools/cmake/modules/OverridableFetchContent.cmake ++++ b/tensorflow/lite/tools/cmake/modules/OverridableFetchContent.cmake +@@ -244,6 +244,7 @@ endfunction() + # All content names passed to this method are added to the global property + # OVERRIDABLE_FETCH_CONTENT_LIST. + function(OverridableFetchContent_Declare CONTENT_NAME) ++ message(FATAL_ERROR "OverridableFetchContent_Declare called by ${CONTENT_NAME}! Failing build.") + set(OVERRIDABLE_ARGS + GIT_REPOSITORY + GIT_TAG diff --git a/recipes/tensorflow-lite/all/patches/msvc_fixes.patch b/recipes/tensorflow-lite/all/patches/msvc_fixes.patch deleted file mode 100644 index 6400721781285..0000000000000 --- a/recipes/tensorflow-lite/all/patches/msvc_fixes.patch +++ /dev/null @@ -1,155 +0,0 @@ -From 79be9efa5190a4a9c828369ba358e6f9e59fbbe5 Mon Sep 17 00:00:00 2001 -From: Jamie Cook -Date: Thu, 9 Jun 2022 17:54:52 +1000 -Subject: [PATCH 1/4] Use the help macro from absl to avoid gcc specific - compiler macro (__PRETTY_FUNCTION__) - ---- - tensorflow/lite/kernels/internal/compatibility.h | 11 +++++++++++ - .../kernels/internal/optimized/depthwiseconv_float.h | 2 +- - .../kernels/internal/optimized/depthwiseconv_uint8.h | 2 +- - .../internal/optimized/integer_ops/depthwise_conv.h | 2 +- - 4 files changed, 14 insertions(+), 3 deletions(-) - -diff --git a/tensorflow/lite/kernels/internal/compatibility.h b/tensorflow/lite/kernels/internal/compatibility.h -index 61becad30c5c2..1b275095092dd 100644 ---- a/tensorflow/lite/kernels/internal/compatibility.h -+++ b/tensorflow/lite/kernels/internal/compatibility.h -@@ -86,6 +86,17 @@ using int32 = std::int32_t; - using uint32 = std::uint32_t; - #endif // !defined(TF_LITE_STATIC_MEMORY) - -+ -+// Allow for cross-compiler usage of function signatures - used for specifying -+// named RUY profiler regions in templated methods. -+#if defined(_MSC_VER) -+#define TFLITE_PRETTY_FUNCTION __FUNCSIG__ -+#elif defined(__GNUC__) -+#define TFLITE_PRETTY_FUNCTION __PRETTY_FUNCTION__ -+#else -+#define TFLITE_PRETTY_FUNCTION __func__ -+#endif -+ - // TFLITE_DEPRECATED() - // - // Duplicated from absl/base/macros.h to avoid pulling in that library. -diff --git a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_float.h b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_float.h -index a8903c1d2758a..daafa93ef3baa 100644 ---- a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_float.h -+++ b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_float.h -@@ -768,7 +768,7 @@ void FloatDepthwiseConvAccumRow(int stride, int dilation_factor, - const float* filter_data, - int out_x_buffer_start, int out_x_buffer_end, - int output_depth, float* acc_buffer) { -- ruy::profiler::ScopeLabel label(__PRETTY_FUNCTION__); -+ ruy::profiler::ScopeLabel label(TFLITE_PRETTY_FUNCTION); - // Consistency check parameters. This is important in particular to ensure - // that we keep the number of template instantiations minimal, so we don't - // increase binary size unnecessarily. -diff --git a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h -index 52469b34c8703..8ebb7411e0ff7 100644 ---- a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h -+++ b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h -@@ -1519,7 +1519,7 @@ void QuantizedDepthwiseConvAccumRow(int stride, int dilation_factor, - int16 filter_offset, int out_x_buffer_start, - int out_x_buffer_end, int output_depth, - int32* acc_buffer) { -- ruy::profiler::ScopeLabel label(__PRETTY_FUNCTION__); -+ ruy::profiler::ScopeLabel label(TFLITE_PRETTY_FUNCTION);; - // Consistency check parameters. This is important in particular to ensure - // that we keep the number of template instantiations minimal, so we don't - // increase binary size unnecessarily. -diff --git a/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h b/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h -index d38d05e81bd3e..b9727e4ad40c3 100644 ---- a/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h -+++ b/tensorflow/lite/kernels/internal/optimized/integer_ops/depthwise_conv.h -@@ -1429,7 +1429,7 @@ void QuantizedDepthwiseConvAccumRow(int stride, int dilation_factor, - int out_x_buffer_start, - int out_x_buffer_end, int output_depth, - int32* acc_buffer) { -- ruy::profiler::ScopeLabel label(__PRETTY_FUNCTION__); -+ ruy::profiler::ScopeLabel label(TFLITE_PRETTY_FUNCTION); - // Consistency check parameters. This is important in particular to ensure - // that we keep the number of template instantiations minimal, so we don't - // increase binary size unnecessarily. - -From 3616d189a87a3f7cd3cabb8f3ec44f29f58f7e14 Mon Sep 17 00:00:00 2001 -From: Jamie Cook -Date: Fri, 10 Jun 2022 08:19:52 +1000 -Subject: [PATCH 2/4] designated initializers are only supported on MSVC 2019 - with stdc++20 - ---- - .../lite/delegates/external/external_delegate.cc | 12 ++++++------ - 1 file changed, 6 insertions(+), 6 deletions(-) - -diff --git a/tensorflow/lite/delegates/external/external_delegate.cc b/tensorflow/lite/delegates/external/external_delegate.cc -index 7fe5c5329dd2a..39a2d04cfca43 100644 ---- a/tensorflow/lite/delegates/external/external_delegate.cc -+++ b/tensorflow/lite/delegates/external/external_delegate.cc -@@ -155,12 +155,12 @@ ExternalDelegateWrapper::ExternalDelegateWrapper( - ckeys.size(), nullptr); - if (external_delegate_) { - wrapper_delegate_ = { -- .data_ = reinterpret_cast(this), -- .Prepare = DelegatePrepare, -- .CopyFromBufferHandle = nullptr, -- .CopyToBufferHandle = nullptr, -- .FreeBufferHandle = nullptr, -- .flags = external_delegate_->flags, -+ reinterpret_cast(this), // .data = -+ DelegatePrepare, // .Prepare = -+ nullptr, // .CopyFromBufferHandle = -+ nullptr, // .CopyToBufferHandle = -+ nullptr, // .FreeBufferHandle = -+ external_delegate_->flags, // .flags = - }; - if (external_delegate_->CopyFromBufferHandle) { - wrapper_delegate_.CopyFromBufferHandle = DelegateCopyFromBufferHandle; - -From 6e7e5291950e8f72f9ad50674ba0162247f5d078 Mon Sep 17 00:00:00 2001 -From: Jamie Cook -Date: Mon, 13 Jun 2022 14:29:51 +1000 -Subject: [PATCH 3/4] Trigger build which was failing last week with DNS issues - ---- - tensorflow/lite/kernels/internal/compatibility.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tensorflow/lite/kernels/internal/compatibility.h b/tensorflow/lite/kernels/internal/compatibility.h -index 1b275095092dd..037697f19fb6c 100644 ---- a/tensorflow/lite/kernels/internal/compatibility.h -+++ b/tensorflow/lite/kernels/internal/compatibility.h -@@ -87,7 +87,7 @@ using uint32 = std::uint32_t; - #endif // !defined(TF_LITE_STATIC_MEMORY) - - --// Allow for cross-compiler usage of function signatures - used for specifying -+// Allow for cross-compiler usage of function signatures - currently used for specifying - // named RUY profiler regions in templated methods. - #if defined(_MSC_VER) - #define TFLITE_PRETTY_FUNCTION __FUNCSIG__ - -From d12d20dfc989f2ebdc74bdcfb8a9155eb51ba03e Mon Sep 17 00:00:00 2001 -From: Mihai Maruseac -Date: Wed, 15 Jun 2022 17:14:47 -0700 -Subject: [PATCH 4/4] Update - tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h - ---- - .../lite/kernels/internal/optimized/depthwiseconv_uint8.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h -index 8ebb7411e0ff7..f7176bb8bc7db 100644 ---- a/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h -+++ b/tensorflow/lite/kernels/internal/optimized/depthwiseconv_uint8.h -@@ -1519,7 +1519,7 @@ void QuantizedDepthwiseConvAccumRow(int stride, int dilation_factor, - int16 filter_offset, int out_x_buffer_start, - int out_x_buffer_end, int output_depth, - int32* acc_buffer) { -- ruy::profiler::ScopeLabel label(TFLITE_PRETTY_FUNCTION);; -+ ruy::profiler::ScopeLabel label(TFLITE_PRETTY_FUNCTION); - // Consistency check parameters. This is important in particular to ensure - // that we keep the number of template instantiations minimal, so we don't - // increase binary size unnecessarily. diff --git a/recipes/tensorflow-lite/all/patches/remove_simple_memory_arena_debug_dump.patch b/recipes/tensorflow-lite/all/patches/remove_simple_memory_arena_debug_dump.patch index 4e2350cd29678..2f7e6367c52d8 100644 --- a/recipes/tensorflow-lite/all/patches/remove_simple_memory_arena_debug_dump.patch +++ b/recipes/tensorflow-lite/all/patches/remove_simple_memory_arena_debug_dump.patch @@ -1,8 +1,8 @@ diff --git a/tensorflow/lite/CMakeLists.txt b/tensorflow/lite/CMakeLists.txt -index f184ac5d30d..f59f9ea717c 100644 +index 40f9485b5d6..f250ebccc05 100644 --- a/tensorflow/lite/CMakeLists.txt +++ b/tensorflow/lite/CMakeLists.txt -@@ -199,6 +199,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "Android") +@@ -202,6 +202,9 @@ if(CMAKE_SYSTEM_NAME MATCHES "Android") endif() # Build a list of source files to compile into the TF Lite library. populate_tflite_source_vars("." TFLITE_SRCS) diff --git a/recipes/tensorflow-lite/all/test_package/CMakeLists.txt b/recipes/tensorflow-lite/all/test_package/CMakeLists.txt index afc3ca8116573..b1b0f24e0aa99 100644 --- a/recipes/tensorflow-lite/all/test_package/CMakeLists.txt +++ b/recipes/tensorflow-lite/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) project(test_package CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(tensorflowlite REQUIRED CONFIG) add_executable(test_package test_package.cpp) target_link_libraries(test_package PRIVATE tensorflow::tensorflowlite) -target_compile_features(test_package PRIVATE cxx_std_14) +target_compile_features(test_package PRIVATE cxx_std_17) diff --git a/recipes/tensorflow-lite/all/test_package/conanfile.py b/recipes/tensorflow-lite/all/test_package/conanfile.py index ac6751f7f689b..841a097747d32 100644 --- a/recipes/tensorflow-lite/all/test_package/conanfile.py +++ b/recipes/tensorflow-lite/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.build import can_run import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): model_path = os.path.join(self.source_folder, "model.tflite") - command = os.path.join("bin", "test_package") - self.run(" ".join([command, model_path]), run_environment=True) + command = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(f"{command} {model_path}", env="conanrun") diff --git a/recipes/tensorflow-lite/all/test_v1_package/CMakeLists.txt b/recipes/tensorflow-lite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..ff2f7e7d39536 --- /dev/null +++ b/recipes/tensorflow-lite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tensorflowlite REQUIRED CONFIG) + +add_executable(test_package ../test_package/test_package.cpp) +target_link_libraries(test_package PRIVATE tensorflow::tensorflowlite) +target_compile_features(test_package PRIVATE cxx_std_17) diff --git a/recipes/tensorflow-lite/all/test_v1_package/conanfile.py b/recipes/tensorflow-lite/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..17a163fae24bd --- /dev/null +++ b/recipes/tensorflow-lite/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + model_path = os.path.join(self.source_folder, os.pardir, "test_package", "model.tflite") + command = os.path.join("bin", "test_package") + self.run(f"{command} {model_path}", run_environment=True) diff --git a/recipes/tensorflow-lite/config.yml b/recipes/tensorflow-lite/config.yml index 939866f077b06..22d65dcfdfac6 100644 --- a/recipes/tensorflow-lite/config.yml +++ b/recipes/tensorflow-lite/config.yml @@ -1,7 +1,3 @@ versions: - "2.6.0": - folder: all - "2.6.2": - folder: all - "2.9.1": + "2.10.0": folder: all diff --git a/recipes/tensorpipe/all/CMakeLists.txt b/recipes/tensorpipe/all/CMakeLists.txt deleted file mode 100644 index bd3083b512cb9..0000000000000 --- a/recipes/tensorpipe/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/tensorpipe/all/conanfile.py b/recipes/tensorpipe/all/conanfile.py index c6fddca666969..6b75a2b9a55d1 100644 --- a/recipes/tensorpipe/all/conanfile.py +++ b/recipes/tensorpipe/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.3" class TensorpipeConan(ConanFile): @@ -37,14 +41,6 @@ class TensorpipeConan(ConanFile): "cma": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "pkg_config" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os != "Linux": del self.options.ibv @@ -57,80 +53,94 @@ def configure(self): if not self.options.cuda: del self.options.cuda_ipc + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): self.requires("libnop/cci.20200728") - self.requires("libuv/1.42.0") - if self.options.cuda: - raise ConanInvalidConfiguration("cuda recipe not yet available in CCI") - self.requires("cuda/11.2") + self.requires("libuv/1.44.1") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) - if self.settings.os == "Windows": - raise ConanInvalidConfiguration("tensorpipe doesn't support Windows") - - def build_requirements(self): - self.build_requires("pkgconf/1.7.4") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + if self.info.settings.os == "Windows": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support Windows") + if self.info.options.cuda: + raise ConanInvalidConfiguration("cuda recipe not yet available in CCI") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["TP_USE_CUDA"] = self.options.cuda - self._cmake.definitions["TP_ENABLE_IBV"] = self.options.get_safe("ibv", False) - self._cmake.definitions["TP_ENABLE_SHM"] = self.options.get_safe("shm", False) - self._cmake.definitions["TP_ENABLE_CMA"] = self.options.get_safe("cma", False) - self._cmake.definitions["TP_ENABLE_CUDA_IPC"] = self.options.get_safe("cuda_ipc", False) - self._cmake.definitions["TP_BUILD_BENCHMARK"] = False - self._cmake.definitions["TP_BUILD_PYTHON"] = False - self._cmake.definitions["TP_BUILD_TESTING"] = False - self._cmake.definitions["TP_BUILD_LIBUV"] = False - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TP_USE_CUDA"] = self.options.cuda + tc.variables["TP_ENABLE_IBV"] = self.options.get_safe("ibv", False) + tc.variables["TP_ENABLE_SHM"] = self.options.get_safe("shm", False) + tc.variables["TP_ENABLE_CMA"] = self.options.get_safe("cma", False) + tc.variables["TP_ENABLE_CUDA_IPC"] = self.options.get_safe("cuda_ipc", False) + tc.variables["TP_BUILD_BENCHMARK"] = False + tc.variables["TP_BUILD_PYTHON"] = False + tc.variables["TP_BUILD_TESTING"] = False + tc.variables["TP_BUILD_LIBUV"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + cmakelists = os.path.join(self.source_folder, "tensorpipe", "CMakeLists.txt") + replace_in_file(self, cmakelists, "find_package(uv REQUIRED)", "find_package(libuv REQUIRED CONFIG)") + replace_in_file( + self, + cmakelists, + "target_link_libraries(tensorpipe PRIVATE uv::uv)", + "target_link_libraries(tensorpipe PRIVATE $,uv,uv_a>)", + ) + replace_in_file( + self, + cmakelists, + "target_include_directories(tensorpipe PUBLIC $)", + "find_package(libnop REQUIRED CONFIG)\ntarget_link_libraries(tensorpipe PUBLIC libnop::libnop)", + ) def build(self): - with tools.run_environment(self): - cmake = self._configure_cmake() - cmake.build() + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - with tools.run_environment(self): - cmake = self._configure_cmake() - cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"tensorpipe": "Tensorpipe::Tensorpipe"}, ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "Tensorpipe") self.cpp_info.set_property("cmake_target_name", "tensorpipe") self.cpp_info.libs = ["tensorpipe"] - if tools.is_apple_os(self.settings.os): + if is_apple_os(self): self.cpp_info.frameworks = ["CoreFoundation", "IOKit"] # TODO: to remove in conan v2 once cmake_find_package* generators removed diff --git a/recipes/tensorpipe/all/test_package/CMakeLists.txt b/recipes/tensorpipe/all/test_package/CMakeLists.txt index a5db988ae91b5..b5d4b3c8d26da 100644 --- a/recipes/tensorpipe/all/test_package/CMakeLists.txt +++ b/recipes/tensorpipe/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Tensorpipe REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} tensorpipe) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE tensorpipe) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/tensorpipe/all/test_package/conanfile.py b/recipes/tensorpipe/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/tensorpipe/all/test_package/conanfile.py +++ b/recipes/tensorpipe/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tensorpipe/all/test_v1_package/CMakeLists.txt b/recipes/tensorpipe/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a071eb41c6bdd --- /dev/null +++ b/recipes/tensorpipe/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Tensorpipe REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tensorpipe) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/tensorpipe/all/test_v1_package/conanfile.py b/recipes/tensorpipe/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/tensorpipe/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/termcap/all/CMakeLists.txt b/recipes/termcap/all/CMakeLists.txt index 938d410319ca2..8f1754f603024 100644 --- a/recipes/termcap/all/CMakeLists.txt +++ b/recipes/termcap/all/CMakeLists.txt @@ -1,8 +1,5 @@ cmake_minimum_required(VERSION 3.1) -project(conan_termcap C) - -include("conanbuildinfo.cmake") -conan_basic_setup(KEEP_RPATHS) +project(conan_termcap LANGUAGES C) include(CheckIncludeFile) include(GNUInstallDirs) diff --git a/recipes/termcap/all/conandata.yml b/recipes/termcap/all/conandata.yml index ae28eb40c9642..e1dc4852be620 100644 --- a/recipes/termcap/all/conandata.yml +++ b/recipes/termcap/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "1.3.1": - patch_file: "patches/0001-msvc.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-macOS.patch" - base_path: "source_subfolder" diff --git a/recipes/termcap/all/conanfile.py b/recipes/termcap/all/conanfile.py index 056553202443f..5a7977cbd588b 100644 --- a/recipes/termcap/all/conanfile.py +++ b/recipes/termcap/all/conanfile.py @@ -1,9 +1,10 @@ +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -from conans import ConanFile, CMake, tools import re - -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class TermcapConan(ConanFile): @@ -13,63 +14,59 @@ class TermcapConan(ConanFile): description = "Enables programs to use display terminals in a terminal-independent manner" license = "GPL-2.0-or-later" topics = ("terminal", "display", "text", "writing") - generators = "cmake" - settings = "os", "arch", "compiler", "build_type" - options = {"shared": [True, False], "fPIC": [True, False], } - default_options = {"shared": False, "fPIC": True, } - - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def _extract_sources(self): - makefile_text = open(os.path.join(self._source_subfolder, "Makefile.in")).read() - sources = list("{}/{}".format(self._source_subfolder, src) for src in re.search("\nSRCS = (.*)\n", makefile_text).group(1).strip().split(" ")) - headers = list("{}/{}".format(self._source_subfolder, src) for src in re.search("\nHDRS = (.*)\n", makefile_text).group(1).strip().split(" ")) - autoconf_text = open(os.path.join(self._source_subfolder, "configure.in")).read() + makefile_text = open(os.path.join(self.source_folder, "Makefile.in")).read() + sources = list(f"{self.source_folder}/{src}" for src in re.search("\nSRCS = (.*)\n", makefile_text).group(1).strip().split(" ")) + headers = list(f"{self.source_folder}/{src}" for src in re.search("\nHDRS = (.*)\n", makefile_text).group(1).strip().split(" ")) + autoconf_text = open(os.path.join(self.source_folder, "configure.in")).read() optional_headers = re.search(r"AC_HAVE_HEADERS\((.*)\)", autoconf_text).group(1).strip().split(" ") return sources, headers, optional_headers - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) + to_cmake_paths = lambda paths: ";".join([p.replace("\\", "/") for p in paths]) sources, headers, optional_headers = self._extract_sources() - self._cmake.definitions["TERMCAP_SOURCES"] = ";".join(sources) - self._cmake.definitions["TERMCAP_HEADERS"] = ";".join(headers) - self._cmake.definitions["TERMCAP_INC_OPTS"] = ";".join(optional_headers) - self._cmake.definitions["TERMCAP_CAP_FILE"] = os.path.join(self._source_subfolder, "termcap.src").replace("\\", "/") - self._cmake.definitions["CMAKE_INSTALL_SYSCONFDIR"] = os.path.join(self.package_folder, "bin", "etc").replace("\\", "/") - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.cache_variables["TERMCAP_SOURCES"] = to_cmake_paths(sources) + tc.cache_variables["TERMCAP_HEADERS"] = to_cmake_paths(headers) + tc.cache_variables["TERMCAP_INC_OPTS"] = to_cmake_paths(optional_headers) + tc.cache_variables["TERMCAP_CAP_FILE"] = os.path.join(self.source_folder, "termcap.src").replace("\\", "/") + tc.cache_variables["CMAKE_INSTALL_SYSCONFDIR"] = os.path.join(self.package_folder, "bin", "etc").replace("\\", "/") + tc.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) if self.settings.os == "Windows": for src in self._extract_sources()[0]: @@ -80,12 +77,13 @@ def _patch_sources(self): def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() @property @@ -93,9 +91,9 @@ def _termcap_path(self): return os.path.join(self.package_folder, "bin", "etc", "termcap") def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["termcap"] if self.options.shared: self.cpp_info.defines = ["TERMCAP_SHARED"] - self.output.info("Setting TERMCAP environment variable: {}".format(self._termcap_path)) + self.runenv_info.define_path("TERMCAP", self._termcap_path) self.env_info.TERMCAP = self._termcap_path diff --git a/recipes/termcap/all/test_package/CMakeLists.txt b/recipes/termcap/all/test_package/CMakeLists.txt index a0af472514742..57743fe7229db 100644 --- a/recipes/termcap/all/test_package/CMakeLists.txt +++ b/recipes/termcap/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(termcap CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} termcap::termcap) +target_link_libraries(${PROJECT_NAME} PRIVATE termcap::termcap) diff --git a/recipes/termcap/all/test_package/conanfile.py b/recipes/termcap/all/test_package/conanfile.py index b4135aca58084..299c3facd9ebf 100644 --- a/recipes/termcap/all/test_package/conanfile.py +++ b/recipes/termcap/all/test_package/conanfile.py @@ -1,10 +1,25 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.env import Environment import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + env = Environment() + env.define("TERM", "xtermc") + env.vars(self, scope="run").save_script("conanrun_term") def build(self): cmake = CMake(self) @@ -12,7 +27,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - with tools.environment_append({"TERM": "xtermc"}): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/termcap/all/test_v1_package/CMakeLists.txt b/recipes/termcap/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/termcap/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/termcap/all/test_v1_package/conanfile.py b/recipes/termcap/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a7ccb827b1a74 --- /dev/null +++ b/recipes/termcap/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + with tools.environment_append({"TERM": "xtermc"}): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tesseract/all/CMakeLists.txt b/recipes/tesseract/all/CMakeLists.txt deleted file mode 100644 index 10f181138a90f..0000000000000 --- a/recipes/tesseract/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(NOT CMAKE_SYSTEM_PROCESSOR) - set(CMAKE_SYSTEM_PROCESSOR ${CONAN_TESSERACT_SYSTEM_PROCESSOR}) -endif() - -add_subdirectory("source_subfolder") diff --git a/recipes/tesseract/all/conandata.yml b/recipes/tesseract/all/conandata.yml index 855fa8f63561e..7daa1a412e05d 100644 --- a/recipes/tesseract/all/conandata.yml +++ b/recipes/tesseract/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.3.0": + url: "https://github.com/tesseract-ocr/tesseract/archive/5.3.0.tar.gz" + sha256: "7e70870f8341e5ea228af2836ce79a36eefa11b01b56177b4a8997f330c014b8" "5.2.0": url: "https://github.com/tesseract-ocr/tesseract/archive/5.2.0.tar.gz" sha256: "eba4deb2f92a3f89a6623812074af8c53b772079525b3c263aa70bbf7b748b3c" @@ -12,27 +15,41 @@ sources: url: "https://github.com/tesseract-ocr/tesseract/archive/4.1.1.tar.gz" sha256: "2a66ff0d8595bff8f04032165e6c936389b1e5727c3ce5a27b3e059d218db1cb" patches: + "5.3.0": + - patch_file: "patches/0004-control-optimizations-5.3.0.patch" + patch_description: "fix condition for cpu optimizations" + patch_type: "portability" "5.2.0": - - patch_file: "patches/0002-Link-with-targets-5.2.0.patch" - base_path: "source_subfolder" - - patch_file: "patches/0004-control-optimizations-5.2.0.patch" - base_path: "source_subfolder" + - patch_file: "patches/0002-Link-with-targets-5.2.0.patch" + patch_description: "link cci package" + patch_type: "conan" + - patch_file: "patches/0004-control-optimizations-5.2.0.patch" + patch_description: "fix condition for cpu optimizations" + patch_type: "portability" "5.1.0": - - patch_file: "patches/0002-Link-with-targets-5.1.0.patch" - base_path: "source_subfolder" - - patch_file: "patches/0004-control-optimizations-5.1.0.patch" - base_path: "source_subfolder" + - patch_file: "patches/0002-Link-with-targets-5.1.0.patch" + patch_description: "link cci package" + patch_type: "conan" + - patch_file: "patches/0004-control-optimizations-5.1.0.patch" + patch_description: "fix condition for cpu optimizations" + patch_type: "portability" "5.0.0": - - patch_file: "patches/0002-Link-with-targets-5.0.0.patch" - base_path: "source_subfolder" - - patch_file: "patches/0004-control-optimizations-5.0.0.patch" - base_path: "source_subfolder" + - patch_file: "patches/0002-Link-with-targets-5.0.0.patch" + patch_description: "link cci package" + patch_type: "conan" + - patch_file: "patches/0004-control-optimizations-5.0.0.patch" + patch_description: "fix condition for cpu optimizations" + patch_type: "portability" "4.1.1": - - patch_file: "patches/0001-install-bundle.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-Link-with-targets.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-Dont-change-locale.patch" - base_path: "source_subfolder" - - patch_file: "patches/0004-control-optimizations-4.1.1.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-install-bundle.patch" + patch_description: "fix runtime install path" + patch_type: "conan" + - patch_file: "patches/0002-Link-with-targets.patch" + patch_description: "link cci package" + patch_type: "conan" + - patch_file: "patches/0003-Dont-change-locale.patch" + patch_description: "disable settings locale" + patch_type: "portability" + - patch_file: "patches/0004-control-optimizations-4.1.1.patch" + patch_description: "fix condition for cpu optimizations" + patch_type: "portability" diff --git a/recipes/tesseract/all/conanfile.py b/recipes/tesseract/all/conanfile.py index e8471ec2f6dff..347299bc98164 100644 --- a/recipes/tesseract/all/conanfile.py +++ b/recipes/tesseract/all/conanfile.py @@ -1,12 +1,14 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, save from conan.tools.build import cross_building +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout + import os import textwrap -import functools - -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class TesseractConan(ConanFile): name = "tesseract" @@ -36,53 +38,45 @@ class TesseractConan(ConanFile): "with_libarchive": True, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": del self.options.fPIC - if tools.Version(self.version) < "5.0.0": + if Version(self.version) < "5.0.0": del self.options.with_libcurl del self.options.with_libarchive def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if self.options.with_training: # do not enforce failure and allow user to build with system cairo, pango, fontconfig self.output.warn("*** Build with training is not yet supported, continue on your own") + def layout(self): + cmake_layout(self, src_folder="src") + def requirements(self): self.requires("leptonica/1.82.0") # libarchive is required for 4.x so default value is true if self.options.get_safe("with_libarchive", default=True): - self.requires("libarchive/3.6.1") + self.requires("libarchive/3.6.2") # libcurl is not required for 4.x if self.options.get_safe("with_libcurl", default=False): - self.requires("libcurl/7.84.0") + self.requires("libcurl/7.86.0") def validate(self): # Check compiler version compiler = str(self.settings.compiler) - compiler_version = tools.Version(self.settings.compiler.version.value) + compiler_version = Version(self.settings.compiler.version.value) - if tools.Version(self.version) >= "5.0.0": + if Version(self.version) >= "5.0.0": # 5.0.0 requires C++-17 compiler minimal_version = { "Visual Studio": "16", + "msvc": "192", "gcc": "7", "clang": "7", "apple-clang": "11" @@ -90,6 +84,7 @@ def validate(self): else: minimal_version = { "Visual Studio": "14", + "msvc": "190", "gcc": "5", "clang": "5", "apple-clang": "6" @@ -98,66 +93,64 @@ def validate(self): self.output.warn( "%s recipe lacks information about the %s compiler standard version support" % (self.name, compiler)) elif compiler_version < minimal_version[compiler]: - raise ConanInvalidConfiguration("{} requires a {} version >= {}, but {} was found".format(self.name, compiler, minimal_version[compiler], compiler_version)) + raise ConanInvalidConfiguration(f"{self.ref} requires a {compiler} version >= {minimal_version[compiler]}, but {compiler_version} was found") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TRAINING_TOOLS"] = self.options.with_training - cmake.definitions["INSTALL_CONFIGS"] = self.options.with_training + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_TRAINING_TOOLS"] = self.options.with_training + tc.variables["INSTALL_CONFIGS"] = self.options.with_training # pre-5.0.0 uses custom STATIC variable instead of BUILD_SHARED_LIBS - if tools.Version(self.version) < "5.0.0": - cmake.definitions["STATIC"] = not self.options.shared + if Version(self.version) < "5.0.0": + tc.variables["STATIC"] = not self.options.shared # Use CMake-based package build and dependency detection, not the pkg-config, cppan or SW - cmake.definitions["CPPAN_BUILD"] = False - cmake.definitions["SW_BUILD"] = False + tc.variables["CPPAN_BUILD"] = False + tc.variables["SW_BUILD"] = False # disable autodetect of vector extensions and march=native - cmake.definitions["ENABLE_OPTIMIZATIONS"] = self.options.with_auto_optimize + tc.variables["ENABLE_OPTIMIZATIONS"] = self.options.with_auto_optimize - if tools.Version(self.version) < "5.0.0": - cmake.definitions["AUTO_OPTIMIZE"] = self.options.with_auto_optimize + if Version(self.version) < "5.0.0": + tc.variables["AUTO_OPTIMIZE"] = self.options.with_auto_optimize # Set Leptonica_DIR to ensure that find_package will be called in original CMake file - cmake.definitions["Leptonica_DIR"] = self.deps_cpp_info["leptonica"].rootpath + tc.variables["Leptonica_DIR"] = self.deps_cpp_info["leptonica"].rootpath.replace("\\", "/") - if tools.Version(self.version) >= "5.0.0": - cmake.definitions["DISABLE_CURL"] = not self.options.with_libcurl - cmake.definitions["DISABLE_ARCHIVE"] = not self.options.with_libarchive + if Version(self.version) >= "5.0.0": + tc.variables["DISABLE_CURL"] = not self.options.with_libcurl + tc.variables["DISABLE_ARCHIVE"] = not self.options.with_libarchive if cross_building(self): cmake_system_processor = { "armv8": "aarch64", "armv8.3": "aarch64", }.get(str(self.settings.arch), str(self.settings.arch)) - cmake.definitions["CONAN_TESSERACT_SYSTEM_PROCESSOR"] = cmake_system_processor + tc.cache_variables["CMAKE_SYSTEM_PROCESSOR"] = cmake_system_processor - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - tools.rmdir(os.path.join(self.package_folder, "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -165,8 +158,7 @@ def package(self): {"libtesseract": "Tesseract::libtesseract"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): content += textwrap.dedent("""\ @@ -175,7 +167,7 @@ def _create_cmake_module_alias_targets(module_file, targets): set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + save(self, module_file, content) @property def _module_file_rel_path(self): @@ -222,7 +214,7 @@ def package_info(self): def _libname(self): suffix = "" if self.settings.os == "Windows": - v = tools.Version(self.version) + v = Version(self.version) suffix += "{}{}".format(v.major, v.minor) if self.settings.build_type == "Debug": suffix += "d" diff --git a/recipes/tesseract/all/patches/0004-control-optimizations-5.3.0.patch b/recipes/tesseract/all/patches/0004-control-optimizations-5.3.0.patch new file mode 100644 index 0000000000000..493ab5b70ee14 --- /dev/null +++ b/recipes/tesseract/all/patches/0004-control-optimizations-5.3.0.patch @@ -0,0 +1,31 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 8c6845c..6e56862 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -144,7 +144,7 @@ else() + endif() + + check_cxx_compiler_flag("-march=native" COMPILER_SUPPORTS_MARCH_NATIVE) +-if(COMPILER_SUPPORTS_MARCH_NATIVE) ++if(ENABLE_OPTIMIZATIONS AND COMPILER_SUPPORTS_MARCH_NATIVE) + set(MARCH_NATIVE_FLAGS "${MARCH_NATIVE_FLAGS} -march=native") + if(NOT CLANG AND MSVC) + # clang-cl does not know this argument +@@ -155,7 +155,7 @@ endif() + + message(STATUS "CMAKE_SYSTEM_PROCESSOR=<${CMAKE_SYSTEM_PROCESSOR}>") + +-if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86|x86_64|AMD64|amd64|i386|i686") ++if(ENABLE_OPTIMIZATIONS AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86|x86_64|AMD64|amd64|i386|i686") + + set(HAVE_NEON FALSE) + if(MSVC) +@@ -255,7 +255,7 @@ else() + set(HAVE_NEON FALSE) + set(HAVE_SSE4_1 FALSE) + +-endif(CMAKE_SYSTEM_PROCESSOR MATCHES "x86|x86_64|AMD64|amd64|i386|i686") ++endif(ENABLE_OPTIMIZATIONS AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86|x86_64|AMD64|amd64|i386|i686") + + # Compiler specific environments + if(CMAKE_COMPILER_IS_GNUCXX OR MINGW) diff --git a/recipes/tesseract/all/test_package/CMakeLists.txt b/recipes/tesseract/all/test_package/CMakeLists.txt index c64cfc9b9ceb3..b9b9eb1f26670 100644 --- a/recipes/tesseract/all/test_package/CMakeLists.txt +++ b/recipes/tesseract/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(Tesseract REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) if(TARGET Tesseract::libtesseract) - target_link_libraries(${PROJECT_NAME} Tesseract::libtesseract) + target_link_libraries(${PROJECT_NAME} PRIVATE Tesseract::libtesseract) else() - target_link_libraries(${PROJECT_NAME} libtesseract) + target_link_libraries(${PROJECT_NAME} PRIVATE libtesseract) endif() target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tesseract/all/test_package/conanfile.py b/recipes/tesseract/all/test_package/conanfile.py index 2490acfa82ff8..a9fb96656f203 100644 --- a/recipes/tesseract/all/test_package/conanfile.py +++ b/recipes/tesseract/all/test_package/conanfile.py @@ -1,11 +1,19 @@ -from conans import ConanFile, CMake -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tesseract/all/test_v1_package/CMakeLists.txt b/recipes/tesseract/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/tesseract/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/tesseract/all/test_v1_package/conanfile.py b/recipes/tesseract/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/tesseract/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tesseract/config.yml b/recipes/tesseract/config.yml index 1a611918fe43c..18a9581e91b42 100644 --- a/recipes/tesseract/config.yml +++ b/recipes/tesseract/config.yml @@ -1,4 +1,6 @@ versions: + "5.3.0": + folder: all "5.2.0": folder: all "5.1.0": diff --git a/recipes/tgbot/all/conandata.yml b/recipes/tgbot/all/conandata.yml index 2d22eb0d1c313..054b04f19ea35 100644 --- a/recipes/tgbot/all/conandata.yml +++ b/recipes/tgbot/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.5": + url: "https://github.com/reo7sp/tgbot-cpp/archive/v1.5.tar.gz" + sha256: "ecd5a21ea45b890828aba1639ac49401cfdd5b30f791322cb1ba84c9ac77647c" "1.3": url: "https://github.com/reo7sp/tgbot-cpp/archive/v1.3.tar.gz" sha256: "85b9aef49c595d39fc9dc330b1b83625bea9509966dc623f7b4c1ee7309679c9" diff --git a/recipes/tgbot/config.yml b/recipes/tgbot/config.yml index c7e8d9bb1b5d2..220c83c443ceb 100644 --- a/recipes/tgbot/config.yml +++ b/recipes/tgbot/config.yml @@ -1,4 +1,6 @@ versions: + "1.5": + folder: all "1.3": folder: all "1.2.1": diff --git a/recipes/tgc/all/conanfile.py b/recipes/tgc/all/conanfile.py index a608a5953817a..9864929c0cf10 100644 --- a/recipes/tgc/all/conanfile.py +++ b/recipes/tgc/all/conanfile.py @@ -3,17 +3,18 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class TgcConan(ConanFile): name = "tgc" description = "A Tiny Garbage Collector for C." license = "BSD-2-Clause" - topics = ("tgc", "garbage-collector") + topics = ("garbage-collector",) homepage = "https://github.com/orangeduck/tgc" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,22 +33,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/tgc/all/test_package/conanfile.py b/recipes/tgc/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/tgc/all/test_package/conanfile.py +++ b/recipes/tgc/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/tgc/all/test_v1_package/CMakeLists.txt b/recipes/tgc/all/test_v1_package/CMakeLists.txt index 3c18b56dfcebf..0d20897301b68 100644 --- a/recipes/tgc/all/test_v1_package/CMakeLists.txt +++ b/recipes/tgc/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tgc REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE tgc::tgc) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/theora/all/CMakeLists.txt b/recipes/theora/all/CMakeLists.txt new file mode 100644 index 0000000000000..d51dd8c636707 --- /dev/null +++ b/recipes/theora/all/CMakeLists.txt @@ -0,0 +1,122 @@ +cmake_minimum_required(VERSION 3.15) +project(theora C) + +# Note that I wrote this cmake file because: +# - the old msvc sln was very old and required upgrades each time it was built +# - the old msvc did not support RelWithDebInfo +# - the recipe needed to be upgraded for conan-v2, so a simpler recipe was desired + +find_package(Ogg CONFIG REQUIRED) + +set (HEADERS + "include/theora/codec.h" + "include/theora/theora.h" + "include/theora/theoradec.h" + "include/theora/theoraenc.h" +) + +set(LIBTHEORA_COMMON + "lib/apiwrapper.c" + "lib/bitpack.c" # was not in enc in SConstruct + "lib/dequant.c" + "lib/fragment.c" + "lib/idct.c" + "lib/info.c" # was not in enc in SConstruct + "lib/internal.c" + "lib/state.c" + "lib/quant.c" + ) + +set(LIBTHEORA_ENC + "lib/analyze.c" + "lib/encapiwrapper.c" + "lib/encfrag.c" + "lib/encinfo.c" + "lib/encode.c" + "lib/enquant.c" + "lib/fdct.c" + "lib/huffenc.c" + "lib/mathops.c" + "lib/mcenc.c" + "lib/rate.c" + "lib/tokenize.c" + ) + + +set(LIBTHEORA_DEC + "lib/decapiwrapper.c" + "lib/decinfo.c" + "lib/decode.c" + "lib/huffdec.c" + ) + + +option(USE_X86_32 "Use x86-32 optimization" OFF) +option(USE_X86_64 "Use x86-64 optimization" OFF) +if (USE_X86_32) + message("Enabling x86-32 assembly optimizations") + add_definitions(-DOC_X86_ASM) + + list (APPEND LIBTHEORA_COMMON + "lib/x86/mmxidct.c" + "lib/x86/mmxfrag.c" + "lib/x86/mmxstate.c" + "lib/x86/x86state.c" + ) + + list (APPEND LIBTHEORA_ENC + "lib/x86/mmxencfrag.c" + "lib/x86/mmxfdct.c" + "lib/x86/x86enc.c" + "lib/x86/mmxfrag.c" + "lib/x86/mmxidct.c" + "lib/x86/mmxstate.c" + "lib/x86/x86state.c" + ) +elseif (USE_X86_64) + message("Enabling x86-64 assembly optimizations") + add_definitions(-DOC_X86_ASM) + add_definitions(-DOC_X86_64_ASM) + + list (APPEND LIBTHEORA_COMMON + "lib/x86/mmxidct.c" + "lib/x86/mmxfrag.c" + "lib/x86/mmxstate.c" + "lib/x86/x86state.c" + ) + + list (APPEND LIBTHEORA_ENC + "lib/x86/mmxencfrag.c" + "lib/x86/mmxfdct.c" + "lib/x86/x86enc.c" + "lib/x86/sse2fdct.c" + ) +else() + message("Not enabling any assembly optimizations (x86 and x86_64 asm optimizations are available)") +endif() + + +if (MSVC AND BUILD_SHARED_LIBS) + set (CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) +endif () + +add_library(theora ${LIBTHEORA_COMMON} ${LIBTHEORA_ENC} ${LIBTHEORA_DEC}) +add_library(theoraenc ${LIBTHEORA_COMMON} ${LIBTHEORA_ENC}) +add_library(theoradec ${LIBTHEORA_COMMON} ${LIBTHEORA_DEC}) + +if (BUILD_SHARED_LIBS) + target_compile_definitions(theora PRIVATE LIBTHEORA_EXPORTS) + target_compile_definitions(theoraenc PRIVATE LIBTHEORA_EXPORTS) + target_compile_definitions(theoradec PRIVATE LIBTHEORA_EXPORTS) +endif() + +target_link_libraries(theora PUBLIC Ogg::ogg) +target_link_libraries(theoraenc PUBLIC Ogg::ogg) +target_link_libraries(theoradec PUBLIC Ogg::ogg) + +target_include_directories(theora PUBLIC include) +target_include_directories(theoraenc PUBLIC include) +target_include_directories(theoradec PUBLIC include) + +install(FILES ${HEADERS} DESTINATION include/theora) +install(TARGETS theora theoraenc theoradec) diff --git a/recipes/theora/all/conandata.yml b/recipes/theora/all/conandata.yml index 74e7aaff46cc5..b2963c4be74a9 100644 --- a/recipes/theora/all/conandata.yml +++ b/recipes/theora/all/conandata.yml @@ -1,6 +1,4 @@ sources: "1.1.1": - - url: "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.zip" - sha256: "f644fef154f7a80e7258c8baec5c510f594d720835855cddce322b924934ba36" - - url: "https://raw.githubusercontent.com/xiph/theora/v1.1.1/lib/theora.def" - sha256: "56362ca0cc73172c06b53866ba52fad941d02fc72084d292c705a1134913e806" + url: "http://downloads.xiph.org/releases/theora/libtheora-1.1.1.zip" + sha256: "f644fef154f7a80e7258c8baec5c510f594d720835855cddce322b924934ba36" diff --git a/recipes/theora/all/conanfile.py b/recipes/theora/all/conanfile.py index 0734e7d3d3670..ca4711add6a90 100644 --- a/recipes/theora/all/conanfile.py +++ b/recipes/theora/all/conanfile.py @@ -1,47 +1,26 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, MSBuild, AutoToolsBuildEnvironment, tools -import functools +from conan import ConanFile +from conan.tools.cmake import CMakeToolchain, CMake, CMakeDeps, cmake_layout +from conan.tools.files import copy, download, get, replace_in_file +from conan.tools.microsoft import is_msvc +from conan.errors import ConanException import os -import re -import shutil -import stat - -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.52.0" class TheoraConan(ConanFile): name = "theora" - description = "Theora is a free and open video compression format from the Xiph.org Foundation" + license = "BSD-3-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/xiph/theora" - topics = ("theora", "video", "video-compressor", "video-format") - license = "BSD-3-Clause" - - settings = "os", "arch", "compiler", "build_type" - options = { - "shared": [True, False], - "fPIC": [True, False], - } - default_options = { - "shared": False, - "fPIC": True, - } - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] + description = "Theora is a free and open video compression format from the Xiph.org Foundation" + topics = "video", "video-compressor", "video-format" - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + settings = "os", "compiler", "build_type", "arch" + options = {"shared": [True, False], "fPIC": [True, False]} + default_options = {"shared": False, "fPIC": True} - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + def export_sources(self): + copy(self, "CMakeLists.txt", self.recipe_folder, os.path.join(self.export_sources_folder,"src")) def config_options(self): if self.settings.os == "Windows": @@ -49,134 +28,63 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except ConanException: + pass + try: + del self.settings.compiler.libcxx + except ConanException: + pass + try: + del self.settings.compiler.cppstd + except ConanException: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("ogg/1.3.5") - def build_requirements(self): - if not self._is_msvc: - self.build_requires("gnu-config/cci.20201022") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - def source(self): - tools.get(**self.conan_data["sources"][self.version][0], strip_root=True, destination=self._source_subfolder) - - source = self.conan_data["sources"][self.version][1] - url = source["url"] - filename = url[url.rfind("/") + 1:] - tools.download(url, filename) - tools.check_sha256(filename, source["sha256"]) - - shutil.move(filename, os.path.join(self._source_subfolder, "lib", filename)) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) - def _build_msvc(self): - def format_libs(libs): - return " ".join([l + ".lib" for l in libs]) - - project = "libtheora" - config = "dynamic" if self.options.shared else "static" - sln_dir = os.path.join(self._source_subfolder, "win32", "VS2008") - vcproj_path = os.path.join(sln_dir, project, "{}_{}.vcproj".format(project, config)) - - # fix hard-coded ogg names - if self.options.shared: - tools.replace_in_file(vcproj_path, - "libogg.lib", - format_libs(self.deps_cpp_info["ogg"].libs)) - - # Honor vc runtime from profile - if "MT" in msvc_runtime_flag(self): - tools.replace_in_file(vcproj_path, 'RuntimeLibrary="2"', 'RuntimeLibrary="0"') - tools.replace_in_file(vcproj_path, 'RuntimeLibrary="3"', 'RuntimeLibrary="1"') - - sln = "{}_{}.sln".format(project, config) - targets = ["libtheora" if self.options.shared else "libtheora_static"] - properties = { - # Enable LTO when CFLAGS contains -GL - "WholeProgramOptimization": "true" if any(re.finditer("(^| )[/-]GL($| )", tools.get_env("CFLAGS", ""))) else "false", - } - - with tools.chdir(sln_dir): - msbuild = MSBuild(self) - msbuild.build(sln, targets=targets, platforms={"x86": "Win32", "x86_64": "x64"}, properties=properties) - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - "--disable-examples", - ] - autotools.configure(configure_dir=self._source_subfolder, args=args) - return autotools + def generate(self): + tc = CMakeToolchain(self) + tc.variables["USE_X86_32"] = (self.settings.arch == "x86") + # note: MSVC does not support inline assembly for 64 bit builds + tc.variables["USE_X86_64"] = (self.settings.arch == "x86_64" and not is_msvc(self)) + tc.generate() + cd = CMakeDeps(self) + cd.generate() def build(self): - if self._is_msvc: - self._build_msvc() - else: - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "config.guess")) - configure = os.path.join(self._source_subfolder, "configure") - permission = stat.S_IMODE(os.lstat(configure).st_mode) - os.chmod(configure, (permission | stat.S_IEXEC)) - # relocatable shared libs on macOS - tools.replace_in_file(configure, "-install_name \\$rpath/", "-install_name @rpath/") - # avoid SIP issues on macOS when dependencies are shared - if tools.is_apple_os(self.settings.os): - libpaths = ":".join(self.deps_cpp_info.lib_paths) - tools.replace_in_file( - configure, - "#! /bin/sh\n", - "#! /bin/sh\nexport DYLD_LIBRARY_PATH={}:$DYLD_LIBRARY_PATH\n".format(libpaths), - ) - autotools = self._configure_autotools() - autotools.make() + cmake = CMake(self) + cmake.configure() + cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern="*.h", dst="include", src=include_folder) - self.copy(pattern="*.dll", dst="bin", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) - else: - autotools = self._configure_autotools() - autotools.install() - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() def package_info(self): - self.cpp_info.set_property("pkg_config_name", "theora_full_package") # to avoid conflicts with _theora component + self.cpp_info.set_property("pkg_config_name", "theora_full_package_do_not_use") # to avoid conflicts with theora component - self.cpp_info.components["_theora"].set_property("pkg_config_name", "theora") - prefix = "lib" if self._is_msvc else "" - suffix = "_static" if self._is_msvc and not self.options.shared else "" - self.cpp_info.components["_theora"].libs = [f"{prefix}theora{suffix}"] - self.cpp_info.components["_theora"].requires = ["ogg::ogg"] + self.cpp_info.components["theora"].set_property("pkg_config_name", "theora") + self.cpp_info.components["theora"].libs = ["theora"] + self.cpp_info.components["theora"].requires = ["ogg::ogg"] self.cpp_info.components["theoradec"].set_property("pkg_config_name", "theoradec") + self.cpp_info.components["theoradec"].libs = ["theoradec"] self.cpp_info.components["theoradec"].requires = ["ogg::ogg"] - if self._is_msvc: - self.cpp_info.components["theoradec"].requires.append("_theora") - else: - self.cpp_info.components["theoradec"].libs = ["theoradec"] self.cpp_info.components["theoraenc"].set_property("pkg_config_name", "theoraenc") - self.cpp_info.components["theoraenc"].requires = ["theoradec", "ogg::ogg"] - if self._is_msvc: - self.cpp_info.components["theoradec"].requires.append("_theora") - else: - self.cpp_info.components["theoraenc"].libs = ["theoraenc"] + self.cpp_info.components["theoraenc"].libs = ["theoraenc"] + self.cpp_info.components["theoraenc"].requires = ["ogg::ogg"] + # TODO: to remove in conan v2 once pkg_config generator removed self.cpp_info.names["pkg_config"] = "theora_full_package" diff --git a/recipes/theora/all/test_package/CMakeLists.txt b/recipes/theora/all/test_package/CMakeLists.txt index 019f47403d1ff..73fb77db6077c 100644 --- a/recipes/theora/all/test_package/CMakeLists.txt +++ b/recipes/theora/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.15) +project(PackageTest C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(theora CONFIG REQUIRED) -find_package(theora REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} theora::theora) +add_executable(test_package test_package.c) +target_link_libraries(test_package PRIVATE theora::theora) diff --git a/recipes/theora/all/test_package/conanfile.py b/recipes/theora/all/test_package/conanfile.py index ab912e4e61df1..f5759f27e0ef5 100644 --- a/recipes/theora/all/test_package/conanfile.py +++ b/recipes/theora/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -class TestPackageConan(ConanFile): +class TheoraTestConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/theora/all/test_v1_package/CMakeLists.txt b/recipes/theora/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2e5ac93f43d5b --- /dev/null +++ b/recipes/theora/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(theora CONFIG REQUIRED) + +add_executable(test_package ../test_package/test_package.c) +target_link_libraries(test_package PRIVATE theora::theora) diff --git a/recipes/theora/all/test_v1_package/conanfile.py b/recipes/theora/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/theora/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/threadpool/all/conandata.yml b/recipes/threadpool/all/conandata.yml index 1166e9a506472..7e760f1f74283 100644 --- a/recipes/threadpool/all/conandata.yml +++ b/recipes/threadpool/all/conandata.yml @@ -1,4 +1,4 @@ sources: "20140926": - url: "https://github.com/progschj/ThreadPool/archive/9a42ec1.zip" - sha256: "18854bb7ecc1fc9d7dda9c798a1ef0c81c2dd331d730c76c75f648189fa0c20f" + url: "https://github.com/progschj/ThreadPool/archive/9a42ec1329f259a5f4881a291db1dcb8f2ad9040.tar.gz" + sha256: "954e0ecdac1aa0da1e0fa78577ff0d352e53094df43762fbc1884f76a7e1dcd2" diff --git a/recipes/threadpool/all/conanfile.py b/recipes/threadpool/all/conanfile.py index a0dde5830cc28..ad1dad9d75688 100644 --- a/recipes/threadpool/all/conanfile.py +++ b/recipes/threadpool/all/conanfile.py @@ -1,35 +1,50 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -from conans import ConanFile, tools -class threadpoolConan(ConanFile): +required_conan_version = ">=1.50.0" + + +class ThreadpoolConan(ConanFile): name = "threadpool" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/progschj/ThreadPool" description = "A simple C++11 Thread Pool implementation." license = "Zlib" - topics = ("C++11", "Thread", "Pool", "threadpool", "conan") - settings = "os", "compiler" + topics = ("c++11", "thread", "pool") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - listdir = os.listdir() - extracted_dir = [i for i in listdir if "ThreadPool" in i][0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def package(self): - self.copy(pattern="COPYING", src=self._source_subfolder, dst="licenses", ) - self.copy(pattern="*.h", src=self._source_subfolder, dst=os.path.join("include", "ThreadPool")) + def build(self): + pass - def package_id(self): - self.info.header_only() + def package(self): + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include", "ThreadPool")) def package_info(self): - if self.settings.os == "Linux": + self.cpp_info.bindirs = [] + self.cpp_info.includedirs.append(os.path.join("include", "ThreadPool")) + self.cpp_info.libdirs = [] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread"] + + # TODO: to remove in conan v2 (and do not port to CMakeDeps, it was a mistake) self.cpp_info.names["cmake_find_package"] = "ThreadPool" self.cpp_info.names["cmake_find_package_multi"] = "ThreadPool" diff --git a/recipes/threadpool/all/test_package/CMakeLists.txt b/recipes/threadpool/all/test_package/CMakeLists.txt index 829b5ca81b9ce..700241bb74acb 100644 --- a/recipes/threadpool/all/test_package/CMakeLists.txt +++ b/recipes/threadpool/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(threadpool REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE threadpool::threadpool) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/threadpool/all/test_package/conanfile.py b/recipes/threadpool/all/test_package/conanfile.py index 4903f1a7e8fa0..98ab55852ad56 100644 --- a/recipes/threadpool/all/test_package/conanfile.py +++ b/recipes/threadpool/all/test_package/conanfile.py @@ -1,9 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/threadpool/all/test_package/test_package.cpp b/recipes/threadpool/all/test_package/test_package.cpp index 87d978d512809..02e175532d6ce 100644 --- a/recipes/threadpool/all/test_package/test_package.cpp +++ b/recipes/threadpool/all/test_package/test_package.cpp @@ -1,5 +1,5 @@ #include -#include +#include int main(void) { diff --git a/recipes/threadpool/all/test_v1_package/CMakeLists.txt b/recipes/threadpool/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..338ffbb0c05f3 --- /dev/null +++ b/recipes/threadpool/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(ThreadPool REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE ThreadPool::ThreadPool) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/threadpool/all/test_v1_package/conanfile.py b/recipes/threadpool/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/threadpool/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/threadpool/config.yml b/recipes/threadpool/config.yml index 123172e94fde9..3722466e546d5 100644 --- a/recipes/threadpool/config.yml +++ b/recipes/threadpool/config.yml @@ -1,3 +1,3 @@ versions: - "20140926": - folder: all + "20140926": + folder: all diff --git a/recipes/thrift/all/conandata.yml b/recipes/thrift/all/conandata.yml index 59c6e430f7e0f..ab039201f49e0 100644 --- a/recipes/thrift/all/conandata.yml +++ b/recipes/thrift/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.17.0": + url: "https://github.com/apache/thrift/archive/v0.17.0.tar.gz" + sha256: "f5888bcd3b8de40c2c2ab86896867ad9b18510deb412cba3e5da76fb4c604c29" "0.16.0": url: "https://github.com/apache/thrift/archive/refs/tags/v0.16.0.tar.gz" sha256: "df2931de646a366c2e5962af679018bca2395d586e00ba82d09c0379f14f8e7b" @@ -15,13 +18,27 @@ sources: url: "https://github.com/apache/thrift/archive/0.13.0.tar.gz" sha256: "8469c8d72c684c6de72ddf55fc65d1c10868a576e7dc4d1f4a21a59814b97110" patches: + "0.17.0": + - patch_file: "patches/cmake-0.16.0.patch" + patch_description: "use cci packages" + patch_type: "conan" "0.16.0": - patch_file: "patches/cmake-0.16.0.patch" + patch_description: "use cci packages" + patch_type: "conan" "0.15.0": - patch_file: "patches/cmake-0.15.0.patch" + patch_description: "use cci packages" + patch_type: "conan" "0.14.2": - patch_file: "patches/cmake-0.14.1.patch" + patch_description: "use cci packages" + patch_type: "conan" "0.14.1": - patch_file: "patches/cmake-0.14.1.patch" + patch_description: "use cci packages" + patch_type: "conan" "0.13.0": - patch_file: "patches/cmake-0.13.0.patch" + patch_description: "use cci packages" + patch_type: "conan" diff --git a/recipes/thrift/all/conanfile.py b/recipes/thrift/all/conanfile.py index 341979c20ba15..3470e0c73c483 100644 --- a/recipes/thrift/all/conanfile.py +++ b/recipes/thrift/all/conanfile.py @@ -7,7 +7,7 @@ import os import textwrap -required_conan_version = ">1.50.0" +required_conan_version = ">=1.53.0" class ThriftConan(ConanFile): @@ -61,18 +61,18 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def requirements(self): - self.requires("boost/1.79.0") + self.requires("boost/1.81.0") if self.options.with_openssl: - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_libevent: self.requires("libevent/2.1.12") if self.options.with_qt5: - self.requires("qt/5.15.4") + self.requires("qt/5.15.8") def build_requirements(self): # TODO: use is_msvc with build_context in conan >=1.52.0 (see https://github.com/conan-io/conan/pull/11949) @@ -80,7 +80,7 @@ def build_requirements(self): self.tool_requires("winflexbison/2.5.24") else: self.tool_requires("flex/2.6.4") - self.tool_requires("bison/3.7.6") + self.tool_requires("bison/3.8.2") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/thrift/all/test_v1_package/CMakeLists.txt b/recipes/thrift/all/test_v1_package/CMakeLists.txt index e503c370b400e..be00a8c7f57c7 100644 --- a/recipes/thrift/all/test_v1_package/CMakeLists.txt +++ b/recipes/thrift/all/test_v1_package/CMakeLists.txt @@ -1,16 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Thrift CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} - ../test_package/calculator_constants.cpp - ../test_package/calculator_types.cpp - ../test_package/Calculator.cpp - ../test_package/test_package.cpp -) -target_link_libraries(${PROJECT_NAME} PRIVATE thrift::thrift) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/thrift/config.yml b/recipes/thrift/config.yml index b2d38c3685f16..66a1ad96af024 100644 --- a/recipes/thrift/config.yml +++ b/recipes/thrift/config.yml @@ -1,4 +1,6 @@ versions: + "0.17.0": + folder: all "0.16.0": folder: all "0.15.0": diff --git a/recipes/tiny-aes-c/all/CMakeLists.txt b/recipes/tiny-aes-c/all/CMakeLists.txt deleted file mode 100644 index 2fcc36dafa513..0000000000000 --- a/recipes/tiny-aes-c/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/tiny-aes-c/all/conandata.yml b/recipes/tiny-aes-c/all/conandata.yml index 6ee30840f6f37..f5bd969c7683c 100644 --- a/recipes/tiny-aes-c/all/conandata.yml +++ b/recipes/tiny-aes-c/all/conandata.yml @@ -2,3 +2,8 @@ sources: "1.0.0": url: "https://github.com/kokke/tiny-AES-c/archive/v1.0.0.tar.gz" sha256: "61fd99ac95df30e9ab39d6cdd41e88909b2eaf9b9806f23aa235485ac0bed2fd" +patches: + "1.0.0": + - patch_file: "patches/0001-cmake-install.patch" + patch_description: "CMake: add install target" + patch_type: "conan" diff --git a/recipes/tiny-aes-c/all/conanfile.py b/recipes/tiny-aes-c/all/conanfile.py index 058b2937bb14b..e393e50a77697 100644 --- a/recipes/tiny-aes-c/all/conanfile.py +++ b/recipes/tiny-aes-c/all/conanfile.py @@ -1,9 +1,11 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +required_conan_version = ">=1.52.0" -required_conan_version = ">=1.32.0" class TinyAesCConan(ConanFile): name = "tiny-aes-c" @@ -13,8 +15,7 @@ class TinyAesCConan(ConanFile): description = "Small portable AES128/192/256 in C" topics = ("encryption", "crypto", "AES") - settings = "os", "compiler", "build_type", "arch" - + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -27,7 +28,6 @@ class TinyAesCConan(ConanFile): # enable encryption in counter-mode "ctr": [True, False], } - default_options = { "shared": False, "fPIC": True, @@ -37,26 +37,17 @@ class TinyAesCConan(ConanFile): "ctr": True, } - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def _aes_defs(self): + return { + str(self.options.aes_block_size).upper(): "1", + "CBC": "1" if self.options.cbc else "0", + "ECB": "1" if self.options.ecb else "0", + "CTR": "1" if self.options.ctr else "0", + } - @property - def _cflags(self): - return [ - "{}=1".format(str(self.options.aes_block_size).upper()), - "CBC={}".format("1" if self.options.cbc else "0"), - "ECB={}".format("1" if self.options.ecb else "0"), - "CTR={}".format("1" if self.options.ctr else "0") - ] + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -64,41 +55,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if not self.options.cbc and not self.options.ecb and not self.options.ctr: + if not self.info.options.cbc and not self.info.options.ecb and not self.info.options.ctr: raise ConanInvalidConfiguration("Need to at least specify one of CBC, ECB or CTR modes") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = "tiny-AES-c-" + self.version - os.rename(extracted_dir, self._source_subfolder) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["CMAKE_C_FLAGS"] = " ".join("-D{}".format(flag) for flag in self._cflags) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + for definition, value in self._aes_defs.items(): + tc.preprocessor_definitions[definition] = value + # Export symbols for shared msvc + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + # Relocatable shared lib on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("unlicense.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h", dst="include", src=self._source_subfolder) - self.copy(pattern="*.hpp", dst="include", src=self._source_subfolder) - self.copy(pattern="*.a", dst="lib", keep_path=False) - self.copy(pattern="*.lib", dst="lib", keep_path=False) - self.copy(pattern="*.dylib", dst="lib", keep_path=False) - self.copy(pattern="*.so*", dst="lib", keep_path=False) - self.copy(pattern="*.dll", dst="bin", keep_path=False) + copy(self, "unlicense.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() def package_info(self): self.cpp_info.libs = ["tiny-aes"] - self.cpp_info.defines = self._cflags + self.cpp_info.defines.extend([f"{definition}={value}" for definition, value in self._aes_defs.items()]) diff --git a/recipes/tiny-aes-c/all/patches/0001-cmake-install.patch b/recipes/tiny-aes-c/all/patches/0001-cmake-install.patch new file mode 100644 index 0000000000000..bc75d2b9edd8c --- /dev/null +++ b/recipes/tiny-aes-c/all/patches/0001-cmake-install.patch @@ -0,0 +1,14 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -7,3 +7,11 @@ add_library(tiny-aes + ) + + target_include_directories(tiny-aes PRIVATE tiny-AES-c/) ++include(GNUInstallDirs) ++install(FILES aes.h aes.hpp DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) ++install( ++ TARGETS tiny-aes ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ++ ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ++ LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ++) diff --git a/recipes/tiny-aes-c/all/test_package/CMakeLists.txt b/recipes/tiny-aes-c/all/test_package/CMakeLists.txt index a5c315a7b4677..40e72103cc9fc 100644 --- a/recipes/tiny-aes-c/all/test_package/CMakeLists.txt +++ b/recipes/tiny-aes-c/all/test_package/CMakeLists.txt @@ -1,13 +1,10 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C CXX) find_package(tiny-aes-c REQUIRED CONFIG) add_executable(test_package_c test_package.c) add_executable(test_package_cpp test_package.cpp) -target_link_libraries(test_package_c tiny-aes-c::tiny-aes-c) -target_link_libraries(test_package_cpp tiny-aes-c::tiny-aes-c) +target_link_libraries(test_package_c PRIVATE tiny-aes-c::tiny-aes-c) +target_link_libraries(test_package_cpp PRIVATE tiny-aes-c::tiny-aes-c) diff --git a/recipes/tiny-aes-c/all/test_package/conanfile.py b/recipes/tiny-aes-c/all/test_package/conanfile.py index f90f6273aa3a6..66426ef544d60 100644 --- a/recipes/tiny-aes-c/all/test_package/conanfile.py +++ b/recipes/tiny-aes-c/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,8 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package_c") - self.run(bin_path, run_environment=True) - bin_path = os.path.join("bin", "test_package_cpp") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package_c") + self.run(bin_path, env="conanrun") + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package_cpp") + self.run(bin_path, env="conanrun") diff --git a/recipes/tiny-aes-c/all/test_v1_package/CMakeLists.txt b/recipes/tiny-aes-c/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/tiny-aes-c/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tiny-aes-c/all/test_v1_package/conanfile.py b/recipes/tiny-aes-c/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..43f372e78e8c3 --- /dev/null +++ b/recipes/tiny-aes-c/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package_c") + self.run(bin_path, run_environment=True) + bin_path = os.path.join("bin", "test_package_cpp") + self.run(bin_path, run_environment=True) diff --git a/recipes/tiny-bignum-c/all/conanfile.py b/recipes/tiny-bignum-c/all/conanfile.py index 61df4a457246a..af56e48b755d8 100644 --- a/recipes/tiny-bignum-c/all/conanfile.py +++ b/recipes/tiny-bignum-c/all/conanfile.py @@ -3,17 +3,18 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class TinybignumcConan(ConanFile): name = "tiny-bignum-c" description = "Small portable multiple-precision unsigned integer arithmetic in C." license = "Unlicense" - topics = ("tiny-bignum-c", "bignum", "arbitrary-precision", "multi-precision") + topics = ("bignum", "arbitrary-precision", "multi-precision") homepage = "https://github.com/kokke/tiny-bignum-c" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -32,22 +33,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/tiny-bignum-c/all/test_package/conanfile.py b/recipes/tiny-bignum-c/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/tiny-bignum-c/all/test_package/conanfile.py +++ b/recipes/tiny-bignum-c/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/tiny-bignum-c/all/test_v1_package/CMakeLists.txt b/recipes/tiny-bignum-c/all/test_v1_package/CMakeLists.txt index bd8c38a0d57c5..0d20897301b68 100644 --- a/recipes/tiny-bignum-c/all/test_v1_package/CMakeLists.txt +++ b/recipes/tiny-bignum-c/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tiny-bignum-c REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE tiny-bignum-c::tiny-bignum-c) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tiny-regex-c/all/conanfile.py b/recipes/tiny-regex-c/all/conanfile.py index 6863d2e48d759..1d5c381da2516 100644 --- a/recipes/tiny-regex-c/all/conanfile.py +++ b/recipes/tiny-regex-c/all/conanfile.py @@ -3,17 +3,18 @@ from conan.tools.files import copy, get import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class TinyregexcConan(ConanFile): name = "tiny-regex-c" description = "Small and portable Regular Expression (regex) library written in C." license = "Unlicense" - topics = ("tiny-regex-c", "regex") + topics = ("regex",) homepage = "https://github.com/kokke/tiny-regex-c" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,22 +35,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/tiny-regex-c/all/test_package/conanfile.py b/recipes/tiny-regex-c/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/tiny-regex-c/all/test_package/conanfile.py +++ b/recipes/tiny-regex-c/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/tiny-regex-c/all/test_v1_package/CMakeLists.txt b/recipes/tiny-regex-c/all/test_v1_package/CMakeLists.txt index 6d82d1fcc3a91..0d20897301b68 100644 --- a/recipes/tiny-regex-c/all/test_v1_package/CMakeLists.txt +++ b/recipes/tiny-regex-c/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tiny-regex-c REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE tiny-regex-c::tiny-regex-c) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tinycbor/all/conandata.yml b/recipes/tinycbor/all/conandata.yml index 0c8e53e269696..7b0b677552552 100644 --- a/recipes/tinycbor/all/conandata.yml +++ b/recipes/tinycbor/all/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "0.6.0": - patch_file: "patches/0.6.0/001-build-system.patch" - base_path: "source_subfolder" "0.5.3": - patch_file: "patches/0.5.3/001-build-system.patch" - base_path: "source_subfolder" diff --git a/recipes/tinycbor/all/conanfile.py b/recipes/tinycbor/all/conanfile.py index 6dc0adf9a554e..61985ed700c30 100644 --- a/recipes/tinycbor/all/conanfile.py +++ b/recipes/tinycbor/all/conanfile.py @@ -1,28 +1,43 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import is_apple_os +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, chdir, copy, export_conandata_patches, get, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, NMakeToolchain import os -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.55.0" -class tinycborConan(ConanFile): +class TinycborConan(ConanFile): name = "tinycbor" + description = ( + "A small CBOR encoder and decoder library, optimized for very fast " + "operation with very small footprint." + ) license = "MIT" + topics = ("cbor", "encoder", "decoder") homepage = "https://github.com/intel/tinycbor" url = "https://github.com/conan-io/conan-center-index" - description = ("A small CBOR encoder and decoder library, \ - optimized for very fast operation with very small footprint.") + settings = "os", "arch", "compiler", "build_type" - options = {"fPIC": [True, False], "shared": [True, False]} - default_options = {"fPIC": True, "shared": False} - topics = ("CBOR", "encoder", "decoder") - _source_subfolder = "source_subfolder" - _env_build = None - _env_vars = [] + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -30,68 +45,69 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + basic_layout(self, src_folder="src") + + def validate(self): + if self.options.shared and (self.settings.os == "Windows" or is_apple_os(self)): + raise ConanInvalidConfiguration(f"{self.ref} shared not supported on {self.settings.os}") - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.settings.os != "Linux" and self.options.shared: - raise ConanInvalidConfiguration("Shared library only supported on Linux platform") + def build_requirements(self): + if self._settings_build.os == "Windows" and not is_msvc(self): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if not self._env_build: - self._env_build = AutoToolsBuildEnvironment(self) - self._env_vars = self._env_build.vars - self._env_vars['DESTDIR'] = self.package_folder - if self.settings.os == "Windows": - self._env_vars["BUILD_SHARED"] = "0" - self._env_vars["BUILD_STATIC"] = "1" - else: - self._env_vars["BUILD_SHARED"] = "1" if self.options.shared else "0" - self._env_vars["BUILD_STATIC"] = "1" if not self.options.shared else "0" - return self._env_build, self._env_vars - - def _build_nmake(self): - with tools.chdir(self._source_subfolder): - vcvars_command = tools.vcvars_command(self.settings) - self.run("%s && nmake -f Makefile.nmake" % vcvars_command) - - def _build_make(self): - with tools.chdir(self._source_subfolder): - env_build, env_vars = self._configure_autotools() - env_build.make(vars=env_vars) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + else: + tc = AutotoolsToolchain(self) + env = tc.environment() + env.define("BUILD_SHARED", "1" if self.options.shared else "0") + env.define("BUILD_STATIC", "0" if self.options.shared else "1") + tc.generate(env) def build(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - if self.settings.compiler == "Visual Studio": - self._build_nmake() + apply_conandata_patches(self) + if is_msvc(self): + with chdir(self, self.source_folder): + self.run("nmake -f Makefile.nmake") else: - self._build_make() - - def _package_unix(self): - with tools.chdir(self._source_subfolder): - env_build, env_vars = self._configure_autotools() - env_build.install(vars=env_vars) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "bin")) - - def _package_visual(self): - self.copy("tinycbor.lib", src=os.path.join(self._source_subfolder, "lib"), dst="lib") - for header in ["cbor.h", "cborjson.h", "tinycbor-version.h"]: - self.copy(header, src=os.path.join(self._source_subfolder, "src"), dst="include") + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.make() def package(self): - self.copy("LICENSE", src=self._source_subfolder, dst="licenses") - if self.settings.compiler == "Visual Studio": - self._package_visual() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + copy(self, "tinycbor.lib", + src=os.path.join(self.source_folder, "lib"), + dst=os.path.join(self.package_folder, "lib")) + for header in ["cbor.h", "cborjson.h", "tinycbor-version.h"]: + copy(self, header, + src=os.path.join(self.source_folder, "src"), + dst=os.path.join(self.package_folder, "include", "tinycbor")) else: - self._package_unix() + autotools = Autotools(self) + with chdir(self, self.source_folder): + autotools.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "bin")) def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.set_property("pkg_config_name", "tinycbor") + self.cpp_info.libs = ["tinycbor"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] - self.cpp_info.includedirs = ["include", os.path.join("include","tinycbor")] + self.cpp_info.includedirs.append(os.path.join("include", "tinycbor")) diff --git a/recipes/tinycbor/all/test_package/CMakeLists.txt b/recipes/tinycbor/all/test_package/CMakeLists.txt index d4fdee1a8a79c..d44243714d196 100644 --- a/recipes/tinycbor/all/test_package/CMakeLists.txt +++ b/recipes/tinycbor/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(PackageTest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(tinycbor REQUIRED CONFIG) -add_executable(example example.cpp) -target_link_libraries(example ${CONAN_LIBS}) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE tinycbor::tinycbor) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/tinycbor/all/test_package/conanfile.py b/recipes/tinycbor/all/test_package/conanfile.py index fcae7e3c40edd..0a6bc68712d90 100644 --- a/recipes/tinycbor/all/test_package/conanfile.py +++ b/recipes/tinycbor/all/test_package/conanfile.py @@ -1,9 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class apriltagTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "example") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tinycbor/all/test_package/example.cpp b/recipes/tinycbor/all/test_package/test_package.c similarity index 100% rename from recipes/tinycbor/all/test_package/example.cpp rename to recipes/tinycbor/all/test_package/test_package.c diff --git a/recipes/tinycbor/all/test_v1_package/CMakeLists.txt b/recipes/tinycbor/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/tinycbor/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tinycbor/all/test_v1_package/conanfile.py b/recipes/tinycbor/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/tinycbor/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tinyexr/all/conandata.yml b/recipes/tinyexr/all/conandata.yml index 1cf53acb3c810..6fdffb908d2c6 100644 --- a/recipes/tinyexr/all/conandata.yml +++ b/recipes/tinyexr/all/conandata.yml @@ -1,8 +1,17 @@ sources: + "1.0.1": + url: "https://github.com/syoyo/tinyexr/archive/v1.0.1.tar.gz" + sha256: "4dbbd8c7d17597ad557518de5eb923bd02683d26d0de765f9224e8d57d121677" "1.0.0": url: "https://github.com/syoyo/tinyexr/archive/v1.0.0.tar.gz" sha256: "d9d135a835916655057ad58fdabe17f4ae7047a0b15e20e891dab4e563275b68" patches: + "1.0.1": + - patch_file: "patches/1.0.1-0001-fix-SaveEXRNPartImageToMemory.patch" + patch_description: "fix compilation error with use_zfp" + patch_type: "backport" + patch_source: "https://github.com/syoyo/tinyexr/issues/188" "1.0.0": - - patch_file: "patches/0001-use-conan-deps.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.0.0-0001-use-conan-deps.patch" + patch_description: "use conan recipes, fix namespace issue" + patch_type: "conan" diff --git a/recipes/tinyexr/all/conanfile.py b/recipes/tinyexr/all/conanfile.py index b9ab8c37116a5..889c4c311e95f 100644 --- a/recipes/tinyexr/all/conanfile.py +++ b/recipes/tinyexr/all/conanfile.py @@ -1,15 +1,17 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, save +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.52.0" class TinyExrConan(ConanFile): name = "tinyexr" description = "Tiny OpenEXR image loader/saver library" - homepage = "https://github.com/syoyo/tinyexr" - url = "https://github.com/conan-io/conan-center-index" license = "BSD-3-Clause" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/syoyo/tinyexr" topics = ("exr", "header-only") settings = "os", "arch", "compiler", "build_type" @@ -28,54 +30,53 @@ class TinyExrConan(ConanFile): "with_openmp": False, } - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_z == "miniz": - self.requires("miniz/2.2.0") + self.requires("miniz/3.0.1") else: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_zfp: - self.requires("zfp/0.5.5") + self.requires("zfp/1.0.0") def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): if self.options.with_thread and self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "11") + check_min_cppstd(self, "11") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) @property def _extracted_license(self): - content_lines = open(os.path.join(self.source_folder, self._source_subfolder, "tinyexr.h")).readlines() + content_lines = open(os.path.join(self.source_folder, "tinyexr.h")).readlines() license_content = [] for i in range(3, 27): license_content.append(content_lines[i][:-1]) return "\n".join(license_content) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def package(self): - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), self._extracted_license) - self.copy("tinyexr.h", dst="include", src=self._source_subfolder) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extracted_license) + copy( + self, + pattern="tinyexr.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] self.cpp_info.defines.append("TINYEXR_USE_MINIZ={}".format("1" if self.options.with_z == "miniz" else "0")) self.cpp_info.defines.append("TINYEXR_USE_PIZ={}".format("1" if self.options.with_piz else "0")) self.cpp_info.defines.append("TINYEXR_USE_ZFP={}".format("1" if self.options.with_zfp else "0")) diff --git a/recipes/tinyexr/all/patches/0001-use-conan-deps.patch b/recipes/tinyexr/all/patches/1.0.0-0001-use-conan-deps.patch similarity index 100% rename from recipes/tinyexr/all/patches/0001-use-conan-deps.patch rename to recipes/tinyexr/all/patches/1.0.0-0001-use-conan-deps.patch diff --git a/recipes/tinyexr/all/patches/1.0.1-0001-fix-SaveEXRNPartImageToMemory.patch b/recipes/tinyexr/all/patches/1.0.1-0001-fix-SaveEXRNPartImageToMemory.patch new file mode 100644 index 0000000000000..5794b5002ee2d --- /dev/null +++ b/recipes/tinyexr/all/patches/1.0.1-0001-fix-SaveEXRNPartImageToMemory.patch @@ -0,0 +1,13 @@ +diff --git a/tinyexr.h b/tinyexr.h +index 2580ae0..4b44d82 100644 +--- a/tinyexr.h ++++ b/tinyexr.h +@@ -6947,7 +6947,7 @@ static size_t SaveEXRNPartImageToMemory(const EXRImage* exr_images, + return 0; + } + #else +- for (int c = 0; c < exr_header->num_channels; ++c) { ++ for (int c = 0; c < exr_headers[i]->num_channels; ++c) { + if (exr_headers[i]->requested_pixel_types[c] != TINYEXR_PIXELTYPE_FLOAT) { + SetErrorMessage("Pixel type must be FLOAT for ZFP compression", + err); diff --git a/recipes/tinyexr/all/test_package/CMakeLists.txt b/recipes/tinyexr/all/test_package/CMakeLists.txt index 5910bbed9c32f..08dd3dd347374 100644 --- a/recipes/tinyexr/all/test_package/CMakeLists.txt +++ b/recipes/tinyexr/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(tinyexr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} tinyexr::tinyexr) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE tinyexr::tinyexr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tinyexr/all/test_package/conanfile.py b/recipes/tinyexr/all/test_package/conanfile.py index dada0cdf21684..5a5dc0862d479 100644 --- a/recipes/tinyexr/all/test_package/conanfile.py +++ b/recipes/tinyexr/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") img_path = os.path.join(self.source_folder, "test.exr") - self.run("{} {}".format(bin_path, img_path), run_environment=True) + self.run(f"{bin_path} {img_path}", env="conanrun") diff --git a/recipes/tinyexr/all/test_v1_package/CMakeLists.txt b/recipes/tinyexr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/tinyexr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/tinyexr/all/test_v1_package/conanfile.py b/recipes/tinyexr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..bd607d6c6515a --- /dev/null +++ b/recipes/tinyexr/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + img_path = os.path.join(self.source_folder, os.pardir, "test_package", "test.exr") + self.run(f"{bin_path} {img_path}", run_environment=True) diff --git a/recipes/tinyexr/config.yml b/recipes/tinyexr/config.yml index 40341aa3db6cd..af3bb0714e65c 100644 --- a/recipes/tinyexr/config.yml +++ b/recipes/tinyexr/config.yml @@ -1,3 +1,5 @@ versions: + "1.0.1": + folder: all "1.0.0": folder: all diff --git a/recipes/tinygltf/all/conandata.yml b/recipes/tinygltf/all/conandata.yml index 4dccec0d384aa..0e07d04c2de59 100644 --- a/recipes/tinygltf/all/conandata.yml +++ b/recipes/tinygltf/all/conandata.yml @@ -1,10 +1,10 @@ sources: - "2.2.0": - url: "https://github.com/syoyo/tinygltf/archive/v2.2.0.tar.gz" - sha256: "2d6950c76eba11214bf068b2a569d69c84ae35860a42fcde1aa1c8ad143f351d" - "2.4.0": - url: "https://github.com/syoyo/tinygltf/archive/v2.4.0.tar.gz" - sha256: "8c4d9efac544c5471d672dfd52842cb93df45b1a4c8f91e38487db4a0e500d70" "2.5.0": url: "https://github.com/syoyo/tinygltf/archive/v2.5.0.tar.gz" sha256: "5d85bd556b60b1b69527189293cfa4902957d67fabb8582b6532f23a5ef27ec1" + "2.4.0": + url: "https://github.com/syoyo/tinygltf/archive/v2.4.0.tar.gz" + sha256: "8c4d9efac544c5471d672dfd52842cb93df45b1a4c8f91e38487db4a0e500d70" + "2.2.0": + url: "https://github.com/syoyo/tinygltf/archive/v2.2.0.tar.gz" + sha256: "2d6950c76eba11214bf068b2a569d69c84ae35860a42fcde1aa1c8ad143f351d" diff --git a/recipes/tinygltf/all/conanfile.py b/recipes/tinygltf/all/conanfile.py index a85c90f80392a..1d6e2279c2680 100644 --- a/recipes/tinygltf/all/conanfile.py +++ b/recipes/tinygltf/all/conanfile.py @@ -1,16 +1,21 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, replace_in_file +from conan.tools.layout import basic_layout import os -from conans import ConanFile, tools +required_conan_version = ">=1.51.1" + class TinygltfConan(ConanFile): name = "tinygltf" description = "Header only C++11 tiny glTF 2.0 library." license = "MIT" - topics = ("conan", "tinygltf", "gltf") + topics = ("gltf") homepage = "https://github.com/syoyo/tinygltf" url = "https://github.com/conan-io/conan-center-index" - settings = "compiler" - no_copy_source = True + + settings = "os", "arch", "compiler", "build_type" options = { "draco": [True, False], "stb_image": [True, False], @@ -19,44 +24,51 @@ class TinygltfConan(ConanFile): default_options = { "draco": False, "stb_image": True, - "stb_image_write": True + "stb_image_write": True, } - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") - def configure(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + def package_id(self): + self.info.clear() def requirements(self): - self.requires("nlohmann_json/3.9.1") + self.requires("nlohmann_json/3.11.2") if self.options.draco: - self.requires("draco/1.3.6") + self.requires("draco/1.5.5") if self.options.stb_image or self.options.stb_image_write: - self.requires("stb/20200203") + self.requires("stb/cci.20210910") - def package_id(self): - self.info.header_only() + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename(self.name + "-" + self.version, self._source_subfolder) - tools.replace_in_file(os.path.join(self._source_subfolder, "tiny_gltf.h"), + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + replace_in_file(self, os.path.join(self.source_folder, "tiny_gltf.h"), "#include \"json.hpp\"", "#include ") def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("tiny_gltf.h", dst="include", src=os.path.join(self.source_folder, self._source_subfolder)) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "tiny_gltf.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) def package_info(self): - self.cpp_info.names["cmake_find_package"] = "TinyGLTF" - self.cpp_info.names["cmake_find_package_multi"] = "TinyGLTF" + self.cpp_info.set_property("cmake_file_name", "TinyGLTF") + self.cpp_info.set_property("cmake_target_name", "TinyGLTF::TinyGLTF") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self.options.draco: self.cpp_info.defines.append("TINYGLTF_ENABLE_DRACO") if not self.options.stb_image: self.cpp_info.defines.append("TINYGLTF_NO_STB_IMAGE") if not self.options.stb_image_write: self.cpp_info.defines.append("TINYGLTF_NO_STB_IMAGE_WRITE") + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "TinyGLTF" + self.cpp_info.names["cmake_find_package_multi"] = "TinyGLTF" diff --git a/recipes/tinygltf/all/test_package/CMakeLists.txt b/recipes/tinygltf/all/test_package/CMakeLists.txt index 33ae887aa6aea..687cf3cb6de80 100644 --- a/recipes/tinygltf/all/test_package/CMakeLists.txt +++ b/recipes/tinygltf/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(TinyGLTF REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE TinyGLTF::TinyGLTF) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tinygltf/all/test_package/conanfile.py b/recipes/tinygltf/all/test_package/conanfile.py index 606ee08407413..0708ee77c3850 100644 --- a/recipes/tinygltf/all/test_package/conanfile.py +++ b/recipes/tinygltf/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") glb_path = os.path.join(self.source_folder, "box01.glb") - bin_path = os.path.join("bin", "test_package") - self.run("{0} {1}".format(bin_path, glb_path), run_environment=True) + self.run(f"{bin_path} {glb_path}", env="conanrun") diff --git a/recipes/tinygltf/all/test_v1_package/CMakeLists.txt b/recipes/tinygltf/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/tinygltf/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tinygltf/all/test_v1_package/conanfile.py b/recipes/tinygltf/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6d85d0b397c56 --- /dev/null +++ b/recipes/tinygltf/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + glb_path = os.path.join(self.source_folder, os.pardir, "test_package", "box01.glb") + self.run(f"{bin_path} {glb_path}", run_environment=True) diff --git a/recipes/tinygltf/config.yml b/recipes/tinygltf/config.yml index a11de5107db48..a23d2b23eb439 100644 --- a/recipes/tinygltf/config.yml +++ b/recipes/tinygltf/config.yml @@ -1,7 +1,7 @@ versions: - "2.2.0": + "2.5.0": folder: all "2.4.0": folder: all - "2.5.0": + "2.2.0": folder: all diff --git a/recipes/tinyobjloader/all/CMakeLists.txt b/recipes/tinyobjloader/all/CMakeLists.txt deleted file mode 100644 index 881b1cb39250b..0000000000000 --- a/recipes/tinyobjloader/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) - -add_subdirectory(source_subfolder) diff --git a/recipes/tinyobjloader/all/conandata.yml b/recipes/tinyobjloader/all/conandata.yml index 1db573226b501..a7c8b081490fb 100644 --- a/recipes/tinyobjloader/all/conandata.yml +++ b/recipes/tinyobjloader/all/conandata.yml @@ -1,4 +1,26 @@ sources: + "2.0.0-rc10": + url: "https://github.com/tinyobjloader/tinyobjloader/archive/refs/tags/v2.0.0rc10.tar.gz" + sha256: "e1bc2e5547b562d33ca4a90b581717984a70d58113d83208dbc97c82e137b9fe" + "1.0.7": + url: "https://github.com/tinyobjloader/tinyobjloader/archive/refs/tags/v1.0.7.tar.gz" + sha256: "b9d08b675ba54b9cb00ffc99eaba7616d0f7e6f6b8947a7e118474e97d942129" "1.0.6": - url: https://github.com/syoyo/tinyobjloader/archive/v1.0.6.zip - sha256: ba549b59eafcdcd3d6a0ce367c9655affbc8e6f85053ea793a7333fe276879a2 + url: "https://github.com/tinyobjloader/tinyobjloader/archive/refs/tags/v1.0.6.tar.gz" + sha256: "19ee82cd201761954dd833de551edb570e33b320d6027e0d91455faf7cd4c341" +patches: + "2.0.0-rc10": + - patch_file: "patches/2.0.0-rc10-0001-cmake-minimum-required.patch" + patch_description: "CMake: move cmake_minimum_required() before project()" + patch_type: "backport" + patch_source: "https://github.com/tinyobjloader/tinyobjloader/pull/347" + "1.0.7": + - patch_file: "patches/1.0.x-0001-cmake-minimum-required.patch" + patch_description: "CMake: move cmake_minimum_required() before project()" + patch_type: "backport" + patch_source: "https://github.com/tinyobjloader/tinyobjloader/pull/347" + "1.0.6": + - patch_file: "patches/1.0.x-0001-cmake-minimum-required.patch" + patch_description: "CMake: move cmake_minimum_required() before project()" + patch_type: "backport" + patch_source: "https://github.com/tinyobjloader/tinyobjloader/pull/347" diff --git a/recipes/tinyobjloader/all/conanfile.py b/recipes/tinyobjloader/all/conanfile.py index 09b19ed30254e..3370350884707 100644 --- a/recipes/tinyobjloader/all/conanfile.py +++ b/recipes/tinyobjloader/all/conanfile.py @@ -1,8 +1,11 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, get, export_conandata_patches, load, replace_in_file, rmdir, save +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class TinyObjLoaderConan(ConanFile): @@ -11,7 +14,7 @@ class TinyObjLoaderConan(ConanFile): license = "MIT" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/syoyo/tinyobjloader" - topics = ("tinyobjloader", "wavefront", "geometry") + topics = ("loader", "obj", "3d", "wavefront", "geometry") settings = "os", "arch", "build_type", "compiler" options = { @@ -25,17 +28,8 @@ class TinyObjLoaderConan(ConanFile): "double": False, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,33 +37,42 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["TINYOBJLOADER_USE_DOUBLE"] = self.options.double - self._cmake.definitions["TINYOBJLOADER_BUILD_TEST_LOADER"] = False - self._cmake.definitions["TINYOBJLOADER_COMPILATION_SHARED"] = self.options.shared - self._cmake.definitions["TINYOBJLOADER_BUILD_OBJ_STICHER"] = False - self._cmake.definitions["CMAKE_INSTALL_DOCDIR"] = "licenses" - self._cmake.configure(build_dir=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TINYOBJLOADER_USE_DOUBLE"] = self.options.double + tc.variables["TINYOBJLOADER_BUILD_TEST_LOADER"] = False + if Version(self.version) < "1.0.7": + tc.variables["TINYOBJLOADER_COMPILATION_SHARED"] = self.options.shared + tc.variables["TINYOBJLOADER_BUILD_OBJ_STICHER"] = False + tc.variables["CMAKE_INSTALL_DOCDIR"] = "licenses" + if Version(self.version).major < 2: + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() def build(self): - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - cmake = self._configure_cmake() + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "tinyobjloader")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "tinyobjloader")) + self._remove_implementation(os.path.join(self.package_folder, "include", "tiny_obj_loader.h")) # TODO: to remove in conan v2 once cmake_find_package* generators removed cmake_target = "tinyobjloader_double" if self.options.double else "tinyobjloader" @@ -78,32 +81,37 @@ def package(self): {cmake_target: "tinyobjloader::tinyobjloader"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _remove_implementation(self, header_fullpath): + header_content = load(self, header_fullpath) + begin = header_content.find("#ifdef TINYOBJLOADER_IMPLEMENTATION") + implementation = header_content[begin:-1] + replace_in_file(self, header_fullpath, implementation, "") + + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): suffix = "_double" if self.options.double else "" self.cpp_info.set_property("cmake_file_name", "tinyobjloader") - self.cpp_info.set_property("cmake_target_name", "tinyobjloader{}".format(suffix)) - self.cpp_info.set_property("pkg_config_name", "tinyobjloader{}".format(suffix)) - self.cpp_info.libs = ["tinyobjloader{}".format(suffix)] + self.cpp_info.set_property("cmake_target_name", f"tinyobjloader::tinyobjloader{suffix}") + self.cpp_info.set_property("cmake_target_aliases", [f"tinyobjloader{suffix}"]) # old target (before 1.0.7) + self.cpp_info.set_property("pkg_config_name", f"tinyobjloader{suffix}") + self.cpp_info.libs = [f"tinyobjloader{suffix}"] if self.options.double: self.cpp_info.defines.append("TINYOBJLOADER_USE_DOUBLE") # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] - self.cpp_info.names["pkg_config"] = "tinyobjloader{}".format(suffix) diff --git a/recipes/tinyobjloader/all/patches/1.0.x-0001-cmake-minimum-required.patch b/recipes/tinyobjloader/all/patches/1.0.x-0001-cmake-minimum-required.patch new file mode 100644 index 0000000000000..aafa055df46bb --- /dev/null +++ b/recipes/tinyobjloader/all/patches/1.0.x-0001-cmake-minimum-required.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,8 +1,8 @@ + #Tiny Object Loader Cmake configuration file. + #This configures the Cmake system with multiple properties, depending + #on the platform and configuration it is set to build in. ++cmake_minimum_required(VERSION 3.1) + project(tinyobjloader) +-cmake_minimum_required(VERSION 2.8.11) + set(TINYOBJLOADER_SOVERSION 1) + set(TINYOBJLOADER_VERSION 1.0.4) + diff --git a/recipes/tinyobjloader/all/patches/2.0.0-rc10-0001-cmake-minimum-required.patch b/recipes/tinyobjloader/all/patches/2.0.0-rc10-0001-cmake-minimum-required.patch new file mode 100644 index 0000000000000..a2d751763b940 --- /dev/null +++ b/recipes/tinyobjloader/all/patches/2.0.0-rc10-0001-cmake-minimum-required.patch @@ -0,0 +1,12 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,8 +1,8 @@ + #Tiny Object Loader Cmake configuration file. + #This configures the Cmake system with multiple properties, depending + #on the platform and configuration it is set to build in. +-project(tinyobjloader) + cmake_minimum_required(VERSION 3.2) ++project(tinyobjloader) + set(TINYOBJLOADER_SOVERSION 2) + set(TINYOBJLOADER_VERSION 2.0.0-rc.10) + diff --git a/recipes/tinyobjloader/all/test_package/CMakeLists.txt b/recipes/tinyobjloader/all/test_package/CMakeLists.txt index c6aaba9ebe875..05eed698062d7 100644 --- a/recipes/tinyobjloader/all/test_package/CMakeLists.txt +++ b/recipes/tinyobjloader/all/test_package/CMakeLists.txt @@ -1,23 +1,17 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -configure_file(cube.obj cube.obj COPYONLY) -configure_file(cube.mtl cube.mtl COPYONLY) +cmake_minimum_required(VERSION 3.7) +project(test_package LANGUAGES CXX) find_package(tinyobjloader REQUIRED CONFIG) -string(FIND "${CONAN_TINYOBJLOADER_ROOT}" "2." IS_2x) -if ("${IS_2x}" EQUAL "-1") - add_executable(${PROJECT_NAME} test_package_1.cpp) +add_executable(${PROJECT_NAME} test_package.cpp) +if(TARGET tinyobjloader::tinyobjloader_double) + target_link_libraries(${PROJECT_NAME} PRIVATE tinyobjloader::tinyobjloader_double) else() - add_executable(${PROJECT_NAME} test_package_2.cpp) + target_link_libraries(${PROJECT_NAME} PRIVATE tinyobjloader::tinyobjloader) endif() - -if(TARGET tinyobjloader_double) - target_link_libraries(${PROJECT_NAME} tinyobjloader_double) -else() - target_link_libraries(${PROJECT_NAME} tinyobjloader) +if(tinyobjloader_VERSION VERSION_GREATER_EQUAL "1.0.7") + target_compile_definitions(${PROJECT_NAME} PRIVATE TINYOBJLOADER_GE_1_0_7) +endif() +if(tinyobjloader_VERSION VERSION_GREATER_EQUAL "2") + target_compile_definitions(${PROJECT_NAME} PRIVATE TINYOBJLOADER_GE_2) endif() diff --git a/recipes/tinyobjloader/all/test_package/conanfile.py b/recipes/tinyobjloader/all/test_package/conanfile.py index 49a3a66ea5bad..ba7f5d3e170c1 100644 --- a/recipes/tinyobjloader/all/test_package/conanfile.py +++ b/recipes/tinyobjloader/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + obj_path = os.path.join(self.source_folder, "cube.obj") + mtl_dir = os.path.join(self.source_folder, "") + self.run(f"{bin_path} {obj_path} {mtl_dir}", env="conanrun") diff --git a/recipes/tinyobjloader/all/test_package/test_package.cpp b/recipes/tinyobjloader/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..886f96cfb3429 --- /dev/null +++ b/recipes/tinyobjloader/all/test_package/test_package.cpp @@ -0,0 +1,52 @@ +#include + +#include +#include +#include + +int main(int argc, char **argv) +{ + if (argc < 3) { + std::cerr << "Need at least two arguments" << std::endl; + return 1; + } + +#ifdef TINYOBJLOADER_GE_2 + tinyobj::ObjReaderConfig config; + config.mtl_search_path = argv[2]; + + tinyobj::ObjReader reader; + reader.ParseFromFile(argv[1], config); +#else + tinyobj::attrib_t attrib; + std::vector shapes; + std::vector materials; +#ifdef TINYOBJLOADER_GE_1_0_7 + std::string warn; +#endif + std::string err; + bool ret = tinyobj::LoadObj( + &attrib, &shapes, &materials, +#ifdef TINYOBJLOADER_GE_1_0_7 + &warn, +#endif + &err, argv[1], argv[2]); + +#ifdef TINYOBJLOADER_GE_1_0_7 + if (!warn.empty()) { + std::cout << "WARN: " << warn << std::endl; + } +#endif + + if (!err.empty()) { + std::cerr << "ERR: " << err << std::endl; + } + + if (!ret) { + std::cerr << "Failed to load/parse .obj" << std::endl; + return 1; + } +#endif + + return 0; +} diff --git a/recipes/tinyobjloader/all/test_package/test_package_1.cpp b/recipes/tinyobjloader/all/test_package/test_package_1.cpp deleted file mode 100644 index 5f572e6c88eb9..0000000000000 --- a/recipes/tinyobjloader/all/test_package/test_package_1.cpp +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include -#include - -int main (void) -{ - tinyobj::attrib_t attrib; - std::vector shapes; - std::vector materials; - std::string err; - bool ret = tinyobj::LoadObj( - &attrib, &shapes, &materials, &err, "cube.obj"); - - if (!err.empty()) { - std::cerr << "ERR: " << err << std::endl; - } - - if (!ret) { - std::cerr << "Failed to load/parse .obj" << std::endl; - return 1; - } - - return 0; -} diff --git a/recipes/tinyobjloader/all/test_package/test_package_2.cpp b/recipes/tinyobjloader/all/test_package/test_package_2.cpp deleted file mode 100644 index 00b10dbabe209..0000000000000 --- a/recipes/tinyobjloader/all/test_package/test_package_2.cpp +++ /dev/null @@ -1,29 +0,0 @@ -#include -#include -#include - -int main (void) -{ - tinyobj::attrib_t attrib; - std::vector shapes; - std::vector materials; - std::string warn; - std::string err; - bool ret = tinyobj::LoadObj( - &attrib, &shapes, &materials, &warn, &err, "cube.obj"); - - if (!warn.empty()) { - std::cout << "WARN: " << warn << std::endl; - } - - if (!err.empty()) { - std::cerr << "ERR: " << err << std::endl; - } - - if (!ret) { - std::cerr << "Failed to load/parse .obj" << std::endl; - return 1; - } - - return 0; -} diff --git a/recipes/tinyobjloader/all/test_v1_package/CMakeLists.txt b/recipes/tinyobjloader/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/tinyobjloader/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tinyobjloader/all/test_v1_package/conanfile.py b/recipes/tinyobjloader/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..159afa2f8c340 --- /dev/null +++ b/recipes/tinyobjloader/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + res_dir = os.path.join(self.source_folder, os.pardir, "test_package") + obj_path = os.path.join(res_dir, "cube.obj") + mtl_dir = os.path.join(res_dir, "") + self.run(f"{bin_path} {obj_path} {mtl_dir}", run_environment=True) diff --git a/recipes/tinyobjloader/config.yml b/recipes/tinyobjloader/config.yml index c8c4465c97415..a6a9ff8a03a2a 100644 --- a/recipes/tinyobjloader/config.yml +++ b/recipes/tinyobjloader/config.yml @@ -1,3 +1,7 @@ versions: + "2.0.0-rc10": + folder: all + "1.0.7": + folder: all "1.0.6": folder: all diff --git a/recipes/tinyply/all/conanfile.py b/recipes/tinyply/all/conanfile.py index 04d436851cee5..cd8d6bcce424f 100644 --- a/recipes/tinyply/all/conanfile.py +++ b/recipes/tinyply/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.files import collect_libs, get, load, rmdir, save import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class TinyplyConan(ConanFile): @@ -15,6 +15,7 @@ class TinyplyConan(ConanFile): homepage = "https://github.com/ddiakopoulos/tinyply" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -30,19 +31,17 @@ def config_options(self): del self.options.fPIC def configure(self): - if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, 11) def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/tinyply/all/test_package/conanfile.py b/recipes/tinyply/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/tinyply/all/test_package/conanfile.py +++ b/recipes/tinyply/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/tinyply/all/test_v1_package/CMakeLists.txt b/recipes/tinyply/all/test_v1_package/CMakeLists.txt index 54e04ba21f978..0d20897301b68 100644 --- a/recipes/tinyply/all/test_v1_package/CMakeLists.txt +++ b/recipes/tinyply/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tinyply REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE tinyply::tinyply) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tinyply/all/test_v1_package/conanfile.py b/recipes/tinyply/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/tinyply/all/test_v1_package/conanfile.py +++ b/recipes/tinyply/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/tinyspline/all/conandata.yml b/recipes/tinyspline/all/conandata.yml index aa28ae157cc11..0c5a0ad66351c 100644 --- a/recipes/tinyspline/all/conandata.yml +++ b/recipes/tinyspline/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.6.0": + url: "https://github.com/msteinbeck/tinyspline/archive/refs/tags/v0.6.0.tar.gz" + sha256: "3ea31b610dd279266f26fd7ad5b5fca7a20c0bbe05c7c32430ed6aa54d57097a" "0.5.0": url: "https://github.com/msteinbeck/tinyspline/archive/v0.5.0.tar.gz" sha256: "cf7a6de40a5456b6791bc043d978b134c54e0404129a05846b803ccd45db366b" diff --git a/recipes/tinyspline/all/conanfile.py b/recipes/tinyspline/all/conanfile.py index f3ba8f07d5469..2800204293c83 100644 --- a/recipes/tinyspline/all/conanfile.py +++ b/recipes/tinyspline/all/conanfile.py @@ -1,14 +1,13 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir, save +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, rmdir, save from conan.tools.microsoft import is_msvc from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.50.0" - +required_conan_version = ">=1.53.0" class TinysplineConan(ConanFile): name = "tinyspline" @@ -34,8 +33,7 @@ class TinysplineConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -43,20 +41,14 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") if not self.options.cxx: - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def validate(self): if Version(self.version) >= "0.4.0" and self.options.cxx: - if self.info.settings.compiler.cppstd: + if self.settings.compiler.cppstd: check_min_cppstd(self, 11) def layout(self): diff --git a/recipes/tinyspline/all/test_package/CMakeLists.txt b/recipes/tinyspline/all/test_package/CMakeLists.txt index 1d8cb14b6113e..4ff151e0924ad 100644 --- a/recipes/tinyspline/all/test_package/CMakeLists.txt +++ b/recipes/tinyspline/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES C CXX) find_package(tinyspline REQUIRED CONFIG) diff --git a/recipes/tinyspline/all/test_v1_package/CMakeLists.txt b/recipes/tinyspline/all/test_v1_package/CMakeLists.txt index e0c3d724e5360..be00a8c7f57c7 100644 --- a/recipes/tinyspline/all/test_v1_package/CMakeLists.txt +++ b/recipes/tinyspline/all/test_v1_package/CMakeLists.txt @@ -4,20 +4,5 @@ project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tinyspline REQUIRED CONFIG) - -if(tinyspline_VERSION VERSION_GREATER_EQUAL "0.3.0") - add_definitions(-DTINYSPLINE_API_0_3) -endif() - -add_executable(${PROJECT_NAME}_c ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME}_c PRIVATE tinyspline::tinyspline) - -if(TINYSPLINE_CXX) - # FIXME: we should have to call find_package(tinysplinecxx REQUIRED CONFIG) - add_executable(${PROJECT_NAME}_cpp ../test_package/test_package.cpp) - target_link_libraries(${PROJECT_NAME}_cpp PRIVATE tinysplinecxx::tinysplinecxx) - if(tinyspline_VERSION VERSION_GREATER_EQUAL "0.4.0") - target_compile_features(${PROJECT_NAME}_cpp PRIVATE cxx_std_11) - endif() -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/tinyspline/all/test_v1_package/conanfile.py b/recipes/tinyspline/all/test_v1_package/conanfile.py index c0d9c57278fd7..f0e24ab54dc38 100644 --- a/recipes/tinyspline/all/test_v1_package/conanfile.py +++ b/recipes/tinyspline/all/test_v1_package/conanfile.py @@ -1,8 +1,6 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake", "cmake_find_package_multi" diff --git a/recipes/tinyspline/config.yml b/recipes/tinyspline/config.yml index f552ed1dcb956..88f70b2c8fcdf 100644 --- a/recipes/tinyspline/config.yml +++ b/recipes/tinyspline/config.yml @@ -1,4 +1,6 @@ versions: + "0.6.0": + folder: all "0.5.0": folder: all "0.4.0": diff --git a/recipes/tinyxml/all/CMakeLists.txt b/recipes/tinyxml/all/CMakeLists.txt index 513e8c93e1858..c8bf6c2939aa7 100644 --- a/recipes/tinyxml/all/CMakeLists.txt +++ b/recipes/tinyxml/all/CMakeLists.txt @@ -1,35 +1,27 @@ cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() +project(tinyxml LANGUAGES CXX) option(TINYXML_WITH_STL "Compile TinyXML with STL" OFF) -set(SOURCE_SUBFOLDER "source_subfolder") - -if(MSVC AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - set(TINYXML_HDRS - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}/tinystr.h - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}/tinyxml.h) + ${TINYXML_SRC_DIR}/tinystr.h + ${TINYXML_SRC_DIR}/tinyxml.h) set(TINYXML_SRCS - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}/tinystr.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}/tinyxml.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}/tinyxmlerror.cpp - ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}/tinyxmlparser.cpp) + ${TINYXML_SRC_DIR}/tinystr.cpp + ${TINYXML_SRC_DIR}/tinyxml.cpp + ${TINYXML_SRC_DIR}/tinyxmlerror.cpp + ${TINYXML_SRC_DIR}/tinyxmlparser.cpp) -add_library(tinyxml STATIC ${TINYXML_SRCS}) -target_include_directories(tinyxml PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/${SOURCE_SUBFOLDER}) +add_library(tinyxml ${TINYXML_SRCS}) +target_include_directories(tinyxml PUBLIC ${TINYXML_SRC_DIR}) if(TINYXML_WITH_STL) target_compile_definitions(tinyxml PUBLIC TIXML_USE_STL) endif() +include(GNUInstallDirs) install(TARGETS tinyxml - RUNTIME DESTINATION bin - LIBRARY DESTINATION lib - ARCHIVE DESTINATION lib) -install(FILES ${TINYXML_HDRS} DESTINATION include) + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +install(FILES ${TINYXML_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) diff --git a/recipes/tinyxml/all/conanfile.py b/recipes/tinyxml/all/conanfile.py index bd887d9df371d..b6d3aba1021b4 100644 --- a/recipes/tinyxml/all/conanfile.py +++ b/recipes/tinyxml/all/conanfile.py @@ -1,74 +1,86 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import get, save +from conan.tools.microsoft import is_msvc import os -from conans import ConanFile, CMake, tools + +required_conan_version = ">=1.47.0" + class TinyXmlConan(ConanFile): name = "tinyxml" description = "TinyXML is a simple, small, C++ XML parser that can be easily integrated into other programs." license = "Zlib" - topics = ("conan", "tinyxml", "xml", "parser") + topics = ("xml", "parser") homepage = "http://www.grinninglizard.com/tinyxml/" url = "https://github.com/conan-io/conan-center-index" - exports_sources = "CMakeLists.txt" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" options = { + "shared": [True, False], "fPIC": [True, False], "with_stl": [True, False], } default_options = { + "shared": False, "fPIC": True, "with_stl": False, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + exports_sources = "CMakeLists.txt" def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") + + def validate(self): + if is_msvc(self) and self.info.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported by Visual Studio") + def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("tinyxml", self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["TINYXML_WITH_STL"] = self.options.with_stl - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TINYXML_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["TINYXML_WITH_STL"] = self.options.with_stl + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def _extract_license(self): - with open(os.path.join(self._source_subfolder, "tinyxml.h")) as f: + with open(os.path.join(self.source_folder, "tinyxml.h")) as f: content_lines = f.readlines() license_content = [] for i in range(2, 22): license_content.append(content_lines[i][:-1]) - tools.save("LICENSE", "\n".join(license_content)) - + return "\n".join(license_content) def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), self._extract_license()) + cmake = CMake(self) cmake.install() - self._extract_license() - self.copy(pattern="LICENSE", dst="licenses") def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = ["tinyxml"] if self.options.with_stl: self.cpp_info.defines = ["TIXML_USE_STL"] + + # TODO: to remove in conan v2, and do not port these names to CMakeDeps, it was a mistake self.cpp_info.names["cmake_find_package"] = "TinyXML" self.cpp_info.names["cmake_find_package_multi"] = "TinyXML" diff --git a/recipes/tinyxml/all/test_package/CMakeLists.txt b/recipes/tinyxml/all/test_package/CMakeLists.txt index 196188113685c..f35c28e75d81c 100644 --- a/recipes/tinyxml/all/test_package/CMakeLists.txt +++ b/recipes/tinyxml/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(tinyxml REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE tinyxml::tinyxml) diff --git a/recipes/tinyxml/all/test_package/conanfile.py b/recipes/tinyxml/all/test_package/conanfile.py index ea57a464900be..0a6bc68712d90 100644 --- a/recipes/tinyxml/all/test_package/conanfile.py +++ b/recipes/tinyxml/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tinyxml/all/test_v1_package/CMakeLists.txt b/recipes/tinyxml/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..f0821ea56fd5b --- /dev/null +++ b/recipes/tinyxml/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(TinyXML REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE TinyXML::TinyXML) diff --git a/recipes/tinyxml/all/test_v1_package/conanfile.py b/recipes/tinyxml/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/tinyxml/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tinyxml2/all/conanfile.py b/recipes/tinyxml2/all/conanfile.py index 44533d02e4015..2136d8c5a732a 100644 --- a/recipes/tinyxml2/all/conanfile.py +++ b/recipes/tinyxml2/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class Tinyxml2Conan(ConanFile): @@ -16,6 +16,7 @@ class Tinyxml2Conan(ConanFile): homepage = "https://github.com/leethomason/tinyxml2" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -27,8 +28,7 @@ class Tinyxml2Conan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -36,14 +36,13 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -51,9 +50,6 @@ def generate(self): if Version(self.version) < "8.1.0": # Relocatable shared lib on Macos tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" - if Version(self.version) < "9.0.0": - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): diff --git a/recipes/tinyxml2/all/test_package/conanfile.py b/recipes/tinyxml2/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/tinyxml2/all/test_package/conanfile.py +++ b/recipes/tinyxml2/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/tinyxml2/all/test_v1_package/CMakeLists.txt b/recipes/tinyxml2/all/test_v1_package/CMakeLists.txt index 9133a38f51e23..0d20897301b68 100644 --- a/recipes/tinyxml2/all/test_v1_package/CMakeLists.txt +++ b/recipes/tinyxml2/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tinyxml2 REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE tinyxml2::tinyxml2) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tinyxml2/all/test_v1_package/conanfile.py b/recipes/tinyxml2/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/tinyxml2/all/test_v1_package/conanfile.py +++ b/recipes/tinyxml2/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/tmx/all/CMakeLists.txt b/recipes/tmx/all/CMakeLists.txt deleted file mode 100644 index 8315062fd31ee..0000000000000 --- a/recipes/tmx/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper C) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/tmx/all/conanfile.py b/recipes/tmx/all/conanfile.py index d229ad4b32c22..5a3b3214bc42f 100644 --- a/recipes/tmx/all/conanfile.py +++ b/recipes/tmx/all/conanfile.py @@ -1,9 +1,10 @@ -from conans import ConanFile, CMake, tools -import functools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" class TmxConan(ConanFile): @@ -28,58 +29,61 @@ class TmxConan(ConanFile): "with_zstd": False, } - exports_sources = "CMakeLists.txt" - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("libxml2/2.9.13") + self.requires("libxml2/2.9.14") if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.with_zstd: self.requires("zstd/1.5.2") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _patch_sources(self): - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "${CMAKE_BINARY_DIR}", "${CMAKE_CURRENT_BINARY_DIR}") + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["WANT_ZLIB"] = self.options.with_zlib - cmake.definitions["WANT_ZSTD"] = self.options.with_zstd + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WANT_ZLIB"] = self.options.with_zlib + tc.variables["WANT_ZSTD"] = self.options.with_zstd if self.options.with_zstd: - cmake.definitions["ZSTD_PREFER_STATIC"] = not self.options["zstd"].shared - cmake.configure() - return cmake + tc.variables["ZSTD_PREFER_STATIC"] = not self.dependencies["zstd"].options.shared + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self._create_cmake_module_alias_targets( @@ -87,21 +91,20 @@ def package(self): {"tmx": "tmx::tmx"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "tmx") diff --git a/recipes/tmx/all/test_package/CMakeLists.txt b/recipes/tmx/all/test_package/CMakeLists.txt index 8caed204543d3..27410290350a8 100644 --- a/recipes/tmx/all/test_package/CMakeLists.txt +++ b/recipes/tmx/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(tmx REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} tmx) +target_link_libraries(${PROJECT_NAME} PRIVATE tmx) diff --git a/recipes/tmx/all/test_package/conanfile.py b/recipes/tmx/all/test_package/conanfile.py index 2d4b3d3b837ac..da601c15e4dfc 100644 --- a/recipes/tmx/all/test_package/conanfile.py +++ b/recipes/tmx/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") tmx_path = os.path.join(self.source_folder, "externtileset.tmx") - self.run("{} {}".format(bin_path, tmx_path), run_environment=True) + self.run(f"{bin_path} {tmx_path}", env="conanrun") diff --git a/recipes/tmx/all/test_v1_package/CMakeLists.txt b/recipes/tmx/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7b3630d9b9ae2 --- /dev/null +++ b/recipes/tmx/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tmx REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE tmx) diff --git a/recipes/tmx/all/test_v1_package/conanfile.py b/recipes/tmx/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5654af76091cf --- /dev/null +++ b/recipes/tmx/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + tmx_path = os.path.join(self.source_folder, os.pardir, "test_package", "externtileset.tmx") + self.run(f"{bin_path} {tmx_path}", run_environment=True) diff --git a/recipes/tmxlite/all/CMakeLists.txt b/recipes/tmxlite/all/CMakeLists.txt deleted file mode 100644 index f39f80ce857c2..0000000000000 --- a/recipes/tmxlite/all/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -link_libraries(${CONAN_LIBS}) - -add_subdirectory(source_subfolder/tmxlite) diff --git a/recipes/tmxlite/all/conandata.yml b/recipes/tmxlite/all/conandata.yml index 33d0e85a50a95..acb2db05df822 100644 --- a/recipes/tmxlite/all/conandata.yml +++ b/recipes/tmxlite/all/conandata.yml @@ -5,4 +5,4 @@ sources: patches: "1.3.0": - patch_file: "patches/0001-include-external-pugixml.patch" - base_path: "source_subfolder" + - patch_file: "patches/0002-cmake-link-external-miniz-pugixml.patch" diff --git a/recipes/tmxlite/all/conanfile.py b/recipes/tmxlite/all/conanfile.py index 38e769ee77b57..44380126b8654 100644 --- a/recipes/tmxlite/all/conanfile.py +++ b/recipes/tmxlite/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rm, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class TmxliteConan(ConanFile): @@ -17,21 +21,14 @@ class TmxliteConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "rtti": [True, False], } default_options = { "shared": False, "fPIC": True, - "rtti": True, } - exports_sources = ["CMakeLists.txt", "patches/**"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,59 +36,64 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("miniz/2.1.0") - self.requires("pugixml/1.11") + self.requires("miniz/2.2.0") + self.requires("pugixml/1.12.1") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) + if self.info.settings.compiler == "gcc" and Version(self.info.settings.compiler.version) < "5": raise ConanInvalidConfiguration("gcc < 5 not supported") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TMXLITE_STATIC_LIB"] = not self.options.shared + tc.variables["PROJECT_STATIC_RUNTIME"] = False + tc.variables["USE_RTTI"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # unvendor miniz - tools.remove_files_by_mask(os.path.join(self._source_subfolder, "tmxlite", "src"), "miniz*") - tools.replace_in_file(os.path.join(self._source_subfolder, "tmxlite", "src", "CMakeLists.txt"), + rm(self, "miniz*", os.path.join(self.source_folder, "tmxlite", "src")) + replace_in_file(self, os.path.join(self.source_folder, "tmxlite", "src", "CMakeLists.txt"), "${PROJECT_DIR}/miniz.c", "") # unvendor pugixml - tools.rmdir(os.path.join(self._source_subfolder, "tmxlite", "src", "detail")) - tools.replace_in_file(os.path.join(self._source_subfolder, "tmxlite", "src", "CMakeLists.txt"), + rmdir(self, os.path.join(self.source_folder, "tmxlite", "src", "detail")) + replace_in_file(self, os.path.join(self.source_folder, "tmxlite", "src", "CMakeLists.txt"), "${PROJECT_DIR}/detail/pugixml.cpp", "") # Don't inject -O3 in compile flags - tools.replace_in_file(os.path.join(self._source_subfolder, "tmxlite", "CMakeLists.txt"), + replace_in_file(self, os.path.join(self.source_folder, "tmxlite", "CMakeLists.txt"), "-O3", "") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["TMXLITE_STATIC_LIB"] = not self.options.shared - self._cmake.definitions["PROJECT_STATIC_RUNTIME"] = False - self._cmake.definitions["USE_RTTI"] = self.options.rtti - self._cmake.configure() - return self._cmake - def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, "tmxlite")) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if not self.options.shared: self.cpp_info.defines.append("TMXLITE_STATIC") if self.settings.os == "Android": diff --git a/recipes/tmxlite/all/patches/0002-cmake-link-external-miniz-pugixml.patch b/recipes/tmxlite/all/patches/0002-cmake-link-external-miniz-pugixml.patch new file mode 100644 index 0000000000000..f2ca8d92a2ca9 --- /dev/null +++ b/recipes/tmxlite/all/patches/0002-cmake-link-external-miniz-pugixml.patch @@ -0,0 +1,12 @@ +--- a/tmxlite/CMakeLists.txt ++++ b/tmxlite/CMakeLists.txt +@@ -70,6 +70,9 @@ else() + add_library(${PROJECT_NAME} SHARED ${PROJECT_SRC}) + endif() + endif() ++find_package(miniz REQUIRED CONFIG) ++find_package(pugixml REQUIRED CONFIG) ++target_link_libraries(${PROJECT_NAME} PRIVATE miniz::miniz pugixml::pugixml) + + target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include) + diff --git a/recipes/tmxlite/all/test_package/CMakeLists.txt b/recipes/tmxlite/all/test_package/CMakeLists.txt index 3300ff7750277..564eece99799e 100644 --- a/recipes/tmxlite/all/test_package/CMakeLists.txt +++ b/recipes/tmxlite/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(tmxlite REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE tmxlite::tmxlite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/tmxlite/all/test_package/conanfile.py b/recipes/tmxlite/all/test_package/conanfile.py index 5216332f39f5c..0a6bc68712d90 100644 --- a/recipes/tmxlite/all/test_package/conanfile.py +++ b/recipes/tmxlite/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tmxlite/all/test_v1_package/CMakeLists.txt b/recipes/tmxlite/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..ca4979c8e62d9 --- /dev/null +++ b/recipes/tmxlite/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tmxlite REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tmxlite::tmxlite) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/tmxlite/all/test_v1_package/conanfile.py b/recipes/tmxlite/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/tmxlite/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tng/all/CMakeLists.txt b/recipes/tng/all/CMakeLists.txt deleted file mode 100644 index 61f3d3b039e2b..0000000000000 --- a/recipes/tng/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/tng/all/conandata.yml b/recipes/tng/all/conandata.yml index 8ab8469db669a..80d49b1a4f2fd 100644 --- a/recipes/tng/all/conandata.yml +++ b/recipes/tng/all/conandata.yml @@ -4,7 +4,6 @@ sources: sha256: "7010eb68e586efe23dd553b306ac1a4eea6a4b9028b32a3408744d9e4ae4205e" patches: "1.8.2": - - base_path: "source_subfolder" - patch_file: "patches/0001-BuildTNG.patch" - - base_path: "source_subfolder" - patch_file: "patches/0002-CMakeLists.patch" + - patch_file: "patches/0001-cmake-install.patch" + patch_description: "Install dll in bin folder" + patch_type: "portability" diff --git a/recipes/tng/all/conanfile.py b/recipes/tng/all/conanfile.py index e0050a7f1d40f..4a409ba3da2e2 100644 --- a/recipes/tng/all/conanfile.py +++ b/recipes/tng/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class tngConan(ConanFile): @@ -22,21 +24,8 @@ class tngConan(ConanFile): "fPIC": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,38 +33,42 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TNG_BUILD_OWN_ZLIB"] = False + tc.variables["TNG_BUILD_EXAMPLES"] = False + tc.variables["TNG_BUILD_TEST"] = False + # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["TNG_BUILD_OWN_ZLIB"] = False - self._cmake.definitions["TNG_BUILD_EXAMPLES"] = False - self._cmake.definitions["TNG_BUILD_TEST"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake - def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "tng_io") diff --git a/recipes/tng/all/patches/0001-BuildTNG.patch b/recipes/tng/all/patches/0001-BuildTNG.patch deleted file mode 100644 index 01fbe6401a53b..0000000000000 --- a/recipes/tng/all/patches/0001-BuildTNG.patch +++ /dev/null @@ -1,14 +0,0 @@ ---- BuildTNG.cmake -+++ BuildTNG.cmake -@@ -1,9 +1,9 @@ - set(TNG_ROOT_SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}) --file(RELATIVE_PATH TNG_ROOT_BINARY_DIR ${CMAKE_SOURCE_DIR} ${TNG_ROOT_SOURCE_DIR}) -+file(RELATIVE_PATH TNG_ROOT_BINARY_DIR ${PROJECT_SOURCE_DIR} ${TNG_ROOT_SOURCE_DIR}) - if ("${TNG_ROOT_BINARY_DIR}" MATCHES "^\.\.") - set(TNG_ROOT_BINARY_DIR tng) - endif() --set(TNG_ROOT_BINARY_DIR ${CMAKE_BINARY_DIR}/${TNG_ROOT_BINARY_DIR}) -+set(TNG_ROOT_BINARY_DIR ${PROJECT_BINARY_DIR}/${TNG_ROOT_BINARY_DIR}) - - set(TNG_MAJOR_VERSION "1") - set(TNG_MINOR_VERSION "8") diff --git a/recipes/tng/all/patches/0002-CMakeLists.patch b/recipes/tng/all/patches/0001-cmake-install.patch similarity index 100% rename from recipes/tng/all/patches/0002-CMakeLists.patch rename to recipes/tng/all/patches/0001-cmake-install.patch diff --git a/recipes/tng/all/test_package/CMakeLists.txt b/recipes/tng/all/test_package/CMakeLists.txt index 4bc787c04a2ad..30ebfd5167712 100644 --- a/recipes/tng/all/test_package/CMakeLists.txt +++ b/recipes/tng/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(tng_io REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} tng_io::tng_io) +target_link_libraries(${PROJECT_NAME} PRIVATE tng_io::tng_io) diff --git a/recipes/tng/all/test_package/conanfile.py b/recipes/tng/all/test_package/conanfile.py index e34c3f44da6b6..0a6bc68712d90 100644 --- a/recipes/tng/all/test_package/conanfile.py +++ b/recipes/tng/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run( os.path.join("bin", "test_package"), run_environment=True ) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tng/all/test_v1_package/CMakeLists.txt b/recipes/tng/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/tng/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tng/all/test_v1_package/conanfile.py b/recipes/tng/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..2fc9de9b0d3fc --- /dev/null +++ b/recipes/tng/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path , run_environment=True ) diff --git a/recipes/toml11/all/conanfile.py b/recipes/toml11/all/conanfile.py index f0c21a1ef54b4..72284ac7310c2 100644 --- a/recipes/toml11/all/conanfile.py +++ b/recipes/toml11/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class Toml11Conan(ConanFile): @@ -14,27 +17,31 @@ class Toml11Conan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("toml.hpp", dst=os.path.join("include", "toml11"), src=self._source_subfolder) - self.copy("*.hpp", dst=os.path.join("include", "toml11", "toml"), src=os.path.join(self._source_subfolder, "toml")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "toml.hpp", src=self.source_folder, dst=os.path.join(self.package_folder, "include", "toml11")) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "toml"), dst=os.path.join(self.package_folder, "include", "toml11", "toml")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "toml11") self.cpp_info.set_property("cmake_target_name", "toml11::toml11") + self.cpp_info.bindirs = [] self.cpp_info.includedirs.append(os.path.join("include", "toml11")) + self.cpp_info.libdirs = [] diff --git a/recipes/toml11/all/test_package/CMakeLists.txt b/recipes/toml11/all/test_package/CMakeLists.txt index 7c5e612554e37..6fbc21219d46f 100644 --- a/recipes/toml11/all/test_package/CMakeLists.txt +++ b/recipes/toml11/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(toml11 REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} toml11::toml11) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE toml11::toml11) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/toml11/all/test_package/conanfile.py b/recipes/toml11/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/toml11/all/test_package/conanfile.py +++ b/recipes/toml11/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/toml11/all/test_v1_package/CMakeLists.txt b/recipes/toml11/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/toml11/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/toml11/all/test_v1_package/conanfile.py b/recipes/toml11/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/toml11/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tomlplusplus/all/conandata.yml b/recipes/tomlplusplus/all/conandata.yml index 18f7762d37f25..a459f949569ec 100644 --- a/recipes/tomlplusplus/all/conandata.yml +++ b/recipes/tomlplusplus/all/conandata.yml @@ -1,34 +1,19 @@ sources: - "1.2.3": - url: "https://github.com/marzer/tomlplusplus/archive/v1.2.3.tar.gz" - sha256: "ead2900cc1123e3c6eb61267396aa6358597366598d199ff62cae4fe22f1cca7" - "1.3.0": - url: "https://github.com/marzer/tomlplusplus/archive/v1.3.0.tar.gz" - sha256: "b857813083c7e8937cd559887c994f1df44bcb779d830af369dae46f379c3f57" - "1.3.3": - url: "https://github.com/marzer/tomlplusplus/archive/v1.3.3.tar.gz" - sha256: "1553cdecbfceb890da77895356ed471792e29362af701fe1f08b55c8a42ec746" - "2.0.0": - url: "https://github.com/marzer/tomlplusplus/archive/v2.0.0.tar.gz" - sha256: "01cf0f659bd70493dbe51c161feb598ffed68d67bcc7f2984aec4b544c368f91" - "2.1.0": - url: "https://github.com/marzer/tomlplusplus/archive/v2.1.0.tar.gz" - sha256: "c741c95ddc01ee7993c1a426db5cb4d2e35e16f3f240012efdebfdf55712ba38" - "2.2.0": - url: "https://github.com/marzer/tomlplusplus/archive/v2.2.0.tar.gz" - sha256: "b7d5878cb324582086435d81ec4498b7bc05feab8a89c51f9cf9a8bf7e07b704" - "2.3.0": - url: "https://github.com/marzer/tomlplusplus/archive/v2.3.0.tar.gz" - sha256: "2b832ef30fb4a1f5bcea831b126febd173f28381f7f37112865dd1bdc5e991e0" - "2.4.0": - url: "https://github.com/marzer/tomlplusplus/archive/v2.4.0.tar.gz" - sha256: "d7c28b25374241afa08c60183717d3025aa8abffe1030928dc7e1d2143852da1" - "2.5.0": - url: "https://github.com/marzer/tomlplusplus/archive/v2.5.0.tar.gz" - sha256: "2e246ee126cfb7bd68edd7285d5bb5c8c5296121ce809306ee71cfd6127c76a6" - "3.0.1": - url: "https://github.com/marzer/tomlplusplus/archive/v3.0.1.tar.gz" - sha256: "e05b2814b891e223d7546aa2408d6cba0628164a84ac453205c7743cb667b9cf" + "3.3.0": + url: "https://github.com/marzer/tomlplusplus/archive/v3.3.0.tar.gz" + sha256: "fc1a5eb410f3c67e90e5ad1264a1386d020067cfb01b633cc8c0441789aa6cf2" + "3.2.0": + url: "https://github.com/marzer/tomlplusplus/archive/v3.2.0.tar.gz" + sha256: "aeba776441df4ac32e4d4db9d835532db3f90fd530a28b74e4751a2915a55565" "3.1.0": url: "https://github.com/marzer/tomlplusplus/archive/v3.1.0.tar.gz" sha256: "dae72714fc356ca1b019298d9e6275cc41ba95546ae722ccdb6795e92f47762e" + "3.0.1": + url: "https://github.com/marzer/tomlplusplus/archive/v3.0.1.tar.gz" + sha256: "e05b2814b891e223d7546aa2408d6cba0628164a84ac453205c7743cb667b9cf" + "2.5.0": + url: "https://github.com/marzer/tomlplusplus/archive/v2.5.0.tar.gz" + sha256: "2e246ee126cfb7bd68edd7285d5bb5c8c5296121ce809306ee71cfd6127c76a6" + "1.3.3": + url: "https://github.com/marzer/tomlplusplus/archive/v1.3.3.tar.gz" + sha256: "1553cdecbfceb890da77895356ed471792e29362af701fe1f08b55c8a42ec746" diff --git a/recipes/tomlplusplus/all/conanfile.py b/recipes/tomlplusplus/all/conanfile.py index 79bdb14d5851c..44f523638d713 100644 --- a/recipes/tomlplusplus/all/conanfile.py +++ b/recipes/tomlplusplus/all/conanfile.py @@ -1,27 +1,25 @@ -from conans import ConanFile, tools +from conan import ConanFile from conan.tools.microsoft import is_msvc -from conans.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.files import get, copy +from conan.errors import ConanInvalidConfiguration import os -required_conan_version = ">=1.33.0" + +required_conan_version = ">=1.51.3" + class TomlPlusPlusConan(ConanFile): name = "tomlplusplus" description = "Header-only TOML config file parser and serializer for modern C++." - topics = ("tomlformoderncpp", "toml++", "tomlplusplus", - "toml", "json", "header-only", "single-header") + topics = ("tomlformoderncpp", "tomlcpp", "toml", "json", "header-only") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/marzer/tomlplusplus" license = "MIT" - settings = ("compiler",) - options = {"multiple_headers": [True, False, "deprecated"]} - default_options = {"multiple_headers": "deprecated"} + settings = ("compiler", "arch", "os", "build_type") no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _minimum_cpp_standard(self): return 17 @@ -29,45 +27,48 @@ def _minimum_cpp_standard(self): @property def _minimum_compilers_version(self): return { - "Visual Studio": "16" if tools.Version(self.version) < "2.2.0" or tools.Version(self.version) >= "3.0.0" else "15", + "Visual Studio": "16" if Version(self.version) < "2.2.0" or Version(self.version) >= "3.0.0" else "15", + "msvc": "192" if Version(self.version) < "2.2.0" or Version(self.version) >= "3.0.0" else "191", "gcc": "7", "clang": "5", "apple-clang": "10", } def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): - if self.options.multiple_headers != "deprecated": - self.output.warn("The {} option 'multiple_headers' has been deprecated. Both formats are in the same package.") - - if self.settings.get_safe("compiler.cppstd"): - tools.check_min_cppstd(self, self._minimum_cpp_standard) - min_version = self._minimum_compilers_version.get( - str(self.settings.compiler)) + if self.info.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + min_version = self._minimum_compilers_version.get(str(self.settings.compiler)) + compiler = f"{self.settings.compiler} {self.settings.compiler.version}" if not min_version: - self.output.warn("{} recipe lacks information about the {} compiler support.".format( - self.name, self.settings.compiler)) + self.output.warn(f"{self.ref} recipe lacks information about the {self.settings.compiler} compiler support.") else: - if tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration("{} requires c++17 support. The current compiler {} {} does not support it.".format( - self.name, self.settings.compiler, self.settings.compiler.version)) + if Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration(f"{self.ref} requires c++{self._minimum_cpp_standard} support." + " The current compiler {compiler} does not support it.") - if self.settings.compiler == "apple-clang" and tools.Version(self.version) < "2.3.0": - raise ConanInvalidConfiguration("The current compiler {} {} is supported in version >= 2.3.0".format( - self.settings.compiler, self.settings.compiler.version)) + if self.settings.compiler == "apple-clang" and Version(self.version) < "2.3.0": + raise ConanInvalidConfiguration(f"The compiler {compiler} is supported in version >= 2.3.0") - if is_msvc(self) and tools.Version(self.version) == "2.1.0": - raise ConanInvalidConfiguration("The current compiler {} {} is unable to build version 2.1.0".format( - self.settings.compiler, self.settings.compiler.version)) + if is_msvc(self) and Version(self.version) == "2.1.0": + raise ConanInvalidConfiguration(f"The current compiler {compiler} is unable to build version 2.1.0") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h**", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy(pattern="*.inl", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy(pattern="toml.hpp", dst="include", src=self._source_subfolder) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="*.h**", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + copy(self, pattern="*.inl", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) + copy(self, pattern="toml.hpp", dst=os.path.join(self.package_folder, "include"), src=self.source_folder) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.frameworkdirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + + self.cpp_info.set_property("cmake_file_name", "tomlplusplus") + self.cpp_info.set_property("cmake_target_name", "tomlplusplus::tomlplusplus") diff --git a/recipes/tomlplusplus/all/test_package/CMakeLists.txt b/recipes/tomlplusplus/all/test_package/CMakeLists.txt index 8ae698cd63713..dfea477614e59 100644 --- a/recipes/tomlplusplus/all/test_package/CMakeLists.txt +++ b/recipes/tomlplusplus/all/test_package/CMakeLists.txt @@ -1,17 +1,14 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(tomlplusplus REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} tomlplusplus::tomlplusplus) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE tomlplusplus::tomlplusplus) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) if(NOT DEFINED TOMLPP_BUILD_SINGLE_ONLY) add_executable(${PROJECT_NAME}_multi test_package_multi.cpp) - target_link_libraries(${PROJECT_NAME}_multi tomlplusplus::tomlplusplus) - set_property(TARGET ${PROJECT_NAME}_multi PROPERTY CXX_STANDARD 17) + target_link_libraries(${PROJECT_NAME}_multi PRIVATE tomlplusplus::tomlplusplus) + target_compile_features(${PROJECT_NAME}_multi PRIVATE cxx_std_17) endif() diff --git a/recipes/tomlplusplus/all/test_package/conanfile.py b/recipes/tomlplusplus/all/test_package/conanfile.py index 8f87945239e5b..db279683bd8cc 100644 --- a/recipes/tomlplusplus/all/test_package/conanfile.py +++ b/recipes/tomlplusplus/all/test_package/conanfile.py @@ -1,26 +1,36 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +from conan.tools.scm import Version import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) - if tools.Version(self.deps_cpp_info["tomlplusplus"].version) < "1.3.0": + if Version(self.deps_cpp_info["tomlplusplus"].version) < "1.3.0": self.single_header_only = True - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "8": + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "8": self.single_header_only = True - if hasattr(self, "single_header_only"): - cmake.definitions["TOMLPP_BUILD_SINGLE_ONLY"] = True - cmake.configure() + variables = {"TOMLPP_BUILD_SINGLE_ONLY": True} if hasattr(self, "single_header_only") else None + cmake.configure(variables=variables) cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + conf_path = os.path.join(self.recipe_folder, "configuration.toml") + self.run(f"{bin_path} {conf_path}", env="conanrun") if not hasattr(self, "single_header_only"): - bin_path_multi = os.path.join("bin", "test_package_multi") - self.run(bin_path_multi, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package_multi") + self.run(f"{bin_path} {conf_path}", env="conanrun") diff --git a/recipes/tomlplusplus/all/test_package/test_package.cpp b/recipes/tomlplusplus/all/test_package/test_package.cpp index 77de87f488b35..d50b3c6469741 100644 --- a/recipes/tomlplusplus/all/test_package/test_package.cpp +++ b/recipes/tomlplusplus/all/test_package/test_package.cpp @@ -5,8 +5,8 @@ using namespace std::string_view_literals; -int main() { - auto config = toml::parse_file( "../../configuration.toml" ); +int main(int argc, char* argv[]) { + auto config = toml::parse_file(argv[1]); // get key-value pairs std::string_view library_name = config["library"]["name"].value_or(""sv); diff --git a/recipes/tomlplusplus/all/test_package/test_package_multi.cpp b/recipes/tomlplusplus/all/test_package/test_package_multi.cpp index 42a9220443b6e..df195938cfdee 100644 --- a/recipes/tomlplusplus/all/test_package/test_package_multi.cpp +++ b/recipes/tomlplusplus/all/test_package/test_package_multi.cpp @@ -5,8 +5,8 @@ using namespace std::string_view_literals; -int main() { - auto config = toml::parse_file( "../../configuration.toml" ); +int main(int argc, char* argv[]) { + auto config = toml::parse_file(argv[1]); // get key-value pairs std::string_view library_name = config["library"]["name"].value_or(""sv); diff --git a/recipes/tomlplusplus/all/test_v1_package/CMakeLists.txt b/recipes/tomlplusplus/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..a6b6b2e67ed13 --- /dev/null +++ b/recipes/tomlplusplus/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) + diff --git a/recipes/tomlplusplus/all/test_v1_package/conanfile.py b/recipes/tomlplusplus/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..aba957cc3efa9 --- /dev/null +++ b/recipes/tomlplusplus/all/test_v1_package/conanfile.py @@ -0,0 +1,29 @@ +from conans import ConanFile, CMake +from conan.tools.scm import Version +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + if Version(self.deps_cpp_info["tomlplusplus"].version) < "1.3.0": + self.single_header_only = True + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "8": + self.single_header_only = True + if hasattr(self, "single_header_only"): + cmake.definitions["TOMLPP_BUILD_SINGLE_ONLY"] = True + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + conf_path = os.path.join(self.recipe_folder, "..", "test_package", "configuration.toml") + self.run(f"{bin_path} {conf_path}", run_environment=True) + if not hasattr(self, "single_header_only"): + bin_path = os.path.join("bin", "test_package_multi") + self.run(f"{bin_path} {conf_path}", run_environment=True) diff --git a/recipes/tomlplusplus/config.yml b/recipes/tomlplusplus/config.yml index 954a0985e0476..4cd7ca8687e68 100644 --- a/recipes/tomlplusplus/config.yml +++ b/recipes/tomlplusplus/config.yml @@ -1,23 +1,13 @@ versions: - "1.2.3": + "3.3.0": folder: all - "1.3.0": + "3.2.0": folder: all - "1.3.3": - folder: all - "2.0.0": - folder: all - "2.1.0": - folder: all - "2.2.0": - folder: all - "2.3.0": + "3.1.0": folder: all - "2.4.0": + "3.0.1": folder: all "2.5.0": folder: all - "3.0.1": - folder: all - "3.1.0": + "1.3.3": folder: all diff --git a/recipes/tracy/all/CMakeLists.txt b/recipes/tracy/all/CMakeLists.txt deleted file mode 100644 index 06981958954c6..0000000000000 --- a/recipes/tracy/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.10) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/tracy/all/conandata.yml b/recipes/tracy/all/conandata.yml index 1c5bd3d35cfef..266a1ecb7f6b1 100644 --- a/recipes/tracy/all/conandata.yml +++ b/recipes/tracy/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.9": + url: "https://github.com/wolfpld/tracy/archive/refs/tags/v0.9.tar.gz" + sha256: "93a91544e3d88f3bc4c405bad3dbc916ba951cdaadd5fcec1139af6fa56e6bfc" "0.8.2.1": url: "https://github.com/wolfpld/tracy/archive/v0.8.2.1.tar.gz" sha256: "97f478579efa1f5ce4c8619014a20327010fea122c21248701fe2bbb46ec1c1f" diff --git a/recipes/tracy/all/conanfile.py b/recipes/tracy/all/conanfile.py index dff83d16fd052..bdb852b534295 100644 --- a/recipes/tracy/all/conanfile.py +++ b/recipes/tracy/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class TracyConan(ConanFile): @@ -11,21 +14,27 @@ class TracyConan(ConanFile): homepage = "https://github.com/wolfpld/tracy" url = "https://github.com/conan-io/conan-center-index" license = ["BSD-3-Clause"] - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" # Existing CMake tracy options with default value _tracy_options = { "enable": ([True, False], True), + "on_demand": ([True, False], False), "callstack": ([True, False], False), + "no_callstack": ([True, False], False), + "no_callstack_inlines": ([True, False], False), "only_localhost": ([True, False], False), "no_broadcast": ([True, False], False), + "only_ipv": ([True, False], False), "no_code_transfer": ([True, False], False), "no_context_switch": ([True, False], False), "no_exit": ([True, False], False), - "no_frame_image": ([True, False], False), "no_sampling": ([True, False], False), "no_verify": ([True, False], False), "no_vsync_capture": ([True, False], False), + "no_frame_image": ([True, False], False), + "no_system_tracing": ([True, False], False), + "delayed_init": ([True, False], False), } options = { "shared": [True, False], @@ -38,58 +47,72 @@ class TracyConan(ConanFile): **{k: v[1] for k, v in _tracy_options.items()}, } - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + def layout(self): + cmake_layout(self, src_folder="src") - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + def generate(self): + tc = CMakeToolchain(self) # Set all tracy options in the correct form # For example, TRACY_NO_EXIT for opt in self._tracy_options.keys(): switch = getattr(self.options, opt) - opt = 'TRACY_' + opt.upper() - self._cmake.definitions[opt] = switch - - self._cmake.configure() - return self._cmake + opt = f"TRACY_{opt.upper()}" + tc.variables[opt] = switch + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", - src=self._source_subfolder) - self._cmake.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "LICENSE", src=self.source_folder, + dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): - self.cpp_info.libs = ["TracyClient"] + self.cpp_info.set_property("cmake_file_name", "Tracy") + self.cpp_info.set_property("cmake_target_name", "Tracy::TracyClient") + # TODO: back to global scope in conan v2 + self.cpp_info.components["tracyclient"].libs = ["TracyClient"] + if self.options.shared: + self.cpp_info.components["tracyclient"].defines.append( + "TRACY_IMPORTS") if self.settings.os in ["Linux", "FreeBSD"]: - self.cpp_info.system_libs.append("pthread") + self.cpp_info.components["tracyclient"].system_libs.append( + "pthread") if self.settings.os == "Linux": - self.cpp_info.system_libs.append("dl") + self.cpp_info.components["tracyclient"].system_libs.append("dl") + + # Tracy CMake adds options set to ON as public + for opt in self._tracy_options.keys(): + switch = getattr(self.options, opt) + opt = f"TRACY_{opt.upper()}" + if switch: + self.cpp_info.components["tracyclient"].defines.append(opt) + + # TODO: to remove in conan v2 + self.cpp_info.names["cmake_find_package"] = "Tracy" + self.cpp_info.names["cmake_find_package_multi"] = "Tracy" + self.cpp_info.components["tracyclient"].names["cmake_find_package"] = "TracyClient" + self.cpp_info.components["tracyclient"].names["cmake_find_package_multi"] = "TracyClient" + self.cpp_info.components["tracyclient"].set_property( + "cmake_target_name", "Tracy::TracyClient") diff --git a/recipes/tracy/all/test_package/CMakeLists.txt b/recipes/tracy/all/test_package/CMakeLists.txt index bdbbc29794d6a..a21a716d47b2b 100644 --- a/recipes/tracy/all/test_package/CMakeLists.txt +++ b/recipes/tracy/all/test_package/CMakeLists.txt @@ -1,10 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(Tracy REQUIRED CONFIG) -find_package(tracy REQUIRED) - -add_executable(test_package example.cpp) -target_link_libraries(test_package tracy::tracy) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Tracy::TracyClient) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +if(Tracy_VERSION VERSION_GREATER_EQUAL "0.9") + target_compile_definitions(${PROJECT_NAME} PRIVATE TRACY_GE_0_9) +endif() diff --git a/recipes/tracy/all/test_package/conanfile.py b/recipes/tracy/all/test_package/conanfile.py index 1bf1c7e26255d..3a8c6c5442b33 100644 --- a/recipes/tracy/all/test_package/conanfile.py +++ b/recipes/tracy/all/test_package/conanfile.py @@ -1,9 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout import os + class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if not cross_building(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tracy/all/test_package/example.cpp b/recipes/tracy/all/test_package/example.cpp deleted file mode 100644 index 3baf0806049f9..0000000000000 --- a/recipes/tracy/all/test_package/example.cpp +++ /dev/null @@ -1,7 +0,0 @@ -#include - -int main(int argc, char **argv) { - ZoneScopedN("main") - - return 0; -} diff --git a/recipes/tracy/all/test_package/test_package.cpp b/recipes/tracy/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..3063aab0b6e28 --- /dev/null +++ b/recipes/tracy/all/test_package/test_package.cpp @@ -0,0 +1,11 @@ +#ifdef TRACY_GE_0_9 +#include +#else +#include +#endif + +int main(int argc, char **argv) { + ZoneScopedN("main"); + + return 0; +} diff --git a/recipes/tracy/all/test_v1_package/CMakeLists.txt b/recipes/tracy/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/tracy/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/tracy/all/test_v1_package/conanfile.py b/recipes/tracy/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/tracy/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tracy/config.yml b/recipes/tracy/config.yml index bb4757863ed10..77aaa018b1794 100644 --- a/recipes/tracy/config.yml +++ b/recipes/tracy/config.yml @@ -1,4 +1,6 @@ versions: + "0.9": + folder: all "0.8.2.1": folder: all "0.8.1": diff --git a/recipes/trantor/all/CMakeLists.txt b/recipes/trantor/all/CMakeLists.txt deleted file mode 100644 index b71c882d9d33f..0000000000000 --- a/recipes/trantor/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory(source_subfolder) diff --git a/recipes/trantor/all/conandata.yml b/recipes/trantor/all/conandata.yml index 455bbc430bc18..1da6086070fb7 100644 --- a/recipes/trantor/all/conandata.yml +++ b/recipes/trantor/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.5.10": + url: "https://github.com/an-tao/trantor/archive/v1.5.10.tar.gz" + sha256: "2d47775b3091a1a103bea46f5da017dc03c39883f8d717cf6ba24bdcdf01a15d" + "1.5.8": + url: "https://github.com/an-tao/trantor/archive/v1.5.8.tar.gz" + sha256: "705ec0176681be5c99fcc7af37416ece9d65ff4d907bca764cb11471b104fbf8" + "1.5.7": + url: "https://github.com/an-tao/trantor/archive/v1.5.7.tar.gz" + sha256: "42576563afbf1e58c7d68f758cf3fca4d193496d4e3f82c80069d8389a7839d5" "1.5.6": url: "https://github.com/an-tao/trantor/archive/v1.5.6.tar.gz" sha256: "827aca30e120244a8ede9d07446481328d9a3869228f01fc4978b19301d66e65" diff --git a/recipes/trantor/all/conanfile.py b/recipes/trantor/all/conanfile.py index 431f2f2574231..ceac8f815ba35 100644 --- a/recipes/trantor/all/conanfile.py +++ b/recipes/trantor/all/conanfile.py @@ -1,19 +1,22 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import os -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc, msvc_runtime_flag +from conan.tools.files import get, copy, rmdir, replace_in_file +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -required_conan_version = ">=1.43.0" +import os +required_conan_version = ">=1.53.0" class TrantorConan(ConanFile): name = "trantor" description = "a non-blocking I/O tcp network lib based on c++14/17" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/an-tao/trantor" topics = ("tcp-server", "asynchronous-programming", "non-blocking-io") license = "BSD-3-Clause" - homepage = "https://github.com/an-tao/trantor" - url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], @@ -26,22 +29,16 @@ class TrantorConan(ConanFile): "with_c_ares": True, } - exports_sources = ["CMakeLists.txt"] - generators = "cmake", "cmake_find_package" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + def _minimum_cpp_standard(self): + return 14 @property def _compilers_minimum_version(self): return { "gcc": "5", "Visual Studio": "15.0", + "msvc": "191", "clang": "5", "apple-clang": "10", } @@ -52,59 +49,66 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") if self.options.with_c_ares: - self.requires("c-ares/1.18.1") + self.requires("c-ares/1.19.0") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, "14") + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration("trantor requires C++14, which your compiler does not support.") + if Version(self.info.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") else: - self.output.warn("trantor requires C++14. Your compiler is unknown. Assuming it supports C++14.") + self.output.warn(f"{self.ref} requires C++{self._minimum_cpp_standard}. Your compiler is unknown. Assuming it supports C++{self._minimum_cpp_standard}.") - # TODO: Compilation succeeds, but execution of test_package fails on Visual Studio 16 MDd - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) == "16" and \ - self.options.shared == True and self.settings.compiler.runtime == "MDd": - raise ConanInvalidConfiguration("trantor does not support the MDd runtime on Visual Studio 16.") + # TODO: Compilation succeeds, but execution of test_package fails on Visual Studio with MDd + if is_msvc(self) and self.options.shared and "MDd" in msvc_runtime_flag(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support the MDd runtime on Visual Studio.") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if Version(self.version) < "1.5.6": + tc.variables["BUILD_TRANTOR_SHARED"] = self.options.shared + else: + # Trantor's CMakeLists.txt has BUILD_SHARED_LIBS option. + tc.variables["BUILD_SHARED_LIBS"] = self.options.shared + tc.variables["BUILD_C-ARES"] = self.options.with_c_ares + tc.generate() + + tc = CMakeDeps(self) + tc.generate() def _patch_sources(self): - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") # fix c-ares imported target - tools.replace_in_file(cmakelists, "c-ares_lib", "c-ares::cares") + replace_in_file(self, cmakelists, "c-ares_lib", "c-ares::cares") # Cleanup rpath in shared lib - tools.replace_in_file(cmakelists, "set(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}\")", "") - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["BUILD_TRANTOR_SHARED"] = self.options.shared - cmake.definitions["BUILD_C-ARES"] = self.options.with_c_ares - cmake.configure(build_folder=self._build_subfolder) - - return cmake + replace_in_file(self, cmakelists, "set(CMAKE_INSTALL_RPATH \"${CMAKE_INSTALL_PREFIX}/${INSTALL_LIB_DIR}\")", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Trantor") @@ -115,6 +119,7 @@ def package_info(self): self.cpp_info.system_libs.append("ws2_32") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") + self.cpp_info.system_libs.append("m") # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "Trantor" diff --git a/recipes/trantor/all/test_package/CMakeLists.txt b/recipes/trantor/all/test_package/CMakeLists.txt index 55d9d825736a1..96e466512e5b2 100644 --- a/recipes/trantor/all/test_package/CMakeLists.txt +++ b/recipes/trantor/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(Trantor CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Trantor::Trantor) +target_link_libraries(${PROJECT_NAME} PRIVATE Trantor::Trantor) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/trantor/all/test_package/conanfile.py b/recipes/trantor/all/test_package/conanfile.py index 27c426e38df11..a9fbb7f543162 100644 --- a/recipes/trantor/all/test_package/conanfile.py +++ b/recipes/trantor/all/test_package/conanfile.py @@ -1,9 +1,18 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -11,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/trantor/all/test_v1_package/CMakeLists.txt b/recipes/trantor/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..bc541ea90b512 --- /dev/null +++ b/recipes/trantor/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/trantor/all/test_v1_package/conanfile.py b/recipes/trantor/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/trantor/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/trantor/config.yml b/recipes/trantor/config.yml index 20f69b756a9a7..0056a4f6c8a1d 100644 --- a/recipes/trantor/config.yml +++ b/recipes/trantor/config.yml @@ -1,4 +1,10 @@ versions: + "1.5.10": + folder: "all" + "1.5.8": + folder: "all" + "1.5.7": + folder: "all" "1.5.6": folder: "all" "1.5.5": diff --git a/recipes/trompeloeil/all/conandata.yml b/recipes/trompeloeil/all/conandata.yml index 6e066732fc58c..bb27ac3c59d8a 100644 --- a/recipes/trompeloeil/all/conandata.yml +++ b/recipes/trompeloeil/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "43": + url: "https://github.com/rollbear/trompeloeil/archive/v43.tar.gz" + sha256: "86a0afa2e97347202a0a883ab43da78c1d4bfff0d6cb93205cfc433d0d9eb9eb" "42": url: "https://github.com/rollbear/trompeloeil/archive/v42.tar.gz" sha256: "96f3b518eeb609216f8f5ba5cf9314181d1d340ebbf25a73ee63a482a669cc4c" diff --git a/recipes/trompeloeil/all/conanfile.py b/recipes/trompeloeil/all/conanfile.py index 9bcce64548e1d..c2548bfe997b8 100644 --- a/recipes/trompeloeil/all/conanfile.py +++ b/recipes/trompeloeil/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" + class TrompeloeilConan(ConanFile): name = "trompeloeil" @@ -10,22 +14,33 @@ class TrompeloeilConan(ConanFile): homepage = "https://github.com/rollbear/trompeloeil" url = "https://github.com/conan-io/conan-center-index" license = "BSL-1.0" - settings = "os", "compiler", "build_type", "arch" - + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 14) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern="LICENSE*.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.hpp", dst="include", src=include_folder) + copy(self, "LICENSE*.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "trompeloeil") + self.cpp_info.set_property("cmake_target_name", "trompeloeil::trompeloeil") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/trompeloeil/all/test_package/CMakeLists.txt b/recipes/trompeloeil/all/test_package/CMakeLists.txt index 9188e664fcbab..ecb1ebf14da1c 100644 --- a/recipes/trompeloeil/all/test_package/CMakeLists.txt +++ b/recipes/trompeloeil/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(trompeloeil REQUIRED) -add_executable(test_package example.cpp) -target_link_libraries(test_package trompeloeil::trompeloeil) -set_property(TARGET test_package PROPERTY CXX_STANDARD 14) +add_executable(test_package test_package.cpp) +target_link_libraries(test_package PRIVATE trompeloeil::trompeloeil) +target_compile_features(test_package PRIVATE cxx_std_14) diff --git a/recipes/trompeloeil/all/test_package/conanfile.py b/recipes/trompeloeil/all/test_package/conanfile.py index 3da371b660e0a..0a6bc68712d90 100644 --- a/recipes/trompeloeil/all/test_package/conanfile.py +++ b/recipes/trompeloeil/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/trompeloeil/all/test_package/example.cpp b/recipes/trompeloeil/all/test_package/test_package.cpp similarity index 100% rename from recipes/trompeloeil/all/test_package/example.cpp rename to recipes/trompeloeil/all/test_package/test_package.cpp diff --git a/recipes/trompeloeil/all/test_v1_package/CMakeLists.txt b/recipes/trompeloeil/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..328f7742d99d6 --- /dev/null +++ b/recipes/trompeloeil/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(trompeloeil REQUIRED) + +add_executable(test_package ../test_package/test_package.cpp) +target_link_libraries(test_package PRIVATE trompeloeil::trompeloeil) +target_compile_features(test_package PRIVATE cxx_std_14) diff --git a/recipes/trompeloeil/all/test_v1_package/conanfile.py b/recipes/trompeloeil/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/trompeloeil/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/trompeloeil/config.yml b/recipes/trompeloeil/config.yml index b9d0c4e351e68..26645b05ba8da 100644 --- a/recipes/trompeloeil/config.yml +++ b/recipes/trompeloeil/config.yml @@ -1,4 +1,6 @@ versions: + "43": + folder: all "42": folder: all "41": diff --git a/recipes/tscns/all/conandata.yml b/recipes/tscns/all/conandata.yml new file mode 100644 index 0000000000000..953de47361755 --- /dev/null +++ b/recipes/tscns/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + # upstream don't create tag for releases + "2.0": + url: "https://github.com/MengRao/tscns/archive/40240b92fc9431710005faccb422d3dbdcb324dd.tar.gz" + sha256: "5564f9984e7984a68b767ed44acc70ba605300511bcd7673aa46c207e907263d" + +patches: + "2.0": + - patch_file: "patches/0001-include-thread.patch" + patch_description: "include thread header (this patch is already applied upstream)" + patch_type: "backport" + patch_source: "https://github.com/MengRao/tscns/commit/3d9179de9af88358eef66d9f03c8e2126d35296a" + - patch_file: "patches/0002-support-older-compiler.patch" + patch_description: "support older compiler by fix initializer" + patch_type: "backport" diff --git a/recipes/tscns/all/conanfile.py b/recipes/tscns/all/conanfile.py new file mode 100644 index 0000000000000..f9a1b573dbe33 --- /dev/null +++ b/recipes/tscns/all/conanfile.py @@ -0,0 +1,56 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.layout import basic_layout + +import os + +required_conan_version = ">=1.52.0" + +class TscnsConan(ConanFile): + name = "tscns" + description = "A low overhead nanosecond clock based on x86 TSC" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/MengRao/tscns/" + topics = ("timestamp", "x86_64", "header-only") + settings = "os", "arch", "compiler", "build_type" + + @property + def _min_cppstd(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.arch != "x86_64": + raise ConanInvalidConfiguration(f"{self.ref} supports x86_64 only.") + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def build(self): + apply_conandata_patches(self) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="tscns.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/tscns/all/patches/0001-include-thread.patch b/recipes/tscns/all/patches/0001-include-thread.patch new file mode 100644 index 0000000000000..5a125217b7fa0 --- /dev/null +++ b/recipes/tscns/all/patches/0001-include-thread.patch @@ -0,0 +1,12 @@ +diff --git a/tscns.h b/tscns.h +index e66153d..a7c9a73 100644 +--- a/tscns.h ++++ b/tscns.h +@@ -25,6 +25,7 @@ SOFTWARE. + #pragma once + #include + #include ++#include + + #ifdef _MSC_VER + #include diff --git a/recipes/tscns/all/patches/0002-support-older-compiler.patch b/recipes/tscns/all/patches/0002-support-older-compiler.patch new file mode 100644 index 0000000000000..078437e591d8f --- /dev/null +++ b/recipes/tscns/all/patches/0002-support-older-compiler.patch @@ -0,0 +1,13 @@ +diff --git a/tscns.h b/tscns.h +index e66153d..a7c9a73 100644 +--- a/tscns.h ++++ b/tscns.h +@@ -139,7 +139,7 @@ public: + param_seq.store(++seq, std::memory_order_release); + } + +- alignas(64) std::atomic param_seq = 0; ++ alignas(64) std::atomic param_seq{0}; + double ns_per_tsc = 1.0; + int64_t ns_offset = 0; + int64_t calibate_interval_ns; diff --git a/recipes/tscns/all/test_package/CMakeLists.txt b/recipes/tscns/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..46909114bb657 --- /dev/null +++ b/recipes/tscns/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(tscns REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tscns::tscns) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tscns/all/test_package/conanfile.py b/recipes/tscns/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/tscns/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tscns/all/test_package/test_package.cpp b/recipes/tscns/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..2383256ac42ac --- /dev/null +++ b/recipes/tscns/all/test_package/test_package.cpp @@ -0,0 +1,23 @@ +#include + +#include "tscns.h" + +int main() { + TSCNS tn; + tn.init(); + + std::cout << tn.getTscGhz() << std::endl; + + uint64_t count = (tn.rdns() % 100u) + 1; + + uint64_t tsc1 = tn.rdtsc(); + int total = 0; + while (count-- > 0) { + total += count; + } + uint64_t tsc2 = tn.rdtsc(); + + std::cout << (tn.tsc2ns(tsc2) - tn.tsc2ns(tsc1)) << " ns" << std::endl; + + return 0; +} diff --git a/recipes/tscns/all/test_v1_package/CMakeLists.txt b/recipes/tscns/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..eebfbab4ba7b5 --- /dev/null +++ b/recipes/tscns/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tscns REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tscns::tscns) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tscns/all/test_v1_package/conanfile.py b/recipes/tscns/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/tscns/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tscns/config.yml b/recipes/tscns/config.yml new file mode 100644 index 0000000000000..eab700ad534a3 --- /dev/null +++ b/recipes/tscns/config.yml @@ -0,0 +1,3 @@ +versions: + "2.0": + folder: all diff --git a/recipes/tsil/all/CMakeLists.txt b/recipes/tsil/all/CMakeLists.txt index 5d70658b6ac75..2c6adc0080dcc 100644 --- a/recipes/tsil/all/CMakeLists.txt +++ b/recipes/tsil/all/CMakeLists.txt @@ -1,73 +1,73 @@ cmake_minimum_required(VERSION 3.4) -project(TSIL C) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(SOURCE_DIR source_subfolder) +project(TSIL LANGUAGES C) add_library(tsil - ${SOURCE_DIR}/initialize.c - ${SOURCE_DIR}/evaluate.c - ${SOURCE_DIR}/fevaluate.c - ${SOURCE_DIR}/generic.c - ${SOURCE_DIR}/rk6.c - ${SOURCE_DIR}/rk5.c - ${SOURCE_DIR}/functions.c - ${SOURCE_DIR}/dilog.c - ${SOURCE_DIR}/trilog.c - ${SOURCE_DIR}/dBds.c - ${SOURCE_DIR}/dSds.c - ${SOURCE_DIR}/dTds.c - ${SOURCE_DIR}/dUds.c - ${SOURCE_DIR}/dsMds.c - ${SOURCE_DIR}/initB.c - ${SOURCE_DIR}/initS.c - ${SOURCE_DIR}/initT.c - ${SOURCE_DIR}/initU.c - ${SOURCE_DIR}/initV.c - ${SOURCE_DIR}/initM.c - ${SOURCE_DIR}/special.c - ${SOURCE_DIR}/analyticAB.c - ${SOURCE_DIR}/analyticI.c - ${SOURCE_DIR}/analyticS.c - ${SOURCE_DIR}/analyticT.c - ${SOURCE_DIR}/analyticTbar.c - ${SOURCE_DIR}/analyticU.c - ${SOURCE_DIR}/analyticV.c - ${SOURCE_DIR}/analyticM.c - ${SOURCE_DIR}/setTbar.c - ${SOURCE_DIR}/setV.c - ${SOURCE_DIR}/setbold.c - ) + ${TSIL_SRC_DIR}/initialize.c + ${TSIL_SRC_DIR}/evaluate.c + ${TSIL_SRC_DIR}/fevaluate.c + ${TSIL_SRC_DIR}/generic.c + ${TSIL_SRC_DIR}/rk6.c + ${TSIL_SRC_DIR}/rk5.c + ${TSIL_SRC_DIR}/functions.c + ${TSIL_SRC_DIR}/dilog.c + ${TSIL_SRC_DIR}/trilog.c + ${TSIL_SRC_DIR}/dBds.c + ${TSIL_SRC_DIR}/dSds.c + ${TSIL_SRC_DIR}/dTds.c + ${TSIL_SRC_DIR}/dUds.c + ${TSIL_SRC_DIR}/dsMds.c + ${TSIL_SRC_DIR}/initB.c + ${TSIL_SRC_DIR}/initS.c + ${TSIL_SRC_DIR}/initT.c + ${TSIL_SRC_DIR}/initU.c + ${TSIL_SRC_DIR}/initV.c + ${TSIL_SRC_DIR}/initM.c + ${TSIL_SRC_DIR}/special.c + ${TSIL_SRC_DIR}/analyticAB.c + ${TSIL_SRC_DIR}/analyticI.c + ${TSIL_SRC_DIR}/analyticS.c + ${TSIL_SRC_DIR}/analyticT.c + ${TSIL_SRC_DIR}/analyticTbar.c + ${TSIL_SRC_DIR}/analyticU.c + ${TSIL_SRC_DIR}/analyticV.c + ${TSIL_SRC_DIR}/analyticM.c + ${TSIL_SRC_DIR}/setTbar.c + ${TSIL_SRC_DIR}/setV.c + ${TSIL_SRC_DIR}/setbold.c +) -add_executable(tsil.x ${SOURCE_DIR}/basecalc.c) -target_link_libraries(tsil.x tsil m) -set_target_properties(tsil.x PROPERTIES OUTPUT_NAME "tsil") +find_library(LIBM NAMES m) +target_link_libraries(tsil PRIVATE $<$:${LIBM}>) -set(size long CACHE STRING "set floating point data size") -set_property(CACHE size PROPERTY STRINGS long double) +set(TSIL_SIZE long CACHE STRING "set floating point data size") +set_property(CACHE TSIL_SIZE PROPERTY STRINGS long double) -if(size STREQUAL "double") +if(TSIL_SIZE STREQUAL "double") target_compile_definitions(tsil PUBLIC TSIL_SIZE_DOUBLE) -elseif(size STREQUAL "long") +elseif(TSIL_SIZE STREQUAL "long") target_compile_definitions(tsil PUBLIC TSIL_SIZE_LONG) else() message(FATAL_ERROR "You must set size to either double or long") endif() -message(STATUS "Using size: ${size}") +message(STATUS "Using size: ${TSIL_SIZE}") install( FILES - "${SOURCE_DIR}/tsil.h" - "${SOURCE_DIR}/tsil_cpp.h" + "${TSIL_SRC_DIR}/tsil.h" + "${TSIL_SRC_DIR}/tsil_cpp.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) install( - TARGETS tsil tsil.x + TARGETS tsil ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) + +add_executable(tsil.x ${TSIL_SRC_DIR}/basecalc.c) +target_link_libraries(tsil.x PRIVATE tsil) +set_target_properties(tsil.x PROPERTIES OUTPUT_NAME "tsil" RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}/bin") + +install(TARGETS tsil.x DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/recipes/tsil/all/conanfile.py b/recipes/tsil/all/conanfile.py index 3596a1b741488..81d982b72282a 100644 --- a/recipes/tsil/all/conanfile.py +++ b/recipes/tsil/all/conanfile.py @@ -1,8 +1,11 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +from conan.tools.microsoft import is_msvc import os -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class TsilConan(ConanFile): @@ -11,29 +14,21 @@ class TsilConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.niu.edu/spmartin/TSIL/" description = "Two-loop Self-energy Integral Library" - topics = ("conan", "high-energy", "physics", "hep", "two-loop", "integrals") - settings = "os", "compiler", "build_type", "arch" + topics = ("high-energy", "physics", "hep", "two-loop", "integrals") + + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], - "size": ["long", "double"] + "size": ["long", "double"], } default_options = { "shared": False, "fPIC": True, - "size": "long" + "size": "long", } - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property - def _build_subfolder(self): - return "build_subfolder" + exports_sources = "CMakeLists.txt" @property def _tsil_size(self): @@ -45,34 +40,44 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.settings.compiler == "Visual Studio": - raise ConanInvalidConfiguration("TSIL does not support {}".format(self.settings.compiler)) + if is_msvc(self): + raise ConanInvalidConfiguration(f"TSIL does not support {self.settings.compiler}") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["size"] = self.options.size - self._cmake.definitions["CMAKE_MACOSX_BUNDLE"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["TSIL_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.variables["TSIL_SIZE"] = self.options.size + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy(pattern="LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): @@ -81,6 +86,7 @@ def package_info(self): if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("m") + # TODO: to remove in conan v2 bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/tsil/all/test_package/CMakeLists.txt b/recipes/tsil/all/test_package/CMakeLists.txt index 546c16acea82b..48214718fc55d 100644 --- a/recipes/tsil/all/test_package/CMakeLists.txt +++ b/recipes/tsil/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(PackageTest C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(tsil REQUIRED CONFIG) add_executable(test_package test_package.c) -target_link_libraries(test_package CONAN_PKG::tsil) +target_link_libraries(test_package PRIVATE tsil::tsil) diff --git a/recipes/tsil/all/test_package/conanfile.py b/recipes/tsil/all/test_package/conanfile.py index 23559dca88d0c..0a6bc68712d90 100644 --- a/recipes/tsil/all/test_package/conanfile.py +++ b/recipes/tsil/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" -class TsilTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = ["cmake"] + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tsil/all/test_v1_package/CMakeLists.txt b/recipes/tsil/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..141659813702c --- /dev/null +++ b/recipes/tsil/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tsil REQUIRED CONFIG) + +add_executable(test_package ../test_package/test_package.c) +target_link_libraries(test_package PRIVATE tsil::tsil) diff --git a/recipes/tsil/all/test_v1_package/conanfile.py b/recipes/tsil/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/tsil/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/tsl-array-hash/all/conanfile.py b/recipes/tsl-array-hash/all/conanfile.py index cc15f0c529ecd..8c6297fe62672 100644 --- a/recipes/tsl-array-hash/all/conanfile.py +++ b/recipes/tsl-array-hash/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class TslArrayHashConan(ConanFile): @@ -14,24 +17,33 @@ class TslArrayHashConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "tsl-array-hash") self.cpp_info.set_property("cmake_target_name", "tsl::array_hash") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "tsl-array-hash" @@ -41,3 +53,6 @@ def package_info(self): self.cpp_info.components["array_hash"].names["cmake_find_package"] = "array_hash" self.cpp_info.components["array_hash"].names["cmake_find_package_multi"] = "array_hash" self.cpp_info.components["array_hash"].set_property("cmake_target_name", "tsl::array_hash") + self.cpp_info.components["array_hash"].bindirs = [] + self.cpp_info.components["array_hash"].libdirs = [] + self.cpp_info.components["array_hash"].resdirs = [] diff --git a/recipes/tsl-array-hash/all/test_package/CMakeLists.txt b/recipes/tsl-array-hash/all/test_package/CMakeLists.txt index 9618f6b9a037e..813f6130cae26 100644 --- a/recipes/tsl-array-hash/all/test_package/CMakeLists.txt +++ b/recipes/tsl-array-hash/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(tsl-array-hash REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} tsl::array_hash) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE tsl::array_hash) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tsl-array-hash/all/test_package/conanfile.py b/recipes/tsl-array-hash/all/test_package/conanfile.py index 1e9df9e32dfbd..0a6bc68712d90 100644 --- a/recipes/tsl-array-hash/all/test_package/conanfile.py +++ b/recipes/tsl-array-hash/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - test_package = os.path.join("bin", "test_package") - self.run(test_package, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tsl-array-hash/all/test_v1_package/CMakeLists.txt b/recipes/tsl-array-hash/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..15d716d7a9505 --- /dev/null +++ b/recipes/tsl-array-hash/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tsl-array-hash REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tsl::array_hash) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tsl-array-hash/all/test_v1_package/conanfile.py b/recipes/tsl-array-hash/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1e9df9e32dfbd --- /dev/null +++ b/recipes/tsl-array-hash/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + test_package = os.path.join("bin", "test_package") + self.run(test_package, run_environment=True) diff --git a/recipes/tsl-hat-trie/all/conanfile.py b/recipes/tsl-hat-trie/all/conanfile.py index 5e966dafd748d..fbce5d32f1f2b 100644 --- a/recipes/tsl-hat-trie/all/conanfile.py +++ b/recipes/tsl-hat-trie/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class TslHatTrieConan(ConanFile): @@ -14,32 +17,38 @@ class TslHatTrieConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): self.requires("tsl-array-hash/0.7.1") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def build(self): - tools.rmdir(os.path.join(self._source_subfolder, "include", "tsl", "array-hash")) - tools.replace_in_file(os.path.join(self._source_subfolder, "include", "tsl", "htrie_hash.h"), + rmdir(self, os.path.join(self.source_folder, "include", "tsl", "array-hash")) + replace_in_file(self, os.path.join(self.source_folder, "include", "tsl", "htrie_hash.h"), '#include "array-hash/', '#include "tsl/') def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "tsl-hat-trie") self.cpp_info.set_property("cmake_target_name", "tsl::hat_trie") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "tsl-hat-trie" @@ -50,3 +59,6 @@ def package_info(self): self.cpp_info.components["hat_trie"].names["cmake_find_package_multi"] = "hat_trie" self.cpp_info.components["hat_trie"].requires = ["tsl-array-hash::array_hash"] self.cpp_info.components["hat_trie"].set_property("cmake_target_name", "tsl::hat_trie") + self.cpp_info.components["hat_trie"].bindirs = [] + self.cpp_info.components["hat_trie"].libdirs = [] + self.cpp_info.components["hat_trie"].resdirs = [] diff --git a/recipes/tsl-hat-trie/all/test_package/CMakeLists.txt b/recipes/tsl-hat-trie/all/test_package/CMakeLists.txt index 29a9a3272ad00..c212bc7cbc125 100644 --- a/recipes/tsl-hat-trie/all/test_package/CMakeLists.txt +++ b/recipes/tsl-hat-trie/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(tsl-hat-trie REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} tsl::hat_trie) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE tsl::hat_trie) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tsl-hat-trie/all/test_package/conanfile.py b/recipes/tsl-hat-trie/all/test_package/conanfile.py index 1e9df9e32dfbd..0a6bc68712d90 100644 --- a/recipes/tsl-hat-trie/all/test_package/conanfile.py +++ b/recipes/tsl-hat-trie/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - test_package = os.path.join("bin", "test_package") - self.run(test_package, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tsl-hat-trie/all/test_v1_package/CMakeLists.txt b/recipes/tsl-hat-trie/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..6a1b5a8c7df69 --- /dev/null +++ b/recipes/tsl-hat-trie/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tsl-hat-trie REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tsl::hat_trie) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tsl-hat-trie/all/test_v1_package/conanfile.py b/recipes/tsl-hat-trie/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1e9df9e32dfbd --- /dev/null +++ b/recipes/tsl-hat-trie/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + test_package = os.path.join("bin", "test_package") + self.run(test_package, run_environment=True) diff --git a/recipes/tsl-hopscotch-map/all/conanfile.py b/recipes/tsl-hopscotch-map/all/conanfile.py index bd7f158542108..6772f3c321bc9 100644 --- a/recipes/tsl-hopscotch-map/all/conanfile.py +++ b/recipes/tsl-hopscotch-map/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class TslHopscotchMapConan(ConanFile): @@ -14,24 +17,33 @@ class TslHopscotchMapConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "tsl-hopscotch-map") self.cpp_info.set_property("cmake_target_name", "tsl::hopscotch_map") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "tsl-hopscotch-map" @@ -41,3 +53,6 @@ def package_info(self): self.cpp_info.components["hopscotch_map"].names["cmake_find_package"] = "hopscotch_map" self.cpp_info.components["hopscotch_map"].names["cmake_find_package_multi"] = "hopscotch_map" self.cpp_info.components["hopscotch_map"].set_property("cmake_target_name", "tsl::hopscotch_map") + self.cpp_info.components["hopscotch_map"].bindirs = [] + self.cpp_info.components["hopscotch_map"].libdirs = [] + self.cpp_info.components["hopscotch_map"].resdirs = [] diff --git a/recipes/tsl-hopscotch-map/all/test_package/CMakeLists.txt b/recipes/tsl-hopscotch-map/all/test_package/CMakeLists.txt index b8b116d1cdf2f..de096ee6a84f9 100644 --- a/recipes/tsl-hopscotch-map/all/test_package/CMakeLists.txt +++ b/recipes/tsl-hopscotch-map/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(tsl-hopscotch-map REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} tsl::hopscotch_map) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE tsl::hopscotch_map) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tsl-hopscotch-map/all/test_package/conanfile.py b/recipes/tsl-hopscotch-map/all/test_package/conanfile.py index 1e9df9e32dfbd..0a6bc68712d90 100644 --- a/recipes/tsl-hopscotch-map/all/test_package/conanfile.py +++ b/recipes/tsl-hopscotch-map/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - test_package = os.path.join("bin", "test_package") - self.run(test_package, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tsl-hopscotch-map/all/test_v1_package/CMakeLists.txt b/recipes/tsl-hopscotch-map/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..d71994382aff0 --- /dev/null +++ b/recipes/tsl-hopscotch-map/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tsl-hopscotch-map REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tsl::hopscotch_map) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tsl-hopscotch-map/all/test_v1_package/conanfile.py b/recipes/tsl-hopscotch-map/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1e9df9e32dfbd --- /dev/null +++ b/recipes/tsl-hopscotch-map/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + test_package = os.path.join("bin", "test_package") + self.run(test_package, run_environment=True) diff --git a/recipes/tsl-ordered-map/all/conandata.yml b/recipes/tsl-ordered-map/all/conandata.yml index 85051743065cc..50a0714a45e06 100644 --- a/recipes/tsl-ordered-map/all/conandata.yml +++ b/recipes/tsl-ordered-map/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.1.0": + url: "https://github.com/Tessil/ordered-map/archive/v1.1.0.tar.gz" + sha256: "d6070502351646d68f2bbe6078c0da361bc1db733ee8a392e33cfb8b31183e28" "1.0.0": url: "https://github.com/Tessil/ordered-map/archive/v1.0.0.tar.gz" sha256: "49cd436b8bdacb01d5f4afd7aab0c0d6fa57433dfc29d65f08a5f1ed1e2af26b" diff --git a/recipes/tsl-ordered-map/all/conanfile.py b/recipes/tsl-ordered-map/all/conanfile.py index 88eb33e09a29c..d13b78edda147 100644 --- a/recipes/tsl-ordered-map/all/conanfile.py +++ b/recipes/tsl-ordered-map/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class TslOrderedMapConan(ConanFile): @@ -14,24 +17,33 @@ class TslOrderedMapConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "tsl-ordered-map") self.cpp_info.set_property("cmake_target_name", "tsl::ordered_map") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "tsl-ordered-map" @@ -41,3 +53,6 @@ def package_info(self): self.cpp_info.components["ordered_map"].names["cmake_find_package"] = "ordered_map" self.cpp_info.components["ordered_map"].names["cmake_find_package_multi"] = "ordered_map" self.cpp_info.components["ordered_map"].set_property("cmake_target_name", "tsl::ordered_map") + self.cpp_info.components["ordered_map"].bindirs = [] + self.cpp_info.components["ordered_map"].libdirs = [] + self.cpp_info.components["ordered_map"].resdirs = [] diff --git a/recipes/tsl-ordered-map/all/test_package/CMakeLists.txt b/recipes/tsl-ordered-map/all/test_package/CMakeLists.txt index 4683f6913dedf..cf4b3a228306b 100644 --- a/recipes/tsl-ordered-map/all/test_package/CMakeLists.txt +++ b/recipes/tsl-ordered-map/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(tsl-ordered-map REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} tsl::ordered_map) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE tsl::ordered_map) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tsl-ordered-map/all/test_package/conanfile.py b/recipes/tsl-ordered-map/all/test_package/conanfile.py index 1e9df9e32dfbd..0a6bc68712d90 100644 --- a/recipes/tsl-ordered-map/all/test_package/conanfile.py +++ b/recipes/tsl-ordered-map/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - test_package = os.path.join("bin", "test_package") - self.run(test_package, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt b/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/tsl-ordered-map/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/tsl-ordered-map/all/test_v1_package/conanfile.py b/recipes/tsl-ordered-map/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1e9df9e32dfbd --- /dev/null +++ b/recipes/tsl-ordered-map/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + test_package = os.path.join("bin", "test_package") + self.run(test_package, run_environment=True) diff --git a/recipes/tsl-ordered-map/config.yml b/recipes/tsl-ordered-map/config.yml index 40341aa3db6cd..73c245662b08d 100644 --- a/recipes/tsl-ordered-map/config.yml +++ b/recipes/tsl-ordered-map/config.yml @@ -1,3 +1,5 @@ versions: + "1.1.0": + folder: all "1.0.0": folder: all diff --git a/recipes/tsl-robin-map/all/conandata.yml b/recipes/tsl-robin-map/all/conandata.yml index c223869bef2e4..89211be8fec7b 100644 --- a/recipes/tsl-robin-map/all/conandata.yml +++ b/recipes/tsl-robin-map/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.1": + url: "https://github.com/Tessil/robin-map/archive/v1.2.1.tar.gz" + sha256: "2b54d2c1de2f73bea5c51d5dcbd64813a08caf1bfddcfdeee40ab74e9599e8e3" "1.0.1": url: "https://github.com/Tessil/robin-map/archive/v1.0.1.tar.gz" sha256: "b2ffdb623727cea852a66bddcb7fa6d938538a82b40e48294bb581fe086ef005" diff --git a/recipes/tsl-robin-map/all/conanfile.py b/recipes/tsl-robin-map/all/conanfile.py index da0b3a58cb5e8..60cfac70c1a0d 100644 --- a/recipes/tsl-robin-map/all/conanfile.py +++ b/recipes/tsl-robin-map/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class TslRobinMapConan(ConanFile): @@ -14,24 +17,33 @@ class TslRobinMapConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "tsl-robin-map") self.cpp_info.set_property("cmake_target_name", "tsl::robin_map") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "tsl-robin-map" @@ -41,3 +53,6 @@ def package_info(self): self.cpp_info.components["robin_map"].names["cmake_find_package"] = "robin_map" self.cpp_info.components["robin_map"].names["cmake_find_package_multi"] = "robin_map" self.cpp_info.components["robin_map"].set_property("cmake_target_name", "tsl::robin_map") + self.cpp_info.components["robin_map"].bindirs = [] + self.cpp_info.components["robin_map"].libdirs = [] + self.cpp_info.components["robin_map"].resdirs = [] diff --git a/recipes/tsl-robin-map/all/test_package/CMakeLists.txt b/recipes/tsl-robin-map/all/test_package/CMakeLists.txt index c27b4ffba58e9..e1f4cd6d85611 100644 --- a/recipes/tsl-robin-map/all/test_package/CMakeLists.txt +++ b/recipes/tsl-robin-map/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(tsl-robin-map REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} tsl::robin_map) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE tsl::robin_map) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tsl-robin-map/all/test_package/conanfile.py b/recipes/tsl-robin-map/all/test_package/conanfile.py index 1e9df9e32dfbd..0a6bc68712d90 100644 --- a/recipes/tsl-robin-map/all/test_package/conanfile.py +++ b/recipes/tsl-robin-map/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - test_package = os.path.join("bin", "test_package") - self.run(test_package, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt b/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/tsl-robin-map/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/tsl-robin-map/all/test_v1_package/conanfile.py b/recipes/tsl-robin-map/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1e9df9e32dfbd --- /dev/null +++ b/recipes/tsl-robin-map/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + test_package = os.path.join("bin", "test_package") + self.run(test_package, run_environment=True) diff --git a/recipes/tsl-robin-map/config.yml b/recipes/tsl-robin-map/config.yml index bfce952bf842d..7a3b316dace84 100644 --- a/recipes/tsl-robin-map/config.yml +++ b/recipes/tsl-robin-map/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.1": + folder: all "1.0.1": folder: all "0.6.3": diff --git a/recipes/tsl-sparse-map/all/conanfile.py b/recipes/tsl-sparse-map/all/conanfile.py index 19327116f1ac9..4168882cba1a3 100644 --- a/recipes/tsl-sparse-map/all/conanfile.py +++ b/recipes/tsl-sparse-map/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class TslSparseMapConan(ConanFile): @@ -14,24 +17,33 @@ class TslSparseMapConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def package_id(self): - self.info.header_only() + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*.h", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "tsl-sparse-map") self.cpp_info.set_property("cmake_target_name", "tsl::sparse_map") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.filenames["cmake_find_package"] = "tsl-sparse-map" @@ -41,3 +53,6 @@ def package_info(self): self.cpp_info.components["sparse_map"].names["cmake_find_package"] = "sparse_map" self.cpp_info.components["sparse_map"].names["cmake_find_package_multi"] = "sparse_map" self.cpp_info.components["sparse_map"].set_property("cmake_target_name", "tsl::sparse_map") + self.cpp_info.components["sparse_map"].bindirs = [] + self.cpp_info.components["sparse_map"].libdirs = [] + self.cpp_info.components["sparse_map"].resdirs = [] diff --git a/recipes/tsl-sparse-map/all/test_package/CMakeLists.txt b/recipes/tsl-sparse-map/all/test_package/CMakeLists.txt index 32b9c341072fd..47e7071ad283b 100644 --- a/recipes/tsl-sparse-map/all/test_package/CMakeLists.txt +++ b/recipes/tsl-sparse-map/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(tsl-sparse-map REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} tsl::sparse_map) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE tsl::sparse_map) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tsl-sparse-map/all/test_package/conanfile.py b/recipes/tsl-sparse-map/all/test_package/conanfile.py index 1e9df9e32dfbd..0a6bc68712d90 100644 --- a/recipes/tsl-sparse-map/all/test_package/conanfile.py +++ b/recipes/tsl-sparse-map/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - test_package = os.path.join("bin", "test_package") - self.run(test_package, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/tsl-sparse-map/all/test_v1_package/CMakeLists.txt b/recipes/tsl-sparse-map/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..3e681dedd0cd4 --- /dev/null +++ b/recipes/tsl-sparse-map/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(tsl-sparse-map REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE tsl::sparse_map) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/tsl-sparse-map/all/test_v1_package/conanfile.py b/recipes/tsl-sparse-map/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1e9df9e32dfbd --- /dev/null +++ b/recipes/tsl-sparse-map/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + test_package = os.path.join("bin", "test_package") + self.run(test_package, run_environment=True) diff --git a/recipes/tuplet/all/conandata.yml b/recipes/tuplet/all/conandata.yml index 17959ac3b2cd7..98eee37c105c5 100644 --- a/recipes/tuplet/all/conandata.yml +++ b/recipes/tuplet/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "2.1.0": + url: "https://github.com/codeinred/tuplet/archive/v2.1.0.tar.gz" + sha256: "e77503b81259c4d67d1b16b887b9ab778422e2ffc031d2171b5117d2fddb237c" + "2.0.0": + url: "https://github.com/codeinred/tuplet/archive/refs/tags/v2.0.0.tar.gz" + sha256: "cb754d119ca9d0a17ef165624d2c856b86eed9451bc8bc5c17b41410177a8d9f" "1.2.2": url: "https://github.com/codeinred/tuplet/archive/refs/tags/v1.2.2.tar.gz" sha256: "8605abf16f3ffcf87b0a5d81bc30f75b1fb478a5d747749fca31397e8705f8bc" diff --git a/recipes/tuplet/all/conanfile.py b/recipes/tuplet/all/conanfile.py index 64a8041e609cb..e4ef08ece551c 100644 --- a/recipes/tuplet/all/conanfile.py +++ b/recipes/tuplet/all/conanfile.py @@ -3,6 +3,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.files import copy, get from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os required_conan_version = ">=1.50.0" @@ -20,16 +21,24 @@ class TupletConan(ConanFile): @property def _min_cppstd(self): - return "20" + return "20" if Version(self.version) < "2.0.0" else "17" @property def _compilers_minimum_version(self): + if self._min_cppstd == "20": + return { + "gcc": "11", + "Visual Studio": "17", + "msvc": "193", + "clang": "13", + "apple-clang": "13" + } return { - "gcc": "11", - "Visual Studio": "17", - "msvc": "193", - "clang": "13", - "apple-clang": "13" + "gcc": "8", + "Visual Studio": "16", + "msvc": "192", + "clang": "7", + "apple-clang": "12" } def package_id(self): @@ -51,7 +60,7 @@ def loose_lt_semver(v1, v2): minimum_version = self._compilers_minimum_version.get(compiler, False) if minimum_version and loose_lt_semver(version, minimum_version): raise ConanInvalidConfiguration( - f"{self.name} {self.version} requires C++20, which your compiler ({compiler}-{version}) does not support") + f"{self.ref} requires C++{self._min_cppstd} which your compiler ({compiler}-{version}) does not support") def layout(self): basic_layout(self, src_folder="src") @@ -72,6 +81,4 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "tuplet") self.cpp_info.set_property("cmake_target_name", "tuplet::tuplet") self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/tuplet/all/test_v1_package/CMakeLists.txt b/recipes/tuplet/all/test_v1_package/CMakeLists.txt index 61c92c0f66ed6..925ecbe19e448 100644 --- a/recipes/tuplet/all/test_v1_package/CMakeLists.txt +++ b/recipes/tuplet/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.12) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(tuplet REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE tuplet::tuplet) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/tuplet/all/test_v1_package/conanfile.py b/recipes/tuplet/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/tuplet/all/test_v1_package/conanfile.py +++ b/recipes/tuplet/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/tuplet/config.yml b/recipes/tuplet/config.yml index af40d9653a378..dab8b51866d73 100644 --- a/recipes/tuplet/config.yml +++ b/recipes/tuplet/config.yml @@ -1,3 +1,7 @@ versions: + "2.1.0": + folder: all + "2.0.0": + folder: all "1.2.2": folder: all diff --git a/recipes/ulfius/all/conandata.yml b/recipes/ulfius/all/conandata.yml new file mode 100644 index 0000000000000..fc73e1163d024 --- /dev/null +++ b/recipes/ulfius/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "2.7.11": + url: "https://github.com/babelouest/ulfius/archive/refs/tags/v2.7.11.tar.gz" + sha256: "6f6fadf2fed0516f6f2203b9e5afcd9c6dfeee0cb48a27f659d6c4e21d1b456f" +patches: + "2.7.11": + - patch_file: "patches/2.7.11-0001-shared-static-conan.patch" + patch_description: "Build shared and static libraries" + patch_type: "portability" + - patch_file: "patches/2.7.11-0002-pthread-for-websockets-only.patch" + patch_description: "pthread is only required when using websockets" + patch_type: "portability" diff --git a/recipes/ulfius/all/conanfile.py b/recipes/ulfius/all/conanfile.py new file mode 100644 index 0000000000000..675ce5de0ba1e --- /dev/null +++ b/recipes/ulfius/all/conanfile.py @@ -0,0 +1,217 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir, save +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +import os +import textwrap + +required_conan_version = ">=1.52.0" + + +class UlfiusConan(ConanFile): + name = "ulfius" + description = "Web Framework to build REST APIs, Webservices or any HTTP endpoint in C language" + homepage = "https://github.com/babelouest/ulfius" + topics = ("web", "http", "rest", "endpoint", "json", "websocket") + license = "LGPL-2.1-or-later" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "enable_websockets": [True, False], + "with_gnutls": [True, False], + "with_jansson": [True, False], + "with_libcurl": [True, False], + "with_yder": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "enable_websockets": False, # FIXME: should be True (cannot be True because of missing gnutls recipe) + "with_gnutls": False, # FIXME: should be True + "with_jansson": True, + "with_libcurl": True, + "with_yder": True, + } + + def config_options(self): + if self.settings.os == "Windows": + self.options.enable_websockets = False + del self.options.fPIC + + def validate(self): + if self.options.with_gnutls: + raise ConanInvalidConfiguration("with_gnutls=True is not yet implemented due to missing gnutls CCI recipe") + if self.settings.os == "Windows" and self.options.enable_websockets: + raise ConanInvalidConfiguration("ulfius does not support with_websockets=True on Windows") + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def requirements(self): + self.requires("orcania/2.3.1") + self.requires("libmicrohttpd/0.9.75") + if self.options.with_yder: + self.requires("yder/1.4.18") + if self.options.with_jansson: + self.requires("jansson/2.14") + if self.options.with_libcurl: + self.requires("libcurl/7.85.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.variables["DOWNLOAD_DEPENDENCIES"] = False + tc.variables["WITH_GNUTLS"] = self.options.with_gnutls + tc.variables["WITH_WEBSOCKETS"] = self.options.enable_websockets + tc.variables["WITH_CURL"] = self.options.with_libcurl + tc.variables["WITH_JANSSON"] = self.options.with_jansson + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + # https://github.com/conan-io/conan/issues/12367 + move this before running CMakeDeps.generate() + save(self, os.path.join(self.generators_folder, "MHDConfig.cmake"), textwrap.dedent(f"""\ + include(CMakeFindDependencyMacro) + find_dependency(libmicrohttpd) + + set(MHD_FOUND TRUE) + add_library(MHD::MHD INTERFACE IMPORTED) + set_target_properties(MHD::MHD PROPERTIES INTERFACE_LINK_LIBRARIES "libmicrohttpd::libmicrohttpd") + set(MHD_VERSION_STRING {self.dependencies['libmicrohttpd'].ref.version}) + """)) + save(self, os.path.join(self.generators_folder, "MHDConfigVersion.cmake"), textwrap.dedent(f"""\ + set(PACKAGE_VERSION "{ self.dependencies['libmicrohttpd'].ref.version }") + + if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) + set(PACKAGE_VERSION_COMPATIBLE FALSE) + else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) + set(PACKAGE_VERSION_EXACT TRUE) + endif() + endif() + """)) + + # Shared ulfius looks for Orcania::Orcania and Yder::Yder + # Static ulfius looks for Orcania::Orcania-static and Yder::Yder-static + if self.options.shared: + if not self.dependencies["orcania"].options.shared: + save(self, os.path.join(self.generators_folder, "OrcaniaConfig.cmake"), textwrap.dedent("""\ + add_library(Orcania::Orcania INTERFACE IMPORTED) + set_target_properties(Orcania::Orcania PROPERTIES INTERFACE_LINK_LIBRARIES "Orcania::Orcania-static") + """), append=True) + if self.options.with_yder and not self.dependencies["yder"].options.shared: + save(self, os.path.join(self.generators_folder, "YderConfig.cmake"), textwrap.dedent("""\ + add_library(Yder::Yder INTERFACE IMPORTED) + set_target_properties(Yder::Yder PROPERTIES INTERFACE_LINK_LIBRARIES "Yder::Yder-static") + """), append=True) + + # Create Jansson::Jansson + if self.options.with_jansson: + save(self, os.path.join(self.generators_folder, "jansson-config.cmake"), textwrap.dedent(f"""\ + add_library(Jansson::Jansson INTERFACE IMPORTED) + set_target_properties(Jansson::Jansson PROPERTIES INTERFACE_LINK_LIBRARIES "jansson::jansson") + set(JANSSON_VERSION_STRING {self.dependencies['jansson'].ref.version}) + """), append=True) + + if self.options.with_gnutls: + # FIXME: make sure gnutls creates GnuTLSCOnfig.cmake + GnuTLS::GnuTLS target + GNUTLS_VERSION_STRING + pass + + def _patch_sources(self): + apply_conandata_patches(self) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", os.path.join(self.source_folder), os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + save(self, os.path.join(self.package_folder, self._variable_file_rel_path), + textwrap.dedent(f"""\ + set(ULFIUS_VERSION_STRING "{self.version}") + """)) + + # TODO: to remove in conan v2 once cmake_find_package* generators removed + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {} if self.options.shared else {"Ulfius::Ulfius-static": "Ulfius::Ulfius"} + ) + + def _create_cmake_module_alias_targets(self, module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent(f"""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + + @property + def _variable_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + + def package_info(self): + libname = "ulfius" + if is_msvc(self) and not self.options.shared: + libname += "-static" + self.cpp_info.libs = [libname] + + target_name = "Ulfius::Ulfius" if self.options.shared else "Ulfius::Ulfius-static" + self.cpp_info.set_property("cmake_file_name", "Ulfius") + self.cpp_info.set_property("cmake_target_name", target_name) + self.cpp_info.set_property("pkg_config_name", "libulfius") + self.cpp_info.set_property("cmake_build_modules", [self._variable_file_rel_path]) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "Ulfius" + self.cpp_info.filenames["cmake_find_package_multi"] = "Ulfius" + self.cpp_info.names["cmake_find_package"] = "Ulfius" + self.cpp_info.names["cmake_find_package_multi"] = "Ulfius" + self.cpp_info.names["pkg_config"] = "libulfius" + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path, self._variable_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path, self._variable_file_rel_path] diff --git a/recipes/ulfius/all/patches/2.7.11-0001-shared-static-conan.patch b/recipes/ulfius/all/patches/2.7.11-0001-shared-static-conan.patch new file mode 100644 index 0000000000000..0ea893bf22c64 --- /dev/null +++ b/recipes/ulfius/all/patches/2.7.11-0001-shared-static-conan.patch @@ -0,0 +1,323 @@ +--- src/CMakeLists.txt 2022-10-15 16:33:21.000000000 +0200 ++++ CMakeLists.txt 2022-11-04 17:47:35.458046726 +0100 +@@ -20,11 +20,11 @@ + + set(CMAKE_C_STANDARD 99) + if (NOT MSVC) +- set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}") ++ set(CMAKE_C_FLAGS "-Wall -Werror ${CMAKE_C_FLAGS}") + endif() + + # library info +- ++set(ULFIUS_LIBS ) + set(PROJECT_DESCRIPTION "Web Framework to build REST APIs, Webservices or any HTTP endpoint in C language. Can stream large amount of data, integrate JSON data with Jansson, and create websocket services") + set(PROJECT_HOMEPAGE_URL "https://github.com/babelouest/ulfius/") + set(PROJECT_BUGREPORT_PATH "https://github.com/babelouest/ulfius/issues") +@@ -64,10 +64,10 @@ + + set(U_CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake-modules) + list(APPEND CMAKE_MODULE_PATH "${U_CMAKE_MODULE_PATH}") +- + include(GNUInstallDirs) + include(CheckSymbolExists) +- ++include(CMakeDependentOption) ++include(CMakePackageConfigHelpers) + # check if _GNU_SOURCE is available + + if (NOT _GNU_SOURCE) +@@ -105,32 +105,32 @@ + + # pthread libraries + find_package (Threads) +-set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT}) ++list(APPEND ULFIUS_LIBS ${CMAKE_THREAD_LIBS_INIT}) + + # GNU TLS support + option(WITH_GNUTLS "GNU TLS support" ON) + + if (WITH_GNUTLS) +- include(FindGnuTLS) ++ #include(FindGnuTLS) + find_package(GnuTLS REQUIRED) ++ list(APPEND ULFIUS_LIBS GnuTLS::GnuTLS) + if (GNUTLS_FOUND) +- set(LIBS ${LIBS} ${GNUTLS_LIBRARIES}) +- include_directories(${GNUTLS_INCLUDE_DIRS}) +- endif () ++ #include_directories(${GNUTLS_INCLUDE_DIRS}) ++ endif() + endif () + +-# websocket support ++# current websocket implementation depends on GNU TLS, and is not supported on Windows + +-option(WITH_WEBSOCKET "Websocket support" ON) +- +-if (WIN32) +- set(WITH_WEBSOCKET OFF) +-endif () ++cmake_dependent_option(WITH_WEBSOCKET "Websocket support" ON "NOT WIN32;WITH_GNUTLS" OFF) + ++#if (WIN32) ++# set(WITH_WEBSOCKET OFF) ++#endif () ++# + # current websocket implementation depends on GNU TLS +-if (NOT WITH_GNUTLS) +- set(WITH_WEBSOCKET OFF) +-endif () ++#if (NOT WITH_GNUTLS) ++# set(WITH_WEBSOCKET OFF) ++#endif () + + if (WITH_WEBSOCKET AND NOT ${RELEASE_CODENAME} STREQUAL "stretch") + set(MHD_MIN_VERSION 0.9.53) +@@ -144,24 +144,23 @@ + set(U_DISABLE_GNUTLS ON) + endif () + +-include(FindMHD) ++#include(FindMHD) + find_package(MHD ${MHD_MIN_VERSION} REQUIRED) +-if (MHD_FOUND) +- set(LIBS ${LIBS} ${MHD_LIBRARIES}) +- include_directories(${MHD_INCLUDE_DIRS}) +- if (MHD_VERSION_STRING VERSION_LESS "0.9.53") +- set(WITH_WEBSOCKET OFF) +- endif () ++#if (MHD_FOUND) ++#endif() ++list(APPEND ULFIUS_LIBS MHD::MHD) ++#include_directories(${MHD_INCLUDE_DIRS}) ++if (MHD_VERSION_STRING VERSION_LESS "0.9.53") ++ set(WITH_WEBSOCKET OFF) + endif () + + if (WITH_WEBSOCKET) + set(U_DISABLE_WEBSOCKET OFF) +- include(FindZLIB) + find_package(ZLIB REQUIRED) +- if (ZLIB_FOUND) +- set(LIBS ${LIBS} ${ZLIB_LIBRARIES}) +- include_directories(${ZLIB_INCLUDE_DIRS}) +- endif () ++ list(APPEND ULFIUS_LIBS ZLIB::ZLIB) ++ #if (ZLIB_FOUND) ++ #set(LIBS ${LIBS} ${ZLIB_LIBRARIES}) ++ #endif () + else () + set(U_DISABLE_WEBSOCKET ON) + endif () +@@ -169,13 +168,13 @@ + option(WITH_CURL "Use Curl library" ON) + + if (WITH_CURL) +- include(FindCURL) + find_package(CURL REQUIRED) +- if (CURL_FOUND) +- set(LIBS ${LIBS} ${CURL_LIBRARIES}) +- include_directories(${CURL_INCLUDE_DIRS}) +- set(U_DISABLE_CURL OFF) ++ if (NOT TARGET CURL::libcurl) ++ add_library(CURL::libcurl INTERFACE IMPORTED) ++ set_target_properties(CURL::libcurl PROPERTIES INTERFACE_LINK_LIBRARIES "${CURL_LIBRARIES}"INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIRS}") + endif () ++ list(APPEND ULFIUS_LIBS CURL::libcurl) ++ set(U_DISABLE_CURL OFF) + else () + set(U_DISABLE_CURL ON) + endif () +@@ -183,14 +182,14 @@ + option(WITH_JANSSON "Use jansson library" ON) + + if (WITH_JANSSON) +- include(FindJansson) + set(JANSSON_MIN_VERSION 2.4) + find_package(Jansson ${JANSSON_MIN_VERSION} REQUIRED) +- if (JANSSON_FOUND) +- include_directories(${JANSSON_INCLUDE_DIRS}) +- set(LIBS ${LIBS} ${JANSSON_LIBRARIES}) +- set(U_DISABLE_JANSSON OFF) +- endif () ++ list(APPEND ULFIUS_LIBS Jansson::Jansson) ++ set(U_DISABLE_JANSSON OFF) ++ #if (JANSSON_FOUND) ++ #include_directories(${JANSSON_INCLUDE_DIRS}) ++ #set(LIBS ${LIBS} ${JANSSON_LIBRARIES}) ++ #endif () + else () + set(U_DISABLE_JANSSON ON) + endif () +@@ -199,32 +198,31 @@ + # The following 2 blocks are put BEFORE searching for Orcania and Yder by design + # Otherwise it will lead to cmake errors + # DON'T MOVE IT BELOW PLEASE! +- + # static library +- ++option(BUILD_SHARED "Build shared library." ON) + option(BUILD_STATIC "Build static library." OFF) +- + if (BUILD_STATIC) + add_library(ulfius_static STATIC ${LIB_SRC}) +- target_compile_definitions(ulfius_static PUBLIC -DO_STATIC_LIBRARY) +- set_target_properties(ulfius_static PROPERTIES +- OUTPUT_NAME ulfius) ++ target_include_directories(ulfius_static PUBLIC "$" PUBLIC "$" PUBLIC "$") ++ target_link_libraries(ulfius_static PUBLIC ${ULFIUS_LIBS}) ++ target_compile_definitions(ulfius_static PUBLIC O_STATIC_LIBRARY) ++ set_target_properties(ulfius_static PROPERTIES PUBLIC_HEADER "${INC_DIR}/ulfius.h;${PROJECT_BINARY_DIR}/ulfius-cfg.h" OUTPUT_NAME ulfius EXPORT_NAME Ulfius-static) ++ if (MSVC) ++ set_target_properties(ulfius_static PROPERTIES OUTPUT_NAME ulfius-static) ++ endif () ++ set(ulfius_lib ulfius_static) + endif () +- + # shared library +- +-add_library(ulfius SHARED ${LIB_SRC}) +-if (NOT MSVC) +- set_target_properties(ulfius PROPERTIES +- COMPILE_OPTIONS -Wextra +- PUBLIC_HEADER "${INC_DIR}/ulfius.h;${PROJECT_BINARY_DIR}/ulfius-cfg.h" +- VERSION "${LIBRARY_VERSION}" +- SOVERSION "${LIBRARY_SOVERSION}") +-endif() +-if (WIN32) +- set_target_properties(ulfius PROPERTIES SUFFIX "-${LIBRARY_VERSION_MAJOR}.dll") ++if (BUILD_SHARED) ++ add_library(ulfius SHARED ${LIB_SRC}) ++ target_include_directories(ulfius PUBLIC "$" PUBLIC "$" PUBLIC "$") ++ target_link_libraries(ulfius PUBLIC ${ULFIUS_LIBS}) ++ set_target_properties(ulfius PROPERTIES PUBLIC_HEADER "${INC_DIR}/ulfius.h;${PROJECT_BINARY_DIR}/ulfius-cfg.h" VERSION "${LIBRARY_VERSION}" SOVERSION "${LIBRARY_SOVERSION}" WINDOWS_EXPORT_ALL_SYMBOLS TRUE EXPORT_NAME Ulfius) ++ if (WIN32) ++ set_target_properties(ulfius PROPERTIES SUFFIX "-${LIBRARY_VERSION_MAJOR}.dll") ++ endif () ++ set(ulfius_lib ulfius) + endif () +-target_link_libraries(ulfius ${LIBS}) + + # documentation + +@@ -255,9 +253,9 @@ + option(SEARCH_ORCANIA_U "Search for ORCANIA library" ON) + if (SEARCH_ORCANIA_U) + set(Orcania_FIND_QUIETLY ON) # force to find Orcania quietly +- include(FindOrcania) +- find_package(Orcania ${ORCANIA_VERSION_REQUIRED} QUIET) # try to find orcania +- if (NOT ORCANIA_FOUND) ++ #include(FindOrcania) ++ find_package(Orcania ${ORCANIA_VERSION_REQUIRED} REQUIRED) # try to find orcania ++ if (NOT Orcania_FOUND) + if (DOWNLOAD_DEPENDENCIES) + include(DownloadProject) + download_project(PROJ orcania # ... otherwise, download archive +@@ -273,26 +271,33 @@ + message( FATAL_ERROR "Orcania not found") + endif () + else() +- set(LIBS ${LIBS} ${ORCANIA_LIBRARIES}) +- include_directories(${ORCANIA_INCLUDE_DIRS}) ++ if (NOT ("${ORCANIA_VERSION_STRING}" VERSION_GREATER_EQUAL "${ORCANIA_VERSION_REQUIRED}")) ++ message( FATAL_ERROR "Orcania version required: ${ORCANIA_VERSION_REQUIRED} - version installed: ${ORCANIA_VERSION_STRING}") ++ endif () + endif () +- target_link_libraries(ulfius ${LIBS} ${ORCANIA_LIBRARIES}) ++endif () ++if (BUILD_SHARED) ++ target_link_libraries(ulfius PUBLIC $) ++endif () ++if (BUILD_STATIC) ++ if(TARGET Orcania::Orcania-static) ++ target_link_libraries(ulfius_static PUBLIC $) ++ else() ++ target_link_libraries(ulfius_static PUBLIC $) ++ endif() + endif () + + option(WITH_YDER "Use Yder library to log messages" ON) + option(SEARCH_YDER "Search for Yder library" ON) + +-set(LIB_YDER "") + if (WITH_YDER) +- set(LIB_YDER "-lyder") + set(U_DISABLE_YDER OFF) + set(SEARCH_ORCANIA OFF CACHE BOOL "Force to false") # Avoid to search and download orcania during yder search and download + + if (SEARCH_YDER) + set(Yder_FIND_QUIETLY ON) # force to find Yder quietly +- include(FindYder) + find_package(Yder ${YDER_VERSION_REQUIRED} QUIET) # try to find Yder +- if (NOT YDER_FOUND) ++ if (NOT Yder_FOUND) + if (DOWNLOAD_DEPENDENCIES) + include(DownloadProject) + download_project(PROJ yder # ... otherwise, download archive +@@ -307,10 +312,21 @@ + message( FATAL_ERROR "Yder not found") + endif () + else() +- set(LIBS ${LIBS} ${YDER_LIBRARIES}) +- include_directories(${YDER_INCLUDE_DIRS}) ++ if ("${YDER_VERSION_STRING}" VERSION_GREATER_EQUAL "${YDER_VERSION_REQUIRED}") ++ else () ++ message( FATAL_ERROR "Yder version required: ${YDER_VERSION_REQUIRED} - version installed: ${YDER_VERSION_STRING}") ++ endif () ++ endif () ++ if (BUILD_SHARED) ++ target_link_libraries(ulfius PUBLIC $) ++ endif () ++ if (BUILD_STATIC) ++ if(TARGET Yder::Yder-static) ++ target_link_libraries(ulfius_static PUBLIC $) ++ else() ++ target_link_libraries(ulfius_static PUBLIC $) ++ endif() + endif () +- target_link_libraries(ulfius ${LIBS} ${YDER_LIBRARIES}) + endif () + else () + set(U_DISABLE_YDER ON) +@@ -318,17 +334,13 @@ + + # build uwsc + +-option(BUILD_UWSC "Build uwsc application." ON) +- +-if (NOT WITH_WEBSOCKET) +- set(BUILD_UWSC OFF) +-endif () ++cmake_dependent_option(BUILD_UWSC "Build uwsc application." ON "WITH_WEBSOCKET" OFF) + + if (BUILD_UWSC) + add_executable(uwsc ${UWSC_DIR}/uwsc.c ${INC_DIR}/ulfius.h ${INC_DIR}/u_private.h ${PROJECT_BINARY_DIR}/ulfius-cfg.h) + set_target_properties(uwsc PROPERTIES SKIP_BUILD_RPATH TRUE) + add_dependencies(uwsc ulfius) +- target_link_libraries(uwsc ulfius ${LIBS}) ++ target_link_libraries(uwsc PRIVATE "${ulfius_lib}") + install(TARGETS uwsc RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) + INSTALL(FILES ${UWSC_DIR}/uwsc.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 COMPONENT runtime) + endif () +@@ -353,7 +365,7 @@ + # build ulfius-cfg.h file + configure_file(${INC_DIR}/ulfius-cfg.h.in ${PROJECT_BINARY_DIR}/ulfius-cfg.h) + set (CMAKE_EXTRA_INCLUDE_FILES ${PROJECT_BINARY_DIR}) +-include_directories(${PROJECT_BINARY_DIR}) ++#include_directories(${PROJECT_BINARY_DIR}) + + # tests + +@@ -435,9 +447,9 @@ + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libulfius.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + +-SET (TARGETS ulfius) ++SET (TARGETS ${ulfius_lib}) + if (BUILD_STATIC) +- SET (TARGETS ${TARGETS} ulfius_static) ++ #SET (TARGETS ${TARGETS} ulfius_static) + endif () + + if (INSTALL_HEADER) diff --git a/recipes/ulfius/all/patches/2.7.11-0002-pthread-for-websockets-only.patch b/recipes/ulfius/all/patches/2.7.11-0002-pthread-for-websockets-only.patch new file mode 100644 index 0000000000000..cf3559e240556 --- /dev/null +++ b/recipes/ulfius/all/patches/2.7.11-0002-pthread-for-websockets-only.patch @@ -0,0 +1,41 @@ +From fab66efc6b64cfe6d21e4ab0b60d00a06ceee860 Mon Sep 17 00:00:00 2001 +From: Nicolas Mora +Date: Sun, 23 Oct 2022 13:53:08 -0400 +Subject: [PATCH] Include pthread.h with websockets only + +Close #243 +--- + include/ulfius.h | 2 +- + src/ulfius.c | 1 - + 2 files changed, 1 insertion(+), 2 deletions(-) + +diff --git a/include/ulfius.h b/include/ulfius.h +index 7b327dd..772554b 100644 +--- a/include/ulfius.h ++++ b/include/ulfius.h +@@ -51,12 +51,12 @@ extern "C" + #ifndef U_DISABLE_WEBSOCKET + #include + #include ++ #include + #ifndef POLLRDHUP + #define POLLRDHUP 0x2000 + #endif + #endif + +-#include + #include + + #if defined(_WIN32) && !defined(U_DISABLE_WEBSOCKET) +diff --git a/src/ulfius.c b/src/ulfius.c +index c004048..4a147cf 100644 +--- a/src/ulfius.c ++++ b/src/ulfius.c +@@ -30,7 +30,6 @@ + #endif + + #include +-#include + #include + #include + diff --git a/recipes/ulfius/all/test_package/CMakeLists.txt b/recipes/ulfius/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5abb20511e4c7 --- /dev/null +++ b/recipes/ulfius/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(Ulfius REQUIRED CONFIG) + +option(ULFIUS_SHARED "Ulfius is built as a shared library") + +add_executable(${PROJECT_NAME} test_package.c) +if(ULFIUS_SHARED) + target_link_libraries(${PROJECT_NAME} PRIVATE Ulfius::Ulfius) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE Ulfius::Ulfius-static) +endif() diff --git a/recipes/ulfius/all/test_package/conanfile.py b/recipes/ulfius/all/test_package/conanfile.py new file mode 100644 index 0000000000000..9885e9d6fa11b --- /dev/null +++ b/recipes/ulfius/all/test_package/conanfile.py @@ -0,0 +1,31 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ULFIUS_SHARED"] = self.dependencies["ulfius"].options.shared + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/ulfius/all/test_package/test_package.c b/recipes/ulfius/all/test_package/test_package.c new file mode 100644 index 0000000000000..6677e3c86a579 --- /dev/null +++ b/recipes/ulfius/all/test_package/test_package.c @@ -0,0 +1,64 @@ +/** + * test.c + * Small Hello World! example + * to compile with gcc, run the following command + * gcc -o test test.c -lulfius + */ +#include + +#include +#include + +#define PORT 8080 + +/** + * Callback function for the web application on /helloworld url call + */ +int callback_hello_world (const struct _u_request * request, struct _u_response * response, void * user_data) { + ulfius_set_string_body_response(response, 200, "Hello World!"); + return U_CALLBACK_CONTINUE; +} + +/** + * main function + */ +int main(int argc, char *argv[]) { + struct _u_instance instance; + + if (ulfius_global_init() != U_OK) { + fprintf(stderr, "Error ulfius_global_init, abort\n"); + return(1); + } + + // Avoid running a server on CI + if (argc > 1 && strcmp(argv[1], "run") == 0) { + + // Initialize instance with the port number + if (ulfius_init_instance(&instance, PORT, NULL, NULL) != U_OK) { + fprintf(stderr, "Error ulfius_init_instance, abort\n"); + return(1); + } + + // Endpoint list declaration + ulfius_add_endpoint_by_val(&instance, "GET", "/helloworld", NULL, 0, &callback_hello_world, NULL); + + // Start the framework + if (ulfius_start_framework(&instance) == U_OK) { + printf("Start framework on port %d\n", instance.port); + + // Wait for the user to press on the console to quit the application + getchar(); + } else { + fprintf(stderr, "Error starting framework\n"); + } + printf("End framework\n"); + + ulfius_stop_framework(&instance); + + ulfius_clean_instance(&instance); + } + + ulfius_global_close(); + + return 0; +} diff --git a/recipes/ulfius/all/test_v1_package/CMakeLists.txt b/recipes/ulfius/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..c0c854f00b188 --- /dev/null +++ b/recipes/ulfius/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(Ulfius REQUIRED CONFIG) + +option(ULFIUS_SHARED "Ulfius is built as a shared library") + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +if(ULFIUS_SHARED) + target_link_libraries(${PROJECT_NAME} PRIVATE Ulfius::Ulfius) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE Ulfius::Ulfius-static) +endif() diff --git a/recipes/ulfius/all/test_v1_package/conanfile.py b/recipes/ulfius/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..32ed9b5ed5ce3 --- /dev/null +++ b/recipes/ulfius/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["ULFIUS_SHARED"] = self.options["ulfius"].shared + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/ulfius/config.yml b/recipes/ulfius/config.yml new file mode 100644 index 0000000000000..f0814bc8af2c7 --- /dev/null +++ b/recipes/ulfius/config.yml @@ -0,0 +1,3 @@ +versions: + "2.7.11": + folder: all diff --git a/recipes/uncrustify/all/CMakeLists.txt b/recipes/uncrustify/all/CMakeLists.txt deleted file mode 100644 index 6daa96f1f210a..0000000000000 --- a/recipes/uncrustify/all/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -add_subdirectory("source_subfolder") diff --git a/recipes/uncrustify/all/conanfile.py b/recipes/uncrustify/all/conanfile.py index 85c2f0f6f2b23..da8a4d29e3f0e 100644 --- a/recipes/uncrustify/all/conanfile.py +++ b/recipes/uncrustify/all/conanfile.py @@ -1,10 +1,12 @@ -from conans import ConanFile, CMake, tools -from conan.tools.files import rename -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, mkdir, rename, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os -import functools -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.47.0" class UncrustifyConan(ConanFile): @@ -15,41 +17,40 @@ class UncrustifyConan(ConanFile): homepage = "https://github.com/uncrustify/uncrustify" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - exports_sources = "CMakeLists.txt" - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + cmake_layout(self, src_folder="src") - @property - def _build_subfolder(self): - return "build_subfolder" + def package_id(self): + del self.info.settings.compiler def validate(self): - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "7": - raise ConanInvalidConfiguration(f"{self.name} requires GCC >=8") + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "7": + raise ConanInvalidConfiguration(f"{self.ref} requires GCC >=7") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure(build_folder=self._build_subfolder) - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["NoGitVersionString"] = True + tc.variables["BUILD_TESTING"] = False + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) - if self.settings.os == "Windows": - tools.mkdir(os.path.join(self.package_folder, "bin")) + if is_msvc(self): + mkdir(self, os.path.join(self.package_folder, "bin")) rename(self, os.path.join(self.package_folder, "uncrustify.exe"), os.path.join(self.package_folder, "bin", "uncrustify.exe")) os.remove(os.path.join(self.package_folder, "AUTHORS")) @@ -58,16 +59,15 @@ def package(self): os.remove(os.path.join(self.package_folder, "ChangeLog")) os.remove(os.path.join(self.package_folder, "HELP")) os.remove(os.path.join(self.package_folder, "README.md")) - tools.rmdir(os.path.join(self.package_folder, "cfg")) - tools.rmdir(os.path.join(self.package_folder, "doc")) - - tools.rmdir(os.path.join(self.package_folder, "share")) - - def package_id(self): - del self.info.settings.compiler + rmdir(self, os.path.join(self.package_folder, "cfg")) + rmdir(self, os.path.join(self.package_folder, "doc")) def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] + + # TODO: to remove in conan v2 binpath = os.path.join(self.package_folder, "bin") self.output.info(f"Adding to PATH: {binpath}") self.env_info.PATH.append(binpath) - self.cpp_info.includedirs = [] diff --git a/recipes/uncrustify/all/test_package/conanfile.py b/recipes/uncrustify/all/test_package/conanfile.py index a60815102333e..ca7e7aabaf2bf 100644 --- a/recipes/uncrustify/all/test_package/conanfile.py +++ b/recipes/uncrustify/all/test_package/conanfile.py @@ -1,9 +1,15 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + generators = "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self): - self.run("uncrustify --version", run_environment=True) + if can_run(self): + self.run("uncrustify --version", env="conanrun") diff --git a/recipes/uncrustify/all/test_v1_package/conanfile.py b/recipes/uncrustify/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..a60815102333e --- /dev/null +++ b/recipes/uncrustify/all/test_v1_package/conanfile.py @@ -0,0 +1,9 @@ +from conans import ConanFile, tools + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not tools.cross_building(self): + self.run("uncrustify --version", run_environment=True) diff --git a/recipes/uni-algo/all/conandata.yml b/recipes/uni-algo/all/conandata.yml new file mode 100644 index 0000000000000..71c9d6aa01ab6 --- /dev/null +++ b/recipes/uni-algo/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "0.7.0": + url: "https://github.com/uni-algo/uni-algo/archive/refs/tags/v0.7.0.tar.gz" + sha256: "c8d078461c77fa4e50013ea4e1263466163eac9102fca2e125bd5c992de6cc2f" + "0.6.0": + url: "https://github.com/uni-algo/uni-algo/archive/refs/tags/v0.6.0.tar.gz" + sha256: "b2b0cf62c8476895ce2dae51459f8df82cd27b6f199b014cb5b2dbb45a605187" diff --git a/recipes/uni-algo/all/conanfile.py b/recipes/uni-algo/all/conanfile.py new file mode 100644 index 0000000000000..7c84fb1abcb6a --- /dev/null +++ b/recipes/uni-algo/all/conanfile.py @@ -0,0 +1,66 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.52.0" + +class UniAlgoConan(ConanFile): + name = "uni-algo" + description = "Unicode Algorithms Implementation for C/C++" + license = ("MIT", "Unlicense") + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/uni-algo/uni-algo" + topics = ("unicode", "utf-8", "utf-16", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compiler_required_cpp(self): + return { + "Visual Studio": "16", + "msvc": "191", + "gcc": "8", + "clang": "7", + "apple-clang": "12.0", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._compiler_required_cpp.get(str(self.settings.compiler), False) + if minimum_version: + if Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.") + else: + self.output.warn(f"{self.ref} requires C++{self._min_cppstd}. Your compiler is unknown. Assuming it supports C++{self._min_cppstd}.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def package(self): + copy(self, pattern="LICENSE.md", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/uni-algo/all/test_package/CMakeLists.txt b/recipes/uni-algo/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..2c2668410d8a6 --- /dev/null +++ b/recipes/uni-algo/all/test_package/CMakeLists.txt @@ -0,0 +1,12 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(uni-algo REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE uni-algo::uni-algo) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) + +if(uni-algo_VERSION VERSION_LESS "0.7.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE -DUNI_ALGO_NAMESPACE_UNI) +endif() diff --git a/recipes/uni-algo/all/test_package/conanfile.py b/recipes/uni-algo/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/uni-algo/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/uni-algo/all/test_package/test_package.cpp b/recipes/uni-algo/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..9a151c2fa3703 --- /dev/null +++ b/recipes/uni-algo/all/test_package/test_package.cpp @@ -0,0 +1,30 @@ +// This code was cited from https://github.com/uni-algo/uni-algo/tree/v0.1.0#convert-module +#include "uni_algo/all.h" + +int main() { + // Lenient conversion (cannot fail) "\xD800" is unpaired high surrogate in + // UTF-16 + { +#ifdef UNI_ALGO_NAMESPACE_UNI + std::string str8 = uni::utf16to8(u"Te\xD800st"); +#else + std::string str8 = una::utf16to8(u"Te\xD800st"); +#endif + assert(str8 == "Te\xEF\xBF\xBDst"); // "\xEF\xBF\xBD" is replacement + // character U+FFFD in UTF-8 + } + + // Strict conversion + { +#ifdef UNI_ALGO_NAMESPACE_UNI + uni::error error; + std::string str8 = uni::strict::utf16to8(u"Te\xD800st", error); +#else + una::error error; + std::string str8 = una::strict::utf16to8(u"Te\xD800st", error); +#endif + assert(str8.empty() && error && error.pos() == 2); + } + + return 0; +} diff --git a/recipes/uni-algo/all/test_v1_package/CMakeLists.txt b/recipes/uni-algo/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/uni-algo/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/uni-algo/all/test_v1_package/conanfile.py b/recipes/uni-algo/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/uni-algo/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/uni-algo/config.yml b/recipes/uni-algo/config.yml new file mode 100644 index 0000000000000..8989066184790 --- /dev/null +++ b/recipes/uni-algo/config.yml @@ -0,0 +1,5 @@ +versions: + "0.7.0": + folder: all + "0.6.0": + folder: all diff --git a/recipes/unicorn/all/CMakeLists.txt b/recipes/unicorn/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f..0000000000000 --- a/recipes/unicorn/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/unicorn/all/conandata.yml b/recipes/unicorn/all/conandata.yml index b55a1cc058087..8687bbd470670 100644 --- a/recipes/unicorn/all/conandata.yml +++ b/recipes/unicorn/all/conandata.yml @@ -1,14 +1,19 @@ sources: - "1.0.3": - url: "https://github.com/unicorn-engine/unicorn/archive/refs/tags/1.0.3.tar.gz" - sha256: "64fba177dec64baf3f11c046fbb70e91483e029793ec6a3e43b028ef14dc0d65" + "2.0.1": + url: "https://github.com/unicorn-engine/unicorn/archive/refs/tags/2.0.1.tar.gz" + sha256: "0c1586f6b079e705d760403141db0ea65d0e22791cf0f43f38172d49497923fd" "2.0.0": url: "https://github.com/unicorn-engine/unicorn/archive/refs/tags/2.0.0.tar.gz" sha256: "67b445c760e2bbac663e8c8bc410e43311c7fc92df4dfa8d90e06a021d07f634" -patches: "1.0.3": - - patch_file: "patches/1.0.3-0001-cmake-crossbuild-support.patch" - base_path: "source_subfolder" + url: "https://github.com/unicorn-engine/unicorn/archive/refs/tags/1.0.3.tar.gz" + sha256: "64fba177dec64baf3f11c046fbb70e91483e029793ec6a3e43b028ef14dc0d65" +patches: + "2.0.1": + - patch_file: "patches/2.0.1-0001-cmake-msvc-support.patch" + - patch_file: "patches/2.0.1-0002-cmake-msvc-runtime.patch" "2.0.0": - patch_file: "patches/2.0.0-0001-cmake-msvc-support.patch" - base_path: "source_subfolder" + - patch_file: "patches/2.0.0-0002-cmake-msvc-runtime.patch" + "1.0.3": + - patch_file: "patches/1.0.3-0001-cmake-crossbuild-support.patch" diff --git a/recipes/unicorn/all/conanfile.py b/recipes/unicorn/all/conanfile.py index 683f2d61f04c3..a304c26bd1555 100644 --- a/recipes/unicorn/all/conanfile.py +++ b/recipes/unicorn/all/conanfile.py @@ -1,11 +1,13 @@ -from conans import CMake, ConanFile, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout, CMakeDeps +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy, rmdir, save, export_conandata_patches, apply_conandata_patches +from conan.tools.microsoft import is_msvc import os import stat import textwrap -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class UnicornConan(ConanFile): @@ -19,21 +21,14 @@ class UnicornConan(ConanFile): options = { "shared": [True, False], "fPIC": [True, False], - "supported_archs": "ANY", # comma-separated list of archs + "supported_archs": ["ANY"], # comma-separated list of archs } default_options = { "shared": False, "fPIC": True, - "supported_archs": "", # defaults to all archs supported by the current version. See `config_options`. + "supported_archs": ["ANY"], # defaults to all archs supported by the current version. See `config_options`. } - exports_sources = "CMakeLists.txt", "patches/*" - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _all_supported_archs(self): """ @@ -64,11 +59,21 @@ def configure(self): @property def _needs_jwasm(self): - return self.settings.os == "Windows" and self.settings.compiler != "Visual Studio" + return self.settings.os == "Windows" and not is_msvc(self) + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") def build_requirements(self): if self._needs_jwasm: - self.build_requires("jwasm/2.13") + self.tool_requires("jwasm/2.13") + + def package_id(self): + # normalize the supported_archs option (sorted+comma separated) + self.info.options.supported_archs = ",".join(self._supported_archs) def validate(self): unsupported_archs = [arch for arch in self._supported_archs if arch not in self._all_supported_archs] @@ -79,39 +84,17 @@ def validate(self): # FIXME: will/should be fixed with unicorn 2 (https://github.com/unicorn-engine/unicorn/issues/1379) raise ConanInvalidConfiguration("arm builds of unicorn are currently unsupported") - def package_id(self): - # normalize the supported_archs option (sorted+comma separated) - self.info.options.supported_archs = ",".join(self._supported_archs) - def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) @property def _jwasm_wrapper(self): return os.path.join(self.build_folder, "jwasm_wrapper.py") - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["UNICORN_INSTALL"] = True - cmake.definitions["UNICORN_BUILD_SAMPLES"] = False - cmake.definitions["UNICORN_ARCH"] = " ".join(self._supported_archs) - if self._needs_jwasm: - cmake.definitions["CMAKE_ASM_MASM_COMPILER"] = self._jwasm_wrapper - if self.settings.arch == "x86_64": - cmake.definitions["CMAKE_ASM_MASM_FLAGS"] = { - "x86_64": "-win64", - "x86": "-coff", - }[str(self.settings.arch)] - cmake.configure() - return cmake - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) if self._needs_jwasm: - tools.save(self._jwasm_wrapper, textwrap.dedent("""\ + save(self, self._jwasm_wrapper, textwrap.dedent("""\ #!/usr/bin/env python import os import sys @@ -132,22 +115,43 @@ def _patch_sources(self): """)) os.chmod(self._jwasm_wrapper, stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR | stat.S_IRGRP | stat.S_IWGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH) + def generate(self): + tc = CMakeToolchain(self) + tc.variables["UNICORN_INSTALL"] = True + tc.variables["UNICORN_BUILD_SAMPLES"] = False + tc.cache_variables["UNICORN_ARCH"] = ";".join(self._supported_archs) + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" + + if self._needs_jwasm: + tc.variables["CMAKE_ASM_MASM_COMPILER"] = self._jwasm_wrapper + if self.settings.arch == "x86_64": + tc.variables["CMAKE_ASM_MASM_FLAGS"] = { + "x86_64": "-win64", + "x86": "-coff", + }[str(self.settings.arch)] + + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + def build(self): + apply_conandata_patches(self) self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - self.copy("COPYING.LGPL2", src=self._source_subfolder, dst="licenses") - self.copy("COPYING_GLIB", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + for lic in ("COPYING", "COPYING.LGPL2", "COPYING_GLIB"): + copy(self, lic, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.libs = ["unicorn"] - self.cpp_info.names["pkg_config"] = "unicorn" + self.cpp_info.set_property("pkg_config_name", "unicorn") if self.settings.os in ("FreeBSD", "Linux"): self.cpp_info.system_libs = ["m", "pthread"] diff --git a/recipes/unicorn/all/patches/2.0.0-0002-cmake-msvc-runtime.patch b/recipes/unicorn/all/patches/2.0.0-0002-cmake-msvc-runtime.patch new file mode 100644 index 0000000000000..b28165288cd1f --- /dev/null +++ b/recipes/unicorn/all/patches/2.0.0-0002-cmake-msvc-runtime.patch @@ -0,0 +1,11 @@ +--- CMakeLists.txt ++++ CMakeLists.txt +@@ -100,7 +100,7 @@ + add_compile_options($<$:/wd4267>) + + # handle msvcrt setting being passed in CMAKE_C_FLAGS +- if(DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) ++ if(FALSE) + # do not support other methods of setting this (it would be more conformant, tho) + message(FATAL_ERROR "please set msvcrt via CMAKE_C_FLAGS") + endif() diff --git a/recipes/unicorn/all/patches/2.0.1-0001-cmake-msvc-support.patch b/recipes/unicorn/all/patches/2.0.1-0001-cmake-msvc-support.patch new file mode 100644 index 0000000000000..93cdf2304d9ee --- /dev/null +++ b/recipes/unicorn/all/patches/2.0.1-0001-cmake-msvc-support.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 85597f46..3161d714 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1431,7 +1431,7 @@ if(UNICORN_BUILD_TESTS) + endif() + + +-if(UNICORN_INSTALL AND NOT MSVC) ++if(UNICORN_INSTALL) + include("GNUInstallDirs") + file(GLOB UNICORN_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/unicorn/*.h) + if (BUILD_SHARED_LIBS) diff --git a/recipes/unicorn/all/patches/2.0.1-0002-cmake-msvc-runtime.patch b/recipes/unicorn/all/patches/2.0.1-0002-cmake-msvc-runtime.patch new file mode 100644 index 0000000000000..0d1c0d94f4fa4 --- /dev/null +++ b/recipes/unicorn/all/patches/2.0.1-0002-cmake-msvc-runtime.patch @@ -0,0 +1,16 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 85597f46..1467bc55 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -108,8 +108,10 @@ if(MSVC) + add_compile_options($<$:/wd4244>) + add_compile_options($<$:/wd4267>) + ++ message(OUTPUT "CMAKE_MSVC_RUNTIME_LIBRARY ${CMAKE_MSVC_RUNTIME_LIBRARY} CMAKE_C_FLAGS ${CMAKE_C_FLAGS}") ++ + # handle msvcrt setting being passed in CMAKE_C_FLAGS +- if(DEFINED CMAKE_MSVC_RUNTIME_LIBRARY) ++ if(FALSE) + # do not support other methods of setting this (it would be more conformant, tho) + message(FATAL_ERROR "please set msvcrt via CMAKE_C_FLAGS") + endif() diff --git a/recipes/unicorn/all/test_package/CMakeLists.txt b/recipes/unicorn/all/test_package/CMakeLists.txt index 77c8819fd7ca9..6c6411fee68ac 100644 --- a/recipes/unicorn/all/test_package/CMakeLists.txt +++ b/recipes/unicorn/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(unicorn REQUIRED) +find_package(unicorn REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE unicorn::unicorn) diff --git a/recipes/unicorn/all/test_package/conanfile.py b/recipes/unicorn/all/test_package/conanfile.py index 3da371b660e0a..3a8c6c5442b33 100644 --- a/recipes/unicorn/all/test_package/conanfile.py +++ b/recipes/unicorn/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import cross_building +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if not cross_building(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/unicorn/all/test_v1_package/CMakeLists.txt b/recipes/unicorn/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2318e761b0487 --- /dev/null +++ b/recipes/unicorn/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(unicorn REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE unicorn::unicorn) diff --git a/recipes/unicorn/all/test_v1_package/conanfile.py b/recipes/unicorn/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..49a3a66ea5bad --- /dev/null +++ b/recipes/unicorn/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/unicorn/config.yml b/recipes/unicorn/config.yml index 4e8846be88f82..7daf28aace362 100644 --- a/recipes/unicorn/config.yml +++ b/recipes/unicorn/config.yml @@ -1,5 +1,7 @@ versions: - "1.0.3": + "2.0.1": folder: "all" "2.0.0": folder: "all" + "1.0.3": + folder: "all" diff --git a/recipes/units/all/conandata.yml b/recipes/units/all/conandata.yml index 3a9acfbdba5f7..5286960fcf8dc 100644 --- a/recipes/units/all/conandata.yml +++ b/recipes/units/all/conandata.yml @@ -1,4 +1,7 @@ sources: - "2.3.1": - url: https://github.com/nholthaus/units/archive/v2.3.1.tar.gz - sha256: 4a242a6e1b117f0234dffc2796c9133ca57d114f0fdf2c200754e6770db6bfd8 + "2.3.3": + url: "https://github.com/nholthaus/units/archive/v2.3.3.tar.gz" + sha256: "b1f3c1dd11afa2710a179563845ce79f13ebf0c8c090d6aa68465b18bd8bd5fc" + "2.3.1": + url: "https://github.com/nholthaus/units/archive/v2.3.1.tar.gz" + sha256: "4a242a6e1b117f0234dffc2796c9133ca57d114f0fdf2c200754e6770db6bfd8" diff --git a/recipes/units/all/conanfile.py b/recipes/units/all/conanfile.py index dad45a55f097d..abb3f73f19041 100644 --- a/recipes/units/all/conanfile.py +++ b/recipes/units/all/conanfile.py @@ -1,51 +1,67 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.scm import Version import os -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version +required_conan_version = ">=1.50.0" class UnitsConan(ConanFile): name = "units" - url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/nholthaus/units" - description = "A compile-time, header-only, dimensional analysis and unit conversion library built on c++14 with no dependencies" + description = ( + "A compile-time, header-only, dimensional analysis and unit conversion " + "library built on c++14 with no dependencies" + ) + license = "MIT" topics = ("unit-conversion", "dimensional-analysis", "cpp14", "template-metaprogramming", "compile-time", "header-only", "no-dependencies") - license = "MIT" + homepage = "https://github.com/nholthaus/units" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - settings = "compiler" - _source_subfolder = "source_subfolder" + @property + def _min_cppstd(self): + return "14" - def configure(self): - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, "14") - minimum_version = { - "clang": 3.4, + @property + def _minimum_compilers_version(self): + return { + "clang": "3.4", "gcc": "4.9.3", - "Visual Studio": 14.0, - }.get(str(self.settings.compiler)) - if not minimum_version: - self.output.warn( - "Unknown compiler: assuming compiler supports C++14") - else: - if Version(self.settings.compiler.version) < minimum_version: - raise ConanInvalidConfiguration( - "Compiler does not support C++14") + "Visual Studio": "14", + "msvc": "190", + } + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = self.name + "-" + self.version - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy( - "units.h", - dst="include", - src=os.path.join(self._source_subfolder, "include")) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "units.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "units") + self.cpp_info.set_property("cmake_target_name", "units::units") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/units/all/test_package/CMakeLists.txt b/recipes/units/all/test_package/CMakeLists.txt index 6458832a89f30..34eb08429bc23 100644 --- a/recipes/units/all/test_package/CMakeLists.txt +++ b/recipes/units/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(unitstest CXX) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(units REQUIRED CONFIG) -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_target_properties(${PROJECT_NAME} PROPERTIES CXX_STANDARD 14) +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE units::units) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/units/all/test_package/conanfile.py b/recipes/units/all/test_package/conanfile.py index f62c3328307cc..0a6bc68712d90 100644 --- a/recipes/units/all/test_package/conanfile.py +++ b/recipes/units/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import CMake, ConanFile, tools +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" -class UnitsTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "unitstest") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/units/all/test_package/unitstest.cpp b/recipes/units/all/test_package/test_package.cpp similarity index 100% rename from recipes/units/all/test_package/unitstest.cpp rename to recipes/units/all/test_package/test_package.cpp diff --git a/recipes/units/all/test_v1_package/CMakeLists.txt b/recipes/units/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b01d1d5fd06ef --- /dev/null +++ b/recipes/units/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(units REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE units::units) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/units/all/test_v1_package/conanfile.py b/recipes/units/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e0a85886fc12c --- /dev/null +++ b/recipes/units/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import CMake, ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/units/config.yml b/recipes/units/config.yml index 215bc57fe4993..12ddc838534be 100644 --- a/recipes/units/config.yml +++ b/recipes/units/config.yml @@ -1,3 +1,5 @@ versions: + "2.3.3": + folder: all "2.3.1": folder: all diff --git a/recipes/univalue/all/conandata.yml b/recipes/univalue/all/conandata.yml index d2972a3ca4175..1cbda6bed44a6 100644 --- a/recipes/univalue/all/conandata.yml +++ b/recipes/univalue/all/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "1.1.1": - patch_file: "patches/1.1.1-0001-fix-windows.patch" - base_path: "source_subfolder" "1.0.5": - patch_file: "patches/1.0.5-0001-fix-windows.patch" - base_path: "source_subfolder" diff --git a/recipes/univalue/all/conanfile.py b/recipes/univalue/all/conanfile.py index cdd8d42494919..c8a79f9bcd0b8 100644 --- a/recipes/univalue/all/conanfile.py +++ b/recipes/univalue/all/conanfile.py @@ -1,18 +1,24 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from contextlib import contextmanager +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class UnivalueConan(ConanFile): name = "univalue" description = "High performance RAII C++ JSON library and universal value object class" - topics = "conan", "univalue", "universal", "json", "encoding", "decoding" + topics = ("universal", "json", "encoding", "decoding") license = "MIT" homepage = "https://github.com/jgarzik/univalue" url = "https://github.com/conan-io/conan-center-index" - exports_sources = "patches/**" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -23,11 +29,16 @@ class UnivalueConan(ConanFile): "fPIC": True, } - _autotools = None + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) @property - def _source_subfolder(self): - return "source_subfolder" + def _user_info_build(self): + return getattr(self, "user_info_build", self.deps_user_info) + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -35,83 +46,78 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - @property - def _settings_build(self): - return getattr(self, "settings_build", self.settings) + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - self._autotools.libs = [] - if self.settings.compiler == "Visual Studio": - self._autotools.flags.append("-FS") - self._autotools.cxx_flags.append("-EHsc") - conf_args = [] - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) - else: - conf_args.extend(["--disable-shared", "--enable-static"]) - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - if self.settings.compiler == "Visual Studio": - tools.replace_in_file("libtool", "-Wl,-DLL,-IMPLIB", "-link -DLL -link -DLL -link -IMPLIB") - return self._autotools - - def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - - @contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - env = { - "CC": "cl -nologo", - "CXX": "cl -nologo", - "CPP": "cl -nologo -EP", - "LD": "link", - "CXXLD": "link", - "AR": "{} lib".format(tools.unix_path(self.deps_user_info["automake"].ar_lib)), - "NM": "dumpbin -symbols", - } - with tools.environment_append(env): - yield - else: - yield + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + if is_msvc(self): + tc.extra_cxxflags.append("-EHsc") + if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + tc.extra_cflags.append("-FS") + tc.extra_cxxflags.append("-FS") + tc.generate() + + if is_msvc(self): + env = Environment() + ar_wrapper = unix_path(self, self._user_info_build["automake"].ar_lib) + env.define("CC", "cl -nologo") + env.define("CXX", "cl -nologo") + env.define("CPP", "cl -nologo -EP") + env.define("LD", "link -nologo") + env.define("CXXLD", "link -nologo") + env.define("AR", f"{ar_wrapper} \"lib -nologo\"") + env.define("NM", "dumpbin -symbols") + env.define("OBJDUMP", ":") + env.define("RANLIB", ":") + env.define("STRIP", ":") + env.vars(self).save_script("conanbuild_univalue_msvc") def build(self): - self._patch_sources() - with tools.chdir(self._source_subfolder): - self.run("{} --verbose --install --force".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + if is_msvc(self): + replace_in_file( + self, + os.path.join(self.build_folder, "libtool"), + "-Wl,-DLL,-IMPLIB", + "-link -DLL -link -DLL -link -IMPLIB", + ) + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - if self.settings.compiler == "Visual Studio" and self.options.shared: - tools.rename(os.path.join(self.package_folder, "lib", "univalue.dll.lib"), + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + if is_msvc(self) and self.options.shared: + rename(self, os.path.join(self.package_folder, "lib", "univalue.dll.lib"), os.path.join(self.package_folder, "lib", "univalue.lib")) + fix_apple_shared_install_name(self) def package_info(self): + self.cpp_info.set_property("pkg_config_name", "libunivalue") self.cpp_info.libs = ["univalue"] if self.options.shared: self.cpp_info.defines = ["UNIVALUE_SHARED"] - - self.cpp_info.names["pkg_config"] = "univalue" diff --git a/recipes/univalue/all/test_package/CMakeLists.txt b/recipes/univalue/all/test_package/CMakeLists.txt index 7604497b1046c..2d1b2f3c62e86 100644 --- a/recipes/univalue/all/test_package/CMakeLists.txt +++ b/recipes/univalue/all/test_package/CMakeLists.txt @@ -1,9 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) +project(test_package LANGUAGES CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(univalue REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE univalue::univalue) diff --git a/recipes/univalue/all/test_package/conanfile.py b/recipes/univalue/all/test_package/conanfile.py index 24334d23c0241..0a6bc68712d90 100644 --- a/recipes/univalue/all/test_package/conanfile.py +++ b/recipes/univalue/all/test_package/conanfile.py @@ -1,9 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools -class apriltagTestConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -11,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/univalue/all/test_package/test_package.cpp b/recipes/univalue/all/test_package/test_package.cpp index 2d9136262e86c..06e3067282011 100644 --- a/recipes/univalue/all/test_package/test_package.cpp +++ b/recipes/univalue/all/test_package/test_package.cpp @@ -1,4 +1,4 @@ -#include "univalue.h" +#include #include #include @@ -16,6 +16,6 @@ int main(int argc, char *argv[]) parents.pushKV("p1", package1); parents.pushKV("p2", package2); - std::cout << parents.write(2); + std::cout << parents.write(2) << std::endl; return EXIT_SUCCESS; } diff --git a/recipes/univalue/all/test_v1_package/CMakeLists.txt b/recipes/univalue/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/univalue/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/univalue/all/test_v1_package/conanfile.py b/recipes/univalue/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/univalue/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/unordered_dense/all/conandata.yml b/recipes/unordered_dense/all/conandata.yml new file mode 100644 index 0000000000000..8851bfc8570ec --- /dev/null +++ b/recipes/unordered_dense/all/conandata.yml @@ -0,0 +1,28 @@ +sources: + "3.1.0": + url: "https://github.com/martinus/unordered_dense/archive/v3.1.0.tar.gz" + sha256: "adf8670bf494a84f1148687375ac568e2990167b8ced3cc1e5bacc9f6c49f272" + "3.0.2": + url: "https://github.com/martinus/unordered_dense/archive/v3.0.2.tar.gz" + sha256: "0c0b874e9682cce3c75a1152308bfbb108538aaf1e90824d7789e2b64122520b" + "3.0.0": + url: "https://github.com/martinus/unordered_dense/archive/v3.0.0.tar.gz" + sha256: "e73452d7c1e274b4a15b553c0904f1de4bcfa61b00514acd1eaad7deac805ef0" + "2.0.1": + url: "https://github.com/martinus/unordered_dense/archive/v2.0.1.tar.gz" + sha256: "450d53bd8709f9476702a3c4975bf6e40d66059b25b125e480534228d7f5616d" + "2.0.0": + url: "https://github.com/martinus/unordered_dense/archive/v2.0.0.tar.gz" + sha256: "e838bdcf380a1aeb6f1fee17fbdf59d7a14b6b9fb6dfca32981e4cbd60739d20" + "1.4.0": + url: "https://github.com/martinus/unordered_dense/archive/v1.4.0.tar.gz" + sha256: "36b6bfe2fe2633f9d9c537b9b808b4be6b77ff51c66d370d855f477517bc3bc9" + "1.3.3": + url: "https://github.com/martinus/unordered_dense/archive/v1.3.3.tar.gz" + sha256: "621a984d7f1de156d3078ecb5e1252bcc2ebc875de6eb6b8635f6c2a0898e496" + "1.3.2": + url: "https://github.com/martinus/unordered_dense/archive/v1.3.2.tar.gz" + sha256: "f12db3b93f31f7f20f4d8cac6adc551f6ae17a5b9a16040abeee427f54427953" + "1.3.1": + url: "https://github.com/martinus/unordered_dense/archive/refs/tags/v1.3.1.tar.gz" + sha256: "d393168833d6609c9eaf54a05b19fc3120f68b85feffb282ab225119a86df1d4" diff --git a/recipes/unordered_dense/all/conanfile.py b/recipes/unordered_dense/all/conanfile.py new file mode 100644 index 0000000000000..574ac33f1668f --- /dev/null +++ b/recipes/unordered_dense/all/conanfile.py @@ -0,0 +1,72 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.51.3" + + +class PackageConan(ConanFile): + name = "unordered_dense" + description = "A fast & densely stored hashmap and hashset based on robin-hood backward shift deletion" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/martinus/unordered_dense" + topics = ("unordered_map", "unordered_set", "hashmap", "hashset", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _minimum_cpp_standard(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15.7", + "msvc": "191", + "gcc": "7", + "clang": "7", + "apple-clang": "11", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.info.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.get_safe("compiler.version")) < minimum_version: + raise ConanInvalidConfiguration(f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include", "ankerl"), src=os.path.join(self.source_folder, "include", "ankerl")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_file_name", "unordered_dense") + self.cpp_info.set_property("cmake_target_name", "unordered_dense::unordered_dense") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "unordered_dense" + self.cpp_info.filenames["cmake_find_package_multi"] = "unordered_dense" + self.cpp_info.names["cmake_find_package"] = "unordered_dense" + self.cpp_info.names["cmake_find_package_multi"] = "unordered_dense" diff --git a/recipes/unordered_dense/all/test_package/CMakeLists.txt b/recipes/unordered_dense/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..b9de8205fed9d --- /dev/null +++ b/recipes/unordered_dense/all/test_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package LANGUAGES CXX) + +find_package(unordered_dense REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE unordered_dense::unordered_dense) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/unordered_dense/all/test_package/conanfile.py b/recipes/unordered_dense/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/unordered_dense/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/unordered_dense/all/test_package/test_package.cpp b/recipes/unordered_dense/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..428f955bc9dea --- /dev/null +++ b/recipes/unordered_dense/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +// sited from https://github.com/martinus/unordered_dense/blob/main/example/main.cpp +#include + +#include + +auto main() -> int { + auto map = ankerl::unordered_dense::map(); + map[123] = "hello"; + map[987] = "world!"; + + for (auto const& [key, val] : map) { + std::cout << key << " => " << val << std::endl; + } +} diff --git a/recipes/unordered_dense/all/test_v1_package/CMakeLists.txt b/recipes/unordered_dense/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..2a9b48732268c --- /dev/null +++ b/recipes/unordered_dense/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/unordered_dense/all/test_v1_package/conanfile.py b/recipes/unordered_dense/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/unordered_dense/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/unordered_dense/config.yml b/recipes/unordered_dense/config.yml new file mode 100644 index 0000000000000..f1e96ac4a83f2 --- /dev/null +++ b/recipes/unordered_dense/config.yml @@ -0,0 +1,19 @@ +versions: + "3.1.0": + folder: all + "3.0.2": + folder: all + "3.0.0": + folder: all + "2.0.1": + folder: all + "2.0.0": + folder: all + "1.4.0": + folder: all + "1.3.3": + folder: all + "1.3.2": + folder: all + "1.3.1": + folder: all diff --git a/recipes/uriparser/all/conandata.yml b/recipes/uriparser/all/conandata.yml index a62cf79ae8ff0..2e0f68c6098de 100644 --- a/recipes/uriparser/all/conandata.yml +++ b/recipes/uriparser/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.9.7": + url: "https://github.com/uriparser/uriparser/releases/download/uriparser-0.9.7/uriparser-0.9.7.tar.xz" + sha256: "1ddae35cb3cc2c36e8199829d46f1c7f8b222e74a723fdae67ec8561e1ac5a39" "0.9.6": url: "https://github.com/uriparser/uriparser/releases/download/uriparser-0.9.6/uriparser-0.9.6.tar.xz" sha256: "a288a06668528c19e85e38c508335938e1de6fdd4b8f2072401b4533fcebf644" diff --git a/recipes/uriparser/all/conanfile.py b/recipes/uriparser/all/conanfile.py index 9418ef35de4dd..79bc7cd3ce078 100644 --- a/recipes/uriparser/all/conanfile.py +++ b/recipes/uriparser/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir from conan.tools.microsoft import is_msvc, msvc_runtime_flag import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class UriparserConan(ConanFile): @@ -30,8 +30,7 @@ class UriparserConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,15 +38,18 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass try: - del self.settings.compiler.libcxx + del self.settings.compiler.libcxx except Exception: - pass + pass try: - del self.settings.compiler.cppstd + del self.settings.compiler.cppstd except Exception: - pass + pass def layout(self): cmake_layout(self, src_folder="src") @@ -93,6 +95,3 @@ def package_info(self): self.cpp_info.defines.append("URI_NO_ANSI") if not self.options.with_wchar: self.cpp_info.defines.append("URI_NO_UNICODE") - - # TODO: to remove in conan v2 once pkg_config generator removed - self.cpp_info.names["pkg_config"] = "liburiparser" diff --git a/recipes/uriparser/all/test_package/conanfile.py b/recipes/uriparser/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/uriparser/all/test_package/conanfile.py +++ b/recipes/uriparser/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/uriparser/all/test_v1_package/conanfile.py b/recipes/uriparser/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/uriparser/all/test_v1_package/conanfile.py +++ b/recipes/uriparser/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/uriparser/config.yml b/recipes/uriparser/config.yml index 8b143dad4006e..983b5479ac5be 100644 --- a/recipes/uriparser/config.yml +++ b/recipes/uriparser/config.yml @@ -1,4 +1,6 @@ versions: + "0.9.7": + folder: "all" "0.9.6": folder: "all" "0.9.5": diff --git a/recipes/usockets/all/conandata.yml b/recipes/usockets/all/conandata.yml index 6134ecad920ae..5b4a41335be2a 100644 --- a/recipes/usockets/all/conandata.yml +++ b/recipes/usockets/all/conandata.yml @@ -1,34 +1,78 @@ sources: - "0.4.0": - url: "https://github.com/uNetworking/uSockets/archive/v0.4.0.tar.gz" - sha256: "f9f15b395def578cc79a5b32abc64fa9cff5dac873062911f515b984b90f7cc2" - "0.6.0": - url: "https://github.com/uNetworking/uSockets/archive/v0.6.0.tar.gz" - sha256: "999387d3653b2bc663c34aa7e973358ac4c4897dccd644553a5caab843a978a1" - "0.7.1": - url: "https://github.com/uNetworking/uSockets/archive/v0.7.1.tar.gz" - sha256: "1fdc5376e5ef9acf4fb673fcd5fd191da9b8d59a319e9ec7922872070a3dd21c" + "0.8.5": + url: "https://github.com/uNetworking/uSockets/archive/v0.8.5.tar.gz" + sha256: "c52c98b7ff2c24534c17ad97d5fea8ca0cb7ff38cc933b8d08bac6e498a2ea6b" + "0.8.3": + url: "https://github.com/uNetworking/uSockets/archive/v0.8.3.tar.gz" + sha256: "2f96a26365b87badbea2360a82521a382c0c3ee2dcf4f32c79b11d0cb1989a53" + "0.8.2": + url: "https://github.com/uNetworking/uSockets/archive/v0.8.2.tar.gz" + sha256: "c17fc99773a30552cdd7741ff98af177eeecb26b89fc38011b430956b3b2eca5" "0.8.1": url: "https://github.com/uNetworking/uSockets/archive/v0.8.1.tar.gz" sha256: "3b33b5924a92577854e2326b3e2d393849ec00beb865a1271bf24c0f210cc1d6" -patches: + "0.7.1": + url: "https://github.com/uNetworking/uSockets/archive/v0.7.1.tar.gz" + sha256: "1fdc5376e5ef9acf4fb673fcd5fd191da9b8d59a319e9ec7922872070a3dd21c" + "0.6.0": + url: "https://github.com/uNetworking/uSockets/archive/v0.6.0.tar.gz" + sha256: "999387d3653b2bc663c34aa7e973358ac4c4897dccd644553a5caab843a978a1" "0.4.0": - - patch_file: "patches/0001-makefile.patch" + url: "https://github.com/uNetworking/uSockets/archive/v0.4.0.tar.gz" + sha256: "f9f15b395def578cc79a5b32abc64fa9cff5dac873062911f515b984b90f7cc2" +patches: + "0.8.5": + - patch_file: "patches/0001-makefile_0.8.3.patch" base_path: "source_subfolder" - - patch_file: "patches/0002-vcxproj.patch" + patch_description: "remove lto options" + patch_type: "portability" + "0.8.3": + - patch_file: "patches/0001-makefile_0.8.3.patch" base_path: "source_subfolder" - "0.6.0": + patch_description: "remove lto options" + patch_type: "portability" + "0.8.2": + - patch_file: "patches/0001-makefile_0.8.2.patch" + base_path: "source_subfolder" + patch_description: "remove lto options" + patch_type: "portability" + - patch_file: "patches/0002-vcxproj_0.8.1.patch" + base_path: "source_subfolder" + patch_description: "build static library" + patch_type: "conan" + "0.8.1": + - patch_file: "patches/0001-makefile_0.8.1.patch" + base_path: "source_subfolder" + patch_description: "remove lto options" + patch_type: "portability" + - patch_file: "patches/0002-vcxproj_0.8.1.patch" + base_path: "source_subfolder" + patch_description: "build static library" + patch_type: "conan" + "0.7.1": - patch_file: "patches/0001-makefile_0.6.0.patch" base_path: "source_subfolder" + patch_description: "remove lto options" + patch_type: "portability" - patch_file: "patches/0002-vcxproj.patch" base_path: "source_subfolder" - "0.7.1": + patch_description: "build static library" + patch_type: "conan" + "0.6.0": - patch_file: "patches/0001-makefile_0.6.0.patch" base_path: "source_subfolder" + patch_description: "remove lto options" + patch_type: "portability" - patch_file: "patches/0002-vcxproj.patch" base_path: "source_subfolder" - "0.8.1": - - patch_file: "patches/0001-makefile_0.8.1.patch" + patch_description: "build static library" + patch_type: "conan" + "0.4.0": + - patch_file: "patches/0001-makefile.patch" base_path: "source_subfolder" - - patch_file: "patches/0002-vcxproj_0.8.1.patch" + patch_description: "remove lto options" + patch_type: "portability" + - patch_file: "patches/0002-vcxproj.patch" base_path: "source_subfolder" + patch_description: "build static library" + patch_type: "conan" diff --git a/recipes/usockets/all/conanfile.py b/recipes/usockets/all/conanfile.py index 21f31328b479e..09208942cd97e 100644 --- a/recipes/usockets/all/conanfile.py +++ b/recipes/usockets/all/conanfile.py @@ -1,35 +1,47 @@ -import os +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, chdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc +from conan.errors import ConanInvalidConfiguration +from conans import MSBuild, AutoToolsBuildEnvironment +from conans.tools import vcvars, environment_append, unix_path, get_env -from conans import ConanFile, tools, MSBuild, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +import os +import contextlib +required_conan_version = ">=1.52.0" class UsocketsConan(ConanFile): name = "usockets" - url = "https://github.com/conan-io/conan-center-index" description = "Miniscule cross-platform eventing, networking & crypto for async applications" license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/uNetworking/uSockets" - topics = ("conan", "socket", "network", "web") + topics = ("socket", "network", "web") settings = "os", "arch", "compiler", "build_type" - options = {"fPIC": [True, False], - "with_ssl": [False, "openssl", "wolfssl"], - "with_libuv": [True, False, "deprecated"], - "eventloop": ["syscall", "libuv", "gcd", "boost"]} - default_options = {"fPIC": True, - "with_ssl": False, - "with_libuv": "deprecated", - "eventloop": "syscall"} - exports_sources = "patches/**" + options = { + "fPIC": [True, False], + "with_ssl": [False, "openssl", "wolfssl"], + "eventloop": ["syscall", "libuv", "gcd", "boost"], + } + default_options = { + "fPIC": True, + "with_ssl": False, + "eventloop": "syscall", + } @property - def _source_subfolder(self): - return "source_subfolder" + def _minimum_cpp_standard(self): + version = False + if self.options.eventloop == "boost": + version = "14" - def config_options(self): - if self.settings.os == "Windows": - del self.options.fPIC - self.options.eventloop = "libuv" + # OpenSSL wrapper of uSockets uses C++17 features. + if self.options.with_ssl == "openssl": + version = "17" + + return version def _minimum_compilers_version(self, cppstd): standards = { @@ -49,93 +61,120 @@ def _minimum_compilers_version(self, cppstd): return standards.get(cppstd) or {} @property - def _cppstd(self): - version = False - if self.options.eventloop == "boost": - version = "14" + def _source_subfolder(self): + return "source_subfolder" - # OpenSSL wrapper of uSockets uses C++17 features. - if self.options.with_ssl == "openssl": - version = "17" + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) - return version + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + self.options.eventloop = "libuv" def validate(self): - if self.options.eventloop == "syscall" and self.settings.os == "Windows": + if self.options.eventloop == "syscall" and self.info.settings.os == "Windows": raise ConanInvalidConfiguration("syscall is not supported on Windows") - if self.options.eventloop == "gcd" and (self.settings.os != "Linux" or self.settings.compiler != "clang"): + if self.options.eventloop == "gcd" and (self.info.settings.os != "Linux" or self.info.settings.compiler != "clang"): raise ConanInvalidConfiguration("eventloop=gcd is only supported on Linux with clang") - if tools.Version(self.version) < "0.8.0" and self.options.eventloop not in ("syscall", "libuv", "gcd"): + if Version(self.version) < "0.8.0" and self.options.eventloop not in ("syscall", "libuv", "gcd"): raise ConanInvalidConfiguration(f"eventloop={self.options.eventloop} is not supported with {self.name}/{self.version}") - if tools.Version(self.version) >= "0.5.0" and self.options.with_ssl == "wolfssl": + if Version(self.version) >= "0.5.0" and self.options.with_ssl == "wolfssl": raise ConanInvalidConfiguration(f"with_ssl={self.options.with_ssl} is not supported with {self.name}/{self.version}. https://github.com/uNetworking/uSockets/issues/147") if self.options.with_ssl == "wolfssl" and not self.options["wolfssl"].opensslextra: raise ConanInvalidConfiguration("wolfssl needs opensslextra option enabled for usockets") - if not self.options.with_libuv and self.settings.os == "Windows": - raise ConanInvalidConfiguration("uSockets in Windows uses libuv by default. After 0.8.0, you can choose boost.asio by eventloop=boost.") - - cppstd = self._cppstd + cppstd = self._minimum_cpp_standard if not cppstd: return - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, cppstd) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, cppstd) - minimum_version = self._minimum_compilers_version(cppstd).get(str(self.settings.compiler), False) + minimum_version = self._minimum_compilers_version(cppstd).get(str(self.info.settings.compiler), False) if minimum_version: - if tools.Version(self.settings.compiler.version) < minimum_version: + if Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration("{} requires C++{}, which your compiler does not support.".format(self.name, cppstd)) else: self.output.warn("{0} requires C++{1}. Your compiler is unknown. Assuming it supports C++{1}.".format(self.name, cppstd)) def configure(self): - if bool(self._cppstd) == False: - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx - - if self.options.with_libuv != "deprecated": - self.output.warn("with_libuv is deprecated, use 'eventloop' instead.") - if self.options.with_libuv == True: - self.options.eventloop = "libuv" - else: - self.options.eventloop = "syscall" + if bool(self._minimum_cpp_standard) == False: + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass def requirements(self): if self.options.with_ssl == "openssl": - self.requires("openssl/1.1.1q") + self.requires("openssl/1.1.1s") elif self.options.with_ssl == "wolfssl": - self.requires("wolfssl/5.3.0") + self.requires("wolfssl/5.5.1") if self.options.eventloop == "libuv": - self.requires("libuv/1.44.1") + self.requires("libuv/1.44.2") elif self.options.eventloop == "gcd": self.requires("libdispatch/5.3.2") elif self.options.eventloop == "boost": - self.requires("boost/1.79.0") + self.requires("boost/1.81.0") + + def build_requirements(self): + if self._settings_build.os == "Windows" and not get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + if self.settings.compiler == "Visual Studio": + self.build_requires("automake/1.16.5") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - os.rename("uSockets-%s" % self.version, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) def _patch_sources(self): - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) + apply_conandata_patches(self) def _build_msvc(self): - with tools.chdir(os.path.join(self._source_subfolder)): + with chdir(self, os.path.join(self._source_subfolder)): msbuild = MSBuild(self) msbuild.build(project_file="uSockets.vcxproj", platforms={"x86": "Win32"}) + @contextlib.contextmanager + def _build_context(self): + if is_msvc(self): + with vcvars(self): + env = { + "CC": "{} cl -nologo".format(unix_path(self.deps_user_info["automake"].compile)), + "CXX": "{} cl -nologo".format(unix_path(self.deps_user_info["automake"].compile)), + "CFLAGS": "-{}".format(self.settings.compiler.runtime), + "LD": "link", + "NM": "dumpbin -symbols", + "STRIP": ":", + "AR": "{} lib".format(unix_path(self.deps_user_info["automake"].ar_lib)), + "RANLIB": ":", + } + + if self.options.eventloop == "libuv": + env["CPPFLAGS"] = "-I" + unix_path(self.deps_cpp_info["libuv"].include_paths[0]) + " " + + with environment_append(env): + yield + else: + yield + def _build_configure(self): autotools = AutoToolsBuildEnvironment(self) autotools.fpic = self.options.get_safe("fPIC", False) - with tools.chdir(self._source_subfolder): - args = [] + with chdir(self, self._source_subfolder): + args = ["WITH_LTO=0"] if self.options.with_ssl == "openssl": args.append("WITH_OPENSSL=1") elif self.options.with_ssl == "wolfssl": @@ -148,27 +187,24 @@ def _build_configure(self): elif self.options.eventloop == "boost": args.append("WITH_ASIO=1") - args.extend("{}={}".format(key, value) for key, value in autotools.vars.items()) + args.extend(f"{key}={value}" for key, value in autotools.vars.items()) autotools.make(target="default", args=args) def build(self): self._patch_sources() - if self.settings.compiler == "Visual Studio": + if Version(self.version) < "0.8.3" and is_msvc(self): self._build_msvc() else: - self._build_configure() + with self._build_context(): + self._build_configure() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*.h", src=os.path.join(self._source_subfolder, "src"), dst="include", keep_path=True) - self.copy(pattern="*.a", src=self._source_subfolder, dst="lib", keep_path=False) - self.copy(pattern="*.lib", src=self._source_subfolder, dst="lib", keep_path=False) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self._source_subfolder) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self._source_subfolder, "src"), keep_path=True) + copy(self, pattern="*.a", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) + copy(self, pattern="*.lib", dst=os.path.join(self.package_folder, "lib"), src=self.build_folder, keep_path=False) # drop internal headers - tools.rmdir(os.path.join(self.package_folder, "include", "internal")) - - def package_id(self): - # Deprecated options - del self.info.options.with_libuv + rmdir(self, os.path.join(self.package_folder, "include", "internal")) def package_info(self): self.cpp_info.libs = ["uSockets"] diff --git a/recipes/usockets/all/patches/0001-makefile_0.8.2.patch b/recipes/usockets/all/patches/0001-makefile_0.8.2.patch new file mode 100644 index 0000000000000..aafe333e3b357 --- /dev/null +++ b/recipes/usockets/all/patches/0001-makefile_0.8.2.patch @@ -0,0 +1,39 @@ +diff --git a/Makefile b/Makefile +index 8bf11b3..9577ee7 100644 +--- a/Makefile ++++ b/Makefile +@@ -58,20 +58,20 @@ endif + # By default we build the uSockets.a static library + default: + rm -f *.o +- $(CC) $(CFLAGS) -flto -O3 -c src/*.c src/eventing/*.c src/crypto/*.c ++ $(CC) $(CFLAGS) $(CPPFLAGS) -O3 -c src/*.c src/eventing/*.c src/crypto/*.c + # Also link in Boost Asio support + ifeq ($(WITH_ASIO),1) +- $(CXX) $(CXXFLAGS) -Isrc -std=c++14 -flto -O3 -c src/eventing/asio.cpp ++ $(CXX) $(CXXFLAGS) -Isrc -std=c++14 $(CPPFLAGS) -O3 -c src/eventing/asio.cpp + endif + + # For now we do rely on C++17 for OpenSSL support but we will be porting this work to C11 + ifeq ($(WITH_OPENSSL),1) +- $(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp ++ $(CXX) $(CXXFLAGS) -std=c++17 $(CPPFLAGS) -O3 -c src/crypto/*.cpp + endif + ifeq ($(WITH_BORINGSSL),1) +- $(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp ++ $(CXX) $(CXXFLAGS) -std=c++17 $(CPPFLAGS) -O3 -c src/crypto/*.cpp + endif +- $(AR) rvs uSockets.a *.o ++ $(AR) rvs libuSockets.a *.o + + # BoringSSL needs cmake and golang + .PHONY: boringssl +@@ -81,7 +81,7 @@ boringssl: + # Builds all examples + .PHONY: examples + examples: default +- for f in examples/*.c; do $(CC) -flto -O3 $(CFLAGS) -o $$(basename "$$f" ".c") "$$f" $(LDFLAGS); done ++ for f in examples/*.c; do $(CC) $(CPPFLAGS) -O3 $(CFLAGS) -o $$(basename "$$f" ".c") "$$f" $(LDFLAGS); done + + swift_examples: + swiftc -O -I . examples/swift_http_server/main.swift uSockets.a -o swift_http_server diff --git a/recipes/usockets/all/patches/0001-makefile_0.8.3.patch b/recipes/usockets/all/patches/0001-makefile_0.8.3.patch new file mode 100644 index 0000000000000..5ea7628ad348d --- /dev/null +++ b/recipes/usockets/all/patches/0001-makefile_0.8.3.patch @@ -0,0 +1,40 @@ +diff --git a/Makefile b/Makefile +index f6e2c6b..087d021 100644 +--- a/Makefile ++++ b/Makefile +@@ -63,21 +63,21 @@ endif + # By default we build the uSockets.a static library + default: + rm -f *.o +- $(CC) $(CFLAGS) -O3 -c src/*.c src/eventing/*.c src/crypto/*.c ++ $(CC) $(CFLAGS) $(CPPFLAGS) -O3 -c src/*.c src/eventing/*.c src/crypto/*.c + # Also link in Boost Asio support + ifeq ($(WITH_ASIO),1) +- $(CXX) $(CXXFLAGS) -Isrc -std=c++14 -flto -O3 -c src/eventing/asio.cpp ++ $(CXX) $(CXXFLAGS) -Isrc -std=c++14 $(CPPFLAGS) -O3 -c src/eventing/asio.cpp + endif + + # For now we do rely on C++17 for OpenSSL support but we will be porting this work to C11 + ifeq ($(WITH_OPENSSL),1) +- $(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp ++ $(CXX) $(CXXFLAGS) -std=c++17 $(CPPFLAGS) -O3 -c src/crypto/*.cpp + endif + ifeq ($(WITH_BORINGSSL),1) +- $(CXX) $(CXXFLAGS) -std=c++17 -flto -O3 -c src/crypto/*.cpp ++ $(CXX) $(CXXFLAGS) -std=c++17 $(CPPFLAGS) -O3 -c src/crypto/*.cpp + endif + # Create a static library (try windows, then unix) +- lib.exe /out:uSockets.a *.o || $(AR) rvs uSockets.a *.o ++ lib.exe /out:uSockets.lib *.obj || $(AR) rvs libuSockets.a *.o + + # BoringSSL needs cmake and golang + .PHONY: boringssl +@@ -87,7 +87,7 @@ boringssl: + # Builds all examples + .PHONY: examples + examples: default +- for f in examples/*.c; do $(CC) -O3 $(CFLAGS) -o $$(basename "$$f" ".c")$(EXEC_SUFFIX) "$$f" $(LDFLAGS); done ++ for f in examples/*.c; do $(CC) $(CPPFLAGS) -O3 $(CFLAGS) -o $$(basename "$$f" ".c")$(EXEC_SUFFIX) "$$f" $(LDFLAGS); done + + swift_examples: + swiftc -O -I . examples/swift_http_server/main.swift uSockets.a -o swift_http_server diff --git a/recipes/usockets/all/test_package/CMakeLists.txt b/recipes/usockets/all/test_package/CMakeLists.txt index 196188113685c..8502a8260d7ce 100644 --- a/recipes/usockets/all/test_package/CMakeLists.txt +++ b/recipes/usockets/all/test_package/CMakeLists.txt @@ -1,8 +1,11 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) + +find_package(usockets REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE usockets::usockets) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/usockets/all/test_package/conanfile.py b/recipes/usockets/all/test_package/conanfile.py index bd7165a553cf4..7895db93c24a6 100644 --- a/recipes/usockets/all/test_package/conanfile.py +++ b/recipes/usockets/all/test_package/conanfile.py @@ -1,10 +1,12 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import cross_building +from conans import CMake import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) @@ -12,6 +14,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): + if not cross_building(self): bin_path = os.path.join("bin", "test_package") self.run(bin_path, run_environment=True) diff --git a/recipes/usockets/config.yml b/recipes/usockets/config.yml index ed051b80517fb..c4f53d0a2aff0 100644 --- a/recipes/usockets/config.yml +++ b/recipes/usockets/config.yml @@ -1,9 +1,15 @@ versions: - "0.4.0": + "0.8.5": folder: all - "0.6.0": + "0.8.3": folder: all - "0.7.1": + "0.8.2": folder: all "0.8.1": folder: all + "0.7.1": + folder: all + "0.6.0": + folder: all + "0.4.0": + folder: all diff --git a/recipes/utf8.h/all/conanfile.py b/recipes/utf8.h/all/conanfile.py index 635e886398dd2..3c63ca89d6157 100644 --- a/recipes/utf8.h/all/conanfile.py +++ b/recipes/utf8.h/all/conanfile.py @@ -1,6 +1,9 @@ +from conan import ConanFile +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -import glob -from conans import ConanFile, tools + +required_conan_version = ">=1.50.0" class Utf8HConan(ConanFile): @@ -10,20 +13,27 @@ class Utf8HConan(ConanFile): description = "Single header utf8 string functions for C and C++" topics = ("utf8", "unicode", "text") license = "Unlicense" + settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("utf8.h-*")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("utf8.h", dst="include", src=self._source_subfolder) - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) + copy(self, "utf8.h", src=self.source_folder, dst=os.path.join(self.package_folder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.resdirs = [] diff --git a/recipes/utf8.h/all/test_package/CMakeLists.txt b/recipes/utf8.h/all/test_package/CMakeLists.txt index 6fec0df294d0a..59a397c341a04 100644 --- a/recipes/utf8.h/all/test_package/CMakeLists.txt +++ b/recipes/utf8.h/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +project(test_package LANGUAGES CXX) find_package(utf8.h REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} utf8.h::utf8.h) +target_link_libraries(${PROJECT_NAME} PRIVATE utf8.h::utf8.h) diff --git a/recipes/utf8.h/all/test_package/conanfile.py b/recipes/utf8.h/all/test_package/conanfile.py index abcaeed3f89b6..0a6bc68712d90 100644 --- a/recipes/utf8.h/all/test_package/conanfile.py +++ b/recipes/utf8.h/all/test_package/conanfile.py @@ -1,10 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/utf8.h/all/test_v1_package/CMakeLists.txt b/recipes/utf8.h/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..e35aca1f7a135 --- /dev/null +++ b/recipes/utf8.h/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(utf8.h REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE utf8.h::utf8.h) diff --git a/recipes/utf8.h/all/test_v1_package/conanfile.py b/recipes/utf8.h/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/utf8.h/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/utf8proc/all/CMakeLists.txt b/recipes/utf8proc/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f..0000000000000 --- a/recipes/utf8proc/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/utf8proc/all/conandata.yml b/recipes/utf8proc/all/conandata.yml index 51d38ebd768e5..2e408e9011b37 100644 --- a/recipes/utf8proc/all/conandata.yml +++ b/recipes/utf8proc/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2.8.0": + url: "https://github.com/JuliaStrings/utf8proc/archive/v2.8.0.tar.gz" + sha256: "a0a60a79fe6f6d54e7d411facbfcc867a6e198608f2cd992490e46f04b1bcecc" "2.7.0": url: "https://github.com/JuliaStrings/utf8proc/archive/v2.7.0.tar.gz" sha256: "4bb121e297293c0fd55f08f83afab6d35d48f0af4ecc07523ad8ec99aa2b12a1" diff --git a/recipes/utf8proc/all/conanfile.py b/recipes/utf8proc/all/conanfile.py index 66de4c17f64fc..698e23be72ec9 100644 --- a/recipes/utf8proc/all/conanfile.py +++ b/recipes/utf8proc/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import CMake, ConanFile, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, rmdir +from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" + class Utf8ProcConan(ConanFile): name = "utf8proc" @@ -10,8 +14,7 @@ class Utf8ProcConan(ConanFile): description = "A clean C library for processing UTF-8 Unicode data" topics = ("utf", "utf8", "unicode", "text") license = "MIT expat" - exports_sources = "CMakeLists.txt" - generators = "cmake" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -22,48 +25,50 @@ class Utf8ProcConan(ConanFile): "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.md", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): - self.cpp_info.names["pkg_config"] = "libutf8proc" - self.cpp_info.libs = ["utf8proc_static" if self.settings.compiler == "Visual Studio" and not self.options.shared else "utf8proc"] + self.cpp_info.set_property("pkg_config_name", "libutf8proc") + suffix = "_static" if is_msvc(self) and not self.options.shared else "" + self.cpp_info.libs = [f"utf8proc{suffix}"] if not self.options.shared: self.cpp_info.defines = ["UTF8PROC_STATIC"] diff --git a/recipes/utf8proc/all/test_package/CMakeLists.txt b/recipes/utf8proc/all/test_package/CMakeLists.txt index 3a215a752bdf4..55f8f30732e29 100644 --- a/recipes/utf8proc/all/test_package/CMakeLists.txt +++ b/recipes/utf8proc/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +find_package(utf8proc REQUIRED CONFIG) -find_package(utf8proc CONFIG REQUIRED) - -add_executable(${PROJECT_NAME} ${PROJECT_NAME}.c) -target_link_libraries(${PROJECT_NAME} utf8proc::utf8proc) +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE utf8proc::utf8proc) diff --git a/recipes/utf8proc/all/test_package/conanfile.py b/recipes/utf8proc/all/test_package/conanfile.py index 9b63bd176646b..0a6bc68712d90 100644 --- a/recipes/utf8proc/all/test_package/conanfile.py +++ b/recipes/utf8proc/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/utf8proc/all/test_v1_package/CMakeLists.txt b/recipes/utf8proc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..93470a5a40dd5 --- /dev/null +++ b/recipes/utf8proc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(utf8proc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE utf8proc::utf8proc) diff --git a/recipes/utf8proc/all/test_v1_package/conanfile.py b/recipes/utf8proc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/utf8proc/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/utf8proc/config.yml b/recipes/utf8proc/config.yml index 89fa84c772840..44b916f7f7e88 100644 --- a/recipes/utf8proc/config.yml +++ b/recipes/utf8proc/config.yml @@ -1,4 +1,6 @@ versions: + "2.8.0": + folder: all "2.7.0": folder: all "2.6.1": diff --git a/recipes/utfcpp/all/conandata.yml b/recipes/utfcpp/all/conandata.yml index be1055de8e6ad..f435f56f7acf1 100644 --- a/recipes/utfcpp/all/conandata.yml +++ b/recipes/utfcpp/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "3.2.3": + url: "https://github.com/nemtrif/utfcpp/archive/v3.2.3.tar.gz" + sha256: "3ba9b0dbbff08767bdffe8f03b10e596ca351228862722e4c9d4d126d2865250" + "3.2.2": + url: "https://github.com/nemtrif/utfcpp/archive/v3.2.2.tar.gz" + sha256: "6f81e7cb2be2a6a9109a8a0cb7dc39ec947f1bcdb5dfa4a660e11a23face19f5" "3.2.1": url: "https://github.com/nemtrif/utfcpp/archive/refs/tags/v3.2.1.tar.gz" sha256: "8d6aa7d77ad0abb35bb6139cb9a33597ac4c5b33da6a004ae42429b8598c9605" diff --git a/recipes/utfcpp/all/conanfile.py b/recipes/utfcpp/all/conanfile.py index 63d01a72ddc94..2d5820625e176 100644 --- a/recipes/utfcpp/all/conanfile.py +++ b/recipes/utfcpp/all/conanfile.py @@ -61,9 +61,7 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "utf8cpp") self.cpp_info.includedirs.append(os.path.join("include", "utf8cpp")) self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.names["cmake_find_package"] = "utf8cpp" diff --git a/recipes/utfcpp/all/test_v1_package/CMakeLists.txt b/recipes/utfcpp/all/test_v1_package/CMakeLists.txt index d476d50d29d2f..be00a8c7f57c7 100644 --- a/recipes/utfcpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/utfcpp/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(utf8cpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE utf8cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/utfcpp/config.yml b/recipes/utfcpp/config.yml index 2894a4f98e534..00df0fb881cb8 100644 --- a/recipes/utfcpp/config.yml +++ b/recipes/utfcpp/config.yml @@ -1,4 +1,8 @@ versions: + "3.2.3": + folder: all + "3.2.2": + folder: all "3.2.1": folder: all "3.2": diff --git a/recipes/uwebsockets/all/conandata.yml b/recipes/uwebsockets/all/conandata.yml index e4e397463ff7a..d0d6f814547b2 100644 --- a/recipes/uwebsockets/all/conandata.yml +++ b/recipes/uwebsockets/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "20.36.0": + url: "https://github.com/uNetworking/uWebSockets/archive/v20.36.0.tar.gz" + sha256: "cda266f7ed6abe67ef3cae6e223a580fe5091db9156c1f4123ee328ae21511c9" + "20.17.0": + url: "https://github.com/uNetworking/uWebSockets/archive/v20.17.0.tar.gz" + sha256: "62027b0b847563bcc65a760045dc4233328229fc551f97fe5814e518e272141c" "20.14.0": url: "https://github.com/uNetworking/uWebSockets/archive/v20.14.0.tar.gz" sha256: "15cf995844a930c9a36747e8d714b94ff886b6814b5d4e3b3ee176f05681cccc" diff --git a/recipes/uwebsockets/all/conanfile.py b/recipes/uwebsockets/all/conanfile.py index 2b490e7f28dab..13c1e737124b8 100644 --- a/recipes/uwebsockets/all/conanfile.py +++ b/recipes/uwebsockets/all/conanfile.py @@ -1,18 +1,20 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.52.0" class UwebsocketsConan(ConanFile): name = "uwebsockets" - url = "https://github.com/conan-io/conan-center-index" description = "Simple, secure & standards compliant web server for the most demanding of applications" license = "Apache-2.0" + url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/uNetworking/uWebSockets" - topics = ("websocket", "network", "server") - + topics = ("websocket", "network", "server", "header-only") settings = "os", "arch", "compiler", "build_type" options = { "with_zlib": [True, False], @@ -22,91 +24,85 @@ class UwebsocketsConan(ConanFile): "with_zlib": True, "with_libdeflate": False, } - no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "15", + "msvc": "191", + "gcc": "7" if Version(self.version) < "20.11.0" else "8", + "clang": "5" if Version(self.version) < "20.11.0" else "7", + "apple-clang": "10", + } def config_options(self): # libdeflate is not supported before 19.0.0 - if tools.Version(self.version) < "19.0.0": + if Version(self.version) < "19.0.0": del self.options.with_libdeflate + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.options.get_safe("with_libdeflate"): - self.requires("libdeflate/1.10") + self.requires("libdeflate/1.14") - if tools.Version(self.version) >= "19.0.0": + if Version(self.version) > "20.17.0": + self.requires("usockets/0.8.5") + elif Version(self.version) >= "20.15.0": + self.requires("usockets/0.8.2") + elif Version(self.version) >= "19.0.0": self.requires("usockets/0.8.1") else: self.requires("usockets/0.4.0") def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): - minimal_cpp_standard = "17" - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, minimal_cpp_standard) - - minimal_version = { - "Visual Studio": "15", - "gcc": "7" if tools.Version(self.version) < "20.11.0" else "8", - "clang": "5" if tools.Version(self.version) < "20.11.0" else "7", - "apple-clang": "10", - } - - compiler = str(self.settings.compiler) - if compiler not in minimal_version: - self.output.warn( - "%s recipe lacks information about the %s compiler standard version support" - % (self.name, compiler) - ) - self.output.warn( - "%s requires a compiler that supports at least C++%s" - % (self.name, minimal_cpp_standard) - ) - return - - version = tools.Version(self.settings.compiler.version) - if version < minimal_version[compiler]: + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: raise ConanInvalidConfiguration( - "%s requires a compiler that supports at least C++%s" - % (self.name, minimal_cpp_standard) + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." ) - if tools.Version(self.version) >= "20.14.0" and self.settings.compiler == "clang" and str(self.settings .compiler.libcxx) == "libstdc++": + if Version(self.version) >= "20.14.0" and self.settings.compiler == "clang" and str(self.settings .compiler.libcxx) == "libstdc++": raise ConanInvalidConfiguration("{} needs recent libstdc++ with charconv.".format(self.name)) def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy( + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, pattern="*.h", - src=os.path.join(self._source_subfolder, "src"), - dst=os.path.join("include", "uWebSockets"), + src=os.path.join(self.source_folder, "src"), + dst=os.path.join(self.package_folder, "include", "uWebSockets"), keep_path=False, ) - self.copy( + copy(self, pattern="*.hpp", - src=os.path.join(self._source_subfolder, "src", "f2"), - dst=os.path.join("include", "uWebSockets", "f2"), + src=os.path.join(self.source_folder, "src", "f2"), + dst=os.path.join(self.package_folder, "include", "uWebSockets", "f2"), keep_path=False, ) def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] - self.cpp_info.includedirs.append(os.path.join("include", "uWebSockets")) self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] + if not self.options.with_zlib: self.cpp_info.defines.append("UWS_NO_ZLIB") if self.options.get_safe("with_libdeflate"): self.cpp_info.defines.append("UWS_USE_LIBDEFLATE") + + self.cpp_info.includedirs.append(os.path.join("include", "uWebSockets")) diff --git a/recipes/uwebsockets/all/test_package/CMakeLists.txt b/recipes/uwebsockets/all/test_package/CMakeLists.txt index 01d361da61644..38145240aeafa 100644 --- a/recipes/uwebsockets/all/test_package/CMakeLists.txt +++ b/recipes/uwebsockets/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) +cmake_minimum_required(VERSION 3.8) project(test_package) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(uwebsockets CONFIG REQUIRED) +find_package(uwebsockets REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} uwebsockets::uwebsockets) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE uwebsockets::uwebsockets) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/uwebsockets/all/test_package/conanfile.py b/recipes/uwebsockets/all/test_package/conanfile.py index 38f4483872d47..e845ae751a301 100644 --- a/recipes/uwebsockets/all/test_package/conanfile.py +++ b/recipes/uwebsockets/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/uwebsockets/all/test_v1_package/CMakeLists.txt b/recipes/uwebsockets/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/uwebsockets/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/uwebsockets/all/test_v1_package/conanfile.py b/recipes/uwebsockets/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/uwebsockets/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/uwebsockets/config.yml b/recipes/uwebsockets/config.yml index b3ad6496af80b..be1e8815a9c32 100644 --- a/recipes/uwebsockets/config.yml +++ b/recipes/uwebsockets/config.yml @@ -1,4 +1,8 @@ versions: + "20.36.0": + folder: all + "20.17.0": + folder: all "20.14.0": folder: all "20.9.0": diff --git a/recipes/v-hacd/all/conandata.yml b/recipes/v-hacd/all/conandata.yml new file mode 100644 index 0000000000000..730e7d62d1b90 --- /dev/null +++ b/recipes/v-hacd/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "4.1.0": + url: "https://github.com/kmammou/v-hacd/archive/refs/tags/v4.1.0.tar.gz" + sha256: "9fe895cd10ec995d2171b11bde97aaaa221b418a3aaed0f5d9a068ae057d626b" diff --git a/recipes/v-hacd/all/conanfile.py b/recipes/v-hacd/all/conanfile.py new file mode 100644 index 0000000000000..0121a2fed52b8 --- /dev/null +++ b/recipes/v-hacd/all/conanfile.py @@ -0,0 +1,60 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.50.0" + + +class VhacdConan(ConanFile): + name = "v-hacd" + description = "The V-HACD library decomposes a 3D surface into a set of \"near\" convex parts." + license = "BSD-3-Clause" + topics = ("3d", "mesh", "shape", "decomposition", "convex") + homepage = "https://github.com/kmammou/v-hacd" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return "11" + + @property + def _compilers_minimum_version(self): + return { + "gcc": "6", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.h", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/v-hacd/all/test_package/CMakeLists.txt b/recipes/v-hacd/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..188e6c3aff9e2 --- /dev/null +++ b/recipes/v-hacd/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(v-hacd REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE v-hacd::v-hacd) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/v-hacd/all/test_package/conanfile.py b/recipes/v-hacd/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/v-hacd/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/v-hacd/all/test_package/test_package.cpp b/recipes/v-hacd/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..08b411c10dff9 --- /dev/null +++ b/recipes/v-hacd/all/test_package/test_package.cpp @@ -0,0 +1,9 @@ +#define ENABLE_VHACD_IMPLEMENTATION 1 +#define VHACD_DISABLE_THREADING 1 +#include + +int main() { + VHACD::IVHACD *iface = VHACD::CreateVHACD(); + iface->Release(); + return 0; +} diff --git a/recipes/v-hacd/all/test_v1_package/CMakeLists.txt b/recipes/v-hacd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/v-hacd/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/v-hacd/all/test_v1_package/conanfile.py b/recipes/v-hacd/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/v-hacd/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/v-hacd/config.yml b/recipes/v-hacd/config.yml new file mode 100644 index 0000000000000..702888c159594 --- /dev/null +++ b/recipes/v-hacd/config.yml @@ -0,0 +1,3 @@ +versions: + "4.1.0": + folder: all diff --git a/recipes/vaapi/all/conanfile.py b/recipes/vaapi/all/conanfile.py index 588e9fe71b361..756d5ef4595be 100644 --- a/recipes/vaapi/all/conanfile.py +++ b/recipes/vaapi/all/conanfile.py @@ -1,5 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.system import package_manager +from conans import tools + +required_conan_version = ">=1.47" class SysConfigVAAPIConan(ConanFile): @@ -10,7 +14,11 @@ class SysConfigVAAPIConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://01.org/linuxmedia/vaapi" license = "MIT" - settings = {"os": ["Linux", "FreeBSD"]} + settings = "os", "arch", "compiler", "build_type" + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def package_id(self): self.info.header_only() @@ -36,24 +44,23 @@ def _fill_cppinfo_from_pkgconfig(self, name): self.cpp_info.cxxflags.extend(cflags) def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_yum: - packages = ["libva-devel"] - elif tools.os_info.with_apt: - packages = ["libva-dev"] - elif tools.os_info.with_pacman: - packages = ["libva"] - elif tools.os_info.with_zypper: - packages = ["libva-devel"] - else: - self.output.warn("Don't know how to install %s for your distro." % self.name) - elif tools.os_info.is_freebsd and self.settings.os == "FreeBSD": - packages = ["libva"] - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify') - for p in packages: - package_tool.install(update=True, packages=p) + dnf = package_manager.Dnf(self) + dnf.install(["libva-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["libva-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + apt.install(["libva-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["libva"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["libva-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install(["libva"], update=True, check=True) def package_info(self): self.cpp_info.includedirs = [] diff --git a/recipes/valijson/all/conandata.yml b/recipes/valijson/all/conandata.yml index 24c9e08a4b434..7d91b8058deb9 100644 --- a/recipes/valijson/all/conandata.yml +++ b/recipes/valijson/all/conandata.yml @@ -1,14 +1,10 @@ sources: + "1.0": + url: "https://github.com/tristanpenman/valijson/archive/v1.0.tar.gz" + sha256: "6b9f0bc89880feb3fe09aa469cd81f6168897d2fbb4e715853da3b94afd3779a" "0.7": url: "https://github.com/tristanpenman/valijson/archive/v0.7.tar.gz" sha256: "bc24736709acfb252a5fdcb5145f1f2670c7aecaba3356f6f8ba54903800fa5c" "0.6": - url: "https://github.com/tristanpenman/valijson/archive/v0.6.zip" - sha256: d655dd7ca502978238e72a4febcd064cb1ffaece18cd5d78c7f17df420387b59 - "0.3": - url: "https://github.com/tristanpenman/valijson/archive/v0.3.zip" - sha256: 76f1ad4800fb730b258a6272dfe738b0695101cbbb4e72f9ab75e33b2a90262e -patches: - "0.3": - - patch_file: "patches/nlohmann_json.patch" - base_path: "source_subfolder" + url: "https://github.com/tristanpenman/valijson/archive/v0.6.tar.gz" + sha256: "e06bf78fc1d26d4956fabc182408ebbbc47e3a6699778cda4aa439c2a6110b09" diff --git a/recipes/valijson/all/conanfile.py b/recipes/valijson/all/conanfile.py index e2e40fe6389af..4c1f0676480ad 100644 --- a/recipes/valijson/all/conanfile.py +++ b/recipes/valijson/all/conanfile.py @@ -1,43 +1,61 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout import os -import glob +required_conan_version = ">=1.52.0" class ValijsonConan(ConanFile): name = "valijson" description = "Valijson is a header-only JSON Schema Validation library for C++11." - topics = ("conan", "valijson", "json", "validator") + license = "BSD-2-Clause" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/tristanpenman/valijson" - license = "BSD-2-Clause" - exports_sources = ["patches/**"] + topics = ("json", "validator", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob(self.name + "-*/")[0] - os.rename(extracted_dir, self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + pass def package(self): - include_folder = os.path.join(self._source_subfolder, "include") - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*", dst="include", src=include_folder) - - def package_id(self): - self.info.header_only() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + self.cpp_info.set_property("cmake_target_name", "ValiJSON::valijson") + self.cpp_info.components["libvalijson"].set_property("cmake_target_name", "ValiJSON::valijson") + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed # self.cpp_info.filenames["cmake_find_package"] = "valijson" # TBA: There's no installed config file # self.cpp_info.filenames["cmake_find_package_multi"] = "valijson" # TBA: There's no installed config file self.cpp_info.names["cmake_find_package"] = "ValiJSON" self.cpp_info.names["cmake_find_package_multi"] = "ValiJSON" - self.cpp_info.components["libvalijson"].names["cmake_find_package"] = "valijson" self.cpp_info.components["libvalijson"].names["cmake_find_package_multi"] = "valijson" diff --git a/recipes/valijson/all/patches/nlohmann_json.patch b/recipes/valijson/all/patches/nlohmann_json.patch deleted file mode 100644 index ebad2ea4b7c30..0000000000000 --- a/recipes/valijson/all/patches/nlohmann_json.patch +++ /dev/null @@ -1,26 +0,0 @@ -diff --git a/include/valijson/adapters/nlohmann_json_adapter.hpp b/include/valijson/adapters/nlohmann_json_adapter.hpp -index 49d27dd..5541adc 100644 ---- a/include/valijson/adapters/nlohmann_json_adapter.hpp -+++ b/include/valijson/adapters/nlohmann_json_adapter.hpp -@@ -26,7 +26,7 @@ - #pragma once - - #include --#include -+#include - - #include - #include -diff --git a/include/valijson/utils/nlohmann_json_utils.hpp b/include/valijson/utils/nlohmann_json_utils.hpp -index 8d03899..15edaba 100644 ---- a/include/valijson/utils/nlohmann_json_utils.hpp -+++ b/include/valijson/utils/nlohmann_json_utils.hpp -@@ -2,7 +2,7 @@ - - #include - --#include -+#include - #include - - namespace valijson { diff --git a/recipes/valijson/all/test_package/CMakeLists.txt b/recipes/valijson/all/test_package/CMakeLists.txt index cfd480a873120..f283c4c7cf92c 100644 --- a/recipes/valijson/all/test_package/CMakeLists.txt +++ b/recipes/valijson/all/test_package/CMakeLists.txt @@ -1,17 +1,18 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) -set(CMAKE_CXX_STANDARD 11) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(ValiJSON REQUIRED) +find_package(ValiJSON REQUIRED CONFIG) +find_package(nlohmann_json REQUIRED CONFIG) +find_package(picojson REQUIRED CONFIG) +find_package(RapidJSON REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries( ${PROJECT_NAME} + PRIVATE ValiJSON::valijson - CONAN_PKG::nlohmann_json - CONAN_PKG::picojson - CONAN_PKG::rapidjson + nlohmann_json::nlohmann_json + picojson::picojson + rapidjson ) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/valijson/all/test_package/conanfile.py b/recipes/valijson/all/test_package/conanfile.py index c6b6735da129e..44512632f983b 100644 --- a/recipes/valijson/all/test_package/conanfile.py +++ b/recipes/valijson/all/test_package/conanfile.py @@ -1,24 +1,30 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() + def layout(self): + cmake_layout(self) def requirements(self): self.requires("nlohmann_json/3.9.1") self.requires("rapidjson/cci.20200410") self.requires("picojson/1.3.0") + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") schema_file = os.path.abspath(os.path.join(self.source_folder, "schema.json")) valid_file = os.path.abspath(os.path.join(self.source_folder, "valid.json")) invalid_file = os.path.abspath(os.path.join(self.source_folder, "invalid.json")) diff --git a/recipes/valijson/all/test_v1_package/CMakeLists.txt b/recipes/valijson/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..679bcbb3ab1fd --- /dev/null +++ b/recipes/valijson/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(ValiJSON REQUIRED CONFIG) +find_package(nlohmann_json REQUIRED CONFIG) +find_package(picojson REQUIRED CONFIG) +find_package(RapidJSON REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries( + ${PROJECT_NAME} + ValiJSON::valijson + nlohmann_json::nlohmann_json + picojson::picojson + RapidJSON::RapidJSON +) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/valijson/all/test_v1_package/conanfile.py b/recipes/valijson/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1ffe3deaeb51c --- /dev/null +++ b/recipes/valijson/all/test_v1_package/conanfile.py @@ -0,0 +1,28 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "cmake", "cmake_find_package", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def requirements(self): + self.requires("nlohmann_json/3.9.1") + self.requires("rapidjson/cci.20200410") + self.requires("picojson/1.3.0") + + def test(self): + if not tools.cross_building(self.settings): + bin_path = os.path.join("bin", "test_package") + schema_file = os.path.abspath(os.path.join(self.source_folder, os.pardir, "test_package", "schema.json")) + valid_file = os.path.abspath(os.path.join(self.source_folder, os.pardir, "test_package", "valid.json")) + invalid_file = os.path.abspath(os.path.join(self.source_folder, os.pardir, "test_package", "invalid.json")) + self.run( + "{} {} {} {}".format(bin_path, schema_file, valid_file, invalid_file), + run_environment=True + ) diff --git a/recipes/valijson/config.yml b/recipes/valijson/config.yml index 44072ef695757..3fcfb3c4539e9 100644 --- a/recipes/valijson/config.yml +++ b/recipes/valijson/config.yml @@ -1,7 +1,7 @@ versions: - "0.3": - folder: "all" - "0.6": + "1.0": folder: "all" "0.7": folder: "all" + "0.6": + folder: "all" diff --git a/recipes/vc/all/CMakeLists.txt b/recipes/vc/all/CMakeLists.txt deleted file mode 100644 index 361b35d4c17d9..0000000000000 --- a/recipes/vc/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.11) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/vc/all/conanfile.py b/recipes/vc/all/conanfile.py index 31bfc101182be..7cfaddf7b0838 100644 --- a/recipes/vc/all/conanfile.py +++ b/recipes/vc/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.51.1" class VcConan(ConanFile): @@ -20,52 +23,40 @@ class VcConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC + def layout(self): + cmake_layout(self, src_folder="src") + def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _patch_sources(self): - cmakelists = os.path.join(self._source_subfolder, "CMakeLists.txt") - tools.replace_in_file(cmakelists, "CMAKE_SOURCE_DIR", "CMAKE_CURRENT_SOURCE_DIR") - tools.replace_in_file(cmakelists, "AddCompilerFlag(\"-fPIC\" CXX_FLAGS libvc_compile_flags)", "") + def generate(self): + tc = CMakeToolchain(self) + tc.generate() - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def _patch_sources(self): + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "AddCompilerFlag(\"-fPIC\" CXX_FLAGS libvc_compile_flags)", "") def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Vc") diff --git a/recipes/vc/all/test_package/CMakeLists.txt b/recipes/vc/all/test_package/CMakeLists.txt index 54585e3f38779..f92c2d97f3154 100644 --- a/recipes/vc/all/test_package/CMakeLists.txt +++ b/recipes/vc/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(Vc REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} Vc::Vc) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE Vc::Vc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/vc/all/test_package/conanfile.py b/recipes/vc/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/vc/all/test_package/conanfile.py +++ b/recipes/vc/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/vc/all/test_v1_package/CMakeLists.txt b/recipes/vc/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..492877a81dfa8 --- /dev/null +++ b/recipes/vc/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Vc REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE Vc::Vc) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/vc/all/test_v1_package/conanfile.py b/recipes/vc/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/vc/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/vcglib/all/CMakeLists.txt b/recipes/vcglib/all/CMakeLists.txt index 8c109eb5cb52f..503836eca235b 100644 --- a/recipes/vcglib/all/CMakeLists.txt +++ b/recipes/vcglib/all/CMakeLists.txt @@ -1,10 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(vcglib) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -set(VCGLIB_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder) +project(vcglib LANGUAGES CXX) find_package(Eigen3 REQUIRED CONFIG) @@ -14,6 +9,7 @@ set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS TRUE target_include_directories(${PROJECT_NAME} PUBLIC ${VCGLIB_SRC_DIR}) target_link_libraries(${PROJECT_NAME} PUBLIC Eigen3::Eigen) +include(GNUInstallDirs) install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} diff --git a/recipes/vcglib/all/conandata.yml b/recipes/vcglib/all/conandata.yml index 9189efc74ad1c..d8dc31a26ed34 100644 --- a/recipes/vcglib/all/conandata.yml +++ b/recipes/vcglib/all/conandata.yml @@ -8,7 +8,5 @@ sources: patches: "2022.02": - patch_file: "patches/0001-use-external-eigen.patch" - base_path: "source_subfolder" "2020.12": - patch_file: "patches/0001-use-external-eigen.patch" - base_path: "source_subfolder" diff --git a/recipes/vcglib/all/conanfile.py b/recipes/vcglib/all/conanfile.py index fdb554f64e62d..f452d7336181c 100644 --- a/recipes/vcglib/all/conanfile.py +++ b/recipes/vcglib/all/conanfile.py @@ -1,7 +1,10 @@ -from conans import ConanFile, CMake, tools -import functools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class VcglibConan(ConanFile): @@ -22,16 +25,9 @@ class VcglibConan(ConanFile): "fPIC": True, } - generators = "cmake", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + copy(self, "CMakeLists.txt", src=self.recipe_folder, dst=self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -39,34 +35,41 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("eigen/3.4.0") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.configure() - return cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["VCGLIB_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/vcglib/all/test_package/CMakeLists.txt b/recipes/vcglib/all/test_package/CMakeLists.txt index 2f5ac307877bf..e31ccdde007c2 100644 --- a/recipes/vcglib/all/test_package/CMakeLists.txt +++ b/recipes/vcglib/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(vcglib REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} vcglib::vcglib) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE vcglib::vcglib) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/vcglib/all/test_package/conanfile.py b/recipes/vcglib/all/test_package/conanfile.py index 8eaf28f5cf632..6ecd0412fd260 100644 --- a/recipes/vcglib/all/test_package/conanfile.py +++ b/recipes/vcglib/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") obj_path = os.path.join(self.source_folder, "cube.obj") - self.run("{} {}".format(bin_path, obj_path), run_environment=True) + self.run(f"{bin_path} {obj_path}", env="conanrun") diff --git a/recipes/vcglib/all/test_v1_package/CMakeLists.txt b/recipes/vcglib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0b93c9e9b9c66 --- /dev/null +++ b/recipes/vcglib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(vcglib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE vcglib::vcglib) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/vcglib/all/test_v1_package/conanfile.py b/recipes/vcglib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..4d2909d5e4d45 --- /dev/null +++ b/recipes/vcglib/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + obj_path = os.path.join(self.source_folder, os.pardir, "test_package", "cube.obj") + self.run(f"{bin_path} {obj_path}", run_environment=True) diff --git a/recipes/vdpau/all/conanfile.py b/recipes/vdpau/all/conanfile.py index c13780fe4e482..037314ecd8e20 100644 --- a/recipes/vdpau/all/conanfile.py +++ b/recipes/vdpau/all/conanfile.py @@ -1,5 +1,9 @@ -from conans import ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration, ConanException +from conan.tools.system import package_manager +from conans import tools + +required_conan_version = ">=1.47" class SysConfigVDPAUConan(ConanFile): @@ -10,7 +14,11 @@ class SysConfigVDPAUConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://www.freedesktop.org/wiki/Software/VDPAU/" license = "MIT" - settings = {"os": ["Linux", "FreeBSD"]} + settings = "os", "arch", "compiler", "build_type" + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def package_id(self): self.info.header_only() @@ -36,24 +44,23 @@ def _fill_cppinfo_from_pkgconfig(self, name): self.cpp_info.cxxflags.extend(cflags) def system_requirements(self): - packages = [] - if tools.os_info.is_linux and self.settings.os == "Linux": - if tools.os_info.with_yum: - packages = ["libvdpau-devel"] - elif tools.os_info.with_apt: - packages = ["libvdpau-dev"] - elif tools.os_info.with_pacman: - packages = ["libvdpau"] - elif tools.os_info.with_zypper: - packages = ["libvdpau-devel"] - else: - self.output.warn("Don't know how to install %s for your distro." % self.name) - elif tools.os_info.is_freebsd and self.settings.os == "FreeBSD": - packages = ["libvdpau"] - if packages: - package_tool = tools.SystemPackageTool(conanfile=self, default_mode='verify') - for p in packages: - package_tool.install(update=True, packages=p) + dnf = package_manager.Dnf(self) + dnf.install(["libvdpau-devel"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["libvdpau-devel"], update=True, check=True) + + apt = package_manager.Apt(self) + apt.install(["libvdpau-dev"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["libvdpau"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["libvdpau-devel"], update=True, check=True) + + pkg = package_manager.Pkg(self) + pkg.install(["libvdpau"], update=True, check=True) def package_info(self): self.cpp_info.includedirs = [] diff --git a/recipes/vectorclass/all/CMakeLists.txt b/recipes/vectorclass/all/CMakeLists.txt index a8fe5cc4331f3..80dcca3ff846c 100644 --- a/recipes/vectorclass/all/CMakeLists.txt +++ b/recipes/vectorclass/all/CMakeLists.txt @@ -1,16 +1,9 @@ cmake_minimum_required(VERSION 3.8) +project(vectorclass LANGUAGES CXX) -project(vectorclass CXX) +file(GLOB HEADERS "${VECTORCLASS_SRC_DIR}/*.h") -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(SOURCES - ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/instrset_detect.cpp) - -file(GLOB HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/*.h") - -add_library(vectorclass STATIC ${SOURCES} ${HEADERS}) +add_library(vectorclass STATIC ${VECTORCLASS_SRC_DIR}/instrset_detect.cpp) target_compile_features(vectorclass PUBLIC cxx_std_17) set_target_properties(vectorclass PROPERTIES PUBLIC_HEADER "${HEADERS}") diff --git a/recipes/vectorclass/all/conanfile.py b/recipes/vectorclass/all/conanfile.py index f2a0e8cc20e75..5696b99489d45 100644 --- a/recipes/vectorclass/all/conanfile.py +++ b/recipes/vectorclass/all/conanfile.py @@ -1,7 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.51.1" class VectorclassConan(ConanFile): @@ -11,32 +15,23 @@ class VectorclassConan(ConanFile): "microprocessors with the x86 or x86/64 instruction set on " \ "Windows, Linux, and Mac platforms." license = "Apache-2.0" - topics = ("conan", "vectorclass", "vector", "simd") + topics = ("vectorclass", "vector", "simd") homepage = "https://github.com/vectorclass/version2" url = "https://github.com/conan-io/conan-center-index" - exports_sources = ["CMakeLists.txt"] - generators = "cmake" - settings = ("os", "arch", "compiler", "build_type") + + settings = "os", "arch", "compiler", "build_type" options = { - "fPIC": [True, False] + "fPIC": [True, False], } default_options = { - "fPIC": True + "fPIC": True, } - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" + exports_sources = "CMakeLists.txt" @property - def _build_subfolder(self): - return "build_subfolder" - - def config_options(self): - if self.settings.os == 'Windows': - del self.options.fPIC + def _min_cppstd(self): + return "17" @property def _compilers_minimum_version(self): @@ -44,46 +39,52 @@ def _compilers_minimum_version(self): "Visual Studio": "15.7", "gcc": "7", "clang": "4.0", - "apple-clang": "9.1" + "apple-clang": "9.1", } + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def layout(self): + cmake_layout(self, src_folder="src") + def validate(self): - if self.settings.os not in ["Linux", "Windows", "Macos"] or self.settings.arch not in ["x86", "x86_64"]: + if self.info.settings.os not in ["Linux", "Windows", "Macos"] or self.info.settings.arch not in ["x86", "x86_64"]: raise ConanInvalidConfiguration("vectorclass supports Linux/Windows/macOS and x86/x86_64 only.") - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) - def lazy_lt_semver(v1, v2): + def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] - minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("{} {} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name, self.version)) - elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("{} {} requires C++17, which your compiler does not support.".format(self.name, self.version)) + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.info.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["VECTORCLASS_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/vectorclass/all/test_package/CMakeLists.txt b/recipes/vectorclass/all/test_package/CMakeLists.txt index 2954126775e7b..b10c5c90bde2f 100644 --- a/recipes/vectorclass/all/test_package/CMakeLists.txt +++ b/recipes/vectorclass/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(vectorclass REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE vectorclass::vectorclass) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/vectorclass/all/test_package/conanfile.py b/recipes/vectorclass/all/test_package/conanfile.py index 5216332f39f5c..0a6bc68712d90 100644 --- a/recipes/vectorclass/all/test_package/conanfile.py +++ b/recipes/vectorclass/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/vectorclass/all/test_v1_package/CMakeLists.txt b/recipes/vectorclass/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..1d531c5d5a930 --- /dev/null +++ b/recipes/vectorclass/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(vectorclass REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE vectorclass::vectorclass) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/vectorclass/all/test_v1_package/conanfile.py b/recipes/vectorclass/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/vectorclass/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/verilator/all/conanfile.py b/recipes/verilator/all/conanfile.py index 1caac1166ce33..dae6d10f3a17c 100644 --- a/recipes/verilator/all/conanfile.py +++ b/recipes/verilator/all/conanfile.py @@ -1,14 +1,14 @@ from conan import ConanFile -from conan.tools.files import get -from conan.tools.files import rmdir +from conan.tools.files import get, rmdir, patch, replace_in_file, rename from conan.tools.build import cross_building +from conan.tools.scm import Version from conans import AutoToolsBuildEnvironment, tools -from conans.errors import ConanInvalidConfiguration +from conan.errors import ConanInvalidConfiguration from contextlib import contextmanager import os import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class VerilatorConan(ConanFile): name = "verilator" @@ -36,7 +36,7 @@ def export_sources(self): @property def _needs_old_bison(self): - return tools.Version(self.version) < "4.100" + return Version(self.version) < "4.100" def build_requirements(self): if self._settings_build.os == "Windows" and "CONAN_BASH_PATH" not in os.environ: @@ -58,7 +58,7 @@ def build_requirements(self): self.build_requires("bison/3.5.3") else: self.build_requires("bison/3.7.6") - if tools.Version(self.version) >= "4.224": + if Version(self.version) >= "4.224": self.build_requires("autoconf/2.71") @@ -76,10 +76,10 @@ def validate(self): if hasattr(self, "settings_build") and cross_building(self): raise ConanInvalidConfiguration("Cross building is not yet supported. Contributions are welcome") - if tools.Version(self.version) >= "4.200" and self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "7": + if Version(self.version) >= "4.200" and self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "7": raise ConanInvalidConfiguration("GCC < version 7 is not supported") - if self.settings.os == "Windows" and tools.Version(self.version) >= "4.200": + if self.settings.os == "Windows" and Version(self.version) >= "4.200": raise ConanInvalidConfiguration("Windows build is not yet supported. Contributions are welcome") @contextmanager def _build_context(self): @@ -115,7 +115,7 @@ def _configure_autotools(self): if yacc.endswith(" -y"): yacc = yacc[:-3] with tools.environment_append({"YACC": yacc}): - if tools.Version(self.version) >= "4.224": + if Version(self.version) >= "4.224": with tools.chdir(self._source_subfolder): self.run("autoconf", win_bash=tools.os_info.is_windows, run_environment=True) self._autotools.configure(args=conf_args, configure_dir=os.path.join(self.build_folder, self._source_subfolder)) @@ -135,17 +135,16 @@ def _make_args(self): return args def _patch_sources(self): - if tools.Version(self.version) < "4.200": - for patch in self.conan_data["patches"][self.version]: - tools.patch(**patch) - + if Version(self.version) < "4.200": + for patch_file in self.conan_data.get("patches", {}).get(self.version, []): + patch(self, **patch_file) try: os.unlink(os.path.join(self._source_subfolder, "src", "config_build.h")) except FileNotFoundError: pass if self.settings.compiler == "Visual Studio": - tools.replace_in_file(os.path.join(self._source_subfolder, "src", "Makefile_obj.in"), + replace_in_file(self, os.path.join(self._source_subfolder, "src", "Makefile_obj.in"), "${LINK}", "${PROGLINK}") def build(self): @@ -164,18 +163,24 @@ def package(self): rmdir(self, os.path.join(self.package_folder, "bin", "share", "pkgconfig")) rmdir(self, os.path.join(self.package_folder, "bin", "share", "verilator", "examples")) os.unlink(os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-config-version.cmake")) - tools.rename(os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-config.cmake"), + rename(self, os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-config.cmake"), os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-tools.cmake")) - tools.replace_in_file(os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-tools.cmake"), + replace_in_file(self, os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-tools.cmake"), "${CMAKE_CURRENT_LIST_DIR}", "${CMAKE_CURRENT_LIST_DIR}/../../..") if self.settings.build_type == "Debug": - tools.replace_in_file(os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-tools.cmake"), + replace_in_file(self, os.path.join(self.package_folder, "bin", "share", "verilator", "verilator-tools.cmake"), "verilator_bin", "verilator_bin_dbg") shutil.move(os.path.join(self.package_folder, "bin", "share", "verilator", "include"), os.path.join(self.package_folder)) - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin", "share", "verilator", "bin"), "*") + if Version(self.version) >= "4.224": + shutil.move(os.path.join(self.package_folder, "bin", "share", "verilator", "bin", "verilator_ccache_report"), + os.path.join(self.package_folder, "bin", "verilator_ccache_report")) + + shutil.move(os.path.join(self.package_folder, "bin", "share", "verilator", "bin", "verilator_includer"), + os.path.join(self.package_folder, "bin", "verilator_includer")) + rmdir(self, os.path.join(self.package_folder, "bin", "share", "verilator", "bin")) def package_id(self): diff --git a/recipes/vk-bootstrap/all/conandata.yml b/recipes/vk-bootstrap/all/conandata.yml index 3ba36acbcf006..d3c923855081d 100644 --- a/recipes/vk-bootstrap/all/conandata.yml +++ b/recipes/vk-bootstrap/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "0.7": + url: "https://github.com/charles-lunarg/vk-bootstrap/archive/refs/tags/v0.7.tar.gz" + sha256: "7b2c30a4c46514cc5b20d2bebab25c495df39574b9e117c760d1cfe19f71d9aa" + "0.6": + url: "https://github.com/charles-lunarg/vk-bootstrap/archive/refs/tags/v0.6.tar.gz" + sha256: "95dedaa5cedf7a271f051d91b24b3b6c78aa3c5b2bc3cf058554c92748a421b2" "0.5": url: "https://github.com/charles-lunarg/vk-bootstrap/archive/refs/tags/v0.5.tar.gz" sha256: "7ec1017d71d48595c078a4488140b230fd9cad1059986a18a507f356bf00e89b" @@ -12,6 +18,8 @@ sources: url: "https://github.com/charles-lunarg/vk-bootstrap/archive/v0.2.tar.gz" sha256: "45afc9c2c90309f768786c8014913627e6f1cb4db20449a65b98283b58918483" patches: + "0.6": + - patch_file: "patches/0001-fix-cmake-0.6.patch" "0.5": - patch_file: "patches/0001-fix-cmake-0.5.patch" "0.4": diff --git a/recipes/vk-bootstrap/all/conanfile.py b/recipes/vk-bootstrap/all/conanfile.py index 1ebda5ab43574..2d7b6c5514a0c 100644 --- a/recipes/vk-bootstrap/all/conanfile.py +++ b/recipes/vk-bootstrap/all/conanfile.py @@ -1,24 +1,24 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration -from conan.tools.build import check_min_cppstd +from conan.tools.build import check_min_cppstd, stdcpp_library from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get from conan.tools.microsoft import is_msvc from conan.tools.scm import Version -from conans import tools as tools_legacy import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class VkBootstrapConan(ConanFile): name = "vk-bootstrap" description = "Vulkan bootstraping library." license = "MIT" - topics = ("vk-bootstrap", "vulkan") + topics = ("vulkan", "bootstrap", "setup") homepage = "https://github.com/charles-lunarg/vk-bootstrap" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -39,13 +39,12 @@ def _compilers_minimum_version(self): "gcc": "5", "Visual Studio": "15", "msvc": "191", - "clang": "3.7" if tools_legacy.stdcpp_library(self) == "stdc++" else "6", + "clang": "3.7" if stdcpp_library(self) == "stdc++" else "6", "apple-clang": "10", } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,13 +52,19 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("vulkan-headers/1.3.224.0") + if Version(self.version) < "0.7": + self.requires("vulkan-headers/1.3.236.0", transitive_headers=True) + else: + self.requires("vulkan-headers/1.3.239.0", transitive_headers=True) def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) def loose_lt_semver(v1, v2): @@ -68,21 +73,17 @@ def loose_lt_semver(v1, v2): min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] - minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) - if minimum_version and loose_lt_semver(str(self.info.settings.compiler.version), minimum_version): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration( - f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", ) - if is_msvc(self) and self.info.options.shared: - raise ConanInvalidConfiguration("vk-boostrap shared not supported with Visual Studio") - - def layout(self): - cmake_layout(self, src_folder="src") + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} shared not supported with Visual Studio") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/vk-bootstrap/all/patches/0001-fix-cmake-0.6.patch b/recipes/vk-bootstrap/all/patches/0001-fix-cmake-0.6.patch new file mode 100644 index 0000000000000..a24ee1446f9e5 --- /dev/null +++ b/recipes/vk-bootstrap/all/patches/0001-fix-cmake-0.6.patch @@ -0,0 +1,13 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index f1e0181..4d154e0 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -83,7 +83,7 @@ install(TARGETS vk-bootstrap vk-bootstrap-compiler-warnings vk-bootstrap-vulkan- + + option(VK_BOOTSTRAP_TEST "Test Vk-Bootstrap with glfw and Catch2" OFF) + +-if (CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME OR VK_BOOTSTRAP_TEST) ++if (VK_BOOTSTRAP_TEST) + + add_subdirectory(ext) + add_subdirectory(tests) diff --git a/recipes/vk-bootstrap/all/test_package/conanfile.py b/recipes/vk-bootstrap/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/vk-bootstrap/all/test_package/conanfile.py +++ b/recipes/vk-bootstrap/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/vk-bootstrap/all/test_v1_package/CMakeLists.txt b/recipes/vk-bootstrap/all/test_v1_package/CMakeLists.txt index db45c343a8483..0d20897301b68 100644 --- a/recipes/vk-bootstrap/all/test_v1_package/CMakeLists.txt +++ b/recipes/vk-bootstrap/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(vk-bootstrap REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE vk-bootstrap::vk-bootstrap) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/vk-bootstrap/config.yml b/recipes/vk-bootstrap/config.yml index 67b99f4d61f63..eaed33f60995e 100644 --- a/recipes/vk-bootstrap/config.yml +++ b/recipes/vk-bootstrap/config.yml @@ -1,4 +1,8 @@ versions: + "0.7": + folder: all + "0.6": + folder: all "0.5": folder: all "0.4": diff --git a/recipes/volk/all/CMakeLists.txt b/recipes/volk/all/CMakeLists.txt deleted file mode 100644 index a69305eb3971f..0000000000000 --- a/recipes/volk/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/volk/all/conandata.yml b/recipes/volk/all/conandata.yml index 51d3cb8ae93f1..f99a39c644222 100644 --- a/recipes/volk/all/conandata.yml +++ b/recipes/volk/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "1.3.236.0": + url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "fba21aeccd8df4ce49fd0cce54cc9b1808e24e4283cad733f65fdd52f1729f16" + "1.3.231.1": + url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "fac8d3d295e88bcc6bfb2b729d2c4babb2ea04ccb39fd918a3471b2d756789b9" + "1.3.224.1": + url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.224.1.tar.gz" + sha256: "86505052a83d3085e34d22f8b9969e9961efc24c0c902fefb0b6b43d496f69b4" + "1.3.224.0": + url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.224.0.tar.gz" + sha256: "c9f9dd80dc8f3cd28b1d3d5716bb5e56be966b88aa9c54b18d793df8f60abc36" "1.3.216.0": url: "https://github.com/zeux/volk/archive/refs/tags/sdk-1.3.216.0.tar.gz" sha256: "cbbbcad79d84081f21a3cfa3261819a4fa2012cd8e6965136bdebb444bae063c" diff --git a/recipes/volk/all/conanfile.py b/recipes/volk/all/conanfile.py index 691cdc3d5bfc7..4d95cbead05b0 100644 --- a/recipes/volk/all/conanfile.py +++ b/recipes/volk/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file, rmdir import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.47.0" class VolkConan(ConanFile): @@ -20,7 +22,7 @@ class VolkConan(ConanFile): ) topics = ("vulkan", "loader", "extension", "entrypoint", "graphics") - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" options = { "fPIC": [True, False], } @@ -28,46 +30,54 @@ class VolkConan(ConanFile): "fPIC": True, } - exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def config_options(self): if self.settings.os == "Windows": del self.options.fPIC def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("vulkan-headers/" + self.version) + self.requires(f"vulkan-headers/{self.version}") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["VOLK_INSTALL"] = True - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["VOLK_PULL_IN_VULKAN"] = True + tc.variables["VOLK_INSTALL"] = True + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + replace_in_file(self, cmakelists, "find_package(Vulkan QUIET)", "find_package(VulkanHeaders REQUIRED)") + replace_in_file(self, cmakelists, "Vulkan::Vulkan", "Vulkan::Headers") def build(self): - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("LICENSE.md", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "volk") diff --git a/recipes/volk/all/test_package/CMakeLists.txt b/recipes/volk/all/test_package/CMakeLists.txt index bd1fc171d101b..f79c7351a572f 100644 --- a/recipes/volk/all/test_package/CMakeLists.txt +++ b/recipes/volk/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(volk REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} volk::volk) +target_link_libraries(${PROJECT_NAME} PRIVATE volk::volk) add_executable(${PROJECT_NAME}_nolibs test_package.c) target_compile_definitions(${PROJECT_NAME}_nolibs PRIVATE VOLK_IMPLEMENTATION) -target_link_libraries(${PROJECT_NAME}_nolibs volk::volk_headers) +target_link_libraries(${PROJECT_NAME}_nolibs PRIVATE volk::volk_headers) diff --git a/recipes/volk/all/test_package/conanfile.py b/recipes/volk/all/test_package/conanfile.py index da79ceaaf9ebd..ca066f730c2f4 100644 --- a/recipes/volk/all/test_package/conanfile.py +++ b/recipes/volk/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) - self.run(os.path.join("bin", "test_package_nolibs"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") + bin_path_nolibs = os.path.join(self.cpp.build.bindirs[0], "test_package_nolibs") + self.run(bin_path_nolibs, env="conanrun") diff --git a/recipes/volk/all/test_v1_package/CMakeLists.txt b/recipes/volk/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..528a71ca307f4 --- /dev/null +++ b/recipes/volk/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(volk REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE volk::volk) + +add_executable(${PROJECT_NAME}_nolibs ../test_package/test_package.c) +target_compile_definitions(${PROJECT_NAME}_nolibs PRIVATE VOLK_IMPLEMENTATION) +target_link_libraries(${PROJECT_NAME}_nolibs PRIVATE volk::volk_headers) diff --git a/recipes/volk/all/test_v1_package/conanfile.py b/recipes/volk/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..da79ceaaf9ebd --- /dev/null +++ b/recipes/volk/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join("bin", "test_package"), run_environment=True) + self.run(os.path.join("bin", "test_package_nolibs"), run_environment=True) diff --git a/recipes/volk/config.yml b/recipes/volk/config.yml index 205873f336fae..863bb85e7f8b2 100644 --- a/recipes/volk/config.yml +++ b/recipes/volk/config.yml @@ -1,4 +1,12 @@ versions: + "1.3.236.0": + folder: "all" + "1.3.231.1": + folder: "all" + "1.3.224.1": + folder: "all" + "1.3.224.0": + folder: "all" "1.3.216.0": folder: "all" "1.3.204": diff --git a/recipes/vorbis/all/conanfile.py b/recipes/vorbis/all/conanfile.py index 007a900f3ab52..4e074b9f2cd87 100644 --- a/recipes/vorbis/all/conanfile.py +++ b/recipes/vorbis/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import apply_conandata_patches, copy, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class VorbisConan(ConanFile): @@ -34,7 +34,7 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") try: del self.settings.compiler.libcxx except Exception: @@ -45,7 +45,7 @@ def configure(self): pass def requirements(self): - self.requires("ogg/1.3.5") + self.requires("ogg/1.3.5", transitive_headers=True) def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/voropp/all/CMakeLists.txt b/recipes/voropp/all/CMakeLists.txt index 5aaa1e0bd9de9..6f2c6b9d5757a 100644 --- a/recipes/voropp/all/CMakeLists.txt +++ b/recipes/voropp/all/CMakeLists.txt @@ -1,12 +1,7 @@ cmake_minimum_required(VERSION 3.4) -project(voro++) +project(voro++ LANGUAGES CXX) -include(conanbuildinfo.cmake) -conan_basic_setup() - -set(VOROPP_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/source_subfolder/src) - -add_library(${PROJECT_NAME} ${VOROPP_SRC_DIR}/voro++.cc) +add_library(${PROJECT_NAME} ${VOROPP_SRC_DIR}/src/voro++.cc) set_target_properties(${PROJECT_NAME} PROPERTIES WINDOWS_EXPORT_ALL_SYMBOLS ON) include(GNUInstallDirs) @@ -16,5 +11,5 @@ install(TARGETS ${PROJECT_NAME} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ) -file(GLOB VOROPP_HEADERS ${VOROPP_SRC_DIR}/*.hh) +file(GLOB VOROPP_HEADERS ${VOROPP_SRC_DIR}/src/*.hh) install(FILES ${VOROPP_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/voro++) diff --git a/recipes/voropp/all/conanfile.py b/recipes/voropp/all/conanfile.py index f8ab267cbb9e9..c327986e7052b 100644 --- a/recipes/voropp/all/conanfile.py +++ b/recipes/voropp/all/conanfile.py @@ -1,6 +1,9 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class VoroppConan(ConanFile): @@ -15,6 +18,7 @@ class VoroppConan(ConanFile): homepage = "http://math.lbl.gov/voro++" url = "https://github.com/conan-io/conan-center-index" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -26,12 +30,6 @@ class VoroppConan(ConanFile): } exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -39,26 +37,27 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True, verify=False) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.configure() - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + tc.variables["VOROPP_SRC_DIR"] = self.source_folder.replace("\\", "/") + tc.generate() def build(self): - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build() def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): diff --git a/recipes/voropp/all/test_package/CMakeLists.txt b/recipes/voropp/all/test_package/CMakeLists.txt index 196188113685c..80445ad826690 100644 --- a/recipes/voropp/all/test_package/CMakeLists.txt +++ b/recipes/voropp/all/test_package/CMakeLists.txt @@ -1,8 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(voropp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +target_link_libraries(${PROJECT_NAME} PRIVATE voropp::voropp) diff --git a/recipes/voropp/all/test_package/conanfile.py b/recipes/voropp/all/test_package/conanfile.py index 5c09494bc67c0..0a6bc68712d90 100644 --- a/recipes/voropp/all/test_package/conanfile.py +++ b/recipes/voropp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/voropp/all/test_v1_package/CMakeLists.txt b/recipes/voropp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/voropp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/voropp/all/test_v1_package/conanfile.py b/recipes/voropp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/voropp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/vulkan-headers/all/conandata.yml b/recipes/vulkan-headers/all/conandata.yml index 04e004b954592..58fb14241e22f 100644 --- a/recipes/vulkan-headers/all/conandata.yml +++ b/recipes/vulkan-headers/all/conandata.yml @@ -1,4 +1,22 @@ sources: + "1.3.239.0": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.239.0.tar.gz" + sha256: "865fa8e8e8314fcca60777a92f50bd0cf612205a36e719d6975482d3366f619e" + "1.3.236.0": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "2df85b3daa78ced7f910db870ea2aed10f718c703e18076b4549ca4005c9c451" + "1.3.231.1": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "6e16051ccb28821b907a08025eedb82cc73e1056924b32f75880ecae2499f7f6" + "1.3.231.0": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.231.0.tar.gz" + sha256: "f7c185dedf7753d58e7b59913dd4b77006a6ed91fae598c5961f77d85b183da0" + "1.3.231": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/v1.3.231.tar.gz" + sha256: "4cb1c0aeb858e1a4955a736b86b0da8511ca8701222e9a252adcf093d40a8d28" + "1.3.224.1": + url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.224.1.tar.gz" + sha256: "628bd5943c0d007c192769480e789801a088f892445c80cb336fc9b6d236c5ef" "1.3.224.0": url: "https://github.com/KhronosGroup/Vulkan-Headers/archive/refs/tags/sdk-1.3.224.0.tar.gz" sha256: "ccdfa47cea58a080957481fb6c35908d005d04cc5dd1778150dc0c651ccea077" diff --git a/recipes/vulkan-headers/all/conanfile.py b/recipes/vulkan-headers/all/conanfile.py index 75fb63bbf7938..2926437171c3e 100644 --- a/recipes/vulkan-headers/all/conanfile.py +++ b/recipes/vulkan-headers/all/conanfile.py @@ -16,12 +16,12 @@ class VulkanHeadersConan(ConanFile): settings = "os", "arch", "compiler", "build_type" no_copy_source = True - def package_id(self): - self.info.clear() - def layout(self): basic_layout(self, src_folder="src") + def package_id(self): + self.info.clear() + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -38,13 +38,12 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "VulkanHeaders") self.cpp_info.components["vulkanheaders"].set_property("cmake_target_name", "Vulkan::Headers") self.cpp_info.components["vulkanheaders"].bindirs = [] - self.cpp_info.components["vulkanheaders"].frameworkdirs = [] self.cpp_info.components["vulkanheaders"].libdirs = [] self.cpp_info.components["vulkanregistry"].set_property("cmake_target_name", "Vulkan::Registry") self.cpp_info.components["vulkanregistry"].includedirs = [os.path.join("res", "vulkan", "registry")] self.cpp_info.components["vulkanregistry"].bindirs = [] - self.cpp_info.components["vulkanregistry"].frameworkdirs = [] self.cpp_info.components["vulkanregistry"].libdirs = [] + self.cpp_info.components["vulkanregistry"].resdirs = ["res"] self.cpp_info.filenames["cmake_find_package"] = "VulkanHeaders" self.cpp_info.filenames["cmake_find_package_multi"] = "VulkanHeaders" diff --git a/recipes/vulkan-headers/all/test_package/conanfile.py b/recipes/vulkan-headers/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/vulkan-headers/all/test_package/conanfile.py +++ b/recipes/vulkan-headers/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/vulkan-headers/config.yml b/recipes/vulkan-headers/config.yml index 7892e6ee422a2..4938af0ce545d 100644 --- a/recipes/vulkan-headers/config.yml +++ b/recipes/vulkan-headers/config.yml @@ -1,4 +1,16 @@ versions: + "1.3.239.0": + folder: all + "1.3.236.0": + folder: all + "1.3.231.1": + folder: all + "1.3.231.0": + folder: all + "1.3.231": + folder: all + "1.3.224.1": + folder: all "1.3.224.0": folder: all "1.3.221": diff --git a/recipes/vulkan-loader/all/conandata.yml b/recipes/vulkan-loader/all/conandata.yml index b1c25119aefb6..fceeca688d80b 100644 --- a/recipes/vulkan-loader/all/conandata.yml +++ b/recipes/vulkan-loader/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "1.3.239.0": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.239.0.tar.gz" + sha256: "fa2078408793b2173f174173a8784de56b6bbfbcb5fb958a07e46ef126c7eada" + "1.3.236.0": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "157d2230b50bb5be3ef9b9467aa90d1c109d5f188a49b11f741246d7ca583bf3" + "1.3.231.1": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "5226fbc6a90e4405200c8cfdd5733d5e0c6a64e64dcc614c485ea06e03d66578" + "1.3.231": + url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/v1.3.231.tar.gz" + sha256: "02e185b939635167ea8f8815f8daab76af36923a3b995951fe6a5d3e25c55bf7" "1.3.224.0": url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/refs/tags/sdk-1.3.224.0.tar.gz" sha256: "9f102a89b7d350ce5a6c82887459821aa9725c521128495ed7cbda637ed52022" @@ -42,7 +54,25 @@ sources: url: "https://github.com/KhronosGroup/Vulkan-Loader/archive/sdk-1.2.154.0.tar.gz" sha256: "418017d7bab907e72291476df231dd0e7dc7fe20b97e55389c975bcfc48d6433" patches: + "1.3.236.0": + - patch_file: "patches/1.3.236.0-0001-cmake-minimum-required-3.10.patch" + patch_description: "Do not use features of CMake 3.16, back to 3.10 as min version" + patch_type: "portability" + patch_source: "https://github.com/KhronosGroup/Vulkan-Loader/pull/1102" + "1.3.231.1": + - patch_file: "patches/1.3.231.1-0001-no-find-package-wayland.patch" + patch_description: "CMake: remove attempt to find Wayland" + patch_type: "portability" + patch_source: "https://github.com/KhronosGroup/Vulkan-Loader/pull/1020" "1.2.182": - - patch_file: "patches/fix-mingw-1.2.182.patch" + - patch_file: "patches/1.2.182-0001-fix-mingw.patch" + patch_description: "Fix MinGW" + patch_type: "portability" "1.2.154.0": - - patch_file: "patches/fix-mingw-1.2.154.0.patch" + - patch_file: "patches/1.2.154.0-0001-fix-mingw.patch" + patch_description: "Fix MinGW" + patch_type: "portability" + patch_source: + - "https://github.com/KhronosGroup/Vulkan-Loader/pull/475" + - "https://github.com/KhronosGroup/Vulkan-Loader/pull/495" + - "https://github.com/KhronosGroup/Vulkan-Loader/pull/523" diff --git a/recipes/vulkan-loader/all/conanfile.py b/recipes/vulkan-loader/all/conanfile.py index 27d1253c5a47d..e1a6db65c0bf0 100644 --- a/recipes/vulkan-loader/all/conanfile.py +++ b/recipes/vulkan-loader/all/conanfile.py @@ -3,12 +3,12 @@ from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout from conan.tools.env import Environment, VirtualBuildEnv -from conan.tools.files import apply_conandata_patches, copy, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.gnu import PkgConfigDeps from conan.tools.scm import Version import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class VulkanLoaderConan(ConanFile): @@ -47,8 +47,7 @@ def _is_pkgconf_needed(self): self.options.get_safe("with_wsi_wayland") or self.options.get_safe("with_wsi_directfb") def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -61,30 +60,27 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires(f"vulkan-headers/{self.version}") if self.options.get_safe("with_wsi_xcb") or self.options.get_safe("with_wsi_xlib"): self.requires("xorg/system") - if self.options.get_safe("with_wsi_wayland"): - self.requires("wayland/1.20.0") + if Version(self.version) < "1.3.231" and self.options.get_safe("with_wsi_wayland"): + self.requires("wayland/1.21.0") def validate(self): if self.options.get_safe("with_wsi_directfb"): # TODO: directfb package raise ConanInvalidConfiguration("Conan recipe for DirectFB is not available yet.") - if not is_apple_os(self) and not self.info.options.shared: + if not is_apple_os(self) and not self.options.shared: raise ConanInvalidConfiguration(f"Static builds are not supported on {self.settings.os}") - if self.info.settings.compiler == "Visual Studio" and Version(self.info.settings.compiler.version) < 15: + if self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) < 15: # FIXME: It should build but Visual Studio 2015 container in CI of CCI seems to lack some Win SDK headers raise ConanInvalidConfiguration("Visual Studio < 2017 not yet supported in this recipe") # TODO: to replace by some version range check @@ -93,18 +89,19 @@ def validate(self): def build_requirements(self): if self._is_pkgconf_needed: - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("pkgconf/1.9.3") if self._is_mingw: self.tool_requires("jwasm/2.13") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def generate(self): + if self._is_pkgconf_needed or self._is_mingw: + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) tc.variables["VULKAN_HEADERS_INSTALL_DIR"] = self.dependencies["vulkan-headers"].package_folder.replace("\\", "/") tc.variables["BUILD_TESTS"] = False @@ -121,6 +118,8 @@ def generate(self): tc.variables["BUILD_LOADER"] = True if self.settings.os == "Windows": tc.variables["USE_MASM"] = True + if Version(self.version) >= "1.3.212": + tc.variables["ENABLE_WERROR"] = False tc.generate() deps = CMakeDeps(self) deps.generate() @@ -130,18 +129,15 @@ def generate(self): # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) env = Environment() env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) - envvars = env.vars(self) - envvars.save_script("conanbuildenv_pkg_config_path") - if self._is_pkgconf_needed or self._is_mingw: - env = VirtualBuildEnv(self) - env.generate() + env.vars(self).save_script("conanbuildenv_pkg_config_path") def _patch_sources(self): apply_conandata_patches(self) - replace_in_file(self, os.path.join(self.source_folder, "cmake", "FindVulkanHeaders.cmake"), - "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry", - "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry") + if Version(self.version) < "1.3.234": + replace_in_file(self, os.path.join(self.source_folder, "cmake", "FindVulkanHeaders.cmake"), + "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry", + "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry") # Honor settings.compiler.runtime replace_in_file(self, os.path.join(self.source_folder, "loader", "CMakeLists.txt"), "if(${configuration} MATCHES \"/MD\")", @@ -149,12 +145,15 @@ def _patch_sources(self): cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") # No warnings as errors - replace_in_file(self, cmakelists, "/WX", "") + if Version(self.version) < "1.3.212": + replace_in_file(self, cmakelists, "/WX", "") # This fix is needed due to CMAKE_FIND_PACKAGE_PREFER_CONFIG ON in CMakeToolchain (see https://github.com/conan-io/conan/issues/10387). # Indeed we want to use upstream Find modules of xcb, x11, wayland and directfb. There are properly using pkgconfig under the hood. replace_in_file(self, cmakelists, "find_package(XCB REQUIRED)", "find_package(XCB REQUIRED MODULE)") replace_in_file(self, cmakelists, "find_package(X11 REQUIRED)", "find_package(X11 REQUIRED MODULE)") - replace_in_file(self, cmakelists, "find_package(Wayland REQUIRED)", "find_package(Wayland REQUIRED MODULE)") + # find_package(Wayland REQUIRED) was removed, as it was unused + if Version(self.version) < "1.3.231": + replace_in_file(self, cmakelists, "find_package(Wayland REQUIRED)", "find_package(Wayland REQUIRED MODULE)") replace_in_file(self, cmakelists, "find_package(DirectFB REQUIRED)", "find_package(DirectFB REQUIRED MODULE)") def build(self): diff --git a/recipes/vulkan-loader/all/patches/1.2.154.0-0001-fix-mingw.patch b/recipes/vulkan-loader/all/patches/1.2.154.0-0001-fix-mingw.patch new file mode 100644 index 0000000000000..a585b5a17fff5 --- /dev/null +++ b/recipes/vulkan-loader/all/patches/1.2.154.0-0001-fix-mingw.patch @@ -0,0 +1,77 @@ +--- a/loader/CMakeLists.txt ++++ b/loader/CMakeLists.txt +@@ -133,9 +133,28 @@ set(ASM_FAILURE_MSG "${ASM_FAILURE_MSG}Note that this may be unsafe, as the C co + set(ASM_FAILURE_MSG "${ASM_FAILURE_MSG} the stack frame for certain calls. If the compiler does not do this, then unknown device") + set(ASM_FAILURE_MSG "${ASM_FAILURE_MSG} extensions will suffer from a corrupted stack.") + if(WIN32) +- enable_language(ASM_MASM) +- if(CMAKE_ASM_MASM_COMPILER_WORKS) +- if(NOT CMAKE_CL_64) ++ if(MINGW) ++ find_program(JWASM_FOUND jwasm) ++ if (JWASM_FOUND) ++ set(CMAKE_ASM_MASM_COMPILER ${JWASM_FOUND}) ++ execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE COMPILER_VERSION_OUTPUT) ++ if (COMPILER_VERSION_OUTPUT) ++ if (COMPILER_VERSION_OUTPUT MATCHES "x86_64") ++ set(JWASM_FLAGS -win64) ++ else() ++ set(JWASM_FLAGS -coff) ++ endif() ++ endif() ++ endif() ++ endif() ++ option(USE_MASM "Use MASM" ON) ++ if (USE_MASM) ++ enable_language(ASM_MASM) ++ endif () ++ if(CMAKE_ASM_MASM_COMPILER_WORKS OR JWASM_FOUND) ++ if(MINGW) ++ set(CMAKE_ASM_MASM_FLAGS ${CMAKE_ASM_MASM_FLAGS} ${JWASM_FLAGS}) ++ elseif(NOT CMAKE_CL_64 AND NOT JWASM_FOUND) + set(CMAKE_ASM_MASM_FLAGS ${CMAKE_ASM_MASM_FLAGS} /safeseh) + endif() + +@@ -205,14 +224,16 @@ if(WIN32) + PROPERTIES LINK_FLAGS_DEBUG + "/ignore:4098" + OUTPUT_NAME +- vulkan-1) ++ vulkan-1 ++ PREFIX ++ "") + target_link_libraries(vulkan Vulkan::Headers) + + if(ENABLE_WIN10_ONECORE) + target_link_libraries(vulkan OneCoreUAP.lib LIBCMT.LIB LIBCMTD.LIB LIBVCRUNTIME.LIB LIBUCRT.LIB) + set_target_properties(vulkan PROPERTIES LINK_FLAGS "/NODEFAULTLIB") + else() +- target_link_libraries(vulkan Cfgmgr32) ++ target_link_libraries(vulkan cfgmgr32) + endif() + + add_dependencies(vulkan loader_asm_gen_files) +--- a/loader/loader.c ++++ b/loader/loader.c +@@ -71,6 +71,9 @@ + #include + #include + #include ++#ifdef __MINGW32__ ++#undef strcpy // fix error with redfined strcpy when building with MinGW-w64 ++#endif + #include + #include "adapters.h" + +@@ -695,7 +698,11 @@ VkResult loaderGetDeviceRegistryFiles(const struct loader_instance *inst, char * + LPCSTR value_name) { + static const wchar_t *softwareComponentGUID = L"{5c4c3332-344d-483c-8739-259e934c9cc8}"; + static const wchar_t *displayGUID = L"{4d36e968-e325-11ce-bfc1-08002be10318}"; ++#ifdef CM_GETIDLIST_FILTER_PRESENT + const ULONG flags = CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT; ++#else ++ const ULONG flags = 0x300; ++#endif + + wchar_t childGuid[MAX_GUID_STRING_LEN + 2]; // +2 for brackets {} + ULONG childGuidSize = sizeof(childGuid); diff --git a/recipes/vulkan-loader/all/patches/fix-mingw-1.2.182.patch b/recipes/vulkan-loader/all/patches/1.2.182-0001-fix-mingw.patch similarity index 100% rename from recipes/vulkan-loader/all/patches/fix-mingw-1.2.182.patch rename to recipes/vulkan-loader/all/patches/1.2.182-0001-fix-mingw.patch diff --git a/recipes/vulkan-loader/all/patches/1.3.231.1-0001-no-find-package-wayland.patch b/recipes/vulkan-loader/all/patches/1.3.231.1-0001-no-find-package-wayland.patch new file mode 100644 index 0000000000000..0f841d44ccf38 --- /dev/null +++ b/recipes/vulkan-loader/all/patches/1.3.231.1-0001-no-find-package-wayland.patch @@ -0,0 +1,13 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -215,10 +215,6 @@ if(UNIX AND NOT APPLE) # i.e.: Linux + find_package(X11 REQUIRED) + endif() + +- if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) +- include_directories(SYSTEM ${WAYLAND_CLIENT_INCLUDE_DIR}) +- endif() + + if(BUILD_WSI_DIRECTFB_SUPPORT) + find_package(DirectFB REQUIRED) diff --git a/recipes/vulkan-loader/all/patches/1.3.236.0-0001-cmake-minimum-required-3.10.patch b/recipes/vulkan-loader/all/patches/1.3.236.0-0001-cmake-minimum-required-3.10.patch new file mode 100644 index 0000000000000..fe88588420cd9 --- /dev/null +++ b/recipes/vulkan-loader/all/patches/1.3.236.0-0001-cmake-minimum-required-3.10.patch @@ -0,0 +1,24 @@ +--- a/loader/CMakeLists.txt ++++ b/loader/CMakeLists.txt +@@ -160,9 +160,7 @@ if(WIN32) + target_link_libraries(asm_offset PRIVATE loader_specific_options) + # If not cross compiling, run asm_offset to generage gen_defines.asm + if (NOT CMAKE_CROSSCOMPILING) +- add_custom_command(TARGET asm_offset POST_BUILD +- COMMAND asm_offset MASM +- BYPRODUCTS gen_defines.asm) ++ add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset MASM) + else() + # Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it. + target_compile_options(asm_offset PRIVATE "/Fa$/asm_offset.asm" /FA) +@@ -236,9 +234,7 @@ else() # i.e.: Linux + target_link_libraries(asm_offset loader_specific_options) + # If not cross compiling, run asm_offset to generage gen_defines.asm + if (NOT CMAKE_CROSSCOMPILING) +- add_custom_command(TARGET asm_offset POST_BUILD +- COMMAND asm_offset GAS +- BYPRODUCTS gen_defines.asm) ++ add_custom_command(OUTPUT gen_defines.asm DEPENDS asm_offset COMMAND asm_offset GAS) + else() + # Forces compiler to write the intermediate asm file, needed so that we can get sizeof/offset of info out of it. + target_compile_options(asm_offset PRIVATE -save-temps=obj) diff --git a/recipes/vulkan-loader/all/patches/fix-mingw-1.2.154.0.patch b/recipes/vulkan-loader/all/patches/fix-mingw-1.2.154.0.patch deleted file mode 100644 index ea9754bf3e7ec..0000000000000 --- a/recipes/vulkan-loader/all/patches/fix-mingw-1.2.154.0.patch +++ /dev/null @@ -1,82 +0,0 @@ -Fixes for MinGW: -https://github.com/KhronosGroup/Vulkan-Loader/pull/475 -https://github.com/KhronosGroup/Vulkan-Loader/pull/495 -https://github.com/KhronosGroup/Vulkan-Loader/pull/523 - ---- a/loader/CMakeLists.txt -+++ b/loader/CMakeLists.txt -@@ -133,9 +133,28 @@ set(ASM_FAILURE_MSG "${ASM_FAILURE_MSG}Note that this may be unsafe, as the C co - set(ASM_FAILURE_MSG "${ASM_FAILURE_MSG} the stack frame for certain calls. If the compiler does not do this, then unknown device") - set(ASM_FAILURE_MSG "${ASM_FAILURE_MSG} extensions will suffer from a corrupted stack.") - if(WIN32) -- enable_language(ASM_MASM) -- if(CMAKE_ASM_MASM_COMPILER_WORKS) -- if(NOT CMAKE_CL_64) -+ if(MINGW) -+ find_program(JWASM_FOUND jwasm) -+ if (JWASM_FOUND) -+ set(CMAKE_ASM_MASM_COMPILER ${JWASM_FOUND}) -+ execute_process(COMMAND ${CMAKE_C_COMPILER} --version OUTPUT_VARIABLE COMPILER_VERSION_OUTPUT) -+ if (COMPILER_VERSION_OUTPUT) -+ if (COMPILER_VERSION_OUTPUT MATCHES "x86_64") -+ set(JWASM_FLAGS -win64) -+ else() -+ set(JWASM_FLAGS -coff) -+ endif() -+ endif() -+ endif() -+ endif() -+ option(USE_MASM "Use MASM" ON) -+ if (USE_MASM) -+ enable_language(ASM_MASM) -+ endif () -+ if(CMAKE_ASM_MASM_COMPILER_WORKS OR JWASM_FOUND) -+ if(MINGW) -+ set(CMAKE_ASM_MASM_FLAGS ${CMAKE_ASM_MASM_FLAGS} ${JWASM_FLAGS}) -+ elseif(NOT CMAKE_CL_64 AND NOT JWASM_FOUND) - set(CMAKE_ASM_MASM_FLAGS ${CMAKE_ASM_MASM_FLAGS} /safeseh) - endif() - -@@ -205,14 +224,16 @@ if(WIN32) - PROPERTIES LINK_FLAGS_DEBUG - "/ignore:4098" - OUTPUT_NAME -- vulkan-1) -+ vulkan-1 -+ PREFIX -+ "") - target_link_libraries(vulkan Vulkan::Headers) - - if(ENABLE_WIN10_ONECORE) - target_link_libraries(vulkan OneCoreUAP.lib LIBCMT.LIB LIBCMTD.LIB LIBVCRUNTIME.LIB LIBUCRT.LIB) - set_target_properties(vulkan PROPERTIES LINK_FLAGS "/NODEFAULTLIB") - else() -- target_link_libraries(vulkan Cfgmgr32) -+ target_link_libraries(vulkan cfgmgr32) - endif() - - add_dependencies(vulkan loader_asm_gen_files) ---- a/loader/loader.c -+++ b/loader/loader.c -@@ -71,6 +71,9 @@ - #include - #include - #include -+#ifdef __MINGW32__ -+#undef strcpy // fix error with redfined strcpy when building with MinGW-w64 -+#endif - #include - #include "adapters.h" - -@@ -695,7 +698,11 @@ VkResult loaderGetDeviceRegistryFiles(const struct loader_instance *inst, char * - LPCSTR value_name) { - static const wchar_t *softwareComponentGUID = L"{5c4c3332-344d-483c-8739-259e934c9cc8}"; - static const wchar_t *displayGUID = L"{4d36e968-e325-11ce-bfc1-08002be10318}"; -+#ifdef CM_GETIDLIST_FILTER_PRESENT - const ULONG flags = CM_GETIDLIST_FILTER_CLASS | CM_GETIDLIST_FILTER_PRESENT; -+#else -+ const ULONG flags = 0x300; -+#endif - - wchar_t childGuid[MAX_GUID_STRING_LEN + 2]; // +2 for brackets {} - ULONG childGuidSize = sizeof(childGuid); diff --git a/recipes/vulkan-loader/all/test_package/CMakeLists.txt b/recipes/vulkan-loader/all/test_package/CMakeLists.txt index 00975b926f978..5a43176c74c66 100644 --- a/recipes/vulkan-loader/all/test_package/CMakeLists.txt +++ b/recipes/vulkan-loader/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) find_package(Vulkan REQUIRED) diff --git a/recipes/vulkan-loader/all/test_package/conanfile.py b/recipes/vulkan-loader/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/vulkan-loader/all/test_package/conanfile.py +++ b/recipes/vulkan-loader/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/vulkan-loader/all/test_v1_package/CMakeLists.txt b/recipes/vulkan-loader/all/test_v1_package/CMakeLists.txt index 6e3d630171e32..0d20897301b68 100644 --- a/recipes/vulkan-loader/all/test_v1_package/CMakeLists.txt +++ b/recipes/vulkan-loader/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) +cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(Vulkan REQUIRED) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE Vulkan::Vulkan) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/vulkan-loader/config.yml b/recipes/vulkan-loader/config.yml index 19625cd66e0dd..493a9fc0ba035 100644 --- a/recipes/vulkan-loader/config.yml +++ b/recipes/vulkan-loader/config.yml @@ -1,4 +1,12 @@ versions: + "1.3.239.0": + folder: all + "1.3.236.0": + folder: all + "1.3.231.1": + folder: all + "1.3.231": + folder: all "1.3.224.0": folder: all "1.3.221": diff --git a/recipes/vulkan-memory-allocator/all/conanfile.py b/recipes/vulkan-memory-allocator/all/conanfile.py index 39e07acab2792..5920e7735e904 100644 --- a/recipes/vulkan-memory-allocator/all/conanfile.py +++ b/recipes/vulkan-memory-allocator/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.tools.build import check_min_cppstd -from conan.tools.files import apply_conandata_patches, copy, get +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get from conan.tools.layout import basic_layout from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class VulkanMemoryAllocatorConan(ConanFile): @@ -22,11 +22,13 @@ def _min_cppstd(self): return "11" if Version(self.version) < "3.0.0" else "14" def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("vulkan-headers/1.3.224.0") + self.requires("vulkan-headers/1.3.236.0") def package_id(self): self.info.clear() @@ -35,9 +37,6 @@ def validate(self): if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, self._min_cppstd) - def layout(self): - basic_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -55,6 +54,4 @@ def package(self): def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/vulkan-memory-allocator/all/test_package/conanfile.py b/recipes/vulkan-memory-allocator/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/vulkan-memory-allocator/all/test_package/conanfile.py +++ b/recipes/vulkan-memory-allocator/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/vulkan-memory-allocator/all/test_v1_package/CMakeLists.txt b/recipes/vulkan-memory-allocator/all/test_v1_package/CMakeLists.txt index ead56f86c0f5a..925ecbe19e448 100644 --- a/recipes/vulkan-memory-allocator/all/test_v1_package/CMakeLists.txt +++ b/recipes/vulkan-memory-allocator/all/test_v1_package/CMakeLists.txt @@ -1,15 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(vulkan-memory-allocator REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE vulkan-memory-allocator::vulkan-memory-allocator) -if(vulkan-memory-allocator_VERSION VERSION_LESS "3.0.0") - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) -else() - target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/vulkan-validationlayers/all/CMakeLists.txt b/recipes/vulkan-validationlayers/all/CMakeLists.txt deleted file mode 100644 index d4a511891ccf3..0000000000000 --- a/recipes/vulkan-validationlayers/all/CMakeLists.txt +++ /dev/null @@ -1,13 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -if(NOT TARGET glslang) - add_library(glslang INTERFACE) # fake target for upstream CMakeLists (glslang required by tests only) -endif() - -find_package(SPIRV-Tools REQUIRED CONFIG) - -add_subdirectory(source_subfolder) diff --git a/recipes/vulkan-validationlayers/all/conandata.yml b/recipes/vulkan-validationlayers/all/conandata.yml index 9d695319580e0..f251df5a89323 100644 --- a/recipes/vulkan-validationlayers/all/conandata.yml +++ b/recipes/vulkan-validationlayers/all/conandata.yml @@ -1,4 +1,13 @@ sources: + "1.3.236.0": + url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.236.0.tar.gz" + sha256: "68f2cf70b1960f85e931ef56935e6ceda1beeb214f8fa319e6b95128b02b485a" + "1.3.231.1": + url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.231.1.tar.gz" + sha256: "ea40af0f499e7e97a86ee54410c5c78e7f7bac40f65ae09a1549773b6501bf4d" + "1.3.224.1": + url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.224.1.tar.gz" + sha256: "49c00e0119e3bc11e13c0c740e57c76b582b14f754f3779b85508c4d90d9df85" "1.3.216.0": url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/refs/tags/sdk-1.3.216.0.tar.gz" sha256: "593d9b818d536490b70322a01b306ec165df5e7a70d770d05014fbd0b325fa15" @@ -17,25 +26,43 @@ sources: "1.2.182": url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/v1.2.182.tar.gz" sha256: "5a1f7027c06a8e5ae777d9053b5ce46f10ca623806a43332eb2da06fe46476d4" - "1.2.154.0": - url: "https://github.com/KhronosGroup/Vulkan-ValidationLayers/archive/sdk-1.2.154.0.tar.gz" - sha256: "8898ab05d0d8dec04fbba03d0ed2e79a1eb5c0382e5c89d4c737b45a6648f7f9" patches: + "1.3.236.0": + - patch_file: "patches/1.3.236.0-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + "1.3.231.1": + - patch_file: "patches/1.3.231.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + - patch_file: "patches/1.3.231.1-0002-cmake-no-werror.patch" + patch_description: "Allow to disable Werror for old gcc/clang versions" + patch_type: "portability" + "1.3.224.1": + - patch_file: "patches/1.3.224.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + "1.3.216.0": + - patch_file: "patches/1.3.204.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + "1.3.211.0": + - patch_file: "patches/1.3.204.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" + "1.3.204.1": + - patch_file: "patches/1.3.204.1-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" "1.2.198.0": - - patch_file: "patches/0005-fix-cmake-1.2.198.0.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.2.198.0-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" "1.2.189.2": - - patch_file: "patches/0005-fix-cmake-1.2.189.2.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.2.189.2-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" "1.2.182": - - patch_file: "patches/0005-fix-cmake-1.2.182.patch" - base_path: "source_subfolder" - "1.2.154.0": - - patch_file: "patches/0001-duplicated-declaration.patch" - base_path: "source_subfolder" - - patch_file: "patches/0002-fix-mingw.patch" - base_path: "source_subfolder" - - patch_file: "patches/0003-disable-nortti-and-warnings-as-errors.patch" - base_path: "source_subfolder" - - patch_file: "patches/0004-fix-installation.patch" - base_path: "source_subfolder" + - patch_file: "patches/1.2.182-0001-fix-cmake.patch" + patch_description: "CMake: Adapt to conan" + patch_type: "conan" diff --git a/recipes/vulkan-validationlayers/all/conanfile.py b/recipes/vulkan-validationlayers/all/conanfile.py index 6abb4ae5f0675..aac6abc417151 100644 --- a/recipes/vulkan-validationlayers/all/conanfile.py +++ b/recipes/vulkan-validationlayers/all/conanfile.py @@ -1,12 +1,18 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanException, ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanException, ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.env import Environment, VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, mkdir, rename, replace_in_file, rm +from conan.tools.gnu import PkgConfigDeps +from conan.tools.scm import Version import functools import glob import os import shutil import yaml -required_conan_version = ">=1.35.0" +required_conan_version = ">=1.52.0" class VulkanValidationLayersConan(ConanFile): @@ -30,11 +36,6 @@ class VulkanValidationLayersConan(ConanFile): } short_paths = True - generators = "cmake", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" @property def _dependencies_filename(self): @@ -49,13 +50,40 @@ def _dependencies_versions(self): cached_dependencies = yaml.safe_load(open(dependencies_filepath)) return cached_dependencies + @property + def _needs_wayland_for_build(self): + return self.options.get_safe("with_wsi_wayland") and Version(self.version) < "1.3.231" + + @property + def _needs_pkg_config(self): + return self.options.get_safe("with_wsi_xcb") or \ + self.options.get_safe("with_wsi_xlib") or \ + self._needs_wayland_for_build + + @property + def _min_cppstd(self): + if Version(self.version) >= "1.3.235": + return "17" + return "11" + + @property + def _compilers_minimum_version(self): + return { + "11": {}, + "17": { + "apple-clang": "9", + "clang": "6", + "gcc": "7", + "msvc": "191", + "Visual Studio": "15.7", + }, + }[self._min_cppstd] + def export(self): - self.copy(self._dependencies_filename, src="dependencies", dst="dependencies") + copy(self, f"dependencies/{self._dependencies_filename}", self.recipe_folder, self.export_folder) def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os not in ["Linux", "FreeBSD"]: @@ -63,28 +91,18 @@ def config_options(self): del self.options.with_wsi_xlib del self.options.with_wsi_wayland - @staticmethod - def _greater_equal_semver(v1, v2): - lv1 = [int(v) for v in v1.split(".")] - lv2 = [int(v) for v in v2.split(".")] - diff_len = len(lv2) - len(lv1) - if diff_len > 0: - lv1.extend([0] * diff_len) - elif diff_len < 0: - lv2.extend([0] * -diff_len) - return lv1 >= lv2 + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): + self.requires("robin-hood-hashing/3.11.5") # TODO: set private=True, once the issue is resolved https://github.com/conan-io/conan/issues/9390 self.requires(self._require("spirv-tools"), private=not hasattr(self, "settings_build")) self.requires(self._require("vulkan-headers")) - # TODO: use tools.Version comparison once https://github.com/conan-io/conan/issues/10000 is fixed - if self._greater_equal_semver(self.version, "1.2.173"): - self.requires("robin-hood-hashing/3.11.5") if self.options.get_safe("with_wsi_xcb") or self.options.get_safe("with_wsi_xlib"): self.requires("xorg/system") - if self.options.get_safe("with_wsi_wayland"): - self.requires("wayland/1.20.0") + if self._needs_wayland_for_build: + self.requires("wayland/1.21.0") def _require(self, recipe_name): if recipe_name not in self._dependencies_versions: @@ -93,76 +111,118 @@ def _require(self, recipe_name): def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.info.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.info.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) - if self.options["spirv-tools"].shared: + if self.dependencies["spirv-tools"].options.shared: raise ConanInvalidConfiguration("vulkan-validationlayers can't depend on shared spirv-tools") - if self.settings.compiler == "gcc" and tools.Version(self.settings.compiler.version) < "5": + if self.settings.compiler == "gcc" and Version(self.settings.compiler.version) < "5": raise ConanInvalidConfiguration("gcc < 5 is not supported") + def build_requirements(self): + if self._needs_pkg_config and not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def build(self): - self._patch_sources() - cmake = self._configure_cmake() - cmake.build() + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = CMakeToolchain(self) + if Version(self.version) < "1.3.234": + tc.variables["VULKAN_HEADERS_INSTALL_DIR"] = self.dependencies["vulkan-headers"].package_folder.replace("\\", "/") + tc.variables["USE_CCACHE"] = False + if self.settings.os in ["Linux", "FreeBSD"]: + tc.variables["BUILD_WSI_XCB_SUPPORT"] = self.options.with_wsi_xcb + tc.variables["BUILD_WSI_XLIB_SUPPORT"] = self.options.with_wsi_xlib + tc.variables["BUILD_WSI_WAYLAND_SUPPORT"] = self.options.with_wsi_wayland + tc.variables["BUILD_WERROR"] = False + tc.variables["BUILD_TESTS"] = False + tc.variables["INSTALL_TESTS"] = False + tc.variables["BUILD_LAYERS"] = True + tc.variables["BUILD_LAYER_SUPPORT_FILES"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + if self._needs_pkg_config: + deps = PkgConfigDeps(self) + deps.generate() + # TODO: to remove when properly handled by conan (see https://github.com/conan-io/conan/issues/11962) + env = Environment() + env.prepend_path("PKG_CONFIG_PATH", self.generators_folder) + env.vars(self).save_script("conanbuildenv_pkg_config_path") def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - tools.replace_in_file(os.path.join(self._source_subfolder, "cmake", "FindVulkanHeaders.cmake"), - "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry", - "HINTS ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry") + apply_conandata_patches(self) + # Vulkan-ValidationLayers relies on Vulkan-Headers version from CMake config file + # to set api_version in its manifest file, but this value MUST have format x.y.z (no extra number). + # FIXME: find a way to force correct version in CMakeDeps of vulkan-headers recipe? + if Version(self.version) >= "1.3.235": + vk_version = Version(self.dependencies["vulkan-headers"].ref.version) + sanitized_vk_version = f"{vk_version.major}.{vk_version.minor}.{vk_version.patch}" + replace_in_file( + self, os.path.join(self.source_folder, "layers", "CMakeLists.txt"), + "set(JSON_API_VERSION ${VulkanHeaders_VERSION})", + f"set(JSON_API_VERSION \"{sanitized_vk_version}\")", + ) # FIXME: two CMake module/config files should be generated (SPIRV-ToolsConfig.cmake and SPIRV-Tools-optConfig.cmake), # but it can't be modeled right now in spirv-tools recipe - if not os.path.exists("SPIRV-Tools-optConfig.cmake"): - shutil.copy("SPIRV-ToolsConfig.cmake", "SPIRV-Tools-optConfig.cmake") + if not os.path.exists(os.path.join(self.generators_folder, "SPIRV-Tools-optConfig.cmake")): + shutil.copy( + os.path.join(self.generators_folder, "SPIRV-ToolsConfig.cmake"), + os.path.join(self.generators_folder, "SPIRV-Tools-optConfig.cmake"), + ) - @functools.lru_cache(1) - def _configure_cmake(self): + def build(self): + self._patch_sources() cmake = CMake(self) - cmake.definitions["VULKAN_HEADERS_INSTALL_DIR"] = self.deps_cpp_info["vulkan-headers"].rootpath - cmake.definitions["USE_CCACHE"] = False - if self.settings.os in ["Linux", "FreeBSD"]: - cmake.definitions["BUILD_WSI_XCB_SUPPORT"] = self.options.with_wsi_xcb - cmake.definitions["BUILD_WSI_XLIB_SUPPORT"] = self.options.with_wsi_xlib - cmake.definitions["BUILD_WSI_WAYLAND_SUPPORT"] = self.options.with_wsi_wayland - cmake.definitions["BUILD_WERROR"] = False - cmake.definitions["BUILD_TESTS"] = False - cmake.definitions["INSTALL_TESTS"] = False - cmake.definitions["BUILD_LAYERS"] = True - cmake.definitions["BUILD_LAYER_SUPPORT_FILES"] = True cmake.configure() - return cmake + cmake.build() def package(self): - self.copy("LICENSE.txt", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) if self.settings.os == "Windows": # import lib is useless, validation layers are loaded at runtime lib_dir = os.path.join(self.package_folder, "lib") - tools.remove_files_by_mask(lib_dir, "VkLayer_khronos_validation.lib") - tools.remove_files_by_mask(lib_dir, "libVkLayer_khronos_validation.dll.a") + rm(self, "VkLayer_khronos_validation.lib", lib_dir) + rm(self, "libVkLayer_khronos_validation.dll.a", lib_dir) # move dll and json manifest files in bin folder bin_dir = os.path.join(self.package_folder, "bin") - tools.mkdir(bin_dir) + mkdir(self, bin_dir) for ext in ("*.dll", "*.json"): for bin_file in glob.glob(os.path.join(lib_dir, ext)): shutil.move(bin_file, os.path.join(bin_dir, os.path.basename(bin_file))) else: # Move json files to res, but keep in mind to preserve relative # path between module library and manifest json file - tools.rename(os.path.join(self.package_folder, "share"), os.path.join(self.package_folder, "res")) + rename(self, os.path.join(self.package_folder, "share"), os.path.join(self.package_folder, "res")) def package_info(self): self.cpp_info.libs = ["VkLayer_utils"] manifest_subfolder = "bin" if self.settings.os == "Windows" else os.path.join("res", "vulkan", "explicit_layer.d") vk_layer_path = os.path.join(self.package_folder, manifest_subfolder) - self.output.info("Prepending to VK_LAYER_PATH runtime environment variable: {}".format(vk_layer_path)) + self.output.info(f"Prepending to VK_LAYER_PATH runtime environment variable: {vk_layer_path}") self.runenv_info.prepend_path("VK_LAYER_PATH", vk_layer_path) # TODO: to remove after conan v2, it allows to not break consumers still relying on virtualenv generator self.env_info.VK_LAYER_PATH.append(vk_layer_path) diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.154.0.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.154.0.yml deleted file mode 100644 index 89220f11bfbe0..0000000000000 --- a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.2.154.0.yml +++ /dev/null @@ -1,2 +0,0 @@ -spirv-tools: "2020.5" -vulkan-headers: "1.2.154.0" diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.224.1.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.224.1.yml new file mode 100644 index 0000000000000..17115c7cd5750 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.224.1.yml @@ -0,0 +1,2 @@ +spirv-tools: "1.3.224.0" +vulkan-headers: "1.3.224.0" diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.231.1.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.231.1.yml new file mode 100644 index 0000000000000..bfd00812c5211 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.231.1.yml @@ -0,0 +1,2 @@ +spirv-tools: "1.3.231.1" +vulkan-headers: "1.3.231.1" diff --git a/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.236.0.yml b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.236.0.yml new file mode 100644 index 0000000000000..830bb842e9002 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/dependencies/dependencies-1.3.236.0.yml @@ -0,0 +1,2 @@ +spirv-tools: "1.3.236.0" +vulkan-headers: "1.3.236.0" diff --git a/recipes/vulkan-validationlayers/all/patches/0001-duplicated-declaration.patch b/recipes/vulkan-validationlayers/all/patches/0001-duplicated-declaration.patch deleted file mode 100644 index ef1e6f9cb33ea..0000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0001-duplicated-declaration.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/layers/range_vector.h -+++ b/layers/range_vector.h -@@ -141,8 +141,6 @@ class range_view { - const Range &range_; - }; - --template --using const_correct_iterator = decltype(std::declval().begin()); - - // Type parameters for the range_map(s) - struct insert_range_no_split_bounds { diff --git a/recipes/vulkan-validationlayers/all/patches/0002-fix-mingw.patch b/recipes/vulkan-validationlayers/all/patches/0002-fix-mingw.patch deleted file mode 100644 index 8a5be818754e9..0000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0002-fix-mingw.patch +++ /dev/null @@ -1,34 +0,0 @@ -see https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2549 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -287,6 +287,9 @@ add_library(VkLayer_utils - target_link_libraries(VkLayer_utils PUBLIC Vulkan::Headers) - if(WIN32) - target_compile_definitions(VkLayer_utils PUBLIC _CRT_SECURE_NO_WARNINGS) -+ if(MINGW) -+ target_compile_definitions(VkLayer_utils PUBLIC "_WIN32_WINNT=0x0600") -+ endif() - endif() - install(TARGETS VkLayer_utils DESTINATION ${CMAKE_INSTALL_LIBDIR}) - set_target_properties(VkLayer_utils PROPERTIES LINKER_LANGUAGE CXX) ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -139,7 +139,7 @@ endif() - - include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/generated ${VulkanHeaders_INCLUDE_DIR}) - --if(WIN32) -+if(MSVC) - # Applies to all configurations - add_definitions(-D_CRT_SECURE_NO_WARNINGS -DNOMINMAX) - # Avoid: fatal error C1128: number of sections exceeded object file format limit: compile with /bigobj -@@ -150,6 +150,9 @@ if(WIN32) - # that constructor initializers are now fixed to clear the struct members. - add_compile_options("$<$,$,19>>:/wd4351>") - else() -+ if(MINGW) -+ add_compile_options("-Wa,-mbig-obj") -+ endif() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wpointer-arith -Wno-unused-function -Wno-sign-compare") - endif() diff --git a/recipes/vulkan-validationlayers/all/patches/0003-disable-nortti-and-warnings-as-errors.patch b/recipes/vulkan-validationlayers/all/patches/0003-disable-nortti-and-warnings-as-errors.patch deleted file mode 100644 index d9c8bd409372f..0000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0003-disable-nortti-and-warnings-as-errors.patch +++ /dev/null @@ -1,34 +0,0 @@ -rtti enabled: -https://github.com/KhronosGroup/Vulkan-ValidationLayers/commit/3a0631bd11f25113d28c65d9984d3f3b486026b4 -no warnings as errors submitted to upstream project: -https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2300 -https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2552 ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -118,12 +118,14 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") - -fvisibility=hidden) - - # Treat warnings as errors for versions of GCC and c++11-compliant Clang versions that are shipped on Ubuntu 18.04 or older. -+ if(BUILD_WERROR) - if((CMAKE_COMPILER_IS_GNUCXX AND NOT (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 7.3.0)) OR - (("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") AND - (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0.0) AND - (CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 7.0.0))) - add_compile_options(-Werror) - endif() -+ endif() - - set(CMAKE_C_STANDARD 99) - set(CMAKE_CXX_STANDARD 11) -@@ -136,9 +138,9 @@ if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang") - endif() - elseif(MSVC) - # Treat warnings as errors -+ if(BUILD_WERROR) - add_compile_options("/WX") -- # Disable RTTI -- add_compile_options("/GR-") -+ endif() - # Warn about nested declarations - add_compile_options("/w34456") - # Warn about potentially uninitialized variables diff --git a/recipes/vulkan-validationlayers/all/patches/0004-fix-installation.patch b/recipes/vulkan-validationlayers/all/patches/0004-fix-installation.patch deleted file mode 100644 index 2fe7804510f4b..0000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0004-fix-installation.patch +++ /dev/null @@ -1,37 +0,0 @@ -see: -https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2307 -https://github.com/KhronosGroup/Vulkan-ValidationLayers/pull/2551 ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -72,7 +72,7 @@ if(BUILD_LAYER_SUPPORT_FILES) - generated/vk_object_types.h - generated/vk_extension_helper.h - generated/vk_typemap_helper.h) -- install(FILES ${LAYER_UTIL_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) -+ install(FILES ${LAYER_UTIL_FILES} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/vulkan) - endif() - - set(TARGET_NAMES -@@ -83,11 +83,11 @@ if(BUILD_LAYERS) - if(WIN32) - if(CMAKE_GENERATOR MATCHES "^Visual Studio.*") - foreach(TARGET_NAME ${TARGET_NAMES}) -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES $/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endforeach() - else() - foreach(TARGET_NAME ${TARGET_NAMES}) -- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_LIBDIR}) -+ install(FILES $/${TARGET_NAME}.json DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endforeach() - endif() - elseif(UNIX) # UNIX includes APPLE -@@ -124,7 +127,7 @@ elseif(APPLE) - "-Wl" - INSTALL_RPATH - "@loader_path/") -- install(TARGETS VkLayer_${target} DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) -+ install(TARGETS VkLayer_${target} DESTINATION ${CMAKE_INSTALL_LIBDIR}) - endmacro() - else(UNIX AND NOT APPLE) # i.e.: Linux - macro(AddVkLayer target LAYER_COMPILE_DEFINITIONS) diff --git a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.182.patch b/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.182.patch deleted file mode 100644 index 23f54090508e9..0000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.182.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -237,10 +237,7 @@ option(BUILD_LAYERS "Build layers" ON) - option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers - option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) - if (USE_ROBIN_HOOD_HASHING) -- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) -- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") -- endif() -- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") -+ find_package(robin_hood REQUIRED CONFIG) - endif() - - if(BUILD_TESTS OR BUILD_LAYERS) -@@ -389,7 +386,7 @@ target_include_directories(VkLayer_utils - ${VulkanHeaders_INCLUDE_DIR}) - - if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -+ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) - target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) - endif() - ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -291,9 +291,6 @@ if(BUILD_LAYERS) - if(INSTRUMENT_OPTICK) - target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) - endif() -- if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -- endif() - target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) - - # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.189.2.patch b/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.189.2.patch deleted file mode 100644 index 3f250cc259e56..0000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.189.2.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -240,10 +240,7 @@ option(BUILD_LAYERS "Build layers" ON) - option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers - option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) - if (USE_ROBIN_HOOD_HASHING) -- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) -- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") -- endif() -- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") -+ find_package(robin_hood REQUIRED CONFIG) - endif() - - if(BUILD_TESTS) -@@ -375,7 +372,7 @@ target_include_directories(VkLayer_utils - ${VulkanHeaders_INCLUDE_DIR}) - - if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -+ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) - target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) - endif() - ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -297,9 +297,6 @@ if(BUILD_LAYERS) - if(INSTRUMENT_OPTICK) - target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) - endif() -- if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -- endif() - target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) - - # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.198.0.patch b/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.198.0.patch deleted file mode 100644 index 00e8fb562f304..0000000000000 --- a/recipes/vulkan-validationlayers/all/patches/0005-fix-cmake-1.2.198.0.patch +++ /dev/null @@ -1,35 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -237,10 +237,7 @@ option(BUILD_LAYERS "Build layers" ON) - option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers - option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) - if (USE_ROBIN_HOOD_HASHING) -- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) -- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") -- endif() -- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") -+ find_package(robin_hood REQUIRED CONFIG) - endif() - - if(BUILD_TESTS) -@@ -372,7 +369,7 @@ target_include_directories(VkLayer_utils - ${VulkanHeaders_INCLUDE_DIR}) - - if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -+ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) - target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) - endif() - ---- a/layers/CMakeLists.txt -+++ b/layers/CMakeLists.txt -@@ -301,9 +301,6 @@ if(BUILD_LAYERS) - if(INSTRUMENT_OPTICK) - target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) - endif() -- if (USE_ROBIN_HOOD_HASHING) -- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) -- endif() - target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) - - # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/1.2.182-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.2.182-0001-fix-cmake.patch new file mode 100644 index 0000000000000..1df1151c34367 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.2.182-0001-fix-cmake.patch @@ -0,0 +1,83 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -102,7 +102,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -154,7 +154,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +@@ -237,13 +237,10 @@ option(BUILD_LAYERS "Build layers" ON) + option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers + option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) + if (USE_ROBIN_HOOD_HASHING) +- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) +- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") +- endif() +- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") ++ find_package(robin_hood REQUIRED CONFIG) + endif() + +-if(BUILD_TESTS OR BUILD_LAYERS) ++if(BUILD_TESTS) + + set(GLSLANG_INSTALL_DIR "GLSLANG-NOTFOUND" CACHE PATH "Absolute path to a glslang install directory") + if(NOT GLSLANG_INSTALL_DIR AND NOT DEFINED ENV{GLSLANG_INSTALL_DIR} AND NOT TARGET glslang) +@@ -302,8 +299,14 @@ if(BUILD_TESTS OR BUILD_LAYERS) + set(GLSLANG_SPIRV_INCLUDE_DIR "${glslang_SOURCE_DIR}" CACHE PATH "Path to glslang spirv headers") + set(GLSLANG_LIBRARIES glslang SPIRV SPVRemapper) + endif() ++endif() + ++if(BUILD_TESTS OR BUILD_LAYERS) + # spirv-tools ++ find_package(SPIRV-Tools REQUIRED CONFIG) ++ if(NOT TARGET SPIRV-Tools-opt) ++ find_package(SPIRV-Tools-opt REQUIRED CONFIG) ++ endif() + if (NOT TARGET SPIRV-Tools) + if(NOT SPIRV_TOOLS_INSTALL_DIR) + set(SPIRV_TOOLS_INSTALL_DIR "${GLSLANG_INSTALL_DIR}") +@@ -389,7 +392,7 @@ target_include_directories(VkLayer_utils + ${VulkanHeaders_INCLUDE_DIR}) + + if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) ++ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) + target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) + endif() + +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_CMAKE_FIND_ROOT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH) + else() + # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, +--- a/layers/CMakeLists.txt ++++ b/layers/CMakeLists.txt +@@ -291,9 +291,6 @@ if(BUILD_LAYERS) + if(INSTRUMENT_OPTICK) + target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) + endif() +- if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) +- endif() + target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) + + # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/1.2.189.2-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.2.189.2-0001-fix-cmake.patch new file mode 100644 index 0000000000000..a5cb883c9cc3a --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.2.189.2-0001-fix-cmake.patch @@ -0,0 +1,75 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -111,7 +111,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -163,7 +163,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +@@ -240,10 +240,7 @@ option(BUILD_LAYERS "Build layers" ON) + option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers + option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) + if (USE_ROBIN_HOOD_HASHING) +- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) +- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") +- endif() +- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") ++ find_package(robin_hood REQUIRED CONFIG) + endif() + + if(BUILD_TESTS) +@@ -307,6 +304,10 @@ endif() + + if(BUILD_TESTS OR BUILD_LAYERS) + # spirv-tools ++ find_package(SPIRV-Tools REQUIRED CONFIG) ++ if(NOT TARGET SPIRV-Tools-opt) ++ find_package(SPIRV-Tools-opt REQUIRED CONFIG) ++ endif() + if (NOT TARGET SPIRV-Tools) + if(NOT SPIRV_TOOLS_INSTALL_DIR) + set(SPIRV_TOOLS_INSTALL_DIR "${GLSLANG_INSTALL_DIR}") +@@ -375,7 +376,7 @@ target_include_directories(VkLayer_utils + ${VulkanHeaders_INCLUDE_DIR}) + + if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) ++ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) + target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) + endif() + +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_CMAKE_FIND_ROOT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH) + else() + # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, +--- a/layers/CMakeLists.txt ++++ b/layers/CMakeLists.txt +@@ -297,9 +297,6 @@ if(BUILD_LAYERS) + if(INSTRUMENT_OPTICK) + target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) + endif() +- if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) +- endif() + target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) + + # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/1.2.198.0-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.2.198.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..e482c6be482cf --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.2.198.0-0001-fix-cmake.patch @@ -0,0 +1,75 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -108,7 +108,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -160,7 +160,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +@@ -237,10 +237,7 @@ option(BUILD_LAYERS "Build layers" ON) + option(BUILD_LAYER_SUPPORT_FILES "Generate layer files" OFF) # For generating files when not building layers + option(USE_ROBIN_HOOD_HASHING "Use robin-hood-hashing" ON) + if (USE_ROBIN_HOOD_HASHING) +- if(NOT ROBIN_HOOD_HASHING_INSTALL_DIR) +- set(ROBIN_HOOD_HASHING_INSTALL_DIR $ENV{ROBIN_HOOD_HASHING_INSTALL_DIR} PATH "Path to robin-hood-hashing repository") +- endif() +- set(ROBIN_HOOD_HASHING_INCLUDE_DIR "${ROBIN_HOOD_HASHING_INSTALL_DIR}/src/include" PATH "Path to robin-hood-hashing/src/include") ++ find_package(robin_hood REQUIRED CONFIG) + endif() + + if(BUILD_TESTS) +@@ -304,6 +301,10 @@ endif() + + if(BUILD_TESTS OR BUILD_LAYERS) + # spirv-tools ++ find_package(SPIRV-Tools REQUIRED CONFIG) ++ if(NOT TARGET SPIRV-Tools-opt) ++ find_package(SPIRV-Tools-opt REQUIRED CONFIG) ++ endif() + if (NOT TARGET SPIRV-Tools) + if(NOT SPIRV_TOOLS_INSTALL_DIR) + set(SPIRV_TOOLS_INSTALL_DIR "${GLSLANG_INSTALL_DIR}") +@@ -372,7 +373,7 @@ target_include_directories(VkLayer_utils + ${VulkanHeaders_INCLUDE_DIR}) + + if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_utils PUBLIC ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) ++ target_link_libraries(VkLayer_utils PUBLIC robin_hood::robin_hood) + target_compile_definitions(VkLayer_utils PUBLIC USE_ROBIN_HOOD_HASHING) + endif() + +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_CMAKE_FIND_ROOT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH) + else() + # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, +--- a/layers/CMakeLists.txt ++++ b/layers/CMakeLists.txt +@@ -301,9 +301,6 @@ if(BUILD_LAYERS) + if(INSTRUMENT_OPTICK) + target_include_directories(VkLayer_khronos_validation PRIVATE ${OPTICK_SOURCE_DIR}) + endif() +- if (USE_ROBIN_HOOD_HASHING) +- target_include_directories(VkLayer_khronos_validation PRIVATE ${ROBIN_HOOD_HASHING_INCLUDE_DIR}) +- endif() + target_link_libraries(VkLayer_khronos_validation PRIVATE ${SPIRV_TOOLS_LIBRARIES}) + + # The output file needs Unix "/" separators or Windows "\" separators On top of that, Windows separators actually need to be doubled diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.204.1-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.204.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..319efad89dcde --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.204.1-0001-fix-cmake.patch @@ -0,0 +1,31 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -122,7 +122,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -174,7 +174,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -62,7 +62,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_CMAKE_FIND_ROOT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH) + else() + # If VULKAN_HEADERS_INSTALL_DIR, or one of its variants was not specified, diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.224.1-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.224.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..76ce4f2ef3df3 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.224.1-0001-fix-cmake.patch @@ -0,0 +1,31 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -122,7 +122,7 @@ if (TARGET Vulkan::Headers) + get_target_property(VulkanHeaders_INCLUDE_DIRS Vulkan::Headers INTERFACE_INCLUDE_DIRECTORIES) + get_target_property(VulkanRegistry_DIR Vulkan::Registry INTERFACE_INCLUDE_DIRECTORIES) + else() +- find_package(VulkanHeaders REQUIRED) ++ find_package(VulkanHeaders REQUIRED MODULE) + + # xxxnsubtil: this should eventually be replaced by exported targets + add_library(Vulkan-Headers INTERFACE) +@@ -174,7 +174,7 @@ if(UNIX AND NOT APPLE) # i.e. Linux + endif() + + if(BUILD_WSI_WAYLAND_SUPPORT) +- find_package(Wayland REQUIRED) ++ find_package(Wayland REQUIRED MODULE) + include_directories(${WAYLAND_CLIENT_INCLUDE_DIR}) + endif() + endif() +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -63,7 +63,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_DEFAULT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) + else() diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0001-fix-cmake.patch new file mode 100644 index 0000000000000..dc7286044497f --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0001-fix-cmake.patch @@ -0,0 +1,30 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -103,7 +103,7 @@ if (GOOGLETEST_INSTALL_DIR) + list(APPEND CMAKE_PREFIX_PATH ${GOOGLETEST_INSTALL_DIR}) + endif() + +-find_package(VulkanHeaders REQUIRED) ++find_package(VulkanHeaders REQUIRED MODULE) + add_library(Vulkan-Headers INTERFACE) + target_include_directories(Vulkan-Headers INTERFACE ${VulkanHeaders_INCLUDE_DIRS}) + add_library(Vulkan::Headers ALIAS Vulkan-Headers) +@@ -229,7 +229,6 @@ if(BUILD_LAYERS OR BUILD_TESTS) + endif() + + # VVLGenerateSourceCode depends on spirv/unified1 +- include(VVLGenerateSourceCode) + + if (NOT TARGET SPIRV-Tools-opt) + find_package(SPIRV-Tools-opt REQUIRED CONFIG) +--- a/cmake/FindVulkanHeaders.cmake ++++ b/cmake/FindVulkanHeaders.cmake +@@ -63,7 +63,7 @@ if(DEFINED VULKAN_HEADERS_INSTALL_DIR) + NO_DEFAULT_PATH) + find_path(VulkanRegistry_DIR + NAMES vk.xml +- HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ++ HINTS ${VULKAN_HEADERS_INSTALL_DIR}/share/vulkan/registry ${VULKAN_HEADERS_INSTALL_DIR}/res/vulkan/registry + NO_CMAKE_FIND_ROOT_PATH + NO_DEFAULT_PATH) + else() diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0002-cmake-no-werror.patch b/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0002-cmake-no-werror.patch new file mode 100644 index 0000000000000..5d410a8c7a09e --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.231.1-0002-cmake-no-werror.patch @@ -0,0 +1,13 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -171,9 +171,7 @@ if(${CMAKE_C_COMPILER_ID} MATCHES "(GNU|Clang)") + -fno-builtin-memcmp) + + # Treat warnings as errors for versions of GCC and c++11-compliant Clang versions that are shipped on Ubuntu 18.04 or older. +- if(BUILD_WERROR OR +- (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU" AND CMAKE_CXX_COMPILER_VERSION VERSION_LESS_EQUAL 7.3.0) OR +- (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang" AND CMAKE_CXX_COMPILER_VERSION VERSION_GREATER_EQUAL 6.0.0)) ++ if(BUILD_WERROR) + add_compile_options(-Werror) + endif() + diff --git a/recipes/vulkan-validationlayers/all/patches/1.3.236.0-0001-fix-cmake.patch b/recipes/vulkan-validationlayers/all/patches/1.3.236.0-0001-fix-cmake.patch new file mode 100644 index 0000000000000..f63003f30dac5 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/patches/1.3.236.0-0001-fix-cmake.patch @@ -0,0 +1,10 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -230,7 +230,6 @@ endif() + if(BUILD_LAYERS OR BUILD_TESTS) + find_package(SPIRV-Headers REQUIRED CONFIG QUIET) + +- include(VVLGenerateSourceCode) + + find_package(SPIRV-Tools-opt REQUIRED CONFIG QUIET) + diff --git a/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt b/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt index d79aaa901551f..f968d5c77f977 100644 --- a/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt +++ b/recipes/vulkan-validationlayers/all/test_package/CMakeLists.txt @@ -1,9 +1,12 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(vulkan-validationlayers REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +target_link_libraries(${PROJECT_NAME} PRIVATE vulkan-validationlayers::vulkan-validationlayers) +if(vulkan-validationlayers_VERSION VERSION_GREATER_EQUAL "1.3.235") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +endif() diff --git a/recipes/vulkan-validationlayers/all/test_package/conanfile.py b/recipes/vulkan-validationlayers/all/test_package/conanfile.py index 5c09494bc67c0..0a6bc68712d90 100644 --- a/recipes/vulkan-validationlayers/all/test_package/conanfile.py +++ b/recipes/vulkan-validationlayers/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/vulkan-validationlayers/all/test_v1_package/CMakeLists.txt b/recipes/vulkan-validationlayers/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/vulkan-validationlayers/all/test_v1_package/conanfile.py b/recipes/vulkan-validationlayers/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/vulkan-validationlayers/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/vulkan-validationlayers/config.yml b/recipes/vulkan-validationlayers/config.yml index 0e539bdcf5f56..8da325f5c1293 100644 --- a/recipes/vulkan-validationlayers/config.yml +++ b/recipes/vulkan-validationlayers/config.yml @@ -1,4 +1,10 @@ versions: + "1.3.236.0": + folder: all + "1.3.231.1": + folder: all + "1.3.224.1": + folder: all "1.3.216.0": folder: all "1.3.211.0": @@ -11,5 +17,3 @@ versions: folder: all "1.2.182": folder: all - "1.2.154.0": - folder: all diff --git a/recipes/wasmedge/all/conandata.yml b/recipes/wasmedge/all/conandata.yml index f6bd77980ef83..363797364db78 100644 --- a/recipes/wasmedge/all/conandata.yml +++ b/recipes/wasmedge/all/conandata.yml @@ -1,4 +1,86 @@ sources: + "0.11.2": + Windows: + "x86_64": + Visual Studio: + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-windows.zip" + sha256: "ca49b98c0cf5f187e08c3ba71afc8d71365fde696f10b4219379a4a4d1a91e6d" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.2/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Linux: + "x86_64": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-manylinux2014_x86_64.tar.gz" + sha256: "784bf1eb25928e2cf02aa88e9372388fad682b4a188485da3cd9162caeedf143" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.2/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-manylinux2014_aarch64.tar.gz" + sha256: "a2766a4c1edbaea298a30e5431a4e795003a10d8398a933d923f23d4eb4fa5d1" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Macos: + "x86_64": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-darwin_x86_64.tar.gz" + sha256: "aedec53f29b1e0b657e46e67dba3e2f32a2924f4d9136e60073ea1aba3073e70" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.2/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-darwin_arm64.tar.gz" + sha256: "fe391df90e1eee69cf1e976f5ddf60c20f29b651710aaa4fc03e2ab4fe52c0d3" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.2/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Android: + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.2/WasmEdge-0.11.2-android_aarch64.tar.gz" + sha256: "69e308f5927c753b2bb5639569d10219b60598174d8b304bdf310093fd7b2464" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.2/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "0.11.1": + Windows: + "x86_64": + Visual Studio: + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.1/WasmEdge-0.11.1-windows.zip" + sha256: "c86f6384555a0484a5dd81faba5636bba78f5e3d6eaf627d880e34843f9e24bf" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Linux: + "x86_64": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.1/WasmEdge-0.11.1-manylinux2014_x86_64.tar.gz" + sha256: "76ce4ea0eb86adfa52c73f6c6b44383626d94990e0923cae8b1e6f060ef2bf5b" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.1/WasmEdge-0.11.1-manylinux2014_aarch64.tar.gz" + sha256: "cb9ea32932360463991cfda80e09879b2cf6c69737f12f3f2b371cd0af4e9ce8" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Macos: + "x86_64": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.1/WasmEdge-0.11.1-darwin_x86_64.tar.gz" + sha256: "56df2b00669c25b8143ea2c17370256cd6a33f3b316d3b47857dd38d603cb69a" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.1/WasmEdge-0.11.1-darwin_arm64.tar.gz" + sha256: "82f7da1a7a36ec1923fb045193784dd090a03109e84da042af97297205a71f08" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" + Android: + "armv8": + "gcc": + - url: "https://github.com/WasmEdge/WasmEdge/releases/download/0.11.1/WasmEdge-0.11.1-android_aarch64.tar.gz" + sha256: "af8694e93bf72ac5506450d4caebccc340fbba254dca3d58ec0712e96ec9dedd" + - url: "https://raw.githubusercontent.com/WasmEdge/WasmEdge/0.11.1/LICENSE" + sha256: "c71d239df91726fc519c6eb72d318ec65820627232b2f796219e87dcf35d0ab4" "0.10.0": Windows: "x86_64": diff --git a/recipes/wasmedge/all/conanfile.py b/recipes/wasmedge/all/conanfile.py index ba7cc0b861a7c..22d9509121432 100644 --- a/recipes/wasmedge/all/conanfile.py +++ b/recipes/wasmedge/all/conanfile.py @@ -1,23 +1,22 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, copy, download +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration + import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class WasmedgeConan(ConanFile): name = "wasmedge" description = ("WasmEdge is a lightweight, high-performance, and extensible WebAssembly runtime" "for cloud native, edge, and decentralized applications." "It powers serverless apps, embedded functions, microservices, smart contracts, and IoT devices.") - topics = ("webassembly", "wasm", "wasi", "emscripten") license = "Apache-2.0" - homepage = "https://github.com/WasmEdge/WasmEdge/" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "arch", "compiler", - - @property - def _source_subfolder(self): - return "source_subfolder" + homepage = "https://github.com/WasmEdge/WasmEdge/" + topics = ("webassembly", "wasm", "wasi", "emscripten") + settings = "os", "arch", "compiler", "build_type" @property def _compiler_alias(self): @@ -41,30 +40,51 @@ def package_id(self): self.info.settings.compiler = self._compiler_alias def source(self): - tools.get(**self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)][self._compiler_alias][0], - destination=self._source_subfolder, strip_root=True) - tools.download(filename="LICENSE", - **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)][self._compiler_alias][1]) + # This is packaging binaries so the download needs to be in build + get(self, **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)][self._compiler_alias][0], + destination=self.source_folder, strip_root=True) + download(self, filename="LICENSE", + **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)][self._compiler_alias][1]) def package(self): - self.copy("*.h", src=os.path.join(self._source_subfolder, "include"), dst="include", keep_path=True) - self.copy("*.inc", src=os.path.join(self._source_subfolder, "include"), dst="include", keep_path=True) - - srclibdir = os.path.join(self._source_subfolder, "lib64" if self.settings.os == "Linux" else "lib") - srcbindir = os.path.join(self._source_subfolder, "bin") - - self.copy("wasmedge_c.lib", src=srclibdir, dst="lib", keep_path=False) - self.copy("wasmedge_c.dll", src=srcbindir, dst="bin", keep_path=False) - self.copy("libwasmedge_c.so*", src=srclibdir, dst="lib", keep_path=False) - self.copy("libwasmedge_c.dylib", src=srclibdir, dst="lib", keep_path=False) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include"), keep_path=True) + copy(self, pattern="*.inc", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include"), keep_path=True) - self.copy("wasmedge*", src=srcbindir, dst="bin", keep_path=False) + srclibdir = os.path.join(self.source_folder, "lib64" if self.settings.os == "Linux" else "lib") + srcbindir = os.path.join(self.source_folder, "bin") + dstlibdir = os.path.join(self.package_folder, "lib") + dstbindir = os.path.join(self.package_folder, "bin") + if Version(self.version) >= "0.11.1": + copy(self, pattern="wasmedge.lib", src=srclibdir, dst=dstlibdir, keep_path=False) + copy(self, pattern="wasmedge.dll", src=srcbindir, dst=dstbindir, keep_path=False) + copy(self, pattern="libwasmedge.so*", src=srclibdir, dst=dstlibdir, keep_path=False) + copy(self, pattern="libwasmedge*.dylib", src=srclibdir, dst=dstlibdir, keep_path=False) + else: + copy(self, pattern="wasmedge_c.lib", src=srclibdir, dst=dstlibdir, keep_path=False) + copy(self, pattern="wasmedge_c.dll", src=srcbindir, dst=dstbindir, keep_path=False) + copy(self, pattern="libwasmedge_c.so*", src=srclibdir, dst=dstlibdir, keep_path=False) + copy(self, pattern="libwasmedge_c*.dylib", src=srclibdir, dst=dstlibdir, keep_path=False) - self.copy("LICENSE", dst="licenses", keep_path=False) + copy(self, pattern="wasmedge*", src=srcbindir, dst=dstbindir, keep_path=False) + copy(self, pattern="LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses"), keep_path=False) def package_info(self): - self.cpp_info.libs = ["wasmedge_c"] + if Version(self.version) >= "0.11.1": + self.cpp_info.libs = ["wasmedge"] + else: + self.cpp_info.libs = ["wasmedge_c"] bindir = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bindir)) self.env_info.PATH.append(bindir) + + if self.settings.os == "Windows": + self.cpp_info.system_libs.append("ws2_32") + self.cpp_info.system_libs.append("wsock32") + self.cpp_info.system_libs.append("shlwapi") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + self.cpp_info.system_libs.append("dl") + self.cpp_info.system_libs.append("rt") + self.cpp_info.system_libs.append("pthread") diff --git a/recipes/wasmedge/all/test_package/CMakeLists.txt b/recipes/wasmedge/all/test_package/CMakeLists.txt index 537356e17d089..a433b073bf6ea 100644 --- a/recipes/wasmedge/all/test_package/CMakeLists.txt +++ b/recipes/wasmedge/all/test_package/CMakeLists.txt @@ -1,9 +1,6 @@ cmake_minimum_required(VERSION 3.8) project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(wasmedge REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/wasmedge/all/test_package/conanfile.py b/recipes/wasmedge/all/test_package/conanfile.py index 194e60765d566..a9fb96656f203 100644 --- a/recipes/wasmedge/all/test_package/conanfile.py +++ b/recipes/wasmedge/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.20.1") + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wasmedge/all/test_v1_package/CMakeLists.txt b/recipes/wasmedge/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/wasmedge/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/wasmedge/all/test_v1_package/conanfile.py b/recipes/wasmedge/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/wasmedge/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/wasmedge/config.yml b/recipes/wasmedge/config.yml index a319c82cd717d..26c6ed136a298 100644 --- a/recipes/wasmedge/config.yml +++ b/recipes/wasmedge/config.yml @@ -1,4 +1,8 @@ versions: + "0.11.2": + folder: "all" + "0.11.1": + folder: "all" "0.10.0": folder: "all" "0.9.1": diff --git a/recipes/wasmer/all/conandata.yml b/recipes/wasmer/all/conandata.yml index b0026f2080544..7b9c9649cb8d8 100644 --- a/recipes/wasmer/all/conandata.yml +++ b/recipes/wasmer/all/conandata.yml @@ -1,8 +1,62 @@ sources: + "3.1.0": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.1.0/wasmer-windows-amd64.tar.gz" + sha256: "6f49be0023571f9d4edab36c4acdd449c3a03da483c1f4412fbfcc98fe455dce" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.1.0/wasmer-windows-gnu64.tar.gz" + sha256: "6dec33b2dbadde24b2ec1219f8e65588020dfc79de48a0e3f1ab130be6883760" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.1.0/wasmer-linux-amd64.tar.gz" + sha256: "c22116e42a51bf0646c55c43337a137b3edd0da2f23a8b7eeba8f4acbae9a1c4" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.1.0/wasmer-linux-aarch64.tar.gz" + sha256: "37af1383f19c0470a2454f8e3901eab91ea8439a81d8af4eb2ba81966130b4dd" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.1.0/wasmer-darwin-amd64.tar.gz" + sha256: "a8415fadf7de329a6444879e02f746c1ce793cbfbbc77907b447a00aacc35d34" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.1.0/wasmer-darwin-arm64.tar.gz" + sha256: "737877b59d702b853a3f70632ea90d884dc8e616c2076492337c6ef81e1d3026" + "3.0.2": + Windows: + "x86_64": + "Visual Studio": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.0.2/wasmer-windows-amd64.tar.gz" + sha256: "f8ecb5aa78e2f9c3b734dbbcfe05be51ad33fd99e0b9684d1531ad2d663306af" + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.0.2/wasmer-windows-gnu64.tar.gz" + sha256: "a59377cf710d330d47b81bbdeaa0bc18bae16196fb9e2d2251d9f4535d6d9ee5" + Linux: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.0.2/wasmer-linux-amd64.tar.gz" + sha256: "3567d46a1832b0d3672e2ead4ca088e8fa27f8730407af7bc72350d54da38950" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.0.2/wasmer-linux-aarch64.tar.gz" + sha256: "90bd5b6610fa225ee0c7ec25ef3fdcde39bbab00cf42a6dddb544ee361ee4108" + Macos: + "x86_64": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.0.2/wasmer-darwin-amd64.tar.gz" + sha256: "44a858dab2ac74c464f3a2fc80bb6958125a9b4611199f83a5d4bf20e021b6d9" + "armv8": + "gcc": + url: "https://github.com/wasmerio/wasmer/releases/download/v3.0.2/wasmer-darwin-arm64.tar.gz" + sha256: "70e63ab808e502527e7e36f03f98bc4debb7d532b6093292f4cb50f9b3a3dfae" "2.3.0": Windows: "x86_64": - Visual Studio: + "Visual Studio": url: "https://github.com/wasmerio/wasmer/releases/download/2.3.0/wasmer-windows-amd64.tar.gz" sha256: "9b0b9eac25dfd3cd59358bc82a9f793a9ac991a11844d4ffc3ff898831d118bd" Linux: @@ -22,7 +76,7 @@ sources: "2.2.0": Windows: "x86_64": - Visual Studio: + "Visual Studio": url: "https://github.com/wasmerio/wasmer/releases/download/2.2.0/wasmer-windows-amd64.tar.gz" sha256: "e931e729d6bbe99fe5d9b0ce003bebe134ae94d7c6855a8287134b49e1a6f69f" Linux: @@ -42,7 +96,7 @@ sources: "2.1.1": Windows: "x86_64": - Visual Studio: + "Visual Studio": url: "https://github.com/wasmerio/wasmer/releases/download/2.1.1/wasmer-windows-amd64.tar.gz" sha256: "8d2264621fb172e9085b13c94e79f97b175aec2046ad64e1575259535bd691b3" Linux: diff --git a/recipes/wasmer/all/conanfile.py b/recipes/wasmer/all/conanfile.py index 8825504c52a57..9db5f12cf18fe 100644 --- a/recipes/wasmer/all/conanfile.py +++ b/recipes/wasmer/all/conanfile.py @@ -1,14 +1,17 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc +from conan.tools.files import get, copy, replace_in_file +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class WasmerConan(ConanFile): name = "wasmer" - license = "Apache-2.0" description = "The leading WebAssembly Runtime supporting WASI and Emscripten" + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/wasmerio/wasmer/" topics = ("webassembly", "wasm", "wasi", "emscripten") @@ -24,14 +27,17 @@ class WasmerConan(ConanFile): def _compiler_alias(self): return { "Visual Studio": "Visual Studio", + "msvc": "Visual Studio", }.get(str(self.settings.compiler), "gcc") def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - if self.settings.compiler == "Visual Studio": - if self.options.shared: - del self.settings.compiler.runtime + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + if is_msvc(self) and self.options.shared: + del self.settings.compiler.runtime + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): try: @@ -42,44 +48,47 @@ def validate(self): if self.settings.os == "Windows" and self.options.shared: raise ConanInvalidConfiguration("Shared Windows build of wasmer are non-working atm (no import libraries are available)") - if self.settings.os == "Linux" and self.options.shared and tools.Version(self.version) >= "2.3.0": + if self.settings.os == "Linux" and self.options.shared and "2.3.0" <= Version(self.version): raise ConanInvalidConfiguration("Shared Linux build of wasmer are not working. It requires glibc >= 2.25") - if self.settings.compiler == "Visual Studio": - if not self.options.shared and self.settings.compiler.runtime != "MT": - raise ConanInvalidConfiguration("wasmer is only available with compiler.runtime=MT") + if is_msvc(self) and not self.options.shared and self.settings.compiler.runtime != "MT": + raise ConanInvalidConfiguration("wasmer is only available with compiler.runtime=MT") def package_id(self): del self.info.settings.compiler.version self.info.settings.compiler = self._compiler_alias def source(self): - tools.get(**self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)][self._compiler_alias], - destination=self.source_folder) + get( + self, + **self.conan_data["sources"][self.version][str(self.settings.os)][str(self.settings.arch)][self._compiler_alias], destination=self.source_folder + ) def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + self.copy("*.h", src=os.path.join(self.source_folder, "include"), dst="include", keep_path=False) srclibdir = os.path.join(self.source_folder, "lib") + dstlibdir = os.path.join(self.package_folder, "lib") + dstbindir = os.path.join(self.package_folder, "bin") if self.options.shared: - self.copy("wasmer.dll.lib", src=srclibdir, dst="lib", keep_path=False) # FIXME: not available (yet) - self.copy("wasmer.dll", src=srclibdir, dst="bin", keep_path=False) - self.copy("libwasmer.so*", src=srclibdir, dst="lib", keep_path=False) - self.copy("libwasmer.dylib", src=srclibdir, dst="lib", keep_path=False) + self.copy("wasmer.dll.lib", src=srclibdir, dst=dstlibdir, keep_path=False) # FIXME: not available (yet) + self.copy("wasmer.dll", src=srclibdir, dst=dstbindir, keep_path=False) + self.copy("libwasmer.so*", src=srclibdir, dst=dstlibdir, keep_path=False) + self.copy("libwasmer.dylib", src=srclibdir, dst=dstlibdir, keep_path=False) else: - self.copy("wasmer.lib", src=srclibdir, dst="lib", keep_path=False) - self.copy("libwasmer.a", src=srclibdir, dst="lib", keep_path=False) - tools.replace_in_file(os.path.join(self.package_folder, "include", "wasm.h"), - "__declspec(dllimport)", "") - - self.copy("LICENSE", dst="licenses", src=self.source_folder) + self.copy("wasmer.lib", src=srclibdir, dst=dstlibdir, keep_path=False) + self.copy("libwasmer.a", src=srclibdir, dst=dstlibdir, keep_path=False) + replace_in_file(self, os.path.join(self.package_folder, "include", "wasm.h"), + "__declspec(dllimport)", "") def package_info(self): self.cpp_info.libs = ["wasmer"] if not self.options.shared: if self.settings.os == "Linux": self.cpp_info.system_libs = ["pthread", "dl", "m"] - if tools.Version(self.version) >= "2.3.0": + if Version(self.version) >= "2.3.0": self.cpp_info.system_libs.append("rt") elif self.settings.os == "Windows": self.cpp_info.system_libs = ["bcrypt", "userenv", "ws2_32"] diff --git a/recipes/wasmer/all/test_package/CMakeLists.txt b/recipes/wasmer/all/test_package/CMakeLists.txt index 404aec345799f..bf0cebf3a9ba7 100644 --- a/recipes/wasmer/all/test_package/CMakeLists.txt +++ b/recipes/wasmer/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) find_package(wasmer REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) target_link_libraries(${PROJECT_NAME} PRIVATE wasmer::wasmer) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 11) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_11) diff --git a/recipes/wasmer/all/test_package/conanfile.py b/recipes/wasmer/all/test_package/conanfile.py index 38f4483872d47..e845ae751a301 100644 --- a/recipes/wasmer/all/test_package/conanfile.py +++ b/recipes/wasmer/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wasmer/all/test_v1_package/CMakeLists.txt b/recipes/wasmer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/wasmer/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/wasmer/all/test_v1_package/conanfile.py b/recipes/wasmer/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/wasmer/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/wasmer/config.yml b/recipes/wasmer/config.yml index 474a5ce0464db..e0d445f36bd33 100644 --- a/recipes/wasmer/config.yml +++ b/recipes/wasmer/config.yml @@ -1,4 +1,8 @@ versions: + "3.1.0": + folder: "all" + "3.0.2": + folder: "all" "2.3.0": folder: "all" "2.2.0": diff --git a/recipes/wasmtime-cpp/all/conandata.yml b/recipes/wasmtime-cpp/all/conandata.yml index 902f27be4acb5..5b84a11013082 100644 --- a/recipes/wasmtime-cpp/all/conandata.yml +++ b/recipes/wasmtime-cpp/all/conandata.yml @@ -1,4 +1,16 @@ sources: + "5.0.0": + url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/v5.0.0.tar.gz" + sha256: "071ab8f01eb52760e584b711c76630b491e7516672188bb51f696ae45c08e0cc" + "3.0.0": + url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/v3.0.0.tar.gz" + sha256: "9840637cc3040f924db1caf957b883efcfa4ad9d92a86245cc0fd3967ea3db09" + "2.0.0": + url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/refs/tags/v2.0.0.tar.gz" + sha256: "27dcf8fbbc8dbe0387bde2d38e9d78a829b649a0bf86750c5d2a1327a5971b18" + "1.0.0": + url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/refs/tags/v1.0.0.tar.gz" + sha256: "246e1d7f8f7f61170296d68c6f44ba53232d1549807633da366ca70b19089a7a" "0.39.0": url: "https://github.com/bytecodealliance/wasmtime-cpp/archive/refs/tags/v0.39.0.tar.gz" sha256: "b0b2d4c629d341078f8157a39c3101f9dcd84c643ddb7b25f843ed84eae281ea" diff --git a/recipes/wasmtime-cpp/all/conanfile.py b/recipes/wasmtime-cpp/all/conanfile.py index 2fc85662a49ec..482036a9eeb0c 100644 --- a/recipes/wasmtime-cpp/all/conanfile.py +++ b/recipes/wasmtime-cpp/all/conanfile.py @@ -1,9 +1,12 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.layout import basic_layout import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class WasmtimeCppConan(ConanFile): name = 'wasmtime-cpp' @@ -16,52 +19,55 @@ class WasmtimeCppConan(ConanFile): no_copy_source = True @property - def _minimum_cpp_standard(self): + def _min_cppstd(self): return 17 @property - def _minimum_compilers_version(self): + def _compilers_minimum_version(self): return { "Visual Studio": "16", + "msvc": "192", "apple-clang": "12.0", "clang": "12.0", "gcc": "10.0" } + def layout(self): + basic_layout(self, src_folder="src") + def requirements(self): version = str(self.version) - if version == "0.35.0": - version = "0.35.1" - elif version == "0.39.0": - version = "0.39.1" - self.requires(f"wasmtime/{version}") + version_map = { + "0.35.0": "0.35.1", + "0.39.0": "0.39.1", + "1.0.0": "1.0.1", + } + self.requires(f"wasmtime/{version_map.get(version, version)}") def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): - compiler = self.settings.compiler if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) - min_version = self._minimum_compilers_version[str(compiler)] - try: - if tools.Version(compiler.version) < min_version: - msg = ( - "{} requires C++{} features which are not supported by compiler {} {} !!" - ).format(self.name, self._minimum_cpp_standard, compiler, compiler.version) - raise ConanInvalidConfiguration(msg) - except KeyError: - msg = ( - "{} recipe lacks information about the {} compiler, " - "support for the required C++{} features is assumed" - ).format(self.name, compiler, self._minimum_cpp_standard) - self.output.warn(msg) + check_min_cppstd(self, self._min_cppstd) + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def package(self): - shutil.copytree(os.path.join(self.source_folder, "include"), - os.path.join(self.package_folder, "include")) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy(self, + pattern="*.hh", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include") + ) - self.copy('LICENSE', dst='licenses', src=self.source_folder) + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/wasmtime-cpp/all/test_package/CMakeLists.txt b/recipes/wasmtime-cpp/all/test_package/CMakeLists.txt index 30d1f75007b44..a815c3edc0b1a 100644 --- a/recipes/wasmtime-cpp/all/test_package/CMakeLists.txt +++ b/recipes/wasmtime-cpp/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(wasmtime-cpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) target_link_libraries(${PROJECT_NAME} PRIVATE wasmtime-cpp::wasmtime-cpp) -target_compile_definitions(${PROJECT_NAME} PUBLIC WASMTIME_EXAMPLES_PATH="${CMAKE_SOURCE_DIR}") -target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) +target_compile_definitions(${PROJECT_NAME} PRIVATE WASMTIME_EXAMPLES_PATH="${CMAKE_CURRENT_SOURCE_DIR}") +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) set_target_properties(${PROJECT_NAME} PROPERTIES CXX_EXTENSIONS OFF ) diff --git a/recipes/wasmtime-cpp/all/test_package/conanfile.py b/recipes/wasmtime-cpp/all/test_package/conanfile.py index 19f014b0fde37..a9fbb7f543162 100644 --- a/recipes/wasmtime-cpp/all/test_package/conanfile.py +++ b/recipes/wasmtime-cpp/all/test_package/conanfile.py @@ -1,11 +1,18 @@ -from conans import ConanFile, CMake, tools -from conan.tools.build import cross_building +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" -class WasmtimeCppTestConan(ConanFile): - settings = 'os', 'arch', 'compiler', 'build_type' - generators = 'cmake', 'cmake_find_package_multi' + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -13,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join('bin', 'test_package') - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wasmtime-cpp/all/test_v1_package/CMakeLists.txt b/recipes/wasmtime-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..bc541ea90b512 --- /dev/null +++ b/recipes/wasmtime-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/wasmtime-cpp/all/test_v1_package/conanfile.py b/recipes/wasmtime-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/wasmtime-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/wasmtime-cpp/config.yml b/recipes/wasmtime-cpp/config.yml index 782bb03276a8a..22d922512a80a 100644 --- a/recipes/wasmtime-cpp/config.yml +++ b/recipes/wasmtime-cpp/config.yml @@ -1,4 +1,12 @@ versions: + "5.0.0": + folder: all + "3.0.0": + folder: all + "2.0.0": + folder: all + "1.0.0": + folder: all "0.39.0": folder: all "0.38.0": diff --git a/recipes/wasmtime/all/conandata.yml b/recipes/wasmtime/all/conandata.yml index 5941dc599896f..c3f23ab9141ee 100644 --- a/recipes/wasmtime/all/conandata.yml +++ b/recipes/wasmtime/all/conandata.yml @@ -1,4 +1,154 @@ sources: + "5.0.0": + Windows: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v5.0.0/wasmtime-v5.0.0-x86_64-windows-c-api.zip" + sha256: "11b3c7473afee0db400683ac1aa9e5243b3d55dbdaeaca534c7b3481d3e3c8a3" + MinGW: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v5.0.0/wasmtime-v5.0.0-x86_64-mingw-c-api.zip" + sha256: "3c87f5c59a10cfda484131dd1454a9bac8b56e48648377178b4b1cbb201358bd" + Linux: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v5.0.0/wasmtime-v5.0.0-x86_64-linux-c-api.tar.xz" + sha256: "cbdec67ae16af672d50ff2c47718713d60b6cdc05f7c0bee77f612dde8c7ee92" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v5.0.0/wasmtime-v5.0.0-aarch64-linux-c-api.tar.xz" + sha256: "1b2baa5038afdd6d8338c4b94487c2b271d391b1f3e0bdf462ca7d9ef1c489df" + "s390x": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v5.0.0/wasmtime-v5.0.0-s390x-linux-c-api.tar.xz" + sha256: "4ee4fc1e43c5b588f52b309046549928e3f6c1daee373d245c71687c1bd8a2dd" + Macos: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v5.0.0/wasmtime-v5.0.0-x86_64-macos-c-api.tar.xz" + sha256: "8c6f326c452598e23e2ba4894378e4ba73d18ce4d488cb1f29a377a47457321c" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v5.0.0/wasmtime-v5.0.0-aarch64-macos-c-api.tar.xz" + sha256: "7c773aa2650bd9b2b50cfe5faa8bbff772a5417d8fc2ae1f050f575331aa6015" + Android: + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v5.0.0/wasmtime-v5.0.0-aarch64-linux-c-api.tar.xz" + sha256: "1b2baa5038afdd6d8338c4b94487c2b271d391b1f3e0bdf462ca7d9ef1c489df" + "4.0.0": + Windows: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-x86_64-windows-c-api.zip" + sha256: "b2874ab0e2f7588dacef433bd1f9c4cd958243ef4cbbc5886b328cd14eab5d48" + MinGW: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-x86_64-mingw-c-api.zip" + sha256: "68c0a5fccdd875c0d653110af94bceb2d8e35b0d836f8784bccea2d5b5b88108" + Linux: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-x86_64-linux-c-api.tar.xz" + sha256: "174166c8c2294d66844fe9736543e9edc8a28ff8db18b26e8b74f5a27024f8c5" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-aarch64-linux-c-api.tar.xz" + sha256: "f3017e9272068a264234efec5df822b619299e138bd2fdab2eca43c73d8e7d26" + "s390x": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-s390x-linux-c-api.tar.xz" + sha256: "9243404037187900ed85188744d28501c786abba1098a933a8c80363d3763350" + Macos: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-x86_64-macos-c-api.tar.xz" + sha256: "41d0d2fd9c9942f0b00eac3da6ddfaca5a660a61c6220bc608d2e15d5adfbdd4" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-aarch64-macos-c-api.tar.xz" + sha256: "2761ee87f265e520a2ed1d82188c958f5dc244ad6fed94a80f6af33f705a320d" + Android: + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v4.0.0/wasmtime-v4.0.0-aarch64-linux-c-api.tar.xz" + sha256: "f3017e9272068a264234efec5df822b619299e138bd2fdab2eca43c73d8e7d26" + "3.0.0": + Windows: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-x86_64-windows-c-api.zip" + sha256: "4375673c544e43fc5c9c939e05b30efafdb1449412912ee17937272a25ee1ddd" + MinGW: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-x86_64-mingw-c-api.zip" + sha256: "793a0179391e1f9b6699b1054b37dfffc36b7ab5eff401bb16a8fe66e6e42ee1" + Linux: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-x86_64-linux-c-api.tar.xz" + sha256: "0cdc7e36fa752c66d57121555fa58370581613e8c119654a4a12c197d4fde148" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-aarch64-linux-c-api.tar.xz" + sha256: "93c3dcd7b315a98de221d68e0d253cfcbf122328aea285c28e70aa0ea6582088" + "s390x": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-s390x-linux-c-api.tar.xz" + sha256: "9e19c795996a94ece9d0bf00c88cbb1081552c4ae0590effd50121351fb8303e" + Macos: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-x86_64-macos-c-api.tar.xz" + sha256: "df85111b0b20ee5a4201eae7c7cf368f905e6b73d186fcbf7347f750278a598d" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-aarch64-macos-c-api.tar.xz" + sha256: "253a3d1c79134665ab2d7ae0672227b8d88b2becbb84ab96ceeee897a074801a" + Android: + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v3.0.0/wasmtime-v3.0.0-aarch64-linux-c-api.tar.xz" + sha256: "93c3dcd7b315a98de221d68e0d253cfcbf122328aea285c28e70aa0ea6582088" + "2.0.0": + Windows: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-x86_64-windows-c-api.zip" + sha256: "ada9fe8f706811f3f63dcaa4c7c72519893f91ae7980f7f8ed6e542932ad6a4e" + MinGW: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-x86_64-mingw-c-api.zip" + sha256: "dc024d00671098260643b51b3609bb808f440bb8e2f06d9fad6c2af1160d16b7" + Linux: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-x86_64-linux-c-api.tar.xz" + sha256: "c216f16a0494b7b609890effcd417b9807dc8a6d5c47818fb4a297fef2bb54e3" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-aarch64-linux-c-api.tar.xz" + sha256: "9bbcfbcc68b9b8c4572f0bdd956e1a558f9a01e82bd099fac9c7755220c92189" + "s390x": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-s390x-linux-c-api.tar.xz" + sha256: "9bbe40d443a34b1d8f71c9239d87555e9f41e04a9d84f085186711b8075ec5ef" + Macos: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-x86_64-macos-c-api.tar.xz" + sha256: "658f8834a322ddf35cfcfc2c56afbbfad91106a00633d5c6c932757fa83378b2" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-aarch64-macos-c-api.tar.xz" + sha256: "08749d061565f9b48a29c57d3ef9ee2d432d531fad8758be97b1c98bfda1c14b" + Android: + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v2.0.0/wasmtime-v2.0.0-aarch64-linux-c-api.tar.xz" + sha256: "9bbcfbcc68b9b8c4572f0bdd956e1a558f9a01e82bd099fac9c7755220c92189" + "1.0.1": + Windows: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v1.0.1/wasmtime-v1.0.1-x86_64-windows-c-api.zip" + sha256: "7b8ae00997d3d6fef21d084141f843db9d2c562ca24aebccb5b20cdbba93c8c2" + MinGW: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v1.0.1/wasmtime-v1.0.1-x86_64-mingw-c-api.zip" + sha256: "ce5b516b3924fdf38e200cad2fd9438ac35bf7ddd734aea3e2dee8f319e275c3" + Linux: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v1.0.1/wasmtime-v1.0.1-x86_64-linux-c-api.tar.xz" + sha256: "b481b015c8805acabf2d1aad3b005a8564ac11f3c5b360bbbf71ba0f03e2c067" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v1.0.1/wasmtime-v1.0.1-aarch64-linux-c-api.tar.xz" + sha256: "aa950e47fdff4970efb7a59a3ea9e96b965180f9e84be46280915086f0ad7519" + "s390x": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v1.0.1/wasmtime-v1.0.1-s390x-linux-c-api.tar.xz" + sha256: "b197a1d8878ae98b2a6ca769bc89aeda9352cb516f94d5a8d84453666ba57ab6" + Macos: + "x86_64": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v1.0.1/wasmtime-v1.0.1-x86_64-macos-c-api.tar.xz" + sha256: "fc570e49cf3c4d66b69770ecee692e1cf27d0fa6a6363c83f3f5cca23ac9dc3b" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v1.0.1/wasmtime-v1.0.1-aarch64-macos-c-api.tar.xz" + sha256: "48fe254302c6519bf289a4d1385dd425a1c65c4dd521d88dc6a1fab6f025bd19" + Android: + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v1.0.1/wasmtime-v1.0.1-aarch64-linux-c-api.tar.xz" + sha256: "aa950e47fdff4970efb7a59a3ea9e96b965180f9e84be46280915086f0ad7519" "0.39.1": Windows: "x86_64": @@ -22,6 +172,9 @@ sources: "x86_64": url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.39.1/wasmtime-v0.39.1-x86_64-macos-c-api.tar.xz" sha256: "a045371654222d7eb29ca23520ebf64d8144ea8e1ae0b38df2f39cdeb83e3649" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.39.1/wasmtime-v0.39.1-aarch64-macos-c-api.tar.xz" + sha256: "a5e0e3b1acf924771d84beec6462baa00d9a436df2d65748bcd202cb8470d267" Android: "armv8": url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.39.1/wasmtime-v0.39.1-aarch64-linux-c-api.tar.xz" @@ -49,6 +202,9 @@ sources: "x86_64": url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.38.0/wasmtime-v0.38.0-x86_64-macos-c-api.tar.xz" sha256: "651c41d4de8958caf80086bab46d0f326bbfa0f328f544a632df52b050f2776c" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.38.0/wasmtime-v0.38.0-aarch64-macos-c-api.tar.xz" + sha256: "1e424122c73418c972287043a50555569afb09dc721fb6630503bf455cbd2856" Android: "armv8": url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.38.0/wasmtime-v0.38.0-aarch64-linux-c-api.tar.xz" @@ -76,6 +232,9 @@ sources: "x86_64": url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-x86_64-macos-c-api.tar.xz" sha256: "0f785932fc69105dcecbb2d7c1ceb0cd63dffa5e4b0b3f198c4c56118bdb4ecd" + "armv8": + url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-aarch64-macos-c-api.tar.xz" + sha256: "0a0f5fd2283f52b3ab725650a5dfc77a8bf53de962344fabc37418af9e5e407a" Android: "armv8": url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.37.0/wasmtime-v0.37.0-aarch64-linux-c-api.tar.xz" @@ -134,108 +293,3 @@ sources: "armv8": url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.35.1/wasmtime-v0.35.1-aarch64-linux-c-api.tar.xz" sha256: "8e263a62919a8dc8a7789abe3cfc69bdc0d6ea14b0cabee7a988bac250436785" - "0.34.0": - Windows: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.34.0/wasmtime-v0.34.0-x86_64-windows-c-api.zip" - sha256: "92c8fa3e1394b51be18bae5e3111fec17320fe49ad51fd32d89795e60749f5e9" - MinGW: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.34.0/wasmtime-v0.34.0-x86_64-mingw-c-api.zip" - sha256: "f239d5aec3a064562bcb6182c628d6b8c64b2776e09628cf11c3165ba07f421d" - Linux: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.34.0/wasmtime-v0.34.0-x86_64-linux-c-api.tar.xz" - sha256: "d0f26fcbf003ed1b1ef517a3b5d24b5a5eb9526c95848e8e82cb711a3fa13010" - "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.34.0/wasmtime-v0.34.0-aarch64-linux-c-api.tar.xz" - sha256: "3ee684353b87dd0e114cb7244d79107985ad34ab2358ec342317f5aeed42298a" - "s390x": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.34.0/wasmtime-v0.34.0-s390x-linux-c-api.tar.xz" - sha256: "5b206c997f3ccdddf6b95f1ecf7c28edf4cca78246f6d8d79cbcb782426b16bc" - Macos: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.34.0/wasmtime-v0.34.0-x86_64-macos-c-api.tar.xz" - sha256: "04bd8e61552c78f905b2d7468ea121dcb7759160ac9a41595992107e17c1712e" - Android: - "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.34.0/wasmtime-v0.34.0-aarch64-linux-c-api.tar.xz" - sha256: "3ee684353b87dd0e114cb7244d79107985ad34ab2358ec342317f5aeed42298a" - "0.32.0": - Windows: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-x86_64-windows-c-api.zip" - sha256: "079abe3c22636a66e6a5f25ebb39e1facec9521d4dd0d41159381a60098701bf" - MinGW: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-x86_64-mingw-c-api.zip" - sha256: "3d999427dab6b2750fccddf6cd2b0ac251dbc4e527cc930728a5280feb248743" - Linux: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-x86_64-linux-c-api.tar.xz" - sha256: "80d2e587e16cda44696a01792e74dc2064fd13598d139302599e10389ca09a0e" - "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-aarch64-linux-c-api.tar.xz" - sha256: "6d9425829003a44c92af118ff2ae72a887e088ea6ac4a887ae315b41b5e96206" - "s390x": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-s390x-linux-c-api.tar.xz" - sha256: "f0c66b9b6a2e499e9ef0f500711e7dd3fb2f1f458d8fe17c4c81590de1a0b075" - Macos: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-x86_64-macos-c-api.tar.xz" - sha256: "9c191f678dc4fbcf345b628a70322e3034d36469e294d799a9ab4e28b6a98db9" - Android: - "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.32.0/wasmtime-v0.32.0-aarch64-linux-c-api.tar.xz" - sha256: "6d9425829003a44c92af118ff2ae72a887e088ea6ac4a887ae315b41b5e96206" - "0.31.0": - Windows: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.31.0/wasmtime-v0.31.0-x86_64-windows-c-api.zip" - sha256: "6514d891f0648f92291945acd2bde57427b7375d94fcb7655d7c0595c763ed51" - MinGW: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.31.0/wasmtime-v0.31.0-x86_64-mingw-c-api.zip" - sha256: "734fa254c65864bec5382f72a89788ba72961e472d5ec7b67b821be20d1aa3ab" - Linux: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.31.0/wasmtime-v0.31.0-x86_64-linux-c-api.tar.xz" - sha256: "63c7c0d0862d4ac4640676b50e4f2d13d63485e8fa982779d02438095c06d52c" - "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.31.0/wasmtime-v0.31.0-aarch64-linux-c-api.tar.xz" - sha256: "2a6311ee4ec3d5a00fd656d2134cab277219e180b54694f31aeab705d11cb20c" - "s390x": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.31.0/wasmtime-v0.31.0-s390x-linux-c-api.tar.xz" - sha256: "5c5ef16543a80479d25ddf064c6668340b603be90269d1245478cfc0ae86c4ae" - Macos: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.31.0/wasmtime-v0.31.0-x86_64-macos-c-api.tar.xz" - sha256: "4f191c3413dcaaba36253783b0c82113d554968f52d02befe4e0a9f1b97c7f34" - Android: - "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.31.0/wasmtime-v0.31.0-aarch64-linux-c-api.tar.xz" - sha256: "2a6311ee4ec3d5a00fd656d2134cab277219e180b54694f31aeab705d11cb20c" - "0.30.0": - Windows: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.30.0/wasmtime-v0.30.0-x86_64-windows-c-api.zip" - sha256: "3180c482a9f83a3c07c12a72c6efce73cf02ccad50f918666c805003de6756a5" - MinGW: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.30.0/wasmtime-v0.30.0-x86_64-mingw-c-api.zip" - sha256: "557e774a7fb33de8f6eceda298cdfada7b6aaa7ad30c307d105c3aa74aef79fd" - Linux: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.30.0/wasmtime-v0.30.0-x86_64-linux-c-api.tar.xz" - sha256: "bf197fedc9fd68f9d78f6b5781e99242e58cee090fef9024dc56fa3f961707fd" - "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.30.0/wasmtime-v0.30.0-aarch64-linux-c-api.tar.xz" - sha256: "9b9f1bce6c34968923aa8f90869931b5c610d4bc3d5884a5a2ec958c15017dc1" - Macos: - "x86_64": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.30.0/wasmtime-v0.30.0-x86_64-macos-c-api.tar.xz" - sha256: "6299f9cb37b23f4a2d51690a5343f56de271626036a945c8bbf063dab487435d" - Android: - "armv8": - url: "https://github.com/bytecodealliance/wasmtime/releases/download/v0.30.0/wasmtime-v0.30.0-aarch64-linux-c-api.tar.xz" - sha256: "9b9f1bce6c34968923aa8f90869931b5c610d4bc3d5884a5a2ec958c15017dc1" diff --git a/recipes/wasmtime/all/conanfile.py b/recipes/wasmtime/all/conanfile.py index 8156e75a8c727..2d27efc384860 100644 --- a/recipes/wasmtime/all/conanfile.py +++ b/recipes/wasmtime/all/conanfile.py @@ -1,10 +1,12 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.scm import Version +from conan.errors import ConanInvalidConfiguration from conan.tools.microsoft import is_msvc + import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.47.0" class WasmtimeConan(ConanFile): @@ -31,9 +33,10 @@ def _minimum_cpp_standard(self): def _minimum_compilers_version(self): return { "Visual Studio": "15", + "msvc": "190", "apple-clang": "9.4", "clang": "3.3", - "gcc": "5.1" + "gcc": "5.1", } @property @@ -49,20 +52,26 @@ def configure(self): del self.settings.compiler.cppstd del self.settings.compiler.runtime + def package_id(self): + del self.info.settings.compiler.version + if self.settings.compiler == "clang": + self.info.settings.compiler = "gcc" + def validate(self): compiler = self.settings.compiler min_version = self._minimum_compilers_version[str(compiler)] try: - if tools.Version(compiler.version) < min_version: + if Version(compiler.version) < min_version: msg = ( - "{} requires C{} features which are not supported by compiler {} {} !!" - ).format(self.name, self._minimum_cpp_standard, compiler, compiler.version) + f"{self.name} requires C{self._minimum_cpp_standard} features " + f"which are not supported by compiler {compiler} {compiler.version} !!" + ) raise ConanInvalidConfiguration(msg) except KeyError: msg = ( - "{} recipe lacks information about the {} compiler, " - "support for the required C{} features is assumed" - ).format(self.name, compiler, self._minimum_cpp_standard) + f"{self.name} recipe lacks information about the {compiler} compiler, " + f"support for the required C{self._minimum_cpp_standard} features is assumed" + ) self.output.warn(msg) try: @@ -70,37 +79,28 @@ def validate(self): except KeyError: raise ConanInvalidConfiguration("Binaries for this combination of architecture/version/os are not available") - if tools.Version(self.version) <= "0.29.0": - if (self.settings.compiler, self.settings.os) == ("gcc", "Windows") and self.options.shared: - # https://github.com/bytecodealliance/wasmtime/issues/3168 - raise ConanInvalidConfiguration("Shared mingw is currently not possible") - - def package_id(self): - del self.info.settings.compiler.version - if self.settings.compiler == "clang": - self.info.settings.compiler = "gcc" - def build(self): # This is packaging binaries so the download needs to be in build - tools.get(**self.conan_data["sources"][self.version][self._sources_os_key][str(self.settings.arch)], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][self._sources_os_key][str(self.settings.arch)], + destination=self.source_folder, strip_root=True) def package(self): - shutil.copytree(os.path.join(self.source_folder, "include"), - os.path.join(self.package_folder, "include")) + copy(self, pattern="*.h", dst=os.path.join(self.package_folder, "include"), src=os.path.join(self.source_folder, "include")) srclibdir = os.path.join(self.source_folder, "lib") + dstlibdir = os.path.join(self.package_folder, "lib") + dstbindir = os.path.join(self.package_folder, "bin") if self.options.shared: - self.copy("wasmtime.dll.lib", src=srclibdir, dst="lib", keep_path=False) - self.copy("wasmtime.dll", src=srclibdir, dst="bin", keep_path=False) - self.copy("libwasmtime.dll.a", src=srclibdir, dst="lib", keep_path=False) - self.copy("libwasmtime.so*", src=srclibdir, dst="lib", keep_path=False) - self.copy("libwasmtime.dylib", src=srclibdir, dst="lib", keep_path=False) + copy(self, "wasmtime.dll.lib", dst=dstlibdir, src=srclibdir, keep_path=False) + copy(self, "wasmtime.dll", dst=dstbindir, src=srclibdir, keep_path=False) + copy(self, "libwasmtime.dll.a", dst=dstlibdir, src=srclibdir, keep_path=False) + copy(self, "libwasmtime.so*", dst=dstlibdir, src=srclibdir, keep_path=False) + copy(self, "libwasmtime.dylib", dst=dstlibdir, src=srclibdir, keep_path=False) else: - self.copy("wasmtime.lib", src=srclibdir, dst="lib", keep_path=False) - self.copy("libwasmtime.a", src=srclibdir, dst="lib", keep_path=False) + copy(self, "wasmtime.lib", dst=dstlibdir, src=srclibdir, keep_path=False) + copy(self, "libwasmtime.a", dst=dstlibdir, src=srclibdir, keep_path=False) - self.copy("LICENSE", dst="licenses", src=self.source_folder) + copy(self, "LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) def package_info(self): if self.options.shared: @@ -114,6 +114,6 @@ def package_info(self): self.cpp_info.libs = ["wasmtime"] if self.settings.os == "Windows": - self.cpp_info.system_libs = ["ws2_32", "bcrypt", "advapi32", "userenv", "ntdll", "shell32", "ole32"] + self.cpp_info.system_libs = ["ws2_32", "bcrypt", "advapi32", "userenv", "ntdll", "shell32", "ole32"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread", "dl", "m", "rt"] diff --git a/recipes/wasmtime/all/test_package/CMakeLists.txt b/recipes/wasmtime/all/test_package/CMakeLists.txt index 9aef72b44e8f5..6ed94adafb8e8 100644 --- a/recipes/wasmtime/all/test_package/CMakeLists.txt +++ b/recipes/wasmtime/all/test_package/CMakeLists.txt @@ -1,8 +1,6 @@ cmake_minimum_required(VERSION 3.8) -project(test_package C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(wasmtime REQUIRED CONFIG) diff --git a/recipes/wasmtime/all/test_package/conanfile.py b/recipes/wasmtime/all/test_package/conanfile.py index 38f4483872d47..a9fbb7f543162 100644 --- a/recipes/wasmtime/all/test_package/conanfile.py +++ b/recipes/wasmtime/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wasmtime/all/test_v1_package/CMakeLists.txt b/recipes/wasmtime/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..bc541ea90b512 --- /dev/null +++ b/recipes/wasmtime/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/wasmtime/all/test_v1_package/conanfile.py b/recipes/wasmtime/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/wasmtime/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/wasmtime/config.yml b/recipes/wasmtime/config.yml index c74ca85f0e898..aa814a3ff9b69 100644 --- a/recipes/wasmtime/config.yml +++ b/recipes/wasmtime/config.yml @@ -1,4 +1,14 @@ versions: + "5.0.0": + folder: all + "4.0.0": + folder: all + "3.0.0": + folder: all + "2.0.0": + folder: all + "1.0.1": + folder: all "0.39.1": folder: all "0.38.0": @@ -9,11 +19,3 @@ versions: folder: all "0.35.1": folder: all - "0.34.0": - folder: all - "0.32.0": - folder: all - "0.31.0": - folder: all - "0.30.0": - folder: all diff --git a/recipes/watcher/all/conandata.yml b/recipes/watcher/all/conandata.yml new file mode 100644 index 0000000000000..d89638d2592b9 --- /dev/null +++ b/recipes/watcher/all/conandata.yml @@ -0,0 +1,36 @@ +sources: + "0.6.0": + url: "https://github.com/e-dant/watcher/archive/release/0.6.0.tar.gz" + sha256: "156669c92f9119d658954e124fcd9fc640999fb8a45e2bd915ea8b05e15b925a" + "0.5.5": + url: "https://github.com/e-dant/watcher/archive/release/0.5.5.tar.gz" + sha256: "55da2b7a22cbdba836a405d5cab31a461e84e4e686a117f06399a806d33b2d09" + "0.5.4": + url: "https://github.com/e-dant/watcher/archive/release/0.5.4.tar.gz" + sha256: "0dac1d89886252bb0b999c2dad85aff283022a2b4393922a993459b180b8c663" + "0.5.2": + url: "https://github.com/e-dant/watcher/archive/release/0.5.2.tar.gz" + sha256: "e18e663f9a72a59fca3e7a9e125ca77823b03a3388aa569398965777c5671173" + "0.4.3": + url: "https://github.com/e-dant/watcher/archive/release/0.4.3.tar.gz" + sha256: "8603b45edfa5023752d9e2fdd731efe5a556a542aaf03f6be0e69c68f552b25a" + "0.3.3": + url: "https://github.com/e-dant/watcher/archive/release/0.3.3.tar.gz" + sha256: "1cb4a898741306bb9089bd24175bcbb2cb434531eac6bbcfe1a3679b8bf1f44c" + "0.3.2": + url: "https://github.com/e-dant/watcher/archive/release/0.3.2.tar.gz" + sha256: "f00247ad8ee492cb70143917bd19f80056227f4ebd4263015727f02750e4fbd5" + "0.3.1": + url: "https://github.com/e-dant/watcher/archive/release/0.3.1.tar.gz" + sha256: "0fa79d21ac16c96b7ca50f2563aed9d8841e5b8f139af27d0b2cf199d0d281dc" + +patches: + "0.5.5": + - patch_file: "patches/0.5.5-fix-limits_max.patch" + patch_description: "fix max macro error in windows" + patch_type: "portability" + "0.3.1": + - patch_file: "patches/0.3.1-fix-include.patch" + patch_description: "add missing include headers for some compilers" + patch_type: "portability" + patch_source: "https://github.com/e-dant/watcher/pull/18" diff --git a/recipes/watcher/all/conanfile.py b/recipes/watcher/all/conanfile.py new file mode 100644 index 0000000000000..07ff58367997f --- /dev/null +++ b/recipes/watcher/all/conanfile.py @@ -0,0 +1,82 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import export_conandata_patches, apply_conandata_patches, get, copy +from conan.tools.build import check_min_cppstd +from conan.tools.apple import is_apple_os +from conan.tools.layout import basic_layout +import os + +required_conan_version = ">=1.49.0" + +class WatcherConan(ConanFile): + name = "watcher" + description = "Filesystem watcher. Works anywhere. Simple, efficient and friendly." + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/e-dant/watcher/" + topics = ("watch", "filesystem", "event", "header-only") + settings = "os", "arch", "compiler", "build_type" + + @property + def _minimum_cpp_standard(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "13", + "apple-clang": "13.1", + "Visual Studio": "16", + "msvc": "192", + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.get_safe("compiler.cppstd"): + check_min_cppstd(self, self._minimum_cpp_standard) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._minimum_cpp_standard}, which your compiler does not support.", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + apply_conandata_patches(self) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.hpp", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include"), + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs.append("m") + + if is_apple_os(self): + self.cpp_info.frameworks = ["CoreFoundation", "CoreServices"] diff --git a/recipes/watcher/all/patches/0.3.1-fix-include.patch b/recipes/watcher/all/patches/0.3.1-fix-include.patch new file mode 100644 index 0000000000000..1c3d12d2130de --- /dev/null +++ b/recipes/watcher/all/patches/0.3.1-fix-include.patch @@ -0,0 +1,12 @@ +diff --git a/include/watcher/adapter/linux/watch.hpp b/include/watcher/adapter/linux/watch.hpp +index 1b6b61a..a3e6aa9 100644 +--- a/include/watcher/adapter/linux/watch.hpp ++++ b/include/watcher/adapter/linux/watch.hpp +@@ -11,6 +11,7 @@ + + #include + #include ++#include + #include + #include + #include diff --git a/recipes/watcher/all/patches/0.5.5-fix-limits_max.patch b/recipes/watcher/all/patches/0.5.5-fix-limits_max.patch new file mode 100644 index 0000000000000..aeed151aa95e0 --- /dev/null +++ b/recipes/watcher/all/patches/0.5.5-fix-limits_max.patch @@ -0,0 +1,13 @@ +diff --git a/include/watcher/detail/adapter/adapter.hpp b/include/watcher/detail/adapter/adapter.hpp +index 3d43bb8..597c0bc 100644 +--- a/include/watcher/detail/adapter/adapter.hpp ++++ b/include/watcher/detail/adapter/adapter.hpp +@@ -23,7 +23,7 @@ namespace adapter { + + namespace { + inline constexpr size_t watch_count_max +- = std::numeric_limits::max() - 1; ++ = (std::numeric_limits::max)() - 1; + } /* namespace */ + + /* @brief wtr/watcher/detail/adapter/message diff --git a/recipes/watcher/all/test_package/CMakeLists.txt b/recipes/watcher/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..18f5fe387b11a --- /dev/null +++ b/recipes/watcher/all/test_package/CMakeLists.txt @@ -0,0 +1,21 @@ +cmake_minimum_required(VERSION 3.12) + +project(test_package LANGUAGES CXX) + +find_package(watcher REQUIRED CONFIG) +find_package(Threads REQUIRED) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE watcher::watcher Threads::Threads) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +if(watcher_VERSION VERSION_LESS "0.4.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE WATCHER_NAMESPACE=water) +else() + target_compile_definitions(${PROJECT_NAME} PRIVATE WATCHER_NAMESPACE=wtr) +endif() + +if(watcher_VERSION VERSION_GREATER_EQUAL "0.6.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE WATCHER_WATCH_OBJECT) +elseif(watcher_VERSION VERSION_GREATER_EQUAL "0.5.0") + target_compile_definitions(${PROJECT_NAME} PRIVATE WATCHER_DIE_WITH_PATH) +endif() diff --git a/recipes/watcher/all/test_package/conanfile.py b/recipes/watcher/all/test_package/conanfile.py new file mode 100644 index 0000000000000..2704a5edd07d6 --- /dev/null +++ b/recipes/watcher/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake +from conan.tools.build import can_run + +import os + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/watcher/all/test_package/test_package.cpp b/recipes/watcher/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..5324e0d9a2b54 --- /dev/null +++ b/recipes/watcher/all/test_package/test_package.cpp @@ -0,0 +1,47 @@ +#include +#include +#include + +#ifdef WATCHER_WATCH_OBJECT +# include "wtr/watcher.hpp" +#else +# include "watcher/watcher.hpp" +#endif + +int main(int argc, char** argv) { + std::cout << R"({ + "water.watcher.stream":{ +)"; + + auto const show_event_json = [](const WATCHER_NAMESPACE::watcher::event::event& this_event) { + std::cout << " " << this_event; + if (this_event.kind != WATCHER_NAMESPACE::watcher::event::kind::watcher) { + std::cout << ","; + } + std::cout << "\n"; + }; + + auto const time_until_death = std::chrono::seconds(3); + +#ifdef WATCHER_WATCH_OBJECT + auto lifetime = wtr::watch(".", show_event_json); + std::this_thread::sleep_for(time_until_death); + auto const is_watch_dead = lifetime.close(); +#else + std::thread([&]() { WATCHER_NAMESPACE::watcher::watch(".", show_event_json); }).detach(); + std::this_thread::sleep_for(time_until_death); +# ifdef WATCHER_DIE_WITH_PATH + auto const is_watch_dead = WATCHER_NAMESPACE::watcher::die(".", show_event_json); +# else + auto const is_watch_dead = WATCHER_NAMESPACE::watcher::die(show_event_json); +# endif +#endif + + std::cout << " },\n" + << R"( "milliseconds":)" << time_until_death.count() << "," << std::endl + << R"( "expired":)" << std::boolalpha << is_watch_dead << "\n" + << "}" + << std::endl; + + return 0; +} diff --git a/recipes/watcher/all/test_v1_package/CMakeLists.txt b/recipes/watcher/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..3154400093a96 --- /dev/null +++ b/recipes/watcher/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.12) + +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/watcher/all/test_v1_package/conanfile.py b/recipes/watcher/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/watcher/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/watcher/config.yml b/recipes/watcher/config.yml new file mode 100644 index 0000000000000..4878522ff1530 --- /dev/null +++ b/recipes/watcher/config.yml @@ -0,0 +1,17 @@ +versions: + "0.6.0": + folder: all + "0.5.5": + folder: all + "0.5.4": + folder: all + "0.5.2": + folder: all + "0.4.3": + folder: all + "0.3.3": + folder: all + "0.3.2": + folder: all + "0.3.1": + folder: all diff --git a/recipes/wavelet_buffer/all/conandata.yml b/recipes/wavelet_buffer/all/conandata.yml new file mode 100644 index 0000000000000..fbf3768205fcc --- /dev/null +++ b/recipes/wavelet_buffer/all/conandata.yml @@ -0,0 +1,24 @@ +sources: + "0.5.0": + url: "https://github.com/panda-official/WaveletBuffer/archive/refs/tags/v0.5.0.tar.gz" + sha256: "2b1fa552f9a6e032dfd9f59bd05c049bf0cac46aced7cd42f49ff0d020cfdb50" + "0.4.0": + url: "https://github.com/panda-official/WaveletBuffer/archive/refs/tags/v0.4.0.tar.gz" + sha256: "0a30080a6d1e9e7f8947ae0c3395d3c86888900c7ae09730f8dd0ed5138daab2" +patches: + "0.5.0": + - patch_file: "patches/0001-0.4.0-cmake-no-openblas.patch" + patch_description: "Fix CMakeLists: OpenBLAS is not a dependency" + patch_type: "conan" + patch_source: "https://github.com/panda-official/WaveletBuffer/pull/49" + - patch_file: "patches/0002-0.4.0-cmake-find-jpeblib.patch" + patch_description: "Fix CMakeLists: link to jpeg lib only" + patch_type: "conan" + "0.4.0": + - patch_file: "patches/0001-0.4.0-cmake-no-openblas.patch" + patch_description: "Fix CMakeLists: OpenBLAS is not a dependency" + patch_type: "conan" + patch_source: "https://github.com/panda-official/WaveletBuffer/pull/49" + - patch_file: "patches/0002-0.4.0-cmake-find-jpeblib.patch" + patch_description: "Fix CMakeLists: link to jpeg lib only" + patch_type: "conan" diff --git a/recipes/wavelet_buffer/all/conanfile.py b/recipes/wavelet_buffer/all/conanfile.py new file mode 100644 index 0000000000000..d2fc690c180b0 --- /dev/null +++ b/recipes/wavelet_buffer/all/conanfile.py @@ -0,0 +1,130 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class WaveletBufferConan(ConanFile): + name = "wavelet_buffer" + license = "MPL-2.0" + description = "An universal C++ compression library based on wavelet transformation" + topics = ("compression", "signal-processing", "wavelet") + homepage = "https://github.com/panda-official/WaveletBuffer" + url = "https://github.com/conan-io/conan-center-index" + + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "jpeg": ["libjpeg-turbo", "libjpeg"], + } + default_options = { + "shared": False, + "fPIC": True, + "jpeg": "libjpeg-turbo", + } + + @property + def _min_cppstd(self): + return 20 + + @property + def _minimum_compilers_version(self): + return { + "gcc": "8", + "clang": "12", + "apple-clang": "12", + "Visual Studio": "16", + "msvc": "192", + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("blaze/3.8", transitive_headers=True) + self.requires("cimg/3.0.2") + if self.options.jpeg == "libjpeg-turbo": + self.requires("libjpeg-turbo/2.1.4") + else: + self.requires("libjpeg/9e") + # FIXME: unvendor SfCompressor which is currently downloaded at build time :s + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + minimum_version = self._minimum_compilers_version.get(str(self.settings.compiler)) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support." + ) + + if is_msvc(self) and self.options.shared: + raise ConanInvalidConfiguration(f"{self.ref} can not be built as shared with Visual Studio.") + + def _cmake_new_enough(self, required_version): + try: + import re + from io import StringIO + output = StringIO() + self.run("cmake --version", output=output) + m = re.search(r'cmake version (\d+\.\d+\.\d+)', output.getvalue()) + return Version(m.group(1)) >= required_version + except: + return False + + def build_requirements(self): + if not self._cmake_new_enough("3.16"): + self.tool_requires("cmake/3.25.0") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CONAN_EXPORTED"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "wavelet_buffer") + self.cpp_info.set_property("cmake_target_name", "wavelet_buffer::wavelet_buffer") + self.cpp_info.libs = ["wavelet_buffer", "sf_compressor"] + self.cpp_info.requires = ["blaze::blaze", "cimg::cimg"] + if self.options.jpeg == "libjpeg-turbo": + self.cpp_info.requires.append("libjpeg-turbo::jpeg") + else: + self.cpp_info.requires.append("libjpeg::libjpeg") diff --git a/recipes/wavelet_buffer/all/patches/0001-0.4.0-cmake-no-openblas.patch b/recipes/wavelet_buffer/all/patches/0001-0.4.0-cmake-no-openblas.patch new file mode 100644 index 0000000000000..3245b71894066 --- /dev/null +++ b/recipes/wavelet_buffer/all/patches/0001-0.4.0-cmake-no-openblas.patch @@ -0,0 +1,18 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,7 +58,6 @@ else() + endif() + + find_package(blaze REQUIRED) +-find_package(OpenBLAS REQUIRED) + find_package(libjpeg-turbo REQUIRED) + find_package(cimg REQUIRED) + +@@ -122,7 +121,6 @@ target_include_directories( + # Link dependencies + target_link_libraries(${WB_TARGET_NAME} sf_compressor) + target_link_libraries(${WB_TARGET_NAME} blaze::blaze) +-target_link_libraries(${WB_TARGET_NAME} OpenBLAS::OpenBLAS) + target_link_libraries(${WB_TARGET_NAME} libjpeg-turbo::libjpeg-turbo) + target_link_libraries(${WB_TARGET_NAME} cimg::cimg) + diff --git a/recipes/wavelet_buffer/all/patches/0002-0.4.0-cmake-find-jpeblib.patch b/recipes/wavelet_buffer/all/patches/0002-0.4.0-cmake-find-jpeblib.patch new file mode 100644 index 0000000000000..4a17b7079fb2e --- /dev/null +++ b/recipes/wavelet_buffer/all/patches/0002-0.4.0-cmake-find-jpeblib.patch @@ -0,0 +1,20 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -58,7 +58,7 @@ else() + endif() + + find_package(blaze REQUIRED) +-find_package(libjpeg-turbo REQUIRED) ++find_package(JPEG REQUIRED MODULE) + find_package(cimg REQUIRED) + + # Dependencies +@@ -121,7 +121,7 @@ target_include_directories( + # Link dependencies + target_link_libraries(${WB_TARGET_NAME} sf_compressor) + target_link_libraries(${WB_TARGET_NAME} blaze::blaze) +-target_link_libraries(${WB_TARGET_NAME} libjpeg-turbo::libjpeg-turbo) ++target_link_libraries(${WB_TARGET_NAME} JPEG::JPEG) + target_link_libraries(${WB_TARGET_NAME} cimg::cimg) + + # Catch2 installation diff --git a/recipes/wavelet_buffer/all/test_package/CMakeLists.txt b/recipes/wavelet_buffer/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..07b3926a7394a --- /dev/null +++ b/recipes/wavelet_buffer/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(WaveletBufferTest LANGUAGES CXX) + +find_package(wavelet_buffer CONFIG REQUIRED) + +add_executable(test_package test_package.cpp) +target_compile_features(test_package PRIVATE cxx_std_20) +target_link_libraries(test_package PRIVATE wavelet_buffer::wavelet_buffer) diff --git a/recipes/wavelet_buffer/all/test_package/conanfile.py b/recipes/wavelet_buffer/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0f34761d1525c --- /dev/null +++ b/recipes/wavelet_buffer/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/wavelet_buffer/all/test_package/test_package.cpp b/recipes/wavelet_buffer/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c37d44129cc08 --- /dev/null +++ b/recipes/wavelet_buffer/all/test_package/test_package.cpp @@ -0,0 +1,47 @@ +#include + +#include + +using drift::Signal1D; +using drift::WaveletBuffer; +using drift::WaveletParameters; +using drift::WaveletTypes; +using DenoiseAlgo = drift::ThresholdAbsDenoiseAlgorithm; + +int main() { + Signal1D original = blaze::generate( + 1000, [](auto index) { return static_cast(index % 100); }); + + std::cout << "Original size: " << original.size() * 4 << std::endl; + WaveletBuffer buffer(WaveletParameters{ + .signal_shape = {original.size()}, + .signal_number = 1, + .decomposition_steps = 3, + .wavelet_type = WaveletTypes::kDB1, + }); + + // Wavelet decomposition of the signal and denoising + buffer.Decompose(original, DenoiseAlgo(0, 0.3)); + + // Compress the buffer + std::string arch; + if (buffer.Serialize(&arch, 16)) { + std::cout << "Compressed size: " << arch.size() << std::endl; + } else { + std::cerr << "Serialization error" << std::endl; + return EXIT_FAILURE; + } + + // Decompress the buffer + auto restored_buffer = WaveletBuffer::Parse(arch); + Signal1D output_signal; + + // Restore the signal from wavelet decomposition + restored_buffer->Compose(&output_signal); + + std::cout << "Distance between original and restored signal: " + << blaze::norm(original - output_signal) / original.size() + << std::endl; + std::cout << "Compression rate: " << original.size() * 4. / arch.size() * 100 + << "%" << std::endl; +} diff --git a/recipes/wavelet_buffer/all/test_v1_package/CMakeLists.txt b/recipes/wavelet_buffer/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/wavelet_buffer/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/wavelet_buffer/all/test_v1_package/conanfile.py b/recipes/wavelet_buffer/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/wavelet_buffer/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/wavelet_buffer/config.yml b/recipes/wavelet_buffer/config.yml new file mode 100644 index 0000000000000..d13fcfd021b7b --- /dev/null +++ b/recipes/wavelet_buffer/config.yml @@ -0,0 +1,5 @@ +versions: + "0.5.0": + folder: all + "0.4.0": + folder: all diff --git a/recipes/wayland-protocols/all/conandata.yml b/recipes/wayland-protocols/all/conandata.yml index 35f717f4c3d19..1caa67f91c85d 100644 --- a/recipes/wayland-protocols/all/conandata.yml +++ b/recipes/wayland-protocols/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "1.31": + url: "https://github.com/wayland-project/wayland-protocols/archive/1.31.tar.gz" + sha256: "04d3f66eca99d638ec8dbfdfdf79334290e22028f7d0b04c7034d9ef18a3248a" + "1.27": + url: "https://github.com/wayland-project/wayland-protocols/archive/1.27.tar.gz" + sha256: "6dd6ee86478adf4347f3b8b4f3da62dbe9e44912c9cef21cf99abfe692313df4" "1.26": url: "https://github.com/wayland-project/wayland-protocols/archive/1.26.tar.gz" sha256: "fe56386f436a84e97c3b6a61b76306f205a64425900f247ad0048174b9c32d4d" diff --git a/recipes/wayland-protocols/all/conanfile.py b/recipes/wayland-protocols/all/conanfile.py index ccf5e12a5f5b4..d2ce51903263d 100644 --- a/recipes/wayland-protocols/all/conanfile.py +++ b/recipes/wayland-protocols/all/conanfile.py @@ -1,76 +1,67 @@ from conan import ConanFile +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain +from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration -from conans import Meson, tools import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" class WaylandProtocolsConan(ConanFile): name = "wayland-protocols" description = "Wayland is a project to define a protocol for a compositor to talk to its clients as well as a library implementation of the protocol" - topics = ("wayland") + topics = "wayland" url = "https://github.com/conan-io/conan-center-index" homepage = "https://gitlab.freedesktop.org/wayland/wayland-protocols" license = "MIT" - settings = "os", "arch", "compiler", "build_type" - _meson = None - def package_id(self): - self.info.header_only() - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" + self.info.clear() def validate(self): if self.settings.os != "Linux": - raise ConanInvalidConfiguration("Wayland-protocols can be built on Linux only") + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): - self.build_requires("meson/0.63.0") + self.tool_requires("meson/1.0.0") + + def layout(self): + basic_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = MesonToolchain(self) + tc.project_options["datadir"] = os.path.join(self.package_folder, "res") + tc.project_options["tests"] = "false" + tc.generate() + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() def _patch_sources(self): - if tools.Version(self.version) <= 1.23: + if Version(self.version) <= "1.23": # fixed upstream in https://gitlab.freedesktop.org/wayland/wayland-protocols/-/merge_requests/113 - tools.replace_in_file(os.path.join(self._source_subfolder, "meson.build"), - "dep_scanner = dependency('wayland-scanner', native: true)", - "#dep_scanner = dependency('wayland-scanner', native: true)") - - def _configure_meson(self): - if not self._meson: - defs = { - "tests": "false", - } - self._meson = Meson(self) - self._meson.configure( - source_folder=self._source_subfolder, - build_folder=self._build_subfolder, - defs=defs, - args=[f'--datadir={self.package_folder}/res'], - ) - return self._meson + replace_in_file(self, os.path.join(self.source_folder, "meson.build"), + "dep_scanner = dependency('wayland-scanner', native: true)", + "#dep_scanner = dependency('wayland-scanner', native: true)") def build(self): self._patch_sources() - meson = self._configure_meson() + meson = Meson(self) + meson.configure() meson.build() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - meson = self._configure_meson() + copy(self, "COPYING", self.source_folder, os.path.join(self.package_folder, "licenses")) + meson = Meson(self) meson.install() - tools.rmdir(os.path.join(self.package_folder, "res", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "res", "pkgconfig")) def package_info(self): pkgconfig_variables = { diff --git a/recipes/wayland-protocols/all/test_package/conanfile.py b/recipes/wayland-protocols/all/test_package/conanfile.py index 88f036db9bd02..19d2d81011711 100644 --- a/recipes/wayland-protocols/all/test_package/conanfile.py +++ b/recipes/wayland-protocols/all/test_package/conanfile.py @@ -1,27 +1,52 @@ -from conans import Meson, tools from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run +from conan.tools.env import VirtualBuildEnv +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.meson import Meson, MesonToolchain import os class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "pkg_config" + test_type = "explicit" - def build_requirements(self): - self.build_requires("wayland/1.21.0") - self.build_requires("meson/0.63.0") + @property + def _has_build_profile(self): + return hasattr(self, "settings_build") def requirements(self): + self.requires(self.tested_reference_str) self.requires("wayland/1.21.0") + def build_requirements(self): + self.tool_requires("meson/1.0.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + self.tool_requires("wayland/1.21.0") + + def layout(self): + basic_layout(self) + + def generate(self): + tc = MesonToolchain(self) + tc.project_options["build.pkg_config_path"] = self.generators_folder + tc.project_options["has_build_profile"] = self._has_build_profile + tc.generate() + pkg_config_deps = PkgConfigDeps(self) + if self._has_build_profile: + pkg_config_deps.build_context_activated = ["wayland"] + pkg_config_deps.build_context_suffix = {"wayland": "_BUILD"} + pkg_config_deps.generate() + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + def build(self): meson = Meson(self) - env_build = tools.RunEnvironment(self) - with tools.environment_append(env_build.vars): - meson.configure() - meson.build() + meson.configure() + meson.build() def test(self): - if not cross_building(self): - self.run(os.path.join(".", "test_package"), run_environment=True) + if can_run(self): + cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(cmd, env="conanrun") diff --git a/recipes/wayland-protocols/all/test_package/meson.build b/recipes/wayland-protocols/all/test_package/meson.build index fb3bbdfc77566..a79bb8c0c5c35 100644 --- a/recipes/wayland-protocols/all/test_package/meson.build +++ b/recipes/wayland-protocols/all/test_package/meson.build @@ -4,14 +4,20 @@ wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: wayland_protocols_dep = dependency('wayland-protocols', required: true) wayland_protocols_datadir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir') -wayland_scanner = find_program('wayland-scanner') +if get_option('has_build_profile') + wayland_scanner_dep = dependency('wayland-scanner_BUILD', native: true) + wayland_scanner_for_build = find_program(wayland_scanner_dep.get_variable(pkgconfig: 'wayland_scanner')) +else + wayland_scanner_for_build = find_program('wayland-scanner') +endif + wayland_scanner_code_gen = generator( - wayland_scanner, + wayland_scanner_for_build, output: '@BASENAME@-protocol.c', arguments: ['code', '@INPUT@', '@OUTPUT@'], ) wayland_scanner_client_header_gen = generator( - wayland_scanner, + wayland_scanner_for_build, output: '@BASENAME@-client-protocol.h', arguments: ['client-header', '@INPUT@', '@OUTPUT@'], ) diff --git a/recipes/wayland-protocols/all/test_package/meson_options.txt b/recipes/wayland-protocols/all/test_package/meson_options.txt new file mode 100644 index 0000000000000..15a4dceff2c0d --- /dev/null +++ b/recipes/wayland-protocols/all/test_package/meson_options.txt @@ -0,0 +1 @@ +option('has_build_profile', type : 'boolean', value : false) diff --git a/recipes/wayland-protocols/all/test_v1_package/conanfile.py b/recipes/wayland-protocols/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..37376c2138077 --- /dev/null +++ b/recipes/wayland-protocols/all/test_v1_package/conanfile.py @@ -0,0 +1,27 @@ +from conans import Meson, tools +from conan import ConanFile +from conan.tools.build import cross_building +import os + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "pkg_config" + + def build_requirements(self): + self.build_requires("wayland/1.21.0") + self.build_requires("meson/1.0.0") + + def requirements(self): + self.requires("wayland/1.21.0") + + def build(self): + meson = Meson(self) + env_build = tools.RunEnvironment(self) + with tools.environment_append(env_build.vars): + meson.configure() + meson.build() + + def test(self): + if not cross_building(self): + self.run(os.path.join(".", "test_package"), run_environment=True) diff --git a/recipes/wayland-protocols/all/test_v1_package/meson.build b/recipes/wayland-protocols/all/test_v1_package/meson.build new file mode 100644 index 0000000000000..d1776cc1915fd --- /dev/null +++ b/recipes/wayland-protocols/all/test_v1_package/meson.build @@ -0,0 +1,30 @@ +project('test_wayland_protocols', 'c') + +wayland_client_dep = dependency('wayland-client', version: '>=1.2.0', required: true) +wayland_protocols_dep = dependency('wayland-protocols', required: true) +wayland_protocols_datadir = wayland_protocols_dep.get_pkgconfig_variable('pkgdatadir') + +wayland_scanner = find_program('wayland-scanner') +wayland_scanner_code_gen = generator( + wayland_scanner, + output: '@BASENAME@-protocol.c', + arguments: ['code', '@INPUT@', '@OUTPUT@'], +) +wayland_scanner_client_header_gen = generator( + wayland_scanner, + output: '@BASENAME@-client-protocol.h', + arguments: ['client-header', '@INPUT@', '@OUTPUT@'], +) + +xdg_shell_xml = wayland_protocols_datadir/'stable/xdg-shell/xdg-shell.xml' + +xdg_shell_sources = [ + wayland_scanner_code_gen.process(xdg_shell_xml), + wayland_scanner_client_header_gen.process(xdg_shell_xml), +] + +executable('test_package', + '../test_package/test_package.c', + xdg_shell_sources, + dependencies: [wayland_client_dep], + link_args : '-lrt') diff --git a/recipes/wayland-protocols/config.yml b/recipes/wayland-protocols/config.yml index 1bb41705cf242..81aded41c9822 100644 --- a/recipes/wayland-protocols/config.yml +++ b/recipes/wayland-protocols/config.yml @@ -1,4 +1,8 @@ versions: + "1.31": + folder: all + "1.27": + folder: all "1.26": folder: all "1.25": diff --git a/recipes/wayland/all/conanfile.py b/recipes/wayland/all/conanfile.py index 69131d15a7f3b..c656a7a7cff96 100644 --- a/recipes/wayland/all/conanfile.py +++ b/recipes/wayland/all/conanfile.py @@ -1,13 +1,15 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.gnu import PkgConfigDeps from conan.tools.layout import basic_layout from conan.tools.meson import Meson, MesonToolchain from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class WaylandConan(ConanFile): @@ -16,11 +18,11 @@ class WaylandConan(ConanFile): "Wayland is a project to define a protocol for a compositor to talk to " "its clients as well as a library implementation of the protocol" ) - topics = ("protocol", "compositor", "display") + topics = "protocol", "compositor", "display" url = "https://github.com/conan-io/conan-center-index" homepage = "https://wayland.freedesktop.org" license = "MIT" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -35,50 +37,58 @@ class WaylandConan(ConanFile): "enable_dtd_validation": True, } - generators = "PkgConfigDeps", "VirtualBuildEnv", "VirtualRunEnv" - def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.enable_libraries: - self.requires("libffi/3.4.2") + self.requires("libffi/3.4.3") if self.options.enable_dtd_validation: - self.requires("libxml2/2.9.14") - self.requires("expat/2.4.8") + self.requires("libxml2/2.10.3") + self.requires("expat/2.5.0") def validate(self): - if self.info.settings.os != "Linux": - raise ConanInvalidConfiguration("Wayland can be built on Linux only") + if self.settings.os != "Linux": + raise ConanInvalidConfiguration(f"{self.ref} only supports Linux") def build_requirements(self): - self.tool_requires("meson/0.63.1") - self.tool_requires("pkgconf/1.7.4") + self.tool_requires("meson/1.0.0") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") if cross_building(self): - self.tool_requires(self.ref) - - def layout(self): - basic_layout(self, src_folder="src") + self.tool_requires(str(self.ref)) def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + pkg_config_deps = PkgConfigDeps(self) + if cross_building(self): + pkg_config_deps.build_context_activated = ["wayland"] + elif self.dependencies["expat"].is_build_context: # wayland is being built as build_require + # If wayland is the build_require, all its dependencies are treated as build_requires + pkg_config_deps.build_context_activated = [dep.ref.name for _, dep in self.dependencies.host.items()] + pkg_config_deps.generate() tc = MesonToolchain(self) tc.project_options["libdir"] = "lib" tc.project_options["datadir"] = "res" tc.project_options["libraries"] = self.options.enable_libraries tc.project_options["dtd_validation"] = self.options.enable_dtd_validation tc.project_options["documentation"] = False + if cross_building(self): + tc.project_options["build.pkg_config_path"] = self.generators_folder if Version(self.version) >= "1.18.91": tc.project_options["scanner"] = True tc.generate() @@ -87,14 +97,6 @@ def _patch_sources(self): replace_in_file(self, os.path.join(self.source_folder, "meson.build"), "subdir('tests')", "#subdir('tests')") - if cross_building(self): - replace_in_file(self, f"{self.source_folder}/src/meson.build", - "scanner_dep = dependency('wayland-scanner', native: true, version: meson.project_version())", - "# scanner_dep = dependency('wayland-scanner', native: true, version: meson.project_version())") - replace_in_file(self, f"{self.source_folder}/src/meson.build", - "wayland_scanner_for_build = find_program(scanner_dep.get_variable(pkgconfig: 'wayland_scanner'))", - "wayland_scanner_for_build = find_program('wayland-scanner')") - def build(self): self._patch_sources() meson = Meson(self) @@ -110,13 +112,10 @@ def package(self): def package_info(self): self.cpp_info.components["wayland-scanner"].set_property("pkg_config_name", "wayland-scanner") - self.cpp_info.components["wayland-scanner"].names["pkg_config"] = "wayland-scanner" self.cpp_info.components["wayland-scanner"].resdirs = ["res"] - self.cpp_info.components["wayland-scanner"].includedirs = [] self.cpp_info.components["wayland-scanner"].libdirs = [] self.cpp_info.components["wayland-scanner"].set_property("component_version", self.version) - self.cpp_info.components["wayland-scanner"].requires = ["expat::expat"] if self.options.enable_dtd_validation: self.cpp_info.components["wayland-scanner"].requires.append("libxml2::libxml2") @@ -130,24 +129,15 @@ def package_info(self): "pkg_config_custom_content", "\n".join(f"{key}={value}" for key,value in pkgconfig_variables.items())) - bindir = os.path.join(self.package_folder, "bin") - self.buildenv_info.prepend_path("PATH", bindir) - self.runenv_info.prepend_path("PATH", bindir) - # TODO: Remove in Conan 2.0 where Environment class will be required. - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) - if self.options.enable_libraries: self.cpp_info.components["wayland-server"].libs = ["wayland-server"] self.cpp_info.components["wayland-server"].set_property("pkg_config_name", "wayland-server") - self.cpp_info.components["wayland-server"].names["pkg_config"] = "wayland-server" self.cpp_info.components["wayland-server"].requires = ["libffi::libffi"] self.cpp_info.components["wayland-server"].system_libs = ["pthread", "m"] self.cpp_info.components["wayland-server"].resdirs = ["res"] if self.version >= Version("1.21.0") and self.settings.os == "Linux": self.cpp_info.components["wayland-server"].system_libs += ["rt"] self.cpp_info.components["wayland-server"].set_property("component_version", self.version) - pkgconfig_variables = { 'datarootdir': '${prefix}/res', 'pkgdatadir': '${datarootdir}/wayland', @@ -158,14 +148,12 @@ def package_info(self): self.cpp_info.components["wayland-client"].libs = ["wayland-client"] self.cpp_info.components["wayland-client"].set_property("pkg_config_name", "wayland-client") - self.cpp_info.components["wayland-client"].names["pkg_config"] = "wayland-client" self.cpp_info.components["wayland-client"].requires = ["libffi::libffi"] self.cpp_info.components["wayland-client"].system_libs = ["pthread", "m"] self.cpp_info.components["wayland-client"].resdirs = ["res"] if self.version >= Version("1.21.0") and self.settings.os == "Linux": self.cpp_info.components["wayland-client"].system_libs += ["rt"] self.cpp_info.components["wayland-client"].set_property("component_version", self.version) - pkgconfig_variables = { 'datarootdir': '${prefix}/res', 'pkgdatadir': '${datarootdir}/wayland', @@ -176,20 +164,16 @@ def package_info(self): self.cpp_info.components["wayland-cursor"].libs = ["wayland-cursor"] self.cpp_info.components["wayland-cursor"].set_property("pkg_config_name", "wayland-cursor") - self.cpp_info.components["wayland-cursor"].names["pkg_config"] = "wayland-cursor" self.cpp_info.components["wayland-cursor"].requires = ["wayland-client"] self.cpp_info.components["wayland-cursor"].set_property("component_version", self.version) self.cpp_info.components["wayland-egl"].libs = ["wayland-egl"] self.cpp_info.components["wayland-egl"].set_property("pkg_config_name", "wayland-egl") - self.cpp_info.components["wayland-egl"].names["pkg_config"] = "wayland-egl" self.cpp_info.components["wayland-egl"].requires = ["wayland-client"] self.cpp_info.components["wayland-egl"].set_property("component_version", "18.1.0") - self.cpp_info.components["wayland-egl-backend"].names["pkg_config"] = "wayland-egl-backend" self.cpp_info.components["wayland-egl-backend"].set_property("pkg_config_name", "wayland-egl-backend") self.cpp_info.components["wayland-egl-backend"].set_property("component_version", "3") - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/wayland/all/test_package/CMakeLists.txt b/recipes/wayland/all/test_package/CMakeLists.txt index b2f1007483914..fa5ae025fbfc7 100644 --- a/recipes/wayland/all/test_package/CMakeLists.txt +++ b/recipes/wayland/all/test_package/CMakeLists.txt @@ -1,5 +1,5 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package C) +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) find_package(wayland COMPONENTS wayland-client REQUIRED) diff --git a/recipes/wayland/all/test_package/conanfile.py b/recipes/wayland/all/test_package/conanfile.py index bcb69ca93c05f..c201ad68aff34 100644 --- a/recipes/wayland/all/test_package/conanfile.py +++ b/recipes/wayland/all/test_package/conanfile.py @@ -1,28 +1,55 @@ import os from conan import ConanFile -from conan.tools.build import cross_building -from conan.tools.cmake import CMake -from conan.tools.gnu import PkgConfig -from conan.tools.layout import cmake_layout +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout, CMakeDeps, CMakeToolchain +from conan.tools.env import VirtualBuildEnv +from conan.tools.gnu import PkgConfig, PkgConfigDeps class TestPackageConan(ConanFile): settings = "os", "compiler", "build_type", "arch" - generators = "CMakeToolchain", "CMakeDeps", "PkgConfigDeps", "VirtualRunEnv" + test_type = "explicit" + + @property + def _has_build_profile(self): + return hasattr(self, "settings_build") + + def requirements(self): + self.requires(self.tested_reference_str) + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") def layout(self): cmake_layout(self) + def generate(self): + tc = CMakeToolchain(self) + tc.generate() + cmake_deps = CMakeDeps(self) + cmake_deps.generate() + pkg_config_deps = PkgConfigDeps(self) + if self._has_build_profile: + pkg_config_deps.build_context_activated = ["wayland"] + pkg_config_deps.build_context_suffix = {"wayland": "_BUILD"} + pkg_config_deps.generate() + virtual_build_env = VirtualBuildEnv(self) + virtual_build_env.generate() + def build(self): - if not cross_building(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - pkg_config = PkgConfig(self, "wayland-scanner", self.generators_folder) - self.run('%s --version' % pkg_config.variables["wayland_scanner"], env="conanrun") + cmake = CMake(self) + cmake.configure() + cmake.build() + + if self._has_build_profile: + pkg_config = PkgConfig(self, "wayland-scanner_BUILD", self.generators_folder) + wayland_scanner = pkg_config.variables["wayland_scanner"] + self.run(f"{wayland_scanner} --version", env="conanrun") def test(self): - if not cross_building(self): - cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") - self.run(cmd, env="conanrun") + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wayland/all/test_v1_package/CMakeLists.txt b/recipes/wayland/all/test_v1_package/CMakeLists.txt index 8388973d3de1e..925ecbe19e448 100644 --- a/recipes/wayland/all/test_v1_package/CMakeLists.txt +++ b/recipes/wayland/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.15) -project(test_package C) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(wayland REQUIRED CONFIG) - -add_executable(test_package ../test_package/test_package.c) -target_link_libraries(test_package PRIVATE wayland::wayland-client) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/websocketpp/all/conandata.yml b/recipes/websocketpp/all/conandata.yml index e4a2c72f4436b..f48a24b75f74d 100644 --- a/recipes/websocketpp/all/conandata.yml +++ b/recipes/websocketpp/all/conandata.yml @@ -6,6 +6,16 @@ sources: url: "https://github.com/zaphoyd/websocketpp/archive/0.8.1.tar.gz" sha256: "178899de48c02853b55b1ea8681599641cedcdfce59e56beaff3dd0874bf0286" patches: + "0.8.2": + - patch_file: "patches/support-gcc-12.patch" + patch_type: "portability" + patch_description: "support gcc 12" + patch_source: "https://github.com/zaphoyd/websocketpp/issues/991" "0.8.1": - patch_file: "patches/websocket_boost_support_1_7_x.patch" - base_path: "source_subfolder" + patch_type: "conan" + patch_description: "Boost 1.70+ support: Mostly captures zaphoyd/websocketpp#814" + - patch_file: "patches/support-gcc-12.patch" + patch_type: "portability" + patch_description: "support gcc 12" + patch_source: "https://github.com/zaphoyd/websocketpp/issues/991" diff --git a/recipes/websocketpp/all/conanfile.py b/recipes/websocketpp/all/conanfile.py index 4978bf5a6d6e8..561f5099440d0 100644 --- a/recipes/websocketpp/all/conanfile.py +++ b/recipes/websocketpp/all/conanfile.py @@ -1,7 +1,9 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class WebsocketPPConan(ConanFile): @@ -24,44 +26,50 @@ class WebsocketPPConan(ConanFile): "with_zlib": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): if self.options.with_openssl: - self.requires("openssl/1.1.1o") + self.requires("openssl/1.1.1s", transitive_headers=True, transitive_libs=True) if self.options.with_zlib: - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13", transitive_headers=True, transitive_libs=True) if self.options.asio == "standalone": - self.requires("asio/1.22.1") + self.requires("asio/1.24.0", transitive_headers=True) elif self.options.asio == "boost": - self.requires("boost/1.79.0") + self.requires("boost/1.81.0", transitive_headers=True) def package_id(self): - self.info.header_only() + self.info.clear() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - # We have to copy the headers manually, since the upstream cmake.install() step doesn't do so. - self.copy(pattern=os.path.join("websocketpp","*.hpp"), dst="include", src=self._source_subfolder) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, os.path.join("websocketpp","*.hpp"), src=self.source_folder, dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "websocketpp") self.cpp_info.set_property("cmake_target_name", "websocketpp::websocketpp") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + self.cpp_info.requires = [] + if self.options.with_openssl: + self.cpp_info.requires.append("openssl::openssl") + if self.options.with_zlib: + self.cpp_info.requires.append("zlib::zlib") if self.options.asio == "standalone": self.cpp_info.defines.extend(["ASIO_STANDALONE", "_WEBSOCKETPP_CPP11_STL_"]) + self.cpp_info.requires.append("asio::asio") + elif self.options.asio == "boost": + self.cpp_info.requires.append("boost::headers") diff --git a/recipes/websocketpp/all/patches/support-gcc-12.patch b/recipes/websocketpp/all/patches/support-gcc-12.patch new file mode 100644 index 0000000000000..b69f7b18a5145 --- /dev/null +++ b/recipes/websocketpp/all/patches/support-gcc-12.patch @@ -0,0 +1,93 @@ +diff --git a/websocketpp/endpoint.hpp b/websocketpp/endpoint.hpp +index c124b1d..9ce8a62 100644 +--- a/websocketpp/endpoint.hpp ++++ b/websocketpp/endpoint.hpp +@@ -109,7 +109,7 @@ public: + + + /// Destructor +- ~endpoint() {} ++ ~endpoint() {} + + #ifdef _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_ + // no copy constructor because endpoints are not copyable +diff --git a/websocketpp/logger/basic.hpp b/websocketpp/logger/basic.hpp +index 8451413..51efa94 100644 +--- a/websocketpp/logger/basic.hpp ++++ b/websocketpp/logger/basic.hpp +@@ -58,33 +58,33 @@ namespace log { + template + class basic { + public: +- basic(channel_type_hint::value h = ++ basic(channel_type_hint::value h = + channel_type_hint::access) + : m_static_channels(0xffffffff) + , m_dynamic_channels(0) + , m_out(h == channel_type_hint::error ? &std::cerr : &std::cout) {} + +- basic(std::ostream * out) ++ basic(std::ostream * out) + : m_static_channels(0xffffffff) + , m_dynamic_channels(0) + , m_out(out) {} + +- basic(level c, channel_type_hint::value h = ++ basic(level c, channel_type_hint::value h = + channel_type_hint::access) + : m_static_channels(c) + , m_dynamic_channels(0) + , m_out(h == channel_type_hint::error ? &std::cerr : &std::cout) {} + +- basic(level c, std::ostream * out) ++ basic(level c, std::ostream * out) + : m_static_channels(c) + , m_dynamic_channels(0) + , m_out(out) {} + + /// Destructor +- ~basic() {} ++ ~basic() {} + + /// Copy constructor +- basic(basic const & other) ++ basic(basic const & other) + : m_static_channels(other.m_static_channels) + , m_dynamic_channels(other.m_dynamic_channels) + , m_out(other.m_out) +@@ -97,7 +97,7 @@ public: + + #ifdef _WEBSOCKETPP_MOVE_SEMANTICS_ + /// Move constructor +- basic(basic && other) ++ basic(basic && other) + : m_static_channels(other.m_static_channels) + , m_dynamic_channels(other.m_dynamic_channels) + , m_out(other.m_out) +diff --git a/websocketpp/roles/server_endpoint.hpp b/websocketpp/roles/server_endpoint.hpp +index 9cc652f..ad8f403 100644 +--- a/websocketpp/roles/server_endpoint.hpp ++++ b/websocketpp/roles/server_endpoint.hpp +@@ -72,11 +72,11 @@ public: + } + + /// Destructor +- ~server() {} ++ ~server() {} + + #ifdef _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_ + // no copy constructor because endpoints are not copyable +- server(server &) = delete; ++ server(server&) = delete; + + // no copy assignment operator because endpoints are not copyable + server & operator=(server const &) = delete; +@@ -84,7 +84,7 @@ public: + + #ifdef _WEBSOCKETPP_MOVE_SEMANTICS_ + /// Move constructor +- server(server && o) : endpoint,config>(std::move(o)) {} ++ server(server&& o) : endpoint,config>(std::move(o)) {} + + #ifdef _WEBSOCKETPP_DEFAULT_DELETE_FUNCTIONS_ + // no move assignment operator because of const member variables diff --git a/recipes/websocketpp/all/test_package/CMakeLists.txt b/recipes/websocketpp/all/test_package/CMakeLists.txt index 6ac22fac2b9d7..d6d230796653e 100644 --- a/recipes/websocketpp/all/test_package/CMakeLists.txt +++ b/recipes/websocketpp/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(websocketpp REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} websocketpp::websocketpp) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE websocketpp::websocketpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/websocketpp/all/test_package/conanfile.py b/recipes/websocketpp/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/websocketpp/all/test_package/conanfile.py +++ b/recipes/websocketpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/websocketpp/all/test_v1_package/CMakeLists.txt b/recipes/websocketpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/websocketpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/websocketpp/all/test_v1_package/conanfile.py b/recipes/websocketpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/websocketpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/wildmidi/all/conandata.yml b/recipes/wildmidi/all/conandata.yml new file mode 100644 index 0000000000000..aeed5ef43a0f2 --- /dev/null +++ b/recipes/wildmidi/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "0.4.5": + url: "https://github.com/Mindwerks/wildmidi/releases/download/wildmidi-0.4.5/wildmidi-0.4.5.tar.gz" + sha256: "d5e7bef00a7aa47534a53d43b1265f8d3d27f6a28e7f563c1cdf02ff4fa35b99" diff --git a/recipes/wildmidi/all/conanfile.py b/recipes/wildmidi/all/conanfile.py new file mode 100644 index 0000000000000..0e6c15d33a72b --- /dev/null +++ b/recipes/wildmidi/all/conanfile.py @@ -0,0 +1,94 @@ +from conan import ConanFile +from conan.tools.microsoft import is_msvc +from conan.tools.files import export_conandata_patches, get, copy, rmdir +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +required_conan_version = ">=1.53.0" + + +class WildmidiConan(ConanFile): + name = "wildmidi" + description = "WildMIDI is a simple software midi player which has a core softsynth library that can be used in other applications." + license = "LGPL-3.0-only" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://www.mindwerks.net/projects/wildmidi" + topics = ("audio", "midi", "multimedia", "music", "softsynth", "sound", "synth") + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") + + def layout(self): + cmake_layout(self, src_folder="src") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + if self.settings.os == "Windows": + tc.variables["CMAKE_BUILD_TYPE"] = self.settings.build_type + tc.variables["WANT_PLAYER"] = False + if not self.options.shared: + tc.variables["WANT_STATIC"] = True + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, pattern="docs/license/LGPLv3.txt", dst=os.path.join( + self.package_folder, "licenses"), src=self.source_folder, keep_path=False) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + if is_msvc(self): + libname = "libWildMidi" + if not self.options.shared: + libname += "-static" + else: + libname = "WildMidi" + + self.cpp_info.set_property("cmake_file_name", "WildMidi") + self.cpp_info.set_property("cmake_target_name", "WildMidi::libwildmidi") + self.cpp_info.set_property("pkg_config_name", "wildmidi") + + # TODO: back to global scope in conan v2 once cmake_find_package* generators removed + self.cpp_info.components["libwildmidi"].libs = [libname] + if not self.options.shared: + self.cpp_info.components["libwildmidi"].defines = ["WILDMIDI_STATIC"] + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["libwildmidi"].system_libs.append("m") + + # TODO: remove in conan v2 once cmake_find_package* generators removed + self.cpp_info.names["cmake_find_package"] = "WildMidi" + self.cpp_info.names["cmake_find_package_multi"] = "WildMidi" + self.cpp_info.components["libwildmidi"].names["cmake_find_package"] = "libwildmidi" + self.cpp_info.components["libwildmidi"].names["cmake_find_package_multi"] = "libwildmidi" diff --git a/recipes/wildmidi/all/test_package/CMakeLists.txt b/recipes/wildmidi/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..583b61deec33c --- /dev/null +++ b/recipes/wildmidi/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) + +project(test_package C) + +find_package(WildMidi REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE WildMidi::libwildmidi) diff --git a/recipes/wildmidi/all/test_package/conanfile.py b/recipes/wildmidi/all/test_package/conanfile.py new file mode 100644 index 0000000000000..a9fb96656f203 --- /dev/null +++ b/recipes/wildmidi/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wildmidi/all/test_package/test_package.c b/recipes/wildmidi/all/test_package/test_package.c new file mode 100644 index 0000000000000..d4722893a8b9c --- /dev/null +++ b/recipes/wildmidi/all/test_package/test_package.c @@ -0,0 +1,11 @@ +#include +#include + +#include + + +int main(void) { + printf("WildMidi version %d\n", WildMidi_GetVersion()); + + return EXIT_SUCCESS; +} diff --git a/recipes/wildmidi/all/test_v1_package/CMakeLists.txt b/recipes/wildmidi/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/wildmidi/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/wildmidi/all/test_v1_package/conanfile.py b/recipes/wildmidi/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/wildmidi/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/wildmidi/config.yml b/recipes/wildmidi/config.yml new file mode 100644 index 0000000000000..2f58813e5d25d --- /dev/null +++ b/recipes/wildmidi/config.yml @@ -0,0 +1,3 @@ +versions: + "0.4.5": + folder: all diff --git a/recipes/winflexbison/all/conanfile.py b/recipes/winflexbison/all/conanfile.py index 5bec8a823d53f..96dfb9c1906e9 100644 --- a/recipes/winflexbison/all/conanfile.py +++ b/recipes/winflexbison/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.errors import ConanInvalidConfiguration from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rename, save +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, save import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.52.0" class WinflexbisonConan(ConanFile): @@ -17,19 +17,20 @@ class WinflexbisonConan(ConanFile): settings = "os", "arch", "compiler", "build_type" def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) - - def validate(self): - if self.info.settings.os != "Windows": - raise ConanInvalidConfiguration("winflexbison is only supported on Windows.") + export_conandata_patches(self) def layout(self): cmake_layout(self, src_folder="src") + def package_id(self): + del self.info.settings.compiler + + def validate(self): + if self.settings.os != "Windows": + raise ConanInvalidConfiguration("winflexbison is only supported on Windows.") + def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -84,8 +85,6 @@ def package_info(self): self.buildenv_info.define_path("YACC", yacc_path) # TODO: to remove in conan v2 - bindir = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bindir)) - self.env_info.PATH.append(bindir) + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) self.env_info.LEX = lex_path self.env_info.YACC = yacc_path diff --git a/recipes/winflexbison/all/test_package/conanfile.py b/recipes/winflexbison/all/test_package/conanfile.py index be1250f9b3a7b..30f93d42368f9 100644 --- a/recipes/winflexbison/all/test_package/conanfile.py +++ b/recipes/winflexbison/all/test_package/conanfile.py @@ -7,23 +7,23 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv" - - def build_requirements(self): - self.tool_requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): + self.run("win_flex --version") + self.run("win_bison --version") if not cross_building(self): - self.run("win_flex --version", env="conanbuild") - self.run("win_bison --version", env="conanbuild") - bison_test = os.path.join(self.cpp.build.bindirs[0], "bison_test_package") self.run(bison_test, env="conanrun") flex_test = os.path.join(self.cpp.build.bindirs[0], "flex_test_package") diff --git a/recipes/winflexbison/all/test_v1_package/CMakeLists.txt b/recipes/winflexbison/all/test_v1_package/CMakeLists.txt index 94d419f8a1bdd..0d20897301b68 100644 --- a/recipes/winflexbison/all/test_v1_package/CMakeLists.txt +++ b/recipes/winflexbison/all/test_v1_package/CMakeLists.txt @@ -1,54 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES C CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -# Flex - -set(FLEX_TARGET_COMPILE_FLAGS "") -if(MSVC) - set(FLEX_TARGET_COMPILE_FLAGS "--wincompat") -endif() - -find_package(FLEX REQUIRED) -set(FLEX_VARS - FLEX_FOUND - FLEX_EXECUTABLE - FLEX_LIBRARIES - FLEX_INCLUDE_DIRS -) - -foreach(FLEX_VAR ${FLEX_VARS}) - message("${FLEX_VAR}: ${${FLEX_VAR}}") - if(NOT ${FLEX_VAR}) - message(WARNING "${FLEX_VAR} NOT FOUND") - endif() -endforeach() - -FLEX_TARGET(TestParser ../test_package/basic_nr.l "${CMAKE_CURRENT_BINARY_DIR}/lexer.cpp" COMPILE_FLAGS "${FLEX_TARGET_COMPILE_FLAGS}") -add_executable(flex_test_package ${FLEX_TestParser_OUTPUTS}) -target_compile_features(flex_test_package PRIVATE cxx_std_11) - -# Bison - -find_package(BISON) - -set(BISON_VARS - BISON_FOUND - BISON_EXECUTABLE - BISON_VERSION -) - -foreach(BISON_VAR ${BISON_VARS}) - message("${BISON_VAR}: ${${BISON_VAR}}") - if(NOT ${BISON_VAR}) - message(WARNING "${BISON_VAR} NOT FOUND") - endif() -endforeach() - -bison_target(bison_parser_target ../test_package/mc_parser.yy "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp") - -add_executable(bison_test_package "${CMAKE_CURRENT_BINARY_DIR}/mc_parser.cpp" ../test_package/dummy_lex.c) -target_compile_features(bison_test_package PRIVATE cxx_std_11) -target_include_directories(bison_test_package PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/winflexbison/all/test_v1_package/conanfile.py b/recipes/winflexbison/all/test_v1_package/conanfile.py index 41351eeed660f..744b30cd87048 100644 --- a/recipes/winflexbison/all/test_v1_package/conanfile.py +++ b/recipes/winflexbison/all/test_v1_package/conanfile.py @@ -5,19 +5,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "cmake" + test_type = "explicit" + + def build_requirements(self): + self.build_requires(self.tested_reference_str) def build(self): - if not tools.cross_building(self, skip_x64_x86=True): - with tools.run_environment(self): - cmake = CMake(self) - cmake.configure() - cmake.build() + cmake = CMake(self) + cmake.configure() + cmake.build() def test(self): + self.run("win_flex --version") + self.run("win_bison --version") if not tools.cross_building(self, skip_x64_x86=True): - self.run("win_flex --version", run_environment=True) - self.run("win_bison --version", run_environment=True) - bison_test = os.path.join("bin", "bison_test_package") self.run(bison_test, run_environment=True) flex_test = os.path.join("bin", "flex_test_package") diff --git a/recipes/winmd/all/conandata.yml b/recipes/winmd/all/conandata.yml new file mode 100644 index 0000000000000..df65e2d6e2f3f --- /dev/null +++ b/recipes/winmd/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0.210629.2": + url: "https://github.com/microsoft/winmd/archive/refs/tags/1.0.210629.2.tar.gz" + sha256: "93ef28b801abc390a2a09a69d56e1200533a5c8d9fc1743cb23afaaa890ac5a8" diff --git a/recipes/winmd/all/conanfile.py b/recipes/winmd/all/conanfile.py new file mode 100644 index 0000000000000..1882e7a4ae703 --- /dev/null +++ b/recipes/winmd/all/conanfile.py @@ -0,0 +1,70 @@ +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc, check_min_vs + +required_conan_version = ">=1.52.0" + + +class WinMDConan(ConanFile): + name = "winmd" + description = "C++ winmd parser" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/microsoft/winmd" + topics = ("native", "C++", "WinRT", "WinMD") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 17 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "8", + "clang": "12", + "apple-clang": "12.0", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + # FIXME: `self.settings` is not available in 2.0 but there are plenty of open issues about + # the migration point. For now we are only going to write valid 1.x recipes until we have a proper answer + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + check_min_vs(self, 191) + if not is_msvc(self): + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and Version(self.settings.compiler.version) < minimum_version: + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not (fully) support." + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "src"), + ) + + def package_info(self): + if not is_msvc(self): + # ignore shadowing errors + self.cpp_info.cppflags = ['-fpermissive'] diff --git a/recipes/winmd/all/test_package/CMakeLists.txt b/recipes/winmd/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..64e3b97db4f96 --- /dev/null +++ b/recipes/winmd/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(winmd REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE winmd::winmd) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/winmd/all/test_package/conanfile.py b/recipes/winmd/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/winmd/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/winmd/all/test_package/test_package.cpp b/recipes/winmd/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..94c14b063f2b1 --- /dev/null +++ b/recipes/winmd/all/test_package/test_package.cpp @@ -0,0 +1,12 @@ +#include +#include + + +int main(void) { + std::vector include = { "N1", "N3", "N3.N4.N5" }; + std::vector exclude = { "N2", "N3.N4" }; + + winmd::reader::filter f{ include, exclude }; + + return f.empty() ? EXIT_FAILURE : EXIT_SUCCESS; +} diff --git a/recipes/winmd/all/test_v1_package/CMakeLists.txt b/recipes/winmd/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/winmd/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/winmd/all/test_v1_package/conanfile.py b/recipes/winmd/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/winmd/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/winmd/config.yml b/recipes/winmd/config.yml new file mode 100644 index 0000000000000..f7c649835750b --- /dev/null +++ b/recipes/winmd/config.yml @@ -0,0 +1,4 @@ +versions: + # Newer versions at the top + "1.0.210629.2": + folder: all diff --git a/recipes/wolfssl/all/conandata.yml b/recipes/wolfssl/all/conandata.yml index 18d51db251a4a..6fec683102ea7 100644 --- a/recipes/wolfssl/all/conandata.yml +++ b/recipes/wolfssl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "5.5.1": + url: "https://github.com/wolfSSL/wolfssl/archive/v5.5.1-stable.tar.gz" + sha256: "97339e6956c90e7c881ba5c748dd04f7c30e5dbe0c06da765418c51375a6dee3" "5.4.0": url: "https://github.com/wolfSSL/wolfssl/archive/v5.4.0-stable.tar.gz" sha256: "dc36cc19dad197253e5c2ecaa490c7eef579ad448706e55d73d79396e814098b" diff --git a/recipes/wolfssl/config.yml b/recipes/wolfssl/config.yml index b5e6c7b8e93a2..84cd9530404f8 100644 --- a/recipes/wolfssl/config.yml +++ b/recipes/wolfssl/config.yml @@ -1,4 +1,6 @@ versions: + "5.5.1": + folder: all "5.4.0": folder: all "5.3.0": diff --git a/recipes/wslay/all/CMakeLists.txt b/recipes/wslay/all/CMakeLists.txt deleted file mode 100644 index 97030501e5bd7..0000000000000 --- a/recipes/wslay/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup() - -add_subdirectory(source_subfolder) diff --git a/recipes/wslay/all/conandata.yml b/recipes/wslay/all/conandata.yml index facd0e25d7b16..5a894437f1a9e 100644 --- a/recipes/wslay/all/conandata.yml +++ b/recipes/wslay/all/conandata.yml @@ -5,6 +5,4 @@ sources: patches: "1.1.1": - patch_file: "patches/0001-msvc-support.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-cmake-install-shared-artifacts.patch" - base_path: "source_subfolder" diff --git a/recipes/wslay/all/conanfile.py b/recipes/wslay/all/conanfile.py index 47817938f37d1..0891ca89ea5c3 100644 --- a/recipes/wslay/all/conanfile.py +++ b/recipes/wslay/all/conanfile.py @@ -1,8 +1,10 @@ -from conans import ConanFile, tools, CMake +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, get, rmdir, save import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.50.0" class WslayConan(ConanFile): @@ -23,17 +25,9 @@ class WslayConan(ConanFile): "fPIC": True, } - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + for p in self.conan_data.get("patches", {}).get(self.version, []): + copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) def config_options(self): if self.settings.os == "Windows": @@ -42,33 +36,41 @@ def config_options(self): def configure(self): if self.options.shared: del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["WSLAY_STATIC"] = not self.options.shared - self._cmake.definitions["WSLAY_SHARED"] = self.options.shared - self._cmake.configure() - return self._cmake + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WSLAY_STATIC"] = not self.options.shared + tc.variables["WSLAY_SHARED"] = self.options.shared + # Relocatable shared libs on macOS + tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0042"] = "NEW" + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", src=os.path.join(self.source_folder, self._source_subfolder), dst="licenses") - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self._create_cmake_module_alias_targets( @@ -76,21 +78,20 @@ def package(self): {self._wslay_lib_target: "wslay::wslay"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property def _wslay_lib_target(self): diff --git a/recipes/wslay/all/patches/0001-msvc-support.patch b/recipes/wslay/all/patches/0001-msvc-support.patch index ddc83979cf721..a689fc2452be1 100644 --- a/recipes/wslay/all/patches/0001-msvc-support.patch +++ b/recipes/wslay/all/patches/0001-msvc-support.patch @@ -35,7 +35,7 @@ index 4af972e..96b5392 100644 -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -pedantic-errors -Wno-long-long") +if(NOT MSVC) -+ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror -pedantic-errors -Wno-long-long") ++ set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wno-long-long") +endif() include(CheckIncludeFile) diff --git a/recipes/wslay/all/test_package/CMakeLists.txt b/recipes/wslay/all/test_package/CMakeLists.txt index ec02a305e3b07..2f2c295f8ed13 100644 --- a/recipes/wslay/all/test_package/CMakeLists.txt +++ b/recipes/wslay/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(wslay REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) if(TARGET wslay_shared) - target_link_libraries(${PROJECT_NAME} wslay_shared) + target_link_libraries(${PROJECT_NAME} PRIVATE wslay_shared) else() - target_link_libraries(${PROJECT_NAME} wslay) + target_link_libraries(${PROJECT_NAME} PRIVATE wslay) endif() diff --git a/recipes/wslay/all/test_package/conanfile.py b/recipes/wslay/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/wslay/all/test_package/conanfile.py +++ b/recipes/wslay/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wslay/all/test_v1_package/CMakeLists.txt b/recipes/wslay/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..b27e89de2a1f8 --- /dev/null +++ b/recipes/wslay/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(wslay REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +if(TARGET wslay_shared) + target_link_libraries(${PROJECT_NAME} PRIVATE wslay_shared) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE wslay) +endif() diff --git a/recipes/wslay/all/test_v1_package/conanfile.py b/recipes/wslay/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/wslay/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/wyhash/all/conandata.yml b/recipes/wyhash/all/conandata.yml new file mode 100644 index 0000000000000..97f88594e3ec8 --- /dev/null +++ b/recipes/wyhash/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "cci.20221102": + url: "https://github.com/wangyi-fudan/wyhash/archive/ea3b25e1aef55d90f707c3a292eeb9162e2615d8.tar.gz" + sha256: "94c6ca365a1ca39f4327c4e031690441a45a7d9feefbc14f86323d8b42c82cbe" diff --git a/recipes/wyhash/all/conanfile.py b/recipes/wyhash/all/conanfile.py new file mode 100644 index 0000000000000..34e8d0350c888 --- /dev/null +++ b/recipes/wyhash/all/conanfile.py @@ -0,0 +1,39 @@ +from conan import ConanFile +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout + +import os + +required_conan_version = ">=1.52.0" + +class WyhashConan(ConanFile): + name = "wyhash" + description = "The FASTEST QUALITY hash function, random number generators (PRNG) and hash map." + license = "Unlicense" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/wangyi-fudan/wyhash" + topics = ("bloom-filter", "hash", "random-number-generators", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/wyhash/all/test_package/CMakeLists.txt b/recipes/wyhash/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..3e7c350f8102f --- /dev/null +++ b/recipes/wyhash/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +find_package(wyhash REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE wyhash::wyhash) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/wyhash/all/test_package/conanfile.py b/recipes/wyhash/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/wyhash/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/wyhash/all/test_package/test_package.c b/recipes/wyhash/all/test_package/test_package.c new file mode 100644 index 0000000000000..121a6c973751a --- /dev/null +++ b/recipes/wyhash/all/test_package/test_package.c @@ -0,0 +1,15 @@ +#include +#include +#include +#include + +#include "wyhash.h" + +int main(void) { + uint64_t _wyp[4]; + make_secret(time(NULL), _wyp); + char s[] = "fcdskhfjs"; + uint64_t h=wyhash(s, sizeof(s) / sizeof(s[0]), 0 ,_wyp); + + return 0; +} diff --git a/recipes/wyhash/all/test_v1_package/CMakeLists.txt b/recipes/wyhash/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..961b416af6b07 --- /dev/null +++ b/recipes/wyhash/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/wyhash/all/test_v1_package/conanfile.py b/recipes/wyhash/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/wyhash/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/wyhash/config.yml b/recipes/wyhash/config.yml new file mode 100644 index 0000000000000..eec24bd72e90d --- /dev/null +++ b/recipes/wyhash/config.yml @@ -0,0 +1,3 @@ +versions: + "cci.20221102": + folder: all diff --git a/recipes/xapian-core/all/conanfile.py b/recipes/xapian-core/all/conanfile.py index 6f8b8f9882041..257fe6219505e 100644 --- a/recipes/xapian-core/all/conanfile.py +++ b/recipes/xapian-core/all/conanfile.py @@ -1,7 +1,6 @@ from conan import ConanFile from conan.tools.files import rename, apply_conandata_patches, replace_in_file, rmdir, save, rm, get from conan.tools.microsoft import is_msvc -from conan.tools.microsoft.visual import msvc_version_to_vs_ide_version from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration from conans import AutoToolsBuildEnvironment, tools @@ -54,7 +53,7 @@ def configure(self): del self.options.fPIC def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") if self.settings.os != "Windows": self.requires("libuuid/1.0.3") @@ -102,12 +101,9 @@ def _configure_autotools(self): autotools.library_paths = [] if is_msvc(self): autotools.cxx_flags.append("-EHsc") - if self.settings.compiler == "Visual Studio": - vs_ide_version = self.settings.compiler.version - else: - vs_ide_version = msvc_version_to_vs_ide_version(self.settings.compiler.version) - if Version(vs_ide_version) >= "12": - autotools.flags.append("-FS") + if (self.settings.compiler == "Visual Studio" and Version(self.settings.compiler.version) >= "12") or \ + (self.settings.compiler == "msvc" and Version(self.settings.compiler.version) >= "180"): + autotools.flags.append("-FS") conf_args = [ "--datarootdir={}".format(self._datarootdir.replace("\\", "/")), "--disable-documentation", @@ -180,7 +176,7 @@ def package_info(self): self.cpp_info.libs = ["xapian"] if not self.options.shared: if self.settings.os in ("Linux", "FreeBSD"): - self.cpp_info.system_libs = ["rt"] + self.cpp_info.system_libs = ["rt", "m"] elif self.settings.os == "Windows": self.cpp_info.system_libs = ["rpcrt4", "ws2_32"] elif self.settings.os == "SunOS": diff --git a/recipes/xbyak/all/conandata.yml b/recipes/xbyak/all/conandata.yml index 17cf1e26fddfe..2e045a1c8a082 100644 --- a/recipes/xbyak/all/conandata.yml +++ b/recipes/xbyak/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "6.62": + url: "https://github.com/herumi/xbyak/archive/v6.62.tar.gz" + sha256: "fd5f074d64cdfcacad3bbe8664727a8eab569f131cadd725a778c028fa6b0ccd" "6.61.2": url: "https://github.com/herumi/xbyak/archive/v6.61.2.tar.gz" sha256: "97b88064c9e7cd12bd235e7e600cb017481851d929ccdc95924e9d9e56a0bc3c" diff --git a/recipes/xbyak/config.yml b/recipes/xbyak/config.yml index 462c4bf804643..9006396a7028a 100644 --- a/recipes/xbyak/config.yml +++ b/recipes/xbyak/config.yml @@ -1,4 +1,6 @@ versions: + "6.62": + folder: all "6.61.2": folder: all "6.60.2": diff --git a/recipes/xerces-c/all/CMakeLists.txt b/recipes/xerces-c/all/CMakeLists.txt deleted file mode 100644 index 9d48e327cd88a..0000000000000 --- a/recipes/xerces-c/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/xerces-c/all/conandata.yml b/recipes/xerces-c/all/conandata.yml index 1fe9340e9c368..b384861145f6b 100644 --- a/recipes/xerces-c/all/conandata.yml +++ b/recipes/xerces-c/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "3.2.4": + url: "https://github.com/apache/xerces-c/archive/v3.2.4.tar.gz" + sha256: "8dfaa30d6a641bda113625ef65e43c433e8ffd94fadd3b8d39dfe6faf450f26d" "3.2.3": url: "https://github.com/apache/xerces-c/archive/v3.2.3.tar.gz" sha256: "a7cf582d618c048ef6a4684457a641940179c446e5f02c81f582f5952755a76a" @@ -6,13 +9,12 @@ sources: url: "https://github.com/apache/xerces-c/archive/v3.2.2.tar.gz" sha256: "7fe5af7d7ad9d4a06503c15fb5bb0aa5f2ba7959700d16c21b8bd183ca542e7f" patches: + "3.2.4": + - patch_file: "patches/0001-remove-test-samples-324.patch" + - patch_file: "patches/0002-find-icu-programs.patch" "3.2.3": - patch_file: "patches/0001-remove-test-samples.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-find-icu-programs.patch" - base_path: "source_subfolder" "3.2.2": - patch_file: "patches/0001-remove-test-samples.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-find-icu-programs.patch" - base_path: "source_subfolder" diff --git a/recipes/xerces-c/all/conanfile.py b/recipes/xerces-c/all/conanfile.py index 06b8a858e9d3e..30133690332a3 100644 --- a/recipes/xerces-c/all/conanfile.py +++ b/recipes/xerces-c/all/conanfile.py @@ -1,8 +1,12 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile, conan_version +from conan.errors import ConanInvalidConfiguration +from conan.tools.env import VirtualBuildEnv +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class XercesCConan(ConanFile): @@ -36,21 +40,8 @@ class XercesCConan(ConanFile): "mutex_manager": "standard", } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -67,13 +58,19 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if "icu" in (self.options.transcoder, self.options.message_loader): - self.requires("icu/70.1") + self.requires("icu/71.1") if self.options.network_accessor == "curl": - self.requires("libcurl/7.80.0") + self.requires("libcurl/7.85.0") def _validate(self, option, value, os): """ @@ -85,15 +82,11 @@ def _validate(self, option, value, os): :param os: either a single string or a tuple of strings containing the OS(es) that `value` is valid on """ - if self.settings.os not in os and getattr(self.options, option) == value: - raise ConanInvalidConfiguration( - "Option '{option}={value}' is only supported on {os}".format( - option=option, value=value, os=os - ) - ) + if self.info.settings.os not in os and getattr(self.info.options, option) == value: + raise ConanInvalidConfiguration(f"Option '{option}={value}' is only supported on {os}") def validate(self): - if self.settings.os not in ("Windows", "Macos", "Linux"): + if self.info.settings.os not in ("Windows", "Macos", "Linux"): raise ConanInvalidConfiguration("OS is not supported") self._validate("char_type", "wchar_t", ("Windows", )) self._validate("network_accessor", "winsock", ("Windows", )) @@ -107,55 +100,58 @@ def validate(self): def build_requirements(self): if hasattr(self, "settings_build") and self.options.message_loader == "icu": - self.build_requires("icu/70.1") + self.tool_requires("icu/71.1") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + tc = CMakeToolchain(self) + # Because upstream overrides BUILD_SHARED_LIBS as a CACHE variable + tc.cache_variables["BUILD_SHARED_LIBS"] = "ON" if self.options.shared else "OFF" # https://xerces.apache.org/xerces-c/build-3.html - self._cmake.definitions["network-accessor"] = self.options.network_accessor - self._cmake.definitions["transcoder"] = self.options.transcoder - self._cmake.definitions["message-loader"] = self.options.message_loader - self._cmake.definitions["xmlch-type"] = self.options.char_type - self._cmake.definitions["mutex-manager"] = self.options.mutex_manager + tc.variables["network-accessor"] = self.options.network_accessor + tc.variables["transcoder"] = self.options.transcoder + tc.variables["message-loader"] = self.options.message_loader + tc.variables["xmlch-type"] = self.options.char_type + tc.variables["mutex-manager"] = self.options.mutex_manager # avoid picking up system dependency - self._cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_CURL"] = self.options.network_accessor != "curl" - self._cmake.definitions["CMAKE_DISABLE_FIND_PACKAGE_ICU"] = "icu" not in (self.options.transcoder, self.options.message_loader) - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_CURL"] = self.options.network_accessor != "curl" + tc.variables["CMAKE_DISABLE_FIND_PACKAGE_ICU"] = "icu" not in (self.options.transcoder, self.options.message_loader) + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="NOTICE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + for license in ("LICENSE", "NOTICE"): + copy(self, license, src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - # remove unneeded directories - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "cmake")) def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") self.cpp_info.set_property("cmake_file_name", "XercesC") self.cpp_info.set_property("cmake_target_name", "XercesC::XercesC") self.cpp_info.set_property("pkg_config_name", "xerces-c") - self.cpp_info.libs = tools.collect_libs(self) + self.cpp_info.libs = collect_libs(self) if self.settings.os == "Macos": self.cpp_info.frameworks = ["CoreFoundation", "CoreServices"] elif self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") - self.cpp_info.names["cmake_find_package"] = "XercesC" - self.cpp_info.names["cmake_find_package_multi"] = "XercesC" + if Version(conan_version).major < 2: + self.cpp_info.names["cmake_find_package"] = "XercesC" + self.cpp_info.names["cmake_find_package_multi"] = "XercesC" diff --git a/recipes/xerces-c/all/patches/0001-remove-test-samples-324.patch b/recipes/xerces-c/all/patches/0001-remove-test-samples-324.patch new file mode 100644 index 0000000000000..248d7401136e7 --- /dev/null +++ b/recipes/xerces-c/all/patches/0001-remove-test-samples-324.patch @@ -0,0 +1,27 @@ +From 02f819bfda7f01d53d986db1c14ec704dd290b7b Mon Sep 17 00:00:00 2001 +From: Chris Mc +Date: Fri, 3 Sep 2021 20:30:03 -0400 +Subject: [PATCH] disable extra junk + +--- + CMakeLists.txt | 6 +++--- + 1 file changed, 3 insertions(+), 3 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 33bc40f..ebd70c1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -164,10 +164,10 @@ install( + COMPONENT "development") + + # Process subdirectories +-add_subdirectory(doc) ++#add_subdirectory(doc) + add_subdirectory(src) +-add_subdirectory(tests) +-add_subdirectory(samples) ++#add_subdirectory(tests) ++#add_subdirectory(samples) + + # Display configuration summary + message(STATUS "") diff --git a/recipes/xerces-c/all/test_package/CMakeLists.txt b/recipes/xerces-c/all/test_package/CMakeLists.txt index 71e1760854d13..3f03b5b9ef2cd 100644 --- a/recipes/xerces-c/all/test_package/CMakeLists.txt +++ b/recipes/xerces-c/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(XercesC REQUIRED CONFIG) +find_package(XercesC REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} XercesC::XercesC) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE XercesC::XercesC) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/xerces-c/all/test_package/conanfile.py b/recipes/xerces-c/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/xerces-c/all/test_package/conanfile.py +++ b/recipes/xerces-c/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xerces-c/all/test_v1_package/CMakeLists.txt b/recipes/xerces-c/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7c3c78b82bae7 --- /dev/null +++ b/recipes/xerces-c/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(XercesC REQUIRED) + +add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE XercesC::XercesC) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/xerces-c/all/test_v1_package/conanfile.py b/recipes/xerces-c/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/xerces-c/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xerces-c/config.yml b/recipes/xerces-c/config.yml index a99e0aef4db99..795ad892ef369 100644 --- a/recipes/xerces-c/config.yml +++ b/recipes/xerces-c/config.yml @@ -1,4 +1,6 @@ versions: + "3.2.4": + folder: all "3.2.3": folder: all "3.2.2": diff --git a/recipes/xkbcommon/all/conandata.yml b/recipes/xkbcommon/all/conandata.yml index eb163931d3401..1c21a5c826ba0 100644 --- a/recipes/xkbcommon/all/conandata.yml +++ b/recipes/xkbcommon/all/conandata.yml @@ -1,28 +1,22 @@ sources: + "1.5.0": + url: "https://xkbcommon.org/download/libxkbcommon-1.5.0.tar.xz" + sha256: "560f11c4bbbca10f495f3ef7d3a6aa4ca62b4f8fb0b52e7d459d18a26e46e017" "1.4.1": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.4.1.tar.gz" - sha256: "3b86670dd91441708dedc32bc7f684a034232fd4a9bb209f53276c9783e9d40e" - "1.4.0": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.4.0.tar.gz" - sha256: "51b5a732d6d6976da9d52b8f136850c193c68a31a9bdf28965a81cf8e62e919e" + url: "https://xkbcommon.org/download/libxkbcommon-1.4.1.tar.xz" + sha256: "943c07a1e2198026d8102b17270a1f406e4d3d6bbc4ae105b9e1b82d7d136b39" "1.3.1": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.3.1.tar.gz" - sha256: "8eda6782c6ed4b83296521f2f7e6bea88aba76d49c39fb4fce0f8d355a9181ce" - "1.3.0": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.3.0.tar.gz" - sha256: "e1b79838256549d72f42c824f720b4f14603374cfbe5587942e35a0cbb13ff9e" + url: "https://xkbcommon.org/download/libxkbcommon-1.3.1.tar.xz" + sha256: "b3c710d27a2630054e1e1399c85b7f330ef03359b460f0c1b3b587fd01fe9234" "1.2.1": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.2.1.tar.gz" - sha256: "50684541c11686203650f6ac8fe9b4b0343158fb7c54fbb0c86147f1ff5a5dbc" + url: "https://xkbcommon.org/download/libxkbcommon-1.2.1.tar.xz" + sha256: "e833a7d3024c9bb9d5eb2b20f6d5de08865541f21bb7ba227c83cbd236691fb3" "1.1.0": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.1.0.tar.gz" - sha256: "3f93ebcbc5823dc61aacee2aa65c8cb8a13401a9f76fb8b7695922fbfc6689ab" + url: "https://xkbcommon.org/download/libxkbcommon-1.1.0.tar.xz" + sha256: "412cfcca596f92914ea1a66ad244804d73a5ff20b6d86459951e7ad20576c246" "1.0.3": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.0.3.tar.gz" - sha256: "5d10a57ab65daad7d975926166770eca1d2c899131ab96c23845df1c42da5c31" - "1.0.1": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-1.0.1.tar.gz" - sha256: "270e2ad4ce5699f633e49042114cb68a5697fa1ed45b65c1d96a833cfac20954" + url: "https://xkbcommon.org/download/libxkbcommon-1.0.3.tar.xz" + sha256: "a2202f851e072b84e64a395212cbd976ee18a8ee602008b0bad02a13247dbc52" "0.10.0": - url: "https://github.com/xkbcommon/libxkbcommon/archive/xkbcommon-0.10.0.tar.gz" - sha256: "9b4635cf5d9fc0fb9611ceec1780aafc0944299e9a29ab09c18ec2633923b9c3" + url: "https://xkbcommon.org/download/libxkbcommon-0.10.0.tar.xz" + sha256: "57c3630cdc38fb4734cd57fa349e92244f5ae3862813e533cedbd86721a0b6f2" diff --git a/recipes/xkbcommon/all/conanfile.py b/recipes/xkbcommon/all/conanfile.py index 069c77a267a91..8d401d5d35de2 100644 --- a/recipes/xkbcommon/all/conanfile.py +++ b/recipes/xkbcommon/all/conanfile.py @@ -1,23 +1,25 @@ import os from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv from conan.tools.files import copy, get, replace_in_file, rmdir +from conan.tools.gnu import PkgConfigDeps from conan.tools.layout import basic_layout from conan.tools.meson import Meson, MesonToolchain from conan.tools.scm import Version from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class XkbcommonConan(ConanFile): name = "xkbcommon" description = "keymap handling library for toolkits and window systems" - topics = ("xkbcommon", "keyboard") + topics = ("keyboard", "wayland", "x11", "xkb") url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/xkbcommon/libxkbcommon" license = "MIT" - settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -34,7 +36,9 @@ class XkbcommonConan(ConanFile): "xkbregistry": True, } - generators = "PkgConfigDeps", "VirtualBuildEnv", "VirtualRunEnv" + @property + def _has_build_profile(self): + return hasattr(self, "settings_build") @property def _has_xkbregistry_option(self): @@ -48,64 +52,89 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("xorg/system") + self.requires("xkeyboard-config/system") + if self.options.with_x11: + self.requires("xorg/system") if self.options.get_safe("xkbregistry"): - self.requires("libxml2/2.9.14") + self.requires("libxml2/2.10.3") if self.options.get_safe("with_wayland"): self.requires("wayland/1.21.0") - self.requires("wayland-protocols/1.26") # FIXME: This should be a build-requires + if not self._has_build_profile: + self.requires("wayland-protocols/1.31") def validate(self): if self.settings.os not in ["Linux", "FreeBSD"]: - raise ConanInvalidConfiguration("This library is only compatible with Linux or FreeBSD") + raise ConanInvalidConfiguration(f"{self.ref} is only compatible with Linux and FreeBSD") def build_requirements(self): - self.tool_requires("meson/0.63.1") - self.tool_requires("bison/3.7.6") - self.tool_requires("pkgconf/1.7.4") - if self.options.get_safe("with_wayland"): + self.tool_requires("meson/1.0.0") + self.tool_requires("bison/3.8.2") + if not self.conf.get("tools.gnu:pkg_config", default=False, check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._has_build_profile and self.options.get_safe("with_wayland"): self.tool_requires("wayland/1.21.0") - - def layout(self): - basic_layout(self, src_folder="src") + self.tool_requires("wayland-protocols/1.31") def source(self): get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): - tc = MesonToolchain(self) - - tc.project_options["libexecdir"] = "bin" - tc.project_options["libdir"] = "lib" - tc.project_options["datadir"] = "res" + env = VirtualBuildEnv(self) + env.generate() + tc = MesonToolchain(self) tc.project_options["enable-docs"] = False tc.project_options["enable-wayland"] = self.options.get_safe("with_wayland", False) tc.project_options["enable-x11"] = self.options.with_x11 - if self._has_xkbregistry_option: tc.project_options["enable-xkbregistry"] = self.options.xkbregistry + if self._has_build_profile: + tc.project_options["build.pkg_config_path"] = self.generators_folder tc.generate() - def build(self): - # Conan doesn't provide a `wayland-scanner.pc` file for the package in the _build_ context - meson_build_file = os.path.join(self.source_folder, "meson.build") - replace_in_file(self, meson_build_file, - "wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)", - "# wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)") - - replace_in_file(self, meson_build_file, - "if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()", - "if not wayland_client_dep.found() or not wayland_protocols_dep.found()") + pkg_config_deps = PkgConfigDeps(self) + if self._has_build_profile and self.options.get_safe("with_wayland"): + pkg_config_deps.build_context_activated = ["wayland", "wayland-protocols"] + pkg_config_deps.build_context_suffix = {"wayland": "_BUILD", "wayland-protocols": "_BUILD"} + pkg_config_deps.generate() - replace_in_file(self, meson_build_file, - "wayland_scanner = find_program(wayland_scanner_dep.get_pkgconfig_variable('wayland_scanner'))", - "wayland_scanner = find_program('wayland-scanner')") + def build(self): + if self.options.get_safe("with_wayland"): + meson_build_file = os.path.join(self.source_folder, "meson.build") + # Patch the build system to use the pkg-config files generated for the build context. + + if Version(self.version) >= "1.5.0": + get_pkg_config_var = "get_variable(pkgconfig: " + else: + get_pkg_config_var = "get_pkgconfig_variable(" + + if self._has_build_profile: + replace_in_file(self, meson_build_file, + "wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)", + "wayland_scanner_dep = dependency('wayland-scanner_BUILD', required: false, native: true)") + replace_in_file(self, meson_build_file, + "wayland_protocols_dep = dependency('wayland-protocols', version: '>=1.12', required: false)", + "wayland_protocols_dep = dependency('wayland-protocols_BUILD', version: '>=1.12', required: false, native: true)") + else: + replace_in_file(self, meson_build_file, + "wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)", + "# wayland_scanner_dep = dependency('wayland-scanner', required: false, native: true)") + + replace_in_file(self, meson_build_file, + "if not wayland_client_dep.found() or not wayland_protocols_dep.found() or not wayland_scanner_dep.found()", + "if not wayland_client_dep.found() or not wayland_protocols_dep.found()") + + replace_in_file(self, meson_build_file, + f"wayland_scanner = find_program(wayland_scanner_dep.{get_pkg_config_var}'wayland_scanner'))", + "wayland_scanner = find_program('wayland-scanner')") meson = Meson(self) meson.configure() @@ -117,43 +146,31 @@ def package(self): meson.install() rmdir(self, os.path.join(self.package_folder, "share")) rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.components["libxkbcommon"].set_property("pkg_config_name", "xkbcommon") self.cpp_info.components["libxkbcommon"].libs = ["xkbcommon"] - self.cpp_info.components["libxkbcommon"].requires = ["xorg::xkeyboard-config"] + self.cpp_info.components["libxkbcommon"].requires = ["xkeyboard-config::xkeyboard-config"] self.cpp_info.components["libxkbcommon"].resdirs = ["res"] - # todo Remove in Conan version 1.50.0 where these are set by default for the PkgConfigDeps generator. - self.cpp_info.components["libxkbcommon"].includedirs = ["include"] - self.cpp_info.components["libxkbcommon"].libdirs = ["lib"] - if self.options.with_x11: self.cpp_info.components["libxkbcommon-x11"].set_property("pkg_config_name", "xkbcommon-x11") self.cpp_info.components["libxkbcommon-x11"].libs = ["xkbcommon-x11"] self.cpp_info.components["libxkbcommon-x11"].requires = ["libxkbcommon", "xorg::xcb", "xorg::xcb-xkb"] - - # todo Remove in Conan version 1.50.0 where these are set by default for the PkgConfigDeps generator. - self.cpp_info.components["libxkbcommon-x11"].includedirs = ["include"] - self.cpp_info.components["libxkbcommon-x11"].libdirs = ["lib"] if self.options.get_safe("xkbregistry"): self.cpp_info.components["libxkbregistry"].set_property("pkg_config_name", "xkbregistry") self.cpp_info.components["libxkbregistry"].libs = ["xkbregistry"] self.cpp_info.components["libxkbregistry"].requires = ["libxml2::libxml2"] - - # todo Remove in Conan version 1.50.0 where these are set by default for the PkgConfigDeps generator. - self.cpp_info.components["libxkbregistry"].includedirs = ["include"] - self.cpp_info.components["libxkbregistry"].libdirs = ["lib"] if self.options.get_safe("with_wayland", False): - # FIXME: This generates just executable, but I need to use the requirements to pass Conan checks self.cpp_info.components["xkbcli-interactive-wayland"].libs = [] self.cpp_info.components["xkbcli-interactive-wayland"].includedirs = [] - self.cpp_info.components["xkbcli-interactive-wayland"].requires = ["wayland::wayland", "wayland-protocols::wayland-protocols"] + self.cpp_info.components["xkbcli-interactive-wayland"].requires = ["wayland::wayland-client"] + if not self._has_build_profile: + self.cpp_info.components["xkbcli-interactive-wayland"].requires.append("wayland-protocols::wayland-protocols") if Version(self.version) >= "1.0.0": bindir = os.path.join(self.package_folder, "bin") - self.buildenv_info.prepend_path("PATH", bindir) - self.runenv_info.prepend_path("PATH", bindir) self.output.info(f"Appending PATH environment variable: {bindir}") self.env_info.PATH.append(bindir) diff --git a/recipes/xkbcommon/all/test_package/CMakeLists.txt b/recipes/xkbcommon/all/test_package/CMakeLists.txt index 0b0b6cb9fe82d..713779fc01923 100644 --- a/recipes/xkbcommon/all/test_package/CMakeLists.txt +++ b/recipes/xkbcommon/all/test_package/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.1) project(test_package LANGUAGES CXX) find_package(xkbcommon REQUIRED COMPONENTS libxkbcommon) diff --git a/recipes/xkbcommon/all/test_package/conanfile.py b/recipes/xkbcommon/all/test_package/conanfile.py index eecad0444878e..0bd86fa64260a 100644 --- a/recipes/xkbcommon/all/test_package/conanfile.py +++ b/recipes/xkbcommon/all/test_package/conanfile.py @@ -2,13 +2,13 @@ from conan import ConanFile from conan.tools.build import can_run -from conan.tools.cmake import CMake -from conan.tools.layout import cmake_layout +from conan.tools.cmake import CMake, cmake_layout class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv", "VirtualRunEnv" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" def requirements(self): self.requires(self.tested_reference_str) diff --git a/recipes/xkbcommon/all/test_v1_package/CMakeLists.txt b/recipes/xkbcommon/all/test_v1_package/CMakeLists.txt index 578486105d7d3..925ecbe19e448 100644 --- a/recipes/xkbcommon/all/test_v1_package/CMakeLists.txt +++ b/recipes/xkbcommon/all/test_v1_package/CMakeLists.txt @@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.1) project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +conan_basic_setup(TARGETS) -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/xkbcommon/all/test_v1_package/conanfile.py b/recipes/xkbcommon/all/test_v1_package/conanfile.py index e49d2fb75e704..e9bf8aa5f82dd 100644 --- a/recipes/xkbcommon/all/test_v1_package/conanfile.py +++ b/recipes/xkbcommon/all/test_v1_package/conanfile.py @@ -6,7 +6,7 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "cmake", "cmake_find_package_multi" def build(self): cmake = CMake(self) diff --git a/recipes/xkbcommon/config.yml b/recipes/xkbcommon/config.yml index b1ae06a7c3ea8..aa62b1dc6f781 100644 --- a/recipes/xkbcommon/config.yml +++ b/recipes/xkbcommon/config.yml @@ -1,19 +1,15 @@ versions: - "1.4.1": + "1.5.0": folder: all - "1.4.0": + "1.4.1": folder: all "1.3.1": folder: all - "1.3.0": - folder: all "1.2.1": folder: all "1.1.0": folder: all "1.0.3": folder: all - "1.0.1": - folder: all "0.10.0": folder: all diff --git a/recipes/xkeyboard-config/all/conanfile.py b/recipes/xkeyboard-config/all/conanfile.py new file mode 100644 index 0000000000000..ec1b8c4a6f2ed --- /dev/null +++ b/recipes/xkeyboard-config/all/conanfile.py @@ -0,0 +1,50 @@ +from conan import ConanFile +from conan.tools.gnu import PkgConfig +from conan.tools.system import package_manager +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.50.0" + + +class XkeyboardConfigConan(ConanFile): + name = "xkeyboard-config" + url = "https://github.com/conan-io/conan-center-index" + license = "MIT" + homepage = "https://www.freedesktop.org/wiki/Software/XKeyboardConfig/" + description = "The non-arch keyboard configuration database for X Window." + settings = "os", "compiler", "build_type" # no arch here, because the xkeyboard-config system package is arch independant + topics = ("x11", "xorg", "keyboard") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") + + def package_id(self): + self.info.clear() + + def system_requirements(self): + apt = package_manager.Apt(self) + apt.install(["xkb-data"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["xkeyboard-config-devel"], update=True, check=True) + + dnf = package_manager.Dnf(self) + dnf.install(["xkeyboard-config-devel"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["xkeyboard-config"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["xkeyboard-config"], update=True, check=True) + + package_manager.Pkg(self).install(["xkeyboard-config"], update=True, check=True) + + def package_info(self): + pkg_config = PkgConfig(self, "xkeyboard-config") + pkg_config.fill_cpp_info( + self.cpp_info, is_system=self.settings.os != "FreeBSD") + self.cpp_info.set_property("pkg_config_name", "xkeyboard-config") + self.cpp_info.set_property("component_version", pkg_config.version) + self.cpp_info.set_property("pkg_config_custom_content", + "\n".join(f"{key}={value}" for key, value in pkg_config.variables.items() if key not in ["pcfiledir","prefix", "includedir"])) diff --git a/recipes/xkeyboard-config/all/test_package/conanfile.py b/recipes/xkeyboard-config/all/test_package/conanfile.py new file mode 100644 index 0000000000000..5ce13b9d34b6d --- /dev/null +++ b/recipes/xkeyboard-config/all/test_package/conanfile.py @@ -0,0 +1,23 @@ +from conan import ConanFile +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "VirtualBuildEnv", "VirtualRunEnv" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + basic_layout(self) + + def generate(self): + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() + + def test(self): + pkg_config = self.conf_info.get("tools.gnu:pkg_config", default="pkg-config") + self.run(f"{pkg_config} --validate xkeyboard-config") diff --git a/recipes/xkeyboard-config/all/test_v1_package/conanfile.py b/recipes/xkeyboard-config/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..510f8a1855391 --- /dev/null +++ b/recipes/xkeyboard-config/all/test_v1_package/conanfile.py @@ -0,0 +1,13 @@ +from conans import ConanFile, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "pkg_config" + + def build(self): + pass + + def test(self): + self.run("pkg-config --validate ./xkeyboard-config.pc") diff --git a/recipes/xkeyboard-config/config.yml b/recipes/xkeyboard-config/config.yml new file mode 100644 index 0000000000000..76a338dd54cee --- /dev/null +++ b/recipes/xkeyboard-config/config.yml @@ -0,0 +1,3 @@ +versions: + "system": + folder: "all" diff --git a/recipes/xlnt/all/conandata.yml b/recipes/xlnt/all/conandata.yml new file mode 100644 index 0000000000000..e00cfba4123d9 --- /dev/null +++ b/recipes/xlnt/all/conandata.yml @@ -0,0 +1,12 @@ +sources: + "1.5.0": + url: "https://github.com/tfussell/xlnt/archive/refs/tags/v1.5.0.tar.gz" + sha256: "8dec266d59ab6e4829da5dacea764a02887eeff5a5501c9a51ce796e735b90de" +patches: + "1.5.0": + - patch_file: "patches/0001-fix-cmake-and-unvendor-deps.patch" + patch_description: "Fix CMakeLists and unvendor dependencies" + patch_type: "conan" + - patch_file: "patches/0002-include-limits.patch" + patch_description: "Add missing includes" + patch_type: "portability" diff --git a/recipes/xlnt/all/conanfile.py b/recipes/xlnt/all/conanfile.py new file mode 100644 index 0000000000000..b40b12448a161 --- /dev/null +++ b/recipes/xlnt/all/conanfile.py @@ -0,0 +1,105 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.scm import Version +import os + +required_conan_version = ">=1.53.0" + + +class XlntConan(ConanFile): + name = "xlnt" + description = "Cross-platform user-friendly xlsx library for C++11+" + license = "MIT" + topics = ("excel", "xlsx", "spreadsheet", "reader", "writer") + homepage = "https://github.com/tfussell/xlnt" + url = "https://github.com/conan-io/conan-center-index" + + package_type = "library" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } + + def export_sources(self): + export_conandata_patches(self) + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def configure(self): + if self.options.shared: + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires("libstudxml/1.1.0-b.10+1") + self.requires("miniz/3.0.2") + self.requires("utfcpp/3.2.3") + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) + libstudxml_version = Version(self.dependencies["libstudxml"].ref.version) + libstudxml_major_minor = f"{libstudxml_version.major}.{libstudxml_version.minor}" + if Version(libstudxml_major_minor) < "1.1": + raise ConanInvalidConfiguration(f"{self.ref} not compatible with libstudxml < 1.1") + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["STATIC"] = not self.options.shared + tc.variables["TESTS"] = False + tc.variables["SAMPLES"] = False + tc.variables["BENCHMARKS"] = False + tc.variables["PYTHON"] = False + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + # Remove unvendored third party libs + for third_party in ("libstudxml", "miniz", "utfcpp"): + rmdir(self, os.path.join(self.source_folder, "third-party", third_party)) + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE.md", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "Xlnt") + self.cpp_info.set_property("cmake_target_name", "xlnt::xlnt") + self.cpp_info.set_property("pkg_config_name", "xlnt") + suffix = "d" if self.settings.build_type == "Debug" else "" + self.cpp_info.libs = [f"xlnt{suffix}"] + if not self.options.shared: + self.cpp_info.defines.append("XLNT_STATIC") + + # TODO: to remove in conan v2 + self.cpp_info.filenames["cmake_find_package"] = "Xlnt" + self.cpp_info.filenames["cmake_find_package_multi"] = "Xlnt" + self.cpp_info.names["cmake_find_package"] = "xlnt" + self.cpp_info.names["cmake_find_package_multi"] = "xlnt" diff --git a/recipes/xlnt/all/patches/0001-fix-cmake-and-unvendor-deps.patch b/recipes/xlnt/all/patches/0001-fix-cmake-and-unvendor-deps.patch new file mode 100644 index 0000000000000..f894c2e80026b --- /dev/null +++ b/recipes/xlnt/all/patches/0001-fix-cmake-and-unvendor-deps.patch @@ -0,0 +1,113 @@ +--- a/source/CMakeLists.txt ++++ b/source/CMakeLists.txt +@@ -1,9 +1,6 @@ + cmake_minimum_required(VERSION 3.1) + project(xlnt VERSION 1.5.0) + +-set(CMAKE_CXX_STANDARD ${XLNT_CXX_LANG}) +-set(CMAKE_CXX_STANDARD_REQUIRED ON) +-set(CXX_EXTENSIONS OFF) + + # Project metadata + set(PROJECT_VENDOR "Thomas Fussell") +@@ -18,8 +15,6 @@ set(XLNT_SOURCE_DIR ${XLNT_ROOT_DIR}/source) + set(THIRD_PARTY_DIR ${XLNT_ROOT_DIR}/third-party) + + # Include libstudxml library +-add_subdirectory(${THIRD_PARTY_DIR}/libstudxml +- ${CMAKE_CURRENT_BINARY_DIR}/third-party/libstudxml) + + if(COVERAGE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") +@@ -30,12 +25,9 @@ if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W4") # level 4 warnings + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP") # multi-processor compilation + elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall") # all warnings +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra") # extra warnings + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unknown-pragmas") # ignore MSVC and Clang pragmas + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-maybe-uninitialized") # GCC diagnostic with lots of false positives + elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang") +- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything") # all warnings + # blacklist warnings that are not relevant + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++98-compat") # ignore warnings about C++98 compatibility + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-c++98-compat-pedantic") # ignore pedantic warnings about C++98 compatibility +@@ -54,7 +46,7 @@ if(STATIC_CRT) + ucm_set_runtime(STATIC) + endif() + +-if(APPLE) ++if(0) + # Prevent a warning about deployment target not being set by setting it to current OSX version + execute_process(COMMAND "sw_vers -productVersion | awk -F'.' '{print $1\".\"$2}'" + OUTPUT_VARIABLE OSX_VERSION) +@@ -84,8 +76,6 @@ file(GLOB WORKBOOK_HEADERS ${XLNT_INCLUDE_DIR}/xlnt/workbook/*.hpp) + file(GLOB WORKBOOK_SOURCES ${XLNT_SOURCE_DIR}/workbook/*.cpp) + file(GLOB WORKSHEET_HEADERS ${XLNT_INCLUDE_DIR}/xlnt/worksheet/*.hpp) + file(GLOB WORKSHEET_SOURCES ${XLNT_SOURCE_DIR}/worksheet/*.cpp) +-file(GLOB MINIZ_HEADERS ${THIRD_PARTY_DIR}/miniz/*.h) +-file(GLOB MINIZ_SOURCES ${THIRD_PARTY_DIR}/miniz/*.c) + + file(GLOB DETAIL_ROOT_HEADERS ${XLNT_SOURCE_DIR}/detail/*.hpp) + file(GLOB DETAIL_ROOT_SOURCES ${XLNT_SOURCE_DIR}/detail/*.cpp) +@@ -115,12 +105,12 @@ set(XLNT_HEADERS ${ROOT_HEADERS} ${CELL_HEADERS} ${CHARTS_HEADERS} + ${CHARTSHEET_HEADERS} ${DRAWING_HEADERS} ${FORMULA_HEADERS} + ${PACKAGING_HEADERS} ${STYLES_HEADERS} ${UTILS_HEADERS} + ${WORKBOOK_HEADERS} ${WORKSHEET_HEADERS} ${DETAIL_HEADERS} ${DETAIL_CRYPTO_HEADERS} +- ${DRAWING_HEADERS} ${MINIZ_HEADERS}) ++ ${DRAWING_HEADERS}) + set(XLNT_SOURCES ${CELL_SOURCES} ${CHARTS_SOURCES} ${CHARTSHEET_SOURCES} + ${DRAWING_SOURCES} ${FORMULA_SOURCES} ${PACKAGING_SOURCES} + ${STYLES_SOURCES} ${UTILS_SOURCES} ${WORKBOOK_SOURCES} + ${WORKSHEET_SOURCES} ${DETAIL_SOURCES} ${DETAIL_CRYPTO_SOURCES} +- ${DRAWING_SOURCES} ${MINIZ_SOURCES}) ++ ${DRAWING_SOURCES}) + + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + # Set a default CMAKE_INSTALL_PREFIX if one wasn't specified +@@ -159,7 +149,7 @@ if(NOT STATIC) + add_library(xlnt SHARED + ${XLNT_HEADERS} + ${XLNT_SOURCES} +- $) ++ ) + + target_compile_definitions(xlnt PRIVATE XLNT_SHARED=1) + +@@ -168,10 +158,10 @@ if(NOT STATIC) + PROPERTIES + VERSION ${PROJECT_VERSION} + SOVERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH} +- INSTALL_NAME_DIR "${XLNT_LIB_DEST_DIR}") ++ ) + else() + # Compile static library +- add_library(xlnt STATIC ${XLNT_HEADERS} ${XLNT_SOURCES} $) ++ add_library(xlnt STATIC ${XLNT_HEADERS} ${XLNT_SOURCES}) + target_compile_definitions(xlnt PUBLIC XLNT_STATIC=1) + endif() + +@@ -185,9 +175,12 @@ target_include_directories(xlnt + $ + PRIVATE + ${XLNT_SOURCE_DIR} +- ${XLNT_SOURCE_DIR}/../third-party/libstudxml +- ${XLNT_SOURCE_DIR}/../third-party/miniz +- ${XLNT_SOURCE_DIR}/../third-party/utfcpp) ++) ++find_package(libstudxml REQUIRED CONFIG) ++find_package(miniz REQUIRED CONFIG) ++find_package(utf8cpp REQUIRED CONFIG) ++target_link_libraries(xlnt PRIVATE miniz::miniz utf8cpp libstudxml::libstudxml) ++target_compile_features(xlnt PUBLIC cxx_std_11) + + # Platform- and file-specific settings, MSVC + if(MSVC) +@@ -240,7 +233,6 @@ source_group(styles FILES ${STYLES_HEADERS} ${STYLES_SOURCES}) + source_group(utils FILES ${UTILS_HEADERS} ${UTILS_SOURCES}) + source_group(workbook FILES ${WORKBOOK_HEADERS} ${WORKBOOK_SOURCES}) + source_group(worksheet FILES ${WORKSHEET_HEADERS} ${WORKSHEET_SOURCES}) +-source_group(third-party\\miniz FILES ${MINIZ_HEADERS} ${MINIZ_SOURCES}) + + # Install library + install(TARGETS xlnt EXPORT XlntTargets diff --git a/recipes/xlnt/all/patches/0002-include-limits.patch b/recipes/xlnt/all/patches/0002-include-limits.patch new file mode 100644 index 0000000000000..10da95ecdd562 --- /dev/null +++ b/recipes/xlnt/all/patches/0002-include-limits.patch @@ -0,0 +1,20 @@ +--- a/source/cell/cell.cpp ++++ b/source/cell/cell.cpp +@@ -24,6 +24,7 @@ + + #include + #include ++#include + #include + + #include +--- a/source/detail/number_format/number_formatter.cpp ++++ b/source/detail/number_format/number_formatter.cpp +@@ -24,6 +24,7 @@ + #include + #include + #include ++#include + + #include + #include diff --git a/recipes/xlnt/all/test_package/CMakeLists.txt b/recipes/xlnt/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..5996d0ee3e85b --- /dev/null +++ b/recipes/xlnt/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +find_package(Xlnt REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE xlnt::xlnt) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/xlnt/all/test_package/conanfile.py b/recipes/xlnt/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0a6bc68712d90 --- /dev/null +++ b/recipes/xlnt/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xlnt/all/test_package/test_package.cpp b/recipes/xlnt/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..2ca71e20dee41 --- /dev/null +++ b/recipes/xlnt/all/test_package/test_package.cpp @@ -0,0 +1,14 @@ +#include + +int main() +{ + xlnt::workbook wb; + xlnt::worksheet ws = wb.active_sheet(); + ws.cell("A1").value(5); + ws.cell("B2").value("string data"); + ws.cell("C3").formula("=RAND()"); + ws.merge_cells("C3:C4"); + ws.freeze_panes("B2"); + wb.save("example.xlsx"); + return 0; +} diff --git a/recipes/xlnt/all/test_v1_package/CMakeLists.txt b/recipes/xlnt/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/xlnt/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xlnt/all/test_v1_package/conanfile.py b/recipes/xlnt/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/xlnt/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xlnt/config.yml b/recipes/xlnt/config.yml new file mode 100644 index 0000000000000..7f3d5d7f62dd8 --- /dev/null +++ b/recipes/xlnt/config.yml @@ -0,0 +1,3 @@ +versions: + "1.5.0": + folder: all diff --git a/recipes/xmlsec/all/conandata.yml b/recipes/xmlsec/all/conandata.yml index 9b158696a96c9..0f782600a7b31 100644 --- a/recipes/xmlsec/all/conandata.yml +++ b/recipes/xmlsec/all/conandata.yml @@ -1,10 +1,10 @@ sources: "1.2.32": - url: "https://github.com/lsh123/xmlsec/archive/xmlsec-1_2_32.tar.gz" - sha256: "e33e551fb9f6da5576b1a55ce962048adf337332c27e6be9dba04d360b6a5584" + url: "http://www.aleksey.com/xmlsec/download/xmlsec1-1.2.32.tar.gz" + sha256: "e383702853236004e5b08e424b8afe9b53fe9f31aaa7a5382f39d9533eb7c043" "1.2.31": - url: "https://github.com/lsh123/xmlsec/archive/xmlsec-1_2_31.tar.gz" - sha256: "3d975c7c945b6f8f84e956934b562f794fa6b469d78d913190d3a1c32d1a3ddb" + url: "http://www.aleksey.com/xmlsec/download/xmlsec1-1.2.31.tar.gz" + sha256: "9b10bc52cc31e4f76162e3975e50db26b71ab49c571d810b311ca626be5a0b26" "1.2.30": - url: "https://github.com/lsh123/xmlsec/archive/xmlsec-1_2_30.tar.gz" - sha256: "57f6a5f3b9f2d17859a5583dc0b23f47130cc1c909ed6caf596ab0cd388237ec" + url: "http://www.aleksey.com/xmlsec/download/xmlsec1-1.2.30.tar.gz" + sha256: "2d84360b03042178def1d9ff538acacaed2b3a27411db7b2874f1612ed71abc8" diff --git a/recipes/xmlsec/all/conanfile.py b/recipes/xmlsec/all/conanfile.py index 6dc96aa50a99e..507ae2456e030 100644 --- a/recipes/xmlsec/all/conanfile.py +++ b/recipes/xmlsec/all/conanfile.py @@ -1,21 +1,27 @@ -from conan.tools.microsoft import msvc_runtime_flag -from conans import ConanFile, tools, AutoToolsBuildEnvironment, VisualStudioBuildEnvironment -from conans.errors import ConanInvalidConfiguration -from contextlib import contextmanager -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import cross_building +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import chdir, copy, get, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, msvc_runtime_flag, NMakeDeps, NMakeToolchain +from conan.tools.scm import Version import os -required_conan_version = ">=1.36.0" +required_conan_version = ">=1.58.0" class XmlSecConan(ConanFile): name = "xmlsec" description = "XML Security Library is a C library based on LibXML2. The library supports major XML security standards." license = ("MIT", "MPL-1.1") - homepage = "https://github.com/lsh123/xmlsec" + homepage = "https://www.aleksey.com/xmlsec" url = "https://github.com/conan-io/conan-center-index" topics = ("xml", "signature", "encryption") + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -36,16 +42,6 @@ class XmlSecConan(ConanFile): "with_xslt": False, } - generators = "pkg_config" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -56,14 +52,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("libxml2/2.9.12") + self.requires("libxml2/2.10.3") if self.options.with_openssl: - self.requires("openssl/1.1.1m") + self.requires("openssl/1.1.1s") if self.options.with_xslt: self.requires("libxslt/1.1.34") @@ -78,147 +77,143 @@ def validate(self): raise ConanInvalidConfiguration("At least one crypto engine needs to be enabled") def build_requirements(self): - if not self._is_msvc: - self.build_requires("libtool/2.4.6") - self.build_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if not is_msvc(self): + self.tool_requires("libtool/2.4.7") + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextmanager - def _msvc_build_environment(self): - with tools.chdir(os.path.join(self._source_subfolder, "win32")): - with tools.vcvars(self): - with tools.environment_append(VisualStudioBuildEnvironment(self).vars): - yield - - def _build_msvc(self): - yes_no = lambda v: "yes" if v else "no" - with self._msvc_build_environment(): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + if is_msvc(self): + tc = NMakeToolchain(self) + tc.generate() + deps = NMakeDeps(self) + deps.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + if not self.options.shared: + tc.extra_defines.append("XMLSEC_STATIC") + yes_no = lambda v: "yes" if v else "no" + tc.configure_args.extend([ + "--enable-crypto-dl=no", + "--enable-apps-crypto-dl=no", + f"--with-libxslt={yes_no(self.options.with_xslt)}", + f"--with-openssl={yes_no(self.options.with_openssl)}", + f"--with-nss={yes_no(self.options.with_nss)}", + f"--with-nspr={yes_no(self.options.with_nss)}", + f"--with-gcrypt={yes_no(self.options.with_gcrypt)}", + f"--with-gnutls={yes_no(self.options.with_gnutls)}", + "--enable-mscrypto=no", # Built on mingw + "--enable-mscng=no", # Build on mingw + "--enable-docs=no", + "--enable-mans=no", + ]) + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() + deps = PkgConfigDeps(self) + deps.generate() + + def build(self): + if is_msvc(self): + # Configure step to generate Makefile.msvc + deps_includedirs = [] + deps_libdirs = [] + for deps in self.dependencies.values(): + deps_cpp_info = deps.cpp_info.aggregated_components() + deps_includedirs.extend(deps_cpp_info.includedirs) + deps_libdirs.extend(deps_cpp_info.libdirs) + crypto_engines = [] if self.options.with_openssl: - ov = tools.Version(self.deps_cpp_info["openssl"].version) - crypto_engines.append("openssl={}{}0".format(ov.major, ov.minor)) + ov = Version(self.dependencies["openssl"].ref.version) + crypto_engines.append(f"openssl={ov.major}{ov.minor}0") + + yes_no = lambda v: "yes" if v else "no" args = [ - "cscript", - "configure.js", - "prefix={}".format(self.package_folder), - "cruntime=/{}".format(msvc_runtime_flag(self)), - "debug={}".format(yes_no(self.settings.build_type == "Debug")), - "static={}".format(yes_no(not self.options.shared)), - "include=\"{}\"".format(";".join(self.deps_cpp_info.include_paths)), - "lib=\"{}\"".format(";".join(self.deps_cpp_info.lib_paths)), + f"prefix={self.package_folder}", + f"cruntime=/{msvc_runtime_flag(self)}", + f"debug={yes_no(self.settings.build_type == 'Debug')}", + f"static={yes_no(not self.options.shared)}", + "include=\"{}\"".format(";".join(deps_includedirs)), + "lib=\"{}\"".format(";".join(deps_libdirs)), "with-dl=no", - "xslt={}".format(yes_no(self.options.with_xslt)), - "iconv={}".format(yes_no(False)), + f"xslt={yes_no(self.options.with_xslt)}", + "iconv=no", "crypto={}".format(",".join(crypto_engines)), ] - configure_command = " ".join(args) - self.output.info(configure_command) - self.run(configure_command) + with chdir(self, os.path.join(self.source_folder, "win32")): + self.run(f"cscript configure.js {' '.join(args)}") - # Fix library names + # Fix library names in generated Makefile.msvc def format_libs(package): - libs = [] - for lib in self.deps_cpp_info[package].libs: - libname = lib - if not libname.endswith(".lib"): - libname += ".lib" - libs.append(libname) - for lib in self.deps_cpp_info[package].system_libs: - libname = lib - if not libname.endswith(".lib"): - libname += ".lib" - libs.append(libname) + cpp_info = self.dependencies[package].cpp_info.aggregated_components() + libs = [lib if lib.endswith(".lib") else f"{lib}.lib" for lib in cpp_info.libs + cpp_info.system_libs] return " ".join(libs) - tools.replace_in_file("Makefile.msvc", "libxml2.lib", format_libs("libxml2")) - tools.replace_in_file("Makefile.msvc", "libxml2_a.lib", format_libs("libxml2")) + makefile_msvc = os.path.join(self.source_folder, "win32", "Makefile.msvc") + replace_in_file(self, makefile_msvc, "libxml2.lib", format_libs("libxml2")) + replace_in_file(self, makefile_msvc, "libxml2_a.lib", format_libs("libxml2")) if self.options.with_xslt: - tools.replace_in_file("Makefile.msvc", "libxslt.lib", format_libs("libxslt")) - tools.replace_in_file("Makefile.msvc", "libxslt_a.lib", format_libs("libxslt")) - - if self.settings.build_type == "Debug": - tools.replace_in_file("Makefile.msvc", "libcrypto.lib", "libcryptod.lib") - - self.run("nmake /f Makefile.msvc") - - def _package_msvc(self): - with self._msvc_build_environment(): - self.run("nmake /f Makefile.msvc install") - - @functools.lru_cache(1) - def _configure_autotools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - if not self.options.shared: - autotools.defines.append("XMLSEC_STATIC") - yes_no = lambda v: "yes" if v else "no" - configure_args = [ - "--enable-crypto-dl={}".format(yes_no(False)), - "--enable-apps-crypto-dl={}".format(yes_no(False)), - "--with-libxslt={}".format(yes_no(self.options.with_xslt)), - "--with-openssl={}".format(yes_no(self.options.with_openssl)), - "--with-nss={}".format(yes_no(self.options.with_nss)), - "--with-nspr={}".format(yes_no(self.options.with_nss)), - "--with-gcrypt={}".format(yes_no(self.options.with_gcrypt)), - "--with-gnutls={}".format(yes_no(self.options.with_gnutls)), - "--enable-mscrypto={}".format(yes_no(False)), # Built on mingw - "--enable-mscng={}".format(yes_no(False)), # Build on mingw - "--enable-docs=no", - "--enable-mans=no", - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - autotools.libs = [] - autotools.configure(args=configure_args, configure_dir=self._source_subfolder) - return autotools + replace_in_file(self, makefile_msvc, "libxslt.lib", format_libs("libxslt")) + replace_in_file(self, makefile_msvc, "libxslt_a.lib", format_libs("libxslt")) + if self.options.with_openssl: + replace_in_file(self, makefile_msvc, "libcrypto.lib", format_libs("openssl")) - def build(self): - if self._is_msvc: - self._build_msvc() + # Build with NMake + with chdir(self, os.path.join(self.source_folder, "win32")): + self.run("nmake -f Makefile.msvc") else: - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True, win_bash=tools.os_info.is_windows) - # relocatable shared lib on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy("Copyright", src=self._source_subfolder, dst="licenses") - - if self._is_msvc: - self._package_msvc() + copy(self, "Copyright", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + with chdir(self, os.path.join(self.source_folder, "win32")): + self.run("nmake -f Makefile.msvc install") if not self.options.shared: - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.dll") - tools.remove_files_by_mask(os.path.join(self.package_folder, "bin"), "*.pdb") + rm(self, "*.dll", os.path.join(self.package_folder, "bin")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) os.unlink(os.path.join(self.package_folder, "lib", "libxmlsec-openssl_a.lib" if self.options.shared else "libxmlsec-openssl.lib")) os.unlink(os.path.join(self.package_folder, "lib", "libxmlsec_a.lib" if self.options.shared else "libxmlsec.lib")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) os.remove(os.path.join(self.package_folder, "lib", "xmlsec1Conf.sh")) + fix_apple_shared_install_name(self) def package_info(self): - prefix = "lib" if self._is_msvc else "" - infix = "" if self._is_msvc else str(tools.Version(self.version).major) - suffix = "_a" if self._is_msvc and not self.options.shared else "" - - get_libname = lambda libname: prefix + "xmlsec" + infix + (("-" + libname) if libname else "") + suffix - - self.cpp_info.components["libxmlsec"].libs = [get_libname(None)] - self.cpp_info.components["libxmlsec"].includedirs.append(os.path.join("include", "xmlsec{}".format(tools.Version(self.version).major))) + major = str(Version(self.version).major) + prefix = "lib" if is_msvc(self) else "" + infix = "" if is_msvc(self) else major + base_libname = f"{prefix}xmlsec{infix}" + suffix = "_a" if is_msvc(self) and not self.options.shared else "" + + self.cpp_info.components["libxmlsec"].set_property("pkg_config_name", f"xmlsec{major}") + self.cpp_info.components["libxmlsec"].libs = [f"{base_libname}{suffix}"] + if not is_msvc(self): + self.cpp_info.components["libxmlsec"].includedirs.append(os.path.join("include", f"xmlsec{major}")) self.cpp_info.components["libxmlsec"].requires = ["libxml2::libxml2"] - self.cpp_info.components["libxmlsec"].set_property( - "pkg_config_name", "xmlsec{}".format(tools.Version(self.version).major) - ) if not self.options.shared: self.cpp_info.components["libxmlsec"].defines.append("XMLSEC_STATIC") if self.options.with_xslt: @@ -232,9 +227,7 @@ def package_info(self): self.cpp_info.components["libxmlsec"].system_libs = ["crypt32", "ws2_32", "advapi32", "user32", "bcrypt"] if self.options.with_openssl: - self.cpp_info.components["openssl"].libs = [get_libname("openssl")] + self.cpp_info.components["openssl"].set_property("pkg_config_name", f"xmlsec{major}-openssl") + self.cpp_info.components["openssl"].libs = [f"{base_libname}-openssl{suffix}"] self.cpp_info.components["openssl"].requires = ["libxmlsec", "openssl::openssl"] self.cpp_info.components["openssl"].defines = ["XMLSEC_CRYPTO_OPENSSL=1"] - self.cpp_info.components["openssl"].set_property( - "pkg_config_name", "xmlsec{}-openssl".format(tools.Version(self.version).major) - ) diff --git a/recipes/xmlsec/all/test_package/CMakeLists.txt b/recipes/xmlsec/all/test_package/CMakeLists.txt index e0e8c141daaef..b99fa5a5fed63 100644 --- a/recipes/xmlsec/all/test_package/CMakeLists.txt +++ b/recipes/xmlsec/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(xmlsec REQUIRED CONFIG) add_executable(${PROJECT_NAME} sign1.c) -target_link_libraries(${PROJECT_NAME} xmlsec::xmlsec) +target_link_libraries(${PROJECT_NAME} PRIVATE xmlsec::xmlsec) diff --git a/recipes/xmlsec/all/test_package/conanfile.py b/recipes/xmlsec/all/test_package/conanfile.py index 56bd9bb27c235..80f642849361b 100644 --- a/recipes/xmlsec/all/test_package/conanfile.py +++ b/recipes/xmlsec/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,9 +21,8 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - arg_path1 = os.path.abspath(os.path.join(os.path.dirname(__file__), "sign1-tmpl.xml")) - arg_path2 = os.path.abspath(os.path.join(os.path.dirname(__file__), "rsakey.pem")) - bin_arg_path = "%s %s %s" % (bin_path, arg_path1, arg_path2) - self.run(bin_arg_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + xml_file = os.path.join(self.source_folder, "sign1-tmpl.xml") + pem_file = os.path.join(self.source_folder, "rsakey.pem") + self.run(f"{bin_path} {xml_file} {pem_file}", env="conanrun") diff --git a/recipes/xmlsec/all/test_v1_package/CMakeLists.txt b/recipes/xmlsec/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/xmlsec/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xmlsec/all/test_v1_package/conanfile.py b/recipes/xmlsec/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..dd7e5cd83ea16 --- /dev/null +++ b/recipes/xmlsec/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + xml_file = os.path.join(self.source_folder, os.pardir, "test_package", "sign1-tmpl.xml") + pem_file = os.path.join(self.source_folder, os.pardir, "test_package", "rsakey.pem") + self.run(f"{bin_path} {xml_file} {pem_file}", run_environment=True) diff --git a/recipes/xnnpack/all/CMakeLists.txt b/recipes/xnnpack/all/CMakeLists.txt index 297289017d303..cde962d5658e3 100644 --- a/recipes/xnnpack/all/CMakeLists.txt +++ b/recipes/xnnpack/all/CMakeLists.txt @@ -1,25 +1,35 @@ -cmake_minimum_required(VERSION 3.4) +cmake_minimum_required(VERSION 3.15) project(cmake_wrapper) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_library(cpuinfo INTERFACE IMPORTED) -add_library(clog INTERFACE IMPORTED) -set_property(TARGET cpuinfo PROPERTY INTERFACE_LINK_LIBRARIES CONAN_PKG::cpuinfo) -set_property(TARGET clog PROPERTY INTERFACE_LINK_LIBRARIES CONAN_PKG::cpuinfo) +if(NOT CMAKE_SYSTEM_PROCESSOR AND CONAN_XNNPACK_SYSTEM_PROCESSOR) + set(CMAKE_SYSTEM_PROCESSOR ${CONAN_XNNPACK_SYSTEM_PROCESSOR}) +endif() -add_library(pthreadpool INTERFACE IMPORTED) -set_property(TARGET pthreadpool PROPERTY INTERFACE_LINK_LIBRARIES CONAN_PKG::pthreadpool) +find_package(cpuinfo REQUIRED CONFIG) +if(NOT TARGET cpuinfo) + add_library(cpuinfo INTERFACE IMPORTED) + set_property(TARGET cpuinfo PROPERTY INTERFACE_LINK_LIBRARIES cpuinfo::cpuinfo) +endif() +if(NOT TARGET clog) + add_library(clog INTERFACE IMPORTED) + set_property(TARGET clog PROPERTY INTERFACE_LINK_LIBRARIES cpuinfo::cpuinfo) +endif() -add_library(fxdiv INTERFACE IMPORTED) -set_property(TARGET fxdiv PROPERTY INTERFACE_LINK_LIBRARIES CONAN_PKG::fxdiv) +find_package(pthreadpool REQUIRED CONFIG) +if(NOT TARGET pthreadpool) + add_library(pthreadpool INTERFACE IMPORTED) + set_property(TARGET pthreadpool PROPERTY INTERFACE_LINK_LIBRARIES pthreadpool::pthreadpool) +endif() -add_library(fp16 INTERFACE IMPORTED) -set_property(TARGET fp16 PROPERTY INTERFACE_LINK_LIBRARIES CONAN_PKG::fp16) +find_package(fp16 REQUIRED CONFIG) +if(NOT TARGET fp16) + add_library(fp16 INTERFACE IMPORTED) + set_property(TARGET fp16 PROPERTY INTERFACE_LINK_LIBRARIES fp16::fp16) +endif() -if(MSVC AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) +# not a direct requirement, but we have to define this target to avoid xnnpack to download it +if(NOT TARGET fxdiv) + add_library(fxdiv INTERFACE IMPORTED) endif() -add_subdirectory(source_subfolder) +add_subdirectory(src) diff --git a/recipes/xnnpack/all/conandata.yml b/recipes/xnnpack/all/conandata.yml index 1e939090cd27a..5168859b5421f 100644 --- a/recipes/xnnpack/all/conandata.yml +++ b/recipes/xnnpack/all/conandata.yml @@ -1,13 +1,16 @@ sources: - "cci.20210310": - url: "https://github.com/google/XNNPACK/archive/24c2dec2c451b7594eb6ef70c538923899bd541c.tar.gz" - sha256: "f049f55d57d6e608dd1125c3d40323763dc842949b31437be7158b7e91687ed8" - "cci.20211026": - url: "https://github.com/google/XNNPACK/archive/ccbaedf11c70a3ff4db0ef17cfeacd710ffc3492.tar.gz" - sha256: "9324aea663d21cea4538095c40928572ddb685e0601853f278b7e5ead697fe81" - "cci.20211210": - url: "https://github.com/google/XNNPACK/archive/113092317754c7dea47bfb3cb49c4f59c3c1fa10.tar.gz" - sha256: "065bb9c85438c453f9300251f263118c4d123d79b21acf8f66582a3124d95fb2" + "cci.20220801": + url: "https://github.com/google/XNNPACK/archive/8e3d3359f9bec608e09fac1f7054a2a14b1bd73c.tar.gz" + sha256: "c82327543249bd333034bbaa0300ed1fc9c7060fa73673a285042e3f042540e0" "cci.20220621": url: "https://github.com/google/XNNPACK/archive/b725ca1a40b53d8087d1be0c53cb49fa05e2f1bc.tar.gz" sha256: "a745c629dea5fc76e5a545e412a408fde1a523b71027f07d1b0670ec9ae54819" + "cci.20211210": + url: "https://github.com/google/XNNPACK/archive/113092317754c7dea47bfb3cb49c4f59c3c1fa10.tar.gz" + sha256: "065bb9c85438c453f9300251f263118c4d123d79b21acf8f66582a3124d95fb2" + "cci.20211026": + url: "https://github.com/google/XNNPACK/archive/ccbaedf11c70a3ff4db0ef17cfeacd710ffc3492.tar.gz" + sha256: "9324aea663d21cea4538095c40928572ddb685e0601853f278b7e5ead697fe81" + "cci.20210310": + url: "https://github.com/google/XNNPACK/archive/24c2dec2c451b7594eb6ef70c538923899bd541c.tar.gz" + sha256: "f049f55d57d6e608dd1125c3d40323763dc842949b31437be7158b7e91687ed8" diff --git a/recipes/xnnpack/all/conanfile.py b/recipes/xnnpack/all/conanfile.py index 131f20b274b16..b4f316563dd04 100644 --- a/recipes/xnnpack/all/conanfile.py +++ b/recipes/xnnpack/all/conanfile.py @@ -1,8 +1,13 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import glob +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import copy, get, replace_in_file +from conan.tools.microsoft import check_min_vs +from conan.tools.scm import Version import os +required_conan_version = ">=1.51.1" + class XnnpackConan(ConanFile): name = "xnnpack" @@ -10,8 +15,8 @@ class XnnpackConan(ConanFile): "neural network inference operators for ARM, WebAssembly, " \ "and x86 platforms." license = "BSD-3-Clause" - topics = ("conan", "xnnpack", "neural-network", "inference", "multithreading", - "inference-optimization", "matrix-multiplication", "simd") + topics = ("neural-network", "inference", "multithreading", "inference-optimization", + "matrix-multiplication", "simd") homepage = "https://github.com/google/XNNPACK" url = "https://github.com/conan-io/conan-center-index" @@ -32,12 +37,6 @@ class XnnpackConan(ConanFile): } exports_sources = "CMakeLists.txt" - generators = "cmake" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" def config_options(self): if self.settings.os == "Windows": @@ -45,72 +44,82 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd - compiler = self.settings.compiler - compiler_version = tools.Version(compiler.version) - if (compiler == "gcc" and compiler_version < "6") or \ - (compiler == "clang" and compiler_version < "5") or \ - (compiler == "Visual Studio" and compiler_version < "16"): - raise ConanInvalidConfiguration("xnnpack doesn't support {} {}".format(str(compiler), compiler.version)) + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): - self.requires("cpuinfo/cci.20201217") + self.requires("cpuinfo/cci.20220228") self.requires("fp16/cci.20210320") - # Note: using newer version of pthreadpool compared to reference cci.20201205 self.requires("pthreadpool/cci.20210218") - def _patch_sources(self): - tools.replace_in_file(os.path.join(self.source_folder, self._source_subfolder, "CMakeLists.txt"), - "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}", - "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}") + def validate(self): + check_min_vs(self, 192) + compiler = self.info.settings.compiler + compiler_version = Version(compiler.version) + if (compiler == "gcc" and compiler_version < "6") or \ + (compiler == "clang" and compiler_version < "5"): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support {compiler} {compiler.version}") def source(self): - tools.get(**self.conan_data["sources"][self.version]) - extracted_dir = glob.glob("XNNPACK-*")[0] - os.rename(extracted_dir, self._source_subfolder) - self._patch_sources() + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) + def generate(self): + tc = CMakeToolchain(self) if self.settings.arch == "armv8": if self.settings.os == "Linux": - self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "aarch64" + tc.variables["CONAN_XNNPACK_SYSTEM_PROCESSOR"] = "aarch64" else: # Not defined by Conan for Apple Silicon. See https://github.com/conan-io/conan/pull/8026 - self._cmake.definitions["CMAKE_SYSTEM_PROCESSOR"] = "arm64" - self._cmake.definitions["XNNPACK_LIBRARY_TYPE"] = "shared" if self.options.shared else "static" - self._cmake.definitions["XNNPACK_ENABLE_ASSEMBLY"] = self.options.assembly - self._cmake.definitions["XNNPACK_ENABLE_MEMOPT"] = self.options.memopt - self._cmake.definitions["XNNPACK_ENABLE_SPARSE"] = self.options.sparse - self._cmake.definitions["XNNPACK_BUILD_TESTS"] = False - self._cmake.definitions["XNNPACK_BUILD_BENCHMARKS"] = False - + tc.variables["CONAN_XNNPACK_SYSTEM_PROCESSOR"] = "arm64" + tc.cache_variables["XNNPACK_LIBRARY_TYPE"] = "shared" if self.options.shared else "static" + tc.variables["XNNPACK_ENABLE_ASSEMBLY"] = self.options.assembly + tc.variables["XNNPACK_ENABLE_MEMOPT"] = self.options.memopt + tc.variables["XNNPACK_ENABLE_SPARSE"] = self.options.sparse + tc.variables["XNNPACK_BUILD_TESTS"] = False + tc.variables["XNNPACK_BUILD_BENCHMARKS"] = False + tc.variables["XNNPACK_USE_SYSTEM_LIBS"] = True # Default fPIC on if it doesn't exist (i.e. for shared library builds) - self._cmake.definitions["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) - - # Use conan dependencies instead of downloading them during configuration - self._cmake.definitions["XNNPACK_USE_SYSTEM_LIBS"] = True - + tc.variables["CMAKE_POSITION_INDEPENDENT_CODE"] = self.options.get_safe("fPIC", True) # Install only built targets, in this case just the XNNPACK target - self._cmake.definitions["CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"] = True + tc.variables["CMAKE_SKIP_INSTALL_ALL_DEPENDENCY"] = True + # To export symbols for shared msvc + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + tc.generate() + + deps = CMakeDeps(self) + deps.generate() - self._cmake.configure() - return self._cmake + def _patch_sources(self): + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), + "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}", + "LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}") def build(self): - cmake = self._configure_cmake() + self._patch_sources() + cmake = CMake(self) + cmake.configure(build_script_folder=os.path.join(self.source_folder, os.pardir)) cmake.build(target="XNNPACK") def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): self.cpp_info.libs = ["XNNPACK"] - if self.settings.os == "Linux": + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["m"] diff --git a/recipes/xnnpack/all/test_package/CMakeLists.txt b/recipes/xnnpack/all/test_package/CMakeLists.txt index fd126a732c403..b71bd6e6242c8 100644 --- a/recipes/xnnpack/all/test_package/CMakeLists.txt +++ b/recipes/xnnpack/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(xnnpack REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE xnnpack::xnnpack) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/xnnpack/all/test_package/conanfile.py b/recipes/xnnpack/all/test_package/conanfile.py index 5216332f39f5c..0a6bc68712d90 100644 --- a/recipes/xnnpack/all/test_package/conanfile.py +++ b/recipes/xnnpack/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xnnpack/all/test_v1_package/CMakeLists.txt b/recipes/xnnpack/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..7a503e7fa1a41 --- /dev/null +++ b/recipes/xnnpack/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,11 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(xnnpack REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE xnnpack::xnnpack) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/xnnpack/all/test_v1_package/conanfile.py b/recipes/xnnpack/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/xnnpack/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xnnpack/config.yml b/recipes/xnnpack/config.yml index 55f77649339db..48525c3051347 100644 --- a/recipes/xnnpack/config.yml +++ b/recipes/xnnpack/config.yml @@ -1,9 +1,11 @@ versions: - "cci.20210310": + "cci.20220801": folder: all - "cci.20211026": + "cci.20220621": folder: all "cci.20211210": folder: all - "cci.20220621": + "cci.20211026": + folder: all + "cci.20210310": folder: all diff --git a/recipes/xorg-cf-files/all/conandata.yml b/recipes/xorg-cf-files/all/conandata.yml index 68ca6f92cb6b3..6580982dad473 100644 --- a/recipes/xorg-cf-files/all/conandata.yml +++ b/recipes/xorg-cf-files/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "1.0.7": - patch_file: "patches/1.0.7-0001-win-fixes.patch" - base_path: "source_subfolder" diff --git a/recipes/xorg-cf-files/all/conanfile.py b/recipes/xorg-cf-files/all/conanfile.py index 8d74bd53252c0..01f8b70e11cc2 100644 --- a/recipes/xorg-cf-files/all/conanfile.py +++ b/recipes/xorg-cf-files/all/conanfile.py @@ -1,101 +1,100 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration -import contextlib +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.gnu import AutotoolsToolchain, Autotools, PkgConfigDeps +from conan.tools.microsoft import is_msvc, unix_path +from conan.tools.files import get, rmdir, copy, apply_conandata_patches, export_conandata_patches +from conan.tools.env import VirtualBuildEnv +from conan.tools.apple import is_apple_os +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.57.0" class XorgCfFilesConan(ConanFile): name = "xorg-cf-files" + package_type = "build-scripts" description = "Imake configuration files & templates" - topics = ("conan", "imake", "xorg", "template", "configuration", "obsolete") + topics = ("imake", "xorg", "template", "configuration", "obsolete") license = "MIT" homepage = "https://gitlab.freedesktop.org/xorg/util/cf" url = "https://github.com/conan-io/conan-center-index" - settings = "os", "compiler" - - exports_sources = "patches/*" - generators = "pkg_config" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + settings = "os", "arch", "compiler", "build_type" @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - def requirements(self): - self.requires("xorg-macros/1.19.3") - self.requires("xorg-proto/2021.4") - - def build_requirements(self): - self.build_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - if self.settings.compiler == "Visual Studio": - self.build_requires("automake/1.16.3") + def export_sources(self): + export_conandata_patches(self) def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def validate(self): - if tools.is_apple_os(self.settings.os): - raise ConanInvalidConfiguration("This recipe does not support Apple operating systems.") + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("xorg-macros/1.19.3") + self.requires("xorg-proto/2022.2") def package_id(self): del self.info.settings.compiler + del self.info.settings.arch + del self.info.settings.build_type # self.info.settings.os # FIXME: can be removed once c3i is able to test multiple os'es from one common package + def validate(self): + if is_apple_os(self): + raise ConanInvalidConfiguration(f"{self.ref} does not support Apple operating systems.") + + def build_requirements(self): + if not self.conf.get("tools.gnu:pkg_config", check_type=str): + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + if is_msvc(self): + self.build_requires("automake/1.16.5") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "CXX": "{} cl -nologo".format(tools.unix_path(self._user_info_build["automake"].compile)), - "CPP": "{} cl -E".format(tools.unix_path(self._user_info_build["automake"].compile)), - } - with tools.environment_append(env): - yield - else: - yield - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") - self._autotools.libs = [] - self._autotools.configure(configure_dir=self._source_subfolder) - return self._autotools + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + env = tc.environment() + if is_msvc(self): + compile_wrapper = unix_path(self, self.conf.get('user.automake:compile-wrapper')) + env.define("CC", f"{compile_wrapper} cl -nologo") + env.define("CXX", f"{compile_wrapper} cl -nologo") + env.define("CPP", f"{compile_wrapper} cl -E") + tc.generate(env) + + deps = PkgConfigDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): + self.cpp_info.includedirs = [] self.cpp_info.libdirs = [] - self.user_info.CONFIG_PATH = os.path.join(self.package_folder, "lib", "X11", "config").replace("\\", "/") + x11_config_files = os.path.join(self.package_folder, "lib", "X11", "config") + self.conf_info.define("user.xorg-cf-files:config-path", x11_config_files) + + self.user_info.CONFIG_PATH = x11_config_files.replace("\\", "/") diff --git a/recipes/xorg-cf-files/all/test_package/conanfile.py b/recipes/xorg-cf-files/all/test_package/conanfile.py index 843ab72802179..a1d91cfb0034d 100644 --- a/recipes/xorg-cf-files/all/test_package/conanfile.py +++ b/recipes/xorg-cf-files/all/test_package/conanfile.py @@ -1,45 +1,51 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -import contextlib import os -import shutil + +from conan import ConanFile +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.files import copy +from conan.tools.env import VirtualBuildEnv +from conan.tools.microsoft import is_msvc +from conan.tools.build import can_run class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" exports_sources = "Imakefile", "test_package.c" + test_type = "explicit" def build_requirements(self): - self.build_requires("imake/1.0.8") - if not tools.get_env("CONAN_MAKE_PROGRAM"): - self.build_requires("make/4.3") + self.tool_requires(self.tested_reference_str) + self.tool_requires("imake/1.0.8") + if not self.conf_info.get("tools.gnu:make_program", check_type=str): + self.tool_requires("make/4.3") @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self): - env = { - "CC": "cl -nologo", - } - with tools.environment_append(env): - yield - else: - yield + def layout(self): + basic_layout(self) + + def generate(self): + tc = AutotoolsToolchain(self) + env = tc.environment() + if is_msvc(self): + env.define("CC", "cl -nologo") + tc.generate() + + buildenv = VirtualBuildEnv(self) + buildenv.generate() def build(self): for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), os.path.join(self.build_folder, src)) - if not tools.cross_building(self): - with self._build_context(): - self.run("imake -DUseInstalled -I{}".format(self.deps_user_info["xorg-cf-files"].CONFIG_PATH), run_environment=True) - with self._build_context(): - autotools = AutoToolsBuildEnvironment(self) - with tools.environment_append(autotools.vars): - autotools.make(target="test_package") + copy(self, src, self.source_folder, self.build_folder) + + config_path = self.conf.get("user.xorg-cf-files:config-path") + self.run(f"imake -DUseInstalled -I{config_path}", env="conanbuild") + autotools = Autotools(self) + autotools.make(target="test_package") def test(self): - if not tools.cross_building(self): - self.run(os.path.join(".", "test_package"), run_environment=True) + if can_run(self): + self.run(os.path.join(".", "test_package"), env="conanrun") diff --git a/recipes/xorg-cf-files/all/test_v1_package/Imakefile b/recipes/xorg-cf-files/all/test_v1_package/Imakefile new file mode 100644 index 0000000000000..a4a7f50021773 --- /dev/null +++ b/recipes/xorg-cf-files/all/test_v1_package/Imakefile @@ -0,0 +1,4 @@ +PROGRAMS = ProgramTargetName(test_package) +AllTarget($(PROGRAMS)) + +NormalProgramTarget(test_package,test_package.o,,,) diff --git a/recipes/xorg-cf-files/all/test_v1_package/conanfile.py b/recipes/xorg-cf-files/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..843ab72802179 --- /dev/null +++ b/recipes/xorg-cf-files/all/test_v1_package/conanfile.py @@ -0,0 +1,45 @@ +from conans import AutoToolsBuildEnvironment, ConanFile, tools +import contextlib +import os +import shutil + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + exports_sources = "Imakefile", "test_package.c" + + def build_requirements(self): + self.build_requires("imake/1.0.8") + if not tools.get_env("CONAN_MAKE_PROGRAM"): + self.build_requires("make/4.3") + + @property + def _settings_build(self): + return getattr(self, "settings_build", self.settings) + + @contextlib.contextmanager + def _build_context(self): + if self.settings.compiler == "Visual Studio": + with tools.vcvars(self): + env = { + "CC": "cl -nologo", + } + with tools.environment_append(env): + yield + else: + yield + + def build(self): + for src in self.exports_sources: + shutil.copy(os.path.join(self.source_folder, src), os.path.join(self.build_folder, src)) + if not tools.cross_building(self): + with self._build_context(): + self.run("imake -DUseInstalled -I{}".format(self.deps_user_info["xorg-cf-files"].CONFIG_PATH), run_environment=True) + with self._build_context(): + autotools = AutoToolsBuildEnvironment(self) + with tools.environment_append(autotools.vars): + autotools.make(target="test_package") + + def test(self): + if not tools.cross_building(self): + self.run(os.path.join(".", "test_package"), run_environment=True) diff --git a/recipes/xorg-cf-files/all/test_v1_package/test_package.c b/recipes/xorg-cf-files/all/test_v1_package/test_package.c new file mode 100644 index 0000000000000..c5e7cd00f008f --- /dev/null +++ b/recipes/xorg-cf-files/all/test_v1_package/test_package.c @@ -0,0 +1,6 @@ +#include + +int main() { + printf("hello world!\n"); + return 0; +} diff --git a/recipes/xorg-gccmakedep/all/conanfile.py b/recipes/xorg-gccmakedep/all/conanfile.py index 8381a9f3c1377..813811cb7758d 100644 --- a/recipes/xorg-gccmakedep/all/conanfile.py +++ b/recipes/xorg-gccmakedep/all/conanfile.py @@ -1,9 +1,12 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, export_conandata_patches, copy, get, load, save, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout import os import re -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class XorgGccmakedep(ConanFile): @@ -15,69 +18,64 @@ class XorgGccmakedep(ConanFile): url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - generators = "pkg_config" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + def requirements(self): self.requires("xorg-macros/1.19.3") def build_requirements(self): - self.build_requires("pkgconf/1.7.4") + self.tool_requires("pkgconf/1.7.4") def validate(self): if self.settings.os == "Windows": raise ConanInvalidConfiguration("Windows is not supported by xorg-gccmakedep") def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def package_id(self): del self.info.settings.compiler + def layout(self): + basic_layout(self, src_folder="src") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - self._autotools.configure(configure_dir=self._source_subfolder) - return self._autotools + deps = PkgConfigDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - autotools = self._configure_autotools() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - conf_ac_text = tools.load(os.path.join(self._source_subfolder, "configure.ac")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + conf_ac_text = load(self, os.path.join(self.source_folder, "configure.ac")) topblock = re.match("((?:dnl[^\n]*\n)+)", conf_ac_text, flags=re.MULTILINE).group(1) license_text = re.subn(r"^dnl(|\s+([^\n]*))", r"\1", topblock, flags=re.MULTILINE)[0] - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), license_text) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_text) - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libdirs = [] + self.cpp_info.includedirs = [] bin_path = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bin_path)) diff --git a/recipes/xorg-gccmakedep/all/test_package/conanfile.py b/recipes/xorg-gccmakedep/all/test_package/conanfile.py index 7ac03637058e2..d86fb3898f201 100644 --- a/recipes/xorg-gccmakedep/all/test_package/conanfile.py +++ b/recipes/xorg-gccmakedep/all/test_package/conanfile.py @@ -1,5 +1,7 @@ -from conans import ConanFile, tools -from conans.errors import ConanException +from conan import ConanFile +from conan.errors import ConanException +from conan.tools.files import copy, load +from conan.tools.layout import basic_layout import os import shutil @@ -7,14 +9,23 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" exports_sources = "Makefile", "test_package.c", "test_package.h" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def layout(self): + basic_layout(self) def build(self): for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), os.path.join(self.build_folder, src)) + copy(self, src, self.source_folder, self.build_folder) - def test(self): - src = os.path.join(self.source_folder, "test_package.c") - self.run("gccmakedep {}".format(src), run_environment=True) + src = os.path.join(self.build_folder, "test_package.c") + self.run(f"gccmakedep {src}", env="conanbuild") - if tools.load(os.path.join(self.source_folder, "Makefile")) == os.path.join(self.build_folder, "Makefile"): + if load(self, os.path.join(self.source_folder, "Makefile")) == os.path.join(self.build_folder, "Makefile"): raise ConanException("xorg-gccmakedep did not modify `Makefile'") + + def test(self): + pass diff --git a/recipes/xorg-gccmakedep/all/test_v1_package/Makefile b/recipes/xorg-gccmakedep/all/test_v1_package/Makefile new file mode 100644 index 0000000000000..b129780b6cb50 --- /dev/null +++ b/recipes/xorg-gccmakedep/all/test_v1_package/Makefile @@ -0,0 +1,2 @@ +test_package: + $(CC) test_package.c -o test_package diff --git a/recipes/xorg-gccmakedep/all/test_v1_package/conanfile.py b/recipes/xorg-gccmakedep/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..7ac03637058e2 --- /dev/null +++ b/recipes/xorg-gccmakedep/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, tools +from conans.errors import ConanException +import os +import shutil + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + exports_sources = "Makefile", "test_package.c", "test_package.h" + + def build(self): + for src in self.exports_sources: + shutil.copy(os.path.join(self.source_folder, src), os.path.join(self.build_folder, src)) + + def test(self): + src = os.path.join(self.source_folder, "test_package.c") + self.run("gccmakedep {}".format(src), run_environment=True) + + if tools.load(os.path.join(self.source_folder, "Makefile")) == os.path.join(self.build_folder, "Makefile"): + raise ConanException("xorg-gccmakedep did not modify `Makefile'") diff --git a/recipes/xorg-gccmakedep/all/test_v1_package/test_package.c b/recipes/xorg-gccmakedep/all/test_v1_package/test_package.c new file mode 100644 index 0000000000000..d58f0ed2d240b --- /dev/null +++ b/recipes/xorg-gccmakedep/all/test_v1_package/test_package.c @@ -0,0 +1,8 @@ +#include "test_package.h" + +#include + +int main() { + printf(TEXT); + return EXIT_SUCCESS; +} diff --git a/recipes/xorg-gccmakedep/all/test_v1_package/test_package.h b/recipes/xorg-gccmakedep/all/test_v1_package/test_package.h new file mode 100644 index 0000000000000..32e2088cba479 --- /dev/null +++ b/recipes/xorg-gccmakedep/all/test_v1_package/test_package.h @@ -0,0 +1,8 @@ +#ifndef TEST_PACKAGE_H +#define TEST_PACKAGE_H + +#include + +#define TEXT "hello world\n" + +#endif // TEST_PACKAGE_H diff --git a/recipes/xorg-macros/all/conandata.yml b/recipes/xorg-macros/all/conandata.yml index 85c72ec02a2db..69af08fff0a8f 100644 --- a/recipes/xorg-macros/all/conandata.yml +++ b/recipes/xorg-macros/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "1.19.3": - patch_file: "patches/0001-export-XORG_MACROS_VERSION-macro.patch" - base_path: "source_subfolder" diff --git a/recipes/xorg-macros/all/conanfile.py b/recipes/xorg-macros/all/conanfile.py index bc5840140f774..6fe36bf8322c5 100644 --- a/recipes/xorg-macros/all/conanfile.py +++ b/recipes/xorg-macros/all/conanfile.py @@ -1,76 +1,76 @@ from conan import ConanFile -from conan.tools import files -from conan.tools import build -from conans import AutoToolsBuildEnvironment, tools +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.env import VirtualBuildEnv +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import unix_path_package_info_legacy import os import textwrap -required_conan_version = ">=1.50.2" +required_conan_version = ">=1.57" class XorgMacrosConan(ConanFile): name = "xorg-macros" description = "GNU autoconf macros shared across X.Org projects" - topics = ("conan", "autoconf", "macros", "build", "system", "m4") + topics = ("autoconf", "macros", "build", "system", "m4") license = "MIT" homepage = "https://gitlab.freedesktop.org/xorg/util/macros" url = "https://github.com/conan-io/conan-center-index" settings = "os" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") @property def _settings_build(self): return self.settings_build if hasattr(self, "settings_build") else self.settings def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def source(self): - files.get(self, **self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) def build_requirements(self): - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") - self.build_requires("automake/1.16.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + self.tool_requires("automake/1.16.5") def package_id(self): - self.info.header_only() + self.info.clear() @property def _datarootdir(self): return os.path.join(self.package_folder, "bin", "share") - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") - conf_args = [ - f"--datarootdir={tools.unix_path(self._datarootdir)}", - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + def generate(self): + tc = AutotoolsToolchain(self) + tc.configure_args.extend( + ["--datarootdir=${prefix}/bin/share"] + ) + tc.generate() + + buildenv = VirtualBuildEnv(self) + buildenv.generate() def build(self): - files.apply_conandata_patches(self) - with files.chdir(self, self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), run_environment=True, win_bash=self._settings_build.os == "Windows") - autotools = self._configure_autotools() + apply_conandata_patches(self) + + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - autotools = self._configure_autotools() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + autotools = Autotools(self) autotools.install() - files.rmdir(self, os.path.join(self._datarootdir, "pkgconfig")) - files.rmdir(self, os.path.join(self._datarootdir, "util-macros")) + rmdir(self, os.path.join(self._datarootdir, "pkgconfig")) + rmdir(self, os.path.join(self._datarootdir, "util-macros")) def package_info(self): self.cpp_info.names["pkg_config"] = "xorg-macros" @@ -87,6 +87,9 @@ def package_info(self): name="util-macros", )) - aclocal = tools.unix_path(os.path.join(self._datarootdir, "aclocal")) + aclocal = os.path.join(self._datarootdir, "aclocal") + self.buildenv_info.append_path("ACLOCAL_PATH", aclocal) + + # TODO: remove once recipe only supports Conan >= 2.0 only self.output.info("Appending AUTOMAKE_CONAN_INCLUDES environment variable: {}".format(aclocal)) - self.env_info.AUTOMAKE_CONAN_INCLUDES.append(aclocal) + self.env_info.AUTOMAKE_CONAN_INCLUDES.append(unix_path_package_info_legacy(self, aclocal )) diff --git a/recipes/xorg-macros/all/test_package/conanfile.py b/recipes/xorg-macros/all/test_package/conanfile.py index 81b7391be15ba..0c8e15396bb6e 100644 --- a/recipes/xorg-macros/all/test_package/conanfile.py +++ b/recipes/xorg-macros/all/test_package/conanfile.py @@ -1,30 +1,34 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -import os -import shutil +from conan import ConanFile +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.layout import basic_layout class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - exports_sources = "configure.ac", "Makefile.am", - generators = "pkg_config" test_type = "explicit" + win_bash = True @property def _settings_build(self): return self.settings_build if hasattr(self, "settings_build") else self.settings def build_requirements(self): - self.build_requires(self.tested_reference_str) - self.build_requires("automake/1.16.3") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires(self.tested_reference_str) + self.build_requires("automake/1.16.5") + if self._settings_build.os == "Windows" and not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + + def layout(self): + basic_layout(self, src_folder="src") + + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() def build(self): - for src in self.exports_sources: - shutil.copy(os.path.join(self.source_folder, src), self.build_folder) - print(tools.get_env("AUTOMAKE_CONAN_INCLUDES")) - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=self._settings_build.os == "Windows", run_environment=True) - autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") + # Only make sure the project configures correctly, as these are build scripts + autotools = Autotools(self) + autotools.autoreconf(args=["--debug"]) autotools.configure() def test(self): diff --git a/recipes/xorg-macros/all/test_package/src/Makefile.am b/recipes/xorg-macros/all/test_package/src/Makefile.am new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/recipes/xorg-macros/all/test_package/src/configure.ac b/recipes/xorg-macros/all/test_package/src/configure.ac new file mode 100644 index 0000000000000..3bb86acef57c9 --- /dev/null +++ b/recipes/xorg-macros/all/test_package/src/configure.ac @@ -0,0 +1,14 @@ +AC_PREREQ([2.69]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_INIT([test_package], [1.0]) +AC_CONFIG_SRCDIR([configure.ac]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + +m4_ifndef([XORG_MACROS_VERSION],[ + m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])],[ + AC_MSG_NOTICE([xorg-macros version ok])]) + +XORG_MACROS_VERSION([1.1]) + +AC_CONFIG_FILES(Makefile) +AC_OUTPUT diff --git a/recipes/xorg-macros/all/test_v1_package/Makefile.am b/recipes/xorg-macros/all/test_v1_package/Makefile.am new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/recipes/xorg-macros/all/test_v1_package/conanfile.py b/recipes/xorg-macros/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..81b7391be15ba --- /dev/null +++ b/recipes/xorg-macros/all/test_v1_package/conanfile.py @@ -0,0 +1,32 @@ +from conans import AutoToolsBuildEnvironment, ConanFile, tools +import os +import shutil + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + exports_sources = "configure.ac", "Makefile.am", + generators = "pkg_config" + test_type = "explicit" + + @property + def _settings_build(self): + return self.settings_build if hasattr(self, "settings_build") else self.settings + + def build_requirements(self): + self.build_requires(self.tested_reference_str) + self.build_requires("automake/1.16.3") + if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): + self.build_requires("msys2/cci.latest") + + def build(self): + for src in self.exports_sources: + shutil.copy(os.path.join(self.source_folder, src), self.build_folder) + print(tools.get_env("AUTOMAKE_CONAN_INCLUDES")) + self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=self._settings_build.os == "Windows", run_environment=True) + autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") + autotools.configure() + + def test(self): + # FIXME: how to test extra pkg_config content? + pass diff --git a/recipes/xorg-macros/all/test_v1_package/configure.ac b/recipes/xorg-macros/all/test_v1_package/configure.ac new file mode 100644 index 0000000000000..3bb86acef57c9 --- /dev/null +++ b/recipes/xorg-macros/all/test_v1_package/configure.ac @@ -0,0 +1,14 @@ +AC_PREREQ([2.69]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_INIT([test_package], [1.0]) +AC_CONFIG_SRCDIR([configure.ac]) +AM_INIT_AUTOMAKE([-Wall -Werror foreign]) + +m4_ifndef([XORG_MACROS_VERSION],[ + m4_fatal([must install xorg-macros 1.1 or later before running autoconf/autogen])],[ + AC_MSG_NOTICE([xorg-macros version ok])]) + +XORG_MACROS_VERSION([1.1]) + +AC_CONFIG_FILES(Makefile) +AC_OUTPUT diff --git a/recipes/xorg-makedepend/all/conanfile.py b/recipes/xorg-makedepend/all/conanfile.py index 954b8aa995149..30942c62ac839 100644 --- a/recipes/xorg-makedepend/all/conanfile.py +++ b/recipes/xorg-makedepend/all/conanfile.py @@ -1,9 +1,12 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, rmdir, save +from conan.tools.gnu import Autotools, AutotoolsToolchain, PkgConfigDeps +from conan.tools.layout import basic_layout import os import re -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" class XorgMakedepend(ConanFile): @@ -15,22 +18,16 @@ class XorgMakedepend(ConanFile): url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - exports_sources = "patches/*" - generators = "pkg_config" - - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + def requirements(self): self.requires("xorg-macros/1.19.3") - self.requires("xorg-proto/2021.4") + self.requires("xorg-proto/2022.2") def build_requirements(self): self.build_requires("pkgconf/1.7.4") @@ -40,46 +37,49 @@ def validate(self): raise ConanInvalidConfiguration("Windows is not supported by xorg-makedepend") def configure(self): - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def package_id(self): del self.info.settings.compiler + def layout(self): + basic_layout(self, src_folder="src") + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) @property def _user_info_build(self): return getattr(self, "user_info_build", self.deps_user_info) - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") - self._autotools.libs = [] - self._autotools.configure(configure_dir=self._source_subfolder) - return self._autotools + def generate(self): + tc = AutotoolsToolchain(self) + tc.generate() + + deps = PkgConfigDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - autotools = self._configure_autotools() + apply_conandata_patches(self) + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") - def_h_text = tools.load(os.path.join(self._source_subfolder, "def.h")) + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + def_h_text = load(self, os.path.join(self.source_folder, "def.h")) license_text = next(re.finditer(r"/\*([^*]+)\*/", def_h_text)).group(1) - tools.save(os.path.join(self.package_folder, "licenses", "LICENSE"), license_text) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE"), license_text) - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) def package_info(self): self.cpp_info.libdirs = [] + self.cpp_info.includedirs = [] bin_path = os.path.join(self.package_folder, "bin") self.output.info("Appending PATH environment variable: {}".format(bin_path)) diff --git a/recipes/xorg-makedepend/all/test_package/conanfile.py b/recipes/xorg-makedepend/all/test_package/conanfile.py index b34e1e6e6345d..4fb3d595e8d53 100644 --- a/recipes/xorg-makedepend/all/test_package/conanfile.py +++ b/recipes/xorg-makedepend/all/test_package/conanfile.py @@ -1,13 +1,22 @@ -from conans import ConanFile, tools import os -required_conan_version = ">=1.36.0" +from conan import ConanFile +from conan.tools.layout import basic_layout class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) + + def layout(self): + basic_layout(self) + + def build(self): + src = os.path.join(self.source_folder, "test_package.c") + self.run(f"makedepend -f- -- -- {src}") def test(self): - if not tools.cross_building(self): - src = os.path.join(self.source_folder, "test_package.c") - self.run("makedepend -f- -- -- {}".format(src), run_environment=True) + pass diff --git a/recipes/xorg-makedepend/all/test_v1_package/conanfile.py b/recipes/xorg-makedepend/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..b34e1e6e6345d --- /dev/null +++ b/recipes/xorg-makedepend/all/test_v1_package/conanfile.py @@ -0,0 +1,13 @@ +from conans import ConanFile, tools +import os + +required_conan_version = ">=1.36.0" + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not tools.cross_building(self): + src = os.path.join(self.source_folder, "test_package.c") + self.run("makedepend -f- -- -- {}".format(src), run_environment=True) diff --git a/recipes/xorg-makedepend/all/test_v1_package/test_package.c b/recipes/xorg-makedepend/all/test_v1_package/test_package.c new file mode 100644 index 0000000000000..d58f0ed2d240b --- /dev/null +++ b/recipes/xorg-makedepend/all/test_v1_package/test_package.c @@ -0,0 +1,8 @@ +#include "test_package.h" + +#include + +int main() { + printf(TEXT); + return EXIT_SUCCESS; +} diff --git a/recipes/xorg-makedepend/all/test_v1_package/test_package.h b/recipes/xorg-makedepend/all/test_v1_package/test_package.h new file mode 100644 index 0000000000000..32e2088cba479 --- /dev/null +++ b/recipes/xorg-makedepend/all/test_v1_package/test_package.h @@ -0,0 +1,8 @@ +#ifndef TEST_PACKAGE_H +#define TEST_PACKAGE_H + +#include + +#define TEXT "hello world\n" + +#endif // TEST_PACKAGE_H diff --git a/recipes/xorg-proto/all/conandata.yml b/recipes/xorg-proto/all/conandata.yml index f23edcc216fbf..a78c2d2c2da43 100644 --- a/recipes/xorg-proto/all/conandata.yml +++ b/recipes/xorg-proto/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "2022.2": + url: "https://www.x.org/releases/individual/proto/xorgproto-2022.2.tar.gz" + sha256: "da351a403d07a7006d7bdc8dcfc14ddc1b588b38fb81adab9989a8eef605757b" "2021.4": url: "https://www.x.org/releases/individual/proto/xorgproto-2021.4.tar.gz" sha256: "9de0babd3d8cb16b0c1c47b8389a52f3e1326bb0bc9a9ab34a9500778448a2bd" diff --git a/recipes/xorg-proto/all/conanfile.py b/recipes/xorg-proto/all/conanfile.py index ad8e696b97953..b53e7215a2338 100644 --- a/recipes/xorg-proto/all/conanfile.py +++ b/recipes/xorg-proto/all/conanfile.py @@ -1,98 +1,85 @@ from conan import ConanFile -from conan.tools.files import rmdir, mkdir, save, load -from conans import AutoToolsBuildEnvironment, tools -import contextlib +from conan.tools.files import rmdir, mkdir, save, load, get, apply_conandata_patches, export_conandata_patches, copy +from conan.tools.gnu import AutotoolsToolchain, Autotools +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path + import glob import os import re import yaml -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class XorgProtoConan(ConanFile): name = "xorg-proto" + package_type = "header-library" description = "This package provides the headers and specification documents defining " \ "the core protocol and (many) extensions for the X Window System." - topics = ("conan", "xproto", "header", "specification") + topics = ("specification", "x-window") license = "X11" homepage = "https://gitlab.freedesktop.org/xorg/proto/xorgproto" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" - generators = "PkgConfigDeps" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") @property def _settings_build(self): return getattr(self, "settings_build", self.settings) - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) - def build_requirements(self): - self.build_requires("automake/1.16.3") - self.build_requires("xorg-macros/1.19.3") - self.build_requires("pkgconf/1.7.4") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("automake/1.16.5") + self.tool_requires("xorg-macros/1.19.3") + self.tool_requires("pkgconf/1.9.3") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def requirements(self): if hasattr(self, "settings_build"): self.requires("xorg-macros/1.19.3") def package_id(self): - # self.info.header_only() would be fine too, but keep the os to add c3i test coverage for Windows. + # self.info.clear() would be fine too, but keep the os to add c3i test coverage for Windows. del self.info.settings.arch del self.info.settings.build_type del self.info.settings.compiler + def export_sources(self): + export_conandata_patches(self) + def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @contextlib.contextmanager - def _build_context(self): - if self.settings.compiler == "Visual Studio": - with tools.vcvars(self.settings): - env = { - "CC": "{} cl -nologo".format(self._user_info_build["automake"].compile).replace("\\", "/"), - } - with tools.environment_append(env): - yield - else: - yield - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=self._settings_build.os == "Windows") - self._autotools.libs = [] - self._autotools.configure(configure_dir=self._source_subfolder) - return self._autotools + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def generate(self): + tc = AutotoolsToolchain(self) + env = tc.environment() + if is_msvc(self): + compile_wrapper = unix_path(self, self.conf.get("user.automake:compile-wrapper")) + env.define("CC", f"{compile_wrapper} cl -nologo") + tc.generate(env) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - with self._build_context(): - autotools = self._configure_autotools() - autotools.make() + apply_conandata_patches(self) + + autotools = Autotools(self) + autotools.configure() + autotools.make() @property def _pc_data_path(self): return os.path.join(self.package_folder, "res", "pc_data.yml") def package(self): - self.copy("COPYING-*", src=self._source_subfolder, dst="licenses") - with self._build_context(): - autotools = self._configure_autotools() - autotools.install() + copy(self, "COPYING-*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + + autotools = Autotools(self) + autotools.install() pc_data = {} for fn in glob.glob(os.path.join(self.package_folder, "share", "pkgconfig", "*.pc")): diff --git a/recipes/xorg-proto/all/test_package/CMakeLists.txt b/recipes/xorg-proto/all/test_package/CMakeLists.txt deleted file mode 100644 index fd126a732c403..0000000000000 --- a/recipes/xorg-proto/all/test_package/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() - -add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) diff --git a/recipes/xorg-proto/all/test_package/conanfile.py b/recipes/xorg-proto/all/test_package/conanfile.py index 74a00ca1ef212..60a4e553bae92 100644 --- a/recipes/xorg-proto/all/test_package/conanfile.py +++ b/recipes/xorg-proto/all/test_package/conanfile.py @@ -1,12 +1,20 @@ from conan import ConanFile -from conan.tools.build import cross_building -from conans import CMake +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout + import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps" + test_type = "explicit" + + def layout(self): + cmake_layout(self, src_folder="src") + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -14,6 +22,6 @@ def build(self): cmake.build() def test(self): - if not cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindir, "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xorg-proto/all/test_package/src/CMakeLists.txt b/recipes/xorg-proto/all/test_package/src/CMakeLists.txt new file mode 100644 index 0000000000000..9f690fb1f0fe5 --- /dev/null +++ b/recipes/xorg-proto/all/test_package/src/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES C) + +find_package(xorg-proto REQUIRED) + +add_executable(${PROJECT_NAME} test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE xorg-proto::xorg-proto) +set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) diff --git a/recipes/xorg-proto/all/test_package/test_package.c b/recipes/xorg-proto/all/test_package/src/test_package.c similarity index 100% rename from recipes/xorg-proto/all/test_package/test_package.c rename to recipes/xorg-proto/all/test_package/src/test_package.c diff --git a/recipes/xorg-proto/all/test_v1_package/CMakeLists.txt b/recipes/xorg-proto/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..39b78234180b2 --- /dev/null +++ b/recipes/xorg-proto/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,9 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package C) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +add_executable(${PROJECT_NAME} ../test_package/src/test_package.c) +target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) +set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) diff --git a/recipes/xorg-proto/all/test_v1_package/conanfile.py b/recipes/xorg-proto/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..74a00ca1ef212 --- /dev/null +++ b/recipes/xorg-proto/all/test_v1_package/conanfile.py @@ -0,0 +1,19 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from conans import CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xorg-proto/config.yml b/recipes/xorg-proto/config.yml index e586020e72036..2928e57dc1b28 100644 --- a/recipes/xorg-proto/config.yml +++ b/recipes/xorg-proto/config.yml @@ -1,3 +1,5 @@ versions: + "2022.2": + folder: "all" "2021.4": folder: "all" diff --git a/recipes/xorg/all/conanfile.py b/recipes/xorg/all/conanfile.py index 6dfbe525aad48..a3fc28f91164a 100644 --- a/recipes/xorg/all/conanfile.py +++ b/recipes/xorg/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.tools.gnu import PkgConfig -from conan.tools.system.package_manager import Apt, Dnf, PacMan, Pkg, Yum, Zypper +from conan.tools.system import package_manager from conan.errors import ConanInvalidConfiguration -required_conan_version = ">=1.47" +required_conan_version = ">=1.50.0" class XorgConan(ConanFile): @@ -12,7 +12,7 @@ class XorgConan(ConanFile): license = "MIT" homepage = "https://www.x.org/wiki/" description = "The X.Org project provides an open source implementation of the X Window System." - settings = "os" + settings = "os", "arch", "compiler", "build_type" topics = ("x11", "xorg") def validate(self): @@ -20,60 +20,64 @@ def validate(self): raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") def package_id(self): - self.info.header_only() + self.info.clear() def system_requirements(self): - apt = Apt(self) + apt = package_manager.Apt(self) apt.install(["libx11-dev", "libx11-xcb-dev", "libfontenc-dev", "libice-dev", "libsm-dev", "libxau-dev", "libxaw7-dev", "libxcomposite-dev", "libxcursor-dev", "libxdamage-dev", "libxdmcp-dev", "libxext-dev", "libxfixes-dev", "libxi-dev", "libxinerama-dev", "libxkbfile-dev", "libxmu-dev", "libxmuu-dev", "libxpm-dev", "libxrandr-dev", "libxrender-dev", "libxres-dev", "libxss-dev", "libxt-dev", "libxtst-dev", - "libxv-dev", "libxvmc-dev", "libxxf86vm-dev", "xtrans-dev", "libxcb-render0-dev", + "libxv-dev", "libxvmc-dev", "libxxf86vm-dev", "libxcb-render0-dev", "libxcb-render-util0-dev", "libxcb-xkb-dev", "libxcb-icccm4-dev", "libxcb-image0-dev", "libxcb-keysyms1-dev", "libxcb-randr0-dev", "libxcb-shape0-dev", "libxcb-sync-dev", "libxcb-xfixes0-dev", - "libxcb-xinerama0-dev", "xkb-data", "libxcb-dri3-dev", "uuid-dev"], update=True, check=True) + "libxcb-xinerama0-dev", "libxcb-dri3-dev", "uuid-dev"], update=True, check=True) apt.install_substitutes( ["libxcb-util-dev"], ["libxcb-util0-dev"], update=True, check=True) - Yum(self).install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", + yum = package_manager.Yum(self) + yum.install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", "libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel", "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel", "libXvMC-devel", - "xorg-x11-xtrans-devel", "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", + "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel", - "xcb-util-devel", "libuuid-devel", "xkeyboard-config-devel"], update=True, check=True) + "xcb-util-devel", "libuuid-devel"], update=True, check=True) - Dnf(self).install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", + dnf = package_manager.Dnf(self) + dnf.install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", "libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel", "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel", "libXvMC-devel", - "xorg-x11-xtrans-devel", "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", + "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel", - "xcb-util-devel", "libuuid-devel", "xkeyboard-config-devel"], update=True, check=True) + "xcb-util-devel", "libuuid-devel"], update=True, check=True) - Zypper(self).install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", + zypper = package_manager.Zypper(self) + zypper.install(["libxcb-devel", "libfontenc-devel", "libXaw-devel", "libXcomposite-devel", "libXcursor-devel", "libXdmcp-devel", "libXtst-devel", "libXinerama-devel", - "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXScrnSaver-devel", "libXvMC-devel", - "xorg-x11-xtrans-devel", "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", + "libxkbfile-devel", "libXrandr-devel", "libXres-devel", "libXss-devel", "libXvMC-devel", + "xcb-util-wm-devel", "xcb-util-image-devel", "xcb-util-keysyms-devel", "xcb-util-renderutil-devel", "libXdamage-devel", "libXxf86vm-devel", "libXv-devel", - "xcb-util-devel", "libuuid-devel", "xkeyboard-config"], update=True, check=True) + "xcb-util-devel", "libuuid-devel"], update=True, check=True) - PacMan(self).install(["libxcb", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", + pacman = package_manager.PacMan(self) + pacman.install(["libxcb", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", "libxdamage", "libxdmcp", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres", - "libxss", "libxvmc", "xtrans", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", - "libxxf86vm", "libxv", "xkeyboard-config", "xcb-util", "util-linux-libs"], update=True, check=True) + "libxss", "libxvmc", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", + "libxxf86vm", "libxv", "xcb-util", "util-linux-libs"], update=True, check=True) - Pkg(self).install(["libX11", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", + package_manager.Pkg(self).install(["libX11", "libfontenc", "libice", "libsm", "libxaw", "libxcomposite", "libxcursor", "libxdamage", "libxdmcp", "libxtst", "libxinerama", "libxkbfile", "libxrandr", "libxres", - "libXScrnSaver", "libxvmc", "xtrans", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", + "libXScrnSaver", "libxvmc", "xcb-util-wm", "xcb-util-image", "xcb-util-keysyms", "xcb-util-renderutil", "libxxf86vm", "libxv", "xkeyboard-config", "xcb-util"], update=True, check=True) def package_info(self): for name in ["x11", "x11-xcb", "fontenc", "ice", "sm", "xau", "xaw7", "xcomposite", "xcursor", "xdamage", "xdmcp", "xext", "xfixes", "xi", "xinerama", "xkbfile", "xmu", "xmuu", "xpm", "xrandr", "xrender", "xres", - "xscrnsaver", "xt", "xtst", "xv", "xvmc", "xxf86vm", "xtrans", + "xscrnsaver", "xt", "xtst", "xv", "xvmc", "xxf86vm", "xcb-xkb", "xcb-icccm", "xcb-image", "xcb-keysyms", "xcb-randr", "xcb-render", "xcb-renderutil", "xcb-shape", "xcb-shm", "xcb-sync", "xcb-xfixes", - "xcb-xinerama", "xcb", "xkeyboard-config", "xcb-atom", "xcb-aux", "xcb-event", "xcb-util", + "xcb-xinerama", "xcb", "xcb-atom", "xcb-aux", "xcb-event", "xcb-util", "xcb-dri3"] + ([] if self.settings.os == "FreeBSD" else ["uuid"]): pkg_config = PkgConfig(self, name) pkg_config.fill_cpp_info( diff --git a/recipes/xorg/all/test_package/conanfile.py b/recipes/xorg/all/test_package/conanfile.py index 603eba58719ec..f414ecd075ee7 100644 --- a/recipes/xorg/all/test_package/conanfile.py +++ b/recipes/xorg/all/test_package/conanfile.py @@ -2,9 +2,8 @@ from conan import ConanFile from conan.tools.build import cross_building -from conan.tools.cmake import CMake +from conan.tools.cmake import CMake, cmake_layout from conan.tools.gnu import PkgConfigDeps -from conan.tools.layout import cmake_layout class TestPackageConan(ConanFile): diff --git a/recipes/xorg/all/test_v1_package/conanfile.py b/recipes/xorg/all/test_v1_package/conanfile.py index 5079d1fb5b083..ce69ba8b754ca 100644 --- a/recipes/xorg/all/test_v1_package/conanfile.py +++ b/recipes/xorg/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/xorstr/all/conanfile.py b/recipes/xorstr/all/conanfile.py index 069c03de54d91..2712a05ac7044 100644 --- a/recipes/xorstr/all/conanfile.py +++ b/recipes/xorstr/all/conanfile.py @@ -1,56 +1,70 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.50.0" class XorstrConan(ConanFile): name = "xorstr" description = "A heavily vectorized c++17 compile time string encryption." license = "Apache-2.0" - topics = ("conan", "xorstr", "encryption", "string", "vectorized") + topics = ("encryption", "string", "vectorized") homepage = "https://github.com/JustasMasiulis/xorstr" url = "https://github.com/conan-io/conan-center-index" no_copy_source = True - settings = "compiler" + settings = "os", "arch", "compiler", "build_type" @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "17" @property def _compilers_minimum_version(self): return { "Visual Studio": "16", + "msvc": "192", "gcc": "7", "clang": "5.0", - "apple-clang": "9.1" + "apple-clang": "9.1", } + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 17) + check_min_cppstd(self, self._min_cppstd) - def lazy_lt_semver(v1, v2): + def loose_lt_semver(v1, v2): lv1 = [int(v) for v in v1.split(".")] lv2 = [int(v) for v in v2.split(".")] min_length = min(len(lv1), len(lv2)) return lv1[:min_length] < lv2[:min_length] minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) - if not minimum_version: - self.output.warn("{} {} requires C++17. Your compiler is unknown. Assuming it supports C++17.".format(self.name, self.version)) - elif lazy_lt_semver(str(self.settings.compiler.version), minimum_version): - raise ConanInvalidConfiguration("{} {} requires C++17, which your compiler does not support.".format(self.name, self.version)) - - def package_id(self): - self.info.header_only() + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/xorstr/all/test_package/CMakeLists.txt b/recipes/xorstr/all/test_package/CMakeLists.txt index 0029db0945c64..b2faa1d5c02ce 100644 --- a/recipes/xorstr/all/test_package/CMakeLists.txt +++ b/recipes/xorstr/all/test_package/CMakeLists.txt @@ -1,9 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup() +find_package(xorstr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} ${CONAN_LIBS}) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17) +target_link_libraries(${PROJECT_NAME} PRIVATE xorstr::xorstr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) diff --git a/recipes/xorstr/all/test_package/conanfile.py b/recipes/xorstr/all/test_package/conanfile.py index 5216332f39f5c..0a6bc68712d90 100644 --- a/recipes/xorstr/all/test_package/conanfile.py +++ b/recipes/xorstr/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self.settings): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xorstr/all/test_v1_package/CMakeLists.txt b/recipes/xorstr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/xorstr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xorstr/all/test_v1_package/conanfile.py b/recipes/xorstr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/xorstr/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xpack/all/conandata.yml b/recipes/xpack/all/conandata.yml index 28444be3a175d..86baf40457468 100644 --- a/recipes/xpack/all/conandata.yml +++ b/recipes/xpack/all/conandata.yml @@ -1,4 +1,23 @@ sources: + "1.0.4": + url: "https://github.com/xyz347/xpack/archive/v1.0.4.tar.gz" + sha256: "ccea6d986052a9ad8ad859ad42283fc01fed29009133017b231a06ec0b1976b9" + "1.0.3": + url: "https://github.com/xyz347/xpack/archive/v1.0.3.tar.gz" + sha256: "dcda8da82a82b30bb2100233e45750de3f29b6be00681c38cb102406f6fe399a" "1.0.2": url: "https://github.com/xyz347/xpack/archive/v1.0.2.tar.gz" - sha256: 50cf82e123ef0a0aeb8d39e21f5f067c259f17bd917493ed8d7b39cd33c80f07 + sha256: "50cf82e123ef0a0aeb8d39e21f5f067c259f17bd917493ed8d7b39cd33c80f07" +patches: + "1.0.4": + - patch_file: "patches/1.0.2-0001-use-cci.patch" + patch_description: "use cci packages" + patch_type: "conan" + "1.0.3": + - patch_file: "patches/1.0.2-0001-use-cci.patch" + patch_description: "use cci packages" + patch_type: "conan" + "1.0.2": + - patch_file: "patches/1.0.2-0001-use-cci.patch" + patch_description: "use cci packages" + patch_type: "conan" diff --git a/recipes/xpack/all/conanfile.py b/recipes/xpack/all/conanfile.py index 5e311861c72d2..87dad9562235b 100644 --- a/recipes/xpack/all/conanfile.py +++ b/recipes/xpack/all/conanfile.py @@ -1,28 +1,58 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" - +required_conan_version = ">=1.52.0" class XpackConan(ConanFile): name = "xpack" description = "C++ reflection, ability to convert between C++ structures and json/xml." - topics = ("xpack", "json", "reflection", "xml") + license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/xyz347/xpack" - license = "Apache-2.0" + topics = ("json", "bson", "reflection", "xml", "header-only") + settings = "os", "arch", "compiler", "build_type" no_copy_source = True @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return 11 + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") + + def requirements(self): + self.requires("rapidjson/cci.20220822", transitive_headers=True) + self.requires("rapidxml/1.13", transitive_headers=True) + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + apply_conandata_patches(self) def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - self.copy(pattern="*[.h|.hpp]", dst=os.path.join("include", "xpack"), excludes=["example/*", "gtest/*"], src=self._source_subfolder) + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include", "xpack"), + src=self.source_folder, + excludes=["example", "gtest", "thirdparty"], + ) - def package_id(self): - self.info.header_only() + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/xpack/all/patches/1.0.2-0001-use-cci.patch b/recipes/xpack/all/patches/1.0.2-0001-use-cci.patch new file mode 100644 index 0000000000000..74dacc942ce60 --- /dev/null +++ b/recipes/xpack/all/patches/1.0.2-0001-use-cci.patch @@ -0,0 +1,43 @@ +diff --git a/a/json_decoder.h b/b/json_decoder.h +index 6d5e50c..e66fe8c 100755 +--- a/a/json_decoder.h ++++ b/b/json_decoder.h +@@ -20,8 +20,8 @@ + #include + + #include "rapidjson_custom.h" +-#include "thirdparty/rapidjson/document.h" +-#include "thirdparty/rapidjson/error/en.h" ++#include "rapidjson/document.h" ++#include "rapidjson/error/en.h" + + #include "xdecoder.h" + +diff --git a/a/json_encoder.h b/b/json_encoder.h +index 442d9e0..2be9323 100755 +--- a/a/json_encoder.h ++++ b/b/json_encoder.h +@@ -20,8 +20,8 @@ + #include + + #include "rapidjson_custom.h" +-#include "thirdparty/rapidjson/prettywriter.h" +-#include "thirdparty/rapidjson/stringbuffer.h" ++#include "rapidjson/prettywriter.h" ++#include "rapidjson/stringbuffer.h" + + #include "xencoder.h" + +diff --git a/a/xml_decoder.h b/b/xml_decoder.h +index d9cb4bb..91530ba 100755 +--- a/a/xml_decoder.h ++++ b/b/xml_decoder.h +@@ -24,7 +24,7 @@ + #include + #include + +-#include "thirdparty/rapidxml/rapidxml.hpp" ++#include "rapidxml/rapidxml.hpp" + + #include "xdecoder.h" + diff --git a/recipes/xpack/all/test_package/CMakeLists.txt b/recipes/xpack/all/test_package/CMakeLists.txt index 1e9f89773e52e..64e85764dcebb 100644 --- a/recipes/xpack/all/test_package/CMakeLists.txt +++ b/recipes/xpack/all/test_package/CMakeLists.txt @@ -1,10 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(xpack CONFIG REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} xpack::xpack) +target_link_libraries(${PROJECT_NAME} PRIVATE xpack::xpack) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/xpack/all/test_package/conanfile.py b/recipes/xpack/all/test_package/conanfile.py index 49a3a66ea5bad..b9d7f11e89dcd 100644 --- a/recipes/xpack/all/test_package/conanfile.py +++ b/recipes/xpack/all/test_package/conanfile.py @@ -1,10 +1,18 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +20,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xpack/all/test_v1_package/CMakeLists.txt b/recipes/xpack/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/xpack/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/xpack/all/test_v1_package/conanfile.py b/recipes/xpack/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/xpack/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xpack/config.yml b/recipes/xpack/config.yml index 732f7eb9a62dd..7ae7c5d038959 100644 --- a/recipes/xpack/config.yml +++ b/recipes/xpack/config.yml @@ -1,3 +1,7 @@ versions: + "1.0.4": + folder: "all" + "1.0.3": + folder: "all" "1.0.2": folder: "all" diff --git a/recipes/xproperty/all/conanfile.py b/recipes/xproperty/all/conanfile.py index 4eb06511f769a..f3db566cfff6d 100644 --- a/recipes/xproperty/all/conanfile.py +++ b/recipes/xproperty/all/conanfile.py @@ -1,66 +1,72 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get, save +from conan.tools.layout import basic_layout import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class XpropertyConan(ConanFile): name = "xproperty" description = "Traitlets-like C++ properties and implementation of the observer pattern." license = "BSD-3-Clause" - topics = ("xproperty", "observer", "traitlets") + topics = ("observer", "traitlets") homepage = "https://github.com/jupyter-xeus/xproperty" url = "https://github.com/conan-io/conan-center-index" no_copy_source = True settings = "os", "arch", "compiler", "build_type" - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("xtl/0.7.4") + self.requires("xtl/0.7.4", transitive_headers=True, transitive_libs=True) + + def package_id(self): + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 14) - - def package_id(self): - self.info.header_only() + check_min_cppstd(self, 14) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "include")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), {"xproperty": "xproperty::xproperty"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "xproperty") self.cpp_info.set_property("cmake_target_name", "xproperty") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] diff --git a/recipes/xproperty/all/test_package/CMakeLists.txt b/recipes/xproperty/all/test_package/CMakeLists.txt index f01f0f02aa1d4..5115f7961f51a 100644 --- a/recipes/xproperty/all/test_package/CMakeLists.txt +++ b/recipes/xproperty/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(xproperty REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} xproperty) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14) +target_link_libraries(${PROJECT_NAME} PRIVATE xproperty) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/xproperty/all/test_package/conanfile.py b/recipes/xproperty/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/xproperty/all/test_package/conanfile.py +++ b/recipes/xproperty/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xproperty/all/test_v1_package/CMakeLists.txt b/recipes/xproperty/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/xproperty/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/xproperty/all/test_v1_package/conanfile.py b/recipes/xproperty/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/xproperty/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xqilla/all/conandata.yml b/recipes/xqilla/all/conandata.yml index 334c38a5ea59d..b20a5f6960ca0 100644 --- a/recipes/xqilla/all/conandata.yml +++ b/recipes/xqilla/all/conandata.yml @@ -2,4 +2,8 @@ sources: "2.3.4": url: "https://sourceforge.net/projects/xqilla/files/XQilla-2.3.4.tar.gz" sha256: "292631791631fe2e7eb9727377335063a48f12611d641d0296697e0c075902eb" - +patches: + "2.3.4": + - patch_file: "patches/0001-honor-deps-ldflags.patch" + patch_description: "Honor LDFLAGS from dependencies" + patch_type: "conan" diff --git a/recipes/xqilla/all/conanfile.py b/recipes/xqilla/all/conanfile.py index 5c32875b534ea..94f360d94a83b 100644 --- a/recipes/xqilla/all/conanfile.py +++ b/recipes/xqilla/all/conanfile.py @@ -1,23 +1,29 @@ -from conans import AutoToolsBuildEnvironment, ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import check_min_cppstd, cross_building, valid_min_cppstd +from conan.tools.env import VirtualBuildEnv, VirtualRunEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, load, rename, rm, save +from conan.tools.gnu import Autotools, AutotoolsDeps, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, unix_path import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.53.0" -class ConanXqilla(ConanFile): +class XqillaConan(ConanFile): name = "xqilla" - description = ( - "XQilla is an XQuery and XPath 2 library and command line utility written in C++, implemented on top of the Xerces-C library" + "XQilla is an XQuery and XPath 2 library and command line utility " + "written in C++, implemented on top of the Xerces-C library" ) - topics = ("xqilla", "xml", "xquery") + topics = ("xml", "xquery") url = "https://github.com/conan-io/conan-center-index" homepage = "http://xqilla.sourceforge.net/HomePage" license = "Apache-2.0" - settings = "os", "arch", "compiler", "build_type" + settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], "fPIC": [True, False], @@ -27,97 +33,105 @@ class ConanXqilla(ConanFile): "fPIC": True, } - exports_sources = "patches/**" - _autotools = None - @property - def _source_subfolder(self): - return "source_subfolder" - - def requirements(self): - self.requires("xerces-c/3.2.3") + def _min_cppstd(self): + return "11" @property - def _doc_folder(self): - return os.path.join( - self._source_subfolder, - "doc" - ) + def _settings_build(self): + return getattr(self, "settings_build", self.settings) - def validate(self): - if self.settings.os != "Linux": - raise ConanInvalidConfiguration("The xqilla recipe currently only supports Linux.") - if self.settings.compiler.cppstd: - tools.check_min_cppstd(self, 11) + def export_sources(self): + export_conandata_patches(self) - def build_requirements(self): - self.build_requires("gnu-config/cci.20210814") + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") - def source(self): - tools.get(**self.conan_data["sources"][self.version], strip_root=True, - destination=self._source_subfolder) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self) - conf_args = [ - "--with-xerces={}".format(tools.unix_path(self.deps_cpp_info["xerces-c"].rootpath)), - ] - - if not self.settings.compiler.cppstd: - self._autotools.cppstd_flag = "-std=c++11" + def layout(self): + basic_layout(self, src_folder="src") - if self.options.shared: - conf_args.extend(["--enable-shared", "--disable-static"]) - else: - conf_args.extend(["--disable-shared", "--enable-static"]) + def requirements(self): + self.requires("xerces-c/3.2.3") - if self.options.get_safe("fPIC", True): - conf_args.extend(["--with-pic"]) + def validate(self): + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + if is_msvc(self): + raise ConanInvalidConfiguration("xqilla recipe doesn't support msvc build yet") - self._autotools.configure(configure_dir=self._source_subfolder, args=conf_args) - return self._autotools + def build_requirements(self): + self.tool_requires("gnu-config/cci.20210814") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") - @property - def _user_info_build(self): - return getattr(self, "user_info_build", self.deps_user_info) + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + env = VirtualBuildEnv(self) + env.generate() + if not cross_building(self): + env = VirtualRunEnv(self) + env.generate(scope="build") + + tc = AutotoolsToolchain(self) + tc.configure_args.append(f"--with-xerces={unix_path(self, self.dependencies['xerces-c'].package_folder)}") + if not valid_min_cppstd(self, self._min_cppstd): + tc.extra_cxxflags.append(f"-std=c++{self._min_cppstd}") + tc.generate() + + deps = AutotoolsDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + for gnu_config in [ + self.conf.get("user.gnu-config:config_guess", check_type=str), + self.conf.get("user.gnu-config:config_sub", check_type=str), + ]: + if gnu_config: + copy(self, os.path.basename(gnu_config), + src=os.path.dirname(gnu_config), + dst=os.path.join(self.source_folder, "autotools")) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_SUB, - os.path.join(self._source_subfolder, "autotools","config.sub")) - shutil.copy(self._user_info_build["gnu-config"].CONFIG_GUESS, - os.path.join(self._source_subfolder, "autotools","config.guess")) - autotools = self._configure_autotools() + self._patch_sources() + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() autotools.make() + def _extract_yajl_license(self): + tmp = load(self, os.path.join(self.source_folder, "src", "yajl", "yajl_buf.h")) + return tmp[2:tmp.find("*/", 1)] + def package(self): - autotools = self._configure_autotools() - autotools.install() - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("README", dst="licenses/LICENSE.mapm", src=os.path.join(self._source_subfolder, "src", "mapm")) - - tmp = tools.load(os.path.join(self._source_subfolder, "src", "yajl", "yajl_buf.h")) - license_contents = tmp[2:tmp.find("*/", 1)] - tools.save("LICENSE", license_contents) - self.copy("LICENSE", dst="licenses/LICENSE.yajl", ignore_case=True, keep_path=False) - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - tools.rmdir(os.path.join(self.package_folder, "share")) - + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "README", src=os.path.join(self.source_folder, "src", "mapm"), + dst=os.path.join(self.package_folder, "licenses")) + rename(self, os.path.join(self.package_folder, "licenses", "README"), + os.path.join(self.package_folder, "licenses", "LICENSE.mapm")) + save(self, os.path.join(self.package_folder, "licenses", "LICENSE.yajl"), self._extract_yajl_license()) + + autotools = Autotools(self) + # TODO: replace by autotools.install() once https://github.com/conan-io/conan/issues/12153 fixed + autotools.install(args=[f"DESTDIR={unix_path(self, self.package_folder)}"]) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) + def package_info(self): - self.cpp_info.names["pkg_config"] = "libxqilla" - self.cpp_info.libs = tools.collect_libs(self) - if self.settings.os == "Linux": + self.cpp_info.libs = ["xqilla"] + if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.path.append(bin_path) + # TODO: to remove in conan v2 + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/xqilla/all/patches/0001-honor-deps-ldflags.patch b/recipes/xqilla/all/patches/0001-honor-deps-ldflags.patch new file mode 100644 index 0000000000000..77822de6fa0c7 --- /dev/null +++ b/recipes/xqilla/all/patches/0001-honor-deps-ldflags.patch @@ -0,0 +1,11 @@ +--- a/Makefile.am ++++ b/Makefile.am +@@ -2,7 +2,7 @@ AUTOMAKE_OPTIONS = foreign dist-zip + SUBDIRS = include + + INCLUDES = -I$(top_srcdir)/include/ $(xerces_include) -I$(top_srcdir)/src/lexer/ $(faxpp_include) $(tidy_include) +-LDFLAGS = -L$(xerces_lib) -R$(xerces_lib) $(faxpp_lib) $(tidy_lib) -lxerces-c $(faxpp_library) $(tidy_library) ++LDFLAGS += -L$(xerces_lib) -R$(xerces_lib) $(faxpp_lib) $(tidy_lib) $(faxpp_library) $(tidy_library) + LDADD = libxqilla.la + ACLOCAL_AMFLAGS = -I autotools/m4 + diff --git a/recipes/xqilla/all/test_package/CMakeLists.txt b/recipes/xqilla/all/test_package/CMakeLists.txt index 2945fa8a028b3..689d0b9e4eff3 100644 --- a/recipes/xqilla/all/test_package/CMakeLists.txt +++ b/recipes/xqilla/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(xqilla REQUIRED) +find_package(xqilla REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} xqilla::xqilla) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE xqilla::xqilla) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/xqilla/all/test_package/conanfile.py b/recipes/xqilla/all/test_package/conanfile.py index 6e29cdae9a48f..0276f2c2a7ffa 100644 --- a/recipes/xqilla/all/test_package/conanfile.py +++ b/recipes/xqilla/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,7 +21,7 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run("xqilla -h", run_environment=True) - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + self.run("xqilla -h", env="conanrun") + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xqilla/all/test_v1_package/CMakeLists.txt b/recipes/xqilla/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/xqilla/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xqilla/all/test_v1_package/conanfile.py b/recipes/xqilla/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..6e29cdae9a48f --- /dev/null +++ b/recipes/xqilla/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + self.run("xqilla -h", run_environment=True) + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xsimd/all/conandata.yml b/recipes/xsimd/all/conandata.yml index e6b7679e66c7c..2ed7aecb5b128 100644 --- a/recipes/xsimd/all/conandata.yml +++ b/recipes/xsimd/all/conandata.yml @@ -1,4 +1,10 @@ sources: + "10.0.0": + url: "https://github.com/xtensor-stack/xsimd/archive/10.0.0.tar.gz" + sha256: "73f818368b3a4dad92fab1b2933d93694241bd2365a6181747b2df1768f6afdd" + "9.0.1": + url: "https://github.com/xtensor-stack/xsimd/archive/9.0.1.tar.gz" + sha256: "b1bb5f92167fd3a4f25749db0be7e61ed37e0a5d943490f3accdcd2cd2918cc0" "8.1.0": url: "https://github.com/xtensor-stack/xsimd/archive/8.1.0.tar.gz" sha256: "d52551360d37709675237d2a0418e28f70995b5b7cdad7c674626bcfbbf48328" @@ -14,18 +20,3 @@ sources: "7.4.10": url: "https://github.com/xtensor-stack/xsimd/archive/7.4.10.tar.gz" sha256: "df00f476dea0c52ffebad60924e3f0db2a016b80d508f8d5a2399a74c0d134cd" - "7.4.9": - url: "https://github.com/xtensor-stack/xsimd/archive/7.4.9.tar.gz" - sha256: "f6601ffb002864ec0dc6013efd9f7a72d756418857c2d893be0644a2f041874e" - "7.4.8": - sha256: 318676faae48d2082440df9f161a95303a3f29c3f0b03ff32ca24063b12f5699 - url: https://github.com/xtensor-stack/xsimd/archive/7.4.8.tar.gz - "7.4.6": - sha256: 0e70411a9fff76ac17c6ef642465d4f0d1f29d3f3a70e5ece4cfc522bd4fcd0b - url: https://github.com/xtensor-stack/xsimd/archive/7.4.6.tar.gz - "7.4.5": - sha256: 854c0506fb6f0c90a98b30a9407af1d06870338d6c7e63d21ddbbf8b7ce1dd42 - url: https://github.com/xtensor-stack/xsimd/archive/7.4.5.tar.gz - "7.4.4": - sha256: a60d49f638b68117ae5aea73cf2d5586f4afda4de2435962de4310b11214de6a - url: https://github.com/xtensor-stack/xsimd/archive/7.4.4.tar.gz diff --git a/recipes/xsimd/all/conanfile.py b/recipes/xsimd/all/conanfile.py index 611414ef7b0c5..704d20b0065db 100644 --- a/recipes/xsimd/all/conanfile.py +++ b/recipes/xsimd/all/conanfile.py @@ -3,6 +3,7 @@ from conan.tools.files import copy, get, save from conan.tools.layout import basic_layout from conan.tools.scm import Version +from conan.tools.apple import is_apple_os import os import textwrap @@ -83,6 +84,11 @@ def package_info(self): self.cpp_info.libdirs = [] self.cpp_info.resdirs = [] + ## TODO: workaround for arm compilation issue : https://github.com/xtensor-stack/xsimd/issues/735 + if Version(self.version) >= "9.0.0" and \ + is_apple_os(self) and self.settings.arch in ["armv8", "armv8_32", "armv8.3"]: + self.cpp_info.cxxflags.extend(["-flax-vector-conversions", "-fsigned-char",]) + # TODO: to remove in conan v2 once cmake_find_package* generators removed self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] diff --git a/recipes/xsimd/all/test_package/test_package.cpp b/recipes/xsimd/all/test_package/test_package.cpp index 6db0f1a3e4d36..be0d55dea1818 100644 --- a/recipes/xsimd/all/test_package/test_package.cpp +++ b/recipes/xsimd/all/test_package/test_package.cpp @@ -3,13 +3,22 @@ namespace xs = xsimd; +#if XSIMD_VERSION_MAJOR >= 9 && (XSIMD_WITH_NEON64 || XSIMD_WITH_NEON) +using number_type = float; +#else +using number_type = double; +#endif + int main(int argc, char *argv[]) { #if XSIMD_VERSION_MAJOR < 8 - xs::batch a(1.5, 2.5, 3.5, 4.5); - xs::batch b(2.5, 3.5, 4.5, 5.5); + xs::batch a(1.5, 2.5, 3.5, 4.5); + xs::batch b(2.5, 3.5, 4.5, 5.5); +#elif XSIMD_VERSION_MAJOR < 9 + xs::batch a({1.5, 2.5, 3.5, 4.5}); + xs::batch b({2.5, 3.5, 4.5, 5.5}); #else - xs::batch a({1.5, 2.5, 3.5, 4.5}); - xs::batch b({2.5, 3.5, 4.5, 5.5}); + xs::batch a{1.5, 2.5, 3.5, 4.5}; + xs::batch b{2.5, 3.5, 4.5, 5.5}; #endif auto mean = (a + b) / 2; diff --git a/recipes/xsimd/all/test_v1_package/conanfile.py b/recipes/xsimd/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/xsimd/all/test_v1_package/conanfile.py +++ b/recipes/xsimd/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/xsimd/config.yml b/recipes/xsimd/config.yml index 15049fc2e83d7..87c79dc95d5ef 100644 --- a/recipes/xsimd/config.yml +++ b/recipes/xsimd/config.yml @@ -1,4 +1,8 @@ versions: + "10.0.0": + folder: all + "9.0.1": + folder: all "8.1.0": folder: all "8.0.5": @@ -9,13 +13,3 @@ versions: folder: all "7.4.10": folder: all - "7.4.9": - folder: all - "7.4.8": - folder: all - "7.4.6": - folder: all - "7.4.5": - folder: all - "7.4.4": - folder: all diff --git a/recipes/xtensor/all/conandata.yml b/recipes/xtensor/all/conandata.yml index 99f4ce4af7773..40af805ba9e93 100644 --- a/recipes/xtensor/all/conandata.yml +++ b/recipes/xtensor/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.24.3": + url: "https://github.com/xtensor-stack/xtensor/archive/0.24.3.tar.gz" + sha256: "3acde856b9fb8cf4e2a7b66726da541275d40ab9b002e618ad985ab97f08ca4f" "0.24.2": url: "https://github.com/xtensor-stack/xtensor/archive/0.24.2.tar.gz" sha256: "790d9e449add817154177157a850b9afd0260dc0f9df857d8b3a38886a10ef8b" @@ -9,36 +12,48 @@ sources: url: "https://github.com/xtensor-stack/xtensor/archive/0.23.10.tar.gz" sha256: "2e770a6d636962eedc868fef4930b919e26efe783cd5d8732c11e14cf72d871c" "0.23.9": - sha256: 5bdb9d85ee82c60be0bce32d891b5cc20eb633284a0aabb907f55bbe722cc8e3 - url: https://github.com/xtensor-stack/xtensor/archive/refs/tags/0.23.9.tar.gz + url: "https://github.com/xtensor-stack/xtensor/archive/0.23.9.tar.gz" + sha256: "5bdb9d85ee82c60be0bce32d891b5cc20eb633284a0aabb907f55bbe722cc8e3" "0.21.5": - sha256: 30cb896b6686683ddaefb12c98bf1109fdfe666136dd027aba1a1e9aa825c241 - url: https://github.com/xtensor-stack/xtensor/archive/0.21.5.tar.gz + url: "https://github.com/xtensor-stack/xtensor/archive/0.21.5.tar.gz" + sha256: "30cb896b6686683ddaefb12c98bf1109fdfe666136dd027aba1a1e9aa825c241" "0.21.4": - sha256: 143ef2536f1671e1c7c7834de4a040f1694112e23222fcd2ae59b0f5e5124b57 - url: https://github.com/xtensor-stack/xtensor/archive/0.21.4.tar.gz + url: "https://github.com/xtensor-stack/xtensor/archive/0.21.4.tar.gz" + sha256: "143ef2536f1671e1c7c7834de4a040f1694112e23222fcd2ae59b0f5e5124b57" "0.21.3": - sha256: f63c25cafea4bfc268edb26e6f5004a28a2f689e6a852bb3559c553106c8d6bf - url: https://github.com/xtensor-stack/xtensor/archive/0.21.3.tar.gz + url: "https://github.com/xtensor-stack/xtensor/archive/0.21.3.tar.gz" + sha256: "f63c25cafea4bfc268edb26e6f5004a28a2f689e6a852bb3559c553106c8d6bf" "0.21.2": - sha256: a32490bc8499f59f8e30c288e178ff41c9511cf4959dc59c9628b29b77049a4a - url: https://github.com/xtensor-stack/xtensor/archive/0.21.2.tar.gz + url: "https://github.com/xtensor-stack/xtensor/archive/0.21.2.tar.gz" + sha256: "a32490bc8499f59f8e30c288e178ff41c9511cf4959dc59c9628b29b77049a4a" patches: "0.24.2": - patch_file: "patches/0.24.0-cxx11-abi.patch" - base_path: "source_subfolder" + patch_description: "has_trivial_default_constructor has been removed from libstdc++ since version 7" + patch_type: "bugfix" + patch_source: "https://github.com/xtensor-stack/xtensor/pull/2459" "0.24.0": - patch_file: "patches/0.24.0-cxx11-abi.patch" - base_path: "source_subfolder" + patch_description: "has_trivial_default_constructor has been removed from libstdc++ since version 7" + patch_type: "bugfix" + patch_source: "https://github.com/xtensor-stack/xtensor/pull/2459" "0.23.10": - patch_file: "patches/0.23.9-cxx11-abi.patch" - base_path: "source_subfolder" + patch_description: "has_trivial_default_constructor has been removed from libstdc++ since version 7" + patch_type: "bugfix" + patch_source: "https://github.com/xtensor-stack/xtensor/pull/2459" "0.23.9": - patch_file: "patches/0.23.9-cxx11-abi.patch" - base_path: "source_subfolder" + patch_description: "has_trivial_default_constructor has been removed from libstdc++ since version 7" + patch_type: "bugfix" + patch_source: "https://github.com/xtensor-stack/xtensor/pull/2459" "0.21.5": - patch_file: "patches/0.21.5-cxx11-abi.patch" - base_path: "source_subfolder" + patch_description: "has_trivial_default_constructor has been removed from libstdc++ since version 7" + patch_type: "bugfix" + patch_source: "https://github.com/xtensor-stack/xtensor/pull/2459" "0.21.4": - patch_file: "patches/0.21.4-cxx11-abi.patch" - base_path: "source_subfolder" + patch_description: "has_trivial_default_constructor has been removed from libstdc++ since version 7" + patch_type: "bugfix" + patch_source: "https://github.com/xtensor-stack/xtensor/pull/2459" diff --git a/recipes/xtensor/all/conanfile.py b/recipes/xtensor/all/conanfile.py index baa6ad0bc0c84..9a77cdf6361a6 100644 --- a/recipes/xtensor/all/conanfile.py +++ b/recipes/xtensor/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, save +from conan.tools.layout import basic_layout +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class XtensorConan(ConanFile): @@ -26,23 +30,38 @@ class XtensorConan(ConanFile): } @property - def _source_subfolder(self): - return "source_subfolder" + def _min_cppstd(self): + return "14" + + @property + def _compilers_minimum_version(self): + # https://github.com/xtensor-stack/xtensor/blob/master/README.md + return { + "Visual Studio": "14", + "msvc": "190", + "gcc": "4.9", + "clang": "4", + } def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) + + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("xtl/0.7.4") - self.requires("nlohmann_json/3.10.5") + self.requires("xtl/0.7.5") + self.requires("nlohmann_json/3.11.2") if self.options.xsimd: - if tools.Version(self.version) < "0.24.0": + if Version(self.version) < "0.24.0": self.requires("xsimd/7.5.0") else: - self.requires("xsimd/8.1.0") + self.requires("xsimd/10.0.0") if self.options.tbb: - self.requires("onetbb/2021.3.0") + self.requires("onetbb/2021.7.0") + + def package_id(self): + self.info.clear() def validate(self): if self.options.tbb and self.options.openmp: @@ -50,36 +69,31 @@ def validate(self): "The options 'tbb' and 'openmp' can not be used together." ) - # https://github.com/xtensor-stack/xtensor/blob/master/README.md - # - On Windows platforms, Visual C++ 2015 Update 2, or more recent - # - On Unix platforms, gcc 4.9 or a recent version of Clang - version = tools.Version(self.settings.compiler.version) - compiler = self.settings.compiler - if compiler == "Visual Studio" and version < "16": + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): raise ConanInvalidConfiguration( - "xtensor requires at least Visual Studio version 15.9, please use 16" + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", ) - if (compiler == "gcc" and version < "5.0") or ( - compiler == "clang" and version < "4" - ): - raise ConanInvalidConfiguration("xtensor requires at least C++14") - - def package_id(self): - self.info.header_only() def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy( - "*.hpp", dst="include", src=os.path.join(self._source_subfolder, "include") - ) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*.hpp", src=os.path.join(self.source_folder, "include"), dst=os.path.join(self.package_folder, "include")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( @@ -87,26 +101,27 @@ def package(self): {"xtensor": "xtensor::xtensor"} ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") def package_info(self): self.cpp_info.set_property("cmake_file_name", "xtensor") self.cpp_info.set_property("cmake_target_name", "xtensor") self.cpp_info.set_property("pkg_config_name", "xtensor") + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] if self.options.xsimd: self.cpp_info.defines.append("XTENSOR_USE_XSIMD") if self.options.tbb: diff --git a/recipes/xtensor/all/test_package/CMakeLists.txt b/recipes/xtensor/all/test_package/CMakeLists.txt index 0e4d9800858f9..ed456ebb1ccdb 100644 --- a/recipes/xtensor/all/test_package/CMakeLists.txt +++ b/recipes/xtensor/all/test_package/CMakeLists.txt @@ -1,15 +1,12 @@ cmake_minimum_required(VERSION 3.8) -project(test_package CXX) +project(test_package LANGUAGES CXX) include(CheckCXXCompilerFlag) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(xtensor REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} xtensor) +target_link_libraries(${PROJECT_NAME} PRIVATE xtensor) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) foreach(flag "-march=native" "-mtune=native") diff --git a/recipes/xtensor/all/test_package/conanfile.py b/recipes/xtensor/all/test_package/conanfile.py index 8ac27b308f404..0a6bc68712d90 100644 --- a/recipes/xtensor/all/test_package/conanfile.py +++ b/recipes/xtensor/all/test_package/conanfile.py @@ -1,11 +1,19 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os -from conans import ConanFile, CMake, tools - -class XtensorTestConan(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -13,5 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - self.run(os.path.join("bin", "test_package"), run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xtensor/all/test_v1_package/CMakeLists.txt b/recipes/xtensor/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/xtensor/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xtensor/all/test_v1_package/conanfile.py b/recipes/xtensor/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/xtensor/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xtensor/config.yml b/recipes/xtensor/config.yml index 6237bf2c3ae5d..0077748f19ef0 100644 --- a/recipes/xtensor/config.yml +++ b/recipes/xtensor/config.yml @@ -1,4 +1,6 @@ versions: + "0.24.3": + folder: all "0.24.2": folder: all "0.24.0": diff --git a/recipes/xtl/all/conandata.yml b/recipes/xtl/all/conandata.yml index a693f0bb41b3b..826f7d639e616 100644 --- a/recipes/xtl/all/conandata.yml +++ b/recipes/xtl/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.7.5": + url: "https://github.com/xtensor-stack/xtl/archive/0.7.5.tar.gz" + sha256: "3286fef5fee5d58f82f7b91375cd449c819848584bae9367893501114d923cbe" "0.7.4": url: "https://github.com/xtensor-stack/xtl/archive/0.7.4.tar.gz" sha256: "3c88be0e696b64150c4de7a70f9f09c00a335186b0b0b409771ef9f56bca7d9a" @@ -9,17 +12,17 @@ sources: url: "https://github.com/xtensor-stack/xtl/archive/0.7.2.tar.gz" sha256: "95c221bdc6eaba592878090916383e5b9390a076828552256693d5d97f78357c" "0.6.21": - sha256: 97137014fa5da2a3598a267d06c8e28490b2e1c75b8f52358738bedb526fc771 - url: https://github.com/xtensor-stack/xtl/archive/0.6.21.tar.gz + url: "https://github.com/xtensor-stack/xtl/archive/0.6.21.tar.gz" + sha256: "97137014fa5da2a3598a267d06c8e28490b2e1c75b8f52358738bedb526fc771" "0.6.12": - sha256: 25a16958195f939e6fb7c8feccad89b3e450a18124be6aee119c69a1ee2b308c - url: https://github.com/xtensor-stack/xtl/archive/0.6.12.tar.gz + url: "https://github.com/xtensor-stack/xtl/archive/0.6.12.tar.gz" + sha256: "25a16958195f939e6fb7c8feccad89b3e450a18124be6aee119c69a1ee2b308c" "0.6.11": - sha256: e3cb622def174b76547c29ce0d63ae1407ed19fcbbd233913613e9859568eadd - url: https://github.com/xtensor-stack/xtl/archive/0.6.11.tar.gz + url: "https://github.com/xtensor-stack/xtl/archive/0.6.11.tar.gz" + sha256: "e3cb622def174b76547c29ce0d63ae1407ed19fcbbd233913613e9859568eadd" "0.6.10": - sha256: 9de012e06a6c24561b2c50cf7650cb32ffcf2c22f73b0314deeba9c775e5036f - url: https://github.com/xtensor-stack/xtl/archive/0.6.10.tar.gz + url: "https://github.com/xtensor-stack/xtl/archive/0.6.10.tar.gz" + sha256: "9de012e06a6c24561b2c50cf7650cb32ffcf2c22f73b0314deeba9c775e5036f" "0.6.9": - sha256: c348fcf53dd2b355d143ad28e77f1ede7e1d5e6a196d2d5b9c478b1c005dedd0 - url: https://github.com/xtensor-stack/xtl/archive/0.6.9.tar.gz + url: "https://github.com/xtensor-stack/xtl/archive/0.6.9.tar.gz" + sha256: "c348fcf53dd2b355d143ad28e77f1ede7e1d5e6a196d2d5b9c478b1c005dedd0" diff --git a/recipes/xtl/all/test_v1_package/CMakeLists.txt b/recipes/xtl/all/test_v1_package/CMakeLists.txt index cd3b1fffc1de0..be00a8c7f57c7 100644 --- a/recipes/xtl/all/test_v1_package/CMakeLists.txt +++ b/recipes/xtl/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(xtl REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE xtl) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/xtl/config.yml b/recipes/xtl/config.yml index bd4da1e91c4d3..eb054d979da83 100644 --- a/recipes/xtl/config.yml +++ b/recipes/xtl/config.yml @@ -1,4 +1,6 @@ versions: + "0.7.5": + folder: all "0.7.4": folder: all "0.7.3": diff --git a/recipes/xtrans/all/conanfile.py b/recipes/xtrans/all/conanfile.py new file mode 100644 index 0000000000000..a420c87bd7d01 --- /dev/null +++ b/recipes/xtrans/all/conanfile.py @@ -0,0 +1,51 @@ +from conan import ConanFile +from conan.tools.gnu import PkgConfig +from conan.tools.system import package_manager +from conan.errors import ConanInvalidConfiguration + +required_conan_version = ">=1.47" + + +class XtransConan(ConanFile): + name = "xtrans" + url = "https://github.com/conan-io/conan-center-index" + license = "MIT" + homepage = "https://www.x.org/wiki/" + description = "X Network Transport layer shared code" + settings = "os", "compiler", "build_type" # no arch here, because the xtrans system package is arch independant + topics = ("x11", "xorg") + + def validate(self): + if self.settings.os not in ["Linux", "FreeBSD"]: + raise ConanInvalidConfiguration("This recipe supports only Linux and FreeBSD") + + def package_id(self): + self.info.header_only() + + def system_requirements(self): + apt = package_manager.Apt(self) + apt.install(["xtrans-dev"], update=True, check=True) + + yum = package_manager.Yum(self) + yum.install(["xorg-x11-xtrans-devel"], update=True, check=True) + + dnf = package_manager.Dnf(self) + dnf.install(["xorg-x11-xtrans-devel"], update=True, check=True) + + zypper = package_manager.Zypper(self) + zypper.install(["xtrans"], update=True, check=True) + + pacman = package_manager.PacMan(self) + pacman.install(["xtrans"], update=True, check=True) + + package_manager.Pkg(self).install(["xtrans"], update=True, check=True) + + def package_info(self): + pkg_config = PkgConfig(self, "xtrans") + pkg_config.fill_cpp_info( + self.cpp_info, is_system=self.settings.os != "FreeBSD") + self.cpp_info.version = pkg_config.version + self.cpp_info.set_property("pkg_config_name", "xtrans") + self.cpp_info.set_property("component_version", pkg_config.version) + self.cpp_info.set_property("pkg_config_custom_content", + "\n".join(f"{key}={value}" for key, value in pkg_config.variables.items() if key not in ["pcfiledir","prefix", "includedir"])) diff --git a/recipes/xtrans/all/test_package/conanfile.py b/recipes/xtrans/all/test_package/conanfile.py new file mode 100644 index 0000000000000..1b04b27a310a7 --- /dev/null +++ b/recipes/xtrans/all/test_package/conanfile.py @@ -0,0 +1,25 @@ +from conan import ConanFile +from conan.tools.gnu import PkgConfigDeps +from conan.tools.layout import basic_layout + + +class TestPackageConan(ConanFile): + settings = "os", "compiler", "build_type", "arch" + test_type = "explicit" + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + basic_layout(self) + + def generate(self): + pkg_config_deps = PkgConfigDeps(self) + pkg_config_deps.generate() + + def build(self): + pass + + def test(self): + pkg_config = self.conf_info.get("tools.gnu:pkg_config", default="pkg-config") + self.run(f"{pkg_config} --validate xtrans") diff --git a/recipes/xtrans/all/test_v1_package/conanfile.py b/recipes/xtrans/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..c20eb932e465e --- /dev/null +++ b/recipes/xtrans/all/test_v1_package/conanfile.py @@ -0,0 +1,13 @@ +from conans import ConanFile +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "pkg_config" + + def build(self): + pass + + def test(self): + self.run("pkg-config --validate ./xtrans.pc") diff --git a/recipes/xtrans/config.yml b/recipes/xtrans/config.yml new file mode 100644 index 0000000000000..76a338dd54cee --- /dev/null +++ b/recipes/xtrans/config.yml @@ -0,0 +1,3 @@ +versions: + "system": + folder: "all" diff --git a/recipes/xxhash/all/conandata.yml b/recipes/xxhash/all/conandata.yml index e7a7396a165a6..a0b4d68deb6b4 100644 --- a/recipes/xxhash/all/conandata.yml +++ b/recipes/xxhash/all/conandata.yml @@ -8,3 +8,10 @@ sources: patches: "0.8.1": - patch_file: "patches/0.8.1-fix-cmakelists.patch" + patch_description: "Update CMakeLists.txt to properly install manuals" + patch_type: conan + + - patch_file: "patches/0.8.1-fix-static-assert-link-error.patch" + patch_source: "https://github.com/Cyan4973/xxHash/commit/6189ecd3d44a693460f86280ccf49d33cb4b18e1" + patch_description: "Backport fix for link error" + patch_type: bugfix diff --git a/recipes/xxhash/all/conanfile.py b/recipes/xxhash/all/conanfile.py index 642c5d834888f..7ce90e1beb92a 100644 --- a/recipes/xxhash/all/conanfile.py +++ b/recipes/xxhash/all/conanfile.py @@ -1,9 +1,9 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class XxHashConan(ConanFile): @@ -27,8 +27,7 @@ class XxHashConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -36,15 +35,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") @@ -84,11 +77,6 @@ def package_info(self): # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed self.cpp_info.components["libxxhash"].libs = ["xxhash"] - if self.options.utility: - bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) - self.env_info.PATH.append(bin_path) - # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.names["cmake_find_package"] = "xxHash" self.cpp_info.names["cmake_find_package_multi"] = "xxHash" @@ -96,3 +84,5 @@ def package_info(self): self.cpp_info.components["libxxhash"].names["cmake_find_package"] = "xxhash" self.cpp_info.components["libxxhash"].names["cmake_find_package_multi"] = "xxhash" self.cpp_info.components["libxxhash"].set_property("cmake_target_name", "xxHash::xxhash") + if self.options.utility: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) diff --git a/recipes/xxhash/all/patches/0.8.1-fix-static-assert-link-error.patch b/recipes/xxhash/all/patches/0.8.1-fix-static-assert-link-error.patch new file mode 100644 index 0000000000000..82773a37fe366 --- /dev/null +++ b/recipes/xxhash/all/patches/0.8.1-fix-static-assert-link-error.patch @@ -0,0 +1,14 @@ +diff --git a/xxhash.h b/xxhash.h +index 08ab794..511c4d1 100644 +--- a/xxhash.h ++++ b/xxhash.h +@@ -1546,8 +1546,7 @@ static void* XXH_memcpy(void* dest, const void* src, size_t size) + /* note: use after variable declarations */ + #ifndef XXH_STATIC_ASSERT + # if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 201112L) /* C11 */ +-# include +-# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) ++# define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { _Static_assert((c),m); } while(0) + # elif defined(__cplusplus) && (__cplusplus >= 201103L) /* C++11 */ + # define XXH_STATIC_ASSERT_WITH_MESSAGE(c,m) do { static_assert((c),m); } while(0) + # else diff --git a/recipes/xxhash/all/test_package/conanfile.py b/recipes/xxhash/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/xxhash/all/test_package/conanfile.py +++ b/recipes/xxhash/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/xxhash/all/test_v1_package/CMakeLists.txt b/recipes/xxhash/all/test_v1_package/CMakeLists.txt index 8402ba69ce923..0d20897301b68 100644 --- a/recipes/xxhash/all/test_v1_package/CMakeLists.txt +++ b/recipes/xxhash/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(xxHash REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE xxHash::xxhash) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xxhash/all/test_v1_package/conanfile.py b/recipes/xxhash/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/xxhash/all/test_v1_package/conanfile.py +++ b/recipes/xxhash/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/xz_utils/all/conandata.yml b/recipes/xz_utils/all/conandata.yml index c91700d02c91b..ef364b8d89980 100644 --- a/recipes/xz_utils/all/conandata.yml +++ b/recipes/xz_utils/all/conandata.yml @@ -1,7 +1,18 @@ sources: + "5.4.0": + url: "https://tukaani.org/xz/xz-5.4.0.tar.gz" + sha256: "7471ef5991f690268a8f2be019acec2e0564b7b233ca40035f339fe9a07f830b" + "5.2.10": + url: "https://tukaani.org/xz/xz-5.2.10.tar.gz" + sha256: "eb7a3b2623c9d0135da70ca12808a214be9c019132baaa61c9e1d198d1d9ded3" "5.2.5": url: "https://tukaani.org/xz/xz-5.2.5.tar.gz" sha256: "f6f4910fd033078738bd82bfba4f49219d03b17eb0794eb91efbae419f4aba10" "5.2.4": url: "https://tukaani.org/xz/xz-5.2.4.tar.gz" sha256: "b512f3b726d3b37b6dc4c8570e137b9311e7552e8ccbab4d39d47ce5f4177145" +patches: + "5.2.4": + - patch_file: "patches/0001-relax_windows-sdk-restriction.patch" + patch_description: "Relax Windows SDK restriction" + patch_type: "conan" diff --git a/recipes/xz_utils/all/conanfile.py b/recipes/xz_utils/all/conanfile.py index 8358c6924229e..fe3bbefd8b9d0 100644 --- a/recipes/xz_utils/all/conanfile.py +++ b/recipes/xz_utils/all/conanfile.py @@ -1,12 +1,18 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild -from conans.tools import Version +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir, save +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc, is_msvc_static_runtime, MSBuild, MSBuildToolchain +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.54.0" -class XZUtils(ConanFile): +class XZUtilsConan(ConanFile): name = "xz_utils" description = ( "XZ Utils is free general-purpose data compression software with a high " @@ -28,16 +34,6 @@ class XZUtils(ConanFile): "fPIC": True, } - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _is_msvc(self): - return str(self.settings.compiler) in ["Visual Studio", "msvc"] - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) @@ -45,7 +41,18 @@ def _settings_build(self): @property def _effective_msbuild_type(self): # treat "RelWithDebInfo" and "MinSizeRel" as "Release" - return "Debug" if self.settings.build_type == "Debug" else "Release" + # there is no DebugMT configuration in upstream vcxproj, we patch Debug configuration afterwards + return "{}{}".format( + "Debug" if self.settings.build_type == "Debug" else "Release", + "MT" if is_msvc_static_runtime(self) and self.settings.build_type != "Debug" else "", + ) + + @property + def _msbuild_target(self): + return "liblzma_dll" if self.options.shared else "liblzma" + + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -53,134 +60,129 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - del self.settings.compiler.cppstd - del self.settings.compiler.libcxx + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + basic_layout(self, src_folder="src") def build_requirements(self): - if self._settings_build.os == "Windows" and not self._is_msvc and \ - not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + if self._settings_build.os == "Windows" and not is_msvc(self): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _apply_patches(self): - if tools.Version(self.version) == "5.2.4" and self._is_msvc: - # Relax Windows SDK restriction - # Workaround is required only for 5.2.4 because since 5.2.5 WindowsTargetPlatformVersion is dropped from vcproj file - # - # emulate VS2019+ meaning of WindowsTargetPlatformVersion == "10.0" - # undocumented method, but officially recommended workaround by microsoft at at - # https://developercommunity.visualstudio.com/content/problem/140294/windowstargetplatformversion-makes-it-impossible-t.html - windows_target_platform_version_old = "10.0.15063.0" - if self.settings.compiler.version == 15: - windows_target_platform_version_new = "$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))" - else: - windows_target_platform_version_new = "10.0" - tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma.vcxproj"), - windows_target_platform_version_old, - windows_target_platform_version_new) - tools.replace_in_file(os.path.join(self._source_subfolder, "windows", "vs2017", "liblzma_dll.vcxproj"), - windows_target_platform_version_old, - windows_target_platform_version_new) - - # Allow to install relocatable shared lib on macOS - if tools.is_apple_os(self.settings.os): - tools.replace_in_file( - os.path.join(self._source_subfolder, "configure"), - "-install_name \\$rpath/", - "-install_name @rpath/", - ) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + if is_msvc(self): + tc = MSBuildToolchain(self) + tc.configuration = self._effective_msbuild_type + tc.generate() + else: + env = VirtualBuildEnv(self) + env.generate() + tc = AutotoolsToolchain(self) + tc.configure_args.append("--disable-doc") + if self.settings.build_type == "Debug": + tc.configure_args.append("--enable-debug") + tc.generate() + + @property + def _msvc_sln_folder(self): + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler) >= "191"): + return "vs2017" + return "vs2013" def _build_msvc(self): - # windows\INSTALL-MSVC.txt - msvc_version = "vs2017" if Version(self.settings.compiler.version) >= "15" else "vs2013" - with tools.chdir(os.path.join(self._source_subfolder, "windows", msvc_version)): - target = "liblzma_dll" if self.options.shared else "liblzma" - msbuild = MSBuild(self) - msbuild.build( - "xz_win.sln", - targets=[target], - build_type=self._effective_msbuild_type, - platforms={"x86": "Win32", "x86_64": "x64"}, - upgrade_project=Version(self.settings.compiler.version) >= "17") - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - args = ["--disable-doc"] - if self.settings.os != "Windows" and self.options.get_safe("fPIC", True): - args.append("--with-pic") - if self.options.shared: - args.extend(["--disable-static", "--enable-shared"]) + build_script_folder = os.path.join(self.source_folder, "windows", self._msvc_sln_folder) + + #============================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client. + vcxproj_files = [ + os.path.join(build_script_folder, "liblzma.vcxproj"), + os.path.join(build_script_folder, "liblzma_dll.vcxproj"), + ] + if (str(self.settings.compiler) == "Visual Studio" and Version(self.settings.compiler) >= "15") or \ + (str(self.settings.compiler) == "msvc" and Version(self.settings.compiler) >= "191"): + old_toolset = "v141" else: - args.extend(["--enable-static", "--disable-shared"]) - if self.settings.build_type == "Debug": - args.append("--enable-debug") - self._autotools.configure(configure_dir=self._source_subfolder, args=args, build=False) - return self._autotools + old_toolset = "v120" + new_toolset = MSBuildToolchain(self).toolset + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + f"{old_toolset}", + f"{new_toolset}", + ) + replace_in_file( + self, vcxproj_file, + "", + f"", + ) + #============================== + + msbuild = MSBuild(self) + msbuild.build_type = self._effective_msbuild_type + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(build_script_folder, "xz_win.sln"), targets=[self._msbuild_target]) def build(self): - self._apply_patches() - if self._is_msvc: + apply_conandata_patches(self) + if is_msvc(self): self._build_msvc() else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - if self._is_msvc: - inc_dir = os.path.join(self._source_subfolder, "src", "liblzma", "api") - self.copy(pattern="*.h", dst="include", src=inc_dir, keep_path=True) - arch = {"x86": "Win32", "x86_64": "x64"}.get(str(self.settings.arch)) - target = "liblzma_dll" if self.options.shared else "liblzma" - msvc_version = "vs2017" if Version(self.settings.compiler.version) >= "15" else "vs2013" - bin_dir = os.path.join(self._source_subfolder, "windows", msvc_version, - self._effective_msbuild_type, arch, target) - self.copy(pattern="*.lib", dst="lib", src=bin_dir, keep_path=False) - if self.options.shared: - self.copy(pattern="*.dll", dst="bin", src=bin_dir, keep_path=False) - tools.rename(os.path.join(self.package_folder, "lib", "liblzma.lib"), + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + inc_dir = os.path.join(self.source_folder, "src", "liblzma", "api") + copy(self, "*.h", src=inc_dir, dst=os.path.join(self.package_folder, "include")) + output_dir = os.path.join(self.source_folder, "windows") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + rename(self, os.path.join(self.package_folder, "lib", "liblzma.lib"), os.path.join(self.package_folder, "lib", "lzma.lib")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) self._create_cmake_module_variables( os.path.join(self.package_folder, self._module_file_rel_path), - tools.Version(self.version) ) - @staticmethod - def _create_cmake_module_variables(module_file, version): + def _create_cmake_module_variables(self, module_file): # TODO: also add LIBLZMA_HAS_AUTO_DECODER, LIBLZMA_HAS_EASY_ENCODER & LIBLZMA_HAS_LZMA_PRESET - content = textwrap.dedent("""\ - if(DEFINED LibLZMA_FOUND) - set(LIBLZMA_FOUND ${{LibLZMA_FOUND}}) - endif() + content = textwrap.dedent(f"""\ + set(LIBLZMA_FOUND TRUE) if(DEFINED LibLZMA_INCLUDE_DIRS) set(LIBLZMA_INCLUDE_DIRS ${{LibLZMA_INCLUDE_DIRS}}) endif() if(DEFINED LibLZMA_LIBRARIES) set(LIBLZMA_LIBRARIES ${{LibLZMA_LIBRARIES}}) endif() - set(LIBLZMA_VERSION_MAJOR {major}) - set(LIBLZMA_VERSION_MINOR {minor}) - set(LIBLZMA_VERSION_PATCH {patch}) - set(LIBLZMA_VERSION_STRING "{major}.{minor}.{patch}") - """.format(major=version.major, minor=version.minor, patch=version.patch)) - tools.save(module_file, content) + set(LIBLZMA_VERSION_MAJOR {Version(self.version).major}) + set(LIBLZMA_VERSION_MINOR {Version(self.version).minor}) + set(LIBLZMA_VERSION_PATCH {Version(self.version).patch}) + set(LIBLZMA_VERSION_STRING "{self.version}") + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-variables.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") def package_info(self): self.cpp_info.set_property("cmake_find_mode", "both") @@ -188,14 +190,13 @@ def package_info(self): self.cpp_info.set_property("cmake_target_name", "LibLZMA::LibLZMA") self.cpp_info.set_property("cmake_build_modules", [self._module_file_rel_path]) self.cpp_info.set_property("pkg_config_name", "liblzma") + self.cpp_info.libs = ["lzma"] if not self.options.shared: self.cpp_info.defines.append("LZMA_API_STATIC") if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs.append("pthread") - self.cpp_info.libs = tools.collect_libs(self) # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed self.cpp_info.names["cmake_find_package"] = "LibLZMA" self.cpp_info.names["cmake_find_package_multi"] = "LibLZMA" self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] - self.cpp_info.names["pkg_config"] = "liblzma" diff --git a/recipes/xz_utils/all/patches/0001-relax_windows-sdk-restriction.patch b/recipes/xz_utils/all/patches/0001-relax_windows-sdk-restriction.patch new file mode 100644 index 0000000000000..d9680984def65 --- /dev/null +++ b/recipes/xz_utils/all/patches/0001-relax_windows-sdk-restriction.patch @@ -0,0 +1,20 @@ +--- a/windows/vs2017/liblzma.vcxproj ++++ b/windows/vs2017/liblzma.vcxproj +@@ -29,7 +29,6 @@ + + {12728250-16EC-4DC6-94D7-E21DD88947F8} + Win32Proj +- 10.0.15063.0 + + + +--- a/windows/vs2017/liblzma_dll.vcxproj ++++ b/windows/vs2017/liblzma_dll.vcxproj +@@ -29,7 +29,6 @@ + + {E0F247DB-EF12-4755-8DF9-F74BCD1348F7} + Win32Proj +- 10.0.15063.0 + + + diff --git a/recipes/xz_utils/all/test_package/CMakeLists.txt b/recipes/xz_utils/all/test_package/CMakeLists.txt index 52957893e3d02..72a4496088dd7 100644 --- a/recipes/xz_utils/all/test_package/CMakeLists.txt +++ b/recipes/xz_utils/all/test_package/CMakeLists.txt @@ -1,10 +1,26 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(LibLZMA REQUIRED) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} LibLZMA::LibLZMA) +target_link_libraries(${PROJECT_NAME} PRIVATE LibLZMA::LibLZMA) + +# Test whether variables from https://cmake.org/cmake/help/latest/module/FindLibLZMA.html +# are properly defined in conan generators +set(_custom_vars + LIBLZMA_FOUND + LIBLZMA_INCLUDE_DIRS + LIBLZMA_LIBRARIES + LIBLZMA_VERSION_MAJOR + LIBLZMA_VERSION_MINOR + LIBLZMA_VERSION_PATCH + LIBLZMA_VERSION_STRING +) +foreach(_custom_var ${_custom_vars}) + if(DEFINED _custom_var) + message(STATUS "${_custom_var}: ${${_custom_var}}") + else() + message(FATAL_ERROR "${_custom_var} not defined") + endif() +endforeach() diff --git a/recipes/xz_utils/all/test_package/conanfile.py b/recipes/xz_utils/all/test_package/conanfile.py index 52ff86a518167..0a6bc68712d90 100644 --- a/recipes/xz_utils/all/test_package/conanfile.py +++ b/recipes/xz_utils/all/test_package/conanfile.py @@ -1,19 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" - def build_requirements(self): - if self.settings.os == "Macos" and self.settings.arch == "armv8": - # Workaround for CMake bug with error message: - # Attempting to use @rpath without CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG being - # set. This could be because you are using a Mac OS X version less than 10.5 - # or because CMake's platform configuration is corrupt. - # FIXME: Remove once CMake on macOS/M1 CI runners is upgraded. - self.build_requires("cmake/3.22.0") + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -21,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/xz_utils/all/test_v1_package/CMakeLists.txt b/recipes/xz_utils/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/xz_utils/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/xz_utils/all/test_v1_package/conanfile.py b/recipes/xz_utils/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..19e6a0c06e3d8 --- /dev/null +++ b/recipes/xz_utils/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/xz_utils/config.yml b/recipes/xz_utils/config.yml index 4afb08d7749cb..908e8205eebe4 100644 --- a/recipes/xz_utils/config.yml +++ b/recipes/xz_utils/config.yml @@ -1,4 +1,8 @@ versions: + "5.4.0": + folder: all + "5.2.10": + folder: all "5.2.5": folder: all "5.2.4": diff --git a/recipes/yaclib/all/conandata.yml b/recipes/yaclib/all/conandata.yml new file mode 100644 index 0000000000000..728f8d40d44bc --- /dev/null +++ b/recipes/yaclib/all/conandata.yml @@ -0,0 +1,15 @@ +sources: + '2022.12.20': + url: 'https://github.com/YACLib/YACLib/archive/refs/tags/v2022.12.10.tar.gz' + sha256: '30b3e3743daa3ea36244fa9c7e619fdbfed2975e4f8e017a4d973f25fe78bde3' + '2022.10.31': + url: 'https://github.com/YACLib/YACLib/archive/refs/tags/v2022.10.31.tar.gz' + sha256: '81761b1c8e53e6eaeb36fa00183cae66068b85d24c910c0584d0b29b371e143c' +patches: + '2022.10.31': + - patch_file: 'patches/0001-Set-17-as-default-or-20-if-CORO-specified.patch' + patch_description: 'Set 17 standard if not stated otherwise' + patch_type: 'conan' + - patch_file: 'patches/0002-Add-install-commands.patch' + patch_description: 'Add install commands' + patch_type: 'conan' diff --git a/recipes/yaclib/all/conanfile.py b/recipes/yaclib/all/conanfile.py new file mode 100644 index 0000000000000..4c35bd089113e --- /dev/null +++ b/recipes/yaclib/all/conanfile.py @@ -0,0 +1,157 @@ +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeToolchain +from conan.tools.scm import Version +from conan.tools.files import copy, get, export_conandata_patches, apply_conandata_patches, save +from conan.tools.layout import cmake_layout +from conan.errors import ConanInvalidConfiguration +import os +import textwrap + +required_conan_version = ">=1.53.0" + + +class YACLibConan(ConanFile): + name = "yaclib" + description = "lightweight C++ library for concurrent and parallel task execution" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/YACLib/YACLib" + license = "MIT" + topics = ("async", "parallel", "concurrency") + settings = "os", "arch", "compiler", "build_type" + + _yaclib_flags = { + "warn": [True, False], + "coro": [True, False], + "disable_futex": [True, False], + "disable_unsafe_futex": [True, False], + "disable_symmetric_transfer": [True, False], + "disable_final_suspend_transfer": [True, False], + } + + options = { + "fPIC": [True, False], + **_yaclib_flags, + } + + default_options = { + "fPIC": True, + **{k: False for k in _yaclib_flags}, + } + + @property + def _min_cppstd(self): + return 20 if self.options.coro else 17 + + @property + def _compilers_minimum_version(self): + if self._min_cppstd == 17: + return { + "gcc": "7", + "Visual Studio": "14.20", + "msvc": "192", + "clang": "8", + "apple-clang": "12", + } + return { + "gcc": "12", + "Visual Studio": "16", + "msvc": "192", + "clang": "13", + "apple-clang": "13", + } + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables['YACLIB_INSTALL'] = True + if self.settings.compiler.get_safe("cppstd"): + tc.variables["YACLIB_CXX_STANDARD"] = self.settings.compiler.cppstd + + flags = [] + for flag in self._yaclib_flags: + if self.options.get_safe(flag): + flags.append(flag.upper()) + if flags: + tc.variables["YACLIB_FLAGS"] = ";".join(flags) + + tc.generate() + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def build(self): + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() + cmake.build() + + def _create_cmake_module_alias_targets(self, module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent("""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """.format(alias=alias, aliased=aliased)) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) + cmake.install() + + # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {"yaclib": "yaclib::yaclib"} + ) + + def package_info(self): + self.cpp_info.set_property("cmake_file_name", "yaclib") + self.cpp_info.set_property("cmake_target_name", "yaclib") + self.cpp_info.set_property("pkg_config_name", "yaclib") + self.cpp_info.libs = ["yaclib"] + if self.options.get_safe("coro"): + if self.settings.compiler.libcxx == "libstdc++11": + self.cpp_info.cxxflags.append("-fcoroutines") + + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.system_libs = ["pthread"] + + # TODO: to remove in conan v2 once cmake_find_package* & pkg_config generators removed + self.cpp_info.names["cmake_find_package"] = "yaclib" + self.cpp_info.names["cmake_find_package_multi"] = "yaclib" + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path] + self.cpp_info.names["pkg_config"] = "yaclib" diff --git a/recipes/yaclib/all/patches/0001-Set-17-as-default-or-20-if-CORO-specified.patch b/recipes/yaclib/all/patches/0001-Set-17-as-default-or-20-if-CORO-specified.patch new file mode 100644 index 0000000000000..4bdeb1041a928 --- /dev/null +++ b/recipes/yaclib/all/patches/0001-Set-17-as-default-or-20-if-CORO-specified.patch @@ -0,0 +1,17 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 13c28b2..53cbb9b 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -14,6 +14,12 @@ endif () + + if (YACLIB_CXX_STANDARD) + set(CMAKE_CXX_STANDARD ${YACLIB_CXX_STANDARD}) ++elseif (NOT CORO IN_LIST YACLIB_FLAGS) ++ message("Set default standard to c++17") ++ set(CMAKE_CXX_STANDARD 17) ++else () ++message("Set default standard to c++20") ++ set(CMAKE_CXX_STANDARD 20) + endif () + + set(CMAKE_CXX_STANDARD_REQUIRED ON) diff --git a/recipes/yaclib/all/patches/0002-Add-install-commands.patch b/recipes/yaclib/all/patches/0002-Add-install-commands.patch new file mode 100644 index 0000000000000..8e97ed67b0c96 --- /dev/null +++ b/recipes/yaclib/all/patches/0002-Add-install-commands.patch @@ -0,0 +1,30 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index 53cbb9b..ca46fe1 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -32,6 +32,13 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + list(APPEND CMAKE_MODULE_PATH "${YACLIB_SOURCE_DIR}/cmake") + include(yaclib_flags) + ++if (YACLIB_INSTALL) ++ include(GNUInstallDirs) ++ install(DIRECTORY ${YACLIB_SOURCE_DIR}/include/yaclib TYPE INCLUDE) ++ install(DIRECTORY ${YACLIB_SOURCE_DIR}/include/yaclib_std TYPE INCLUDE) ++ install(DIRECTORY ${YACLIB_BINARY_DIR}/include/yaclib TYPE INCLUDE) ++endif() ++ + add_subdirectory(src) # Create static library + + if (YACLIB_TEST) +diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt +index c3d624f..80715cb 100644 +--- a/src/CMakeLists.txt ++++ b/src/CMakeLists.txt +@@ -56,3 +56,7 @@ target_include_directories(yaclib + PUBLIC ${YACLIB_BINARY_DIR}/include # for config.hpp + PRIVATE ${YACLIB_SOURCE_DIR}/src + ) ++ ++if (YACLIB_INSTALL) ++ install(TARGETS yaclib) ++endif () diff --git a/recipes/yaclib/all/test_package/CMakeLists.txt b/recipes/yaclib/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..244a17672765e --- /dev/null +++ b/recipes/yaclib/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package LANGUAGES CXX) + +find_package(yaclib REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE yaclib) + +if(YACLIB_CORO) + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) +endif() diff --git a/recipes/yaclib/all/test_package/conanfile.py b/recipes/yaclib/all/test_package/conanfile.py new file mode 100644 index 0000000000000..9ae67f8661d01 --- /dev/null +++ b/recipes/yaclib/all/test_package/conanfile.py @@ -0,0 +1,30 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake, CMakeToolchain +import os + +class TestPackageConan(ConanFile): + test_type = 'explicit' + generators = 'CMakeDeps', 'VirtualRunEnv' + settings = 'os', 'arch', 'compiler', 'build_type' + + def requirements(self): + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables['YACLIB_CORO'] = self.dependencies["yaclib"].options.coro + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], 'test_package') + self.run(bin_path, env="conanrun") diff --git a/recipes/yaclib/all/test_package/test_package.cpp b/recipes/yaclib/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..d834e92b5b3cf --- /dev/null +++ b/recipes/yaclib/all/test_package/test_package.cpp @@ -0,0 +1,25 @@ +#include + +#include "yaclib/async/contract.hpp" +#include "yaclib/util/result.hpp" + +int main() +{ + auto [f, p] = yaclib::MakeContract(); + + std::move(p).Set(42); + + if (!f.Ready()) + { + return EXIT_FAILURE; + } + + yaclib::Result result = std::move(f).Get(); + + if (std::move(result).Ok() != 42) + { + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} diff --git a/recipes/yaclib/all/test_v1_package/CMakeLists.txt b/recipes/yaclib/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..91630d79f4abb --- /dev/null +++ b/recipes/yaclib/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.15) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/yaclib/all/test_v1_package/conanfile.py b/recipes/yaclib/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..20d4d2e28d57e --- /dev/null +++ b/recipes/yaclib/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/yaclib/config.yml b/recipes/yaclib/config.yml new file mode 100644 index 0000000000000..84e61bde4366a --- /dev/null +++ b/recipes/yaclib/config.yml @@ -0,0 +1,5 @@ +versions: + "2022.12.20": + folder: all + "2022.10.31": + folder: all diff --git a/recipes/yaml-cpp/all/conanfile.py b/recipes/yaml-cpp/all/conanfile.py index c82f3534a578a..1b66ae0cdf060 100644 --- a/recipes/yaml-cpp/all/conanfile.py +++ b/recipes/yaml-cpp/all/conanfile.py @@ -2,12 +2,12 @@ from conan.errors import ConanInvalidConfiguration from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, rmdir, save +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, rmdir, save from conan.tools.microsoft import is_msvc, is_msvc_static_runtime import os import textwrap -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class YamlCppConan(ConanFile): @@ -17,7 +17,7 @@ class YamlCppConan(ConanFile): topics = ("yaml", "yaml-parser", "serialization", "data-serialization") description = "A YAML parser and emitter in C++" license = "MIT" - + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -29,8 +29,7 @@ class YamlCppConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -38,22 +37,21 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.info.settings.compiler.cppstd: + if self.settings.compiler.get_safe("cppstd"): check_min_cppstd(self, "11") - if self.info.options.shared and is_msvc(self) and is_msvc_static_runtime(self): + if self.options.shared and is_msvc(self) and is_msvc_static_runtime(self): raise ConanInvalidConfiguration( f"Visual Studio build for {self.name} shared library with MT runtime is not supported" ) - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/yaml-cpp/all/test_package/conanfile.py b/recipes/yaml-cpp/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/yaml-cpp/all/test_package/conanfile.py +++ b/recipes/yaml-cpp/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/yaml-cpp/all/test_v1_package/CMakeLists.txt b/recipes/yaml-cpp/all/test_v1_package/CMakeLists.txt index 9960181468073..925ecbe19e448 100644 --- a/recipes/yaml-cpp/all/test_v1_package/CMakeLists.txt +++ b/recipes/yaml-cpp/all/test_v1_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.8) -project(test_package LANGUAGES CXX) +cmake_minimum_required(VERSION 3.1) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(yaml-cpp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE yaml-cpp) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/yaml-cpp/all/test_v1_package/conanfile.py b/recipes/yaml-cpp/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/yaml-cpp/all/test_v1_package/conanfile.py +++ b/recipes/yaml-cpp/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/yasm/all/conandata.yml b/recipes/yasm/all/conandata.yml index 8513b90d3ac05..54b8e4dfddf30 100644 --- a/recipes/yasm/all/conandata.yml +++ b/recipes/yasm/all/conandata.yml @@ -2,5 +2,8 @@ sources: "1.3.0": - url: "http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz" sha256: "3dce6601b495f5b3d45b59f7d2492a340ee7e84b5beca17e48f862502bd5603f" - - url: "https://raw.githubusercontent.com/yasm/yasm/bcc01c59d8196f857989e6ae718458c296ca20e3/YASM-VERSION-GEN.bat" - sha256: "b976cb97d2f7bb00e78e5db0da0978659acbdd60b52998cd2983145d8d75f141" +patches: + "1.3.0": + - patch_file: "patches/0001-cmake-updates.patch" + patch_description: "CMake 3.0+ compatibility" + patch_type: "conan" diff --git a/recipes/yasm/all/conanfile.py b/recipes/yasm/all/conanfile.py index 7a6b161ce45e8..7e50843bcd47e 100644 --- a/recipes/yasm/all/conanfile.py +++ b/recipes/yasm/all/conanfile.py @@ -1,12 +1,18 @@ -from conans import ConanFile, tools, AutoToolsBuildEnvironment, MSBuild +from conan import ConanFile +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import is_msvc import os -import shutil -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.54.0" class YASMConan(ConanFile): name = "yasm" + package_type = "application" url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/yasm/yasm" description = "Yasm is a complete rewrite of the NASM assembler under the 'new' BSD License" @@ -14,87 +20,93 @@ class YASMConan(ConanFile): license = "BSD-2-Clause" settings = "os", "arch", "compiler", "build_type" - _autotools = None - - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + def export_sources(self): + export_conandata_patches(self) + def configure(self): - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") - def build_requirements(self): - if self._settings_build.os == "Windows" and self.settings.compiler != "Visual Studio" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + def layout(self): + if is_msvc(self): + cmake_layout(self, src_folder="src") + else: + basic_layout(self, src_folder="src") def package_id(self): del self.info.settings.compiler + def build_requirements(self): + if self._settings_build.os == "Windows" and not is_msvc(self): + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") + def source(self): - tools.get(**self.conan_data["sources"][self.version][0], - destination=self._source_subfolder, strip_root=True) - tools.download(**self.conan_data["sources"][self.version][1], - filename=os.path.join(self._source_subfolder, "YASM-VERSION-GEN.bat")) + get(self, **self.conan_data["sources"][self.version][0], + destination=self.source_folder, strip_root=True) - @property - def _msvc_subfolder(self): - return os.path.join(self._source_subfolder, "Mkfiles", "vc10") - - def _build_vs(self): - with tools.chdir(self._msvc_subfolder): - msbuild = MSBuild(self) - if self.settings.arch == "x86": - msbuild.build_env.link_flags.append("/MACHINE:X86") - elif self.settings.arch == "x86_64": - msbuild.build_env.link_flags.append("/SAFESEH:NO /MACHINE:X64") - build_type = "Debug" if self.settings.build_type == "Debug" else "Release" - msbuild.build(project_file="yasm.sln", build_type=build_type, upgrade_project=False, - targets=["yasm"], platforms={"x86": "Win32"}, force_vcvars=True) - - def _configure_autotools(self): - if self._autotools: - return self._autotools - self._autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--enable-debug={}".format(yes_no(self.settings.build_type == "Debug")), + def _generate_autotools(self): + env = VirtualBuildEnv(self) + env.generate() + + tc = AutotoolsToolchain(self) + enable_debug = "yes" if self.settings.build_type == "Debug" else "no" + tc.configure_args.extend([ + f"--enable-debug={enable_debug}", "--disable-rpath", "--disable-nls", - ] - self._autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return self._autotools + ]) + tc.generate() + + def _generate_cmake(self): + tc = CMakeToolchain(self) + tc.cache_variables["YASM_BUILD_TESTS"] = False + # Don't build shared libraries because: + # 1. autotools doesn't build shared libs either + # 2. the shared libs don't support static libc runtime (MT and such) + tc.cache_variables["BUILD_SHARED_LIBS"] = False + tc.generate() + + def generate(self): + if is_msvc(self): + self._generate_cmake() + else: + self._generate_autotools() def build(self): - if self.settings.compiler == "Visual Studio": - self._build_vs() + apply_conandata_patches(self) + if is_msvc(self): + cmake = CMake(self) + cmake.configure() + cmake.build() else: - autotools = self._configure_autotools() + autotools = Autotools(self) + autotools.configure() autotools.make() def package(self): - self.copy(pattern="BSD.txt", dst="licenses", src=self._source_subfolder) - self.copy(pattern="COPYING", dst="licenses", src=self._source_subfolder) - if self.settings.compiler == "Visual Studio": - arch = { - "x86": "Win32", - "x86_64": "x64", - }[str(self.settings.arch)] - tools.mkdir(os.path.join(self.package_folder, "bin")) - build_type = "Debug" if self.settings.build_type == "Debug" else "Release" - shutil.copy(os.path.join(self._msvc_subfolder, arch, build_type, "yasm.exe"), - os.path.join(self.package_folder, "bin", "yasm.exe")) - self.copy(pattern="yasm.exe*", src=self._source_subfolder, dst="bin", keep_path=False) + copy(self, pattern="BSD.txt", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, pattern="COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + if is_msvc(self): + cmake = CMake(self) + cmake.install() + rmdir(self, os.path.join(self.package_folder, "include")) + rmdir(self, os.path.join(self.package_folder, "lib")) else: - autotools = self._configure_autotools() + autotools = Autotools(self) autotools.install() - tools.rmdir(os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "lib")) def package_info(self): + self.cpp_info.includedirs = [] + self.cpp_info.libdirs = [] + bin_path = os.path.join(self.package_folder, "bin") - self.output.info("Appending PATH environment variable: {}".format(bin_path)) + self.output.info(f"Appending PATH environment variable: {bin_path}") self.env_info.PATH.append(bin_path) diff --git a/recipes/yasm/all/patches/0001-cmake-updates.patch b/recipes/yasm/all/patches/0001-cmake-updates.patch new file mode 100644 index 0000000000000..8f43dacf4f240 --- /dev/null +++ b/recipes/yasm/all/patches/0001-cmake-updates.patch @@ -0,0 +1,67 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,5 +1,5 @@ ++CMAKE_MINIMUM_REQUIRED(VERSION 3.0) + PROJECT(yasm) +-CMAKE_MINIMUM_REQUIRED(VERSION 2.4) + if (COMMAND cmake_policy) + cmake_policy(SET CMP0003 NEW) + endif (COMMAND cmake_policy) +--- a/cmake/modules/YasmMacros.cmake ++++ b/cmake/modules/YasmMacros.cmake +@@ -58,31 +58,31 @@ macro (YASM_ADD_MODULE _module_NAME) + endmacro (YASM_ADD_MODULE) + + macro (YASM_GENPERF _in_NAME _out_NAME) +- get_target_property(_tmp_GENPERF_EXE genperf LOCATION) ++ #get_target_property(_tmp_GENPERF_EXE genperf LOCATION) + add_custom_command( + OUTPUT ${_out_NAME} +- COMMAND ${_tmp_GENPERF_EXE} ${_in_NAME} ${_out_NAME} +- DEPENDS ${_tmp_GENPERF_EXE} ++ COMMAND genperf ${_in_NAME} ${_out_NAME} ++ #DEPENDS ${_tmp_GENPERF_EXE} + MAIN_DEPENDENCY ${_in_NAME} + ) + endmacro (YASM_GENPERF) + + macro (YASM_RE2C _in_NAME _out_NAME) +- get_target_property(_tmp_RE2C_EXE re2c LOCATION) ++ #get_target_property(_tmp_RE2C_EXE re2c LOCATION) + add_custom_command( + OUTPUT ${_out_NAME} +- COMMAND ${_tmp_RE2C_EXE} ${ARGN} -o ${_out_NAME} ${_in_NAME} +- DEPENDS ${_tmp_RE2C_EXE} ++ COMMAND re2c ${ARGN} -o ${_out_NAME} ${_in_NAME} ++ #DEPENDS ${_tmp_RE2C_EXE} + MAIN_DEPENDENCY ${_in_NAME} + ) + endmacro (YASM_RE2C) + + macro (YASM_GENMACRO _in_NAME _out_NAME _var_NAME) +- get_target_property(_tmp_GENMACRO_EXE genmacro LOCATION) ++ #get_target_property(_tmp_GENMACRO_EXE genmacro LOCATION) + add_custom_command( + OUTPUT ${_out_NAME} +- COMMAND ${_tmp_GENMACRO_EXE} ${_out_NAME} ${_var_NAME} ${_in_NAME} +- DEPENDS ${_tmp_GENMACRO_EXE} ++ COMMAND genmacro ${_out_NAME} ${_var_NAME} ${_in_NAME} ++ #DEPENDS ${_tmp_GENMACRO_EXE} + MAIN_DEPENDENCY ${_in_NAME} + ) + endmacro (YASM_GENMACRO) +--- a/modules/preprocs/nasm/CMakeLists.txt ++++ b/modules/preprocs/nasm/CMakeLists.txt +@@ -1,9 +1,9 @@ + add_executable(genversion preprocs/nasm/genversion.c) +-get_target_property(_tmp_GENVERSION_EXE genversion LOCATION) ++#get_target_property(_tmp_GENVERSION_EXE genversion LOCATION) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/version.mac +- COMMAND ${_tmp_GENVERSION_EXE} ${CMAKE_CURRENT_BINARY_DIR}/version.mac +- DEPENDS ${_tmp_GENVERSION_EXE} ++ COMMAND genversion ${CMAKE_CURRENT_BINARY_DIR}/version.mac ++ #DEPENDS ${_tmp_GENVERSION_EXE} + ) + + YASM_GENMACRO( diff --git a/recipes/yasm/all/test_package/conanfile.py b/recipes/yasm/all/test_package/conanfile.py index 605eba819f594..9f19c7186d640 100644 --- a/recipes/yasm/all/test_package/conanfile.py +++ b/recipes/yasm/all/test_package/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools +from conan import ConanFile -class TestPackage(ConanFile): +class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" + generators = "VirtualBuildEnv" + test_type = "explicit" + + def build_requirements(self): + self.tool_requires(self.tested_reference_str) def test(self): - if not tools.cross_building(self, skip_x64_x86=True): - self.run("yasm --help", run_environment=True) + self.run("yasm --help") diff --git a/recipes/yasm/all/test_v1_package/conanfile.py b/recipes/yasm/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5992797490cc6 --- /dev/null +++ b/recipes/yasm/all/test_v1_package/conanfile.py @@ -0,0 +1,10 @@ +from conans import ConanFile +from conan.tools.build import cross_building + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + + def test(self): + if not cross_building(self): + self.run("yasm --help", run_environment=True) diff --git a/recipes/yder/all/conandata.yml b/recipes/yder/all/conandata.yml new file mode 100644 index 0000000000000..f6c79182d9b12 --- /dev/null +++ b/recipes/yder/all/conandata.yml @@ -0,0 +1,9 @@ +sources: + "1.4.18": + url: "https://github.com/babelouest/yder/archive/refs/tags/v1.4.18.tar.gz" + sha256: "b69cc81f6630f66468595d151446c00c90abed058f03f82e151591b8598a7598" +patches: + "1.4.18": + - patch_file: "patches/1.4.18-0001-shared-static-conan.patch" + patch_description: "Build shared and static libraries" + patch_type: "portability" diff --git a/recipes/yder/all/conanfile.py b/recipes/yder/all/conanfile.py new file mode 100644 index 0000000000000..d027f053ed062 --- /dev/null +++ b/recipes/yder/all/conanfile.py @@ -0,0 +1,149 @@ +from conan import ConanFile +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir, save +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.microsoft import is_msvc +import os +import textwrap + +required_conan_version = ">=1.52.0" + + +class YderConan(ConanFile): + name = "yder" + description = "Logging library for C applications" + homepage = "https://github.com/babelouest/yder" + topics = ("logging", "stdout", "file", "journald", "systemd") + license = "LGPL-2.1-or-later" + url = "https://github.com/conan-io/conan-center-index" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + "with_libsystemd": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + "with_libsystemd": True, + } + + def config_options(self): + if self.settings.os == "Windows": + del self.options.fPIC + del self.options.with_libsystemd + + def configure(self): + if self.options.shared: + try: + del self.options.fPIC + except Exception: + pass + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def requirements(self): + self.requires("orcania/2.3.1") + if self.options.get_safe("with_libsystemd"): + self.requires("libsystemd/251.4") + + def source(self): + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def export_sources(self): + export_conandata_patches(self) + + def layout(self): + cmake_layout(self, src_folder="src") + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.variables["DOWNLOAD_DEPENDENCIES"] = False + tc.variables["WITH_JOURNALD"] = self.options.get_safe("with_libsystemd", False) + tc.generate() + deps = CMakeDeps(self) + deps.generate() + + def _patch_sources(self): + apply_conandata_patches(self) + if self.options.shared: + if not self.dependencies["orcania"].options.shared: + replace_in_file(self, os.path.join(self.source_folder, "CMakeLists.txt"), "Orcania::Orcania", "Orcania::Orcania-static") + + def build(self): + self._patch_sources() + cmake = CMake(self) + cmake.configure() + cmake.build() + + def package(self): + copy(self, "LICENSE", os.path.join(self.source_folder), os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) + cmake.install() + + rmdir(self, os.path.join(self.package_folder, "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + + save(self, os.path.join(self.package_folder, self._variable_file_rel_path), + textwrap.dedent(f"""\ + set(YDER_VERSION_STRING "{self.version}") + """)) + + # TODO: to remove in conan v2 once cmake_find_package* generators removed + self._create_cmake_module_alias_targets( + os.path.join(self.package_folder, self._module_file_rel_path), + {} if self.options.shared else {"Yder::Yder-static": "Yder::Yder"} + ) + + def _create_cmake_module_alias_targets(self, module_file, targets): + content = "" + for alias, aliased in targets.items(): + content += textwrap.dedent(f"""\ + if(TARGET {aliased} AND NOT TARGET {alias}) + add_library({alias} INTERFACE IMPORTED) + set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) + endif() + """) + save(self, module_file, content) + + @property + def _module_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") + + @property + def _variable_file_rel_path(self): + return os.path.join("lib", "cmake", f"conan-official-{self.name}-variables.cmake") + + def package_info(self): + libname = "yder" + if is_msvc(self) and not self.options.shared: + libname += "-static" + self.cpp_info.libs = [libname] + + target_name = "Yder::Yder" if self.options.shared else "Yder::Yder-static" + self.cpp_info.set_property("cmake_file_name", "Yder") + self.cpp_info.set_property("cmake_target_name", target_name) + self.cpp_info.set_property("cmake_module_file_name", "Yder") + self.cpp_info.set_property("cmake_module_target_name", target_name) + self.cpp_info.set_property("pkg_config_name", "libyder") + self.cpp_info.set_property("cmake_build_modules", [self._variable_file_rel_path]) + + # TODO: to remove in conan v2 once cmake_find_package_* generators removed + self.cpp_info.filenames["cmake_find_package"] = "Yder" + self.cpp_info.filenames["cmake_find_package_multi"] = "Yder" + self.cpp_info.names["cmake_find_package"] = "Yder" + self.cpp_info.names["cmake_find_package_multi"] = "Yder" + self.cpp_info.names["pkg_config"] = "libyder" + self.cpp_info.builddirs.append(os.path.join("lib", "cmake")) + self.cpp_info.build_modules["cmake_find_package"] = [self._module_file_rel_path, self._variable_file_rel_path] + self.cpp_info.build_modules["cmake_find_package_multi"] = [self._module_file_rel_path, self._variable_file_rel_path] diff --git a/recipes/yder/all/patches/1.4.18-0001-shared-static-conan.patch b/recipes/yder/all/patches/1.4.18-0001-shared-static-conan.patch new file mode 100644 index 0000000000000..0cfb8663d7496 --- /dev/null +++ b/recipes/yder/all/patches/1.4.18-0001-shared-static-conan.patch @@ -0,0 +1,406 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index dd30696..2bbd279 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -65,6 +65,7 @@ list(APPEND CMAKE_MODULE_PATH "${Y_CMAKE_MODULE_PATH}") + + include(GNUInstallDirs) + include(CheckSymbolExists) ++include(CMakePackageConfigHelpers) + + # check if _GNU_SOURCE is available + +@@ -94,83 +95,126 @@ set(LIB_SRC + + # dependencies + +-option(WITH_JOURNALD "Check journald." ON) ++set(WITH_JOURNALD_DEFAULT ON) ++if(WIN32) ++ set(WITH_JOURNALD_DEFAULT OFF) ++endif() ++option(WITH_JOURNALD "Check journald." ${WITH_JOURNALD_DEFAULT}) + + if (WITH_JOURNALD) +- include(FindSystemd) + find_package(Systemd REQUIRED) +- if (SYSTEMD_FOUND) +- set(SYSTEMD_LIBRARIES systemd) +- include_directories(${SYSTEMD_INCLUDE_DIRS}) +- set(Y_DISABLE_JOURNALD OFF) +- endif () ++ set(SYSTEMD_LIBRARIES Systemd::Systemd) ++ set(Y_DISABLE_JOURNALD OFF) + else() + set(Y_DISABLE_JOURNALD ON) ++ set(SYSTEMD_LIBRARIES ) + endif () + +-# shared library ++option(BUILD_SHARED "Build shared library." ON) ++option(BUILD_STATIC "Build static library." OFF) + +-add_library(yder SHARED ${LIB_SRC}) +-if (NOT MSVC) +- set_target_properties(yder PROPERTIES +- COMPILE_OPTIONS -Wextra +- PUBLIC_HEADER "${INC_DIR}/yder.h;${PROJECT_BINARY_DIR}/yder-cfg.h" +- VERSION "${LIBRARY_VERSION}" +- SOVERSION "${LIBRARY_SOVERSION}") +-endif() +-if (WIN32) +- set_target_properties(yder PROPERTIES SUFFIX "-${LIBRARY_VERSION_MAJOR}.dll") ++if (NOT BUILD_SHARED AND NOT BUILD_STATIC) ++ message(FATAL_ERROR "BUILD_SHARED and BUILD_STATIC cannot be both disabled") + endif () + + # static library + +-option(BUILD_STATIC "Build static library." OFF) +- + if (BUILD_STATIC) + add_library(yder_static STATIC ${LIB_SRC}) +- target_compile_definitions(yder_static PUBLIC -DO_STATIC_LIBRARY) ++ add_library(Yder::Yder-static ALIAS yder_static) ++ target_include_directories(yder_static ++ PUBLIC "$" ++ PUBLIC "$" ++ PUBLIC "$") ++ target_compile_definitions(yder_static PUBLIC O_STATIC_LIBRARY) + set_target_properties(yder_static PROPERTIES +- OUTPUT_NAME yder) ++ PUBLIC_HEADER "${INC_DIR}/yder.h;${PROJECT_BINARY_DIR}/yder-cfg.h" ++ OUTPUT_NAME yder ++ EXPORT_NAME Yder-static) ++ if (MSVC) ++ set_target_properties(yder_static PROPERTIES ++ OUTPUT_NAME yder-static) ++ else () ++ target_compile_options(yder_static PRIVATE -Wextra) ++ endif () ++ set(yder_lib yder_static) + endif () + ++# shared library ++ ++if (BUILD_SHARED) ++ add_library(yder SHARED ${LIB_SRC}) ++ add_library(Yder::Yder ALIAS yder) ++ target_include_directories(yder ++ PUBLIC "$" ++ PUBLIC "$" ++ PUBLIC "$") ++ set_target_properties(yder PROPERTIES ++ PUBLIC_HEADER "${INC_DIR}/yder.h;${PROJECT_BINARY_DIR}/yder-cfg.h" ++ VERSION "${LIBRARY_VERSION}" ++ SOVERSION "${LIBRARY_SOVERSION}" ++ WINDOWS_EXPORT_ALL_SYMBOLS TRUE ++ EXPORT_NAME Yder) ++ if (WIN32) ++ set_target_properties(yder PROPERTIES ++ SUFFIX "-${LIBRARY_VERSION_MAJOR}.dll") ++ endif () ++ if (NOT MSVC) ++ target_compile_options(yder PRIVATE -Wextra) ++ endif () ++ set(yder_lib yder) ++endif() ++ + option(DOWNLOAD_DEPENDENCIES "Download required dependencies" ON) + + option(SEARCH_ORCANIA "Search for Orcania library" ON) + if (SEARCH_ORCANIA) +- set(Orcania_FIND_QUIETLY ON) # force to find Orcania quietly +- include(FindOrcania) + find_package(Orcania ${ORCANIA_VERSION_REQUIRED} QUIET) # try to find orcania +- if (NOT ORCANIA_FOUND) ++ if (NOT Orcania_FOUND) + if (DOWNLOAD_DEPENDENCIES) + include(DownloadProject) + download_project(PROJ orcania # ... otherwise, download archive +- URL "https://github.com/babelouest/orcania/archive/v${ORCANIA_VERSION_REQUIRED}.tar.gz" +- QUIET) ++ URL "https://github.com/babelouest/orcania/archive/v${ORCANIA_VERSION_REQUIRED}.tar.gz" ++ QUIET) + add_subdirectory(${orcania_SOURCE_DIR} ${orcania_BINARY_DIR}) +- include_directories(${orcania_SOURCE_DIR}/include) +- include_directories(${orcania_BINARY_DIR}) +- add_dependencies(yder orcania) +- set(ORCANIA_LIBRARIES orcania) +- set(LIBS ${LIBS} ${ORCANIA_LIBRARIES}) ++ if (NOT TARGET Orcania::Orcania) ++ add_library(Orcania::Orcania ALIAS orcania) ++ endif () ++ if (NOT TARGET Orcania::Orcania-static AND TARGET orcania_static) ++ add_library(Orcania::Orcania-static ALIAS orcania_static) ++ endif () + else () + message( FATAL_ERROR "Orcania not found") + endif () + else() +- message(STATUS "Orcania found") +- set(LIBS ${LIBS} ${ORCANIA_LIBRARIES}) +- include_directories(${ORCANIA_INCLUDE_DIRS}) +- include_directories(${orcania_BINARY_DIR}) ++ if ("${ORCANIA_VERSION_STRING}" VERSION_GREATER_EQUAL "${ORCANIA_VERSION_REQUIRED}") ++ message(STATUS "Orcania found: ${ORCANIA_VERSION_STRING}") ++ else () ++ message( FATAL_ERROR "Orcania version required: ${ORCANIA_VERSION_REQUIRED} - version installed: ${ORCANIA_VERSION_STRING}") ++ endif () ++ endif () ++else () ++ if (NOT TARGET Orcania:: Orcania) ++ add_library(Orcania::Orcania IMPORTED UNKNOWN) ++ set_target_properties(Orcania::Orcania PROPERTIES IMPORTED_LOCATION "orcania") + endif () + endif () + +-target_link_libraries(yder ${LIBS} ${ORCANIA_LIBRARIES} ${SYSTEMD_LIBRARIES}) ++if (BUILD_SHARED) ++ target_link_libraries(yder PRIVATE $ ${SYSTEMD_LIBRARIES}) ++endif () ++if (BUILD_STATIC) ++ if(TARGET Orcania::Orcania-static) ++ target_link_libraries(yder_static PRIVATE $ ${SYSTEMD_LIBRARIES}) ++ else() ++ target_link_libraries(yder_static PRIVATE $ ${SYSTEMD_LIBRARIES}) ++ endif() ++endif () + ++set(PKGCONF_REQ_PRIVATE "liborcania") ++set(PKGCONF_REQ "") + if (WITH_JOURNALD) +- set(PKGCONF_REQ "") +- set(PKGCONF_REQ_PRIVATE "libsystemd, liborcania") +-else () +- set(PKGCONF_REQ "") +- set(PKGCONF_REQ_PRIVATE "liborcania") ++ string(APPEND PKGCONF_REQ_PRIVATE ", libsystemd") + endif () + + # documentation +@@ -205,11 +249,9 @@ include_directories(${PROJECT_BINARY_DIR}) + option(BUILD_YDER_TESTING "Build the testing tree." OFF) # because we don not use include(CTest) + + if (BUILD_YDER_TESTING) +- include(FindCheck) + find_package(Check) + if (CHECK_FOUND) + if (NOT WIN32 AND NOT APPLE) +- include(FindSubunit) + find_package(Subunit REQUIRED) + endif () + +@@ -218,16 +260,16 @@ if (BUILD_YDER_TESTING) + set(CMAKE_CTEST_COMMAND ctest -V) + + set(TST_DIR ${CMAKE_CURRENT_SOURCE_DIR}/test) +- set(LIBS yder ${LIBS} ${CHECK_LIBRARIES} ${ORCANIA_LIBRARIES}) ++ set(TEST_LIBS ${yder_lib} Check::Check) + if (NOT WIN32) + find_package(Threads REQUIRED) +- set(LIBS ${LIBS} ${CMAKE_THREAD_LIBS_INIT} m) ++ list(APPEND TEST_LIBS ${CMAKE_THREAD_LIBS_INIT} m) + endif () + if (NOT APPLE) +- set(LIBS ${LIBS} rt) ++ list(APPEND TEST_LIBS rt) + endif () + if (NOT WIN32 AND NOT APPLE) +- set(LIBS ${LIBS} ${SUBUNIT_LIBRARIES}) ++ list(APPEND TEST_LIBS Subunit::Subunit) + endif () + + set(TESTS yder_test) +@@ -239,8 +281,8 @@ if (BUILD_YDER_TESTING) + + foreach (t ${TESTS}) + add_executable(${t} EXCLUDE_FROM_ALL ${TST_DIR}/${t}.c) +- target_include_directories(${t} PUBLIC ${TST_DIR}) +- target_link_libraries(${t} PUBLIC ${LIBS}) ++ target_include_directories(${t} PRIVATE ${TST_DIR}) ++ target_link_libraries(${t} PUBLIC ${TEST_LIBS}) + add_test(NAME ${t} + WORKING_DIRECTORY ${TST_DIR} + COMMAND ${t}) +@@ -269,13 +311,16 @@ configure_file(libyder.pc.in libyder.pc @ONLY) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libyder.pc + DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig) + +-set(TARGETS yder) ++set(TARGETS ) ++if (BUILD_SHARED) ++ list(APPEND TARGETS yder) ++endif () + if (BUILD_STATIC) +- set(TARGETS ${TARGETS} yder_static) ++ list(APPEND TARGETS yder_static) + endif () + + if (INSTALL_HEADER) +- install(TARGETS ${TARGETS} ++ install(TARGETS ${TARGETS} EXPORT YderExports + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +@@ -285,12 +330,33 @@ if (INSTALL_HEADER) + install(FILES README.md + DESTINATION ${CMAKE_INSTALL_DOCDIR} COMPONENT runtime) + else () +- install(TARGETS ${TARGETS} ++ install(TARGETS ${TARGETS} EXPORT YderExports + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + endif () + ++set(YDER_INSTALL_CMAKEDIR_DEFAULT "${CMAKE_INSTALL_LIBDIR}/cmake/Yder") ++if (WIN32 AND NOT MINGW) ++ set(YDER_INSTALL_CMAKEDIR_DEFAULT "cmake") ++endif () ++set(YDER_INSTALL_CMAKEDIR ${YDER_INSTALL_CMAKEDIR_DEFAULT} CACHE STRING "Location where to install the cmake config files") ++ ++install(EXPORT YderExports DESTINATION "${YDER_INSTALL_CMAKEDIR}" ++ NAMESPACE "Yder::" ++ FILE "YderTargets.cmake") ++ ++configure_package_config_file(cmake-modules/YderConfig.cmake.in YderConfig.cmake ++ INSTALL_DESTINATION "${YDER_INSTALL_CMAKEDIR}") ++write_basic_package_version_file(YderConfigVersion.cmake ++ COMPATIBILITY AnyNewerVersion) ++ ++install(FILES ++ cmake-modules/FindSystemd.cmake ++ "${PROJECT_BINARY_DIR}/YderConfig.cmake" ++ "${PROJECT_BINARY_DIR}/YderConfigVersion.cmake" ++ DESTINATION "${YDER_INSTALL_CMAKEDIR}") ++ + # uninstall target + + if (NOT TARGET uninstall) +@@ -357,6 +423,7 @@ add_custom_target(dist_y + COMMAND ${CMAKE_MAKE_PROGRAM} package_source) + + message(STATUS "Journald support: ${WITH_JOURNALD}") ++message(STATUS "Build shared library: ${BUILD_SHARED}") + message(STATUS "Build static library: ${BUILD_STATIC}") + message(STATUS "Build testing tree: ${BUILD_YDER_TESTING}") + message(STATUS "Install the header files: ${INSTALL_HEADER}") +diff --git a/cmake-modules/FindCheck.cmake b/cmake-modules/FindCheck.cmake +index 4aad6bc..16d73ef 100644 +--- a/cmake-modules/FindCheck.cmake ++++ b/cmake-modules/FindCheck.cmake +@@ -68,6 +68,12 @@ find_package_handle_standard_args(Check + if (CHECK_FOUND) + set(CHECK_LIBRARIES ${CHECK_LIBRARY}) + set(CHECK_INCLUDE_DIRS ${CHECK_INCLUDE_DIR}) ++ if (NOT TARGET Check::Check) ++ add_library(Check::Check UNKNOWN IMPORTED) ++ set_target_properties(Check::Check PROPERTIES ++ IMPORTED_LOCATION "${CHECK_LIBRARY}" ++ INTERFACE_INCLUDE_DIRECTORIES "${CHECK_INCLUDE_DIR}") ++ endif () + endif () + + mark_as_advanced(CHECK_INCLUDE_DIR CHECK_LIBRARY) +\ No newline at end of file +diff --git a/cmake-modules/FindOrcania.cmake b/cmake-modules/FindOrcania.cmake +index 0d40a07..1a42c07 100644 +--- a/cmake-modules/FindOrcania.cmake ++++ b/cmake-modules/FindOrcania.cmake +@@ -39,7 +39,7 @@ find_path(ORCANIA_INCLUDE_DIR + HINTS ${PC_ORCANIA_INCLUDEDIR} ${PC_ORCANIA_INCLUDE_DIRS}) + + find_library(ORCANIA_LIBRARY +- NAMES orcania liborcania ++ NAMES orcania liborcania orcania-static + HINTS ${PC_ORCANIA_LIBDIR} ${PC_ORCANIA_LIBRARY_DIRS}) + + set(ORCANIA_VERSION_STRING 0.0.0) +@@ -72,6 +72,12 @@ endif () + if (ORCANIA_FOUND) + set(ORCANIA_LIBRARIES ${ORCANIA_LIBRARY}) + set(ORCANIA_INCLUDE_DIRS ${ORCANIA_INCLUDE_DIR}) ++ if (NOT TARGET Orcania::Orcania) ++ add_library(Orcania::Orcania UNKNOWN IMPORTED) ++ set_target_properties(Orcania::Orcania PROPERTIES ++ IMPORTED_LOCATION "${ORCANIA_LIBRARY}" ++ INTERFACE_INCLUDE_DIRECTORIES "${ORCANIA_INCLUDE_DIR}") ++ endif () + endif () + + mark_as_advanced(ORCANIA_INCLUDE_DIR ORCANIA_LIBRARY) +diff --git a/cmake-modules/FindSubunit.cmake b/cmake-modules/FindSubunit.cmake +index 4ce3a24..700b5bc 100644 +--- a/cmake-modules/FindSubunit.cmake ++++ b/cmake-modules/FindSubunit.cmake +@@ -54,6 +54,12 @@ find_package_handle_standard_args(Subunit + if (SUBUNIT_FOUND) + set(SUBUNIT_LIBRARIES ${SUBUNIT_LIBRARY}) + set(SUBUNIT_INCLUDE_DIRS ${SUBUNIT_INCLUDE_DIR}) ++ if (NOT TARGET Subunit::Subunit) ++ add_library(Subunit::Subunit UNKNOWN IMPORTED) ++ set_target_properties(Subunit::Subunit PROPERTIES ++ IMPORTED_LOCATION "${SUBUNIT_LIBRARY}" ++ INTERFACE_INCLUDE_DIRECTORIES "${SUBUNIT_INCLUDE_DIR}") ++ endif () + endif () + + mark_as_advanced(SUBUNIT_INCLUDE_DIR SUBUNIT_LIBRARY) +\ No newline at end of file +diff --git a/cmake-modules/FindSystemd.cmake b/cmake-modules/FindSystemd.cmake +index e212b95..3a28697 100644 +--- a/cmake-modules/FindSystemd.cmake ++++ b/cmake-modules/FindSystemd.cmake +@@ -50,5 +50,11 @@ find_package_handle_standard_args(Systemd + if (SYSTEMD_FOUND) + set(SYSTEMD_LIBRARIES ${SYSTEMD_LIBRARY}) + set(SYSTEMD_INCLUDE_DIRS ${SYSTEMD_INCLUDE_DIR}) ++ if (NOT TARGET Systemd:Systemd) ++ add_library(Systemd::Systemd IMPORTED UNKNOWN) ++ set_target_properties(Systemd::Systemd PROPERTIES ++ IMPORTED_LOCATION "${SYSTEMD_LIBRARY}" ++ INTERFACE_INCLUDE_DIRECTORIES "${SYSTEMD_INCLUDE_DIR}") ++ endif () + endif () + mark_as_advanced(SYSTEMD_INCLUDE_DIR SYSTEMD_LIBRARY) +diff --git a/cmake-modules/YderConfig.cmake.in b/cmake-modules/YderConfig.cmake.in +new file mode 100644 +index 0000000..eaa89da +--- /dev/null ++++ b/cmake-modules/YderConfig.cmake.in +@@ -0,0 +1,32 @@ ++@PACKAGE_INIT@ ++ ++include("${CMAKE_CURRENT_LIST_DIR}/YderTargets.cmake") ++ ++set(YDER_JOURNALD @WITH_JOURNALD@) ++ ++set(CMAKE_CURRENT_LIST_DIR ${_original_cmake_module_path}) ++ ++if(TARGET Yder::Yder-static) ++ set(ORCANIA_INCLUDE_DIRS $) ++ set(ORCANIA_LIBRARIES Yder::Yder-static) ++endif() ++ ++if(TARGET Yder::Yder) ++ set(ORCANIA_INCLUDE_DIRS $) ++ set(ORCANIA_LIBRARIES Yder::Yder) ++endif() ++ ++include(CMakeFindDependencyMacro) ++ ++set(_original_cmake_module_path ${CMAKE_MODULE_PATH}) ++list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}") ++ ++find_dependency(Orcania) ++set(YDER_VERSION_STRING "@PACKAGE_VERSION@") ++if(TARGET Yder::Yder-static) ++ if(YDER_JOURNALD) ++ find_dependency(Systemd) ++ endif() ++endif() ++set(CMAKE_MODULE_PATH ${_original_cmake_module_path}) ++set(Yder_FOUND TRUE) +diff --git a/doc/doxygen.cfg b/doc/doxygen.cfg +index e8f2b8b..8ac5f16 100644 diff --git a/recipes/yder/all/test_package/CMakeLists.txt b/recipes/yder/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..604a54d72e91e --- /dev/null +++ b/recipes/yder/all/test_package/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +find_package(Yder REQUIRED CONFIG) + +option(YDER_SHARED "Yder is built as a shared library") + +add_executable(${PROJECT_NAME} test_package.c) +if(YDER_SHARED) + target_link_libraries(${PROJECT_NAME} PRIVATE Yder::Yder) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE Yder::Yder-static) +endif() diff --git a/recipes/yder/all/test_package/conanfile.py b/recipes/yder/all/test_package/conanfile.py new file mode 100644 index 0000000000000..0585cd25bd7ad --- /dev/null +++ b/recipes/yder/all/test_package/conanfile.py @@ -0,0 +1,31 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["YDER_SHARED"] = self.dependencies["yder"].options.shared + tc.generate() + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/yder/all/test_package/test_package.c b/recipes/yder/all/test_package/test_package.c new file mode 100644 index 0000000000000..0892f7d0a7c3a --- /dev/null +++ b/recipes/yder/all/test_package/test_package.c @@ -0,0 +1,13 @@ +#include +#include + +int main() { + y_init_logs("test_package", Y_LOG_MODE_CONSOLE, Y_LOG_LEVEL_DEBUG, NULL, "Logging started"); + y_log_message(Y_LOG_LEVEL_INFO, "We started"); + y_log_message(Y_LOG_LEVEL_DEBUG, "Are we really?"); + y_log_message(Y_LOG_LEVEL_WARNING, "We have nothing to do!"); + y_log_message(Y_LOG_LEVEL_ERROR, "Oops!"); + y_log_message(Y_LOG_LEVEL_INFO, "Bye then!"); + y_close_logs(); + return 0; +} diff --git a/recipes/yder/all/test_v1_package/CMakeLists.txt b/recipes/yder/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..376a5ed06c20a --- /dev/null +++ b/recipes/yder/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,16 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") +conan_basic_setup(TARGETS) + +find_package(Yder REQUIRED CONFIG) + +option(YDER_SHARED "Yder is built as a shared library") + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +if(YDER_SHARED) + target_link_libraries(${PROJECT_NAME} PRIVATE Yder::Yder) +else() + target_link_libraries(${PROJECT_NAME} PRIVATE Yder::Yder-static) +endif() diff --git a/recipes/yder/all/test_v1_package/conanfile.py b/recipes/yder/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..af01824ff624e --- /dev/null +++ b/recipes/yder/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["YDER_SHARED"] = self.options["yder"].shared + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/yder/config.yml b/recipes/yder/config.yml new file mode 100644 index 0000000000000..76bddfaab892d --- /dev/null +++ b/recipes/yder/config.yml @@ -0,0 +1,3 @@ +versions: + "1.4.18": + folder: all diff --git a/recipes/yyjson/all/conandata.yml b/recipes/yyjson/all/conandata.yml index c6b67c28471fe..683231e89f238 100644 --- a/recipes/yyjson/all/conandata.yml +++ b/recipes/yyjson/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "0.6.0": + url: "https://github.com/ibireme/yyjson/archive/refs/tags/0.6.0.tar.gz" + sha256: "75aa65d2944b3f64ce5918aa3da00f738dc695a0e8e0662de0063aafe1a8662f" "0.5.1": url: "https://github.com/ibireme/yyjson/archive/refs/tags/0.5.1.tar.gz" sha256: "b484d40b4e20cc3174a6fdc160d0f20f961417f9cb3f6dc1cf6555fffa8359f3" diff --git a/recipes/yyjson/all/conanfile.py b/recipes/yyjson/all/conanfile.py index 183c1889a57b5..5fd04cf964be2 100644 --- a/recipes/yyjson/all/conanfile.py +++ b/recipes/yyjson/all/conanfile.py @@ -3,7 +3,7 @@ from conan.tools.files import copy, get, rmdir import os -required_conan_version = ">=1.47.0" +required_conan_version = ">=1.53.0" class YyjsonConan(ConanFile): @@ -30,15 +30,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") diff --git a/recipes/yyjson/all/test_v1_package/CMakeLists.txt b/recipes/yyjson/all/test_v1_package/CMakeLists.txt index cb1df2a6ebd48..925ecbe19e448 100644 --- a/recipes/yyjson/all/test_v1_package/CMakeLists.txt +++ b/recipes/yyjson/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(yyjson REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE yyjson::yyjson) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/yyjson/all/test_v1_package/conanfile.py b/recipes/yyjson/all/test_v1_package/conanfile.py index 75c0cd81d2d2f..38f4483872d47 100644 --- a/recipes/yyjson/all/test_v1_package/conanfile.py +++ b/recipes/yyjson/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/yyjson/config.yml b/recipes/yyjson/config.yml index 6f86c15c188be..c1abc92e2b1b8 100644 --- a/recipes/yyjson/config.yml +++ b/recipes/yyjson/config.yml @@ -1,4 +1,6 @@ versions: + "0.6.0": + folder: all "0.5.1": folder: all "0.5.0": diff --git a/recipes/zeromq/all/CMakeLists.txt b/recipes/zeromq/all/CMakeLists.txt deleted file mode 100644 index 0611895d93c39..0000000000000 --- a/recipes/zeromq/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(MSVC) - add_definitions("-D_NOEXCEPT=noexcept") -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/zeromq/all/conandata.yml b/recipes/zeromq/all/conandata.yml index b6f5c8a82efc1..099a8577c05d9 100644 --- a/recipes/zeromq/all/conandata.yml +++ b/recipes/zeromq/all/conandata.yml @@ -1,24 +1,22 @@ sources: "4.3.4": - url: "https://github.com/zeromq/libzmq/archive/v4.3.4.tar.gz" - sha256: "0ff5a531c9ffaf0dfdc7dc78d13d1383088f454896d252934c429b2554d10559" + url: "https://github.com/zeromq/libzmq/releases/download/v4.3.4/zeromq-4.3.4.tar.gz" + sha256: "c593001a89f5a85dd2ddf564805deb860e02471171b3f204944857336295c3e5" "4.3.3": - url: "https://github.com/zeromq/libzmq/archive/v4.3.3.tar.gz" - sha256: "c4fd999d67cd12872a8604162f2b1cf5b5a02fb807a88215f0f96bd50331b166" + url: "https://github.com/zeromq/libzmq/releases/download/v4.3.3/zeromq-4.3.3.tar.gz" + sha256: "9d9285db37ae942ed0780c016da87060497877af45094ff9e1a1ca736e3875a2" "4.3.2": - url: "https://github.com/zeromq/libzmq/archive/v4.3.2.tar.gz" - sha256: "02ecc88466ae38cf2c8d79f09cfd2675ba299a439680b64ade733e26a349edeb" + url: "https://github.com/zeromq/libzmq/releases/download/v4.3.2/zeromq-4.3.2.tar.gz" + sha256: "ebd7b5c830d6428956b67a0454a7f8cbed1de74b3b01e5c33c5378e22740f763" patches: "4.3.4": - patch_file: "patches/0003-rpath-macos-4.3.3.patch" - base_path: "source_subfolder" + - patch_file: "patches/0004-cmake-minimum-required-first.patch" "4.3.3": - patch_file: "patches/0003-rpath-macos-4.3.3.patch" - base_path: "source_subfolder" + - patch_file: "patches/0004-cmake-minimum-required-first.patch" "4.3.2": - patch_file: "patches/0001-problem-__try-and-__except-isn-t-universally-supported-on-windows.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-problem-invalid-syntax-for-calling-convention-on-function.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-rpath-macos-4.3.2.patch" - base_path: "source_subfolder" + - patch_file: "patches/0004-cmake-minimum-required-first.patch" diff --git a/recipes/zeromq/all/conanfile.py b/recipes/zeromq/all/conanfile.py index 80aa0c2911613..d7a259f237734 100644 --- a/recipes/zeromq/all/conanfile.py +++ b/recipes/zeromq/all/conanfile.py @@ -1,9 +1,13 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rm, rmdir, save +from conan.tools.microsoft import is_msvc +from conan.tools.scm import Version import os import textwrap -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.53.0" class ZeroMQConan(ConanFile): @@ -36,21 +40,8 @@ class ZeroMQConan(ConanFile): "with_radix_tree": False, } - generators = "cmake", "cmake_find_package" - _cmake = None - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -58,7 +49,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.encryption == "libsodium": @@ -73,85 +67,81 @@ def validate(self): ) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ENABLE_CURVE"] = bool(self.options.encryption) - self._cmake.definitions["WITH_LIBSODIUM"] = self.options.encryption == "libsodium" - self._cmake.definitions["ZMQ_BUILD_TESTS"] = False - self._cmake.definitions["WITH_PERF_TOOL"] = False - self._cmake.definitions["BUILD_SHARED"] = self.options.shared - self._cmake.definitions["BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["BUILD_TESTS"] = False - self._cmake.definitions["ENABLE_CPACK"] = False - self._cmake.definitions["WITH_DOCS"] = False - self._cmake.definitions["WITH_DOC"] = False - self._cmake.definitions["WITH_NORM"] = self.options.with_norm - self._cmake.definitions["ENABLE_DRAFTS"] = self.options.with_draft_api - self._cmake.definitions["ENABLE_WS"] = self.options.with_websocket - self._cmake.definitions["ENABLE_RADIX_TREE"] = self.options.with_radix_tree + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ENABLE_CURVE"] = bool(self.options.encryption) + tc.variables["WITH_LIBSODIUM"] = self.options.encryption == "libsodium" + tc.variables["ZMQ_BUILD_TESTS"] = False + tc.variables["WITH_PERF_TOOL"] = False + tc.variables["BUILD_SHARED"] = self.options.shared + tc.variables["BUILD_STATIC"] = not self.options.shared + tc.variables["BUILD_TESTS"] = False + tc.variables["ENABLE_CPACK"] = False + tc.variables["WITH_DOCS"] = False + tc.variables["WITH_DOC"] = False + tc.variables["WITH_NORM"] = self.options.with_norm + tc.variables["ENABLE_DRAFTS"] = self.options.with_draft_api + tc.variables["ENABLE_WS"] = self.options.with_websocket + tc.variables["ENABLE_RADIX_TREE"] = self.options.with_radix_tree if self.options.poller: - self._cmake.definitions["POLLER"] = self.options.poller - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + tc.variables["POLLER"] = self.options.poller + if is_msvc(self): + tc.preprocessor_definitions["_NOEXCEPT"] = "noexcept" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - os.unlink(os.path.join(self._source_subfolder, "builds", "cmake", "Modules", "FindSodium.cmake")) - + apply_conandata_patches(self) if self.options.encryption == "libsodium": - os.rename("Findlibsodium.cmake", "FindSodium.cmake") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "SODIUM_FOUND", - "libsodium_FOUND") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "SODIUM_INCLUDE_DIRS", - "libsodium_INCLUDE_DIRS") - tools.replace_in_file(os.path.join(self._source_subfolder, "CMakeLists.txt"), - "SODIUM_LIBRARIES", - "libsodium_LIBRARIES") + cmakelists = os.path.join(self.source_folder, "CMakeLists.txt") + cpp_info_sodium = self.dependencies["libsodium"].cpp_info + sodium_config = cpp_info_sodium.get_property("cmake_file_name") or "libsodium" + sodium_target = cpp_info_sodium.get_property("cmake_target_name") or "libsodium::libsodium" + find_sodium = "find_package(Sodium)" if Version(self.version) < "4.3.3" else "find_package(\"Sodium\")" + replace_in_file(self, cmakelists, find_sodium, f"find_package({sodium_config} REQUIRED CONFIG)") + replace_in_file(self, cmakelists, "SODIUM_FOUND", f"{sodium_config}_FOUND") + replace_in_file(self, cmakelists, "SODIUM_INCLUDE_DIRS", f"{sodium_config}_INCLUDE_DIRS") + replace_in_file(self, cmakelists, "${SODIUM_LIBRARIES}", sodium_target) def build(self): self._patch_sources() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="COPYING*", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, "COPYING*", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.rmdir(os.path.join(self.package_folder, "CMake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rm(self, "*.pdb", os.path.join(self.package_folder, "bin")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rmdir(self, os.path.join(self.package_folder, "CMake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) # TODO: to remove in conan v2 once cmake_find_package* generators removed self._create_cmake_module_alias_targets( os.path.join(self.package_folder, self._module_file_rel_path), - {self._libzmq_target: "ZeroMQ::{}".format(self._libzmq_target)} + {self._libzmq_target: f"ZeroMQ::{self._libzmq_target}"}, ) - @staticmethod - def _create_cmake_module_alias_targets(module_file, targets): + def _create_cmake_module_alias_targets(self, module_file, targets): content = "" for alias, aliased in targets.items(): - content += textwrap.dedent("""\ + content += textwrap.dedent(f"""\ if(TARGET {aliased} AND NOT TARGET {alias}) add_library({alias} INTERFACE IMPORTED) set_property(TARGET {alias} PROPERTY INTERFACE_LINK_LIBRARIES {aliased}) endif() - """.format(alias=alias, aliased=aliased)) - tools.save(module_file, content) + """) + save(self, module_file, content) @property def _module_file_rel_path(self): - return os.path.join("lib", "cmake", "conan-official-{}-targets.cmake".format(self.name)) + return os.path.join("lib", "cmake", f"conan-official-{self.name}-targets.cmake") @property def _libzmq_target(self): @@ -163,7 +153,7 @@ def package_info(self): self.cpp_info.set_property("pkg_config_name", "libzmq") # TODO: back to global scope in conan v2 once cmake_find_package_* generators removed - self.cpp_info.components["libzmq"].libs = tools.collect_libs(self) + self.cpp_info.components["libzmq"].libs = collect_libs(self) if self.settings.os == "Windows": self.cpp_info.components["libzmq"].system_libs = ["iphlpapi", "ws2_32"] elif self.settings.os in ["Linux", "FreeBSD"]: diff --git a/recipes/zeromq/all/patches/0004-cmake-minimum-required-first.patch b/recipes/zeromq/all/patches/0004-cmake-minimum-required-first.patch new file mode 100644 index 0000000000000..75064b1ea9822 --- /dev/null +++ b/recipes/zeromq/all/patches/0004-cmake-minimum-required-first.patch @@ -0,0 +1,15 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,11 +1,11 @@ + # CMake build script for ZeroMQ +-project(ZeroMQ) + + if(1) + cmake_minimum_required(VERSION 3.0.2) + else() + cmake_minimum_required(VERSION 2.8.12) + endif() ++project(ZeroMQ) + + include(CheckIncludeFiles) + include(CheckCCompilerFlag) diff --git a/recipes/zeromq/all/test_package/CMakeLists.txt b/recipes/zeromq/all/test_package/CMakeLists.txt index 4b5e1b762305a..e02c2ff4211bd 100644 --- a/recipes/zeromq/all/test_package/CMakeLists.txt +++ b/recipes/zeromq/all/test_package/CMakeLists.txt @@ -1,24 +1,22 @@ cmake_minimum_required(VERSION 3.1) -project(test_package) +project(test_package LANGUAGES CXX) option(WITH_LIBSODIUM "zeromq is built with libsodium") - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +option(WITH_NORM "zeromq is built with norm") find_package(ZeroMQ REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) if(ZEROMQ_SHARED) - target_link_libraries(${PROJECT_NAME} libzmq) + target_link_libraries(${PROJECT_NAME} PRIVATE libzmq) else() - target_link_libraries(${PROJECT_NAME} libzmq-static) + target_link_libraries(${PROJECT_NAME} PRIVATE libzmq-static) endif() if(WITH_LIBSODIUM) - target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_LIBSODIUM") + target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_LIBSODIUM") endif() if(WITH_NORM) - target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_NORM") + target_compile_definitions(${PROJECT_NAME} PRIVATE "WITH_NORM") endif() diff --git a/recipes/zeromq/all/test_package/conanfile.py b/recipes/zeromq/all/test_package/conanfile.py index 9703af61ec346..0378d2924042d 100644 --- a/recipes/zeromq/all/test_package/conanfile.py +++ b/recipes/zeromq/all/test_package/conanfile.py @@ -1,20 +1,33 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["WITH_LIBSODIUM"] = self.dependencies["zeromq"].options.encryption == "libsodium" + tc.variables["ZEROMQ_SHARED"] = self.dependencies["zeromq"].options.shared + tc.variables["WITH_NORM"] = self.dependencies["zeromq"].options.with_norm + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["WITH_LIBSODIUM"] = self.options["zeromq"].encryption == "libsodium" - cmake.definitions["ZEROMQ_SHARED"] = self.options["zeromq"].shared - cmake.definitions["WITH_NORM"] = self.options["zeromq"].with_norm cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zeromq/all/test_v1_package/CMakeLists.txt b/recipes/zeromq/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/zeromq/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/zeromq/all/test_v1_package/conanfile.py b/recipes/zeromq/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..507e0ac53bc64 --- /dev/null +++ b/recipes/zeromq/all/test_v1_package/conanfile.py @@ -0,0 +1,20 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["WITH_LIBSODIUM"] = self.options["zeromq"].encryption == "libsodium" + cmake.definitions["ZEROMQ_SHARED"] = self.options["zeromq"].shared + cmake.definitions["WITH_NORM"] = self.options["zeromq"].with_norm + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/zfp/all/conandata.yml b/recipes/zfp/all/conandata.yml index dec3f160008dd..308872a236805 100644 --- a/recipes/zfp/all/conandata.yml +++ b/recipes/zfp/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.0": + url: "https://github.com/LLNL/zfp/releases/download/1.0.0/zfp-1.0.0.tar.gz" + sha256: "0ea08ae3e50e3c92f8b8cf41ba5b6e2de8892bc4a4ca0c59b8945b6c2ab617c4" "0.5.5": - url: "https://github.com/LLNL/zfp/archive/0.5.5.tar.gz" - sha256: "6a7f4934489087d9c117a4af327fd6495ea757924f4df467b9c537abf8bd86c4" + url: "https://github.com/LLNL/zfp/releases/download/0.5.5/zfp-0.5.5.tar.gz" + sha256: "fdf7b948bab1f4e5dccfe2c2048fd98c24e417ad8fb8a51ed3463d04147393c5" diff --git a/recipes/zfp/all/conanfile.py b/recipes/zfp/all/conanfile.py index a7dd27bf0e399..603564c0343e6 100644 --- a/recipes/zfp/all/conanfile.py +++ b/recipes/zfp/all/conanfile.py @@ -4,7 +4,7 @@ from conan.tools.microsoft import is_msvc import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.54.0" class ZfpConan(ConanFile): @@ -13,7 +13,7 @@ class ZfpConan(ConanFile): homepage = "https://github.com/LLNL/zfp" url = "https://github.com/conan-io/conan-center-index" license = "BSD-3-Clause" - topics = ("zfp", "compression", "arrays") + topics = ("compression", "arrays") settings = "os", "arch", "compiler", "build_type" options = { @@ -47,20 +47,19 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - if self.info.options.with_cuda: + if self.options.with_cuda: self.output.warn("Conan package for CUDA is not available, this package will be used from system.") - if self.info.options.with_openmp: + if self.options.with_openmp: self.output.warn("Conan package for OpenMP is not available, this package will be used from system.") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) @@ -78,8 +77,6 @@ def generate(self): if self.settings.os != "Windows" and not self.options.shared: tc.variables["ZFP_ENABLE_PIC"] = self.options.fPIC tc.variables["BUILD_TESTING"] = False - # Honor BUILD_SHARED_LIBS from conan_toolchain (see https://github.com/conan-io/conan/issues/11840) - tc.cache_variables["CMAKE_POLICY_DEFAULT_CMP0077"] = "NEW" tc.generate() def build(self): @@ -119,6 +116,9 @@ def package_info(self): self.cpp_info.components["_zfp"].sharedlinkflags = openmp_flags self.cpp_info.components["_zfp"].exelinkflags = openmp_flags + if self.settings.os in ["Linux", "FreeBSD"]: + self.cpp_info.components["_zfp"].system_libs.append("m") + # TODO: to remove in conan v2 once cmake_find_package_* generators removed self.cpp_info.components["_zfp"].names["cmake_find_package"] = "zfp" self.cpp_info.components["_zfp"].names["cmake_find_package_multi"] = "zfp" diff --git a/recipes/zfp/all/test_package/conanfile.py b/recipes/zfp/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/zfp/all/test_package/conanfile.py +++ b/recipes/zfp/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/zfp/all/test_package/test_package.cpp b/recipes/zfp/all/test_package/test_package.cpp index f86f80103efc1..29a08fccd4085 100644 --- a/recipes/zfp/all/test_package/test_package.cpp +++ b/recipes/zfp/all/test_package/test_package.cpp @@ -1,6 +1,12 @@ #include -#include "zfparray2.h" +#include "zfp.h" + +#if ZFP_VERSION_MAJOR < 1 +# include "zfparray2.h" +#else +# include "zfp/array2.hpp" +#endif template inline double total(const array2d& u) diff --git a/recipes/zfp/all/test_v1_package/CMakeLists.txt b/recipes/zfp/all/test_v1_package/CMakeLists.txt index e25a4eb173195..0d20897301b68 100644 --- a/recipes/zfp/all/test_v1_package/CMakeLists.txt +++ b/recipes/zfp/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES CXX) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(zfp REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.cpp) -target_link_libraries(${PROJECT_NAME} PRIVATE zfp::zfp) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/zfp/config.yml b/recipes/zfp/config.yml index 0c58157bbf9a6..3e7309cad846c 100644 --- a/recipes/zfp/config.yml +++ b/recipes/zfp/config.yml @@ -1,3 +1,5 @@ versions: + "1.0.0": + folder: all "0.5.5": folder: all diff --git a/recipes/zimg/all/conandata.yml b/recipes/zimg/all/conandata.yml index 401a58d84be23..6f58da26deae3 100644 --- a/recipes/zimg/all/conandata.yml +++ b/recipes/zimg/all/conandata.yml @@ -9,46 +9,25 @@ sources: url: "https://github.com/sekrit-twc/zimg/archive/release-3.0.2.tar.gz" sha256: "b9eadf1df12ae8395ba781f2468965d411b21abbebbebeae3651d492227d4633" "3.0.1": - sha256: "c50a0922f4adac4efad77427d13520ed89b8366eef0ef2fa379572951afcc73f" url: "https://github.com/sekrit-twc/zimg/archive/release-3.0.1.tar.gz" + sha256: "c50a0922f4adac4efad77427d13520ed89b8366eef0ef2fa379572951afcc73f" "2.9.3": - sha256: "a15c0483fbe945ffe695a1a989bc43b3381c8bf33e2d1760464ec21d32cdf30b" url: "https://github.com/sekrit-twc/zimg/archive/release-2.9.3.tar.gz" + sha256: "a15c0483fbe945ffe695a1a989bc43b3381c8bf33e2d1760464ec21d32cdf30b" patches: "3.0.4": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-msvc-remove-toolset-3.0.1.patch" - base_path: "source_subfolder" "3.0.3": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-msvc-remove-toolset-3.0.1.patch" - base_path: "source_subfolder" "3.0.2": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-msvc-remove-toolset-3.0.1.patch" - base_path: "source_subfolder" "3.0.1": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - - patch_file: "patches/0005-msvc-remove-toolset-3.0.1.patch" - base_path: "source_subfolder" "2.9.3": - - patch_file: "patches/0001-msvc-remove-toolset-common.patch" - base_path: "source_subfolder" + - patch_file: "patches/0001-msvc-remove-windows-target-platform.patch" - patch_file: "patches/0002-msvc-solution.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-include-stddef.patch" - base_path: "source_subfolder" - - patch_file: "patches/0004-msvc-remove-toolset-2.9.3.patch" - base_path: "source_subfolder" diff --git a/recipes/zimg/all/conanfile.py b/recipes/zimg/all/conanfile.py index 21a47de5a9593..6332a7e16ebe2 100644 --- a/recipes/zimg/all/conanfile.py +++ b/recipes/zimg/all/conanfile.py @@ -1,17 +1,20 @@ -from conan.tools.files import rename -from conan.tools.microsoft import is_msvc -from conans import ConanFile, AutoToolsBuildEnvironment, MSBuild, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.tools.apple import fix_apple_shared_install_name +from conan.tools.build import stdcpp_library +from conan.tools.env import VirtualBuildEnv +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rename, replace_in_file, rm, rmdir +from conan.tools.gnu import Autotools, AutotoolsToolchain +from conan.tools.layout import basic_layout +from conan.tools.microsoft import check_min_vs, is_msvc, MSBuild, MSBuildToolchain import os -required_conan_version = ">=1.45.0" +required_conan_version = ">=1.54.0" class ZimgConan(ConanFile): name = "zimg" description = "Scaling, colorspace conversion, and dithering library" - topics = ("zimg", "image", "manipulation") + topics = ("image", "manipulation") homepage = "https://github.com/sekrit-twc/zimg" url = "https://github.com/conan-io/conan-center-index" license = "WTFPL" @@ -26,17 +29,16 @@ class ZimgConan(ConanFile): "fPIC": True, } - @property - def _source_subfolder(self): - return "source_subfolder" - @property def _settings_build(self): return getattr(self, "settings_build", self.settings) + @property + def _msbuild_configuration(self): + return "Debug" if self.settings.build_type == "Debug" else "Release" + def export_sources(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -44,106 +46,103 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + basic_layout(self, src_folder="src") def validate(self): - if self.settings.build_type not in ("Release", "Debug"): - raise ConanInvalidConfiguration("zimg does not support the build type '{}'.".format(self.settings.build_type)) - if self.settings.compiler == "Visual Studio" and tools.Version(self.settings.compiler.version) < "15": - raise ConanInvalidConfiguration("zimg requires at least Visual Studio 15 2017") + check_min_vs(self, 191) def build_requirements(self): if not is_msvc(self): - self.build_requires("libtool/2.4.6") - if self._settings_build.os == "Windows" and not tools.get_env("CONAN_BASH_PATH"): - self.build_requires("msys2/cci.latest") + self.tool_requires("libtool/2.4.7") + if self._settings_build.os == "Windows": + self.win_bash = True + if not self.conf.get("tools.microsoft.bash:path", check_type=str): + self.tool_requires("msys2/cci.latest") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_autools(self): - autotools = AutoToolsBuildEnvironment(self, win_bash=tools.os_info.is_windows) - yes_no = lambda v: "yes" if v else "no" - conf_args = [ - "--enable-shared={}".format(yes_no(self.options.shared)), - "--enable-static={}".format(yes_no(not self.options.shared)), - ] - autotools.configure(args=conf_args, configure_dir=self._source_subfolder) - return autotools - - def _build_autotools(self): - with tools.chdir(self._source_subfolder): - self.run("{} -fiv".format(tools.get_env("AUTORECONF")), win_bash=tools.os_info.is_windows) - # relocatable shared lib on macOS - tools.replace_in_file("configure", "-install_name \\$rpath/", "-install_name @rpath/") - autotools = self._configure_autools() - autotools.make() - - _sln_platforms = { - "x86": "Win32", - "x86_64": "x64", - "armv6": "ARM", - "armv7": "ARM", - "armv7hf": "ARM", - "armv7s": "ARM", - "armv7k": "ARM", - "armv8_32": "ARM", - "armv8": "ARM64", - "armv8.3": "ARM64", - } - - def _build_msvc(self): - msbuild = MSBuild(self) - msbuild.build(os.path.join(self._source_subfolder, "_msvc", "zimg.sln"), - targets=["dll" if self.options.shared else "zimg"], - platforms=self._sln_platforms) - - def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + get(self, **self.conan_data["sources"][self.version], strip_root=True) + def generate(self): if is_msvc(self): - self._build_msvc() + tc = MSBuildToolchain(self) + tc.configuration = self._msbuild_configuration + tc.properties["WholeProgramOptimization"] = "false" + tc.generate() else: - self._build_autotools() - - def _package_autotools(self): - autotools = self._configure_autools() - autotools.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) - tools.rmdir(os.path.join(self.package_folder, "share")) - tools.remove_files_by_mask(os.path.join(self.package_folder, "lib"), "*.la") - - def _package_msvc(self): - self.copy("zimg.h", src=os.path.join(self._source_subfolder, "src", "zimg", "api"), dst="include") - self.copy("zimg++.hpp", src=os.path.join(self._source_subfolder, "src", "zimg", "api"), dst="include") + VirtualBuildEnv(self).generate() + tc = AutotoolsToolchain(self) + tc.generate() - sln_dir = os.path.join(self._source_subfolder, "_msvc", self._sln_platforms[str(self.settings.arch)], str(self.settings.build_type)) - if self.options.shared: - self.copy("z_imp.lib", src=sln_dir, dst="lib") - self.copy("z.dll", src=sln_dir, dst="bin") - rename(self, os.path.join(self.package_folder, "lib", "z_imp.lib"), - os.path.join(self.package_folder, "lib", "zimg.lib")) + def build(self): + apply_conandata_patches(self) + if is_msvc(self): + #========================== + # TODO: to remove once https://github.com/conan-io/conan/pull/12817 available in conan client + vcxproj_files = [ + os.path.join(self.source_folder, "_msvc", "zimg", "zimg.vcxproj"), + os.path.join(self.source_folder, "_msvc", "dll", "dll.vcxproj"), + ] + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + "true", + "" + ) + platform_toolset = MSBuildToolchain(self).toolset + conantoolchain_props = os.path.join(self.generators_folder, MSBuildToolchain.filename) + for vcxproj_file in vcxproj_files: + replace_in_file( + self, vcxproj_file, + "v142", + f"{platform_toolset}", + ) + replace_in_file( + self, vcxproj_file, + "", + f"", + ) + #========================== + + msbuild = MSBuild(self) + msbuild.build_type = self._msbuild_configuration + msbuild.platform = "Win32" if self.settings.arch == "x86" else msbuild.platform + msbuild.build(os.path.join(self.source_folder, "_msvc", "zimg.sln"), + targets=["dll" if self.options.shared else "zimg"]) else: - self.copy("z.lib", src=sln_dir, dst="lib") - rename(self, os.path.join(self.package_folder, "lib", "z.lib"), - os.path.join(self.package_folder, "lib", "zimg.lib")) + autotools = Autotools(self) + autotools.autoreconf() + autotools.configure() + autotools.make() def package(self): - self.copy("COPYING", src=self._source_subfolder, dst="licenses") + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) if is_msvc(self): - self._package_msvc() + src_include_dir = os.path.join(self.source_folder, "src", "zimg", "api") + copy(self, "zimg.h", src=src_include_dir, dst=os.path.join(self.package_folder, "include")) + copy(self, "zimg++.hpp", src=src_include_dir, dst=os.path.join(self.package_folder, "include")) + output_dir = os.path.join(self.source_folder, "_msvc") + copy(self, "*.lib", src=output_dir, dst=os.path.join(self.package_folder, "lib"), keep_path=False) + copy(self, "*.dll", src=output_dir, dst=os.path.join(self.package_folder, "bin"), keep_path=False) + old_lib = "z_imp.lib" if self.options.shared else "z.lib" + rename(self, os.path.join(self.package_folder, "lib", old_lib), + os.path.join(self.package_folder, "lib", "zimg.lib")) else: - self._package_autotools() + autotools = Autotools(self) + autotools.install() + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "share")) + rm(self, "*.la", os.path.join(self.package_folder, "lib")) + fix_apple_shared_install_name(self) def package_info(self): self.cpp_info.set_property("pkg_config_name", "zimg") self.cpp_info.libs = ["zimg"] if not self.options.shared: if self.settings.os in ("FreeBSD", "Linux"): - self.cpp_info.system_libs = ["m"] - stdcpp = tools.stdcpp_library(self) - if stdcpp: - self.cpp_info.system_libs.append(stdcpp) + self.cpp_info.system_libs.append("m") + libcxx = stdcpp_library(self) + if libcxx: + self.cpp_info.system_libs.append(libcxx) diff --git a/recipes/zimg/all/patches/0001-msvc-remove-toolset-common.patch b/recipes/zimg/all/patches/0001-msvc-remove-toolset-common.patch deleted file mode 100644 index 4379125fd4c4a..0000000000000 --- a/recipes/zimg/all/patches/0001-msvc-remove-toolset-common.patch +++ /dev/null @@ -1,630 +0,0 @@ ---- _msvc/_example_api/_example_api.vcxproj -+++ _msvc/_example_api/_example_api.vcxproj 2020-08-03 17:07:28.593014100 +0200 -@@ -40,58 +40,58 @@ - - {66EEC0BD-2C32-4B40-A180-B4C25B484D23} - _example_api -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/_example_api_c/_example_api_c.vcxproj -+++ _msvc/_example_api_c/_example_api_c.vcxproj 2020-08-03 17:07:28.608645400 +0200 -@@ -40,58 +40,58 @@ - - {A8C79983-2F34-4E94-A86C-C44130FAB928} - _example_api_c -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/_example_hdr/_example_hdr.vcxproj -+++ _msvc/_example_hdr/_example_hdr.vcxproj 2020-08-03 17:07:28.624263600 +0200 -@@ -37,58 +37,58 @@ - - {613FBE86-C438-4F7C-AB69-4C024C5305D5} - _example_hdr -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/_example_interlace/_example_interlace.vcxproj -+++ _msvc/_example_interlace/_example_interlace.vcxproj 2020-08-03 17:07:28.646395600 +0200 -@@ -40,58 +40,58 @@ - - {6D8D14B2-6D32-45E3-A205-AA74DE2FBE7F} - _example_interlace -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/_example_tile/_example_tile.vcxproj -+++ _msvc/_example_tile/_example_tile.vcxproj 2020-08-03 17:07:28.662027800 +0200 -@@ -38,58 +38,58 @@ - 15.0 - {53972BF2-7BFE-4A09-81E0-DC6EAF065D94} - exampletile -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/dll/dll.vcxproj -+++ _msvc/dll/dll.vcxproj 2020-08-03 17:07:28.508393400 +0200 -@@ -43,58 +43,58 @@ - - {96822C64-B0B6-49F3-A24C-F9C5FDB02DD3} - dll -- 10.0 -+ - - - - DynamicLibrary - true -- v142 -+ - Unicode - - - DynamicLibrary - true -- v142 -+ - Unicode - - - DynamicLibrary - true -- v142 -+ - Unicode - - - DynamicLibrary - false -- v142 -+ - true - Unicode - - - DynamicLibrary - false -- v142 -+ - true - Unicode - - - DynamicLibrary - false -- v142 -+ - true - Unicode - - - DynamicLibrary - true -- v142 -+ - Unicode - - - DynamicLibrary - false -- v142 -+ - true - Unicode - ---- _msvc/testapp/testapp.vcxproj -+++ _msvc/testapp/testapp.vcxproj 2020-08-03 17:07:28.524017800 +0200 -@@ -57,58 +57,58 @@ - - {B85E6CC0-ED80-487D-805A-DA3597A15CE6} - TestApp -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/testcommon/testcommon.vcxproj -+++ _msvc/testcommon/testcommon.vcxproj 2020-08-03 17:07:28.546136800 +0200 -@@ -37,58 +37,58 @@ - - {3849AF96-797C-4322-AD39-810D8367684D} - TestCommon -- 10.0 -+ - - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - ---- _msvc/zimg/zimg.vcxproj -+++ _msvc/zimg/zimg.vcxproj 2020-08-03 17:07:28.577392500 +0200 -@@ -37,58 +37,58 @@ - - {C8629E57-4D6F-40FA-82FC-B39824195932} - zimg -- 10.0 -+ - - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - - - StaticLibrary - true -- v142 -+ - Unicode - - - StaticLibrary - false -- v142 -+ - true - Unicode - diff --git a/recipes/zimg/all/patches/0001-msvc-remove-windows-target-platform.patch b/recipes/zimg/all/patches/0001-msvc-remove-windows-target-platform.patch new file mode 100644 index 0000000000000..f445b3e2da987 --- /dev/null +++ b/recipes/zimg/all/patches/0001-msvc-remove-windows-target-platform.patch @@ -0,0 +1,22 @@ +--- a/_msvc/dll/dll.vcxproj ++++ b/_msvc/dll/dll.vcxproj +@@ -43,7 +43,7 @@ + + {96822C64-B0B6-49F3-A24C-F9C5FDB02DD3} + dll +- 10.0 ++ + + + +--- a/_msvc/zimg/zimg.vcxproj ++++ b/_msvc/zimg/zimg.vcxproj +@@ -37,7 +37,7 @@ + + {C8629E57-4D6F-40FA-82FC-B39824195932} + zimg +- 10.0 ++ + + + diff --git a/recipes/zimg/all/patches/0004-msvc-remove-toolset-2.9.3.patch b/recipes/zimg/all/patches/0004-msvc-remove-toolset-2.9.3.patch deleted file mode 100644 index 7f3bd48e5a6a5..0000000000000 --- a/recipes/zimg/all/patches/0004-msvc-remove-toolset-2.9.3.patch +++ /dev/null @@ -1,110 +0,0 @@ ---- _msvc/_example_alpha/_example_alpha.vcxproj -+++ _msvc/_example_alpha/_example_alpha.vcxproj 2020-08-03 17:07:28.593014100 +0200 -@@ -37,58 +37,58 @@ - - {3C822249-7551-4086-AF0B-F43871F36191} - _example_alpha -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - ---- _msvc/unit_test/unit_test.vcxproj -+++ _msvc/unit_test/unit_test.vcxproj 2020-08-03 17:07:28.561767900 +0200 -@@ -108,32 +108,32 @@ - - {DDD98DB2-2ABE-4550-9F8C-0E4E4E991D73} - _unit_test -- 10.0 -+ - - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - - - Application - true -- v142 -+ - Unicode - - - Application - false -- v142 -+ - true - Unicode - diff --git a/recipes/zimg/all/patches/0005-msvc-remove-toolset-3.0.1.patch b/recipes/zimg/all/patches/0005-msvc-remove-toolset-3.0.1.patch deleted file mode 100644 index c0335fb34d0f8..0000000000000 --- a/recipes/zimg/all/patches/0005-msvc-remove-toolset-3.0.1.patch +++ /dev/null @@ -1,61 +0,0 @@ ---- a/_msvc/unit_test/unit_test.vcxproj -+++ b/_msvc/unit_test/unit_test.vcxproj -@@ -183,58 +183,49 @@ - - {DDD98DB2-2ABE-4550-9F8C-0E4E4E991D73} - _unit_test -- 10.0 - - - - Application - true -- v142 - Unicode - - - Application - true -- v142 - Unicode - - - Application - false -- v142 - true - Unicode - - - Application - false -- v142 - true - Unicode - - - Application - true -- v142 - Unicode - - - Application - true -- v142 - Unicode - - - Application - false -- v142 - true - Unicode - - - Application - false -- v142 - true - Unicode - diff --git a/recipes/zimg/all/test_package/CMakeLists.txt b/recipes/zimg/all/test_package/CMakeLists.txt index 1141754d91b5e..0b744ea607a1f 100644 --- a/recipes/zimg/all/test_package/CMakeLists.txt +++ b/recipes/zimg/all/test_package/CMakeLists.txt @@ -1,10 +1,7 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +project(test_package LANGUAGES C) find_package(zimg REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} zimg::zimg) +target_link_libraries(${PROJECT_NAME} PRIVATE zimg::zimg) diff --git a/recipes/zimg/all/test_package/conanfile.py b/recipes/zimg/all/test_package/conanfile.py index 38f4483872d47..98ab55852ad56 100644 --- a/recipes/zimg/all/test_package/conanfile.py +++ b/recipes/zimg/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zimg/all/test_v1_package/CMakeLists.txt b/recipes/zimg/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/zimg/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/zimg/all/test_v1_package/conanfile.py b/recipes/zimg/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/zimg/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/zint/all/CMakeLists.txt b/recipes/zint/all/CMakeLists.txt deleted file mode 100644 index dd348757f3de8..0000000000000 --- a/recipes/zint/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS KEEP_RPATHS) - -add_subdirectory("source_subfolder") diff --git a/recipes/zint/all/conandata.yml b/recipes/zint/all/conandata.yml index 70cf1cd3fb510..7f452ab653337 100644 --- a/recipes/zint/all/conandata.yml +++ b/recipes/zint/all/conandata.yml @@ -5,4 +5,3 @@ sources: patches: "2.10.0": - patch_file: "patches/0001-2.10.0-conan-integration.patch" - base_path: "source_subfolder" diff --git a/recipes/zint/all/conanfile.py b/recipes/zint/all/conanfile.py index 5d31fc46df8af..61596c6c982a7 100644 --- a/recipes/zint/all/conanfile.py +++ b/recipes/zint/all/conanfile.py @@ -1,9 +1,11 @@ -from conans import ConanFile, CMake, tools -from conans.errors import ConanInvalidConfiguration -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, replace_in_file, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.43.0" +required_conan_version = ">=1.52.0" class ZintConan(ConanFile): @@ -28,20 +30,8 @@ class ZintConan(ConanFile): "with_qt": False, } - generators = "cmake", "cmake_find_package", "cmake_find_package_multi" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -49,57 +39,70 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass if not self.options.with_qt: - del self.settings.compiler.libcxx - del self.settings.compiler.cppstd + try: + del self.settings.compiler.libcxx + except Exception: + pass + try: + del self.settings.compiler.cppstd + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): if self.options.with_libpng: - self.requires("libpng/1.6.37") - self.requires("zlib/1.2.12") + self.requires("libpng/1.6.38") + self.requires("zlib/1.2.13") if self.options.with_qt: - self.requires("qt/5.15.3") + self.requires("qt/5.15.6") def validate(self): - if self.options.with_qt and not self.options["qt"].gui: - raise ConanInvalidConfiguration(f"{self.name} needs qt:gui=True") + if self.info.options.with_qt and not self.dependencies["qt"].options.gui: + raise ConanInvalidConfiguration(f"{self.ref} needs qt:gui=True") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["DATA_INSTALL_DIR"] = os.path.join(self.package_folder, "lib").replace("\\", "/") + tc.variables["ZINT_USE_QT"] = self.options.with_qt + if self.options.with_qt: + tc.variables["QT_VERSION_MAJOR"] = Version(self.dependencies["qt"].ref.version).major + tc.variables["ZINT_USE_PNG"] = self.options.with_libpng + tc.generate() + deps = CMakeDeps(self) + deps.generate() def _patch_source(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) + apply_conandata_patches(self) # Don't override CMAKE_OSX_SYSROOT, it can easily break consumers. - tools.replace_in_file( - os.path.join(self._source_subfolder, "CMakeLists.txt"), + replace_in_file( + self, + os.path.join(self.source_folder, "CMakeLists.txt"), "set(CMAKE_OSX_SYSROOT \"/\")", "", ) - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - cmake.definitions["DATA_INSTALL_DIR"] = os.path.join(self.package_folder, "lib") - cmake.definitions["ZINT_USE_QT"] = self.options.with_qt - if self.options.with_qt: - cmake.definitions["QT_VERSION_MAJOR"] = tools.Version(self.deps_cpp_info["qt"].version).major - cmake.definitions["ZINT_USE_PNG"] = self.options.with_libpng - cmake.configure() - return cmake - def build(self): self._patch_source() - cmake = self._configure_cmake() + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy("COPYING", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "COPYING", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "Zint") diff --git a/recipes/zint/all/test_package/CMakeLists.txt b/recipes/zint/all/test_package/CMakeLists.txt index 865d3850ba369..14bd143a5e4a6 100644 --- a/recipes/zint/all/test_package/CMakeLists.txt +++ b/recipes/zint/all/test_package/CMakeLists.txt @@ -1,14 +1,11 @@ cmake_minimum_required(VERSION 3.1) -project(test_package C) +project(test_package LANGUAGES C) option(ZINT_WITH_QT "Zint has been built with Qt support") if(ZINT_WITH_QT) enable_language(CXX) endif() -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - find_package(Zint REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) diff --git a/recipes/zint/all/test_package/conanfile.py b/recipes/zint/all/test_package/conanfile.py index 1ce37b6a52e77..1617e37109bc2 100644 --- a/recipes/zint/all/test_package/conanfile.py +++ b/recipes/zint/all/test_package/conanfile.py @@ -1,21 +1,34 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["ZINT_WITH_QT"] = self.dependencies["zint"].options.with_qt + tc.generate() def build(self): cmake = CMake(self) - cmake.definitions["ZINT_WITH_QT"] = self.options["zint"].with_qt cmake.configure() cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") if self.options["zint"].with_qt: - bin_path = os.path.join("bin", "test_package_cpp") - self.run(bin_path, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package_cpp") + self.run(bin_path, env="conanrun") diff --git a/recipes/zint/all/test_v1_package/CMakeLists.txt b/recipes/zint/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..d155f1e77d4aa --- /dev/null +++ b/recipes/zint/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package LANGUAGES C) + +option(ZINT_WITH_QT "Zint has been built with Qt support") +if(ZINT_WITH_QT) + enable_language(CXX) +endif() + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +find_package(Zint REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} ../test_package/test_package.c) +target_link_libraries(${PROJECT_NAME} PRIVATE Zint::Zint) + +if(ZINT_WITH_QT) + add_executable(${PROJECT_NAME}_cpp ../test_package/test_package.cpp) + target_link_libraries(${PROJECT_NAME}_cpp PRIVATE Zint::QZint) +endif() diff --git a/recipes/zint/all/test_v1_package/conanfile.py b/recipes/zint/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..1ce37b6a52e77 --- /dev/null +++ b/recipes/zint/all/test_v1_package/conanfile.py @@ -0,0 +1,21 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.definitions["ZINT_WITH_QT"] = self.options["zint"].with_qt + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + if self.options["zint"].with_qt: + bin_path = os.path.join("bin", "test_package_cpp") + self.run(bin_path, run_environment=True) diff --git a/recipes/zlib-ng/all/conanfile.py b/recipes/zlib-ng/all/conanfile.py index 4d55e3973374d..6f5453c4384df 100644 --- a/recipes/zlib-ng/all/conanfile.py +++ b/recipes/zlib-ng/all/conanfile.py @@ -7,7 +7,7 @@ from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class ZlibNgConan(ConanFile): @@ -43,23 +43,17 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): if self.info.options.zlib_compat and not self.info.options.with_gzfileop: raise ConanInvalidConfiguration("The option 'with_gzfileop' must be True when 'zlib_compat' is True.") - def layout(self): - cmake_layout(self, src_folder="src") - def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) diff --git a/recipes/zlib-ng/all/test_package/CMakeLists.txt b/recipes/zlib-ng/all/test_package/CMakeLists.txt index 2df95ab4bd46a..1afe7de5d08fc 100644 --- a/recipes/zlib-ng/all/test_package/CMakeLists.txt +++ b/recipes/zlib-ng/all/test_package/CMakeLists.txt @@ -1,8 +1,8 @@ -cmake_minimum_required(VERSION 3.15) +cmake_minimum_required(VERSION 3.8) project(test_package LANGUAGES C) -find_package(zlib-ng REQUIRED) +find_package(zlib-ng REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.c) -target_link_libraries(${PROJECT_NAME} zlib-ng::zlib-ng) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) +target_link_libraries(${PROJECT_NAME} PRIVATE zlib-ng::zlib-ng) +target_compile_features(${PROJECT_NAME} PRIVATE c_std_99) diff --git a/recipes/zlib-ng/all/test_package/conanfile.py b/recipes/zlib-ng/all/test_package/conanfile.py index cfc828a00a52e..0f34761d1525c 100644 --- a/recipes/zlib-ng/all/test_package/conanfile.py +++ b/recipes/zlib-ng/all/test_package/conanfile.py @@ -1,13 +1,16 @@ -import os - from conan import ConanFile +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout -from conan.tools.build import cross_building +import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" + settings = "os", "arch", "compiler", "build_type" generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) def requirements(self): self.requires(self.tested_reference_str) @@ -17,10 +20,7 @@ def build(self): cmake.configure() cmake.build() - def layout(self): - cmake_layout(self) - def test(self): - if not cross_building(self): + if can_run(self): cmd = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(cmd, env="conanrun") diff --git a/recipes/zlib-ng/all/test_package_v1/CMakeLists.txt b/recipes/zlib-ng/all/test_package_v1/CMakeLists.txt deleted file mode 100644 index 1082fa2e76e06..0000000000000 --- a/recipes/zlib-ng/all/test_package_v1/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_executable(${PROJECT_NAME} ${CMAKE_CURRENT_SOURCE_DIR}/../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} CONAN_PKG::zlib-ng) -set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 99) diff --git a/recipes/zlib-ng/all/test_package_v1/conanfile.py b/recipes/zlib-ng/all/test_package_v1/conanfile.py deleted file mode 100644 index 364b9cbe73827..0000000000000 --- a/recipes/zlib-ng/all/test_package_v1/conanfile.py +++ /dev/null @@ -1,18 +0,0 @@ -# pylint: skip-file -import os -from conans import ConanFile, CMake, tools - - -class TestPackageConan(ConanFile): - settings = "os", "compiler", "build_type", "arch" - generators = "cmake", "cmake_find_package_multi" - - def build(self): - cmake = CMake(self) - cmake.configure() - cmake.build() - - def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) diff --git a/recipes/zlib-ng/all/test_v1_package/CMakeLists.txt b/recipes/zlib-ng/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d20897301b68 --- /dev/null +++ b/recipes/zlib-ng/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/zlib-ng/all/test_v1_package/conanfile.py b/recipes/zlib-ng/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/zlib-ng/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/zlib/all/conandata.yml b/recipes/zlib/all/conandata.yml index 8f93ccd1048c6..e2abd8cd4f339 100644 --- a/recipes/zlib/all/conandata.yml +++ b/recipes/zlib/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.2.13": + url: "https://zlib.net/fossils/zlib-1.2.13.tar.gz" + sha256: "b3a24de97a8fdbc835b9833169501030b8977031bcb54b3b3ac13740f846ab30" "1.2.12": url: "https://zlib.net/fossils/zlib-1.2.12.tar.gz" sha256: "91844808532e5ce316b3c010929493c0244f3d37593afd6de04f71821d5136d9" @@ -6,11 +9,24 @@ sources: url: "https://zlib.net/fossils/zlib-1.2.11.tar.gz" sha256: "c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1" patches: + "1.2.13": + - patch_file: "patches/1.2.13/0001-Fix-cmake.patch" + - patch_file: "patches/1.2.x/0002-gzguts-xcode12-compile-fix.patch" "1.2.12": - - patch_file: "patches/0001-fix-cmake.patch" - - patch_file: "patches/0002-gzguts-xcode12-compile-fix.patch" + - patch_file: "patches/1.2.x/0001-fix-cmake.patch" + - patch_file: "patches/1.2.x/0002-gzguts-xcode12-compile-fix.patch" + - patch_file: "patches/1.2.x/0004-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch" + patch_description: "CVE-2022-37434: Fix a bug when getting a gzip header extra field with inflate()" + patch_type: "vulnerability" + patch_source: "https://github.com/madler/zlib/commit/eff308af425b67093bab25f80f1ae950166bece1" + sha256: "15e3c177dc2a034a22e02490a97ba5b1719aae3f8129a06c16d727b661d1650f" + - patch_file: "patches/1.2.x/0005-Fix-extra-field-processing-bug-that-dereferences-NUL.patch" + patch_description: "CVE-2022-37434: Fix extra field processing bug that dereferences NULL state->head" + patch_type: "vulnerability" + patch_source: "https://github.com/madler/zlib/commit/1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d" + sha256: "cdd69eb3251728b1875c8ecae6427b50aa750b4045ef984ab79b6c07b7e6dd3a" "1.2.11": - - patch_file: "patches/0001-fix-cmake.patch" - - patch_file: "patches/0002-gzguts-xcode12-compile-fix.patch" - # https://github.com/madler/zlib/issues/268 - - patch_file: "patches/0003-gzguts-fix-widechar-condition.patch" + - patch_file: "patches/1.2.x/0001-fix-cmake.patch" + - patch_file: "patches/1.2.x/0002-gzguts-xcode12-compile-fix.patch" + # https://github.com/madler/zlib/issues/268 + - patch_file: "patches/1.2.x/0003-gzguts-fix-widechar-condition.patch" diff --git a/recipes/zlib/all/conanfile.py b/recipes/zlib/all/conanfile.py index ab204f405974e..716ee2007ab06 100644 --- a/recipes/zlib/all/conanfile.py +++ b/recipes/zlib/all/conanfile.py @@ -1,15 +1,15 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, load, replace_in_file, save -from conan.tools.microsoft import is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, load, replace_in_file, save from conan.tools.scm import Version import os -required_conan_version = ">=1.46.0" +required_conan_version = ">=1.53.0" class ZlibConan(ConanFile): name = "zlib" + package_type = "library" url = "https://github.com/conan-io/conan-center-index" homepage = "https://zlib.net" license = "Zlib" @@ -28,12 +28,11 @@ class ZlibConan(ConanFile): } @property - def _is_clang_cl(self): - return self.settings.os == "Windows" and self.settings.compiler == "clang" + def _is_mingw(self): + return self.settings.os == "Windows" and self.settings.compiler == "gcc" def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -41,15 +40,9 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.libcxx") + self.settings.rm_safe("compiler.cppstd") def layout(self): cmake_layout(self, src_folder="src") @@ -64,6 +57,9 @@ def generate(self): tc.variables["SKIP_INSTALL_LIBRARIES"] = False tc.variables["SKIP_INSTALL_HEADERS"] = False tc.variables["SKIP_INSTALL_FILES"] = True + # Correct for misuse of "${CMAKE_INSTALL_PREFIX}/" in CMakeLists.txt + tc.variables["INSTALL_LIB_DIR"] = "lib" + tc.variables["INSTALL_INC_DIR"] = "include" tc.generate() def _patch_sources(self): @@ -103,7 +99,7 @@ def package_info(self): self.cpp_info.set_property("cmake_file_name", "ZLIB") self.cpp_info.set_property("cmake_target_name", "ZLIB::ZLIB") self.cpp_info.set_property("pkg_config_name", "zlib") - if is_msvc(self) or self._is_clang_cl: + if self.settings.os == "Windows" and not self._is_mingw: libname = "zdll" if self.options.shared else "zlib" else: libname = "z" diff --git a/recipes/zlib/all/patches/0001-fix-cmake.patch b/recipes/zlib/all/patches/0001-fix-cmake.patch deleted file mode 100644 index 9a3627d41b04c..0000000000000 --- a/recipes/zlib/all/patches/0001-fix-cmake.patch +++ /dev/null @@ -1,104 +0,0 @@ ---- a/CMakeLists.txt -+++ b/CMakeLists.txt -@@ -1,4 +1,4 @@ --cmake_minimum_required(VERSION 2.4.4) -+cmake_minimum_required(VERSION 3.0) # it's important to have https://cmake.org/cmake/help/latest/policy/CMP0042.html#policy:CMP0042 - set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) - - project(zlib C) -@@ -60,7 +60,6 @@ endif() - check_include_file(unistd.h Z_HAVE_UNISTD_H) - - if(MSVC) -- set(CMAKE_DEBUG_POSTFIX "d") - add_definitions(-D_CRT_SECURE_NO_DEPRECATE) - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -@@ -83,7 +82,7 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein - ${ZLIB_PC} @ONLY) - configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein - ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) --include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) -+include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) - - - #============================================================================ -@@ -123,7 +122,7 @@ set(ZLIB_SRCS - zutil.c - ) - --if(NOT MINGW) -+if(MSVC) - set(ZLIB_DLL_SRCS - win32/zlib1.rc # If present will override custom build rule below. - ) -@@ -167,7 +166,7 @@ file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) - string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" - "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) - --if(MINGW) -+if(WIN32 AND NOT MSVC) - # This gets us DLL resource information when compiling on MinGW. - if(NOT CMAKE_RC_COMPILER) - set(CMAKE_RC_COMPILER windres.exe) -@@ -181,12 +180,15 @@ if(MINGW) - -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj - -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) - set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) --endif(MINGW) -+endif() - -+if(BUILD_SHARED_LIBS) - add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) --add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) - set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) - set_target_properties(zlib PROPERTIES SOVERSION 1) -+else() -+add_library(zlib STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) -+endif() - - if(NOT CYGWIN) - # This property causes shared libraries on Linux to have the full version -@@ -199,19 +201,24 @@ if(NOT CYGWIN) - set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) - endif() - --if(UNIX) -+if(MSVC) -+ if(BUILD_SHARED_LIBS) -+ set_target_properties(zlib PROPERTIES ARCHIVE_OUTPUT_NAME zdll) -+ endif() -+else() - # On unix-like platforms the library is almost always called libz -- set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) -+ set_target_properties(zlib PROPERTIES OUTPUT_NAME z) - if(NOT APPLE) - set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") - endif() --elseif(BUILD_SHARED_LIBS AND WIN32) -+endif() -+if(BUILD_SHARED_LIBS AND WIN32) - # Creates zlib1.dll when building shared library version -- set_target_properties(zlib PROPERTIES SUFFIX "1.dll") -+ set_target_properties(zlib PROPERTIES PREFIX "" RUNTIME_OUTPUT_NAME "zlib1") - endif() - - if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) -- install(TARGETS zlib zlibstatic -+ install(TARGETS zlib - RUNTIME DESTINATION "${INSTALL_BIN_DIR}" - ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" - LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) -@@ -230,6 +237,7 @@ endif() - # Example binaries - #============================================================================ - -+if(0) - add_executable(example test/example.c) - target_link_libraries(example zlib) - add_test(example example) -@@ -247,3 +255,4 @@ if(HAVE_OFF64_T) - target_link_libraries(minigzip64 zlib) - set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") - endif() -+endif() diff --git a/recipes/zlib/all/patches/1.2.13/0001-Fix-cmake.patch b/recipes/zlib/all/patches/1.2.13/0001-Fix-cmake.patch new file mode 100644 index 0000000000000..a0748ec590d90 --- /dev/null +++ b/recipes/zlib/all/patches/1.2.13/0001-Fix-cmake.patch @@ -0,0 +1,118 @@ +From 9a709a43549fbe23ca41eeb450d4c71e3b78c8c4 Mon Sep 17 00:00:00 2001 +From: Mikhail Lappo +Date: Fri, 14 Oct 2022 13:29:56 +0200 +Subject: [PATCH] Fix cmake + +--- + CMakeLists.txt | 33 +++++++++++++++++++++------------ + 1 file changed, 21 insertions(+), 12 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index b412dc7..a5284ed 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 2.4.4) ++cmake_minimum_required(VERSION 3.0) # it's important to have https://cmake.org/cmake/help/latest/policy/CMP0042.html#policy:CMP0042 + set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) + + project(zlib C) +@@ -57,7 +57,6 @@ endif() + check_include_file(unistd.h Z_HAVE_UNISTD_H) + + if(MSVC) +- set(CMAKE_DEBUG_POSTFIX "d") + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +@@ -80,7 +79,7 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein + ${ZLIB_PC} @ONLY) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein + ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) +-include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) ++include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + + + #============================================================================ +@@ -120,7 +119,7 @@ set(ZLIB_SRCS + zutil.c + ) + +-if(NOT MINGW) ++if(MSVC) + set(ZLIB_DLL_SRCS + win32/zlib1.rc # If present will override custom build rule below. + ) +@@ -131,7 +130,7 @@ file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) + string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" + "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) + +-if(MINGW) ++if(WIN32 AND NOT MSVC) + # This gets us DLL resource information when compiling on MinGW. + if(NOT CMAKE_RC_COMPILER) + set(CMAKE_RC_COMPILER windres.exe) +@@ -145,12 +144,15 @@ if(MINGW) + -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj + -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) + set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) +-endif(MINGW) ++endif() + ++if(BUILD_SHARED_LIBS) + add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) + set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) + set_target_properties(zlib PROPERTIES SOVERSION 1) ++else() ++add_library(zlib STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) ++endif() + + if(NOT CYGWIN) + # This property causes shared libraries on Linux to have the full version +@@ -163,19 +165,24 @@ if(NOT CYGWIN) + set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) + endif() + +-if(UNIX) ++if(WIN32 AND NOT MINGW) ++ if(BUILD_SHARED_LIBS) ++ set_target_properties(zlib PROPERTIES ARCHIVE_OUTPUT_NAME zdll) ++ endif() ++else() + # On unix-like platforms the library is almost always called libz +- set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) ++ set_target_properties(zlib PROPERTIES OUTPUT_NAME z) + if(NOT APPLE) + set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") + endif() +-elseif(BUILD_SHARED_LIBS AND WIN32) ++endif() ++if(BUILD_SHARED_LIBS AND WIN32) + # Creates zlib1.dll when building shared library version +- set_target_properties(zlib PROPERTIES SUFFIX "1.dll") ++ set_target_properties(zlib PROPERTIES PREFIX "" RUNTIME_OUTPUT_NAME "zlib1") + endif() + + if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) +- install(TARGETS zlib zlibstatic ++ install(TARGETS zlib + RUNTIME DESTINATION "${INSTALL_BIN_DIR}" + ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" + LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) +@@ -194,6 +201,7 @@ endif() + # Example binaries + #============================================================================ + ++if(0) + add_executable(example test/example.c) + target_link_libraries(example zlib) + add_test(example example) +@@ -211,3 +219,4 @@ if(HAVE_OFF64_T) + target_link_libraries(minigzip64 zlib) + set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + endif() ++endif() +-- +2.24.3 (Apple Git-128) + diff --git a/recipes/zlib/all/patches/1.2.x/0001-fix-cmake.patch b/recipes/zlib/all/patches/1.2.x/0001-fix-cmake.patch new file mode 100644 index 0000000000000..f99f0b5219682 --- /dev/null +++ b/recipes/zlib/all/patches/1.2.x/0001-fix-cmake.patch @@ -0,0 +1,104 @@ +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,4 +1,4 @@ +-cmake_minimum_required(VERSION 2.4.4) ++cmake_minimum_required(VERSION 3.0) # it's important to have https://cmake.org/cmake/help/latest/policy/CMP0042.html#policy:CMP0042 + set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) + + project(zlib C) +@@ -60,7 +60,6 @@ endif() + check_include_file(unistd.h Z_HAVE_UNISTD_H) + + if(MSVC) +- set(CMAKE_DEBUG_POSTFIX "d") + add_definitions(-D_CRT_SECURE_NO_DEPRECATE) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +@@ -83,7 +82,7 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zlib.pc.cmakein + ${ZLIB_PC} @ONLY) + configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein + ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @ONLY) +-include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) ++include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) + + + #============================================================================ +@@ -123,7 +122,7 @@ set(ZLIB_SRCS + zutil.c + ) + +-if(NOT MINGW) ++if(MSVC) + set(ZLIB_DLL_SRCS + win32/zlib1.rc # If present will override custom build rule below. + ) +@@ -167,7 +166,7 @@ file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) + string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" + "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) + +-if(MINGW) ++if(WIN32 AND NOT MSVC) + # This gets us DLL resource information when compiling on MinGW. + if(NOT CMAKE_RC_COMPILER) + set(CMAKE_RC_COMPILER windres.exe) +@@ -181,12 +180,15 @@ if(MINGW) + -o ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj + -i ${CMAKE_CURRENT_SOURCE_DIR}/win32/zlib1.rc) + set(ZLIB_DLL_SRCS ${CMAKE_CURRENT_BINARY_DIR}/zlib1rc.obj) +-endif(MINGW) ++endif() + ++if(BUILD_SHARED_LIBS) + add_library(zlib SHARED ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_DLL_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +-add_library(zlibstatic STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) + set_target_properties(zlib PROPERTIES DEFINE_SYMBOL ZLIB_DLL) + set_target_properties(zlib PROPERTIES SOVERSION 1) ++else() ++add_library(zlib STATIC ${ZLIB_SRCS} ${ZLIB_ASMS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) ++endif() + + if(NOT CYGWIN) + # This property causes shared libraries on Linux to have the full version +@@ -199,19 +201,24 @@ if(NOT CYGWIN) + set_target_properties(zlib PROPERTIES VERSION ${ZLIB_FULL_VERSION}) + endif() + +-if(UNIX) ++if(WIN32 AND NOT MINGW) ++ if(BUILD_SHARED_LIBS) ++ set_target_properties(zlib PROPERTIES ARCHIVE_OUTPUT_NAME zdll) ++ endif() ++else() + # On unix-like platforms the library is almost always called libz +- set_target_properties(zlib zlibstatic PROPERTIES OUTPUT_NAME z) ++ set_target_properties(zlib PROPERTIES OUTPUT_NAME z) + if(NOT APPLE) + set_target_properties(zlib PROPERTIES LINK_FLAGS "-Wl,--version-script,\"${CMAKE_CURRENT_SOURCE_DIR}/zlib.map\"") + endif() +-elseif(BUILD_SHARED_LIBS AND WIN32) ++endif() ++if(BUILD_SHARED_LIBS AND WIN32) + # Creates zlib1.dll when building shared library version +- set_target_properties(zlib PROPERTIES SUFFIX "1.dll") ++ set_target_properties(zlib PROPERTIES PREFIX "" RUNTIME_OUTPUT_NAME "zlib1") + endif() + + if(NOT SKIP_INSTALL_LIBRARIES AND NOT SKIP_INSTALL_ALL ) +- install(TARGETS zlib zlibstatic ++ install(TARGETS zlib + RUNTIME DESTINATION "${INSTALL_BIN_DIR}" + ARCHIVE DESTINATION "${INSTALL_LIB_DIR}" + LIBRARY DESTINATION "${INSTALL_LIB_DIR}" ) +@@ -230,6 +237,7 @@ endif() + # Example binaries + #============================================================================ + ++if(0) + add_executable(example test/example.c) + target_link_libraries(example zlib) + add_test(example example) +@@ -247,3 +255,4 @@ if(HAVE_OFF64_T) + target_link_libraries(minigzip64 zlib) + set_target_properties(minigzip64 PROPERTIES COMPILE_FLAGS "-D_FILE_OFFSET_BITS=64") + endif() ++endif() diff --git a/recipes/zlib/all/patches/0002-gzguts-xcode12-compile-fix.patch b/recipes/zlib/all/patches/1.2.x/0002-gzguts-xcode12-compile-fix.patch similarity index 100% rename from recipes/zlib/all/patches/0002-gzguts-xcode12-compile-fix.patch rename to recipes/zlib/all/patches/1.2.x/0002-gzguts-xcode12-compile-fix.patch diff --git a/recipes/zlib/all/patches/0003-gzguts-fix-widechar-condition.patch b/recipes/zlib/all/patches/1.2.x/0003-gzguts-fix-widechar-condition.patch similarity index 100% rename from recipes/zlib/all/patches/0003-gzguts-fix-widechar-condition.patch rename to recipes/zlib/all/patches/1.2.x/0003-gzguts-fix-widechar-condition.patch diff --git a/recipes/zlib/all/patches/1.2.x/0004-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch b/recipes/zlib/all/patches/1.2.x/0004-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch new file mode 100644 index 0000000000000..80eed3e0c3e95 --- /dev/null +++ b/recipes/zlib/all/patches/1.2.x/0004-Fix-a-bug-when-getting-a-gzip-header-extra-field-wit.patch @@ -0,0 +1,35 @@ +From eff308af425b67093bab25f80f1ae950166bece1 Mon Sep 17 00:00:00 2001 +From: Mark Adler +Date: Sat, 30 Jul 2022 15:51:11 -0700 +Subject: [PATCH] Fix a bug when getting a gzip header extra field with + inflate(). + +If the extra field was larger than the space the user provided with +inflateGetHeader(), and if multiple calls of inflate() delivered +the extra header data, then there could be a buffer overflow of the +provided space. This commit assures that provided space is not +exceeded. +--- + inflate.c | 5 +++-- + 1 file changed, 3 insertions(+), 2 deletions(-) + +diff --git a/inflate.c b/inflate.c +index 7be8c63..7a72897 100644 +--- a/inflate.c ++++ b/inflate.c +@@ -763,9 +763,10 @@ int flush; + copy = state->length; + if (copy > have) copy = have; + if (copy) { ++ len = state->head->extra_len - state->length; + if (state->head != Z_NULL && +- state->head->extra != Z_NULL) { +- len = state->head->extra_len - state->length; ++ state->head->extra != Z_NULL && ++ len < state->head->extra_max) { + zmemcpy(state->head->extra + len, next, + len + copy > state->head->extra_max ? + state->head->extra_max - len : copy); +-- +2.25.1 + diff --git a/recipes/zlib/all/patches/1.2.x/0005-Fix-extra-field-processing-bug-that-dereferences-NUL.patch b/recipes/zlib/all/patches/1.2.x/0005-Fix-extra-field-processing-bug-that-dereferences-NUL.patch new file mode 100644 index 0000000000000..f34c4019fbf35 --- /dev/null +++ b/recipes/zlib/all/patches/1.2.x/0005-Fix-extra-field-processing-bug-that-dereferences-NUL.patch @@ -0,0 +1,32 @@ +From 1eb7682f845ac9e9bf9ae35bbfb3bad5dacbd91d Mon Sep 17 00:00:00 2001 +From: Mark Adler +Date: Mon, 8 Aug 2022 10:50:09 -0700 +Subject: [PATCH] Fix extra field processing bug that dereferences NULL + state->head. + +The recent commit to fix a gzip header extra field processing bug +introduced the new bug fixed here. +--- + inflate.c | 4 ++-- + 1 file changed, 2 insertions(+), 2 deletions(-) + +diff --git a/inflate.c b/inflate.c +index 7a72897..2a3c4fe 100644 +--- a/inflate.c ++++ b/inflate.c +@@ -763,10 +763,10 @@ int flush; + copy = state->length; + if (copy > have) copy = have; + if (copy) { +- len = state->head->extra_len - state->length; + if (state->head != Z_NULL && + state->head->extra != Z_NULL && +- len < state->head->extra_max) { ++ (len = state->head->extra_len - state->length) < ++ state->head->extra_max) { + zmemcpy(state->head->extra + len, next, + len + copy > state->head->extra_max ? + state->head->extra_max - len : copy); +-- +2.25.1 + diff --git a/recipes/zlib/all/test_package/conanfile.py b/recipes/zlib/all/test_package/conanfile.py index 3a8c6c5442b33..0a6bc68712d90 100644 --- a/recipes/zlib/all/test_package/conanfile.py +++ b/recipes/zlib/all/test_package/conanfile.py @@ -1,5 +1,5 @@ from conan import ConanFile -from conan.tools.build import cross_building +from conan.tools.build import can_run from conan.tools.cmake import CMake, cmake_layout import os @@ -7,19 +7,20 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() cmake.build() def test(self): - if not cross_building(self): + if can_run(self): bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") self.run(bin_path, env="conanrun") diff --git a/recipes/zlib/all/test_v1_package/conanfile.py b/recipes/zlib/all/test_v1_package/conanfile.py index 3b064a7464a29..0245c9a8028a3 100644 --- a/recipes/zlib/all/test_v1_package/conanfile.py +++ b/recipes/zlib/all/test_v1_package/conanfile.py @@ -1,4 +1,3 @@ -# pylint: skip-file from conans import ConanFile, CMake, tools import os diff --git a/recipes/zlib/config.yml b/recipes/zlib/config.yml index a92270f2d870a..351c06f68201f 100644 --- a/recipes/zlib/config.yml +++ b/recipes/zlib/config.yml @@ -1,4 +1,6 @@ versions: + "1.2.13": + folder: all "1.2.12": folder: all "1.2.11": diff --git a/recipes/zmqpp/all/CMakeLists.txt b/recipes/zmqpp/all/CMakeLists.txt deleted file mode 100644 index e4233e81e86f0..0000000000000 --- a/recipes/zmqpp/all/CMakeLists.txt +++ /dev/null @@ -1,7 +0,0 @@ -cmake_minimum_required(VERSION 3.1) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -add_subdirectory(source_subfolder) diff --git a/recipes/zmqpp/all/conandata.yml b/recipes/zmqpp/all/conandata.yml index b277f02bd3452..b8b843edf38c8 100644 --- a/recipes/zmqpp/all/conandata.yml +++ b/recipes/zmqpp/all/conandata.yml @@ -5,8 +5,5 @@ sources: patches: "4.2.0": - patch_file: "patches/0001-fix-cmake.patch" - base_path: "source_subfolder" - patch_file: "patches/0002-missing-includes.patch" - base_path: "source_subfolder" - patch_file: "patches/0003-Allow-building-with-Werror-undef.patch" - base_path: "source_subfolder" diff --git a/recipes/zmqpp/all/conanfile.py b/recipes/zmqpp/all/conanfile.py index c18e485f5b94d..8d4bf7d455227 100644 --- a/recipes/zmqpp/all/conanfile.py +++ b/recipes/zmqpp/all/conanfile.py @@ -1,6 +1,10 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get +import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.52.0" class ZmqppConan(ConanFile): @@ -8,22 +12,24 @@ class ZmqppConan(ConanFile): homepage = "https://github.com/zeromq/zmqpp" license = "MPL-2.0" url = "https://github.com/conan-io/conan-center-index" - description = "This C++ binding for 0mq/zmq is a 'high-level' library that hides most of the c-style interface core 0mq provides." - topics = ("conan", "zmq", "0mq", "zeromq", "message-queue", "asynchronous") - settings = "os", "compiler", "build_type", "arch" - options = {"shared": [True, False], "fPIC": [True, False]} - default_options = {"shared": False, "fPIC": True} - exports_sources = "CMakeLists.txt", "patches/**" - generators = "cmake" - _cmake = None + description = ( + "This C++ binding for 0mq/zmq is a 'high-level' library that hides " + "most of the c-style interface core 0mq provides." + ) + topics = ("zmq", "0mq", "zeromq", "message-queue", "asynchronous") - @property - def _source_subfolder(self): - return "source_subfolder" + settings = "os", "arch", "compiler", "build_type" + options = { + "shared": [True, False], + "fPIC": [True, False], + } + default_options = { + "shared": False, + "fPIC": True, + } - @property - def _build_subfolder(self): - return "build_subfolder" + def export_sources(self): + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -31,45 +37,51 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass + + def layout(self): + cmake_layout(self, src_folder="src") def requirements(self): self.requires("zeromq/4.3.4") def validate(self): - if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + if self.info.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) - def _configure_cmake(self): - if self._cmake: - return self._cmake - self._cmake = CMake(self) - self._cmake.definitions["ZMQPP_LIBZMQ_CMAKE"] = False - self._cmake.definitions["ZMQPP_BUILD_SHARED"] = self.options.shared - self._cmake.definitions["ZMQPP_BUILD_STATIC"] = not self.options.shared - self._cmake.definitions["ZMQPP_BUILD_EXAMPLES"] = False - self._cmake.definitions["ZMQPP_BUILD_CLIENT"] = False - self._cmake.definitions["ZMQPP_BUILD_TESTS"] = False - self._cmake.configure(build_folder=self._build_subfolder) - return self._cmake + def generate(self): + tc = CMakeToolchain(self) + # No bool cast until https://github.com/conan-io/conan/pull/12086 (conan 1.53.0) + tc.cache_variables["ZMQPP_LIBZMQ_CMAKE"] = "ON" + tc.cache_variables["ZMQPP_BUILD_STATIC"] = "OFF" if self.options.shared else "ON" + tc.cache_variables["ZMQPP_BUILD_SHARED"] = "ON" if self.options.shared else "OFF" + tc.cache_variables["ZMQPP_BUILD_EXAMPLES"] = "OFF" + tc.cache_variables["ZMQPP_BUILD_CLIENT"] = "OFF" + tc.cache_variables["ZMQPP_BUILD_TESTS"] = "OFF" + tc.generate() + deps = CMakeDeps(self) + deps.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE", dst="licenses", src=self._source_subfolder) - cmake = self._configure_cmake() + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + cmake = CMake(self) cmake.install() def package_info(self): - self.cpp_info.names["pkg_config"] = "libzmqpp" + self.cpp_info.set_property("pkg_config_name", "libzmqpp") self.cpp_info.libs = ["zmqpp" if self.options.shared else "zmqpp-static"] if self.settings.os == "Windows": self.cpp_info.system_libs = ["ws2_32"] diff --git a/recipes/zmqpp/all/patches/0001-fix-cmake.patch b/recipes/zmqpp/all/patches/0001-fix-cmake.patch index 5b7f7f83fb25b..bc1a37ef765be 100644 --- a/recipes/zmqpp/all/patches/0001-fix-cmake.patch +++ b/recipes/zmqpp/all/patches/0001-fix-cmake.patch @@ -1,8 +1,5 @@ -Patch from https://github.com/zeromq/zmqpp/commit/05ad2f3255e5d74febbd1e17663bbfc2ded46c18 -It also allows more robust injection of zeromq and C++11 - --- a/CMakeLists.txt -+++ b/CMakeLists_new.txt ++++ b/CMakeLists.txt @@ -11,14 +11,17 @@ # @@ -22,43 +19,66 @@ It also allows more robust injection of zeromq and C++11 # Set compiler flags that don't work on Windows if(NOT MSVC) -@@ -63,7 +66,6 @@ set( ZEROMQ_INCLUDE_DIR "" CACHE PATH "The include directory for ZMQ" ) - set( IS_TRAVIS_CI_BUILD true CACHE bool "Defines TRAVIS_CI_BUILD - Should the tests avoid running cases where memory is scarce." ) +@@ -31,7 +34,7 @@ endif() + # remove this block (see CMP0042). + # + # TODO: verify correctness of this flag +-if(NOT DEFINED CMAKE_MACOSX_RPATH) ++if(0) + set(CMAKE_MACOSX_RPATH 0) + endif() + +@@ -60,11 +63,11 @@ set( ZEROMQ_LIB_DIR "" CACHE PATH "The library directory for libzmq" + set( ZEROMQ_INCLUDE_DIR "" CACHE PATH "The include directory for ZMQ" ) + + # Build flags +-set( IS_TRAVIS_CI_BUILD true CACHE bool "Defines TRAVIS_CI_BUILD - Should the tests avoid running cases where memory is scarce." ) ++set( IS_TRAVIS_CI_BUILD true CACHE BOOL "Defines TRAVIS_CI_BUILD - Should the tests avoid running cases where memory is scarce." ) # Find zmq.h and add its dir to the includes -find_path(ZEROMQ_INCLUDE zmq.h PATHS ${ZEROMQ_INCLUDE_DIR}) - include_directories(${ZEROMQ_INCLUDE_DIR} ${ZEROMQ_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/src ) +-include_directories(${ZEROMQ_INCLUDE_DIR} ${ZEROMQ_INCLUDE} ${CMAKE_CURRENT_SOURCE_DIR}/src ) ++find_package(ZeroMQ REQUIRED CONFIG) ++include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src ) # Do not run some tests when building on travis-ci (this cause oom error and kill the test -@@ -108,13 +110,12 @@ set( LIBZMQPP_SOURCES + # process) +@@ -107,7 +110,8 @@ set( LIBZMQPP_SOURCES + # Staticlib if (ZMQPP_BUILD_STATIC) add_library( zmqpp-static STATIC ${LIBZMQPP_SOURCES}) - target_compile_definitions(zmqpp-static PUBLIC ZMQ_STATIC ZMQPP_STATIC_DEFINE) +- target_compile_definitions(zmqpp-static PUBLIC ZMQ_STATIC ZMQPP_STATIC_DEFINE) ++ target_compile_definitions(zmqpp-static PUBLIC ZMQPP_STATIC_DEFINE) + target_compile_features(zmqpp-static PRIVATE cxx_std_11) if (NOT ZMQPP_LIBZMQ_CMAKE) -- find_library(ZEROMQ_LIBRARY_STATIC ${ZMQPP_LIBZMQ_NAME_STATIC} PATHS ${ZEROMQ_LIB_DIR}) + find_library(ZEROMQ_LIBRARY_STATIC ${ZMQPP_LIBZMQ_NAME_STATIC} PATHS ${ZEROMQ_LIB_DIR}) if (NOT ZEROMQ_LIBRARY_STATIC) - # If libzmq was not installed through CMake, the static binary is libzmq.a not libzmq-static.a -- find_library(ZEROMQ_LIBRARY_STATIC libzmq.a PATHS ${ZEROMQ_LIB_DIR}) - endif() -- target_link_libraries( zmqpp-static ${ZEROMQ_LIBRARY_STATIC}) -+ target_link_libraries( zmqpp-static CONAN_PKG::zeromq) +@@ -118,7 +122,7 @@ if (ZMQPP_BUILD_STATIC) else() # libzmq-static is the name of the target from # libzmq's CMake -@@ -127,9 +128,9 @@ endif() # ZMQPP_BUILD_STATIC +- target_link_libraries(zmqpp-static libzmq-static) ++ target_link_libraries(zmqpp-static $,libzmq,libzmq-static>) + endif() + list( APPEND INSTALL_TARGET_LIST zmqpp-static) + set( LIB_TO_LINK_TO_EXAMPLES zmqpp-static ) +@@ -127,13 +131,14 @@ endif() # ZMQPP_BUILD_STATIC # Shared lib if (ZMQPP_BUILD_SHARED) add_library( zmqpp SHARED ${LIBZMQPP_SOURCES}) + target_compile_features(zmqpp PRIVATE cxx_std_11) if (NOT ZMQPP_LIBZMQ_CMAKE) -- find_library(ZEROMQ_LIBRARY_SHARED ${ZMQPP_LIBZMQ_NAME_SHARED} PATHS ${ZEROMQ_LIB_DIR}) -- target_link_libraries( zmqpp ${ZEROMQ_LIBRARY_SHARED} ) -+ target_link_libraries( zmqpp CONAN_PKG::zeromq ) + find_library(ZEROMQ_LIBRARY_SHARED ${ZMQPP_LIBZMQ_NAME_SHARED} PATHS ${ZEROMQ_LIB_DIR}) + target_link_libraries( zmqpp ${ZEROMQ_LIBRARY_SHARED} ) else() # libzmq is the name of the target from # libzmq's CMake -@@ -141,11 +142,22 @@ endif() # ZMQPP_BUILD_SHARED +- target_link_libraries(zmqpp libzmq) ++ target_link_libraries(zmqpp $,libzmq,libzmq-static>) + endif() + list( APPEND INSTALL_TARGET_LIST zmqpp) + set( LIB_TO_LINK_TO_EXAMPLES zmqpp ) +@@ -141,11 +146,22 @@ endif() # ZMQPP_BUILD_SHARED # We need to link zmqpp to ws2_32 on windows for the implementation of winsock2.h if(WIN32) @@ -73,9 +93,8 @@ It also allows more robust injection of zeromq and C++11 endif() # WIN32 include(GenerateExportHeader) --generate_export_header(zmqpp) +if(ZMQPP_BUILD_SHARED) -+ generate_export_header(zmqpp) + generate_export_header(zmqpp) +elseif(ZMQPP_BUILD_STATIC) + generate_export_header(zmqpp-static BASE_NAME zmqpp) +endif() diff --git a/recipes/zmqpp/all/test_package/CMakeLists.txt b/recipes/zmqpp/all/test_package/CMakeLists.txt index 84aa17fcd594c..18add93ce2d95 100644 --- a/recipes/zmqpp/all/test_package/CMakeLists.txt +++ b/recipes/zmqpp/all/test_package/CMakeLists.txt @@ -1,15 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) - -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) find_package(zmqpp REQUIRED) add_executable(${PROJECT_NAME} test_package.cpp) - -target_link_libraries(${PROJECT_NAME} zmqpp::zmqpp) +target_link_libraries(${PROJECT_NAME} PRIVATE zmqpp::zmqpp) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/zmqpp/all/test_package/conanfile.py b/recipes/zmqpp/all/test_package/conanfile.py index 795f5c8fbb30e..0a6bc68712d90 100644 --- a/recipes/zmqpp/all/test_package/conanfile.py +++ b/recipes/zmqpp/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): - settings = "os", "compiler", "arch", "build_type" - generators = "cmake", "cmake_find_package" + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zmqpp/all/test_v1_package/CMakeLists.txt b/recipes/zmqpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/zmqpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/zmqpp/all/test_v1_package/conanfile.py b/recipes/zmqpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/zmqpp/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/zopfli/all/conanfile.py b/recipes/zopfli/all/conanfile.py index 8427cd77b7996..1f0b88e512435 100644 --- a/recipes/zopfli/all/conanfile.py +++ b/recipes/zopfli/all/conanfile.py @@ -1,9 +1,10 @@ -from conan import ConanFile +from conan import ConanFile, conan_version from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import copy, get, rmdir +from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.52.0" class ZopfliConan(ConanFile): @@ -33,7 +34,10 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + try: + del self.options.fPIC + except Exception: + pass try: del self.settings.compiler.libcxx except Exception: @@ -82,14 +86,7 @@ def package_info(self): self.cpp_info.components["libzopflipng"].libs = ["zopflipng"] self.cpp_info.components["libzopflipng"].requires = ["libzopfli"] - bin_path = os.path.join(self.package_folder, "bin") - self.output.info(f"Appending PATH environment variable: {bin_path}") - self.env_info.PATH.append(bin_path) - - # TODO: to remove in conan v2 once cmake_find_package_* generators removed - self.cpp_info.names["cmake_find_package"] = "Zopfli" - self.cpp_info.names["cmake_find_package_multi"] = "Zopfli" - self.cpp_info.components["libzopfli"].names["cmake_find_package"] = "libzopfli" - self.cpp_info.components["libzopfli"].names["cmake_find_package_multi"] = "libzopfli" - self.cpp_info.components["libzopflipng"].names["cmake_find_package"] = "libzopflipng" - self.cpp_info.components["libzopflipng"].names["cmake_find_package_multi"] = "libzopflipng" + if Version(conan_version).major < 2: + self.env_info.PATH.append(os.path.join(self.package_folder, "bin")) + self.cpp_info.names["cmake_find_package"] = "Zopfli" + self.cpp_info.names["cmake_find_package_multi"] = "Zopfli" diff --git a/recipes/zopfli/all/test_package/conanfile.py b/recipes/zopfli/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/zopfli/all/test_package/conanfile.py +++ b/recipes/zopfli/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/zpp_bits/all/conandata.yml b/recipes/zpp_bits/all/conandata.yml new file mode 100644 index 0000000000000..10471fdb07486 --- /dev/null +++ b/recipes/zpp_bits/all/conandata.yml @@ -0,0 +1,7 @@ +sources: + "4.4.13": + url: "https://github.com/eyalz800/zpp_bits/archive/v4.4.13.tar.gz" + sha256: "817be8218f1ef6ad66f2c18154d16a9577d0f939a29c76cb95c71f7f24c53fe1" + "4.4.12": + url: "https://github.com/eyalz800/zpp_bits/archive/v4.4.12.tar.gz" + sha256: "0060c36d394ab1fb340120a7d14e45657a72419fd1745426e75d820980fa095a" diff --git a/recipes/zpp_bits/all/conanfile.py b/recipes/zpp_bits/all/conanfile.py new file mode 100644 index 0000000000000..4127bf8c567e7 --- /dev/null +++ b/recipes/zpp_bits/all/conanfile.py @@ -0,0 +1,71 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +import os + + +required_conan_version = ">=1.52.0" + + +class ZppBitsConan(ConanFile): + name = "zpp_bits" + description = "A lightweight C++20 serialization and RPC library" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/eyalz800/zpp_bits" + topics = ("serialization", "rpc", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "gcc": "11", + "clang": "12", + "apple-clang": "13.1", + "Visual Studio": "17", + "msvc": "193", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.name} {self.version} requires C++{self._min_cppstd}, which your compiler does not support.", + ) + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="zpp_bits.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] diff --git a/recipes/zpp_bits/all/test_package/CMakeLists.txt b/recipes/zpp_bits/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..73137c5e1e473 --- /dev/null +++ b/recipes/zpp_bits/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(zpp_bits REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE zpp_bits::zpp_bits) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/zpp_bits/all/test_package/conanfile.py b/recipes/zpp_bits/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/zpp_bits/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zpp_bits/all/test_package/test_package.cpp b/recipes/zpp_bits/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..d533c36161edc --- /dev/null +++ b/recipes/zpp_bits/all/test_package/test_package.cpp @@ -0,0 +1,24 @@ +#include +#include + +#include "zpp_bits.h" + +struct person { + std::string name; + int age{}; +}; + +int main(void) { + auto [data, in, out] = zpp::bits::data_in_out(); + + out(person{"Person1", 25}, person{"Person2", 35}); + + person p1, p2; + + in(p1, p2); + + std::cout << p1.name << " : " << p1.age << "\n"; + std::cout << p2.name << " : " << p2.age << "\n"; + + return 0; +} diff --git a/recipes/zpp_bits/all/test_v1_package/CMakeLists.txt b/recipes/zpp_bits/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..925ecbe19e448 --- /dev/null +++ b/recipes/zpp_bits/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.1) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/zpp_bits/all/test_v1_package/conanfile.py b/recipes/zpp_bits/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..5a05af3c2dfd2 --- /dev/null +++ b/recipes/zpp_bits/all/test_v1_package/conanfile.py @@ -0,0 +1,18 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/zpp_bits/config.yml b/recipes/zpp_bits/config.yml new file mode 100644 index 0000000000000..d7d24328031e4 --- /dev/null +++ b/recipes/zpp_bits/config.yml @@ -0,0 +1,5 @@ +versions: + "4.4.13": + folder: all + "4.4.12": + folder: all diff --git a/recipes/zpp_throwing/all/conandata.yml b/recipes/zpp_throwing/all/conandata.yml new file mode 100644 index 0000000000000..063b5be845f31 --- /dev/null +++ b/recipes/zpp_throwing/all/conandata.yml @@ -0,0 +1,4 @@ +sources: + "1.0": + url: "https://github.com/eyalz800/zpp_throwing/archive/refs/tags/v1.0.tar.gz" + sha256: "e02ef0e028e436ed4382b14796550f48c1d2b5ae02910f10b5b9fe097981ea2f" diff --git a/recipes/zpp_throwing/all/conanfile.py b/recipes/zpp_throwing/all/conanfile.py new file mode 100644 index 0000000000000..6cfaa18e3dd02 --- /dev/null +++ b/recipes/zpp_throwing/all/conanfile.py @@ -0,0 +1,87 @@ +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.build import check_min_cppstd +from conan.tools.files import get, copy +from conan.tools.layout import basic_layout +from conan.tools.scm import Version +from conan.tools.microsoft import is_msvc +import os + +required_conan_version = ">=1.52.0" + +class ZppThrowingConan(ConanFile): + name = "zpp_throwing" + description = "Using coroutines to implement C++ exceptions for freestanding environments" + license = "MIT" + url = "https://github.com/conan-io/conan-center-index" + homepage = "https://github.com/eyalz800/zpp_throwing" + topics = ("coroutines", "exceptions", "header-only") + settings = "os", "arch", "compiler", "build_type" + no_copy_source = True + + @property + def _min_cppstd(self): + return 20 + + @property + def _compilers_minimum_version(self): + return { + "Visual Studio": "17", + "msvc": "193", + "gcc": "11", + "clang": "12", + "apple-clang": "13.1", + } + + def layout(self): + basic_layout(self, src_folder="src") + + def package_id(self): + self.info.clear() + + def validate(self): + # TODO: currently msvc isn't suppported + # see https://github.com/eyalz800/zpp_throwing/issues/7 + if is_msvc(self): + raise ConanInvalidConfiguration(f"{self.ref} doesn't support MSVC (yet). See https://github.com/eyalz800/zpp_throwing/issues/7") + + if self.settings.compiler.get_safe("cppstd"): + check_min_cppstd(self, self._min_cppstd) + + def loose_lt_semver(v1, v2): + lv1 = [int(v) for v in v1.split(".")] + lv2 = [int(v) for v in v2.split(".")] + min_length = min(len(lv1), len(lv2)) + return lv1[:min_length] < lv2[:min_length] + + compiler = str(self.settings.compiler) + version = str(self.settings.compiler.version) + + minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False) + if minimum_version and loose_lt_semver(str(self.settings.compiler.version), minimum_version): + raise ConanInvalidConfiguration( + f"{self.ref} requires C++{self._min_cppstd}, which your compiler ({compiler}-{version}) does not support.", + ) + + if self.settings.compiler == "clang" and Version(self.settings.compiler.version) < "14" and self.settings.compiler.get_safe("libcxx") != "libc++": + raise ConanInvalidConfiguration(f"{self.ref} requires libc++ with 'coroutines' supported on your compiler.") + + def source(self): + get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) + + def package(self): + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + copy( + self, + pattern="*.h", + dst=os.path.join(self.package_folder, "include"), + src=self.source_folder, + ) + + def package_info(self): + self.cpp_info.bindirs = [] + self.cpp_info.libdirs = [] + + if self.settings.compiler == "clang" and self.settings.compiler.get_safe("libcxx") == "libc++": + self.cpp_info.cxxflags.append("-fcoroutines-ts") + diff --git a/recipes/zpp_throwing/all/test_package/CMakeLists.txt b/recipes/zpp_throwing/all/test_package/CMakeLists.txt new file mode 100644 index 0000000000000..0d33f96e054b5 --- /dev/null +++ b/recipes/zpp_throwing/all/test_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.12) +project(test_package LANGUAGES CXX) + +find_package(zpp_throwing REQUIRED CONFIG) + +add_executable(${PROJECT_NAME} test_package.cpp) +target_link_libraries(${PROJECT_NAME} PRIVATE zpp_throwing::zpp_throwing) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) diff --git a/recipes/zpp_throwing/all/test_package/conanfile.py b/recipes/zpp_throwing/all/test_package/conanfile.py new file mode 100644 index 0000000000000..e845ae751a301 --- /dev/null +++ b/recipes/zpp_throwing/all/test_package/conanfile.py @@ -0,0 +1,26 @@ +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zpp_throwing/all/test_package/test_package.cpp b/recipes/zpp_throwing/all/test_package/test_package.cpp new file mode 100644 index 0000000000000..c723a245f1637 --- /dev/null +++ b/recipes/zpp_throwing/all/test_package/test_package.cpp @@ -0,0 +1,28 @@ +#include +#include + +#include "zpp_throwing.h" + +zpp::throwing foo(bool success) { + if (!success) { + // Throws an exception. + co_yield std::runtime_error("My runtime error"); + } + + // Returns a value. + co_return 1337; +} + +int main() { + return zpp::try_catch([]() -> zpp::throwing { + std::cout << "Hello World\n"; + std::cout << co_await foo(false) << '\n';; + co_return 0; + }, [&](const std::exception & error) { + std::cout << "std exception caught: " << error.what() << '\n'; + return 0; + }, [&]() { + std::cout << "Unknown exception\n"; + return 0; + }); +} diff --git a/recipes/zpp_throwing/all/test_v1_package/CMakeLists.txt b/recipes/zpp_throwing/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/zpp_throwing/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/zpp_throwing/all/test_v1_package/conanfile.py b/recipes/zpp_throwing/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..0f735b51a2642 --- /dev/null +++ b/recipes/zpp_throwing/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/zpp_throwing/config.yml b/recipes/zpp_throwing/config.yml new file mode 100644 index 0000000000000..edab1ee152d36 --- /dev/null +++ b/recipes/zpp_throwing/config.yml @@ -0,0 +1,3 @@ +versions: + "1.0": + folder: all diff --git a/recipes/zstd/all/conandata.yml b/recipes/zstd/all/conandata.yml index 9c8ee8682a9a5..b1f62bc5ebf11 100644 --- a/recipes/zstd/all/conandata.yml +++ b/recipes/zstd/all/conandata.yml @@ -1,43 +1,75 @@ sources: - "1.3.5": - sha256: d6e1559e4cdb7c4226767d4ddc990bff5f9aab77085ff0d0490c828b025e2eea - url: https://github.com/facebook/zstd/archive/v1.3.5.tar.gz - "1.3.8": - sha256: 90d902a1282cc4e197a8023b6d6e8d331c1fd1dfe60f7f8e4ee9da40da886dc3 - url: https://github.com/facebook/zstd/archive/v1.3.8.tar.gz - "1.4.3": - sha256: 5eda3502ecc285c3c92ee0cc8cd002234dee39d539b3f692997a0e80de1d33de - url: https://github.com/facebook/zstd/archive/v1.4.3.tar.gz - "1.4.4": - sha256: a364f5162c7d1a455cc915e8e3cf5f4bd8b75d09bc0f53965b0c9ca1383c52c8 - url: https://github.com/facebook/zstd/archive/v1.4.4.tar.gz - "1.4.5": - sha256: 734d1f565c42f691f8420c8d06783ad818060fc390dee43ae0a89f86d0a4f8c2 - url: https://github.com/facebook/zstd/archive/v1.4.5.tar.gz - "1.4.7": - sha256: 085500c8d0b9c83afbc1dc0d8b4889336ad019eba930c5d6a9c6c86c20c769c8 - url: https://github.com/facebook/zstd/archive/v1.4.7.tar.gz - "1.4.8": - sha256: f176f0626cb797022fbf257c3c644d71c1c747bb74c32201f9203654da35e9fa - url: https://github.com/facebook/zstd/archive/v1.4.8.tar.gz - "1.4.9": - sha256: acf714d98e3db7b876e5b540cbf6dee298f60eb3c0723104f6d3f065cd60d6a8 - url: https://github.com/facebook/zstd/archive/v1.4.9.tar.gz - "1.5.0": - sha256: 0d9ade222c64e912d6957b11c923e214e2e010a18f39bec102f572e693ba2867 - url: https://github.com/facebook/zstd/archive/v1.5.0.tar.gz - "1.5.1": - sha256: dc05773342b28f11658604381afd22cb0a13e8ba17ff2bd7516df377060c18dd - url: https://github.com/facebook/zstd/archive/v1.5.1.tar.gz + "1.5.4": + url: "https://github.com/facebook/zstd/releases/download/v1.5.4/zstd-1.5.4.tar.gz" + sha256: "0f470992aedad543126d06efab344dc5f3e171893810455787d38347343a4424" "1.5.2": - sha256: f7de13462f7a82c29ab865820149e778cbfe01087b3a55b5332707abf9db4a6e - url: https://github.com/facebook/zstd/archive/v1.5.2.tar.gz -patches: - "1.3.5": - - patch_file: "patches/1.3.5-cmake-project.patch" - "1.4.5": - - patch_file: "patches/1.4.5-cmake-install-dll.patch" + url: "https://github.com/facebook/zstd/releases/download/v1.5.2/zstd-1.5.2.tar.gz" + sha256: "7c42d56fac126929a6a85dbc73ff1db2411d04f104fae9bdea51305663a83fd0" "1.5.1": - - patch_file: "patches/1.5.1-cmake-remove-asm-except-x86_64.patch" + url: "https://github.com/facebook/zstd/releases/download/v1.5.1/zstd-1.5.1.tar.gz" + sha256: "e28b2f2ed5710ea0d3a1ecac3f6a947a016b972b9dd30242369010e5f53d7002" + "1.5.0": + url: "https://github.com/facebook/zstd/releases/download/v1.5.0/zstd-1.5.0.tar.gz" + sha256: "5194fbfa781fcf45b98c5e849651aa7b3b0a008c6b72d4a0db760f3002291e94" + "1.4.9": + url: "https://github.com/facebook/zstd/releases/download/v1.4.9/zstd-1.4.9.tar.gz" + sha256: "29ac74e19ea28659017361976240c4b5c5c24db3b89338731a6feb97c038d293" + "1.4.8": + url: "https://github.com/facebook/zstd/releases/download/v1.4.8/zstd-1.4.8.tar.gz" + sha256: "32478297ca1500211008d596276f5367c54198495cf677e9439f4791a4c69f24" + "1.4.7": + url: "https://github.com/facebook/zstd/releases/download/v1.4.7/zstd-1.4.7.tar.gz" + sha256: "192cbb1274a9672cbcceaf47b5c4e9e59691ca60a357f1d4a8b2dfa2c365d757" + "1.4.5": + url: "https://github.com/facebook/zstd/releases/download/v1.4.5/zstd-1.4.5.tar.gz" + sha256: "98e91c7c6bf162bf90e4e70fdbc41a8188b9fa8de5ad840c401198014406ce9e" + "1.4.4": + url: "https://github.com/facebook/zstd/releases/download/v1.4.4/zstd-1.4.4.tar.gz" + sha256: "59ef70ebb757ffe74a7b3fe9c305e2ba3350021a918d168a046c6300aeea9315" + "1.4.3": + url: "https://github.com/facebook/zstd/releases/download/v1.4.3/zstd-1.4.3.tar.gz" + sha256: "e88ec8d420ff228610b77fba4fbf22b9f8b9d3f223a40ef59c9c075fcdad5767" + "1.3.8": + url: "https://github.com/facebook/zstd/releases/download/v1.3.8/zstd-1.3.8.tar.gz" + sha256: "293fa004dfacfbe90b42660c474920ff27093e3fb6c99f7b76e6083b21d6d48e" + "1.3.5": + url: "https://github.com/facebook/zstd/archive/refs/tags/v1.3.5.tar.gz" + sha256: "d6e1559e4cdb7c4226767d4ddc990bff5f9aab77085ff0d0490c828b025e2eea" +patches: + "1.5.4": + - patch_file: "patches/1.5.2-cmake-remove-asm-except-x86_64.patch" + patch_description: "use assembler codes only on x86_64" + patch_type: "portability" + - patch_file: "patches/1.5.4-decrease-min-cmake-version.patch" + patch_description: "Don't require CMake 3.18 or later" + patch_type: "portability" + patch_source: "https://github.com/facebook/zstd/pull/3510" "1.5.2": - patch_file: "patches/1.5.2-cmake-remove-asm-except-x86_64.patch" + patch_description: "use assembler codes only on x86_64" + patch_type: "portability" + - patch_file: "patches/1.5.0-remove-explicit-standard-setting.patch" + patch_description: "fix strange performance and scalability issues" + patch_type: "bugfix" + patch_source: "https://github.com/facebook/zstd/pull/3167" + "1.5.1": + - patch_file: "patches/1.5.1-cmake-remove-asm-except-x86_64.patch" + patch_description: "use assembler codes only on x86_64" + patch_type: "portability" + - patch_file: "patches/1.5.0-remove-explicit-standard-setting.patch" + patch_description: "fix strange performance and scalability issues" + patch_type: "bugfix" + patch_source: "https://github.com/facebook/zstd/pull/3167" + "1.5.0": + - patch_file: "patches/1.5.0-remove-explicit-standard-setting.patch" + patch_description: "fix strange performance and scalability issues" + patch_type: "bugfix" + patch_source: "https://github.com/facebook/zstd/pull/3167" + "1.4.5": + - patch_file: "patches/1.4.5-cmake-install-dll.patch" + patch_description: "fix runtime installation path" + patch_type: "conan" + "1.3.5": + - patch_file: "patches/1.3.5-cmake-project.patch" + patch_description: "fix `project()` position" + patch_type: "portability" diff --git a/recipes/zstd/all/conanfile.py b/recipes/zstd/all/conanfile.py index e3a3712bb2cbe..0b3e82a7fef9c 100644 --- a/recipes/zstd/all/conanfile.py +++ b/recipes/zstd/all/conanfile.py @@ -1,10 +1,10 @@ from conan import ConanFile from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, collect_libs, copy, get, replace_in_file, rmdir +from conan.tools.files import apply_conandata_patches, collect_libs, copy, export_conandata_patches, get, replace_in_file, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.50.0" +required_conan_version = ">=1.53.0" class ZstdConan(ConanFile): @@ -12,9 +12,10 @@ class ZstdConan(ConanFile): url = "https://github.com/conan-io/conan-center-index" homepage = "https://github.com/facebook/zstd" description = "Zstandard - Fast real-time compression algorithm" - topics = ("zstd", "compression", "algorithm", "decoder") + topics = ("zstandard", "compression", "algorithm", "decoder") license = "BSD-3-Clause" + package_type = "library" settings = "os", "arch", "compiler", "build_type" options = { "shared": [True, False], @@ -28,8 +29,7 @@ class ZstdConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -37,22 +37,15 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") def source(self): - get(self, **self.conan_data["sources"][self.version], - destination=self.source_folder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], strip_root=True) def generate(self): tc = CMakeToolchain(self) diff --git a/recipes/zstd/all/patches/1.5.0-remove-explicit-standard-setting.patch b/recipes/zstd/all/patches/1.5.0-remove-explicit-standard-setting.patch new file mode 100644 index 0000000000000..cb025cd1b5b23 --- /dev/null +++ b/recipes/zstd/all/patches/1.5.0-remove-explicit-standard-setting.patch @@ -0,0 +1,21 @@ +diff --git a/a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake b/b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake +index e23b9d6..8d04458 100644 +--- a/a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake ++++ b/b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake +@@ -22,10 +22,12 @@ endfunction() + + macro(ADD_ZSTD_COMPILATION_FLAGS) + if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" OR MINGW) #Not only UNIX but also WIN32 for MinGW +- #Set c++11 by default +- EnableCompilerFlag("-std=c++11" false true) +- #Set c99 by default +- EnableCompilerFlag("-std=c99" true false) ++ # It's possible to select the exact standard used for compilation. ++ # It's not necessary, but can be employed for specific purposes. ++ # Note that zstd source code is compatible with both C++98 and above ++ # and C-gnu90 (c90 + long long + variadic macros ) and above ++ # EnableCompilerFlag("-std=c++11" false true) # Set C++ compilation to c++11 standard ++ # EnableCompilerFlag("-std=c99" true false) # Set C compiation to c99 standard + if (CMAKE_CXX_COMPILER_ID MATCHES "Clang" AND MSVC) + # clang-cl normally maps -Wall to -Weverything. + EnableCompilerFlag("/clang:-Wall" true true) diff --git a/recipes/zstd/all/patches/1.5.4-decrease-min-cmake-version.patch b/recipes/zstd/all/patches/1.5.4-decrease-min-cmake-version.patch new file mode 100644 index 0000000000000..d846e0df710df --- /dev/null +++ b/recipes/zstd/all/patches/1.5.4-decrease-min-cmake-version.patch @@ -0,0 +1,36 @@ +--- a/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake ++++ b/build/cmake/CMakeModules/AddZstdCompilationFlags.cmake +@@ -1,6 +1,15 @@ + include(CheckCXXCompilerFlag) + include(CheckCCompilerFlag) +-include(CheckLinkerFlag) ++# VERSION_GREATER_EQUAL requires CMake 3.7 or later. ++# https://cmake.org/cmake/help/latest/command/if.html#version-greater-equal ++if (CMAKE_VERSION VERSION_LESS 3.18) ++ set(ZSTD_HAVE_CHECK_LINKER_FLAG false) ++else () ++ set(ZSTD_HAVE_CHECK_LINKER_FLAG true) ++endif () ++if (ZSTD_HAVE_CHECK_LINKER_FLAG) ++ include(CheckLinkerFlag) ++endif() + + function(EnableCompilerFlag _flag _C _CXX _LD) + string(REGEX REPLACE "\\+" "PLUS" varname "${_flag}") +@@ -20,7 +29,15 @@ function(EnableCompilerFlag _flag _C _CXX _LD) + endif () + endif () + if (_LD) +- CHECK_LINKER_FLAG(C ${_flag} LD_FLAG_${varname}) ++ # We never add a linker flag with CMake < 3.18. We will ++ # implement CHECK_LINKER_FLAG() like feature for CMake < 3.18 ++ # or require CMake >= 3.18 when we need to add a required ++ # linker flag in future. ++ if (ZSTD_HAVE_CHECK_LINKER_FLAG) ++ CHECK_LINKER_FLAG(C ${_flag} LD_FLAG_${varname}) ++ else () ++ set(LD_FLAG_${varname} false) ++ endif () + if (LD_FLAG_${varname}) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${_flag}" PARENT_SCOPE) + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${_flag}" PARENT_SCOPE) diff --git a/recipes/zstd/all/test_package/conanfile.py b/recipes/zstd/all/test_package/conanfile.py index 6220cddeb6ff4..6f307ff1c207f 100644 --- a/recipes/zstd/all/test_package/conanfile.py +++ b/recipes/zstd/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/zstd/all/test_v1_package/CMakeLists.txt b/recipes/zstd/all/test_v1_package/CMakeLists.txt index 62ad23c5ae022..0d20897301b68 100644 --- a/recipes/zstd/all/test_v1_package/CMakeLists.txt +++ b/recipes/zstd/all/test_v1_package/CMakeLists.txt @@ -1,14 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(zstd REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -if (TARGET zstd::libzstd_shared) - target_link_libraries(${PROJECT_NAME} PRIVATE zstd::libzstd_shared) -else() - target_link_libraries(${PROJECT_NAME} PRIVATE zstd::libzstd_static) -endif() +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/zstd/config.yml b/recipes/zstd/config.yml index 27b6e7a051e76..a235c3fe762f6 100644 --- a/recipes/zstd/config.yml +++ b/recipes/zstd/config.yml @@ -1,23 +1,25 @@ versions: - "1.3.5": + "1.5.4": folder: all - "1.3.8": + "1.5.2": folder: all - "1.4.3": + "1.5.1": folder: all - "1.4.4": + "1.5.0": folder: all - "1.4.5": + "1.4.9": + folder: all + "1.4.8": folder: all "1.4.7": folder: all - "1.4.8": + "1.4.5": folder: all - "1.4.9": + "1.4.4": folder: all - "1.5.0": + "1.4.3": folder: all - "1.5.1": + "1.3.8": folder: all - "1.5.2": + "1.3.5": folder: all diff --git a/recipes/zstr/all/conandata.yml b/recipes/zstr/all/conandata.yml index f563402cf65a8..d912b849c0a5f 100644 --- a/recipes/zstr/all/conandata.yml +++ b/recipes/zstr/all/conandata.yml @@ -1,4 +1,7 @@ sources: + "1.0.7": + url: "https://github.com/mateidavid/zstr/archive/refs/tags/v1.0.7.tar.gz" + sha256: "8d2ddae68ff7bd0a6fce6150a8f52ad9ce1bed2c4056c8846f4dec4f2dc60819" "1.0.6": url: "https://github.com/mateidavid/zstr/archive/refs/tags/v1.0.6.tar.gz" sha256: "548f3fed81029defc3567d1902f7306eb0aa19f205ce9e06075b7349a3875f32" diff --git a/recipes/zstr/all/conanfile.py b/recipes/zstr/all/conanfile.py index e6352d395c1c2..512be7c200256 100644 --- a/recipes/zstr/all/conanfile.py +++ b/recipes/zstr/all/conanfile.py @@ -1,43 +1,46 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import check_min_cppstd +from conan.tools.files import copy, get +from conan.tools.layout import basic_layout import os -required_conan_version = ">=1.33.0" +required_conan_version = ">=1.51.1" class ZstrConan(ConanFile): name = "zstr" description = "A C++ header-only ZLib wrapper." license = "MIT" - topics = ("zstr", "zlib", "compression") + topics = ("zlib", "wrapper", "compression") homepage = "https://github.com/mateidavid/zstr" url = "https://github.com/conan-io/conan-center-index" settings = "os", "arch", "compiler", "build_type" no_copy_source = True - @property - def _source_subfolder(self): - return "source_subfolder" + def layout(self): + basic_layout(self, src_folder="src") def requirements(self): - self.requires("zlib/1.2.12") + self.requires("zlib/1.2.13") def package_id(self): - self.info.header_only() + self.info.clear() def validate(self): if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, 11) + check_min_cppstd(self, 11) def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version], + destination=self.source_folder, strip_root=True) + + def build(self): + pass def package(self): - self.copy("LICENSE", dst="licenses", src=self._source_subfolder) - self.copy("*", dst="include", src=os.path.join(self._source_subfolder, "src")) + copy(self, "LICENSE", src=self.source_folder, dst=os.path.join(self.package_folder, "licenses")) + copy(self, "*", src=os.path.join(self.source_folder, "src"), dst=os.path.join(self.package_folder, "include")) def package_info(self): self.cpp_info.bindirs = [] - self.cpp_info.frameworkdirs = [] self.cpp_info.libdirs = [] - self.cpp_info.resdirs = [] diff --git a/recipes/zstr/all/test_package/CMakeLists.txt b/recipes/zstr/all/test_package/CMakeLists.txt index ed1a400183c92..4fae7f3b9f5a3 100644 --- a/recipes/zstr/all/test_package/CMakeLists.txt +++ b/recipes/zstr/all/test_package/CMakeLists.txt @@ -1,11 +1,8 @@ -cmake_minimum_required(VERSION 3.1) -project(test_package) +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) -include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) -conan_basic_setup(TARGETS) - -find_package(zstr CONFIG REQUIRED) +find_package(zstr REQUIRED CONFIG) add_executable(${PROJECT_NAME} test_package.cpp) -target_link_libraries(${PROJECT_NAME} zstr::zstr) -set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 11) +target_link_libraries(${PROJECT_NAME} PRIVATE zstr::zstr) +target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_11) diff --git a/recipes/zstr/all/test_package/conanfile.py b/recipes/zstr/all/test_package/conanfile.py index 38f4483872d47..0a6bc68712d90 100644 --- a/recipes/zstr/all/test_package/conanfile.py +++ b/recipes/zstr/all/test_package/conanfile.py @@ -1,10 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import CMake, cmake_layout import os class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" + test_type = "explicit" + + def layout(self): + cmake_layout(self) + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): cmake = CMake(self) @@ -12,6 +21,6 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + if can_run(self): + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") diff --git a/recipes/zstr/all/test_v1_package/CMakeLists.txt b/recipes/zstr/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..9d54a092e0a67 --- /dev/null +++ b/recipes/zstr/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package LANGUAGES CXX) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/zstr/all/test_v1_package/conanfile.py b/recipes/zstr/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..38f4483872d47 --- /dev/null +++ b/recipes/zstr/all/test_v1_package/conanfile.py @@ -0,0 +1,17 @@ +from conans import ConanFile, CMake, tools +import os + + +class TestPackageConan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not tools.cross_building(self): + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) diff --git a/recipes/zstr/config.yml b/recipes/zstr/config.yml index c32b2b7161197..86728f7f3bec4 100644 --- a/recipes/zstr/config.yml +++ b/recipes/zstr/config.yml @@ -1,4 +1,6 @@ versions: + "1.0.7": + folder: all "1.0.6": folder: all "1.0.5": diff --git a/recipes/zulu-openjdk/all/conandata.yml b/recipes/zulu-openjdk/all/conandata.yml index 5243fbdebc8c0..516a7ae7f4098 100644 --- a/recipes/zulu-openjdk/all/conandata.yml +++ b/recipes/zulu-openjdk/all/conandata.yml @@ -1,64 +1,40 @@ sources: - "11.0.8": - "Windows": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-win_x64.zip", - "sha256": "3602ed7bae52898c540c2d3ae3230c081cf061b219d14fb9ac15a47f4226d307", - } - "Linux": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-linux_x64.tar.gz", - "sha256": "f8aee4ab30ca11ab3c8f401477df0e455a9d6b06f2710b2d1b1ddcf06067bc79", - } - "Macos": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.41.23-ca-jdk11.0.8-macosx_x64.tar.gz", - "sha256": "1ed070ea9a27030bcca4d7c074dec1d205d3f3506166d36faf4d1b9e083ab365", - } - "11.0.12": "Windows": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-win_x64.zip", - "sha256": "42ae65e75d615a3f06a674978e1fa85fdf078cad94e553fee3e779b2b42bb015", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-win_x64.zip" + sha256: "42ae65e75d615a3f06a674978e1fa85fdf078cad94e553fee3e779b2b42bb015" "Linux": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz", - "sha256": "b8e8a63b79bc312aa90f3558edbea59e71495ef1a9c340e38900dd28a1c579f3", - } - "armv8": { - "url": "https://cdn.azul.com/zulu-embedded/bin/zulu11.50.19-ca-jdk11.0.12-linux_aarch64.tar.gz", - "sha256": "61254688067454d3ccf0ef25993b5dcab7b56c8129e53b73566c28a8dd4d48fb", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-linux_x64.tar.gz" + sha256: "b8e8a63b79bc312aa90f3558edbea59e71495ef1a9c340e38900dd28a1c579f3" + "armv8": + url: "https://cdn.azul.com/zulu-embedded/bin/zulu11.50.19-ca-jdk11.0.12-linux_aarch64.tar.gz" + sha256: "61254688067454d3ccf0ef25993b5dcab7b56c8129e53b73566c28a8dd4d48fb" "Macos": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_x64.tar.gz", - "sha256": "0b8c8b7cf89c7c55b7e2239b47201d704e8d2170884875b00f3103cf0662d6d7", - } - "armv8" : { - "url": "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_aarch64.tar.gz", - "sha256": "e908a0b4c0da08d41c3e19230f819b364ff2e5f1dafd62d2cf991a85a34d3a17", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_x64.tar.gz" + sha256: "0b8c8b7cf89c7c55b7e2239b47201d704e8d2170884875b00f3103cf0662d6d7" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu11.50.19-ca-jdk11.0.12-macosx_aarch64.tar.gz" + sha256: "e908a0b4c0da08d41c3e19230f819b364ff2e5f1dafd62d2cf991a85a34d3a17" "11.0.15": "Windows": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-win_x64.zip", - "sha256": "a106c77389a63b6bd963a087d5f01171bd32aa3ee7377ecef87531390dcb9050", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-win_x64.zip" + sha256: "a106c77389a63b6bd963a087d5f01171bd32aa3ee7377ecef87531390dcb9050" "Linux": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux_x64.tar.gz", - "sha256": "e064b61d93304012351242bf0823c6a2e41d9e28add7ea7f05378b7243d34247", - } - "armv8": { - "url": "https://cdn.azul.com/zulu-embedded/bin/zulu11.56.19-ca-jdk11.0.15-linux_aarch64.tar.gz", - "sha256": "fc7c41a0005180d4ca471c90d01e049469e0614cf774566d4cf383caa29d1a97", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-linux_x64.tar.gz" + sha256: "e064b61d93304012351242bf0823c6a2e41d9e28add7ea7f05378b7243d34247" + "armv8": + url: "https://cdn.azul.com/zulu-embedded/bin/zulu11.56.19-ca-jdk11.0.15-linux_aarch64.tar.gz" + sha256: "fc7c41a0005180d4ca471c90d01e049469e0614cf774566d4cf383caa29d1a97" "Macos": - "x86_64": { - "url": "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_x64.tar.gz", - "sha256": "2614e5c5de8e989d4d81759de4c333aa5b867b17ab9ee78754309ba65c7f6f55", - } - "armv8" : { - "url": "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64.tar.gz", - "sha256": "6bb0d2c6e8a29dcd9c577bbb2986352ba12481a9549ac2c0bcfd00ed60e538d2", - } + "x86_64": + url: "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_x64.tar.gz" + sha256: "2614e5c5de8e989d4d81759de4c333aa5b867b17ab9ee78754309ba65c7f6f55" + "armv8": + url: "https://cdn.azul.com/zulu/bin/zulu11.56.19-ca-jdk11.0.15-macosx_aarch64.tar.gz" + sha256: "6bb0d2c6e8a29dcd9c577bbb2986352ba12481a9549ac2c0bcfd00ed60e538d2" diff --git a/recipes/zulu-openjdk/all/conanfile.py b/recipes/zulu-openjdk/all/conanfile.py index df269044c419f..05d28945d8c9a 100644 --- a/recipes/zulu-openjdk/all/conanfile.py +++ b/recipes/zulu-openjdk/all/conanfile.py @@ -1,7 +1,8 @@ -from conans import ConanFile, tools -from conans.errors import ConanInvalidConfiguration -from conans.tools import Version -import os, glob +import os + +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.files import get, copy class ZuluOpenJDK(ConanFile): @@ -11,11 +12,8 @@ class ZuluOpenJDK(ConanFile): homepage = "https://www.azul.com" license = "https://www.azul.com/products/zulu-and-zulu-enterprise/zulu-terms-of-use/" topics = ("java", "jdk", "openjdk") - settings = "os", "arch", "build_type", "compiler" - - @property - def _source_subfolder(self): - return "source_subfolder" + settings = "os", "arch" + package_type = "application" @property def _settings_build(self): @@ -26,42 +24,39 @@ def _jni_folder(self): folder = {"Linux": "linux", "Macos": "darwin", "Windows": "win32"}.get(str(self._settings_build.os)) return os.path.join("include", folder) - def package_id(self): - del self.info.settings.build_type - del self.info.settings.compiler def validate(self): - if Version(self.version) < Version("11.0.12"): - supported_archs = ["x86_64"] - if self._settings_build.arch not in supported_archs: - raise ConanInvalidConfiguration(f"Unsupported Architecture ({self._settings_build.arch}). The version {self.version} currently only supports {supported_archs}.") - elif Version(self.version) >= Version("11.0.12"): - supported_archs = ["x86_64", "armv8"] - if self._settings_build.arch not in supported_archs: - raise ConanInvalidConfiguration(f"Unsupported Architecture ({self._settings_build.arch}). This version {self.version} currently only supports {supported_archs}.") + supported_archs = ["x86_64", "armv8"] + if self._settings_build.arch not in supported_archs: + raise ConanInvalidConfiguration(f"Unsupported Architecture ({self._settings_build.arch}). " + "This version {self.version} currently only supports {supported_archs}.") supported_os = ["Windows", "Macos", "Linux"] if self._settings_build.os not in supported_os: - raise ConanInvalidConfiguration(f"Unsupported os ({self._settings_build.os}). This package currently only support {supported_os}.") + raise ConanInvalidConfiguration(f"Unsupported os ({self._settings_build.os}). " + "This package currently only support {supported_os}.") def build(self): - if Version(self.version) < Version("11.0.12"): - tools.get(**self.conan_data["sources"][self.version][str(self._settings_build.os)], - destination=self._source_subfolder, strip_root=True) - else: - tools.get(**self.conan_data["sources"][self.version][str(self._settings_build.os)][str(self._settings_build.arch)], - destination=self._source_subfolder, strip_root=True) + get(self, **self.conan_data["sources"][self.version][str(self._settings_build.os)][str(self._settings_build.arch)], strip_root=True) def package(self): - self.copy(pattern="*", dst="bin", src=os.path.join(self._source_subfolder, "bin"), excludes=("msvcp140.dll", "vcruntime140.dll")) - self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include")) - self.copy(pattern="*", dst="lib", src=os.path.join(self._source_subfolder, "lib")) - self.copy(pattern="*", dst="res", src=os.path.join(self._source_subfolder, "conf")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "bin"), + src=os.path.join(self.source_folder, "bin"), + excludes=("msvcp140.dll", "vcruntime140.dll")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "include"), + src=os.path.join(self.source_folder, "include")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "lib"), + src=os.path.join(self.source_folder, "lib")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "res"), + src=os.path.join(self.source_folder, "conf")) # conf folder is required for security settings, to avoid # java.lang.SecurityException: Can't read cryptographic policy directory: unlimited # https://github.com/conan-io/conan-center-index/pull/4491#issuecomment-774555069 - self.copy(pattern="*", dst="conf", src=os.path.join(self._source_subfolder, "conf")) - self.copy(pattern="*", dst="licenses", src=os.path.join(self._source_subfolder, "legal")) - self.copy(pattern="*", dst=os.path.join("lib", "jmods"), src=os.path.join(self._source_subfolder, "jmods")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "conf"), + src=os.path.join(self.source_folder, "conf")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "licenses"), + src=os.path.join(self.source_folder, "legal")) + copy(self, pattern="*", dst=os.path.join(self.package_folder, "lib", "jmods"), + src=os.path.join(self.source_folder, "jmods")) def package_info(self): self.cpp_info.includedirs.append(self._jni_folder) @@ -72,6 +67,8 @@ def package_info(self): self.output.info("Creating JAVA_HOME environment variable with : {0}".format(java_home)) self.env_info.JAVA_HOME = java_home + self.buildenv_info.define_path("JAVA_HOME", java_home) + self.runenv_info.define_path("JAVA_HOME", java_home) self.output.info("Appending PATH environment variable with : {0}".format(bin_path)) self.env_info.PATH.append(bin_path) diff --git a/recipes/zulu-openjdk/all/test_package/conanfile.py b/recipes/zulu-openjdk/all/test_package/conanfile.py index 59867bd3e396d..e80eb25a7acac 100644 --- a/recipes/zulu-openjdk/all/test_package/conanfile.py +++ b/recipes/zulu-openjdk/all/test_package/conanfile.py @@ -1,26 +1,29 @@ -from conans import ConanFile, tools +from conan import ConanFile +from conan.tools.build import cross_building from io import StringIO class TestPackage(ConanFile): settings = "os", "arch" + test_type = "explicit" + generators = "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) def build(self): pass # nothing to build, but tests should not warn def test(self): - if tools.cross_building(self): + if cross_building(self): return # OK, this needs some explanation # You basically do not crosscompile that package, never # But C3I does, Macos x86_64 to M1, # and this is why there is some cross compilation going on # The test will not work in that environment, so .... don't test - test_cmd = ['java', '--version'] output = StringIO() - self.run(test_cmd, output=output, run_environment=True) + self.run("java --version", output, env="conanrun") version_info = output.getvalue() - if "Zulu" in version_info: - pass - else: + if "Zulu" not in version_info: raise Exception("java call seems not use the Zulu bin") diff --git a/recipes/zulu-openjdk/all/test_v1_package/conanfile.py b/recipes/zulu-openjdk/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..e80eb25a7acac --- /dev/null +++ b/recipes/zulu-openjdk/all/test_v1_package/conanfile.py @@ -0,0 +1,29 @@ +from conan import ConanFile +from conan.tools.build import cross_building +from io import StringIO + + +class TestPackage(ConanFile): + settings = "os", "arch" + test_type = "explicit" + generators = "VirtualRunEnv" + + def requirements(self): + self.requires(self.tested_reference_str) + + def build(self): + pass # nothing to build, but tests should not warn + + def test(self): + if cross_building(self): + return + # OK, this needs some explanation + # You basically do not crosscompile that package, never + # But C3I does, Macos x86_64 to M1, + # and this is why there is some cross compilation going on + # The test will not work in that environment, so .... don't test + output = StringIO() + self.run("java --version", output, env="conanrun") + version_info = output.getvalue() + if "Zulu" not in version_info: + raise Exception("java call seems not use the Zulu bin") diff --git a/recipes/zulu-openjdk/config.yml b/recipes/zulu-openjdk/config.yml index aeba9022820bc..41d345875e1e8 100644 --- a/recipes/zulu-openjdk/config.yml +++ b/recipes/zulu-openjdk/config.yml @@ -1,6 +1,4 @@ versions: - "11.0.8": - folder: all "11.0.12": folder: all "11.0.15": diff --git a/recipes/zxing-cpp/all/CMakeLists.txt b/recipes/zxing-cpp/all/CMakeLists.txt deleted file mode 100644 index a465612005359..0000000000000 --- a/recipes/zxing-cpp/all/CMakeLists.txt +++ /dev/null @@ -1,11 +0,0 @@ -cmake_minimum_required(VERSION 3.4) -project(cmake_wrapper) - -include(conanbuildinfo.cmake) -conan_basic_setup(KEEP_RPATHS) - -if(WIN32 AND BUILD_SHARED_LIBS) - set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON) -endif() - -add_subdirectory(source_subfolder) diff --git a/recipes/zxing-cpp/all/conandata.yml b/recipes/zxing-cpp/all/conandata.yml index 69d8a5f626180..baac1087c0b36 100644 --- a/recipes/zxing-cpp/all/conandata.yml +++ b/recipes/zxing-cpp/all/conandata.yml @@ -1,25 +1,33 @@ sources: + "2.0.0": + url: "https://github.com/zxing-cpp/zxing-cpp/archive/v2.0.0.tar.gz" + sha256: "12b76b7005c30d34265fc20356d340da179b0b4d43d2c1b35bcca86776069f76" "1.4.0": - url: "https://github.com/nu-book/zxing-cpp/archive/v1.4.0.tar.gz" + url: "https://github.com/zxing-cpp/zxing-cpp/archive/v1.4.0.tar.gz" sha256: "126767bb56f8a1f25ae84d233db2e9b9be50d71f5776092d0e170ca0f0ed1862" "1.3.0": - url: "https://github.com/nu-book/zxing-cpp/archive/v1.3.0.tar.gz" + url: "https://github.com/zxing-cpp/zxing-cpp/archive/v1.3.0.tar.gz" sha256: "bfd8fc706def30e34f96088b5a7afdbe0917831e57a774d34e3ee864b01c6891" "1.0.8": - url: "https://github.com/nu-book/zxing-cpp/archive/v1.0.8.tar.gz" + url: "https://github.com/zxing-cpp/zxing-cpp/archive/v1.0.8.tar.gz" sha256: "9154b5456904e47bd4c38462d57e4b7897bfb20cb2bc2e8c958453e40e73c8b2" patches: "1.4.0": # core/ByteArray checks `__cpp_lib_string_view` for using string_view. # But some compilers(ex. gcc 7.2) don't support `__cpp_lib_string_view` but support string_view. - patch_file: "patches/1.4.0-0001-fix-string-view.patch" - base_path: "source_subfolder" + patch_description: "fix compilation error for string_view on several compilers" + patch_type: "portability" "1.0.8": - patch_file: "patches/1.0.8-0001-Fix-C2327-for-MSVC-2015.patch" - base_path: "source_subfolder" + patch_description: "fix compilation error C2327 on MSVC 2015" + patch_type: "portability" - patch_file: "patches/1.0.8-0002-include-limits.patch" - base_path: "source_subfolder" + patch_description: "include limits" + patch_type: "portability" - patch_file: "patches/1.0.8-0003-include-stdexcept.patch" - base_path: "source_subfolder" + patch_description: "include stdexcept" + patch_type: "portability" - patch_file: "patches/1.0.8-0004-include-cstddef.patch" - base_path: "source_subfolder" + patch_description: "include cstddef" + patch_type: "portability" diff --git a/recipes/zxing-cpp/all/conanfile.py b/recipes/zxing-cpp/all/conanfile.py index b5e0b276dbb87..2dd711e9b0caf 100644 --- a/recipes/zxing-cpp/all/conanfile.py +++ b/recipes/zxing-cpp/all/conanfile.py @@ -1,18 +1,20 @@ -from conans import ConanFile, tools, CMake -from conans.errors import ConanInvalidConfiguration -from conan.tools.microsoft import is_msvc, is_msvc_static_runtime -import functools +from conan import ConanFile +from conan.errors import ConanInvalidConfiguration +from conan.tools.microsoft import is_msvc_static_runtime, is_msvc +from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir +from conan.tools.build import check_min_cppstd +from conan.tools.scm import Version +from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout import os -required_conan_version = ">=1.43.0" - +required_conan_version = ">=1.53.0" class ZXingCppConan(ConanFile): name = "zxing-cpp" description = "C++ port of ZXing, a barcode scanning library" license = "Apache-2.0" url = "https://github.com/conan-io/conan-center-index" - homepage = "https://github.com/nu-book/zxing-cpp" + homepage = "https://github.com/zxing-cpp/zxing-cpp" topics = ("zxing", "barcode", "scanner", "generator") settings = "os", "arch", "compiler", "build_type" @@ -29,37 +31,27 @@ class ZXingCppConan(ConanFile): "enable_decoders": True, } - generators = "cmake" - - @property - def _source_subfolder(self): - return "source_subfolder" - - @property - def _build_subfolder(self): - return "build_subfolder" - @property def _compiler_cpp_support(self): return { "14" : { "gcc": "5", "Visual Studio": "14", + "msvc": "190", "clang": "3.4", "apple-clang": "3.4", }, "17" : { - "gcc": "7", + "gcc": "7" if Version(self.version) < "2.0.0" else "8", "Visual Studio": "16", - "clang": "5", - "apple-clang": "5", + "msvc": "192", + "clang": "5" if Version(self.version) < "2.0.0" else "7", + "apple-clang": "5" if Version(self.version) < "2.0.0" else "12", } } def export_sources(self): - self.copy("CMakeLists.txt") - for patch in self.conan_data.get("patches", {}).get(self.version, []): - self.copy(patch["patch_file"]) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -67,62 +59,61 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC + self.options.rm_safe("fPIC") + + def layout(self): + cmake_layout(self, src_folder="src") def validate(self): - cpp_version = 17 if tools.Version(self.version) >= "1.2.0" else 14 + cpp_version = 17 if Version(self.version) >= "1.2.0" else 14 if self.settings.compiler.get_safe("cppstd"): - tools.check_min_cppstd(self, cpp_version) + check_min_cppstd(self, cpp_version) min_version = self._compiler_cpp_support.get(str(cpp_version)).get(str(self.settings.compiler)) - - if min_version and tools.Version(self.settings.compiler.version) < min_version: - raise ConanInvalidConfiguration( - "This compiler is too old. {} needs a compiler with c++{} support".format(self.name, cpp_version) - ) + if min_version and Version(self.settings.compiler.version) < min_version: + raise ConanInvalidConfiguration(f"This compiler is too old. {self.ref} needs a compiler with c++{cpp_version} support") # FIXME: This is a workaround for "The system cannot execute the specified program." - if tools.Version(self.version) >= "1.3.0" and is_msvc_static_runtime(self) and self.settings.build_type == "Debug": - raise ConanInvalidConfiguration("{}/{} doesn't support MT + Debug.".format(self.name, self.version)) + if Version(self.version) >= "1.3.0" and is_msvc_static_runtime(self) and self.settings.build_type == "Debug": + raise ConanInvalidConfiguration(f"{self.ref} doesn't support MT + Debug.") def source(self): - tools.get(**self.conan_data["sources"][self.version], - destination=self._source_subfolder, strip_root=True) - - @functools.lru_cache(1) - def _configure_cmake(self): - cmake = CMake(self) - if tools.Version(self.version) < "1.1": - cmake.definitions["ENABLE_ENCODERS"] = self.options.enable_encoders - cmake.definitions["ENABLE_DECODERS"] = self.options.enable_decoders + get(self, **self.conan_data["sources"][self.version], strip_root=True) + + def generate(self): + tc = CMakeToolchain(self) + tc.variables["CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS"] = True + if Version(self.version) < "1.1": + tc.variables["ENABLE_ENCODERS"] = self.options.enable_encoders + tc.variables["ENABLE_DECODERS"] = self.options.enable_decoders + tc.variables["BUILD_SHARED_LIBRARY"] = self.options.shared else: - cmake.definitions["BUILD_WRITERS"] = self.options.enable_encoders - cmake.definitions["BUILD_READERS"] = self.options.enable_decoders - cmake.definitions["BUILD_EXAMPLES"] = False - cmake.definitions["BUILD_BLACKBOX_TESTS"] = False + tc.variables["BUILD_WRITERS"] = self.options.enable_encoders + tc.variables["BUILD_READERS"] = self.options.enable_decoders + tc.variables["BUILD_EXAMPLES"] = False + tc.variables["BUILD_BLACKBOX_TESTS"] = False if is_msvc(self): - cmake.definitions["LINK_CPP_STATICALLY"] = "MT" in str(self.settings.compiler.runtime) - cmake.configure(build_folder=self._build_subfolder) - return cmake + tc.variables["LINK_CPP_STATICALLY"] = is_msvc_static_runtime(self) + tc.generate() def build(self): - for patch in self.conan_data.get("patches", {}).get(self.version, []): - tools.patch(**patch) - cmake = self._configure_cmake() + apply_conandata_patches(self) + cmake = CMake(self) + cmake.configure() cmake.build() def package(self): - self.copy(pattern="LICENSE*", src=self._source_subfolder, dst="licenses") - cmake = self._configure_cmake() + copy(self, pattern="LICENSE", dst=os.path.join(self.package_folder, "licenses"), src=self.source_folder) + cmake = CMake(self) cmake.install() - tools.rmdir(os.path.join(self.package_folder, "lib", "cmake")) - tools.rmdir(os.path.join(self.package_folder, "lib", "pkgconfig")) + rmdir(self, os.path.join(self.package_folder, "lib", "cmake")) + rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig")) def package_info(self): self.cpp_info.set_property("cmake_file_name", "ZXing") self.cpp_info.set_property("cmake_target_name", "ZXing::ZXing") self.cpp_info.set_property("pkg_config_name", "zxing") - self.cpp_info.libs = ["ZXingCore" if tools.Version(self.version) < "1.1" else "ZXing"] + self.cpp_info.libs = ["ZXingCore" if Version(self.version) < "1.1" else "ZXing"] if self.settings.os in ["Linux", "FreeBSD"]: self.cpp_info.system_libs = ["pthread", "m"] diff --git a/recipes/zxing-cpp/all/test_package/CMakeLists.txt b/recipes/zxing-cpp/all/test_package/CMakeLists.txt index 45f25b99a6fd5..c81d383dece63 100644 --- a/recipes/zxing-cpp/all/test_package/CMakeLists.txt +++ b/recipes/zxing-cpp/all/test_package/CMakeLists.txt @@ -1,16 +1,20 @@ cmake_minimum_required(VERSION 3.8) -project(test_package) - -include("${CMAKE_BINARY_DIR}/conanbuildinfo.cmake") -conan_basic_setup(TARGETS) +project(test_package LANGUAGES CXX) find_package(ZXing REQUIRED CONFIG) find_package(stb REQUIRED CONFIG) if (ZXing_VERSION VERSION_LESS "1.1.0") add_executable(${PROJECT_NAME} test_package.cpp) -else() +elseif (ZXing_VERSION VERSION_LESS "2.0.0") add_executable(${PROJECT_NAME} test_package_1.1.cpp) +else() + add_executable(${PROJECT_NAME} test_package_2.0.cpp) +endif() +target_link_libraries(${PROJECT_NAME} PRIVATE ZXing::ZXing stb::stb) + +if (ZXing_VERSION VERSION_LESS "2.0.0") + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) +else() + target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_17) endif() -target_link_libraries(${PROJECT_NAME} ZXing::ZXing stb::stb) -target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14) diff --git a/recipes/zxing-cpp/all/test_package/conanfile.py b/recipes/zxing-cpp/all/test_package/conanfile.py index 617b69931fb4c..9ba1684044ebf 100644 --- a/recipes/zxing-cpp/all/test_package/conanfile.py +++ b/recipes/zxing-cpp/all/test_package/conanfile.py @@ -1,13 +1,19 @@ -from conans import ConanFile, CMake, tools +from conan import ConanFile +from conan.tools.build import can_run +from conan.tools.cmake import cmake_layout, CMake import os - class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" - generators = "cmake", "cmake_find_package_multi" + generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv" + test_type = "explicit" def requirements(self): - self.requires("stb/cci.20210910") + self.requires("stb/cci.20220909") + self.requires(self.tested_reference_str) + + def layout(self): + cmake_layout(self) def build(self): cmake = CMake(self) @@ -15,12 +21,12 @@ def build(self): cmake.build() def test(self): - if not tools.cross_building(self): + if can_run(self): try: os.unlink("output.png") except FileNotFoundError: pass - bin_path = os.path.join("bin", "test_package") - self.run(bin_path, run_environment=True) + bin_path = os.path.join(self.cpp.build.bindirs[0], "test_package") + self.run(bin_path, env="conanrun") assert os.path.isfile("output.png") diff --git a/recipes/zxing-cpp/all/test_package/test_package_2.0.cpp b/recipes/zxing-cpp/all/test_package/test_package_2.0.cpp new file mode 100644 index 0000000000000..7f93ccdbfcc59 --- /dev/null +++ b/recipes/zxing-cpp/all/test_package/test_package_2.0.cpp @@ -0,0 +1,45 @@ +#include "ZXing/BarcodeFormat.h" +#include "ZXing/BitMatrix.h" +#include "ZXing/BitMatrixIO.h" +#include "ZXing/CharacterSet.h" +#include "ZXing/MultiFormatWriter.h" + +#include +#include +#include +#include +#include +#include + +#define STB_IMAGE_WRITE_IMPLEMENTATION +#include + +using namespace ZXing; + +int main(int argc, char* argv[]) +{ + int width = 100, height = 100; + int margin = 10; + int eccLevel = 8; + auto encoding = CharacterSet::Unknown; + auto format = BarcodeFormat::QRCode; + std::string text = "Hello conan world!"; + std::string outPath = "output.png"; + + try { + auto writer = MultiFormatWriter(format).setMargin(margin).setEncoding(encoding).setEccLevel(eccLevel); + auto matrix = writer.encode(text, width, height); + auto bitmap = ToMatrix(matrix); + + int success = stbi_write_png(outPath.c_str(), bitmap.width(), bitmap.height(), 1, bitmap.data(), 0); + if (!success) { + std::cerr << "Failed to write image: " << outPath << std::endl; + return -1; + } + } catch (const std::exception& e) { + std::cerr << e.what() << std::endl; + return -1; + } + + return 0; +} diff --git a/recipes/zxing-cpp/all/test_v1_package/CMakeLists.txt b/recipes/zxing-cpp/all/test_v1_package/CMakeLists.txt new file mode 100644 index 0000000000000..be00a8c7f57c7 --- /dev/null +++ b/recipes/zxing-cpp/all/test_v1_package/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.8) +project(test_package) + +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package/ + ${CMAKE_CURRENT_BINARY_DIR}/test_package/) diff --git a/recipes/zxing-cpp/all/test_v1_package/conanfile.py b/recipes/zxing-cpp/all/test_v1_package/conanfile.py new file mode 100644 index 0000000000000..030ecca50ee45 --- /dev/null +++ b/recipes/zxing-cpp/all/test_v1_package/conanfile.py @@ -0,0 +1,27 @@ +from conans import ConanFile, CMake +from conan.tools.build import cross_building +import os + + +class TestPackageV1Conan(ConanFile): + settings = "os", "arch", "compiler", "build_type" + generators = "cmake", "cmake_find_package_multi" + + def requirements(self): + self.requires("stb/cci.20220909") + + def build(self): + cmake = CMake(self) + cmake.configure() + cmake.build() + + def test(self): + if not cross_building(self): + try: + os.unlink("output.png") + except FileNotFoundError: + pass + bin_path = os.path.join("bin", "test_package") + self.run(bin_path, run_environment=True) + + assert os.path.isfile("output.png") diff --git a/recipes/zxing-cpp/config.yml b/recipes/zxing-cpp/config.yml index 778dac07cb8fa..a4e6ca74f0f31 100644 --- a/recipes/zxing-cpp/config.yml +++ b/recipes/zxing-cpp/config.yml @@ -1,4 +1,6 @@ versions: + "2.0.0": + folder: all "1.4.0": folder: all "1.3.0": diff --git a/recipes/zziplib/all/conandata.yml b/recipes/zziplib/all/conandata.yml index ecd827e092001..2b47b2bf41c26 100644 --- a/recipes/zziplib/all/conandata.yml +++ b/recipes/zziplib/all/conandata.yml @@ -1,7 +1,16 @@ sources: + "0.13.72": + url: "https://github.com/gdraheim/zziplib/archive/v0.13.72.tar.gz" + sha256: "93ef44bf1f1ea24fc66080426a469df82fa631d13ca3b2e4abaeab89538518dc" "0.13.71": url: "https://github.com/gdraheim/zziplib/archive/v0.13.71.tar.gz" sha256: "2ee1e0fbbb78ec7cc46bde5b62857bc51f8d665dd265577cf93584344b8b9de2" patches: + "0.13.72": + - patch_file: "patches/0.13.72-001_fix.patch" + patch_description: "fix install path" + patch_type: "conan" "0.13.71": - - patch_file: "patches/001_fix.patch" + - patch_file: "patches/0.13.71-001_fix.patch" + patch_description: "fix install path" + patch_type: "conan" diff --git a/recipes/zziplib/all/conanfile.py b/recipes/zziplib/all/conanfile.py index 6e35963342564..140fd9378eebd 100644 --- a/recipes/zziplib/all/conanfile.py +++ b/recipes/zziplib/all/conanfile.py @@ -1,11 +1,11 @@ from conan import ConanFile from conan.tools.apple import is_apple_os from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout -from conan.tools.files import apply_conandata_patches, copy, get, rmdir +from conan.tools.files import apply_conandata_patches, copy, export_conandata_patches, get, rmdir from conan.tools.scm import Version import os -required_conan_version = ">=1.51.3" +required_conan_version = ">=1.53.0" class ZziplibConan(ConanFile): @@ -33,8 +33,7 @@ class ZziplibConan(ConanFile): } def export_sources(self): - for p in self.conan_data.get("patches", {}).get(self.version, []): - copy(self, p["patch_file"], self.recipe_folder, self.export_sources_folder) + export_conandata_patches(self) def config_options(self): if self.settings.os == "Windows": @@ -42,22 +41,16 @@ def config_options(self): def configure(self): if self.options.shared: - del self.options.fPIC - try: - del self.settings.compiler.libcxx - except Exception: - pass - try: - del self.settings.compiler.cppstd - except Exception: - pass - - def requirements(self): - self.requires("zlib/1.2.12") + self.options.rm_safe("fPIC") + self.settings.rm_safe("compiler.cppstd") + self.settings.rm_safe("compiler.libcxx") def layout(self): cmake_layout(self, src_folder="src") + def requirements(self): + self.requires("zlib/1.2.13") + def source(self): get(self, **self.conan_data["sources"][self.version], destination=self.source_folder, strip_root=True) @@ -108,12 +101,18 @@ def package_info(self): # libzzipmmapped if self.options.zzipmapped: self.cpp_info.components["zzipmmapped"].set_property("pkg_config_name", "zzipmmapped") - self.cpp_info.components["zzipmmapped"].libs = [f"zzipmmapped{suffix}"] + if Version(self.version) >= "0.13.72" and self.options.shared and is_apple_os(self): + self.cpp_info.components["zzipmmapped"].libs = [f"zzipmmapped"] + else: + self.cpp_info.components["zzipmmapped"].libs = [f"zzipmmapped{suffix}"] self.cpp_info.components["zzipmmapped"].requires = ["zlib::zlib"] # libzzipfseeko if self.options.zzipfseeko: self.cpp_info.components["zzipfseeko"].set_property("pkg_config_name", "zzipfseeko") - self.cpp_info.components["zzipfseeko"].libs = [f"zzipfseeko{suffix}"] + if Version(self.version) >= "0.13.72" and self.options.shared and is_apple_os(self): + self.cpp_info.components["zzipfseeko"].libs = [f"zzipfseeko"] + else: + self.cpp_info.components["zzipfseeko"].libs = [f"zzipfseeko{suffix}"] self.cpp_info.components["zzipfseeko"].requires = ["zlib::zlib"] # libzzipwrap if self.options.zzipwrap: diff --git a/recipes/zziplib/all/patches/001_fix.patch b/recipes/zziplib/all/patches/0.13.71-001_fix.patch similarity index 100% rename from recipes/zziplib/all/patches/001_fix.patch rename to recipes/zziplib/all/patches/0.13.71-001_fix.patch diff --git a/recipes/zziplib/all/patches/0.13.72-001_fix.patch b/recipes/zziplib/all/patches/0.13.72-001_fix.patch new file mode 100644 index 0000000000000..594dc765e9691 --- /dev/null +++ b/recipes/zziplib/all/patches/0.13.72-001_fix.patch @@ -0,0 +1,12 @@ +diff --git a/a/zzipwrap/CMakeLists.txt b/b/zzipwrap/CMakeLists.txt +index ea7ea93..39de22f 100644 +--- a/a/zzipwrap/CMakeLists.txt ++++ b/b/zzipwrap/CMakeLists.txt +@@ -84,6 +84,7 @@ endif() + + install(FILES ${libzzipwrap_HDRS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/zzip ) + install(TARGETS libzzipwrap ++ RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + diff --git a/recipes/zziplib/all/test_package/conanfile.py b/recipes/zziplib/all/test_package/conanfile.py index d120a992c06a6..0a6bc68712d90 100644 --- a/recipes/zziplib/all/test_package/conanfile.py +++ b/recipes/zziplib/all/test_package/conanfile.py @@ -7,13 +7,14 @@ class TestPackageConan(ConanFile): settings = "os", "arch", "compiler", "build_type" generators = "CMakeToolchain", "CMakeDeps", "VirtualRunEnv" - - def requirements(self): - self.requires(self.tested_reference_str) + test_type = "explicit" def layout(self): cmake_layout(self) + def requirements(self): + self.requires(self.tested_reference_str) + def build(self): cmake = CMake(self) cmake.configure() diff --git a/recipes/zziplib/all/test_v1_package/CMakeLists.txt b/recipes/zziplib/all/test_v1_package/CMakeLists.txt index 7230beb5ea594..0d20897301b68 100644 --- a/recipes/zziplib/all/test_v1_package/CMakeLists.txt +++ b/recipes/zziplib/all/test_v1_package/CMakeLists.txt @@ -1,10 +1,8 @@ cmake_minimum_required(VERSION 3.1) -project(test_package LANGUAGES C) +project(test_package) include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) conan_basic_setup(TARGETS) -find_package(zziplib REQUIRED CONFIG) - -add_executable(${PROJECT_NAME} ../test_package/test_package.c) -target_link_libraries(${PROJECT_NAME} PRIVATE zziplib::zziplib) +add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../test_package + ${CMAKE_CURRENT_BINARY_DIR}/test_package) diff --git a/recipes/zziplib/config.yml b/recipes/zziplib/config.yml index c4caf3e67df7c..68a29e739876a 100644 --- a/recipes/zziplib/config.yml +++ b/recipes/zziplib/config.yml @@ -1,3 +1,5 @@ versions: + "0.13.72": + folder: all "0.13.71": folder: all